From 64f02e3e5cbd20af19a0089553db5ee5c7d5eca1 Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Wed, 17 Apr 2002 00:00:00 +0200
Subject: stable 2002.04.17

---
 tex/context/base/cont-new.tex | 205 ++++++++++++++---
 tex/context/base/context.tex  |  10 +-
 tex/context/base/core-con.tex |  44 ++--
 tex/context/base/core-dat.tex |   3 +-
 tex/context/base/core-fig.tex |  67 +++---
 tex/context/base/core-fld.tex |   2 +-
 tex/context/base/core-fnt.tex |  20 +-
 tex/context/base/core-grd.tex | 316 +++++++++++++-------------
 tex/context/base/core-hlp.tex |  67 +++---
 tex/context/base/core-ins.tex |  90 ++++++++
 tex/context/base/core-int.tex |  74 ++++--
 tex/context/base/core-job.tex |   2 +-
 tex/context/base/core-lst.tex | 123 +++++++---
 tex/context/base/core-mat.tex |   6 +-
 tex/context/base/core-mis.tex | 507 +++++++++++++++++++++++++-----------------
 tex/context/base/core-nav.tex |   1 +
 tex/context/base/core-new.tex |  58 -----
 tex/context/base/core-not.tex |  39 +++-
 tex/context/base/core-pos.tex | 150 ++++++++-----
 tex/context/base/core-ref.tex | 146 +++++++++---
 tex/context/base/core-reg.tex |  84 ++-----
 tex/context/base/core-rul.tex |  26 ++-
 tex/context/base/core-sec.tex | 254 ++++++++++++++-------
 tex/context/base/core-spa.tex | 133 ++++++-----
 tex/context/base/core-tbl.tex |  52 +++--
 tex/context/base/core-uti.tex | 145 +++++++++---
 tex/context/base/core-var.tex |   4 +
 tex/context/base/core-ver.tex |  23 +-
 tex/context/base/enco-ini.tex |  17 +-
 tex/context/base/font-ini.tex |   6 +-
 tex/context/base/font-run.tex |   8 +-
 tex/context/base/hand-ini.tex |  34 ++-
 tex/context/base/java-fld.tex |  16 +-
 tex/context/base/java-ini.tex |   2 +-
 tex/context/base/lang-ini.tex |  95 +++-----
 tex/context/base/lang-ita.tex |  17 +-
 tex/context/base/lang-spa.tex |  73 ++++++
 tex/context/base/m-units.tex  |   2 +-
 tex/context/base/meta-fig.tex |  10 +-
 tex/context/base/meta-ini.tex |   4 +-
 tex/context/base/mult-com.tex |  52 +++--
 tex/context/base/mult-con.tex | 116 +++++-----
 tex/context/base/page-app.tex |   1 +
 tex/context/base/page-flt.tex | 313 ++++++++++++--------------
 tex/context/base/page-imp.tex |   1 +
 tex/context/base/page-ini.tex |  76 ++++---
 tex/context/base/page-lay.tex | 126 ++++++++++-
 tex/context/base/page-lin.tex |  78 ++++---
 tex/context/base/page-mar.tex |  20 +-
 tex/context/base/page-mul.tex | 159 +++----------
 tex/context/base/page-not.tex | 117 ++++++++++
 tex/context/base/page-num.tex |  55 +++--
 tex/context/base/page-one.tex |  14 +-
 tex/context/base/page-set.tex |  62 ++----
 tex/context/base/page-sid.tex |  53 +++--
 tex/context/base/page-txt.tex |  27 ++-
 tex/context/base/ppchtex.tex  |  28 ++-
 tex/context/base/s-abr-01.tex |   1 +
 tex/context/base/setupa.tex   |  36 +--
 tex/context/base/setupb.tex   |  42 +++-
 tex/context/base/spec-def.tex |  17 +-
 tex/context/base/spec-dpm.tex |   8 +-
 tex/context/base/spec-fdf.tex | 135 ++++++++++-
 tex/context/base/spec-pdf.tex |   6 +-
 tex/context/base/spec-tpd.tex |  34 ++-
 tex/context/base/supp-box.tex |  16 +-
 tex/context/base/supp-fil.tex |  97 ++++----
 tex/context/base/supp-lan.tex | 477 +++++++++++++++++++++++----------------
 tex/context/base/supp-mps.tex |  10 +-
 tex/context/base/supp-num.tex |   2 +-
 tex/context/base/syst-ext.tex |  18 +-
 tex/context/base/syst-gen.tex |  68 +++++-
 tex/context/base/type-ini.tex |   9 +-
 tex/context/base/type-pre.tex |   4 -
 tex/context/base/xtag-ext.tex |  30 ++-
 tex/context/base/xtag-ini.tex |  39 +++-
 tex/context/base/xtag-map.tex |  65 ++++--
 tex/context/base/xtag-pre.tex |   2 +-
 78 files changed, 3435 insertions(+), 1914 deletions(-)
 create mode 100644 tex/context/base/core-ins.tex
 create mode 100644 tex/context/base/lang-spa.tex
 create mode 100644 tex/context/base/page-not.tex

(limited to 'tex')

diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 49fcde411..7c918b33e 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -17,8 +17,171 @@
 %D excellent place for hacks and new features.
 
 \unprotect
+
+
+\def\woordrechts % zie naw 
+  {\groupedcommand
+     {\hfill\allowbreak\strut\hfill\hbox}
+     {\parfillskip\zeropoint\par}}
+
+\def\startkolomopmaak
+  {\bgroup
+   \getnoflines\vsize
+   \scratchdimen\noflines\lineheight
+   \vbox to \scratchdimen\bgroup}
+
+\def\stopkolomopmaak
+  {\vss % niet meer aanpassen 
+   \egroup
+   \egroup}
+
+% transparency ! 
+
+\def\dodoglobalstopcolor
+  {\ifcase\colorlevel \else
+     \donoglobalstopcolor
+     \global\@EA\let\@EA\previouscolor\csname\@@currentcolorname\endcsname
+     \ifcase\colorlevel\relax
+       \docolormark\empty
+       \dostoptransparency
+       \dostopcolormode
+     \else % let's do a bit redundant testing here
+       \docolormark\previouscolor
+       \ifx\previouscolor\empty
+         \dostoptransparency
+         \dostopcolormode
+       \else
+         \doifcolorelse\previouscolor
+           {\ifx\currentcolor\previouscolor\else
+% alternatively we could let \startcolormode handle this 
+\dostoptransparency % really needed 
+%\dostopcolormode % less safe but more efficient 
+              \startcolormode\previouscolor
+            \fi}
+           {\dostoptransparency
+            \dostopcolormode}%
+       \fi
+     \fi
+   \fi}
+
+\unexpanded\def\placeheadtext
+  {\doquintupleempty\doplaceheadtextornumber
+     [\c!tekstletter][\c!tekstkleur][\empty]}
+
+\unexpanded\def\placeheadnumber
+  {\doquintupleempty\doplaceheadtextornumber
+     [\c!nummerletter][\c!nummerkleur][\v!nummer]}
+
+\def\doplaceheadtextornumber[#1][#2][#3][#4][#5]%
+  {\bgroup
+   \edef\@@sectie{\??ko\iffifthargument#5\else#4\fi}%
+   \dostartattributes\@@sectie\c!letter\c!kleur\empty
+     \dontconvertfont
+     \dostartattributes\@@sectie#1#2\empty
+       \stelinterliniein % \setupinterlinespace
+       \begstrut\getmarking[\hoofdmarkering{#4#3}]\endstrut
+       \endgraf
+     \dostopattributes
+   \dostopattributes
+   \egroup}
+
+\def\doplaatskoptekst#1#2#3#4%
+  {\beginheadplacement{#1}%
+   \iflegekop
+     \setbox0\ifvertical\vbox\else\hbox\fi to \zeropoint
+       {\headnumbercontentfalse
+        \resetsystemmode\v!sectienummer
+        #2}%
+     \makestrutofbox0
+   \else
+     \setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox
+       {\headnumbercontentfalse
+        \resetsystemmode\v!sectienummer
+        % outerside font determines distance
+        \dosetfontattribute{\??ko#1}\c!letter
+        % but we don't want color to influence user commands 
+        \getvalue{\??ko#1\c!commando}        
+          {} % no number
+          {\dostartattributes{\??ko#1}\c!letter\c!kleur\empty 
+             \dostartattributes{\??ko#1}\c!tekstletter\c!tekstkleur\empty
+               \dontconvertfont
+               \ifdisplaysectionhead
+                 \stelinterliniein
+               \else
+                 \stelspatieringin
+               \fi
+               #2%
+               \getvalue{\??ko#1\c!voorcommando}%
+               \ifdisplaysectionhead
+                 \getvalue{\??ko#1\c!tekstcommando}%
+                   {\setstrut\begstrut#3\endstrut}%
+                 \xdef\localheaddepth{\the\dp\strutbox}%
+               \else
+                 \getvalue{\??ko#1\c!tekstcommando}{#3}%
+               \fi
+               \getvalue{\??ko#1\c!nacommando}%
+               \ifdisplaysectionhead\endgraf\fi
+             \dostopattributes
+          \dostopattributes}}%  
+   \fi  
+   \endheadplacement{#1}{#4}}
+
+\def\doplaatskopnummertekst#1#2#3#4#5%
+  {\beginheadplacement{#1}%
+   \iflegekop
+     \setbox0\ifvertical\vbox\else\hbox\fi to \zeropoint
+       {\doiftextelse{#3}
+          {\setsystemmode  \v!sectienummer\headnumbercontenttrue }
+          {\resetsystemmode\v!sectienummer\headnumbercontentfalse}%
+        #2}%
+     \makestrutofbox0
+   \else
+     \setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox
+       {\doiftextelse{#3}
+          {\setsystemmode  \v!sectienummer\headnumbercontenttrue }
+          {\resetsystemmode\v!sectienummer\headnumbercontentfalse}%
+        % outerside font determines distance
+        \dosetfontattribute{\??ko#1}\c!letter
+        % but we don't want color to influence user commands 
+        \getvalue{\??ko#1\c!commando}%
+          {\dostartattributes{\??ko#1}\c!letter\c!kleur\empty
+             \dostartattributes{\??ko#1}\c!nummerletter\c!nummerkleur\empty
+               \getvalue{\??ko#1\c!voorcommando}%
+               \ifdisplaysectionhead
+                 \getvalue{\??ko#1\c!nummercommando}%
+                   {\setstrut\begstrut#3\endstrut}%
+               \else
+                 \getvalue{\??ko#1\c!nummercommando}{#3}%
+               \fi
+             \dostopattributes
+           \dostopattributes}
+          {\dostartattributes{\??ko#1}\c!letter\c!kleur\empty
+             \dostartattributes{\??ko#1}\c!tekstletter\c!tekstkleur\empty
+               \dontconvertfont
+               \ifdisplaysectionhead
+                 \stelinterliniein
+               \else
+                 \stelspatieringin
+               \fi
+               #2%
+               \ifdisplaysectionhead
+                 \getvalue{\??ko#1\c!tekstcommando}%
+                   {\setstrut\begstrut#4\endstrut}%
+                 \xdef\localheaddepth{\the\dp\strutbox}%
+               \else
+                 \getvalue{\??ko#1\c!tekstcommando}{#4}%
+               \fi
+               \getvalue{\??ko#1\c!nacommando}%
+               \ifdisplaysectionhead\endgraf\fi
+           \dostopattributes
+          \dostopattributes}}%
+   \fi
+   \endheadplacement{#1}{#5}}
+
 
 \writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!}
+
+% todo : hoe komt box er uit 
 
 % \def\@@itemcounter {\s!itemcount} -> non nested continue 
 %
@@ -58,22 +221,6 @@
    \doanalyzefigurefiles\doanalyzefigurefilesB
    \doanalyzefigurefiles\doanalyzefigurefilesC}
 
-\def\dodefineexternalfigure[#1][#2]%
-  {\setvalue{\??ef\??ef#1}%
-     {\doplaceexternalfigure[\dopresetfigure][#1][][#2][]}}
-
-\def\defineexternalfigure
-  {\dodoubleargument\dodefineexternalfigure}
-
-\def\dodoplaceexternalfigure[#1][#2][#3][#4][#5][#6]%
-  {\doifsomething{#3}% catches \defineexternalfigure dummies
-     {\bgroup
-      \def\textunderscore{_}% brrr, temp hack  
-      \calculateexternalfigure[#1][#2][#3][#4][#5][#6]%
-      \calculateexternalscreenfigure[#1][#2][#3][#4][#5][#6]%
-      \box\foundexternalfigure
-      \egroup}}
-
 \definesystemvariable {bl} % bleeding
 
 \newcounter\nofbleeds % per pag 
@@ -515,8 +662,7 @@
 
 \appendtoks\insertparagraphintro\to\everypar
 
-%D \starttext
-%D
+%D \starttypen
 %D \setupparagraphintro[first][\hbox to 3.5em{\tt FIRST \hss}]
 %D \setupparagraphintro[first][\hbox to 3.5em{\tt TSRIF \hss}]
 %D \setupparagraphintro[next] [\hbox to 3.5em{\tt NEXT  \hss}]
@@ -535,8 +681,7 @@
 %D some paragraph \par
 %D some paragraph \par
 %D some paragraph \par
-%D
-%D \stoptext
+%D \stoptypen
 
 \def\@@themaintextcolor{themaintextcolor}
 
@@ -810,13 +955,13 @@
    \hfil
    &}
 
-%D \starttable[|||]
-%D \HL
-%D \VL test \VS test \VL \FR
-%D \VL test \VD test \VL \MR
-%D \VL test \VT test \VL \LR
-%D \HL
-%D \stoptable
+% \starttable[|||]
+% \HL
+% \VL test \VS test \VL \FR
+% \VL test \VD test \VL \MR
+% \VL test \VT test \VL \LR
+% \HL
+% \stoptable
 
 %D To be documented, \type {\includemenu[menu]}.
 %D To be documented, \type {\emphbf} cum suis.
@@ -877,11 +1022,6 @@
 \def\doifstrategyvariable   #1#2{\doifstrategyvariableelse{#1}{#2}{}}
 \def\doifnotstrategyvariable#1#2{\doifstrategyvariableelse{#1}{}{#2}}
 
-\let\definieerkolomgroep\definecolumnset
-\let\stelkolomgroepin   \setupcolumnset
-\let\startkolomgroep    \startcolumnset
-\let\stopkolomgroep     \stopcolumnset
-
 %D New: only at start of columns; may change ! Rather
 %D interwoven and therefore to be integrated when the multi
 %D column modules are merged.
@@ -981,3 +1121,4 @@
 \readfile {cont-loc} {} {}
 
 \endinput
+
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 0ee260743..2e65ebc2f 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -15,7 +15,7 @@
 
 \catcode`\{=1 \catcode`\}=2 
 
-\def\contextversion{2002.3.27}
+\def\contextversion{2002.4.17}
 
 %D Welcome to the main module. When this module is ran through
 %D \type{initex} or \type{tex -i} or \type{whatevertex} using
@@ -99,9 +99,10 @@
 
 %D When loading the font, color and special modules, we need a
 %D bit more advanced file handling as well as some general
-%D variables, so next we load:
+%D variables, and features, so next we load:
 
 \input core-var.tex
+\input core-ins.tex
 \input core-fil.tex
 
 %D We already need some synonyms (patterns). At runtime this 
@@ -191,6 +192,7 @@
 % experimental otr 
 
 \input page-ini.tex 
+\input page-not.tex 
 \input page-one.tex 
 \input page-lay.tex 
 \input page-log.tex
@@ -265,6 +267,10 @@
 \input core-fig.tex % after page body 
 \input core-par.tex
 
+%D Language specific spacing. 
+
+\input lang-spa.tex
+
 %D Only the basic XML parser and remapper are part of the core. 
 %D These macrosa re loaded last since they overload and|/|or
 %D extend previously defined ones. 
diff --git a/tex/context/base/core-con.tex b/tex/context/base/core-con.tex
index 927a94f0f..165701a24 100644
--- a/tex/context/base/core-con.tex
+++ b/tex/context/base/core-con.tex
@@ -471,17 +471,26 @@
 
 \def\kenmerkdatumpatroon{j,mm,dd} % jj,mm,dd changed at januari 1-1-2000 
 
+\newsignal\datesignal
+
+\def\dobetweendates%
+  {\ifdim\lastskip=\datesignal\relax\else
+     \unskip\space
+     \hskip\datesignal\relax
+   \fi}
+
 % \def\complexcurrentdate[#1]%
 %   {\bgroup
 %    \let\labellanguage\currentlanguage
-%    \def\betweendates{\let\betweendates\space}%
+%    \def\betweendates{\let\betweendates\dobetweendates}%
 %    \lowercase{\edef\!!stringa{#1}}% permits usage in \kap 
 %    \@EA\processallactionsinset\@EA
 %      [\!!stringa]
 %      [    \v!dag=>\betweendates\the\normalday,
 %         \v!maand=>\betweendates\month\normalmonth,
 %          \v!jaar=>\betweendates\the\normalyear,
-%               \ =>\ , % optimization -) 
+%           \space=>\unskip\ \hskip\datesignal,% optimization -) 
+%               \ =>\unskip\ \hskip\datesignal,% optimization -) 
 %                d=>\the\normalday,
 %                m=>\the\normalmonth,
 %                j=>\the\normalyear,
@@ -492,25 +501,16 @@
 %               jj=>\expandafter\gobbletwoarguments\the\normalyear,
 %               yy=>\expandafter\gobbletwoarguments\the\normalyear,
 %       \v!weekdag=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear,
-% %       \v!MAAND=>\betweendates\MONTH\normalmonth,
-% %     \v!WEEKDAG=>\betweendates
-% %                 \bgroup
-% %                 \let\labeltext=\LABELTEXT
-% %                 \dayoftheweek\normalday\normalmonth\normalyear
-% %                 \egroup,
 %       \v!kenmerk=>\expanded{\complexcurrentdate[\kenmerkdatumpatroon]},
-%       \s!unknown=>\commalistelement
-%                   \def\betweendates{\let\betweendates\space}]%
+%       \s!unknown=>\unskip
+%                   \commalistelement
+%                   \hskip\datesignal
+%                   \def\betweendates{\let\betweendates\dobetweendates}]%
+%    \ifdim\lastskip=\datesignal\relax
+%      \unskip
+%    \fi
 %    \egroup}
 
-\newsignal\datesignal
-
-\def\dobetweendates%
-  {\ifdim\lastskip=\datesignal\relax\else
-     \unskip\space
-     \hskip\datesignal\relax
-   \fi}
-
 \def\complexcurrentdate[#1]%
   {\bgroup
    \let\labellanguage\currentlanguage
@@ -519,15 +519,19 @@
    \@EA\processallactionsinset\@EA
      [\!!stringa]
      [    \v!dag=>\betweendates\the\normalday,
+         \v!dag+=>\betweendates\ordinaldaynumber\normalday,
         \v!maand=>\betweendates\month\normalmonth,
          \v!jaar=>\betweendates\the\normalyear,
+       \v!spatie=>\unskip\ \hskip\datesignal,% optimization -) 
               \ =>\unskip\ \hskip\datesignal,% optimization -) 
                d=>\the\normalday,
+              d+=>\ordinaldaynumber\normalday,
                m=>\the\normalmonth,
                j=>\the\normalyear,
                y=>\the\normalyear,
                w=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear,
               dd=>\ifnum\normalday  >9 \else0\fi\the\normalday,
+             dd+=>\ordinaldaynumber{\ifnum\normalday  >9 \else0\fi\the\normalday},
               mm=>\ifnum\normalmonth>9 \else0\fi\the\normalmonth,
               jj=>\expandafter\gobbletwoarguments\the\normalyear,
               yy=>\expandafter\gobbletwoarguments\the\normalyear,
@@ -769,6 +773,4 @@
    \mathematics{\ast\ast},
    \mathematics{\ast\ast\ast}]
 
-\protect
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/core-dat.tex b/tex/context/base/core-dat.tex
index f1211ad53..fac66ce02 100644
--- a/tex/context/base/core-dat.tex
+++ b/tex/context/base/core-dat.tex
@@ -165,7 +165,7 @@
 %D \processrecords[datafile][b]
 %D \stoptypen 
 %D 
-%D Of course one can reassing the command used to handle the
+%D Of course one can reassign the command used to handle the
 %D records in between. 
 
 % \??kt -> 
@@ -286,3 +286,4 @@
 \protect
 
 \endinput
+
diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex
index 014ad788f..77a098acb 100644
--- a/tex/context/base/core-fig.tex
+++ b/tex/context/base/core-fig.tex
@@ -251,7 +251,7 @@
   {\ifcase\figurestatus
      \def\@@efcurrentpath{#1}%
      \sanitizefilename#1\to\@@efcurrentpath
-     \doiffileinsertionsupportedelse{\@@efcurrenttype}
+     \doiffileinsertionsupportedelse\@@efcurrenttype
        {\assignfullfilename % needed 
           {\@@efcurrentpath}% 
           {\@@effilename.\figureextension{\@@efcurrenttype}}%
@@ -267,7 +267,7 @@
 \def\doanalyzefigurefilesA%
   {\ifcase\figurestatus
      \@@eftrace{locating \@@efcurrentfile\space as \@@efcurrenttype}%
-     \doiffileelse{\@@efcurrentfile}
+     \doiffileelse\@@efcurrentfile
        {\getfiguredimensionsA
         \getfiguredimensionsB
         \getfiguredimensionsC}
@@ -413,7 +413,7 @@
      \ifcase\figurestatus\ifcase\figurefilemode\else
       %\doif{\@@efcurrenttype}{\c!tex} % oeps, was wrong 
        \doifnotinset{\@@efextension}{\c!tex,\c!tmp}
-         {\doiffileelse{\@@efcurrentfile}
+         {\doiffileelse\@@efcurrentfile
             {\edef\@@effilenametype{\@@effilename.\@@efcurrenttype}%
              \@@eftrace{running texutil on \@@effilenametype}%
              \def\@@efloadname{\f!utilityfilename.\f!temporaryextension}%
@@ -527,14 +527,14 @@
 
 \def\dodolocatepresetfigurefiles#1%
   {\ifcase\figurestatus
-     \doiffileinsertionsupportedelse{\@@efcurrenttype}
+     \doiffileinsertionsupportedelse\@@efcurrenttype
        {%\edef\@@efcurrentfile%
         %  {#1\f!pathseparator\@@effilename.\figureextension{\@@efcurrenttype}}%
         \assignfullfilename
           {#1}{\@@effilename.\figureextension{\@@efcurrenttype}}%
           \to\@@efcurrentfile
         \@@eftrace{only searching for \@@efcurrentfile}%
-        \doiffileelse{\@@efcurrentfile}
+        \doiffileelse\@@efcurrentfile
           {\chardef\figurestatus=1
            \let\@@eftype\@@efcurrenttype
            \let\@@effullname\@@efcurrentfile}
@@ -1261,12 +1261,32 @@
   {\dosixtupleempty\dodoplaceexternalfigure}
 
 \def\dodoplaceexternalfigure[#1][#2][#3][#4][#5][#6]%
-  {\bgroup
-   \def\textunderscore{_}% brrr, temp hack  
-   \calculateexternalfigure[#1][#2][#3][#4][#5][#6]%
-   \calculateexternalscreenfigure[#1][#2][#3][#4][#5][#6]%
-   \box\foundexternalfigure
-   \egroup}
+  {\doifsomething{#3}% catches \defineexternalfigure dummies
+     {\bgroup
+      \def\textunderscore{_}% brrr, temp hack  
+      \calculateexternalfigure[#1][#2][#3][#4][#5][#6]%
+      \calculateexternalscreenfigure[#1][#2][#3][#4][#5][#6]%
+      \box\foundexternalfigure
+      \egroup}}
+
+% new: more convenient/efficient than 
+%
+%   \use..[a][a][setting] \externalfigure[b][a] 
+%
+% is equivalent to: 
+%
+%   \def..[a][setting]    \externalfigure[b][a]
+% 
+% see x-res modules for usage: 
+%                          
+% \defineexternalfigure[name][settings] 
+
+\def\dodefineexternalfigure[#1][#2]%
+  {\setvalue{\??ef\??ef#1}%
+     {\doplaceexternalfigure[\dopresetfigure][#1][][#2][]}}
+
+\def\defineexternalfigure
+  {\dodoubleargument\dodefineexternalfigure}
 
 \def\getexternalfigure#1%
   {\getvalue{\??ef\??ef#1}}
@@ -1412,30 +1432,15 @@
    \popendofline
    \egroup}
 
-\def\pagefigure%
+\def\pagefigure
   {\dodoubleempty\dopagefigure}
 
 \def\dopagefigure[#1][#2]%
   {\bgroup
-   \pagina
-   \setbox\scratchbox=\hbox{\externalfigure[#1][#2]}%
-   \getparameters
-     [\??ex][\c!offset=\!!zeropoint,#2]
-   \scratchdimen=\@@exoffset
-   \dimen0=\figurewidth \advance\dimen0 2\scratchdimen\edef\figurewidth {\the\dimen0}
-   \dimen0=\figureheight\advance\dimen0 2\scratchdimen\edef\figureheight{\the\dimen0}
-   \definepapersize
-     [\s!dummy][\c!breedte=\figurewidth,\c!hoogte=\figureheight]
-   \setuppapersize
-     [\s!dummy][\s!dummy]
-   \setupcolors
-     [\c!status=\v!start]
-   \stellayoutin
-     [\c!kopwit=\@@exoffset,  \c!rugwit=\@@exoffset,
-       \c!hoofd=\!!zeropoint,   \c!voet=\!!zeropoint,
-      \c!hoogte=\v!midden,   \c!breedte=\v!midden]
-   \box\scratchbox
-   \pagina
+   \getparameters[\??ex][\c!offset=\!!zeropoint,#2]
+   \startTEXpage[\c!offset=\@@exoffset]%
+     \externalfigure[#1][#2]%
+   \stopTEXpage
    \egroup}
 
 % \starttext \pagefigure[two.1] \stoptext
diff --git a/tex/context/base/core-fld.tex b/tex/context/base/core-fld.tex
index af64a3975..50a70e1e1 100644
--- a/tex/context/base/core-fld.tex
+++ b/tex/context/base/core-fld.tex
@@ -37,7 +37,7 @@
         {\setbox0=\hbox{\hskip-\maxdimen\getobject{SYM}{#1}}%
          \smashbox0\box0}}}
 
-\def\presetfieldsymbols[#1]%
+\def\presetfieldsymbols[#1]% slow 
   {\def\dopresetfieldsymbols##1%
      {\processcommalist[##1]\dopresetfieldsymbol}%
    \@EA\processcommalist\@EA[#1]\dopresetfieldsymbols}
diff --git a/tex/context/base/core-fnt.tex b/tex/context/base/core-fnt.tex
index da173f0cd..1235439b0 100644
--- a/tex/context/base/core-fnt.tex
+++ b/tex/context/base/core-fnt.tex
@@ -28,6 +28,14 @@
 
 \bgroup \catcode`\|=\@@active \gdef\compound#1{|#1|} \egroup
 
+%D Here we hook some code into the clean up mechanism needed
+%D for verbatim data.  
+
+\appendtoks
+  \disablecompoundcharacters
+  \disablediscretionaries
+\to \everycleanupfeatures
+
 %D \macros
 %D   {kap,KAP,Kap,Kaps,nokap,userealcaps,usepseudocaps}
 %D
@@ -344,7 +352,8 @@
    #1{\def\textstring{#2}}%
    \ifdim\stretchedspaceamount>\zeropoint
      \def\textkern##1%
-       {\determinemidwordbreak{##1}{\stretchedbreaktokens}%
+       {% beware: ##1 may not be \box\somebox -) 
+        \determinemidwordbreak{##1}{\stretchedbreaktokens}%
         \kern\stretchedspaceamount##1\domidwordbreak}%
      \def\textskip%
        {\scratchdimen=\stretchedspaceamount
@@ -683,12 +692,5 @@
    \c!onderoffset=1.5pt,
    \c!bovenoffset=2.5pt,
    \c!lijnkleur=]
-
-%D ? ? ? 
-
-\stelkoppeltekenin
-  [\c!teken=\compoundhyphen]
   
-\protect 
-
-\endinput
+\protect \endinput
diff --git a/tex/context/base/core-grd.tex b/tex/context/base/core-grd.tex
index 427660dbe..0bb39eddd 100644
--- a/tex/context/base/core-grd.tex
+++ b/tex/context/base/core-grd.tex
@@ -65,8 +65,15 @@
 %D
 %D {\showbaselinecorrection\haalbuffer[2]}
 
-\definecolor[GridLineColor][red]
-\definecolor[GridTextColor][blue]
+% \definecolor[GridLineColor][red]
+% \definecolor[GridTextColor][blue]
+
+\definepalet
+  [grid]
+  [  one=red,
+     two=green,
+   three=blue,
+    four=gray]
 
 \def\setbaselinecorrections%
   {\setbox0\hbox{\setstrut\strut}%
@@ -163,12 +170,12 @@
      \ifdim\pagegoal<\maxdimen
        \ifdim\pagetotal<\pagegoal
          \dimen2=\ht\scratchbox
-         \advance\dimen2 by \dp\scratchbox
-         \advance\dimen2 by \parskip
-         \advance\dimen2 by \thetopbaselinecorrection
-         \advance\dimen2 by \thebotbaselinecorrection
+         \advance\dimen2 \dp\scratchbox
+         \advance\dimen2 \parskip
+         \advance\dimen2 \thetopbaselinecorrection
+         \advance\dimen2 \thebotbaselinecorrection
          \dimen0=\pagetotal
-         \advance\dimen0 by \dimen2
+         \advance\dimen0 \dimen2
 %        \ifdim\dimen0<\pagegoal % does more harm than good
            \witruimte
            \nointerlineskip
@@ -235,10 +242,10 @@
    \ifdim\noflinesheight=\zeropoint
      \noflines=0
    \else
-     \divide\noflinesheight by \openlineheight
+     \divide\noflinesheight \openlineheight
      \noflines=\noflinesheight
      #1\ifdim\noflines\openlineheight=#2\relax \else
-       \advance\noflines by 1
+       \advance\noflines 1
      \fi\fi
    \fi}
 
@@ -266,27 +273,32 @@
 \extrasnapreset \enablepresnapcorrection
 
 \newif\iftracegridsnapping
+\newif\ifshowgridboxes
 \newif\ifshowfuzzyskips
 
+\let\showgridboxes\showgridboxestrue
+
 \chardef\@@alignsnap   =0
 \chardef\@@alignsnapbox=0
 
-\let\presnapskip \!!zeropoint  \def\presnap {--}
+\let\presnapskip \!!zeropoint  \def\presnap {-}
 \let\postsnapskip\!!zeropoint  \let\postsnap\presnap
 
-\def\tracesnapping%
+\def\tracedsnapping%
   {\iftracegridsnapping
      \llap
        {\infofont
         \doglobal\increment\currentsnap
-        \color[GridLineColor]{\vl\presnapskip
+        \color[grid:three]{\vl\presnapskip
                     \vl\presnap
                     \vl\postsnap
-                    \vl\ifcase\@@extrasnap
-                            00\or
-               \extrasnapsign0\or
-  \extrasnapsign\extrasnapsign\or
-               0\extrasnapsign\fi
+                    \ifcase\@@alignsnapbox\relax
+                      \vl\ifcase\@@extrasnap
+                              00\or
+                 \extrasnapsign0\or  
+    \extrasnapsign\extrasnapsign\or
+                 0\extrasnapsign\fi
+                    \fi
                     \vl\currentsnap\vl}}%
    \fi}
 
@@ -299,113 +311,40 @@
      \expandafter\dodosnaptogrid
    \fi}
 
-% \def\dodosnaptogrid% 
-%   {\dowithnextbox
-%      {\bgroup
-%       \ifcase\@@alignsnap\else % 1=top 2=high 3=middle 4=low
-%         \getnoflines{\ht\nextbox}
-%         \setbox\nextbox=\vbox to \noflines\lineheight
-%           {\ifnum\@@alignsnap=1 \kern\lineheight\kern-\topskip\fi
-%            \ifnum\@@alignsnap>2 \vfill\fi
-%            \box\nextbox
-%            \ifnum\@@alignsnap<4 \vfill\fi}
-%       \fi
-%       \forgetall
-%       \par
-%       \ifvbox\nextbox
-%         \setbox\nextbox=\hbox{\box\nextbox}% don't ask
-%       \fi
-%       \scratchskip=\lastskip
-%       \edef\presnapskip{\the\lastskip}%
-%       % mixing single/double columns sometimes goes wrong,
-%       % check 'som' document
-%       \ifbinnenkolommen
-%         \forcepresnaptrue
-%       \fi
-%       \ifforcepresnap
-%         \vbox{\hsize\zeropoint\strut}\nobreak\vskip-\openlineheight
-%       \fi
-%       %
-%       \ifdim\ht\nextbox>\ht\strutbox
-%         \scratchdimen=\ht\nextbox
-%         \ifcase\@@presnap
-%           \ifdim\scratchskip>\zeropoint\relax
-%             \scratchcounter=\scratchskip
-%             \advance\scratchcounter by -\openlineheight
-%             \ifnum\scratchcounter<0
-%               \scratchcounter=-\scratchcounter
-%             \fi
-%             \ifnum\scratchcounter<10 % \lastkip is about \openlineheight
-%               \advance\scratchdimen by -\openstrutdepth
-%               \edef\presnapskip{*\presnapskip}%
-%             \else\ifdim\scratchskip>\openlineheight
-%                                   %<\openlineheight \else
-%               \advance\scratchdimen by -\openstrutdepth
-%               \edef\presnapskip{*\presnapskip}%
-%             \fi\fi
-%           \fi
-%         \fi
-%         \getnoflines\scratchdimen
-%         \advance\noflines by -1
-%         \ifnum\noflines>0
-%           \scratchdimen=\noflines\lineheight
-%         \else
-%           \scratchdimen=\zeropoint
-%         \fi
-%       \else
-%         \scratchdimen=\zeropoint
-%       \fi
-%       \ifnum\@@extrasnap=1 \advance\scratchdimen by \extrasnapsign\lineheight \fi
-%       \ifnum\@@extrasnap=2 \advance\scratchdimen by \extrasnapsign.5\lineheight \fi
-%       \edef\presnap{\the\scratchdimen}%
-%       \ifstrutsnapping
-%         \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi
-%       \fi
-%       \ifdim\dp\nextbox>\dp\strutbox
-%         \getnoflines{\dp\nextbox}%
-%         \advance\noflines by -1
-%         \ifnum\noflines>0
-%           \scratchdimen=\noflines\lineheight
-%         \else
-%           \scratchdimen=\zeropoint
-%         \fi
-%       \else
-%         \scratchdimen=\zeropoint
-%       \fi
-%       \ifnum\@@extrasnap=2 \advance\scratchdimen by \extrasnapsign.5\lineheight \fi
-%       \ifnum\@@extrasnap=3 \advance\scratchdimen by \extrasnapsign\lineheight \fi
-%       \edef\postsnap{\the\scratchdimen}%
-%       \ifstrutsnapping
-%         \ht\nextbox=\ht\strutbox
-%         \dp\nextbox=\dp\strutbox
-%       \else
-%         \scratchdimen=\presnap
-%         \advance\scratchdimen by \ht\strutbox
-%         \ht\nextbox=\scratchdimen
-%         \scratchdimen=\postsnap
-%         \advance\scratchdimen by \dp\strutbox
-%         \dp\nextbox=\scratchdimen
-%       \fi
-%       \hbox{\tracesnapping\box\nextbox}%
-%       \ifstrutsnapping
-%         \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi
-%       \fi
-%       \extrasnapreset
-%       \enablepresnapcorrection
-%       \global\chardef\@@alignsnap0
-%       \egroup}}
+\def\forcedpresnapcorrection
+  {\ifforcepresnap
+     % we don't want top of page space  when 'top' option 
+     %\vbox{\strut}\nobreak\vskip-\openlineheight
+     \vbox{\strut}\vskip-\openlineheight
+   \fi}
+
+%\def\forcedpresnapcorrection
+%  {\ifforcepresnap
+%     \ifvmode \else \par \fi
+%     \ifdim\prevdepth<\zeropoint \else
+%       \vskip-\prevdepth
+%       \vskip\strutdepth 
+%       \prevdepth\strutdepth 
+%     \fi
+%   \fi}
 
 \def\dodosnaptogrid
   {\dowithnextbox
      {\bgroup
       \ifcase\@@alignsnapbox\relax
         \ifcase\@@alignsnap\else % 1=top 2=high 3=middle 4=low
-          \getnoflines{\ht\nextbox}
+          \ifshowgridboxes
+            \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\box\nextbox}}}%
+          \fi
+          \getnoflines{\ht\nextbox}%
           \setbox\nextbox\vbox to \noflines\lineheight
             {\ifnum\@@alignsnap=1 \kern\lineheight\kern-\topskip\fi
              \ifnum\@@alignsnap>2 \vfill\fi
              \box\nextbox
-             \ifnum\@@alignsnap<4 \vfill\fi}
+             \ifnum\@@alignsnap<4 \vfill\fi}%
+        \fi
+        \ifshowgridboxes      
+          \setbox\nextbox\hbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}%
         \fi
         \forgetall
         \par
@@ -419,13 +358,10 @@
         \ifbinnenkolommen
           \forcepresnaptrue
         \fi
-        \ifforcepresnap
-          \vbox{\hsize\zeropoint\strut}\nobreak\vskip-\openlineheight
-        \fi
-        %
+        \forcedpresnapcorrection
         \ifdim\ht\nextbox>\ht\strutbox
           \scratchdimen\ht\nextbox
-          \ifcase\@@presnap
+          \ifcase\@@presnap\relax
             \ifdim\scratchskip>\zeropoint\relax
               \scratchcounter\scratchskip
               \advance\scratchcounter -\openlineheight
@@ -483,32 +419,83 @@
           \advance\scratchdimen \dp\strutbox
           \dp\nextbox\scratchdimen
         \fi
-        \hbox{\tracesnapping\box\nextbox}%
+        \hbox{\tracedsnapping\box\nextbox}%
         \ifstrutsnapping
           \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi
         \fi
       \else
-        \scratchdimen\ht\nextbox
-       %\advance\scratchdimen\dp\nextbox % add dp as option 
-        \ifcase\@@alignsnapbox\or
-          \getrawnoflines\scratchdimen
+        \scratchdimen\ht\nextbox\relax
+        \ifcase\@@alignsnapbox
+          % can't happen here
+        \or
+          \getrawnoflines\scratchdimen 
         \else
           \getnoflines   \scratchdimen
         \fi  
         \scratchdimen\noflines\lineheight\relax
-        \ifnum\pagetotal>\zeropoint\else % disable this as option 
+        \advance\scratchdimen-\strutdepth
+        \ifnum\pagetotal>\zeropoint
+        \else % disable this as option 
           \advance\scratchdimen-\strutheight
           \advance\scratchdimen+\topskip
         \fi
+        \dimen0=\scratchdimen
+        \dimen2=\strutdepth
+        \ifshowgridboxes
+          \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\box\nextbox}}}%
+        \fi
+        \dp\nextbox\dp\strutbox
+        \dimen4=\ht\nextbox
+        \dimen6=\dp\nextbox
         \setbox\nextbox\vbox to \scratchdimen
-          {\ifnum\@@alignsnapbox>2 \vfill\fi % 3 4 
+          {\forgetall
+           \ifnum\@@alignsnap>2 \vfill\fi % 3 4 
+           \iftracegridsnapping
+             \scratchdimen\@@alignsnapamount\relax
+             \setbox\scratchbox\hbox
+               {\ifdim\scratchdimen<\zeropoint
+                  \tracedgridamount\zeropoint{-\scratchdimen}%
+                \else
+                  \tracedgridamount\scratchdimen\zeropoint
+                \fi}%
+             \smashbox\scratchbox 
+             \setbox\nextbox\hbox{\box\scratchbox\box\nextbox}%
+           \fi
+           \setbox\nextbox\hbox
+             {\scratchdimen\@@alignsnapamount\relax
+              \ifcase\@@alignsnapdepth\or
+                % don't change this ever ! 
+                \ifdim\dimen0<\lineheight
+                  % otherwise it is ok, but ending up inside 
+                  % the next paragraph is seldom what we want,
+                  % so we move one line up
+                  \advance\scratchdimen-\lineheight
+                  \advance\scratchdimen\strutheight
+                \else
+                  % otherwise we can move down to the 
+                  % baseline 
+                  \advance\scratchdimen\dimen6
+                \fi
+              \fi
+              \lower\scratchdimen\box\nextbox}%
+           \ht\nextbox\dimen4
+           \dp\nextbox\dimen6
            \box\nextbox
-           \ifnum\@@alignsnapbox<4 \vfill\fi % 2 3 
+           \nointerlineskip % \offinterlineskip
+           \ifnum\@@alignsnap<4 \vfill\fi % 2 3 
            \kern\zeropoint}% 
-        \ifnum\@@alignsnapbox>2 \def\presnap {++}\fi 
-        \ifnum\@@alignsnapbox<4 \def\postsnap{++}\fi 
-        \setbox\nextbox\hbox{\tracesnapping\box\nextbox}%
-        \dp\nextbox\zeropoint 
+        \ifshowgridboxes
+          \setbox\nextbox\vbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}%
+        \fi
+        \let\presnapskip\@@alignsnapamount
+        \ifnum\@@alignsnap>2 \def\presnap {+}\fi 
+        \ifnum\@@alignsnap<4 \def\postsnap{+}\fi 
+        \setbox\nextbox\hbox{\tracedsnapping\box\nextbox}%
+        \par
+        \ht\nextbox\dimen0
+        \dp\nextbox\dimen2
+        \forcedpresnapcorrection
+        \nointerlineskip
         \box\nextbox 
       \fi
       \extrasnapreset
@@ -517,6 +504,9 @@
       \global\chardef\@@alignsnapbox0
       \egroup}}
 
+\def\tracedgridamount#1#2%
+  {\color[grid:four]{\vrule\!!width\wd\nextbox\!!height#1\!!depth#2}}
+
 \def\snaptomathgrid% probably not working ok
   {\ifgridsnapping
      \dowithnextbox
@@ -581,6 +571,7 @@
 \def\setgridbox#1#2#3%
   {\setbox#1=\ruledvbox to #3 % given size 
      {\forgetall
+      \resetteststrut 
       \offinterlineskip
       \hsize=#2
       \baselinerulefalse
@@ -607,33 +598,26 @@
 
 \def\gridwarning#1{\message{[beware of #1 extra snap]}}
 
-% \def\doverplaatsopgrid[#1]%
-%   {\ifgridsnapping
-%      \global\chardef\@@alignsnap0
-%      \processaction
-%        [#1]
-%        [  \v!boven=>\gridwarning+\positiveextrasnap\extrasnapbefore,
-%           \v!onder=>\gridwarning+\positiveextrasnap\extrasnapafter,
-%           \v!beide=>\positiveextrasnap\extrasnaparound,
-%          -\v!boven=>\gridwarning-\negativeextrasnap\extrasnapbefore,
-%          -\v!onder=>\gridwarning-\negativeextrasnap\extrasnapafter,
-%          -\v!beide=>\negativeextrasnap\extrasnaparound,
-%          \v!pagina=>\global\chardef\@@alignsnap1, % topskip
-%            \v!hoog=>\global\chardef\@@alignsnap2, 
-%          \v!midden=>\global\chardef\@@alignsnap3, 
-%            \v!laag=>\global\chardef\@@alignsnap4, 
-%           \v!reset=>\positiveextrasnap\extrasnapreset,
-%         \s!default=>\positiveextrasnap\extrasnaparound,
-%         \s!unknown=>\positiveextrasnap\extrasnapreset]%
-%    \fi}
-
-\def\doverplaatsopgrid[#1]% some day : speed up 
-  {\ifgridsnapping
-     \global\chardef\@@alignsnap0 
-     \global\chardef\@@alignsnapbox0 
-     \donefalse 
-     \ExpandFirstAfter\processallactionsinset[#1]
-       [  \v!boven=>\gridwarning+\positiveextrasnap\extrasnapbefore,
+\global\let\@@alignsnapamount\!!zeropoint
+\global\chardef\@@alignsnapdepth0
+
+\def\@@unknowngriddisplacement 
+  {\global\chardef\@@alignsnapbox3
+   \global\let\@@alignsnapamount\commalistelement}
+
+\def\doverplaatsopgrid[#1]% 
+  {\ifgridsnapping\doifsomething{#1}{\dodoverplaatsopgrid[#1]}\fi}
+
+\def\dodoverplaatsopgrid[#1]% some day : speed up 
+  {\global\chardef\@@alignsnap0 
+   \global\chardef\@@alignsnapbox0 
+   \global\chardef\@@alignsnapdepth0
+   \global\let\@@alignsnapamount\!!zeropoint
+   \donefalse 
+   \expanded{\processallactionsinset[#1]}
+     [\v!standaard=>,
+        \v!normaal=>, % to be sure 
+          \v!boven=>\gridwarning+\positiveextrasnap\extrasnapbefore,
           \v!onder=>\gridwarning+\positiveextrasnap\extrasnapafter,
           \v!beide=>\positiveextrasnap\extrasnaparound,
          -\v!boven=>\gridwarning-\negativeextrasnap\extrasnapbefore,
@@ -644,14 +628,16 @@
          \v!midden=>\global\chardef\@@alignsnap3, 
            \v!laag=>\global\chardef\@@alignsnap4, 
         \v!passend=>\global\chardef\@@alignsnapbox1, % new 
-           \v!ruim=>\global\chardef\@@alignsnapbox2, % new 
+           \v!ruim=>\global\chardef\@@alignsnapbox2, % new
+         \v!diepte=>\global\chardef\@@alignsnapdepth1, % new 
+          \v!regel=>\global\chardef\@@alignsnapbox3
+                    \global\chardef\@@alignsnap4 
+                    \global\chardef\@@alignsnapdepth1, 
           \v!reset=>\positiveextrasnap\extrasnapreset,
            \v!geen=>\global\chardef\@@alignsnap0
                     \global\chardef\@@alignsnapbox0,
-      \v!standaard=>\positiveextrasnap\extrasnaparound,
-        \s!default=>\positiveextrasnap\extrasnaparound,
-        \s!unknown=>\positiveextrasnap\extrasnapreset]%
-   \fi}
+        \s!default=>,
+        \s!unknown=>\@@unknowngriddisplacement]}
 
 \def\verplaatsopgrid%
   {\dosingleempty\doverplaatsopgrid}
@@ -736,7 +722,7 @@
      \global\advance\fuzzymarker by \ifodd\fuzzymarker#1\else#2\fi
      \nobreak
      \ifshowfuzzyskips
-       \hbox{\color[GridTextColor]
+       \hbox{\color[grid:three]
          {\llap{\infofont#3\vl\the\fuzzymarker}\nobreak
           \vrule\!!width\hsize\!!height.1\lineheight}}
        \nobreak
@@ -817,7 +803,7 @@
      \iffuzzysnapped
        \iftracegridsnapping
          \gdef\presnapcorrection%
-           {\color[GridLineColor]{\hrule\!!height.5\openlineheight\!!width\hsize}}%
+           {\color[grid:four]{\hrule\!!height.5\openlineheight\!!width\hsize}}%
        \else
          \gdef\presnapcorrection{\kern.5\openlineheight}%
        \fi
diff --git a/tex/context/base/core-hlp.tex b/tex/context/base/core-hlp.tex
index 8e6005059..90503bf30 100644
--- a/tex/context/base/core-hlp.tex
+++ b/tex/context/base/core-hlp.tex
@@ -11,6 +11,8 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for 
 %C details. 
 
+% todo : dedicated vide/hide voor helps 
+
 %D This is an experimental and private module, so the interface
 %D and functionality can change. Pieces of code will be moved
 %D to other modules. More features are possible but will be 
@@ -26,7 +28,7 @@
 
 \setupframedtexts
   [\e!helptext]
-  [\c!breedte=.75\textwidth,
+  [\c!breedte=.75\tekstbreedte,
    \c!uitlijnen=\v!normaal,
    \c!kader=\v!uit,
    \c!achtergrond=\v!raster]
@@ -41,10 +43,10 @@
 
 \let\pagehelpdata\empty
 
-\def\dontresetpagedata%
+\def\dontresetpagedata
   {\let\synchronizepagehelpdata\relax}
 
-\def\resetpagehelpdata% 
+\def\resetpagehelpdata
   {\iflocation  
      \let\synchronizepagehelpdata\resetpagehelpdata
      \global\let\pagehelpdata\empty
@@ -55,7 +57,7 @@
 
 \resetreference[HideHelp]
 
-\def\getpagehelpdata%
+\def\getpagehelpdata
   {\iflocation\ifcase\nofhelpdataentries\else
      \let\pagehelpdata\empty
      \ifconditional\somehelpdatadefined
@@ -75,9 +77,7 @@
    \fi\fi}
 
 \def\setpagehelpdata[#1]%
-  {\iflocation\ifcase\nofhelpdataentries\else
-     \expanded{\dosetpagehelpdata{#1}}%
-   \fi\fi}
+  {\iflocation\expanded{\dosetpagehelpdata{#1}}\fi}
 
 \def\dosetpagehelpdata#1%
   {\doglobal\increment\nofhelpdataentries
@@ -91,19 +91,23 @@
   {\iflocation
      \global\settrue\somehelpdatadefined
      \setvalue{\e!stop\e!helptext}%
-       {\definesymbol[helpinfo:#1][\helptext{\getbuffer[\e!helptext]}]%
+      %{\definesymbol[helpinfo:#1][\getvalue\e!helptext{\getbuffer[\e!helptext]}]%
+       {\definesymbol[helpinfo:#1][{\doframedtext[\e!helptext]{\getbuffer[\e!helptext]}}]%
         \dopresetfieldsymbol{helpinfo:#1}}%
    \else
      \letvalue{\e!stop\e!helptext}\relax
    \fi
    \dostartbuffer[\e!helptext][\e!start\e!helptext][\e!stop\e!helptext]}
 
-\long\def\definehelptext[#1]#2% 
+\long\def\helptext[#1]#2% 
   {\iflocation
      \global\settrue\somehelpdatadefined
-     \definesymbol[helpinfo:#1][\helptext{#2}]%
+    %\definesymbol[helpinfo:#1][\getvalue\e!helptext{#2}]%
+     \definesymbol[helpinfo:#1][{\doframedtext[\e!helptext]{#2}}]%
      \dopresetfieldsymbol{helpinfo:#1}%
    \fi}
+
+\let\definehelptext\helptext % for backward compabilities sake 
 
 \def\dohelpdata#1%
   {\setbox0=\hbox
@@ -113,7 +117,7 @@
          \fitfield[help:#1]}
       \stopoverlay}}
 
-\def\helpdata%
+\def\helpdata
   {\iflocation
      \bgroup
     %\getpagehelpdata
@@ -124,6 +128,7 @@
          [\c!breedte=\v!passend,
           \c!hoogte=\v!passend,
           \c!kader=\v!uit,
+          \c!klikin=JS(Hide_Fields),
           \c!optie={\v!alleenleesbaar,\v!verborgen}]%
        \setbox0=\box\voidb@x
        \processcommacommand[\pagehelpdata]\dohelpdata
@@ -132,38 +137,34 @@
      \egroup  
    \fi}
 
-%\def\dohelpbutton[#1][#2]%
-%  {\iflocation 
-%     \ifsecondargument
-%       \setpagehelpdata[#2]\button[#1]{}[JS(Vide_Fields{help:#2})]%
-%     \else
-%       \setpagehelpdata[#1]\button    {}[JS(Vide_Fields{help:#1})]%
-%     \fi
-%   \fi}
-%
-%\def\helpbutton%
-%  {\dodoubleempty\dohelpbutton}
+\def\helpbutton % also gobble spaces between [][]
+  {\dodoubleempty\dohelpbutton}
+
+\def\dohelpbutton
+  {\ifsecondargument
+     \expandafter\donohelpbutton
+   \else
+     \expandafter\dodohelpbutton
+   \fi}
 
 \def\dodohelpbutton[#1][#2]#3[#4]% #2 is space gobbling dummy 
   {\iflocation 
      \setpagehelpdata[#4]%
-     \button[#1]{#3}[JS(Vide_Fields{help:#4})]%
+     \useJSscripts[fld]%
+     \button[#1]{#3}[JS(Vide_Hide_Fields{help:#4})]%
    \fi}
 
 \def\donohelpbutton[#1][#2]% 
   {\dodohelpbutton[#1][]{}[#2]} 
 
-\def\dohelpbutton
-  {\ifsecondargument
-     \expandafter\donohelpbutton
-   \else
-     \expandafter\dodohelpbutton
+\def\doifhelpinfo#1#2%
+  {\iflocation
+     \doifsymboldefinedelse{helpinfo:#1}{#2}\donothing
    \fi}
 
-\def\helpbutton% also gobble spaces between [][]
-  {\dodoubleempty\dohelpbutton}
-
-\def\doifhelpinfo#1#2%
-  {\iflocation\doifsymboldefinedelse{helpinfo:#1}{#2}{}\fi}
+\def\doifelsehelpinfo#1#2#3%
+  {\iflocation
+     \doifsymboldefinedelse{helpinfo:#1}{#2}{#3}%
+   \fi}
 
 \protect \endinput 
diff --git a/tex/context/base/core-ins.tex b/tex/context/base/core-ins.tex
new file mode 100644
index 000000000..a46fe6dba
--- /dev/null
+++ b/tex/context/base/core-ins.tex
@@ -0,0 +1,90 @@
+%D \module
+%D   [       file=core-ins,
+%D        version=2002.4.16,
+%D          title=\CONTEXT\ Insertion Macros,
+%D       subtitle=Insertions, 
+%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 Insertion Macros / General} 
+
+%D Insertions are special data collections that are associated
+%D to \TEX's internal page builder. When multiple footnote
+%D classes were introduced, I decided to isolate some of the
+%D functionality in a module. 
+
+\unprotect 
+
+\newtoks\@@insertionlist
+
+\def\processinsertions{\the\@@insertionlist}
+
+\let\doprocessinsert\gobbleoneargument
+
+\def\installinsertion#1%
+  {\ifx#1\undefined
+     \newinsert#1%
+     \count#1\!!thousand
+     \skip #1\zeropoint
+     \dimen#1\maxdimen
+     \appendtoks\doprocessinsert#1\to\@@insertionlist
+   \fi}
+
+\def\synchronizeinsertions
+  {\def\doprocessinsert##1{\ifvoid##1\else\insert##1{\unvbox##1}\fi}%
+   \processinsertions}
+
+%D For instance, when we postpone footnotes, we need to save 
+%D some data related to the inserts. The next methods are 
+%D far from ideal, but better than nothing. We save and 
+%D restore box content and associated data independently. 
+%D The box content is only restores when non||void.
+
+\def\backupinsertion#1%
+  {\csname\string#1\endcsname}
+
+\def\installbackupinsertion#1%
+  {\expandafter\newinsert\csname\string#1\endcsname
+   \count\backupinsertion#1\zerocount 
+   \skip \backupinsertion#1\zeropoint
+   \dimen\backupinsertion#1\maxdimen}
+
+\def\saveinsertionbox#1%
+  {\ifdim\ht#1>\zeropoint % hm, actually unknown 
+     \global\setbox\backupinsertion#1\box#1%
+   \else
+     \global\setbox\backupinsertion#1\box\voidb@x
+   \fi}
+
+\def\restoreinsertionbox#1%
+  {\ifvoid\backupinsertion#1\else % if void, we keep the content  
+     \global\setbox#1\box\backupinsertion#1%
+   \fi}
+
+\def\eraseinsertionbackup#1%
+  {\global\setbox\backupinsertion#1\box\voidb@x}
+
+\def\saveinsertiondata#1% 
+  {\global\skip \backupinsertion#1\skip #1%
+   \global\count\backupinsertion#1\count#1%
+   \global\dimen\backupinsertion#1\dimen#1}
+
+\def\restoreinsertiondata#1% 
+  {\global\skip #1\skip \backupinsertion#1%
+   \global\count#1\count\backupinsertion#1%
+   \global\dimen#1\dimen\backupinsertion#1}
+
+%D Auxiliary macros: 
+
+\def\addinsertionheight#1\to#2%
+  {\ifvoid#1\else
+     \advance#2 1\skip#1\relax     
+     \advance#2  \ht  #1\relax        
+   \fi}
+
+\protect \endinput 
diff --git a/tex/context/base/core-int.tex b/tex/context/base/core-int.tex
index e030b612d..4a9d08375 100644
--- a/tex/context/base/core-int.tex
+++ b/tex/context/base/core-int.tex
@@ -298,14 +298,30 @@
         {\!!heighta\@@schoogte}}%
    \doif\@@scwachttijd\v!geen{\let\@@scwachttijd\zerocountervalue}}
 
-\def\initializeidentity% The macro is not to be changed;
-  {\iflocation         % only the \@@ia-variables may be set! 
-     \dosetupidentity  % ConTeXt is the producer but we 
-       {\@@iatitel}    % no longer mention the pragma site, since
-       {\@@iasubtitel} % we don't want to be bothered with
-       {\@@iaauteur}   % remarks about third party documents
-       {ConTeXt/user/\jobname.tex} % and/or associated with documents 
-       {\@@iadatum}%   % produced outside our control. 
+% The macro is not to be changed; only the \@@ia-variables
+% may be set! ConTeXt is the producer but we no longer
+% mention the pragma site, since we don't want to be bothered
+% with remarks about third party documents and/or associated
+% with documents produced outside our control. 
+
+\def\doprepareidentity 
+  {\let\!!stringa\@@iatrefwoord
+   \let\@@iatrefwoord\empty
+   \def\doprepareidentity##1{\edef\@@iatrefwoord
+     {\@@iatrefwoord\ifx\@@iatrefwoord\empty\else\space\fi##1}}%
+   \@EA\processcommacommand\@EA[\!!stringa]\doprepareidentity
+   \global\let\doprepareidentity\relax}
+
+\def\initializeidentity
+  {\iflocation         
+     \doprepareidentity
+     \expanded{\dosetupidentity  
+       {\@@iatitel}%    
+       {\@@iasubtitel}% 
+       {\@@iaauteur}%   
+       {ConTeXt/user/\jobname.tex}%
+       {\@@iadatum}%   
+       {\@@iatrefwoord}}%
      \global\let\initializeidentity\relax 
    \fi}                
 
@@ -350,7 +366,7 @@
 
 \appendtoks \initializepaper \to \everyshipout 
 
-\def\doinitializepaper%
+\def\doinitializepaper
   {\bgroup
    \berekeninteractiescherm
    \ifdim\!!widtha>\papierbreedte\ifdim\!!widtha>\zeropoint 
@@ -398,6 +414,7 @@
 
 \setvalue{\??sc\c!optie\v!max     }{1} % tzt share with driver 
 \setvalue{\??sc\c!optie\v!bookmark}{2} % tzt share with driver 
+\setvalue{\??sc\c!optie\v!passend }{3} % tzt share with driver 
 
 \def\dodosetupinteractionscreens% met a, b en \number
   {\bgroup
@@ -2298,11 +2315,11 @@
 
 \newbox\commentbox
 
-\def\doflushcomments%
+\def\doflushcommentanchors%
    {\inmarge{\hbox{\raise\ht\strutbox\box\commentbox}}}
 
-\def\flushcomments% in everypar so indirect 
-  {\ifvoid\commentbox\else \doflushcomments \fi}
+\def\flushcommentanchors% in everypar so indirect 
+  {\ifvoid\commentbox\else \doflushcommentanchors \fi}
 
 \def\stelcommentaarin%
   {\dodoubleargument\getparameters[\??cc]}
@@ -2317,10 +2334,13 @@
   {\!!widtha\@@ccbreedte
    \!!heighta\@@cchoogte
    \doifelse{\@@ccoptie}{\v!max}
-     {\def\@@ccoptie{1}}{\def\@@ccoptie{0}}%
+     {\def\@@ccopen{1}}{\def\@@ccopen{0}}%
+   \doifelse{\@@ccoptie}{\v!buffer}
+     {\def\@@cccollect{1}}{\def\@@cccollect{0}}%
    \doinsertcomment
      \@@cctitel\!!widtha\!!heighta
-     \@@cckleur\@@ccoptie\@@ccsymbool{#1}}
+     \@@cckleur\@@ccopen\@@ccsymbool
+     \@@cccollect{#1}}
 
 %\def\dopreparecommentaar#1#2%
 %  {\doifassignmentelse{#1}
@@ -2408,6 +2428,32 @@
 %   the way, it's funny that when in Acrobat we scale up the
 %   text, the symbols scale down. 
 % \stopcommentaar
+
+% \definesymbol [comment-normal][{\externalfigure[koe.pdf]}]
+% \definesymbol [comment-down]  [{\externalfigure[koe.pdf]}]
+% 
+% \def\CowSymbol#1#2%
+%  {\scale
+%     [\c!hoogte=#1]
+%     {\startMPcode
+%        loadfigure "koe.mp" number 1 ; 
+%        refill currentpicture withcolor #2 ; 
+%      \stopMPcode}}
+% 
+% \definesymbol [comment-normal]  
+%   [\CowSymbol{4ex}{red}]
+% 
+% \definesymbol [comment-down]  
+%   [\CowSymbol{4ex}{green}]
+% 
+% \setupcomment
+%   [\c!symbool={comment-normal,comment-down},
+%    \c!optie=\v!buffer]
+%
+% \setupfootertexts[\placecomments]
+
+\def\placecomments
+  {\doflushcomments}
 
 % jammer, tussen/midden had erin gemoeten; \c!commando toevoegen
 
diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex
index a9a7b03c5..1943c8769 100644
--- a/tex/context/base/core-job.tex
+++ b/tex/context/base/core-job.tex
@@ -360,7 +360,7 @@
 \appendtoks \checkindentation               \to \everypar    
 \appendtoks \showparagraphnumber            \to \everypar    
 \appendtoks \flushmargincontents            \to \everypar    
-\appendtoks \flushcomments                  \to \everypar    
+\appendtoks \flushcommentanchors            \to \everypar    
 \appendtoks \synchronizefootnotes           \to \everypar    
 
 \appendtoks \flushfootnotes                 \to \everydisplay
diff --git a/tex/context/base/core-lst.tex b/tex/context/base/core-lst.tex
index 03cd5bfbe..cd900c3ca 100644
--- a/tex/context/base/core-lst.tex
+++ b/tex/context/base/core-lst.tex
@@ -64,49 +64,92 @@
 % number uses the text container. We use reference mapping 
 % (define reference) to keep track of the current ref. 
 
-\def\doschrijfnaarlijst#1#2#3#4%
-  {\doifvalue{\??li#1\c!status}{\v!start}
-     {\dodoschrijfnaarlijst{#1}{#2}{#3}{#4}}}
+% \def\doschrijfnaarlijst#1#2#3#4%
+%   {\doifvalue{\??li#1\c!status}{\v!start}
+%      {\dodoschrijfnaarlijst{#1}{#2}{#3}{#4}}}
+% 
+% \def\dodoschrijfnaarlijst#1#2#3#4%
+%   {\begingroup
+%    \convertexpanded{\??li#1}{#3}\asciilistentry
+%    \makesectionformat
+%    \doifelse{\@@nmstatus}{\v!start}
+%      {\def\dopaginanummer{\noexpand\pagenumber}}
+%      {\def\dopaginanummer{0}}%
+%    % niet waterdicht, wat te doen met figuren en zo
+%    % first hack: scheelt rommel, second hack: alleen koppen
+%    \doifelsevalue{\??rf#1\c!status}{\v!start}
+%      {\doif{\@@sectionlevel\@@sectie}{0}{\autocrossdocumentfalse}}
+%      {\autocrossdocumentfalse}%
+%    % blijft nog wat zwakjes en inefficient 
+%    \ifautocrossdocument
+%      \bgroup
+%      \thisisnextinternal{#1}%
+%     %\thisisdestination{#1::\sectionformat}% 
+%      \@EA\setsectieenkoppeling\@EA{#1}%
+%      \edef\currentlevel{\@@sectionlevel\@@sectie}%
+%      \def\docommando##1% naar buiten brengen 
+%        {\def\dodocommando####1% 
+%           {\doifvalue{\??rf####1\c!status}{\v!start}
+%              {\setsectieenkoppeling{####1}%
+%               \def\level{\@@sectionlevel\@@sectie}%
+%               \ifnum\level>\currentlevel
+%                 \expanded{\definereference[##1::####1][\v!geen]}%
+%               \else\ifnum\level=\currentlevel
+%                 \expanded{\definereference[##1::####1][##1::{####1::\sectionformat}]}%
+%               \fi\fi}}%
+%         \processcommacommand[\crossdocumentelements]\dodocommando}%
+%      \processcommacommand[\crossdocumentreferences]\docommando
+%      \egroup
+%    \else
+%      \thisisnextinternal{#1}%
+%    \fi
+%    \edef\schrijfwegnaarlijst%
+%      {\writeutilitycommand%
+%         {\listentry%
+%            {#1}%
+%            {\nextinternalreference}%
+%            {#2}%
+%            {\asciilistentry}%
+%            {\sectionformat::\dopaginanummer}%
+%            {\noexpand\realfolio}}}%
+%    \schrijfwegnaarlijst
+%    \endgroup}
+%
+% adapted 
+
+\def\doschrijfnaarlijst#1%
+  {\doifelsevalue{\??li#1\c!status}{\v!start}
+     \dodoschrijfnaarlijst\gobblefourarguments{#1}}
 
 \def\dodoschrijfnaarlijst#1#2#3#4%
   {\begingroup
-   \convertexpanded{\??li#1}{#3}\asciilistentry
+   \def\currentlist{#1}%
+   \convertexpanded{\??li\currentlist}{#3}\asciilistentry
    \makesectionformat
-   \doifelse{\@@nmstatus}{\v!start}
+   \doifelse\@@nmstatus\v!start
      {\def\dopaginanummer{\noexpand\pagenumber}}
      {\def\dopaginanummer{0}}%
    % niet waterdicht, wat te doen met figuren en zo
    % first hack: scheelt rommel, second hack: alleen koppen
-   \doifelsevalue{\??rf#1\c!status}{\v!start}
-     {\doif{\@@sectionlevel\@@sectie}{0}{\autocrossdocumentfalse}}
+   \doifelsevalue{\??rf\currentlist\c!status}\v!start
+     {\doif{\@@sectionlevel\@@sectie}{0}\autocrossdocumentfalse}
      {\autocrossdocumentfalse}%
-   % blijft nog wat zwakjes en inefficient 
+   % blijft nog wat zwakjes en inefficient
    \ifautocrossdocument
      \bgroup
-     \thisisnextinternal{#1}%
-    %\thisisdestination{#1::\sectionformat}% 
-     \@EA\setsectieenkoppeling\@EA{#1}%
+     \thisisnextinternal\currentlist
+    %\thisisdestination{\currentlist::\sectionformat}%
+     \@EA\setsectieenkoppeling\@EA{\currentlist}%
      \edef\currentlevel{\@@sectionlevel\@@sectie}%
-     \def\docommando##1% naar buiten brengen 
-       {\def\dodocommando####1% 
-          {\doifvalue{\??rf####1\c!status}{\v!start}
-             {\setsectieenkoppeling{####1}%
-              \def\level{\@@sectionlevel\@@sectie}%
-              \ifnum\level>\currentlevel
-                \expanded{\definereference[##1::####1][\v!geen]}%
-              \else\ifnum\level=\currentlevel
-                \expanded{\definereference[##1::####1][##1::{####1::\sectionformat}]}%
-              \fi\fi}}%
-        \processcommacommand[\crossdocumentelements]\dodocommando}%
-     \processcommacommand[\crossdocumentreferences]\docommando
+     \processcommacommand[\crossdocumentreferences]\dododoschrijfnaarlijst
      \egroup
    \else
-     \thisisnextinternal{#1}%
+     \thisisnextinternal\currentlist
    \fi
    \edef\schrijfwegnaarlijst%
      {\writeutilitycommand%
         {\listentry%
-           {#1}%
+           {\currentlist}%
            {\nextinternalreference}%
            {#2}%
            {\asciilistentry}%
@@ -115,6 +158,20 @@
    \schrijfwegnaarlijst
    \endgroup}
 
+\def\dododoschrijfnaarlijst#1%
+  {\def\docommando##1%
+     {\doifvalue{\??rf##1\c!status}\v!start
+        {\setsectieenkoppeling{##1}%
+         \def\level{\@@sectionlevel\@@sectie}%
+         \ifnum\level>\currentlevel
+           \expanded{\definereference[#1::##1][\v!geen]}%
+         \else\ifnum\level=\currentlevel
+           \expanded{\definereference[#1::##1][#1::{##1::\sectionformat}]}%
+         \fi\fi}}%
+   \processcommacommand[\crossdocumentelements]\docommando}
+
+% so far 
+
 \def\doschrijftussenlijst#1#2%
   {\doifvalue{\??li#1\c!status}{\v!start}
      {\dodoschrijftussenlijst{#1}{#2}}}
@@ -448,6 +505,8 @@
      {\ifvmode\nointerlineskip\fi}               % bij multi-line lijsten 
      {\nointerlineskip\endgraf\allowbreak}}      % 
 
+% to be documented: uitlijnen, hang 
+
 \def\dodofixdlijstelementABC#1#2#3#4#5#6% weeden
   {\endgraf
    \leftskip\getvalue{\??li#1\c!marge}% na de \endgraf !
@@ -486,17 +545,19 @@
                     {\hfill
                      \makelijstelement\v!paginanummer
                        {\dolistattributes{#1}\c!paginaletter\c!paginakleur
-                          {\getvalue{\??li#1\c!paginacommando}
+                          {\getvalue{\??li#1\c!paginacommando}%
                              {\paginaprefix\??li#1[#5]%
                               \translatednumber[#5]}}}}}}}%
          \vbox
            {\hsize\!!widthb
+\expanded{\steluitlijnenin[\getvalue{\??li#1\c!uitlijnen}]}%
             \ifdim\!!widtha<\hsize
               \hangindent=\wd2
               \dimen2=\!!widthc % \getvalue{\??li#1\c!afstand}%
               \advance\hangindent by \dimen2
               \hangafter=1
-              \ifvoid4
+\doifvalue{\??li#1\c!hang}{\v!nee}{\hangafter=0 }%
+              \ifdim\wd4=\zeropoint % \ifvoid4
                 % we kunnen gewoon afbreken aan het eind
               \else
                 \ifdim\lijstskip>\zeropoint\relax
@@ -516,12 +577,10 @@
               {\let\\=\newlineinlist
                \dontconvertfont
                \getvalue{\??li#1\c!tekstcommando}{#4}}%
-%\carryoverpar % new otherwise wrong linespacing 
+              %\carryoverpar % new otherwise wrong linespacing 
             \egroup
-            \ifvoid4
-              \ifdim\!!widtha<\hsize
-                \hfill\strut
-              \fi
+            \ifdim\wd4=\zeropoint\relax % \ifvoid4
+              % \ifdim\!!widtha<\hsize \hfill\strut \fi % spoils align 
             \else
               \nobreak\hskip.5em\lijstfill
               \box4\relax
diff --git a/tex/context/base/core-mat.tex b/tex/context/base/core-mat.tex
index ef197eb20..c175d2e64 100644
--- a/tex/context/base/core-mat.tex
+++ b/tex/context/base/core-mat.tex
@@ -27,7 +27,7 @@
 
 \newdimen\lastlinewidth 
 
-\def\setlastlinewidth% 
+\def\setlastlinewidth
   {\resetlastlinewidth
    \ifmmode\else\ifhmode\else\ifoptimizedisplayspacing
      \bgroup
@@ -37,8 +37,8 @@
      \egroup
    \fi\fi\fi}
 
-\def\resetlastlinewidth%
-  {\global\lastlinewidth\!!zeropoint\relax}
+\def\resetlastlinewidth
+  {\global\lastlinewidth\zeropoint\relax}
 
 \appendtoks \setlastlinewidth \to \everyendofpar
 
diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex
index b35bad64d..ab2166fae 100644
--- a/tex/context/base/core-mis.tex
+++ b/tex/context/base/core-mis.tex
@@ -8,8 +8,8 @@
 %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. 
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
 
 \writestatus{loading}{Context Core Macros / Misc Commands}
 
@@ -50,17 +50,17 @@
 
 \unprotect
 
-%D \macros 
+%D \macros
 %D   {simplifiedcommands, simplifycommands}
 %D
 %D I first needed this simplification in bookmarks. Users can
-%D add their own if needed. 
+%D add their own if needed.
 
 \ifx\simplifiedcommands\undefined \newtoks\simplifiedcommands \fi
 
 \def\simplifycommands{\the\simplifiedcommands}
 
-%D A possibly growing list: 
+%D A possibly growing list:
 
 \appendtoks        \def\executesynonym#1#2#3#4{#3}\to\simplifiedcommands
 \appendtoks                              \def\ { }\to\simplifiedcommands
@@ -72,16 +72,16 @@
 \appendtoks                 \def\MetaPost{MetaFun}\to\simplifiedcommands
 \appendtoks                              \def||{-}\to\simplifiedcommands
 
-%D You would not expect the next macro in \CONTEXT, 
-%D wouldn't you? It's there to warn \LATEX\ users that 
-%D something is wrong. 
+%D You would not expect the next macro in \CONTEXT,
+%D wouldn't you? It's there to warn \LATEX\ users that
+%D something is wrong.
 
-\def\documentstyle% 
+\def\documentstyle%
   {\showmessage{\m!systems}{3}{}\stoptekst}
 
 \let\documentclass=\documentstyle
 
-% THIS WAS MAIN-002.TEX 
+% THIS WAS MAIN-002.TEX
 
 %\def\checkinterlineskip%
 %  {\ifvmode
@@ -128,7 +128,7 @@
      {\def\@@isbreedte{\hsize}}%
    \doifconversiondefinedelse{\@@issymbool}
      {\def\doitembullet##1{\convertnumber{\@@issymbool}{##1}}}
-     {\doifsymboldefinedelse{\@@issymbool} 
+     {\doifsymboldefinedelse{\@@issymbool}
         {\def\doitembullet##1{\symbol[\@@issymbool]}}{}}}
 
 \def\makeitemsandbullets#1%
@@ -636,89 +636,119 @@
    f%
    \egroup}
 
-% \newsignal\quotationsignal
-% \def\quotationskip{.125em}
-% 
-% \def\stelciterenin%
-%   {\dodoubleargument\getparameters[\??ci]}
-% 
-% \def\stelcitatenin%
-%   {\stelciterenin}
-% 
-% \def\dostartcitaat[#1]%
-%   {\bgroup
-%    \@@civoor
-%    \doifelsenothing{#1}
-%      {\let\dostopcitaat=\relax}
-%      {\startsmaller[#1]
-%       \let\dostopcitaat=\stopsmaller}%
-%    \dostartattributes\??ci\c!letter\c!kleur{}%
-%    \setbox0=\hbox{\getvalue{\??la\currentlanguage\c!leftquotation}}%
-%    \hskip-\wd0
-%    \box0\relax
-%    \ignorespaces}
-% 
-% \def\stopcitaat%
-%   {\unskip\hsmash{\getvalue{\??la\currentlanguage\c!rightquotation}}%
-%    \dostopattributes
-%    \dostopcitaat
-%    \@@cina
-%    \egroup}
-% 
-% \def\startcitaat%
-%   {\dosingleempty\dostartcitaat}
-% 
-% \def\dohandlequotation#1%
-%   {\ifdim\lastskip=\quotationsignal
-%      \unskip\hskip\quotationskip
-%    \fi
-% \ifhmode % else funny pagebeaks 
-%    \penalty\!!tenthousand\hskip\!!zeropoint      % == \prewordbreak
-% \fi
-%    \strut % new, needed below 
-%    \getvalue{\??la\currentlanguage#1}%
-%    \penalty\!!tenthousand\hskip\quotationsignal} % +- \prewordbreak
-% 
-% \unexpanded\def\citaat%
-%   {\groupedcommand
-%      {\dohandlequotation\c!leftquotation}
-%      {\dohandlequotation\c!rightquotation}}
-% 
-% \unexpanded\def\citeer%
-%   {\doifelse{\@@ciletter}{\v!normaal}
-%      {\let\next=\doquotedcite}
-%      {\let\next=\doattributedcite}%
-%    \next}
-% 
-% \def\doquotedcite%
-%   {\groupedcommand
-%      {\dohandlequotation\c!leftquote}
-%      {\dohandlequotation\c!rightquote}}
-% 
-% \def\doattributedcite%
-%   {\groupedcommand
-%      {\dostartattributes\??ci\c!letter\c!kleur}
-%      {\dostopattributes}}
-% 
-% % The previous one fails in \placefloat[left]{}{}, so instead
-% % we use the next alternative, where the first one is handled 
-% % outside group. Watch the strut. 
-% 
-% \unexpanded\def\citaat%
-%   {\dohandlequotation\c!leftquotation
-%    \groupedcommand{}{\dohandlequotation\c!rightquotation}}
-% 
-% \def\doquotedcite%
-%   {\dohandlequotation\c!leftquote
-%    \groupedcommand{}{\dohandlequotation\c!rightquote}}
-% 
-% \stelciterenin
-%   [\c!letter=\v!normaal,
-%    \c!kleur=,
-%    \c!voor=\startsmaller,
-%    \c!na=\stopsmaller]
+% actually this is pretty old, but temporary moved here
+
+\def\stelkoppeltekenin
+  {\dodoubleargument\getparameters[\??kp]}
+
+\stelkoppeltekenin
+  [\c!teken=\compoundhyphen]
+ 
+\definehspace [sentence]      [\zeropoint]
+\definehspace [intersentence] [.250em]
+
+\definesymbol
+  [\c!leftsentence]
+  [\languageparameter\c!leftsentence
+   \hskip\hspaceamount\currentlanguage{sentence}]
+
+\definesymbol
+  [\c!rightsentence]
+  [\hskip\hspaceamount\currentlanguage{sentence}%
+   \languageparameter\c!rightsentence]
+
+\definesymbol
+  [\c!leftsubsentence]
+  [\languageparameter\c!leftsubsentence
+   \hskip\hspaceamount\currentlanguage{sentence}]
+
+\definesymbol
+  [\c!rightsubsentence]
+  [\hskip\hspaceamount\currentlanguage{sentence}%
+   \languageparameter\c!rightsubsentence]
+
+\installdiscretionaries || \@@kpteken
+
+\newsignal\subsentencesignal
+\newcounter\subsentencelevel
+
+\def\beginofsubsentence%
+  {\ifdim\lastkern=\subsentencesignal
+     \unskip
+     \kern\hspaceamount\currentlanguage{intersentence}%
+   \fi
+   \doglobal\increment\subsentencelevel
+   \ifnum\subsentencelevel=1
+     \leaveoutervmode
+   \fi
+   \symbol[\ifodd\subsentencelevel\c!leftsentence   \else
+                                  \c!leftsubsentence\fi]%
+   \ignorespaces}
+
+\def\beginofsubsentencespacing%
+  {\kern\subsentencesignal\ignorespaces}
+
+\def\endofsubsentence%
+  {\symbol[\ifodd\subsentencelevel\c!rightsentence   \else
+                                  \c!rightsubsentence\fi]%
+   \doglobal\decrement\subsentencelevel
+   \unskip
+   \kern\subsentencesignal}
+
+\def\endofsubsentencespacing%
+  {\ifdim\lastkern=\subsentencesignal
+     \unskip
+     \hskip\hspaceamount\currentlanguage{intersentence}%
+     \ignorespaces
+   \else
+     \unskip
+   \fi}
+
+% test |<|test |<|test|>| test|>| test \par
+% test|<|test|<|test|>|test|>|test     \par
+% test |<||<|test|>||>| test           \par
+
+\enableactivediscretionaries
 
-\newsignal\quotationsignal \def\quotationskip{.125em}
+\definehspace [quotation]      [\zeropoint]
+\definehspace [interquotation] [.125em]
+
+\definesymbol
+  [\c!leftquotation] 
+  [\languageparameter\c!leftquotation
+   \hskip\hspaceamount\currentlanguage{quotation}]
+
+\definesymbol
+  [\c!rightquotation]
+  [\hskip\hspaceamount\currentlanguage{quotation}%
+   \languageparameter\c!rightquotation]
+
+\definesymbol
+  [\c!leftquote]     
+  [\languageparameter\c!leftquote
+   \hskip\hspaceamount\currentlanguage{quote}]
+
+\definesymbol
+  [\c!rightquote]    
+  [\hskip\hspaceamount\currentlanguage{quote}%
+   \languageparameter\c!rightquote]
+
+\definesymbol
+  [\c!leftspeech]   
+  [\languageparameter\c!leftspeech
+   \hskip\hspaceamount\currentlanguage{speech}]
+
+\definesymbol
+  [\c!rightspeech]   
+  [\hskip\hspaceamount\currentlanguage{speech}%
+   \languageparameter\c!rightspeech]
+
+\definesymbol
+  [\c!middlespeech]  
+  [\hspace\hspaceamount\currentlanguage{speech}% brr 
+   \languageparameter\c!middlespeech]
+
+\newsignal\quotationsignal
 
 \def\stelciterenin%
   {\dodoubleargument\getparameters[\??ci]}
@@ -730,15 +760,9 @@
   {\bgroup
    \dosingleempty\dostartcitaat}
 
-\def\leftquotation {\getvalue{\??la\currentlanguage\c!leftquotation }}
-\def\rightquotation{\getvalue{\??la\currentlanguage\c!rightquotation}}
-
-\def\leftquote     {\getvalue{\??la\currentlanguage\c!leftquote }}
-\def\rightquote    {\getvalue{\??la\currentlanguage\c!rightquote}}
-
 \def\leftquotationmark%
-  {\setbox\scratchbox=\hbox{\leftquotation}%
-   \doif{\@@ciplaats}{\v!marge}{\hskip-\wd\scratchbox}%
+  {\setbox\scratchbox\hbox{\leftquotation}%
+   \doif\@@ciplaats\v!marge{\hskip-\wd\scratchbox}%
    \box\scratchbox}
 
 \def\rightquotationmark%
@@ -765,17 +789,20 @@
 
 \def\dohandlequotation#1#2%
   {\ifdim\lastskip=\quotationsignal
-     \unskip\hskip\quotationskip 
+     \unskip\hskip\hspaceamount\currentlanguage{interquotation}%
    \else
      #2%
    \fi
-   \ifhmode % else funny pagebeaks 
+   \ifhmode % else funny pagebeaks
      \penalty\!!tenthousand\hskip\zeropoint      % == \prewordbreak
    \fi
-   \strut % new, needed below 
-   \getvalue{\??la\currentlanguage#1}%
+   \strut % new, needed below
+   \symbol[#1]%
    \penalty\!!tenthousand\hskip\quotationsignal} % +- \prewordbreak
 
+\def\handlequotation#1%
+  {\dohandlequotation{#1}\relax}
+
 \unexpanded\def\citaat%
   {\groupedcommand
      {\dohandlequotation\c!leftquotation\relax}
@@ -798,8 +825,8 @@
      {\dostopattributes}}
 
 %D The previous one fails in \placefloat[left]{}{}, so instead
-%D we use the next alternative, where the first one is handled 
-%D outside group. Watch the strut. 
+%D we use the next alternative, where the first one is handled
+%D outside group. Watch the strut.
 
 \unexpanded\def\citaat%
   {\dohandlequotation\c!leftquotation\relax
@@ -822,13 +849,13 @@
 %D the low level quotation macros in such a way that a speech
 %D feature could be build on top of it. The speech opening and
 %D closing symbols are defined per language. Italian is an
-%D example of a language that has them set. 
+%D example of a language that has them set.
 
 \newcounter\speechlevel \newconditional\insidespeech
 
-\def\startspeech 
+\def\startspeech
   {\doglobal\increment\speechlevel\relax
-   \dohandlequotation\c!leftspeech\relax 
+   \dohandlequotation\c!leftspeech\relax
    \global\settrue\insidespeech
    \ignorespaces}
 
@@ -837,18 +864,18 @@
    \doglobal\decrement\speechlevel\relax
    \ifcase\speechlevel\relax \global\setfalse\insidespeech \fi}
 
-\def\dohandlespeech% indirect since called in everypar 
-  {\relax % still needed? 
+\def\dohandlespeech % indirect since called in everypar
+  {\relax % still needed?
    \ifcase\speechlevel\or\dodohandlespeech\fi}
 
-\def\dodohandlespeech%
+\def\dodohandlespeech
   {\ifconditional\insidespeech
-     \dohandlequotation\c!middlespeech\relax 
+     \dohandlequotation\c!middlespeech\relax
    \else
      \global\settrue\insidespeech
    \fi}
 
-\unexpanded\def\speech% 
+\unexpanded\def\speech
   {\doglobal\increment\speechlevel\relax
    \dohandlequotation\c!leftspeech\relax
    \groupedcommand
@@ -878,7 +905,6 @@
 \def\activiteit#1#2%
   {\sym{\tijdspan{#1}{#2}}}
 
-
 \def\dotoevoegen#1%
   {\def\next{#1}%
    \dorecurse{#1}{\inlinker{\next~+}\def\next{}\crlf}}
@@ -1099,7 +1125,7 @@
 
 \def\dokenmerk[#1]%
    {\noheaderandfooterlines
-    \bgroup  
+    \bgroup
     \getparameters
       [\??km]
       [\c!bet=\unknown,\c!dat=\unknown,\c!ken=\unknown,
@@ -1112,7 +1138,7 @@
     \assigntranslation[nl=datum,     en=date,     du=Datum,      sp=fecha]\to\@@@kmdat
     \assigntranslation[nl=kenmerk,   en=mark,     du=Kennzeichen,sp=]\to\@@@kmken
     %
-    \definetabulate[\s!dummy][|l|p|]    
+    \definetabulate[\s!dummy][|l|p|]
     \startdummy
       \NC\@@@kmbet\EQ\@@kmbet\NC\NR
       \NC\@@@kmdat\EQ\@@kmdat\NC\NR
@@ -1165,7 +1191,7 @@
    \c!boven=,
    \c!onder=\vfill]
 
-% THIS WAS MAIN-003.TEX 
+% THIS WAS MAIN-003.TEX
 
 \startmessages  dutch  library: systems
      41: externe file -- in groep -- bestaat niet
@@ -1224,7 +1250,7 @@
 % \def\mrm#1%
 %   {$\rm#1$}
 
-%D \macros 
+%D \macros
 %D   {definepairedbox, setuppairedbox, placepairedbox}
 %D
 %D Paired boxes, formally called legends, but from now on a
@@ -1232,17 +1258,17 @@
 %D typesetting some text alongside an illustration. Although
 %D there is quite some variation possible, the functionality is
 %D kept simple, if only because in most cases such pairs are
-%D typeset sober. 
-%D 
+%D typeset sober.
+%D
 %D The location specification accepts a pair, where the first
 %D keyword specifies the arrangement, and the second one the
-%D alignment. The first key of the location pair is one of 
-%D \type {left}, \type {right}, \type {top} or \type {bottom}, 
-%D while the second key can also be \type {middle}. 
+%D alignment. The first key of the location pair is one of
+%D \type {left}, \type {right}, \type {top} or \type {bottom},
+%D while the second key can also be \type {middle}.
 %D
-%D The first box is just collected in an horizontal box, but 
-%D the second one is a vertical box that gets passed the 
-%D bodyfont and alignment settings. 
+%D The first box is just collected in an horizontal box, but
+%D the second one is a vertical box that gets passed the
+%D bodyfont and alignment settings.
 
 %  \startbuffer[test]
 %  \test left   \test left,top    \test left,bottom  \test left,middle
@@ -1250,8 +1276,8 @@
 %  \test top    \test top,left    \test top,right    \test top,middle
 %  \test bottom \test bottom,left \test bottom,right \test bottom,middle
 %  \stopbuffer
-%  
-%  \def\showtest#1% 
+%
+%  \def\showtest#1%
 %    {\pagina
 %     \typebuffer[demo]
 %     \def\test##1
@@ -1263,65 +1289,65 @@
 %          {#1}
 %        \stoplinecorrection}
 %     \getbuffer[test]}
-%  
+%
 %  \startbuffer[demo]
 %  \setuplegend
 %    [width=\hsize,maxwidth=\makeupwidth,
 %     height=\vsize,maxheight=\makeupheight]
 %  \stopbuffer
-%  
+%
 %  \showtest{These examples demonstrate the default settings.}
-%  
+%
 %  \startbuffer[demo]
 %  \setuplegend
 %    [width=\textwidth,
 %     maxwidth=\textwidth]
 %  \stopbuffer
-%  
+%
 %  \showtest{\input tufte }
-%  
+%
 %  \startbuffer[demo]
 %  \setuplegend
 %    [width=.65\textwidth]
 %  \stopbuffer
-%  
+%
 %  \showtest{\input knuth }
-%  
+%
 %  \startbuffer[demo]
 %  \setuplegend
 %    [height=2cm]
 %  \stopbuffer
-%  
+%
 %  \showtest{These examples demonstrate some other settings.}
-%  
+%
 %  \startbuffer[demo]
 %  \setuplegend
 %    [width=.65\textwidth,
 %     height=2cm]
 %  \stopbuffer
-%  
+%
 %  \showtest{These examples demonstrate some other settings.}
-%  
+%
 %  \startbuffer[demo]
 %  \setuplegend
 %    [n=2,align=right,width=.5\textwidth]
 %  \stopbuffer
-%  
+%
 %  \showtest{\input zapf }
 
-%D \macros 
+%D \macros
 %D   {setuplegend, placelegend}
 %D
-%D It makes sense to typeset a legend to a figure in \TEX\ 
+%D It makes sense to typeset a legend to a figure in \TEX\
 %D and not in a drawing package. The macro \type {\placelegend}
 %D combines a figure (or something else) and its legend. This
 %D command is just a paired box.
 %D
-%D The legend is placed according to \type {location}, being 
+%D The legend is placed according to \type {location}, being
 %D \type {bottom} or \type {right}. The macro macro is used as
-%D follows. 
+%D follows.
 %D
-%D \starttypen 
+%D \starttypen
 %D \placefigure
 %D   {whow}
 %D   {\placelegend
@@ -1331,7 +1357,7 @@
 %D       \NC 2 \NC legs \NC \NR
 %D       \NC 3 \NC tail \NC \NR
 %D       \stoptabulation}}
-%D 
+%D
 %D \placefigure
 %D   {whow}
 %D   {\placelegend
@@ -1340,7 +1366,7 @@
 %D       \NC 1 \NC head \NC 3 \NC tail \NC \NR
 %D       \NC 2 \NC legs \NC   \NC      \NC \NR
 %D       \stoptabulation}}
-%D 
+%D
 %D \placefigure
 %D   {whow}
 %D   {\placelegend[n=2]
@@ -1350,33 +1376,33 @@
 %D       \NC 2 \NC legs \NC \NR
 %D       \NC 3 \NC tail \NC \NR
 %D       \stoptabulation}}
-%D 
+%D
 %D \placefigure
 %D   {whow}
 %D   {\placelegend[n=2]
 %D      {\externalfigure[cow]}
 %D      {head \par legs \par tail}}
-%D 
+%D
 %D \placefigure
 %D   {whow}
 %D   {\placelegend[n=2]
 %D      {\externalfigure[cow]}
 %D      {\startitemize[packed]
-%D       \item head \item legs \item  tail \item belly \item horns 
+%D       \item head \item legs \item  tail \item belly \item horns
 %D       \stopitemize}}
-%D 
+%D
 %D \placefigure
 %D   {whow}
 %D   {\placelegend[n=2,width=.8\hsize]
 %D      {\externalfigure[cow]}
 %D      {\startitemize[packed]
-%D       \item head \item legs \item  tail \item belly \item horns 
+%D       \item head \item legs \item  tail \item belly \item horns
 %D       \stopitemize}}
-%D \stoptypen 
+%D \stoptypen
 
 % \def\setuplegend%
 %   {\dodoubleargument\getparameters[\??ld]}
-% 
+%
 % \setuplegend
 %   [\c!n=1,
 %    \c!afstand=1em,
@@ -1385,15 +1411,15 @@
 %    \c!hoogte=\vsize,
 %    \c!korps=,
 %    \c!plaats=\v!onder]
-% 
+%
 % \def\placelegend%
 %   {\bgroup
 %    \dosingleempty\doplacelegend}
-% 
+%
 % \def\doplacelegend[#1]% watch the hsize/vsize tricks
-%   {\setuplegend[#1]%  % and don't change them 
+%   {\setuplegend[#1]%  % and don't change them
 %    \dowithnextbox
-%      {\switchtobodyfont[\@@ldkorps]% split under same regime  
+%      {\switchtobodyfont[\@@ldkorps]% split under same regime
 %       \scratchdimen=\wd\nextbox
 %       \doifelse{\@@ldplaats}{\v!rechts}
 %         {\vsize=\ht\nextbox
@@ -1435,8 +1461,8 @@
 %            \let\next=}
 %    \hbox}
 
-\newbox\firstpairedbox 
-\newbox\secondpairedbox 
+\newbox\firstpairedbox
+\newbox\secondpairedbox
 
 \def\definepairedbox%
   {\dodoubleempty\dodefinepairedbox}
@@ -1466,12 +1492,12 @@
 \def\dosetuppairedbox[#1]%
   {\getparameters[\??ld#1]}
 
-\def\placepairedbox% 
+\def\placepairedbox%
   {\bgroup\dodoubleempty\doplacepairedbox}
 
 \def\doplacepairedbox[#1][#2]% watch the hsize/vsize tricks
-  {\setuppairedbox[#1][#2]%     % and don't change them 
-   \copyparameters 
+  {\setuppairedbox[#1][#2]%     % and don't change them
+   \copyparameters
      [\??ld][\??ld#1]
      [\c!n,\c!afstand,\c!tussen,\c!voor,\c!na,
       \c!breedte,\c!hoogte,\c!maxbreedte,\c!maxhoogte,
@@ -1490,17 +1516,17 @@
    \hbox}
 
 \def\beforefirstpairedbox%
-  {\chardef\pairedlocationa=1 % left 
+  {\chardef\pairedlocationa=1 % left
    \chardef\pairedlocationb=4 % middle
    \getfromcommacommand[\@@ldplaats][1]%
-   \processaction 
+   \processaction
      [\commalistelement]
      [ \v!links=>\chardef\pairedlocationa=0,
       \v!rechts=>\chardef\pairedlocationa=1,
        \v!boven=>\chardef\pairedlocationa=2,
        \v!onder=>\chardef\pairedlocationa=3]%
    \getfromcommacommand[\@@ldplaats][2]%
-   \processaction 
+   \processaction
      [\commalistelement]
      [ \v!links=>\chardef\pairedlocationb=0,
       \v!rechts=>\chardef\pairedlocationb=1,
@@ -1511,10 +1537,10 @@
       \v!midden=>\chardef\pairedlocationb=4]}
 
 \def\betweenbothpairedboxes%
-  {\switchtobodyfont[\@@ldkorps]% split under same regime  
+  {\switchtobodyfont[\@@ldkorps]% split under same regime
    \setbox\firstpairedbox=\box\nextbox
    \ifnum\pairedlocationa<2
-     \hsize\wd\firstpairedbox % trick 
+     \hsize\wd\firstpairedbox % trick
      \hsize=\@@ldbreedte
      \scratchdimen=\wd\firstpairedbox
      \advance\scratchdimen by \@@ldafstand
@@ -1527,7 +1553,7 @@
        \egroup
      \fi
    \else
-     \hsize\wd\firstpairedbox 
+     \hsize\wd\firstpairedbox
      \hsize\@@ldbreedte % can be \hsize
      \ifdim\hsize>\@@ldmaxbreedte\relax \hsize=\@@ldmaxbreedte \fi % can be \hsize
    \fi
@@ -1538,16 +1564,16 @@
 \def\afterbothpairedboxes%
   {\setbox\secondpairedbox=\vbox
      {\ifnum\@@ldn>1 \rigidcolumnbalance\nextbox \else \box\nextbox \fi}%
-   \ifnum\pairedlocationa<2\hbox\else\vbox\fi\bgroup % hide vsize 
+   \ifnum\pairedlocationa<2\hbox\else\vbox\fi\bgroup % hide vsize
    \forgetall
-   \ifnum\pairedlocationa<2 
+   \ifnum\pairedlocationa<2
      \scratchdimen=\maxoftwoboxdimens\ht\firstpairedbox\secondpairedbox
-     \vsize=\scratchdimen 
+     \vsize=\scratchdimen
      \ifdim\scratchdimen<\@@ldhoogte\relax % can be \vsize
-       \scratchdimen=\@@ldhoogte 
+       \scratchdimen=\@@ldhoogte
      \fi
      \ifdim\scratchdimen>\@@ldmaxhoogte\relax
-       \scratchdimen=\@@ldmaxhoogte 
+       \scratchdimen=\@@ldmaxhoogte
      \fi
      \valignpairedbox\firstpairedbox \scratchdimen
      \valignpairedbox\secondpairedbox\scratchdimen
@@ -1558,10 +1584,10 @@
      \scratchdimen=\ht\secondpairedbox
      \vsize=\scratchdimen
      \ifdim\ht\secondpairedbox<\@@ldhoogte\relax % can be \vsize
-       \scratchdimen=\@@ldhoogte\relax % \relax needed 
+       \scratchdimen=\@@ldhoogte\relax % \relax needed
      \fi
      \ifdim\scratchdimen>\@@ldmaxhoogte\relax % todo: totale hoogte
-       \scratchdimen=\@@ldmaxhoogte\relax % \relax needed 
+       \scratchdimen=\@@ldmaxhoogte\relax % \relax needed
      \fi
      \ifdim\scratchdimen>\ht\secondpairedbox
        \setbox\secondpairedbox\vbox to \scratchdimen
@@ -1642,7 +1668,7 @@
         \def\next%
           {\futurelet\nexttoken\nextnext}
         \def\nextnext%
-          {\ifx\nexttoken\egroup \else % the next box is empty  
+          {\ifx\nexttoken\egroup \else % the next box is empty
              \hsize\wd0
              \steluitlijnenin[\@@couitlijnen]
              \bgroup
@@ -1799,11 +1825,11 @@
    \vbox to #1\nextbox
      {#2\relax
       \hbox to #4\nextbox
-        {#5\relax % \number removes leading spaces too 
+        {#5\relax % \number removes leading spaces too
          \edef\@@rorotatie{\number\@@rorotatie}%
          \doifelsenothing{\@@rorotatie}
            {\dostartrotation{90}}
-           {\dostartrotation{\@@rorotatie}}% 
+           {\dostartrotation{\@@rorotatie}}%
          \wd\nextbox=\!!zeropoint
          \ht\nextbox=\!!zeropoint
          \box\nextbox
@@ -1859,16 +1885,16 @@
 
 % schaal
 
-\def\doscalelikeafigure%
+\def\doscalelikeafigure
   {\doifsomething{\@@xyfactor\@@xyschaal\@@xyhfactor\@@xybreedte\@@xyhoogte}
      {\let \@@efschaal \@@xyschaal
       \let \@@effactor \@@xyfactor
-      \let \@@efbfactor\@@xybfactor 
+      \let \@@efbfactor\@@xybfactor
       \let \@@efhfactor\@@xyhfactor
       \let \@@efbreedte\@@xybreedte
       \let \@@efhoogte \@@xyhoogte
       \let \@@epx      \!!zeropoint
-      \let \@@epy      \!!zeropoint   
+      \let \@@epy      \!!zeropoint
       \edef\@@epw     {\the\wd\nextbox}%
       \edef\@@eph     {\the\ht\nextbox}%
       \setfactorfiguresize
@@ -1876,10 +1902,10 @@
       \setdimensionfiguresize
       \convertfigureinsertscale\@@epx\figx\figxsca\scax
       \convertfigureinsertscale\@@epy\figy\figysca\scay
-      \scratchdimen=\scax pt \divide\scratchdimen by 100 
+      \scratchdimen=\scax pt \divide\scratchdimen by 100
       \edef\@@xysx{\withoutpt\the\scratchdimen}%
-      \scratchdimen=\scay pt \divide\scratchdimen by 100 
-      \edef\@@xysy{\withoutpt\the\scratchdimen}}}   
+      \scratchdimen=\scay pt \divide\scratchdimen by 100
+      \edef\@@xysy{\withoutpt\the\scratchdimen}}}
 
 \def\doschaal[#1]%
   {\bgroup
@@ -1895,7 +1921,7 @@
       \dimen0=\@@xysy\ht\nextbox
       \dimen2=\@@xysy\dp\nextbox
       \dimen4=\@@xysx\wd\nextbox
-      \dimen6=\dimen0\advance\dimen6 by \dimen2 
+      \dimen6=\dimen0\advance\dimen6 by \dimen2
       \setbox\nextbox=\vbox to \dimen6
         {\ht\nextbox=\zeropoint
          \dp\nextbox=\zeropoint
@@ -1933,8 +1959,10 @@
 %
 %\spiegel{\ruledhbox{\copy0 \schaal{\box0}}}
 
-% verdelen \hsize in fracties, wordt nog wat algemener, 
-% beetje vaag nu 
+% to be used in some other places! todo!
+%
+% verdelen \hsize in fracties, wordt nog wat algemener,
+% beetje vaag nu
 %
 % \fractie[n/m,elementen,afstand]
 %
@@ -1951,20 +1979,20 @@
 
 \def\dodofractie[#1/#2,#3,#4,#5]%
   {\doifelsenothing{#3}
-     {\doifelse{\@@frn}{\v!passend}
-        {\!!counta=#2\relax}
-        {\!!counta=\@@frn\relax}}
-     {\!!counta=#3\relax}%
+     {\doifelse\@@frn\v!passend
+        {\!!counta#2\relax}
+        {\!!counta\@@frn\relax}}
+     {\!!counta#3\relax}%
    \doifelsenothing{#4}
-     {\doifelse{\@@frafstand}{\v!passend}
-        {\!!widtha=\!!zeropoint}
-        {\!!widtha=\@@frafstand}}
-     {\!!widtha=#4}%
-   \advance\!!counta by -1\relax
-   \multiply\!!widtha by \!!counta
-   \advance\hsize by -\!!widtha
-   \divide\hsize by #2\relax
-   \hsize=#1\hsize}
+     {\doifelse\@@frafstand\v!passend
+        {\!!widtha\zeropoint}
+        {\!!widtha\@@frafstand}}
+     {\!!widtha#4}%
+   \advance\!!counta -1\relax
+   \multiply\!!widtha \!!counta
+   \advance\hsize -\!!widtha
+   \divide\hsize #2\relax
+   \hsize#1\hsize}
 
 \def\dofractie[#1]%
   {\dodofractie[#1,,,,,,]}
@@ -1976,4 +2004,77 @@
   [\c!afstand=\tfskipsize,
    \c!n=\v!passend]
 
+%D This one is for Daniel Pittman, who wanted tight
+%D fractions. We show three versions. First the simple
+%D one using \type {\low} and \type {high}:
+%D
+%D \startbuffer
+%D \def\vfrac#1#2%
+%D   {\hbox{\high{\tx#1\kern-.25em}/\low{\kern-.25em\tx#2}}}
+%D
+%D test \vfrac{1}{2} test \vfrac{123}{456} test
+%D \stopbuffer
+%D
+%D \typebuffer {\showmakeup\haalbuffer}
+%D
+%D A better way to handle the kerning is the following, here
+%D we kind of assume that tye slash is symmetrical and has
+%D nearly zero width.
+%D
+%D \startbuffer
+%D \def\vfract#1#2%
+%D   {\hbox{\high{\tx#1}\hbox to \zeropoint{\hss/\hss}\low{\tx#2}}}
+%D \stopbuffer
+%D
+%D \typebuffer {\showmakeup\haalbuffer}
+%D
+%D The third and best alternative is the following:
+%D
+%D {\showmakeup\haalbuffer}\crlf\haalbuffer
+%D
+%D This time we measure the height of the \type {/} and
+%D shift over the maximum height and depths of this
+%D character and the fractional digits (we use 57 as
+%D sample). Here we combine all methods in one macros.
+
+\chardef\vulgarfractionmethod=3
+
+\definehspace[vulgarfraction][.25em] % [.15em]
+\definesymbol[vulgarfraction][/]     % [\raise.2ex\hbox{/}]
+
+\def\vulgarfraction#1#2%
+  {\dontleavehmode
+   \hbox
+     {\def\vulgarfraction{vulgarfraction}%
+      \ifcase\vulgarfractionmethod
+        #1\symbol[\vulgarfraction]#2%
+      \or
+        \high{\tx#1\kern-\hspaceamount\empty\vulgarfraction}%
+        \symbol[\vulgarfraction]%
+        \low {\kern-\hspaceamount\empty\vulgarfraction\tx#2}%
+      \or
+        \high{\tx#1}%
+        \hbox to \zeropoint{\hss\symbol[\vulgarfraction]\hss}%
+        \low{\tx#2}%
+      \or
+        \setbox0\hbox{\symbol[\vulgarfraction]}%
+        \setbox2\hbox{\txx57}%
+        \raise\ht0\hbox{\lower\ht2\hbox{\txx#1}}%
+        \hbox to \zeropoint{\hss\symbol[\vulgarfraction]\hss}%
+        \lower\dp0\hbox{\raise\dp2\hbox{\txx#2}}%
+      \fi}}
+
+\ifx\vfrac\undefined \let\vfrac\vulgarfraction \fi
+
+%D \starttabulate
+%D \HL
+%D \NC \bf method \NC \bf visualization \NC\NR
+%D \HL
+%D \NC 0 \NC \chardef\vulgarfractionmethod0\vulgarfraction{1}{2} \NC\NR
+%D \NC 1 \NC \chardef\vulgarfractionmethod1\vulgarfraction{1}{2} \NC\NR
+%D \NC 2 \NC \chardef\vulgarfractionmethod2\vulgarfraction{1}{2} \NC\NR
+%D \NC 3 \NC \chardef\vulgarfractionmethod3\vulgarfraction{1}{2} \NC\NR
+%D \HL
+%D \stoptabulate
+
 \protect \endinput
diff --git a/tex/context/base/core-nav.tex b/tex/context/base/core-nav.tex
index e1ecb0322..9fab3742d 100644
--- a/tex/context/base/core-nav.tex
+++ b/tex/context/base/core-nav.tex
@@ -351,6 +351,7 @@
    \c!titel=,
    \c!subtitel=,
    \c!auteur=,
+   \c!trefwoord=,
    \c!datum=\@@iatimestamp]
 
 \protect 
diff --git a/tex/context/base/core-new.tex b/tex/context/base/core-new.tex
index 96dbdba5c..9ad3e6fb9 100644
--- a/tex/context/base/core-new.tex
+++ b/tex/context/base/core-new.tex
@@ -294,64 +294,6 @@
 %\ruledhbox{\offsetbox[x=-1cm,y=-1cm,location=c]
 %  {\framed[width=4cm,height=4cm]{x}}}
 
-% actually this is pretty old, but temporary moved here
-
-\installdiscretionaries || \@@kpteken
-
-\newsignal\subsentencesignal
-\newcounter\subsentencelevel
-\def\subsentenceskip{.25em\relax}
-
-\def\stelkoppeltekenin%
-  {\dodoubleargument\getparameters[\??kp]}
-
-\def\beginofsubsentence%
-  {\ifdim\lastkern=\subsentencesignal
-     \unskip
-     \kern\subsentenceskip
-   \fi
-   \doglobal\increment\subsentencelevel
-   \ifnum\subsentencelevel=1
-     \leaveoutervmode
-   \fi
-   \ifodd\subsentencelevel
-     \getvalue{\??la\currentlanguage\c!leftsentence}%
-   \else
-     \getvalue{\??la\currentlanguage\c!leftsubsentence}%
-   \fi
-   \ignorespaces}
-
-\def\beginofsubsentencespacing%
-  {\kern\subsentencesignal\ignorespaces}
-
-\def\endofsubsentence%
-  {\ifodd\subsentencelevel
-     \getvalue{\??la\currentlanguage\c!rightsentence}%
-   \else
-     \getvalue{\??la\currentlanguage\c!rightsubsentence}%
-   \fi
-   \doglobal\decrement\subsentencelevel
-   \unskip
-   \kern\subsentencesignal}
-
-\def\endofsubsentencespacing%
-  {%\ifdim\lastkern=\subsentencesignal \else
-   %  \unskip
-   %\fi
-   \ifdim\lastkern=\subsentencesignal
-     \unskip
-     \hskip\subsentenceskip
-     \ignorespaces
-   \else
-     \unskip
-   \fi}
-
-% test |<|test |<|test|>| test|>| test \par
-% test|<|test|<|test|>|test|>|test     \par
-% test |<||<|test|>||>| test           \par
-
-\enableactivediscretionaries
-
 %D new and beta
 
 % \def\defineshortcut%
diff --git a/tex/context/base/core-not.tex b/tex/context/base/core-not.tex
index 26c9e7d93..36a61db1d 100644
--- a/tex/context/base/core-not.tex
+++ b/tex/context/base/core-not.tex
@@ -39,7 +39,7 @@
 %D taken into account in the pagebreak calculations. This kind
 %D of calculations are forced by using \type{\insert}.
 
-\ifx\footins\undefined \newinsert\footins \fi
+\installinsertion\footins
 
 %D \macros
 %D   {setupfootnotes,setupfootnotedefinition}
@@ -139,7 +139,6 @@
         \scratchcounter=1
       \else
         \scratchcounter=\@@vnn\relax
-       %\divide\count\footins by \scratchcounter
       \fi
       \global\endnotesfalse
       \global\bottomnotestrue
@@ -791,13 +790,6 @@
 %D \setupfootnotes[location={text,none}]
 %D \stoptypen 
 
-%\def\placefootnotesasnone#1% is grouped already 
-%  {\ifdim\ht#1>\zeropoint
-%     \@@vnvoor
-%     \setfootnotebodyfont \unvbox#1\endgraf
-%     \@@vnna 
-%   \fi}
-
 \def\placefootnotesasnone#1% is grouped already 
   {\ifdim\ht#1>\zeropoint
      \@@vnvoor
@@ -888,7 +880,7 @@
 %D \haalbuffer
 
 %D \macros
-%D   {placefootnotes}
+%D   {placefootnotes, fakefootnotes}
 %D
 %D We still have no decent command for placing footnotes
 %D somewhere else than at the bottom of the page (for which no
@@ -915,7 +907,32 @@
    \fi \fi
    \egroup}
 
-%D Now how can this mechanims be hooked into \CONTEXT\ without
+\def\fakefootnotes
+  {\ifhmode \endgraf \fi
+   \ifvmode 
+     \calculatefootnotevsize
+     \ifdim\footnotevsize>\zeropoint \kern\footnotevsize \fi
+   \fi}
+
+\newdimen\footnotevsize
+
+\def\calculatefootnotevsize
+  {\footnotevsize\zeropoint
+   \ifdim\ht\footins>\zeropoint
+     \advance\footnotevsize\ht\footins
+     \advance\footnotevsize\skip\footins
+   \fi}
+
+\newif\iffootnotespresent % global ?  
+
+\def\checkfootnotepresence
+  {\ifdim\ht\footins>\zeropoint     
+     \footnotespresenttrue
+   \else
+     \footnotespresentfalse
+   \fi}
+
+%D Now how can this mechanism be hooked into \CONTEXT\ without
 %D explictly postponing footnotes? The solution turned out to
 %D be rather simple:
 %D
diff --git a/tex/context/base/core-pos.tex b/tex/context/base/core-pos.tex
index 3b6b16737..02d49db16 100644
--- a/tex/context/base/core-pos.tex
+++ b/tex/context/base/core-pos.tex
@@ -83,11 +83,11 @@
 
 \def\POSprefix{POS::}
 
-\def\pxypos    {\pospxy}      % obsolete
-\def\pxyposwhd {\pospxywhd}   % obsolete
-\def\pxyposplus{\pospxyplus}  % obsolete
+\def\pxypos    {\pospxy}     % obsolete
+\def\pxyposwhd {\pospxywhd}  % obsolete
+\def\pxyposplus{\pospxyplus} % obsolete
 
-\def\resetpositions%
+\def\resetpositions
   {\let\pospxy    \gobblefourarguments
    \let\pospxywhd \gobblesevenarguments
    \let\pospxyplus\gobbleeightarguments}
@@ -240,7 +240,7 @@
 
 \beginETEX
 
-\def\doMPxyhdwlr#1#2% evt kan \s!unknown leeg zijn 
+\def\doMPxyhdwlr#1#2% evt kan \s!unknown leeg zijn
   {\@EA\@EA\@EA#1\csname\POSprefix
      \ifcsname\POSprefix#2\endcsname#2\else\s!unknown\fi\endcsname
      ,0,0,0,0\relax}
@@ -278,14 +278,14 @@
    \fi}
 
 % \beginETEX
-% 
+%
 % \def\MPdoplus#1#2#3#4%
 %   {\ifcsname\POSprefix#2\endcsname
 %      \@EA\@EA\@EA#1\csname\POSprefix#2\endcsname,,,,,,,,,\relax{#3}%
 %    \else
 %      #4%
 %    \fi}
-% 
+%
 % \endETEX
 
 \def\doMPplus#1,#2,#3,#4,#5,#6,%
@@ -431,7 +431,7 @@
 %   {\doifdefinedelse{\POSprefix#1}}
 
 \def\doifpositionelse#1%
-  {\ifundefined{\POSprefix#1}% 
+  {\ifundefined{\POSprefix#1}%
      \expandafter\secondoftwoarguments
    \else
      \expandafter\firstoftwoarguments
@@ -466,7 +466,7 @@
 
 % \def\lpos#1{\lrpos{l:#1}{\kern\leftskip}}
 % \def\rpos#1{\lrpos{r:#1}{\hskip\hsize\hskip-\rightskip}}
-% 
+%
 % \def\lrpos#1#2%
 %   {\dontleavehmode\vadjust % may disappear if buried
 %      {\setbox0=\hbox{\raise\dp\strutbox\hbox{\hpos{#1}{\strut}}}%
@@ -481,7 +481,7 @@
    \ignorespaces}
 
 \def\tpos#1%
-  {\removelastspace 
+  {\removelastspace
    \setpositionplus{e:#1}{\parposcounter}\hbox{\strut}}
 
 \def\ffpos#1%
@@ -489,7 +489,7 @@
    \ignorespaces}
 
 \def\ttpos#1%
-  {\removelastspace 
+  {\removelastspace
    \setpositionbox{e:#1}\hbox{\strut}}
 
 \def\wpos#1%
@@ -519,15 +519,15 @@
 
 \def\registerparoptions%
   {\ifpositioningpar
-     \ifpositioning 
-       \ifinpagebody \else 
-         \ifmmode \else 
+     \ifpositioning
+       \ifinpagebody \else
+         \ifmmode \else
            \ifinformula \else
              \doregisterparoptions
-           \fi 
+           \fi
          \fi
-       \fi  
-     \fi 
+       \fi
+     \fi
    \fi}
 
 \def\doregisterparoptions%
@@ -743,7 +743,7 @@
 \def\MPanchoridentifier{mp-anchor} % {MPA} % {mp-anchor}
 \def\MPoverlayposprefix{MO::}
 
-\long\def\defineMPpositiongraphic#1% 
+\long\def\defineMPpositiongraphic#1%
   {\long\setvalue{\MPoverlayposprefix#1}}
 
 %D The rest of the definitions concerning such overlays may
@@ -754,6 +754,18 @@
 %D Position actions are automatically executed when a position
 %D is set.
 
+% \def\positionoverlay#1%
+%   {\ifpositioning
+%      \vbox to \overlayheight
+%        {\edef\MPanchor##1{\MPpos{#1::\MPanchoridentifier:\realfolio}}%
+%         \the\everyinsertpositionaction
+%         \copyposition{#1::\MPanchoridentifier}{#1::\MPanchoridentifier:\realfolio}%
+%         \hpos
+%           {#1::\MPanchoridentifier:\realfolio}
+%           {\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}}%
+%         \vfill}%
+%    \fi}
+
 \def\positionoverlay#1%
   {\ifpositioning
      \vbox to \overlayheight
@@ -821,7 +833,7 @@
    \fi}
 
 \appendtoks
-  \let\dohandlepositionboxes\doinsertpositionboxes % was handle ? 
+  \let\dohandlepositionboxes\doinsertpositionboxes % was handle ?
 \to \everyinsertpositionaction
 
 \def\docleanpositionboxes#1#2#3% pos tag setups
@@ -968,13 +980,15 @@
   [mpos:box]
   [linecolor=blue,
    linewidth=\linewidth,
-   fillcolor=lightgray]
+   fillcolor=lightgray,
+   filloffset=\!!zeropoint]
 
 \startMPpositiongraphic{mpos:box}{fillcolor,linecolor,linewidth}
   initialize_box(\MPpos{\MPvar{self}}) ;
-  boxfillcolor := \MPvar{fillcolor} ;
-  boxlinecolor := \MPvar{linecolor} ;
-  boxlinewidth := \MPvar{linewidth} ;
+  boxfillcolor  := \MPvar{fillcolor} ;
+  boxlinecolor  := \MPvar{linecolor} ;
+  boxlinewidth  := \MPvar{linewidth} ;
+  boxfilloffset := \MPvar{filloffset} ;
   draw_box ;
   anchor_box(\MPanchor{\MPvar{self}}) ;
 \stopMPpositiongraphic
@@ -983,20 +997,22 @@
   [mpos:area]
   [linecolor=blue,
    linewidth=\linewidth,
-   fillcolor=lightgray]
+   fillcolor=lightgray,
+   filloffset=\!!zeropoint]
 
 \startMPpositiongraphic{mpos:area}{fillcolor,linecolor,linewidth}
   initialize_area(\MPpos{b:\MPvar{self}},\MPpos{e:\MPvar{self}}) ;
-  boxfillcolor := \MPvar{fillcolor} ;
-  boxlinecolor := \MPvar{linecolor} ;
-  boxlinewidth := \MPvar{linewidth} ;
+  boxfillcolor  := \MPvar{fillcolor} ;
+  boxlinecolor  := \MPvar{linecolor} ;
+  boxlinewidth  := \MPvar{linewidth} ;
+  boxfilloffset := \MPvar{filloffset} ;
   draw_area ;
   anchor_area(\MPanchor{b:\MPvar{self}}) ;
 \stopMPpositiongraphic
 
 %D This is already cleaned up.
 
-% gridtype = 1 => baseline 
+% gridtype = 1 => baseline
 % gridtype = 2 => betweenline
 
 \setupMPvariables
@@ -1008,6 +1024,7 @@
    gridcolor=red,
    linecolor=blue,
    fillcolor=lightgray,
+   filloffset=\!!zeropoint,
    linewidth=\linewidth,
    gridwidth=\linewidth,
    lineradius=.5\bodyfontsize]
@@ -1023,6 +1040,7 @@
    boxgridcolor  := \MPvar{gridcolor} ;
    boxlinecolor  := \MPvar{linecolor} ;
    boxfillcolor  := \MPvar{fillcolor} ;
+   boxfilloffset := \MPvar{filloffset} ;
    boxlinewidth  := \MPvar{linewidth} ;
    boxgridwidth  := \MPvar{gridwidth} ;
    boxlineradius := \MPvar{lineradius} ;
@@ -1031,7 +1049,7 @@
 % \startMPpositionmethod{mpos:par}
 %   \doifpositionelse{w:\MPvar{self}}
 %     {\startMPpositiongraphic{mpos:par}%
-%          {fillcolor,linecolor,gridcolor,linewidth,gridwidth,lineradius}
+%          {fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,lineradius}
 %        initialize_area_par(\MPpos{b:\MPvar{self}},
 %                            \MPpos{e:\MPvar{self}},
 %                            \MPpos{w:\MPvar{self}}) ;
@@ -1040,7 +1058,7 @@
 %        anchor_par(\MPanchor{b:\MPvar{self}}) ;
 %      \stopMPpositiongraphic}
 %     {\startMPpositiongraphic{mpos:par}%
-%          {fillcolor,linecolor,gridcolor,linewidth,gridwidth,lineradius}
+%          {fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,lineradius}
 %        initialize_par(\MPpos{b:\MPvar{self}},
 %                       \MPpos{e:\MPvar{self}},
 %                       \MPpos{text:\realfolio},
@@ -1048,7 +1066,7 @@
 %                       \MPvv {p:\parcounter}{0,0,0,0,0,0}) ;
 %        \includeMPgraphic{mpos:par:setup} ;
 %        \includeMPgraphic{\MPvar{mp}} ; % \includeMPgraphic{mpos:par:shape} ;
-%        anchor_par(\MPanchor{b:\MPvar{self}}) ;  
+%        anchor_par(\MPanchor{b:\MPvar{self}}) ;
 %      \stopMPpositiongraphic}%
 %   \MPpositiongraphic{mpos:par}{}%
 % \stopMPpositionmethod
@@ -1066,7 +1084,7 @@
 % \startMPpositionmethod{mpos:par}
 %   \edef\parcounter{\MPv\MPbself{1}{0}}%
 %   \startMPpositiongraphic{mpos:par}%
-%       {fillcolor,linecolor,gridcolor,linewidth,gridwidth,lineradius}
+%       {fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,lineradius}
 %     initialize_par(\MPpos\MPbself, \MPpos\MPeself,
 %                    \MPpos\textanchor, \MPpos\paranchor,
 %                    \MPvv\paranchor{0,0,0,0,0,0}) ;
@@ -1081,29 +1099,29 @@
   \edef\parcounter{\MPv\MPbself{1}{0}}%
   \doifpositionelse\MPwself
     {\startMPpositiongraphic{mpos:par}%
-         {fillcolor,linecolor,gridcolor,linewidth,gridwidth,lineradius}
+         {fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,lineradius}
        initialize_area_par(\MPpos\MPbself,
                            \MPpos\MPeself,
                            \MPpos\MPwself) ;
        \includeMPgraphic{mpos:par:setup} ;
-       \includeMPgraphic{\MPvar{mp}} ; 
+       \includeMPgraphic{\MPvar{mp}} ;
        anchor_par(\MPanchor\MPbself) ;
      \stopMPpositiongraphic}
     {\startMPpositiongraphic{mpos:par}%
-         {fillcolor,linecolor,gridcolor,linewidth,gridwidth,lineradius}
+         {fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,lineradius}
        initialize_par(\MPpos\MPbself,
                       \MPpos\MPeself,
                       \MPpos\textanchor,
                       \MPpos\paranchor,
                       \MPvv \paranchor{0,0,0,0,0,0}) ;
        \includeMPgraphic{mpos:par:setup} ;
-       \includeMPgraphic{\MPvar{mp}} ; 
+       \includeMPgraphic{\MPvar{mp}} ;
        anchor_par(\MPanchor\MPbself) ;
      \stopMPpositiongraphic}%
   \MPpositiongraphic{mpos:par}{}%
 \stopMPpositionmethod
 
-%D So far for the unreadable alternative. 
+%D So far for the unreadable alternative.
 
 \appendtoks
   \savecurrentvalue\totalnofparbackgrounds\nofparbackgrounds
@@ -1157,7 +1175,7 @@
    \dodostarttextbackground}
 
 \def\dopresettextbackground#1%
-  {\ExpandFirstAfter\processaction % \EFA niet echt nodig 
+  {\ExpandFirstAfter\processaction % \EFA niet echt nodig
      [\getvalue{\??td#1\c!plaats}]
      [ \v!tekst=>\let\dodostarttextbackground\dostarttextbackgroundtxt
                  \let\dodostoptextbackground \dostoptextbackgroundtxt,
@@ -1185,6 +1203,7 @@
            gridcolor=\getvalue{\??td#1\c!kaderkleur},
            linecolor=\getvalue{\??td#1\c!kaderkleur},
            fillcolor=\getvalue{\??td#1\c!achtergrondkleur},
+           filloffset=\getvalue{\??td#1\c!achtergrondoffset},
            gridwidth=\getvalue{\??td#1\c!lijndikte},
            linewidth=\getvalue{\??td#1\c!lijndikte},
            lineradius=\getvalue{\??td#1\c!straal}}}%
@@ -1250,17 +1269,17 @@
    \else
      % two or more pages
      \scratchdimen        =\MPy#1%\btanchor
-     \advance\scratchdimen-\MPy#2%\etbanchor 
+     \advance\scratchdimen-\MPy#2%\etbanchor
      \advance\scratchdimen-\MPy\textanchor
      \advance\scratchdimen \MPy\textanchor
      \advance\scratchdimen \MPh\textanchor\relax
      \ifcase\scratchcounter>2 \ifnum\scratchcounter<5
        % more pages
        \scratchdimen\teksthoogte
-       \advance\scratchcounter -1 
+       \advance\scratchcounter -1
        \multiply\scratchdimen \scratchcounter
      \else
-       % keep'm small 
+       % keep'm small
        \scratchdimen=5\teksthoogte
      \fi \fi
    \fi
@@ -1281,16 +1300,24 @@
    \fi
    \edef\textparwidth{\the\scratchdimen}}
 
+\def\mintextparheight{4\lineheight}
+
 \def\dontsplitnexttextbackground % dangerous but useful
   {\ifdim\pagetotal>\teksthoogte \else
      \ifdim\pagegoal=\maxdimen \else
-       \calculatenexttextpardimensions
-       \scratchdimen=\textparheight
-       \advance\scratchdimen\pagetotal\relax
-       \ifdim\scratchdimen>\pagegoal
-         \pagina
-       \fi
-     \fi
+      \calculatenexttextpardimensions
+      % too tricky 
+      % \scratchdimen=\textparheight
+      % \advance\scratchdimen\pagetotal\relax
+      % \ifdim\scratchdimen>\pagegoal
+      % \pagina
+      % \fi
+      \ifdim\textparheight>\zeropoint
+        \ifdim\textparheight>\mintextparheight\else
+          \pagina % option 
+        \fi
+      \fi
+    \fi
    \fi}
 
 \def\definetextbackground%
@@ -1301,6 +1328,7 @@
      \copyparameters[\??td#1][\??td]
        [\c!status,\c!plaats,\c!variant,\c!mp,
         \c!achtergrond,\c!achtergrondkleur,\c!hoek,\c!niveau,
+        \c!achtergrondoffset,
         \c!straal,\c!kader,\c!kaderkleur,\c!lijndikte,
         \c!linkeroffset,\c!rechteroffset,\c!bovenoffset,\c!onderoffset]%
      \getparameters[\??td#1][#2]%
@@ -1339,7 +1367,7 @@
 
 \let\currenttextbackground\empty
 
-\def\checktextbackgrounds 
+\def\checktextbackgrounds
   {\ifproductionrun \enablehiddenbackground \fi}
 
 \defineoverlay[\v!tekst-2][\positionoverlay{\v!tekst-2}]
@@ -1359,13 +1387,14 @@
    \c!variant=0,
    \c!achtergrond=\v!kleur,
    \c!achtergrondkleur=lightgray,
+   \c!achtergrondoffset=\!!zeropoint,
    \c!hoek=\v!recht,
    \c!straal=.5\bodyfontsize,
    \c!kader=\v!aan,
    \c!kaderkleur=blue,
    \c!lijndikte=\linewidth]
 
-% lelijk, aanpassen, opties 
+% lelijk, aanpassen, opties
 
 \setupMPvariables
   [mpos:connect]
@@ -1375,41 +1404,42 @@
 \setupMPvariables
   [mpos:encircle]
   [fillcolor=lightgray,
+   filloffset=\!!zeropoint,
    linecolor=blue,
    linewidth=1pt]
 
 \startuseMPgraphic{mpos:common:ec}
-  path pa ; pair ca ; color lc ; numeric lw ; 
+  path pa ; pair ca ; color lc ; numeric lw ;
   lw := \MPvar{linewidth} ;
-  lc := \MPvar{linecolor} ; 
+  lc := \MPvar{linecolor} ;
   initialize_box(\MPpos{\MPvar{self}}) ;
-  pa := pxy ; ca := cxy ; pa := boundingbox pa enlarged 2lw ; 
+  pa := pxy ; ca := cxy ; pa := boundingbox pa enlarged 2lw ;
   pa := llcorner pa...lrcorner pa...urcorner pa...ulcorner pa...cycle ;
   drawoptions (withpen pencircle scaled lw withcolor lc) ;
 \stopuseMPgraphic
 
 \startMPpositiongraphic{mpos:encircle}{linecolor,fillcolor,linewidth}
   \includeMPgraphic{mpos:common:ec}
-  fill pa withcolor \MPvar{fillcolor} ; draw pa ; 
+  fill pa withcolor \MPvar{fillcolor} ; draw pa ;
   anchor_box(\MPanchor{\MPvar{self}}) ;
 \stopMPpositiongraphic
 
 \startMPpositiongraphic{mpos:connect}{linecolor,linewidth}
   path pb, pc ; pair cb, cc ;
   \includeMPgraphic{mpos:common:ec}
-  initialize_box(\MPpos{\MPvar{to}}) ; 
-  pb := pxy ; cb := cxy ; pb := boundingbox pb enlarged 2lw ; 
+  initialize_box(\MPpos{\MPvar{to}}) ;
+  pb := pxy ; cb := cxy ; pb := boundingbox pb enlarged 2lw ;
   pb := llcorner pb...lrcorner pb...urcorner pb...ulcorner pb...cycle ;
   pc := ca {up} .. {down} cb ;
   cc := (pc intersection_point pa) ;
-  if intersection_found : 
+  if intersection_found :
     pc := pc cutbefore cc ;
     cc := (pc intersection_point pb) ;
-    if intersection_found : 
+    if intersection_found :
       pc := pc cutafter cc ;
       drawarrow pc ; drawarrow reverse pc ;
-    fi ; 
-  fi ; 
+    fi ;
+  fi ;
   anchor_box(\MPanchor{\MPvar{self}}) ;
 \stopMPpositiongraphic
 
diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex
index fdd01417f..6f9d18917 100644
--- a/tex/context/base/core-ref.tex
+++ b/tex/context/base/core-ref.tex
@@ -198,9 +198,10 @@
 %D different alphabet and needs accented entries in registers.
 
 \appendtoks
-  \def\dohandleaccent #1#2{\string#1\string#2}%
-  \def\dohandlecommand  #1{\string#1}%
-\to\everyreference
+ %\def\dohandleaccent #1#2{\string#1\string#2}%
+ %\def\dohandlecommand  #1{\string#1}%
+  \cleanupfeatures 
+\to \everyreference
 
 %D Why do we have to write down references? \TEX, and therefore
 %D \CONTEXT\ is a batch processing system. During the
@@ -1242,6 +1243,73 @@
 %    \@EA\dodoifreferencefoundelse\@EA{\primaryreference}{#2}{#3}%
 %    \doresetgotowhereever} % to prevent problems with direct goto's
 
+% \def\doifreferencefoundelse#1#2#3% REF \cs
+%   {\checkreferences
+%    \bgroup
+%      \the\everyreference
+%      \let\referenceprefix\empty
+%      \expandreferences{#1}%
+%    \egroup
+%    \doresetgotowhereever
+%    \global\nofsecondaryreferences 0
+%    \ifcase\nofexpandedreferences\relax % #1 can be number -)
+%      % no ref
+%    \or
+%      % one ref
+%    \or
+%      % two refs
+%      \ifenablereferencechains \iflocation
+%        \global\secondaryreferencetrue
+%        \xdef\secondaryreference{\csname REF::2\endcsname}%
+%        \bgroup
+%          \let\unharmedreferenceprefix\referenceprefix
+%          %\bgroup
+%            \dodoifreferencefoundelse\secondaryreference
+%            \global\nofsecondaryreferences 1
+%            \ifreferencefound
+%              #2%
+%            \else
+%              \dostartnoto#3\dostopnoto
+%            \fi
+%          %\egroup
+%        \egroup
+%      \fi \fi
+%    \else
+%      % more than two refs
+%      \ifenablereferencechains \iflocation
+%        \global\secondaryreferencetrue
+%        \scratchcounter2
+%        \loop
+%          \xdef\secondaryreference{\csname REF::\number\scratchcounter\endcsname}%
+%          \bgroup
+%            \let\unharmedreferenceprefix\referenceprefix
+%            %\bgroup
+%              \dodoifreferencefoundelse\secondaryreference
+%              \global\advance\nofsecondaryreferences 1
+%              \ifreferencefound
+%                #2%
+%              \else
+%                \global\advance\nofsecondaryreferences -1
+%                \dostartnoto#3\dostopnoto
+%              \fi
+%            %\egroup
+%          \egroup
+%          \ifnum\scratchcounter<\nofexpandedreferences\relax
+%            \advance\scratchcounter 1
+%        \repeat
+%      \fi \fi
+%    \fi
+%    \global\secondaryreferencefalse
+%    \xdef\primaryreference{\csname REF::1\endcsname}%
+%    \bgroup
+%      \let\unharmedreferenceprefix\referenceprefix
+%      %\bgroup
+%        \dodoifreferencefoundelse\primaryreference
+%        \ifreferencefound#2\else#3\fi
+%      %\egroup
+%    \egroup
+%    \doresetgotowhereever} % to prevent problems with direct goto's
+
 \def\doifreferencefoundelse#1#2#3% REF \cs
   {\checkreferences
    \bgroup
@@ -1261,16 +1329,15 @@
        \global\secondaryreferencetrue
        \xdef\secondaryreference{\csname REF::2\endcsname}%
        \bgroup
+%%\let\doifreferencefoundelse\localdoifreferencefoundelse
          \let\unharmedreferenceprefix\referenceprefix
-         %\bgroup
-           \dodoifreferencefoundelse\secondaryreference
+         \dodoifreferencefoundelse\secondaryreference
+         \ifreferencefound
            \global\nofsecondaryreferences 1
-           \ifreferencefound
-             #2%
-           \else
-             \dostartnoto#3\dostopnoto
-           \fi
-         %\egroup
+           #2%
+         \else
+           \dostartnoto#3\dostopnoto
+         \fi
        \egroup
      \fi \fi
    \else
@@ -1281,17 +1348,15 @@
        \loop
          \xdef\secondaryreference{\csname REF::\number\scratchcounter\endcsname}%
          \bgroup
+%%\let\doifreferencefoundelse\localdoifreferencefoundelse
            \let\unharmedreferenceprefix\referenceprefix
-           %\bgroup
-             \dodoifreferencefoundelse\secondaryreference
+           \dodoifreferencefoundelse\secondaryreference
+           \ifreferencefound
              \global\advance\nofsecondaryreferences 1
-             \ifreferencefound
-               #2%
-             \else
-               \global\advance\nofsecondaryreferences -1
-               \dostartnoto#3\dostopnoto
-             \fi
-           %\egroup
+             #2%
+           \else
+             \dostartnoto#3\dostopnoto
+           \fi
          \egroup
          \ifnum\scratchcounter<\nofexpandedreferences\relax
            \advance\scratchcounter 1
@@ -1301,14 +1366,24 @@
    \global\secondaryreferencefalse
    \xdef\primaryreference{\csname REF::1\endcsname}%
    \bgroup
+%%\let\doifreferencefoundelse\localdoifreferencefoundelse
      \let\unharmedreferenceprefix\referenceprefix
-     %\bgroup
-       \dodoifreferencefoundelse\primaryreference
-       \ifreferencefound#2\else#3\fi
-     %\egroup
+     \dodoifreferencefoundelse\primaryreference
+     \ifreferencefound#2\else#3\fi
    \egroup
    \doresetgotowhereever} % to prevent problems with direct goto's
 
+%D The following local redefinition permits the usage of 
+%D nested \type {\doifreferencefoundelse}; see for an 
+%D example the local test for file|/|url references. This is
+%D a fuzzy part of this mechanism and a result of the choice
+%D to let speed prevail over beauty in resolving chained 
+%D references with symbolic (defined) references. 
+
+\def\localdoifreferencefoundelse#1#2#3%
+  {\dodoifreferencefoundelse{#1}%
+   \ifreferencefound#2\else#3\fi}
+
 %D Somewhere else we will properly define \type {\dostartgoto};
 %D the noto alternative takes care of undefined references in
 %D a sequence
@@ -1547,11 +1622,11 @@
      {\currentreferencespecial::\currentreferenceoperation}%
 %   \doifdefinedelse{\s!do\v!test\currentreferencespecial}
 %     {\getvalue{\s!do\v!test\currentreferencespecial}%
-%        {\global\referencefoundtrue}
+%        {\global\referencefoundtrue}%
 %        {\global\referencefoundfalse}}
 %     {\global\referencefoundtrue}%
-   \executeifdefined{\s!do\v!test\currentreferencespecial}
-     {\global\referencefoundtrue\gobbletwoarguments}
+   \executeifdefined{\s!do\v!test\currentreferencespecial}%
+     {\global\referencefoundtrue\gobbletwoarguments}%
      {\global\referencefoundtrue}{\global\referencefoundfalse}%
 %   \ifcsname\s!do\v!test\currentreferencespecial\endcsname
 %     \csname\s!do\v!test\currentreferencespecial\endcsname
@@ -1565,7 +1640,9 @@
 %D file and, when enabled, in the left margin of the text.
 
 \def\reportreferenceerror#1#2%
-  {\ifvoorlopig\ifinpagebody\else
+  {\bgroup
+   \the\everyreference % cleanup : etc in french 
+   \ifvoorlopig\ifinpagebody\else
      \doifsomething{#2}
        {\inlinker
           {\infofont
@@ -1576,7 +1653,8 @@
    \doifpredefinedreferenceelse
      {}
      {\predefinereference
-      \showmessage{\m!references}{#1}{[\unharmedreferenceprefix][#2]}}}
+      \showmessage{\m!references}{#1}{[\unharmedreferenceprefix][#2]}}%
+   \egroup}
 
 \def\unknownreference{\reportreferenceerror1}
 \def\illegalreference{\reportreferenceerror4}
@@ -2890,16 +2968,16 @@
 %D
 %D The fastest implementation would be:
 
-\definespecialtest\v!file    {\setfalse\forceURLlocation\handlespecialFILEandURL}
-\definespecialtest\v!URL     {\settrue \forceURLlocation\handlespecialFILEandURL}
-\definespecialtest\v!url     {\settrue \forceURLlocation\handlespecialFILEandURL}
+\definespecialtest\v!file{\setfalse\forceURLlocation\handlespecialFILEandURL}
+\definespecialtest\v!URL {\settrue \forceURLlocation\handlespecialFILEandURL}
+\definespecialtest\v!url {\settrue \forceURLlocation\handlespecialFILEandURL}
 
 \definespeciallocation\v!file{\setfalse\forceURLlocation\handlespecialallocationFILEandURL}
 \definespeciallocation\v!URL {\settrue \forceURLlocation\handlespecialallocationFILEandURL}
 \definespeciallocation\v!url {\settrue \forceURLlocation\handlespecialallocationFILEandURL}
 
 \def\handlespecialFILEandURL%
-  {\doifreferencefoundelse
+  {\localdoifreferencefoundelse
      {\currentreferenceoperation::\currentreferencearguments}}
 
 \def\handlespecialallocationFILEandURL
@@ -2922,7 +3000,7 @@
 %D An better alternative, slower but error aware, is
 
 \definespecialtest\v!actie
-  {\doifreferencefoundelse\currentreferenceoperation}
+  {\localdoifreferencefoundelse\currentreferenceoperation}
 
 \definespeciallocation\v!actie
   {\handleexecreference}
diff --git a/tex/context/base/core-reg.tex b/tex/context/base/core-reg.tex
index 31de1741b..793ba16d3 100644
--- a/tex/context/base/core-reg.tex
+++ b/tex/context/base/core-reg.tex
@@ -73,26 +73,6 @@
    \processseparatedlist[#1][+]\docommando
    \!!stringa}
 
-% \def\doprocesspageregister[#1]#2%
-%   {\begingroup
-%    \thisisnextinternal{\s!ind}%
-%    \ifduplicate\getlastregisterentry{#2}\fi
-%    \convertexpanded{\??id\currentregister}{#2}\asciiregisterentry
-%    \makesectionformat
-%    \edef\schrijfwegnaarregister%
-%      {\writeutility%
-%         {r \ifcase\registerpagestatus\space\or e \or f \or t \fi
-%          {\currentregister} %
-%          {\nextinternalreference} %
-%          {#1} %
-%          {\asciiregisterentry} %
-%          {\sectionformat::\noexpand\pagenumber} %
-%          {\noexpand\realfolio}}}%
-%    \schrijfwegnaarregister
-%    \getfirstcharacter\currentregister
-%    \registerinfo{> \firstcharacter}{#2}%
-%    \endgroup}
-
 \def\doprocesspageregister[#1]#2#3% key altnum entry 
   {\begingroup
    \thisisnextinternal{\s!ind}%
@@ -100,14 +80,14 @@
    \convertexpanded{\??id\currentregister}{#3}\asciiregisterentry
    \makesectionformat
    \doifelsevalue{\??id\currentregister\c!eigennummer}{\v!ja}{\donetrue}{\donefalse}%
-   \edef\schrijfwegnaarregister% spaces between } { are essential for texutil's split  
+   % the spaces between } { are essential for texutil's split  
+   \edef\schrijfwegnaarregister% 
      {\writeutility%
         {r \ifcase\registerpagestatus\space\or e \or f \or t \fi
          {\currentregister} %
          {\nextinternalreference} %
          {#1} %
          {\asciiregisterentry} %
-%         {\sectionformat::\noexpand\pagenumber} %
          {\sectionformat::\ifdone#2\else\noexpand\pagenumber\fi} %
          {\noexpand\realfolio}}}%
    \schrijfwegnaarregister
@@ -115,19 +95,6 @@
    \registerinfo{> \firstcharacter}{#3}%
    \endgroup}
 
-%\def\complexdoregister[#1]#2%
-%  {\doprocesspageregister[#1]{#2}%
-%   \ifvmode\nobreak\fi
-%   \GotoPar}
-
-%\def\doregister#1%
-%  {\chardef\registerpagestatus=1
-%   \def\currentregister{#1}%
-%   \doifelsevalue{\??id\currentregister\c!eigennummer}{\v!ja}
-%     {\def\next{\dosingleempty\dodoregister}}
-%     {\def\next{\dosingleempty\donoregister}}%
-%   \next}
-
 \def\doregister#1%
   {\chardef\registerpagestatus=1
    \def\currentregister{#1}%
@@ -567,39 +534,36 @@
       \doglobal\increment\internallistreference}%
    \setvalue{#1\s!from}%
      {\getvalue{#1\s!page}}%
+\ifautoregisterhack
    \setvalue{#1\s!page}##1##2##3##4%
      {\doifreglevelelse[##3]
         {\global\utilitydonetrue
          \iffirstregisterpage
-           \global\firstregisterpagefalse
-\ifautoregisterhack 
-  \setxvalue{\??id#1\??id\currentregisterentry}%
-    {\internallistreference::##4}%
+           \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname
+             {\internallistreference::##4}%
+         \else % catches errors in index
+           \ifcsname\??id#1\??id\currentregisterentry\endcsname
+             \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname
+               {\csname\??id#1\??id\currentregisterentry\endcsname,##4}%
+           \fi
+         \fi}
+        {}}%
 \else
-           \setxvalue{\??id#1\??id\currentregisterentry}%
+   \setvalue{#1\s!page}##1##2##3##4%
+     {\doifreglevelelse[##3]
+        {\global\utilitydonetrue
+         \iffirstregisterpage
+           \global\firstregisterpagefalse
+           \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname
              {\internallistreference::##2-##4}%
-\fi
          \else % catches errors in index
-\ifautoregisterhack % binnen doif
-  \doifdefined{\??id#1\??id\currentregisterentry}
-    {\setxvalue{\??id#1\??id\currentregisterentry}%
-       {\getvalue{\??id#1\??id\currentregisterentry},##4}}%
-\else
-           \doifdefined{\??id#1\??id\currentregisterentry}
-             {\setxvalue{\??id#1\??id\currentregisterentry}%
-                {\getvalue{\??id#1\??id\currentregisterentry},##2-##4}}%
-\fi
+           \ifcsname\??id#1\??id\currentregisterentry\endcsname
+             \@EA\xdef\csname\??id#1\??id\currentregisterentry\endcsname
+               {\csname\??id#1\??id\currentregisterentry\endcsname,##2-##4}%
+           \fi
          \fi}
-        {}}}
-
-%\def\dokoppelregister[#1][#2]%
-%  {\iflocation
-%     \begingroup
-%     \let\dosetregister=\doloadregisterlinks
-%     \stelregisterin[#1][#2]%
-%     \doutilities{#1}{\jobname}{#1}{}{}%
-%     \endgroup
-%   \fi}
+        {}}%
+\fi}
 
 \def\dokoppelregister[#1][#2]%
   {\iflocation
diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex
index f84808242..434889e85 100644
--- a/tex/context/base/core-rul.tex
+++ b/tex/context/base/core-rul.tex
@@ -723,8 +723,8 @@
    \else
      \boxhasformattrue
      \dosetraggedcommand\localformat
-     \edef\beforeframedbox{\raggedtopcommand\getvalue{\@@framed\c!boven}}%
-     \edef\afterframedbox {\getvalue{\@@framed\c!onder}\raggedbottomcommand}%
+     \edef\dobeforeframedbox{\raggedtopcommand\getvalue{\@@framed\c!boven}}%
+     \edef\doafterframedbox {\getvalue{\@@framed\c!onder}\raggedbottomcommand}%
    \fi
    \ifx\localoffset\v!geen
      \boxhasoffsetfalse
@@ -856,8 +856,8 @@
 \def\dodowithframebox
   {\aftergroup\dowithframebox}
 
-\let\afterframedbox \relax
-\let\beforeframedbox\relax
+\let\doafterframedbox \relax
+\let\dobeforeframedbox\relax
 
 %D Carefull analysis of this macro will learn us that not all
 %D branches in the last conditionals can be encountered, that
@@ -1233,11 +1233,11 @@
        \hsize\!!widtha
        \vsize\!!heighta
        \raggedcommand
-       \beforeframedbox
+       \dobeforeframedbox
        \bgroup
        \localbegstrut
        \aftergroup\localendstrut
-       \aftergroup\afterframedbox
+       \aftergroup\doafterframedbox
        \aftergroup\egroup
        \let\next=}
 
@@ -1317,11 +1317,11 @@
 %D come into action. The examples show us how
 %D \type {\v!passend}, \type {\v!ruim} dimensions influence the
 %D formatting. Watch the visualized struts. \voetnoot {Here we
-%D used \type {\toonstruts}.}
+%D used \type {\showstruts}.}
 %D
 %D \startuitstellen
 %D \bgroup 
-%D \toonstruts
+%D \showstruts
 %D \mindermeldingen
 %D \startregelcorrectie
 %D \halign{#\enskip&#\enskip&#\enskip&#\enskip&#\enskip&#\cr
@@ -1400,9 +1400,9 @@
 %      \setbox\framebox=\vbox to \localheight
 %        {\hsize\@@globalwidth
 %         \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}%
-%         \beforeframedbox
+%         \dobeforeframedbox
 %         \innerflushshapebox
-%         \afterframedbox}%
+%         \doafterframedbox}%
 %    \else
 %      \setbox\framebox=\vbox
 %        {\hsize\@@globalwidth
@@ -1438,9 +1438,9 @@
      \setbox\framebox=\vbox to \localheight
        {\hsize\@@globalwidth
         \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}%
-        \beforeframedbox
+        \dobeforeframedbox
         \innerflushshapebox
-        \afterframedbox}%
+        \doafterframedbox}%
    \else
      \scratchdimen=\dp\framebox
      \setbox\framebox=\vbox to \ht\framebox
@@ -2950,7 +2950,9 @@
           \vfill}
        \@@agvoor
        \ifcase\backgroundsplit\or\or % partial split
+\ifdim\pagegoal<\maxdimen
          \pagegoal=1.2\pagegoal % be a bit more tolerant
+\fi
        \fi
        \startregelcorrectie
          \localframed
diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex
index d6a0e7d52..26085ce06 100644
--- a/tex/context/base/core-sec.tex
+++ b/tex/context/base/core-sec.tex
@@ -14,6 +14,9 @@
 % this module needs a clean up, currently some manipulations
 % take place multiple times
 
+% in manual (zie prikkels) : tussen=\blanko is enige hook om
+% met kop-in-hoofd een spatiering af te dwingen 
+
 \writestatus{loading}{Context Core Macros / Sectioning}
 
 \startmessages  dutch  library: structures
@@ -948,6 +951,7 @@
    \def\\{\crlf\strut\ignorespaces}}
 
 \newif\ifplaatskop
+\newif\iflegekop
 \newif\ifverhoognummer
 \newif\ifkopnummer
 
@@ -1084,6 +1088,14 @@
 
 \unexpanded\def\\{\space}
 
+\def\emptyheadcorrection % experimental, should work 
+  {\iflegekop            % well with na=\blanko
+     \vskip-\lineheight
+     \dosomebreak\nobreak
+     \kern\zeropoint
+     \prevdepth\strutdepth
+   \fi}
+
 \def\dodododosomekop#1[#2]#3#4% [ref] {number} {title} 
   {\def\currenthead{#1}%
    \unexpanded\def\\{\space}%
@@ -1105,6 +1117,11 @@
    \doifelsevalue{\??ko#1\c!plaatskop}{\v!ja}
      {\plaatskoptrue}
      {\plaatskopfalse}%
+\processaction
+  [\getvalue{\??ko#1\c!plaatskop}]
+  [  \v!ja=>\plaatskoptrue \legekopfalse,
+   \v!leeg=>\plaatskoptrue \legekoptrue,
+    \v!nee=>\plaatskopfalse\legekoptrue]%
    \processaction
      [\getvalue{\??ko#1\c!verhoognummer}]
      [     \v!ja=>\verhoognummertrue,
@@ -1203,8 +1220,19 @@
          \setupreferenceprefix[\localkopprefix]%
        \fi
        \dosomebreak\nobreak
-       \ifdisplaysectionhead\getvalue{\??ko#1\c!na}\fi
+       \ifdisplaysectionhead
+         \emptyheadcorrection
+         \getvalue{\??ko#1\c!na}%
+       \fi
      \else
+       % Whatever future tex's will do with nodes, 
+       % we assume a node here, because other \c!na=\blanko
+       % will fail! See 'prikkels'
+       %
+       % so, maybe we need an explicit \kern 
+       % 
+       % do nothing / should be vbox to 0pt 
+       % 
        \checknexthead\dohandelpaginaafB{#1}% toegevoegd ivm subpaginanr / tug sheets
        \setsectieenkoppeling{#1}% can be changed when [voor=\somehead{..}...]
        \ifkopprefix
@@ -1216,7 +1244,7 @@
          \let\fullsectionnumber\expandablefullsectionnumber
          \xdef\currentheadnumber{\someheadconversion}%
        \fi
-       \getvalue{\??ko#1\c!tussen}%
+       \getvalue{\??ko#1\c!tussen}% documenteren, is enige hook 
        \setsectionlistreference{\@@sectie}{#1}%
        \resetsectionmarks\@@sectie
        \marking[#1]{#4}%
@@ -1250,12 +1278,24 @@
          {#1}
          {\rawreference{\s!sec}{#2}{{#3}{\asciititle}}}
          {#4}
-         {}%
+        %{}% new:
+         {\marking[#1]{#4}%
+          \marking[#1\v!nummer]{}}%
        \writesection{#1}{-}{#4}%
        \dosomebreak\nobreak
-       \ifdisplaysectionhead\getvalue{\??ko#1\c!na}\fi
+       \ifdisplaysectionhead
+         \emptyheadcorrection
+         \getvalue{\??ko#1\c!na}%
+       \fi
      \else
-       % do nothing
+       % do nothing / should be vbox to 0pt 
+       \checknexthead\handelpaginaaf{#1}%
+       \setsectieenkoppeling{#1}% can be changed when [voor=\somehead{..}...]
+       \getvalue{\??ko#1\c!tussen}%
+       \rawreference{\s!sec}{#2}{{#3}{\asciititle}}%
+       \marking[#1]{#4}%
+       \marking[#1\v!nummer]{}%
+       \writesection{#1}{-}{#4}%
      \fi
    \fi
    \flushingcolumnfloatstrue
@@ -1326,89 +1366,133 @@
 
 \def\doplaatskoptekst#1#2#3#4%
   {\beginheadplacement{#1}%
-   \setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox
-     {\headnumbercontentfalse
-      \resetsystemmode\v!sectienummer
-      \getvalue{\??ko#1\c!commando}
-        {} % no number
-        {\doattributes
-           {\??ko#1}\c!letter\c!kleur
-           {\doattributes
-              {\??ko#1}\c!tekstletter\c!tekstkleur
-              {\dontconvertfont
-               \ifdisplaysectionhead
-                 \stelinterliniein
-               \else
-                 \stelspatieringin
-               \fi
-               #2%
-               \getvalue{\??ko#1\c!voorcommando}%
-               \ifdisplaysectionhead
-                 \getvalue{\??ko#1\c!tekstcommando}%
-                   {\setstrut\begstrut#3\endstrut}%
-                 \xdef\localheaddepth{\the\dp\strutbox}%
-               \else
-                 \getvalue{\??ko#1\c!tekstcommando}{#3}%
-               \fi
-               \getvalue{\??ko#1\c!nacommando}%
-               \ifdisplaysectionhead\endgraf\fi}}}}%
+   \iflegekop
+     \setbox0\ifvertical\vbox\else\hbox\fi to \zeropoint
+       {\headnumbercontentfalse
+        \resetsystemmode\v!sectienummer
+        #2}%
+     \makestrutofbox0
+   \else
+     \setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox
+       {\headnumbercontentfalse
+        \resetsystemmode\v!sectienummer
+        \getvalue{\??ko#1\c!commando}
+          {} % no number
+          {\doattributes
+             {\??ko#1}\c!letter\c!kleur
+             {\doattributes
+                {\??ko#1}\c!tekstletter\c!tekstkleur
+                {\dontconvertfont
+                 \ifdisplaysectionhead
+                   \stelinterliniein
+                 \else
+                   \stelspatieringin
+                 \fi
+                 #2%
+                 \getvalue{\??ko#1\c!voorcommando}%
+                 \ifdisplaysectionhead
+                   \getvalue{\??ko#1\c!tekstcommando}%
+                     {\setstrut\begstrut#3\endstrut}%
+                   \xdef\localheaddepth{\the\dp\strutbox}%
+                 \else
+                   \getvalue{\??ko#1\c!tekstcommando}{#3}%
+                 \fi
+                 \getvalue{\??ko#1\c!nacommando}%
+                 \ifdisplaysectionhead\endgraf\fi}}}}%  
+   \fi  
    \endheadplacement{#1}{#4}}
 
 \def\doplaatskopnummertekst#1#2#3#4#5%
   {\beginheadplacement{#1}%
-   \setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox
-     {\doiftextelse{#3}
-        {\setsystemmode  \v!sectienummer\headnumbercontenttrue }
-        {\resetsystemmode\v!sectienummer\headnumbercontentfalse}%
-      \getvalue{\??ko#1\c!commando}%
-        {\doattributes{\??ko#1}\c!letter\c!kleur
-           {\doattributes{\??ko#1}\c!nummerletter\c!nummerkleur
-              {\getvalue{\??ko#1\c!voorcommando}%
-               \ifdisplaysectionhead
-                 \getvalue{\??ko#1\c!nummercommando}%
-                   {\setstrut\begstrut#3\endstrut}%
-               \else
-                 \getvalue{\??ko#1\c!nummercommando}{#3}%
-               \fi}}}
-        {\doattributes{\??ko#1}\c!letter\c!kleur
-           {\doattributes{\??ko#1}\c!tekstletter\c!tekstkleur
-              {\dontconvertfont
-               \ifdisplaysectionhead
-                 \stelinterliniein
-               \else
-                 \stelspatieringin
-               \fi
-               #2%
-               \ifdisplaysectionhead
-                 \getvalue{\??ko#1\c!tekstcommando}%
-                   {\setstrut\begstrut#4\endstrut}%
-                 \xdef\localheaddepth{\the\dp\strutbox}%
-               \else
-                 \getvalue{\??ko#1\c!tekstcommando}{#4}%
-               \fi
-               \getvalue{\??ko#1\c!nacommando}%
-               \ifdisplaysectionhead\endgraf\fi}}}}%
+   \iflegekop
+     \setbox0\ifvertical\vbox\else\hbox\fi to \zeropoint
+       {\doiftextelse{#3}
+          {\setsystemmode  \v!sectienummer\headnumbercontenttrue }
+          {\resetsystemmode\v!sectienummer\headnumbercontentfalse}%
+        #2}%
+     \makestrutofbox0
+   \else
+     \setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox
+       {\doiftextelse{#3}
+          {\setsystemmode  \v!sectienummer\headnumbercontenttrue }
+          {\resetsystemmode\v!sectienummer\headnumbercontentfalse}%
+        \getvalue{\??ko#1\c!commando}%
+          {\doattributes{\??ko#1}\c!letter\c!kleur
+             {\doattributes{\??ko#1}\c!nummerletter\c!nummerkleur
+                {\getvalue{\??ko#1\c!voorcommando}%
+                 \ifdisplaysectionhead
+                   \getvalue{\??ko#1\c!nummercommando}%
+                     {\setstrut\begstrut#3\endstrut}%
+                 \else
+                   \getvalue{\??ko#1\c!nummercommando}{#3}%
+                 \fi}}}
+          {\doattributes{\??ko#1}\c!letter\c!kleur
+             {\doattributes{\??ko#1}\c!tekstletter\c!tekstkleur
+                {\dontconvertfont
+                 \ifdisplaysectionhead
+                   \stelinterliniein
+                 \else
+                   \stelspatieringin
+                 \fi
+                 #2%
+                 \ifdisplaysectionhead
+                   \getvalue{\??ko#1\c!tekstcommando}%
+                     {\setstrut\begstrut#4\endstrut}%
+                   \xdef\localheaddepth{\the\dp\strutbox}%
+                 \else
+                   \getvalue{\??ko#1\c!tekstcommando}{#4}%
+                 \fi
+                 \getvalue{\??ko#1\c!nacommando}%
+                 \ifdisplaysectionhead\endgraf\fi}}}}%
+   \fi
    \endheadplacement{#1}{#5}}
 
 \newsignal\headsignal
 \let\headlastlinewidth\!!zeropoint
 \newif\ifcontinuoushead
 
+% \def\beginheadplacement#1%
+%   {\bgroup
+%    \gdef\localheaddepth{\dp\strutbox}%
+%    \everypar{}% needed indeed
+%    \noindent  % ipv \witruimte elders, na \forgetall !
+%    \bgroup
+%    \forgetall % now we may forget everything
+%   %\showcomposition
+%    \mindermeldingen
+%    \postponefootnotes
+%    \iflocation\ifdisplaysectionhead\else\noninterferingmarks\fi\fi
+%    %\setupinteraction
+%    %  [\c!letter=,
+%    %   \c!kleur=,
+%    %   \c!contrastkleur=]%
+%    \resetinteractionparameter\c!letter
+%    \resetinteractionparameter\c!kleur
+%    \resetinteractionparameter\c!contrastkleur
+%    \strictouterreferencestrue % tzt instelling
+%    \def\localkopsetup%
+%      {\dolocalkopsetup{#1}}%
+%    \startsynchronisatie}
+
 \def\beginheadplacement#1%
   {\bgroup
+\ifgridsnapping\iftracegridsnapping\showstruts\fi\fi
    \gdef\localheaddepth{\dp\strutbox}%
-   \everypar{}% needed indeed
-   \noindent  % ipv \witruimte elders, na \forgetall !
+   \everypar\emptytoks % needed indeed
+   \noindent           % ipv \witruimte elders, na \forgetall !
    \bgroup
-   \forgetall % now we may forget everything
-  %\showcomposition
+   \doifelsevalue{\??ko#1\c!titeluitlijnen}{\v!ja} % new 
+     {\leftskip 1\leftskip
+      \rightskip1\rightskip
+      \edef\next{\leftskip\the\leftskip\rightskip\the\rightskip}%
+      \xdef\localheadskip{\the\leftskip}%
+      \expandafter\forgetall\next % now we may forget everything
+      \setlocalhsize\hsize\localhsize}
+     {\global\let\localheadskip\!!zeropoint
+      \forgetall}%
    \mindermeldingen
    \postponefootnotes
    \iflocation\ifdisplaysectionhead\else\noninterferingmarks\fi\fi
-   %\setupinteraction
-   %  [\c!letter=,
-   %   \c!kleur=,
-   %   \c!contrastkleur=]%
    \resetinteractionparameter\c!letter
    \resetinteractionparameter\c!kleur
    \resetinteractionparameter\c!contrastkleur
@@ -1426,7 +1510,8 @@
    \ifdisplaysectionhead
      \let\headlastlinewidth\!!zeropoint
      \snaptogrid[\getvalue{\??ko#1\c!grid}]\hbox
-       {\iflocation
+       {\hskip\localheadskip
+        \iflocation
           \ifautocrossdocument
             \doifreferencefoundelse{\getvalue{\??ko#1\c!file}::#1}
               {\edef\currentinnerreference{\s!aut:\currenttextreference}% stored in
@@ -1560,12 +1645,24 @@
        {\localkopsetup\noindent#2}%
    \fi}
 
+% \def\plaatskopinmarge#1#2%
+%   {\vbox
+%      {\localkopsetup
+%       \begstrut            % but use one \strut here!
+%       \ifheadnumbercontent
+%         \llap{\hbox to 5em{\hfill{#1}\hskip\linkermargeafstand}}%
+%       \fi
+%       {#2}}}
+
 \def\plaatskopinmarge#1#2%
   {\vbox
-     {\localkopsetup
+     {\scratchdimen\linkermargeafstand
+      \advance\scratchdimen\leftskip
+      \edef\plaatskopinmarge{\the\scratchdimen}% re-use saves hash entry 
+      \localkopsetup
       \begstrut            % but use one \strut here!
       \ifheadnumbercontent
-        \llap{\hbox to 5em{\hfill{#1}\hskip\linkermargeafstand}}%
+        \llap{\hbox to 5em{\hfill{#1}\hskip\plaatskopinmarge}}%
       \fi
       {#2}}}
 
@@ -1626,6 +1723,7 @@
          \c!commando=\@@plaatskop,
          \c!scheider=\@@koscheider,
          \c!uitlijnen=,
+         \c!titeluitlijnen=,
          \c!tolerantie=,
          \c!file=,
          \c!expansie=,
@@ -1637,11 +1735,12 @@
               [\??ko#1][\??ko\getvalue{\??ko#1\c!default}]
               [\c!voor,\c!na,\c!commando,\c!file,\c!pagina,\c!doorgaan,
                \c!hoofd,\c!tekst,\c!voet,
+\c!scheider,
                \c!nummer,\c!eigennummer,\c!plaatskop,\c!verhoognummer,
                \c!letter,\c!kleur,\c!afstand,\c!variant,\c!springvolgendein,
               %\c!nummerletter,\c!tekstletter,
               %\c!expansie, % why njet ?
-               \c!uitlijnen,\c!tolerantie,\c!grid,
+               \c!uitlijnen,\c!titeluitlijnen,\c!tolerantie,\c!grid,
                \c!nummercommando,\c!tekstcommando]}}%
       \getparameters[\??ko#1][#2]%
       \doifsomething{\getvalue{\??ko#1\c!sectie}}
@@ -1650,6 +1749,7 @@
            {\definieermarkering[#1]%
             \koppelmarkering[#1][\getvalue{\??ko#1\c!sectie}]%
             \definieermarkering[#1\v!nummer]%
+% klopt dit wel ? 
             \koppelmarkering[#1\v!nummer][\getvalue{\??ko#1\c!sectie}]}}%
 %            \koppelmarkering[#1\v!nummer][\getvalue{\??ko#1\c!sectie}\v!nummer]}}%
       \doifundefined{\??li#1}{\definieerlijst[#1]}}
@@ -1659,12 +1759,13 @@
            [\??ko#1][\??ko#2]
            [\c!niveau,\c!sectie,\c!koppeling,\c!prefix,
             \c!voor,\c!na,\c!commando,\c!file,\c!pagina,\c!doorgaan,
+\c!scheider,
             \c!hoofd,\c!tekst,\c!voet,
             \c!nummer,\c!eigennummer,\c!plaatskop,\c!verhoognummer,
             \c!letter,\c!kleur,\c!afstand,\c!variant,\c!springvolgendein,
            %\c!nummerletter,\c!tekstletter,
            %\c!expansie, % why njet ?
-            \c!uitlijnen,\c!tolerantie,\c!grid,
+            \c!uitlijnen,\c!titeluitlijnen,\c!tolerantie,\c!grid,
             \c!nummercommando,\c!tekstcommando]%
 \getparameters[\??ko#1][\c!expansie=]% iig een value, rather fuzzy
          \definieermarkering[#1][#2]%
@@ -1939,3 +2040,4 @@
    \c!kleur=]
 
 \protect \endinput
+
diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex
index 7223de12a..1b6f51f4e 100644
--- a/tex/context/base/core-spa.tex
+++ b/tex/context/base/core-spa.tex
@@ -15,8 +15,9 @@
 
 \unprotect 
 
-\newevery \everybodyfont   \Everybodyfont   % just to be sure
-\newevery \everyfontswitch \EveryFontSwitch % just to be sure
+\newevery \everybodyfont    \Everybodyfont   % just to be sure
+\newevery \everyfontswitch  \EveryFontSwitch % just to be sure
+\newevery \everydefinedfont \relax           % just to be sure
 
 \appendtoks \presetnormallineheight \to \everybodyfont
 \appendtoks \setnormalbaselines     \to \everybodyfont
@@ -35,6 +36,8 @@
 
 \prependtoks \let\par\endgraf \to \everypagebody % see \fillinline
 
+\appendtoks \simplestelspatieringin \to \everydefinedfont
+
 \def\stelfactorenin%
   {\simplestelwitruimtein
    \simplestelblankoin
@@ -1142,7 +1145,7 @@
       \stopbaselinecorrection}%
    \vbox}
 
-\def\toonstruts%
+\def\showstruts%
   {\setteststrut}
 
 % Hieronder volgen enkele instellingen en macro's ten behoeve
@@ -1350,11 +1353,11 @@
 %D Sometimes a capstrut comes in handy
 %D
 %D \starttabulatie[|Tl|l|l|]
-%D \NC yes          \NC normal strut               \NC {\toonstruts\setupstrut[ja]\strut}  \NC \NR 
-%D \NC no           \NC no strut                   \NC {\toonstruts\setupstrut[nee]\strut}  \NC \NR 
-%D \NC kap          \NC a capital strut (i.e. Q)   \NC {\toonstruts\setupstrut[kap]\strut} \NC \NR 
-%D \NC A B \unknown \NC a character strut (e.g. A) \NC {\toonstruts\setupstrut[A]\strut}   \NC \NR 
-%D \NC              \NC a normal strut             \NC {\toonstruts\setupstrut\strut}      \NC \NR 
+%D \NC yes          \NC normal strut               \NC {\showstruts\setupstrut[ja]\strut}  \NC \NR 
+%D \NC no           \NC no strut                   \NC {\showstruts\setupstrut[nee]\strut}  \NC \NR 
+%D \NC kap          \NC a capital strut (i.e. Q)   \NC {\showstruts\setupstrut[kap]\strut} \NC \NR 
+%D \NC A B \unknown \NC a character strut (e.g. A) \NC {\showstruts\setupstrut[A]\strut}   \NC \NR 
+%D \NC              \NC a normal strut             \NC {\showstruts\setupstrut\strut}      \NC \NR 
 %D \stoptabulatie
 
 \def\setupstrut%
@@ -1867,7 +1870,7 @@
 %D \type {csname} testing since the first argument can be 
 %D anything, even a raw fontswitch. No a real improvement 
 %D (some 5 seconds on 260 seconds for the maps bibliography).  
- 
+
 \beginTEX 
 
 \unexpanded\def\dostartattributes#1#2#3%
@@ -1951,6 +1954,26 @@
   {\doglobalstopcolor
    \endgroup}
 
+%D Bonus macro, see core-sec.tex 
+
+\beginTEX
+
+\unexpanded\def\dosetfontattribute#1#2%
+  {\@EA\ifx\csname#1#2\endcsname\relax\else
+     \@EAEAEA\doconvertfont\@EA\@EA\csname#1#2\endcsname
+   \fi\empty}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\unexpanded\def\dosetfontattribute#1#2%
+  {\ifcsname#1#2\endcsname
+     \@EAEAEA\doconvertfont\@EA\@EA\csname#1#2\endcsname
+   \fi\empty}
+
+\endETEX
+
 %D Since this happens a lot, and sometimes large arguments 
 %D are passed in \type {#4}, we just copy some code:
 
@@ -2381,30 +2404,7 @@
   {\par
    \egroup}
 
-%\def\regellinks#1%
-%  {\noindent\leftline{{\strut#1}}}
-%
-%\def\regelrechts#1%
-%  {\noindent\rightline{{#1\strut}}}
-%
-%\def\regelmidden#1%
-%  {\noindent\centerline{{\strut#1}}}
-
-% \def\doalignline#1#2%
-%   {\dowithnextbox
-%      {\noindent\hbox to \hsize{\strut#1\unhbox\nextbox#2}}
-%      \hbox}
-% 
-% also supporting \\
-%
-% \def\doalignline#1#2%
-%   {\dowithnextbox
-%      {\noindent\hbox to \hsize
-%         {\strut#1\unhbox\nextbox#2}}
-%      \hbox\bgroup
-%        \def\\{\egroup\par\doalignline#1#2\bgroup}\let\next=}
-
-\def\doalignline#1#2%
+\def\doalignline#1#2% \\ == newline 
   {\bgroup
    \def\\{\egroup\par\doalignline{#1}{#2}\bgroup}%
    \dowithnextbox
@@ -2421,12 +2421,12 @@
 
 % indirecte commando's
 
-\setvalue{regel\v!links }{\doalignline \relax \hss  }
-\setvalue{regel\v!rechts}{\doalignline \hss   \relax}
-\setvalue{regel\v!midden}{\doalignline \hss   \hss  }
+\setvalue{\s!do\v!regel\v!links }{\doalignline \relax \hss  }
+\setvalue{\s!do\v!regel\v!rechts}{\doalignline \hss   \relax}
+\setvalue{\s!do\v!regel\v!midden}{\doalignline \hss   \hss  }
 
 \def\doregelplaats#1%
-  {\getvalue{regel#1}}
+  {\getvalue{\s!do\v!regel#1}}
 
 %D Experimental: 
 
@@ -2440,8 +2440,22 @@
       \egroup}
      \hbox}
 
-\setvalue{regel\v!binnen}{\doxalignline\relax\hss}
-\setvalue{regel\v!buiten}{\doxalignline\hss\relax}
+\setvalue{\s!do\v!regel\v!binnen}{\doxalignline\relax\hss}
+\setvalue{\s!do\v!regel\v!buiten}{\doxalignline\hss\relax}
+
+%D Better: 
+
+\def\doregelplaats#1%
+  {\getvalue{\s!do\v!regel#1}}
+
+\def\alignedline#1#2% setting default 
+  {\csname
+     \s!do\v!regel
+     \ifundefined{\s!do\v!regel#1}#2\else#1\fi
+   \endcsname}
+
+% \def\doregelplaats#1%
+%   {\alignedline{#1}\v!links}
 
 %D ... 
 
@@ -2462,10 +2476,10 @@
              \v!soepel=>\tolerance=3000,
          \v!zeersoepel=>\tolerance=4500]}}
 
-\def\steltolerantiein%
+\def\steltolerantiein
   {\dosingleargument\dosteltolerantiein}
 
-\def\woordrechts%
+\def\woordrechts
   {\groupedcommand{\hfill\hbox}{\parfillskip\zeropoint}}
 
 %D \macros
@@ -2534,26 +2548,33 @@
 %D an extra \type{\hbox} around the \type{\strutbox}.
 
 \def\definehspace
-  {\dodoubleargument\dodefinehspace}
+  {\dotripleempty\dodefinehspace}
 
-\def\dodefinehspace[#1][#2]%
-  {\setvalue{\??hs#1}{#2}}
+\def\dodefinehspace[#1][#2][#3]% #1 = optional namespace 
+  {\ifthirdargument
+     \setvalue{\??hs#1:#2}{#3}%
+   \else
+     \setvalue{\??hs:#1}{#2}%
+   \fi}
 
 \unexpanded\def\hspace
-  {\dosingleempty\dohspace}
+  {\dodoubleempty\dohspace}
 
-\def\dohspace[#1]%
+\def\dohspace[#1][#2]%
   {\ifhmode
      \removeunwantedspaces
      \hskip
-     \iffirstargument
-       \executeifdefined{\??hs#1}{#1}%
+     \ifsecondargument
+       \hspaceamount{#1}{#2}%
      \else
-       \getvalue{\??hs\s!default}%
-     \fi  
+       \hspaceamount\empty{\iffirstargument#1\else\s!default\fi}%
+     \fi
      \expandafter\ignorespaces
    \fi}  
 
+\def\hspaceamount#1#2%
+  {\executeifdefined{\??hs#1:#2}{\executeifdefined{\??hs:#2}\zeropoint}}
+
 \def\emspaceamount{\fontdimen6\font}
 \def\spaceamount  {\fontdimen2\font}
 
@@ -2561,7 +2582,7 @@
 \definehspace [\v!middel]  [.5\emspaceamount]
 \definehspace [\v!groot]   [1\emspaceamount]
 \definehspace [\v!normaal] [1\spaceamount] 
-\definehspace [\v!default] [\v!groot]
+\definehspace [\v!default] [\spaceamount]
 
 % Very nasty but needed for margin stuff inside colored 
 % paragraphs. 
@@ -2583,6 +2604,14 @@
          \dostopgraphicgroup}}%
      \vbox}
 
+\def\flexiblespaceamount#1#2#3%
+         {#1\fontdimen2\font
+   \!!plus#2\fontdimen3\font
+  \!!minus#3\fontdimen4\font}
+
+\def\fixedspaceamount#1%
+         {#1\fontdimen2\font}
+
 \stelwitruimtein
   [\v!geen]
 
@@ -2633,5 +2662,5 @@
 
 \stelspatieringin
   [\v!opelkaar]
-
+
 \protect \endinput 
diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex
index fbba941f5..7d7dba09e 100644
--- a/tex/context/base/core-tbl.tex
+++ b/tex/context/base/core-tbl.tex
@@ -495,11 +495,11 @@
        {\copyparameters
           [\??tt#1::][\??tt\e!tabulate::]%
           [\c!afstand,\c!eenheid,\c!voor,\c!korps,\c!na,\c!binnen,\c!inspringen,
-           \c!uitlijnen,\c!lijnkleur,\c!lijndikte,EQ]}%
+           \c!marge,\c!uitlijnen,\c!lijnkleur,\c!lijndikte,EQ]}%
      \copyparameters
        [\??tt#1::#2][\??tt#1::]% 
        [\c!eenheid,\c!afstand,\c!voor,\c!korps,\c!na,\c!binnen,\c!inspringen,
-        \c!uitlijnen,\c!lijnkleur,\c!lijndikte,EQ]%
+        \c!marge,\c!uitlijnen,\c!lijnkleur,\c!lijndikte,EQ]%
      \setvalue{\e!start#1::#2}{\dofinalstarttabulate[#1][#2][#3]}%
      \setvalue{\e!start#1}{\bgroup\dosubstarttabulate[#1]}%
      \letvalue{\??tt#1\v!hoofd}\empty
@@ -521,15 +521,29 @@
 %      {\@EA\let\@EA\tabulatetailcontent\csname\??tt\currenttabulate\v!voet\endcsname}
 %      {\let\tabulatetailcontent\empty}}
 
+% \def\checkfulltabulatecontent
+%   {\doifdefinedelse{\??tt\currenttabulate\v!hoofd}
+%      {\@EA\let\@EA\tabulateheadcontent
+%         \csname\??tt\currenttabulate\v!hoofd\endcsname}
+%      {\let\tabulateheadcontent\empty}%
+%    \doifdefinedelse{\??tt\currenttabulate\v!voet}
+%      {\@EA\let\@EA\tabulatetailcontent
+%         \csname\??tt\currenttabulate\v!voet\endcsname}
+%      {\let\tabulatetailcontent\empty}}
+
 \def\checkfulltabulatecontent
-  {\doifdefinedelse{\??tt\currenttabulate\v!hoofd}
-     {\@EA\let\@EA\tabulateheadcontent
-        \csname\??tt\currenttabulate\v!hoofd\endcsname}
-     {\let\tabulateheadcontent\empty}%
-   \doifdefinedelse{\??tt\currenttabulate\v!voet}
-     {\@EA\let\@EA\tabulatetailcontent
-        \csname\??tt\currenttabulate\v!voet\endcsname}
-     {\let\tabulatetailcontent\empty}}
+  {\ifundefined{\??tt\currenttabulate\v!hoofd}%
+     \let\tabulateheadcontent\empty
+   \else
+     \@EA\let\@EA\tabulateheadcontent
+     \csname\??tt\currenttabulate\v!hoofd\endcsname
+   \fi
+   \ifundefined{\??tt\currenttabulate\v!voet}%
+     \let\tabulatetailcontent\empty
+   \else
+     \@EA\let\@EA\tabulatetailcontent
+       \csname\??tt\currenttabulate\v!voet\endcsname
+   \fi}
 
 \newconditional\tabulatesomeamble
 
@@ -641,8 +655,11 @@
 % 1 = RC column raw    RQ equal column raw   
 % 2 = HC column hook   HQ equal column hook 
 
+\newif\iftabulatefirstflushed
+
 \def\tabulateEQ%
-  {\getvalue{\??tt\currenttabulate EQ}\global\tabulateequalfalse} 
+  {\iftabulatefirstflushed\else\getvalue{\??tt\currenttabulate EQ}\fi
+   \global\tabulateequalfalse} 
 
 \def\tabulatenormalcolumn#1%
   {&\iftabulateequal\tabulateEQ\fi&\global\chardef\tabulatetype#1&}
@@ -730,6 +747,7 @@
    \def\NG{\NC\handletabulatecharalign}%
    \def\NR% next row
      {\doglobal\increment\noftabulatelines
+      \global\tabulatefirstflushedfalse
       \global\tabulateequalfalse
       \xdef\tabulatecolumn{0}%
       \resettabulatepheight
@@ -751,7 +769,13 @@
    \global\let\flushtabulated\empty
    \let\savedbar=|\let|=\nexttabulate
    \tabskip\zeropoint
+\ifdim\getvalue{\??tt\currenttabulate\c!marge}>\zeropoint
+   \!!toksa{&\hbox to \tabulateindent{}##%
+             \tabskip\getvalue{\??tt\currenttabulate\c!marge}\strut
+            &##\tabskip\zeropoint}%
+\else
    \!!toksa{&\hbox to \tabulateindent{}##\strut&##}%
+\fi
    \tabulatewidth\zeropoint
    |#1X|\relax
    \tabulatewidth\zeropoint
@@ -829,10 +853,11 @@
            \dorecurse\tabulatecolumns % was: \noftabcolumns
              {\ifvoid\csname\@@tabbox@@\recurselevel\endcsname\else
                 \gdef\flushtabulatedindeed{\the\tabulatedummy}%
-              \fi}}%
+              \fi}
+           \global\tabulatefirstflushedtrue}%
         \flushtabulatedindeed}%
    \else
-    % tabhook op alles ?
+     % tabhook op alles ?
      \def\bskip%
        {\vtop\bgroup
           \ifautotabulate\hsize\tabulatewidth\fi
@@ -920,6 +945,7 @@
    \c!na=\blanko,
    \c!afstand={\v!diepte,\v!middel},
    \c!uitlijnen=\v!normaal,
+   \c!marge=\!!zeropoint, 
    \c!inspringen=\v!nee]
 
 \protect \endinput
diff --git a/tex/context/base/core-uti.tex b/tex/context/base/core-uti.tex
index 39d084d87..3988e1ff9 100644
--- a/tex/context/base/core-uti.tex
+++ b/tex/context/base/core-uti.tex
@@ -75,7 +75,10 @@
   {%\savenofsubpages
    %\savenofpages
    \immediate\closeout\uti
-   \reportutilityproblems}
+   \reportutilityproblems
+   % should be a message : 
+   \let\immediatewriteutilitycommand\gobbleoneargument
+   \let\immediatewriteutility\gobbleoneargument}
 
 \def\abortutilitygeneration%
   {\immediatewriteutilitycommand{\utilitygenerationaborted}%
@@ -360,69 +363,139 @@
 
 \def\notwopassdata{0}
 
+% \def\dogettwopassdata[#1,#2]#3%
+%   {\edef\twopassdata{#1}%
+%    \ifx\twopassdata\notwopassdata
+%      \twopassdatafoundfalse
+%      \let\twopassdata\empty
+%    \else   
+%      \twopassdatafoundtrue
+%      \setxvalue{#3:\s!list}{#2}%
+%    \fi}
+% 
+% \def\gettwopassdata#1%
+%   {\loadtwopassdata
+%   %\edef\!!stringa{\csname#1:\s!list\endcsname}%
+%   %\debuggerinfo{\m!systems}{twopass get #1 - \!!stringa}%
+%   %\expandafter\dogettwopassdata\expandafter[\!!stringa]{#1}}
+%    \expanded{\dogettwopassdata[\csname#1:\s!list\endcsname]}{#1}}
+% 
+% \def\findtwopassdata#1#2%
+%   {\loadtwopassdata
+%    \expanded{\dofindtwopassdata{#1}{#2}}}
+% 
+% \def\dofindtwopassdata#1#2%
+%   {\edef\!!stringa{,\csname#1:\s!list\endcsname}%
+%   %\debuggerinfo{\m!systems}{twopass find #2 - \!!stringa}%
+%    \def\dodofindtwopassdata[##1,##2#2##3,##4]%
+%      {\edef\twopassdata{##3}%
+%       \ifx\twopassdata\empty
+%         \twopassdatafoundfalse
+%       \else
+%         \twopassdatafoundtrue
+%       \fi}%
+%    \@EA\dodofindtwopassdata\@EA[\!!stringa,#2,#2,]}
+%
+% \def\getfirsttwopassdata#1%
+%   {\loadtwopassdata
+%    \edef\!!stringa{\getvalue{#1:\s!list}}%
+%    \expandafter\dogetfirsttwopassdata\expandafter[\!!stringa]{#1}}
+% 
+% \def\dogetfirsttwopassdata[#1,#2]#3%
+%   {\doifelse{#1}{0}
+%      {\twopassdatafoundfalse
+%       \let\twopassdata\empty}
+%      {\twopassdatafoundtrue
+%       \edef\twopassdata{#1}}}
+% 
+% \def\getlasttwopassdata#1%
+%   {\loadtwopassdata
+%    \edef\twopassdata{0}\twopassdatafoundfalse
+%    \newcounter\noftwopassitems
+%    \def\docommando##1%
+%      {\doifnot{##1}{0}
+%         {\increment\noftwopassitems
+%          \edef\twopassdata{##1}\twopassdatafoundtrue}}%
+%    \processcommacommand[\getvalue{#1:\s!list}]\docommando}
+% 
+% \def\getfromtwopassdata#1#2%
+%   {\loadtwopassdata
+%    \getfromcommacommand[\csname#1:\s!list\endcsname][#2]%
+%    \doifelsenothing{\commalistelement}
+%      {\twopassdatafoundfalse
+%       \let\twopassdata\empty}
+%      {\twopassdatafoundtrue
+%       \let\twopassdata\commalistelement}}
+
+% todo: store each entry in hash, an load all uti commands at once
+
 \def\dogettwopassdata[#1,#2]#3%
   {\edef\twopassdata{#1}%
    \ifx\twopassdata\notwopassdata
      \twopassdatafoundfalse
      \let\twopassdata\empty
-   \else   
+   \else
      \twopassdatafoundtrue
      \setxvalue{#3:\s!list}{#2}%
    \fi}
 
 \def\gettwopassdata#1%
   {\loadtwopassdata
-  %\edef\!!stringa{\csname#1:\s!list\endcsname}%
-  %\debuggerinfo{\m!systems}{twopass get #1 - \!!stringa}%
-  %\expandafter\dogettwopassdata\expandafter[\!!stringa]{#1}}
-   \expanded{\dogettwopassdata[\csname#1:\s!list\endcsname]}{#1}}
+   \@EAEAEA\dogettwopassdata\@EA\@EA\@EA[\csname#1:\s!list\endcsname]{#1}}
 
 \def\findtwopassdata#1#2%
   {\loadtwopassdata
    \expanded{\dofindtwopassdata{#1}{#2}}}
 
 \def\dofindtwopassdata#1#2%
-  {\edef\!!stringa{,\csname#1:\s!list\endcsname}%
-  %\debuggerinfo{\m!systems}{twopass find #2 - \!!stringa}%
-   \def\dodofindtwopassdata[##1,##2#2##3,##4]%
-     {\edef\twopassdata{##3}%
-      \ifx\twopassdata\empty
-        \twopassdatafoundfalse
-      \else
-        \twopassdatafoundtrue
-      \fi}%
-   \@EA\dodofindtwopassdata\@EA[\!!stringa,#2,#2,]}
+  {\def\dodofindtwopassdata[##1,##2#2##3,##4]{\edef\twopassdata{##3}}%
+   \@EAEAEA\dodofindtwopassdata\@EA\@EA\@EA[\@EA\@EA\@EA,\csname#1:\s!list\endcsname,#2,#2,]%
+   \ifx\twopassdata\empty
+     \twopassdatafoundfalse
+   \else
+     \twopassdatafoundtrue
+   \fi}
 
 \def\getfirsttwopassdata#1%
   {\loadtwopassdata
-   \edef\!!stringa{\getvalue{#1:\s!list}}%
-   \expandafter\dogetfirsttwopassdata\expandafter[\!!stringa]{#1}}
+   \@EAEAEA\dogetfirsttwopassdata\@EA\@EA\@EA[\csname#1:\s!list\endcsname]{#1}}
 
 \def\dogetfirsttwopassdata[#1,#2]#3%
-  {\doifelse{#1}{0}
-     {\twopassdatafoundfalse
-      \let\twopassdata\empty}
-     {\twopassdatafoundtrue
-      \edef\twopassdata{#1}}}
+  {\edef\twopassdata{#1}%
+   \ifx\twopassdata\notwopassdata
+     \twopassdatafoundfalse
+     \let\twopassdata\empty
+   \else
+     \twopassdatafoundtrue
+   \fi}
+
+\def\dogetlasttwopassdata#1%
+  {\edef\nexttwopassdata{#1}%
+   \ifx\nexttwopassdata\notwopassdata \else
+     \let\twopassdata\nexttwopassdata
+     \advance\scratchcounter 1
+     \twopassdatafoundtrue
+   \fi}
 
 \def\getlasttwopassdata#1%
   {\loadtwopassdata
-   \edef\twopassdata{0}\twopassdatafoundfalse
-   \newcounter\noftwopassitems
-   \def\docommando##1%
-     {\doifnot{##1}{0}
-        {\increment\noftwopassitems
-         \edef\twopassdata{##1}\twopassdatafoundtrue}}%
-   \processcommacommand[\getvalue{#1:\s!list}]\docommando}
+   \scratchcounter0
+   \@EAEAEA\rawprocesscommalist\@EA\@EA\@EA[\csname#1:\s!list\endcsname]\dogetlasttwopassdata
+   \edef\noftwopassitems{\the\scratchcounter}%
+   \iftwopassdatafound\else
+     \let\twopassdata\empty
+   \fi}
 
 \def\getfromtwopassdata#1#2%
   {\loadtwopassdata
-   \getfromcommacommand[\csname#1:\s!list\endcsname][#2]%
-   \doifelsenothing{\commalistelement}
-     {\twopassdatafoundfalse
-      \let\twopassdata\empty}
-     {\twopassdatafoundtrue
-      \let\twopassdata\commalistelement}}
+   \@EAEAEA\getfromcommalist\@EA\@EA\@EA[\csname#1:\s!list\endcsname][#2]%
+   \ifx\commalistelement\empty
+     \twopassdatafoundfalse
+     \let\twopassdata\empty
+   \else
+     \twopassdatafoundtrue
+     \let\twopassdata\commalistelement
+   \fi}
 
 % Default-instellingen (verborgen)
 
diff --git a/tex/context/base/core-var.tex b/tex/context/base/core-var.tex
index 270c0c1d9..9974060ae 100644
--- a/tex/context/base/core-var.tex
+++ b/tex/context/base/core-var.tex
@@ -38,6 +38,10 @@
 \newevery \everybeforeutilityread \relax 
 \newevery \everyafterutilityread  \relax 
 
+\newevery \everycleanupfeatures   \relax
+
+\def\cleanupfeatures{\the\everycleanupfeatures}
+
 %D \macros
 %D   {ifproductionrun}
 %D
diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex
index 15715da32..fe369675a 100644
--- a/tex/context/base/core-ver.tex
+++ b/tex/context/base/core-ver.tex
@@ -1063,9 +1063,26 @@
 \def\simpletypefile%
   {\complextypefile[\v!file]}
 
+% \def\complextypefile[#1]#2%
+%   {\getvalue{\??tp#1\c!voor}%
+%    \doiflocfileelse{#2}
+%      {\startopelkaar % includes \bgroup
+%       \doifinset{\getvalue{\??tp#1\c!optie}}{\v!commandos,\v!schuin,\v!normaal}
+%         {\setuptyping[#1][\c!optie=\v!geen]}%
+%       \doifvalue{\??tp#1\c!optie}{\v!kleur}
+%         {\expandafter\aftersplitstring#2\at.\to\prettyidentifier
+%          \letvalue{\??tp#1\c!optie}=\prettyidentifier}%
+%       \initializetyping{#1}%
+%       \startverbatimcolor
+%       \processfileverbatim{\pathplusfile\f!currentpath{#2}}%
+%       \stopverbatimcolor
+%       \stopopelkaar}  % includes \egroup
+%      {{\tttf[\makemessage{\m!verbatims}{1}{#2}]}% 
+%       \showmessage{\m!verbatims}{1}{#2}}%
+%    \getvalue{\??tp#1\c!na}}
+
 \def\complextypefile[#1]#2%
   {\getvalue{\??tp#1\c!voor}%
-%   \doiflocfileelse{\pathplusfile\f!currentpath{#2}}
    \doiflocfileelse{#2}
      {\startopelkaar % includes \bgroup
       \doifinset{\getvalue{\??tp#1\c!optie}}{\v!commandos,\v!schuin,\v!normaal}
@@ -1075,7 +1092,9 @@
          \letvalue{\??tp#1\c!optie}=\prettyidentifier}%
       \initializetyping{#1}%
       \startverbatimcolor
-      \processfileverbatim{\pathplusfile\f!currentpath{#2}}%
+      \makelocreadfilename{#2}%
+      \processfileverbatim\readfilename 
+     %\processfileverbatim{\pathplusfile\f!currentpath{#2}}%
       \stopverbatimcolor
       \stopopelkaar}  % includes \egroup
      {{\tttf[\makemessage{\m!verbatims}{1}{#2}]}% 
diff --git a/tex/context/base/enco-ini.tex b/tex/context/base/enco-ini.tex
index ee79b4052..21a9326aa 100644
--- a/tex/context/base/enco-ini.tex
+++ b/tex/context/base/enco-ini.tex
@@ -1409,7 +1409,7 @@
 
 % new, to be documented 
 
-\def\dontexpandencoding%
+\def\dontexpandencoding
   {\let\dohandleaccent   \donthandleaccent
    \let\dohandlecommand  \donthandlecommand
    \let\dohandlecharacter\donthandlecharacter}
@@ -1418,6 +1418,21 @@
 \def\donthandlecommand  #1{\expandafter\string\csname#1\endcsname\space}
 \def\donthandlecharacter#1{\expandafter\string\csname#1\endcsname\space}
 
+%D Still valid? To be checked: 
+
+\def\ignoreencoding
+  {\let\dohandleaccent   \doignoreaccent
+   \let\dohandlecommand  \doignorecommand
+   \let\dohandlecharacter\doignorecharacter}
+
+\def\doignoreaccent #1#2{\string#1\string#2}%
+\def\doignorecommand  #1{\string#1}
+\def\doignorecharacter#1{\string#1}
+
+\appendtoks 
+  \ignoreencoding
+\to \everycleanupfeatures 
+
 %D We preload several encodings: 
 
 \useencoding[def,acc,raw,com,cas,mis]
diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex
index c0dd478d9..e93da016f 100644
--- a/tex/context/base/font-ini.tex
+++ b/tex/context/base/font-ini.tex
@@ -57,7 +57,7 @@
 
 % new
 
-\newtoks \everydefinedfont \relax 
+\newevery \everydefinedfont \relax 
 
 \def\dodefinedfont[#1]%
   {\iffirstargument\definefont[\string\definedfont][#1]\fi
@@ -1986,7 +1986,7 @@
 
 \def\redefinebodyfont[#1][#2][#3][#4]%
   {\iffourthargument
-     \processcommalist[#1]{\reredefinebodyfont[#2][#3][#4]}%
+     \processcommacommand[#1]{\reredefinebodyfont[#2][#3][#4]}%
    \else
      \dodefinebodyfont[#1][#2][#3]%
    \fi}
@@ -2432,7 +2432,7 @@
 \def\dosetfont#1#2%  #1 = set/switch state
   {\doifelse{#2}{\v!globaal}
      {\restoreglobalbodyfont}
-     {\processcommalist[#2]{\dodosetfont{#1}}% ##1 get also passed
+     {\processcommacommand[#2]{\dodosetfont{#1}}% ##1 get also passed
       \ifloadingfonts\else
         \doswitchpoints[\normalizedbodyfontsize]%
         \doswitchstyle[\fontstyle]%
diff --git a/tex/context/base/font-run.tex b/tex/context/base/font-run.tex
index 12c607a04..85e533c57 100644
--- a/tex/context/base/font-run.tex
+++ b/tex/context/base/font-run.tex
@@ -58,11 +58,11 @@
          \tabskip=\!!zeropoint\cr
          \noalign{\hrule}
          &\multispan{29}{\vrule\hfil\tttf\strut\title\hfil
-          \llap{\string\mr\hbox to 1em{\hss:\hss}$\mr Ag$\quad}\vrule}\cr
+          \llap{\string\mr\hbox to 1em{\hss:\hss}$\mr \languageparameter\c!tekst$\quad}\vrule}\cr
          \noalign{\hrule}\next{}{\tt\string}{}
-         \noalign{\hrule}\next{\tt\string\rm}{\rm}{Ag}
-         \noalign{\hrule}\next{\tt\string\ss}{\ss}{Ag}
-         \noalign{\hrule}\next{\tt\string\tt}{\tt}{Ag}
+         \noalign{\hrule}\next{\tt\string\rm}\rm{\languageparameter\c!tekst}
+         \noalign{\hrule}\next{\tt\string\ss}\ss{\languageparameter\c!tekst}
+         \noalign{\hrule}\next{\tt\string\tt}\tt{\languageparameter\c!tekst}
          \noalign{\hrule}}}
    \ifinsidefloat\else\stopbaselinecorrection\fi}
 
diff --git a/tex/context/base/hand-ini.tex b/tex/context/base/hand-ini.tex
index fbbeabeaa..d2d02ee54 100644
--- a/tex/context/base/hand-ini.tex
+++ b/tex/context/base/hand-ini.tex
@@ -116,17 +116,28 @@
 
   \beginETEX \fontcharwd
 
+    % division before multiplication, else overflow with "sa>5"
+
+    \newdimen\protrudethreshhold \protrudethreshhold=36pt
+
+    \def\redodefineprotrudefactor#1%
+      {\ifdim\fontdimen6\font>\protrudethreshhold
+         \divide\scratchdimen\fontdimen6\font
+         \multiply\scratchdimen\fontcharwd\prodfont#1\relax
+       \else
+         \multiply\scratchdimen\fontcharwd\prodfont#1\relax
+         \divide\scratchdimen\fontdimen6\font
+       \fi}
+
     \def\dododefineprotrudefactor#1#2#3%
       {\scratchdimen#2\lproddimen
        \ifembasedprotruding \else
-         \multiply\scratchdimen\fontcharwd\prodfont#1\relax
-         \divide\scratchdimen\fontdimen6\font
+         \redodefineprotrudefactor{#1}%
        \fi
        \lpcode\prodfont#1\scratchdimen 
        \scratchdimen#3\rproddimen
        \ifembasedprotruding \else
-         \multiply\scratchdimen\fontcharwd\prodfont#1\relax
-         \divide\scratchdimen\fontdimen6\font
+         \redodefineprotrudefactor{#1}%
        \fi
        \rpcode\prodfont#1\scratchdimen} 
 
@@ -136,18 +147,25 @@
 
     \ifx\undefined\charbox \newbox\charbox \fi 
 
+    \def\redodefineprotrudefactor
+      {\ifdim\fontdimen6\font>36pt
+         \divide\scratchdimen\fontdimen6\font
+         \multiply\scratchdimen\wd\charbox
+       \else
+         \multiply\scratchdimen\wd\charbox
+         \divide\scratchdimen\fontdimen6\font
+       \fi}
+
     \def\dododefineprotrudefactor#1#2#3%
       {\setbox\charbox{\prodfont\char#1}% ! yet untested !   
        \scratchdimen#2\lproddimen
        \ifembasedprotruding \else
-         \multiply\scratchdimen\wd\charbox
-         \divide\scratchdimen\fontdimen6\font
+         \redodefineprotrudefactor
        \fi
        \lpcode\prodfont#1\scratchdimen 
        \scratchdimen#3\rproddimen
        \ifembasedprotruding \else
-         \multiply\scratchdimen\wd\charbox
-         \divide\scratchdimen\fontdimen6\font
+         \redodefineprotrudefactor
        \fi
        \rpcode\prodfont#1\scratchdimen} 
  
diff --git a/tex/context/base/java-fld.tex b/tex/context/base/java-fld.tex
index dab280e85..4074cb2b5 100644
--- a/tex/context/base/java-fld.tex
+++ b/tex/context/base/java-fld.tex
@@ -141,16 +141,26 @@ function Hide_Field ( Name )
   { var v = this.getField(Name) ;
     if (v)
       { v.hidden = true ;
+        v.readonly = true ; 
         this.dirty = false } }
 
-function Vide_Field ( Name )
+function Do_Vide_Field ( Name,Closable )
   { var v = this.getField(Name) ;
     if (v)
       { ++visible_fields ;
         visible_field[visible_fields] = Name ;
         v.hidden = false ;
+        if (Closable)  
+          { v.readonly = false ; 
+            v.value = "On" } 
         this.dirty = false } }
 
+function Vide_Field ( Name )
+  { Do_Vide_Field(Name,false) } 
+
+function Vide_Hide_Field ( Name )
+  { Do_Vide_Field(Name,true) } 
+
 function Hide_Fields ()
   { while (visible_fields>0)
       { Hide_Field(visible_field[visible_fields]) ;
@@ -160,6 +170,10 @@ function Vide_Fields ( Name ) % show only one field
   { Hide_Fields () ;
     Vide_Field ( Name) }
 
+function Vide_Hide_Fields ( Name ) % show only one field
+  { Hide_Fields () ;
+    Vide_Hide_Field ( Name) }
+
 function Toggle_Hide ( Name )
   { var v = this.getField(Name) ;
     if (v) { v.hidden = !v.hidden ; this.dirty = false } }
diff --git a/tex/context/base/java-ini.tex b/tex/context/base/java-ini.tex
index c8239e4a5..81054a5f5 100644
--- a/tex/context/base/java-ini.tex
+++ b/tex/context/base/java-ini.tex
@@ -288,7 +288,7 @@
 
 \def\dodopresetJSrefvariables R#1\end%
   {\doifreferencefoundelse{#1}
-     {\donetrue\dododopresetJSvariables R{\referenceprefix#1}%
+     {\donetrue \dododopresetJSvariables R{\referenceprefix#1}%
       \donefalse\dododopresetJSvariables P{\currentrealreference}}
      {\unknownreference{#1}}% 
    \ifminimalizeJScode \else
diff --git a/tex/context/base/lang-ini.tex b/tex/context/base/lang-ini.tex
index c2ef0840a..9d25eae31 100644
--- a/tex/context/base/lang-ini.tex
+++ b/tex/context/base/lang-ini.tex
@@ -122,12 +122,6 @@
      10: sabloanele -- incarcate
 \stopmessages
 
-% dutch   : \lccode`\'=`\'
-% english : \lccode`\'=0
-% german  : \lccode`\'=`\'
-% french  : \lccode`\'=`\'
-% czech   : \lccode`\'=`\'
-
 %D When loading hyphenation patterns, \TEX\ assign a number to
 %D each loaded table, starting with~0. Switching to a specific
 %D table is done by assigning the relevant number to the
@@ -144,6 +138,12 @@
 
 \newcounter\loadedlanguage
 
+%D Let's start with setting the lowercase code of quotes, so
+%D that we get proper hyphenation in languages like Dutch, 
+%D French and Czech. 
+
+\lccode`\'=`\'
+
 %D \macros
 %D   {currentlanguage, setupcurrentlanguage}
 %D
@@ -245,6 +245,7 @@
             \s!patterns=,
             \s!mapping=,
             \s!encoding=,
+            \c!tekst=Ag,
             #2]%
          \doifvaluesomething{\??la#1\c!default}
            {\doifnotvalue{\??la#1\c!default}{#1}
@@ -267,6 +268,7 @@
                   \c!datum=\languagedefault{#1}\c!datum,
                   \s!mapping=\languagedefault{#1}\s!mapping,
                   \s!encoding=\languagedefault{#1}\s!encoding,
+                  \c!tekst=\languagedefault{#1}\c!tekst,
                   #2]}}}%
       \doifvalue{\??la#1\c!default}{#1}{\letvalue{\??la#1\c!default}\empty}%
        % loop in deo
@@ -433,68 +435,6 @@
 
 \ifx\synchronizepatterns\undefined \let\synchronizepatterns\relax \fi
 
-%\def\dosetnormallanguage#1#2#3#4%
-%  {\doifdefinedelse{\??la\??la#2#3}
-%     {\doifelsevaluenothing{\??la\??la#2#3}
-%        {#4}
-%        {\donetrue
-%         \setxvalue{\??la#1\s!patterns}{#3}%
-%         \normallanguage=\getvalue{\??la\??la#2#3}\relax}} % \relax is needed for lookahead problems
-%     {#4}}
-%
-% because this macro is called often, we optimize 'm
-% 
-% \def\dosetnormallanguage#1#2#3%
-%   {\@EA\ifx\csname\??la\??la#2#3\endcsname\relax
-%      \@EA\firstofoneargument
-%    \else\@EA\ifx\csname\??la\??la#2#3\endcsname\empty
-%      \@EAEAEA\firstofoneargument
-%    \else
-%      \donetrue
-%      \global\expandafter\xdef\csname\??la#1\s!patterns\endcsname{#3}%
-%      \normallanguage\csname\??la\??la#2#3\endcsname\relax % \relax is needed for lookahead problems
-%      \@EAEAEA\gobbleoneargument
-%    \fi\fi}
-% 
-% \def\setnormallanguage#1#2%
-%   {\dosetnormallanguage{#1}{:\currentencoding:\currentmapping:}{#2}{%
-%    \dosetnormallanguage{#1}{:\currentencoding:\s!default     :}{#2}{%
-%    \dosetnormallanguage{#1}{:\s!default      :\currentmapping:}{#2}{%
-%    \dosetnormallanguage{#1}{:\s!default      :\s!default     :}{#2}{}}}}}
-% 
-% \def\docomplexlanguage[#1]%
-%   {\donefalse
-%    % \def\synchronizepatterns{\setnormallanguage
-%    %   {#1}{\getvalue{\??la#1\s!patterns}}}%
-%    % called often, so :
-%    \def\synchronizepatterns{\setnormallanguage
-%      {#1}{\csname\??la#1\s!patterns\endcsname}}%
-%    \synchronizepatterns
-%    \ifdone\else
-%      \def\synchronizepatterns{\setnormallanguage{#1}{#1}}%
-%      \synchronizepatterns
-%      \ifdone\else
-%        \doifvaluesomething{\??la#1\c!default}
-%          {\def\synchronizepatterns{\setnormallanguage
-%             {#1}{\getvalue{\??la\defaultlanguage{#1}\s!patterns}}}%
-%           \synchronizepatterns
-%           \ifdone\else
-%             \setnormallanguage{#1}{\defaultlanguage{#1}}%
-%             \synchronizepatterns
-%           \fi}%
-%      \fi
-%    \fi
-%    \edef\currentlanguage{#1}%
-%    \enablelanguagespecifics[#1]%
-%    \enablemapping[\getvalue{\??la#1\s!mapping}]%
-%    \lefthyphenmin =0\getvalue{\??la#1\s!lefthyphenmin}\relax
-%    \righthyphenmin=0\getvalue{\??la#1\s!righthyphenmin}\relax
-%    \processaction
-%      [\getvalue{\??la#1\c!spatiering}]
-%      [\v!opelkaar=>\frenchspacing,
-%           \v!ruim=>\nonfrenchspacing,
-%        \s!unknown=>\frenchspacing]}
-
 \beginTEX
 
 \def\dosetnormallanguage#1#2%
@@ -530,6 +470,8 @@
 
 \endETEX
 
+\newevery \everylanguage \relax
+
 \def\setnormallanguage#1%
   {\dosetnormallanguage{:\currentencoding:\currentmapping:}{#1}{%
    \dosetnormallanguage{:\currentencoding:\s!default     :}{#1}{%
@@ -557,6 +499,7 @@
        \fi
      \fi
    \fi
+   \the\everylanguage 
    \enablelanguagespecifics[\currentlanguage]%
 % strange, what is this doing here, dangerous for {il2,ec} 
 %   \edef\languagemapping{\csname\??la\currentlanguage\s!mapping\endcsname}%
@@ -668,6 +611,9 @@
 \def\languagedefault#1#2%
   {\csname\??la\defaultlanguage{#1}#2\endcsname}
 
+\def\languageparameter#1%
+  {\csname\??la\defaultlanguage\currentlanguage#1\endcsname}
+
 %D \macros
 %D   {startlanguagespecifics,enablelanguagespecifics}
 %D
@@ -784,6 +730,19 @@
    \csname\??la#1\??la\endcsname
    \csname\??la\languageencoding#1\??la\endcsname} % dup ?
 
+%D \macros 
+%D   {everyresetlanguagespecifics,resetlanguagespecifics}
+%D 
+%D Cleanup macros. 
+
+\newtoks\everyresetlanguagespecifics
+
+\def\resetlanguagespecifics{\the\everyresetlanguagespecifics}
+
+\appendtoks
+  \resetlanguagespecifics
+\to \everycleanupfeatures
+
 %D \macros
 %D   {leftguillemot,rightguillemot,leftsubguillemot,rightsubguillemot,
 %D    ...single...quote,...double...quote}
diff --git a/tex/context/base/lang-ita.tex b/tex/context/base/lang-ita.tex
index 7d325e45a..963c7dcf1 100644
--- a/tex/context/base/lang-ita.tex
+++ b/tex/context/base/lang-ita.tex
@@ -31,18 +31,21 @@
 
 \unprotect
 
+\ifx\guillemotspace\undefined \let\guillemotspace\empty \fi
+\ifx\sentencespace \undefined \let\sentencespace \empty \fi
+
 \installlanguage
   [\s!fr]
   [\c!spatiering=\v!opelkaar,
-   \c!leftsentence=\leftguillemot,
-   \c!rightsentence=\rightguillemot,
-   \c!leftsubsentence=\leftsubguillemot,
-   \c!rightsubsentence=\rightsubguillemot,
-   \c!leftquote=\leftsubguillemot,
-   \c!rightquote=\rightsubguillemot,
+   \c!leftsentence=\emdash,
+   \c!rightsentence=\emdash,
+   \c!leftsubsentence=\emdash,
+   \c!rightsubsentence=\emdash,
+   \c!leftquote=\leftguillemot,
+   \c!rightquote=\rightguillemot,
    \c!leftquotation=\leftguillemot,
    \c!rightquotation=\rightguillemot,
-   \c!datum={\v!dag,\ ,\v!maand,\ ,\v!jaar},
+   \c!datum={\v!dag+,\v!spatie,\v!maand,\v!spatie,\v!jaar},
    \c!status=\v!stop]
 
 \installlanguage
diff --git a/tex/context/base/lang-spa.tex b/tex/context/base/lang-spa.tex
new file mode 100644
index 000000000..1fb4f3f0e
--- /dev/null
+++ b/tex/context/base/lang-spa.tex
@@ -0,0 +1,73 @@
+%D \module
+%D   [       file=lang-spa,
+%D        version=2002.04.17,
+%D          title=\CONTEXT\ Language Macros,
+%D       subtitle=Spacing,
+%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 Language Macros / Spacing}
+
+%D This module was created in the process of enhancing 
+%D support for French (with the help of Daniel Flipo).
+
+\unprotect 
+
+\definehspace [\s!fr] [quotation]      [\flexiblespaceamount{.8}{.3}{.8}]
+\definehspace [\s!fr] [sentence]       [\fixedspaceamount{1}]
+
+\definehspace [\s!fr] [interquotation] [\zeropoint]
+\definehspace [\s!fr] [intersentence]  [\zeropoint]
+
+\definehspace         [:]              [\zeropoint]
+\definehspace         [;]              [\zeropoint]
+\definehspace         [!]              [\zeropoint]
+\definehspace         [?]              [\zeropoint]
+
+\definehspace [\s!fr] [:]              [\spaceamount]
+\definehspace [\s!fr] [;]              [.16667em]
+\definehspace [\s!fr] [!]              [.16667em]
+\definehspace [\s!fr] [?]              [.16667em]
+
+\protect 
+
+%D Alternative discretionary handlers: 
+
+\definetextmodediscretionary :
+  {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{:}:}
+
+\definetextmodediscretionary ;
+  {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{;};}
+
+\definetextmodediscretionary ?
+  {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{?}?}
+
+\definetextmodediscretionary !
+  {\removeunwantedspaces\prewordbreak\kern\hspaceamount\currentlanguage{!}!}
+
+%D \startbuffer
+%D \mainlanguage[en] \quotation{test \quotation{test} test}\par
+%D \mainlanguage[nl] \quotation{test \quotation{test} test}\par
+%D \mainlanguage[fr] \quotation{test \quotation{test} test}\par
+%D 
+%D \mainlanguage[en] \quotation{\quotation{test} test}\par
+%D \mainlanguage[nl] \quotation{\quotation{test} test}\par
+%D \mainlanguage[fr] \quotation{\quotation{test} test}\par
+%D 
+%D \mainlanguage[en] |<|test |<|test|>| test|>| \par
+%D \mainlanguage[nl] |<|test |<|test|>| test|>| \par
+%D \mainlanguage[fr] |<|test |<|test|>| test|>| \par
+%D 
+%D \mainlanguage[en] |<||<|test|>| test|>| \par
+%D \mainlanguage[nl] |<||<|test|>| test|>| \par
+%D \mainlanguage[fr] |<||<|test|>| test|>| \par
+%D \stopbuffer
+%D
+%D \typebuffer {\getbuffer}
+
+\protect \endinput
diff --git a/tex/context/base/m-units.tex b/tex/context/base/m-units.tex
index f66204f90..c4be1d3ea 100644
--- a/tex/context/base/m-units.tex
+++ b/tex/context/base/m-units.tex
@@ -707,7 +707,7 @@
 \getvalue{\v!eenheid} [Weber]    {Wb}  {Weber}
 \getvalue{\v!eenheid} [Henry]    {H}   {Henry}
 \getvalue{\v!eenheid} [Sterant]  {sr}  {Sterant}
-\getvalue{\v!eenheid} [Angstrom] {\AA} {\AA ngstr\"om}
+\getvalue{\v!eenheid} [Angstrom] {\hbox{\Aring}} {\Aring ngstr\"om}
 \getvalue{\v!eenheid} [Gauss]    {G}   {Gauss}
 
 \setuplabeltext
diff --git a/tex/context/base/meta-fig.tex b/tex/context/base/meta-fig.tex
index e0e3a57c3..6094e4ca1 100644
--- a/tex/context/base/meta-fig.tex
+++ b/tex/context/base/meta-fig.tex
@@ -43,15 +43,15 @@
 
 \presetlocalframed[\??mg]
 
-\def\setupMPpage%
+\def\setupMPpage
   {\dodoubleargument\getparameters[\??mg]}
 
-\def\startMPpage%
-  {\dosingleempty\dostartMPpage}
+\def\startMPpage
+  {\dodoubleempty\dostartMPpage}
 
-\long\def\dostartMPpage[#1]#2\stopMPpage
+\long\def\dostartMPpage[#1][#2]#3\stopMPpage % second arg gobbles space
   {\dostartfittingpage[\??mg][#1]%
-     \startMPcode#2\stopMPcode
+     \startMPcode#3\stopMPcode
    \dostopfittingpage}
 
 \setupMPpage
diff --git a/tex/context/base/meta-ini.tex b/tex/context/base/meta-ini.tex
index d9b407fff..543648db5 100644
--- a/tex/context/base/meta-ini.tex
+++ b/tex/context/base/meta-ini.tex
@@ -88,7 +88,7 @@
 
 %D Some safeguards: 
 
-\appendtoks \let\handlecompoundcharacter\string \to \everyMPgraphic
+\appendtoks \cleanupfeatures \to \everyMPgraphic
 
 %D Another one: 
 
@@ -565,6 +565,8 @@
 %D In order to communicate conveniently with the \TEX\ 
 %D engine, we introduce some typesetting variables. 
 
+% todo : backgroundoffsets 
+
 \startuseMPgraphic{init data}
   color OverlayColor, OverlayLineColor ;
   %
diff --git a/tex/context/base/mult-com.tex b/tex/context/base/mult-com.tex
index 91e9e5aee..8dff7bc76 100644
--- a/tex/context/base/mult-com.tex
+++ b/tex/context/base/mult-com.tex
@@ -403,6 +403,9 @@
                    defineoverlay: definieeroverlay                 defineoverlay
                                   definiereoverlay                 definujprekryv
                                   definiscisovrapposizione         definesteoverlay
+                     definelayer: definieerlayer                   definelayer
+                                  definelayer                      definelayer
+                                  definelayer                      definelayer
                       background: achtergrond                      background
                                   hintergrund                      pozadi
                                   sfondo                           fundal
@@ -838,7 +841,7 @@
                                   marcatura                        marcaje
               ontkoppelmarkering: ontkoppelmarkering               decouplemarking
                                   entknuepfebeschriftung           rozpojeneznaceni
-                                  decouplemarcatura                decupleazamarcaje % GB
+                                  separamarcatura                  decupleazamarcaje % GB
                  koppelmarkering: koppelmarkering                  couplemarking
                                   verknuepfebeschriftung           propojeneznaceni
                                   accoppiamarcatura                cupleazamarcaje % GB
@@ -881,7 +884,7 @@
                        showprint: toonprint                        showprint
                                   zeigedruck                       ukazvytisk
                                   mostrastampa                     afiseazatiparire
-                      toonstruts: toonstruts                       showstruts
+                      showstruts: toonstruts                       showstruts
                                   zeigestruts                      ukazpodpery
                                   mostrastruts                     afiseazastruts
                  definepapersize: definieerpapierformaat           definepapersize
@@ -1030,43 +1033,43 @@
                                   bastablocchi                     gatablocuri
                  definieerlijst:  definieerlijst                   definelist
                                   definiereliste                   definujseznam
-                                  definiscilista                   definestelista
+                                  definiscielenco                  definestelista
     definieersamengesteldelijst:  definieersamengesteldelijst      definecombinedlist
                                   definierezusammengestellteliste  definujkombinovanyseznam
-                                  definiscilistacombinata          definestelistacombinata
+                                  definiscielencocombinato         definestelistacombinata
                     plaatslijst:  plaatslijst                      placelist
                                   platziereliste                   umistiseznam
-                                  mettilista                       punelista
+                                  mettielenco                      punelista
        plaatssamengesteldelijst:  plaatssamengesteldelijst         placecombinedlist
                                   platzierezusammengestellteliste  umistikombinovanyseznam
-                                  mettilistacombinata              punelistacombinata
+                                  mettielencocombinato             punelistacombinata
                schrijfnaarlijst:  schrijfnaarlijst                 writetolist
                                   schreibezurliste                 zapisdoseznamu
-                                  scriviinlista                    scrieinlista
+                                  scriviinelenco                   scrieinlista
              schrijftussenlijst:  schrijftussenlijst               writebetweenlist
                                   schreibezwischenliste            zapismeziseznam
-                                  scrividentrolista                scrieintreliste
+                                  scrividentroelenco               scrieintreliste
                     stellijstin:  stellijstin                      setuplist
                                   stellelisteein                   nastavseznam
-                                  impostalista                     seteazalista
+                                  impostaelenco                    seteazalista
        stelsamengesteldelijstin:  stelsamengesteldelijstin         setupcombinedlist
                                   stellezusammengestelltelisteein  nastavkombinovanyseznam
-                                  impostalistacombinata            seteazalistacombinata
+                                  impostaelencocombinato           seteazalistacombinata
            bepaallijstkenmerken:  bepaallijstkenmerken             determinelistcharacteristics
                                   bestimmelistencharakeristika     stanovcharakteristickuseznamu
-                                  determinacaratterstichelista     determinacaracteristicilelistei
+                                  determinacarattersticheelenco    determinacaracteristicilelistei
                     lijstlengte:  lijstlengte                      listlength
                                   listenlaenge                     delkaseznamu
-                                  lunghezzalista                   lungimelista
+                                  lunghezzaelenco                  lungimelista
                    lijstbreedte:  lijstbreedte                     listwidth
                                   listenbreite                     sirkaseznamu
-                                  ampiezzalista                    latimelista
+                                  ampiezzaelenco                   latimelista
                     lijsthoogte:  lijsthoogte                      listheight
                                   listenhoehe                      vyskaseznamu
-                                  altezzalista                     inaltimelista
+                                  altezzaelenco                    inaltimelista
                       geenlijst:  geenlijst                        nolist
                                   keineliste                       zadnyseznam
-                                  nientelista                      faralista
+                                  nienteelenco                     faralista
         definieerreferentielijst: definieerreferentielijst         definereferencelist
                                   definierereferenzliste           definujseznamodkazu
                                   definiscilistariferimenti        definestelistareferinte
@@ -1827,9 +1830,15 @@
                           kopwit: kopwit                           topspace
                                   kopfweite                        odsazenishora
                                   spaziocima                       spatiusus
+                        bodemwit: bodemwit                         bottomspace
+                                  bottomspace                      bottomspace
+                                  spaziofondo                      spatiujos
                           rugwit: rugwit                           backspace
                                   rumpfweite                       odsazenizleva
                                   spaziodietro                     spatiuspate % GB
+                         snijwit: snijwit                          cutspace
+                                  cutspace                         cutspace
+                                  cutspace                         cutspace % GB
                    papierbreedte: papierbreedte                    paperwidth
                                   papierbreite                     sirkapapiru
                                   ampiezzacarta                    latimehartie
@@ -1862,6 +1871,19 @@
                                   useXMLfilter                     useXMLfilter
                                   useXMLfilter                     useXMLfilter
 
+definecolumnset: definieerkolomgroep definecolumnset 
+                 definecolumnset     definecolumnset 
+                 definecolumnset     definecolumnset 
+ setupcolumnset: stelkolomgroepin    setupcolumnset 
+                 setupcolumnset      setupcolumnset 
+                 setupcolumnset      setupcolumnset 
+ startcolumnset: startkolomgroep     startcolumnset 
+                 startcolumnset      startcolumnset 
+                 startcolumnset      startcolumnset 
+  stopcolumnset: stopkolomgroep      stopcolumnset 
+                 stopcolumnset       stopcolumnset 
+                 stopcolumnset       stopcolumnset 
+
 \stopcommands
 
 %D \stopcompressdefinitions
diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex
index b9f361243..d3bca3f0d 100644
--- a/tex/context/base/mult-con.tex
+++ b/tex/context/base/mult-con.tex
@@ -11,7 +11,7 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
-% additions are marked as % new 
+% additions are marked as % new
 
 %D In this rather large definition file we are going to tell
 %D \CONTEXT\ which constants, variables and elements we use.
@@ -224,7 +224,7 @@
                            typing                    typing % GB
                      file: file                      file
                            datei                     soubor
-                           file                      fisier 
+                           file                      fisier
 
 \stopvariables
 
@@ -344,14 +344,14 @@
                            rechtersubsatz            podvetavpravo
                            sottofrasedestra          subpropozitiedreapta
 
-               leftspeech: linkeruitspraak           leftspeech 
-                           leftspeech                leftspeech 
+               leftspeech: linkeruitspraak           leftspeech
+                           leftspeech                leftspeech
                            leftspeech                leftspeech %%%
-             middlespeech: middenuitspraak           middlespeech 
-                           middlespeech              middlespeech 
+             middlespeech: middenuitspraak           middlespeech
+                           middlespeech              middlespeech
                            middlespeech              middlespeech %%%
-              rightspeech: rechteruitspraak          rightspeech 
-                           rightspeech               rightspeech 
+              rightspeech: rechteruitspraak          rightspeech
+                           rightspeech               rightspeech
                            rightspeech               rightspeech %%%
 
                     datum: datum                     date
@@ -420,8 +420,8 @@
                    auteur: auteur                    author
                            autor                     autor
                            autore                    autor
-                 autofile: autofile                  autofile             
-                           autofile                  autofile             
+                 autofile: autofile                  autofile
+                           autofile                  autofile
                            autofile                  autofile % TB TH
                balanceren: balanceren                balance
                            ausgleichen               rovnovaha
@@ -539,7 +539,7 @@
                            file                      fisier
                 inputfile: inputfile                 inputfile
                            inputfile                 inputfile
-                           inputfile                 inputfile % !! 
+                           inputfile                 inputfile % !!
                   formaat: formaat                   size
                            groesse                   velikost
                            dimensione                dimensiune
@@ -701,7 +701,7 @@
                            colorelinea               culoarerigla
                     lijst: lijst                     list
                            liste                     seznam
-                           lista                     lista
+                           elenco                    lista
             linkerbreedte: linkerbreedte             leftwidth
                            linkerbreite              sirkavlevo
                            ampiezzasinistra          latimestanga
@@ -854,7 +854,7 @@
                            marginedispari            margineimpara
                        op: op                        at
                            bei                       u
-                           ad                        la 
+                           ad                        la
                     optie: optie                     option
                            option                    volba
                            opzione                   optiune
@@ -977,7 +977,7 @@
                            righe                     linii
                       rek: rek                       stretch
                            strecken                  natahnout
-                           dilata                    dilatat % CHECK 
+                           dilata                    dilatat % CHECK
                 resolutie: resolutie                 resolution
                            aufloesung                rozliseni
                            risoluzione               rezolutie
@@ -1285,6 +1285,14 @@
                            cbefehl                   cprikaz
                            ccomando                  comandac
 
+             tekstafstand: tekstafstand              textdistance 
+                           textdistance              textdistance 
+                           distanzatesto             textdistance % TB TH
+
+trefwoord: trefwoord keyword
+           keyword keyword
+           keyword keyword
+
 \stopconstants
 
 %D \stopcompressdefinitions
@@ -1454,7 +1462,7 @@
                            grande                    mare
                grootkorps: grootkorps                bigbodyfont
                            bigbodyfont               bigbodyfont
-                           grossofontdeltesto        bigbodyfont %% 
+                           grossofontdeltesto        bigbodyfont %%
             grotevoorkeur: grotevoorkeur             bigpreference
                            grosszuegig               vysokapriorita
                            grandepreferenza          preferintamare
@@ -1571,7 +1579,7 @@
                            piccolograssettocorsivo   micaldininclinat
                kleinkorps: kleinkorps                smallbodyfont
                            smallbodyfont             smallbodyfont
-                           piccolofontdelcorpo       smallbodyfont %% 
+                           piccolofontdelcorpo       smallbodyfont %%
                     kleur: kleur                     color
                            farbe                     barevne
                            colore                    culoare
@@ -1622,7 +1630,7 @@
                            linea                     rigla
                     lijst: lijst                     list
                            liste                     seznam
-                           lista                     lista
+                           elenco                    lista
               linkermarge: linkermarge               leftmargin
                            linkerrand                levyokraj
                            marginesinistro           marginestanga
@@ -1730,9 +1738,9 @@
                            carta                     foaie
                    scherm: scherm                    display
                            bildschirm                obrazovka
-                           schermo                   display % new 
-                omgekeerd: omgekeerd                 reverse 
-                           reverse                   reverse 
+                           schermo                   display % new
+                omgekeerd: omgekeerd                 reverse
+                           reverse                   reverse
                            invertito                 reverse % new
                   passend: passend                   fit
                            passend                   prizpusobive
@@ -1832,7 +1840,7 @@
                            tollerante                tolerant
                    spatie: spatie                    space
                            spatium                   mezera
-                           spazio                    spatiu %% check 
+                           spazio                    spatiu %% check
                 standaard: standaard                 standard
                            standard                  standardni
                            standard                  standard
@@ -1844,7 +1852,7 @@
                            termina                   stop
                    streng: streng                    strict
                            streng                    striktni
-                           strict                    strict
+                           rigido                    strict
                     strut: strut                     strut
                            strut                     strut
                            strut                     strut
@@ -1955,7 +1963,7 @@
                            moltotollerante           foartetolerant
                zeerstreng: zeerstreng                verystrict
                            sehrstreng                velmistriktni
-                           moltostrict               foartestrict % GB
+                           moltorigido               foartestrict % GB
                       zie: zie                       see
                            sieh                      viz
                            vedi                      vezi
@@ -2025,25 +2033,33 @@
                  bookmark: bookmark                  bookmark
                            bookmark                  zalozka
                            segnalibro                semncarte
-\stopvariables
-
-% nieuw, to be translated 
 
-\startvariables            dutch                     english
-                           german                    czech
-                           italian                   romanian
-
-                  sturing: sturing                   controls 
-                           controls                  controls 
-                           controls                  controale
+% GB TB TH :
+
+              binnenmarge: binnenmarge               innermargin
+                           innermargin               innermargin
+                           margineinterno            innermargin
+              buitenmarge: buitenmarge               outermargin
+                           outermargin               outermargin
+                           margineesterno            outermargin
+               binnenrand: binnenrand                inneredge
+                           inneredge                 inneredge
+                           bordointerno              inneredge
+               buitenrand: buitenrand                outeredge
+                           outeredge                 outeredge
+                           bordoesterno              outeredge
+
+                  sturing: sturing                   controls
+                           controls                  controls
+                           controlli                 controale
               niethangend: niethangend               nothanging
                            nothanging                nothanging
-                           nothanging                nothanging
-               afgebroken: afgebroken                hyphenated 
+                           nonsospeso                nothanging
+               afgebroken: afgebroken                hyphenated
                            hyphenate                 hyphenated
                            sillabato                 despsilabe
-           nietafgebroken: nietafgebroken            nothyphenated 
-                           nothyphenated             nothyphenated 
+           nietafgebroken: nietafgebroken            nothyphenated
+                           nothyphenated             nothyphenated
                            nonsillabato              nedespsilabe
 
 \stopvariables
@@ -2052,8 +2068,8 @@
                            german                    czech
                            italian                   romanian
 
-                  sturing: sturing                   controls 
-                           controls                  controls 
+                  sturing: sturing                   controls
+                           controls                  controls
                            controlli                  controale
                   globaal: globaal                   global
                            global                    globalne
@@ -2061,7 +2077,7 @@
 
 \stopconstants
 
-% so far 
+% so far
 
 %D \stopcompressdefinitions
 
@@ -2186,7 +2202,7 @@
                            etichettatura             etichetare
        samengesteldelijst: samengesteldelijst        combinedlist
                            kombiniereliste           kombinovanyseznam
-                           listacombinata           listacombinata
+                           elencocombinato           listacombinata
                    sectie: sectie                    section
                            abschnitt                 oddil
                            sezione                   sectiune
@@ -2285,10 +2301,10 @@
                            vuoti                     gol
                     lijst: lijst                     list
                            auflisten                 seznam
-                           lista                     lista
+                           elenco                    lista
                  lijstmet: lijstmet                  listof
                            auflistenvon              seznam
-                           listadi                   listade
+                           elencodi                  listade
                    lokale: lokale                    local
                            lokal                     lokalne
                            locale                    local
@@ -2321,10 +2337,10 @@
                            tabulato                  tabulate
              tabulatehead: tabulatiekop              tabulatehead
                            tabulatehead              tabulatehead
-                           testatabulato             tabulatehead % 
+                           testatabulato             tabulatehead %
              tabulatetail: tabulatiestaart           tabulatetail
                            tabulatetail              tabulatetail
-                           codatabulato              tabulatetail % 
+                           codatabulato              tabulatetail %
                     tekst: tekst                     text
                            text                      text
                            testo                     text
@@ -2376,7 +2392,7 @@
              deelomgeving: deelomgeving              localenvironment
                            lokaleumgebung            lokalnihoprostredi
                            ambientelocale            mediulocal
- 
+
 \stopelements
 
 %D \stopcompressdefinitions
@@ -2433,12 +2449,12 @@
               SearchAgain: HerhaalZoeken             SearchAgain
                            WeiterSuchen              HledatZnovu
                            CercaAncora               CautaDinNou
-                    Query: RaadpleegDocument         Query  
+                    Query: RaadpleegDocument         Query
                            Query                     Query
-                           Query                     Query % TB TH GB 
+                           Richiesta                 Query % TB TH GB
                QueryAgain: HerhaalRaadplegen         QueryAgain
                            QueryAgain                QueryAgain
-                           QueryAgain                QueryAgain % TB TH GB 
+                           RinnovaRichiesta          QueryAgain % TB TH GB
                  GotoPage: GaNaarPagina              GotoPage
                            GotoPage                  JdiNaStranku
                            VaiAPagina                LaPagina % TB
@@ -2461,7 +2477,7 @@
                            StopSound                 StopZvuk
                            FermaSuono                StopSunet % TB
                PauseSound: PauzeerGeluid             PauseSound
-                           PauseSound                PozastavitZvuk  
+                           PauseSound                PozastavitZvuk
                            PausaSuono                PauzaSunet % TB
               ResumeSound: HervatGeluid              ResumeSound
                            ResumeSound               PokracovatZvuk
diff --git a/tex/context/base/page-app.tex b/tex/context/base/page-app.tex
index 5ba74fdef..8f93858a9 100644
--- a/tex/context/base/page-app.tex
+++ b/tex/context/base/page-app.tex
@@ -39,6 +39,7 @@
        [\c!breedte=\fittingwd,\c!hoogte=\fittinght,\c!plaats=\v!midden,
         \c!kopwit=\!!zeropoint,\c!rugwit=\!!zeropoint,
         \c!snijwit=\!!zeropoint,\c!bodemwit=\!!zeropoint,
+        \c!tekstafstand=\!!zeropoint,
         \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]%
    \stoplocal % which saves us the trouble of push/pop
    \startmakeup[\v!standaard][\c!tekststatus=\v!leeg,\c!dubbelzijdig=\v!nee,\c!pagina=]%
diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex
index 43d11babe..e009a0b00 100644
--- a/tex/context/base/page-flt.tex
+++ b/tex/context/base/page-flt.tex
@@ -2,7 +2,7 @@
 %D   [       file=page-flt,
 %D        version=2000.10.20,
 %D          title=\CONTEXT\ OTR Macros,
-%D       subtitle=Floating Bodies, 
+%D       subtitle=Floating Bodies,
 %D         author=Hans Hagen,
 %D           date=\currentdate,
 %D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
@@ -11,10 +11,10 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
-\writestatus{loading}{Context OTR Macros / Floating Bodies} 
+\writestatus{loading}{Context OTR Macros / Floating Bodies}
 
-%D This module is currently a mess, due to splitting float 
-%D handlers over specific otr's. Consider it work in progress.  
+%D This module is currently a mess, due to splitting float
+%D handlers over specific otr's. Consider it work in progress.
 
 \unprotect
 
@@ -22,11 +22,11 @@
 
 \def\voidbox{\box\voidb@x}
 
-\def\spreadhbox#1% rebuilds \hbox{<box><hss><box><hss><box>}  
+\def\spreadhbox#1% rebuilds \hbox{<box><hss><box><hss><box>}
   {\bgroup
    \ifhbox#1\relax
      \setbox2=\voidbox
-     \unhbox#1% 
+     \unhbox#1%
      \doloop
        {\unpenalty\unskip\unpenalty\unskip\unpenalty\unskip
         \setbox0=\lastbox
@@ -43,7 +43,7 @@
    \fi
    \egroup}
 
-\def\placefloats{\doflushfloats}  % keep this one 
+\def\placefloats{\doflushfloats}  % keep this one
 
 \startmessages  dutch  library: floatblocks
   title: plaatsblokken
@@ -179,38 +179,19 @@
 
 \def\doleegblok#1%
   {\localframed
-      [\??fl#1][\c!kader=\v!aan]%
-      {\getmessage{\m!floatblocks}{12}}}
-
-% \def\docomplexplaatsblok[#1][#2][#3]#4%
-%   {\flushfootnotes
-%    \ifsomefloatwaiting
-%      % this was \checkwaitingfloats spread all over  
-%      \doifinsetelse{\v!altijd}{#2}
-%        {\showmessage{\m!floatblocks}{5}{}}
-%        {\doifcommonelse{#2}{\v!tekst,\v!naast,% \v!pagina, 
-%              \v!links,\v!rechts,\v!inlinker,\v!inrechter,%
-%              \v!inmarge}
-%           {\doflushfloats}
-%           {}}%
-%      % but which should be done before using box \floatbox 
-%    \fi
-%    \ifmargeblokken
-%      \doifinset{\v!marge}{#2}
-%        {\bgroup
-%         \everypar{\egroup\the\everypar}%
-%         \hsize=\@@mbbreedte}%
-%    \fi
-%    \global\insidefloattrue
-%    \dowithnextboxcontent % better a \the\everyfloattoks 
-%      {\postponefootnotes} % new 
-%      {\setlocalfloatdimensions{#1}{#2}% new  
-%       \docompletefloat
-%         {#1}{#3}{#1}{#2}{#1}{#4}
-%         {\box\nextbox}}%
-%    \vbox}
-
-\def\docomplexplaatsblok[#1][#2][#3]#4%
+     [\??fl#1][\c!kader=\v!aan]%
+     {\getmessage{\m!floatblocks}{12}}}
+
+\def\docomplexplaatsblok[#1][#2]% [#3]#4%
+  {\doifelsenothing{#1}
+     {\let\floattype\v!figuur}
+     {\edef\floattype{#1}}%
+   \doifelsenothing{#2}
+     {\edef\floatlocation{\getvalue{\??fl#1\c!default}}}
+     {\edef\floatlocation{#2}}%
+   \expanded{\dodocomplexplaatsblok[\floattype][\floatlocation]}}
+
+\def\dodocomplexplaatsblok[#1][#2][#3]#4%
   {\flushfootnotes
    \ifsomefloatwaiting
      % this was \checkwaitingfloats spread all over
@@ -244,22 +225,27 @@
 \newif\ifextrafloatactions \extrafloatactionstrue
 
 \def\xdocompletefloat#1#2#3#4#5#6%
-  {\ifextrafloatactions 
+  {\ifextrafloatactions
      \let\@@extrafloat\empty
      \processallactionsinset
        [#4]
-       [\v!binnen=>\xxdocompletefloat\v!links    \v!rechts,
-        \v!buiten=>\xxdocompletefloat\v!rechts   \v!links,
-          ininner=>\xxdocompletefloat\v!inlinker \v!inrechter,
-          inouter=>\xxdocompletefloat\v!inrechter\v!inlinker]%
+       [\v!binnen=>\xxdocompletefloat\v!links       \v!rechts,
+        \v!buiten=>\xxdocompletefloat\v!rechts      \v!links,
+   \v!binnenmarge=>\xxdocompletefloat\v!linkermarge \v!rechtermarge,
+   \v!buitenmarge=>\xxdocompletefloat\v!rechtermarge\v!linkermarge,
+    \v!binnenrand=>\xxdocompletefloat\v!linkerrand  \v!rechterrand,
+    \v!buitenrand=>\xxdocompletefloat\v!rechterrand \v!linkerrand,
+          % for old times sake
+          ininner=>\xxdocompletefloat\v!inlinker    \v!inrechter,
+          inouter=>\xxdocompletefloat\v!inrechter   \v!inlinker]%
      \ifx\@@extrafloat\empty
-       \setlocalfloatdimensions{#1}{#4}% 
+       \setlocalfloatdimensions{#1}{#4}%
        \docompletefloat{#1}{#2}{#3}{#4}{#5}{#6}{\box\nextbox}%
      \else
        \setlocalfloatdimensions{#1}{\@@extrafloat,#4}%
        \docompletefloat{#1}{#2}{#3}{\@@extrafloat,#4}{#5}{#6}{\box\nextbox}%
      \fi
-   \else % downward compatible 
+   \else % downward compatible
      \docompletefloat{#1}{#2}{#3}{#4}{#5}{#6}{\box\nextbox}%
    \fi}
 
@@ -270,9 +256,11 @@
      {\scratchdimen=\getvalue{\??fl#1\c!maxbreedte}\relax
       \ifdim\wd\nextbox>\scratchdimen
         \setbox\nextbox=\hbox to \scratchdimen
-          {\doifnotcommon{\v!rechts,\v!inrechter}{#2}{\hss}%
+          {\doifnotcommon
+             {\v!rechts,\v!inrechter,\v!rechtermarge,\v!rechterrand}{#2}\hss
            \box\nextbox
-           \doifnotcommon{\v!links ,\v!inlinker }{#2}{\hss}}%
+           \doifnotcommon
+             {\v!links,\v!inlinker,\v!linkermarge,\v!linkerrand}{#2}\hss}%
       \fi}}
 
 \def\docomplexstarttekstblok[#1][#2][#3]%
@@ -292,24 +280,24 @@
 
 \def\dodefinieerplaatsblok[#1][#2][#3]% #1=naam #2=meervoud #3=parent
   {\ifthirdargument
-     \redodefinieerplaatsblok[#1][#2][#3]%        
+     \redodefinieerplaatsblok[#1][#2][#3]%
    \else\ifsecondargument
-     \dododefinieerplaatsblok[#1][#2]%        
+     \dododefinieerplaatsblok[#1][#2]%
    \else
-     \dododefinieerplaatsblok[#1][#1]%        
-   \fi\fi}        
+     \dododefinieerplaatsblok[#1][#1]%
+   \fi\fi}
 
-\def\dododefinieerplaatsblok[#1][#2]% 
+\def\dododefinieerplaatsblok[#1][#2]%
   {\presetlocalframed[\??fl#1]%
    \stelplaatsblokin
      [#1]
      [\c!breedte=15\korpsgrootte,
       \c!hoogte=10\korpsgrootte,
-\c!maxbreedte=,
-\c!maxhoogte=,
-\c!zijvoorwit=\@@bkzijvoorwit,
-\c!zijnawit=\@@bkzijnawit,
-\c!marge=\@@bkmarge,
+      \c!maxbreedte=,
+      \c!maxhoogte=,
+      \c!zijvoorwit=\@@bkzijvoorwit,
+      \c!zijnawit=\@@bkzijnawit,
+      \c!marge=\@@bkmarge,
       \c!kader=\@@bkkader,
       \c!straal=\@@bkstraal,
       \c!hoek=\@@bkhoek,
@@ -323,7 +311,8 @@
       \c!linkerkader=\@@bklinkerkader,
       \c!rechterkader=\@@bkrechterkader,
       \c!kaderoffset=\@@bkkaderoffset,
-      \c!paginaovergangen=]%
+      \c!paginaovergangen=,
+      \c!default=\@@bkdefault]%
    \stelblokkopjein
      [#1]
      [\c!plaats=\@@kjplaats,
@@ -388,7 +377,7 @@
       \c!kader,\c!straal,\c!hoek,\c!plaats,\c!achtergrond,
       \c!achtergrondraster,\c!achtergrondkleur,\c!achtergrondoffset,
       \c!bovenkader,\c!onderkader,\c!linkerkader,\c!rechterkader,
-      \c!kaderoffset,\c!paginaovergangen]%
+      \c!kaderoffset,\c!paginaovergangen,\c!default]%
    \copyparameters[\??kj#1][\??kj#3]
      [\c!plaats,\c!voor,\c!tussen,\c!na,
       \c!breedte,\c!kopletter,\c!kopkleur,\c!letter,\c!kleur,
@@ -402,14 +391,10 @@
 \def\placefloat % \plaatsplaatsblok
   {\dotripleempty\docomplexplaatsblok}
 
-% De onderstaande macro's zijn verantwoordelijk voor het plaatsen
-% van floats. De macro's moeten nog worden aangepast en
-% uitgebreid:
-%
-% -  nofloatpermitted : top, bot en mid counters en geen topins
-%    als reeds midfloat of botfloat
-%
-% -  links, rechts, midden als niet hangend
+\installinsertion\topins \newdimen\topinserted 
+\installinsertion\botins \newdimen\botinserted 
+
+%D Extra float registers. 
 
 \newif\ifsomefloatwaiting     \somefloatwaitingfalse
 \newif\ifroomforfloat         \roomforfloattrue
@@ -422,25 +407,6 @@
 \newbox\floatlist
 \newbox\savedfloatlist
 
-\ifx\topins\undefined \newinsert\topins \fi
-\ifx\botins\undefined \newinsert\botins \fi
-\ifx\lowins\undefined \newinsert\lowins \fi
-
-\skip\topins\zeropoint 
-\skip\botins\zeropoint    
-\skip\lowins\zeropoint
-
-\count\topins\!!thousand   
-\count\botins\!!thousand   
-\count\lowins\!!thousand
-
-\dimen\topins\maxdimen     
-\dimen\botins\maxdimen     
-\dimen\lowins\maxdimen
-
-\newdimen\topinserted \topinserted=\zeropoint
-\newdimen\botinserted \botinserted=\zeropoint
-
 \newif\ifflushingfloats \flushingfloatsfalse
 
 \newbox\floattext
@@ -521,7 +487,7 @@
 %      \global\savednoffloats=0
 %      \global\setbox\floatbox=\box\voidb@x
 %    \fi}
-% 
+%
 % \def\dosavefloat%
 %   {\global\setbox\floatlist=\vbox
 %      {\nointerlineskip
@@ -531,7 +497,7 @@
 %    \global\somefloatwaitingtrue
 %    \dosavefloatinfo
 %    \nonoindentation}
-% 
+%
 % \def\doresavefloat%
 %   {\global\setbox\floatlist=\vbox
 %      {\nointerlineskip
@@ -539,7 +505,7 @@
 %       \box\floatbox}%
 %    \global\advance\savednoffloats by 1
 %    \global\somefloatwaitingtrue}
-% 
+%
 % \def\doreversesavefloat%
 %   {\global\setbox\floatlist=\vbox
 %      {\nointerlineskip
@@ -550,7 +516,7 @@
 %    \dosavefloatinfo}
 
 % \def\Xdogetfloat%
-%   {\ifcase\savednoffloats\global\somefloatwaitingfalse\fi 
+%   {\ifcase\savednoffloats\global\somefloatwaitingfalse\fi
 %    \ifsomefloatwaiting
 %      \global\setbox\floatlist=\vbox
 %        {\unvbox\floatlist
@@ -590,7 +556,7 @@
 
 \def\uncenteredfloatbox%
   {\ifcenterfloatbox
-     \ifhbox\floatbox\relax % remove centering 
+     \ifhbox\floatbox\relax % remove centering
        \ifdim\wd\floatbox=\hsize
          \ifhbox\floatbox
            \setbox\scratchbox=\hbox
@@ -645,7 +611,7 @@
      {\global\setbox\floatlist\box\savedfloatlist
       \global\setbox\floatbox \box\savedfloatbox
       \savednoffloats\the\savednoffloats}}
- 
+
 \let\dorestorefloatstatus\relax
 
 %\def\checkwaitingfloats#1%
@@ -658,8 +624,8 @@
 \ifx\doflushfloats\undefined \let\doflushfloats\relax \fi
 \ifx\flushfloatbox\undefined \let\flushfloatbox\relax \fi
 
-\newif\iftopofinsert 
-\newif\iftestfloatbox 
+\newif\iftopofinsert
+\newif\iftestfloatbox
 \newif\ifcenterfloatbox \centerfloatboxtrue
 
 % beter de laatste skip buiten de \insert uitvoeren,
@@ -729,9 +695,9 @@
    \hsize\floattextwidth
    \ignorespaces}
 
-\def\dodostoptextfloat[#1]%  % de tekst kan beter in een soort 
+\def\dodostoptextfloat[#1]%  % de tekst kan beter in een soort
   {\egroup                   % kadertekst zonder kader, is flexibeler
-   \doifnotinset{\v!lang}{#1}% en beter 
+   \doifnotinset{\v!lang}{#1}% en beter
      {\ifdim\ht\floattext<\floatheight
         \floattextheight=\floatheight
       \else
@@ -880,9 +846,9 @@
 \let\floatcaptionsuffix\empty % an optional suffix
 \let\floatcaptionnumber\empty % a logical counter
 
-% obsolete ? 
-% 
-% \def\dosetfloatcaption#1#2#3% name will change 
+% obsolete ?
+%
+% \def\dosetfloatcaption#1#2#3% name will change
 %   {\def\dofloattekst%
 %      {{\doattributes{\??kj#1}\c!letter\c!kleur{#3}}}%
 %    \doifelsevalue{\??kj#1\c!nummer}{\v!ja}
@@ -911,7 +877,7 @@
    \placefloatcaptiontext[#1]%
    \placefloatcaptionreference[#1]}
 
-\def\setfloatcaption % \dosetfloatcaption already in use 
+\def\setfloatcaption % \dosetfloatcaption already in use
   {\dodoubleempty\dodosetfloatcaption} % beware, name clash
 
 \def\dodosetfloatcaption[#1][#2]#3% to do namespace for number/ascii
@@ -972,7 +938,7 @@
       \doattributes{\??kj#1}\c!tekstletter\c!tekstkleur
         {\begstrut#3\endstrut\endgraf}}}
 
-% new 
+% new
 
 \newbox\tempfloatbox
 \newbox\tempcaptionbox
@@ -981,7 +947,7 @@
 %\stelblokkopjesin[\c!uitlijnen=\v!links]
 %\stelblokkopjesin[\c!uitlijnen=\v!rechts]
 
-\def\dosetpagfloat#1#2#3#4% \copy wegwerken 
+\def\dosetpagfloat#1#2#3#4% \copy wegwerken
   {\bgroup
    \forgetall
    \postponefootnotes
@@ -992,7 +958,7 @@
    \ConvertToConstant\doifelse{#3}{\v!geen}
      {\dopreparenocaption{#1}{#2}{#3}{#4}
       \edef\width{\the\wd\floatbox}}
-     {\setbox\tempcaptionbox=\hbox  
+     {\setbox\tempcaptionbox=\hbox
         {\footnotesenabledfalse\putcompletecaption{#4}{#2}{#3}{0}}%
       \doifinsetelse{\@@kjkjplaats}{\v!hoog,\v!midden,\v!laag}
         {\dopreparesidecaption{#1}{#2}{#3}{#4}}
@@ -1012,10 +978,10 @@
 
 \def\dopreparenocaption#1#2#3#4%
   {\global\setbox\floatbox=\vbox % pas op als wd groter dan hsize
-     {\ifbinnenkolommen\ifdim\wd\tempfloatbox>\hsize  
-        \let\locatefloat\relax            
-      \fi\fi                              
-      \locatefloat{\copy\tempfloatbox}}} 
+     {\ifbinnenkolommen\ifdim\wd\tempfloatbox>\hsize
+        \let\locatefloat\relax
+      \fi\fi
+      \locatefloat{\copy\tempfloatbox}}}
 
 \def\dopreparestackcaptionmax#1#2#3#4%
   {\dosetraggedvbox{\@@kjkjuitlijnen}%
@@ -1029,15 +995,15 @@
 \def\dopreparestackcaptionaut#1#2#3#4%
   {\doifsomething{\@@kjkjuitlijnen}
      {\ExpandBothAfter\doifnotinset{\v!midden}{\@@kjkjuitlijnen}
-        {\let\captionovershoot\!!zeropoint}}% 
+        {\let\captionovershoot\!!zeropoint}}%
    \ifdim\wd\tempfloatbox>\hsize
-     % float is wider than \hsize 
+     % float is wider than \hsize
      \dosetraggedvbox\@@kjkjuitlijnen
-     \setbox\scratchbox=\raggedbox % trial run 
+     \setbox\scratchbox=\raggedbox % trial run
        {\hsize=\wd\tempfloatbox
         \footnotesenabledfalse
         \putcompletecaption{#4}{#2}{#3}{0}}%
-     \ifdim\ht\scratchbox>\lineheight % more lines 
+     \ifdim\ht\scratchbox>\lineheight % more lines
        \dosetraggedvbox\@@kjkjuitlijnen
        \setbox\tempcaptionbox=\raggedbox
          {\hsize=\wd\tempfloatbox
@@ -1052,20 +1018,20 @@
           \putcompletecaption{#4}{#2}{#3}{0}}%
      \fi
    \else
-     % float is smaller of equal to \hsize 
+     % float is smaller of equal to \hsize
      \ifdim\wd\tempfloatbox<\captionminwidth\relax
-       \scratchdimen\captionminwidth % float smaller than min width 
-     \else 
-       \scratchdimen\wd\tempfloatbox % float width 
-     \fi 
-     \setbox\scratchbox=\vbox     % test with overshoot 
+       \scratchdimen\captionminwidth % float smaller than min width
+     \else
+       \scratchdimen\wd\tempfloatbox % float width
+     \fi
+     \setbox\scratchbox=\vbox     % test with overshoot
        {\advance\scratchdimen \captionovershoot
-        \advance\scratchdimen 3em % an average word length 
+        \advance\scratchdimen 3em % an average word length
         \ifdim\scratchdimen<\hsize \hsize=\scratchdimen \fi
         \footnotesenabledfalse
         \putcompletecaption{#4}{#2}{#3}{0}}%
-     \ifdim\ht\scratchbox>\lineheight 
-       % at least an average word longer than a line 
+     \ifdim\ht\scratchbox>\lineheight
+       % at least an average word longer than a line
        \dosetraggedvbox\@@kjkjuitlijnen
        \setbox\tempcaptionbox\raggedbox
          {\advance\scratchdimen \captionovershoot
@@ -1093,9 +1059,9 @@
       \putcompletecaption{#4}{#2}{#3}{0}}}
 
 \def\dopreparestackcaptionmin#1#2#3#4%
-  {\raggedcenter                     % the default 
-   \dosetraggedvbox\@@kjkjuitlijnen  % when given 
-   \setbox\tempcaptionbox=\raggedbox % vbox, keeps footnotes 
+  {\raggedcenter                     % the default
+   \dosetraggedvbox\@@kjkjuitlijnen  % when given
+   \setbox\tempcaptionbox=\raggedbox % vbox, keeps footnotes
      {\hsize\wd\tempfloatbox
       \putcompletecaption{#4}{#2}{#3}{0}}}
 
@@ -1151,9 +1117,10 @@
                          {\vbox to\ht\tempfloatbox{\vfill\box\tempcaptionbox\vfill}%
                           \tfskip
                           \box\tempfloatbox}},
+        \s!unknown=>\locatefloat{\box\tempfloatbox},
            \v!geen=>\locatefloat{\box\tempfloatbox}]}}
 
-\newif\ifpostponecolumnfloats \postponecolumnfloatsfalse % don't change 
+\newif\ifpostponecolumnfloats \postponecolumnfloatsfalse % don't change
 
 %\def\postcenterfloatbox#1%
 %  {\ifbinnenkolommen
@@ -1168,7 +1135,7 @@
 %     \scratchdimen=\wd\floatbox
 %   \fi\fi
 %   \global\setbox\floatbox=\hbox to \scratchdimen
-%     {\hfill\box\floatbox\hfill}} % geen \hss, gaat mis in kolommen ! 
+%     {\hfill\box\floatbox\hfill}} % geen \hss, gaat mis in kolommen !
 
 % \def\postcenterfloatbox#1% 2 of 4
 %   {\global\floatwidth\wd\ifdim\wd2>\wd4 2 \else 4 \fi
@@ -1205,8 +1172,8 @@
      \scratchdimen=\wd\floatbox
    \fi\fi
    \global\setbox\floatbox=\hbox to \scratchdimen
-%     {\hfill\box\floatbox\hfill}} % geen \hss, gaat mis in kolommen ! 
-     {\hss\box\floatbox\hss}} % wel \hss, anders mis in colset 
+%     {\hfill\box\floatbox\hfill}} % geen \hss, gaat mis in kolommen !
+     {\hss\box\floatbox\hss}} % wel \hss, anders mis in colset
 
 \def\dosetparfloat#1#2#3#4%
   {\bgroup
@@ -1250,7 +1217,8 @@
      \par
      \doifcommonelse
         {#1}
-        {\v!links,\v!rechts,\v!inlinker,\v!inrechter,\v!inmarge}
+        {\v!links,\v!rechts,\v!inlinker,\v!inrechter,\v!inmarge,%
+         \v!linkermarge,\v!linkerrand,\v!rechtermarge,\v!rechterrand}
         {\global\parfloattrue}
         {\global\parfloatfalse}%
      \ifbinnenkolommen
@@ -1311,6 +1279,10 @@
          \v!inmarge=>\def\next{\somesidefloat[#1]},
         \v!inlinker=>\def\next{\somesidefloat[#1]},
        \v!inrechter=>\def\next{\somesidefloat[#1]},
+     \v!linkermarge=>\def\next{\somesidefloat[#1]},
+    \v!rechtermarge=>\def\next{\somesidefloat[#1]},
+      \v!linkerrand=>\def\next{\somesidefloat[#1]},
+     \v!rechterrand=>\def\next{\somesidefloat[#1]},
          \s!default=>\def\next{\someelsefloat[\v!hier,#1]},
          \s!unknown=>\def\next{\someelsefloat[\v!hier,#1]}]%
      \next
@@ -1337,7 +1309,7 @@
          \vss % gets rid of the depth
          \rawpagereference{\s!flt}{#2}}%
       \egroup\dofloat{#4}{}{#6}{#1}}
-     {\doglobal\convertargument#6\to\asciititle % \asciititle is global 
+     {\doglobal\convertargument#6\to\asciititle % \asciititle is global
       \doifelsevalue{\??kj#1\c!nummer}{\v!ja}
         {\verhoognummer[#1]%
          \maakhetnummer[#1]%
@@ -1348,7 +1320,7 @@
              \rawreference{\s!flt}{#2}{{\hetnummer}{\asciititle}}%
              \doschrijfnaarlijst{#3}{\hetnummer}{#6}{#3}}%
          \egroup
-         \preparethenumber{\??kj#1}\hetnummer\preparednumber 
+         \preparethenumber{\??kj#1}\hetnummer\preparednumber
          \dofloat{#4}{\labeltexts{#5}{\preparednumber}}{#6}{#1}}
         {\global\setbox\floatbox=\vbox
            {\unvbox\floatbox % no \vss, keep the depth
@@ -1411,10 +1383,10 @@
 \def\plaatslinkermargeblok%
   {\hskip\linkermargebreedte}
 
-\def\checkmargeblokken%  
+\def\checkmargeblokken%
   {\ifvoid\marginbox\else\docheckmargeblokken\fi}
 
-\def\docheckmargeblokken% erg inefficient 
+\def\docheckmargeblokken% erg inefficient
   {\setbox\preparedmarginbox=\vbox
      {\forgetall
       \splittopskip\topskip
@@ -1440,7 +1412,7 @@
            {\@@mbrechts\box\preparedmarginbox\@@mblinks}%
          \vsmashbox\preparedmarginbox
          \box\preparedmarginbox}}%
-   \processaction % traag 
+   \processaction % traag
      [\@@mbplaats]
      [ \v!inmarge=>\doifbothsidesoverruled
                      \rightmarginbox
@@ -1499,7 +1471,7 @@
 %\def\douitstellen%
 %  {\the\everytopofpage
 %   \ifinuitstellen\else\ifcase\nofpostponedblocks\else % The \nof-test is
-%     \global\pagetotal\zeropoint % recently added 
+%     \global\pagetotal\zeropoint % recently added
 %     \global\inuitstellentrue                          % definitely needed
 %     \dorecurse{\nofpostponedblocks}                   % else we can loose
 %       {\haalbuffer[buf-\recurselevel]}                % or disorder floats
@@ -1516,7 +1488,7 @@
 %    \fi
 %    \ifinuitstellen\else\ifcase\nofpostponedblocks\else % The \nof-test is
 % \bgroup
-% \restoreglobalbodyfont % else problems inside split verbatim 
+% \restoreglobalbodyfont % else problems inside split verbatim
 %      % message
 %      \global\pagetotal\zeropoint % recently added
 %      \global\inuitstellentrue                          % definitely needed
@@ -1576,7 +1548,7 @@
      \getparameters[\??si][#1]%
      \resetnummer[\??si]%
      \def\floatcaptionsuffix{\nummer[\??si]}%
-     \TABLEcaptionheight=\@@siregels\lineheight % brrr 
+     \TABLEcaptionheight=\@@siregels\lineheight % brrr
 \def\docomplexpagina[##1]{\goodbreak}%
      \dowithnextbox
        {\forgetall
@@ -1691,13 +1663,14 @@
    \c!marge=1em,
    \c!nboven=2,
    \c!nonder=0,
-   \c!nregels=4]
+   \c!nregels=4,
+   \c!default=\v!figuur]
 
 \stelplaatsbloksplitsenin
   [\c!conversie=\v!letter, % \v!romeins
    \c!regels=3]
 
-% float strategy, replaces some of the above macros  
+% float strategy, replaces some of the above macros
 
 \let\floatmethod\empty
 \let\floatcolumn\empty
@@ -1710,11 +1683,11 @@
      \@EA\aftersplitstring \commalistelement\at:\to\floatcolumn
      \@EA\aftersplitstring \floatcolumn\at*\to\floatrow
      \@EA\beforesplitstring\floatcolumn\at*\to\floatcolumn
-% nog algemeen otr 
+% nog algemeen otr
 \ifx\OTRSETsetpreferedcolumnslot\undefined\else
      \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow
-\fi 
-% commando van maken 
+\fi
+% commando van maken
      \doifundefined{\string\floatmethod\floatmethod}
        {\let\floatmethod\v!hier}%
      \getvalue{\string\floatmethod\floatmethod}[#1]%
@@ -1723,30 +1696,34 @@
 \def\installfloathandler#1#2% #1=keyword #2=handler
   {\setvalue{\string\floatmethod#1}{#2}}
 
-\installfloathandler \v!hier      \someherefloat 
-\installfloathandler \v!forceer   \somefixdfloat 
-\installfloathandler \v!links     \someleftsidefloat 
-\installfloathandler \v!rechts    \somerightsidefloat 
-\installfloathandler \v!tekst     \sometextfloat 
-\installfloathandler \v!boven     \sometopfloat 
-\installfloathandler \v!onder     \somebottomfloat 
-\installfloathandler \v!marge     \somemarginfloat 
-\installfloathandler \v!pagina    \somepagefloat 
-\installfloathandler \v!naast     \somefacefloat 
-\installfloathandler \v!inmarge   \someinmarginfloat 
-\installfloathandler \v!inlinker  \someinleftmarginfloat 
-\installfloathandler \v!inrechter \someinrightmarginfloat 
-
-\installfloathandler {tblr} \someslotfloat 
-\installfloathandler {lrtb} \someslotfloat 
-\installfloathandler {tbrl} \someslotfloat 
-\installfloathandler {rltb} \someslotfloat 
-\installfloathandler {btlr} \someslotfloat 
-\installfloathandler {lrbt} \someslotfloat 
-\installfloathandler {btrl} \someslotfloat 
-\installfloathandler {rlbt} \someslotfloat 
-\installfloathandler {fxtb} \someslotfloat 
-\installfloathandler {fxbt} \someslotfloat 
+\installfloathandler \v!hier         \someherefloat
+\installfloathandler \v!forceer      \somefixdfloat
+\installfloathandler \v!links        \someleftsidefloat
+\installfloathandler \v!rechts       \somerightsidefloat
+\installfloathandler \v!tekst        \sometextfloat
+\installfloathandler \v!boven        \sometopfloat
+\installfloathandler \v!onder        \somebottomfloat
+\installfloathandler \v!marge        \somemarginfloat
+\installfloathandler \v!pagina       \somepagefloat
+\installfloathandler \v!naast        \somefacefloat
+\installfloathandler \v!inmarge      \someinmarginfloat
+\installfloathandler \v!inlinker     \someinleftmarginfloat
+\installfloathandler \v!inrechter    \someinrightmarginfloat
+\installfloathandler \v!linkermarge  \someinleftmarginfloat
+\installfloathandler \v!rechtermarge \someinrightmarginfloat
+\installfloathandler \v!linkerrand   \someinleftedgefloat
+\installfloathandler \v!rechterrand  \someinrightedgefloat
+
+\installfloathandler {tblr} \someslotfloat
+\installfloathandler {lrtb} \someslotfloat
+\installfloathandler {tbrl} \someslotfloat
+\installfloathandler {rltb} \someslotfloat
+\installfloathandler {btlr} \someslotfloat
+\installfloathandler {lrbt} \someslotfloat
+\installfloathandler {btrl} \someslotfloat
+\installfloathandler {rlbt} \someslotfloat
+\installfloathandler {fxtb} \someslotfloat
+\installfloathandler {fxbt} \someslotfloat
 
 \def\placesomeslotfloat {\OTRcommand\someslotfloat}
 \def\placesomeherefloat {\OTRcommand\someherefloat}
@@ -1764,6 +1741,8 @@
 \def\somemarginfloat       [#1]{\somenextfloat[#1]\nonoindentation}
 \def\someinleftmarginfloat [#1]{\somesidefloat[#1]}
 \def\someinrightmarginfloat[#1]{\somesidefloat[#1]}
+\def\someinleftedgefloat   [#1]{\somesidefloat[#1]}
+\def\someinrightedgefloat  [#1]{\somesidefloat[#1]}
 \def\someinmarginfloat     [#1]{\somesidefloat[#1]}
 \def\someherefloat         [#1]{\someelsefloat[\v!hier,#1]}
 
@@ -1772,4 +1751,4 @@
 \def\somefacefloat {\placesomefacefloat}
 \def\someslotfloat {\placesomeslotfloat}
 
-\protect \endinput 
+\protect \endinput
diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex
index c8e4f405c..22530676a 100644
--- a/tex/context/base/page-imp.tex
+++ b/tex/context/base/page-imp.tex
@@ -920,6 +920,7 @@
    \stellayoutin % \setuplayout
      [\c!rugwit=\!!zeropoint,\c!kopwit=\!!zeropoint,
       \c!hoogte=\v!midden,\c!breedte=\v!midden,
+      \c!tekstafstand=\!!zeropoint,
       \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]
 \fi
    \dorecurse\noffigurepages
diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex
index a18882f4d..37a99bdeb 100644
--- a/tex/context/base/page-ini.tex
+++ b/tex/context/base/page-ini.tex
@@ -657,9 +657,9 @@
 
 \def\dodotracedoutput#1%
   {\writestatus{\m!otr}{start \the\outputpenalty\space in column \number\mofcolumns}%
-   \writestatus{\m!otr}{v:\the\vsize,g:\the\pagegoal,t:\the\pagetotal,f:\the\ht\footins}%
+   \writestatus{\m!otr}{v:\the\vsize,g:\the\pagegoal,t:\the\pagetotal}%
    \dodoinvokeoutput{#1}%
-   \writestatus{\m!otr}{v:\the\vsize,g:\the\pagegoal,t:\the\pagetotal,f:\the\ht\footins}%
+   \writestatus{\m!otr}{v:\the\vsize,g:\the\pagegoal,t:\the\pagetotal}%
    \writestatus{\m!otr}{stop \the\outputpenalty\space in column \number\mofcolumns}}
 
 \def\installoutput#1#2% \invoke \action 
@@ -667,12 +667,25 @@
    \edef#1{\noexpand\doinvokeoutput{\outputcounter}}% 
    \setvalue{\@@OTR\outputcounter}{#2}}
 
-\installoutput\dosynchronizeoutput
-  {\ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
-   \ifvoid\topins \else\insert\topins {\unvbox\topins }\fi
-   \ifvoid\botins \else\insert\botins {\unvbox\botins }\fi
-   \unvbox\normalpagebox}
+% \installoutput\dosynchronizeoutput
+%   {\synchronizeinsertions
+%    \unvbox\normalpagebox}
            
+\installoutput\dosynchronizeoutput
+  {\unvbox\normalpagebox}
+
+% \installoutput\dosynchronizeoutput
+%   {\bgroup
+%    \setbox\scratchbox\vbox{\unvbox\normalpagebox}%
+%    \ifdim\ht\scratchbox=\zeropoint \else 
+%      \topskip\zeropoint 
+%      \unvbox\scratchbox 
+%    \fi
+%    \egroup}
+
+\def\synchronizeoutput 
+  {\dosynchronizeoutput}
+
 \newtoks\mainoutput 
 \newif\ifinotr
 
@@ -1013,16 +1026,6 @@
       \tlap{\plaatsversieaanduiding}
       \vskip.5cm}}
 
-% this will be inserts some day
-
-%\newinsert\referentieinfobox 
-%\newinsert\registerinfobox   
-%\newinsert\floatinfobox      
-
-\newbox\referentieinfobox
-\newbox\registerinfobox
-\newbox\floatinfobox
-
 \def\dotestinfo#1#2#3%
   {\ifvoorlopig\ifinpagebody\else
      \begingroup
@@ -1047,6 +1050,16 @@
        \totaltestinfo
      \fi
    \fi\fi}
+
+% this will be inserts some day
+
+% \installinsertion\referentieinfobox 
+% \installinsertion\registerinfobox   
+% \installinsertion\floatinfobox      
+
+\newbox\referentieinfobox
+\newbox\registerinfobox
+\newbox\floatinfobox
 
 \def\referentieinfo{\dotestinfo\referentieinfobox}
 \def\registerinfo  {\dotestinfo\registerinfobox}
@@ -1256,18 +1269,23 @@
 \paginageblokkeerdfalse
 
 \def\testpagina[#1][#2]%
-  {\ifpaginageblokkeerd \else
-     \ifdim\pagetotal<\pagegoal
-       \dimen0=\lineheight
-       \multiply\dimen0 by #1\relax
-       \advance\dimen0 by \pagetotal
-       \ifdim\lastskip<\parskip
-         \advance\dimen0 by \parskip
-       \fi
-       \advance\dimen0 by #2\relax
-       \ifdim\dimen0>.99\pagegoal
-         \penalty-\!!tenthousand\relax
-       \fi
+  {\relax % needed ! 
+   \ifpaginageblokkeerd \else
+     \ifdim\pagegoal<\maxdimen 
+       \ifdim\pagetotal<\pagegoal\relax
+         \dimen0=\lineheight
+         \multiply\dimen0 #1\relax
+         \advance\dimen0 \pagetotal
+         \ifdim\lastskip<\parskip
+           \advance\dimen0 \parskip
+         \fi
+         \advance\dimen0 #2\relax
+         \ifdim\dimen0>.99\pagegoal
+           \penalty-\!!tenthousand\relax
+         \fi
+       \else
+         % do nothing 
+       \fi 
      \else
        \goodbreak
      \fi
diff --git a/tex/context/base/page-lay.tex b/tex/context/base/page-lay.tex
index 72f03c9ce..c60928b42 100644
--- a/tex/context/base/page-lay.tex
+++ b/tex/context/base/page-lay.tex
@@ -385,6 +385,97 @@
            {\showmessage{\m!systems}{10}{##1}}}}%
    \processcommalist[#1]\docommando}
 
+% \def\recalculatelayout%
+%   {\global\linkermargebreedte \layoutparameter\c!linkermarge
+%    \global\rechtermargebreedte\layoutparameter\c!rechtermarge
+%    \global\linkerrandbreedte  \layoutparameter\c!linkerrand
+%    \global\rechterrandbreedte \layoutparameter\c!rechterrand
+%    \global\hoofdhoogte        \layoutparameter\c!hoofd
+%    \global\voethoogte         \layoutparameter\c!voet
+%    \global\onderhoogte        \layoutparameter\c!onder
+%    \global\bovenhoogte        \layoutparameter\c!boven
+%    \global\rugwit             \layoutparameter\c!rugwit
+%    \global\kopwit             \layoutparameter\c!kopwit
+%    \setlayoutdimensions % the rest of the `dimensions'
+%    \doifelse\@@lygrid\v!ja\gridsnappingtrue\gridsnappingfalse
+%    \ifgridsnapping
+%      \widowpenalty\zerocount % is gewoon beter
+%      \clubpenalty \zerocount % zeker bij grids
+%    \else
+%      \widowpenalty\defaultwidowpenalty
+%      \clubpenalty \defaultclubpenalty
+%    \fi
+%    \simplestelwitruimtein
+%    \simplestelblankoin
+%    \global\snijwit\layoutparameter\c!snijwit\relax
+%    \doifelse{\layoutparameter\c!breedte}\v!midden
+%      {\ifdim\snijwit=\zeropoint 
+%         \global\snijwit\rugwit 
+%       \fi 
+%       \global\zetbreedte\papierbreedte
+%       \global\advance\zetbreedte -\rugwit
+%       \global\advance\zetbreedte -\snijwit}
+%      {\doifelse{\layoutparameter\c!breedte}\v!passend
+%         {\ifdim\snijwit=\zeropoint 
+%            \global\snijwit\rugwit 
+%          \fi 
+%          \global\zetbreedte\papierbreedte
+%          \global\advance\zetbreedte -\snijwit
+%          \scratchdimen\rugwit
+%          \advance\scratchdimen -\linkerrandbreedte
+%          \advance\scratchdimen -\linkerrandafstand
+%          \advance\scratchdimen -\linkermargebreedte
+%          \advance\scratchdimen -\linkermargeafstand
+%          \ifdim\scratchdimen<\zeropoint
+%            \scratchdimen\zeropoint
+%          \fi
+%          \global\advance\zetbreedte -\rechtermargeafstand
+%          \global\advance\zetbreedte -\rechtermargebreedte
+%          \global\advance\zetbreedte -\rechterrandafstand
+%          \global\advance\zetbreedte -\rechterrandbreedte
+%          \global\advance\zetbreedte -\scratchdimen}
+%         {\global\zetbreedte\layoutparameter\c!breedte
+%          \ifdim\snijwit=\zeropoint 
+%            \global\snijwit\papierbreedte
+%            \global\advance\snijwit-\zetbreedte
+%            \global\advance\snijwit-\rugwit
+%          \else 
+%            % inconsistent specification 
+%          \fi}}%
+%    \scratchdimen\layoutparameter\c!bodemwit\relax
+%    \ifdim\scratchdimen=\zeropoint
+%      \scratchdimen\kopwit
+%    \fi
+%    \doifelse{\layoutparameter\c!regels}\empty
+%      {\doifelse{\layoutparameter\c!hoogte}\v!midden
+%         {\global\zethoogte\papierhoogte
+%          \global\advance\zethoogte -\kopwit
+%          \global\advance\zethoogte -\scratchdimen}
+%         {\doifelse{\layoutparameter\c!hoogte}\v!passend
+%            {\global\zethoogte\papierhoogte
+%             \global\advance\zethoogte -\scratchdimen
+%             \scratchdimen\kopwit
+%             \advance\scratchdimen -\bovenhoogte
+%             \advance\scratchdimen -\bovenafstand
+%             \ifdim\scratchdimen<\zeropoint
+%               \scratchdimen\zeropoint
+%             \fi
+%             \global\advance\zethoogte -\onderafstand
+%             \global\advance\zethoogte -\onderhoogte
+%             \global\advance\zethoogte -\scratchdimen}
+%            {\global\zethoogte\layoutparameter\c!hoogte}}}
+%      {\global\zethoogte\layoutparameter\c!regels\lineheight
+%       \global\advance\zethoogte \hoofdhoogte
+%       \global\advance\zethoogte \voethoogte}%
+%    \rugoffset\layoutparameter\c!rugoffset
+%    \kopoffset\layoutparameter\c!kopoffset
+%    \global\setdimentoatleast\zetbreedte\!!onepoint
+%    \global\setdimentoatleast\zethoogte\!!onepoint
+%    \calculatehsizes
+%    \calculatevsizes
+%    \recalculatelogos
+%    \recalculatebackgrounds}
+
 \def\recalculatelayout%
   {\global\linkermargebreedte \layoutparameter\c!linkermarge
    \global\rechtermargebreedte\layoutparameter\c!rechtermarge
@@ -443,17 +534,24 @@
            % inconsistent specification 
          \fi}}%
    \scratchdimen\layoutparameter\c!bodemwit\relax
-   \ifdim\scratchdimen=\zeropoint
-     \scratchdimen\kopwit
-   \fi
+  %\ifdim\scratchdimen=\zeropoint
+  %  \scratchdimen\kopwit
+  %\fi
+   \global\bodemwit\layoutparameter\c!bodemwit\relax
    \doifelse{\layoutparameter\c!regels}\empty
      {\doifelse{\layoutparameter\c!hoogte}\v!midden
-        {\global\zethoogte\papierhoogte
+        {\ifdim\bodemwit=\zeropoint 
+           \global\bodemwit\kopwit 
+         \fi 
+         \global\zethoogte\papierhoogte
          \global\advance\zethoogte -\kopwit
-         \global\advance\zethoogte -\scratchdimen}
+         \global\advance\zethoogte -\bodemwit}
         {\doifelse{\layoutparameter\c!hoogte}\v!passend
-           {\global\zethoogte\papierhoogte
-            \global\advance\zethoogte -\scratchdimen
+           {\ifdim\bodemwit=\zeropoint 
+             \global\bodemwit\kopwit 
+            \fi 
+            \global\zethoogte\papierhoogte
+            \global\advance\zethoogte -\bodemwit
             \scratchdimen\kopwit
             \advance\scratchdimen -\bovenhoogte
             \advance\scratchdimen -\bovenafstand
@@ -463,8 +561,19 @@
             \global\advance\zethoogte -\onderafstand
             \global\advance\zethoogte -\onderhoogte
             \global\advance\zethoogte -\scratchdimen}
-           {\global\zethoogte\layoutparameter\c!hoogte}}}
+           {\global\zethoogte\layoutparameter\c!hoogte
+            \ifdim\bodemwit=\zeropoint 
+              \global\bodemwit\papierhoogte
+              \global\advance\bodemwit-\zethoogte
+              \global\advance\bodemwit-\kopwit
+            \else 
+              % inconsistent specification 
+            \fi}}}%
      {\global\zethoogte\layoutparameter\c!regels\lineheight
+% new, was a bug 
+\global\advance\zethoogte \hoofdafstand
+\global\advance\zethoogte \voetafstand
+% so far 
       \global\advance\zethoogte \hoofdhoogte
       \global\advance\zethoogte \voethoogte}%
    \rugoffset\layoutparameter\c!rugoffset
@@ -972,6 +1081,7 @@
              \c!kopoffset=\!!zeropoint,
              \c!rugoffset=\!!zeropoint,
           \c!tekstbreedte=, % dangerous option
+          \c!tekstafstand=\!!zeropoint,
                 \c!letter=,
                  \c!kleur=,
              \c!markering=\v!uit,
diff --git a/tex/context/base/page-lin.tex b/tex/context/base/page-lin.tex
index 4b6b9cdac..466a34c43 100644
--- a/tex/context/base/page-lin.tex
+++ b/tex/context/base/page-lin.tex
@@ -16,7 +16,12 @@
 \unprotect 
 
 \newif\ifinregels
-\newif\ifregelnummersinmarge
+%\newif\ifregelnummersinmarge
+
+\chardef\linenumberlocation=0
+
+\newtoks\beforeeverylinenumbering
+\newtoks\aftereverylinenumbering
 
 \def\stelregelsin%
   {\dodoubleargument\getparameters[\??rg]}
@@ -87,7 +92,7 @@
 
 \def\dodoshowlinenumber% for use elsewhere, to be extended 
   {\doschrijfregelnummer
-   \global\advance\linenumber by 1\relax}%
+   \global\advance\linenumber 1\relax}%
 
 \def\regelweergave%
   {\convertnumber\@@rnconversie\linenumber}%
@@ -98,7 +103,7 @@
      [\c!start=1,
       \c!stap=1,
       #1]%
-   \global\linenumber=1\relax}
+   \global\linenumber1\relax}
 
 \def\stelregelnummerenin%
   {\dosingleargument\dostelregelnummerenin}
@@ -107,43 +112,57 @@
   {\EveryPar{\schrijfregelnummer}}
 
 \def\dostopnummerenLINE%
-  {\egroup}
+  {\the\aftereverylinenumbering
+   \egroup}
 
 \def\dodoschrijfregelnummer%
   {\setbox0=\hbox{\regelweergave}%
    \vsmashbox0%
-   \ifregelnummersinmarge
-     \llap{\hbox{\box0\hskip\linkermargeafstand}}%
-   \else
+   \ifcase\linenumberlocation
      \rlap{\hbox to \@@rnbreedte{\box0\hss}}% was \llap, nog testen !! 
+   \else
+     \llap{\hbox{\box0\hskip\linkermargeafstand}}%
    \fi}
 
 \def\complexstartregelnummeren[#1]%
-  {\doifnotinset{\v!verder}{#1}
-     {\global\linenumber=1\relax}%
-   \doifinsetelse{\@@rnplaats}{\v!inmarge,\v!marge}
-     {\regelnummersinmargetrue}
-     {\regelnummersinmargefalse}%
-   \ifregelnummersinmarge\else
-     \advance\leftskip by \@@rnbreedte\relax
+%  {\doifnotinset{\v!verder}{#1}
+%     {\global\linenumber=1\relax}%
+  {\doifnot{\v!verder}{#1}
+     {\doifnumberelse{#1}
+        {\global\linenumber#1}%
+        {\global\linenumber 1}%
+      \relax}%
+   \chardef\linenumberlocation0
+   \processaction
+     [\@@rnplaats]
+     [  \v!inmarge=>\chardef\linenumberlocation1,
+       \v!inlinker=>\chardef\linenumberlocation1,
+      \v!inrechter=>\chardef\linenumberlocation2,
+          \v!marge=>\chardef\linenumberlocation1]%
+       %  \v!tekst=>\chardef\linenumberlocation0,
+       %\v!unknown=>\chardef\linenumberlocation0,
+       %\v!default=>\chardef\linenumberlocation0]%
+   \ifcase\linenumberlocation % text 
+     \advance\leftskip \@@rnbreedte\relax
    \fi
    \ifinregels
      \let\dostartnummeren=\dostartnummerenLINE
      \let\stopregelnummeren=\dostopnummerenLINE
      \def\schrijfregelnummer%
        {\doschrijfregelnummer
-        \global\advance\linenumber by 1\relax}%
+        \global\advance\linenumber 1\relax}%
    \else
      \let\dostartnummeren=\dostartnummerenPAR
      \let\stopregelnummeren=\dostopnummerenPAR
      \def\schrijfregelnummer%
-       {\global\advance\linenumber by -1\relax
+       {\global\advance\linenumber -1\relax
         \doschrijfregelnummer}%
    \fi
    \dostartnummeren}
 
 \def\startregelnummeren%
   {\bgroup
+   \the\beforeeverylinenumbering
    \inregelnummerentrue
    \complexorsimpleempty\startregelnummeren}
 
@@ -235,7 +254,7 @@
       \setlinereference{\linereference}{\@@rnprefix#2}{0}{#1}%
       \advance\dimen0 by \linereference sp}%
    \prewordbreak
-   \vrule \!!width \!!zeropoint \!!depth \dimen0 \!!height \!!zeropoint
+   \vrule \!!width \zeropoint \!!depth \dimen0 \!!height \zeropoint
    \prewordbreak
    \egroup}
 
@@ -243,13 +262,13 @@
   {\endofshapebox
    \checkreferences
    \linestepper=0
-   \reshapebox{\global\advance\linestepper by 1\relax}%
-   \global\advance\linenumber by \linestepper
+   \reshapebox{\global\advance\linestepper 1\relax}%
+   \global\advance\linenumber \linestepper
    \doifelse{\@@rnrefereren}{\v!aan}
      {\reshapebox % We are going back!
         {\global\advance\linenumber by -1
          \dimen0=\dp\shapebox
-         \advance\dimen0 by -\dp\strutbox\relax
+         \advance\dimen0 -\dp\strutbox\relax
          \ifdim\dimen0>\zeropoint
            % 1=>4 | 2=>4 1=>2
            % start 1=>(n=y,l=2,p=1)
@@ -259,7 +278,7 @@
               \setlinereference\recurselevel
                 {\linereferencename}{\the\linenumber}{\linereferenceplus}}%
          \fi}%
-      \global\advance\linenumber by \linestepper
+      \global\advance\linenumber \linestepper
       \ifnum\linereference>0 % anders vreemde loop in paragraphs+recurse
         \dorecurse{\linereference}
           {\getlinereference\recurselevel
@@ -295,7 +314,7 @@
                      {\referenceprefix\linereferencename}{}{}{0}}% ==done
                  \fi}%
               \dimen0=\dp\shapebox
-              \advance\dimen0 by -\dp\strutbox\relax
+              \advance\dimen0 -\dp\strutbox\relax
               \ifdim\dimen0>\zeropoint
                 \dp\shapebox=\dp\strutbox
               \fi
@@ -303,17 +322,18 @@
       \else
         \reshapebox{\hbox{\schrijfregelnummer\box\shapebox}}% no \strut !
       \fi}
-     {\reshapebox{\global\advance\linenumber by -1}%
-      \global\advance\linenumber by \linestepper
+     {\reshapebox{\global\advance\linenumber -1}%
+      \global\advance\linenumber \linestepper
       \reshapebox{\hbox{\schrijfregelnummer\box\shapebox}}}% no \strut !
-   \global\advance\linenumber by \linestepper
+   \global\advance\linenumber \linestepper
    \flushshapebox
+   \the\aftereverylinenumbering
    \egroup}
 
-\def\crlf%
+\def\crlf
   {\ifhmode\unskip\else\strut\fi\ifcase\raggedstatus\hfil\fi\break}
 
-\def\opeenregel%
+\def\opeenregel
   {\def\crlf{\removelastspace\space}\let\\\crlf}
 
 \newcount\internalparagraphnumber
@@ -354,7 +374,7 @@
   [\c!conversie=\v!cijfers,
    \c!start=1,
    \c!stap=1,
-   \c!plaats=\v!inmarge,
+   \c!plaats=\v!marge,
    \c!letter=,
    \c!kleur=,
    \c!breedte=2em,
@@ -365,7 +385,7 @@
   [\c!status=\v!stop,
    \c!letter=,
    \c!kleur=,
-   \c!afstand=\ifregelnummersinmarge2em\else\!!zeropoint\fi] 
+   \c!afstand=\ifcase\linenumberlocation2em\else\!!zeropoint\fi] 
 
 \stelregelsin
   [\c!voor=\blanko,
diff --git a/tex/context/base/page-mar.tex b/tex/context/base/page-mar.tex
index 637a34baa..eff06688e 100644
--- a/tex/context/base/page-mar.tex
+++ b/tex/context/base/page-mar.tex
@@ -65,14 +65,16 @@
    \forgetall % added, else problems with 'center' and nested itemize
    \mindermeldingen
    \hsize#1\relax
-   \ifnum\margetekstnummer=0
-     \def\margetekstnummer{#2}%
-   \fi
-\doifnumberelse{\margetekstnummer}
-  {\ifnum\margetekstnummer>25 % to be translated 
-     \writestatus{\m!systems}{potential margin stack overflow (\margetekstnummer)}%
-   \fi}
-  {}%
+   \doifnumberelse\margetekstnummer
+     {\ifcase\margetekstnummer\relax
+        \def\margetekstnummer{#2}%
+      \fi}
+     {}%
+   \doifnumberelse\margetekstnummer
+     {\ifnum\margetekstnummer>25 % to be translated 
+       \writestatus{\m!systems}{potential margin stack overflow (\margetekstnummer)}%
+     \fi}
+     {}% 
    \processaction
      [\getvalue{\??im\margetekstnummer\c!uitlijnen}]
      [     \v!ja=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{#2},
@@ -224,6 +226,7 @@
 
 \def\dodoinmarge[#1][#2][#3][#4][#5]#6%
   {\ignorespaces
+   \bgroup\postponefootnotes % group is (somehow) needed
    \doifinsetelse{\v!laag}{#4}
      {\lowinmargintrue}
      {\lowinmarginfalse}%
@@ -239,6 +242,7 @@
                     #2{#6}%
                   \fi]%
    \rawpagereference{\s!mar}{#5}%
+   \flushfootnotes\egroup % don't forget the group 
    \ignorespaces}
 
 \def\inlinker%
diff --git a/tex/context/base/page-mul.tex b/tex/context/base/page-mul.tex
index 6ab5bebfd..cddde6727 100644
--- a/tex/context/base/page-mul.tex
+++ b/tex/context/base/page-mul.tex
@@ -256,21 +256,6 @@
 
 \def\OTRMULsomeherefloat{\OTRONEsomeherefloat}
 
-\def\getinsertionheights\to#1\\% \relax'm
-  {#1=\!!zeropoint
-   \def\doaddinsertionheight##1%
-     {\ifvoid##1\else
-        \advance#1 by 1\skip##1     
-        \advance#1 by \ht##1        
-       \fi}%
-   \doaddinsertionheight\topins
-   \doaddinsertionheight\botins
-   \ifcleverfootnotes
-     \doaddinsertionheight\savedfootins
-   \else
-     \doaddinsertionheight\footins
-   \fi}
-
 %D The local column width is available in the dimension
 %D register \type{\localcolumnwidth}, which is calculated as:
 
@@ -433,46 +418,20 @@
    \dosomebreak\allowbreak
    \restoresavedfloats}
 
-%D NEW: still to be documented!
-
-\newinsert\savedfootins
-
-\def\checkbegincolumnfootnotes%
-  {\ifcleverfootnotes
-     \doflushfootnotes
-     \ifdim\ht\footins>\zeropoint % hm, actually unknown 
-       \global\setbox\savedfootins=\box\footins
-     \else
-       \global\setbox\savedfootins=\box\voidb@x
-     \fi
-   \else
-     \global\setbox\savedfootins=\box\voidb@x
-   \fi
-   \global\skip\savedfootins=\skip\footins
-   \global\count\savedfootins=\count\footins
-   \setupfootnotes}
-
-\def\checkendcolumnfootnotes%
-  {\ifcleverfootnotes\ifvoid\savedfootins\else
-     \global\setbox\footins=\box\savedfootins
-   \fi\fi
-   \global\skip\footins=\skip\savedfootins
-   \global\count\footins=\count\savedfootins}
-
 %D Because some initializations happen three times, we
-%D defined a macro for them. The \type{\everypar{}} is
+%D defined a macro for them. Erasing \type{\everypar} is
 %D needed because we don't want anything to interfere.
 
-\def\setmulticolumnsout%
-  {\everypar{}%
+\def\setmulticolumnsout
+  {\everypar\emptytoks
    \dontcomplain
    \settopskip
    \setmaxdepth
-   \topskip=1\topskip
-   \splittopskip=\topskip
-   \splitmaxdepth=\maxdepth
-   \boxmaxdepth=\maxdepth % dangerous
-   \emergencystretch=\!!zeropoint\relax} % sometimes needed !
+   \topskip1\topskip
+   \splittopskip\topskip
+   \splitmaxdepth\maxdepth
+   \boxmaxdepth\maxdepth % dangerous
+   \emergencystretch\zeropoint\relax} % sometimes needed !
 
 %D Flushing the page comes to pasting the columns together and
 %D appending the result to box \type{\precolumnbox}, if not
@@ -689,49 +648,6 @@
 %D like for instance floats, that is already present in the
 %D boxes is preserved.
 
-% \def\splitcolumn#1from \box#2to \dimen#3 top \box#4%
-%   {\bgroup
-%    \ifdim\ht#4>\!!zeropoint
-%      \dimen0=\dimen#3\relax
-%      \dimen2=\dimen#3\relax
-%      \advance\dimen0 by -\ht#4
-%      \setbox0=\vsplit#2 to \dimen0
-%      \global\setbox#1=\vbox to \dimen2{\unvcopy#4\unvbox0}%
-%    \else
-%      \global\setbox#1=\vsplit#2 to \dimen#3
-%    \fi
-%    \egroup}
-
-% \def\splitcolumn#1from \box#2to \dimen#3 top \box#4%
-%   {\bgroup
-%    \ifdim\ht#4>\!!zeropoint
-%      \dimen0=\dimen#3\relax
-%      \dimen2=\dimen2
-%      \advance\dimen0 by -\ht#4%
-%      \columnfootnotecorrection{#1}{\dimen0}%
-%      \setbox0=\vsplit#2 to \dimen0
-%      \global\setbox#1=\vbox to \dimen2
-%        {\ifgridsnapping
-%           \dimen0=-\openstrutheight\advance\dimen0 by \topskip
-%           \vskip\dimen0\copy#4\vskip-\dimen0
-%         \else
-%           \unvcopy#4%
-%         \fi
-%         \unvbox0
-%         \fakecolumnfootnotes{#1}}%
-%    \else
-%      \ifcleverfootnotes
-%        \columnfootnotecorrection{#1}{\dimen#3}%
-%        \setbox0=\vsplit#2 to \dimen#3%
-%        \global\setbox#1=\vbox to \dimen#3%
-%          {\unvbox0
-%           \fakecolumnfootnotes{#1}}%
-%     \else
-%        \global\setbox#1=\vsplit#2 to \dimen#3%
-%      \fi
-%    \fi
-%    \egroup}
-
 \def\splitcolumn#1from \box#2to \dimen#3 top \box#4%
   {\bgroup
    \ifdim\ht#4>\zeropoint
@@ -782,10 +698,7 @@
   {\relax
    \ifcleverfootnotes
      \ifnum#1=\lastcolumnbox
-       \ifdim\ht\footins>\zeropoint
-         \vskip1\skip\footins % remove stretch and shrink 
-         \kern\ht\footins % a \vskip would be is discarded! 
-       \fi
+       \fakefootnotes
      \fi
    \fi}
 
@@ -793,34 +706,35 @@
   {\relax
    \ifcleverfootnotes
      \ifnum#1=\lastcolumnbox\relax
-       \ifdim\ht\footins>\zeropoint
-         \advance#2 by -\ht\footins
-         \advance#2 by -\skip\footins
-       \fi
+       \calculatefootnotevsize
+       \advance#2 -\footnotevsize
      \fi
    \fi}
 
 \def\overlaycolumnfootnotes%   VERVANGEN !!!
   {\relax
-   \ifcleverfootnotes\ifdim\ht\footins>\zeropoint
-     \bgroup
-     \scratchdimen=\ht\firstcolumnbox
-     \advance\scratchdimen by -\openstrutdepth % \dp\strutbox
-     \getnoflines\scratchdimen
-     \advance\noflines by -2
-     \scratchdimen=\noflines\lineheight
-     \advance\scratchdimen by \topskip
-     \setbox0=\hbox
-       {\lower\scratchdimen\vbox{\placefootnoteinserts}}%
-     \ht0=\openstrutheight % \ht\strutbox
-     \dp0=\openstrutdepth  % \dp\strutbox
-     \scratchdimen=\ht\lastcolumnbox
-     \global\setbox\lastcolumnbox=\vbox to \scratchdimen
-       {\box\lastcolumnbox
-        \vskip-\scratchdimen
-        \restoretextcolor{\box0}}%
-     \egroup
-   \fi\fi}
+   \ifcleverfootnotes
+     \checkfootnotepresence
+     \iffootnotespresent
+       \bgroup
+       \scratchdimen=\ht\firstcolumnbox
+       \advance\scratchdimen by -\openstrutdepth % \dp\strutbox
+       \getnoflines\scratchdimen
+       \advance\noflines by -2
+       \scratchdimen=\noflines\lineheight
+       \advance\scratchdimen by \topskip
+       \setbox0=\hbox
+         {\lower\scratchdimen\vbox{\placefootnoteinserts}}%
+       \ht0=\openstrutheight % \ht\strutbox
+       \dp0=\openstrutdepth  % \dp\strutbox
+       \scratchdimen=\ht\lastcolumnbox
+       \global\setbox\lastcolumnbox=\vbox to \scratchdimen
+         {\box\lastcolumnbox
+          \vskip-\scratchdimen
+          \restoretextcolor{\box0}}%
+       \egroup
+     \fi
+   \fi}
 
 %D Here comes the routine that splits the long box in columns.
 %D The macro \type{\flushcolumnfloats} can be used to flush
@@ -834,12 +748,9 @@
    \setmulticolumnsout
    \dontshowcomposition
    \dimen0=\columntextheight
-   \getinsertionheights\to\dimen2\\% toegevoegd ivm voetnoten
-   \advance\dimen2 by \precolumnboxheight
-   \dimen0=\columntextheight
    \advance\dimen0 by -\precolumnboxheight
-   \getinsertionheights\to\dimen2\\%
-   \advance\dimen0 by -\dimen2
+   \settotalinsertionheight
+   \advance\dimen0 by -\totalinsertionheight
    \ifgridsnapping % evt altijd, nog testen
      \getnoflines{\dimen0}
      \dimen0=\noflines\openlineheight
diff --git a/tex/context/base/page-not.tex b/tex/context/base/page-not.tex
new file mode 100644
index 000000000..e4883edc5
--- /dev/null
+++ b/tex/context/base/page-not.tex
@@ -0,0 +1,117 @@
+%D \module
+%D   [       file=page-not,
+%D        version=2002.4.16,
+%D          title=\CONTEXT\ Page Macros,
+%D       subtitle=Footnotes, 
+%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 Page Macros / Footnotes}
+
+%D Terrible hacks: we need to share save/restore 
+
+%D We've moved some footnote handling to a separate page 
+%D module. The macros below are used in the single and multi
+%D column page handlers and permit mixed usage of column and 
+%D page notes. 
+
+\unprotect 
+
+\installbackupinsertion\footins
+
+\def\checkbegincolumnfootnotes % should happen inside otr 
+  {\ifcleverfootnotes
+     \doflushfootnotes
+     \saveinsertionbox\footins
+   \else
+     \eraseinsertionbackup\footins
+   \fi
+   \saveinsertiondata\footins
+   \setupfootnotes}
+
+\def\checkendcolumnfootnotes
+  {\restoreinsertiondata\footins
+   \ifcleverfootnotes
+     \restoreinsertionbox\footins
+   \fi}
+
+\def\checksinglecolumnfootnotes
+  {\restoreinsertiondata\footins}
+
+\def\columnfootins % expands to an insert number 
+  {\ifcleverfootnotes
+     \backupinsertion\footins
+   \else
+     \footins
+   \fi}
+
+% wrong place 
+
+\newdimen\totalinsertionheight
+
+\def\settotalinsertionheight
+  {\totalinsertionheight\zeropoint
+   \doaddinsertionheight\topins       \to\totalinsertionheight
+   \doaddinsertionheight\botins       \to\totalinsertionheight
+   \doaddinsertionheight\columnfootins\to\totalinsertionheight}
+
+% also wrong place + wrong macro 
+
+\def\synchronizevsize
+  {\ifdim\ht\footins>\zeropoint % updates vsize 
+     \insert\footins{\unvbox\footins}%
+   \fi}
+
+% idem 
+
+\def\enablecolumnfootnotes
+  {\global\count\footins=1000
+   \global\skip\footins=1\baselineskip\relax}
+
+\def\disablecolumnfootnotes
+  {\global\count\footins=0
+   \global\skip\footins=\zeropoint}
+
+% also 
+
+\def\flushsavedcolumnfootnotes
+  {\insert\footins{\unvbox\OTRSETsavedfootnotes}}
+
+\def\savecolumnfootnotes
+  {\global\setbox\OTRSETsavedfootnotes=\vbox
+       {\unvbox\OTRSETsavedfootnotes\box\footins}}
+
+% hack 
+
+\def\savefootnotedimensions
+  {\edef\savedfootnotedimen{\the\dimen\footins}}
+
+\def\restorefootnotedimensions
+  {\dimen\footins\savedfootnotedimen}
+
+% hm 
+
+\installbackupinsertion\footins
+
+\def\checkbegincolumnfootnotes % should happen inside otr 
+  {\ifcleverfootnotes
+     \doflushfootnotes
+     \saveinsertionbox\footins
+   \else
+     \eraseinsertionbackup\footins
+   \fi
+   \saveinsertiondata\footins
+   \setupfootnotes}
+
+\def\checkendcolumnfootnotes
+  {\restoreinsertiondata\footins
+   \ifcleverfootnotes
+     \restoreinsertionbox\footins
+   \fi}
+ 
+\protect \endinput 
diff --git a/tex/context/base/page-num.tex b/tex/context/base/page-num.tex
index 815029aef..12785d030 100644
--- a/tex/context/base/page-num.tex
+++ b/tex/context/base/page-num.tex
@@ -298,17 +298,46 @@
 \def\stelpaginanummerin%
   {\dosingleargument\dostelpaginanummerin}
 
-\def\verlaagpaginanummer%
-  {\doifinset{\@@pnstatus}{\v!start,\v!leeg,\v!geen}
-     {\verlaagnummer[\s!page]%
-      \setuserpageno{\ruwenummer[\s!page]}}}
-
-\def\verhoogpaginanummer%
-  {\doifinset{\@@pnstatus}{\v!start,\v!leeg,\v!geen}
-     {\verhoognummer[\s!page]%
-      \setuserpageno{\ruwenummer[\s!page]}}%
-   \doifinset{\@@pnstatus}{\v!handhaaf,\v!leeg}
-     {\global\let\@@pnstatus\v!start}}
+% long time used alternative 
+%
+% \def\verlaagpaginanummer%
+%   {\doifinset{\@@pnstatus}{\v!start,\v!leeg,\v!geen}
+%      {\verlaagnummer[\s!page]%
+%       \setuserpageno{\ruwenummer[\s!page]}}}
+% 
+% \def\verhoogpaginanummer%
+%   {\doifinset{\@@pnstatus}{\v!start,\v!leeg,\v!geen}
+%      {\verhoognummer[\s!page]%
+%       \setuserpageno{\ruwenummer[\s!page]}}%
+%    \doifinset{\@@pnstatus}{\v!handhaaf,\v!leeg}
+%      {\global\let\@@pnstatus\v!start}}
+%
+% alternative, saves some 3 sec on 10K pages on a 1G machine
+% (needed during a test / prelude to installable methods)
+
+\def\dodecrementpagenumber
+  {\verlaagnummer[\s!page]\setuserpageno{\ruwenummer[\s!page]}}
+
+\def\doincrementpagenumber
+  {\verhoognummer[\s!page]\setuserpageno{\ruwenummer[\s!page]}}
+
+\def\dosynchronizepagenumber
+  {\global\let\@@pnstatus\v!start}
+
+\def\verlaagpaginanummer{\getvalue{\??pn-\@@pnstatus}}
+\def\verhoogpaginanummer{\getvalue{\??pn+\@@pnstatus}}
+
+\letvalue{\??pn-\v!start   }\dodecrementpagenumber
+\letvalue{\??pn-\v!geen    }\dodecrementpagenumber
+\letvalue{\??pn-\v!leeg    }\dodecrementpagenumber
+
+\letvalue{\??pn+\v!start   }\doincrementpagenumber
+\letvalue{\??pn+\v!geen    }\doincrementpagenumber
+\setvalue{\??pn+\v!leeg   }{\doincrementpagenumber
+                            \dosynchronizepagenumber}
+\letvalue{\??pn+\v!handhaaf}\dosynchronizepagenumber
+
+% so far 
 
 \def\checkpagecounter%
   {\checknummer{\s!page}}
@@ -525,11 +554,11 @@
        \donexttracklevel{##1}}%
     \donexttrackcommando{\firstsection}}
 
-\unexpanded\def\completepagenumber%  
+\unexpanded\def\completepagenumber  
   {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start} 
      {\@@nmlinks\labeltexts{\v!paginanummer}{\pageprefixes\pagenumber}\@@nmrechts}}
 
-\unexpanded\def\plaatspaginanummer%
+\unexpanded\def\placepagenumber
   {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start}
      {\labeltexts{\v!paginanummer}{\pagenumber}}}
 
diff --git a/tex/context/base/page-one.tex b/tex/context/base/page-one.tex
index 9d0286b16..308ccc99e 100644
--- a/tex/context/base/page-one.tex
+++ b/tex/context/base/page-one.tex
@@ -33,6 +33,7 @@
      \scratchdimen-\vsize
      \advance\scratchdimen \teksthoogte
      \global\advance\vsize \scratchdimen
+\relax
      \ifdim\pagegoal<\maxdimen
        \advance\scratchdimen \pagegoal
        \global\pagegoal\scratchdimen
@@ -64,10 +65,7 @@
         \kern\maxdepth
         \dobotinsertions
       \fi\fi\fi
-      \ifdim\ht\footins>\zeropoint % beter dan \ifvoid\footins\else
-        \kern\skip\footins
-        \kern\ht\footins
-      \fi}%
+      \fakefootnotes}%
    \ifbottomnotes
      \ifgridsnapping
        \getnoflines\teksthoogte
@@ -81,9 +79,7 @@
      \scratchdimen\zeropoint
    \fi
    \setbox2=\hbox
-     {\ifvoid\savedfootins \else
-        \setbox\footins\box\savedfootins
-      \fi
+     {\checksinglecolumnfootnotes
       \lower\scratchdimen\vbox{\placefootnotes}}%
    \smashbox2% % needed here 
    \ifbottomnotes
@@ -367,6 +363,10 @@
             \v!rechts=>\rightfloat{\box\floatbox},
           \v!inlinker=>\leftmarginfloat{\box\floatbox},
          \v!inrechter=>\rightmarginfloat{\box\floatbox},
+       \v!linkermarge=>\leftmarginfloat{\box\floatbox},
+      \v!rechtermarge=>\rightmarginfloat{\box\floatbox},
+        \v!linkerrand=>\leftedgefloat{\box\floatbox},
+       \v!rechterrand=>\rightedgefloat{\box\floatbox},
            \v!inmarge=>{\doinmargenormal\leftmarginfloat
                         \rightmarginfloat{\box\floatbox}}]%
      \doifinset{\v!lang}{#1}
diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex
index 7deece704..c48c94b19 100644
--- a/tex/context/base/page-set.tex
+++ b/tex/context/base/page-set.tex
@@ -451,9 +451,7 @@
        \dosynchronizeoutput
        \allowbreak % hm
      \fi
-     \ifdim\ht\footins>\zeropoint % updates vsize 
-       \insert\footins{\unvbox\footins}%
-     \fi
+     \synchronizevsize
    \fi}
 
 \def\OTRSETsethsize%
@@ -511,19 +509,17 @@
   {\ifvoid\OTRSETsavedfootnotes \else
      \iflastcolumnfootnotes
        \ifnum\nofcolumns=\mofcolumns 
-         \insert\footins{\unvbox\OTRSETsavedfootnotes}%
+         \flushsavedcolumnfootnotes
        \fi
      \else
-       \insert\footins{\unvbox\OTRSETsavedfootnotes}%
+       \flushsavedcolumnfootnotes
      \fi
    \fi}
 
 \def\OTRSETsavefootnotes
   {\iflastcolumnfootnotes
-     \ifnum\nofcolumns=\mofcolumns 
-     \else
-       \global\setbox\OTRSETsavedfootnotes=\vbox
-         {\unvbox\OTRSETsavedfootnotes\box\footins}%
+     \ifnum\nofcolumns=\mofcolumns \else
+       \savecolumnfootnotes
      \fi
    \fi}
 
@@ -865,12 +861,12 @@
      \ifnum\mofcolumns=\nofcolumns
        \def\qofcolumns{\mofcolumns}%
      \else
-       \scratchcounter=\mofcolumns 
+       \scratchcounter\mofcolumns 
        \advance\scratchcounter 1 
        \edef\qofcolumns{\the\scratchcounter}%
      \fi
    \else
-     \let\qofcolumns=\mofcolumns
+     \let\qofcolumns\mofcolumns
    \fi
    \enoughcolumncellsfalse
    \donefalse
@@ -900,10 +896,10 @@
      \OTRSETsetgridcells\currenthcell\currentvcell\columnhcells\columnvcells
        {\copy#9}%
      \ifnum\currenthcell=\mofcolumns\relax
-       \ifdim\ht\OTRSETsavedfootnotes>\zeropoint % \footins
+       \ifdim\ht\OTRSETsavedfootnotes>\zeropoint
          \OTRSETsetfreecells\mofcolumns\columnfirstcell
          \ifsomefreecolumncells
-           \getnoflines{\ht\OTRSETsavedfootnotes}% \footins
+           \getnoflines{\ht\OTRSETsavedfootnotes}% 
 \relax
            \ifnum\columnfreecells<\noflines
              \global\somefreecolumncellsfalse
@@ -1169,7 +1165,7 @@
   {\increment\columnsetlevel\relax
    \ifnum\columnsetlevel=1
      \OTRSETgetmanualbalance 
-     \edef\savedfootnotedimen{\the\dimen\footins}% ugly
+     \savefootnotedimensions
      \bgroup
      \def\currentcolumnset{#2}%
      \binnenkolommentrue % will be different flag 
@@ -1183,20 +1179,6 @@
      \bgroup 
    \fi}
 
-%\def\stopcolumnset%
-%  {\ifnum\columnsetlevel=1
-%     \par
-%     \OTRSETsetmanualbalance 
-%     \dostopcolumnset
-%     \egroup
-%     \global\footnotelimittrue
-%     \dimen\footins\savedfootnotedimen % ugly
-%     \ifsomefloatwaiting \setvsize \pagina \setvsize \fi
-%   \else
-%     \egroup
-%   \fi
-%   \decrement\columnsetlevel\relax}
-
 \def\stopcolumnset%
   {\relax
    \ifnum\columnsetlevel=1
@@ -1205,15 +1187,15 @@
      \dostopcolumnset
      \egroup
      \global\footnotelimittrue
-     \dimen\footins\savedfootnotedimen % ugly
-\setvsize
-\sethsize
-\ifvoid\OTRfinalpagebox\else
-  \dp\OTRfinalpagebox\zeropoint
-  \box\OTRfinalpagebox
-  \nobreak\vbox{\strut}\vskip-\lineheight
-\prevdepth\dp\strutbox  
-\fi
+     \restorefootnotedimensions
+     \setvsize
+     \sethsize
+     \ifvoid\OTRfinalpagebox\else
+       \dp\OTRfinalpagebox\zeropoint
+       \box\OTRfinalpagebox
+       \nobreak\vbox{\strut}\vskip-\lineheight
+     \prevdepth\dp\strutbox  
+     \fi
      \ifsomefloatwaiting \setvsize \pagina \setvsize \fi
    \else
      \egroup
@@ -1405,12 +1387,10 @@
    \fi}
 
 \def\OTRSETforceinserts%
-  {\global\count\footins=1000
-   \global\skip\footins=1\baselineskip\relax}%  plus 4\baselineskip\relax }
+  {\enablecolumnfootnotes}
 
 \def\OTRSETinhibitinserts%
-  {\global\count\footins=0
-   \global\skip\footins=\zeropoint}
+  {\disablecolumnfootnotes}
 
 % interface to footnotes
 
diff --git a/tex/context/base/page-sid.tex b/tex/context/base/page-sid.tex
index 13bfd6224..23a311f70 100644
--- a/tex/context/base/page-sid.tex
+++ b/tex/context/base/page-sid.tex
@@ -55,6 +55,7 @@
 
 \newif\ifrightfloat
 \newif\ifmarginfloat
+\newif\ifedgefloat
 \newif\ifroomforfloat
 \newif\iffloatshort
 \newif\iffloatflag
@@ -188,12 +189,16 @@
 \def\finalsidefloatoutput% new 
   {\finaloutput\unvbox\normalpagebox}
 
-\def\restoreleftindent%
+\def\restoreleftindent
   {\ifrightfloat \else
-     \parskip=\zeropoint
-     \noindent
-     \vadjust{\penalty-1}%
-     \hskip\sidefloatwidth
+     \parskip\zeropoint % here ? 
+     \ifdim\sidefloatwidth>\zeropoint % new, see prikkels 
+       \noindent
+       \vadjust{\penalty-1}%
+       \hskip\sidefloatwidth
+    %\else
+    %  we have a margin or edge float 
+     \fi
    \fi}
 
 \ifx\normaleqno\undefined
@@ -215,16 +220,22 @@
 \fi 
 
 \def\leftmarginfloat#1%
-  {\global\rightfloatfalse\marginfloattrue\putsidefloat{#1}}
+  {\global\rightfloatfalse\marginfloattrue\edgefloatfalse\putsidefloat{#1}}
 
 \def\rightmarginfloat#1%
-  {\global\rightfloattrue\marginfloattrue\putsidefloat{#1}}
+  {\global\rightfloattrue\marginfloattrue\edgefloatfalse\putsidefloat{#1}}
+
+\def\leftedgefloat#1%
+  {\global\rightfloatfalse\marginfloatfalse\edgefloattrue\putsidefloat{#1}}
+
+\def\rightedgefloat#1%
+  {\global\rightfloattrue\marginfloatfalse\edgefloattrue\putsidefloat{#1}}
 
 \def\leftfloat#1%
-  {\global\rightfloatfalse\marginfloatfalse\putsidefloat{#1}}
+  {\global\rightfloatfalse\edgefloatfalse\marginfloatfalse\putsidefloat{#1}}
 
 \def\rightfloat#1%
-  {\global\rightfloattrue\marginfloatfalse\putsidefloat{#1}}
+  {\global\rightfloattrue\marginfloatfalse\edgefloatfalse\putsidefloat{#1}}
 
 \def\putsidefloat#1% crap macro 
   {\par
@@ -235,7 +246,14 @@
    \previoussidefloat
    \stallsidefloat
    \setbox\floatbox=\hbox{\vbox % pretty ugly, will be rewritten
-     {\vskip\ifmarginfloat-\sidefloattopskip\else\sidefloattopoffset\fi#1}}
+     {\vskip
+        \ifmarginfloat
+          -\sidefloattopskip
+        \else\ifedgefloat
+          -\sidefloattopskip
+        \else
+          +\sidefloattopoffset
+        \fi\fi#1}}
    \measuresidefloat
    \ifroomforfloat 
    \else
@@ -245,7 +263,6 @@
    \fi
    \setsidefloat}
 
-
 \def\progresssidefloat%
   {\sidefloatprogress=\sidefloatvsize
    \iffloatflag
@@ -265,10 +282,12 @@
    \global\sidefloatpagetotal \pagetotal % global 
    \ifmarginfloat
      \global        \sidefloatwidth \zeropoint
+   \else\ifedgefloat
+     \global        \sidefloatwidth \zeropoint
    \else
      \global        \sidefloatwidth \wd\floatbox
      \global\advance\sidefloatwidth \floatsideskip
-   \fi
+   \fi\fi
    \global        \sidefloathsize  \hsize
    \global\advance\sidefloathsize -\sidefloatwidth
    \global        \sidefloatheight \ht\floatbox
@@ -310,17 +329,23 @@
      \ifmarginfloat
 %       \rlap{\hskip\rechtermargeafstand\hskip\rightskip\unhbox\floatbox}%
 \rlap{\tbox{\hskip\rechtermargeafstand\hskip\rightskip\unhbox\floatbox}}%
+     \else\ifedgefloat
+\rlap{\tbox{\hskip\rechtermargeafstand\hskip\rechtermargebreedte
+            \hskip\rechterrandafstand\hskip\rightskip\unhbox\floatbox}}%
      \else
        \unhbox\floatbox
-     \fi
+     \fi\fi
    \else
      \noindent
      \ifmarginfloat
 %       \llap{\unhbox\floatbox\hskip\leftskip\hskip\linkermargeafstand}%
 \llap{\tbox{\unhbox\floatbox\hskip\leftskip\hskip\linkermargeafstand}}%
+     \else\ifedgefloat
+\llap{\tbox{\unhbox\floatbox\hskip\leftskip\hskip\linkermargeafstand
+            \hskip\linkermargebreedte\hskip\linkerrandafstand}}%
      \else
        \unhbox\floatbox
-     \fi
+     \fi\fi
      \hfill
    \fi
    \egroup
diff --git a/tex/context/base/page-txt.tex b/tex/context/base/page-txt.tex
index 383c2a389..d578e85ea 100644
--- a/tex/context/base/page-txt.tex
+++ b/tex/context/base/page-txt.tex
@@ -270,15 +270,27 @@
 %     {\let\textlinestatus\s!unknown}%
 %   \getvalue{\string\placelayouttextline\textlinestatus}{#1}} % {#2}
 
+% recently bugged 
+%
+% \def\placelayouttextline#1% #2 
+%   {\settextlinestatus{#1}%
+%    \ifundefined{\string\placelayouttextline\textlinestatus}%
+%      \let\textlinestatus\s!unknown
+%    \fi
+%    \csname\string\placelayouttextline\textlinestatus\endcsname{#1}} % {#2}
+
 \def\placelayouttextline#1% #2 
   {\settextlinestatus{#1}%
-   \ifundefined{\string\placelayouttextline\textlinestatus}%
-     \let\textlinestatus\s!unknown
-   \fi
-   \csname\string\placelayouttextline\textlinestatus\endcsname{#1}} % {#2}
-
-\letvalue{\string\placelayouttextline\v!normaal}\doplacelayouttextline
-\letvalue{\string\placelayouttextline          }\doplacelayouttextline
+   \csname\string\placelayouttextline
+     \ifundefined{\string\placelayouttextline\textlinestatus}%
+       \s!unknown
+     \else
+       \textlinestatus 
+     \fi
+   \endcsname{#1}} % {#2}
+
+\setvalue{\string\placelayouttextline\v!normaal}{\doplacelayouttextline}
+\setvalue{\string\placelayouttextline          }{\doplacelayouttextline}
 \letvalue{\string\placelayouttextline\v!geen   }\gobbletwoarguments
 \letvalue{\string\placelayouttextline\v!hoog   }\gobbletwoarguments
 
@@ -395,6 +407,7 @@
       \swapmargins
       \vskip\hoofdhoogte
       \vskip\hoofdafstand
+      \vskip\layoutparameter\c!tekstafstand
       \hbox to \zetbreedte
         {\bgroup
            \swapmargins
diff --git a/tex/context/base/ppchtex.tex b/tex/context/base/ppchtex.tex
index 2b8729597..474c75c42 100644
--- a/tex/context/base/ppchtex.tex
+++ b/tex/context/base/ppchtex.tex
@@ -2091,9 +2091,13 @@
 % van de + en pijlen. De +, en dus ook de pijlen, worden omhoog
 % gehaald. Dit oogt m.i. fraaier.
 
+\def\chemicalinnerclip#1%
+  {{\setbox0=\hbox{#1}\ht0\ht\strutbox\dp0\dp\strutbox\box0}}
+
 \def\chemicalraise#1#2%
-  {{\setbox0=\hbox{$#1+$}%
-    \raise\dp0\hbox{$#1#2$}}}
+  {\chemicalinnerclip
+     {\setbox0=\hbox{$#1+$}%
+      \raise\dp0\hbox{$#1#2$}}}
 
 \def\chemicalinnersign#1% todo: \@@chemicaltextcolor 
   {\chemicalraise{\@@localchemicalstyle}{#1}}
@@ -2105,13 +2109,14 @@
   {\chemicalraise{\@@localchemicalstyle}{\longrightarrow}}
 
 \def\chemicaldoubleinnerarrow#1#2% todo: \@@chemicaltextcolor 
-  {\lower.2ex\hbox
-     {\setbox0=\hbox{$\@@localchemicalstyle\longrightarrow$}%
-      \setbox2=\hbox{$\@@localchemicalstyle\longleftarrow$}%
-      \wd0=0pt\raise\ht0\box0\box2}}
+  {\chemicalinnerclip
+     {\lower.2ex\hbox
+        {\setbox0=\hbox{$\@@localchemicalstyle\longrightarrow$}%
+         \setbox2=\hbox{$\@@localchemicalstyle\longleftarrow$}%
+         \wd0=0pt\raise\ht0\box0\box2}}}
 
 \def\chemicaltwintipinnerarrow#1#2% todo: \@@chemicaltextcolor 
-  {\hbox
+  {\chemicalinnerclip
      {\setbox0=\hbox{\chemicalraise{\@@localchemicalstyle}{\longrightarrow}}%
       \setbox2=\hbox{\chemicalraise{\@@localchemicalstyle}{\longleftarrow}}%
       \wd0=0pt\box0\box2}}
@@ -2150,11 +2155,10 @@
 
 \def\chemicalinnermolecule#1#2#3% no mathop here, can generate space
   {\chemicalspace               % todo: \@@chemicaltextcolor
-   \bgroup
-   \dosetsubscripts
-   \hbox{$\@@dochemicalstyle{\@@localchemicalstyle\strut#1}$}%
-   \doresetsubscripts
-   \egroup
+   \chemicalinnerclip
+     {\dosetsubscripts
+      $\@@dochemicalstyle{\@@localchemicalstyle\strut#1}$%
+      \doresetsubscripts}%
    \chemicalspace}
 
 \def\chemicaloutermolecule#1#2#3%
diff --git a/tex/context/base/s-abr-01.tex b/tex/context/base/s-abr-01.tex
index b6bb47f81..aec65a385 100644
--- a/tex/context/base/s-abr-01.tex
+++ b/tex/context/base/s-abr-01.tex
@@ -39,6 +39,7 @@
 \logo [DISTILLER]  {distiller}
 \logo [DTD]        {dtd}
 \logo [DTK]        {dtk}
+\logo [DTP]        {dtp}
 \logo [DVIPSONE]   {dvipsone}
 \logo [DVIPS]      {dvips}
 \logo [DVISCR]     {dviscr}
diff --git a/tex/context/base/setupa.tex b/tex/context/base/setupa.tex
index 220e3ba38..14815cb04 100644
--- a/tex/context/base/setupa.tex
+++ b/tex/context/base/setupa.tex
@@ -108,27 +108,27 @@ sectionnumber:  sekcecislo % ?
 \stopmessages
 
 \startmessages  italian library: setup
-        title:  setup
+        title:  impostazioni
       formula:  formula
-       number:  number
-         list:  list
-    dimension:  dimension
-         mark:  mark
-    reference:  reference
-      command:  command
+       number:  numero
+         list:  elenco
+    dimension:  dimensione
+         mark:  marcatura
+    reference:  riferimento
+      command:  comando
          file:  file
-         name:  name
-         text:  text
-      section:  section
-sectionnumber:  sectionnumber
-     singular:  singular name
-       plural:  plural name
+         name:  nome
+         text:  testo
+      section:  sezione
+sectionnumber:  numero sezione
+     singular:  nome singolare
+       plural:  nome plurale
        matrix:  n*m
-          see:  see
-            1:  the characters < and > are globally active!
-            2:  -- is processed
-            3:  -- is undefined
-            4:  -- is processed again
+          see:  vedi
+            1:  caratteri < e > attivi globalmente!
+            2:  -- elaborato
+            3:  -- non definito
+            4:  -- elaborato di nuovo
 \stopmessages
 
 \startmessages  romanian library: setup
diff --git a/tex/context/base/setupb.tex b/tex/context/base/setupb.tex
index 79a63d122..92c3f260a 100644
--- a/tex/context/base/setupb.tex
+++ b/tex/context/base/setupb.tex
@@ -2099,7 +2099,7 @@
 \stopsetup
 
 \startsetup
-  \command[\y!toonstruts]
+  \command[\y!showstruts]
   \type[]
 \stopsetup
 
@@ -3269,6 +3269,10 @@
     [\c!snijwit]
     [\c!number!]
     []
+  \variable 
+    [\c!tekstafstand]
+    [\c!number!]
+    []
 \stopsetup
 
 \startsetup
@@ -3310,11 +3314,11 @@
   \command
     [\y!verplaatsopgrid]
   \type
-    [\c!opt!\c!val!]
+    [\c!opt!\c!vals!]
   \value
     [\v!boven,\v!beide,\v!onder,-\v!boven,-\v!beide,-\v!onder,
-     \v!hoog,\v!midden,\v!laag,\v!pagina,\v!standaard,\v!geen,
-     \v!ruim,\v!passend]
+     \v!hoog,\v!midden,\v!laag,\v!pagina,\v!geen,\v!standaard,
+     \v!ruim,\v!passend,\v!diepte,\v!regel,\c!dimension!]
     [\v!standaard]
 \stopsetup
 
@@ -4901,6 +4905,10 @@
     [\c!uitlijnen]
     [\v!links,\v!rechts,\v!normaal,\v!ruim]
     [\v!normaal]
+  \variable
+    [\c!titeluitlijnen]
+    [\v!ja,\v!nee]
+    [\v!nee]
   \variable
     [\c!tolerantie]
     [\v!zeerstreng,\v!streng,\v!soepel,\v!zeersoepel,\v!rek]
@@ -5641,8 +5649,8 @@
     [\c!number!]
     []
   \value
-    [\v!dag,\v!maand,\v!weekdag,\v!jaar, % \v!WEEKDAG,\v!MAAND, 
-     dd,mm,jj,yy,d,m,j,y,\v!kenmerk]
+    [\v!dag,\v!dag+,\v!maand,\v!weekdag,\v!jaar, % \v!WEEKDAG,\v!MAAND, 
+     dd,dd+,mm,jj,yy,d,d+,m,j,y,\v!kenmerk]
     [\v!dag,\v!maand,\v!jaar]
 \stopsetup
 
@@ -6210,10 +6218,26 @@
     [\c!breedte]
     [\c!dimension!]
     []
+  \variable
+    [\c!maxhoogte]
+    [\c!dimension!]
+    []
+  \variable
+    [\c!maxbreedte]
+    [\c!dimension!]
+    []
+  \variable
+    [\c!default]
+    [\c!identifier!]
+    []
   \variable
     [\c!paginaovergangen]
     [\c!list!]
     []
+  \variable
+    [\c!plaats]
+    [\v!links,\v!midden,\v!rechts]
+    [\v!midden]
   \inheritvariables
     [\y!setupframed]
     []
@@ -8161,11 +8185,13 @@
     [\v!ja]
   \variable
     [\c!symbool]
-    [\v!normaal,\v!New,\v!Balloon,\v!Addition,\v!Help,\v!Paragraph,\v!Key]
+    [\v!normaal,
+     \v!New,\v!Balloon,\v!Addition,\v!Help,\v!Paragraph,\v!Key,
+     \c!identifier!]
     [\v!normaal]
   \variable
     [\c!optie]
-    [\v!max]
+    [\v!max,\v!buffer]
     []
 \stopsetup
 
diff --git a/tex/context/base/spec-def.tex b/tex/context/base/spec-def.tex
index 09c7f27ff..de0bb9c2f 100644
--- a/tex/context/base/spec-def.tex
+++ b/tex/context/base/spec-def.tex
@@ -338,12 +338,12 @@
 %D We can declare some characteristics of the document with
 %D
 %D \starttypen 
-%D \dosetupidentity {title} {subject} {author} {creator} {date} 
+%D \dosetupidentity {title} {subject} {author} {creator} {date} {keys}
 %D \stoptypen
 %D
 %D All data is in string format. 
 
-\installspecial [\dosetupidentity] [and] [5]
+\installspecial [\dosetupidentity] [and] [6]
 
 %D \macros
 %D   {dosetuppaper}
@@ -816,17 +816,24 @@
 \installspecial [\doregistercalculationset] [or] [1]
 
 %D \macros 
-%D   {doinsertcomment}
+%D   {doinsertcomment, doflushcomments}
 %D
 %D Not so much out of need, but to be complete, we also 
 %D implement text annotations, so called  comment:
 %D 
 %D \starttypen
 %D \doinsertcomment
-%D   {title} {width} {height} {color} {open} {symbol} {data} 
+%D   {title} {width} {height} {color} {open} {symbol} {collect} {data} 
+%D \stoptypen
+%D
+%D When enables, comments can be collected and flushed: 
+%D
+%D \starttypen
+%D \doflushcomments
 %D \stoptypen
 
-\installspecial[\doinsertcomment] [and] [7]
+\installspecial[\doinsertcomment] [and] [8]
+\installspecial[\doflushcomments] [and] [0]
 
 %D \macros
 %D   {dosetposition, dosetpositionwhd, dosetpositionplus, 
diff --git a/tex/context/base/spec-dpm.tex b/tex/context/base/spec-dpm.tex
index e5d06f3b7..44e6e87a5 100644
--- a/tex/context/base/spec-dpm.tex
+++ b/tex/context/base/spec-dpm.tex
@@ -185,13 +185,14 @@
 %D \macros
 %D   {dosetupidentity}
 
-\definespecial\dosetupidentity#1#2#3#4#5%
+\definespecial\dosetupidentity#1#2#3#4#5#6%
   {\bgroup
    \enablePDFdocencoding
    \special
      {pdf: docinfo
         <</Title (#1) /Subject (#2) /Author (#3)
-          /Creator (#4) /Producer (dvipdfm)>>}%
+          /Creator (#4) /ModificationDate (#5)
+          /Keywords (#6) /Producer (dvipdfm)>>}%
    \egroup}
 
 %D \macros
@@ -256,9 +257,10 @@
 \definespecial\dosetpagetransition{\doPDFsetpagetransition}
 
 %D \macros
-%D   {doinsertcomment}
+%D   {doinsertcomment, doflushcomments}
 
 \definespecial\doinsertcomment{\doPDFinsertcomment}
+\definespecial\doflushcomments{\doPDFflushcomments}
 
 %D \macros
 %D   {dopresetlinefield,dopresettextfield,
diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex
index 584ac71bb..d67f94cad 100644
--- a/tex/context/base/spec-fdf.tex
+++ b/tex/context/base/spec-fdf.tex
@@ -292,17 +292,22 @@
 %   \PointsToBigPoints\!!heighta\bottom
 %   \PointsToBigPoints\!!widtha \width
 %   \PointsToBigPoints\!!heightb\height
-   \xdef\currentPDFcropbox% \doPDFpagesattribute
+   \xdef\currentPDFcropbox 
      {/CropBox [\left\space\bottom\space\width\space\height]}%
-   \xdef\currentPDFpagemode% \doPDFaddtocatalog  
-     {/PageMode \ifcase#6 /UseNone\or/FullScreen\or/UseOutlines\fi}%
+   \xdef\currentPDFpagemode
+     {/PageMode \ifcase#6 /UseNone\or/FullScreen\or/UseOutlines\else/UseNone\fi}%
+%   \xdef\currentPDFviewerprefs 
+%     {\ifcase#6\or\or\or /ViewerPreferences << /FitWindow true >>\fi}%
    \egroup}
 
-\global\let\currentPDFcropbox \empty
-\global\let\currentPDFpagemode\empty
+\global\let\currentPDFcropbox    \empty % page attributes 
+\global\let\currentPDFpagemode   \empty % document catalog
+\global\let\currentPDFviewerprefs\empty % document catalog
 
 \appendtoksonce % hack to prevent duplicates
-  \ifcase\realfolio\or\doPDFaddtocatalog{\currentPDFpagemode}\fi
+  \ifcase\realfolio\or
+    \doPDFaddtocatalog{\currentPDFpagemode\currentPDFviewerprefs}%
+  \fi
 \to \everyshipout
 
 \appendtoksonce
@@ -1187,6 +1192,8 @@
 \def\PDFpageviewwrd{ /Fit}
 \def\PDFpageview   {/View [\PDFpageviewwrd] }
 
+\def\PDFpagexyzspec{ 0 0 0} % hack, pdftex does handle this
+
 \def\dosetuppageview#1%
   {\processaction
      [#1]
@@ -1196,8 +1203,8 @@
                   \def\PDFpageviewwrd{ /FitH},   % swapping here
        \v!hoogte=>\def\PDFpageviewkey{  fitv}%   % and here and
                   \def\PDFpageviewwrd{ /FitV},   % here too
-%   \v!standaard=>\def\PDFpageviewkey{  xyz 0 0 0}%
-%                 \def\PDFpageviewwrd{ /XYZ 0 0 0}, 
+    \v!standaard=>\def\PDFpageviewkey{   xyz\PDFpagexyzspec}%
+                  \def\PDFpageviewwrd{  /XYZ\PDFpagexyzspec}, 
       \s!unknown=>\def\PDFpageviewkey{   fit}%
                   \def\PDFpageviewwrd{  /Fit}]%
    \edef\PDFpageview{/View [\PDFpageviewwrd]}}
@@ -1830,8 +1837,8 @@
 \def\PDFcommentParagraph {/Paragraph} 
 \def\PDFcommentKey       {/Key } 
 
-\long\def\doPDFinsertcomment#1#2#3#4#5#6#7% title width height color open data 
-  {\bgroup
+\long\def\doPDFinsertcomment#1#2#3#4#5#6#7#8% 
+  {\bgroup % title width height color open symbol collect data 
    \doifelsenothing{#1} 
      {\let\PDFidentifier\empty}
      {\def\PDFidentifier{/T (#1)}}%
@@ -1841,7 +1848,7 @@
    \doifundefinedelse{PDFcomment#6} 
      {\let\PDFcomment\empty}
      {\def\PDFcomment{/Name \getvalue{PDFcomment#6} }}%
-   \sanitizePDFdocencoding#7\to\PDFdata
+   \sanitizePDFdocencoding#8\to\PDFdata
    \setbox\scratchbox=\vbox to #3
      {\vfill
       \doPDFannotation width #2 height #3 data 
@@ -1857,6 +1864,112 @@
    \box\scratchbox
    \egroup}
 
+\startmode[atpragma]
+
+% todo: scale annot relative to paper width to get 
+%       dimensions honored  
+
+\newcounter\nofFDFcomments
+
+\newif\ifPDFpopupcomments   \PDFpopupcommentstrue
+
+\newbox\PDFcommentbox
+
+\def\doPDFflushcomments 
+  {\box\PDFcommentbox}
+
+\long\def\doPDFinsertcomment#1#2#3#4#5#6#7#8% 
+  {\bgroup % title width height color open symbol collect data
+   \doifelsenothing{#1}
+     {\let\PDFidentifier\empty}
+     {\def\PDFidentifier{/T (#1)}}%
+   \doifelsenothing{#4}
+     {\let\PDFattributes\empty}
+     {\def\PDFattributes{/C \FDFcolor{#4}}}%
+   \def\width {18pt}%
+   \def\height{24pt}%
+   \doifundefinedelse{PDFcomment#6}
+     {\doifelsenothing{#6}
+        {\let\PDFcomment\empty}
+        {\presetPDFcommentappearance{#6}}}
+     {\def\PDFcomment{/Name \getvalue{PDFcomment#6} }}%
+   \sanitizePDFdocencoding#8\to\PDFdata
+   \setbox\scratchbox=\vbox to #3
+     {\vfill
+      \ifPDFpopupcomments
+        \doglobal\increment\nofFDFcomments
+        \doifobjectreferencefoundelse{FDF}{c:\nofFDFcomments}
+          {\doPDFgetobjectreference{FDF}{c:\nofFDFcomments}\PDFobjectreference
+           \donetrue}
+          {\donefalse}%
+        \ifdone
+          \setbox\scratchbox\hbox
+            {\doPDFannotation width #2 height #3 data % text window 
+               {/Subtype /Popup
+                /Parent \PDFobjectreference}}%
+          \ifcase#7\relax 
+            \vbox to \height{\forgetall\vskip#3\box\scratchbox\vss}%
+          \else % incredible trial and error hack
+            \global\setbox\PDFcommentbox\vbox
+              {\hsize#2%
+               \forgetall
+               \vsmash{\box\PDFcommentbox}
+               \box\scratchbox}%
+          \fi
+        \fi
+        \doPDFannotationobject class FDF name {c:\nofFDFcomments} 
+            width {\width} height {\height} data  
+          {/Subtype /Text
+           \ifcase#5 \else/Open true\fi 
+           \ifdone /Popup \the\pdflastannot\space 0 R\fi
+           /Contents (\PDFdata)
+           \PDFcomment
+           \PDFidentifier
+           \PDFattributes}%
+        \vskip#3%
+        \vskip-\height
+      \else
+        \doPDFannotation width #2 height #3 data
+          {/Subtype /Text
+           \ifcase#5 \else/Open true\fi 
+           /Contents (\PDFdata)
+           \PDFcomment
+           \PDFidentifier
+           \PDFattributes}%
+      \fi}%
+   \wd\scratchbox\zeropoint
+   \ht\scratchbox\zeropoint
+   \dp\scratchbox\zeropoint
+   \box\scratchbox
+   \egroup}
+
+\def\presetPDFcommentappearance#1%
+  {\getfromcommacommand[#1][1]\let\PDFcommentnormalsymbol\commalistelement
+   \getfromcommacommand[#1][2]\let\PDFcommentdownsymbol  \commalistelement
+   \doifsymboldefinedelse\PDFcommentnormalsymbol
+     {\doifsymboldefinedelse\PDFcommentdownsymbol
+        {\dopresetPDFcommentappearance
+           \PDFcommentnormalsymbol\PDFcommentdownsymbol}
+        {\dopresetPDFcommentappearance
+           \PDFcommentnormalsymbol\PDFcommentnormalsymbol}}
+     {\doifsymboldefinedelse\PDFcommentdownsymbol
+        {\dopresetPDFcommentappearance
+           \PDFcommentdownsymbol\PDFcommentdownsymbol}
+        {\let\PDFcomment\empty}}}
+
+\def\dopresetPDFcommentappearance#1#2%
+  {\dopresetfieldsymbol{#1}%
+   \dopresetfieldsymbol{#2}%
+   \setbox\scratchbox=\hbox{\symbol[#1]}%
+   \edef\width {\the\wd\scratchbox}%
+   \edef\height{\the\ht\scratchbox}%
+   \doPDFgetobjectreference{SYM}{#1}\FDFcommentNappearance
+   \doPDFgetobjectreference{SYM}{#2}\FDFcommentDappearance
+   \edef\PDFcomment
+     {/AP <</N \FDFcommentNappearance /D \FDFcommentDappearance>>}}
+
+\stopmode
+
 %D Hooked into \CONTEXT, this special supports
 %D
 %D \starttypen
diff --git a/tex/context/base/spec-pdf.tex b/tex/context/base/spec-pdf.tex
index 6c8215c1f..49adc7d51 100644
--- a/tex/context/base/spec-pdf.tex
+++ b/tex/context/base/spec-pdf.tex
@@ -142,7 +142,7 @@
 
 \definespecial\dosetupscreen{\doPDFsetupscreen\printpapierhoogte}
 
-\definespecial\dosetupidentity#1#2#3#4#5%
+\definespecial\dosetupidentity#1#2#3#4#5#6%
   {\bgroup
    \enablePDFdocencoding
    \special
@@ -152,6 +152,7 @@
           /Author (#3)
           /Creator (#4)
           /ModificationDate (#5)
+          /Keywords (#6)
           /DOCINFO
         pdfmark}%
    \egroup}
@@ -257,12 +258,13 @@
 \definespecial\dosetpagetransition{\doPDFsetpagetransition}
 
 %D \macros 
-%D   {doinsertcomment}
+%D   {doinsertcomment, doflushcomments}
 %D
 %D I never needed (and used) one until now, but here is the 
 %D text annotation special:
 
 \definespecial\doinsertcomment{\doPDFinsertcomment}
+\definespecial\doflushcomments{\doPDFflushcomments}
 
 %D \macros
 %D   {dopresetlinefield,dopresettextfield,
diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex
index 438519981..dcc46ac56 100644
--- a/tex/context/base/spec-tpd.tex
+++ b/tex/context/base/spec-tpd.tex
@@ -11,6 +11,21 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
+% \let\PDFdestvoffset\zeropoint
+% \newbox\pdfdestbox
+% 
+% \def\doPDFdestination name #1%
+%   {\ifdim\PDFdestvoffset=\zeropoint\relax
+%      \pdfdest name {#1}\PDFpageviewkey
+%    \else
+%      \setbox\pdfdestbox\hbox to \zeropoint
+%        {\raise\PDFdestvoffset\hbox{\pdfdest name {#1}\PDFpageviewkey}}%
+%      \ht\pdfdestbox\zeropoint
+%      \box\pdfdestbox
+%    \fi}
+% 
+% \def\PDFdestvoffset{2\lineheight} % {1.5\ht\strutbox}
+
 %D \macros
 %D   {jobsuffix}
 %D
@@ -528,6 +543,8 @@
 \definespecial\dostartgotorealpage{\doPDFstartgotorealpage}
 \definespecial\dostartgotoJS      {\doPDFstartgotoJS}
 
+\let\PDFpagexyzspec\empty % hack, pdftex does not accept spec
+
 %D \macros
 %D   {doflushJSpreamble}
 %D
@@ -590,7 +607,7 @@
 %D etc. For the moment \PDFTEX\ only supports the first three
 %D of these.
 
-\definespecial\dosetupidentity#1#2#3#4#5%
+\definespecial\dosetupidentity#1#2#3#4#5#6%
   {\bgroup
    \enablePDFdocencoding
    \pdfinfo
@@ -598,7 +615,9 @@
       /Title (#1)
       /Subject (#2)
       /Author (#3)
-      /Creator (#4)}%
+      /Creator (#4)
+      /ModificationDate (#5) 
+      /Keywords (#6)}%
    \egroup}
 
 %D \macros
@@ -689,7 +708,13 @@
      \def\dodostopobject%
        {\egroup
         \ifx\PDFimagereference\empty
-          \immediate\pdfxform resources {\currentPDFresources}\nextbox
+          % We also flush page resources, since shared 
+          % resources end up there; otherwise transparencies 
+          % won't work in xforms; some day I will optimize 
+          % this. 
+          \immediate\pdfxform 
+            resources {\currentPDFresources\the\pdfpageresources}%
+            \nextbox
           \global\let\currentPDFresources\empty
           \dosetobjectreference{#1}{#2}{\the\pdflastxform}%
         \else
@@ -755,11 +780,12 @@
 %D box.
 
 %D \macros
-%D   {doinsertcomment}
+%D   {doinsertcomment, doflushcomments}
 %D
 %D Text annotation, or comments, are provided too:
 
 \definespecial\doinsertcomment{\doPDFinsertcomment}
+\definespecial\doflushcomments{\doPDFflushcomments}
 
 %D \macros
 %D   {dopresetlinefield,dopresettextfield,
diff --git a/tex/context/base/supp-box.tex b/tex/context/base/supp-box.tex
index 9d7b19de3..59afe1fb6 100644
--- a/tex/context/base/supp-box.tex
+++ b/tex/context/base/supp-box.tex
@@ -155,7 +155,7 @@
 \def\vsmash  {\dosomesmash\vsmashbox\normalvbox}
 \def\hsmashed{\dosomesmash\smashbox \normalhbox}
 \def\vsmashed{\dosomesmash\smashbox \normalvbox}
-
+
 %D \macros 
 %D   {smash}
 %D
@@ -2235,6 +2235,20 @@
 \def\removelastskip% \ifvmode the plain tex one \fi
   {\ifvmode\ifdim\lastskip=\z@\else\vskip-\lastskip\fi\fi}
 
+%D \macros
+%D   {makestrutofbox}
+%D 
+%D This macro sets the dimensions of a box to those of a 
+%D strut. 
+
+\def\domakestrutofbox
+  {\ht\registercount\ht\strutbox
+   \dp\registercount\dp\strutbox
+   \wd\registercount\zeropoint}
+
+\def\makestrutofbox
+  {\afterassignment\domakestrutofbox\registercount}
+
 %D \macros
 %D   {raisebox,lowerbox}
 %D
diff --git a/tex/context/base/supp-fil.tex b/tex/context/base/supp-fil.tex
index 43449ef93..14cbd7684 100644
--- a/tex/context/base/supp-fil.tex
+++ b/tex/context/base/supp-fil.tex
@@ -172,6 +172,17 @@
 
 \egroup
 
+%D NEW:
+
+\chardef\kindoffile=0 % 0=normal 1=http
+
+\def\checkfilename#1%
+  {\ifinstringelse{http://}{#1}%
+     \chardef\kindoffile1
+   \else
+     \chardef\kindoffile0
+   \fi}
+
 %D \macros
 %D   {readfile,ReadFile,maxreadlevel,
 %D    normalinput}
@@ -240,17 +251,22 @@
 
 \def\doreadfile#1#2#3%
   {\sanitizefilename#1\to\readfilename
-   \immediate\openin\scratchread=\readfilename\relax
-   \ifeof\scratchread
-     \immediate\closein\scratchread
-     \decrement\readlevel\relax
-     \ifnum\readlevel>0
-       \def\next{\doreadfile{\pathplusfile{\f!parentpath}{#1}}{#2}{#3}}%
+   \checkfilename\readfilename
+   \ifcase\kindoffile
+     \immediate\openin\scratchread=\readfilename\relax
+     \ifeof\scratchread
+       \immediate\closein\scratchread
+       \decrement\readlevel\relax
+       \ifnum\readlevel>0
+         \def\next{\doreadfile{\pathplusfile{\f!parentpath}{#1}}{#2}{#3}}%
+       \else
+         \def\next{#3}%
+       \fi
      \else
-       \def\next{#3}%
+       \def\next{\immediate\closein\scratchread#2\dodoreadfile}%
      \fi
    \else
-     \def\next{\immediate\closein\scratchread#2\dodoreadfile}%
+     \def\next{#2\dodoreadfile}%
    \fi
    \next}               
 
@@ -266,7 +282,6 @@
 \def\ReadFile#1%
   {\readfile{#1}\donothing\donothing}
 
-
 %D \macros
 %D   {readjobfile,readlocfile,readsysfile,
 %D    readfixfile,readsetfile}
@@ -338,13 +353,17 @@
 %D in the normal way by \type{\closein}.
 
 \def\doopenin#1#2%
-  {\increment\readlevel
-   \immediate\openin#1=#2\relax
-   \ifeof#1\relax
-     \ifnum\readlevel>\maxreadlevel\relax
-     \else
-       \immediate\closein#1\relax
-       \doopenin{#1}{\pathplusfile{\f!parentpath}{#2}}%
+  {\sanitizefilename#2\to\readfilename
+   \checkfilename\readfilename
+   \ifcase\kindoffile
+     \increment\readlevel
+     \immediate\openin#1=\readfilename\relax
+     \ifeof#1\relax
+       \ifnum\readlevel>\maxreadlevel\relax
+       \else
+         \immediate\closein#1\relax
+         \doopenin{#1}{\pathplusfile{\f!parentpath}{#2}}%
+       \fi
      \fi
    \fi}
 
@@ -382,28 +401,29 @@
 %D \doiflocfileelse {filename} {before loading} {not found}
 %D \stoptypen
 
-%\def\doiffileelse#1#2#3%
-%  {\immediate\openin\scratchread=#1\relax
-%   \ifeof\scratchread
-%     \def\next{#3}%
-%   \else
-%     \def\next{#2}%
-%   \fi
-%   \immediate\closein\scratchread
-%   \next}
-
-\def\doiffileelse#1%
+\def\doiffileelse#1#2#3%
   {\immediate\openin\scratchread=#1\relax
    \ifeof\scratchread
-     \immediate\closein\scratchread
-     \expandafter\secondoftwoarguments
+     \def\next{#3}%
    \else
-     \immediate\closein\scratchread
-     \expandafter\firstoftwoarguments
-   \fi}
+     \def\next{#2}%
+   \fi
+   \immediate\closein\scratchread
+   \next}
+
+% \def\doiflocfileelse#1%
+%   {\doiffileelse{\pathplusfile{\f!currentpath}{#1}}}
 
 \def\doiflocfileelse#1%
-  {\doiffileelse{\pathplusfile{\f!currentpath}{#1}}}
+  {\makelocreadfilename{#1}%
+   \doiffileelse\readfilename}
+
+\def\makelocreadfilename#1%
+  {\sanitizefilename#1\to\readfilename
+   \checkfilename\readfilename
+   \ifcase\kindoffile
+     \edef\locreadfilename{\pathplusfile{\f!currentpath}{#1}}%
+   \fi}
 
 %D \macros
 %D   {doonlyonce, doinputonce, doendinputonce}
@@ -473,7 +493,7 @@
 %        {\catcode`"=\the\catcode`"\relax
 %         \catcode`<=\the\catcode`<\relax
 %         \catcode`>=\the\catcode`>\relax}%
-%      \catcode`"=\@@other
+%      \catcode`"=\@@letter
 %      \catcode`<=\@@other
 %      \catcode`>=\@@other
 %      \let\stopreadingfile=\dostopreadingfile
@@ -486,9 +506,10 @@
 %    \fi
 %    \decrement\readingfilelevel}
 
-\def\normalless {<} % geen \let ! 
-\def\normalmore {>} % geen \let ! 
-\def\normalequal{=} % geen \let ! 
+\def\normalless    {<} % geen \let ! 
+\def\normalmore    {>} % geen \let ! 
+\def\normalequal   {=} % geen \let ! 
+\def\normaldblquote{"} % geen \let ! 
 
 \newcounter\readingfilelevel
 
@@ -583,7 +604,7 @@
 %% 
 %% \def\setspecialcatcodes%
 %%   {\catcode`/=\@@other
-%%    \catcode`"=\@@letter
+%%    \catcode`"=\@@other
 %%    \catcode`<=\@@other
 %%    \catcode`>=\@@other}
 
diff --git a/tex/context/base/supp-lan.tex b/tex/context/base/supp-lan.tex
index 50aec294b..07f904b38 100644
--- a/tex/context/base/supp-lan.tex
+++ b/tex/context/base/supp-lan.tex
@@ -8,11 +8,11 @@
 %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. 
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
 
-%D This module needs a drastic update: can be made simplier 
-%D and faster. 
+%D This module needs a drastic update: can be made simplier
+%D and faster; code can move to core module. 
 
 %D \gdef\starttest%
 %D   {\blanko
@@ -43,7 +43,7 @@
 %D combining words, we often favor putting dashes between those
 %D words, because it facilitates reading, at least for those
 %D who are not that accustomed to it.
-%D 
+%D
 %D In \TEX\ compound words, separated by a hyphen, are not
 %D hyphenated at all. In spite of the multiple pass paragraph
 %D typesetting this can lead to parts of words sticking into
@@ -53,8 +53,8 @@
 %D like \type {|}, delimited by the same character \type {|},
 %D we get ourselves both a decent visualization (in \TEXEDIT\
 %D and colored verbatim we color these commands yellow) and an
-%D efficient way of combining words. 
-%D 
+%D efficient way of combining words.
+%D
 %D The sequence \type{||} simply leads to two words connected by
 %D a hyphen. Because we want to distinguish such a hyphen from
 %D the one inserted when \TEX\ hyphenates a word, we use a bit
@@ -115,10 +115,10 @@
 %D \starttest
 %D \test {well|_|known}
 %D \stoptest
-%D 
-%D to stress the compoundness of hyphenated words. 
 %D
-%D Of course we also have to take care of the special case: 
+%D to stress the compoundness of hyphenated words.
+%D
+%D Of course we also have to take care of the special case:
 %D
 %D \starttest
 %D \test {text||color and ||font}
@@ -168,7 +168,7 @@
 %D In the main \CONTEXT\ modules these can be tuned by a setup
 %D command. Watch the (maybe) better looking compound hyphen.
 
-% I've added \hbox's so that in mathmode we get proper chars 
+% I've added \hbox's so that in mathmode we get proper chars
 
 \def\compoundhyphen     {\hbox{-\kern-.25ex-}}
 \def\beginofsubsentence {\hbox{---}}
@@ -257,7 +257,7 @@
 %D      \let\nextnext=\relax
 %D    \fi}
 %D \stoptypen
-%D 
+%D
 %D Handling \type{(} and \type{)} is a a bit special, because
 %D \TEX\ sees them as decent hyphenation points, according to
 %D their \type{\lccode} being non||zero. For the same reason,
@@ -300,10 +300,10 @@
 
 \beginTEX
 
-\def\installdiscretionaries#1#2#3% 
+\def\installdiscretionaries#1#2#3%
   {\convertargument#1\to\ascii
-   \setevalue{\strippedcsname\mathmodediscretionary\string#1}{\ascii}% 
-   \setvalue{\strippedcsname\textmodediscretionary\string#1}{#3}%
+   \setevalue{\strippedcsname\mathmodediscretionary\string#1}{\ascii}%
+   \setvalue {\strippedcsname\textmodediscretionary\string#1}{#3}%
    \catcode`#1=\@@active
    \scratchcounter=\the\uccode`~
    \uccode`~=`#1
@@ -314,9 +314,9 @@
 
 \beginETEX \detokenize
 
-\def\installdiscretionaries#1#2#3% 
-  {\setevalue{\strippedcsname\mathmodediscretionary\string#1}{\detokenize{#1}}% 
-   \setvalue{\strippedcsname\textmodediscretionary\string#1}{#3}%
+\def\installdiscretionaries#1#2#3%
+  {\setevalue{\strippedcsname\mathmodediscretionary\string#1}{\detokenize{#1}}%
+   \setvalue {\strippedcsname\textmodediscretionary\string#1}{#3}%
    \catcode`#1=\@@active
    \scratchcounter=\the\uccode`~
    \uccode`~=`#1
@@ -337,32 +337,32 @@
 
 %D The next piece of code is a torture test for this previous
 %D macro. The \type {\relax} before the \type {\ifmmode} is
-%D needed because of the alignment scanner (in \ETEX\ this 
-%D problem is not present because there a protected macro is 
-%D not expanded. Thanks to Tobias Burnus for providing this 
-%D example. 
-%D 
+%D needed because of the alignment scanner (in \ETEX\ this
+%D problem is not present because there a protected macro is
+%D not expanded. Thanks to Tobias Burnus for providing this
+%D example.
+%D
 %D \startformule
-%D   \left|f(x_n)-{1\over2}\right| = 
+%D   \left|f(x_n)-{1\over2}\right| =
 %D      {\cases{|{1\over2}-x_n| &for $0\le x_n < {1\over2}$\cr
 %D              |x_n-{1\over2}| &for ${1\over2}<x_n\le1$   \cr}}
 %D \stopformule
 
-%D \macros 
+%D \macros
 %D   {defineactivecharacter}
 %D
-%D In \type {lang-ger.tex} we define some language specific 
+%D In \type {lang-ger.tex} we define some language specific
 %D commands for german input, like:
-%D 
+%D
 %D \starttypen
 %D \startlanguagespecifics[de]
 %D   \installcompoundcharacter "a {\moveaccent{-.1ex}\"a\midworddiscretionary}
-%D \stoplanguagespecifics 
+%D \stoplanguagespecifics
 %D \stoptypen
-%D 
-%D Occasionally we have to redefine such an active character, 
+%D
+%D Occasionally we have to redefine such an active character,
 %D like in:
-%D 
+%D
 %D \starttypen
 %D \startencoding[pdfdoc]
 %D   \startlanguagespecifics[de]
@@ -370,7 +370,7 @@
 %D   \stoplanguagespecifics
 %D \stopencoding
 %D \stoptypen
-%D 
+%D
 %D Here is the command we used:
 
 % \def\next{#2}% \unexpanded\def\next is wrong in non||etex
@@ -381,11 +381,11 @@
    \scratchcounter=\the\uccode`~
    \uccode`~=`#1\relax
    \uppercase{\def\next{~}}%
-  %\expandafter\unexpanded\expandafter\def\next{#2}% 
-   \expandafter\def\next{#2}% unexpanded goes wrong in pdfdoc 
+  %\expandafter\unexpanded\expandafter\def\next{#2}%
+   \expandafter\def\next{#2}% unexpanded goes wrong in pdfdoc
    \uccode`~=\scratchcounter}
 
-%D The next alternative also supports character numbers: 
+%D The next alternative also supports character numbers:
 
 \def\defineactivecharacter #1 #2%
   {\scratchcounter\the\uccode`~
@@ -393,8 +393,8 @@
      {\catcode #1=\@@active \uccode`~= #1\relax}
      {\catcode`#1=\@@active \uccode`~=`#1\relax}%
    \uppercase{\def\next{~}}%
-  %\expandafter\unexpanded\expandafter\def\next{#2}% 
-   \expandafter\def\next{#2}% unexpanded goes wrong in pdfdoc 
+  %\expandafter\unexpanded\expandafter\def\next{#2}%
+   \expandafter\def\next{#2}% unexpanded goes wrong in pdfdoc
    \uccode`~\scratchcounter}
 
 %D One reason for abusing the \type{~} is that it is already
@@ -402,19 +402,19 @@
 
 %D The next implementation is about 20\% faster; 1M
 %D definitions on a 1Gig machine takes about 19 seconds
-%D (against 24 for the previous alternative). 
+%D (against 24 for the previous alternative).
 
 \chardef\activehackcode=`~
 
 \def\defineactivecharacter #1 %
   {\scratchcounter\the\uccode\activehackcode
    \uccode\activehackcode\expandafter\doifnumberelse\expandafter{\string#1}\empty`#1%
-   \catcode\uccode\activehackcode\@@active 
+   \catcode\uccode\activehackcode\@@active
    \uppercase{\def\next{~}}%
    \uccode\activehackcode\scratchcounter
-   \expandafter\def\next}% unexpanded goes wrong in pdfdoc 
+   \expandafter\def\next}% unexpanded goes wrong in pdfdoc
 
-%D A goody: 
+%D A goody:
 
 \def\makecharacteractive #1 %
   {\catcode`#1\active}
@@ -500,17 +500,17 @@
      \let\nextnext=\relax
    \fi}
 
-%D The macro \type{\checkbeforediscretionary} takes care of 
-%D loners like \type{||word}, while it counterpart 
-%D \type{\checkafterdiscretionary} is responsible for handling 
-%D the comma. 
+%D The macro \type{\checkbeforediscretionary} takes care of
+%D loners like \type{||word}, while it counterpart
+%D \type{\checkafterdiscretionary} is responsible for handling
+%D the comma.
 
 %D \macros
 %D   {beginofsubsentencespacing,endofsubsentencespacing}
-%D 
-%D In the previous macros we provided two hooks which can be 
-%D used to support nested sub||sentences. In \CONTEXT\ these 
-%D hooks are used to insert a small space when needed. 
+%D
+%D In the previous macros we provided two hooks which can be
+%D used to support nested sub||sentences. In \CONTEXT\ these
+%D hooks are used to insert a small space when needed.
 
 \let\beginofsubsentencespacing=\relax
 \let\endofsubsentencespacing  =\relax
@@ -520,13 +520,13 @@
 
 \installdiscretionaries || \compoundhyphen
 
-%D \macros 
+%D \macros
 %D   {fakecompoundhyphen}
 %D
-%D In headers and footers as well as in active pieces of text 
-%D we need a dirty hack. Try to imagine what is needed to 
-%D savely break the next text across a line and at the same 
-%D time make the words interactive. 
+%D In headers and footers as well as in active pieces of text
+%D we need a dirty hack. Try to imagine what is needed to
+%D savely break the next text across a line and at the same
+%D time make the words interactive.
 %D
 %D \starttypen
 %D \goto{Some||Long||Word}
@@ -535,7 +535,7 @@
 \def\currentspaceskip%
   {\fontdimen2\font\!!plus\fontdimen3\font\!!minus\fontdimen4\font\relax}
 
-% \def\fakecompoundhyphen% wrong 
+% \def\fakecompoundhyphen% wrong
 %   {\def|##1|{\compoundhyphen\nobreak\hskip-\currentspaceskip\allowbreak}}
 
 \ifx\newsignal\undefined
@@ -549,9 +549,9 @@
   \def\fakecompoundhyphen%
     {\def|##1|%
        {\doifelsenothing{##1}{\compoundhyphen}{##1}%
-        \kern\compoundbreakpoint\allowbreak}} 
+        \kern\compoundbreakpoint\allowbreak}}
 
-\fi 
+\fi
 
 %D One of the drawbacks of this mechanism is that characters can
 %D be made active afterwards. The next alternative can be used
@@ -603,7 +603,7 @@
 %D This time we use \type{\ifnum}:
 
 \def\activedododotextmodediscretionary%
-  {\let\nextnextnext=\egroup
+  {\let\nextnextnext\egroup
    \ifx\discretionarycommand\next
      \checkafterdiscretionary
      \bgroup
@@ -615,7 +615,7 @@
    \else\ifnum\uccode`~=\nextuccode
      \prewordbreak\discretionary{-}{}{\thinspace}\postwordbreak
    \else\ifnum\uccode`_=\nextuccode
-     \prewordbreak\discretionary{\textmodediscretionary} 
+     \prewordbreak\discretionary{\textmodediscretionary}
        {\textmodediscretionary}{\textmodediscretionary}\prewordbreak
    \else\ifnum\uccode`(=\nextuccode
      \ifdim\lastskip>\!!zeropoint\relax
@@ -635,7 +635,7 @@
      \beginofsubsentence\prewordbreak\beginofsubsentencespacing
    \else\ifnum\uccode`>=\nextuccode
      \endofsubsentencespacing\prewordbreak\endofsubsentence
-   \else 
+   \else
      \checkafterdiscretionary
      \bgroup
        \checkbeforediscretionary
@@ -742,7 +742,9 @@
 
 %D Since most things in \CONTEXT\ are configurable, we
 %D slightly change the previous definition so that we can
-%D install new functionality outside this module.  
+%D install new functionality outside this module.
+
+\def\@tmd@{@@tmd@@}
 
 \def\activedododotextmodediscretionary#1#2%
   {\convertargument#2\to\discretionarytoken
@@ -750,8 +752,8 @@
      {\getvalue{\strippedcsname\textmodediscretionary\string#1}}%
    \ifx\discretionarytoken\empty
      \ifx#1\nextnext % takes care of ||| and +++ and ......
-        \prewordbreak\discretionary{\hbox{$#1$}}{}{\hbox{$#1$}}%
-         \allowbreak\postwordbreak
+       \prewordbreak\discretionary{\hbox{$#1$}}{}{\hbox{$#1$}}%
+       \allowbreak\postwordbreak
        \def\nextnextnext{\afterassignment\egroup\let\next=}%
      \else
        \checkafterdiscretionary
@@ -760,7 +762,7 @@
          \prewordbreak\hbox{\textmodediscretionary\nextnext}\allowbreak\postwordbreak
        \egroup
      \fi
-   \else\expandafter\ifx\csname @tmd@\discretionarytoken\endcsname\relax
+   \else\expandafter\ifx\csname\@tmd@\discretionarytoken\endcsname\relax
      \checkafterdiscretionary
      \bgroup
        \checkbeforediscretionary
@@ -769,15 +771,18 @@
        \allowbreak\postwordbreak
      \egroup
    \else
-     \csname @tmd@\discretionarytoken\endcsname
+     \csname\@tmd@\discretionarytoken\endcsname
    \fi\fi
-   \nextnextnext}
+   \nextnextnext} % can be \egroup so \aftergroup\ignorespaces
 
 \def\definetextmodediscretionary #1
   {\convertargument#1\to\ascii
-   \setvalue{@tmd@\ascii}}
+   \setvalue{\@tmd@\ascii}}
 
-\definetextmodediscretionary = 
+\definetextmodediscretionary {} % empty case, also handled in parser 
+  {\prewordbreak\compoundhyphen\allowbreak\postwordbreak}
+ 
+\definetextmodediscretionary =
   {\prewordbreak\textmodediscretionary}
 
 \definetextmodediscretionary ~
@@ -816,22 +821,55 @@
   {\prewordbreak\discretionary{\hbox{$|$}}{}{\hbox{$|$}}%
    \allowbreak\postwordbreak}
 
-\definetextmodediscretionary : 
-  {\prewordbreak\kern.25em:\space\ignorespaces}
+\definetextmodediscretionary :  
+  {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{:}:}
+  %\space\aftergroup\ignorespaces}
+
+\definetextmodediscretionary ;
+  {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{;};}
+  %\space\aftergroup\ignorespaces}
+
+\definetextmodediscretionary ?
+  {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{?}?}
+  %\space\aftergroup\ignorespaces}
 
-\definetextmodediscretionary ; 
-  {\prewordbreak\kern.25em;\space\ignorespaces}
+\definetextmodediscretionary !
+  {\removeunwantedspaces\prewordbreak\kern\hspaceamount\empty{!}!}
+  %\space\aftergroup\ignorespaces}
 
 \definetextmodediscretionary *
   {\prewordbreak\discretionary{-}{}{\kern.05em}\prewordbreak}
 
+\ifx\hspaceamount\undefined
+
+  \def\hspaceamount#1#2{\kern.16667em}
+
+\fi
+
 %D Since we don't have to bother about active characters any
 %D longer, we end up with a pretty simple activating macro:
 
 \def\enableactivediscretionaries%
   {\let\dotextmodediscretionary=\activedotextmodediscretionary}
 
-%D Done somewhere else: \type {\enableactivediscretionaries}. 
+%D Done somewhere else: \type {\enableactivediscretionaries}.
+
+%D \macros 
+%D   {directdiscretionary}
+%D
+%D In those situations where the nature of characters is 
+%D less predictable, we can use the more direct approach:
+
+\def\directdiscretionary#1%
+  {\convertargument#1\to\discretionarytoken
+   \let\textmodediscretionary\compoundhyphen
+   \expandafter\ifx\csname\@tmd@\string#1\endcsname\relax
+     \prewordbreak
+     \discretionary{\hbox{#1}}{}{\hbox{#1}}%
+     \allowbreak\postwordbreak
+   \else
+     \csname\@tmd@\string#1\endcsname
+   \fi}
 
 %D \macros
 %D   {installcompoundcharacter}
@@ -840,69 +878,89 @@
 %D \PPCHTEX\ into german, he suggested to let \CONTEXT\ support
 %D the \type{german.sty} method of handling compound
 %D characters, especially the umlaut. This package is meant for
-%D use with \PLAIN\ \TEX\ as well as \LATEX. 
-%D 
+%D use with \PLAIN\ \TEX\ as well as \LATEX.
+%D
 %D I decided to implement compound character support as
 %D versatile as possible. As a result one can define his own
-%D compound character support, like: 
-%D 
+%D compound character support, like:
+%D
 %D \starttypen
 %D \installcompoundcharacter "a {\"a}
 %D \installcompoundcharacter "e {\"e}
 %D \installcompoundcharacter "i {\"i}
 %D \installcompoundcharacter "u {\"u}
 %D \installcompoundcharacter "o {\"o}
-%D \installcompoundcharacter "s {\SS} 
+%D \installcompoundcharacter "s {\SS}
 %D \stoptypen
 %D
-%D or even 
-%D 
+%D or even
+%D
 %D \starttypen
 %D \installcompoundcharacter "ck {\discretionary {k-}{k}{ck}}
 %D \installcompoundcharacter "ff {\discretionary{ff-}{f}{ff}}
 %D \stoptypen
-%D 
-%D The support is not limited to alphabetic characters, so the 
-%D next definition is also valid. 
-%D 
+%D
+%D The support is not limited to alphabetic characters, so the
+%D next definition is also valid.
+%D
 %D \starttypen
 %D \installcompoundcharacter ". {.\doifnextcharelse{\spacetoken}{}{\kern.125em}}
 %D \stoptypen
-%D 
+%D
 %D The implementation looks familiar and uses the same tricks as
-%D mentioned earlier in this module. We take care of two 
-%D arguments, which complicates things a bit.  
+%D mentioned earlier in this module. We take care of two
+%D arguments, which complicates things a bit.
 
-\def\@nc@{@nc@} % normal character 
+\def\@nc@{@nc@} % normal character
 \def\@nn@{@nn@} % normal catcode
-\def\@cc@{@cc@} % compound character 
-\def\@cs@{@cs@} % compound characters 
+\def\@cc@{@cc@} % compound character
+\def\@cs@{@cs@} % compound characters
+
+% \def\installcompoundcharacter #1#2#3 #4% {{#4}} keeps move local
+%   {\setvalue{\@nc@\string#1}{\char`#1}%
+%    \ifnum\catcode`#1=\@@active \else
+%      \setevalue{\@nn@\string#1}{\number\catcode`#1}% new
+%    \fi
+%    \def\!!stringa{#3}%
+%    \ifx\!!stringa\empty
+%      \setvalue{\@cc@\string#1\string#2}{{#4}}%
+%    \else
+%      \setvalue{\@cs@\string#1\string#2\string#3}{{#4}}%
+%    \fi
+%    \catcode`#1=\@@active
+%    \scratchcounter=\the\uccode`~
+%    \uccode`~=`#1
+%    \uppercase{\unexpanded\def~{\handlecompoundcharacter~}}%
+%    \uccode`~=\scratchcounter}
 
 \def\installcompoundcharacter #1#2#3 #4% {{#4}} keeps move local
-  {\setvalue{\@nc@\string#1}{\char`#1}%
-   \ifnum\catcode`#1=\@@active \else
-     \setevalue{\@nn@\string#1}{\number\catcode`#1}% new 
-   \fi 
+  {\chardef\thecompoundcharacter`#1%
+  %\@EA\def\csname\@nc@\string#1\endcsname{\char`#1}%
+   \@EA\chardef\csname\@nc@\string#1\endcsname\thecompoundcharacter
+   \ifnum\catcode\thecompoundcharacter=\@@active \else
+     \@EA\edef\csname\@nn@\string#1\endcsname
+       {\number\catcode\thecompoundcharacter}%
+   \fi
    \def\!!stringa{#3}%
-   \ifx\!!stringa\empty
-     \setvalue{\@cc@\string#1\string#2}{{#4}}% 
+   \@EA\def\csname\ifx\!!stringa\empty
+     \@cc@\string#1\string#2%
    \else
-     \setvalue{\@cs@\string#1\string#2\string#3}{{#4}}%
-   \fi
-   \catcode`#1=\@@active
-   \scratchcounter=\the\uccode`~
-   \uccode`~=`#1
+     \@cs@\string#1\string#2\string#3%
+   \fi\endcsname{{#4}}%
+   \catcode\thecompoundcharacter\@@active
+   \scratchcounter\uccode\activehackcode
+   \uccode\activehackcode\thecompoundcharacter
    \uppercase{\unexpanded\def~{\handlecompoundcharacter~}}%
-   \uccode`~=\scratchcounter}
+   \uccode\activehackcode\scratchcounter}
 
-%D A compound character can be reset with the following 
-%D command. 
+%D A compound character can be reset with the following
+%D command.
 %D
 %D \starttypen
 %D \restorecompoundcharacter /
-%D \stoptypen 
+%D \stoptypen
 
-\def\restorecompoundcharacter#1% new 
+\def\restorecompoundcharacter#1% new
   {\catcode`#1=\csname\@nn@\string#1\endcsname\relax}
 
 %D In handling the compound characters we have to take care of
@@ -917,35 +975,69 @@
 %D with \type{\futurelet} to prevent spaces from
 %D disappearing.
 
+% \def\handlecompoundcharacter#1%
+%   {\def\dohandlecompoundcharacter%
+%      {\ifx\next\bgroup
+%        %\def\next{\dodohandlecompoundcharacter#1}%    % handle "{ee} -> \"ee
+%        %\let\next\relax                               % forget "{ee} -> ee
+%         \def\next{\handlecompoundcharacterone#1}%     % ignore "{ee} -> "ee
+%       \else\ifx\next\egroup
+%         \def\next{\getvalue{\@nc@\string#1}}%
+%       \else\ifx\next\blankspace
+%         \def\next{\getvalue{\@nc@\string#1}}%
+%       \else
+%         \def\next{\dodohandlecompoundcharacter#1}%
+%       \fi\fi\fi
+%       \next}%
+%    \futurelet\next\dohandlecompoundcharacter}
+%
+% \def\dodohandlecompoundcharacter#1#2%
+%   {\def\dododohandlecompoundcharacter% Keep it here and
+%      {\ifx\next\bgroup               % preserve spaces!
+%         \def\next{\handlecompoundcharacterone#1#2}%
+%       \else\ifx\next\egroup
+%         \def\next{\handlecompoundcharacterone#1#2}%
+%       \else\ifx\next\blankspace
+%         \def\next{\handlecompoundcharacterone#1#2}%
+%       \else
+%         \def\next{\handlecompoundcharactertwo#1#2}%
+%       \fi\fi\fi
+%       \next}%
+%    \futurelet\next\dododohandlecompoundcharacter}
+
 \def\handlecompoundcharacter#1%
-  {\def\dohandlecompoundcharacter%
-     {\ifx\next\bgroup
-       %\def\next{\dodohandlecompoundcharacter#1}%    % handle "{ee} -> \"ee
-       %\let\next\relax                               % forget "{ee} -> ee
-        \def\next{\handlecompoundcharacterone#1}%     % ignore "{ee} -> "ee
-      \else\ifx\next\egroup
-        \def\next{\getvalue{\@nc@\string#1}}%
-      \else\ifx\next\blankspace
-        \def\next{\getvalue{\@nc@\string#1}}%
-      \else
-        \def\next{\dodohandlecompoundcharacter#1}%
-      \fi\fi\fi
-      \next}%
-   \futurelet\next\dohandlecompoundcharacter}
-
-\def\dodohandlecompoundcharacter#1#2%
-  {\def\dododohandlecompoundcharacter% Keep it here and 
-     {\ifx\next\bgroup               % preserve spaces!
-        \def\next{\handlecompoundcharacterone#1#2}%
-      \else\ifx\next\egroup
-        \def\next{\handlecompoundcharacterone#1#2}%
-      \else\ifx\next\blankspace
-        \def\next{\handlecompoundcharacterone#1#2}%
-      \else
-        \def\next{\handlecompoundcharactertwo#1#2}%
-      \fi\fi\fi
-      \next}%
-   \futurelet\next\dododohandlecompoundcharacter}
+  {\def\xhandlecompoundcharacter{\dohandlecompoundcharacter{#1}}%
+   \futurelet\next\xhandlecompoundcharacter}
+
+\def\dohandlecompoundcharacter
+  {\ifx\next\bgroup
+    %\@EA\dodohandlecompoundcharacter % handle "{ee} -> \"ee
+    %\@EA\gobbleoneargument           % forget "{ee} -> ee
+     \@EA\handlecompoundcharacterone  % ignore "{ee} -> "ee
+   \else\ifx\next\egroup
+     \@EAEAEA\donohandlecompoundcharacter
+   \else\ifx\next\blankspace
+     \@EA\@EAEAEA\@EA\donohandlecompoundcharacter
+   \else
+     \@EA\@EAEAEA\@EA\dodohandlecompoundcharacter
+   \fi\fi\fi}
+
+\def\donohandlecompoundcharacter#1{\csname\@nc@\string#1\endcsname}
+
+\def\dododohandlecompoundcharacter
+  {\ifx\next\bgroup
+     \@EA\handlecompoundcharacterone
+   \else\ifx\next\egroup
+     \@EAEAEA\handlecompoundcharacterone
+   \else\ifx\next\blankspace
+     \@EA\@EAEAEA\@EA\handlecompoundcharacterone
+   \else
+     \@EA\@EAEAEA\@EA\handlecompoundcharactertwo
+   \fi\fi\fi}
+
+\def\dodohandlecompoundcharacter#1#2% preserve space
+  {\def\xdodohandlecompoundcharacter{\dododohandlecompoundcharacter#1#2}%
+   \futurelet\next\xdodohandlecompoundcharacter}
 
 %D Besides taken care of the grouping and space tokens, we have
 %D to deal with three situations. First we look if the next
@@ -955,7 +1047,7 @@
 %D insert the first. So we have
 %D
 %D \starttypen
-%D <key><key>  <key><known>  <key><unknown>  
+%D <key><key>  <key><known>  <key><unknown>
 %D \stoptypen
 %D
 %D In later modules we will see how these commands are used.
@@ -1022,13 +1114,13 @@
 
 \endETEX
 
-%D For very obscure applications (see for an application \type 
-%D {lang-sla.tex}) we provide:  
+%D For very obscure applications (see for an application \type
+%D {lang-sla.tex}) we provide:
 
 \def\dosimplifiedcompoundcharacter#1%
   {#1}
 
-\beginTEX 
+\beginTEX
 
 \def\simplifiedcompoundcharacter#1#2%
   {\@EA\ifx\csname\@cc@\string#1\string#2\endcsname\relax
@@ -1050,10 +1142,10 @@
 
 \endETEX
 
-%D \macros 
+%D \macros
 %D   {nonbreakablespace}
 %D
-%D The following macro is taken from plain \TEX. 
+%D The following macro is taken from plain \TEX.
 
 \def\nonbreakablespace{\penalty\!!tenthousand\ }
 
@@ -1067,11 +1159,11 @@
 %D   {midworddiscretionary}
 %D
 %D If needed, one can add a discretionary hyphen using \type
-%D {\midworddiscretionary}. This macro does the same as 
-%D \PLAIN\ \TEX's \type {\-}, but, like the ones implemented 
+%D {\midworddiscretionary}. This macro does the same as
+%D \PLAIN\ \TEX's \type {\-}, but, like the ones implemented
 %D earlier, this one also looks ahead for spaces and grouping
-%D tokens. 
- 
+%D tokens.
+
 \def\domidworddiscretionary%
   {\ifx\next\blankspace\else
    \ifx\next\bgroup    \else
@@ -1082,21 +1174,21 @@
 \def\midworddiscretionary%
   {\futurelet\next\domidworddiscretionary}
 
-%D \macros 
+%D \macros
 %D   {hyphenatedurl}
-%D 
-%D For those who want to put full \URL's in a text, we offer 
-%D 
+%D
+%D For those who want to put full \URL's in a text, we offer
+%D
 %D \startbuffer
 %D \hyphenatedurl{http://optimist.optimist/optimist/optimist.optimist#optimist}
 %D \stopbuffer
-%D 
+%D
 %D \typebuffer
-%D 
+%D
 %D which breaks at the appropriate places. Watch the \type{#}
-%D hack. 
+%D hack.
 %D
-%D When passed as argument, like in \type {\goto}, one needs 
+%D When passed as argument, like in \type {\goto}, one needs
 %D to substitute a \type {\\} for each \type{#}.
 %D
 %D \startbuffer
@@ -1107,25 +1199,25 @@
 
 \ifx\\\undefined \let\\\crlf \fi
 
-\chardef\urlsplitmode=1 
+\chardef\urlsplitmode=1
 
-% 0 => don't split 
+% 0 => don't split
 % 1 => . : na, rest voor
 % 2 => alles na
 % 3 => alles voor
 
-\bgroup \catcode`\~=\active \catcode`\/=\active 
+\bgroup \catcode`\~=\active \catcode`\/=\active
 
-% Why not convert to ascii first? I will redo this one! 
+% Why not convert to ascii first? I will redo this one!
 
 % \unexpanded\gdef\hyphenatedurl#1% {}{} handles accents
 %   {\bgroup
 %    \obeyhyphens
 %    \def\splitbefore##1%
 %      {\setbox\scratchbox=\hbox{##1{}{}}%
-%       \ifcase\urlsplitmode 
+%       \ifcase\urlsplitmode
 %         \box\scratchbox
-%       \or 
+%       \or
 %         \postwordbreak\box\scratchbox\prewordbreak
 %       \or
 %         \prewordbreak\discretionary{\box\scratchbox}{}{\box\scratchbox}\prewordbreak
@@ -1141,7 +1233,7 @@
 %         \prewordbreak\discretionary{##1{}{}}{}{##1{}{}}\prewordbreak
 %       \else
 %         \prewordbreak\discretionary{}{##1{}{}}{##1{}{}}\prewordbreak
-%       \fi}% 
+%       \fi}%
 %    \def\flushurl%
 %      {\savedurl\let\savedurl\empty}%
 %    \def\\%
@@ -1152,9 +1244,9 @@
 %    \handletokens#1\with\scanurl
 %    \egroup}
 %
-% Better (a mere copy with \dohyphens): 
+% Better (a mere copy with \dohyphens):
 
-\bgroup \catcode`\~=\active \catcode`\/=\active 
+\bgroup \catcode`\~=\active \catcode`\/=\active
 
 \unexpanded\gdef\hyphenatedurl#1% {}{} handles accents
   {\bgroup
@@ -1164,9 +1256,9 @@
    \obeyhyphens
    \def\splitbefore##1%
      {\setbox\scratchbox=\hbox{##1{}{}}%
-      \ifcase\urlsplitmode 
+      \ifcase\urlsplitmode
         \box\scratchbox
-      \or 
+      \or
         \postwordbreak\box\scratchbox\prewordbreak
       \or
         \prewordbreak\discretionary{\box\scratchbox}{}{\box\scratchbox}\prewordbreak
@@ -1182,7 +1274,7 @@
         \prewordbreak\discretionary{##1{}{}}{}{##1{}{}}\prewordbreak
       \else
         \prewordbreak\discretionary{}{##1{}{}}{##1{}{}}\prewordbreak
-      \fi}% 
+      \fi}%
    \def\flushurl%
      {\savedurl\let\savedurl\empty}%
    \def\\%
@@ -1195,10 +1287,10 @@
 
 \egroup
 
-%D This would be better, but it spoils \type {\~} and so:  
+%D This would be better, but it spoils \type {\~} and so:
 %D
-%D \starttypen 
-%D \convertargument#1\to\ascii 
+%D \starttypen
+%D \convertargument#1\to\ascii
 %D \expandafter\handletokens\ascii\with\scanurl
 %D \stoptypen
 
@@ -1208,27 +1300,27 @@
   {\ifx#1\~%
      \flushurl\splitbefore\~%
    \else\ifx#1\#%
-     \flushurl\splitbefore\#% 
+     \flushurl\splitbefore\#%
    \else\ifx#1\&%
-     \flushurl\splitbefore\&% 
+     \flushurl\splitbefore\&%
    \else\ifx#1\%%
-     \flushurl\splitbefore\%% 
+     \flushurl\splitbefore\%%
    \else\ifx#1\_%
-     \flushurl\splitbefore\_% 
+     \flushurl\splitbefore\_%
    \else\if\noexpand#1\relax
      #1%
    \else\ifnum\catcode`#1=8
-     \flushurl\splitbefore\_% 
+     \flushurl\splitbefore\_%
    \else\ifnum\catcode`#1=6
-     \flushurl\splitbefore\#% 
+     \flushurl\splitbefore\#%
    \else\ifnum\catcode`#1=4
-     \flushurl\splitbefore\&% 
+     \flushurl\splitbefore\&%
    \else\if#1\lettertilde
      \flushurl\splitbefore\~%
    \else\if#1\letterpercent
-     \flushurl\splitbefore\%%   
+     \flushurl\splitbefore\%%
    \else\if#1\letterunderscore
-     \flushurl\splitbefore\_%   
+     \flushurl\splitbefore\_%
    \else\if#1\letterquestionmark
      \flushurl\splitafter\letterquestionmark
    \else\if#1\letterat
@@ -1249,26 +1341,26 @@
      #1%
    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
 
-%D When Joop Susan asked (on the \CONTEXT\ mailing list) how 
-%D to handle url's passed as argument, the following solutions 
-%D came to my mind: 
+%D When Joop Susan asked (on the \CONTEXT\ mailing list) how
+%D to handle url's passed as argument, the following solutions
+%D came to my mind:
 %D
-%D \starttypen 
+%D \starttypen
 %D \def\whateverurl#1%
 %D   {{\def~{\string~}\useURL[dummy][#1]\goto{\url[dummy]}[URL(dummy)]}}
-%D 
+%D
 %D \def\whateverurl#1%
 %D   {{\let~\lettertilde\useURL[dummy][#1]\goto{\url[dummy]}[URL(dummy)]}}
-%D 
+%D
 %D \def\whateverurl#1%
 %D   {\convertargument#1\to\ascii
 %D    \expanded{\useURL[dummy][\ascii]}\goto{\url[dummy]}[URL(dummy)]}
-%D \stoptypen 
+%D \stoptypen
 
 %D \macros
 %D   {hyphenatedfile}
 %D
-%D For the moment we treat filenames in a similar way, 
+%D For the moment we treat filenames in a similar way,
 %D
 %D \starttypen
 %D \hyphenatedfile{here/there/filename.suffix}
@@ -1284,9 +1376,20 @@
 %    \def\next##1{##1\doif{##1}{-}{\allowbreak}}%
 %    \handletokens#1\with\next
 %    \egroup}
-% 
+%
 % {\hsize1cm\hyphenatedstring{ABXXXXXXXXXXC-12345-12345}}
 
-\protect
+%D \macros 
+%D   {disablediscretionaries,disablecompoundcharacter}
+%D 
+%D Occasionally we need to disable this mechanism. For the 
+%D moment we assume that \type {|} is used. 
+
+\def\disablediscretionaries   
+  {\def|##1|{\string##1}%
+   \def\directdiscretionary##1{\string##1}}
+
+\def\disablecompoundcharacters
+  {\let\handlecompoundcharacter\string}
 
-\endinput
+\protect \endinput
diff --git a/tex/context/base/supp-mps.tex b/tex/context/base/supp-mps.tex
index deb669db7..d30e13ca2 100644
--- a/tex/context/base/supp-mps.tex
+++ b/tex/context/base/supp-mps.tex
@@ -405,6 +405,14 @@
   \let \} \letterclosebrace
 \to \everyMPgraphic
 
+\beginTEX
+
+\ifx \honorunexpanded \undefined \else % not really needed 
+  \prependtoks \honorunexpanded \to \everyMPgraphic
+\fi 
+
+\endTEX
+
 \def\startwritingMPgraphic
   {\bgroup
    \global\advance\nofMPgraphics 1 
@@ -1535,7 +1543,7 @@
 %D cannot interfere. We use a rather safe maximum of 4000 
 %D graphics here and 8000 in \type {meta-ini}. 
 
-\newcount \maxnofMPgraphics  \maxnofMPgraphics = 4000 %8000 
+\newcount \maxnofMPgraphics  \maxnofMPgraphics = 4000 % 8000 
 \newcount \minnofMPgraphics  \minnofMPgraphics =    1
 
 \newif    \ifMPstaticgraphic \MPstaticgraphicfalse 
diff --git a/tex/context/base/supp-num.tex b/tex/context/base/supp-num.tex
index 1220b53be..5bdf99231 100644
--- a/tex/context/base/supp-num.tex
+++ b/tex/context/base/supp-num.tex
@@ -1,5 +1,5 @@
 %D \module
-%D   [       file=supp-lan,
+%D   [       file=supp-num,
 %D        version=1998.05.15,
 %D          title=\CONTEXT\ Support Macros,
 %D       subtitle=Number (Digit) Handling, 
diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex
index 624deaec7..75a767938 100644
--- a/tex/context/base/syst-ext.tex
+++ b/tex/context/base/syst-ext.tex
@@ -2797,14 +2797,14 @@
 %    \doprocesstokens#5\lastcharacter
 %    \egroup}
 
-\def\dodoprocesstokens%
+\def\dodoprocesstokens
   {\ifx\nextprocessedtoken\lastcharacter
      \after
      \let\nextprocessedtoken=\relax
    \else\ifx\nextprocessedtoken\bgroup
      \def\nextprocessedtoken%
        {\dowithnextbox
-          {\before{\box\nextbox}%
+          {\before{\copy\nextbox}% \before can use nextbox several times 
            \let\before\between
            \doprocesstokens}
            \hbox\bgroup}%          
@@ -4065,4 +4065,18 @@
 \def\verbatimstring#1%
   {\convertargument#1\to\ascii\ascii}
 
+%D These are needed in ordinal number conversions: 
+
+\def\lastdigit#1%
+  {\@EA\thelastdigit\number#1\relax}
+
+\def\thelastdigit#1#2%
+  {\ifx#2\relax#1\else\@EA\thelastdigit\@EA#2\fi}
+
+\def\lasttwodigits#1%
+  {\@EA\thelasttwodigits\@EA0\number#1\relax}
+
+\def\thelasttwodigits#1#2#3% 0 dig ... \relax
+  {\ifx#3\relax#1#2\else\@EA\thelasttwodigits\@EA#2\@EA#3\fi}
+
 \protect \endinput
diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex
index f65eaf75f..f5643fcbd 100644
--- a/tex/context/base/syst-gen.tex
+++ b/tex/context/base/syst-gen.tex
@@ -162,33 +162,69 @@
 
 \chardef\protectionthreshold=2
 
+% \def\unprotect
+%   {\ifcase\protectionlevel
+%      \edef\doprotectcharacters%
+%        {\catcode`\noexpand @=\the\catcode`@
+%         \catcode`\noexpand !=\the\catcode`!
+%         \catcode`\noexpand ?=\the\catcode`? }%
+%      \let\protect\doprotect
+%    \fi
+%    \catcode`@=11
+%    \catcode`!=11
+%    \catcode`?=11
+%    \advance\protectionlevel 1
+%    \ifnum\protectionlevel>\protectionthreshold
+%      \message{<unprotect \the\protectionlevel>}%
+%    \fi}
+% 
+% \def\doprotect%
+%   {\ifnum\protectionlevel=1
+%      \doprotectcharacters
+%      \let\doprotectcharacters\relax
+%      \let\protect\normalprotect
+%    \fi
+%    \ifnum\protectionlevel>\protectionthreshold
+%      \message{<protect \the\protectionlevel>}%
+%    \fi
+%    \advance\protectionlevel -1 }
+
+\def\saveprotectedcharacters
+  {\edef\doprotectcharacters
+     {\catcode`\noexpand @\the\catcode`@
+      \catcode`\noexpand !\the\catcode`!
+      \catcode`\noexpand ?\the\catcode`? }}
+
+\def\setprotectedcharacters
+  {\catcode`@=11
+   \catcode`!=11
+   \catcode`?=11 }
+
 \def\unprotect
   {\ifcase\protectionlevel
-     \edef\doprotectcharacters%
-       {\catcode`\noexpand @=\the\catcode`@
-        \catcode`\noexpand !=\the\catcode`!
-        \catcode`\noexpand ?=\the\catcode`? }%
+     \saveprotectedcharacters
      \let\protect\doprotect
    \fi
-   \catcode`@=11
-   \catcode`!=11
-   \catcode`?=11
+   \setprotectedcharacters
    \advance\protectionlevel 1
-   \ifnum\protectionlevel>\protectionthreshold
-     \message{<unprotect \the\protectionlevel>}%
+   \ifnum\protectionlevel>\protectionthreshold 
+     \reportunprotection 
    \fi}
 
-\def\doprotect%
-  {\ifnum\protectionlevel=1
+\def\doprotect
+  {\ifcase\protectionlevel\or
      \doprotectcharacters
      \let\doprotectcharacters\relax
      \let\protect\normalprotect
    \fi
    \ifnum\protectionlevel>\protectionthreshold
-     \message{<protect \the\protectionlevel>}%
+     \reportprotection 
    \fi
    \advance\protectionlevel -1 }
 
+\def\reportunprotection{\message{<unprotect \the\protectionlevel>}}
+\def\reportprotection  {\message{<protect   \the\protectionlevel>}}
+
 \ifx\everyeof\undefined 
 
   \let\checkprotection\relax
@@ -205,6 +241,14 @@
 
 \unprotect
 
+%D So, now we can redefine a previously defined macro as 
+%D follows:  
+
+\def\setprotectedcharacters
+  {\catcode`@\@@letter
+   \catcode`!\@@letter
+   \catcode`?\@@letter}
+
 %D \macros
 %D   {@@escape,@@begingroup,@@endgroup,@@mathshift,@@alignment,
 %D    @@endofline,@@parameter,@@superscript,@@subscript,
diff --git a/tex/context/base/type-ini.tex b/tex/context/base/type-ini.tex
index 5fba1c9c5..ce1354e8c 100644
--- a/tex/context/base/type-ini.tex
+++ b/tex/context/base/type-ini.tex
@@ -205,6 +205,7 @@
            %     [\@@typescriptone  =#1 (\typescriptone)]
            %     [\@@typescripttwo  =#2 (\typescripttwo)]
            %     [\@@typescriptthree=#3 (\typescriptthree)]}%
+           \typescriptfoundtrue
            \let\next\dostarttypescriptA
          \else
            \let\next\dostarttypescriptC
@@ -226,15 +227,17 @@
    \next}
 
 \def\dostarttypescriptA
- %{\def\stoptypescript{\typescriptfoundtrue}}
-  {\let\stoptypescript\typescriptfoundtrue}
+  {\pushmacro\fontclass}
 
 \def\dostarttypescriptB
-  {\def\stoptypescript{\popmacro\fontclass}\pushmacro\fontclass}
+  {\pushmacro\fontclass}
 
 \long\def\dostarttypescriptC#1\stoptypescript
   {}
 
+\def\stoptypescript
+  {\popmacro\fontclass}
+
 % status
 %
 % 1 loaded
diff --git a/tex/context/base/type-pre.tex b/tex/context/base/type-pre.tex
index c5aee8b98..2b36b8913 100644
--- a/tex/context/base/type-pre.tex
+++ b/tex/context/base/type-pre.tex
@@ -215,10 +215,6 @@
   % fake to prevent loading font-fil.tex and signal 'done'
 \stoptypescript
 
-\starttypescript[ber]
-  % fake to prevent loading font-fil.tex and signal 'done'
-\stoptypescript
-
 %D But for old time sake we provide: 
 
 \starttypescript[ber]
diff --git a/tex/context/base/xtag-ext.tex b/tex/context/base/xtag-ext.tex
index d6f140a33..174ac173a 100644
--- a/tex/context/base/xtag-ext.tex
+++ b/tex/context/base/xtag-ext.tex
@@ -47,17 +47,33 @@
 \def\startXMLmapping
   {\dodoubleempty\dostartXMLmapping}
 
-\def\dostartXMLmapping[#1][#2]% sneller maken 
+% \def\dostartXMLmapping[#1][#2]% sneller maken 
+%   {\pushmacro\@@XMLelement
+%    \pushmacro\@@XMLmapping
+%    \ifsecondargument
+%      \doifelse{#1}{-}
+%        {\donostartXMLmapping{#2}}
+%        {\doifelse{#1}{+}
+%           {\dodostartXMLmapping{#2}}
+%           {\donostartXMLmapping{#2}}}%
+%    \else
+%      \donostartXMLmapping{#1}%
+%    \fi
+%    \unprotect}
+
+\def\dostartXMLmapping[#1#2][#3]%
   {\pushmacro\@@XMLelement
    \pushmacro\@@XMLmapping
    \ifsecondargument
-     \doifelse{#1}{-}
-       {\donostartXMLmapping{#2}}
-       {\doifelse{#1}{+}
-          {\dodostartXMLmapping{#2}}
-          {\donostartXMLmapping{#2}}}%
+     \if\noexpand#1-%
+       \@EA\donostartXMLmapping
+     \else\if\noexpand#1+%
+       \@EAEAEA\dodostartXMLmapping
+     \else
+       \@EAEAEA\donostartXMLmapping
+     \fi\fi{#3}%
    \else
-     \donostartXMLmapping{#1}%
+     \donostartXMLmapping{#1#2}%
    \fi
    \unprotect}
 
diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex
index b768731b7..2a526e0e6 100644
--- a/tex/context/base/xtag-ini.tex
+++ b/tex/context/base/xtag-ini.tex
@@ -228,10 +228,14 @@
 .unexpanded.gdef.enableXML*
   B.catcode`.!=.@@other*
    .catcode`.?=.@@other* 
+   .catcode`.:=.@@other* active in french  
+   .catcode`.;=.@@other* active in french  
    .catcode`.&=.@@active .let&=.doXMLentity*
    .catcode`.<=.@@active .unexpanded.def<B.doXMLelementE*
-   .catcode`.>=.@@other  .catcode`."=.@@other*
-   .catcode`./=.@@other  .catcode`.'=.@@other*
+   .catcode`.>=.@@other  
+   .catcode`."=.@@other*
+   .catcode`./=.@@other  
+   .catcode`.'=.@@other*
    *catcode`.#=.@@active .def#PP1B&tex-hash;E* gobbles its own dup 
    .catcode`.#=.@@active .def#B&tex-hash;E* 
    .catcode`.$=.@@active .def$B&tex-dollar;E*
@@ -1501,7 +1505,8 @@
 
 \def\XMLflushdata#1% see m-steps for usage
   {\@EA\ifx\csname\@@XMLdata:#1\endcsname\longempty\else
-     \@EAEAEA\XMLdata\@EA\@EA\@EA{\csname\@@XMLdata:#1\endcsname}%
+     %\@EAEAEA\XMLdata\@EA\@EA\@EA{\csname\@@XMLdata:#1\endcsname}%
+     \@EA\XMLdata\csname\@@XMLdata:#1\endcsname
    \fi}
 
 \let\XMLpop    \XMLflush
@@ -1949,15 +1954,35 @@
 
 % interesting and fully expandable
 
-\def\XMLifequalelse#1#2#3%
+\def\XMLownifequalelse#1#2%
+  {\@EAEAEA\@@ifequal\csname\@@XMLvariable:\ownXMLelement:#1\endcsname\relax\@@and#2\relax\@@then}
+
+% \def\XMLifequalelse#1#2#3%
+%   {\@EAEAEA\@@ifequal\csname\@@XMLvariable:#1:#2\endcsname\relax\@@and#3\relax\@@then}
+
+\def\XMLifequalelse#1#2%
   {\ifcsname\@@XMLvariable:#1:#2\endcsname
-     \@EAEAEA\@@ifequal\csname\@@XMLvariable:#1:#2\endcsname\relax\@@and#3\relax\@@then
+     \@EAEAEA\doXMLifequalelse\@EA\@EA\csname\@@XMLvariable:#1:#2\endcsname
    \else
      \@EA\secondoftwoarguments
    \fi}
 
-\def\XMLownifequalelse#1#2%
-  {\@EAEAEA\@@ifequal\csname\@@XMLvariable:\ownXMLelement:#1\endcsname\relax\@@and#2\relax\@@then}
+\def\doXMLifequalelse#1#2%
+  {\@EA\@@ifequal#1\relax\@@and#2\relax\@@then}
+
+%D \starttypen 
+%D \defineXMLenvironment[test][a=1]
+%D   {\XMLownifequalelse{a}{2}{YES}{NO}}
+%D   {}
+%D 
+%D \defineXMLenvironment[test][a=1]
+%D   {\XMLifequalelse{test}{a}{1}{YES}{NO}}
+%D   {}
+%D 
+%D \startXMLdata
+%D <test a="1">test</test>
+%D \stopXMLdata
+%D \stoptypen  
 
 \def\XMLyes#1{\XMLownifequalelse{#1}{yes}{#1}{}}
 
diff --git a/tex/context/base/xtag-map.tex b/tex/context/base/xtag-map.tex
index 8eda9b74b..423a5a36d 100644
--- a/tex/context/base/xtag-map.tex
+++ b/tex/context/base/xtag-map.tex
@@ -122,40 +122,79 @@
 
 %D Element need a bit more work; \type {#4} consumes spaces.
 
+% \def\remapXMLunknownONE#1#2% name args
+%   {\ifremapXMLunknown\remapXMLone{\s!unknown}{#1 #2}\fi}
+% 
+% \def\remapXMLunknownTWO#1#2% name args
+%   {\ifremapXMLunknown\remapXMLtwo{\s!unknown}{#1 #2}\fi}
+% 
+% \def\remapXMLunknownTHREE#1#2% name args
+%   {\ifremapXMLunknown\remapXMLthree{\s!unknown/}{#1 #2}\fi}
+% 
+% \long\def\remapXMLelement#1#2 #3>#4% todo: we need to get rid of the end /
+%   {\ifcase\findendofXMLelement#2#3>%
+%      \if#1/%
+%        \expandafter\ifx\csname\@@XML\@@XMLmapping:#2:M\endcsname\relax
+%          \remapXMLunknownONE{#2}{}%
+%        \else
+%          \remapXMLone{#2}{}%
+%        \fi
+%      \else
+%        \expandafter\ifx\csname\@@XML\@@XMLmapping:#1#2:M\endcsname\relax
+%          \remapXMLunknownTWO{#1#2}{#3}%
+%        \else
+%          \remapXMLtwo{#1#2}{#3}%
+%        \fi
+%      \fi
+%    \else
+%      \expandafter\ifx\csname\@@XML\@@XMLmapping:#1#2:M\endcsname\relax
+%        \expandafter\ifx\csname\@@XML\@@XMLmapping:#1#2/:M\endcsname\relax
+%          \remapXMLunknownTHREE{#1#2}{#3}%
+%        \else
+%          \remapXMLthree{#1#2/}{#3}%
+%        \fi
+%      \else
+%        \remapXMLthree{#1#2}{#3}%
+%      \fi
+%    \fi#4}
+
+\def\remapXMLthreeempty#1%
+  {\remapXMLthree{#1/}}
+
 \def\remapXMLunknownONE#1#2% name args
-  {\ifremapXMLunknown\remapXMLone{\s!unknown}{#1 #2}\fi}
+  {\ifremapXMLunknown\remapXMLone\s!unknown{#1 #2}\fi}
 
 \def\remapXMLunknownTWO#1#2% name args
-  {\ifremapXMLunknown\remapXMLtwo{\s!unknown}{#1 #2}\fi}
+  {\ifremapXMLunknown\remapXMLtwo\s!unknown{#1 #2}\fi}
 
 \def\remapXMLunknownTHREE#1#2% name args
-  {\ifremapXMLunknown\remapXMLthree{\s!unknown/}{#1 #2}\fi}
+  {\ifremapXMLunknown\remapXMLthreeempty\s!unknown{#1 #2}\fi}
 
 \long\def\remapXMLelement#1#2 #3>#4% todo: we need to get rid of the end /
   {\ifcase\findendofXMLelement#2#3>%
      \if#1/%
        \expandafter\ifx\csname\@@XML\@@XMLmapping:#2:M\endcsname\relax
-         \remapXMLunknownONE{#2}{}%
+         \@EA\remapXMLunknownONE
        \else
-         \remapXMLone{#2}{}%
-       \fi
+         \@EA\remapXMLone
+       \fi{#2}\empty
      \else
        \expandafter\ifx\csname\@@XML\@@XMLmapping:#1#2:M\endcsname\relax
-         \remapXMLunknownTWO{#1#2}{#3}%
+         \@EA\remapXMLunknownTWO
        \else
-         \remapXMLtwo{#1#2}{#3}%
-       \fi
+         \@EA\remapXMLtwo
+       \fi{#1#2}{#3}%
      \fi
    \else
      \expandafter\ifx\csname\@@XML\@@XMLmapping:#1#2:M\endcsname\relax
        \expandafter\ifx\csname\@@XML\@@XMLmapping:#1#2/:M\endcsname\relax
-         \remapXMLunknownTHREE{#1#2}{#3}%
+         \@EAEAEA\remapXMLunknownTHREE
        \else
-         \remapXMLthree{#1#2/}{#3}%
+         \@EAEAEA\remapXMLthreeempty
        \fi
      \else
-       \remapXMLthree{#1#2}{#3}%
-     \fi
+       \@EA\remapXMLthree
+     \fi{#1#2}{#3}%
    \fi#4}
 
 \unexpanded\def\xmlr#1#2{\csname\@@XML\@@XMLmapping:#1:#2\endcsname}
diff --git a/tex/context/base/xtag-pre.tex b/tex/context/base/xtag-pre.tex
index f9d0afa09..1128708b1 100644
--- a/tex/context/base/xtag-pre.tex
+++ b/tex/context/base/xtag-pre.tex
@@ -2,7 +2,7 @@
 %D   [       file=xtag-pre,
 %D        version=2000.12.20,
 %D          title=\CONTEXT\ XML Support,
-%D       subtitle=Predefined Things
+%D       subtitle=Predefined Things,
 %D         author=Hans Hagen,
 %D           date=\currentdate,
 %D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-- 
cgit v1.2.3