summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/colo-ini.tex95
-rw-r--r--tex/context/base/cont-fil.tex3
-rw-r--r--tex/context/base/cont-it.tex6
-rw-r--r--tex/context/base/cont-log.tex27
-rw-r--r--tex/context/base/cont-new.tex281
-rw-r--r--tex/context/base/cont-old.tex2
-rw-r--r--tex/context/base/context.tex37
-rw-r--r--tex/context/base/core-buf.tex36
-rw-r--r--tex/context/base/core-des.tex51
-rw-r--r--tex/context/base/core-fig.tex44
-rw-r--r--tex/context/base/core-fil.tex40
-rw-r--r--tex/context/base/core-fnt.tex5
-rw-r--r--tex/context/base/core-gen.tex41
-rw-r--r--tex/context/base/core-grd.tex40
-rw-r--r--tex/context/base/core-hlp.tex71
-rw-r--r--tex/context/base/core-int.tex120
-rw-r--r--tex/context/base/core-itm.tex15
-rw-r--r--tex/context/base/core-job.tex376
-rw-r--r--tex/context/base/core-lst.tex225
-rw-r--r--tex/context/base/core-mar.tex4
-rw-r--r--tex/context/base/core-mat.tex355
-rw-r--r--tex/context/base/core-mis.tex1796
-rw-r--r--tex/context/base/core-nav.tex4
-rw-r--r--tex/context/base/core-not.tex139
-rw-r--r--tex/context/base/core-obj.tex7
-rw-r--r--tex/context/base/core-par.tex35
-rw-r--r--tex/context/base/core-pos.tex917
-rw-r--r--tex/context/base/core-ref.tex76
-rw-r--r--tex/context/base/core-reg.tex210
-rw-r--r--tex/context/base/core-rul.tex675
-rw-r--r--tex/context/base/core-sec.tex238
-rw-r--r--tex/context/base/core-spa.tex286
-rw-r--r--tex/context/base/core-syn.tex4
-rw-r--r--tex/context/base/core-sys.tex199
-rw-r--r--tex/context/base/core-tab.tex2
-rw-r--r--tex/context/base/core-tbl.tex2
-rw-r--r--tex/context/base/core-uti.tex10
-rw-r--r--tex/context/base/core-ver.tex21
-rw-r--r--tex/context/base/core-vis.tex10
-rw-r--r--tex/context/base/enco-ini.tex30
-rw-r--r--tex/context/base/font-ini.tex514
-rw-r--r--tex/context/base/hand-ini.tex2
-rw-r--r--tex/context/base/java-fld.tex47
-rw-r--r--tex/context/base/java-ini.tex2
-rw-r--r--tex/context/base/lang-ita.tex10
-rw-r--r--tex/context/base/lang-sla.tex8
-rw-r--r--tex/context/base/m-chart.tex127
-rw-r--r--tex/context/base/m-mathml.tex20
-rw-r--r--tex/context/base/m-steps.tex885
-rw-r--r--tex/context/base/m-units.tex2
-rw-r--r--tex/context/base/main-001.tex8023
-rw-r--r--tex/context/base/main-002.tex973
-rw-r--r--tex/context/base/main-003.tex830
-rw-r--r--tex/context/base/math-run.tex1
-rw-r--r--tex/context/base/math-tex.tex11
-rw-r--r--tex/context/base/meta-fig.tex16
-rw-r--r--tex/context/base/meta-ini.tex22
-rw-r--r--tex/context/base/meta-pag.tex86
-rw-r--r--tex/context/base/meta-txt.tex11
-rw-r--r--tex/context/base/mult-com.tex126
-rw-r--r--tex/context/base/mult-con.tex23
-rw-r--r--tex/context/base/mult-sys.tex4
-rw-r--r--tex/context/base/page-bck.tex457
-rw-r--r--tex/context/base/page-flt.tex1697
-rw-r--r--tex/context/base/page-imp.tex (renamed from tex/context/base/core-pag.tex)199
-rw-r--r--tex/context/base/page-ini.tex1511
-rw-r--r--tex/context/base/page-lay.tex1025
-rw-r--r--tex/context/base/page-lin.tex375
-rw-r--r--tex/context/base/page-log.tex236
-rw-r--r--tex/context/base/page-lyr.tex123
-rw-r--r--tex/context/base/page-mak.tex186
-rw-r--r--tex/context/base/page-mar.tex525
-rw-r--r--tex/context/base/page-mul.tex (renamed from tex/context/base/core-mul.tex)660
-rw-r--r--tex/context/base/page-new.tex199
-rw-r--r--tex/context/base/page-num.tex494
-rw-r--r--tex/context/base/page-one.tex413
-rw-r--r--tex/context/base/page-run.tex374
-rw-r--r--tex/context/base/page-set.tex1488
-rw-r--r--tex/context/base/page-sid.tex341
-rw-r--r--tex/context/base/page-txt.tex624
-rw-r--r--tex/context/base/regi-il1.tex223
-rw-r--r--tex/context/base/s-abr-01.tex259
-rw-r--r--tex/context/base/s-dtk-01.tex14
-rw-r--r--tex/context/base/s-map-01.tex10
-rw-r--r--tex/context/base/s-mod-00.tex102
-rw-r--r--tex/context/base/s-mod-01.tex94
-rw-r--r--tex/context/base/s-pre-00.tex2
-rw-r--r--tex/context/base/setupa.tex5
-rw-r--r--tex/context/base/setupb.tex191
-rw-r--r--tex/context/base/spec-dpm.tex22
-rw-r--r--tex/context/base/spec-dvi.tex11
-rw-r--r--tex/context/base/spec-fdf.tex44
-rw-r--r--tex/context/base/spec-ini.tex94
-rw-r--r--tex/context/base/spec-pdf.tex66
-rw-r--r--tex/context/base/spec-tpd.tex41
-rw-r--r--tex/context/base/supp-box.tex307
-rw-r--r--tex/context/base/supp-emp.tex2
-rw-r--r--tex/context/base/supp-eps.tex20
-rw-r--r--tex/context/base/supp-fil.tex15
-rw-r--r--tex/context/base/supp-lan.tex17
-rw-r--r--tex/context/base/supp-mis.tex22
-rw-r--r--tex/context/base/supp-mps.tex25
-rw-r--r--tex/context/base/supp-mrk.tex49
-rw-r--r--tex/context/base/supp-pdf.tex179
-rw-r--r--tex/context/base/supp-vis.tex18
-rw-r--r--tex/context/base/symb-ini.tex14
-rw-r--r--tex/context/base/syst-etx.tex2
-rw-r--r--tex/context/base/syst-ext.tex44
-rw-r--r--tex/context/base/syst-gen.tex170
-rw-r--r--tex/context/base/syst-new.tex70
-rw-r--r--tex/context/base/type-siz.tex7
-rw-r--r--tex/context/base/verb-ini.tex14
-rw-r--r--tex/context/base/x-fig-00.tex22
-rw-r--r--tex/context/base/x-fig-01.tex22
-rw-r--r--tex/context/base/xtag-ext.tex39
-rw-r--r--tex/context/base/xtag-ini.tex412
-rw-r--r--tex/context/base/xtag-map.tex555
-rw-r--r--tex/context/base/xtag-mea.tex152
-rw-r--r--tex/context/base/xtag-meb.tex124
-rw-r--r--tex/context/base/xtag-mec.tex28
-rw-r--r--tex/context/base/xtag-meh.tex166
-rw-r--r--tex/context/base/xtag-men.tex98
-rw-r--r--tex/context/base/xtag-meo.tex58
-rw-r--r--tex/context/base/xtag-mer.tex185
-rw-r--r--tex/context/base/xtag-mmc.tex1223
-rw-r--r--tex/context/base/xtag-mml.tex513
-rw-r--r--tex/context/base/xtag-mmp.tex472
-rw-r--r--tex/context/base/xtag-mxa.tex101
-rw-r--r--tex/context/base/xtag-mxb.tex55
-rw-r--r--tex/context/base/xtag-mxc.tex10
-rw-r--r--tex/context/base/xtag-mxh.tex67
-rw-r--r--tex/context/base/xtag-mxn.tex84
-rw-r--r--tex/context/base/xtag-mxo.tex14
-rw-r--r--tex/context/base/xtag-mxr.tex112
-rw-r--r--tex/context/base/xtag-run.tex2
-rw-r--r--tex/context/extra/setup-qr.tex6
136 files changed, 23082 insertions, 12796 deletions
diff --git a/tex/context/base/colo-ini.tex b/tex/context/base/colo-ini.tex
index 41233ed90..bb896e0fa 100644
--- a/tex/context/base/colo-ini.tex
+++ b/tex/context/base/colo-ini.tex
@@ -632,13 +632,51 @@
%D command. Later on we will explain the use of palets. We
%D define ourselves a color conditional first.
-\def\currentpalet{}
+% \let\currentpalet\empty
+%
+% \def\doifcolorelse#1%
+% {\doifdefinedelse{\??cr\currentpalet#1}}
+%
+% \def\getcurrentcolorspecs#1%
+% {\edef\currentcolorspecs{\getvalue{\??cr\currentpalet#1}}}
+
+\let\currentpalet\empty
+
+\beginETEX \ifcsname
\def\doifcolorelse#1%
- {\doifdefinedelse{\??cr\currentpalet#1}}
+ {\ifcsname\??cr\ifcsname\??cr\currentpalet#1\endcsname\currentpalet\fi#1\endcsname
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
+\def\getcurrentcolorspecs#1%
+ {\edef\currentcolorspecs%
+ {\csname\??cr
+ \ifcsname\??cr\currentpalet#1\endcsname\currentpalet\fi
+ #1\endcsname}}
+
+\endETEX
+
+\beginTEX
+
+\def\colorcsname#1\endcsname
+ {\csname\??cr
+ \@EA\ifx\csname\??cr\currentpalet#1\endcsname\relax\else\currentpalet\fi
+ #1\endcsname}
+
+\def\doifcolorelse#1%
+ {\@EA\ifx\colorcsname#1\endcsname
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
\def\getcurrentcolorspecs#1%
- {\edef\currentcolorspecs{\getvalue{\??cr\currentpalet#1}}}
+ {\edef\currentcolorspecs{\colorcsname#1\endcsname}}
+
+\endTEX
%D \macros
%D {localstartcolor,localstopcolor}
@@ -1145,17 +1183,17 @@
%D
%D \showsetup{\y!setuppalet}
-\def\currentpalet{}
+\let\currentpalet\empty
\def\setuppalet%
{\dosingleempty\dosetuppalet}
\def\dosetuppalet[#1]%
{\doifelsenothing{#1}
- {\def\currentpalet{}}
+ {\let\currentpalet\empty}
{\doifelsevaluenothing{\??pa#1}
{\showmessage{\m!colors}{7}{#1}%
- \def\currentpalet{}}
+ \let\currentpalet\empty}
{\def\currentpalet{#1:}}}}
%D \macros
@@ -1169,7 +1207,7 @@
%D
%D \showsetup{\y!showpalet}
-\fetchruntimecommand \showpalet {\f!coloprefix\s!run}
+\fetchruntimecommand \showpalet {\f!colorprefix\s!run}
%D \macros
%D {definecolorgroup}
@@ -1246,7 +1284,7 @@
%D
%D \showsetup{\y!showcolorgroup}
-\fetchruntimecommand \showcolorgroup {\f!coloprefix\s!run}
+\fetchruntimecommand \showcolorgroup {\f!colorprefix\s!run}
%D There are ten predefined color groups, like
%D \color[groen]{\em groen}, \color[rood]{\em rood},
@@ -1305,7 +1343,7 @@
%D
%D \showsetup{\y!comparepalet}
-\fetchruntimecommand \comparepalet {\f!coloprefix\s!run}
+\fetchruntimecommand \comparepalet {\f!colorprefix\s!run}
%D \macros
%D {comparecolorgroup}
@@ -1328,7 +1366,7 @@
%D
%D \showsetup{\y!comparecolorgroup}
-\fetchruntimecommand \comparecolorgroup {\f!coloprefix\s!run}
+\fetchruntimecommand \comparecolorgroup {\f!colorprefix\s!run}
%D \macros
%D {showcolor}
@@ -1344,7 +1382,7 @@
%D
%D \showsetup{\y!showcolor}
-\fetchruntimecommand \showcolor {\f!coloprefix\s!run}
+\fetchruntimecommand \showcolor {\f!colorprefix\s!run}
%D \macros
%D {negativecolorbox}
@@ -1386,20 +1424,39 @@
\newif\ifMPcmyk % \MPcmykfalse
+% \def\MPcolor#1%
+% {\ifMPgraphics
+% \@EA\@EA\@EA\doMPcolor\csname\??cr#1\endcsname:::::\end
+% \else
+% #1%
+% \fi}
+
+\beginTEX
+
\def\MPcolor#1%
{\ifMPgraphics
- \@EA\@EA\@EA\doMPcolor\csname\??cr#1\endcsname:::::\end
+ \@EA\@EA\@EA\doMPcolor\colorcsname#1\endcsname:::::\end
\else
#1%
\fi}
-% \def\doMPcolor#1:#2:#3:#4:#5:#6\end%
-% {\if #1R(#2,#3,#4)%
-% \else\if#1C(1-#2-#5,1-#3-#5,1-#4-#5)%
-% % \else\if#1C(1-#2+#5,1-#3+#5,1-#4+#5)%
-% \else\if#1S(#2,#2,#2)%
-% \else (0,0,0)%
-% \fi\fi\fi}
+\endTEX
+
+\beginETEX \ifcsname
+
+\def\MPcolor#1%
+ {\ifMPgraphics
+ \@EA\@EA\@EA\doMPcolor
+ \csname\??cr
+ \ifcsname\??cr\currentpalet#1\endcsname\currentpalet\fi
+ #1\endcsname
+ :::::\end
+ \else
+ #1%
+ \fi}
+
+\endETEX
+
\def\doMPcolor#1:#2:#3:#4:#5:#6\end
{\if #1R(#2,#3,#4)%
diff --git a/tex/context/base/cont-fil.tex b/tex/context/base/cont-fil.tex
index 2d27b9dad..d13131e45 100644
--- a/tex/context/base/cont-fil.tex
+++ b/tex/context/base/cont-fil.tex
@@ -21,6 +21,9 @@
\definefilesynonym [finance] [financ]
+\definefilesynonym [fig-base] [fig-00]
+\definefilesynonym [fig-make] [fig-01]
+
\definefilesynonym [pre-general] [pre-00]
\definefilesynonym [pre-original] [pre-01] % public
diff --git a/tex/context/base/cont-it.tex b/tex/context/base/cont-it.tex
index b5b020644..b689a31d4 100644
--- a/tex/context/base/cont-it.tex
+++ b/tex/context/base/cont-it.tex
@@ -1,8 +1,8 @@
%D \module
-%D [ file=cont-en,
+%D [ file=cont-it,
%D version=1997.08.19,
%D title=\CONTEXT,
-%D subtitle=\CONTEXT\ English Format Generation,
+%D subtitle=\CONTEXT\ Italian Format Generation,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
@@ -25,7 +25,7 @@
%\installlanguage [\s!uk] [\c!status=\v!start]
\installlanguage [\s!de] [\c!status=\v!start]
\installlanguage [\s!fr] [\c!status=\v!start]
-%\installlanguage [\s!es] [\c!status=\v!start]
+\installlanguage [\s!es] [\c!status=\v!start]
\installlanguage [\s!it] [\c!status=\v!start]
%\installlanguage [\s!nl] [\c!status=\v!start]
diff --git a/tex/context/base/cont-log.tex b/tex/context/base/cont-log.tex
index 8f608fb67..deffcd932 100644
--- a/tex/context/base/cont-log.tex
+++ b/tex/context/base/cont-log.tex
@@ -41,7 +41,7 @@
{C%
\CMRkern-.0333emo%
\CMRkern-.0333emn%
- \CMRkern-.0333em\TeX%
+ \CMRkern-.1667em\TeX%
\CMRkern-.0333emt}
\def\PPCHTeX%
@@ -112,6 +112,28 @@
10 at \currentfontscale\bodyfontsize
\logofont}
+% \definefontsynonym [MetaLogo] [logo10]
+% \definefontsynonym [MetaLogoBold] [logobf10]
+% \definefontsynonym [MetaLogoSlanted] [logosl10]
+% \definefontsynonym [MetaLogoItalic] [logosl10]
+% \definefontsynonym [MetaLogoBoldSlanted] [logobf10]
+% \definefontsynonym [MetaLogoBoldtalic] [logobf10]
+%
+% \def\setMFPfont{\symbolicfont{MetaLogo}}
+
+\def\symbolicfont#1{\definedfont[\glyphfontfile{#1} sa *]}
+
+\def\setMFPfont% more sensitive for low level changes
+ {\font\logofont=logo%
+ \ifx\fontalternative\c!bf\else
+ \ifx\fontalternative\c!sl\else
+ \ifx\fontalternative\c!sl\else
+ \ifx\fontalternative\c!bs\else
+ \ifx\fontalternative\c!bi\else
+ \fi\fi\fi\fi\fi
+ 10 at \currentfontscale\bodyfontsize
+ \logofont}
+
%\unexpanded\def\MetaFont%
% {\hbox{\setMFPfont METAFONT}}
%
@@ -177,4 +199,7 @@
\let\PDFTEX \pdfTeX
\let\PDFETEX \pdfeTeX
+\def\XML {XML}
+\def\MATHML {MathML}
+
\protect \endinput
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 935e2229b..18e76bf7c 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -13,212 +13,109 @@
% manual : offsetbox alignbox
-\def\placefloats{\doflushfloats} % keep this one
-
\unprotect
-
-\def\definieertekst%
- {\doseventupleempty\dodefinieertekst}
-
-\def\dodefinieertekst[#1][#2][#3][#4][#5][#6][#7]%
- {\ifseventhargument
- \setvalue{\??tk#2#3#1}{\dosixtupleempty\dodododoteksten[#2][#3][#4][#5][#6][#7]}%
- \else\ifsixthargument
- \setvalue{\??tk #2#1}{\dosixtupleempty\dodododoteksten[#2][#3][#4][#5][#6]}%
- \else\iffifthargument
- \setvalue{\??tk#2#3#1}{\dosixtupleempty\dodododoteksten[#2][#3][#4][#5]}%
- \else\iffourthargument
- \setvalue{\??tk #2#1}{\dosixtupleempty\dodododoteksten[#2][#3][#4]}%
- \else
- \setvalue{\??tk #2#1}{\dosixtupleempty\dodododoteksten[#2][#3]}%
- \fi\fi\fi\fi}
-
-\def\plaatslayoutregel#1#2% % handelt o.b.v. tekst
- {%\message{#1: \getvalue{\??tk#1\v!tekst\c!status}}\wait
- \ExpandFirstAfter\processaction
- [\getvalue{\??tk#1\v!tekst\c!status}]
- [ \v!geen=>,
- \v!hoog=>, % is reset later on
- \v!start=>\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
- \doplaatslayoutregel{#1}{#2},
- \v!stop=>\vskip#2\relax,
- \v!leeg=>\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
- \vskip#2\relax,
- \v!geenmarkering=>\bgroup
- \setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
- \let\dohaalmarkering=\nohaalmarkering
- \doplaatslayoutregel{#1}{#2}%
- \egroup,
- \v!normaal=>\doplaatslayoutregel{#1}{#2},
- \s!default=>\doplaatslayoutregel{#1}{#2},
- \s!unknown=>\bgroup % new
- \setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
-% \getvalue{\??tk#1\commalistelement}%
-\setlocallayoutline{#1\commalistelement}%
-\setlocallayoutline{#1\v!tekst\commalistelement}%
-\setlocallayoutline{#1\v!marge\commalistelement}%
-\setlocallayoutline{#1\v!rand\commalistelement}%
- \doplaatslayoutregel{#1}{#2}%
- \egroup]}
-
-\def\setlocallayoutline#1%
- {\ifundefined{\??tk#1}\else\getvalue{\??tk#1}\fi}
-
-% permits \stoptext inside module
-
-\def\dousemodules[#1]%
- {\doifelsenothing{#1}
- {\let\next\relax}
- {\def\next{\processcommalist[#1]\dodousemodules}}
- \next}
-
-\def\dododousemodules#1#2% we need to protect \next somehow
- {\relax
- \ifconditional\moduleisloaded
- \let\next\relax
- \else
- \makeshortfilename[#1\truefilename{#2}]%
- \doifundefinedelse{\shortfilename\v!aan}
- {\setgvalue{\shortfilename\v!aan}{}%
- \def\next
- {\startreadingfile
- \readsysfile{\shortfilename}%
- {\showmessage{\m!systems}{5}{#2}%
- \settrue\moduleisloaded}%
- {}%
- \stopreadingfile}}
- {\showmessage{\m!systems}{7}{#2}%
- \settrue\moduleisloaded
- \let\next\relax}%
- \fi
- \next}
-
+
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks and new features.
\writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!}
+\def\checkframedtext%
+ {\ifinsidefloat
+ \localhsize\hsize
+ \else\ifdim\sidefloatvsize>\zeropoint % will be proper handle
+ % \strut % rather clean way to invoke the sidefloat OTR
+ % \setbox0=\lastbox % and get the widths set, so from now on we
+ % \setlocalhsize % can have framed texts alongside sidefloats
+ \checksidefloat
+ \setlocalhsize
+ \advance\localhsize-\hangindent
+ \else
+ \localhsize\hsize
+ \fi \fi}
+
+\long\def\parseTR[#1][#2]#3\eTR% [#2] is dummy that kills spaces
+ {\def\currentcol{0}\increment\maximumrow
+ \setupTABLE[\v!rij][\maximumrow][#1]#3}
+
+\def\obeyfollowingtoken{{}} % end \cs scanning
+
+\def\gobbleparameters{\doquadrupleempty\dogobbleparameters}
+\def\dogobbleparameters[#1][#2][#3][#4]{}
+
+% faster, and looks okay
+
+\dostepwiserecurse{0}{255}{1}
+ {\@EA\chardef\csname-\recurselevel\endcsname=\recurselevel}
+
+\newtoks\withminorcharacters
+\newtoks\withlowercharacters
+\newtoks\withuppercharacters
+
+% \thewithcharacter#1 % self
+
+\dostepwiserecurse{0}{31}{1}
+ {\expanded
+ {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname
+ \noexpand\to\withminorcharacters}}
+
+\dostepwiserecurse{32}{127}{1}
+ {\expanded
+ {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname
+ \noexpand\to\withlowercharacters}}
+
+\dostepwiserecurse{128}{255}{1}
+ {\expanded
+ {\appendtoks\noexpand\withcharacter\csname-\recurselevel\endcsname
+ \noexpand\to\withuppercharacters}}
+
+\def\doassigncatcodes#1%
+ {\def\withcharacter##1{\catcode##1#1}%
+ \the\withminorcharacters
+ \the\withlowercharacters
+ \ifeightbitcharacters\the\withuppercharacters\fi}
+
+\def\makeallother%
+ {\doassigncatcodes\@@other}
+
+\makeallothertoks\emptytoks
+
+\chardef\obeyedlccode=`. % so <32 and >127 chars become .
+
+\def\obeylccodes%
+ {\def\withcharacter##1{\lccode##1##1}%
+ \the\withlowercharacters
+ \def\withcharacter##1{\lccode##1\obeyedlccode}%
+ \the\withminorcharacters
+ \ifeightbitcharacters\the\withuppercharacters\fi}
+
\definesystemvariable{en}
\def\setupenv{\dodoubleargument\rawgetparameters[\??en]}
\def\doifenvelse#1{\doifdefinedelse{\??en#1}}
-\def\env#1{\getvalue{\??en#1}} % geen (!) test hier
+% \def\envvar#1#2{\ifundefined{\??en#1}#2\else\getvalue{\??en}\fi}
-\def\inputfilename{\@@svinputfile}
+\def\env#1{\getvalue{\??en#1}}
-\setupsystem[inputfile=\outputfilename] % yes or no
-
-% already patched
-
-\def\setdisplaydimensions%
- {\displayindent=\leftdisplayskip
- \advance\displayindent\leftdisplaymargin
- \displaywidth=\hsize
- \ifdim\hangindent>\!!zeropoint
- \advance\displayindent\hangindent
- \else
- \advance\displaywidth\hangindent
- \fi
- \advance\displaywidth-\displayindent
- \advance\displaywidth-\rightdisplayskip
- \advance\displaywidth-\rightdisplaymargin}
-
-% already patched
-
-\def\dochecksidefloat%
- {\progresssidefloat
- \ifdim\!!heighta>\!!zeropoint
-% \advance\!!heighta by \sidefloatbottomskip
-% \!!counta=\!!heighta
-\scratchdimen=\!!heighta
-\advance\scratchdimen \ht\strutbox
-\!!counta=\scratchdimen
- \divide\!!counta by \baselineskip
- \ifnum\!!counta>0
- \ifrightfloat
- \hangindent=-\sidefloatwidth
- \else
- \hangindent=\sidefloatwidth
- \fi
- \hangafter=-\!!counta
- \fi
- \setsidefloatparagraph
- \else
- \resetsidefloatparagraph
- \fi
- \parskip=\tussenwit}
-
-
-\def\setsidefloat%
- {\vbox{\strut}\vskip-\lineheight
- \kern\sidefloattopskip
- \edef\presidefloatdepth{\the\prevdepth}%
- \nointerlineskip
- \bgroup
- \everypar={}%
- \parskip=\!!zeropoint
- \logsidefloat
- \ifrightfloat
- \hfill
- \ifmarginfloat
- \rlap{\hskip\rechtermargeafstand\hskip\rightskip\unhbox\floatbox}%
- \else
- \unhbox\floatbox
- \fi
- \else
- \noindent
- \ifmarginfloat
- \llap{\unhbox\floatbox\hskip\leftskip\hskip\linkermargeafstand}%
- \else
- \unhbox\floatbox
- \fi
- \hfill
- \fi
- \egroup
- \par
- \kern-\sidefloatheight
- \penalty10001
- \normalbaselines
- \prevdepth=\presidefloatdepth
- %\noindent
- \resetsidefloatparagraph
- \ignorespaces}
-
-% already patched
-
-\def\doapplyfiguresize%
- {\doifelsenothing{\@@efmaxhoogte}
- {\figurevsize=\teksthoogte
- \ifinner
- \figurevsize =\vsize % \teksthoogte =\vsize
- \scratchdimen=\vsize % \scratchdimen=\teksthoogte
- \else\ifinsidefloat
- \figurevsize =\vsize % \teksthoogte =\vsize
- \scratchdimen=\vsize % \scratchdimen=\teksthoogte
- \else\ifinpagebody
- \figurevsize =\vsize % \teksthoogte =\vsize
- \scratchdimen=\vsize % \scratchdimen=\teksthoogte
- \else
- \ifdim\pagegoal<\maxdimen
- \ifdim\pagetotal<\pagegoal
- \scratchdimen=\pagegoal
- \advance\scratchdimen by -\pagetotal
- \else
- \scratchdimen=\figurevsize % \teksthoogte
- \fi
- \else
- \scratchdimen=\figurevsize % \teksthoogte
- \fi
- \fi\fi\fi}
- {\figurevsize=\@@efmaxhoogte}%
- \doifelsenothing{\@@efhoogte}
- {\edef\@@efvsize{\the\scratchdimen}}
- {\let\@@efvsize=\@@efhoogte}%
- \doifelsenothing{\@@efbreedte}
- {\edef\@@efhsize{\the\hsize}}
- {\let\@@efhsize=\@@efbreedte}}
+\beginTEX
+
+\def\envvar#1#2%
+ {\@EA\ifx\csname\??en#1\endcsname\relax
+ #2\else\csname\??en#1\endcsname
+ \fi}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\def\envvar#1#2%
+ {\ifcsname\??en#1\endcsname
+ \csname\??en#1\endcsname\else#2%
+ \fi}
+
+\endETEX
\def\setvariables%
{\dodoubleargument\dosetvariables}
diff --git a/tex/context/base/cont-old.tex b/tex/context/base/cont-old.tex
index 6fb82c4dd..4e364fbff 100644
--- a/tex/context/base/cont-old.tex
+++ b/tex/context/base/cont-old.tex
@@ -64,7 +64,7 @@
% english:
-\substitutecommand \setupformulas \setupformulae
+%substitutecommand \setupformulas \setupformulae
%substitutecommand \useexternalfigures \setupexternalfigures
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 41ece979b..4cbd091d8 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -13,7 +13,7 @@
\catcode`\{=1 \catcode`\}=2
-\def\contextversion{2001.4.30}
+\def\contextversion{2001.7.2}
%D Welcome to the main module. When this module is ran through
%D \type{initex} or \type{tex -i} or \type{whatevertex} using
@@ -171,18 +171,38 @@
\input core-des.tex
\input core-mat.tex
\input core-syn.tex
-\input core-mul.tex % moved
+%input core-mul.tex % moved
\input core-spa.tex
-\input main-001.tex % still to be split
+\input core-sys.tex
+
+% experimental otr
+
+\input page-ini.tex
+\input page-one.tex
+\input page-lay.tex
+\input page-log.tex
+\input page-txt.tex
+\input page-sid.tex
+\input page-flt.tex
+\input page-mul.tex
+\input page-set.tex
+\input page-lyr.tex
+\input page-mak.tex
+\input page-num.tex
+\input page-lin.tex
+\input page-mar.tex
+\input page-bck.tex
+
+\input core-job.tex
+
+% so far
+
\input core-sec.tex
-\input core-pag.tex
+\input page-imp.tex
\input core-tbl.tex
-\input core-mis.tex
\input core-int.tex
\input core-ntb.tex
-\input page-lyr.tex
-
%D Like languages, fonts, encodings and symbols, \METAPOST\
%D support is also organized in its own class of modules.
@@ -226,8 +246,7 @@
\input core-fnt.tex
\input core-not.tex
-\input main-002.tex % still to be split
-\input main-003.tex % still to be split
+\input core-mis.tex
\input core-fig.tex % after page body
\input core-par.tex
diff --git a/tex/context/base/core-buf.tex b/tex/context/base/core-buf.tex
index a43a8acb7..e68c48f76 100644
--- a/tex/context/base/core-buf.tex
+++ b/tex/context/base/core-buf.tex
@@ -174,22 +174,40 @@
%D For Willy's nested commented buffers, we need the \type
%D {\delcharacter} trick.
-\def\processnextbufferline#1#2#3%
+% \def\processnextbufferline#1#2#3%
+% {\relax % checken waarom eerdere macro dit nodig heeft / supp-mps run
+% \convertargument#1 \to\next
+% \doifinstringelse{\delcharacter\texcommentsymbol}{\delcharacter\next}
+% {\def\next{#3}}
+% {\doifinstringelse{\endofblock}{\next}
+% {\ifnum\nestedbufferlevel=0\relax % \relax ?
+% \def\next{#2}%
+% \else
+% \decrement\nestedbufferlevel\relax
+% \def\next{#3}%
+% \fi}
+% {\doifinstringelse{\beginofblock}{\next}
+% {\increment\nestedbufferlevel\relax
+% \def\next{#3}}
+% {\def\next{#3}}}}%
+% \next}
+
+\def\processnextbufferline#1% needs testing ! ! ! !
{\relax % checken waarom eerdere macro dit nodig heeft / supp-mps run
\convertargument#1 \to\next
\doifinstringelse{\delcharacter\texcommentsymbol}{\delcharacter\next}
- {\def\next{#3}}
- {\doifinstringelse{\endofblock}{\next}
- {\ifnum\nestedbufferlevel=0\relax % \relax ?
- \def\next{#2}%
+ {\let\next\secondoftwoarguments}
+ {\doifincsnameelse{\endofblock}{\next}
+ {\ifnum\nestedbufferlevel=0
+ \let\next\firstoftwoarguments
\else
\decrement\nestedbufferlevel\relax
- \def\next{#3}%
+ \let\next\secondoftwoarguments
\fi}
- {\doifinstringelse{\beginofblock}{\next}
+ {\doifincsnameelse{\beginofblock}{\next}
{\increment\nestedbufferlevel\relax
- \def\next{#3}}
- {\def\next{#3}}}}%
+ \let\next\secondoftwoarguments}
+ {\let\next\secondoftwoarguments}}}%
\next}
\def\dostartbuffer%
diff --git a/tex/context/base/core-des.tex b/tex/context/base/core-des.tex
index d4fbbb670..f5d34c0b0 100644
--- a/tex/context/base/core-des.tex
+++ b/tex/context/base/core-des.tex
@@ -61,29 +61,9 @@
\s!default=>\let\next=#2]%
\next{#1}}
-% \def\@@definitielinkspure#1[#2]#3%
-% {\@@dostartdefinitie{#1}[#2]{#3}%
-% \advance\leftskip by \!!widtha
-% \@@makedefinitiepurebox{#1}\raggedright%
-% \advance\leftskip by \!!widthb
-% \llap
-% {\hbox to \leftskip{\copy\@@definitiebox\hss}}% copy ?
-% \@@dodefinitie{#1}}
-%
-% \def\@@definitierechtspure#1[#2]#3%
-% {\@@dostartdefinitie{#1}[#2]{#3}%
-% \advance\rightskip by \!!widtha
-% \@@makedefinitiepurebox{#1}\raggedleft%
-% \rlap
-% {\hskip\hsize
-% \hskip-\leftskip
-% \hskip-\rightskip
-% \copy\@@definitiebox}%
-% \advance\rightskip by \!!widthb
-% \@@dodefinitie{#1}}
-
\def\@@definitielinkspure#1[#2]#3%
{\@@dostartdefinitie{#1}[#2]{#3}%
+ \noindent\ignorespaces
\leftskip\@@leftdefinitieskip
\rightskip\@@rightdefinitieskip
\advance\leftskip by \!!widtha
@@ -97,6 +77,7 @@
\def\@@definitierechtspure#1[#2]#3%
{\@@dostartdefinitie{#1}[#2]{#3}%
+ \noindent\ignorespaces
\leftskip\@@leftdefinitieskip
\rightskip\@@rightdefinitieskip
\advance\rightskip by \!!widtha
@@ -127,6 +108,7 @@
\advance\!!widtha by \!!widthb
\hangindent=\!!widtha
\@@makedefinitiehangbox{#1}{\raggedright}{\advance\rightskip by \!!widthb}%
+ \noindent\ignorespaces
\llap
{\dontshowcomposition
\vtop to \!!zeropoint{\box\@@definitiebox}}%
@@ -138,6 +120,7 @@
\advance\!!widtha by \!!widthb
\hangindent=-\!!widtha
\@@makedefinitiehangbox{#1}{\raggedleft}{\advance\leftskip by \!!widthb}%
+ \noindent\ignorespaces
\rlap
{\mindermeldingen
\dontshowcomposition
@@ -166,20 +149,12 @@
\hangafter=-\noflines}
{\hangafter=-\getvalue{\??dd#1\c!hang}}}%
-%\setvalue{@@definitie\v!boven}#1[#2]#3%
-% {%\pagina[\v!voorkeur]% % Weg ermee!
-% \dosomebreak{\goodbreak}% % Dit is beter en nodig!
-% \@@dostartdefinitie{#1}[#2]{\let\\=\space#3}%
-% \copy\@@definitiebox
-% \nobreak
-% \getvalue{\??dd#1\c!tussen}%
-% \@@dodefinitie{#1}}
-
\setvalue{@@definitie\v!boven}#1[#2]#3%
{%\pagina[\v!voorkeur]% % Weg ermee!
%\dosomebreak{\goodbreak}% % Dit is beter en nodig!
\dohandelpaginaafX1 % En dit moet het maar worden.
\@@dostartdefinitie{#1}[#2]{\let\\=\space#3}%
+ \noindent\ignorespaces
\copy\@@definitiebox\par
\nobreak
\getvalue{\??dd#1\c!tussen}%
@@ -188,33 +163,39 @@
\setvalue{@@definitie\v!inmarge}#1[#2]#3%
{\@@dostartdefinitie{#1}[#2]{#3}%
+ \noindent\ignorespaces
\inmarge{\unhcopy\@@definitiebox}%
\@@dodefinitie{#1}}
\setvalue{@@definitie\v!inlinker}#1[#2]#3%
{\@@dostartdefinitie{#1}[#2]{#3}%
+ \noindent\ignorespaces
\inlinker{\unhcopy\@@definitiebox}%
\@@dodefinitie{#1}}
\setvalue{@@definitie\v!inrechter}#1[#2]#3%
{\@@dostartdefinitie{#1}[#2]{#3}%
+ \noindent\ignorespaces
\inrechter{\unhcopy\@@definitiebox}%
\@@dodefinitie{#1}}
\def\@@definitieaanelkaarpassend#1[#2]#3%
{\@@dostartdefinitie{#1}[#2]{#3}%
+ \noindent\ignorespaces
\unhcopy\@@definitiebox
\hskip\!!widthb % toegevoegd
\@@dodefinitie{#1}}
\def\@@definitieaanelkaarruim#1[#2]#3%
{\@@dostartdefinitie{#1}[#2]{#3}%
+ \noindent\ignorespaces
\unhcopy\@@definitiebox
\hskip\!!widthb \!!plus .5\!!widthb \!!minus .25\!!widthb
\@@dodefinitie{#1}}
\def\@@definitieaanelkaarbreed#1[#2]#3%
{\@@dostartdefinitie{#1}[#2]{#3}%
+ \noindent\ignorespaces
\hbox to \!!widtha
{\unhcopy\@@definitiebox\hss}%
\hskip\!!widthb
@@ -233,6 +214,7 @@
% \setvalue{@@definitie\v!hangend}#1[#2]#3%
% {\skip0=-\leftskip % uggly trick
% \@@dostartdefinitie{#1}[#2]{#3}% % adds \c!marge to \leftskip
+% \noindent\ignorespaces
% \advance\skip0 by \leftskip % but useful
% \ifdim\skip0=\!!zeropoint
% \skip0=1.5em % just some default
@@ -250,6 +232,7 @@
\setvalue{@@definitie\v!hangend}#1[#2]#3%
{\@@dostartdefinitie{#1}[#2]{#3}% % adds \c!marge to \leftskip
+ \noindent\ignorespaces
\advance\leftskip by -\leftskipadaption
\ifdim\leftskipadaption=\!!zeropoint
\leftskipadaption=1.5em % just some default
@@ -301,9 +284,7 @@
% {\getvalue{\??dd#1\c!tekst}\getvalue{\??dd#1\c!monster}}}}
% {\!!widthb}%
% %\getvalue{\??dd#1\s!do\c!lokaal}%
-% \parindent=\!!zeropoint\relax
-% \noindent
-% \ignorespaces}
+% \parindent=\!!zeropoint\relax} % \noindent\ignorespaces
%D A new key 'titeluitlijnen' in definitions.
@@ -350,9 +331,7 @@
\chardef\insidedefinition=1
\or
\chardef\insidedefinition=2
- \fi
- \noindent
- \ignorespaces}
+ \fi} % now happens elsewhere : \noindent\ignorespaces
\def\@@stopdefinitie#1%
{\par
diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex
index ea9789f0b..fe53c70fe 100644
--- a/tex/context/base/core-fig.tex
+++ b/tex/context/base/core-fig.tex
@@ -276,6 +276,8 @@
%D
%D Should be a special!
+% never change the vsize / hsize here, is taken from env
+
\def\dogetfiguresizetex#1#2#3#4#5#6% file pagina ...
{\doifinsetelse{\@@efextension}{\c!tex,\c!tmp}
{\ifx\@@efcurrentpath\empty\executedfalse\else\executedtrue\fi}
@@ -845,7 +847,7 @@
% old \c!achtergrond=,\c!achtergrondkleur=,\c!achtergrondraster=\@@rsraster,
% old \c!hoek=,\c!straal=.5\korpsgrootte,\c!kader=\v!uit,
\c!pagina=0,\c!sturing=\v!nee,\c!preview=\v!nee,\c!herhaal=\v!nee,
-\c!maxbreedte=\@@exmaxbreedte,\c!maxhoogte=\@@exmaxhoogte,
+ \c!maxbreedte=\@@exmaxbreedte,\c!maxhoogte=\@@exmaxhoogte,
\c!schaal=,\c!breedte=,\c!hoogte=,\c!scherm=,
\c!factor=,\c!hfactor=,\c!bfactor=]%
\doif{\@@efextension}{\c!mov}{\presetfiguremov}%
@@ -871,6 +873,12 @@
\c!avi=>\presetfigureavi,
\c!mov=>\presetfiguremov]%
\edef\figuretypes{\figuretypes,\c!tex}%
+ \ifx\@@eftype\c!tex
+ % Since tex code can have positional stuff and worse,
+ % we want to avoid interference with how objects end
+ % up in files, therefore:
+ \let\@@efobject\v!nee
+ \fi
\doifelse{\@@efobject}{\v!nee}
{\donefalse}
{\doifspecialavailableelse\dostartscaling
@@ -1321,9 +1329,9 @@
\scratchdimen=\@@exoffset
\dimen0=\figurewidth \advance\dimen0 2\scratchdimen\edef\figurewidth {\the\dimen0}
\dimen0=\figureheight\advance\dimen0 2\scratchdimen\edef\figureheight{\the\dimen0}
- \definieerpapierformaat
+ \definepapersize
[\s!dummy][\c!breedte=\figurewidth,\c!hoogte=\figureheight]
- \stelpapierformaatin
+ \setuppapersize
[\s!dummy][\s!dummy]
\setupcolors
[\c!status=\v!start]
@@ -1376,7 +1384,7 @@
\def\efcomment#1(#2,#3)#4(#5,#6)% {kader}(x,y)(h,b)[...]{tekst}
{\def\complexefdocomment[##1]##2%
- {\positioneer(#2,#3)%
+ {\position(#2,#3)%
{\setnostrut
\framed
[\c!breedte=#5\efxsteps,
@@ -1400,7 +1408,7 @@
{#4}}
\def\effigure#1%
- {\positioneer(0,0){\getvalue{#1}}}
+ {\position(0,0){\getvalue{#1}}}
\def\efdoarea(#1,#2)#3#4% (h,b){kader}{tekst}
{\bgroup
@@ -1419,9 +1427,9 @@
\def\efmark(#1,#2)#3(#4,#5)#6[#7]%
{\advance\efreference by 1
- \positioneer(#1,#2)
+ \position(#1,#2)
{\hbox{\the\efreference}}%
- \positioneer(#1,#2)
+ \position(#1,#2)
{\gotosomeinternal
{\s!vwb}{#7}{\realfolio}
{\efdomarker(#4,#5){\v!aan}{\thisissomeinternal{\s!vwa}{#7}}}}}
@@ -1463,20 +1471,20 @@
{\useexternalfigure[\s!dummy][#2][#3,#5]%
\externalfigure[\s!dummy]}%
\calculateefsteps
- \startpositioneren
+ \startpositioning
\def\referring(##1,##2)##3(##4,##5)##6[##7]%
- {\positioneer(##1,##2)
+ {\position(##1,##2)
{\efgoto(##4,##5){\@@exhokjes}[##7]}}%
\def\marking(##1,##2)##3(##4,##5)##6[##7]%
- {\positioneer(##1,##2)
+ {\position(##1,##2)
{\efthisis(##4,##5){\@@exhokjes}[##7]}}%
\def\remark%
{\efnocomment}%
\def\colorbar##1[##2]%
{}%
- \positioneer(0,0){\box0}%
+ \position(0,0){\box0}%
\linewidth=1pt
- \stelpositionerenin
+ \setuppositioning
[\c!eenheid=pt,
\c!xschaal=\withoutpt{\the\efxsteps},
\c!yschaal=\withoutpt{\the\efysteps},
@@ -1490,7 +1498,7 @@
\def\colorbar##1[##2]%
{\makecolorbar[##2]}%
\ignorespaces#4%
- \stoppositioneren
+ \stoppositioning
\box\colorbarbox}}
\def\dodostartfigure[#1][#2][#3]#4\stopfigure%
@@ -1521,11 +1529,11 @@
\efreference=0
\setbox0=\vbox
{\hsize240pt
- \startpositioneren
+ \startpositioning
\calculateefsteps
- \positioneer(0,0)
+ \position(0,0)
{\box0}%
- \positioneer(0,0)
+ \position(0,0)
{\rooster
[\c!nx=\@@exxmax,
\c!dx=\withoutpt{\the\efxsteps},
@@ -1536,14 +1544,14 @@
\c!schaal=1,
\c!offset=\v!nee,
\c!eenheid=pt]}%
- \stelpositionerenin%
+ \setuppositioning
[\c!eenheid=pt,
\c!xschaal=\withoutpt{\the\efxsteps},
\c!yschaal=\withoutpt{\the\efysteps},
\c!factor=1]%
\linewidth=1pt
\ignorespaces#4\relax
- \stoppositioneren
+ \stoppositioning
\vfill}%
\efreference=0
\def\referring%
diff --git a/tex/context/base/core-fil.tex b/tex/context/base/core-fil.tex
index 9e47412d2..279e8f3f2 100644
--- a/tex/context/base/core-fil.tex
+++ b/tex/context/base/core-fil.tex
@@ -135,38 +135,48 @@
%D \showsetup{\y!usemodule}
%D
%D More information on the specific modules can be found in
-%D their dedicated manuals.
+%D their dedicated manuals. We use \type {\next} so that we
+%D can \type {\end} in modules.
\newconditional\moduleisloaded
-\def\dododousemodules#1#2%
- {\ifconditional\moduleisloaded\else
+\def\dododousemodules#1#2% no \unprotect/\protect when loading,
+ {\relax % since we need to use ? ! unprotected
+ \ifconditional\moduleisloaded % sometimes (see xtag-map)
+ \let\next\relax
+ \else
\makeshortfilename[#1\truefilename{#2}]%
\doifundefinedelse{\shortfilename\v!aan}
{\setgvalue{\shortfilename\v!aan}{}%
- \startreadingfile
- \readsysfile{\shortfilename}%
- {\showmessage{\m!systems}{5}{#2}%
- \settrue\moduleisloaded}%
- {}%
- \stopreadingfile}
+ \def\next
+ {\startreadingfile
+ \readsysfile{\shortfilename}%
+ {\showmessage{\m!systems}{5}{#2}%
+ \settrue\moduleisloaded}%
+ {}%
+ \stopreadingfile}}
{\showmessage{\m!systems}{7}{#2}%
- \settrue\moduleisloaded}%
- \fi}
+ \settrue\moduleisloaded
+ \let\next\relax}%
+ \fi
+ \next}
\def\dodousemodules#1%
{\setfalse\moduleisloaded
- \dododousemodules\f!moduleprefix {#1}%
+ \dododousemodules\f!moduleprefix {#1}%
+ \dododousemodules\f!privateprefix{#1}%
\dododousemodules\f!styleprefix {#1}%
\dododousemodules\f!xstyleprefix {#1}%
- \dododousemodules\f!privateprefix{#1}%
+ \dododousemodules\f!thirdprefix {#1}%
\ifconditional\moduleisloaded\else
\showmessage{\m!systems}{6}{#1}%
\fi}
\def\dousemodules[#1]%
- {\doifsomething{#1}{\processcommalist[#1]\dodousemodules}%
- }% \enablelanguagespecifics[\currentmainlanguage]}
+ {\doifelsenothing{#1}
+ {\let\next\relax}
+ {\def\next{\processcommalist[#1]\dodousemodules}}
+ \next}
\def\usemodules%
{\dosingleargument\dousemodules}
diff --git a/tex/context/base/core-fnt.tex b/tex/context/base/core-fnt.tex
index 8d9119f25..cec75eb9e 100644
--- a/tex/context/base/core-fnt.tex
+++ b/tex/context/base/core-fnt.tex
@@ -622,6 +622,11 @@
\c!lijndikte=\linewidth,
\c!onderoffset=1.5pt,
\c!bovenoffset=2.5pt]
+
+%D ? ? ?
+
+\stelkoppeltekenin
+ [\c!teken=\compoundhyphen]
\protect
diff --git a/tex/context/base/core-gen.tex b/tex/context/base/core-gen.tex
index 3876db095..0c411a621 100644
--- a/tex/context/base/core-gen.tex
+++ b/tex/context/base/core-gen.tex
@@ -66,7 +66,7 @@
[ \v!klein=>#2=#3,
\v!middel=>#2=#4,
\v!groot=>#2=#5,
- \v!geen=>#2=\!!zeropoint,
+ \v!geen=>#2=\zeropoint,
-\v!klein=>#2=-#3,
-\v!middel=>#2=-#4,
-\v!groot=>#2=-#5,
@@ -95,6 +95,7 @@
%D {\setvalue{\@@dimension\v!klein}{#3}%
%D \setvalue{\@@dimension\v!middel}{#4}%
%D \setvalue{\@@dimension\v!groot}{#5}%
+%D \setvalue{\@@dimension\v!geen}{\!!zeropoint}%
%D \setvalue{\@@negdimension\v!klein}{-#3}%
%D \setvalue{\@@negdimension\v!middel}{-#4}%
%D \setvalue{\@@negdimension\v!groot}{-#5}%
@@ -103,6 +104,35 @@
%D {#2=\getvalue{\@@dimension#1}}
%D {#2=#1}}
%D \stoptypen
+%D
+%D Let's give this a try:
+
+\let\nopv!geen \v!geen
+\let\posv!groot \v!groot
+\let\posv!middel \v!middel
+\let\posv!klein \v!klein
+\edef\negv!groot {-\v!groot }
+\edef\negv!middel{-\v!middel}
+\edef\negv!klein {-\v!klein }
+
+\def\assigndimension#1#2#3#4#5%
+ {\edef\!!stringa{#1}%
+ \ifx\!!stringa\nopv!geen #2=\zeropoint\else
+ \ifx\!!stringa\posv!groot #2=#5\else
+ \ifx\!!stringa\posv!middel#2=#4\else
+ \ifx\!!stringa\posv!klein #2=#3\else
+ \ifx\!!stringa\negv!groot #2=-#5\else
+ \ifx\!!stringa\negv!middel#2=-#4\else
+ \ifx\!!stringa\negv!klein #2=-#3\else
+ #2=#1\fi\fi\fi\fi\fi\fi\fi}
+
+\def\assignalfadimension#1#2#3#4#5%
+ {\edef\!!stringa{#1}%
+ \ifx\!!stringa\posv!groot \edef#2{#5}\else
+ \ifx\!!stringa\posv!middel\edef#2{#4}\else
+ \ifx\!!stringa\posv!klein \edef#2{#3}\else
+ \ifx\!!stringa\nopv!geen \edef#2{0}\else
+ \edef#2{#1}\fi\fi\fi\fi}
%D \macros
%D {assignvalue}
@@ -140,6 +170,15 @@
\v!groot=>\edef#2{#5},
\s!unknown=>\edef#2{#1}]}
+%D Or faster:
+
+\def\assignvalue#1#2#3#4#5%
+ {\edef\!!stringa{#1}%
+ \ifx\!!stringa\posv!groot \edef#2{#5}\else
+ \ifx\!!stringa\posv!middel\edef#2{#4}\else
+ \ifx\!!stringa\posv!klein \edef#2{#3}\else
+ \edef#2{#1}\fi\fi\fi}
+
%D \macros
%D {assignwidth}
%D
diff --git a/tex/context/base/core-grd.tex b/tex/context/base/core-grd.tex
index f3877e679..2b7db091b 100644
--- a/tex/context/base/core-grd.tex
+++ b/tex/context/base/core-grd.tex
@@ -72,9 +72,9 @@
{\setbox0=\hbox{\setstrut\strut}%
\setbox2=\hbox{(}%
\dimen0=\ht0\advance\dimen0 by -\ht2
- \ifdim\dimen0<\!!zeropoint\dimen0=\!!zeropoint\fi
+ \ifdim\dimen0<\zeropoint\dimen0=\zeropoint\fi
\dimen2=\dp0\advance\dimen2 by -\dp2
- \ifdim\dimen2<\!!zeropoint\dimen2=\!!zeropoint\fi
+ \ifdim\dimen2<\zeropoint\dimen2=\zeropoint\fi
\edef\thetopbaselinecorrection{\the\dimen0}%
\edef\thebotbaselinecorrection{\the\dimen2}}
@@ -108,7 +108,7 @@
{\endgraf
\ifvmode
\ifdim\prevdepth<\maxdimen
- \ifdim\prevdepth<\!!zeropoint \else
+ \ifdim\prevdepth<\zeropoint \else
\ifdim\prevdepth<\dp\strutbox
\dobaselinecorrection
\fi
@@ -227,7 +227,7 @@
\def\dogetnoflines#1#2%
{\noflinesheight=#2\relax
- \ifdim\noflinesheight=\!!zeropoint\relax
+ \ifdim\noflinesheight=\zeropoint
\noflines=0
\else
\divide\noflinesheight by \openlineheight
@@ -313,13 +313,13 @@
\forcepresnaptrue
\fi
\ifforcepresnap
- \vbox{\hsize\!!zeropoint\strut}\nobreak\vskip-\openlineheight
+ \vbox{\hsize\zeropoint\strut}\nobreak\vskip-\openlineheight
\fi
%
\ifdim\ht\nextbox>\ht\strutbox
\scratchdimen=\ht\nextbox
\ifcase\@@presnap
- \ifdim\scratchskip>\!!zeropoint\relax
+ \ifdim\scratchskip>\zeropoint\relax
\scratchcounter=\scratchskip
\advance\scratchcounter by -\openlineheight
\ifnum\scratchcounter<0
@@ -340,16 +340,16 @@
\ifnum\noflines>0
\scratchdimen=\noflines\lineheight
\else
- \scratchdimen=\!!zeropoint
+ \scratchdimen=\zeropoint
\fi
\else
- \scratchdimen=\!!zeropoint
+ \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
+ \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi
\fi
\ifdim\dp\nextbox>\dp\strutbox
\getnoflines{\dp\nextbox}%
@@ -357,10 +357,10 @@
\ifnum\noflines>0
\scratchdimen=\noflines\lineheight
\else
- \scratchdimen=\!!zeropoint
+ \scratchdimen=\zeropoint
\fi
\else
- \scratchdimen=\!!zeropoint
+ \scratchdimen=\zeropoint
\fi
\ifnum\@@extrasnap=2 \advance\scratchdimen by \extrasnapsign.5\lineheight \fi
\ifnum\@@extrasnap=3 \advance\scratchdimen by \extrasnapsign\lineheight \fi
@@ -378,7 +378,7 @@
\fi
\hbox{\tracesnapping\box\nextbox}%
\ifstrutsnapping
- \ifdim\scratchdimen=\!!zeropoint\else\vskip\scratchdimen\fi
+ \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi
\fi
\extrasnapreset
\enablepresnapcorrection
@@ -393,10 +393,10 @@
\blanko[\v!regel]}
\vbox\bgroup
\let\setdisplayskips=\relax
- \abovedisplayskip=\!!zeropoint
- \abovedisplayshortskip=\!!zeropoint
- \belowdisplayskip=\!!zeropoint
- \belowdisplayshortskip=\!!zeropoint
+ \abovedisplayskip\zeropoint
+ \abovedisplayshortskip\zeropoint
+ \belowdisplayskip\zeropoint
+ \belowdisplayshortskip\zeropoint
\@EA\let\@EA\next
\fi}
@@ -407,7 +407,7 @@
\advance\scratchdimen by -\ht\strutbox
\advance\scratchdimen by \topskip
\ht\nextbox=\scratchdimen
- \dp\nextbox=\!!zeropoint
+ \dp\nextbox=\zeropoint
\box\nextbox
\kern\lineheight
\kern-\topskip
@@ -425,10 +425,10 @@
\getnoflines\scratchdimen
\setbox\nextbox=\vbox to \noflines\lineheight
{\forgetall
- \vskip\!!zeropoint plus \ht\nextbox
+ \vskip\zeropoint plus \ht\nextbox
\copy\nextbox
\kern.5\dp\strutbox % VOORLOPIGE WAARDE
- \vskip\!!zeropoint plus \dp\nextbox}
+ \vskip\zeropoint plus \dp\nextbox}
\noindent\snaptogrid\vbox{\box\nextbox}%
\egroup}
\hbox
@@ -530,7 +530,7 @@
\newbox\fuzzysnapsplit
\def\dosyncfuzzyvskip%
- {\ifvmode\ifdim\lastskip<\lineheight\ifdim\lastskip>\!!zeropoint
+ {\ifvmode\ifdim\lastskip<\lineheight\ifdim\lastskip>\zeropoint
\hbox{\strut}
% \nobreak
\kern-2\lineheight
diff --git a/tex/context/base/core-hlp.tex b/tex/context/base/core-hlp.tex
index 5a7a22d8d..afede5acd 100644
--- a/tex/context/base/core-hlp.tex
+++ b/tex/context/base/core-hlp.tex
@@ -14,7 +14,10 @@
%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
-%D interfaces later. See m-chart for an application.
+%D interfaces later. See m-chart for an application as well
+%D as the second tno-tpd manual (graphic in margin, click
+%D on it, pop up big one, use menu with hides, as well as
+%D background, etc. etc.
\unprotect
@@ -31,8 +34,20 @@
\newcounter \nofhelpdataentries
\newconditional \somehelpdatadefined
-\appendtoks \getpagehelpdata \to \beforeeverypage
-\appendtoks \resetpagehelpdata \to \aftereverypage
+\appendtoks \getpagehelpdata \to \beforeeverypage
+\appendtoks \synchronizepagehelpdata \to \aftereverypage
+
+% will be proper state variable
+
+\def\dontresetpagedata%
+ {\let\synchronizepagehelpdata\relax}
+
+\def\resetpagehelpdata%
+ {\let\synchronizepagehelpdata\resetpagehelpdata
+ \global\let\pagehelpdata\empty
+ \definereference[HideHelp][]} % hm
+
+\let\synchronizepagehelpdata\resetpagehelpdata
\def\getpagehelpdata%
{\iflocation
@@ -53,7 +68,7 @@
\fi
\fi}
-\def\setpagehelpdata#1%
+\def\setpagehelpdata[#1]%
{\iflocation\expanded{\dosetpagehelpdata{#1}}\fi}
\def\dosetpagehelpdata#1%
@@ -64,10 +79,6 @@
{\nofhelpdataentries}%
{#1}}}
-\def\resetpagehelpdata%
- {\global\let\pagehelpdata\empty
- \definereference[HideHelp][]}
-
\setvalue{\e!start\e!helptext}[#1]%
{\iflocation
\global\settrue\somehelpdatadefined
@@ -78,7 +89,14 @@
\letvalue{\e!stop\e!helptext}\relax
\fi
\dostartbuffer[\e!helptext][\e!start\e!helptext][\e!stop\e!helptext]}
-
+
+\long\def\definehelptext[#1]#2%
+ {\iflocation
+ \global\settrue\somehelpdatadefined
+ \definesymbol[helpinfo:#1][\helptext{#2}]%
+ \dopresetfieldsymbol{helpinfo:#1}%
+ \fi}
+
\def\dohelpdata#1%
{\setbox0=\hbox
{\startoverlay
@@ -106,17 +124,36 @@
\egroup
\fi}
-\def\dohelpbutton[#1][#2]%
+%\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\dodohelpbutton[#1][#2]#3[#4]% #2 is space gobbling dummy
{\iflocation
- \ifsecondargument
- \setpagehelpdata{#2}\button[#1]{}[JS(Vide_Fields{help:#2})]%
- \else
- \setpagehelpdata{#1}\button {}[JS(Vide_Fields{help:#1})]%
- \fi
+ \setpagehelpdata[#4]%
+ \button[#1]{#3}[JS(Vide_Fields{help:#4})]%
+ \fi}
+
+\def\donohelpbutton[#1][#2]%
+ {\dodohelpbutton[#1][]{}[#2]}
+
+\def\dohelpbutton[#1][#2]%
+ {\ifsecondargument
+ \expandafter\donohelpbutton
+ \else
+ \expandafter\dodohelpbutton
\fi}
-\def\helpbutton%
- {\dodoubleempty\dohelpbutton}
+\def\helpbutton% also gobble spaces between [][]
+ {\dodoublempty\dohelpbutton}
\def\doifhelpinfo#1#2%
{\iflocation\doifsymboldefinedelse{helpinfo:#1}{#2}{}\fi}
diff --git a/tex/context/base/core-int.tex b/tex/context/base/core-int.tex
index 85d258de3..5cc0d9537 100644
--- a/tex/context/base/core-int.tex
+++ b/tex/context/base/core-int.tex
@@ -333,13 +333,13 @@
% \iflocation % without screen settings
% \egroup
% \dosetuppaper
-% {\papierformaat}
+% {\papersize}
% {\the\papierbreedte}
% {\the\papierhoogte}%
% \else
% \egroup
% \dosetuppaper
-% {\printpapierformaat}
+% {\printpapersize}
% {\the\printpapierbreedte}
% {\the\printpapierhoogte}%
% \fi}
@@ -357,13 +357,13 @@
\iflocation % without screen settings
\egroup
\dosetuppaper
- {\papierformaat}
+ {\papersize}
{\the\papierbreedte}
{\the\papierhoogte}%
\else
\egroup
\dosetuppaper
- {\printpapierformaat}
+ {\printpapersize}
{\the\printpapierbreedte}
{\the\printpapierhoogte}%
\fi}
@@ -380,7 +380,7 @@
\papierhoogte=\!!heighta
\fi\fi
\dosetuppaper
- {\printpapierformaat}
+ {\printpapersize}
{\the\papierbreedte}
{\the\papierhoogte}%
\egroup}
@@ -765,11 +765,11 @@
{\localframed[#1][#2]{#3}}
\def\executeamboxcommands#1#2#3#4#5%
- {\processaction
- [\getvalue{\??am#1\c!dummy}]
- [ \v!ja=>\chardef\handleunknownmenuitem=0\relax,
- \v!leeg=>\chardef\handleunknownmenuitem=1\relax,
- \v!nee=>\chardef\handleunknownmenuitem=2\relax]%
+ {%\processaction
+ % [\getvalue{\??am#1\c!dummy}]
+ % [ \v!ja=>\chardef\handleunknownmenuitem=0\relax,
+ % \v!leeg=>\chardef\handleunknownmenuitem=1\relax,
+ % \v!nee=>\chardef\handleunknownmenuitem=2\relax]%
\getvalue{\??am#1#3}\relax
\ifextendedmenu
\setamboxcommands{#1}{#4}%
@@ -896,8 +896,8 @@
{\getvalue{\??am\c!menu#1}}
\def\horizontaalinteractiemenu#1#2#3#4%
- {\ifdim#2>\!!zeropoint % new
- \dimen2=\!!zeropoint
+ {\ifdim#2>\zeropoint % new
+ \dimen2=\zeropoint
\setbox0=\hbox
{\def\docommando##1%
{\doifnotvalue{\??am##1\c!status}{\v!geen}
@@ -905,8 +905,8 @@
\setbox2=\hbox to #2
{\getvalue{\??am##1#3}\interactiemenu[##1]\getvalue{\??am##1#4}}%
\doifelsevalue{\??am##1\c!afstand}{\v!overlay}
- {\dimen2=\!!zeropoint
- \wd2=\!!zeropoint}%
+ {\dimen2=\zeropoint
+ \wd2=\zeropoint}%
{\dimen2=\getvalue{\??am##1\c!afstand}}%
\box2}}%
\startinteractie
@@ -917,8 +917,8 @@
\fi}
\def\vertikaalinteractiemenu#1#2#3#4%
- {\ifdim#2>\!!zeropoint % new
- \dimen2=\!!zeropoint
+ {\ifdim#2>\zeropoint % new
+ \dimen2=\zeropoint
\setbox0=\vbox
{\def\docommando##1%
{\doifnotvalue{\??am##1\c!status}{\v!geen}
@@ -928,34 +928,50 @@
\doifelsevalue{\??am##1\c!afstand}{\v!overlay}
{\dimen2=\!!zeropoint
\offinterlineskip
- \dp2=\!!zeropoint
- \ht2=\!!zeropoint}%
+ \dp2=\zeropoint
+ \ht2=\zeropoint}%
{\dimen2=\getvalue{\??am##1\c!afstand}}%
\box2}}%
\startinteractie
\processcommacommand[\getvalue{\??am#1}]\docommando
\stopinteractie}%
\ht0=#2\relax
- \dp0=\!!zeropoint
+ \dp0=\zeropoint
\box0\relax
\fi}
+\letvalue{\??am\v!links }\empty
+\letvalue{\??am\v!rechts}\empty
+\letvalue{\??am\v!boven }\empty
+\letvalue{\??am\v!onder }\empty
+
+% \def\interactiemenus[#1]%
+% {\iflocation
+% \processaction
+% [#1]
+% [ \v!links=>\horizontaalinteractiemenu\v!links \linkerrandbreedte\c!links\c!rechts,
+% \v!rechts=>\horizontaalinteractiemenu\v!rechts\rechterrandbreedte\c!links\c!rechts,
+% \v!boven=>\vertikaalinteractiemenu \v!boven \bovenhoogte\c!voor\c!na,
+% \v!onder=>\vertikaalinteractiemenu \v!onder \onderhoogte\c!voor\c!na]%
+% \else
+% \dodummypageskip{#1}%
+% \fi}
+
\def\interactiemenus[#1]%
{\iflocation
- \processaction
- [#1]
- [ \v!links=>\horizontaalinteractiemenu\v!links\linkerrandbreedte\c!links\c!rechts,
- \v!rechts=>\horizontaalinteractiemenu\v!rechts\rechterrandbreedte\c!links\c!rechts,
- \v!boven=>\vertikaalinteractiemenu\v!boven\bovenhoogte\c!voor\c!na,
- \v!onder=>\vertikaalinteractiemenu\v!onder\onderhoogte\c!voor\c!na]%
+ \getvalue{\??am\??am\c!menu#1}%
\else
\dodummypageskip{#1}%
\fi}
-\setvalue{\??am\v!links }{}
-\setvalue{\??am\v!rechts}{}
-\setvalue{\??am\v!boven }{}
-\setvalue{\??am\v!onder }{}
+\setvalue{\??am\??am\c!menu\v!links}%
+ {\horizontaalinteractiemenu\v!links\linkerrandbreedte\c!links\c!rechts}
+\setvalue{\??am\??am\c!menu\v!rechts}%
+ {\horizontaalinteractiemenu\v!rechts\rechterrandbreedte\c!links\c!rechts}
+\setvalue{\??am\??am\c!menu\v!boven}%
+ {\vertikaalinteractiemenu\v!boven\bovenhoogte\c!voor\c!na}
+\setvalue{\??am\??am\c!menu\v!onder}%
+ {\vertikaalinteractiemenu\v!onder\onderhoogte\c!voor\c!na}
%D This can save complicated menu macros when one want to
%D keep control over parts of a menu (i.e.\ turn them on and
@@ -2127,7 +2143,7 @@
% jammer, tussen/midden had erin gemoeten; \c!commando toevoegen
\def\registermenucommand#1%
- {\noindent#1\space}
+ {{\textonly\noindent#1\space}} % no math switching
\def\doregistermenubuttons[#1][#2]% [menu id] [register]
{\bgroup
@@ -2222,28 +2238,48 @@
\c!linkeroffset=\!!zeropoint,
\c!rechteroffset=\!!zeropoint]
-%\stelbovenin [\v!tekst] [\c!middentekst={\interactiemenus[\v!boven]}]
-%\stelonderin [\v!tekst] [\c!middentekst={\interactiemenus[\v!onder]}]
+%\def\plaatslinkerrandtekstblok {\interactiemenus[\v!links ]}
+%\def\plaatsrechterrandtekstblok{\interactiemenus[\v!rechts]}
+%\def\plaatsboventekstblok {\interactiemenus[\v!boven ]}
+%\def\plaatsondertekstblok {\interactiemenus[\v!onder ]}
+
+\def\plaatslinkerrandtekstblok % Is \hss/\hsize really needed here?
+ {\hbox to \linkerrandbreedte % (check outer level and settings)
+ {\hsize\linkerrandbreedte
+ \hss
+ \interactiemenus[\v!links]}}
-\def\plaatsrechterrandblok {\interactiemenus[\v!rechts]}
-\def\plaatslinkerrandblok {\interactiemenus[\v!links]}
-\def\plaatsboventekstblok {\interactiemenus[\v!boven]}
-\def\plaatsondertekstblok {\interactiemenus[\v!onder]}
+\def\plaatsrechterrandtekstblok % Is \hss/\hsize really needed here?
+ {\hbox to \rechterrandbreedte % (check outer level and settings)
+ {\hsize\rechterrandbreedte
+ \interactiemenus[\v!rechts]%
+ \hss}}
-\def\plaatsboventekstblok%
+\def\plaatsboventekstblok
{\vbox to \bovenhoogte
- {\getvalue{\??tk\v!boven\v!tekst\c!voor}
+ {\vsize\bovenhoogte
+ \getvalue{\??tk\v!boven\v!tekst\c!voor}
\interactiemenus[\v!boven]
\getvalue{\??tk\v!boven\v!tekst\c!na}
- \kern\!!zeropoint}}
+ \kern\zeropoint}}
-\def\plaatsondertekstblok%
+\def\plaatsondertekstblok
{\vbox to \onderhoogte
- {\getvalue{\??tk\v!onder\v!tekst\c!voor}
+ {\vsize\onderhoogte
+ \getvalue{\??tk\v!onder\v!tekst\c!voor}
\interactiemenus[\v!onder]
\getvalue{\??tk\v!onder\v!tekst\c!na}
- \kern\!!zeropoint}}
+ \kern\zeropoint}}
+
+\ifx\leftedgetextcontent\undefined \else
+
+ \appendtoks \plaatslinkerrandtekstblok \hskip-\linkerrandbreedte \to \leftedgetextcontent
+ \appendtoks \plaatsrechterrandtekstblok \hskip-\rechterrandbreedte \to \rightedgetextcontent
+ \appendtoks \plaatsboventekstblok \vskip-\bovenhoogte \to \toptextcontent
+ \appendtoks \plaatsondertekstblok \vskip-\onderhoogte \to \bottomtextcontent
+\fi
+
\stelinteractieschermin
[\c!breedte=\printpapierbreedte,
\c!hoogte=\printpapierhoogte,
diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex
index 49f4940a5..6493e93cc 100644
--- a/tex/context/base/core-itm.tex
+++ b/tex/context/base/core-itm.tex
@@ -1,3 +1,5 @@
+% todo : start=2
+
%D \module
%D [ file=core-itm,
%D version=1997.03.31,
@@ -197,9 +199,20 @@
\def\stelopsommingin%
{\dotripleempty\dostelopsommingin}
+%\def\doadvanceitem%
+% {\ifsubsom\else\ifsymsom\else
+% \pluscounter{\s!itemcount\itemlevel}%
+% \fi\fi}
+
\def\doadvanceitem%
{\ifsubsom\else\ifsymsom\else
- \pluscounter{\s!itemcount\itemlevel}%
+ \scratchcounter=0\getvalue{\??op\itemlevel\c!start}\relax
+ \ifcase\scratchcounter
+ \pluscounter{\s!itemcount\itemlevel}%
+ \else
+ \setcounter{\s!itemcount1}{\scratchcounter}%
+ \setvalue{\??op\itemlevel\c!start}{0}%
+ \fi
\fi\fi}
\def\setitemlevel#1%
diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex
new file mode 100644
index 000000000..c942e4f44
--- /dev/null
+++ b/tex/context/base/core-job.tex
@@ -0,0 +1,376 @@
+%D \module
+%D [ file=core-job, % copied from main-001,
+%D version=1997.03.31,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Job Handling,
+%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.
+
+%D This module is still to be split and documented.
+
+\writestatus{loading}{Context Core Macros (Job Handling)}
+
+%S InputFile \input
+%S InputFile \omgeving \environment
+%S InputFile \projekt \project
+%S InputFile \produkt \product
+%S InputFile \onderdeel \component
+%S
+%S CheckStrings \start \stop
+%S CheckStrings \begin \end
+%S CheckStrings \begin \eind
+%S
+%S CheckChars { }
+%S CheckChars [ ]
+%S CheckChars ( )
+%S
+%S CheckChar $
+
+\unprotect
+
+\def\currentproject {}
+\def\currentproduct {}
+\def\currentenvironment {}
+\def\currentcomponent {}
+
+\def\loadedfiles {}
+\def\processedfiles {}
+
+\let\geenfilesmeer=\relax
+
+\newcounter\textlevel
+\newcounter\fileprocesslevel
+
+\setvalue{\c!file::0}{\jobname}
+
+\def\processedfile% is used in styles, don't change !
+ {\getvalue{\c!file::\fileprocesslevel}}
+
+%\def\processfile#1%
+% {\doglobal\increment\fileprocesslevel
+% \setxvalue{\c!file::\fileprocesslevel}{#1}%
+% \@EA\doglobal\@EA\addtocommalist\@EA{#1}\processedfiles
+% \readlocfile{#1}{}{}
+% \doglobal\decrement\fileprocesslevel}
+
+\def\processlocalfile#1#2%
+ {\doglobal\increment\fileprocesslevel
+ \setxvalue{\c!file::\fileprocesslevel}{#2}%
+ \@EA\doglobal\@EA\addtocommalist\@EA{#2}\processedfiles
+ #1{#2}{}{}% #1=\readlocfile|\readsetfile{dir} #2=filename
+ \doglobal\decrement\fileprocesslevel}
+
+\def\processfile#1%
+ {\ifx\allinputpaths\empty
+ \def\next{\processlocalfile\readlocfile}%
+ \else
+ \let\filepath\empty
+ \def\docommando##1%
+ {\doiffileelse{\pathplusfile{##1}{#1}}
+ {\donetrue\def\filepath{##1}}
+ {\donefalse}%
+ \ifdone\expandafter\quitcommalist\fi}%
+ \doifparentfileelse{#1} % new
+ {\processcommacommand [\allinputpaths]\docommando}
+ {\processcommacommand[.,\allinputpaths]\docommando}%
+ \ifx\filepath\empty
+ \def\next{\processlocalfile\readlocfile}% fall back ../../..
+ \else
+ \def\next{\processlocalfile{\readsetfile\filepath}}% file found
+ \fi
+ \fi
+ \next{#1}}
+
+\let\allinputpaths\empty
+
+\def\usepath[#1]%
+ {\def\docommando##1%
+ {\doifelse{##1}{\v!reset}
+ {\let\allinputpaths\empty}
+ {\addtocommalist{##1}\allinputpaths}}%
+ \processcommalist[#1]\docommando}
+
+\def\registreerfileinfo[#1#2]#3% geen \showmessage ?
+ {\writestatus{\m!systems}{#1#2 file #3 at line \the\inputlineno}%
+ \immediatewriteutility{f #1 {#3}}}
+
+\doifundefined{preloadfonts} {\let\preloadfonts=\relax}
+\doifundefined{preloadspecials} {\let\preloadspecials=\relax}
+
+\def\loadsystemfiles%
+ {\readsysfile{\f!newfilename}
+ {\showmessage{\m!systems}{2}{\f!newfilename}}{}%
+ \readsysfile{\f!oldfilename}
+ {\showmessage{\m!systems}{2}{\f!oldfilename}}{}%
+ \readsysfile{\f!filfilename}
+ {\showmessage{\m!systems}{2}{\f!filfilename}}{}%
+ \readsysfile{\f!sysfilename}
+ {\showmessage{\m!systems}{2}{\f!sysfilename}}{}}
+
+% test \@@svgebied
+
+\def\loadallsystemfiles#1%
+ {\ifx\@@svgebied\empty
+ \readsysfile{#1}{\showmessage{\m!systems}{2}{#1}}{}%
+ \else
+ \def\doloadsystemfile##1%
+ {\readsetfile{##1}{#1}{\showmessage{\m!systems}{2}{#1}}{}}%
+ \processcommacommand[\@@svgebied]\doloadsystemfile
+ \fi}
+
+\def\loadsystemfiles%
+ {\readsysfile{\f!newfilename}
+ {\showmessage{\m!systems}{2}{\f!newfilename}}{}%
+ \readsysfile{\f!oldfilename}
+ {\showmessage{\m!systems}{2}{\f!oldfilename}}{}%
+ \loadallsystemfiles\f!filfilename
+ \loadallsystemfiles\f!sysfilename}
+
+%D Loading of \type {cont-usr.tex} (edited by the user)
+%D and \type {cont-fmt.tex} (generated by texexec).
+
+\def\loaduserspecifications
+ {\readsysfile{\f!usrfilename}
+ {\showmessage{\m!systems}{2}{\f!usrfilename}}{}%
+ \readjobfile{\f!fmtfilename}
+ {\showmessage{\m!systems}{2}{\f!fmtfilename}}{}}
+
+%D We don't want multiple jobfiles to interfere.
+
+\bgroup
+\catcode`\%=\@@other
+\xdef\texcommentsymbol{%}
+\egroup
+
+\def\loadoptionfile%
+ {\readjobfile{\jobname.\f!optionextension}
+ {\showmessage{\m!systems}{2}{\jobname.\f!optionextension}}%
+ {}}
+
+% \newevery \everyjob \EveryJob
+% \appendtoks ... \to \everyjob
+
+\prependtoks \showcontextbanner \to \everyjob
+
+\appendtoks \loadsystemfiles \to \everyjob
+\appendtoks \preloadfonts \to \everyjob
+\appendtoks \settopskip \to \everyjob
+\appendtoks \preloadlanguages \to \everyjob
+\appendtoks \preloadspecials \to \everyjob
+\appendtoks \openspecialfile \to \everyjob
+%appendtoks \checkutilityfile \to \everyjob % obsolete
+\appendtoks \openutilities \to \everyjob
+\appendtoks \loadoptionfile \to \everyjob
+\appendtoks \loadtwopassdata \to \everyjob
+\appendtoks \setupfootnotes \to \everyjob % depends on bodyfont
+\appendtoks \initializeMPgraphics \to \everyjob % after loading system files
+
+\appendtoks \pagina[\v!laatste] \pagina \to \everybye
+\appendtoks \ifarrangingpages\poparrangedpages\fi \to \everybye
+\appendtoks \registreerfileinfo[end]{\jobname} \to \everybye
+
+\appendtoks \savenofpages \to \everybye
+\appendtoks \savenofsubpages \to \everybye
+
+\appendtoks \closeutilities \to \everygoodbye
+\appendtoks \stopcopyingblocks \to \everygoodbye
+\appendtoks \closespecialfile \to \everygoodbye
+
+\appendtoks \checkreferences \to \everystarttext % nieuw 4-12-1999
+
+\def\doateverystarttext%
+ {\the\everystarttext
+ \global\let\doateverystarttext\relax}
+
+\def\starttekst%
+ {\doateverystarttext
+ \ifnum\textlevel=0
+ \registreerfileinfo[begin]{\jobname}%
+ \expandafter\startcopyingblocks
+ \fi
+ \doglobal\increment\textlevel\relax}
+
+\def\stoptekst%
+ {\doglobal\decrement\textlevel\relax
+ \ifnum\textlevel>0 \else
+ \the\everystoptext
+ %\the\everybye %
+ %\the\everygoodbye % == \end (new)
+ %\expandafter\normalend %
+ \expandafter\end
+ \fi}
+
+\let\normalend=\end
+
+\def\end%
+ {\ifnum\textlevel>0 \else
+ \the\everybye
+ \the\everygoodbye
+ \global\everygoodbye\emptytoks % rather unneeded
+ \global\everybye\emptytoks % but for sure
+ \expandafter\normalend
+ \fi}
+
+\def\doexecutefileonce#1%
+ {\beforesplitstring#1\at.\to\currentfile
+ \ExpandBothAfter\doifnotinset{\currentfile}{\loadedfiles}%
+ {\ExpandFirstAfter\addtocommalist{\currentfile}\loadedfiles
+ \doexecutefile{#1}}}
+
+\def\doexecutefile#1%
+ {\registreerfileinfo[begin]{#1}
+ \processfile{#1}%
+ \registreerfileinfo[end]{#1}}
+
+\def\donotexecutefile#1%
+ {}
+
+\def\verwerkfile#1 %
+ {\doexecutefile{#1}}
+
+\def\omgeving #1 % at outermost level only
+ {\def\startomgeving ##1 {}%
+ \let\stopomgeving=\relax
+ \startreadingfile
+ \processfile{#1}% \readlocfile{#1}{}{}%
+ \stopreadingfile}
+
+\let\environment\omgeving % for the moment
+
+\newcounter\filelevel
+
+\def\!!donextlevel#1#2#3#4#5#6\\%
+ {\beforesplitstring#6\at.\to#1
+ \ifnum\filelevel=0
+ \starttekst
+ \def\projekt ##1 {#2{##1}}%
+ \def\omgeving ##1 {#3{##1}}%
+ \def\produkt ##1 {#4{##1}}%
+ \def\onderdeel ##1 {#5{##1}}%
+ \fi
+ \increment\filelevel\relax
+ \ExpandFirstAfter\addtocommalist{#1}\loadedfiles}
+
+\def\doprevlevel%
+ {\ifnum\filelevel=1
+ \expandafter\stoptekst
+ \else
+ \decrement\filelevel\relax
+ \expandafter\endinput
+ \fi}
+
+\def\startprojekt #1 %
+ {\!!donextlevel\currentproject
+ \donotexecutefile\doexecutefileonce
+ \doexecutefileonce\doexecutefile#1\\}
+
+\def\stopprojekt%
+ {\doprevlevel}
+
+\def\startprodukt #1 %
+ {\doateverystarttext
+ \!!donextlevel\currentproduct
+ \doexecutefileonce\doexecutefileonce
+ \donotexecutefile\doexecutefile#1\\}
+
+\def\stopprodukt%
+ {\doprevlevel}
+
+\def\startonderdeel #1 %
+ {\doateverystarttext
+ \!!donextlevel\currentcomponent
+ \doexecutefileonce\doexecutefileonce
+ \donotexecutefile\doexecutefile#1\\}
+
+\def\stoponderdeel%
+ {\doprevlevel}
+
+\def\startomgeving #1 %
+ {\!!donextlevel\currentenvironment
+ \donotexecutefile\doexecutefileonce
+ \donotexecutefile\donotexecutefile#1\\}
+
+\def\stopomgeving%
+ {\doprevlevel}
+
+\long\def\skipdeelomgeving#1\stopdeelomgeving%
+ {}
+
+\def\startdeelomgeving[#1]%
+ {\def\partialenvironments{}%
+ \def\docommando##1%
+ {\beforesplitstring##1\at.\to\someevironment
+ \ExpandFirstAfter\addtocommalist{\someevironment}\partialenvironments}%
+ \processcommalist[#1]\docommando
+ \ExpandBothAfter\doifcommonelse
+ {\currentproject,\currentproduct,
+ \currentcomponent,\currentenvironment}
+ {\partialenvironments}
+ {\let\stopdeelomgeving=\relax
+ \let\next=\relax}
+ {\let\next=\skipdeelomgeving}%
+ \next}
+
+\def\startproduct{\startprodukt}
+\def\stopproduct {\stopprodukt}
+\def\startproject{\startprojekt}
+\def\stopproject {\stopprojekt}
+
+\def\project{\projekt}
+\def\product{\produkt}
+
+\def\deelomgeving #1 %
+ {\doexecutefileonce{#1}}
+
+\expanded
+ {\long\noexpand\def\csname\e!start\e!instellingen\endcsname##1 ##2\csname\e!stop\e!instellingen\endcsname%
+ {\noexpand\long\noexpand\setvalue{\??su##1}{##2}}}
+
+\long\def\startsetups#1 #2\stopsetups% for international purposes
+ {\long\setvalue{\??su#1}{#2}}
+
+\def\dodosetups#1%
+ {\getvalue{\??su#1}}
+
+\def\dosetups[#1]%
+ {\iffirstargument
+ \dodosetups{#1}%
+ \else
+ \expandafter\dodosetups
+ \fi}
+
+\def\setups%
+ {\dosingleargument\dosetups}
+
+% Het <pagina>-karakter (FormFeed), wordt omgezet in \par
+
+\edef\oldlinefeed{\the\catcode`\^^L}
+
+\catcode`\^^L=\oldlinefeed
+\catcode`\^^L=\@@endofline
+
+% NOT TOEVOEGEN: \the\everytrace
+
+\neverypar=\emptytoks
+
+\appendtoks \flushfootnotes \to \everypar
+\appendtoks \ifinner\else\checksidefloat\fi \to \everypar
+\appendtoks \checkindentation \to \everypar
+\appendtoks \showparagraphnumber \to \everypar
+\appendtoks \flushmargincontents \to \everypar
+\appendtoks \flushcomments \to \everypar
+\appendtoks \synchronizefootnotes \to \everypar
+
+\appendtoks \flushfootnotes \to \everydisplay
+\appendtoks \adjustsidefloatdisplaylines \to \everydisplay
+
+% Default-instellingen (verborgen)
+
+\resetutilities
+
+\protect \endinput
diff --git a/tex/context/base/core-lst.tex b/tex/context/base/core-lst.tex
index bf4f0ac49..698cf8ee2 100644
--- a/tex/context/base/core-lst.tex
+++ b/tex/context/base/core-lst.tex
@@ -64,69 +64,75 @@
\def\doschrijfnaarlijst#1#2#3#4%
{\doifvalue{\??li#1\c!status}{\v!start}
- {\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%
- {\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}}
+ {\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}
\def\doschrijftussenlijst#1#2%
- {\doif{\getvalue{\??li#1\c!status}}{\v!start}
- {\begingroup
- \convertargument#2\to\ascii
- \makesectionformat
- \doifelse{\@@nmstatus}{\v!start}
- {\def\dopaginanummer{\noexpand\pagenumber}}
- {\def\dopaginanummer{0}}%
- \edef\schrijfwegnaarlijst%
- {\writeutilitycommand%
- {\listbetween%
- {#1}%
- {\ascii}%
- {\sectionformat::\dopaginanummer}%
- {\noexpand\realfolio}}}%
- \schrijfwegnaarlijst
- \endgroup}}
+ {\doifvalue{\??li#1\c!status}{\v!start}
+ {\dodoschrijftussenlijst{#1}{#2}}}
+
+\def\dodoschrijftussenlijst#1#2%
+ {\begingroup
+ \convertargument#2\to\ascii
+ \makesectionformat
+ \doifelse{\@@nmstatus}{\v!start}
+ {\def\dopaginanummer{\noexpand\pagenumber}}
+ {\def\dopaginanummer{0}}%
+ \edef\schrijfwegnaarlijst%
+ {\writeutilitycommand%
+ {\listbetween%
+ {#1}%
+ {\ascii}%
+ {\sectionformat::\dopaginanummer}%
+ {\noexpand\realfolio}}}%
+ \schrijfwegnaarlijst
+ \endgroup}
\def\listentry#1%
{\executeifdefined{#1\c!lijst}\gobblefivearguments}
@@ -257,10 +263,10 @@
\def\dosetlistmode%
{\iflijstgeplaatst
- \enablemode [\systemmodeprefix\v!lijst]%
+ \expandafter \enablemode
\else
- \disablemode[\systemmodeprefix\v!lijst]%
- \fi}
+ \expandafter \disablemode
+ \fi [\systemmodeprefix\v!lijst]}
\def\plaatslijst%
{\dodoubleempty\doplaatslijst}
@@ -285,7 +291,7 @@
{#1=#3\relax}
{#1=#2\relax}}
-\def\dosetlistsymbol#1#2%
+\def\dosetlistsymbol#1#2% kan sneller, default case afvangen
{\processaction
[\getvalue{\??li#1\c!symbool}]
[ \v!geen=>\def\listsymbol%
@@ -345,23 +351,24 @@
\def\newlineinlist{\space}
\def\dolijstelement#1#2#3#4#5#6% pas op: wordt ook elders gedefinieerd
- {\doiftoclevelelse[#5]
- {\getvalue{\@@dodolijstelement\getvalue{\??li#1\c!variant}}%
- %\showcomposition
- \let\@@iabreedte=\!!zeropoint % moet boolean worden
- \bgroup
- \edef\lijstelementen%
- {\getvalue{\??li#1\c!paginaovergangen}}%
- \ExpandSecondAfter\doifinset{#3}{\lijstelementen}%
- {\showmessage{\m!systems}{14}{#3}%
- \pagina}%
- \egroup
- \mindermeldingen
- \setfullsectionnumber{\??li#1}%
- \dosetlistsymbol{#1}{#3}%
- \dosomelijstelement{#1}{#2}{#3}{#4}{#5}{#6}%
- \global\utilitydonetrue}
- {}}
+ {\doiftoclevelelse[#5]{\dodolijstelement{#1}{#2}{#3}{#4}{#5}{#6}}{}}
+
+\def\dodolijstelement#1#2#3#4#5#6%
+ {\getvalue{\@@dodolijstelement\getvalue{\??li#1\c!variant}}%
+ %\showcomposition
+ \let\@@iabreedte=\!!zeropoint % moet boolean worden
+ \bgroup
+ \edef\lijstelementen%
+ {\getvalue{\??li#1\c!paginaovergangen}}%
+ \ExpandSecondAfter\doifinset{#3}{\lijstelementen}%
+ {\showmessage{\m!systems}{14}{#3}%
+ \pagina}%
+ \egroup
+ \mindermeldingen
+ \setfullsectionnumber{\??li#1}%
+ \dosetlistsymbol{#1}{#3}%
+ \dosomelijstelement{#1}{#2}{#3}{#4}{#5}{#6}%
+ \global\utilitydonetrue}
\def\dolistattributes#1#2#3%
{\doifvaluesomething{\??li#1#3}
@@ -904,4 +911,58 @@
\def\plaatssamengesteldelijst%
{\dodoubleempty\doplaatssamengesteldelijst}
+% new and yet undocumented (used in cocoa qa)
+%
+% \setupremaininglistlength
+% [left=\hss nog~,right=~ingangen]
+%
+% \resetremaininglistlength
+% [section][setttings]
+%
+% \placelist
+% [section]
+% [before=\showremaininglistlength]
+%
+% \dorecurse{100}{\section{hans}}
+
+\definesystemvariable {ll} % ListLength
+
+\def\setupremaininglistlength[#1]%
+ {\getparameters[\??ll][#1]%
+ \xdef\listlengthcounter{0}}
+
+\setupremaininglistlength
+ [\c!links=\hss,\c!rechts=,\c!nummer=\v!ja,
+ \c!voor=\blanko,\c!na=\pagina,
+ \c!letter=\v!kleinnormaal,\c!kleur=]
+
+\def\resetremaininglistlength%
+ {\dodoubleempty\doresetremaininglistlength}
+
+\def\doresetremaininglistlength[#1][#2]%
+ {\bepaallijstkenmerken[#1][#2]% \determinelistcharacteristics[#1][#2]%
+ \xdef\listlengthcounter{\number\utilitylistlength}}
+
+\def\showremaininglistlength%
+ {\bgroup
+ \ifnum\listlengthcounter>1
+ \scratchdimen=\pagetotal
+ \setbox\scratchbox=\vbox
+ {\@@llvoor\par\hbox{\strut}\par\hbox{\strut}\par\@@llna}
+ \advance\scratchdimen by \ht\scratchbox
+ \advance\scratchdimen by \dp\scratchbox
+ \ifdim\scratchdimen>\pagegoal
+ \@@llvoor
+ \nobreak\hbox to \hsize
+ {\doifnot{\@@llnummer}{\v!ja}{\let\listlengthcounter\empty}%
+ \doattributes\??ll\c!letter\c!kleur{\@@lllinks\listlengthcounter\@@llrechts}}
+ \@@llna
+ \fi
+ \fi
+ \doglobal\decrement\listlengthcounter\relax
+ \egroup}
+
+\stelreferentielijstin
+ [\c!letter=\v!normaal]
+
\protect \endinput
diff --git a/tex/context/base/core-mar.tex b/tex/context/base/core-mar.tex
index 836dd64b6..e7f497f89 100644
--- a/tex/context/base/core-mar.tex
+++ b/tex/context/base/core-mar.tex
@@ -37,7 +37,8 @@
{\dosingleargument\doresetmarkering}
\def\dostelmarkeringin[#1][#2]%
- {\getparameters[\??mk#1][#2]}
+ {\def\docommando##1{\getparameters[\??mk##1][#2]}%
+ \processcommalist[#1]\docommando}
\def\stelmarkeringin%
{\dodoubleargument\dostelmarkeringin}
@@ -45,6 +46,7 @@
\letvalue{\??mk \v!vorige}\gettopmark
\letvalue{\??mk \v!eerste}\getfirstmark
\letvalue{\??mk\v!laatste}\getbotmark
+\letvalue{\??mk\v!huidige}\getcurrentmark
\def\dododefinieermarkering[#1][#2]%
{\stelmarkeringin[#1]
diff --git a/tex/context/base/core-mat.tex b/tex/context/base/core-mat.tex
index 15aaf49c4..0a5807c30 100644
--- a/tex/context/base/core-mat.tex
+++ b/tex/context/base/core-mat.tex
@@ -108,7 +108,7 @@
\c!blokwijze=\@@fmblokwijze,
\c!plaats=\v!intekst]
-\def\stelformulesin%
+\def\setupformulas%
{\dodoubleargument\getparameters[\??fm]}
\newconditional\handleformulanumber
@@ -162,25 +162,26 @@
{\copyparameters
[\??fm#1][\??fm]
[\c!voorwit,\c!nawit,
- \c!linkermarge,\c!rechtermarge,
- \c!springvolgendein,\c!variant]%
- \stelformulesin[#1][#2]%
+ \c!linkermarge,\c!rechtermarge,\c!marge,
+ \c!springvolgendein,\c!variant,
+ \c!strut,\c!uitlijnen,\c!afstand]%
+ \setupformulas[#1][#2]%
\setvalue{\e!start#1\e!formule}%
{\dostartformula{#1}}%
\setvalue{\e!stop #1\e!formule}%
{\dostopformula}}}
-\def\stelformulesin%
- {\dodoubleempty\dostelformulesin}
+\def\setupformulas%
+ {\dodoubleempty\dosetupformulas}
-\def\dostelformulesin[#1][#2]%
+\def\dosetupformulas[#1][#2]%
{\ifsecondargument
\getparameters[\??fm#1][#2]%
\else
\getparameters[\??fm][#1]%
\fi}
-\stelformulesin
+\setupformulas
[\c!wijze=\@@nrwijze,
\c!blokwijze=,
\c!sectienummer=\@@nrsectienummer,
@@ -191,8 +192,12 @@
\c!nawit=\@@fmvoorwit,
\c!linkermarge=\!!zeropoint,
\c!rechtermarge=\!!zeropoint,
+ \c!marge=,
\c!springvolgendein=\v!nee,
- \c!variant=\s!default]
+ \c!variant=\s!default,
+ \c!uitlijnen=,
+ \c!strut=\v!nee,
+ \c!afstand=1em]
\def\currentformula {}
\def\predisplaysizethreshhold{3em}
@@ -235,10 +240,13 @@
\newif\ifoptimizedisplayspacing
-\def\dostartformula#1%
+\def\dostartformula#1% setting leftskip adaption is slow !
{\bgroup
- \long\def\dostartformula##1{\bgroup\let\dostopformula\egroup}%
\def\currentformula{#1}%
+ \doifvaluesomething{\??fm\currentformula\c!marge}% so we test first
+ {\dosetleftskipadaption{\getvalue{\??fm\currentformula\c!marge}}%
+ \edef\leftdisplaymargin{\the\leftskipadaption}}% overloaded
+ \long\def\dostartformula##1{\bgroup\let\dostopformula\egroup}%
\freezedimenmacro\leftdisplayskip
\freezedimenmacro\rightdisplayskip
\freezedimenmacro\leftdisplaymargin
@@ -289,14 +297,43 @@
% \par\ifvmode\vskip-\parskip\fi
% \afterdisplayspace}
+% \def\startdisplaymath%
+% {\ifgridsnapping
+% \beforedisplayspace
+% \snaptogrid\vbox\bgroup
+% % \vskip\parskip
+% \forgetall
+% \else
+% \bgroup
+% \ifdim\lastskip<\!!zeropoint\else
+% \par\ifvmode\ifdim\parskip>\!!zeropoint\relax\vskip-\parskip\fi\fi
+% \fi
+% \beforedisplayspace
+% \par\ifvmode\vbox{\strut}\vskip-2\baselineskip\fi
+% \fi
+% $$\setdisplaydimensions
+% \setpredisplaysize\lastlinewidth
+% \startinnermath}
+%
+% \def\stopdisplaymath%
+% {\stopinnermath
+% $$\egroup
+% \par\ifvmode\ifdim\parskip>\!!zeropoint\relax\vskip-\parskip\fi\fi
+% \afterdisplayspace}
+
+\newif\ifinformula
+
\def\startdisplaymath%
{\ifgridsnapping
\beforedisplayspace
- \snaptogrid\vbox\bgroup
- % \vskip\parskip
+ \snaptogrid\vbox
+ \bgroup
+ \informulatrue
\forgetall
- \else
+ \else
\bgroup
+ \informulatrue
+ %\forgetall % otherwise backgrounds fail
\ifdim\lastskip<\!!zeropoint\else
\par\ifvmode\ifdim\parskip>\!!zeropoint\relax\vskip-\parskip\fi\fi
\fi
@@ -304,12 +341,21 @@
\par\ifvmode\vbox{\strut}\vskip-2\baselineskip\fi
\fi
$$\setdisplaydimensions
- \setpredisplaysize\lastlinewidth}
+ \setpredisplaysize\lastlinewidth
+ \startinnermath}
\def\stopdisplaymath%
- {$$\egroup
- \par\ifvmode\ifdim\parskip>\!!zeropoint\relax\vskip-\parskip\fi\fi
- \afterdisplayspace}
+ {\stopinnermath
+ $$%
+ \ifgridsnapping
+ \else
+ \par\ifvmode\ifdim\parskip>\zeropoint\vskip-\parskip\fi\fi
+ \fi
+ \afterdisplayspace
+ \egroup}
+
+\let\startinnermath\empty
+\let\stopinnermath \empty
\def\defineformulaalternative%
{\dotripleargument\dodefineformulaalternative}
@@ -355,22 +401,22 @@
% \defineformulaalternative[multi][\begindmath][\enddmath]
%
% \fakewords{20}{40}\epar
-% \plaatsformule {a} $$ \fakeformula $$
+% \plaatsformule {a} $$ \fakespacingformula $$
% \fakewords{20}{40}\epar
-% \plaatsformule {b} \startformule \fakeformula \stopformule
-% \plaatsformule {b} \startformule \fakeformula \stopformule
+% \plaatsformule {b} \startformule \fakespacingformula \stopformule
+% \plaatsformule {b} \startformule \fakespacingformula \stopformule
% \fakewords{20}{40}\epar
-% \plaatsformule {c} \startmdformule \fakeformula \stopmdformule
-% \plaatsformule {c} \startmdformule \fakeformula \stopmdformule
+% \plaatsformule {c} \startmdformule \fakespacingformula \stopmdformule
+% \plaatsformule {c} \startmdformule \fakespacingformula \stopmdformule
% \fakewords{20}{40}\epar
-% \plaatsformule {d} \startmpformule \fakeformula \stopmpformule
-% \plaatsformule {d} \startmpformule \fakeformula \stopmpformule
+% \plaatsformule {d} \startmpformule \fakespacingformula \stopmpformule
+% \plaatsformule {d} \startmpformule \fakespacingformula \stopmpformule
% \fakewords{20}{40}\epar
-% \plaatsformule {e} \startsdformule \fakeformula \stopsdformule
-% \plaatsformule {e} \startsdformule \fakeformula \stopsdformule
+% \plaatsformule {e} \startsdformule \fakespacingformula \stopsdformule
+% \plaatsformule {e} \startsdformule \fakespacingformula \stopsdformule
% \fakewords{20}{40}\epar
-% \plaatsformule {f} \startspformule \fakeformula \stopspformule
-% \plaatsformule {f} \startspformule \fakeformula \stopspformule
+% \plaatsformule {f} \startspformule \fakespacingformula \stopspformule
+% \plaatsformule {f} \startspformule \fakespacingformula \stopspformule
% \fakewords{20}{40}
\def\plaatsformule%
@@ -431,6 +477,179 @@
\global\let\doplaceformulanumber\empty
\fi}
+%D Here we implement a basic math alignment mechanism. Numbers
+%D are also handled. The macros \type {\startinnermath} and
+%D \type {\stopinnermath} can be overloaded in specialized
+%D modules.
+
+\def\startinnermath%
+ {\getvalue{\e!start\??fm\getvalue{\??fm\currentformula\c!uitlijnen}}}
+
+\def\stopinnermath%
+ {\getvalue{\e!stop \??fm\getvalue{\??fm\currentformula\c!uitlijnen}}}
+
+\def\mathinnerstrut%
+ {\doifvalue{\??fm\currentformula\c!strut}{\v!ja}{\strut}}
+
+\long\def\defineinnermathhandler#1#2#3%
+ {\setvalue{\e!start\??fm#1}{#2}%
+ \setvalue{\e!stop \??fm#1}{#3}}
+
+\newif\iftracemath
+
+\def\mathhbox%
+ {\iftracemath\ruledhbox\else\hbox\fi}
+
+\def\startmathbox#1#2%
+ {\hsize\displaywidth
+ \global\let\@eqno \empty \def\eqno {\gdef\@eqno }%
+ \global\let\@leqno\empty \def\leqno{\gdef\@leqno}%
+ \doplaceformulanumber
+ \mathhbox to \displaywidth\bgroup
+ \mathinnerstrut
+ $\displaystyle
+ \ifx\@leqno\empty\else \ifcase#2
+ \rlap{\@leqno}%
+ \else
+ \@leqno\hskip\getvalue{\??fm\currentformula\c!afstand}%
+ \fi \fi
+ #1}
+
+\def\stopmathbox#1#2%
+ {$#1%
+ \ifx\@eqno\empty\else \ifcase#2
+ \llap{\@eqno}%
+ \else
+ \hskip\getvalue{\??fm\currentformula\c!afstand}\@eqno
+ \fi \fi
+ \egroup}
+
+\defineinnermathhandler\v!rechts{\startmathbox\empty1}{\stopmathbox\hfill0}
+\defineinnermathhandler\v!links {\startmathbox\hfill0}{\stopmathbox\empty1}
+\defineinnermathhandler\v!midden{\startmathbox\hfill0}{\stopmathbox\hfill0}
+
+%D [The examples below are in english and don't process in the
+%D documentation style, which will be english some day.]
+%D
+%D Normally a formula is centered, but in case you want to
+%D align it left or right, you can set up formulas to behave
+%D that way. Normally a formula will adapt is left indentation
+%D to the environment:
+%D
+%D \startbuffer
+%D \fakewords{20}{40}\epar
+%D \startitemize
+%D \item \fakewords{20}{40}\epar
+%D \placeformula \startformula \fakeformula \stopformula
+%D \item \fakewords{20}{40}\epar
+%D \stopitemize
+%D \fakewords{20}{40}\epar
+%D \stopbuffer
+%D
+%D % \getbuffer
+%D
+%D In the next examples we explicitly align formulas to the
+%D left (\type {\raggedleft}), center and right (\type
+%D {\raggedright}):
+%D
+%D \startbuffer
+%D \setupformulas[align=left]
+%D \startformula\fakeformula\stopformula
+%D \setupformulas[align=middle]
+%D \startformula\fakeformula\stopformula
+%D \setupformulas[align=right]
+%D \startformula\fakeformula\stopformula
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D Or in print:
+%D
+%D % {\getbuffer}
+%D
+%D With formula numbers these formulas look as follows:
+%D
+%D \startbuffer
+%D \setupformulas[align=left]
+%D \placeformula \startformula\fakeformula\stopformula
+%D \setupformulas[align=middle]
+%D \placeformula \startformula\fakeformula\stopformula
+%D \setupformulas[align=right]
+%D \placeformula \startformula\fakeformula\stopformula
+%D \stopbuffer
+%D
+%D % {\getbuffer}
+%D
+%D This was keyed in as:
+%D
+%D \typebuffer
+%D
+%D When tracing is turned on (\type {\tracemathtrue}) you can
+%D visualize the bounding box of the formula,
+%D
+%D % {\tracemathtrue\getbuffer}
+%D
+%D As you can see, the dimensions are the natural ones, but if
+%D needed you can force a normalized line:
+%D
+%D \startbuffer
+%D \setupformulas[strut=yes]
+%D \placeformula \startformula \fakeformula \stopformula
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D This time we get a more spacy result.
+%D
+%D % {\tracemathtrue\getbuffer}
+%D
+%D We will now show a couple of more settings and combinations
+%D of settings. In centered formulas, the number takes no space
+%D
+%D \startbuffer
+%D \setupformulas[align=middle]
+%D \startformula \fakeformula \stopformula
+%D \placeformula \startformula \fakeformula \stopformula
+%D \stopbuffer
+%D
+%D \typebuffer % {\tracemathtrue\getbuffer}
+%D
+%D You can influence the placement of the whole box with the
+%D parameters \type {leftmargin} and \type {rightmargin}.
+%D
+%D \startbuffer
+%D \setupformulas[align=right,leftmargin=3em]
+%D \startformula \fakeformula \stopformula
+%D \placeformula \startformula \fakeformula \stopformula
+%D
+%D \setupformulas[align=left,rightmargin=1em]
+%D \startformula \fakeformula \stopformula
+%D \placeformula \startformula \fakeformula \stopformula
+%D \stopbuffer
+%D
+%D \typebuffer % {\tracemathtrue\getbuffer}
+%D
+%D You can also inherit the margin from the environment.
+%D
+%D \startbuffer
+%D \setupformulas[align=right,margin=standard]
+%D \startformula \fakeformula \stopformula
+%D \placeformula \startformula \fakeformula \stopformula
+%D \stopbuffer
+%D
+%D \typebuffer % {\tracemathtrue\getbuffer}
+%D
+%D The distance between the formula and the number is only
+%D applied when the formula is left or right aligned.
+%D
+%D \startbuffer
+%D \setupformulas[align=left,distance=2em]
+%D \startformula \fakeformula \stopformula
+%D \placeformula \startformula \fakeformula \stopformula
+%D \stopbuffer
+%D
+%D \typebuffer % {\tracemathtrue\getbuffer}
+
%D \macros
%D {big..}
%D
@@ -531,23 +750,79 @@
{\scriptscriptstyle#1}}
%D \macros
-%D {frac}
+%D {frac, xfrac, xxfrac}
%D
%D This is another one Tobias asked for. It replaces the
%D primitive \type {\over}. We also take the opportunity to
%D handle math style restoring, which makes sure units and
%D chemicals come out ok.
+%D
+%D \starttypen
+%D \def\frac#1#2%
+%D {\relax
+%D \ifmmode
+%D {{\mathstyle{#1}}\over{\mathstyle{#2}}}%
+%D \else
+%D $\frac{#1}{#2}$%
+%D \fi}
+%D \stoptypen
+%D
+%D Better is:
+%D
+%D \starttypen
+%D \def\frac#1#2%
+%D {\relax\mathematics{{{\mathstyle{#1}}\over{\mathstyle{#2}}}}}
+%D \stoptypen
+%D
+%D The \type {\frac} macro kind of replaces the awkward \type
+%D {\over} primitive. Say that we habve the following formulas:
+%D
+%D \startbuffer[sample]
+%D test $\frac {1}{2}$ test $$1 + \frac {1}{2} = 1.5$$
+%D test $\xfrac {1}{2}$ test $$1 + \xfrac {1}{2} = 1.5$$
+%D test $\xxfrac{1}{2}$ test $$1 + \xxfrac{1}{2} = 1.5$$
+%D \stopbuffer
+%D
+%D \typebuffer[sample]
+%D
+%D With the most straightforward definitions, we get:
+%D
+%D \startbuffer[code]
+%D \def\dofrac#1#2#3{\relax\mathematics{{{#1{#2}}\over{#1{#3}}}}}
+%D
+%D \def\frac {\dofrac\mathstyle}
+%D \def\xfrac {\dofrac\scriptstyle}
+%D \def\xxfrac{\dofrac\scriptscriptstyle}
+%D \stopbuffer
+%D
+%D \typebuffer[code] \getbuffer[code,sample]
+%D
+%D Since this does not work well, we can try:
+%D
+%D \startbuffer[code]
+%D \def\xfrac #1#2{\hbox{$\dofrac\scriptstyle {#1}{#2}$}}
+%D \def\xxfrac#1#2{\hbox{$\dofrac\scriptscriptstyle{#1}{#2}$}}
+%D \stopbuffer
+%D
+%D \typebuffer[code] \getbuffer[code,sample]
+%D
+%D This for sure looks better than:
+%D
+%D \startbuffer[code]
+%D \def\xfrac #1#2{{\scriptstyle \dofrac\relax{#1}{#2}}}
+%D \def\xxfrac#1#2{{\scriptscriptstyle\dofrac\relax{#1}{#2}}}
+%D \stopbuffer
+%D
+%D \typebuffer[code] \getbuffer[code,sample]
+%D
+%D So we stick to the next definitions (watch the local
+%D overloading of \type {\xfrac}).
-\def\frac#1#2%
- {\relax
- \ifmmode
- {{\mathstyle{#1}}\over{\mathstyle{#2}}}%
- \else
- $\frac{#1}{#2}$%
- \fi}
+\def\dofrac#1#2#3{\relax\mathematics{{{#1{#2}}\over{#1{#3}}}}}
-\def\frac#1#2%
- {\relax\mathematics{{{\mathstyle{#1}}\over{\mathstyle{#2}}}}}
+\def\frac{\dofrac\mathstyle}
+\def\xfrac#1#2{\hbox{$\let\xfrac\xxfrac\dofrac\scriptstyle{#1}{#2}$}}
+\def\xxfrac#1#2{\hbox{$\dofrac\scriptscriptstyle{#1}{#2}$}}
%D The next macro, \type {\ch}, is \PPCHTEX\ aware. In
%D formulas one can therefore best use \type {\ch} instead of
@@ -634,7 +909,7 @@
%D How negative such a symbol looks is demonstrated in:
%D $\negative 10^{\negative 10^{\negative 10}}$.
-\stelformulesin
+\setupformulas
[\c!wijze=\@@nrwijze,
\c!blokwijze=,
\c!sectienummer=\@@nrsectienummer,
diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex
index 72c8ac66b..63b6ecd2d 100644
--- a/tex/context/base/core-mis.tex
+++ b/tex/context/base/core-mis.tex
@@ -13,6 +13,41 @@
\writestatus{loading}{Context Core Macros / Misc Commands}
+\startmessages dutch library: systems
+ title: systeem
+ 3: probeer LaTeX eens
+\stopmessages
+
+\startmessages english library: systems
+ title: system
+ 3: try LaTeX
+\stopmessages
+
+\startmessages german library: systems
+ title: system
+ 3: Versuche LaTeX
+\stopmessages
+
+\startmessages czech library: systems
+ title: system
+ 3: zkuste LaTeX
+\stopmessages
+
+\startmessages italian library: systems
+ title: sistema
+ 3: provare LaTeX
+\stopmessages
+
+\startmessages norwegian library: systems
+ title: system
+ 3: forsøker LaTeX
+\stopmessages
+
+\startmessages romanian library: systems
+ title: sistem
+ 3: incercati LaTeX
+\stopmessages
+
\unprotect
%D \macros
@@ -37,6 +72,1763 @@
\appendtoks \def\MetaPost{MetaFun}\to\simplifiedcommands
\appendtoks \def||{-}\to\simplifiedcommands
-\protect
+%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%
+ {\showmessage{\m!systems}{3}{}\stoptekst}
+
+\let\documentclass=\documentstyle
+
+% THIS WAS MAIN-002.TEX
+
+%\def\checkinterlineskip%
+% {\ifvmode
+% \ifdim\lastskip>\!!zeropoint\relax
+% \nointerlineskip
+% \else\ifdim\lastkern>\!!zeropoint\relax
+% \nointerlineskip
+% \fi\fi
+% \fi}
+
+\def\horitems#1#2% #1=breedte #2=commandos
+ {\dimen0=#1\relax
+ \divide\dimen0 by \nofitems
+ \!!counta=0\relax
+ \def\docommando##1%
+ {\advance\!!counta by 1\relax
+ \processaction
+ [\@@isuitlijnen]
+ [ \v!links=>\hbox to \dimen0{\strut##1\hss},
+ \v!rechts=>\hbox to \dimen0{\hss\strut##1},
+ \v!midden=>\hbox to \dimen0{\hss\strut##1\hss},
+ \v!marge=>\ifnum\!!counta=1\hss\else\hfill\fi
+ \strut##1%
+ \ifnum\!!counta=\nofitems\hss\else\hfill\fi,
+ \s!default=>\hbox to \dimen0{\hss\strut##1\hss}, % midden
+ \s!unknown=>\hbox to \dimen0{\strut##1\hss}]}% % links
+ \hbox to #1{\hss#2\hss}}
+
+\def\veritems#1#2% #1=breedte #2=commandos
+ {\dimen0=#1\relax
+ \def\docommando##1%
+ {\ifdim\dimen0<\!!zeropoint\relax % the - was a signal
+ \hbox to -\dimen0{\hss\strut##1}%
+ \else\ifdim\dimen0>\!!zeropoint\relax
+ \hbox to \dimen0{\strut##1\hss}%
+ \else
+ \hbox{\strut##1}%
+ \fi\fi}%
+ \vbox{#2}}
+
+\def\dostelitemsin[#1]%
+ {\getparameters[\??is][#1]%
+ \doif{\@@isbreedte}{\v!onbekend}
+ {\def\@@isbreedte{\hsize}}%
+ \doifconversiondefinedelse{\@@issymbool}
+ {\def\doitembullet##1{\convertnumber{\@@issymbool}{##1}}}
+ {\doifsymboldefinedelse{\@@issymbool}
+ {\def\doitembullet##1{\symbol[\@@issymbool]}}{}}}
+
+\def\makeitemsandbullets#1%
+ {\doifelse{\@@isn}{\v!onbekend}
+ {\getcommalistsize[#1]%
+ \edef\nofitems{\commalistsize}}
+ {\edef\nofitems{\@@isn}}%
+ \setbox0=\hbox
+ {\doitems
+ {\@@isbreedte}
+ {\processcommalist[#1]\docommando}}%
+ \setbox2=\hbox
+ {\doitems
+ {\@@isbulletbreedte}
+ {\dorecurse{\nofitems}
+ {\docommando{\strut\doitembullet{\herhaler}}}}}}
+
+\def\dostartitems#1#2#3%
+ {\let\doitems=#2
+ \def\@@isbulletbreedte{#3}%
+ \makeitemsandbullets{#1}%
+ \@@isvoor}
+
+\def\dostopitems%
+ {\@@isna
+ \egroup}
+
+\setvalue{doitems\v!boven}#1%
+ {\dostartitems{#1}\horitems\@@isbreedte
+ \noindent\vbox
+ {\forgetall
+ \doifsomething{\@@issymbool}
+ {\doifnot{\@@issymbool}{\v!geen}
+ {\box2
+ \@@istussen
+ \nointerlineskip}}%
+ \box0}%
+ \dostopitems}
+
+\setvalue{doitems\v!onder}#1%
+ {\dostartitems{#1}\horitems\@@isbreedte
+ \noindent\vbox
+ {\forgetall
+ \box0
+ \doifsomething{\@@issymbool}
+ {\@@istussen
+ \nointerlineskip
+ \box2}}%
+ \dostopitems}
+
+\setvalue{doitems\v!inmarge}#1%
+ {\dostartitems{#1}{\veritems}{-1.5em}% - is a signal
+ \noindent\hbox{\llap{\box2\hskip\linkermargeafstand}\box0}%
+ \dostopitems}
+
+\setvalue{doitems\v!links}#1%
+ {\advance\hsize by -1.5em\relax
+ \dostartitems{#1}{\veritems}{1.5em}%
+ \noindent\hbox{\box2\box0}%
+ \dostopitems}
+
+\setvalue{doitems\v!rechts}#1%
+ {\dostartitems{#1}{\veritems}{0em}%
+ \noindent\hbox{\box0\hskip-\wd2\box2}%
+ \dostopitems}
+
+\def\stelitemsin%
+ {\dosingleargument\dostelitemsin}
+
+\def\complexitems[#1]%
+ {\bgroup
+ \stelitemsin[#1]%
+ \parindent=\!!zeropoint
+ \setlocalhsize
+ \hsize=\localhsize
+ \mindermeldingen
+ \doifundefined{doitems\@@isplaats}%
+ {\let\@@isplaats\v!links}%
+ \getvalue{doitems\@@isplaats}}
+
+\definecomplexorsimpleempty\items
+
+\stelitemsin
+ [\c!plaats=\v!links,
+ \c!symbool=5,
+ \c!breedte=\hsize,
+ \c!uitlijnen=\v!midden,
+ \c!n=\v!onbekend,
+ \c!voor=\blanko,
+ \c!tussen={\blanko[\v!middel]},
+ \c!na=\blanko]
+
+% Te zijner tijd [plaats=boven,onder,midden] implementeren,
+% in dat geval moet eerst de maximale hoogte worden bepaald.
+%
+% Overigens kan een en ander mooier met \halign.
+
+\def\dodefinieeralineas[#1][#2]%
+ {\setvalue{\s!do\s!next#1}%
+ {\def\\{\getvalue{#1}}}%
+ \setvalue{#1}%
+ {\getvalue{\s!do\s!next#1}%
+ \dostartalineas{#1}}%
+ \setvalue{\e!volgende#1}%
+ {\getvalue{#1}}%
+ \setvalue{\e!start#1}%
+ {\bgroup
+ \setvalue{\s!do\s!next#1}{}%
+ \setvalue{\e!stop#1}%
+ {\getvalue{#1}%
+ \egroup}%
+ \getvalue{#1}}%
+ \getparameters[\??al#1]%
+ [\c!n=3,
+ \c!voor=\blanko,
+ \c!na=\blanko,
+ \c!afstand=1em,
+ \c!hoogte=\v!passend,
+ \c!lijn=\v!uit,
+ \c!commando=,
+ \c!uitlijnen=,
+ \c!tolerantie=\v!soepel,
+ \c!letter=,
+ \c!kleur=,
+ \c!boven=,
+ \c!boven=\vss,
+ \c!onder=\vfill,
+ #2]%
+ \setvalue{\e!stel#1\e!in}%
+ {\stelalineasin[#1]}%
+ \dorecurse
+ {\getvalue{\??al#1\c!n}}
+ {\stelalineasin[#1][\recurselevel]
+ [\c!breedte=,
+ \c!onder=\getvalue{\??al#1\c!onder},
+ \c!boven=\getvalue{\??al#1\c!boven},
+ \c!hoogte=\getvalue{\??al#1\c!hoogte},
+ \c!letter=\getvalue{\??al#1\c!letter},
+ \c!kleur=\getvalue{\??al#1\c!kleur},
+ \c!lijn=\getvalue{\??al#1\c!lijn},
+ \c!uitlijnen=\getvalue{\??al#1\c!uitlijnen},
+ \c!tolerantie=\getvalue{\??al#1\c!tolerantie},
+ \c!afstand=\getvalue{\??al#1\c!afstand}]}%
+ \stelalineasin[#1][1][\c!afstand=0em]}
+
+% nog monster
+%
+%\assignwidth
+% {\!!widtha}
+% {\getvalue{\??dd#1\c!breedte}}
+% {\doifelsevaluenothing{\??dd#1\c!monster}
+% {\hskip
+% {\doattributes
+% {\??al#1}\c!letter\c!kleur
+% {\getvalue{\??dd#1\c!monster}}}}
+% {0pt}
+
+\def\definieeralineas%
+ {\dodoubleargument\dodefinieeralineas}
+
+\def\dostelalineasin[#1][#2][#3]%
+ {\doifelse{#2}{\v!elk}
+ {\dorecurse
+ {\getvalue{\??al#1\c!n}}
+ {\getparameters[\??al#1\herhaler][#3]}}
+ {\ConvertToConstant\doifelse{#3}{}
+ {\getparameters[\??al#1][#2]}
+ {\def\docommando##1%
+ {\getparameters[\??al#1##1][#3]}%
+ \processcommalist[#2]\docommando}}}
+
+\def\stelalineasin%
+ {\dotripleempty\dostelalineasin}
+
+\newcount\alteller
+\newcount\alnsize
+\newdimen\alhsize
+
+\def\doalinealijn#1#2%
+ {\doifelsevalue{\??al#2\the\alteller\c!lijn}{\v!aan}
+ {\expandafter\dimen2=#1\relax
+ \hskip.5\dimen2
+ \hskip-\linewidth
+ \vrule\!!width\linewidth
+ \hskip.5\dimen2}
+ {\hskip#1}}
+
+\def\dostartalinea#1%
+ {\doifelsevaluenothing{\??al#1\the\alteller\c!breedte}
+ {\!!widtha=\alhsize\relax
+ \divide\!!widtha by \alnsize}
+ {\!!widtha=\getvalue{\??al#1\the\alteller\c!breedte}\relax}%
+ \dostartattributes
+ {\??al#1\the\alteller}\c!letter\c!kleur
+ {}%
+ \doifelsevalue{\??al#1\the\alteller\c!hoogte}{\v!passend}
+ {\setbox0=\vtop}
+ {\setbox0=\vtop to \getvalue{\??al#1\the\alteller\c!hoogte}}%
+ \bgroup
+ \blanko[\v!blokkeer]%
+ \forgetall
+ \getvalue{\??al#1\the\alteller\c!boven}%
+ \getvalue{\??al#1\c!binnen}%
+ \hsize=\!!widtha % setting \wd afterwards removed
+ \getvalue{\??al#1\the\alteller\c!binnen}%
+ \edef\!!stringa{\getvalue{\??al#1\the\alteller\c!uitlijnen}}% nodig?
+ \expandafter\steluitlijnenin\expandafter[\!!stringa]%
+ \edef\!!stringa{\getvalue{\??al#1\the\alteller\c!tolerantie}}% nodig?
+ \expandafter\steltolerantiein\expandafter[\!!stringa]%
+ \ignorespaces
+ \endgraf
+ \ignorespaces
+ %
+ % Nadeel van de onderstaande constructie is dat \everypar
+ % binnen een groep kan staan en zo steeds \begstruts
+ % worden geplaatst. Mooi is anders dus moet het anders!
+ %
+ % Hier is \Everypar niet nodig.
+ %
+ \everypar{\begstrut\everypar{}}%
+ %
+ \ignorespaces\geenspatie % dubbel: \ignorespaces
+ \getvalue{\??al#1\the\alteller\c!commando}}
+
+\def\dostopalinea#1%
+ {\ifvmode
+ \removelastskip
+ \else
+ \unskip\endstrut\endgraf
+ \fi
+ \getvalue{\??al#1\the\alteller\c!onder}%
+ \egroup
+ \ifdim\wd0=\!!zeropoint % no data
+ \wd0=\!!widtha
+ \fi
+ \box0
+ \dostopattributes
+ \ifnum\alteller<\getvalue{\??al#1\c!n}\relax
+ \def\next{\doalinea{#1}}%
+ \else
+ \def\next{\dostopalineas{#1}}%
+ \fi
+ \next}
+
+\def\doalinea#1%
+ {\global\advance\alteller by 1\relax
+ \doifelsevaluenothing{\??al#1\the\alteller\c!afstand}
+ {\doifnot{\the\alteller}{1}
+ {\hskip\getvalue{\??al#1\c!afstand}}}
+ {\doifelse{\the\alteller}{1}%
+ {\hskip\getvalue{\??al#1\the\alteller\c!afstand}}
+ {\doalinealijn{\getvalue{\??al#1\the\alteller\c!afstand}}{#1}}}%
+ \setvalue{#1}{\dostopalinea{#1}}%
+ \dostartalinea{#1}}
+
+\def\dostartalineas#1%
+ {\global\alteller=0\relax
+ \parindent=\!!zeropoint
+ \setlocalhsize
+ \alhsize=\localhsize
+ \alnsize=\getvalue{\??al#1\c!n}\relax
+ \dorecurse
+ {\getvalue{\??al#1\c!n}}
+ {\doifelsevaluenothing{\??al#1\recurselevel\c!afstand}
+ {\doifnot{\recurselevel}{1}
+ {\global\advance\alhsize by -\getvalue{\??al#1\c!afstand}\relax}}
+ {\global\advance\alhsize by -\getvalue{\??al#1\recurselevel\c!afstand}\relax}%
+ \doifvaluesomething{\??al#1\recurselevel\c!breedte}
+ {\global\advance\alnsize by -1\relax
+ \global\advance\alhsize by -\getvalue{\??al#1\recurselevel\c!breedte}\relax}}%
+ %\witruimte % gaat fout bij \framed
+ \getvalue{\??al#1\c!voor}%
+ \leavevmode % gaat wel goed bij \framed
+ \vbox\bgroup\hbox\bgroup
+ \doalinea{#1}}
+
+\def\dostopalineas#1%
+ {\egroup
+ \egroup
+ \par
+ \getvalue{\??al#1\c!na}}%
+
+\def\dosteltabin[#1]%
+ {\getparameters[\??ta]
+ [\c!kopletter=\v!normaal,
+ \c!kopkleur=,
+ \c!letter=\v!normaal,
+ \c!kleur=,
+ \c!breedte=\v!ruim,
+ \c!monster={\hskip4em},
+ \c!voor=,
+ \c!na=,
+ #1]%
+ \doordefinieren
+ [tab]
+ [\c!kopletter=\@@takopletter,
+ \c!kopkleur=\@@takleur,
+ \c!monster=\@@tamonster,
+ \c!breedte=\@@tabreedte,
+ \c!voor=\@@tavoor,
+ \c!na=\@@tana]}
+
+\def\steltabin%
+ {\dosingleargument\dosteltabin}
+
+\steltabin
+ [\c!plaats=\v!links]
+
+% The following macro's are derived from PPCHTEX and
+% therefore take some LaTeX font-switching into account.
+
+\newif\ifloweredsubscripts
+
+% Due to some upward incompatibality of LaTeX to LaTeX2.09
+% and/or LaTeX2e we had to force \@@chemieletter. Otherwise
+% some weird \nullfont error comes up.
+
+\doifundefined{@@chemieletter}{\def\@@chemieletter{\rm}}
+
+\def\beginlatexmathmodehack%
+ {\ifmmode
+ \let\endlatexmathmodehack=\relax
+ \else
+ \def\endlatexmathmodehack{$}$\@@chemieletter
+ \fi}
+
+\def\setsubscripts%
+ {\beginlatexmathmodehack
+ \def\dosetsubscript##1##2##3%
+ {\dimen0=##3\fontdimen5##2%
+ \setxvalue{@@\string##1\string##2}{\the##1##2\relax}%
+ ##1##2=\dimen0\relax}%
+ \def\dodosetsubscript##1##2%
+ {\dosetsubscript{##1}{\textfont2}{##2}%
+ \dosetsubscript{##1}{\scriptfont2}{##2}%
+ \dosetsubscript{##1}{\scriptscriptfont2}{##2}}%
+ %\dodosetsubscript{\fontdimen14}{?}%
+ \dodosetsubscript{\fontdimen16}{.7}%
+ \dodosetsubscript{\fontdimen17}{.7}%
+ \global\loweredsubscriptstrue
+ \endlatexmathmodehack}
+
+\def\resetsubscripts%
+ {\ifloweredsubscripts
+ \beginlatexmathmodehack
+ \def\doresetsubscript##1##2%
+ {\dimen0=\getvalue{@@\string##1\string##2}\relax
+ ##1##2=\dimen0}%
+ \def\dodoresetsubscript##1%
+ {\doresetsubscript{##1}{\textfont2}%
+ \doresetsubscript{##1}{\scriptfont2}%
+ \doresetsubscript{##1}{\scriptscriptfont2}}%
+ %\dodoresetsubscript{\fontdimen14}%
+ \dodoresetsubscript{\fontdimen16}%
+ \dodoresetsubscript{\fontdimen17}%
+ \global\loweredsubscriptsfalse
+ \endlatexmathmodehack
+ \fi}
+
+\let\beginlatexmathmodehack = \relax
+\let\endlatexmathmodehack = \relax
+
+\def\chem#1#2#3%
+ {\bgroup
+ \setsubscripts
+ \mathematics{\hbox{#1}_{#2}^{#3}}%
+ \resetsubscripts
+ \egroup}
+
+\def\celsius#1%
+ {#1\mathematics{^\circ}C}
+
+\def\graden%
+ {\mathematics{^\circ}}
+
+\def\inch%
+ {\hbox{\rm\char125\relax}}
+
+\def\breuk#1#2%
+ {\mathematics{#1\over#2}}
+
+%\def\bedrag#1%
+% {\mathematics{f~}\hbox{#1}}
+
+\def\bedragprefix{\mathematics{f\normalfixedspace}}
+\def\bedragsuffix{}
+
+\def\bedrag#1%
+ {\strut\hbox\bgroup
+ \let\normalfixedspace~%
+ % \def~{\futurelet\next\dofixedspace}%
+ % \def\dofixedspace%
+ % {\hskip.5em\relax
+ % \ifx\next,%
+ % \hphantom{,}\let\next\gobbleoneargument
+ % \else\ifx\next.%
+ % \hphantom{.}\let\next\gobbleoneargument
+ % \else
+ % \let\next\relax
+ % \fi\fi
+ % \next}%
+ % \bedragprefix#1\bedragsuffix
+ \bedragprefix\digits{#1}\bedragsuffix
+ \egroup}
+
+% \definieeralineas[test][n=3]
+%
+% \stelalineasin[test][3][breedte=4cm,uitlijnen=links]
+%
+% \startopelkaar
+% \test hans \\ ton \\ \bedrag{1.000,--} \\
+% \test hans \\ ton \\ \bedrag{~.~~1,--} \\
+% \test hans \\ ton \\ \bedrag{~.~~1,~~} \\
+% \test hans \\ ton \\ \bedrag{~.100,--} \\
+% \test hans \\ ton \\ \subtot{1.000,--} \\
+% \test hans \\ ton \\ \bedrag{1.000,--} \\
+% \test hans \\ ton \\ \bedrag{1.000,--} \\
+% \test hans \\ ton \\ \totaal{1.000,--} \\
+% \test hans \\ ton \\ \bedrag{nihil,--} \\
+% \test hans \\ ton \\ \totaal{nihil,--} \\
+% \test hans \\ ton \\ \subtot{nihil,--} \\
+% \stopopelkaar
+
+\def\doorsnede%
+ {\hbox{\rlap/$\circ$} }
+
+\def\complexpunten[#1]%
+ {\dimen0=.5em\relax
+ \multiply\dimen0 by #1\relax
+ \hbox to \dimen0
+ {\leaders\hbox to .5em{\hss.\hss}\hss}}
+
+\def\simplepunten%
+ {\complexpunten[5]}
+
+\definecomplexorsimple\punten
+
+\def\ongeveer%
+ {\mathematics{\pm}}
+
+\def\permille%
+ {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle00}}}
+
+\def\percent%
+ {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle0}}}
+
+\let\promille=\permille
+\let\procent =\percent
+
+\def\permine%
+ {\dontleavehmode
+ \bgroup
+ \setbox0=\hbox
+ {\mathematics{+}}%
+ \hbox to \wd0
+ {\hss
+ \mathematics{^{\scriptscriptstyle-}\kern-.4em/\kern-.3em_{\scriptscriptstyle-}}%
+ \hss}%
+ \egroup}
+
+% for compatibility
+
+\def\unknown%
+ {\dontleavehmode\punten[3]}
+
+% currency
+
+\def\dollar%
+ {\bgroup
+ \ifnum\fam=\itfam
+ \sl
+ \else\ifnum\fam=\bifam
+ \bs
+ \fi\fi
+ \$%
+ \egroup}
+
+\def\sterling%
+ {\bgroup
+ \ifnum\fam=\bffam
+ \bi
+ \else\ifnum\fam=\bifam
+ \bi
+ \else\ifnum\fam=\bsfam
+ \bi
+ \else
+ \it
+ \fi\fi\fi
+ \$%
+ \egroup}
+
+\def\florijn%
+ {\bgroup
+ \ifnum\fam=\bffam
+ \bi
+ \else\ifnum\fam=\bifam
+ \bi
+ \else\ifnum\fam=\bsfam
+ \bi
+ \else
+ \it
+ \fi\fi\fi
+ 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]
+
+% Tijden horen hier niet thuis en zullen in een aparte
+% module worden ondergebracht. voorlopig handhaven we ze nog
+% even. Een implementatie met \doordefinieren zou beter voldoen
+% omdat een en ander dan instelbaar wordt. Het is trouwens
+% zowieso beter het commando \tijd te reserveren voor de
+% systeemtijd.
+
+\def\tijd#1%
+ {\setbox0=\hbox{00.00}%
+ \hbox to \wd0{\hfill#1}}
+
+\def\tijdspan#1#2%
+ {\hbox{\tijd{#1}~---~\tijd{#2}}}
+
+\def\activiteit#1#2%
+ {\activity{\tijdspan{#1}{#2}}}
+
+\def\activiteit#1#2%
+ {\sym{\tijdspan{#1}{#2}}}
+
+
+\def\dotoevoegen#1%
+ {\def\next{#1}%
+ \dorecurse{#1}{\inlinker{\next~+}\def\next{}\crlf}}
+
+\def\complextoevoegen[#1]%
+ {\blanko
+ \processaction
+ [#1]
+ [ \v!klein=>\dotoevoegen{3},
+ \v!middel=>\dotoevoegen{6},
+ \v!groot=>\dotoevoegen{9},
+ \s!default=>\dotoevoegen{6},
+ \s!unknown=>\dotoevoegen{#1}]
+ \blanko}
+
+\definecomplexorsimpleempty\toevoegen
+
+
+\def\dorooster[#1]%
+ {\begingroup
+ \getparameters[\??rt]
+ [\c!x=0,\c!y=0,
+ \c!nx=10,\c!ny=10,
+ \c!dx=.5,\c!dy=.5,
+ \c!xstap=0,\c!ystap=0,
+ \c!eenheid=\s!cm,
+ \c!schaal=1,
+ \c!factor=1,
+ \c!offset=\v!ja,
+ \c!plaats=\v!links,
+ #1]%
+ \startpositioning
+ \dimen0=\@@rtdx\@@rteenheid\relax
+ \dimen0=\@@rtschaal\dimen0\relax
+ \dimen0=\@@rtfactor\dimen0\relax
+ \multiply\dimen0 by \@@rtnx\relax
+ \dimen2=\@@rtdy\@@rteenheid\relax
+ \dimen2=\@@rtschaal\dimen2\relax
+ \dimen2=\@@rtfactor\dimen2\relax
+ \multiply\dimen2 by \@@rtny\relax
+ \def\horline
+ {\vbox
+ {\hrule
+ \!!width \dimen0
+ \!!height \linewidth
+ \!!depth \!!zeropoint}}%
+ \def\verline%
+ {\vrule
+ \!!width \linewidth
+ \!!height \dimen2
+ \!!depth \!!zeropoint}%
+ \doglobal\newcounter\@@roosterc
+ \doglobal\newcounter\@@roosterd
+ \doglobal\newcounter\@@roostere
+ \def\setlegend##1##2##3%
+ {\gdef\@@roosterc{0}%
+ \dimen0=2em\relax
+ \dimen2=##2\@@rteenheid\relax
+ \dimen2=\@@rtschaal\dimen2\relax
+ \dimen2=\@@rtfactor\dimen2\relax
+ \divide\dimen0 by \dimen2\relax
+ \xdef\@@roostere{\number\dimen0}%
+ \ifnum\@@roostere>50
+ \gdef\@@roostere{100}%
+ \else\ifnum\@@roostere>10
+ \gdef\@@roostere{50}%
+ \else\ifnum\@@roostere>5
+ \gdef\@@roostere{10}%
+ \else\ifnum\@@roostere>1
+ \gdef\@@roostere{5}%
+ \else
+ \gdef\@@roostere{1}%
+ \fi\fi\fi\fi
+ \gdef\@@roosterd{0}%
+ \def\legend%
+ {\ifnum\@@roosterd=0\relax
+ \vbox
+ {\increment(\@@roosterc,##1)%
+ \hbox to 2em{\hss\@@roosterc\hss}}%
+ \global\let\@@roosterd=\@@roostere
+ \fi
+ \doglobal\decrement\@@roosterd
+ \doglobal\increment(\@@roosterc,##1)}}%
+ \def\draw##1##2##3##4##5##6##7##8##9%
+ {\setuppositioning
+ [\c!status=##8,
+ \c!xstap=\v!absoluut,
+ \c!ystap=\v!absoluut,
+ \c!eenheid=\@@rteenheid,
+ \c!schaal=\@@rtschaal,
+ \c!factor=\@@rtfactor,
+ \c!offset=\@@rtoffset,
+ \c!xoffset=##6,
+ \c!yoffset=##7]%
+ \doifelse{##9}{\v!midden}
+ {\scratchdimen=##3pt\scratchdimen=.5\scratchdimen
+ \edef\@@psxx{\withoutpt\the\scratchdimen}%
+ \scratchdimen=##4pt\scratchdimen=.5\scratchdimen
+ \edef\@@psyy{\withoutpt\the\scratchdimen}%
+ \scratchcounter=##2\advance\scratchcounter by -1
+ \edef\@@pszz{\the\scratchcounter}}
+ {\edef\@@psxx{0}\edef\@@psyy{0}\edef\@@pszz{##2}}%
+ \position(\@@psxx,\@@psyy){##1}%
+ \setuppositioning
+ [\c!status=##8,
+ \c!xstap=\v!relatief,
+ \c!ystap=\v!relatief,
+ \c!schaal=\@@rtschaal,
+ \c!factor=\@@rtfactor,
+ \c!offset=\@@rtoffset,
+ \c!eenheid=\@@rteenheid]%
+ \dorecurse{\@@pszz}{\position(##3,##4){##5}}}%
+ \draw
+ \verline\@@rtnx\@@rtdx0\verline\!!zeropoint\!!zeropoint\v!start\empty
+ \draw
+ \horline\@@rtny0\@@rtdy\horline\!!zeropoint\!!zeropoint\v!start\empty
+ \tfx
+ \doifnot{\@@rtxstap}{0}
+ {\setlegend\@@rtxstap\@@rtdx\@@rtx
+ \draw\legend\@@rtnx\@@rtdx0\legend{-1em}{-1.5em}\v!overlay\@@rtplaats}%
+ \doifnot{\@@rtystap}{0}
+ {\setlegend\@@rtystap\@@rtdy\@@rty
+ \draw\legend\@@rtny0\@@rtdy\legend{-2em}{-.75ex}\v!overlay\@@rtplaats}%
+ \stoppositioning
+ \endgroup}
+
+\def\rooster%
+ {\dosingleempty\dorooster}
+
+% Dit wordt:
+%
+% \doorverwijzen[naam][instellingen] enz.
+%
+% waarbij <naam> bijvoorbeeld publicatie is. Dit levert:
+%
+% \start<naam>
+% \stop<naam>
+%
+% \beginvan<naam>
+% \eindvan<naam>
+%
+% \publicatie
+%
+% \volledigelijstmetpublicaties
+%
+% eigenlijk kan ook door... zo worden uitgebreid!
+
+\doornummeren
+ [@publicatie]
+ [\c!plaats=\v!links,
+ \c!breedte=\@@pbbreedte,\c!hang=,\c!monster=,
+ \c!voor=\@@pbvoor,\c!na=\@@pbna,\c!tussen=,
+ \c!kopletter=\@@pbkopletter,\c!letter=,
+ \c!kopkleur=\@@pbkopkleur,\c!kleur=,
+ \c!wijze=\@@pbwijze,\c!blokwijze=\@@pbblokwijze,
+ \c!tekst=,\c!links=\@@pblinks,\c!rechts=\@@pbrechts]
+
+\def\dostelpublicatiesin[#1]%
+ {\getparameters[\??pb][#1]}
+
+\def\stelpublicatiesin%
+ {\dosingleargument\dostelpublicatiesin}
+
+\def\apa@publicatie%
+ {\doifsomething{\@@pb@naam}{\@@pb@naam,\spatie}%
+ \doifsomething{\@@pb@titel}{{\sl\@@pb@titel}.\spatie}%
+ \doifsomething{\@@pb@jaar}{(\@@pb@jaar).\spatie}%
+ \doifsomething{\@@pb@plaats}{\@@pb@plaats\doifelsenothing{\@@pb@uitgever}{.}{:\spatie}}%
+ \doifsomething{\@@pb@uitgever}{\@@pb@uitgever.}}
+
+\def\normaal@publicatie%
+ {\@@pb@naam, \@@pb@titel, \@@pb@jaar, \@@pb@pagina, \@@pb@plaats, \@@pb@uitgever.}
+
+\def\complexstartpublicatie[#1]#2\stoppublicatie%
+ {\bgroup%
+ \def\dosetpublicatie%
+ {\processcommalist
+ [naam,titel,jaar,plaats,pagina,uitgever]
+ \setpublicatie
+ \ignorespaces}%
+ \def\setpublicatie##1%
+ {\setvalue{\??pb @##1}{}%
+ \setvalue{##1}####1{\setvalue{\??pb @##1}{####1}\ignorespaces}}%
+ \def\getpublicatie%
+ {\doifsomething{\@@pbvariant}{\getvalue{\@@pbvariant @publicatie}}}%
+ \doifelse{\@@pbnummeren}{\v!ja}%
+ {\@publicatie[#1]\dosetpublicatie#2\getpublicatie\par}%
+ {\@@pbvoor
+ \dosetpublicatie\ignorespaces#2\getpublicatie
+ \@@pbna}%
+ \egroup}
+
+\definecomplexorsimpleempty\startpublicatie
+
+\def\publicatie#1[#2]%
+ {\@@pblinks\in{#1}[#2]\@@pbrechts}
+
+\stelpublicatiesin
+ [\c!nummeren=\v!ja,
+ \c!variant=\c!apa,
+ \c!breedte=2em,
+ \c!hang=,
+ \c!monster=,
+ \c!voor=,
+ \c!na=,
+ \c!tussen=,
+ \c!kopletter=,
+ \c!kopkleur=,
+ \c!letter=,
+ \c!kleur=,
+ \c!blokwijze=\v!per\v!tekst,
+ \c!wijze=\v!per\v!tekst,
+ \c!tekst=,
+ \c!links={[},
+ \c!rechts={]}]
+
+\def\kenmerkdatum%
+ {\currentdate[\v!kenmerk]}
+
+\def\dokenmerk[#1]%
+ {\noheaderandfooterlines
+ \bgroup
+ \getparameters
+ [\??km]
+ [\c!bet=\unknown,\c!dat=\unknown,\c!ken=\unknown,
+ \c!van=, \c!aan=, \c!ref=, #1]%
+ % moet anders, hoort niet in 01b
+ \assigntranslation[nl=referentie,en=reference,du=Referenz, sp=referencia]\to\@@@kmref
+ \assigntranslation[nl=van, en=from, du=Von, sp=de]\to\@@@kmvan
+ \assigntranslation[nl=aan, en=to, du=An, sp=a]\to\@@@kmaan
+ \assigntranslation[nl=betreft, en=concerns, du=Betreff, sp=]\to\@@@kmbet
+ \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|]
+ \startdummy
+ \NC\@@@kmbet\EQ\@@kmbet\NC\NR
+ \NC\@@@kmdat\EQ\@@kmdat\NC\NR
+ \NC\@@@kmken\EQ\expanded{\kap{\@@kmken}}\NC\NR
+ \doifsomething{\@@kmvan\@@kmaan}{\NC\NC\NC\NR}%
+ \doifsomething{\@@kmvan}{\NC\@@@kmvan\EQ\@@kmvan\NC\NR}%
+ \doifsomething{\@@kmaan}{\NC\@@@kmaan\EQ\@@kmaan\NC\NR}%
+ \doifsomething{\@@kmref}{\NC\NC\NC\NR\NC\@@@kmref\EQ\@@kmref\NC\NR}%
+ \stopdummy
+ \egroup}
+
+\def\kenmerk%
+ {\dosingleargument\dokenmerk}
+
+% NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW
+% NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW
+
+\def\??ri{@@ri}
+
+\def\stelrijenin%
+ {\dodoubleargument\getparameters[\??ri]}
+
+\def\complexstartrijen[#1]%
+ {\bgroup
+ \stelrijenin[#1]%
+ \let\do@@rionder=\relax
+ \def\rij%
+ {\do@@rionder
+ \egroup
+ \dimen0=\vsize
+ \divide\dimen0 by \@@rin
+ \advance\dimen0 by -\lineskip
+ \vbox to \dimen0
+ \bgroup
+ \@@riboven
+ \let\do@@rionder=\@@rionder
+ \ignorespaces}%
+ \bgroup
+ \rij}
+
+\definecomplexorsimpleempty\startrijen
+
+\def\stoprijen%
+ {\do@@rionder
+ \egroup
+ \egroup}
+
+\stelrijenin
+ [\c!n=2,
+ \c!boven=,
+ \c!onder=\vfill]
+
+% THIS WAS MAIN-003.TEX
+
+\startmessages dutch library: systems
+ 41: externe file -- in groep -- bestaat niet
+\stopmessages
+
+\startmessages english library: systems
+ 41: external file -- in group -- does not exist
+\stopmessages
+
+\startmessages german library: systems
+ 41: Externe Datei -- in Gruppe -- existiert nicht
+\stopmessages
+
+\startmessages czech library: systems
+ 41: externi soubor -- ve skupine -- neexistuje
+\stopmessages
+
+\startmessages italian library: systems
+ 41: il file esterno -- del gruppo -- non esiste
+\stopmessages
+
+\startmessages norwegian library: systems
+ 41: ekstern fil -- i gruppe -- eksisterer ikke
+\stopmessages
+
+\startmessages romanian library: systems
+ 41: fisierul extern -- din grupul -- nu exista
+\stopmessages
+
+\definetabulate
+ [\e!legenda]
+ [|emj1|i1|mR|]
+
+\setuptabulate
+ [\e!legenda]
+ [\c!eenheid=.75em,\c!binnen=\setquicktabulate\leg,EQ={=}]
+
+\definetabulate
+ [\e!legenda][\v!twee]
+ [|emj1|emk1|i1|mR|]
+
+\definetabulate
+ [\e!gegeven]
+ [|R|ecmj1|i1mR|]
+
+\setuptabulate
+ [\e!gegeven]
+ [\c!eenheid=.75em,\c!binnen=\setquicktabulate\geg,EQ={=}]
+
+\unexpanded\def\xbox%
+ {\bgroup\aftergroup\egroup\hbox\bgroup\tx\let\next=}
+
+\unexpanded\def\xxbox%
+ {\bgroup\aftergroup\egroup\hbox\bgroup\txx\let\next=}
+
+% \def\mrm#1%
+% {$\rm#1$}
+
+%D \macros
+%D {definepairedbox, setuppairedbox, placepairedbox}
+%D
+%D Paired boxes, formally called legends, but from now on a
+%D legend is just an instance, are primarily meant for
+%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 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
+%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
+% \test right \test right,top \test right,bottom \test right,middle
+% \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%
+% {\pagina
+% \typebuffer[demo]
+% \def\test##1
+% {\startlinecorrection[blank]
+% \getbuffer[demo]%
+% \ruledhbox\placelegend
+% [bodyfont=6pt,location={##1}]
+% {\framed[width=.25\textwidth]{\tttf##1}}
+% {#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 {setuplegend, placelegend}
+%D
+%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 \type {bottom} or \type {right}. The macro macro is used as
+%D follows.
+%D
+%D \starttypen
+%D \placefigure
+%D {whow}
+%D {\placelegend
+%D {\externalfigure[cow]}
+%D {\starttabulation
+%D \NC 1 \NC head \NC \NR
+%D \NC 2 \NC legs \NC \NR
+%D \NC 3 \NC tail \NC \NR
+%D \stoptabulation}}
+%D
+%D \placefigure
+%D {whow}
+%D {\placelegend
+%D {\externalfigure[cow]}
+%D {\starttabulation[|l|l|l|l|]
+%D \NC 1 \NC head \NC 3 \NC tail \NC \NR
+%D \NC 2 \NC legs \NC \NC \NC \NR
+%D \stoptabulation}}
+%D
+%D \placefigure
+%D {whow}
+%D {\placelegend[n=2]
+%D {\externalfigure[cow]}
+%D {\starttabulation
+%D \NC 1 \NC head \NC \NR
+%D \NC 2 \NC legs \NC \NR
+%D \NC 3 \NC tail \NC \NR
+%D \stoptabulation}}
+%D
+%D \placefigure
+%D {whow}
+%D {\placelegend[n=2]
+%D {\externalfigure[cow]}
+%D {head \par legs \par tail}}
+%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 \stopitemize}}
+%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 \stopitemize}}
+%D \stoptypen
+
+% \def\setuplegend%
+% {\dodoubleargument\getparameters[\??ld]}
+%
+% \setuplegend
+% [\c!n=1,
+% \c!afstand=1em,
+% \c!tussen={\blanko[\v!middel]},
+% \c!breedte=\hsize,
+% \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
+% \dowithnextbox
+% {\switchtobodyfont[\@@ldkorps]% split under same regime
+% \scratchdimen=\wd\nextbox
+% \doifelse{\@@ldplaats}{\v!rechts}
+% {\vsize=\ht\nextbox
+% \vsize=\@@ldhoogte
+% \hsize=\zetbreedte
+% \advance\hsize by -\scratchdimen
+% \advance\hsize by -\@@ldafstand
+% \plaatsnaastelkaar{\box\nextbox}\bgroup}
+% {\hsize\scratchdimen
+% \plaatsonderelkaar{\box\nextbox}\bgroup}%
+% \hsize\@@ldbreedte
+% \doif{\@@ldplaats}{\v!rechts}{\hskip\@@ldafstand}%
+% \ifnum\@@ldn>1
+% \setrigidcolumnhsize\hsize\@@ldafstand\@@ldn
+% \fi
+% \dowithnextbox
+% {\doifelse{\@@ldplaats}{\v!rechts}
+% {\vbox to \vsize
+% {\ifnum\@@ldn>1
+% \rigidcolumnbalance\nextbox
+% \else
+% \box\nextbox
+% \fi
+% \vfill}}
+% {\vbox
+% {\@@ldtussen
+% \ifnum\@@ldn>1
+% \rigidcolumnbalance\nextbox
+% \else
+% \box\nextbox
+% \fi}}%
+% \egroup\egroup}%
+% \vbox
+% \bgroup
+% \forgetall
+% \tolerantTABLEbreaktrue % hm.
+% \blanko[\v!blokkeer]%
+% \everypar{\begstrut}%
+% \let\next=}
+% \hbox}
+
+\newbox\firstpairedbox
+\newbox\secondpairedbox
+
+\def\definepairedbox%
+ {\dodoubleempty\dodefinepairedbox}
+
+\def\dodefinepairedbox[#1][#2]%
+ {\getparameters
+ [\??ld#1]
+ [\c!n=1,
+ \c!afstand=\bodyfontsize,
+ \c!tussen={\blanko[\v!middel]},
+ \c!breedte=\hsize,
+ \c!hoogte=\vsize,
+ \c!maxbreedte=\zetbreedte,
+ \c!maxhoogte=\zethoogte,
+ \c!korps=,
+ \c!uitlijnen=,
+ \c!plaats=\v!onder,
+ #2]%
+ \setvalue{\e!stel#1\e!in}{\setuppairedbox[#1]}%
+ \setvalue{\e!plaats#1}{\placepairedbox[#1]}}
+
+\def\setuppairedbox%
+ {\dodoubleempty\dosetuppairedbox}
+
+\def\dosetuppairedbox[#1]%
+ {\getparameters[\??ld#1]}
+
+\def\placepairedbox%
+ {\bgroup\dodoubleempty\doplacepairedbox}
+
+\def\doplacepairedbox[#1][#2]% watch the hsize/vsize tricks
+ {\setuppairedbox[#1][#2]% % and don't change them
+ \copyparameters
+ [\??ld][\??ld#1]
+ [\c!n,\c!afstand,\c!tussen,
+ \c!breedte,\c!hoogte,\c!maxbreedte,\c!maxhoogte,
+ \c!korps,\c!uitlijnen,\c!plaats]%
+ \beforefirstpairedbox
+ \dowithnextbox
+ {\betweenbothpairedboxes
+ \dowithnextbox
+ {\afterbothpairedboxes
+ \egroup}
+ \vbox\bgroup
+ \insidesecondpairedbox
+ \let\next=}
+ \hbox}
+
+\def\beforefirstpairedbox%
+ {\chardef\pairedlocationa=1 % left
+ \chardef\pairedlocationb=4 % middle
+ \getfromcommacommand[\@@ldplaats][1]%
+ \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
+ [\commalistelement]
+ [ \v!links=>\chardef\pairedlocationb=0,
+ \v!rechts=>\chardef\pairedlocationb=1,
+ \v!hoog=>\chardef\pairedlocationb=2,
+ \v!boven=>\chardef\pairedlocationb=2,
+ \v!laag=>\chardef\pairedlocationb=3,
+ \v!onder=>\chardef\pairedlocationb=3,
+ \v!midden=>\chardef\pairedlocationb=4]}
+
+\def\betweenbothpairedboxes%
+ {\switchtobodyfont[\@@ldkorps]% split under same regime
+ \setbox\firstpairedbox=\box\nextbox
+ \ifnum\pairedlocationa<2
+ \hsize\wd\firstpairedbox % trick
+ \hsize=\@@ldbreedte
+ \scratchdimen=\wd\firstpairedbox
+ \advance\scratchdimen by \@@ldafstand
+ \bgroup\advance\scratchdimen by \hsize
+ \ifdim\scratchdimen>\@@ldmaxbreedte\relax
+ \egroup
+ \hsize=\@@ldmaxbreedte
+ \advance\hsize by -\scratchdimen
+ \else
+ \egroup
+ \fi
+ \else
+ \hsize\wd\firstpairedbox
+ \hsize\@@ldbreedte % can be \hsize
+ \ifdim\hsize>\@@ldmaxbreedte\relax \hsize=\@@ldmaxbreedte \fi % can be \hsize
+ \fi
+ \ifnum\@@ldn>1
+ \setrigidcolumnhsize\hsize\@@ldafstand\@@ldn
+ \fi}
+
+\def\afterbothpairedboxes%
+ {\setbox\secondpairedbox=\vbox
+ {\ifnum\@@ldn>1 \rigidcolumnbalance\nextbox \else \box\nextbox \fi}%
+ \ifnum\pairedlocationa<2\hbox\else\vbox\fi\bgroup % hide vsize
+ \forgetall
+ \ifnum\pairedlocationa<2
+ \scratchdimen=\maxoftwoboxdimens\ht\firstpairedbox\secondpairedbox
+ \vsize=\scratchdimen
+ \ifdim\scratchdimen<\@@ldhoogte\relax % can be \vsize
+ \scratchdimen=\@@ldhoogte
+ \fi
+ \ifdim\scratchdimen>\@@ldmaxhoogte\relax
+ \scratchdimen=\@@ldmaxhoogte
+ \fi
+ \valignpairedbox\firstpairedbox \scratchdimen
+ \valignpairedbox\secondpairedbox\scratchdimen
+ \else
+ \scratchdimen=\maxoftwoboxdimens\wd\firstpairedbox\secondpairedbox
+ \halignpairedbox\firstpairedbox \scratchdimen
+ \halignpairedbox\secondpairedbox\scratchdimen
+ \scratchdimen=\ht\secondpairedbox
+ \vsize=\scratchdimen
+ \ifdim\ht\secondpairedbox<\@@ldhoogte\relax % can be \vsize
+ \scratchdimen=\@@ldhoogte\relax % \relax needed
+ \fi
+ \ifdim\scratchdimen>\@@ldmaxhoogte\relax % todo: totale hoogte
+ \scratchdimen=\@@ldmaxhoogte\relax % \relax needed
+ \fi
+ \ifdim\scratchdimen>\ht\secondpairedbox
+ \setbox\secondpairedbox\vbox to \scratchdimen
+ {\ifnum\pairedlocationa=3 \vss\fi
+ \box\secondpairedbox
+ \ifnum\pairedlocationa=2 \vss\fi}%
+ \fi
+ \fi
+ \ifcase\pairedlocationa
+ \box\secondpairedbox\hskip\@@ldafstand\box\firstpairedbox \or
+ \box\firstpairedbox \hskip\@@ldafstand\box\secondpairedbox\or
+ \box\secondpairedbox\par \@@ldtussen \box\firstpairedbox \or
+ \box\firstpairedbox \par \@@ldtussen \box\secondpairedbox\else
+ \fi
+ \egroup}
+
+\def\insidesecondpairedbox%
+ {\forgetall
+ \steluitlijnenin[\@@lduitlijnen]%
+ \tolerantTABLEbreaktrue % hm.
+ \blanko[\v!blokkeer]%
+ \everypar{\begstrut}}
+
+\def\maxoftwoboxdimens#1#2#3%
+ {#1\ifdim#1#2>#1#3 #2\else#3\fi}
+
+\def\valignpairedbox#1#2%
+ {\setbox#1=\vbox to #2
+ {\ifcase\pairedlocationb\or\or\or\vss\or\vss\fi
+ \box#1\relax
+ \ifcase\pairedlocationb\or\or\vss\or\or\vss\fi}}
+
+\def\halignpairedbox#1#2%
+ {\setbox#1=\hbox to #2
+ {\ifcase\pairedlocationb\or\hss\or\or\or\hss\fi
+ \box#1\relax
+ \ifcase\pairedlocationb\hss\or\or\or\or\hss\fi}}
+
+\definepairedbox[\e!legenda]
+
+\newcount\horcombinatie % counter
+\newcount\totcombinatie
+
+\def\stelcombinatiesin%
+ {\dodoubleargument\getparameters[\??co]}
+
+\long\def\dodostartcombinatie[#1*#2*#3]%
+ {\stelfractiesin
+ [\c!n=\v!passend,
+ \c!afstand=\@@coafstand]%
+ \global\horcombinatie=#1\relax
+ \global\totcombinatie=#2\relax
+ \xdef\maxhorcombinatie{\the\horcombinatie}%
+ \multiply\totcombinatie by \horcombinatie
+ \tabskip=\!!zeropoint
+ \doifelse{\@@cobreedte}{\v!passend}
+ {\halign}
+ {\halign to \@@cobreedte}%
+ \bgroup&\hfil##\hfil&\tabskip\!!zeropoint \!!plus 1fill##\cr
+ \docombinatie}
+
+% \def\docombinatie%
+% {\dowithnextbox
+% {\setbox0=\box\nextbox
+% \dowithnextbox
+% {\setbox2=\box\nextbox
+% \dodocombinatie}
+% \hbox}
+% \hbox}
+
+\def\docombinatie% we want to add struts but still ignore an empty box
+ {\dowithnextbox%
+ {\setbox0=\box\nextbox
+ \dowithnextbox
+ {\setbox2=\box\nextbox
+ \dodocombinatie}
+ \vtop\bgroup
+ \def\next%
+ {\futurelet\nexttoken\nextnext}
+ \def\nextnext%
+ {\ifx\nexttoken\egroup \else % the next box is empty
+ \hsize\wd0
+ \steluitlijnenin[\@@couitlijnen]
+ \bgroup
+ \aftergroup\endstrut
+ \aftergroup\egroup
+ \begstrut
+ \fi}
+ \afterassignment\next\let\nexttoken=}
+ \hbox}
+
+\def\dodocombinatie%
+ {\vbox
+ {\forgetall % \stelwitruimtein[\v!geen]%
+ \vbox
+ {\copy0}%
+ \ifdim\ht2>\!!zeropoint\relax % beter dan \wd2, nu \strut mogelijk
+ \@@cotussen
+ %\vtop
+ % {\nointerlineskip % recently added
+ % \hsize\wd0
+ % \steluitlijnenin[\@@couitlijnen]% % \raggedcenter
+ % \begstrut\unhbox2\endstrut}%
+ \box2
+ \fi}%
+ \ifnum\totcombinatie>1
+ \global\advance\totcombinatie by -1
+ \global\advance\horcombinatie by -1
+ \ifnum\horcombinatie=0
+ \def\next%
+ {\cr\noalign
+ {\forgetall %\stelwitruimtein[\v!geen]%
+ \nointerlineskip
+ \@@cona
+ \@@covoor
+ \vss
+ \nointerlineskip}%
+ \global\horcombinatie=\maxhorcombinatie\relax
+ \docombinatie}%
+ \else
+ \def\next%
+ {&&&\hskip\@@coafstand&\docombinatie}%
+ \fi
+ \else
+ \def\next%
+ {\cr\egroup}%
+ \fi
+ \next}
+
+\def\complexdostartcombinatie[#1]%
+ {\dodostartcombinatie[#1*1*]}
+
+\def\simpledostartcombinatie%
+ {\complexdostartcombinatie[2]}
+
+\def\startcombinatie%
+ {\bgroup
+ \forgetall
+ \doifelse{\@@cohoogte}{\v!passend}
+ {\vbox}
+ {\vbox to \@@cohoogte}%
+ \bgroup
+ \complexorsimple\dostartcombinatie}
+
+\def\stopcombinatie%
+ {\egroup
+ \egroup}
+
+\stelcombinatiesin
+ [\c!breedte=\v!passend,
+ \c!hoogte=\v!passend,
+ \c!afstand=1em,
+ \c!voor=\blanko,
+ \c!tussen={\blanko[\v!middel]},
+ \c!na=,
+ \c!uitlijnen=\v!midden]
+
+\def\plaatsondernaastelkaar#1#2%
+ {\bgroup
+ \def\doplaatsondernaastelkaar%
+ {#2\cr\omit\bgroup#2%
+ \aftergroup#2%
+ \aftergroup\cr
+ \aftergroup\egroup
+ \aftergroup\egroup
+ \let\next=}%
+ #1\bgroup##\cr
+ \omit\bgroup#2%
+ \aftergroup\doplaatsondernaastelkaar
+ \let\next=}
+
+\def\plaatsonderelkaar%
+ {\plaatsondernaastelkaar\halign\hss}
+
+\def\plaatsnaastelkaar%
+ {\plaatsondernaastelkaar\valign\vss}
+
+\def\dogebruikexternefiles[#1][#2]%
+ {\getparameters
+ [\??fi#1]
+ [\c!file=,
+ \c!korps=,
+ \c!optie=,
+ #2]}
+
+\def\gebruikexternefiles%
+ {\dodoubleargument\dogebruikexternefiles}
+
+\def\dostelexternefilesin[#1][#2]%
+ {\doifundefinedelse{\??fi#1\c!file}
+ {\gebruikexternefiles[#1][#2]}
+ {\getparameters[\??fi#1][#2]}}
+
+\def\stelexternefilesin%
+ {\dodoubleargument\dostelexternefilesin}
+
+\def\verwerkexternefile#1#2#3%
+ {\bgroup
+ \getparameters[\??fi#1][\c!file=,#3]%
+ \doinputonce{\getvalue{\??fi#1\c!file}}%
+ \ExpandFirstAfter\switchtobodyfont[\getvalue{\??fi#1\c!korps}]%
+ \readsysfile{#2} % beter: loc of fix gebied
+ {}
+ {\showmessage{\m!systems}{41}{#2,#1}}%
+ \egroup}
+
+\def\dogebruikexternefile[#1][#2][#3][#4]%
+ {\stelexternefilesin[#1][]%
+ \doinputonce{\getvalue{\??fi#1\c!file}}%
+ \doifelsenothing{#2}
+ {\setvalue{#3}{\verwerkexternefile{#1}{#3}{#4}}}
+ {\setvalue{#2}{\verwerkexternefile{#1}{#3}{#4}}}}
+
+\def\gebruikexternefile%
+ {\doquadrupleargument\dogebruikexternefile}
+
+\gebruikexternefiles
+ [pictex]
+ [\c!korps=\v!klein,
+ \c!file=pictex]
+
+\gebruikexternefiles
+ [table]
+ [\c!file=table]
+
+\presetlocalframed[\??ro]
+
+\def\stelroterenin%
+ {\dodoubleargument\getparameters[\??ro]}
+
+% \ht, \vfillvoor, \vfillna, \wd, \hfillvoor, \hfillna
+
+\def\dodostoproteer#1#2#3#4#5#6%
+ {\dontshowcomposition
+ \vbox to #1\nextbox
+ {#2\relax
+ \hbox to #4\nextbox
+ {#5\relax % \number removes leading spaces too
+ \edef\@@rorotatie{\number\@@rorotatie}%
+ \doifelsenothing{\@@rorotatie}
+ {\dostartrotation{90}}
+ {\dostartrotation{\@@rorotatie}}%
+ \wd\nextbox=\!!zeropoint
+ \ht\nextbox=\!!zeropoint
+ \box\nextbox
+ \dostoprotation
+ #6}
+ #3}%
+ \egroup}
+
+
+\def\dostoproteer%
+ {\!!counta=\@@rorotatie
+ \divide\!!counta by 90
+ \ifcase\!!counta
+ \dodostoproteer\ht\relax\vfill\wd\relax\hfill
+ \or
+ \dodostoproteer\wd\vfill\relax\ht\relax\hfill
+ \or
+ \dodostoproteer\ht\vfill\relax\wd\hfill\relax
+ \or
+ \dodostoproteer\wd\relax\vfill\ht\hfill\relax
+ \or
+ \dodostoproteer\ht\relax\vfill\wd\relax\hfill
+ \else
+ \def\@@rotatie{90}%
+ \dodostoproteer\ht\relax\vfill\wd\relax\hfill
+ \fi}
+
+\def\dorotatebox#1% {angle} \hbox/\vbox/\vtop
+ {\bgroup
+ \hbox\bgroup % compatibility hack
+ \dowithnextbox
+ {\edef\@@rorotatie{#1}%
+ \setbox\nextbox=\vbox{\box\nextbox}%
+ \dostoproteer
+ \egroup}}
+
+\def\complexroteer[#1]%
+ {\dowithnextbox
+ {\getparameters[\??ro][#1]%
+ \dostoproteer}%
+ \vbox\localframed[\??ro][#1]}
+
+\def\roteer%
+ {\bgroup % \roteer kan argument zijn
+ \complexorsimpleempty\roteer}
+
+\stelroterenin
+ [\c!rotatie=90,
+ \c!breedte=\v!passend,
+ \c!hoogte=\v!passend,
+ \c!offset=\v!overlay,
+ \c!kader=\v!uit]
+
+% schaal
+
+\def\doscalelikeafigure%
+ {\doifsomething{\@@xyfactor\@@xyschaal\@@xyhfactor\@@xybreedte\@@xyhoogte}
+ {\let \@@efschaal \@@xyschaal
+ \let \@@effactor \@@xyfactor
+ \let \@@efbfactor\@@xybfactor
+ \let \@@efhfactor\@@xyhfactor
+ \let \@@efbreedte\@@xybreedte
+ \let \@@efhoogte \@@xyhoogte
+ \let \@@epx \!!zeropoint
+ \let \@@epy \!!zeropoint
+ \edef\@@epw {\the\wd\nextbox}%
+ \edef\@@eph {\the\ht\nextbox}%
+ \setfactorfiguresize
+ \setscalefiguresize
+ \setdimensionfiguresize
+ \convertfigureinsertscale\@@epx\figx\figxsca\scax
+ \convertfigureinsertscale\@@epy\figy\figysca\scay
+ \scratchdimen=\scax pt \divide\scratchdimen by 100
+ \edef\@@xysx{\withoutpt\the\scratchdimen}%
+ \scratchdimen=\scay pt \divide\scratchdimen by 100
+ \edef\@@xysy{\withoutpt\the\scratchdimen}}}
+
+\def\doschaal[#1]%
+ {\bgroup
+ \forgetall
+ \getparameters
+ [\??xy]
+ [\c!schaal=,\c!breedte=,\c!hoogte=,
+ \c!factor=,\c!hfactor=,\c!bfactor=,
+ \c!sx=1,\c!sy=1,#1]%
+ \dowithnextbox
+ {\dontshowcomposition
+ \doscalelikeafigure
+ \dimen0=\@@xysy\ht\nextbox
+ \dimen2=\@@xysy\dp\nextbox
+ \dimen4=\@@xysx\wd\nextbox
+ \dimen6=\dimen0\advance\dimen6 by \dimen2
+ \setbox\nextbox=\vbox to \dimen6
+ {\ht\nextbox=\!!zeropoint
+ \dp\nextbox=\!!zeropoint
+ \vfill % erbij
+ \dostartscaling\@@xysx\@@xysy\box\nextbox\dostopscaling}%
+ \ht\nextbox=\dimen0
+ \dp\nextbox=\dimen2
+ \wd\nextbox=\dimen4
+ \box\nextbox
+ \egroup}
+ \hbox}
+
+\def\schaal%
+ {\dosingleempty\doschaal}
+
+% mirror
+
+\def\domirrorbox% \hbox/\vbox/\vtop
+ {\bgroup
+ \dowithnextbox
+ {\dontshowcomposition
+ \dimen0=\wd\nextbox
+ \setbox\nextbox=\vbox
+ {\dostartmirroring\hskip-\wd\nextbox\box\nextbox\dostopmirroring}%
+ \wd\nextbox=\dimen0
+ \box\nextbox
+ \egroup}}
+
+\def\spiegel%
+ {\domirrorbox\hbox}
+
+%\setbox0=\hbox{gans}
+%
+%\ruledhbox{\copy0 \schaal[sx=2,sy=2]{\copy0}}
+%
+%\spiegel{\ruledhbox{\copy0 \schaal{\box0}}}
+
+% verdelen \hsize in fracties, wordt nog wat algemener,
+% beetje vaag nu
+%
+% \fractie[n/m,elementen,afstand]
+%
+% \fractie[2/5,3,1em]
+% \fractie[2/5,3,1em]
+% \fractie[1/5,3,1em]
+%
+% \stelfractiesin[afstand=,aantal=] (passend,passend)
+
+\def\??fr{@@fr}
+
+\def\stelfractiesin%
+ {\dodoubleargument\getparameters[\??fr]}
+
+\def\dodofractie[#1/#2,#3,#4,#5]%
+ {\doifelsenothing{#3}
+ {\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}
+
+\def\dofractie[#1]%
+ {\dodofractie[#1,,,,,,]}
+
+\def\fractie%
+ {\dosingleargument\dofractie}
-\endinput
+\stelfractiesin
+ [\c!afstand=\tfskipsize,
+ \c!n=\v!passend]
+
+\protect \endinput
diff --git a/tex/context/base/core-nav.tex b/tex/context/base/core-nav.tex
index 2f7343ab3..6e5e1f97d 100644
--- a/tex/context/base/core-nav.tex
+++ b/tex/context/base/core-nav.tex
@@ -26,7 +26,7 @@
%D functionality of many macro depends on the output medium:
%D paper or screen. The next boolean holds the state:
-\newif\iflocation
+\newif\iflocation \def\ifinteractief{\iflocation} % upw comp
%D We also allocate a scratchbox:
@@ -149,7 +149,7 @@
%D In the macros that deal with making areas into hyperlinks,
%D we use:
-\def\dostartgoto\data#1\start#2\stop#3\dostopgoto%
+\def\dostartgoto\data#1\start#2\stop#3\dostopgoto
{\ifsecondaryreference
\bgroup\setbox0=\hbox{#2#3}\egroup
\else
diff --git a/tex/context/base/core-not.tex b/tex/context/base/core-not.tex
index f0ac4080a..9d4499615 100644
--- a/tex/context/base/core-not.tex
+++ b/tex/context/base/core-not.tex
@@ -112,21 +112,17 @@
\newif\iffootnotelimit \footnotelimittrue
\def\dosetupfootnotes[#1]%
- {\getparameters[\??vn][#1]%
- \processaction
- [\@@vnlijn]
- [ \v!aan=>\let\dofootnoterule=\dodofootnoterule,
- \v!uit=>\let\dofootnoterule=\relax,
- \s!default=>\let\dofootnoterule=\relax,
- \s!unknown=>\let\dofootnoterule=\@@vnlijn]%
- \setbox\scratchbox=\vbox
- {\forgetall
- \@@vnvoor
- \dofootnoterule
- \@@vnna}%
- \skip\footins=\ht\scratchbox
+ {\iffirstargument
+ \getparameters[\??vn][#1]%
+ \processaction
+ [\@@vnlijn]
+ [ \v!aan=>\let\dofootnoterule=\dodofootnoterule,
+ \v!uit=>\let\dofootnoterule=\relax,
+ \s!default=>\let\dofootnoterule=\relax,
+ \s!unknown=>\let\dofootnoterule=\@@vnlijn]%
+ \fi
+ \setfootnotedistance
\count\footins=1000
- \setbox\scratchbox=\box\voidb@x % scratchbox can be in use
\ExpandBothAfter\doifinsetelse{\v!kolommen}{\@@vnplaats}
{\cleverfootnotestrue % global ?
\ifnum\@@kln=0
@@ -160,6 +156,15 @@
\multiply\dimen\footins by \scratchcounter
\fi}
+\def\setfootnotedistance
+ {\setbox\scratchbox=\vbox
+ {\forgetall
+ \@@vnvoor
+ \dofootnoterule
+ \@@vnna}%
+ \skip\footins=\ht\scratchbox
+ \setbox\scratchbox=\box\voidb@x} % scratchbox can be in use
+
\ifx\setfootnotehsize\undefined
\def\setfootnotehsize{\hsize=\@@vnbreedte} % can be overloaded
@@ -595,38 +600,63 @@
\fi\fi
\fi\fi}
+%D This is a nasty and new secondary footnote flusher. It
+%D can be hooked into \type {\everypar} like:
+%D
+%D \starttypen
+%D \appendtoks \synchronizefootnotes \to \everypar
+%D \stoptypen
+
+\def\synchronizefootnotes%
+ {\ifvoid\footins\else\insert\footins{\unvbox\footins}\fi}
+
\def\placefootnotesintext#1%
- {\endgraf
- \ifvmode
- \witruimte
+ {\ifdim\ht#1>\zeropoint
+ \endgraf
+ \ifvmode
+ \witruimte
+ \@@vnvoor
+ \fi
+ \snaptogrid\hbox
+ {\setfootnotebodyfont
+ \setbox0=\hbox
+ {\startpopfootnotes
+ \unvbox#1\endgraf\relax
+ \stoppopfootnotes}%
+ \doif{\@@vnbreedte}{\v!passend} % new, auto width
+ {\setbox0=\hbox % uggly but ok.
+ {\beginofshapebox
+ \unhbox0\setbox0=\lastbox\unvbox0
+ \endofshapebox
+ \reshapebox{\hbox{\unhbox\shapebox}}%
+ \vbox{\flushshapebox}}}%
+ \localframed
+ [\??vn]
+ [\c!breedte=\v!passend,
+ \c!hoogte=\v!passend,
+ \c!strut=\v!nee,
+ \c!offset=\v!overlay]
+ {\ifdim\dp0=\!!zeropoint % this hack is needed because \vadjust
+ \hbox{\lower\dp\strutbox\box0}% % in margin number placement
+ \else % hides the (always) present depth
+ \box0
+ \fi}}%
+ \ifvmode
+ \@@vnna
+ \fi
+ \fi}
+
+%D A stupid alternative is also provided:
+%D
+%D \starttypen
+%D \setupfootnotes[location={text,none}]
+%D \stoptypen
+
+\def\placefootnotesasnone#1% is grouped already
+ {\ifdim\ht#1>\zeropoint
\@@vnvoor
- \fi
- \snaptogrid\hbox
- {\setfootnotebodyfont
- \setbox0=\hbox
- {\startpopfootnotes
- \unvbox#1\endgraf\relax
- \stoppopfootnotes}%
- \doif{\@@vnbreedte}{\v!passend} % new, auto width
- {\setbox0=\hbox % uggly but ok.
- {\beginofshapebox
- \unhbox0\setbox0=\lastbox\unvbox0
- \endofshapebox
- \reshapebox{\hbox{\unhbox\shapebox}}%
- \vbox{\flushshapebox}}}%
- \localframed
- [\??vn]
- [\c!breedte=\v!passend,
- \c!hoogte=\v!passend,
- \c!strut=\v!nee,
- \c!offset=\v!overlay]
- {\ifdim\dp0=\!!zeropoint % this hack is needed because \vadjust
- \hbox{\lower\dp\strutbox\box0}% % in margin number placement
- \else % hides the (always) present depth
- \box0
- \fi}}%
- \ifvmode
- \@@vnna
+ \setfootnotebodyfont \unvbox#1\endgraf
+ \@@vnna
\fi}
%D \macros
@@ -711,21 +741,24 @@
%D
%D \showsetup{\y!placefootnotes}
+\def\placefootnotes%
+ {\dosingleempty\doplacefootnotes}
+
\def\doplacefootnotes[#1]%
{\bgroup
- \setupfootnotes[#1,\c!hoogte=\teksthoogte]%
\ifendnotes
- \ifinpagebody \else
- \placefootnotesintext\postponedfootnotes
- \fi
- \else
+ \ifinpagebody \else \ifdim\ht\postponedfootnotes>\zeropoint
+ \iffirstargument\setupfootnotes[#1,\c!hoogte=\teksthoogte]\fi
+ \ExpandBothAfter\doifinsetelse{\v!geen}{\@@vnplaats}
+ {\placefootnotesasnone\postponedfootnotes}%
+ {\placefootnotesintext\postponedfootnotes}%
+ \fi \fi
+ \else \ifdim\ht\footins>\zeropoint
+ \iffirstargument\setupfootnotes[#1,\c!hoogte=\teksthoogte]\fi
\placefootnoteinserts
- \fi
+ \fi \fi
\egroup}
-\def\placefootnotes%
- {\dosingleempty\doplacefootnotes}
-
%D Now how can this mechanims be hooked into \CONTEXT\ without
%D explictly postponing footnotes? The solution turned out to
%D be rather simple:
diff --git a/tex/context/base/core-obj.tex b/tex/context/base/core-obj.tex
index 58315aeba..ffbd9ad34 100644
--- a/tex/context/base/core-obj.tex
+++ b/tex/context/base/core-obj.tex
@@ -99,7 +99,12 @@
\fi
{#1}{#2}{#3}}
-\let\objectoffset\!!zeropoint
+%D Somehow there is a rounding error problem in either \PDFTEX\
+%D or in viewers, or maybe it is conforming the specs. The next
+%D variable compensate for it by removing the rather tight
+%D clip.
+
+\def\objectoffset{1cm}
% \def\dodosetobject#1#2#3%
% {\bgroup
diff --git a/tex/context/base/core-par.tex b/tex/context/base/core-par.tex
index 1235d74b4..b6279d7db 100644
--- a/tex/context/base/core-par.tex
+++ b/tex/context/base/core-par.tex
@@ -76,7 +76,7 @@
\resetparagraphlines
\EveryPar
{\strut\inleftmargin{\tf{\tx\paragraphnumber}\kern2em}%
- \ignorespaces}}
+ \ignorespaces}}%
\def\doresetparagraph%
{\resetparagraphlines
\egroup}}
@@ -84,19 +84,27 @@
\def\numberparagraphlines%
{\processpreviousparagraphstrue
\def\dosetparagraph%
- {\resetparagraphlines}
+ {\resetparagraphlines}%
\def\doresetparagraph%
- {\resetparagraphlines}
+ {\resetparagraphlines}%
\def\dobeforeparagraph%
- {\startregelnummeren[\v!verder]}
+ {\startregelnummeren[\v!verder]}%
\def\doafterparagraph%
- {\stopregelnummeren}
+ {\stopregelnummeren}%
\def\dobeforeskipparagraph%
{\stopregelnummeren
- \let\paragraphnumber=\relax}
+ \let\paragraphnumber=\relax}%
\def\doafterskipparagraph%
{\startregelnummeren[\v!verder]}}
+\long\def\directpushparagraph#1%
+ {\doglobal\increment\totalnofparagraphs
+ \ifnum\totalnofparagraphs>0\nofskippedparagraphs\relax
+ \setgvalue{\paragraphprefix\totalnofparagraphs}{#1}%
+ \else
+ \setgvalue{\paragraphprefix\totalnofparagraphs}{\skipparagraph#1\par}%
+ \fi}
+
\def\dopushparagraphs#1%
{\global\let\mostrecentparagraphtotal=\totalnofparagraphs
\ifx#1\undefined
@@ -108,17 +116,10 @@
{\convertargument##1\to\asciiC
\doifelse{\asciiC}{\asciiA}
{\let\next=#1}
- {\doifnot{\asciiC}{} % lege paragraaf
+ {\doifnot{\asciiC}{} % lege paragraaf
{\doifnot{\asciiC}{\asciiB}
- {\doglobal\increment\totalnofparagraphs
- \ifnum\totalnofparagraphs>0\nofskippedparagraphs\relax
- \setgvalue{\paragraphprefix\totalnofparagraphs}%
- {##1}%
- \else
- \setgvalue{\paragraphprefix\totalnofparagraphs}%
- {\skipparagraph##1\par}%
- \fi}}%
- \let\next=\dopushparagraph}
+ {\directpushparagraph{#1}}}%
+ \let\next=\dopushparagraph}%
\next}%
\dopushparagraph}
@@ -205,7 +206,7 @@
\global\let\nofparagraphs=\totalnofparagraphs
\doglobal\decrement(\nofparagraphs,\discardedparagraphs)}
-% \toonkader
+% \showframe
%
% \numberparagraphlines
% \numberparagraphs
diff --git a/tex/context/base/core-pos.tex b/tex/context/base/core-pos.tex
index 7f8ea7b10..08229e9eb 100644
--- a/tex/context/base/core-pos.tex
+++ b/tex/context/base/core-pos.tex
@@ -64,6 +64,7 @@
%D \starttypen
%D \dosetposition {identifier}
%D \dosetpositionwhd {identifier} {width} {height} {depth}
+%D \dosetpositionplus {identifier} {width} {height} {depth} {list}
%D \dosetpositionpapersize {width} {height}
%D \stoptypen
%D
@@ -72,8 +73,9 @@
%D utility file as:
%D
%D \starttypen
-%D \pospxy {identifier} {page} {x} {y}
-%D \pospxywhd {identifier} {page} {x} {y} {w} {h} {d}
+%D \pospxy {identifier} {page} {x} {y}
+%D \pospxywhd {identifier} {page} {x} {y} {w} {h} {d}
+%D \pospxylist {identifier} {page} {x} {y} {w} {h} {d} {list}
%D \stoptypen
%D
%D This means that we have to provide both a utility set and
@@ -81,29 +83,47 @@
\def\POSprefix{POS::}
-\def\pxypos {\pospxy}
-\def\pxyposwhd{\pospxywhd}
+\def\pxypos {\pospxy} % obsolete
+\def\pxyposwhd {\pospxywhd} % obsolete
+\def\pxyposplus{\pospxyplus} % obsolete
\def\resetpositions%
- {\let\pospxy =\gobblefourarguments
- \let\pospxywhd=\gobblesevenarguments}
-
-\resetpositions
+ {\let\pospxy \gobblefourarguments
+ \let\pospxywhd \gobblesevenarguments
+ \let\pospxyplus\gobbleeightarguments}
\def\setpositions%
- {\def\pospxy##1##2##3##4%
- {\dosetpositionnm\@@posp{##2}%
- \dosetpositionpt\@@posx{##3}%
- \dosetpositionpt\@@posy{##4}%
- \setxvalue{\POSprefix##1}{\@@posp,\@@posx,\@@posy}}%
- \def\pospxywhd##1##2##3##4##5##6##7%
- {\dosetpositionnm\@@posp{##2}%
- \dosetpositionpt\@@posx{##3}%
- \dosetpositionpt\@@posy{##4}%
- \dosetpositionpt\@@posw{##5}%
- \dosetpositionpt\@@posh{##6}%
- \dosetpositionpt\@@posd{##7}%
- \setxvalue{\POSprefix##1}{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd}}}
+ {\let\pospxy \setpospxy
+ \let\pospxywhd \setpospxywhd
+ \let\pospxyplus\setpospxyplus}
+
+\def\setpospxy#1#2#3#4%
+ {\dosetpositionnm\@@posp{#2}%
+ \dosetpositionpt\@@posx{#3}%
+ \dosetpositionpt\@@posy{#4}%
+ \setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy}}%
+
+\def\setpospxywhd#1#2#3#4#5#6#7%
+ {\dosetpositionnm\@@posp{#2}%
+ \dosetpositionpt\@@posx{#3}%
+ \dosetpositionpt\@@posy{#4}%
+ \dosetpositionpt\@@posw{#5}%
+ \dosetpositionpt\@@posh{#6}%
+ \dosetpositionpt\@@posd{#7}%
+ \setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd}}%
+
+\def\setpospxyplus#1#2#3#4#5#6#7#8%
+ {\dosetpositionnm\@@posp{#2}%
+ \dosetpositionpt\@@posx{#3}%
+ \dosetpositionpt\@@posy{#4}%
+ \dosetpositionpt\@@posw{#5}%
+ \dosetpositionpt\@@posh{#6}%
+ \dosetpositionpt\@@posd{#7}%
+ \setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd,#8}}
+
+%D We need to initialize.
+
+\resetpositions
%D For postprocessing purposes, we save the number of
%D positions.
@@ -111,9 +131,9 @@
\newcounter\currentpositions % current number of positions
\newcounter\totalnofpositions % total from previous run
-\prependtoks
+\appendtoks
\savecurrentvalue\totalnofpositions\currentpositions
-\to \everybye % \everylastshipout
+\to \everybye
%D We save positionional information without dimensions, which
%D saves some bytes. The conversion too saves some bytes, but
@@ -141,25 +161,31 @@
%D Positions are either generated at a delayed write time
%D (in \PDFTEX), or derived from the dvi file. The actual
%D method is implemented in a special driver. If needed, the
-%D driver can fall back on the following macros.
+%D driver can fall back on the following macros.
-\def\dolazysaveposition#1#2#3#4% tag page x y
+\def\dolazysaveposition#1#2#3#4% tag page x y
{\expanded{\writeutilitycommand{\noexpand\pospxy
{#1}{#2}{#3}{#4}}}}
-\def\dolazysavepositionwhd#1#2#3#4#5#6#7% tag page x y w h d
+\def\dolazysavepositionwhd#1#2#3#4#5#6#7% tag page x y w h d
{\expanded{\writeutilitycommand{\noexpand\pospxywhd
{#1}{#2}{#3}{#4}{#5}{#6}{#7}}}}
-\def\dosaveposition#1#2#3#4% tag page x y
+\def\dolazysavepositionplus#1#2#3#4#5#6#7#8% tag page x y w h d list
+ {\expanded{\writeutilitycommand{\noexpand\pospxyplus
+ {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}}
+
+\def\dosaveposition#1#2#3#4% tag page x y
{\expanded{\immediatewriteutilitycommand{\noexpand\pospxy
{#1}{#2}{#3}{#4}}}}
-\def\dosavepositionwhd#1#2#3#4#5#6#7% tag page x y w h d
+\def\dosavepositionwhd#1#2#3#4#5#6#7% tag page x y w h d
{\expanded{\immediatewriteutilitycommand{\noexpand\pospxywhd
{#1}{#2}{#3}{#4}{#5}{#6}{#7}}}}
-
+\def\dosavepositionplus#1#2#3#4#5#6#7#8% tag page x y w h d list
+ {\expanded{\immediatewriteutilitycommand{\noexpand\pospxyplus
+ {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}}}
%D \macros
%D {MPp, MPx, MPy, MPw, MPh, MPd,
@@ -210,6 +236,50 @@
\fi}
%D \macros
+%D {MPplus, MPrest, MPv, MPvv}
+%D
+%D Since we will probably keep on extending, we provide a
+%D general extension macro. The plus alternative takes an
+%D extra argument, denoting what additional parameter to pick
+%D up. So, the third extra is fetched with,
+%D
+%D \starttypen
+%D \MPplus{identifier}{3}
+%D \stoptypen
+%D
+%D All extras (comma separated) are fetched with:
+%D
+%D \starttypen
+%D \MPrest{identifier}
+%D \stoptypen
+%D
+%D The extra parameters are not treated.
+
+\def\MPplus {\MPdoplus\doMPplus} \let\MPv \MPplus
+\def\MPrest#1{\MPdoplus\doMPrest{#1}{}} \let\MPvv\MPrest
+
+\def\MPdoplus#1#2#3#4%
+ {\ifundefined{\POSprefix#2}#4\else
+ \@EA\@EA\@EA#1\csname\POSprefix#2\endcsname,,,,,,,,,\relax{#3}%
+ \fi}
+
+\def\doMPplus#1,#2,#3,#4,#5,#6,%
+ {\dodoMPplus}
+
+\def\dodoMPplus#1,#2,#3,#4,#5,#6,#7,#8\relax#9%
+ {\ifcase#9\or#1\or#2\or#3\or#4\or#5\or#6\or#7\else
+ \dododoMPplus#8\relax{#9}\fi}
+
+\def\dododoMPplus#1,#2,#3,#4,#5,#6,#7,#8\relax#9%
+ {\ifcase#9\or \or \or \or \or \or \or \or
+ #1\or#2\or#3\or#4\or#5\or#6\or#7\fi}
+
+\def\doMPrest#1,#2,#3,#4,#5,#6,#7,,#8\relax#9%
+ {#7}
+
+% We can now remap the normal whd onto this.
+
+%D \macros
%D {MPanchor}
%D
%D For readability we define a few synonyms:
@@ -224,8 +294,7 @@
\let\POSp\MPp \let\POSx\MPx \let\POSy\MPy
\let\POSh\MPh \let\POSd\MPd \let\POSw\MPw
-\newbox\positionbox
-\newif\ifpositioning
+\newbox\positionbox \newif\ifpositioning
%D There are two low level positioning macros. Both store the
%D position as well as execute an action associated with that
@@ -250,8 +319,27 @@
{\hbox to \wd\nextbox
{\initializenextposition
\def\currentposition{#1}%
- \dosetpositionwhd{#1}
- {\number\wd\nextbox}{\number\ht\nextbox}{\number\dp\nextbox}%
+ \dosetpositionwhd
+ {#1}
+ {\number\wd\nextbox}
+ {\number\ht\nextbox}
+ {\number\dp\nextbox}%
+ \setbox\positionbox=\box\nextbox
+ \dopositionaction{#1}%
+ \box\positionbox
+ \hss}}}
+
+\def\setpositionplus#1#2%
+ {\dowithnextbox
+ {\hbox to \wd\nextbox
+ {\initializenextposition
+ \def\currentposition{#1}%
+ \dosetpositionplus
+ {#1}
+ {\number\wd\nextbox}
+ {\number\ht\nextbox}
+ {\number\dp\nextbox}
+ {#2}%
\setbox\positionbox=\box\nextbox
\dopositionaction{#1}%
\box\positionbox
@@ -272,11 +360,19 @@
\def\dosetpositionaction#1%
{\setgvalue{\POSactionprefix#1::}}
+%D The lists can become quite long (also because there can
+%D be lots of parameters passed on) so we provide a hook
+%D to clean up the list afterwards.
+
+\let\cleanuppositionaction\gobbleoneargument
+
\def\dopositionaction#1% test saves hash entry in etex
{\doifdefined{\POSactionprefix#1::}%
{\bgroup
+ \the\everyinsertpositionaction
\the\everypositionaction
\getvalue{\POSactionprefix#1::}%
+ \cleanuppositionaction{#1}%
\egroup}}
\def\doifpositionaction#1%
@@ -322,8 +418,6 @@
%D \NC \type {\xypos} \NC \NC simple position with no dimensions \NC \NR
%D \NC \type {\hpos} \NC \NC position and characteristics of a \type {\hbox} \NC \NR
%D \NC \type {\vpos} \NC \NC position and characteristics of a \type {\vbox} \NC \NR
-%D \NC \type {\lpos} \NC l: \NC left edge of a line \NC \NR
-%D \NC \type {\rpos} \NC r: \NC right edge of a line \NC \NR
%D \NC \type {\bpos} \NC b: \NC begin point in a line \NC \NR
%D \NC \type {\epos} \NC e: \NC end point in a line \NC \NR
%D \NC \type {\fpos} \NC f: \NC begin point in a paragraph \NC \NR
@@ -338,22 +432,63 @@
\def\hpos#1{\dontleavehmode\setpositionbox{#1}\hbox}
\def\vpos#1{\setpositionbox{#1}\vbox}
-\def\lpos#1{\lrpos{l:#1}{\kern\leftskip}}
-\def\rpos#1{\lrpos{r:#1}{\hskip\hsize\hskip-\rightskip}}
+% \def\lpos#1{\lrpos{l:#1}{\kern\leftskip}}
+% \def\rpos#1{\lrpos{r:#1}{\hskip\hsize\hskip-\rightskip}}
\def\bpos#1{\hpos{b:#1}{\strut}\ignorespaces}
\def\epos#1{\ifhmode\unskip\fi\hpos{e:#1}{\strut}}
-\def\fpos#1{\lpos{#1}\rpos{#1}\bpos{#1}}
-\def\tpos#1{\epos{#1}}
-
-%D The macros \type {\lpos} and \type {\rpos} share some code.
+\def\fpos#1%
+ {\setpositionplus{b:#1}{\parposcounter}\hbox{\strut}%
+ \ignorespaces}
+
+\def\tpos#1%
+ {\ifhmode\unskip\fi
+ \setpositionplus{e:#1}{\parposcounter}\hbox{\strut}}
+
+%D When we want to calculate more complex backgrounds, we
+%D need to know what the current indentation scheme is. At
+%D the cost of many positions and memory, we can keep track
+%D of them. This mechanism is activated automatically
+%D based on information collected in the previous pass.
+
+\newcounter\parposcounter
+
+\newif\ifpositioningpar
+
+\def\efficientdimen#1%
+ {\the#1} % \ifdim#1=\zeropoint\string\!!zeropoint\else\the#1\fi}
+
+% we can check for used entries, and if not, then not add one
+
+\def\registerparoptions%
+ {\ifinpagebody \else \ifpositioning \ifpositioningpar
+ \ifmmode \else \ifinformula \else
+ \doglobal\increment\parposcounter
+ \bgroup
+ \leftskip =1\leftskip
+ \rightskip=1\rightskip
+ \setpositionplus
+ {p:\parposcounter}% % identifier
+ {\efficientdimen\hsize ,% 1
+ \efficientdimen\leftskip ,% 2
+ \efficientdimen\rightskip ,% 3
+ \efficientdimen\hangindent,% 4
+ \the\hangafter ,% 5
+ \efficientdimen\parindent }% 6
+ \hbox{\strut\registerparsymbol}%
+ \egroup
+ \fi \fi
+ \fi \fi \fi}
+
+\newif\iftracepositions
+
+\def\registerparsymbol
+ {\iftracepositions
+ \hbox to \zeropoint{\hss\blue\vrule\!!width4pt\!!height2pt\!!depth2pt\hss}%
+ \fi}
-\def\lrpos#1#2%
- {\dontleavehmode\vadjust % may disappear if buried
- {\setbox0=\hbox{\raise\dp\strutbox\hbox{\hpos{#1}{\strut}}}%
- \smashbox0
- \rlap{#2\box0}}}
+\appendtoks \registerparoptions \to \everypar
%D \macros
%D {doifoverlappingelse}
@@ -398,16 +533,16 @@
%D {doifpositionsonsamepageelse,
%D doifpositionsonthispageelse}
%D
-%D Instead of letting the user handle fuzzy expansion, we
+%D Instead of letting the user handle fuzzy expansion, we
%D provide a simple test on positione being on the same page.
%D
%D \starttypen
%D \doifpositionsonsamepageelse{point a}{point b}
%D {action when on same page}
-%D {action when not on same page}
+%D {action when not on same page}
%D \doifpositionsonthispageelse{point a}{point b}
%D {action when on this page}
-%D {action when not on this page}
+%D {action when not on this page}
%D \stoptypen
\def\doifpositionsonsamepageelse#1#2#3#4%
@@ -432,15 +567,60 @@
%D the reference point on the page. The next macro does so and
%D is hooked into the page building routine.
-\def\placepositionanchors%
+% in the future, the depth of tail will reflect page depth
+
+\def\textanchor{text:\realfolio}
+
+\def\placepositionanchors% todo : depth pagebox
{\ifpositioning
- \vbox to \teksthoogte
- {\hpos{head:\realfolio}{\hskip\tekstbreedte}
+ \setbox\scratchbox=\vbox to \teksthoogte
+ {\topskipcorrection
+ \hbox{\strut\dopositionaction\headanchor}%
\vfill
- \hpos{tail:\realfolio}{\hskip\tekstbreedte}}
+ \hbox{\strut\dopositionaction\tailanchor}}%
+ \dp\scratchbox=\zeropoint
+ \hpos\textanchor{\box\scratchbox}%
\else
\vskip\teksthoogte
\fi}
+
+%D The first version of this module implemented head and tail
+%D anchors. Currently we stick to just one anchor and derive
+%D the head and tail anchors from this one.
+
+\def\headanchor{head:\realfolio} % virtual position
+\def\tailanchor{tail:\realfolio} % virtual position
+
+\def\presetpositionanchors% compatibility hack
+ {\ifpositioning
+ \bgroup
+ \dimen0=\ifdim\topskip>\ht\strutbox\topskip\else\ht\strutbox\fi
+ \dimen2=\MPy\textanchor
+ \dimen4=\dimen2
+ \advance\dimen2 \MPh\textanchor % space is essential
+ \advance\dimen2 -\dimen0
+ \advance\dimen4 \dp\strutbox
+ \dimen6=\MPx\textanchor
+ \dimen8=\MPw\textanchor
+ \setxvalue{\POSprefix\headanchor}%
+ {\realfolio,\withoutpt{\the\dimen6},\withoutpt{\the\dimen2},%
+ \withoutpt{\the\dimen8},\withoutpt{\the\dimen0},\withoutpt{\the\dp\strutbox}}%
+ \setxvalue{\POSprefix\tailanchor}%
+ {\realfolio,\withoutpt{\the\dimen6},\withoutpt{\the\dimen4},%
+ \withoutpt{\the\dimen8},\withoutpt{\the\ht\strutbox},\withoutpt{\the\dp\strutbox}}%
+ % \showanchor\textanchor\showanchor\headanchor\showanchor\tailanchor\wait
+ \egroup
+ \fi}
+
+\def\showanchor#1%
+ {\expanded{\writestatus{#1}
+ {\MPp{#1}\string|\MPx{#1}\string|\MPy{#1}\string|%
+ \MPw{#1}\string|\MPh{#1}\string|\MPd{#1}}}}
+
+%D We set these anchors befor and after each page.
+
+\appendtoks \presetpositionanchors \to \beforeeverypage
+\appendtoks \presetpositionanchors \to \aftereverypage
%D \macros
%D {positionoverlay,startpositionoverlay}
@@ -504,22 +684,17 @@
\let\currentpositionoverlay\empty
%D Position actions are automatically executed when a position
-%D is set. In the next macro, the definitions sort of prelude
-%D this process.
+%D is set.
\def\positionoverlay#1%
{\ifpositioning
\vbox to \overlayheight
- {\edef\MPanchor##1{\MPpos{#1::\MPanchoridentifier}}%
- \def\dohandlepositionboxes##1##2##3% pos tag setups
- {\ifnum\MPp{##1}=\realpageno\relax % extra saveguard / beter in \dodo
- \dodohandlepositionboxes{##1}{##2}{##3}%
- \fi}%
- \def\dohandleMPpositiongraphic##1##2##3% pos tag setups
- {\ifnum\MPp{##1}=\realpageno\relax % extra saveguard / beter in \dodo
- \dodohandleMPpositiongraphic{##1}{##2}{##3}%
- \fi}%
- \hpos{#1::\MPanchoridentifier}{\hskip\overlaywidth}%
+ {\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}
@@ -533,31 +708,62 @@
{\dosetpositionaction{#1::\MPanchoridentifier::}{}}
%D Here the complication has to do with collecting actions
-%D for later execution.
+%D for later execution. This collection is especially handy
+%D when we want to move actions to a specific layer.
+%D Such series of actions are stored in a macro (the one
+%D with the funny \type {++}) which is cleaned up after each
+%D invocation.
-\def\handlepositionboxes#1#2#3%
+\newtoks\everycleanpositionaction
+\newtoks\everyinsertpositionaction
+
+\def\cleanuppositionaction#1%
+ {\doifdefined{\POSactionprefix#1++}
+ {\the\everycleanpositionaction
+ \setxvalue{\POSactionprefix#1++}{\getvalue{\POSactionprefix#1++}}}}
+
+\def\handlepositionaction#1\with#2\on#3%
{\bgroup
\ifx\currentpositionoverlay\empty
- \edef\!!stringa{\POSactionprefix#2::}%
+ \edef\!!stringa{#3}%
\else
- \edef\!!stringa{\POSactionprefix\currentpositionoverlay::\MPanchoridentifier::}%
+ \edef\!!stringa{\currentpositionoverlay::\MPanchoridentifier}%
\fi
- \let\dohandlepositionboxes\relax
- \doifundefinedelse\!!stringa
+ \edef\!!stringc{\POSactionprefix\!!stringa++}%
+ \expanded{\dosetpositionaction{\!!stringa}{\noexpand\getvalue{\!!stringc}}}%
+ \global\let#1\relax
+ \doifundefinedelse\!!stringc
{\let\!!stringb\empty}
- {\edef\!!stringb{\getvalue\!!stringa}}%
- \setxvalue\!!stringa
- {\!!stringb\dohandlepositionboxes{#1}{#2}{#3}}%
+ {\edef\!!stringb{\getvalue\!!stringc}}%
+ \setxvalue\!!stringc{\!!stringb#1#2}%
\egroup}
-%D The indirectness enables us (as was demonstrated a few lines
-%D ago) to redefine this macro but still use its functionality.
+%D The indirectness enables us redefine macros for special
+%D purposes, like a cleanup.
+
+\def\handlepositionboxes#1#2#3%
+ {\handlepositionaction\dohandlepositionboxes\with{#1}{#2}{#3}\on{#2}}
+
+\def\doinsertpositionboxes#1#2#3% pos tag setups
+ {\ifnum\MPp{#1}=\realpageno
+ % \doifdefined{\MPoverlayposprefix#1}
+ % {\getvalue{\MPoverlayposprefix#1}{#1}{#2}{#3}}%
+ \executeifdefined{\MPoverlayposprefix#1}%
+ \gobblethreearguments{#1}{#2}{#3}%
+ \fi}
+
+\appendtoks
+ \let\dohandlepositionboxes\dohandlepositionboxes
+\to \everyinsertpositionaction
-\def\dodohandlepositionboxes#1#2#3%
- {\doifdefined{\MPoverlayposprefix#1}
- {\getvalue{\MPoverlayposprefix#1}{#1}{#2}{#3}}}
+\def\docleanpositionboxes#1#2#3% pos tag setups
+ {\ifnum\MPp{#1}<\realpageno \else
+ \noexpand \dohandlepositionboxes{#1}{#2}{#3}%
+ \fi}
-\let\dohandlepositionboxes\dodohandlepositionboxes
+\appendtoks
+ \let\dohandlepositionboxes\docleanpositionboxes
+\to \everycleanpositionaction
%D A position graphic is a normal (non||reused) \METAPOST\
%D graphic, used immediately, with zero dimensions, so that a
@@ -565,36 +771,6 @@
\newbox\positiongraphicbox
-\def\setMPpositiongraphic%
- {\dotriplegroupempty\dosetMPpositiongraphic}
-
-\def\dosetMPpositiongraphic#1#2#3% pos tag vars
- {\ifx\currentpositionoverlay\empty
- \dosetpositionaction{#1}{\MPpositiongraphic{#2}{#3}}%
- \else % silly can be one
- \handlepositiongraphics{#1}{#2}{#3}%
- \fi}
-
-\def\handlepositiongraphics#1#2#3% combine with boxes
- {\bgroup
- \ifx\currentpositionoverlay\empty
- \edef\!!stringa{\POSactionprefix#2::}% #2 ?
- \else
- \edef\!!stringa{\POSactionprefix\currentpositionoverlay::\MPanchoridentifier::}%
- \fi
- \let\dohandleMPpositiongraphic\relax
- \doifundefinedelse\!!stringa
- {\let\!!stringb\empty}
- {\edef\!!stringb{\getvalue\!!stringa}}%
- \setxvalue\!!stringa
- {\!!stringb\dohandleMPpositiongraphic{#1}{#2}{#3}}%
- \egroup}
-
-\def\dodohandleMPpositiongraphic#1#2#3%
- {\def\currentposition{#1}\MPpositiongraphic{#2}{#3}}
-
-\let\dohandleMPpositiongraphic\dodohandleMPpositiongraphic
-
\def\startMPpositiongraphic% id setups
{\dodoublegroupempty\dostartMPpositiongraphic}
@@ -610,8 +786,6 @@
{\bgroup
\prepareMPvariables{#2}%
\prepareMPpositionvariables
-% \startuseMPgraphic{MPG}#3\stopuseMPgraphic
-% \getvalue{MP:MPG}%
\enableincludeMPgraphics
\startMPgraphic#3\stopMPgraphic
\loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}%
@@ -637,9 +811,79 @@
\box\positiongraphicbox
\egroup}
-\long\def\startMPpositionmethod#1#2\stopMPpositionmethod%
+\long\def\startMPpositionmethod#1#2\stopMPpositionmethod
{\long\setgvalue{MPM:#1}{#2}} % todo: var list here
+%D Simple one position graphics.
+
+\def\setMPpositiongraphic%
+ {\dotriplegroupempty\dosetMPpositiongraphic}
+
+\def\dosetMPpositiongraphic#1#2#3% pos tag vars
+ {\ifx\currentpositionoverlay\empty
+ \dosetpositionaction{#1}{\MPpositiongraphic{#2}{#3}}%
+ \else % silly can be one
+ \handlepositiongraphics{#1}{#2}{#3}%
+ \fi}
+
+\def\handlepositiongraphics#1#2#3% combine with boxes
+ {\handlepositionaction\dohandleMPpositiongraphic\with{#1}{#2}{#3}\on{#2}}
+
+\def\doinsertMPpositiongraphic#1#2#3% pos tag setups
+ {\ifnum\MPp{#1}=\realpageno % extra saveguard
+ \def\currentposition{#1}\MPpositiongraphic{#2}{#3}%
+ \fi}
+
+\appendtoks
+ \let\dohandleMPpositiongraphic\doinsertMPpositiongraphic
+\to \everyinsertpositionaction
+
+\def\docleanMPpositiongraphic#1#2#3% pos tag setups
+ {\ifnum\MPp{#1}<\realpageno \else
+ \noexpand \dohandleMPpositiongraphic{#1}{#2}{#3}%
+ \fi}
+
+\appendtoks
+ \let\dohandleMPpositiongraphic\docleanMPpositiongraphic
+\to \everycleanpositionaction
+
+%D Graphics that span two positions.
+
+\def\setMPpositiongraphicrange%
+ {\doquadruplegroupempty\dosetMPpositiongraphicrange}
+
+\def\dosetMPpositiongraphicrange#1#2#3#4% bpos epos tag vars
+ {\ifx\currentpositionoverlay\empty
+ \dosetpositionaction{#1}{\MPpositiongraphic{#3}{#4}}%
+ \else
+ \handlepositiongraphicsrange{#1}{#2}{#3}{#4}%
+ \fi}
+
+\def\handlepositiongraphicsrange#1#2#3#4%
+ {\handlepositionaction\dohandleMPpositiongraphicrange\with{#1}{#2}{#3}{#4}\on{#2}}
+
+\def\doinsertMPpositiongraphicrange#1#2#3#4% pos tag setups
+ {\donefalse
+ \ifnum\MPp{#1}=\realpageno \donetrue
+ \else\ifnum\MPp{#2}=\realpageno \donetrue
+ \else\ifnum\MPp{#1}<\realpageno\ifnum\MPp{#2}>\realpageno \donetrue
+ \fi\fi\fi\fi \ifdone
+ \def\currentposition{#1}\MPpositiongraphic{#3}{#4}%
+ \fi}
+
+\appendtoks
+ \let\dohandleMPpositiongraphicrange\doinsertMPpositiongraphicrange
+\to \everyinsertpositionaction
+
+\def\docleanMPpositiongraphicrange#1#2#3#4% pos tag setups
+ {\ifnum\MPp{#2}<\realpageno \else
+ \noexpand \dohandleMPpositiongraphicrange{#1}{#2}{#3}{#4}%
+ \fi}
+
+\appendtoks
+ \let\dohandleMPpositiongraphicrange\docleanMPpositiongraphicrange
+\to \everycleanpositionaction
+
%D The auxiliary \METAPOST\ macros are defined by default,
%D by saying:
@@ -650,16 +894,19 @@
%D Some of these macros are pretty clever but too complicated
%D to be nice.
+%D THIS NEEDS A CLEANUP
+
\setupMPvariables
[mpos:box]
[linecolor=blue,
linewidth=\linewidth,
- backgroundcolor=lightgray]
+ fillcolor=lightgray]
-\startMPpositiongraphic{mpos:box}{backgroundcolor,linecolor}
+\startMPpositiongraphic{mpos:box}{fillcolor,linecolor,linewidth}
initialize_box(\MPpos{\MPvar{self}}) ;
- boxfillcolor := \MPvar{backgroundcolor} ;
+ boxfillcolor := \MPvar{fillcolor} ;
boxlinecolor := \MPvar{linecolor} ;
+ boxlinewidth := \MPvar{linewidth} ;
draw_box ;
anchor_box(\MPanchor{\MPvar{self}}) ;
\stopMPpositiongraphic
@@ -668,72 +915,333 @@
[mpos:area]
[linecolor=blue,
linewidth=\linewidth,
- backgroundcolor=lightgray]
+ fillcolor=lightgray]
-\startMPpositiongraphic{mpos:area}{backgroundcolor,linecolor}
+\startMPpositiongraphic{mpos:area}{fillcolor,linecolor,linewidth}
initialize_area(\MPpos{b:\MPvar{self}},\MPpos{e:\MPvar{self}}) ;
- boxfillcolor := \MPvar{backgroundcolor} ;
+ boxfillcolor := \MPvar{fillcolor} ;
boxlinecolor := \MPvar{linecolor} ;
+ boxlinewidth := \MPvar{linewidth} ;
draw_area ;
anchor_area(\MPanchor{b:\MPvar{self}}) ;
\stopMPpositiongraphic
+%D This is already cleaned up.
+
\setupMPvariables
[mpos:par]
- [linecolor=blue,
+ [mp=mpos:par:shape,
+ gridtype=0,
+ linetype=1,
+ filltype=1,
+ gridcolor=red,
+ linecolor=blue,
+ fillcolor=lightgray,
linewidth=\linewidth,
- backgroundcolor=lightgray]
+ gridwidth=\linewidth,
+ lineradius=.5\bodyfontsize]
\startuseMPgraphic{mpos:par:shape}
- draw_par ;
+ draw_par ; \iftracepositions show_par ; \fi
+\stopuseMPgraphic
+
+\startuseMPgraphic{mpos:par:setup}
+ boxgridtype := \MPvar{gridtype} ;
+ boxlinetype := \MPvar{linetype} ;
+ boxfilltype := \MPvar{filltype} ;
+ boxgridcolor := \MPvar{gridcolor} ;
+ boxlinecolor := \MPvar{linecolor} ;
+ boxfillcolor := \MPvar{fillcolor} ;
+ boxlinewidth := \MPvar{linewidth} ;
+ boxgridwidth := \MPvar{gridwidth} ;
+ boxlineradius := \MPvar{lineradius} ;
\stopuseMPgraphic
\startMPpositionmethod{mpos:par}
- \ifnum\MPp{b:\MPvar{self}}=\MPp{e:\MPvar{self}}\relax
- \startMPpositiongraphic{mpos:par}{backgroundcolor,linecolor}
- initialize_par(\MPpos{b:\MPvar{self}},\MPpos{l:\MPvar{self}},
- \MPpos{r:\MPvar{self}},\MPpos{e:\MPvar{self}}) ;
- boxfillcolor := \MPvar{backgroundcolor} ;
- boxlinecolor := \MPvar{linecolor} ;
- \includeMPgraphic{mpos:par:shape} ;
-if not (\MPx{head:\realfolio}=\MPx{head:\MPp{l:\MPvar{self}}}) :
- LoadPageState ; currentpicture := currentpicture shifted
- if odd \realfolio : - fi (PaperWidth-MakeupWidth-2BackSpace,0) ;
-fi ;
- anchor_par(\MPanchor{b:\MPvar{self}}) ;
- \stopMPpositiongraphic
- \MPpositiongraphic{mpos:par}{}%
- \else\ifnum\MPp{b:\MPvar{self}}<\MPp{e:\MPvar{self}}\relax
- \startMPpositiongraphic{mpos:par}{backgroundcolor,linecolor}
- initialize_par(\MPpos{b:\MPvar{self}},\MPpos{l:\MPvar{self}},
- \MPpos{r:\MPvar{self}},\MPpos{tail:\realfolio}) ;
- boxfillcolor := \MPvar{backgroundcolor} ;
- boxlinecolor := \MPvar{linecolor} ;
- \includeMPgraphic{mpos:par:shape} ;
-if not (\MPx{head:\realfolio}=\MPx{head:\MPp{l:\MPvar{self}}}) :
- LoadPageState ; currentpicture := currentpicture shifted
- if odd \realfolio : - fi (PaperWidth-MakeupWidth-2BackSpace,0) ;
-fi ;
- anchor_par(\MPanchor{b:\MPvar{self}}) ;
- \stopMPpositiongraphic
- \MPpositiongraphic{mpos:par}{}%
- \ifnum\MPp{e:\MPvar{self}}>\realpageno
- \bgroup
- \advance\realpageno by 1
- \copyposition{b:\MPvar{self}}{head:\realfolio}%
- \egroup
- \fi
- \fi\fi
+ \startMPpositiongraphic{mpos:par}%
+ {fillcolor,linecolor,gridcolor,linewidth,gridwidth,lineradius}
+ initialize_par(\MPpos{b:\MPvar{self}},
+ \MPpos{e:\MPvar{self}},
+ \MPpos{text:\realfolio},
+ \MPpos{p:\parcounter},
+ \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}}) ;
+ \stopMPpositiongraphic
+ \MPpositiongraphic{mpos:par}{}%
\stopMPpositionmethod
+
+%D Less readable but shorter.
+
+\ifx\parcounter\undefined \newcounter\parcounter \fi
+
+\def\MPself {\MPvar{self}}
+\def\MPbself {b:\MPself}
+\def\MPeself {e:\MPself}
+\def\paranchor{p:\parcounter}
+
+\startMPpositionmethod{mpos:par}
+ \edef\parcounter{\MPv\MPbself{1}{0}}%
+ \startMPpositiongraphic{mpos:par}%
+ {fillcolor,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{mpos:par:shape} ;
+ anchor_par(\MPanchor\MPbself) ;
+ \stopMPpositiongraphic
+ \MPpositiongraphic{mpos:par}{}%
+\stopMPpositionmethod
+
+\appendtoks
+ \savecurrentvalue\totalnofparbackgrounds\nofparbackgrounds
+\to \everybye
+
+\appendtoks
+ \initializeparbackgrounds
+\to \everystarttext
+
+\ifx\totalnofparbackgrounds\undefined \newcounter\totalnofparbackgrounds \fi
+\ifx\nofparbackgrounds \undefined \newcounter\nofparbackgrounds \fi
+
+\def\initializeparbackgrounds
+ {\ifcase\totalnofparbackgrounds\else
+ \global\positioningtrue
+ \global\positioningpartrue
+ \fi}
+
+\unexpanded\def\starttextbackground%
+ {\bgroup
+ \dodoubleempty\dostarttextbackground}
+
+\let\dodostarttextbackground\relax
+\let\dodostoptextbackground \relax
+
+\def\currentparbackground{background:0}
+\def\nextparbackground {background:1}
+
+\def\btbanchor{b:\currentparbackground}
+\def\etbanchor{e:\currentparbackground}
+
+\def\nextbtbanchor{b:\nextparbackground}
+\def\nextetbanchor{e:\nextparbackground}
+
+\def\backgroundvariable#1{\getvalue{\??td\currenttextbackground#1}}
+
+\def\dostarttextbackground[#1][#2]%
+ {\checktextbackgrounds
+ \def\currenttextbackground{#1}%
+ \doglobal\increment\nofparbackgrounds
+ \edef\currentparbackground{background:\nofparbackgrounds}%
+ \bgroup
+ \increment\nofparbackgrounds
+ \xdef\nextparbackground{background:\nofparbackgrounds}%
+ \egroup
+ \setuptextbackground[#1][#2]%
+ \let\dodostarttextbackground\relax
+ \let\dodostoptextbackground \relax
+ \doifvalue{\??td#1\c!status}{\v!start}
+ {\dopresettextbackground{#1}}%
+ \dodostarttextbackground}
+
+\def\dopresettextbackground#1%
+ {\ExpandFirstAfter\processaction
+ [\getvalue{\??td#1\c!plaats}]
+ [ \v!tekst=>\let\dodostarttextbackground\dostarttextbackgroundtxt
+ \let\dodostoptextbackground \dostoptextbackgroundtxt,
+ \v!alinea=>\let\dodostarttextbackground\dostarttextbackgroundpar
+ \let\dodostoptextbackground \dostoptextbackgroundpar]%
+ \doifelsevalue{\??td#1\c!kader}{\v!aan}
+ {\doifelsevalue{\??td#1\c!hoek}{\v!rond}
+ {\setvalue{\??td#1\c!kader}{2}}
+ {\setvalue{\??td#1\c!kader}{1}}}
+ {\setvalue{\??td#1\c!kader}{0}}%
+ \doifelsevalue{\??td#1\c!achtergrond}{\v!kleur}
+ {\setvalue{\??td#1\c!achtergrond}{1}}
+ {\setvalue{\??td#1\c!achtergrond}{0}}%
+ \startpositionoverlay{\v!tekst\getvalue{\??td#1\c!niveau}}%
+ \expanded
+ {\setMPpositiongraphicrange % moet veel efficienter
+ {b:\currentparbackground}%
+ {e:\currentparbackground}%
+ {mpos:par}%
+ {self=\currentparbackground,
+ mp=\getvalue{\??td#1\c!mp},
+ gridtype=\getvalue{\??td#1\c!variant},
+ filltype=\getvalue{\??td#1\c!achtergrond},
+ linetype=\getvalue{\??td#1\c!kader},
+ gridcolor=\getvalue{\??td#1\c!kaderkleur},
+ linecolor=\getvalue{\??td#1\c!kaderkleur},
+ fillcolor=\getvalue{\??td#1\c!achtergrondkleur},
+ gridwidth=\getvalue{\??td#1\c!lijndikte},
+ linewidth=\getvalue{\??td#1\c!lijndikte},
+ lineradius=\getvalue{\??td#1\c!straal}}}%
+ \stoppositionoverlay}
+
+\def\stoptextbackground%
+ {\dodostoptextbackground
+ \carryoverpar\egroup}
+
+\def\dostarttextbackgroundtxt
+ {\ifvmode \leavevmode \fi
+ \dostartattributes{\??td\currenttextbackground}\c!letter\c!kleur{}%
+ \fpos\currentparbackground\ignorespaces}
+
+\def\dostoptextbackgroundtxt
+ {\tpos\currentparbackground
+ \dostopattributes}
+
+\def\dostarttextbackgroundpar
+ {\getvalue{\??td\currenttextbackground\c!voor}%
+ \noindent\fpos\currentparbackground\ignorespaces
+ \bgroup
+ \nobreak \vskip-\lineheight \nobreak
+ \doassignsomeskip\getvalue{\??td\currenttextbackground\c!bovenoffset}\to\scratchskip
+ \kern\scratchskip\nobreak
+ \dosetleftskipadaption{\getvalue{\??td\currenttextbackground\c!linkeroffset}}%
+ \advance\leftskip\leftskipadaption
+ \dosetleftskipadaption{\getvalue{\??td\currenttextbackground\c!rechteroffset}}%
+ \advance\rightskip\leftskipadaption
+ \dostartattributes{\??td\currenttextbackground}\c!letter\c!kleur{}%
+ \geenwitruimte
+ \par}
+
+\def\dostoptextbackgroundpar
+ {\par
+ \dostopattributes
+ \doassignsomeskip\getvalue{\??td\currenttextbackground\c!onderoffset}\to\scratchskip
+ \kern\scratchskip\nobreak
+ \nobreak \vskip-\lineheight \nobreak
+ \geenwitruimte
+ \egroup
+ \nobreak \noindent \strut \hfill \kern\zeropoint \tpos\currentparbackground
+ \getvalue{\??td\currenttextbackground\c!na}}
+
+\let\textparpages \!!zeropoint
+\let\textparheight\!!zeropoint
+\let\textparwidth \!!zeropoint
+
+\def\calculatetextpardimensions
+ {\docalculatetextpardimensions\btbanchor \etbanchor \paranchor}
+
+\def\calculatenexttextpardimensions
+ {\docalculatetextpardimensions\nextbtbanchor\nextetbanchor\relax}
+
+\def\docalculatetextpardimensions#1#2#3%
+ {\scratchcounter\MPp#2%\etbanchor
+ \advance\scratchcounter-\MPp#1%\btanchor
+ \edef\textparpages{\the\scratchcounter}%
+ \ifcase\scratchcounter
+ % one page
+ \scratchdimen =\MPy#1%\btanchor
+ \advance\scratchdimen-\MPy#2%\etbanchor
+ \else
+ % two or more pages
+ \scratchdimen =\MPy#1%\btanchor
+ \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
+ \multiply\scratchdimen \scratchcounter
+ \else
+ % keep'm small
+ \scratchdimen=5\teksthoogte
+ \fi \fi
+ \fi
+ \edef\textparheight{\the\scratchdimen}%
+ \ifcase\scratchcounter
+ % one page
+ \scratchdimen =\MPx#2%\etbanchor
+ \advance\scratchdimen-\MPx#1%\btanchor
+ \else
+ % two or more pages / maybe also hang
+ \ifx#3\relax
+ \scratchdimen=\tekstbreedte
+ \else
+ \scratchdimen=\MPw\paranchor
+ \advance\scratchdimen-\MPl\paranchor
+ \advance\scratchdimen-\MPr\paranchor
+ \fi
+ \fi
+ \edef\textparwidth{\the\scratchdimen}}
+
+\def\definetextbackground%
+ {\dodoubleempty\dodefinetextbackground}
+
+\def\dodefinetextbackground[#1][#2]%
+ {\ifsecondargument
+ \copyparameters[\??td#1][\??td]
+ [\c!status,\c!plaats,\c!variant,\c!mp,
+ \c!achtergrond,\c!achtergrondkleur,\c!hoek,\c!niveau,
+ \c!straal,\c!kader,\c!kaderkleur,\c!lijndikte,
+ \c!linkeroffset,\c!rechteroffset,\c!bovenoffset,\c!onderoffset]%
+ \getparameters[\??td#1][#2]%
+ \doifvalue{\??td#1\c!status}{\v!start}{\checktextbackgrounds}%
+ \unexpanded\setvalue{#1}%
+ {\groupedcommand{\starttextbackground[#1]}{\stoptextbackground}}%
+ \setvalue{\e!start#1}{\starttextbackground[#1]}%
+ \setvalue{\e!stop #1}{\stoptextbackground}%
+ \fi}
+
+\def\setuptextbackground%
+ {\dodoubleargument\dosetuptextbackground}
+
+\def\dosetuptextbackground[#1][#2]%
+ {\ifsecondargument
+ \getparameters[\??td#1][#2]%
+ \def\currenttextbackground{#1}%
+ \doifvalue{\??td#1\c!status}{\v!start}{\checktextbackgrounds}%
+ \else
+ \setuptextbackground[][#1]%
+ \fi}
+
+\let\currenttextbackground\empty
+
+\def\checktextbackgrounds % maybe we need a dedicated layer
+ {\ifproductionrun % for this kind of trickery, but
+ \setupbackgrounds % for the moment this one will do
+ [\v!tekst] % or maybe an \extendbackgrounds
+ % [\c!achtergrond={\v!tekst-2,\v!tekst-1,\v!voorgrond,\v!tekst+1,\v!tekst+2}]%
+ [\c!achtergrond={\v!tekst-1,\v!voorgrond,\v!tekst+1}]%
+ \let\checktextbackgrounds\relax
+ \fi}
+
+\defineoverlay[\v!tekst-2][\positionoverlay{\v!tekst-2}]
+\defineoverlay[\v!tekst-1][\positionoverlay{\v!tekst-1}]
+\defineoverlay[\v!tekst+1][\positionoverlay{\v!tekst+1}]
+\defineoverlay[\v!tekst+2][\positionoverlay{\v!tekst+2}]
+
+\setuptextbackground
+ [\c!mp=mpos:par:shape,
+ \c!status=\v!start,
+ \c!plaats=\v!tekst,
+ \c!linkeroffset=\!!zeropoint, % 1em,
+ \c!rechteroffset=\getvalue{\??td\currenttextbackground\c!linkeroffset},
+ \c!bovenoffset=\!!zeropoint, % \v!middel,
+ \c!onderoffset=\getvalue{\??td\currenttextbackground\c!bovenoffset},
+ \c!niveau=-1,
+ \c!variant=0,
+ \c!achtergrond=\v!kleur,
+ \c!achtergrondkleur=lightgray,
+ \c!hoek=\v!recht,
+ \c!straal=.5\bodyfontsize,
+ \c!kader=\v!aan,
+ \c!kaderkleur=blue,
+ \c!lijndikte=\linewidth]
-% lelijk, aanpassen
+% lelijk, aanpassen
\setupMPvariables
[mpos:connect]
[linecolor=blue,
- linewidth=\linewidth,
- arrowcolor=red,
- backgroundcolor=lightgray]
+ linewidth=1pt,
+ arrowcolor=red]
\startMPpositiongraphic{mpos:connect}{linecolor,linewidth,arrowcolor}
path pa, pb ; pair ca, cb ;
@@ -788,8 +1296,8 @@ fi ;
\def\stackposleft {\dostackposbox{\copy\nextbox\hskip\wd\nextbox\hskip\stackposdistance}}
\def\stackposright{\dostackposbox{\hskip\stackposdistance\hskip\wd\nextbox\box\nextbox}}
-%D The next hack make sure that margin texts near faulty
-%D strutted lines are handled ok.
+%D The next hack make sure that margin texts near faulty
+%D strutted lines are handled ok.
\newif\ifrepositionmarginbox % \repositionmarginboxtrue
@@ -799,7 +1307,7 @@ fi ;
% {\bgroup
% \ifrepositionmarginbox
% \doglobal\increment\currentmarginpos
-% \setposition{\s!margin:\currentmarginpos}%
+% \setposition{\s!margin:\currentmarginpos}%
% \scratchdimen=\MPy{\s!margin:\currentmarginpos}%
% \doglobal\increment\currentmarginpos
% \advance\scratchdimen by -\MPy{\s!margin:\currentmarginpos}%
@@ -816,17 +1324,17 @@ fi ;
{\bgroup
\ifrepositionmarginbox
\doglobal\increment\currentmarginpos
- \setposition{\s!margin:\currentmarginpos}%
+ \setposition{\s!margin:\currentmarginpos}%
\scratchdimen=\MPy{\s!margin:\currentmarginpos}%
\doglobal\increment\currentmarginpos
\advance\scratchdimen by -\MPy{\s!margin:\currentmarginpos}%
\advance\scratchdimen by -\dp\strutbox
- % new
+ % new
\setbox#1=\hbox
{\hskip-\MPx{\s!margin:\currentmarginpos}%
\hskip\MPx{head:\realfolio}%
\box#1}%
- % so far
+ % so far
\setbox#1=\hbox
{\setposition{\s!margin:\currentmarginpos}\raise\scratchdimen\box#1}%
\dp#1=\!!zeropoint
@@ -836,19 +1344,19 @@ fi ;
\egroup}
%D For a right menu, a sequence of calls to \type
-%D {right_menu_button} is generated.
-%D
+%D {right_menu_button} is generated.
+%D
%D \starttypen
-%D right_menu_button (n, p, s=0/1/2, x, y, w, h, d) ;
+%D right_menu_button (n, p, s=0/1/2, x, y, w, h, d) ;
%D \stoptypen
%D
%D Here, n is the number of the button, s a status variable,
%D while the rest is positional info. The status variable is
-%D 0, 1 or~2: not found, found and found but current page.
+%D 0, 1 or~2: not found, found and found but current page.
% 0=not found 1=found 2=current page
-% geen leeg
+% geen leeg
\newtoks\MPmenutoks
@@ -856,7 +1364,7 @@ fi ;
\appendtoks \global\MPmenutoks\emptytoks \to \everyshipout
-% 0=notfound 1=found 2=currentpage
+% 0=notfound 1=found 2=currentpage
\def\do@@amposition#1#2#3%
{\doifelsevalue{\??am#1\c!positie}{\v!ja}
@@ -866,21 +1374,19 @@ fi ;
\global\chardef\currentamrealpage=\ifrealreferencepage2\else1\fi}
{\doifreferencefoundelse{#2}
{\global\chardef\currentamrealpage=\ifrealreferencepage2\else1\fi}
- {\global\chardef\currentamrealpage=0}}% % not found
+ {\global\chardef\currentamrealpage=0}}% % not found
\expanded
- {\doglobal\noexpand\appendtoks
+ {\doglobal\noexpand\appendtoks
#1_menu_button(\currentamposition,\the\currentamrealpage,\noexpand\MPpos{#1:\currentamposition}) ;
\to \MPmenutoks}%
\hpos{#1:\currentamposition}{#3}}
- {#3}}
+ {#3}}
\def\do@@ammenuposition#1%
{\ifnum\currentamposition>0
\dowithnextbox{\hpos{menu:#1:\realfolio}{\box\nextbox}}\hbox
- \fi}
+ \fi}
-\protect \endinput
-
%D \macros
%D {GFC, GTC, GSC}
%D
@@ -957,10 +1463,10 @@ fi ;
\def\doGTC[#1]{\iffirstargument\dodoGTC[#1]\else\expandafter\NC\fi}
\def\doXC [#1]{\iffirstargument\dodoXC [#1]\else\expandafter\fi\NC}
-\def\GSC{\dosingleempty\doGSC}
-\def\GFC{\dosingleempty\doGFC}
-\def\GTC{\dosingleempty\doGTC}
-\def\XC {\dosingleempty\doXC }
+\def\tbGSC{\dosingleempty\doGSC}
+\def\tbGFC{\dosingleempty\doGFC}
+\def\tbGTC{\dosingleempty\doGTC}
+\def\tbXC {\dosingleempty\doXC }
%D The amount of code to support tables and tabulation is
%D rather minimalistic.
@@ -976,15 +1482,24 @@ fi ;
\hskip-\wd\scratchbox
\box\scratchbox}
-\def\tabulatenormalcolumn#1%
+\def\tabulatenormalcolumn#1% overloaded
{&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi
&\global\chardef\tabulatetype=#1&}
-\def\tabulateequalcolumn#1%
+\def\tabulateequalcolumn#1% overloaded
{&\tabulateequalpos
&\global\chardef\tabulatetype=#1&}
-\appendtoks \doglobal\increment\noftabpositions \to \everytabulate
+\appendtoks
+ \doglobal\increment\noftabpositions
+\to \everytabulate
+
+%D In order to prevent potential clashes with abbreviations,
+%D postpone the mapping.
+
+\appendtoks
+ \let\GSC\tbGSC \let\GFC\tbGFC \let\GTC\tbGTC \let\XC\tbXC
+\to \everytabulate
%D \macros
%D {definepositionframed}
@@ -993,9 +1508,9 @@ fi ;
%D cells. First we define some framed backgrounds.
%D
%D \startbuffer
-%D \definepositionframed[x][background=color,backgroundcolor=red]
-%D \definepositionframed[y][background=color,backgroundcolor=green]
-%D \definepositionframed[z][background=color,backgroundcolor=blue]
+%D \definepositionframed[x][background=color,fillcolor=red]
+%D \definepositionframed[y][background=color,fillcolor=green]
+%D \definepositionframed[z][background=color,fillcolor=blue]
%D \stopbuffer
%D
%D \typebuffer
@@ -1022,7 +1537,15 @@ fi ;
\def\normalTABLEcomplexbar{\unskip\!ttRightGlue&\omit\tablepos\!ttAlternateVrule} % \|
\def\normalTABLEquote {\unskip\!ttRightGlue&\omit\tablepos&} % "
-\appendtoks \doglobal\increment\noftabpositions \to \EveryTable
+\appendtoks
+ \doglobal\increment\noftabpositions
+\to \everytable
+
+%D Since we don't want nameclashes:
+
+\appendtoks
+ \let\GSC\tbGSC \let\GFC\tbGFC \let\GTC\tbGTC \let\XC\tbXC
+\to \everytable
%D In the previous example, we could have provided an overlay to
%D the framed definition. A more direct approach is demonstrated
@@ -1062,10 +1585,10 @@ fi ;
%D
%D % \haalbuffer
-% \definepositionframed[w][background=color,backgroundcolor=yellow]
-% \definepositionframed[x][background=color,backgroundcolor=red]
-% \definepositionframed[y][background=color,backgroundcolor=green]
-% \definepositionframed[z][background=color,backgroundcolor=blue]
+% \definepositionframed[w][background=color,fillcolor=yellow]
+% \definepositionframed[x][background=color,fillcolor=red]
+% \definepositionframed[y][background=color,fillcolor=green]
+% \definepositionframed[z][background=color,fillcolor=blue]
%
% \starttabulate[|c|c|c|]
% \NC this is a small \NC table \NC in which we \NC \FR
@@ -1099,9 +1622,9 @@ fi ;
% evt [b:x]
%
-% \definepositionframed[x][background=color,backgroundcolor=red]
-% \definepositionframed[y][background=color,backgroundcolor=green]
-% \definepositionframed[z][background=color,backgroundcolor=blue]
+% \definepositionframed[x][background=color,fillcolor=red]
+% \definepositionframed[y][background=color,fillcolor=green]
+% \definepositionframed[z][background=color,fillcolor=blue]
\def\remappositionframed#1#2% from to
{\copyposition{b:#1}{b:#2}%
diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex
index 107b1b518..fb8a0d5c2 100644
--- a/tex/context/base/core-ref.tex
+++ b/tex/context/base/core-ref.tex
@@ -154,9 +154,13 @@
%D These are implemented in a low level form as:
-\def\dotextreference[#1]#2{\rawtextreference{\s!txt}{#1}{#2}}
-\def\dopagereference [#1]{\rawpagereference{\s!pag}{#1}}
-\def\doreference [#1]#2{\rawreference {\s!ref}{#1}{#2}}
+% \def\dotextreference[#1]#2{\rawtextreference{\s!txt}{#1}{#2}}
+% \def\dopagereference [#1]{\rawpagereference{\s!pag}{#1}}
+% \def\doreference [#1]#2{\rawreference {\s!ref}{#1}{#2}}
+
+\def\dotextreference[#1]{\rawtextreference\s!txt{#1}} % #2
+\def\dopagereference[#1]{\rawpagereference\s!pag{#1}}
+\def\doreference [#1]{\rawreference \s!ref{#1}} % #2
%D Actually there is not much difference between a text and a
%D full reference, but it's the concept that counts. The low
@@ -584,6 +588,12 @@
\fi
\fi}
+\ifx\referencepagenumber\undefined
+
+ \def\referencepagenumber[#1]{?}
+
+\fi
+
%D Text references can contain more than one entry and
%D therefore we check for
%D
@@ -715,20 +725,20 @@
\def\dosplitofffullreference#1(#2#3)#4#5\end
{\ifx#2)%
- \let\currentreferenceoperation=\empty
- \let\currentreferencearguments=\empty
- \let\currentinnerreference=\empty
+ \let\currentreferenceoperation\empty
+ \let\currentreferencearguments\empty
+ \let\currentinnerreference \empty
\dodosplitofffullreferenceA#1::::\empty\end
\currentouterreference\currentreferencespecial
\else\ifx#2\relax
- \let\currentreferencespecial=\empty
- \let\currentreferenceoperation=\empty
- \let\currentreferencearguments=\empty
+ \let\currentreferencespecial \empty
+ \let\currentreferenceoperation\empty
+ \let\currentreferencearguments\empty
\dodosplitofffullreferenceA#1::::\empty\end
\currentouterreference\currentinnerreference
\else
\dosplitoffreferenceoperation#2#3{}\end
- \let\currentinnerreference=\empty
+ \let\currentinnerreference\empty
\dodosplitofffullreferenceB#1::::\empty\end
\currentouterreference\currentreferencespecial
\fi\fi}
@@ -1497,8 +1507,11 @@
\def\thisissomeinternal#1#2% tag reference
{\doifsomething{#2}{\thisisdestination{#1:#2}}}
-\def\gotosomeinternal#1#2#3#4%
- {\gotodestination{}{}{#1:#2}{#3}{#4}}
+% \def\gotosomeinternal#1#2#3#4%
+% {\gotodestination{}{}{#1:#2}{#3}{#4}}
+
+\def\gotosomeinternal#1#2% #3#4
+ {\gotodestination{}{}{#1:#2}}
%D An automatic mechanism is provided too:
%D
@@ -1526,8 +1539,11 @@
{\global\advance\locationcount by 1
\thisisdestination{\s!aut\iftraceinternalreferences:#1\fi:\nextinternalreference}}
-\def\gotonextinternal#1#2#3#4%
- {\gotodestination{}{}{\s!aut\iftraceinternalreferences:#1\fi:#2}{#3}{#4}}
+% \def\gotonextinternal#1#2#3#4%
+% {\gotodestination{}{}{\s!aut\iftraceinternalreferences:#1\fi:#2}{#3}{#4}}
+
+\def\gotonextinternal#1#2% #3#4
+ {\gotodestination{}{}{\s!aut\iftraceinternalreferences:#1\fi:#2}}
%D We already went through a lot of problems to sort out what
%D kind of reference we're dealing with. Sorting out the user
@@ -1629,7 +1645,7 @@
%D \definespeciallocation{JS}#1#2{... #1 ... #2 ...}
%D \stoptypen
%D
-%D In module \type {core-jav} one can see that \type
+%D In module \type {java-ini} one can see that \type
%D {\gotoJSlocation} looks much like the previous goto
%D definitions.
@@ -1904,25 +1920,23 @@
%D --- VANAF HIER NOG VERENGELSEN ---
-\let\donormalin =\in
-\let\donormalover=\over % about/oppassen beter nederlands dan engels!
+%\let\donormalin =\in
+%\let\donormalover=\over % about/oppassen beter nederlands dan engels!
+%
+%\def\in%
+% {\ifmmode
+% \expandafter\donormalin
+% \else
+% \expandafter\doinatreference\expandafter\currenttextreference
+% \fi}
-\def\in%
- {\ifmmode
- \expandafter\donormalin
- \else
- \expandafter\doinatreference\expandafter\currenttextreference
- \fi}
+% we need to bypass math tokens
-\def\op%
- {\doinatreference\currentpagereference}
+\let\normalover \over
-\def\over%
- {\ifmmode
- \expandafter\donormalover
- \else
- \expandafter\dospecialover
- \fi}
+\definecommand in {\doinatreference\currenttextreference}
+\definecommand op {\doinatreference\currentpagereference}
+\definecommand over {\dospecialover}
\unexpanded\def\dospecialover[#1]%
{\dontleavehmode
diff --git a/tex/context/base/core-reg.tex b/tex/context/base/core-reg.tex
index 841df4e46..d1149426e 100644
--- a/tex/context/base/core-reg.tex
+++ b/tex/context/base/core-reg.tex
@@ -15,6 +15,7 @@
\newif \ifautoregisterhack % for the moment a private hack
+% new: eigennummer=ja => eerste {} ipv pag nummer
\unprotect
%D Isolated but still indocumented.
@@ -308,60 +309,61 @@
{\limitatetext{#2}{\getvalue{\??id#1\c!maxbreedte}}{\unknown}}}}
\def\dosetpageregisterpage#1#2#3#4#5#6%
- {\doifreglevelelse[#5]
- {\global\utilitydonetrue
- \c!entryletter
- \setregisterhowto[#3]%
- \def\dohandleregisterentry##1%
+ {\doifreglevelelse[#5]{\dodosetpageregisterpage{#1}{#2}{#3}{#4}{#5}{#6}}{}}
+
+\def\dodosetpageregisterpage#1#2#3#4#5#6%
+ {\global\utilitydonetrue
+ \c!entryletter
+ \setregisterhowto[#3]%
+ \def\dohandleregisterentry##1%
+ {\bgroup
+ \if!!donea % \strut nieuw
+ \setbox0=\hbox{\showlocation{\doregistertexthowto{#2}
+ {\strut\limitedregisterentry{#2}{##1}}}}%
+ \gotonextinternal{\s!ind}{#4}{#6}{\box0}%
+ \else
+ \doregistertexthowto{#2}{##1}%
+ \fi
+ \egroup
+ \!!doneafalse}%
+ \!!doneafalse
+ \doifelsevalue{\??id#2\c!interactie}{\v!tekst}
+ {\ifcase\currententrylevel \or
+ \!!doneatrue\c!entrya\c!entryb\c!entryc \or
+ \c!entrya\!!doneatrue\c!entryb\c!entryc \or
+ \c!entrya\c!entryb\!!doneatrue\c!entryc \fi}
+ {\c!entrya\c!entryb\c!entryc}%
+ \global\let\c!entrya=\relax
+ \global\let\c!entryb=\relax
+ \global\let\c!entryc=\relax
+ \global\let\c!entryletter=\relax
+ \global\let\c!entryreference=\relax
+ \iffirstregisterpage
+ \global\chardef\lastregisterpagestatus=0
+ \expandafter\hskip\getvalue{\??id#2\c!afstand}\relax
+ \donetrue
+ \else\ifnum#1=3
+ |--|\relax % -- !
+ \donetrue
+ \else\ifnum\lastregisterpagestatus=2
+ \donefalse % waiting for "to" pagenumber
+ \else
+ \registerpageseparator
+ |\spatie|\relax % \relax needed because | looks ahead
+ \donetrue
+ \fi\fi\fi
+ \ifdone
+ \doifelsevalue{\??id#2\c!interactie}{\v!paginanummer}
{\bgroup
- \if!!donea % \strut nieuw
- \setbox0=\hbox{\showlocation{\doregistertexthowto{#2}
- {\strut\limitedregisterentry{#2}{##1}}}}%
- \gotonextinternal{\s!ind}{#4}{#6}{\box0}%
- \else
- \doregistertexthowto{#2}{##1}%
- \fi
- \egroup
- \!!doneafalse}%
- \!!doneafalse
- \doifelsevalue{\??id#2\c!interactie}{\v!tekst}
- {\ifcase\currententrylevel \or
- \!!doneatrue\c!entrya\c!entryb\c!entryc \or
- \c!entrya\!!doneatrue\c!entryb\c!entryc \or
- \c!entrya\c!entryb\!!doneatrue\c!entryc \fi}
- {\c!entrya\c!entryb\c!entryc}%
- \global\let\c!entrya=\relax
- \global\let\c!entryb=\relax
- \global\let\c!entryc=\relax
- \global\let\c!entryletter=\relax
- \global\let\c!entryreference=\relax
- \iffirstregisterpage
- \global\chardef\lastregisterpagestatus=0
- \expandafter\hskip\getvalue{\??id#2\c!afstand}\relax
- \donetrue
- \else\ifnum#1=3
- |--|\relax % -- !
- \donetrue
- \else\ifnum\lastregisterpagestatus=2
- \donefalse % waiting for "to" pagenumber
- \else
- \registerpageseparator
- |\spatie|\relax % \relax needed because | looks ahead
- \donetrue
- \fi\fi\fi
- \ifdone
- \doifelsevalue{\??id#2\c!interactie}{\v!paginanummer}
- {\bgroup
- \setbox0=\hbox
- {\showlocation{\doregisterpage{#2}[#5]\ifnum#1=2\/\fi}}%
- \gotonextinternal{\s!ind}{#4}{#6}{\box0}%{\copy0}%
- \egroup}
- {\hbox{\doregisterpage{#2}[#5]\ifnum#1=2\/\fi}}%
- \ignorespaces
- \global\chardef\lastregisterpagestatus=#1\relax
- \fi
- \global\firstregisterpagefalse}
- {}}
+ \setbox0=\hbox
+ {\showlocation{\doregisterpage{#2}[#5]\ifnum#1=2\/\fi}}%
+ \gotonextinternal{\s!ind}{#4}{#6}{\box0}%{\copy0}%
+ \egroup}
+ {\hbox{\doregisterpage{#2}[#5]\ifnum#1=2\/\fi}}%
+ \ignorespaces
+ \global\chardef\lastregisterpagestatus=#1\relax
+ \fi
+ \global\firstregisterpagefalse}
\def\dosetpageregistersee#1#2#3#4%
{\doifreglevelelse[#4::0]
@@ -619,9 +621,74 @@
\def\koppelregister%
{\dodoubleempty\dokoppelregister}
+% \def\doprocesslinkregister[#1][#2]#3%
+% {\hbox
+% {\doprocesspageregister[#2]{#3}%
+% \let\firstlistreference=\empty
+% \let\lastlistreference=\empty
+% \let\selflistreference=\empty
+% \let\prevlistreference=\empty
+% \let\nextlistreference=\empty
+% \getalllistreferences{#1}{#3}%
+% \doifnot{\alllistreferences}{}
+% {\def\dodocommando[##1-##2]%
+% {\ifx\firstlistreference\empty
+% \def\firstlistreference{##1-##2}%
+% \fi
+% \def\lastlistreference{##1-##2}%
+% \ifnum##1<\nextinternalreference\relax
+% \def\prevlistreference{##1-##2}%
+% \else\ifnum##1>\nextinternalreference\relax
+% \def\nextlistreference{##1-##2}%
+% \def\dodocommando[####1-####2]%
+% {\def\lastlistreference{####1-####2}}%
+% \else
+% \def\selflistreference{##1-##2}%
+% \fi\fi}%
+% \def\docommando##1%
+% {\dodocommando[##1]}%
+% \processcommacommand[\alllistreferences]\docommando}%
+% \ifx\prevlistreference\empty
+% \let\prevlistreference=\lastlistreference
+% \fi
+% \ifx\nextlistreference\empty
+% \let\nextlistreference=\firstlistreference
+% \fi
+% \ifx\prevlistreference\selflistreference
+% \let\prevlistreference=\empty
+% \let\nextlistreference=\empty
+% \fi
+% \def\dodocommando[##1-##2]%
+% {\gotonextinternal{\s!ind}{##1}{##2}{\box0}}%{\copy0}}%
+% \def\docommando##1##2%
+% {\bgroup
+% \ifx##1\empty
+% \doifvalue{\??id#1\c!onbekendeverwijzing}{\v!leeg}
+% {\hskip1em}%
+% \else
+% \setbox0=\hbox to 1em{\hss\showlocation{\symbol[##2]}\hss}%
+% \expandafter\dodocommando\expandafter[##1]%
+% \fi
+% \egroup}%
+% \processaction
+% [\getvalue{\??id#1\c!plaats}]
+% [\v!midden=>\docommando\prevlistreference\v!vorige,
+% \v!links=>\docommando\prevlistreference\v!vorige
+% \docommando\nextlistreference\v!volgende]%
+% \doifreferencefoundelse{\s!lin:\internallistreference}
+% {\gotosomeinternal
+% {\s!lin}{\internallistreference}{\currentrealreference}
+% {\showlocation{\limitedregisterentry{#1}{#3}}}}
+% {\hbox{\limitedregisterentry{#1}{#3}}}%
+% \processaction
+% [\getvalue{\??id#1\c!plaats}]
+% [ \v!midden=>\docommando\nextlistreference\v!volgende,
+% \v!rechts=>\docommando\prevlistreference\v!vorige
+% \docommando\nextlistreference\v!volgende]}}
+
\def\doprocesslinkregister[#1][#2]#3%
{\hbox
- {\doprocesspageregister[#2]{#3}%
+ {\doprocesspageregister[#2]{}{#3}%
\let\firstlistreference=\empty
\let\lastlistreference=\empty
\let\selflistreference=\empty
@@ -684,6 +751,24 @@
\v!rechts=>\docommando\prevlistreference\v!vorige
\docommando\nextlistreference\v!volgende]}}
+% \def\dodolinkedregister[#1][#2]#3% page auto link
+% {\bgroup
+% \chardef\registerpagestatus=1
+% \def\currentregister{#1}%
+% \iflocation
+% \ifautoregisterhack
+% \def\next{\doprocessautoregister[#1][#2]{#3}}%
+% \else
+% \def\next{\doprocesslinkregister[#1][#2]{#3}}%
+% \fi
+% \else
+% \def\next{\doprocesspageregister[#2]{#3}}%
+% \fi
+% \next
+% \egroup
+% \ifvmode\nobreak\fi
+% \GotoPar}
+
\def\dodolinkedregister[#1][#2]#3% page auto link
{\bgroup
\chardef\registerpagestatus=1
@@ -695,7 +780,7 @@
\def\next{\doprocesslinkregister[#1][#2]{#3}}%
\fi
\else
- \def\next{\doprocesspageregister[#2]{#3}}%
+ \def\next{\doprocesspageregister[#2]{}{#3}}%
\fi
\next
\egroup
@@ -736,9 +821,18 @@
\limitedregisterentry{#1}{#2}%
\fi}
+% \def\doprocessautoregister[#1][#2]#3%
+% {\hbox
+% {\doprocesspageregister[#2]{#3}%
+% \doifreferencefoundelse{\s!lin:\internallistreference}
+% {\gotosomeinternal
+% {\s!lin}{\internallistreference}{\currentrealreference}
+% {\showlocation{\limitedregisterentry{#1}{#3}}}}
+% {\hbox{\limitedregisterentry{#1}{#3}}}}}
+
\def\doprocessautoregister[#1][#2]#3%
{\hbox
- {\doprocesspageregister[#2]{#3}%
+ {\doprocesspageregister[#2]{}{#3}%
\doifreferencefoundelse{\s!lin:\internallistreference}
{\gotosomeinternal
{\s!lin}{\internallistreference}{\currentrealreference}
@@ -749,8 +843,8 @@
%D The first implementation used one main field with clones.
%D In a 2500 page document this resulted in a rather (anoying)
-%D long start||up time. This \quote {every page its own field}
-%D solution, combined with a \quote {page open action}, works
+%D long start||up time. This \citeer {every page its own field}
+%D solution, combined with a \citeer {page open action}, works
%D much faster, but is conceptually pretty weak.
\def\complexregisterfield[#1]%
diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex
index 1d6d19d6d..85996d5ba 100644
--- a/tex/context/base/core-rul.tex
+++ b/tex/context/base/core-rul.tex
@@ -8,11 +8,13 @@
%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 / Ruled Stuff Handling}
+% to test: [#1]#2[#3] in \startlocalframed
+
\unprotect
%D \macros
@@ -97,7 +99,7 @@
{\rasterfont.}
\def\rasterbox%
- {\hss\vrule\!!width.4pt\!!height.4pt\!!depth\!!zeropoint}
+ {\hss\vrule\!!width.4pt\!!height.4pt\!!depth\zeropoint}
%D Now of course we need:
@@ -151,18 +153,18 @@
%D We just introduced two pure \TEX\ methods for generating
%D rasters. However, it's far more efficient and comfortable in
%D terms of speed, memory usage and file size, to use a driver
-%D supported method.
+%D supported method.
\setvalue{\v!extern graybox}\width#1\height#2\depth#3\raster#4\corner#5\radius#6\\%
{\setgraybox\width#1\height#2\depth#3\raster#4\corner#5\radius#6\\}
-%D For compatibility reasons we also define the original one:
+%D For compatibility reasons we also define the original one:
\setvalue{\v!postscript graybox}%
- {\getvalue{\v!extern graybox}}
+ {\getvalue{\v!extern graybox}}
%D A quite valid way of letting drivers do the job, is giving
-%D a solid rule a gray texture.
+%D a solid rule a gray texture.
\def\raster[#1]%
{\groupedcommand{\startraster[#1]}{\stopraster}}
@@ -173,13 +175,13 @@
{\raster[#4]%
{\dofilledbox \width#1\height#2\depth#3\corner#5\radius#6\\}}}
-%D The auxiliary macro is defined as:
+%D The auxiliary macro is defined as:
\def\dophantombox#1\\{\hphantom{\dofilledbox#1\\}}
-%D We don't have to stick to a \TEX\ drawn rule, but
-%D also can use rounded or even fancier shapes, as we will
-%D see later on.
+%D We don't have to stick to a \TEX\ drawn rule, but
+%D also can use rounded or even fancier shapes, as we will
+%D see later on.
\def\dofilledbox\width#1\height#2\depth#3\corner#4\radius#5\\%
{\bgroup
@@ -206,7 +208,7 @@
\scratchdimen=#3\edef\ovaldep{\number\scratchdimen}%
\scratchdimen=#4\edef\ovallin{\number\scratchdimen}%
\scratchdimen=#5\edef\ovalrad{\number\scratchdimen}%
- \doifelse{#6}{\v!aan} % will be a macro that handles
+ \doifelse{#6}{\v!aan} % will be a macro that handles
{\def\ovalstr{1}} % start, stop, ja, nee, aan, uit
{\def\ovalstr{0}}% % and something \doif
\doifelse{#7}{\v!aan}
@@ -218,11 +220,11 @@
{\ovalstr}{\ovalfil}%
\egroup}
-%D The oval box is drawn using a special macro, depending on
-%D the driver in use.
+%D The oval box is drawn using a special macro, depending on
+%D the driver in use.
%D It won't be a surprise that we not only provide gray boxes,
-%D but also colored ones. Here it is:
+%D but also colored ones. Here it is:
\def\setcolorbox\width#1\height#2\depth#3\color#4\corner#5\radius#6\\%
{\ifincolor
@@ -237,68 +239,68 @@
{\setcolorbox}
%D \macros
-%D {defineoverlay,doifoverlayelse,
+%D {defineoverlay,doifoverlayelse,
%D overlaywidth, overlayheight, overlaydepth,
%D overlaycolor, overlaylinecolor, overlaylinewidth}
-%D
+%D
%D Before we define the macro that actually takes card of the
%D backgrounds, we introduce overlays. An overlay is something
%D that contrary to its name lays {\em under} the text. An
-%D example of an overlay definition is:
-%D
+%D example of an overlay definition is:
+%D
%D \startbuffer[tmp-1]
%D \defineoverlay
%D [fancy]
%D [{\externfiguur
%D [mp-cont.502]
-%D [breedte=\overlaywidth,
+%D [breedte=\overlaywidth,
%D hoogte=\overlayheight]}]
%D \stopbuffer
-%D
+%D
%D \typebuffer[tmp-1]
-%D
+%D
%D That for instance can be uses in:
-%D
+%D
%D \startbuffer[tmp-2]
%D \omlijnd[achtergrond=fancy]{How Fancy!}
%D \omlijnd[achtergrond=fancy,kader=uit]{Even More Fancy!}
%D \stopbuffer
-%D
-%D and looks like:
-%D
-%D \startregelcorrectie
+%D
+%D and looks like:
+%D
+%D \startregelcorrectie
%D \vbox{\baselineskip24pt\haalbuffer[tmp-1]\haalbuffer[tmp-2]}
%D \stopregelcorrectie
-%D
-%D The formal definition is:
-%D
+%D
+%D The formal definition is:
+%D
%D \showsetup{\y!defineoverlay}
%D
-%D This macro's definition is a bit obscure, due the many
-%D non||used arguments and the two step call that enable the
-%D setting of the width, height and depth variables.
+%D This macro's definition is a bit obscure, due the many
+%D non||used arguments and the two step call that enable the
+%D setting of the width, height and depth variables.
%D Multiple backgrounds are possible and are specified as:
%D
%D \starttypen
%D \omlijnd[achtergrond={one,two,three}]{Three backgrounds!}
%D \stoptypen
%D
-%D Most drawing packages only know width and height. Therefore
+%D Most drawing packages only know width and height. Therefore
%D the dimensions have a slightly different meaning here:
-%D
+%D
%D \startopsomming[opelkaar]
%D \som \type{\overlaywidth }: width of the overlay
%D \som \type{\overlayheight}: height plus depth of the overlay
%D \som \type{\overlaydepth }: depth of the overlay
%D \stopopsomming
-%D
-%D The resulting box is lowered to the right depth.
-
-\def\overlaywidth {\the\vsize\space} % We preset the variables
+%D
+%D The resulting box is lowered to the right depth.
+
+\def\overlaywidth {\the\vsize\space} % We preset the variables
\def\overlayheight {\the\hsize\space} % to some reasonable default
-\let\overlaydepth \!!zeropoint % values. The attributes
-\let\overlaycolor \empty % of the frame can be (are)
-\let\overlaylinewidth \!!zeropoint % set somewhere else.
+\let\overlaydepth \!!zeropoint % values. The attributes
+\let\overlaycolor \empty % of the frame can be (are)
+\let\overlaylinewidth \!!zeropoint % set somewhere else.
\let\overlaylinecolor \empty %
\newtoks\everyoverlay
@@ -311,8 +313,8 @@
{\setvalue{\??ov##1}{\executedefinedoverlay##1\\#2\\}}%
\processcommalist[#1]\docommando}
-\long\def\executedefinedoverlay#1\\#2\\#3#4#5#6#7#8#9%
- {\bgroup
+\long\def\executedefinedoverlay#1\\#2\\#3#4#5#6#7#8#9%
+ {\bgroup
\scratchdimen=#3%
\edef\overlaywidth{\the\scratchdimen\space}%
\scratchdimen=#4%
@@ -322,36 +324,36 @@
\edef\overlaydepth{\the\scratchdimen\space}%
\edef\overlaycolor{#6}%
\prependtoks
- \hsize=\overlaywidth
- \vsize=\overlayheight
+ \hsize\overlaywidth
+ \vsize\overlayheight
\to\everyoverlay
%\writestatus
% {overlay}
% {#1\space w=\overlaywidth/h+d=\overlayheight/d=\overlaydepth]}%
- \setbox0=\hbox{\lower\overlaydepth\hbox{\the\everyoverlay#2}}%
+ \setbox0=\hbox{\lower\overlaydepth\hbox{\the\everyoverlay#2}}%
\dimen0=\wd0 \advance\dimen0 by -\overlaywidth
\dimen2=\ht0 \advance\dimen2 by -#4% not \overlayheight
\wd0=\overlaywidth
\ht0=\overlayheight
\dp0=\overlaydepth
- \setbox0=\hbox{\hskip-.5\dimen0\raise-.5\dimen2\box0}%
+ \setbox0=\hbox{\hskip-.5\dimen0\raise-.5\dimen2\box0}%
\wd0=\overlaywidth
\ht0=\overlayheight
\dp0=\overlaydepth
\box0
\egroup}
-%D The empty case is:
+%D The empty case is:
\def\executeoverlay#1#2#3#4#5#6#7%
{}
-%D For testing we provide:
+%D For testing we provide:
\def\doifoverlayelse#1%
{\doifdefinedelse{\??ov#1}}
-%D We predefine two already familiar backgrounds:
+%D We predefine two already familiar backgrounds:
\setvalue{\??ov\v!raster}#1#2#3#4#5#6#7%
{\graybox\width#1\height#2\depth#3\raster#5\corner#6\radius#7\\}
@@ -361,18 +363,18 @@
%D After all these preparations, the background macro does no
%D bring to many surprises. One has to keep in mind that this
-%D macro starts up a call chain, depending on the background
-%D one needs:
-%D
+%D macro starts up a call chain, depending on the background
+%D one needs:
+%D
%D \startopsomming[opelkaar]
%D \som a raster, color or user defined shape
%D \som square or round corners
%D \som a \TEX\ or driver based method
%D \stopopsomming
-%D
-%D The macro can be extended by adding commands to the token
-%D list register \type {\everybackgroundbox}. For this
-%D purpose, the name of the current background is available in
+%D
+%D The macro can be extended by adding commands to the token
+%D list register \type {\everybackgroundbox}. For this
+%D purpose, the name of the current background is available in
%D \type {\currentbackgound}.
\newbox\extraframebox
@@ -390,7 +392,7 @@
{\dimen2}{\dimen4}{\dimen6}{#3}{#4}{#5}{#6}}%
\setbox\extraframebox=\hbox
{\vbox{\moveleft\dimen0\box\extraframebox}}%
- \wd\extraframebox=\!!zeropoint % \backgroundwidth
+ \wd\extraframebox=\zeropoint % \backgroundwidth
\ht\extraframebox=\backgroundheight
\dp\extraframebox=\backgrounddepth
\box\extraframebox % \hskip-\backgroundwidth
@@ -404,11 +406,11 @@
\dimen2=\wd#1\advance\dimen2 by 2\dimen0
\dimen4=\ht#1\advance\dimen4 by \dimen0
\dimen6=\dp#1\advance\dimen6 by \dimen0\advance\dimen6 by #8\relax
- \edef\backgroundwidth {\the\wd#1}%
+ \edef\backgroundwidth {\the\wd#1}%
\edef\backgroundheight{\the\ht#1}%
- \edef\backgrounddepth {\the\dp#1}%
+ \edef\backgrounddepth {\the\dp#1}%
%\edef\foregroundbox{\box#1}%
- \def\foregroundbox% fuzzy but needed hack, this \vss, otherwise
+ \def\foregroundbox% fuzzy but needed hack, this \vss, otherwise
{\vbox to \backgroundheight{\vss\box#1\vss}}% vertical shift
\def\docommando##1%
{\dodobackgroundbox{##1}{#1}{#3}{#4}{#6}{#7}}%
@@ -416,19 +418,19 @@
{\expanded{\rawprocesscommalist[#2]\noexpand\docommando}%
\box#1\hss}}}
-%D One can explictly insert the foreground box. For that
-%D purpose we introduce the overlay \type {foreground}.
+%D One can explictly insert the foreground box. For that
+%D purpose we introduce the overlay \type {foreground}.
\defineoverlay[\v!voorgrond][\foregroundbox]
-%D We can specify overlays as a comma separated list of
+%D We can specify overlays as a comma separated list of
%D overlays, a sometimes handy feature.
%D Besides backgrounds (overlays) we also need some macros to
%D draw outlines (ruled borders). Again we have to deal with
%D square and round corners. The first category can be handled
%D by \TEX\ itself, the latter one depends on the driver. This
-%D macro also support a negative offset.
+%D macro also support a negative offset.
\def\dooutlinebox#1\color#2\offset#3\corner#4\radius#5\depth#6\toggle#7\\%
{\vbox % rules on top of box
@@ -436,10 +438,10 @@
\dimen2=\wd#1\advance\dimen2 by 2\dimen0
\dimen4=\ht#1\advance\dimen4 by \dimen0
\dimen6=\dp#1\advance\dimen6 by \dimen0\advance\dimen6 by #6\relax
- \ifdim\dimen6<\!!zeropoint
- \advance\dimen4 by \dimen6 \dimen8=-\dimen6 \dimen6=\!!zeropoint
+ \ifdim\dimen6<\zeropoint
+ \advance\dimen4 by \dimen6 \dimen8=-\dimen6 \dimen6=\zeropoint
\else
- \dimen8=\!!zeropoint
+ \dimen8=\zeropoint
\fi
\setbox\extraframebox=\hbox
{\dostrokedbox\width\dimen2\height\dimen4\depth\dimen6%
@@ -471,7 +473,7 @@
%D The toggle argument in these calls concern the individual
%D rules: left, right, top and bottom. Each can be turned on,
%D depending on the general state (\type{#4}) or the individual
-%D ones (\type{#5}, \type{#6}, \type{#7} and \type{#8}).
+%D ones (\type{#5}, \type{#6}, \type{#7} and \type{#8}).
\def\dostrokedlinedbox\width#1\height#2\depth#3\toggle
#4\left#5\right#6\top#7\bottom#8\\%
@@ -505,12 +507,12 @@
%D I condidered using the low level support command
%D \type{\ruledhbox}, but this would slow down processing by a
-%D factor~3.
+%D factor~3.
%D Before we come to using these macros we yet have to define
-%D the rounded corner alternative, which after all is not that
-%D hard because it uses the previously defined macro \type
-%D {\ovalbox}.
+%D the rounded corner alternative, which after all is not that
+%D hard because it uses the previously defined macro \type
+%D {\ovalbox}.
\def\dostrokedroundbox\width#1\height#2\depth#3\radius#4\toggle#5\left#6\\%
{\doif{#5}{\v!aan}{\ovalbox{#1}{#2}{#3}{\linewidth}{#4}{\v!aan}{\v!uit}}}
@@ -543,11 +545,11 @@
%D \macros
%D {framed, setupframed}
-%D
+%D
%D Ruled boxes are typeset using \type{\framed}. This command
%D is quite versatile and, although some users will probably
-%D seldom use it, one cannot overlook its features.
-%D
+%D seldom use it, one cannot overlook its features.
+%D
%D \showsetup{\y!setupframed}
%D \showsetup{\y!framed}
%D
@@ -587,17 +589,17 @@
%D \macros
%D {ifinframed}
-%D
+%D
%D The normal case first presets all parameters and next starts
%D looking for the user supplied ones. The first step is
%D omitted in the local case, because these are preset at
%D declaration time and keep their values unless explictly
%D changed. By presetting the variables everytime the normal
%D command is called, we can use this command nested, without
-%D the unwanted side effect of inheritance. The boolean is
+%D the unwanted side effect of inheritance. The boolean is
%D used to speed up the color stack.
-\newif\ifinframed
+\newif\ifinframed
\def\localframed%
{\bgroup
@@ -609,30 +611,30 @@
%D collected in a horizontal or vertical box with fixed or free
%D dimensions and specific settings concerning aligment and
%D offsets.
-%D
+%D
%D In the first few lines, we pre||expand the frame and
%D background offsets. We do so, because the can be defined in
%D terms of the main offset. However, see for instance page
%D backgrounds, when \type {#2} sets the offset to \type
-%D {overlay}, both offsets become invalid.
+%D {overlay}, both offsets become invalid.
\def\startlocalframed[#1][#2]%
{\bgroup
- \inframedtrue
- \edef\@@framed{#1}%
- % this piece of pre expansion is needed
- \scratchdimen\getvalue{\@@framed\c!kaderoffset}%
- \setevalue{\@@framed\c!kaderoffset}{\the\scratchdimen}%
- \doifnotvalue{\@@framed\c!achtergrondoffset}{\v!kader}
- {\scratchdimen\getvalue{\@@framed\c!achtergrondoffset}%
- \setevalue{\@@framed\c!achtergrondoffset}{\the\scratchdimen}}%
+ \inframedtrue
+ \edef\@@framed{#1}%
+ % this piece of pre expansion is needed
+ \scratchdimen\getvalue{\@@framed\c!kaderoffset}%
+ \setevalue{\@@framed\c!kaderoffset}{\the\scratchdimen}%
+ \doifnotvalue{\@@framed\c!achtergrondoffset}{\v!kader}
+ {\scratchdimen\getvalue{\@@framed\c!achtergrondoffset}%
+ \setevalue{\@@framed\c!achtergrondoffset}{\the\scratchdimen}}%
% we need to register the (outer) color
\startregistercolor[\getvalue{\@@framed\c!voorgrondkleur}]%
- % to prevent deadlock in case of self refering
- \ifsecondargument % faster
- \getparameters[\@@framed][#2]% here !
+ % to prevent deadlock in case of self refering
+ \ifsecondargument % faster
+ \getparameters[\@@framed][#2]% here !
\fi
- % beware, both the frame and background offset can be overruled
+ % beware, both the frame and background offset can be overruled
\edef\localoffset{\getvalue{\@@framed\c!offset}}%
\edef\localwidth{\getvalue{\@@framed\c!breedte}}%
\edef\localheight{\getvalue{\@@framed\c!hoogte}}%
@@ -657,7 +659,7 @@
\boxhasoffsetfalse
\boxhasstrutfalse
\boxisoverlaidtrue
- \@@localoffset=\!!zeropoint
+ \@@localoffset=\zeropoint
\else
\boxhasoffsettrue
\boxhasstruttrue
@@ -694,13 +696,13 @@
\!!heighta=\localheight
\fi\fi
\ifdim\!!widtha=\hsize
- \parindent=\!!zeropoint
+ \parindent=\zeropoint
\setlocalhsize
\!!widtha=\localhsize
\fi
- \advance\!!widtha by -2\@@localoffset
- \advance\!!heighta by -2\@@localoffset
- \ifx\localstrut\v!nee
+ \advance\!!widtha -2\@@localoffset
+ \advance\!!heighta -2\@@localoffset
+ \ifx\localstrut\v!nee
\boxhasstrutfalse
\fi
\ifboxhasstrut
@@ -712,8 +714,8 @@
\let\localbegstrut=\pseudobegstrut % was: \relax
\let\localendstrut=\pseudoendstrut % was: \relax
\let\localstrut =\pseudostrut % was: \relax
- %\ifboxhasheight\ifdim\!!heighta<\ht\strutbox % saveguard
- % \let\localbegstrut=\relax % but not that
+ %\ifboxhasheight\ifdim\!!heighta<\ht\strutbox % saveguard
+ % \let\localbegstrut=\relax % but not that
% \let\localstrut =\relax % save afterall
%\fi\fi
\fi
@@ -754,24 +756,24 @@
\def\dowithframedbox%
{\let\postprocessframebox\undefined %new
\aftergroup\stoplocalframed}%
- \edef\framedwidth % a new feature
- {\ifdim\!!widtha >\!!zeropoint\the\!!widtha \else\!!zeropoint\fi}%
- \edef\framedheight% a new feature
- {\ifdim\!!heighta>\!!zeropoint\the\!!heighta\else\!!zeropoint\fi}%
+ \edef\framedwidth % a new feature
+ {\ifdim\!!widtha >\zeropoint\the\!!widtha \else\zeropoint\fi}%
+ \edef\framedheight% a new feature
+ {\ifdim\!!heighta>\zeropoint\the\!!heighta\else\zeropoint\fi}%
\afterassignment\dowithframedbox
\setbox\framebox=\next}
\let\afterframedbox \relax
\let\beforeframedbox\relax
-
+
%D Carefull analysis of this macro will learn us that not all
%D branches in the last conditionals can be encountered, that
%D is, some assignments to \type{\next} will never occur.
%D Nevertheless we implement the whole scheme, if not for
-%D future extensions.
+%D future extensions.
%D \macros
-%D {ifreshapeframebox}
+%D {ifreshapeframebox}
%D
%D The last few lines tell what to do after the content of the
%D box is collected and passed to the next macro. In the case
@@ -784,11 +786,17 @@
\def\stoplocalframed%
{\dontshowcomposition
\ifboxhasformat
- \doifelse{\localwidth}{\v!passend}
- {\ifreshapeframebox\doreshapeframedbox\fi
- \boxhaswidthfalse}%
- {\resetshapeframebox}%
- \else
+% \doifelse{\localwidth}{\v!passend}
+% {\ifreshapeframebox\doreshapeframedbox\fi
+% \boxhaswidthfalse}%
+% {\resetshapeframebox}%
+ \ifx\localwidth\v!passend
+ \ifreshapeframebox\doreshapeframedbox\fi
+ \boxhaswidthfalse
+ \else
+ \resetshapeframebox
+ \fi
+ \else
\resetshapeframebox
\fi
\ifboxhaswidth
@@ -814,7 +822,7 @@
\fi
\edef\overlaylinecolor{\getvalue{\@@framed\c!kaderkleur}}%
\edef\overlaylinewidth{\the\linewidth}%
- \doifnotvalue{\@@framed\c!kader}{\v!overlay} % faster -)
+ \doifnotvalue{\@@framed\c!kader}{\v!overlay} % faster -)
{\doframedbox}%
\doifvaluesomething{\@@framed\c!achtergrond}
{\dobackedbox}%
@@ -828,7 +836,7 @@
%D The last conditional takes care of the special situation of
%D in||line \inframed[hoogte=3cm]{framed} boxes. Such boxes have
-%D to be \inframed{aligned} with the running text.
+%D to be \inframed{aligned} with the running text.
\def\doinframed[#1]% we could omit #1] but readibility ...
{\framed[\c!plaats=\v!laag,#1]}
@@ -836,11 +844,11 @@
\unexpanded\def\inframed%
{\dosingleempty\doinframed}
-%D When we set \type{\c!leeg} to \type{\v!ja}, we get
-%D ourselves a frame and/or background, but no content, so
-%D actually we have a sort of phantom framed box.
+%D When we set \type{\c!leeg} to \type{\v!ja}, we get
+%D ourselves a frame and/or background, but no content, so
+%D actually we have a sort of phantom framed box.
-%D Because color marks and specials can interfere with
+%D Because color marks and specials can interfere with
%D spacing, we provide a way to specify a foregroundcolor.
\def\docolorframebox%
@@ -856,7 +864,7 @@
%D
%D When Tobias asked how to frame mathematical elements in
%D formulas, Taco's posted the next macro:
-%D
+%D
%D \starttypen
%D \def\mframed#1%
%D {\relax
@@ -866,15 +874,15 @@
%D \framed{$#1$}%
%D \fi}
%D \stoptypen
-%D
+%D
%D Because \type {\ifinner} does not (always) reports what
%D one would expect, we move the test to the outer level. We
%D also want to pass arguments,
-%D
+%D
%D \starttypen
%D \def\mframed%
%D {\dosingleempty\domframed}
-%D
+%D
%D \def\domframed[#1]#2% % tzt \dowithnextmathbox ?
%D {\relax
%D \ifmmode
@@ -887,13 +895,13 @@
%D \inframed[#1]{$#2$}%
%D \fi}
%D \stoptypen
-%D
+%D
%D Still better is the next alternative, if only because it
%D takes care of setting the super- and subscripts styles
\ifx\restoremathstyle\undefined \let\restoremathstyle\relax \fi
-%\def\domframed[#1][#2]#3%
+%\def\domframed[#1][#2]#3%
% {\begingroup
% \ifmmode
% \ifinner
@@ -917,7 +925,7 @@
% \fi
% \endgroup}
-\def\domframed[#1][#2]#3%
+\def\domframed[#1][#2]#3%
{\begingroup
\ifmmode
\ifinner
@@ -948,71 +956,71 @@
%D So instead of the rather versatile \type {\framed}, we ue
%D the \type {\mframed}.
-%D
+%D
%D \startbuffer
%D \startformule
%D x \times \mframed{y} \times y^{z_z}
%D x \times \inmframed{y} \times y^{z_z}
%D \stopformule
%D \stopbuffer
-%D
+%D
%D \typebuffer
-%D
+%D
%D \haalbuffer
-%D
+%D
%D However, we got into troubles when we want to nest sub- and
%D superscripts, like in
-%D
+%D
%D \startbuffer
%D \startformule
%D x \times \mframed{y} \times y^{\mframed{z}_{\mframed{z}}}
%D \stopformule
%D \stopbuffer
-%D
+%D
%D \typebuffer
-%D
+%D
%D \haalbuffer
-%D
+%D
%D Therefore, we can best use \type {\super} and \type {\suber}
%D instead of \type {^} and \type {_}. Both commands take care
%D of proper font switching.
-%D
+%D
%D \startbuffer
%D \startformule
%D x \times \mframed{y} \times y\super{\mframed{z}\suber{\mframed{z}}}
%D \stopformule
%D \stopbuffer
-%D
+%D
%D \typebuffer
-%D
+%D
%D \haalbuffer
-%D
+%D
%D As usual, one can specify in what way the text should be
%D framed. One should be aware of the fact that, inorder to
%D preserve the proper spacing, the \type {offset} is set to
-%D \type {overlay} and \type {frameoffset} is used used
+%D \type {overlay} and \type {frameoffset} is used used
%D instead.
-%D
+%D
%D \startbuffer
%D \startformule
%D x \times y\super{\mframed[kaderkleur=rood]{z}\suber{z}}
%D \stopformule
%D \stopbuffer
-%D
+%D
%D \typebuffer
-%D
+%D
%D \haalbuffer
-%D
+%D
%D For inline use, we also provide the \type {\inmframed}
-%D alternative: we want $x \times \inmframed{y}$ in inline
+%D alternative: we want $x \times \inmframed{y}$ in inline
%D math, right?
%D This previous framing macros needs a lot of alternatives for
%D putting rules around boxes, inserting offsets and aligning
%D text. Each step is handled by separate macros.
-\def\dowidenframebox#1%
- {\setbox\framebox=\vbox
+\def\dowidenframebox#1%
+ {\setbox\framebox=\vbox
{\kern#1\hbox{\kern#1\box\framebox\kern#1}\kern#1}}
\def\dooffsetframebox{\dowidenframebox\localoffset}
@@ -1103,7 +1111,7 @@
%D have to take care of additional offsets.
\def\dobackedbox%
- {\doifelsevalue{\@@framed\c!achtergrondoffset}{\v!kader} % new
+ {\doifelsevalue{\@@framed\c!achtergrondoffset}{\v!kader} % new
{\dodobackedbox\c!kaderoffset}
{\dodobackedbox\c!achtergrondoffset}}
@@ -1264,31 +1272,31 @@
%D \egroup
%D \stopuitstellen
-%D \macros
+%D \macros
%D {framednoflines, framedlastlength}
%D
%D It is possible to let the frame macro calculate the width
%D of a centered box automatically (\type{\v!passend}). When
%D doing so, we need to reshape the box:
-\newcount\framednoflines
-\newdimen\framedlastlength
+\newcount\framednoflines
+\newdimen\framedlastlength
\def\resetshapeframebox%
{\framednoflines=0
- \framedlastlength=\!!zeropoint}
+ \framedlastlength=\zeropoint}
% \def\doreshapeframedbox%
% {\beginofshapebox
% \unvcopy\framebox
% \endofshapebox
-% \global\@@globalwidth=\!!zeropoint
+% \global\@@globalwidth=\zeropoint
% \resetshapeframebox
% \reshapebox
% {\setbox0=\hbox
% {\strut\ifhbox\shapebox\unhbox\else\box\fi\shapebox}%
% \global\advance\framednoflines by 1
-% \ifdim\framedlastlength>\!!zeropoint\else
+% \ifdim\framedlastlength>\zeropoint\else
% \global\framedlastlength=\wd0
% \fi
% \ifdim\wd0>\@@globalwidth
@@ -1310,23 +1318,23 @@
% \innerflushshapebox}%
% \dp\framebox=\dp\strutbox
% \fi
-% \ifdim\framedlastlength=\!!zeropoint\global\framednoflines=\wd\framebox\fi
+% \ifdim\framedlastlength=\zeropoint\global\framednoflines=\wd\framebox\fi
% \ifcase\framednoflines\global\framednoflines=1\fi}
% better depth preserving, else problems with framed display
-% math and auto width
+% math and auto width
\def\doreshapeframedbox%
{\beginofshapebox
\unvcopy\framebox
\endofshapebox
- \global\@@globalwidth=\!!zeropoint
+ \global\@@globalwidth=\zeropoint
\resetshapeframebox
\reshapebox
{\setbox0=\hbox
{\strut\ifhbox\shapebox\unhbox\else\box\fi\shapebox}%
\global\advance\framednoflines by 1
- \ifdim\framedlastlength>\!!zeropoint\else
+ \ifdim\framedlastlength>\zeropoint\else
\global\framedlastlength=\wd0
\fi
\ifdim\wd0>\@@globalwidth
@@ -1347,14 +1355,14 @@
{\hsize\@@globalwidth
\reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}%
\innerflushshapebox}%
- \dp\framebox=\scratchdimen % \dp\strutbox otherwise problem with math
+ \dp\framebox=\scratchdimen % \dp\strutbox otherwise problem with math
\fi
- \ifdim\framedlastlength=\!!zeropoint\global\framednoflines=\wd\framebox\fi
+ \ifdim\framedlastlength=\zeropoint\global\framednoflines=\wd\framebox\fi
\ifcase\framednoflines\global\framednoflines=1\fi}
-%D The two variables \type {\framednoflines} and \type
-%D {\framedlastlength} can be used in a second pass to
-%D optimized framed material.
+%D The two variables \type {\framednoflines} and \type
+%D {\framedlastlength} can be used in a second pass to
+%D optimized framed material.
%D The examples on the next page show how one can give the
%D frame as well as the background an additional offset and
@@ -1428,8 +1436,8 @@
\dp\framebox\dp\strutbox
\box\framebox}
-%D We can also lower the box over the natural depth of the
-%D line.
+%D We can also lower the box over the natural depth of the
+%D line.
\def\doloweredframedbox%
{\getboxheight\dimen2\of\box\framebox
@@ -1460,15 +1468,15 @@
\def\vboxedhairline%
{\bgroup
- \dimen2=\ifboxhasoffset \localoffset \else \!!zeropoint \fi
+ \dimen2=\ifboxhasoffset \localoffset \else \zeropoint \fi
\dimen4=\dimen2
\advance\dimen4 by \linewidth
\setbox0=\vbox
{\advance\hsize by 2\dimen4
\vskip\dimen2
- \hrule
- \!!height\linewidth
- \!!depth\!!zeropoint
+ \hrule
+ \!!height\linewidth
+ \!!depth\zeropoint
\!!width\hsize
\vskip\dimen2}%
\endgraf\nointerlineskip\endgraf
@@ -1479,7 +1487,7 @@
\def\hboxedhairline%
{\bgroup
- \dimen2=\ifboxhasoffset \localoffset \else \!!zeropoint \fi
+ \dimen2=\ifboxhasoffset \localoffset \else \zeropoint \fi
\ifboxhasheight
\dimen4=\localheight \divide\dimen4 by 2
\dimen6=\dimen4
@@ -1496,7 +1504,7 @@
\unskip
\setbox0=\hbox
{\hskip\dimen2
- \vrule
+ \vrule
\!!height\dimen4
\!!depth\dimen6
\!!width\linewidth
@@ -1520,8 +1528,8 @@
%D We can set each rule on or off. The default setting is
%D inherited from \type{\c!kader}. An earlier implementation
%D use a bit different approach, but the new one seems more
-%D natural:
-%D
+%D natural:
+%D
%D \bgroup
%D \steltypenin[marge=0pt]
%D \startregelcorrectie
@@ -1529,27 +1537,27 @@
%D \omlijnd[offset=overlay,kader=aan] {\DemoRed\blokje}
%D \stopbuffer
%D \hbox{\haalbuffer\vbox{\typebuffer}}
-%D
+%D
%D \startbuffer
%D \omlijnd[offset=overlay,kader=aan,onderkader=uit]{\DemoRed\blokje}
%D \stopbuffer
%D \hbox{\haalbuffer\vbox{\typebuffer}}
-%D
+%D
%D \startbuffer
%D \omlijnd[offset=overlay,kader=aan,onderkader=aan]{\DemoRed\blokje}
%D \stopbuffer
%D \hbox{\haalbuffer\vbox{\typebuffer}}
-%D
+%D
%D \startbuffer
%D \omlijnd[offset=overlay,kader=uit] {\DemoRed\blokje}
%D \stopbuffer
%D \hbox{\haalbuffer\vbox{\typebuffer}}
-%D
+%D
%D \startbuffer
%D \omlijnd[offset=overlay,kader=uit,onderkader=uit]{\DemoRed\blokje}
%D \stopbuffer
%D \hbox{\haalbuffer\vbox{\typebuffer}}
-%D
+%D
%D \startbuffer
%D \omlijnd[offset=overlay,kader=uit,onderkader=aan]{\DemoRed\blokje}
%D \stopbuffer
@@ -1635,7 +1643,7 @@
\doif{\@@bjvariant}{\c!b}
{\scratchcounter=\@@bjn
\ifnum\scratchcounter=1
- \!!widthb=\!!zeropoint
+ \!!widthb=\zeropoint
\else
\advance\scratchcounter by -1
\advance\!!widtha by -\scratchcounter\!!widthb
@@ -1655,7 +1663,7 @@
%D The next commands can be used to draw margin rules. We
%D support two methods: \marginrule{one for in||line use} and
-%D one that acts on a paragraph. Drawing a margin rule is
+%D one that acts on a paragraph. Drawing a margin rule is
%D rather straightforward because we can use the commands that
%D put text in the margin.
@@ -1758,8 +1766,8 @@
%D \stopkantlijn
%D \stopbuffer
%D
-%D In next example we show most features. Watch the rule
-%D thickness adapting itself to the level.
+%D In next example we show most features. Watch the rule
+%D thickness adapting itself to the level.
%D
%D \startvoorbeeld
%D \haalbuffer
@@ -1788,9 +1796,9 @@
\dimen0=#1\ht\strutbox
\dimen2=#1\dp\strutbox
\setbox0=\hbox
- {\vrule
- \!!width\linewidth
- \!!height\dimen0
+ {\vrule
+ \!!width\linewidth
+ \!!height\dimen0
\!!depth\dimen2}%
\dp0=\dp\strutbox
\ht0=\ht\strutbox
@@ -1800,9 +1808,9 @@
\def\complexhl[#1]%
{\hbox
{\vrule
- \!!width#1em
- \!!height\linewidth
- \!!depth\!!zeropoint}}
+ \!!width#1em
+ \!!height\linewidth
+ \!!depth\zeropoint}}
\def\simplevl%
{\complexvl[1]}
@@ -1859,11 +1867,39 @@
%D
%D which looks like: \thinrules[n=2]
+% \def\thinrule%
+% {\strut
+% \leaders
+% \hrule\!!height.5\linewidth\!!depth.5\linewidth
+% \hfill
+% \strut}
+
\def\thinrule%
{\strut
+ \bgroup
+ \startcolor[\@@dlkleur]%
+ \doif{\@@dlhoogte}{\v!max}{\def\@@dlhoogte{1}}%
+ \doif{\@@dldiepte}{\v!max}{\def\@@dldiepte{1}}%
+ \freezedimensionwithunit\@@dlhoogte{\ht\strutbox}%
+ \freezedimensionwithunit\@@dldiepte{\dp\strutbox}%
\leaders
- \hrule\!!height.5\linewidth\!!depth.5\linewidth
+ \hrule\!!height\@@dlhoogte\!!depth\@@dldiepte
\hfill
+ \stopcolor
+ \donefalse
+ \processaction
+ [\@@dlvariant]
+ [\v!a=>,
+ \v!b=>\dimen0=.5\linewidth\dimen2=\dimen0\donetrue,
+ \v!c=>\dimen2=\@@dldiepte\dimen0=-\dimen2\donetrue
+ \advance\dimen0\linewidth]%
+ \ifdone
+ \hfillneg
+ \leaders
+ \hrule\!!height\dimen0\!!depth\dimen2
+ \hfill
+ \fi
+ \egroup
\strut}
\def\hairline%
@@ -1877,6 +1913,21 @@
\def\setupthinrules%
{\dosingleargument\dosetupthinrules}
+% \def\dothinrules[#1]%
+% {\bgroup
+% \dosetupthinrules[#1]%
+% \@@dlvoor
+% \assignvalue{\@@dlinterlinie}{\@@dlinterlinie}{1.0}{1.5}{2.0}%
+% \spacing\@@dlinterlinie
+% \dorecurse
+% {\@@dln}
+% {\ifnum\recurselevel=\@@dln \dothinrulesnobreak \else
+% \ifnum\recurselevel=2 \dothinrulesnobreak \fi\fi
+% \thinrule
+% \ifnum\recurselevel<\@@dln \endgraf \fi}%
+% \@@dlna
+% \egroup}
+
\def\dothinrules[#1]%
{\bgroup
\dosetupthinrules[#1]%
@@ -1887,24 +1938,44 @@
{\@@dln}
{\ifnum\recurselevel=\@@dln \dothinrulesnobreak \else
\ifnum\recurselevel=2 \dothinrulesnobreak \fi\fi
- \thinrule
- \ifnum\recurselevel<\@@dln \endgraf \fi}%
+ \thinrule
+ %\ifnum\recurselevel<\@@dln \endgraf \fi}%
+ \ifnum\recurselevel<\@@dln \endgraf \geenwitruimte \@@dltussen \fi}%
\@@dlna
\egroup}
\def\thinrules%
{\dosingleempty\dothinrules}
+%D A couple of examples are given below.
+%D
+%D \startbuffer
+%D \steldunnelijnenin[n=3,tussen=,kleur=grijs]
+%D
+%D test test \dunnelijnen\ test test \par
+%D test test \dunnelijnen [kleur=groen] test test \par
+%D test test \dunnelijnen [hoogte=max, diepte=max] test test \par
+%D
+%D \steldunnelijnenin[hoogte=.9,diepte=.9]
+%D
+%D test test \dunnelijnen\ test test \par
+%D test test \dunnelijnen [variant=b] test test \par
+%D test test \dunnelijnen [variant=c] test test \par
+%D test test \dunnelijnen [variant=c,tussen=\vskip2ex] test test \par
+%D \stopbuffer
+%D
+%D \typebuffer {\haalbuffer}
+
%D \macros
%D {optimizethinrules}
%D
-%D By saying \type {\thinrulestrue} or \type {-false}, we
-%D can influence the way dangling lines are handled.
+%D By saying \type {\thinrulestrue} or \type {-false}, we
+%D can influence the way dangling lines are handled.
-\newif\ifoptimizethinrules \optimizethinrulestrue
+\newif\ifoptimizethinrules \optimizethinrulestrue
\def\dothinrulesnobreak%
- {\ifoptimizethinrules\penalty500\fi}
+ {\ifoptimizethinrules\penalty500\fi}
%D \macros
%D {startframedtext, setupframedtexts, defineframedtext}
@@ -2018,12 +2089,12 @@
\c!achtergrond=,
\c!achtergrondkleur=,
\c!achtergrondraster=\@@rsraster,
- \c!regelcorrectie=\v!aan,
- \c!dieptecorrectie=\v!aan,
+ \c!regelcorrectie=\v!aan,
+ \c!dieptecorrectie=\v!aan,
\c!marge=\v!standaard,
#2]%
\setvalue{\e!start#1}{\dostartframedtext[#1]}%
- \setvalue{\e!stop#1}{\dostopframedtext[#1]}
+ \setvalue{\e!stop#1}{\dostopframedtext}%
\setvalue{#1}{\doframedtext[#1]}}
\def\defineframedtext%
@@ -2039,7 +2110,8 @@
\def\dosetupframedtexts[#1][#2]%
{\ifsecondargument
- \getparameters[\??kd#1][#2]%
+ \def\docommando##1{\getparameters[\??kd##1][#2]}%
+ \processcommalist[#1]\docommando % new
\else
\getparameters[\??kd\v!framedtext][#1]%
\fi}
@@ -2055,42 +2127,82 @@
{\dododostartframedtext[#1][][#2]}
{\dododostartframedtext[#1][#2][#3]}}
+% \def\dododostartframedtext[#1][#2][#3]%
+% {\processaction
+% [#2]
+% [ \v!links=>\letvalue{\??kd#1\c!links }=\relax
+% \letvalue{\??kd#1\c!rechts}=\hfill,
+% \v!rechts=>\letvalue{\??kd#1\c!links }=\hfill
+% \letvalue{\??kd#1\c!rechts}=\relax,
+% \v!midden=>\letvalue{\??kd#1\c!links }=\hfill
+% \letvalue{\??kd#1\c!rechts}=\hfill,
+% \v!geen=>\letvalue{\??kd#1\c!links }=\relax % new
+% \letvalue{\??kd#1\c!rechts}=\relax]% new
+% \forgetparindent
+% \setbox\framebox=\vbox
+% \bgroup
+% % \insidefloattrue % ?
+% \expanded{\switchtobodyfont[\getvalue{\??kd#1\c!korps}]}%
+% \localframed[\??kd#1][\c!strut=\v!nee,#3]%
+% \bgroup
+% \blanko[\v!blokkeer]%
+% \let\\=\endgraf
+% \getvalue{\??kd#1\c!binnen}%
+% \dostartattributes{\??kd#1}\c!letter\c!kleur{}%
+% \def\dostopframedtext{\dodostopframedtext{#1}{#2}}}
+
+\ifx\checkframedtext\undefined \let\checkframedtext\relax \fi
+
\def\dododostartframedtext[#1][#2][#3]%
{\processaction
- [#2]
+ [#2]
[ \v!links=>\letvalue{\??kd#1\c!links }=\relax
\letvalue{\??kd#1\c!rechts}=\hfill,
\v!rechts=>\letvalue{\??kd#1\c!links }=\hfill
\letvalue{\??kd#1\c!rechts}=\relax,
\v!midden=>\letvalue{\??kd#1\c!links }=\hfill
- \letvalue{\??kd#1\c!rechts}=\hfill]%
- \forgetparindent
+ \letvalue{\??kd#1\c!rechts}=\hfill,
+ \v!geen=>\letvalue{\??kd#1\c!links }=\relax % new
+ \letvalue{\??kd#1\c!rechts}=\relax]% new
+ % removed 06/2001
+ % \forgetparindent
+ % added 06/2001 [see demo-bbv]
+ \localhsize\hsize \checkframedtext
+ % so far
\setbox\framebox=\vbox
\bgroup
+ \hsize\localhsize
+ % \insidefloattrue % ?
\expanded{\switchtobodyfont[\getvalue{\??kd#1\c!korps}]}%
\localframed[\??kd#1][\c!strut=\v!nee,#3]%
\bgroup
\blanko[\v!blokkeer]%
\let\\=\endgraf
\getvalue{\??kd#1\c!binnen}%
- \dostartattributes{\??kd#1}\c!letter\c!kleur{}}
+ \dostartattributes{\??kd#1}\c!letter\c!kleur{}%
+ \def\dostopframedtext{\dodostopframedtext{#1}{#2}}}
+
+%D The \type {none} option is handy for nested usage, as
+%D in the presentation styles, where we don't want
+%D interference.
-\def\dostopframedtext[#1]%
+\def\dodostopframedtext#1#2%
{\endgraf
\removelastskip
\dostopattributes
- \doifvalue{\??kd#1\c!dieptecorrectie}{\v!aan}{\baselinecorrection} % new, inside box
+ \doifvalue{\??kd#1\c!dieptecorrectie}{\v!aan} % new, inside box
+ {\baselinecorrection}%
\egroup
\egroup
+ \doif{#2}{\v!geen}{\insidefloattrue}% new
\ifinsidefloat
\box\framebox
\else
- %\doplaats[\??kd#1][\c!regelcorrectie=\v!aan]{\box\framebox}%
\doplaats[\??kd#1][]{\box\framebox}%
\fi
\egroup}
-%D The simple brace (or group) delimited case is typeset
+%D The simple brace (or group) delimited case is typeset
%D slightly different and is not aligned.
\def\doframedtext%
@@ -2117,7 +2229,7 @@
%D \macros
%D {defineframed}
%D
-%D One can also define simple framed texts, using:
+%D One can also define simple framed texts, using:
%D
%D \showsetup{\y!defineframed}
@@ -2137,38 +2249,38 @@
%D
%D Putting rules before and after a paragraph is very space
%D sensitive, but the next command handles that quite well. It
-%D comes in to disguises:
+%D comes in to disguises:
%D
%D \startbuffer
%D \textrule[boven]{fragments}
%D \input reich
%D \textrule
%D \stopbuffer
-%D
+%D
%D \bgroup \typebuffer \haalbuffer \egroup
-%D
+%D
%D \startbuffer
%D \setuptextrules
%D [breedte=90pt,afstand=12pt,lijnkleur=blauw,
%D korps=klein,letter=\sc,kleur=rood]
-%D
+%D
%D \starttextrule{Ship Building Tools}
%D \nl \steltolerantiein[soepel] \input materie
%D \stoptextrule
%D \stopbuffer
-%D
+%D
%D \bgroup \typebuffer \haalbuffer \egroup
-%D
+%D
%D \startbuffer
%D \setuptextrules
%D [plaats=inmarge,
%D korps=klein,letter=schuinvet]
-%D
+%D
%D \starttextrule{wonderful}
-%D \input tufte
+%D \input tufte
%D \stoptextrule
%D \stopbuffer
-%D
+%D
%D \bgroup \typebuffer \haalbuffer \egroup
%D
%D The formal definition of these commands is:
@@ -2176,9 +2288,9 @@
%D \showsetup{\y!textrule}
%D \showsetup{\y!starttextrule}
%D \showsetup{\y!setuptextrules}
-%D
-%D The implementation looks a bit complicated due to the
-%D optional arguments.
+%D
+%D The implementation looks a bit complicated due to the
+%D optional arguments.
\def\setuptextrules%
{\dodoubleargument\getparameters[\??tl]}
@@ -2201,7 +2313,7 @@
{\bgroup
\advance\hsize by -\rightskip
\advance\hsize by -\leftskip
- \setbox\scratchbox=\hbox to \hsize
+ \setbox\scratchbox=\hbox to \hsize
{\dimen4=.5ex
\dimen6=-.5ex
\advance\dimen4 by .5\linewidth
@@ -2240,7 +2352,7 @@
\fi
\dimen0=\dp\strutbox
\ifdim\prevdepth<\dp\strutbox
- \ifdim\prevdepth>\!!zeropoint
+ \ifdim\prevdepth>\zeropoint
\advance\dimen0 by -\prevdepth
\fi
\fi
@@ -2251,13 +2363,13 @@
{\bgroup
\advance\hsize by -\rightskip
\advance\hsize by -\leftskip
- \nointerlineskip
+ \nointerlineskip
\moveleft-\leftskip\vbox
{\color[\@@tllijnkleur]
- {\hrule\!!depth\linewidth\!!height\!!zeropoint\!!width\hsize}}%
+ {\hrule\!!depth\linewidth\!!height\zeropoint\!!width\hsize}}%
\egroup}
- {\docomplextextrule{#2}}%
- \ifvmode\prevdepth\!!zeropoint\fi
+ {\docomplextextrule{#2}}%
+ \ifvmode\prevdepth\zeropoint\fi
#1%
\pagina[\v!voorkeur]}
@@ -2276,7 +2388,7 @@
\next}
%D The grouped commands also supports bodyfont switching:
-
+
\def\starttextrule#1%
{\bgroup
\def\dounknowntextrule{\domiddletextrule}
@@ -2297,19 +2409,19 @@
%D core module, because they deal with specific typography.
%D Nevertheless I decided to make them part of the core,
%D because they permit us to make questionaires. Let's start
-%D with some examples.
-%D
-%D \fillinrules[n=2,breedte=passend]{first}
-%D \fillinrules[n=2,breedte=ruim]{first}
-%D \fillinrules[n=2,breedte=3cm]{first}
-%D \fillinrules[n=2,breedte=3cm,afstand=.5em,scheider=:]{first}
-%D \fillinrules[n=2]{first}{last}
+%D with some examples.
+%D
+%D \fillinrules[n=2,breedte=passend]{first}
+%D \fillinrules[n=2,breedte=ruim]{first}
+%D \fillinrules[n=2,breedte=3cm]{first}
+%D \fillinrules[n=2,breedte=3cm,afstand=.5em,scheider=:]{first}
+%D \fillinrules[n=2]{first}{last}
%D \fillintext{first}{last} \input reich \par
-%D
-%D The main command is \type{\fillinrules}. This command takes
+%D
+%D The main command is \type{\fillinrules}. This command takes
%D one and an optional second argument and sets a paragraph with
-%D empty visualized lines.
-%D
+%D empty visualized lines.
+%D
%D \showsetup{\y!fillinrules}
%D \showsetup{\y!setupfillinrules}
@@ -2355,16 +2467,16 @@
%D \macros
%D {fillintext}
-%D
+%D
%D To provide compatible layouts when texts and lines are
-%D mixed, one can typeset a paragraph by using the command
-%D \type{\fillintext}.
-%D
+%D mixed, one can typeset a paragraph by using the command
+%D \type{\fillintext}.
+%D
%D \showsetup{\y!fillintext}
\definecomplexorsimpleempty\fillintext
-\def\complexfillintext[#1]% rather rough, using an \unhbox is suboptimal
+\def\complexfillintext[#1]% rather rough, using an \unhbox is suboptimal
{\def\docomplexfillintext##1##2%
{\dowithnextbox
{\dodocomplexfillinrules[#1]{##1}{\hfill##2}{\unhbox\nextbox\unskip}}%
@@ -2373,25 +2485,25 @@
%D \macros
%D {fillinline, setupfillinlines}
-%D
+%D
%D Another member of the family takes care of putting a (often
-%D small) rule after a piece of text, like
-%D
+%D small) rule after a piece of text, like
+%D
%D \startbuffer
%D \fillinline \input reich \par
%D \fillinline[marge=0cm] \input reich \par
%D \stopbuffer
-%D
+%D
%D \startvoorbeeld
%D \haalbuffer
%D \stopvoorbeeld
-%D
+%D
%D which was typeset by saying:
-%D
+%D
%D \typebuffer
-%D
+%D
%D The two commands that take care of this are:
-%D
+%D
%D \showsetup{\y!fillinline}
%D \showsetup{\y!setupfillinlines}
@@ -2401,12 +2513,12 @@
\definecomplexorsimpleempty\fillinline
\def\complexfillinline[#1]%
- {%\endgraf % interferes with \doordefinieren cum suis
+ {%\endgraf % interferes with \doordefinieren cum suis
\@@ivvoor
\begingroup
\setupfillinlines[#1]%
\advance\rightskip by \@@ivmarge
- \parfillskip\!!zeropoint
+ \parfillskip\zeropoint
\def\par%
{\unskip\hfill
\dimen0=\@@ivbreedte
@@ -2417,9 +2529,9 @@
\!!width\dimen0
\!!height.5\linewidth
\!!depth.5\linewidth}%
- \endgraf % !
+ \endgraf % !
\endgroup
- \endgraf % !
+ \endgraf % !
\@@ilna}}
%D \stopdocumentation
@@ -2489,7 +2601,7 @@
\newif\ifbackgroundsplit
-%D The \type{\vbox to \lineheight{}\vskip\!!zeropoint}
+%D The \type{\vbox to \lineheight{}\vskip\zeropoint}
%D construction gives the first real line a decent height by
%D adding a dummy line.
@@ -2497,7 +2609,7 @@
{\endgraf
\bgroup
\setbox0=\vbox\bgroup
- \vbox to \lineheight{}\vskip\!!zeropoint
+ \vbox to \lineheight{}\vskip\zeropoint
\blanko[\v!blokkeer]
\advance\hsize by -\@@aglinkeroffset
\advance\hsize by -\@@agrechteroffset}
@@ -2511,56 +2623,56 @@
{\endgraf
\removelastskip
\egroup
- \forgetall
+ \forgetall
\splitmaxdepth=\boxmaxdepth
\splittopskip=\topskip
- \setbox2=\vsplit0 to \lineheight % get rid of fake line
+ \setbox2=\vsplit0 to \lineheight % get rid of fake line
\loop
- \ifdim\pagetotal=\!!zeropoint % empty page
+ \ifdim\pagetotal=\zeropoint % empty page
\scratchdimen=\teksthoogte
- \chardef\backgroundsplit=1 % split to max height
+ \chardef\backgroundsplit=1 % split to max height
\else
\scratchdimen=\pagegoal
\setbox\scratchbox=\vbox{\@@agvoor}%
- \advance\scratchdimen -\ht\scratchbox
+ \advance\scratchdimen -\ht\scratchbox
\advance\scratchdimen -\pagetotal
- \chardef\backgroundsplit=2 % split to partial height
+ \chardef\backgroundsplit=2 % split to partial height
\fi
\advance\scratchdimen -\@@agbovenoffset
\advance\scratchdimen -\@@agonderoffset \relax
\ifdim\scratchdimen>2\lineheight\relax % reasonable, will be configurable
- \ifdim\ht0>\scratchdimen % larger than page
+ \ifdim\ht0>\scratchdimen % larger than page
\setbox2=\vsplit0 to \scratchdimen
\else
\setbox2=\box0
- \chardef\backgroundsplit=0 % no split
+ \chardef\backgroundsplit=0 % no split
\fi
- \setbox2=\vbox \ifcase\backgroundsplit\or to \teksthoogte \fi % max split
+ \setbox2=\vbox \ifcase\backgroundsplit\or to \teksthoogte \fi % max split
{\vskip\@@agbovenoffset
\popsplitcolor
\unvcopy2
\prevdepth\dp2
- \obeydepth
+ \obeydepth
\vskip\@@agonderoffset
- \vfill}
- \@@agvoor
- \ifcase\backgroundsplit\or\or % partial split
+ \vfill}
+ \@@agvoor
+ \ifcase\backgroundsplit\or\or % partial split
\pagegoal=1.2\pagegoal % be a bit more tolerant
- \fi
+ \fi
\startregelcorrectie
\localframed
[\??ag][\c!offset=\v!overlay]
{\hskip\@@aglinkeroffset\box2\hskip\@@agrechteroffset}%
\stopregelcorrectie
- \ifcase\backgroundsplit % no split
+ \ifcase\backgroundsplit % no split
\@@agna
- \else % some split
- \vfill\eject % geen \pagina !
+ \else % some split
+ \vfill\eject % geen \pagina !
\fi
- \else
+ \else
\pagina
\fi
- \ifdim\ht0>\!!zeropoint \repeat
+ \ifdim\ht0>\zeropoint \repeat
\egroup
\endgraf}
@@ -2576,7 +2688,7 @@
[\??ag][\c!offset=\v!overlay]
{\box\nextbox}%
\egroup}
- \vbox}
+ \vbox}
%D \stopdocumentation
%D \stopachtergrond
@@ -2584,8 +2696,8 @@
%D \macros
%D {copyright, registered}
-%D
-%D Some not so robust left||overs (borrowed from Knuth,
+%D
+%D Some not so robust left||overs (borrowed from Knuth,
%D \TEX Book\ page 356):
\def\omcirkeld#1%
@@ -2651,7 +2763,12 @@
[\c!interlinie=\v!klein,
\c!n=3,
\c!voor=,
- \c!na=]
+ \c!tussen={\blanko[\v!wit]},
+ \c!na=,
+ \c!kleur=,
+ \c!hoogte=.5\linewidth,
+ \c!diepte=.5\linewidth,
+ \c!variant=\v!a]
\setuptextrules
[\c!plaats=\v!links,
diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex
index d0be70d10..c2c43d8d6 100644
--- a/tex/context/base/core-sec.tex
+++ b/tex/context/base/core-sec.tex
@@ -304,6 +304,8 @@
% Omdat een markering kan worden herdefinieerd moeten we
% eerst testen of er wel een keten||afhankelijkheid is.
+% we het huidge (eigen) nummer kunnen ophalen
+
\def\resetsectionmarks[#1]%
{\doifdefinedelse{\??se#1}
{\def\donexttrackcommando##1%
@@ -340,8 +342,53 @@
\newif\ifalllevels
+% \def\dosetlevel#1% opvoeren met \ifcsname
+% {\bgroup
+% \doifelse{#1}{\v!vorige}
+% {\global\alllevelstrue
+% \global\let\currentlevel\empty
+% \def\dobacktrackcommando##1%
+% {\ifnum\countervalue{\??se##1}>0
+% \global\alllevelsfalse
+% \xdef\currentlevel{\getvalue{\previoussection{##1}\s!format}}%
+% \else
+% \dobacktracklevel{##1}%
+% \fi}%
+% \dobacktrackcommando\lastsection}
+% {\doifelse{\getvalue{\??by#1}}{\v!tekst}
+% {\global\alllevelstrue
+% \global\let\currentlevel\empty}
+% {\doifdefinedelse{\??ko#1\c!sectie} % beter alteratief: ook
+% {\edef\@@sectie{\getvalue{\??ko#1\c!sectie}}} % hoofdstuk\c!format
+% {\edef\@@sectie{#1}}%
+% \doifdefinedelse{\??se\@@sectie}
+% {\global\alllevelsfalse
+% \xdef\currentlevel{\getvalue{\@@sectie\s!format}}}
+% {\global\alllevelstrue
+% \global\let\currentlevel\empty
+% \def\dobacktrackcommando##1%
+% {\@EA\ifx\csname\??se##1\c!start\endcsname\relax
+% \dobacktracklevel{##1}%
+% \else
+% \ifnum\countervalue{\??se##1}>0
+% \global\alllevelsfalse
+% \xdef\currentlevel{\getvalue{##1\s!format}}%
+% \else
+% \dobacktracklevel{##1}%
+% \fi
+% \fi}%
+% \dobacktrackcommando\lastsection}}}%
+% \egroup}
+
+\let\currentlevel\empty
+
+\def\dontsetlevel#1%
+ {\let\currentlevel\somesavedlevel
+ \alllevelsfalse}
+
\def\dosetlevel#1% opvoeren met \ifcsname
- {\bgroup
+ {\let\dosetlevel\dontsetlevel % local lists will be real local
+ \bgroup
\doifelse{#1}{\v!vorige}
{\global\alllevelstrue
\global\let\currentlevel\empty
@@ -356,7 +403,7 @@
{\doifelse{\getvalue{\??by#1}}{\v!tekst}
{\global\alllevelstrue
\global\let\currentlevel\empty}
- {\doifdefinedelse{\??ko#1\c!sectie} % beter alteratief: ook
+ {\doifdefinedelse{\??ko#1\c!sectie} % beter alteratief: ook
{\edef\@@sectie{\getvalue{\??ko#1\c!sectie}}} % hoofdstuk\c!format
{\edef\@@sectie{#1}}%
\doifdefinedelse{\??se\@@sectie}
@@ -378,34 +425,107 @@
\dobacktrackcommando\lastsection}}}%
\egroup}
-\let\currentlevel\empty
+\def\dosettoclevel{\dosetlevel}
+\def\dosetreglevel{\dosetlevel}
+\def\dosetblklevel{\dosetlevel}
+
+% cleaner
+%
+% \def\doifnextlevelelse[#1::#2]#3#4%
+% {\ifalllevels
+% #3%
+% \else
+% \doifelse{\@@sectiontype}{#1}
+% {\doifinstringelse{=\currentlevel:}{=:#2:}
+% {\doifinstringelse{=\currentlevel:0}{=:#2:}{#4}{#3}}
+% {#4}}
+% {#4}%
+% \fi}
+%
+% \def\doifprevlevelelse[#1::#2]#3#4%
+% {\ifalllevels
+% #3%
+% \else
+% \doifelse{\@@sectiontype}{#1}
+% {\doifinstringelse{=\currentlevel:}{=:#2:}{#3}{#4}}
+% {#4}%
+% \fi}
+%
+% faster
+%
+% \def\doifnextlevelelse[#1::#2]%
+% {\ifalllevels
+% \donetrue
+% \else
+% \doifelse{\@@sectiontype}{#1}
+% {\doifinstringelse{=\currentlevel:}{=:#2:}
+% {\doifinstringelse{=\currentlevel:0}{=:#2:}\donefalse\donetrue}
+% \donefalse}
+% \donefalse
+% \fi
+% \ifdone
+% \expandafter\firstoftwoarguments
+% \else
+% \expandafter\secondoftwoarguments
+% \fi}
+%
+% \def\doifprevlevelelse[#1::#2]%
+% {\ifalllevels
+% \donetrue
+% \else
+% \doifelse{\@@sectiontype}{#1}
+% {\doifinstringelse{=\currentlevel:}{=:#2:}\donetrue\donefalse}
+% \donefalse
+% \fi
+% \ifdone
+% \expandafter\firstoftwoarguments
+% \else
+% \expandafter\secondoftwoarguments
+% \fi}
+%
+% meaner
+%
+% \stellijstin
+% [hoofdstuk]
+% [na={\startkolommen\plaatslijst[paragraaf]\stopkolommen}]
+
+\def\somesavedlevel{0}
+
+\def\dosavesomelevel[#1:0:0:0:#2]%
+ {\def\somesavedlevel{:#1}}
-\def\doifnextlevelelse[#1::#2]#3#4%
- {\ifalllevels
- #3%
+\def\doifnextlevelelse[#1::#2]%
+ {\dosavesomelevel[#2:0:0:0:0]%
+ \ifalllevels
+ \donetrue
\else
- \doifelse{\@@sectiontype}{#1} % \@EA kunnen denk ik weg
- {\@EA\doifinstringelse\@EA{\@EA=\currentlevel:}{=:#2:}
- {\@EA\doifinstringelse\@EA{\@EA=\currentlevel:0}{=:#2:}{#4}{#3}}
- {#4}}
- {#4}%
+ \doifelse{\@@sectiontype}{#1}
+ {\doifinstringelse{=\currentlevel:}{=:#2:}
+ {\doifinstringelse{=\currentlevel:0}{=:#2:}\donefalse\donetrue}
+ \donefalse}
+ \donefalse
+ \fi
+ \ifdone
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
\fi}
-\def\doifprevlevelelse[#1::#2]#3#4%
- {\ifalllevels
- #3%
+\def\doifprevlevelelse[#1::#2]%
+ {\dosavesomelevel[#2:0:0:0:0]%
+ \ifalllevels
+ \donetrue
\else
\doifelse{\@@sectiontype}{#1}
- {\@EA\doifinstringelse\@EA{\@EA=\currentlevel:}{=:#2:}
- {#3}
- {#4}}
- {#4}%
+ {\doifinstringelse{=\currentlevel:}{=:#2:}\donetrue\donefalse}
+ \donefalse
+ \fi
+ \ifdone
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
\fi}
-\def\dosettoclevel{\dosetlevel}
-\def\dosetreglevel{\dosetlevel}
-\def\dosetblklevel{\dosetlevel}
-
\def\doiftoclevelelse{\doifnextlevelelse}
\def\doifreglevelelse{\doifprevlevelelse}
\def\doifblklevelelse{\doifprevlevelelse}
@@ -578,17 +698,19 @@
\fi
\xdef\@@koniveau{\getvalue{\??se\@@sectie\c!niveau}}}
+\def\dohandelpaginaafBB#1#2#3%
+ {\doifinset{\getvalue{\??tk#2\v!tekst\c!status}}{\v!normaal,\v!start}
+ {\doifvaluesomething{\??ko#1#3}
+ {\setuplayouttext[#2][\c!status=\getvalue{\??ko#1#3}]}}}
+
\def\dohandelpaginaafB#1%
{\doifinset{\getvalue{\??ko#1\c!pagina}}{\v!ja,\v!rechts,\v!links}
{\def\resetcurrentsectionmarks% toegevoegd, zie \pagina
{\resetsectionmarks[\previoussection{\@@sectie}]}%
\pagina[\getvalue{\??ko#1\c!pagina}]%
- \doifinset{\getvalue{\??tk\v!hoofd\v!tekst\c!status}}{\v!normaal,\v!start}
- {\doifvaluesomething{\??ko#1\c!hoofd}
- {\stelhoofdin[\c!status=\getvalue{\??ko#1\c!hoofd}]}}%
- \doifinset{\getvalue{\??tk\v!voet\v!tekst\c!status}}{\v!normaal,\v!start}
- {\doifvaluesomething{\??ko#1\c!voet} % new
- {\stelvoetin[\c!status=\getvalue{\??ko#1\c!voet}]}}}}
+ \dohandelpaginaafBB{#1}\v!hoofd\c!hoofd
+ \dohandelpaginaafBB{#1}\v!tekst\c!tekst
+ \dohandelpaginaafBB{#1}\v!voet \c!voet}}
\def\dohandelpaginaafX#1% zie doordefinieren / boven
{\bgroup
@@ -661,7 +783,7 @@
\def\dodosomekop#1[#2]#3%
{\doifelsevalue{\??ko#1\c!eigennummer}{\v!ja}
{\def\next{\doquadruplegroupempty\dododosomekop{#1}{#2}{#3}}}
- {\def\next{\fourthargumentfalse\dododosomekop{#1}{#2}{#3}{}}}%
+ {\def\next{\fourthargumentfalse \dododosomekop{#1}{#2}{#3}{}}}%
\next}
\def\finalsectionnumber%
@@ -924,6 +1046,57 @@
\let\fullsectionnumber\limitedfullsectionnumber
\ifdisplaysectionhead\else\expandafter\GotoPar\fi}
+\def\previoussectionformat{}
+\def\currentsectionformat{}
+
+\let\updatelistreferences=\relax
+\def\updatedlistreferences{}
+
+\def\setsectionlistreference#1#2%
+ {\ifnum\countervalue{\??se\previoussection{#1}}>0\relax
+ \xdef\previoussectionformat{\@@longformatnumber{\previoussection{#1}}}%
+ \else
+ \xdef\previoussectionformat{}%
+ \fi
+ \xdef\currentsectionformat{\@@longformatnumber{#1}}}
+
+\def\startlistreferences#1%
+ {\thisissomeinternal{\s!lst}{#1\currentsectionformat}%
+ \setxvalue{\s!lst:#1}{\realfolio}% to be sure
+ \setxvalue{\s!lst:#1\currentsectionformat}{\realfolio}%
+ \setxvalue{\e!vorigelokale#1}{\s!lst:#1\previoussectionformat}%
+ \setxvalue{\e!huidigelokale#1}{\s!lst:#1\currentsectionformat}%
+ \doifelse{\currentsectionformat}{}
+ {\setglobalcrossreference
+ {\e!vorige#1}{}{\realfolio}{}}
+%
+ {\setglobalsystemreference\rt!list
+ {\e!vorige#1}{\getvalue{\e!vorigelokale#1}}}%
+%
+% {\definereference[\e!vorige#1][\getvalue{\e!vorigelokale#1}]%
+%
+ \def\stoplistreferences{\dostoplistreferences}}
+
+\def\dostoplistreferences#1%
+ {\iflijstgeplaatst
+ \addtocommalist{#1}\updatedlistreferences % nog global (\doglobal)
+ \global\let\updatedlistreferences=\updatedlistreferences % een noodverbandje
+ \gdef\updatelistreferences%
+ {\def\docommando####1%
+%
+ {\setglobalsystemreference\rt!list
+ {\e!vorige####1}{\getvalue{\e!huidigelokale####1}}}%
+%
+% {\definereference[\e!vorige####1][\getvalue{\e!huidigelokale####1}]%
+%
+ \processcommacommand[\updatedlistreferences]\docommando
+ \global\let\updatelistreferences=\relax
+ \global\let\updatedlistreferences=\empty}%
+ \fi}
+
+\def\stoplistreferences%
+ {\gobbleoneargument}
+
% \prevdepth\dp\strutbox is belangrijk, vergelijk naast elkaar:
%
% \onderwerp{test} \input tufte
@@ -1230,6 +1403,7 @@
\c!afstand=,
\c!pagina=,
\c!hoofd=,
+ \c!tekst=,
\c!voet=,
\c!letter=,
\c!nummercommando=,
@@ -1252,7 +1426,8 @@
{\doifsomething{\getvalue{\??ko#1\c!default}}
{\copyparameters
[\??ko#1][\??ko\getvalue{\??ko#1\c!default}]
- [\c!voor,\c!na,\c!commando,\c!file,\c!pagina,\c!doorgaan,\c!hoofd,\c!voet,
+ [\c!voor,\c!na,\c!commando,\c!file,\c!pagina,\c!doorgaan,
+ \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,
@@ -1272,7 +1447,8 @@
{\copyparameters
[\??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!hoofd,\c!voet,
+ \c!voor,\c!na,\c!commando,\c!file,\c!pagina,\c!doorgaan,
+ \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,
diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex
index 87983690f..1abd6014e 100644
--- a/tex/context/base/core-spa.tex
+++ b/tex/context/base/core-spa.tex
@@ -15,7 +15,8 @@
\unprotect
-\newevery \everybodyfont \Everybodyfont % just to be sure
+\newevery \everybodyfont \Everybodyfont % just to be sure
+\newevery \everyfontswitch \EveryFontSwitch % just to be sure
\appendtoks \presetnormallineheight \to \everybodyfont
\appendtoks \setnormalbaselines \to \everybodyfont
@@ -26,16 +27,36 @@
\appendtoks \stelinspringenin \to \everybodyfont
\appendtoks \stelblankoin \to \everybodyfont
\appendtoks \stelwitruimtein \to \everybodyfont
-%\appendtoks\setupfootnotes \to \everybodyfont
+%appendtoks \setupfootnotes \to \everybodyfont % not
\appendtoks \stelspatieringin \to \everybodyfont % nieuw
\appendtoks \setdisplayskips \to \everybodyfont % nieuw
+\appendtoks \updateraggedskips \to \everyfontswitch % under test
+
\def\stelfactorenin%
{\stelwitruimtein
\stelblankoin
\settopskip
\setmaxdepth}
+%D The dreadful sequence \type {\bgroup} \unknown\
+%D \type{\carryoverpar} \unknown\ \type{\egroup} is needed
+%D when for instance sidefloats are used in combination with
+%D something that starts with a group. This is because
+%D otherwise the indentation as set (by the output routine)
+%D inside the group are forgotten afterwards.
+
+\global\let\carriedoverpar\relax
+
+\def\carryoverpar#1%
+ {\expanded
+ {\noexpand#1%
+ \hangindent\the\hangindent
+ \hangafter \the\hangafter
+ \parskip \the\parskip
+ \leftskip \the\leftskip
+ \rightskip \the\rightskip}}
+
%D There are two ways to influence the interline spacing. The
%D most general and often most consistent way is using
%D
@@ -101,13 +122,13 @@
\let\normallineheight=\@@itregel % let ! ! ! ! ! ivm ex
\let\topskipfactor=\@@itboven
\let\maxdepthfactor=\@@itonder
- \setfontparameters % redundant \setstrut
+ \setfontparameters % redundant, can be \setstrut, test first
\updateraggedskips} % yes indeed
{\processallactionsinset % \regelwit = dummy !
[#1]
[ \v!aan=>\oninterlineskip,
\v!uit=>\offinterlineskip,
- \v!reset=>\setfontparameters,
+ \v!reset=>\setfontparameters,% just \setstrut, test first
\s!unknown=>\assignvalue{#1}{\regelwit}{1.00}{1.25}{1.50}%
\spacing{\regelwit}]}}
@@ -159,16 +180,19 @@
\def\geenblanko%
{\removelastskip}
-\def\dosingleblanko#1% ook nog \v!halveregel+fuzzysnap
+\def\doassignsomeskip#1\to#2% ook nog \v!halveregel+fuzzysnap
{\doifelse{#1}{\v!regel}
- {\blankoskipamount=\openlineheight}
+ {#2\openlineheight}
{\ifgridsnapping
- \assigndimension{#1}{\blankoskipamount}%
+ \assigndimension{#1}{#2}%
{.25\openlineheight}{.5\openlineheight}{\openlineheight}%
\else
- \assigndimension{#1}{\blankoskipamount}%
+ \assigndimension{#1}{#2}%
{\smallskipamount}{\medskipamount}{\bigskipamount}%
- \fi}%
+ \fi}}
+
+\def\dosingleblanko#1%
+ {\doassignsomeskip#1\to\blankoskipamount
\global\advance\blankoskip by \blankoskipamount}
\newif\iffuzzyvskip
@@ -536,7 +560,7 @@
\s!unknown=>\edef\currentvoorwit{\commalistelement}%
\simplestelinspringenin]}
-\def\simplestelinspringenin%
+\def\simplestelinspringenin
{\assigndimension{\currentvoorwit}{\voorwit}{1em}{1.5em}{2em}%
\parindent=\voorwit\relax}
@@ -966,8 +990,8 @@
\def\spacing#1%
{\ifgridsnapping
+ \doifnot{#1}{1}{\showmessage{\m!layouts}{11}{#1}}%
\edef\spacingfactor{1}%
- \showmessage{\m!layouts}{11}{#1}%
\else
\edef\spacingfactor{#1}%
\fi
@@ -1306,8 +1330,8 @@
\v!laho=>\let\raggedbottomcommand\vfilll % we do support the
\let\raggedtopcommand \vfilll, % ugly laho (lohi)
\v!nee=>\def\raggedcommand{\raggedright},
- \v!ja=>\let\raggedcommand\relax,
- \v!normaal=>\let\raggedcommand\relax]}
+ \v!ja=>\let\raggedcommand\notragged, % was \relax
+ \v!normaal=>\let\raggedcommand\notragged]} % was \relax
% Nodig i.v.m. inspringen eerste alineas
@@ -1410,19 +1434,31 @@
% vergeten
-\def\forgeteverypar%
- {\everypar{}}
+%\def\forgeteverypar%
+% {\everypar\emptytoks}
\def\forgeteverypar%
{\everypar{\the\neverypar}}
-\def\forgetparindent%
+%\def\forgetparindent%
+% {\forgeteverypar
+% \indentfirstparagraphtrue % recently added
+% \stelinspringenin[\v!geen]}
+
+%\def\forgetparskip%
+% {\stelwitruimtein[\v!geen]}
+
+\def\forgetparindent
{\forgeteverypar
\indentfirstparagraphtrue % recently added
- \stelinspringenin[\v!geen]}
+ \let\currentvoorwit\v!geen
+ \voorwit\zeropoint
+ \parindent\zeropoint\relax}
\def\forgetparskip%
- {\stelwitruimtein[\v!geen]}
+ {\let\currentwitruimte\v!geen
+ \tussenwit\zeropoint
+ \parskip\zeropoint\relax}
\def\forgetbothskips%
{\tolerance=1500
@@ -1435,8 +1471,7 @@
\def\forgetall%
{\the\everyforgetall}
-\appendtoks \let\par\endgraf \to \everyforgetall % i.v.m. getpar etc
-\appendtoks \notragged \to \everyforgetall
+\appendtoks \forgetragged \to \everyforgetall
\appendtoks \forgetparskip \to \everyforgetall
\appendtoks \forgetparindent \to \everyforgetall
\appendtoks \forgetbothskips \to \everyforgetall
@@ -1453,27 +1488,98 @@
\forgeteverypar
\let\next=}
-% ach ja
+% ach ja, hoort niet hier
+
+% \unexpanded\def\dostartattributes#1#2#3%
+% {\begingroup % geen \bgroup, anders in mathmode lege \hbox
+% \doifdefinedelse{#1#2}
+% {\def\fontattribute{\getvalue{#1#2}}}
+% {\let\fontattribute=\empty}%
+% \doifdefinedelse{#1#3}
+% {\def\colorattribute{\getvalue{#1#3}}}
+% {\let\colorattribute=\empty}%
+% \startcolor[\colorattribute]%
+% \@EA\doconvertfont\@EA{\fontattribute}}
+%
+% \unexpanded\def\dostopattributes%
+% {\stopcolor
+% \endgroup}
+%
+% \unexpanded\def\doattributes#1#2#3#4%
+% {\dostartattributes{#1}{#2}{#3}{#4}\dostopattributes}
+
+%D A hardly faster implementation follows. We cannot use
+%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).
+
+\def\@@dodoconvertfont#1{\csname\@letter@ #1\endcsname}
+\def\@@donoconvertfont#1{\csname\@noletter@#1\endcsname}
+
+\unexpanded\def\dodoconvertfont#1%#2%
+ {\doifdefinedelse{\@letter@#1}
+ {\doifelsenothing{#1}
+ {\let\next\gobbleoneargument}
+ {\let\next\@@dodoconvertfont}}
+ {\doifdefinedelse{#1}
+ {\let\next\getvalue}
+ {\let\next\firstofoneargument}}%
+ \next{#1}}%{#2}}
+
+\let\doconvertfont=\dodoconvertfont
+
+\def\noconvertfont#1%#2%
+ {\doifdefinedelse{\@noletter@#1}
+ {\doifelsenothing{#1}
+ {\let\next\gobbleoneargument}
+ {\let\next\@@donoconvertfont}}
+ {\let\next\firstofoneargument}%
+ \next{#1}}%{#2}}
+
+\beginTEX
\unexpanded\def\dostartattributes#1#2#3%
{\begingroup % geen \bgroup, anders in mathmode lege \hbox
- \doifdefinedelse{#1#2}
- {\def\fontattribute{\getvalue{#1#2}}}
- {\let\fontattribute=\empty}%
- \doifdefinedelse{#1#3}
- {\def\colorattribute{\getvalue{#1#3}}}
- {\let\colorattribute=\empty}%
- \startcolor[\colorattribute]%
- \@EA\doconvertfont\@EA{\fontattribute}}
-
-\unexpanded\def\dostopattributes%
+ \@EA\ifx\csname#1#3\endcsname\relax
+ \let\dostopattributes\endgroup
+ \else
+ \let\dostopattributes\@@dostopattributes
+ \startcolor[\csname#1#3\endcsname]%
+ \fi
+ \@EA\ifx\csname#1#2\endcsname\relax
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\doconvertfont
+ \fi{\csname#1#2\endcsname}}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\unexpanded\def\dostartattributes#1#2#3%
+ {\begingroup % geen \bgroup, anders in mathmode lege \hbox
+ \ifcsname#1#3\endcsname
+ \let\dostopattributes\@@dostopattributes
+ \startcolor[\csname#1#3\endcsname]%
+ \else
+ \let\dostopattributes\endgroup
+ \fi
+ \ifcsname#1#2\endcsname
+ \expandafter\doconvertfont
+ \else
+ \expandafter\gobbleoneargument
+ \fi{\csname#1#2\endcsname}}
+
+\endETEX
+
+\unexpanded\def\@@dostopattributes%
{\stopcolor
\endgroup}
\unexpanded\def\doattributes#1#2#3#4%
{\dostartattributes{#1}{#2}{#3}{#4}\dostopattributes}
-% kan vaker worden toegepast:
+% Kan vaker worden toegepast en moet bovendien sneller!
\newskip\leftskipadaption
@@ -1481,15 +1587,46 @@
{\dosetleftskipadaption{#1}%
\advance\leftskip by \leftskipadaption}
+\beginTEX
+
\def\dosetleftskipadaption#1%
- {\leftskipadaption\!!zeropoint
+ {\leftskipadaption\zeropoint
\processaction[#1] % \ExpandFirstAfter
[\v!standaard=>\leftskipadaption=
- \ifdim\voorwit=\!!zeropoint\@@sllinks\else\voorwit\fi,
+ \ifdim\voorwit=\zeropoint\@@sllinks\else\voorwit\fi,
\v!ja=>\leftskipadaption=
- \ifdim\voorwit=\!!zeropoint\@@sllinks\else\voorwit\fi,
+ \ifdim\voorwit=\zeropoint\@@sllinks\else\voorwit\fi,
\v!nee=>,
\s!unknown=>\leftskipadaption=#1]}
+
+\endTEX
+
+\beginETEX
+
+% installation
+
+\setvalue{@lsa@\v!standaard}%
+ {\ifdim\voorwit=\zeropoint\@@sllinks\else\voorwit\fi}
+
+\setvalue{@lsa@\v!ja}%
+ {\ifdim\voorwit=\zeropoint\@@sllinks\else\voorwit\fi}
+
+\setvalue{@lsa@\v!nee}%
+ {\zeropoint}
+
+\setvalue{@lsa@\empty}%
+ {\zeropoint}
+
+\def\dosetleftskipadaption#1%
+ {\leftskipadaption
+ \ifcsname @lsa@#1\endcsname
+ \csname @lsa@#1\endcsname
+ \else
+ #1%
+ \fi
+ \relax}
+
+\endETEX
% Dit hoort eigenlijk thuis onder het kopje boodschappen cq,
% meldingen.
@@ -1647,8 +1784,19 @@
\parfillskip\!!zeropoint\!!plus#6\relax
\parindent#7\relax}
-\def\notragged%
- {\setraggedskips{0}{0em}{0em}{0em}{0em}{1fil}{\parindent}}
+% \def\notragged%
+% {\setraggedskips{0}{0em}{0em}{0em}{0em}{1fil}{\parindent}}
+
+\def\notragged
+ {\chardef\raggedstatus=0
+ \leftskip1\leftskip
+ \rightskip1\rightskip
+ \spaceskip\!!zeropoint
+ \xspaceskip\!!zeropoint
+ \parfillskip\!!zeropoint\!!plus1fil\relax
+ \let\updateraggedskips\relax} % new
+
+\let\forgetragged\notragged
\def\raggedleft%
{\setraggedness\leftraggedness
@@ -1815,7 +1963,71 @@
\def\woordrechts%
{\groupedcommand{\hfill\hbox}{\parfillskip\!!zeropoint}}
+
+%D \macros
+%D {pushindentation,popindentation}
+%D
+%D The pushing and popping is done by:
+
+\newbox\indentationboxA
+\newbox\indentationboxB
+
+\def\pushindentation%
+ {\bgroup
+ \ifhmode
+ \unskip
+ \setbox\indentationboxA=\lastbox % get \strut if present
+ \unskip
+ \setbox\indentationboxB=\lastbox % get \indent generated box
+ \unskip
+ \else
+ \hskip\!!zeropoint % switch to horizontal mode
+ \unskip
+ \setbox\indentationboxA=\lastbox % get \indent generated box
+ \setbox\indentationboxB=\box\voidb@x
+ \fi}
+\def\popindentation%
+ {\box\indentationboxB\box\indentationboxA % put back the boxes
+ \egroup}
+
+%D The only complication lays in \type{\strut}. In \PLAIN\
+%D \TEX\ a \type{\strut} is defined as:
+%D
+%D \starttypen
+%D \def\strut%
+%D {\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
+%D \stoptypen
+%D
+%D But what is a \type{\strut}? Normally it's a rule of width
+%D zero, but when made visual, it's a rule and a negative skip.
+%D The mechanism for putting things in the margins described
+%D here cannot handle this situation very well. One
+%D characteristic of \type{\strut} is that the \type{\unhcopy}
+%D results in entering horizontal mode, which in return leads
+%D to some indentation.
+%D
+%D To serve our purpose a bit better, the macro \type{\strut}
+%D can be redefined as:
+%D
+%D \starttypen
+%D \def\strut%
+%D {\relax\ifmmode\else\hskip0pt\fi\copy\strutbox}
+%D \stoptypen
+%D
+%D Or more compatible:
+%D
+%D \starttypen
+%D \def\strut%
+%D {\relax\ifmmode
+%D \copy\strutbox
+%D \else
+%D \bgroup\setbox\strutbox=\normalhbox{\box\strutbox}\unhcopy\strutbox\egroup
+%D \fi}
+%D \stoptypen
+%D
+%D In \CONTEXT\ however we save some processing time by putting
+%D an extra \type{\hbox} around the \type{\strutbox}.
\stelwitruimtein
[\v!geen]
diff --git a/tex/context/base/core-syn.tex b/tex/context/base/core-syn.tex
index 6b6678392..65dc1b7a0 100644
--- a/tex/context/base/core-syn.tex
+++ b/tex/context/base/core-syn.tex
@@ -87,8 +87,8 @@
\def\processsynonym#1#2#3%
{\begingroup % anders in mathmode lege \hbox, zie eenheden
\ifsynonymmeaning
- \doattributes{\??sm#1}\c!synoniemletter\c!synoniemkleur
- {\synonymmeaningfalse#3}%
+ \synonymmeaningfalse
+ \doattributes{\??sm#1}\c!synoniemletter\c!synoniemkleur{#3}%
\else
\explicithmode
\doattributes{\??sm#1}\c!tekstletter\c!tekstkleur{#2}%
diff --git a/tex/context/base/core-sys.tex b/tex/context/base/core-sys.tex
new file mode 100644
index 000000000..044fb9a52
--- /dev/null
+++ b/tex/context/base/core-sys.tex
@@ -0,0 +1,199 @@
+%D \module
+%D [ file=core-sys, % moved from main-001
+%D version=1997.03.31,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=System,
+%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 Core Macros (System)}
+
+\unprotect
+
+\def\dosetupsystem[#1]%
+ {\getparameters[\??sv][#1]%
+ \setuprandomize[\@@svwillekeur]%
+ \beforesplitstring\@@svresolutie\at dpi\to\@@svresolutie
+ \let\outputresolution=\@@svresolutie}
+
+\def\setupsystem%
+ {\dosingleargument\dosetupsystem}
+
+\def\setuprandomize[#1]%
+ {\doifsomething{#1}
+ {\bgroup
+ \setrandomseed{-1}%
+ \processaction
+ [#1]
+ [ \v!klein=>\divide\time 900, % 15 taco vragen hoe
+ \v!middel=>\divide\time 1800, % 30 time werkt; nodig voor
+ \v!groot=>\divide\time 3600, % 60 random pos deadlock
+ \v!normaal=>,
+ \s!default=>,
+ \s!unknown=>\time=#1]%
+ \nextrandom
+ \egroup}}
+
+\def\outputfilename{\@@svfile}
+\def\inputfilename {\@@svinputfile}
+
+\setupsystem
+ [\c!gebied=,
+ \c!resolutie=600dpi,
+ \c!willekeur=,
+ \c!file=\jobname,
+ \c!inputfile=\outputfilename,
+ \c!korps=\normalizedlocalbodyfontsize] % of iets anders
+
+%D
+
+\def\dostartglobaldefs#1#2%
+ {\edef\!!stringa{\the\globaldefs}%
+ \ifnum\globaldefs#10
+ \globaldefs=-\globaldefs
+ \fi
+ \advance\globaldefs by #21
+ \setevalue{@gd@\the\globaldefs}{\!!stringa}}
+
+\def\dostopglobaldefs%
+ {\doifdefinedelse{@gd@\the\globaldefs}
+ {\globaldefs=\getvalue{@gd@\the\globaldefs}\relax}
+ {\globaldefs=0\relax}}
+
+\def\startlocal {\dostartglobaldefs>-}
+\def\stoplocal {\dostopglobaldefs}
+\def\startglobal {\dostartglobaldefs<+}
+\def\stopglobal {\dostopglobaldefs}
+
+\def\complexstart[#1]{\bgroup\getvalue{\e!start#1}}
+\def\complexstop [#1]{\getvalue{\e!stop #1}\egroup}
+
+\def\simplestart{\bgroup}
+\def\simplestop {\egroup}
+
+\definecomplexorsimple\start
+\definecomplexorsimple\stop
+
+\def\dodefinieerstartstop[#1][#2]%
+ {\getparameters
+ [\??be#1]
+ [\c!voor=,
+ \c!na=,
+ \c!commandos=,
+ \c!letter=,
+ #2]%
+% \setvalue{\e!stel#1\e!in}[##1]%
+% {\dodoubleargument\getparameters[\??be##1]}%
+ \unexpanded\setvalue{#1}%
+ {\groupedcommand
+ {\getvalue{\??be#1\c!commandos}%
+ \dostartattributes{\??be#1}\c!letter\c!kleur}
+ {\dostopattributes}}%
+ \setvalue{\e!start#1}%
+ {\getvalue{\??be#1\c!voor}%
+ \bgroup
+ \getvalue{\??be#1\c!commandos}%
+ \dostartattributes{\??be#1}\c!letter\c!kleur{}}%
+ \setvalue{\e!stop#1}%
+ {\dostopattributes
+ \egroup
+ \getvalue{\??be#1\c!na}}}
+
+\def\definieerstartstop%
+ {\dodoubleargument\dodefinieerstartstop}
+
+\def\stelstartstopin[#1]%
+ {\dodoubleargument\getparameters[\??be#1]}
+
+% \docommando kan niet worden gebruikt omdat deze macro
+% soms lokaal wordt gebruikt
+
+% te zijner tijd:
+%
+% \definevariable {pc} % ProtectedCommand
+%
+% \def\executeprotected#1%
+% {\csname\??pc\string#1\endcsname}
+%
+% \def\defineprotected#1#2%
+% {\expandafter\def\csname\??pc\string#2\endcsname}
+%
+% \def\defineunprotected#1%
+% {\def#1}
+%
+% \def\doprotected%
+% {\ifx\next\define
+% \let\next=\defineprotected
+% \else
+% \let\next=\executeprotected
+% \fi
+% \next}
+%
+% \def\unexpanded%
+% {\futurelet\next\doprotected}
+%
+% \unexpanded\define\ziezo{ziezo}
+%
+% \unexpanded\ziezo
+
+\def\complexdefinieer[#1]#2#3%
+ {\ifx#2\undefined
+ \else
+ \showmessage{\m!systems}{4}{\string#2}%
+ \fi
+ \ifcase0#1\def#2{#3}%
+ \or\def#2##1{#3}%
+ \or\def#2##1##2{#3}%
+ \or\def#2##1##2##3{#3}%
+ \or\def#2##1##2##3##4{#3}%
+ \or\def#2##1##2##3##4##5{#3}%
+ \or\def#2##1##2##3##4##5##6{#3}%
+ \or\def#2##1##2##3##4##5##6##7{#3}%
+ \or\def#2##1##2##3##4##5##6##7##8{#3}%
+ \or\def#2##1##2##3##4##5##6##7##8##9{#3}%
+ \else\def#2{#3}%
+ \fi}
+
+\definecomplexorsimpleempty\definieer
+
+\unexpanded\def\naam#1%
+ {\getvalue{#1}}
+
+\def\gebruikcommandos#1%
+ {\bgroup
+ \def\docommando##1%
+ {\setbox0=\hbox{\getvalue{\string##1}##1}}%
+ \processcommalist[#1]\docommando
+ \egroup}
+
+\def\convertexpanded#1#2#3% watch the double \v!ja expansion !
+ {\ExpandFirstAfter\processaction
+ [\getvalue{#1\c!expansie}]
+ [ \v!ja=>{{\honorunexpanded\xdef\@@globalexpanded{#2}%
+ \xdef\@@globalexpanded{\@@globalexpanded}}%
+ \dodoglobal\convertcommand\@@globalexpanded\to#3},
+ \v!commando=>{\dodoglobal\convertcommand #2\to#3},
+ \s!default=>{\dodoglobal\convertargument#2\to#3},
+ \s!unknown=>{\dodoglobal\convertargument#2\to#3}]}
+
+% \setvalue{statevalue\v!stop }{0}
+% \setvalue{statevalue\v!start }{1}
+% \setvalue{statevalue\v!normaal}{2}
+% \setvalue{statevalue\v!leeg }{3}
+% \setvalue{statevalue\v!geen }{4}
+%
+% \def\setcurrentstate#1%
+% {\chardef\currentstate=0\getvalue{statevalue\getvalue{#1\c!status}\relax}
+%
+% \ifcase\currentstate ...
+
+\def\herhaal {\dorepeat}
+\def\herhaler {\repeater}
+\def\herhaalmetcommando {\dorepeatwithcommand}
+
+\protect \endinput
diff --git a/tex/context/base/core-tab.tex b/tex/context/base/core-tab.tex
index 4dc8fff7e..ab17fbec0 100644
--- a/tex/context/base/core-tab.tex
+++ b/tex/context/base/core-tab.tex
@@ -987,6 +987,8 @@
%D The third stage involves a lot of (re)sets, which we will
%D explain later.
+\let \everytable \EveryTable % convenient and more in tune
+
\def\thirdstagestartTABLE#1%
{\global\setTABLEactiontrue
\setTABLEaction\TABLEunknown
diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex
index ff569f77b..075bf0c0e 100644
--- a/tex/context/base/core-tbl.tex
+++ b/tex/context/base/core-tbl.tex
@@ -702,7 +702,7 @@
\setbox0=\vbox % outside if because of line counting
{\footnotesenabledfalse
\let\tabulateindent\!!zeropoint
-\trialtypesettingtrue
+ \trialtypesettingtrue % very important
\@EA\halign\@EA{\the\!!toksa\cr\tabulatecontent\crcr}}%
\ifnum\nofautotabulate>0
\tabulatewidth\hsize
diff --git a/tex/context/base/core-uti.tex b/tex/context/base/core-uti.tex
index 4cd2a81f8..f5d5fc778 100644
--- a/tex/context/base/core-uti.tex
+++ b/tex/context/base/core-uti.tex
@@ -15,6 +15,8 @@
\unprotect
+% to do : lan ook safen
+
% Utility-file
%
% De onderstaande macro's ondersteunen het gebruik van de
@@ -24,6 +26,9 @@
% file \jobname.tmp gebruikt. Informatie wordt ingelezen uit
% de file \jobname.tuo, welke door TeXUtil wordt aangemaakt.
+\edef\utilityversion{1998.07.07} % was: 1996.03.15 % status variables
+\edef\utilityversion{1998.12.20} % was: 1998.07.07 % index attributes
+
% Bepaalde commando's worden als string weggeschreven. Deze
% zijn aan het eind van deze file gedefinieerd.
@@ -383,4 +388,9 @@
\prependtoks \resetutilities \to \everyjob
+% left over
+
+\def\plaatsvolledig#1#2#3#4% kop, ref, tit, do
+ {#1[#2]{#3}#4\pagina[\v!ja]}
+
\protect \endinput
diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex
index 84e6c857d..95c817805 100644
--- a/tex/context/base/core-ver.tex
+++ b/tex/context/base/core-ver.tex
@@ -171,6 +171,11 @@
\doifvalue{#1\c!pagina}{\v!nee}{\def\obeypages {\ignorepages}}%
%
\ExpandFirstAfter\processaction
+ [\getvalue{#1\c!regels}]
+ [ \v!ja=>\obeybreakpoints,
+ \v!afgebroken=>\obeyhyphens]%
+ %
+ \ExpandFirstAfter\processaction
[\getvalue{#1\c!optie}]
[ \v!geen=>\let\obeycharacters=\relax,
\v!kleur=>\setupprettiesintype{TEX}%
@@ -538,7 +543,7 @@
\c!optie=\v!normaal]
%D \macros
-%D {typ,obeyhyphens}
+%D {typ,obeyhyphens,obeybreakpoints}
%D
%D Although it's not clear from the macros, one character trait
%D of this macros, which are build on top of the support
@@ -555,6 +560,10 @@
\savedfont
\spaceskip.5em\!!plus.25em\!!minus.25em\relax}
+\def\obeybreakpoints%
+ {\def\obeyedspace{ }%
+ \veryraggedright}
+
%\unexpanded\def\typ%
% {\bgroup
% \obeyhyphens
@@ -765,7 +774,8 @@
\c!evenmarge=\!!zeropoint,
\c!onevenmarge=\!!zeropoint,
\c!blanko=\v!regel,
- \c!escape=/]
+ \c!escape=/,
+ \c!regels=\v!ja]
%D \macros
%D {definetype}
@@ -806,7 +816,7 @@
[\c!voor,\c!na,\c!spatie,\c!pagina,\c!tab,\c!kleur,\c!letter,
\c!tekst,\c!icommando,\c!vcommando,\c!ccommando,\c!korps,
\c!optie,\c!palet,\c!marge,\c!evenmarge,\c!onevenmarge,
- \c!springvolgendein,\c!blanko,\c!escape]%
+ \c!springvolgendein,\c!blanko,\c!escape,\c!regels]%
\getparameters
[\??tp#1]
[#2]}
@@ -1075,6 +1085,11 @@
\permitshiftedendofverbatim
\optimizeverbatimtrue
+%D And a bonus macro:
+
+\def\verbatim#1%
+ {\convertargument#1\to\ascii\ascii}
+
\protect
\endinput
diff --git a/tex/context/base/core-vis.tex b/tex/context/base/core-vis.tex
index 5c76ad84f..feb4a5afc 100644
--- a/tex/context/base/core-vis.tex
+++ b/tex/context/base/core-vis.tex
@@ -243,12 +243,10 @@
{\EveryPar{\doshowpagebuilder}}
\def\doshowpagebuilder%
- {\strut
- \llap
- {\ttxx \vl
- v:\the\vsize \vl
- g:\the\pagegoal \vl
- t:\the\pagetotal\vl}}
+ {\strut\llap{\tt\blue \vl
+ \high{\txx v:\the\vsize }\vl
+ \high{\txx g:\the\pagegoal }\vl
+ \high{\txx t:\the\pagetotal}\vl}}
%D \macros
%D {makecutbox, cuthbox, cutvbox, cutvtop}
diff --git a/tex/context/base/enco-ini.tex b/tex/context/base/enco-ini.tex
index ce1b17572..82f29e6ae 100644
--- a/tex/context/base/enco-ini.tex
+++ b/tex/context/base/enco-ini.tex
@@ -701,11 +701,12 @@
\def\stoppatternaccents%
{\let\char\savedpatternchar}
-%\def\presetcharacter#1%
-% {\setvalue{#1}{\dohandlecharacter{#1}}}
+% \def\presetcharacter#1%
+% {\setvalue{#1}{\dohandlecharacter{#1}}}
\def\definecharacter#1 #2 %
- {\setvalue{#1}{\dohandlecharacter{#1}}%
+ {\ifundefined{#1}\setvalue{#1}{\dohandlecharacter{#1}}\fi
+% {\setvalue{#1}{\dohandlecharacter{#1}}%
% {\@EA\presetcharacter\@EA{\@EA\strippedcsname\csname#1\endcsname}%
\doifnumberelse{\string#2}
{\setvalue{\characterencoding\string#1}{\char#2 }% watch the space
@@ -1032,6 +1033,17 @@
\@EA\appendtoks\csname#1\endcsname\to\everyULmap
\@EA\appendtoks\csname#2\endcsname\to\everyULmap}
+% slightly faster with \kap's but far more hash and stringspace
+%
+% \newif\ifuppercase \appendtoks\uppercasetrue\to\everyuppercase
+% \newif\iflowercase \appendtoks\lowercasetrue\to\everylowercase
+%
+% \def\defineULcharacter #1 #2 %
+% {\def\!!stringa{@#1}\@EA\letvalue\@EA\!!stringa\csname#1\endcsname
+% \def\!!stringa{@#2}\@EA\letvalue\@EA\!!stringa\csname#2\endcsname
+% \setvalue{#1}{\getvalue{@\ifuppercase#2\else#1\fi}}%
+% \setvalue{#2}{\getvalue{@\iflowercase#1\else#2\fi}}}
+
%D \macros
%D {everysanitize, EverySanitize}
%D
@@ -1049,18 +1061,18 @@
%D this can be found in \type{spec-mis}.
\def\obeylccodes%
- {\scratchcounter=32
+ {\scratchcounter32
\loop
\ifnum\scratchcounter<127
- \lccode\scratchcounter=\scratchcounter
- \advance\scratchcounter by 1
+ \lccode\scratchcounter\scratchcounter
+ \advance\scratchcounter 1
\repeat
\ifeightbitcharacters
- \scratchcounter=128
+ \scratchcounter128
\loop
\ifnum\scratchcounter<255
- \lccode\scratchcounter=`.
- \advance\scratchcounter by 1
+ \lccode\scratchcounter`.
+ \advance\scratchcounter 1
\repeat
\fi}
diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex
index afe943ee7..e0bf5f838 100644
--- a/tex/context/base/font-ini.tex
+++ b/tex/context/base/font-ini.tex
@@ -43,6 +43,8 @@
\def\definedfont%
{\dosingleempty\dodefinedfont}
+%%% message 14 added
+
\startmessages dutch library: fonts
title: korps
1: codering --
@@ -55,6 +57,7 @@
8: stijl -- gedefinieerd
% 9: mapping -- is geladen
10: onbekende font file --
+ 14: korps -- is gedefinieerd (kan beter globaal plaatsvinden)
\stopmessages
\startmessages english library: fonts
@@ -69,6 +72,7 @@
8: style -- defined
% 9: mapping -- is loaded
10: unknown font file --
+ 14: bodyfont -- is defined (can beter be done global)
\stopmessages
\startmessages german library: fonts
@@ -83,6 +87,7 @@
8: Stil -- definiert
% 9: Map -- ist geladen
10: unbekanntes Font --
+ 14: bodyfont -- is defined (can beter be done global)
\stopmessages
\startmessages czech library: fonts
@@ -97,6 +102,7 @@
8: styl -- definovan
% 9: mapovani -- je nacteno
10: neznamy font --
+ 14: bodyfont -- is defined (can beter be done global)
\stopmessages
\startmessages italian library: fonts
@@ -111,6 +117,7 @@
8: stile -- definito
% 9: mappatura -- caricata
10: file di font sconosciuto --
+ 14: bodyfont -- is defined (can beter be done global)
\stopmessages
\startmessages norwegian library: fonts
@@ -125,6 +132,7 @@
8: stil -- definert
% 9: avbildning -- er lest inn
10: ukjent fontfil --
+ 14: bodyfont -- is defined (can beter be done global)
\stopmessages
\startmessages romanian library: fonts
@@ -139,6 +147,7 @@
8: stilul -- definit
% 9: maparea -- este incarcat
10: fisier font necunoscut --
+ 14: bodyfont -- is defined (can beter be done global)
\stopmessages
%D This module is one of the oldest modules of \CONTEXT. The
@@ -702,9 +711,23 @@
\newtoks \mathstrategies
\newtoks \symbstrategies
-\def\synchronizetext{\the\textstrategies\fam\mrfam} % stylish text in mmode
-\def\synchronizemath{\the\mathstrategies\fam\mrfam} % math stuff in mmode
-\def\synchronizesymb{\the\symbstrategies\fam\mrfam} % stylish math stuff in mmode
+\newif\ifsynchronizemathfonts \synchronizemathfontstrue
+
+\def\synchronizetext % stylish text in mmode
+ {\ifsynchronizemathfonts\the\textstrategies\fam\mrfam\fi}
+
+\def\synchronizemath % math stuff in mmode
+ {\ifsynchronizemathfonts\the\mathstrategies\fam\mrfam\fi}
+
+\def\synchronizesymb % stylish math stuff in mmode
+ {\ifsynchronizemathfonts\the\symbstrategies\fam\mrfam\fi}
+
+%D \macros
+%D {textonly}
+%D
+%D We can inhibit this slow||downer with:
+
+\def\textonly{\synchronizemathfontsfalse}
\appendtoks
\dosettextfamily\c!tf
@@ -717,58 +740,61 @@
\to \textstrategies
\def\dosettextfamily#1%
- {\dodosettextfamily\scriptscriptfont\scriptscriptface#1%
- \dodosettextfamily\scriptfont \scriptface #1%
- \dodosettextfamily\textfont \textface #1}
+ {\let\savedfontbody\fontbody
+ \let\fontfamily#1%
+ \let\fontbody \scriptscriptface\dodosettextfamily\scriptscriptfont
+ \let\fontbody \scriptface \dodosettextfamily \scriptfont
+ \let\fontbody \textface \dodosettextfamily \textfont
+ \let\fontbody\savedfontbody}
% \def\s!nullfont{nullfont}
\beginTEX
-\def\dodosettextfamily#1#2#3%
- {\@EA\ifx\csname\fontclass#2\c!mm#3\fontsize\endcsname\relax
- \@EA\ifx\csname\fontclass#2\c!mm#3\endcsname \relax
- \@EA\ifx\csname\fontclass#2\c!rm#3\fontsize\endcsname\relax
- \@EA\ifx\csname\fontclass#2\c!rm#3\endcsname \relax
- \@EA\ifx\csname #2\c!mm#3\fontsize\endcsname\relax
- \@EA\ifx\csname #2\c!mm#3\endcsname \relax
- \@EA\ifx\csname #2\c!rm#3\fontsize\endcsname\relax
- \@EA\ifx\csname #2\c!rm#3\endcsname \relax
+\def\dodosettextfamily#1%
+ {\@EA\ifx\csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname\relax
+ \@EA\ifx\csname\fontclass\fontbody\c!mm\fontfamily\endcsname \relax
+ \@EA\ifx\csname\fontclass\fontbody\c!rm\fontfamily\fontsize\endcsname\relax
+ \@EA\ifx\csname\fontclass\fontbody\c!rm\fontfamily\endcsname \relax
+ \@EA\ifx\csname \fontbody\c!mm\fontfamily\fontsize\endcsname\relax
+ \@EA\ifx\csname \fontbody\c!mm\fontfamily\endcsname \relax
+ \@EA\ifx\csname \fontbody\c!rm\fontfamily\fontsize\endcsname\relax
+ \@EA\ifx\csname \fontbody\c!rm\fontfamily\endcsname \relax
\autofontsizetrue \nullfont \else
- \autofontsizetrue \csname#2\c!rm#3\endcsname \fi\else
- \autofontsizefalse \csname#2\c!rm#3\fontsize\endcsname\fi\else
- \autofontsizetrue \csname#2\c!mm#3\endcsname \fi\else
- \autofontsizefalse \csname#2\c!mm#3\fontsize\endcsname\fi\else
- \autofontsizetrue \csname\fontclass#2\c!rm#3\endcsname \fi\else
- \autofontsizefalse \csname\fontclass#2\c!rm#3\fontsize\endcsname\fi\else
- \autofontsizetrue \csname\fontclass#2\c!mm#3\endcsname \fi\else
- \autofontsizefalse \csname\fontclass#2\c!mm#3\fontsize\endcsname\fi
- #1\csname#3\s!fam\endcsname\font}
+ \autofontsizetrue \csname\fontbody\c!rm\fontfamily\endcsname \fi\else
+ \autofontsizefalse \csname\fontbody\c!rm\fontfamily\fontsize\endcsname\fi\else
+ \autofontsizetrue \csname\fontbody\c!mm\fontfamily\endcsname \fi\else
+ \autofontsizefalse \csname\fontbody\c!mm\fontfamily\fontsize\endcsname\fi\else
+ \autofontsizetrue \csname\fontclass\fontbody\c!rm\fontfamily\endcsname \fi\else
+ \autofontsizefalse \csname\fontclass\fontbody\c!rm\fontsize\endcsname\fi\else
+ \autofontsizetrue \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \fi\else
+ \autofontsizefalse \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname\fi
+ #1\csname\fontfamily\s!fam\endcsname\font}
\endTEX
\beginETEX \ifcsname
-\def\dodosettextfamily#1#2#3%
- {\ifcsname\fontclass#2\c!mm#3\fontsize\endcsname \autofontsizefalse
- \csname\fontclass#2\c!mm#3\fontsize\endcsname \else
- \ifcsname\fontclass#2\c!mm#3\endcsname \autofontsizetrue
- \csname\fontclass#2\c!mm#3\endcsname \else
- \ifcsname\fontclass#2\c!rm#3\fontsize\endcsname \autofontsizefalse
- \csname\fontclass#2\c!rm#3\fontsize\endcsname \else
- \ifcsname\fontclass#2\c!rm#3\endcsname \autofontsizetrue
- \csname\fontclass#2\c!rm#3\endcsname \else
- \ifcsname #2\c!mm#3\fontsize\endcsname \autofontsizefalse
- \csname #2\c!mm#3\fontsize\endcsname \else
- \ifcsname #2\c!mm#3\endcsname \autofontsizetrue
- \csname #2\c!mm#3\endcsname \else
- \ifcsname #2\c!rm#3\fontsize\endcsname \autofontsizefalse
- \csname #2\c!rm#3\fontsize\endcsname \else
- \ifcsname #2\c!rm#3\endcsname \autofontsizetrue
- \csname #2\c!rm#3\endcsname \else
- \nullfont \autofontsizetrue
+\def\dodosettextfamily#1%
+ {\ifcsname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+ \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \else
+ \ifcsname\fontclass\fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
+ \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \else
+ \ifcsname\fontclass\fontbody\c!rm\fontfamily\fontsize\endcsname \autofontsizefalse
+ \csname\fontclass\fontbody\c!rm\fontfamily\fontsize\endcsname \else
+ \ifcsname\fontclass\fontbody\c!rm\fontfamily\endcsname \autofontsizetrue
+ \csname\fontclass\fontbody\c!rm\fontfamily\endcsname \else
+ \ifcsname \fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+ \csname \fontbody\c!mm\fontfamily\fontsize\endcsname \else
+ \ifcsname \fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
+ \csname \fontbody\c!mm\fontfamily\endcsname \else
+ \ifcsname \fontbody\c!rm\fontfamily\fontsize\endcsname \autofontsizefalse
+ \csname \fontbody\c!rm\fontfamily\fontsize\endcsname \else
+ \ifcsname \fontbody\c!rm\fontfamily\endcsname \autofontsizetrue
+ \csname \fontbody\c!rm\fontfamily\endcsname \else
+ \nullfont \autofontsizetrue
\fi\fi\fi\fi\fi\fi\fi\fi
- #1\csname#3\s!fam\endcsname\font}
+ #1\csname\fontfamily\s!fam\endcsname\font}
\endETEX
@@ -788,56 +814,60 @@
\to \mathstrategies
\def\dosetmathfamily#1#2#3#4#5#6%
- {\dodosetmathfamily\scriptscriptfont#4#1#5{#6}%
- \dodosetmathfamily\scriptfont #3#1#5{#6}%
- \dodosetmathfamily\textfont #2#1#5{#6}}
+ {\let\savedfontbody\fontbody % op hoger plan
+ \let\fontfamily#5%
+ \let\backfamily#6%
+ \let\fontbody #4\dodosetmathfamily\scriptscriptfont#1%
+ \let\fontbody #3\dodosetmathfamily \scriptfont#1%
+ \let\fontbody #2\dodosetmathfamily \textfont#1%
+ \let\fontbody\savedfontbody}
\beginTEX
-\def\dodosetmathfamily#1#2#3#4#5%
- {\@EA\ifx \csname\fontclass#2\c!mm#4\fontsize\endcsname\relax
- \@EA\ifx \csname\fontclass#2\c!mm#4\endcsname \relax
- \@EA\ifx \csname\fontclass#2#5\fontsize\endcsname \relax
- \@EA\ifx \csname\fontclass#2#5\endcsname \relax
- \@EA\ifx \csname #2\c!mm#4\fontsize\endcsname\relax
- \@EA\ifx \csname #2\c!mm#4\endcsname \relax
- \@EA\ifx \csname #2#5\fontsize\endcsname \relax
- \@EA\ifx \csname #2#5\endcsname \relax
+\def\dodosetmathfamily#1#2%
+ {\@EA\ifx \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname\relax
+ \@EA\ifx \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \relax
+ \@EA\ifx \csname\fontclass\fontbody\backfamily\fontsize\endcsname \relax
+ \@EA\ifx \csname\fontclass\fontbody\backfamily\endcsname \relax
+ \@EA\ifx \csname \fontbody\c!mm\fontfamily\fontsize\endcsname\relax
+ \@EA\ifx \csname \fontbody\c!mm\fontfamily\endcsname \relax
+ \@EA\ifx \csname \fontbody\backfamily\fontsize\endcsname \relax
+ \@EA\ifx \csname \fontbody\backfamily\endcsname \relax
\autofontsizetrue \nullfont \else
- \autofontsizetrue \csname #2#5\endcsname \fi \else
- \autofontsizefalse \csname #2#5\fontsize\endcsname \fi \else
- \autofontsizetrue \csname #2\c!mm#4\endcsname \fi \else
- \autofontsizefalse \csname #2\c!mm#4\fontsize\endcsname\fi \else
- \autofontsizetrue \csname\fontclass#2#5\endcsname \fi \else
- \autofontsizefalse \csname\fontclass#2#5\fontsize\endcsname \fi \else
- \autofontsizetrue \csname\fontclass#2\c!mm#4\endcsname \fi \else
- \autofontsizefalse \csname\fontclass#2\c!mm#4\fontsize\endcsname\fi
- #1#3\font}
+ \autofontsizetrue \csname \fontbody\backfamily\endcsname \fi \else
+ \autofontsizefalse \csname \fontbody\backfamily\fontsize\endcsname \fi \else
+ \autofontsizetrue \csname \fontbody\c!mm\fontfamily\endcsname \fi \else
+ \autofontsizefalse \csname \fontbody\c!mm\fontfamily\fontsize\endcsname\fi \else
+ \autofontsizetrue \csname\fontclass\fontbody\backfamily\endcsname \fi \else
+ \autofontsizefalse \csname\fontclass\fontbody\backfamily\fontsize\endcsname \fi \else
+ \autofontsizetrue \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \fi \else
+ \autofontsizefalse \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname\fi
+ #1#2\font}
\endTEX
\beginETEX \ifcsname
-\def\dodosetmathfamily#1#2#3#4#5%
- {\ifcsname\fontclass#2\c!mm#4\fontsize\endcsname \autofontsizefalse
- \csname\fontclass#2\c!mm#4\fontsize\endcsname \else
- \ifcsname\fontclass#2\c!mm#4\endcsname \autofontsizetrue
- \csname\fontclass#2\c!mm#4\endcsname \else
- \ifcsname\fontclass#2#5\fontsize\endcsname \autofontsizefalse
- \csname\fontclass#2#5\fontsize\endcsname \else
- \ifcsname\fontclass#2#5\endcsname \autofontsizetrue
- \csname\fontclass#2#5\endcsname \else
- \ifcsname #2\c!mm#4\fontsize\endcsname \autofontsizefalse
- \csname #2\c!mm#4\fontsize\endcsname \else
- \ifcsname #2\c!mm#4\endcsname \autofontsizetrue
- \csname #2\c!mm#4\endcsname \else
- \ifcsname #2#5\fontsize\endcsname \autofontsizefalse
- \csname #2#5\fontsize\endcsname \else
- \ifcsname #2#5\endcsname \autofontsizetrue
- \csname #2#5\endcsname \else
- \nullfont \autofontsizetrue
+\def\dodosetmathfamily#1#2%
+ {\ifcsname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+ \csname\fontclass\fontbody\c!mm\fontfamily\fontsize\endcsname \else
+ \ifcsname\fontclass\fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
+ \csname\fontclass\fontbody\c!mm\fontfamily\endcsname \else
+ \ifcsname\fontclass\fontbody\backfamily\fontsize\endcsname \autofontsizefalse
+ \csname\fontclass\fontbody\backfamily\fontsize\endcsname \else
+ \ifcsname\fontclass\fontbody\backfamily\endcsname \autofontsizetrue
+ \csname\fontclass\fontbody\backfamily\endcsname \else
+ \ifcsname \fontbody\c!mm\fontfamily\fontsize\endcsname \autofontsizefalse
+ \csname \fontbody\c!mm\fontfamily\fontsize\endcsname \else
+ \ifcsname \fontbody\c!mm\fontfamily\endcsname \autofontsizetrue
+ \csname \fontbody\c!mm\fontfamily\endcsname \else
+ \ifcsname \fontbody\backfamily\fontsize\endcsname \autofontsizefalse
+ \csname \fontbody\backfamily\fontsize\endcsname \else
+ \ifcsname \fontbody\backfamily\endcsname \autofontsizetrue
+ \csname \fontbody\backfamily\endcsname \else
+ \nullfont \autofontsizetrue
\fi\fi\fi\fi\fi\fi\fi\fi
- #1#3\font}
+ #1#2\font}
\endETEX
@@ -852,44 +882,38 @@
\to \symbstrategies
\def\dosetsymbfamily#1#2#3#4#5%
- {\dodosetsymbfamily\scriptscriptfont#4#1#5%
- \dodosetsymbfamily\scriptfont #3#1#5%
- \dodosetsymbfamily\textfont #2#1#5}
+ {\let\savedfontbody\fontbody
+ \let\fontfamily#5%
+ \let\fontbody #4\dodosetsymbfamily\scriptscriptfont#1%
+ \let\fontbody #3\dodosetsymbfamily \scriptfont#1%
+ \let\fontbody #2\dodosetsymbfamily \textfont#1%
+ \let\fontbody\savedfontbody}
\beginTEX
-\def\dodosetsymbfamily#1#2#3#4%
- {\@EA\ifx\csname\fontclass#2\c!mm#4\fontalternative\fontsize\endcsname\relax
- \@EA\ifx\csname#2\c!mm#4\fontalternative\fontsize\endcsname\relax
+\def\dodosetsymbfamily#1#2%
+ {\@EA\ifx\csname\fontclass\fontbody\c!mm\fontfamily\fontalternative\fontsize\endcsname\relax
+ \@EA\ifx\csname\fontbody\c!mm\fontfamily\fontalternative\fontsize\endcsname\relax
\else
- \csname#2\c!mm#4\fontalternative\fontsize\endcsname
- #1#3\font
+ \csname\fontbody\c!mm\fontfamily\fontalternative\fontsize\endcsname
+ #1#2\font
\fi
\else
- \csname\fontclass#2\c!mm#4\fontalternative\fontsize\endcsname
- #1#3\font
+ \csname\fontclass\fontbody\c!mm\fontfamily\fontalternative\fontsize\endcsname
+ #1#2\font
\fi}
\endTEX
\beginETEX \ifcsname
-\def\dodosetsymbfamily#1#2#3#4%
- {\ifcsname\fontclass#2\c!mm#4\fontalternative\fontsize\endcsname
- \csname\fontclass#2\c!mm#4\fontalternative\fontsize\endcsname
- #1#3\font
- \else\ifcsname#2\c!mm#4\fontalternative\fontsize\endcsname
- \csname#2\c!mm#4\fontalternative\fontsize\endcsname
- #1#3\font
- \fi\fi}
-
-\def\dodosetsymbfamily#1#2#3#4%
- {\ifcsname\fontclass#2\c!mm#4\fontalternative\fontsize\endcsname
- \csname\fontclass#2\c!mm#4\fontalternative\fontsize\endcsname
- #1#3\font
- \else\ifcsname#2\c!mm#4\fontalternative\fontsize\endcsname
- \csname#2\c!mm#4\fontalternative\fontsize\endcsname
- #1#3\font
+\def\dodosetsymbfamily#1#2%
+ {\ifcsname\fontclass\fontbody\c!mm\fontfamily\fontalternative\fontsize\endcsname
+ \csname\fontclass\fontbody\c!mm\fontfamily\fontalternative\fontsize\endcsname
+ #1#2\font
+ \else\ifcsname\fontbody\c!mm\fontfamily\fontalternative\fontsize\endcsname
+ \csname\fontbody\c!mm\fontfamily\fontalternative\fontsize\endcsname
+ #1#2\font
\fi\fi}
\endETEX
@@ -1017,7 +1041,6 @@
\fi
#2}
-
\def\setnaturalfontspec#1]%
{\@fs@scaled\!!thousand}
@@ -1125,7 +1148,10 @@
\let\@@skewchar \empty
\let\@@hyphenchar \empty % todo, will go to encoding
-\newif\ifskipfontcharacteristics % \skipfontcharacteristicstrue
+%D This brings down maps processing from 466 to 309 seconds
+%D ($-33$\%) and mfonts from 42 to 34 seconds ($-15$\%).
+
+\newif\ifskipfontcharacteristics \skipfontcharacteristicstrue
\def\donoparsefontspec#1%
{\edef\fontfile{\truefontname\somefontname}%
@@ -1409,6 +1435,8 @@
\setfontcharacteristics
\the\everyfontswitch}
+\beginETEX \ifcsname
+
\def\xxdododefinefont#1#2% \autofontsizetrue is set by calling routine
{\ifcsname*\fontclass#1\fontsize*\endcsname\else
\dosetrelativefontsize{\fontclass#1}% dangerous with fallback
@@ -1423,6 +1451,26 @@
\the\everyfontswitch
\fi}
+\endETEX
+
+\beginTEX
+
+\def\xxdododefinefont#1#2% \autofontsizetrue is set by calling routine
+ {\@EA\ifx\csname*\fontclass#1\fontsize*\endcsname\relax
+ \dosetrelativefontsize{\fontclass#1}% dangerous with fallback
+ \parsefontspec{#2}{*\fontclass#1\fontsize*}%
+ \doresetrelativefontsize
+ \fi
+ \csname*\fontclass#1\fontsize*\endcsname
+ \autofontsizefalse
+ \edef\lastfontidentifier{#1}%
+ \ifskipfontcharacteristics \else
+ \setfontcharacteristics
+ \the\everyfontswitch
+ \fi}
+
+\endTEX
+
%D I considered checking for mistakenly use of \PLAIN's
%D \type{\magstep}'s but although it would take only a few
%D lines of code, this would not add to consistent use. I
@@ -1668,7 +1716,7 @@
\def\definebodyfontenvironment%
{\dotripleempty\dodefinebodyfontenvironment}
-\def\dodefinebodyfontenvironment[#1][#2][#3]% [class] size settings
+\def\dodefinebodyfontenvironment[#1][#2][#3]% class size settings
{\ifthirdargument
\@@beginfontdef
\doifelse{#2}{\s!default}
@@ -1682,24 +1730,50 @@
\fi}
\def\dododefinebodyfontenvironment[#1][#2][#3]% size class settings
- {\doifundefined{\??ft#2#1\s!text}
- {\def\docommando##1%
- {\scratchdimen=#1\relax
+ {\@@beginfontdef
+ \doifundefined{\??ft#2#1\c!em} % \s!text goes wrong in testing because
+ {\def\docommando##1% % the 12pt alternative will called when
+ {\scratchdimen=#1\relax % typesetting the test (or so)
\scratchdimen=\getvalue{\??ft\s!default##1}\scratchdimen
\normalizebodyfontsize\scratchdimen\to\tempbodyfontsize
- \setevalue{\??ft#2#1##1}{\tempbodyfontsize}%
- %\expanded{\checkbodyfontenvironment[\tempbodyfontsize]}%
- }%
+ \setevalue{\??ft#2#1##1}{\tempbodyfontsize}}%
\processcommalist
[\s!text,\s!script,\s!scriptscript,\c!x,\c!xx,\c!groot,\c!klein]
\docommando
\copyparameters
- [\??ft#2#1][\??ft\s!default]
- [\c!interlinie,\c!em]}%
- \@@beginfontdef
+ [\??ft#2#1][\??ft\s!default]
+ [\c!interlinie,\c!em]}%
+ % \@@beginfontdef
\getparameters[\??ft#2#1][#3]%
\@@endfontdef
- \setvalue{\@size@#2#1}{\docompletefontswitch[#1]}}
+ % new code, see remark
+ \ifloadingfonts \else % only runtime
+ \doifundefined{\@size@#1} % only once
+ {\letvalue{\@size@#1}\empty % prevent loop
+ \defineunknownfont{#1}}% % safeguard
+ \fi
+ % so far
+ \setvalue{\@size@#1}{\docompletefontswitch[#1]}}
+
+%D {\bf Remark:} We need to cover the following cases,
+%D otherwise users can get confused:
+%D
+%D \starttypen
+%D \setupbodyfont[23pt]
+%D
+%D \definebodyfontenvironment[23pt]
+%D \setupbodyfont[23pt]
+%D
+%D \definebodyfontenvironment[23pt]
+%D \definebodyfont[23pt][rm,ss,tt][default]
+%D \setupbodyfont[23pt]
+%D \stoptypen
+
+%D Beware: while some font defs can be global, the bodyfont
+%D environment checks local. This means that multiple local
+%D checks resulting in definitions are not that efficient.
+%D So, apart from an occasional switch, one should define an
+%D environment at the outer level.
\def\checkbodyfontenvironment[#1]%
{\definebodyfontenvironment[\fontclass][#1][]}
@@ -1838,6 +1912,26 @@
\definebodyfont[#1][#2][#3]%
\popmacro\fontclass}
+% \def\dodefinebodyfont[#1][#2][#3]% body|identifier style defs|identifier
+% {\ifthirdargument
+% \doifnumberelse{#1}
+% {\doifassignmentelse{#3}
+% {% [12pt] [style] [settings]
+% \doifundefined{#2}{\expanded{\definefontstyle[#2][#2]}}% new
+% \processcommalist[#1]{\dododefinebodyfont{#2}{#3}}}
+% {% [12pt] [style] [identifier]
+% \dodefinedefaultbodyfont[#1][#2][#3]}} % body style identifier
+% {% [identifier] [style] [settings]
+% \setvalue{\s!default#1#2}##1##2{\expanded{\dodefinebodyfont[##1][##2][#3]}}}%
+% \else\ifsecondargument
+% \definebodyfont[#1][\c!rm][#2]%
+% \else
+% \doifundefined{\@size@#1} % Maybe there are default dependancies
+% {\defineunknownfont{#1}}% defined which we can use ([unknown])
+% \doifundefined{\@size@#1} % and if not, then we have at least to
+% {\definebodyfont[#1][\c!rm][]}% make sure some basics are set up.
+% \fi\fi}
+
\def\dodefinebodyfont[#1][#2][#3]% body|identifier style defs|identifier
{\ifthirdargument
\doifnumberelse{#1}
@@ -1847,8 +1941,8 @@
\processcommalist[#1]{\dododefinebodyfont{#2}{#3}}}
{% [12pt] [style] [identifier]
\dodefinedefaultbodyfont[#1][#2][#3]}} % body style identifier
- {% [identifier] [style] [settings]
- \setvalue{\s!default#1#2}##1##2{\expanded{\dodefinebodyfont[##1][##2][#3]}}}%
+ {% [identifier] [style] [settings] % see ***
+ \setvalue{\s!default#1#2}##1##2{\expanded{\xdodefinebodyfont[##1][##2][#3]}}}%
\else\ifsecondargument
\definebodyfont[#1][\c!rm][#2]%
\else
@@ -1858,6 +1952,27 @@
{\definebodyfont[#1][\c!rm][]}% make sure some basics are set up.
\fi\fi}
+% nested
+%
+% \def\xdodefinebodyfont[#1][#2][#3]% body|identifier style defs|identifier
+% {%\writestatus{[#1]}{[#2][#3]}%
+% \doifnumberelse{#1}
+% {\doifassignmentelse{#3}
+% {% [12pt] [style] [settings]
+% \doifundefined{#2}{\expanded{\definefontstyle[#2][#2]}}% new
+% \processcommalist[#1]{\dododefinebodyfont{#2}{#3}}}
+% {% [12pt] [style] [identifier]
+% \dodefinedefaultbodyfont[#1][#2][#3]}} % body style identifier
+% {% [identifier] [style] [settings]
+% \setvalue{\s!default#1#2}##1##2{\expanded{\xdodefinebodyfont[##1][##2][#3]}}}}
+%
+% faster
+
+\def\xdodefinebodyfont[#1][#2][#3]% body|identifier style defs|identifier
+ {%\writestatus{[#1]}{[#2][#3]}%
+ \doifundefined{#2}{\expanded{\definefontstyle[#2][#2]}}% new
+ \processcommalist[#1]{\dododefinebodyfont{#2}{#3}}}
+
\def\dododefinebodyfont#1#2#3% style defs body
{\checkbodyfontenvironment[#3]% just to be sure.
\processcommalist[#2]{\dodododefinebodyfont{#1}{#3}}}
@@ -1947,8 +2062,11 @@
\let\c!text=\c!savedtext
\ifdone
\donefalse
- \def\defineunknownbodyfont##1%
- {\doifdefined{\s!default##1}{\donetrue\getvalue{\s!default##1}{#1}}}%
+ \def\defineunknownbodyfont##1% see ***
+ %{\doifdefined{\s!default##1}
+ % {\donetrue\getvalue{\s!default##1}{#1}}}%
+ {\doifdefined{\s!default\s!default##1}
+ {\donetrue\getvalue{\s!default\s!default##1}{#1}{##1}}}%
\processcommacommand
[\stylelist]
\defineunknownbodyfont
@@ -1965,6 +2083,9 @@
\definingunknownfontfalse
\fi
\fi
+ \ifdone
+ \showmessage{\m!fonts}{14}{#1}%
+ \fi
\fi}
%D These macros show that quite some definitions take place.
@@ -2144,6 +2265,7 @@
{\getvalue{\@size@#1}%
\localbodyfontsize=#1\relax
\normalizebodyfontsize\localbodyfontsize\to\normalizedbodyfontsize
+\checkbodyfontenvironment[\normalizedbodyfontsize]% added
}% \the\everybodyfont}
{\showmessage{\m!fonts}{4}{#1}}}
@@ -2291,17 +2413,58 @@
\let\defaultfontalternative \c!tf
\let\defaultfontsize \empty
-\def\dosetcurrentfontsize#1%
- {\let\!!stringa\fontsize
- \edef\fontsize{#1}%
- \ifx\!!stringa\fontsize\else
- \synchronizemath
- \synchronizetext
+%D \macros
+%D {bigmath,nobigmath}
+%D
+%D We can inhibit this slow||downer with:
+
+% these can best be combined
+
+% 0=never 1=everymath 2=always
+
+\chardef\synchronizebigmathflag =1
+
+\appendtoks
+ \ifcase\synchronizebigmathflag
+ % never
+ \or
+ \synchronizebigmath
+ \or
+ % always
+ \fi
+\to \everymath
+
+\def\nobigmath{\chardef\synchronizebigmathflag =0 }
+\def\bigmath {\chardef\synchronizebigmathflag =2 \synchronizebigmath}
+
+\let\bigmathfontsize\empty
+
+\def\synchronizebigmath%
+ {\ifx\bigmathfontsize\fontsize
+ % already in sync
+ \else
+ \let\bigmathfontsize\fontsize
+ \synchronizemath \synchronizetext
+ \fi}
+
+\def\checkbigmathsynchronization
+ {\ifcase\synchronizebigmathflag
+ % never
+ \or
+ \ifmmode \synchronizebigmath \fi
+ \or
+ \synchronizebigmath
\fi}
+%D So far for synchronisation.
+
+\def\dosetcurrentfontsize#1%
+ {\edef\fontsize{#1}%
+ \checkbigmathsynchronization}
+
\def\dosetcurrentfontalternative#1%
{\edef\fontalternative{#1}%
- \ifmmode % maybe better no test
+ \ifmmode % maybe no test, or actually, an option
\fam\csname\fontalternative\s!fam\endcsname
\fi}
@@ -2484,7 +2647,7 @@
\def\dosetcurrentfontxxxalternative#1#2#3#4%
{\chardef\currentxfontsize=#2
\ifmmode
- #4%
+ #4%
\else\ifcsname\bodyfontvariable{\normalizedbodyfontsize#3}\endcsname
\setcurrentfontbodyalternative{\bodyfontcsname\normalizedbodyfontsize#3\endcsname}{#1}%
\fi\fi}
@@ -2825,8 +2988,7 @@
{\edef\fontstep{\bodyfontcsname\normalizedbodyfontsize\interfaced#1\endcsname}%
\doswitchpoints[\fontstep]%
\doswitchstyle[\fontstyle]%
-\the\everybodyfont
-}
+ \the\everybodyfont}
\def\setsmallbodyfont{\setbodyfontstep\v!klein}
\def\setbigbodyfont {\setbodyfontstep\v!groot}
@@ -2834,8 +2996,7 @@
\def\setmainbodyfont%
{\doswitchpoints[\normalizedbodyfontsize]%
\doswitchstyle[\fontstyle]%
-\the\everybodyfont
-}
+ \the\everybodyfont}
%D \macros
%D {restoreglobalbodyfont}
@@ -3031,10 +3192,10 @@
%D or even better:
\def\doemphasistypeface#1#2%
- {\doifelsevalue {\??ft\fontclass\normalizedbodyfontsize\c!em}{\v!schuin}{#1}
- {\doifelsevalue {\??ft\fontclass\normalizedbodyfontsize\c!em}{\v!italic}{#2}
- {\doifelsevalue{\??ft \normalizedbodyfontsize\c!em}{\v!schuin}{#1}
- {\doifvalue {\??ft \normalizedbodyfontsize\c!em}{\v!italic}{#2}}}}}
+ {\doifelsevalue{\??ft\fontclass\normalizedbodyfontsize\c!em}\v!schuin#1%
+ {\doifelsevalue{\??ft\fontclass\normalizedbodyfontsize\c!em}\v!italic#2%
+ {\doifelsevalue{\??ft \normalizedbodyfontsize\c!em}\v!schuin#1%
+ {\doifvalue {\??ft \normalizedbodyfontsize\c!em}\v!italic#2}}}}
\def\emphasistypeface{\doemphasistypeface\sl\it}
\def\emphasisboldface{\doemphasistypeface\bs\bi}
@@ -3046,21 +3207,21 @@
\unexpanded\def\em%
{\relax
- \ifdim\fontdimen1\font>\!!zeropoint\relax
+ \ifdim\fontdimen1\font>\zeropoint
\settrue\emneeded
\else
\setfalse\emneeded
\fi
\setemphasisboldface % new
- \ifnum\fam=\itfam
+ \ifx\fontalternative\c!it % \ifnum\fam=\itfam
\def\emphasistypeface{\it}\tf
- \else\ifnum\fam=\slfam
+ \else\ifx\fontalternative\c!sl % \ifnum\fam=\slfam
\def\emphasistypeface{\sl}\tf
- \else\ifnum\fam=\bffam
+ \else\ifx\fontalternative\c!bf % \ifnum\fam=\bffam
\emphasisboldface
- \else\ifnum\fam=\bsfam
+ \else\ifx\fontalternative\c!bs % \ifnum\fam=\bsfam
\def\emphasisboldface{\bs}\bf
- \else\ifnum\fam=\bifam
+ \else\ifx\fontalternative\c!bi % \ifnum\fam=\bifam
\def\emphasisboldface{\bi}\bf
\else
\emphasistypeface
@@ -3079,9 +3240,9 @@
\let\setemphasisboldface\relax
\def\bf%
{\relax
- \ifnum\fam=\itfam
+ \ifx\fontalternative\c!it % \ifnum\fam=\itfam
\bi
- \else\ifnum\fam=\slfam
+ \else\ifx\fontalternative\c!sl % \ifnum\fam=\slfam
\bs
\else
\normalbf
@@ -3260,17 +3421,20 @@
\fetchruntimecommand \showfontstyle {\f!fontprefix\s!run}
%D \macros
-%D {getglyph}
+%D {getglyph, symbolicfont}
%D
%D Individual glyphs can be accessed by using
%D
%D \starttypen
%D \getglyph{fontname}{character}
%D \stoptypen
-%D
+%D
%D This macro is used in for instance the symbol modules and
%D as one can see, it does obey the small and even smaller
-%D sizes.
+%D sizes. The \type {\symbolicfont} macro can be used to
+%D switch to a font named \type {fontname} (see \type
+%D {cont-log} and \type {symb-eur} for examples of symbolic
+%D definitions.
\def\fontstringA%
{\ifx\fontstyle\c!rm \s!Serif \else
@@ -3285,11 +3449,11 @@
\s!Serif \fi\fi\fi}
\def\fontstringC%
- {\ifnum\fam=\bffam \s!Bold \else
- \ifnum\fam=\slfam \s!Slanted \else
- \ifnum\fam=\itfam \s!Italic \else
- \ifnum\fam=\bsfam \s!BoldSlanted \else
- \ifnum\fam=\bifam \s!BoldItalic \s!Regular \fi\fi\fi\fi\fi}
+ {\ifx\fontalternative\c!bf \s!Bold \else
+ \ifx\fontalternative\c!sl \s!Slanted \else
+ \ifx\fontalternative\c!it \s!Italic \else
+ \ifx\fontalternative\c!bs \s!BoldSlanted \else
+ \ifx\fontalternative\c!bi \s!BoldItalic \fi\fi\fi\fi\fi}
\beginETEX \ifcsname
@@ -3326,9 +3490,13 @@
\endTEX
+\def\symbolicfont#1% see cont-log.tex for example usage
+ {\definedfont[\glyphfontfile{#1} sa *]}
+
\def\getglyph#1#2%
%{{\definefont[\s!dummy][\glyphfontfile{#1} sa \currentfontscale]\dummy#2}}
- {{\definefont[\s!dummy][\glyphfontfile{#1} sa *]\dummy#2}}
+ %{{\definefont[\s!dummy][\glyphfontfile{#1} sa *]\dummy#2}}
+ {{\symbolicfont{#1}#2}}
%D The last implementation of \type {\getglyph} permits
%D definitions like:
@@ -3694,6 +3862,9 @@
\definealternativestyle [\v!kleinvetschuin,\v!kleinschuinvet] [\bsx] []
\definealternativestyle [\v!kleinvetitalic,\v!kleinitalicvet] [\bix] []
+\definealternativestyle [\v!kleinkorps] [\setsmallbodyfont] []
+\definealternativestyle [\v!grootkorps] [\setbigbodyfont] []
+
%D We treat {\sc Small Caps} and \kap {Pseudo Caps} a bit
%D different. We also provide an \WOORD {uppercase} style.
@@ -3725,14 +3896,23 @@
%D The next macro is used to map non latin fontnames on
%D fonts. See \type {font-uni} for an example of its use.
-\def\fontstylesuffix%
- {\ifnum\fam=\tffam \s!Regular \else
- \ifnum\fam=\bffam \s!Bold \else
- \ifnum\fam=\slfam \s!Slanted \else
- \ifnum\fam=\itfam \s!Italic \else
- \ifnum\fam=\bsfam \s!BoldSlanted \else
- \ifnum\fam=\bifam \s!BoldItalic \else
- \s!Regular \fi\fi\fi\fi\fi\fi}%
+%\def\fontstylesuffix%
+% {\ifnum\fam=\tffam \s!Regular \else
+% \ifnum\fam=\bffam \s!Bold \else
+% \ifnum\fam=\slfam \s!Slanted \else
+% \ifnum\fam=\itfam \s!Italic \else
+% \ifnum\fam=\bsfam \s!BoldSlanted \else
+% \ifnum\fam=\bifam \s!BoldItalic \else
+% \s!Regular \fi\fi\fi\fi\fi\fi}%
+
+\def\fontstylesuffix% why the \s!Regular ? see \getglyph
+ {\ifx\fontalternative\c!tf \s!Regular \else
+ \ifx\fontalternative\c!bf \s!Bold \else
+ \ifx\fontalternative\c!sl \s!Slanted \else
+ \ifx\fontalternative\c!it \s!Italic \else
+ \ifx\fontalternative\c!bs \s!BoldSlanted \else
+ \ifx\fontalternative\c!bi \s!BoldItalic \else
+ \s!Regular \fi\fi\fi\fi\fi\fi}%
%D We still have to take care of \type{\xi}, so:
diff --git a/tex/context/base/hand-ini.tex b/tex/context/base/hand-ini.tex
index 248ec401e..e41a2f209 100644
--- a/tex/context/base/hand-ini.tex
+++ b/tex/context/base/hand-ini.tex
@@ -96,7 +96,7 @@
{\ifskipprotrudingdef \else
\doifelsenothing{#2}
{\doifnumberelse{\string#1}
- {\dododefineprotrudefactor{#1}{#3}{#4}}
+ {\dododefineprotrudefactor {#1}{#3}{#4}}
{\dododefineprotrudefactor{`#1}{#3}{#4}}}
{\pushmacro\char \let\char\empty
\doifnumberelse{\csname#1#2\endcsname}
diff --git a/tex/context/base/java-fld.tex b/tex/context/base/java-fld.tex
index 0ce30f8fc..fc78e4c93 100644
--- a/tex/context/base/java-fld.tex
+++ b/tex/context/base/java-fld.tex
@@ -211,51 +211,8 @@ function Forget_Changes ()
\definereference[ForgetChanges][JS(Forget_Changes)]
-% \startJSpreamble {Walk_Field} used later
-%
-% function Walk_Field ( FieldSet )
-% { var i = 1 ;
-% while (true)
-% { v = this.getField(FieldSet+":"+i) ;
-% if (v)
-% { if (v.value=="On")
-% { v.value = "Off" ;
-% var ii = i ; ii++ ;
-% v = this.getField(FieldSet+":"+ii) ;
-% if (!v)
-% { v = this.getField(FieldSet+":"+1) }
-% if (v)
-% { v.value = "On" }
-% break }
-% i++ }
-% else
-% { break } } }
-%
-% \stopJSpreamble
-%
-% \startJScode {Walk_Field} uses {Walk_Field}
-% Walk_Field (JS_S_1) ;
-% \stopJScode
-%
-% \startJSpreamble {Set_Field} used later
-%
-% function Set_Field ( FieldSet, FieldName )
-% { var i = 1 ;
-% while (true)
-% { v = this.getField(FieldSet+":"+i) ;
-% if (!v)
-% { break }
-% else if (i==FieldName)
-% { v.value = "On" }
-% else
-% { v.value = "Off" }
-% i++ } }
-%
-% \stopJSpreamble
-%
-% \startJScode {Set_Field} uses {Set_Field}
-% Set_Field (JS_S_1,JS_S_2) ;
-% \stopJScode
+% This can be done more efficient, by keeping track of the
+% current top of the stack.
\startJSpreamble {FieldStack} used later
diff --git a/tex/context/base/java-ini.tex b/tex/context/base/java-ini.tex
index 45ef677a5..ebe9698a6 100644
--- a/tex/context/base/java-ini.tex
+++ b/tex/context/base/java-ini.tex
@@ -629,9 +629,11 @@
\definespeciallocation{JS}#1#2%
{\iflocation
\bgroup
+\bgroup
\presetJScode
\currentreferenceoperation
\currentreferencearguments
+\egroup
\dostartgoto
\data
{#2}%
diff --git a/tex/context/base/lang-ita.tex b/tex/context/base/lang-ita.tex
index 0f5d3a1ac..d933ba005 100644
--- a/tex/context/base/lang-ita.tex
+++ b/tex/context/base/lang-ita.tex
@@ -59,13 +59,15 @@
\installlanguage [sp] [\s!es] % old times context
+% Note GB left|/|right (sub)sentences are for \quote {incisi}.
+
\installlanguage
[\s!it]
[\c!spatiering=\v!opelkaar,
- \c!leftsentence=\leftguillemot,
- \c!rightsentence=\rightguillemot,
- \c!leftsubsentence=\leftsubguillemot,
- \c!rightsubsentence=\rightsubguillemot,
+ \c!leftsentence=---,
+ \c!rightsentence=---,
+ \c!leftsubsentence=--,
+ \c!rightsubsentence=--,
\c!leftquote=\upperleftsinglesixquote,
\c!rightquote=\upperrightsingleninequote,
\c!leftquotation=\upperleftdoublesixquote,
diff --git a/tex/context/base/lang-sla.tex b/tex/context/base/lang-sla.tex
index 35eb7c2bd..1b3dd3d3e 100644
--- a/tex/context/base/lang-sla.tex
+++ b/tex/context/base/lang-sla.tex
@@ -53,10 +53,10 @@
\c!rightsentence=---,
\c!leftsubsentence=---,
\c!rightsubsentence=---,
- \c!leftquote=\upperleftsinglesixquote,
- \c!rightquote=\upperrightsingleninequote,
- \c!leftquotation=\upperleftdoublesixquote,
- \c!rightquotation=\upperrightdoubleninequote,
+ \c!leftquote=\lowerleftsingleninequote,
+ \c!rightquote=\upperrightsinglesixquote,
+ \c!leftquotation=\lowerleftdoubleninequote,
+ \c!rightquotation=\upperrightdoublesixquote,
\c!datum={\v!dag,\ ,\v!maand,\ ,\v!jaar},
\c!status=\v!stop]
diff --git a/tex/context/base/m-chart.tex b/tex/context/base/m-chart.tex
index e4b84abc1..3cd670d2c 100644
--- a/tex/context/base/m-chart.tex
+++ b/tex/context/base/m-chart.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% to do: \localpushmacro/\localpopmacro (dosetflowchart etc)
+% to do: \localpushmacro/\localpopmacro (dohandleflowchart etc)
%D This is an experimental module. Pieces of code will be moved
%D to other modules. More features are possible but will be
@@ -190,12 +190,22 @@
\dodoubleempty\dostartFLOWchart}
\def\dostartFLOWchart[#1][#2]%
+ {\preparenextFLOWchart{#1}{#2}%
+ \dostartbuffer[\FLOWbufferprefix\nofFLOWcharts][startFLOWchart][stopFLOWchart]}
+
+\def\defineFLOWchart%
+ {\dodoubleempty\dodefineFLOWchart}
+
+\long\def\dodefineFLOWchart[#1][#2]#3%
+ {\preparenextFLOWchart{#1}{#2}%
+ \setbuffer[\FLOWbufferprefix\nofFLOWcharts]#3\endbuffer}
+
+\def\preparenextFLOWchart#1#2%
{\doglobal\increment\nofFLOWcharts
\flowchart{#1}%
\setxvalue{\@FLOW@-#1}%
- {\noexpand\dosetFLOWchart[\nofFLOWcharts][#2]}%
- \dostartbuffer[\FLOWbufferprefix\nofFLOWcharts][startFLOWchart][stopFLOWchart]}
-
+ {\noexpand\dohandleflowchart[\nofFLOWcharts][#2]}}
+
\def\setupFLOWcharts{\dodoubleargument\getparameters[\@@FLOW]}
\def\setupFLOWlines {\dodoubleargument\getparameters[\@@FLOL]}
\def\setupFLOWshapes{\dodoubleargument\getparameters[\@@FLOS]}
@@ -270,20 +280,42 @@
\increment(\includeFLOWy,0\FLOWiy)\decrement\includeFLOWy
\def\dodoincludeFLOWchart##1%
{\doifdefined{\@FLOW@-##1}
- {\pushmacro\dosetFLOWchart
- \gdef\dosetFLOWchart[####1][####2]%
- {\popmacro\dosetFLOWchart
+ {\pushmacro\dohandleflowchart
+ \gdef\dohandleflowchart[####1][####2]%
+ {\popmacro\dohandleflowchart
+ \resetFLOWlocation
\haalbuffer[\FLOWbufferprefix####1]}%
\getvalue{\@FLOW@-##1}}}%
\processcommalist[#1]\dodoincludeFLOWchart
\popmacro\includeFLOWx
\popmacro\includeFLOWy}
-\def\setFLOWlocation#1,#2\end%
- {\scratchcounter=0#1\advance\scratchcounter\includeFLOWx
- \xdef\FLOWlocation{\the\scratchcounter}%
- \scratchcounter=0#2\advance\scratchcounter\includeFLOWy
- \xdef\FLOWlocation{\FLOWlocation,\the\scratchcounter}}
+%\def\setFLOWlocation#1,#2\end%
+% {\scratchcounter=0#1\advance\scratchcounter\includeFLOWx
+% \xdef\FLOWlocation{\the\scratchcounter}%
+% \scratchcounter=0#2\advance\scratchcounter\includeFLOWy
+% \xdef\FLOWlocation{\FLOWlocation,\the\scratchcounter}}
+
+\def\resetFLOWlocation%
+ {\gdef\lastFLOWx{0}%
+ \gdef\lastFLOWy{0}}
+
+\def\dosetFLOWlocation[#1#2]#3#4%
+ {\processaction
+ [#1#2]
+ [ +=>\scratchcounter=#4\advance\scratchcounter+1,
+ -=>\scratchcounter=#4\advance\scratchcounter-1,
+ +#2=>\scratchcounter=#4\advance\scratchcounter+#2,
+ -#2=>\scratchcounter=#4\advance\scratchcounter-#2,
+ \s!default=>\scratchcounter=#4,
+ \s!unknown=>\scratchcounter=0#1#2]%
+ \advance\scratchcounter#3%
+ \xdef#4{\the\scratchcounter}}
+
+\def\setFLOWlocation#1,#2\end
+ {\dosetFLOWlocation[#1\empty]\includeFLOWx\lastFLOWx
+ \dosetFLOWlocation[#2\empty]\includeFLOWy\lastFLOWy
+ \xdef\FLOWlocation{\lastFLOWx,\lastFLOWy}}
\def\FLOWshapes%
{node, action, procedure, product, decision, archive,
@@ -339,10 +371,11 @@
\def\dodogetFLOWchart[#1][#2]% to be split a bit more
{\vbox\bgroup
+ \insidefloattrue
\forgetall
\dontcomplain
\offinterlineskip
- \def\dosetFLOWchart[##1][##2]%
+ \def\dohandleflowchart[##1][##2]%
{\def\currentFLOWnumber{##1}%
\getparameters[\@@FLOW][##2]}%
\getvalue{\@FLOW@-#1}%
@@ -353,6 +386,7 @@
\let\FLOWwidth \@@FLOWnx
\let\FLOWheight\@@FLOWny
\let\startFLOWcell\startFLOWcellA
+ \resetFLOWlocation
\haalbuffer[\FLOWbufferprefix\currentFLOWnumber]%
\ifcase\@@FLOWnx\relax \let\@@FLOWnx\FLOWwidth \fi
\ifcase\@@FLOWny\relax \let\@@FLOWny\FLOWheight \fi
@@ -458,6 +492,7 @@
% \expandafter\getFLOWlocationX\FLOWlocation\end
% \ignorespaces}%
% \let\startFLOWcell\startFLOWcellX
+% \resetFLOWlocation
% \haalbuffer[\FLOWbufferprefix\currentFLOWnumber]%
% \ifnum\@@FLOWnx\@@FLOWny=11 % listig
% \let\@@FLOWnx\FLOWwidth
@@ -492,8 +527,10 @@
show_\@@FLOWpunt_points := true ;
\stopMPdrawing]%
\let\startFLOWcell\startFLOWcellB
+ \resetFLOWlocation
\haalbuffer[\FLOWbufferprefix\currentFLOWnumber]%
\let\startFLOWcell\startFLOWcellC
+ \resetFLOWlocation
\haalbuffer[\FLOWbufferprefix\currentFLOWnumber]%
\startMPdrawing
clip_chart(\@@FLOWx,\@@FLOWy,\@@FLOWnx,\@@FLOWny) ;
@@ -515,14 +552,16 @@
\doglobal\newcounter\FLOWcomment
\let\startFLOWcell\startFLOWcellD
\setbox2=\vbox to \ht0
- {\forgetall%%%\offinterlineskip
+ {\forgetall % \offinterlineskip
+ \resetFLOWlocation
\haalbuffer[\FLOWbufferprefix\currentFLOWnumber]\vss}%
\setbox2=\hbox
{\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box2}%
\wd2=\wd0\ht2=\ht0\dp2=\dp0
\let\startFLOWcell\startFLOWcellE
\setbox4=\vbox to \ht0
- {\forgetall%%%\offinterlineskip
+ {\forgetall % \offinterlineskip
+ \resetFLOWlocation
\haalbuffer[\FLOWbufferprefix\currentFLOWnumber]\vss}%
\setbox4=\hbox
{\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box4}%
@@ -589,8 +628,8 @@
% empty and we don't want to redefine \@FLOC@ itself by
% mistake
-\long\def\startFLOWcellB#1\stopFLOWcell%
- {\resetFLOWcell\ignorespaces#1\unskip%
+\long\def\startFLOWcellB#1\stopFLOWcell
+ {\resetFLOWcell\ignorespaces#1\unskip
\setxvalue{\@FLOC@-\FLOWname}{\FLOWlocation}% kost veel cs's
\ifx\FLOWshape\empty
\global\let\FLOWshape\@@FLOSdefault
@@ -639,7 +678,11 @@
\long\def\startFLOWcellC#1\stopFLOWcell%
{\resetFLOWcell
+\pushmacro\lastFLOWx
+\pushmacro\lastFLOWy
\ignorespaces#1\unskip % makes sure that vars are set
+\popmacro\lastFLOWy
+\popmacro\lastFLOWx
\let\connection\doFLOWconnectionC
\ignorespaces#1\unskip}
@@ -684,7 +727,11 @@
\long\def\startFLOWcellD#1\stopFLOWcell%
{\resetFLOWcell
+\pushmacro\lastFLOWx
+\pushmacro\lastFLOWy
\ignorespaces#1\unskip % presets vars
+\popmacro\lastFLOWy
+\popmacro\lastFLOWx
\let\doprocessFLOWcell\doprocessFLOWcellD
\expandafter\doprocessFLOWcellD\FLOWlocation\end
\let\connection\doFLOWconnectionD
@@ -833,7 +880,7 @@
% Pass E
-\long\def\startFLOWcellE#1\stopFLOWcell%
+\long\def\startFLOWcellE#1\stopFLOWcell
{\resetFLOWcell
\ignorespaces#1\unskip
\let\doprocessFLOWcell\doprocessFLOWcellE
@@ -892,6 +939,7 @@
\def\@@FLOWmaxx {0}\let\@@FLOWmaxy\@@FLOWmaxx
\def\@@FLOWabsx {0}\let\@@FLOWabsy\@@FLOWabsx
\let\startFLOWcell\startFLOWcellF
+ \resetFLOWlocation
\haalbuffer[\FLOWbufferprefix\currentFLOWnumber]%
%\message{AUTOSHAPE 1: (\@@FLOWminx,\@@FLOWminy)->(\@@FLOWmaxx,\@@FLOWmaxy)}%
\ifnum\@@FLOWabsx<\@@FLOWmaxx\let\@@FLOWmaxx\@@FLOWabsx\fi
@@ -979,7 +1027,7 @@
{\setbox#1=\hbox
{\setbox\scratchbox=\hbox{\lower\@@FLOWdy\hbox
{\helpbutton
- [\c!breedte=\wd0,\c!kleur=,\c!hoogte=\@@FLOWdy,\c!kader=\v!nee]
+ [\c!breedte=\wd0,\c!kleur=,\c!hoogte=\@@FLOWdy,\c!kader=\v!nee]%
[\FLOWhelp]}}%
\smashbox\scratchbox
\setbox#1=\vbox
@@ -995,14 +1043,15 @@
{\setbox\scratchbox=\vbox
{\xdef\FLOWmaxwidth {0}%
\xdef\FLOWmaxheight{0}%
- \def\getFLOWlocation##1,##2\end%
+ \def\getFLOWlocation##1,##2\end
{\ifnum0##1>\FLOWmaxwidth \xdef\FLOWmaxwidth {##1}\fi
\ifnum0##2>\FLOWmaxheight\xdef\FLOWmaxheight{##2}\fi}%
\resetFLOWcell
- \long\def\startFLOWcell##1\stopFLOWcell%
+ \long\def\startFLOWcell##1\stopFLOWcell
{{##1\expandafter\getFLOWlocation\FLOWlocation\end}}%
- \def\dosetFLOWchart[##1][##2]%
- {\haalbuffer[\FLOWbufferprefix##1]}%
+ \def\dohandleflowchart[##1][##2]%
+ {\resetFLOWlocation
+ \haalbuffer[\FLOWbufferprefix##1]}%
\getvalue{\@FLOW@-#1}}}
\def\setupFLOWsplit%
@@ -1113,7 +1162,7 @@
\def\typeFLOWchart[#1]%
{\bgroup
- \def\dosetFLOWchart[##1][##2]{\typebuffer[\FLOWbufferprefix##1]}%
+ \def\dohandleflowchart[##1][##2]{\typebuffer[\FLOWbufferprefix##1]}%
\convertargument\startFLOWchart[#1]\to\firstverbatimfileline
\convertargument \stopFLOWchart\to\lastverbatimfileline
\getvalue{\@FLOW@-#1}
@@ -1136,7 +1185,7 @@
%D \handleFLOWset[convert-en] % [tag]
%D
%D \def\Whow#1%
-%D {\stelhoofdin[status=hoog]
+%D {\setuphead[status=hoog]
%D \startstandardmakeup
%D \centerbox{#1}
%D \stopstandardmakeup}
@@ -1190,6 +1239,34 @@
\setupFLOWsets
[\c!commando=]
+%D The XML interface [will be mode protected or separate x-chart file]
+
+\defineXMLargument [flowchartdefinition]
+ {\defineFLOWchart[\XMLpar{flowchartdefinition}{identifier}{unknown}]}
+
+\defineXMLpickup [flowcell]
+ {\startFLOWcell
+ \defineXMLargument[name]{\unspaceafter\name}%
+ \defineXMLargument[shape]{\unspaceafter\shape}%
+ \defineXMLnestedargument[text]{\text}}
+ {\stopFLOWcell}
+
+\defineXMLenvironment [location] % global unspace/store
+ {\bgroup\defineXMLpush[x]\defineXMLpush[y]}
+ {\XMLunspace{x}\XMLunspace{y}%
+ \expanded{\egroup\noexpand\location{\XMLpop{x},\XMLpop{y}}}}
+
+\defineXMLenvironment [connection]
+ {\bgroup\defineXMLpush[type]\defineXMLpush[name]}%
+ {\XMLunspace{type}\XMLunspace{name}%
+ \expanded{\egroup\noexpand\connection[\XMLpop{type}]{\XMLpop{name}}}}
+
+\defineXMLsingular [flowchart]
+ {\expanded{\FLOWchart[\XMLpar{flowchart}{identifier}{unknown}]}}
+
+\defineXMLdirective [flowchart] [shapes] \setupFLOWshapes
+\defineXMLdirective [flowchart] [lines] \setupFLOWlines
+
\protect
\endinput
diff --git a/tex/context/base/m-mathml.tex b/tex/context/base/m-mathml.tex
index 471aa4770..f9caf56d3 100644
--- a/tex/context/base/m-mathml.tex
+++ b/tex/context/base/m-mathml.tex
@@ -20,9 +20,27 @@
\useXMLfilter[mml,mmp,mmc]
-%D And finaly we load the whole bunch of entities:
+%D And we also load the whole bunch of entities:
% \useXMLfilter[mea,meb,mec,meh,men,meo,mer]
% \useXMLfilter[mxa,mxb,mxc,mxh,mxn,mxo,mxr]
+%D For simple inline math, we first provide:
+
+% todo : nesting ! ! ! !
+
+\newcount\xmlmathlevel
+
+\defineXMLenvironment [m]
+ {\ifmmode
+ \advance\xmlmathlevel1\relax
+ \else
+ \xmlmathlevel1$%
+ \fi}
+ {\ifcase\xmlmathlevel\or
+ $\xmlmathlevel0\relax
+ \else
+ \advance\xmlmathlevel-1\relax
+ \fi}
+
\endinput
diff --git a/tex/context/base/m-steps.tex b/tex/context/base/m-steps.tex
new file mode 100644
index 000000000..c5c660924
--- /dev/null
+++ b/tex/context/base/m-steps.tex
@@ -0,0 +1,885 @@
+%D \module
+%D [ file=m-steps,
+%D version=2001.05.28,
+%D title=\CONTEXT\ Modules,
+%D subtitle=Step Charts \& Tables,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE / 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.
+
+\unprotect
+
+% temp hack :
+
+% \ifx\v!kleinkorps\undefined \let\v!kleinkorps\setsmallbodyfont \fi
+
+% end of hack
+
+\definecolor [STEPlinecolor] [s=.5]
+\definecolor [STEPframecolor] [s=.7]
+\definecolor [STEPbackgroundcolor] [s=.9]
+
+\def\@@STPF{@@STPF} % frames
+
+\def\@@STPC{@@STPC} % charts
+\def\@@STPT{@@STPT} % tables
+
+\def\@@STEC{@@STEC} % cells
+\def\@@STET{@@STET} % tables
+\def\@@STEL{@@STEL} % lines
+
+\def\setupSTEPcharts{\dodoubleargument\getparameters[\@@STPC]}
+\def\setupSTEPtables{\dodoubleargument\getparameters[\@@STPT]}
+\def\setupSTEPcells {\dodoubleargument\getparameters[\@@STEC]}
+\def\setupSTEPtexts {\dodoubleargument\getparameters[\@@STET]}
+\def\setupSTEPlines {\dodoubleargument\getparameters[\@@STEL]}
+
+\setupSTEPcharts
+ [\c!voor=\blanko,
+ \c!na=\blanko,
+ %\c!afstand=.25em, % nvt
+ \c!hoffset=1em,
+ \c!voffset=1ex,
+ \c!methode=1,
+ \c!hoogte=2ex,
+ \c!offset=.15\bodyfontsize]
+
+\setupSTEPtables
+ [\c!voor=\blanko,
+ \c!na=\blanko,
+ \c!afstand=.25em,
+ %\c!hoffset=1em, % nvt
+ \c!voffset=1ex,
+ \c!methode=1,
+ \c!breedte=4em,
+ \c!offset=.15\bodyfontsize]
+
+\setupSTEPcells
+ [\c!variant=24,
+ \c!achtergrond=\v!kleur,
+ \c!achtergrondkleur=STEPbackgroundcolor,
+ \c!lijndikte=.1\bodyfontsize,
+ \c!kaderkleur=STEPframecolor,
+ \c!offset=.25\bodyfontsize,
+ \c!letter=,
+ \c!kleur=]
+
+\setupSTEPtexts
+ [\c!variant=24,
+ \c!achtergrond=\v!kleur,
+ \c!achtergrondkleur=STEPbackgroundcolor,
+ \c!lijndikte=.1\bodyfontsize,
+ \c!kaderkleur=STEPframecolor,
+ \c!offset=.25\bodyfontsize,
+ \c!letter=\v!kleinkorps,
+ \c!kleur=]
+
+\setupSTEPlines
+ [\c!variant=1,
+ \c!lijndikte=.15\bodyfontsize,
+ \c!kleur=STEPlinecolor]
+
+\def\initializeSTEP
+ {\initializeSTET \initializeSTEC \initializeSTEL}
+
+\def\initializeSTPC
+ {\freezedimenmacro\@@STPCoffset
+ \startMPdrawing
+ line_v_offset := \@@STPCoffset ;
+ line_method := \@@STPCmethode ; % only charts
+ \stopMPdrawing}
+
+\def\initializeSTPT
+ {\freezedimenmacro\@@STPToffset
+ \startMPdrawing
+ line_h_offset := \@@STPToffset ;
+ line_method := \@@STPTmethode ; % only charts
+ \stopMPdrawing}
+
+\def\initializeSTET
+ {\freezedimenmacro\@@STETlijndikte
+ \freezedimenmacro\@@STEToffset}
+
+\def\initializeSTEC
+ {\freezedimenmacro\@@STEClijndikte
+ \freezedimenmacro\@@STECoffset}
+
+\def\initializeSTEL
+ {\freezedimenmacro\@@STELlijndikte}
+
+%D ...
+
+\defineXMLdirective [stepchart] [charts] \setupSTEPcharts
+\defineXMLdirective [stepchart] [cells] \setupSTEPcells
+\defineXMLdirective [stepchart] [texts] \setupSTEPtexts
+\defineXMLdirective [stepchart] [lines] \setupSTEPlines
+
+\defineXMLdirective [steptable] [tables] \setupSTEPtables
+\defineXMLdirective [steptable] [cells] \setupSTEPcells
+\defineXMLdirective [steptable] [texts] \setupSTEPtexts
+\defineXMLdirective [steptable] [lines] \setupSTEPlines
+
+%D ...
+
+\presetlocalframed[\@@STPF]
+
+\def\@@stepcell#1%
+ {\doattributes\@@STEC\c!letter\c!kleur
+ {\localframed
+ [\@@STPF][\c!offset=\@@STECoffset,\c!kader=\v!uit]
+ {\ignorespaces#1\unskip}}}
+
+\def\@@stepfake#1%
+ {\doattributes\@@STEC\c!letter\c!kleur
+ {\ignorespaces#1\unskip}}
+
+\def\@@steptext#1%
+ {\doattributes\@@STET\c!letter\c!kleur
+ {\localframed
+ [\@@STPF][\c!offset=\@@STEToffset,\c!kader=\v!uit]
+ {\ignorespaces#1\unskip}}}
+
+%D The first attempt was purely \METAPOST\ based and spawned
+%D the typesetting to the \METAFUN\ handler. This method
+%D collects the cells, and directly passes them on to
+%D \METAPOST. This method is the cleanest, but has the
+%D disadvantage that one cannot embed hyperlinks or document
+%D dependent definitions in the cells. The implementation
+%D roughly looks as follows:
+%D
+%D \starttypen
+%D \def\startSTEPchart%
+%D {\bgroup
+%D \startMPdrawing
+%D input mp-step ; begin_step_chart ;
+%D \stopMPdrawing
+%D \initializeSTEP
+%D \let\cells\stepchartcells \def\cell{\cells{}}%
+%D \let\texts\stepcharttexts \def\text{\texts{}}}
+%D
+%D \def\stepchartcells#1#2%
+%D {\setMPtext{tdummy}{\strut\ignorespaces#1\unskip}% beter etex/btex
+%D \setMPtext{bdummy}{\strut\ignorespaces#2\unskip}% beter etex/btex
+%D \startMPdrawing
+%D set_step_chart_cells(\MPstring{tdummy},\MPstring{bdummy}) ;
+%D \stopMPdrawing}
+%D
+%D \def\stepcharttexts#1#2%
+%D {\setMPtext{tdummy}{\strut\ignorespaces#1\unskip}% beter etex/btex
+%D \setMPtext{bdummy}{\strut\ignorespaces#2\unskip}% beter etex/btex
+%D \startMPdrawing
+%D set_step_chart_texts(\MPstring{tdummy},\MPstring{bdummy}) ;
+%D \stopMPdrawing}
+%D
+%D \def\stopSTEPchart
+%D {\startMPdrawing
+%D end_step_chart ;
+%D \stopMPdrawing
+%D \MPdrawingdonetrue
+%D \getMPdrawing
+%D \resetMPdrawing
+%D \egroup}
+%D \stoptypen
+%D
+%D This method has the advantage that it does the job in
+%D (virtually) one pass, while the next methods need multiple
+%D passes: one to build the table, another to synchronize the
+%D positions, and a third one beause the dimensions may have
+%D changed. The last pass is a result from the fact that
+%D positions are related to the page.
+%D
+%D The second attempt was based on tabulations and used the
+%D build in position tracking mechanism, which uses two
+%D position nodes per cell.
+%D
+%D This method collects the content in token list registers
+%D and build a table from them. In the collecting pass, the
+%D graphics are build stepwise. We need to collect because the
+%D order of definitions is not the same as the order of
+%D typesetting. We show this alternative too because it
+%D demonstrates how to apply backgrounds to table cells.
+%D
+%D \starttypen
+%D \newtoks\stepsonetop \newtoks\stepstwotop
+%D \newtoks\stepsonebot \newtoks\stepstwobot
+%D \stoptypen
+%D
+%D During the collecting phase, we temporarily have to
+%D increment the name space counter.
+%D
+%D \starttypen
+%D \def\startSTEPchart%
+%D {\bgroup
+%D \resetMPdrawing
+%D \increment\noftabpositions % begin of preroll
+%D \startMPdrawing
+%D input mp-step ;
+%D begin_step_chart ;
+%D \stopMPdrawing
+%D \initializeSTEP
+%D \newcounter\cellcounter
+%D \stepsonetop\emptytoks \chardef\somesteponetop=1
+%D \stepsonebot\emptytoks \chardef\somesteponebot=1
+%D \stepstwotop\emptytoks \chardef\somesteptwotop=1
+%D \stepstwobot\emptytoks \chardef\somesteptwobot=1
+%D \let\cells\stepchartcells \def\cell{\cells{}}%
+%D \let\texts\stepcharttexts \def\text{\texts{}}}
+%D \stoptypen
+%D
+%D Now we collect the steps and texts, and in the process the
+%D graphic is built. Then we continue with building the table.
+%D
+%D Watch how we anchor the graphic to the main table box. This
+%D is needed since the graphic may be larger than the table
+%D itself. Actually, these small point took me the most time to
+%D digest, even with the right tools (anchors) already in
+%D place.
+%D
+%D \starttypen
+%D \def\stopSTEPchart
+%D {\splittabulatefalse
+%D \insidefloattrue
+%D \startMPdrawing
+%D nofcells := \cellcounter ;
+%D end_step_chart ;
+%D anchor_box(\MPpos{\tbPOSprefix origin}) ;
+%D \stopMPdrawing
+%D \MPdrawingdonetrue
+%D \decrement\noftabpositions % end of preroll
+%D \setbox0=\vbox
+%D {\getMPdrawing}
+%D \resetMPdrawing
+%D \increment(\cellcounter,\cellcounter)\decrement\cellcounter
+%D \setbox2=\vbox
+%D {\definetabulate[chart][|*{\cellcounter}{ck0|}] % k0 nills space
+%D \startchart
+%D \ifcase\somesteptwotop \the\stepstwotop \NC \NR \noalign{\kern2ex} \fi
+%D \ifcase\somesteponetop \the\stepsonetop \NC \NR \noalign{\kern2ex} \fi
+%D \ifcase\somesteponebot \the\stepsonebot \NC \NR \noalign{\kern2ex} \fi
+%D \ifcase\somesteptwobot \the\stepstwobot \NC \NR \noalign{\kern2ex} \fi
+%D \noalign{\kern-2ex}%
+%D \stopchart}
+%D \hbox
+%D {\scratchdimen\wd0
+%D \advance\scratchdimen \MPllx bp
+%D \raise\MPlly bp\box0
+%D \hskip-\scratchdimen
+%D \hpos{\tbPOSprefix origin}{\box2}}
+%D \egroup}
+%D \stoptypen
+%D
+%D The steps and texts fill the (at most 4) lines that make up
+%D the table. We also feed the (automatically registerd) cell
+%D dimensions to the graphic backend.
+%D
+%D \starttypen
+%D \newcounter\cellcounter
+%D \newcounter\textcounter
+%D
+%D \def\stepchartcells#1#2%
+%D {\doloop
+%D {\ifnum\cellcounter>\textcounter
+%D \stepcharttexts{}{}%
+%D \else
+%D \exitloop
+%D \fi}%
+%D \increment\cellcounter
+%D \doifelsenothing{#1}
+%D {\startMPdrawing
+%D cells[t][\cellcounter] := origin ;
+%D \stopMPdrawing
+%D \appendtoks\NC\NC\to\stepsonetop}
+%D {\chardef\somesteponetop=0
+%D \edef\stepidentifier{\cellcounter-t-c}%
+%D \startMPdrawing
+%D initialize_area(\MPpos{b:\tbPOSprefix\stepidentifier},
+%D \MPpos{e:\tbPOSprefix\stepidentifier}) ;
+%D cells[t][\cellcounter] := pxy ;
+%D \stopMPdrawing
+%D \@EA\appendtoks\@EA\stepidentifierposition\@EA{\stepidentifier}#1\NC\to\stepsonetop}%
+%D \doifelsenothing{#2}
+%D {\startMPdrawing
+%D cells[b][\cellcounter] := origin ;
+%D \stopMPdrawing
+%D \appendtoks\NC\NC\to\stepsonebot}
+%D {\chardef\somesteponebot=0
+%D \edef\stepidentifier{\cellcounter-b-c}%
+%D \startMPdrawing
+%D initialize_area(\MPpos{b:\tbPOSprefix\stepidentifier},
+%D \MPpos{e:\tbPOSprefix\stepidentifier}) ;
+%D cells[b][\cellcounter] := pxy ;
+%D \stopMPdrawing
+%D \@EA\appendtoks\@EA\stepidentifierposition\@EA{\stepidentifier}#2\NC\to\stepsonebot}}
+%D
+%D \def\stepcharttexts#1#2% \cellcounter = nofcells
+%D {\increment\textcounter
+%D \doifelsenothing{#1}
+%D {\startMPdrawing
+%D texts[t][\cellcounter][\textcounter] := origin ;
+%D \stopMPdrawing
+%D \appendtoks\NC\NC\to\stepstwotop}
+%D {\chardef\somesteptwotop=0
+%D \edef\stepidentifier{\cellcounter-\textcounter-t-t}%
+%D \startMPdrawing
+%D initialize_area(\MPpos{b:\tbPOSprefix\stepidentifier},
+%D \MPpos{e:\tbPOSprefix\stepidentifier}) ;
+%D texts[t][\cellcounter][\textcounter] := pxy ;
+%D \stopMPdrawing
+%D \@EA\appendtoks\@EA\NC\@EA\textcellposition\@EA{\stepidentifier}#1\to\stepstwotop}%
+%D \doifelsenothing{#2}
+%D {\startMPdrawing
+%D texts[b][\cellcounter][\textcounter] := origin ;
+%D \stopMPdrawing
+%D \appendtoks\NC\NC\to\stepstwobot}
+%D {\chardef\somesteptwobot=0
+%D \edef\stepidentifier{\cellcounter-\textcounter-b-t}%
+%D \startMPdrawing
+%D initialize_area(\MPpos{b:\tbPOSprefix\stepidentifier},
+%D \MPpos{e:\tbPOSprefix\stepidentifier}) ;
+%D texts[b][\cellcounter][\textcounter] := pxy ;
+%D \stopMPdrawing
+%D \@EA\appendtoks\@EA\NC\@EA\textcellposition\@EA{\stepidentifier}#2\to\stepstwobot}}
+%D \stoptypen
+%D
+%D Here are the hooks that take care of calculating the cell
+%D dimensions.
+%D
+%D \starttypen
+%D \def\textcellposition#1{\GSC[#1:text]}
+%D \def\stepidentifierposition#1{\GSC[#1:step]}
+%D \stoptypen
+%D
+%D We abandoned this method after some testing and went for
+%D a third one. It was this third method that evolved into the
+%D current mechanism.
+%D
+%D Since this method was not that efficient, a third one was
+%D implemented, which used one position per cell. So,
+%D
+%D \blanko {\bf Here starts the real implementation!} \blanko
+%D
+%D Because we want to build one graphic only we need to store
+%D the graphic directives. We also need to collect the cells,
+%D which are not defined in the order they show up. This
+%D solution uses multiple passes over the definitions. First
+%D the cells and texts are processed and the associated
+%D graphics are defined in the \METAPOST\ file. Next the
+%D lines are flushed. We need to do that in a second pass,
+%D because in order to determine the nature of the line,
+%D \METAPOST\ needs to know if the start and end cells exist.
+%D This need comes from the fact that we store the shapes
+%D and lines kind of directly with their associated colors and
+%D types, so that we can change the settings in between. So,
+%D changing for instance the line color, can take place
+%D locally.
+
+\newbox\stepboxone \newbox\stepboxtwo
+\newbox\textboxone \newbox\textboxtwo
+
+%D We need to define a dedicated name space counter.
+
+\newcounter\currentstepchart
+
+\def\stepchartprefix{@sc@-\currentstepchart-}
+
+%D Next we define the initialization part of the macros.
+
+\newcounter\cellcounter
+\newcounter\textcounter
+
+\def\startSTEPchart%
+ {\dosingleempty\dostartSTEPchart}
+
+\long\def\dostartSTEPchart[#1]#2\stopSTEPchart
+ {\ifinsidefloat \else \witruimte \@@STPCvoor \startbaselinecorrection \fi
+ \vbox\bgroup
+ \setupSTEPcharts[#1]%
+ \forgetall
+ \pushMPdrawing
+ \resetMPdrawing
+ \doglobal\increment\currentstepchart
+ \startMPdrawing
+ input mp-step ;
+ begin_step_chart ;
+ \stopMPdrawing
+ \initializeSTEP
+ \initializeSTPC
+\global
+ \chardef\somestepboxone=1
+\global
+ \chardef\sometextboxone=1
+\global
+ \chardef\somestepboxtwo\somestepboxone
+\global
+ \chardef\sometextboxtwo\sometextboxone
+ \def\startlines{\bgroup\setupSTEPlines}%
+ \def\stoplines {\egroup}%
+ \def\cells{\dosingleempty\dostepchartcells}
+ \def\texts{\dosingleempty\dostepcharttexts}
+ \def\cell {\dosingleempty\docell}%
+ \def\text {\dosingleempty\dotext}%
+ \def\docell[##1]{\dostepchartcells[##1]{}}%
+ \def\dotext[##1]{\dostepcharttexts[##1]{}}
+\doglobal
+ \newcounter\cellcounter
+\doglobal
+ \newcounter\textcounter
+ \let\dostepchartcells\doSTEPchartcellsA
+ \let\dostepcharttexts\doSTEPcharttextsA
+ {#2} % pass one: cells and texts {} keeps setting local
+ \startMPdrawing
+ nofcells := \cellcounter ;
+ analyze_step_chart ;
+ \stopMPdrawing
+\doglobal
+ \newcounter\cellcounter
+\doglobal
+ \newcounter\textcounter
+ \let\dostepchartcells\doSTEPchartcellsB
+ \let\dostepcharttexts\doSTEPcharttextsB
+ {#2} % pass two: lines
+ \startMPdrawing
+ end_step_chart ;
+ % if box_found(\MPpos{\stepchartprefix origin}) :
+ % initialize_box(\MPpos{\stepchartprefix origin}) ;
+ % draw pxy ;
+ % fi ;
+ anchor_box(\MPpos{\stepchartprefix origin}) ;
+ \stopMPdrawing
+ \MPdrawingdonetrue
+ \setbox0=\vbox
+ {\getMPdrawing}%
+ \resetMPdrawing
+ \setbox2=\vbox
+ {\offinterlineskip
+ \scratchdimen=\@@STPChoogte
+ \advance\scratchdimen\@@STPCoffset
+ \advance\scratchdimen\@@STPCoffset
+ \ifcase\sometextboxone \box\textboxone \vskip\scratchdimen \fi
+ \ifcase\somestepboxone \box\stepboxone \vskip\@@STPCvoffset \fi
+ \ifcase\somestepboxtwo \box\stepboxtwo \vskip\scratchdimen \fi
+ \ifcase\sometextboxtwo \box\textboxtwo \vskip\@@STPCvoffset \fi
+ \global\resetbox\stepboxone \global\resetbox\stepboxtwo % needed indeed
+ \global\resetbox\textboxone \global\resetbox\textboxtwo % needed indeed
+% \kern-\scratchdimen}%
+ \vskip-\lastskip}
+ \hbox
+ {\scratchdimen\wd0
+ \advance\scratchdimen \MPllx bp
+ \raise\MPlly bp\box0
+ \hskip-\scratchdimen
+ \hpos{\stepchartprefix origin}{\box2}}%
+ \popMPdrawing
+ \egroup
+ \ifinsidefloat \else \stopbaselinecorrection \@@STPCna \fi}
+
+%D The next macro looks more complicated than it is. We collect
+%D the cells in boxes. Before adding a new step cell, we padd
+%D the text rows. After adding the step cells, we flush text
+%D cells that are defined but not yet processed.
+
+\def\doSTEPchartcellsA[#1]#2#3%
+ {% synchronize texts
+ \doSTEPchartcellsAB[#1]{#2}{#3}%
+ % package steps
+ \setbox0=\hbox{\doifsomething{#2}{\@@stepcell{#2}}}%
+ \setbox2=\hbox{\doifsomething{#3}{\@@stepcell{#3}}}%
+ \ifdim\wd0>\zeropoint \!!doneafalse \else \!!doneatrue \fi
+ \ifdim\wd2>\zeropoint \!!donebfalse \else \!!donebtrue \fi
+ \ifdim\wd0>\wd2
+ \setbox2=\hbox to \wd0{\hss\box2\hss}%
+ \else
+ \setbox0=\hbox to \wd2{\hss\box0\hss}%
+ \fi
+ \if!!donea
+ \startMPdrawing
+ cells[t][\cellcounter] := nullpicture ;
+ \stopMPdrawing
+ \else
+\global
+ \chardef\somestepboxone=0
+ \edef\stepidentifier{\stepchartprefix\cellcounter-t-c}%
+ \setbox0=\hbox{\hpos{\stepidentifier}{\box0}}%
+ \bgroup
+ \iffirstargument\setupSTEPcells[#1]\fi\initializeSTEC
+ \startMPdrawing
+ initialize_box(\MPpos{\stepidentifier}) ;
+ cells[t][\cellcounter] := \MPcellsgraphic ;
+ \stopMPdrawing
+ \egroup
+ \fi
+ \if!!doneb
+ \startMPdrawing
+ cells[b][\cellcounter] := nullpicture ;
+ \stopMPdrawing
+ \else
+\global
+ \chardef\somestepboxtwo=0
+ \edef\stepidentifier{\stepchartprefix\cellcounter-b-c}%
+ \setbox2=\hbox{\hpos{\stepidentifier}{\box2}}%
+ \bgroup
+ \iffirstargument\setupSTEPcells[#1]\fi\initializeSTEC
+ \startMPdrawing
+ initialize_box(\MPpos{\stepidentifier}) ;
+ cells[b][\cellcounter] := \MPcellsgraphic ;
+ \stopMPdrawing
+ \egroup
+ \fi
+\global
+ \setbox\stepboxone=\hbox
+ {\ifdim\wd\stepboxone>\zeropoint
+ \box\stepboxone\hskip\@@STPChoffset\else
+ \fi\box0}%
+\global
+ \setbox\stepboxtwo=\hbox
+ {\ifdim\wd\stepboxtwo>\zeropoint
+ \box\stepboxtwo\hskip\@@STPChoffset\else
+ \fi\box2}%
+ % flush saved texts
+ \doSTEPchartcellsBA}
+
+\def\doSTEPchartcellsB[#1]#2#3%
+ {\doSTEPchartcellsAB[#1]{#2}{#3}%
+ \doSTEPchartcellsBA}
+
+\def\doSTEPchartcellsAB[#1]#2#3%
+ {\doloop
+ {\ifnum\cellcounter>\textcounter
+ \texts{}{}\else\exitloop
+ \fi}%
+\doglobal
+ \increment\cellcounter}
+
+\def\doSTEPchartcellsBA%
+ {\scratchtoks\stepchartbuffer
+ \stepchartbuffer\emptytoks
+ \the\scratchtoks}
+
+\def\MPcellsgraphic
+ {image ( drawshape (
+ \@@STECvariant, pxy enlarged (-.5*\@@STECoffset),
+ \@@STEClijndikte, \MPcolor{\@@STECkaderkleur},
+ \MPcolor{\@@STECachtergrondkleur} ) )}
+
+%D Although each step can have only one associated text, the
+%D place where the text is defined determines the starting
+%D point of the connecting arrow. Although several methods are
+%D possible, we've chosen a funny collector that flushes one
+%D step text at a time.
+
+\newtoks\stepchartbuffer
+
+\def\doSTEPcharttextsA[#1]% #2 #3
+ {\dodoSTEPcharttextsA{\cellcounter}{#1}}
+
+\def\dodoSTEPcharttextsA#1#2#3#4% #1=number #2=setup
+ {\dodoSTEPcharttextsAB{#1}{#2}{#3}{#4}\dodoSTEPcharttextsA
+ \ifnum\textcounter>\cellcounter\relax
+\doglobal
+ \decrement\textcounter\relax
+ \else
+ \setbox0=\hbox{\doifsomething{#3}{\@@steptext{#3}}}%
+ \setbox2=\hbox{\doifsomething{#4}{\@@steptext{#4}}}%
+ \ifdim\wd0>\zeropoint \!!doneafalse \else \!!doneatrue \fi
+ \ifdim\wd2>\zeropoint \!!donebfalse \else \!!donebtrue \fi
+ \if!!donea
+ \setbox0=\hbox to \@@STPChoffset{\hss}%
+ \startMPdrawing
+ texts[t][#1][\textcounter] := nullpicture ;
+ \stopMPdrawing
+ \else
+\global
+ \chardef\sometextboxone=0
+ \edef\stepidentifier{\stepchartprefix#1-\textcounter-t-t}%
+ \setbox0=\hbox to \@@STPChoffset
+ {\hss\hpos{\stepidentifier}{\box0}\hss}%
+ \bgroup
+ \setupSTEPtexts[#2]\initializeSTET
+ \startMPdrawing
+ initialize_box(\MPpos{\stepidentifier}) ;
+ texts[t][#1][\textcounter] := \MPtextsgraphic ;
+ \stopMPdrawing
+ \egroup
+ \fi
+ \if!!doneb
+ \setbox2=\hbox to \@@STPChoffset{\hss}%
+ \startMPdrawing
+ texts[b][#1][\textcounter] := nullpicture ;
+ \stopMPdrawing
+ \else
+\global
+ \chardef\sometextboxtwo=0
+ \edef\stepidentifier{\stepchartprefix#1-\textcounter-b-t}%
+ \setbox2=\hbox to \@@STPChoffset
+ {\hss\hpos{\stepidentifier}{\box2}\hss}%
+ \bgroup
+ \setupSTEPtexts[#2]\initializeSTET
+ \startMPdrawing
+ initialize_box(\MPpos{\stepidentifier}) ;
+ texts[b][#1][\textcounter] := \MPtextsgraphic ;
+ \stopMPdrawing
+ \egroup
+ \fi
+\global
+ \setbox\textboxone=\hbox
+ {\hbox to \wd\stepboxone{\box\textboxone\hss}\box0}
+\global
+ \setbox\textboxtwo=\hbox
+ {\hbox to \wd\stepboxtwo{\box\textboxtwo\hss}\box2}
+ \fi}
+
+\def\doSTEPcharttextsB[#1]% #2 #3
+ {\dodoSTEPcharttextsB{\cellcounter}{#1}}
+
+\def\dodoSTEPcharttextsB#1#2#3#4% #1=number #2=setup
+ {\dodoSTEPcharttextsAB{#1}{#2}{#3}{#4}\dodoSTEPcharttextsB
+ \ifnum\textcounter>\cellcounter\relax
+\doglobal
+ \decrement\textcounter\relax
+ \else
+ \bgroup
+ \initializeSTEL
+ \startMPdrawing
+ lines[t][#1][\textcounter] := \MPcharttoplinesgraphic{#1}\textcounter ;
+ lines[b][#1][\textcounter] := \MPchartbotlinesgraphic{#1}\textcounter ;
+ \stopMPdrawing
+ \egroup
+ \fi}
+
+\def\dodoSTEPcharttextsAB#1#2#3#4#5% #1=number #2=setup
+ {%
+\doglobal
+ \increment\textcounter\relax
+ \ifnum\textcounter>\cellcounter\relax
+ \@EA\appendtoks\@EA#5\@EA{#1}{#2}{#3}{#4}\to\stepchartbuffer
+ \fi}
+
+\def\MPtextsgraphic
+ {image ( drawshape (
+ \@@STETvariant, pxy enlarged (-.5*\@@STEToffset),
+ \@@STETlijndikte, \MPcolor{\@@STETkaderkleur},
+ \MPcolor{\@@STETachtergrondkleur} ) )}
+
+\def\MPcharttoplinesgraphic#1#2%
+ {image ( drawline (
+ \@@STELvariant, get_step_chart_top_line(#1,#2),
+ \@@STELlijndikte, \MPcolor{\@@STELkleur} ) )}
+
+\def\MPchartbotlinesgraphic#1#2%
+ {image ( drawline (
+ \@@STELvariant, get_step_chart_bot_line(#1,#2),
+ \@@STELlijndikte, \MPcolor{\@@STELkleur} ) )}
+
+%D \XML\ coupling.
+
+\defineXMLpickup
+ [stepchart] [@@STPC]
+ {\bgroup
+ \defineXMLpush[top]%
+ \defineXMLpush[bot]%
+ \defineXMLenvironment [lines] [@@STEL]
+ {\expanded{\startlines[\theXMLarguments{@@STEL}]}}
+ {\stoplines}%
+ \defineXMLenvironment [cells] [@@STEC]
+ {\XMLerase{top}\XMLerase{bot}}
+ {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{top}}{\XMLpop{bot}}}}%
+ \defineXMLenvironment [texts] [@@STET]
+ {\XMLerase{top}\XMLerase{bot}}
+ {\expanded{\texts[\theXMLarguments{@@STET}]{\XMLpop{top}}{\XMLpop{bot}}}}%
+ \defineXMLenvironmentpush [cell] [@@STEC]
+ {\XMLerase{cell}}
+ {\expanded{\cell [\theXMLarguments{@@STEC}]{\XMLpop{cell}}}}%
+ \defineXMLenvironmentpush [text] [@@STET]
+ {\XMLerase{text}}
+ {\expanded{\text [\theXMLarguments{@@STET}]{\XMLpop{text}}}}%
+ \expanded{\startSTEPchart[\theXMLarguments{@@STPC}]}}
+ {\stopSTEPchart
+ \egroup}
+
+%D Step tables are the vertical counterpart of stepcharts.
+
+\newcounter\currentsteptable
+
+\def\steptableprefix{@st@-\currentsteptable-}
+
+\def\startSTEPtable
+ {\dosingleempty\dostartSTEPtable}
+
+\def\dostartSTEPtable[#1]#2\stopSTEPtable
+ {\dostartSTEPaligntable[0][#1]#2\stopSTEPaligntable}
+
+\def\startSTEPaligntable
+ {\dodoubleempty\dostartSTEPaligntable[1]}
+
+\def\dostartSTEPaligntable[#1][#2]#3\stopSTEPaligntable % flag settings data
+ {\ifinsidefloat \else \witruimte \@@STPTvoor \startbaselinecorrection \fi
+ \vbox\bgroup
+ \setupSTEPtables[#2]%
+ \forgetall
+ \pushMPdrawing
+ \doglobal\increment\currentsteptable
+ \startMPdrawing
+ input mp-step ;
+ begin_step_table ;
+ \stopMPdrawing
+ \initializeSTEP
+ \initializeSTPT
+ \def\startlines{\bgroup\setupSTEPlines}%
+ \def\stoplines {\egroup}%
+ \def\prep##1{\ignorespaces##1\unskip\enspace\ignorespaces}%
+ \def\cell {\dosingleempty\docell}%
+ \def\cells {\dosingleempty\docells}%
+ \def\text {\dosingleempty\dotext}%
+ % first graphic pass, also trial pass
+ \global\dimen1=\zeropoint
+ \global\dimen3=\zeropoint
+ \global\dimen5=\zeropoint
+ \def\docell[##1]%
+ {\docells[##1]{}{}}%
+ \def\docells[##1]##2##3##4%
+ {\doglobal\increment\cellcounter
+ \bgroup
+ \iffirstargument\setupSTEPcells[##1]\fi
+ \initializeSTEC
+ \startMPdrawing
+ if box_found(\MPpos{\steptableprefix\cellcounter-c}) :
+ initialize_box(\MPpos{\steptableprefix\cellcounter-c}) ;
+ cells[\cellcounter] := \MPcellsgraphic ;
+ fi ;
+ \stopMPdrawing
+ \egroup
+ \def\do####1####2%
+ {\setbox\scratchbox=\hbox{\@@stepfake{####2}}%
+ \ifdim\wd\scratchbox>\dimen####1\global\dimen####1=\wd\scratchbox\fi}%
+ \ifcase#1\else\do1{##2}\do3{##3}\fi\do5{##4}}%
+ \def\dotext[##1]##2%
+ {\bgroup
+ \iffirstargument\setupSTEPtexts[##1]\fi
+ \initializeSTET
+ \startMPdrawing
+ if box_found(\MPpos{\steptableprefix\cellcounter-t}) :
+ initialize_box(\MPpos{\steptableprefix\cellcounter-t}) ;
+ texts[\cellcounter] := \MPtextsgraphic ;
+ fi ;
+ \stopMPdrawing
+ \egroup}
+ \doglobal\newcounter\cellcounter#3
+ % second graphic pass pass, drawing lines
+ \def\docells[##1]##2##3##4%
+ {\doglobal\increment\cellcounter}
+ \def\dotext[##1]##2%
+ {\bgroup
+ \initializeSTEL
+ \startMPdrawing
+ lines[\cellcounter] := \MPtablelinesgraphic ;
+ \stopMPdrawing
+ \egroup}
+ \doglobal\newcounter\cellcounter#3
+ % finishing graphic touch
+ \startMPdrawing
+ nofcells := \cellcounter ;
+ end_step_table ;
+ anchor_box(\MPpos{\steptableprefix origin}) ;
+ \stopMPdrawing
+ \MPdrawingdonetrue
+ \setbox0=\vbox{\getMPdrawing}
+ \resetMPdrawing
+ % typesetting pass
+ \dimen6=\@@STPTafstand \dimen6=2\dimen6
+ % cell width
+ \dimen8=\dimen1
+ \advance\dimen8\dimen3
+ \advance\dimen8\dimen5
+ % offset width
+ \ifcase#1\else \advance\dimen8 \dimen6 \fi
+ % arrow width
+ \advance\dimen8 \@@STPTbreedte
+ \advance\dimen8 \@@STPToffset
+ \advance\dimen8 \@@STPToffset
+ \def\docells[##1]##2##3##4%
+ {\doglobal\increment\cellcounter
+ \def\do####1####2####3####4% % strut really needed there !
+ {\hbox to \dimen####1{####2\@@stepfake{####3}\strut####4}}%
+ \setbox8=\hbox
+ {\ifcase#1\else
+ \do1\hss{##2}\relax \hskip\@@STPTafstand
+ \do3\hss{##3}\hss \hskip\@@STPTafstand
+ \fi
+ \do5\relax{##4}\hss}%
+ \hpos{\steptableprefix\cellcounter-c}{\@@stepcell{\box8}}
+ \endgraf
+ \nointerlineskip
+ \kern\@@STPTvoffset}
+ \def\dotext[##1]##2%
+ {\bgroup
+ \hskip\dimen8
+ \advance\hsize-\dimen8
+ \advance\hsize-\dimen6 % twice the offset
+ \setbox0=\hbox{\@@steptext{##2}}%
+% to do
+% \ifdim\wd0>\hsize
+% \setbox0=\vbox{\@@steptext{##2}}%
+% \fi
+% align
+ \hpos{\steptableprefix\cellcounter-t}{\box0}%
+ \endgraf
+ \egroup
+ \nointerlineskip
+ \kern\@@STPTvoffset}
+ \setbox2=\vbox
+ {\doglobal\newcounter\cellcounter
+ #3\kern-\@@STPTvoffset}
+ \hbox
+ {\scratchdimen\wd0
+ \advance\scratchdimen \MPllx bp
+ \raise\MPlly bp\box0
+ \hskip-\scratchdimen
+ \hpos{\steptableprefix origin}{\box2}}
+ \popMPdrawing
+ \egroup
+ \ifinsidefloat \else \stopbaselinecorrection \@@STPTna \fi}
+
+\def\MPtablelinesgraphic
+ {image ( drawline (
+ \@@STELvariant, get_step_table_line(\cellcounter),
+ \@@STELlijndikte, \MPcolor{\@@STELkleur} ) )}
+
+\defineXMLpickup
+ [steptable] [@@STPT]
+ {\bgroup
+ \defineXMLenvironment [lines] [@@STEL]
+ {\expanded{\startlines[\theXMLarguments{@@STEL}]}}
+ {\stoplines}%
+ \defineXMLargument [cell] [@@STEC]
+ {\expanded{\cell[\theXMLarguments{@@STEC}]}}%
+ \defineXMLargument [text] [@@STET]
+ {\expanded{\text[\theXMLarguments{@@STET}]}}%
+ \defineXMLargument [prep]
+ {\prep}%
+ \expanded{\startSTEPtable[\theXMLarguments{@@STPT}]}}
+ {\stopSTEPtable
+ \egroup}
+
+\defineXMLpickup
+ [stepaligntable] [@@STPT]
+ {\bgroup
+ \defineXMLenvironment [lines] [@@STEL]
+ {\expanded{\setupSTEPlines[\theXMLarguments{@@STEL}]}}
+ {}%
+ \defineXMLpush[c1]\defineXMLpush[c2]\defineXMLpush[c3]%
+ \defineXMLenvironment [cells] [@@STEC]
+ {\XMLerase{c1}\XMLerase{c1}\XMLerase{c3}}
+ {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{c1}}{\XMLpop{c2}}{\XMLpop{c3}}}}%
+ \defineXMLargument [text] [@@STET]
+ {\expanded{\text[\theXMLarguments{@@STET}]}}%
+ \defineXMLargument [prep]
+ {\prep}%
+ \expanded{\startSTEPaligntable[\theXMLarguments{@@STPT}]}}
+ {\stopSTEPaligntable
+ \egroup}
+
+\protect \endinput
diff --git a/tex/context/base/m-units.tex b/tex/context/base/m-units.tex
index 658f417d1..b2c82373c 100644
--- a/tex/context/base/m-units.tex
+++ b/tex/context/base/m-units.tex
@@ -349,7 +349,7 @@
\getvalue{\v!eenheid} [hMeter] {\Hecto \Meter} {hectometer}
\getvalue{\v!eenheid} [kMeter] {\Kilo \Meter} {kilometer}
-\getvalue{\v!eenheid} [Liter] {l} {liter}
+\getvalue{\v!eenheid} [Liter] {L} {liter}
\getvalue{\v!eenheid} [mLiter] {\Milli \Liter} {milliliter}
\getvalue{\v!eenheid} [cLiter] {\Centi \Liter} {centiliter}
\getvalue{\v!eenheid} [dLiter] {\Deci \Liter} {deciliter}
diff --git a/tex/context/base/main-001.tex b/tex/context/base/main-001.tex
deleted file mode 100644
index 8d72cfc79..000000000
--- a/tex/context/base/main-001.tex
+++ /dev/null
@@ -1,8023 +0,0 @@
-%D \module
-%D [ file=main-001,
-%D version=1997.03.31,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=1A (to be split),
-%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.
-
-%D This module is still to be split and documented.
-
-\writestatus{loading}{Context Core Macros (1)}
-
-% kan elders ook worden gebruikt i.i.g ongeveer
-% \v!tekst EN \c!tekst etc checken
-
-\unprotect
-
-\def\gobbleassigndimen#1\\{}
-
-\def\assigndimen#1#2%
- {\afterassignment\gobbleassigndimen#1=#2\!!zeropoint\\}
-
-\protect
-
-\unprotect
-
-\startmessages dutch library: systems
- title: systeem
- 1: laden hulpfile uitgesteld (typemode)
- 2: -- geladen
- 3: probeer LaTeX eens
- 4: commando -- is al gedefinieerd
- 5: macro's uit module -- geladen
- 6: geen macro's in module -- gevonden
- 7: macro's uit module -- reeds geladen
- 8: nieuwe versie hulpfile, tweede run nodig
- 9: -- niet gevonden/geplaatst
- 10: gebruik geen em in --
- 11: aanmaken basale hulpfile
- 12: de hulpfile is niet gesorteerd, gebruik texutil
- 13: markering -- gedefinieerd --
- 14: geforceerde paginaovergang in lijst voor --
- 15: wegschrijven buffer --
- 16: inlezen buffer --
- 17: verbatim inlezen buffer --
- 18: synoniem -- -- bestaat niet
- 19: betekenissen (synoniemen) van -- geladen
- 20: betekenissen (sorteren) van -- geladen
- 21: de hulpfile is niet geladen
- 22: gebruik een goede hulpfile
- 23: -- gearrangeerd op --
- 24: Plaatsblokken
- 25: Verwijzingen
- 26: Registers
- 27: Versie
-\stopmessages
-
-\startmessages english library: systems
- title: system
- 1: loading utility-file postponed (typemode)
- 2: -- loaded
- 3: try LaTeX
- 4: command -- is already defined
- 5: macros of module -- loaded
- 6: no macros found in module --
- 7: macros of module -- already loaded
- 8: new version of utility file, second pass needed
- 9: -- not found/processed
- 10: don't use em in --
- 11: building simple util
- 12: the utility-file is not sorted, use texutil
- 13: mark -- defined --
- 14: forced newpage in list at --
- 15: saving buffer --
- 16: typesetting buffer --
- 17: typesetting verbatim buffer --
- 18: synonym -- -- does not exist
- 19: meaning (synonyms) of -- loaded
- 20: meaning (sorts) of -- loaded
- 21: no utility data is loaded
- 22: use a valid utilityfile
- 23: -- arranged at --
- 24: Floatblocks
- 25: References
- 26: Registers
- 27: Version
-\stopmessages
-
-\startmessages german library: systems
- title: system
- 1: Laden der Hilfsdatei verschoben (tippenmodus)
- 2: -- geladen
- 3: Versuche LaTeX
- 4: Befehl -- ist bereits definiert
- 5: Makros aus Modul -- geladen
- 6: Keine Makros in Modul -- gefunden
- 7: Makros aus Modul -- bereits geladen
- 8: Neue Version der Hilfsdatei, zweiter Durchlauf benoetigt
- 9: -- nicht gefunden/verarbeitet
- 10: Benutzte kein em in --
- 11: Erstelle einfache Hilfdatei
- 12: Die Hilfdatei ist nicht sortiert, verwende texutil
- 13: Beschriftung -- definiert --
- 14: Erzwungendes Seitenumbruch in Liste bei --
- 15: Speichere Buffer --
- 16: Setzte Buffer --
- 17: Setzte tippen-Buffer --
- 18: Synonym -- -- existiert nicht
- 19: Bedeutung (synonyme) von -- geladen
- 20: Bedeutung (sortieren) von -- geladen
- 21: Die Hilfsdatei ist nicht geladen
- 22: Benoetige gueltige Hilfsdateie
- 23: -- angeordnet auf --
- 24: Fliessbloecke
- 25: Referenzen
- 26: Register
- 27: Version
-\stopmessages
-
-\startmessages czech library: systems
- title: system
- 1: nacteni pomocneho souboru odlozeno (typemode)
- 2: -- nacteno
- 3: zkuste LaTeX
- 4: prikaz -- je jiz definovan
- 5: makra z -- nactena
- 6: zadna makra v -- nenalezena
- 7: makra z -- jsou jiz nactena
- 8: nova verze pomocneho souboru, je treba druheho behu
- 9: -- nenalezeno/nezpracovano
- 10: nepouzivejte em v --
- 11: vytvarim jednoduchy pomocny soubor
- 12: pomosny soubor neni setriden, pouzijte texutil
- 13: znacka -- definovana --
- 14: vynucena nova stranka v seznamu na --
- 15: uklada se buffer --
- 16: sazi se buffer --
- 17: sazi se doslovny (verbatim) buffer --
- 18: synonymum -- -- neexistuje
- 19: vyznam (synonyma) -- nacten
- 20: vyznam (trideni) -- nacten
- 21: pomocny soubor necten
- 22: pouzijte platny pomocny soubor
- 23: -- upraveno na --
- 24: plovouci bloky
- 25: reference
- 26: registry
- 27: verze
-\stopmessages
-
-\startmessages italian library: systems
- title: sistema
- 1: caricamento dei file supplementari posticipato (typemode)
- 2: -- caricato
- 3: provare LaTeX
- 4: comando -- già definito
- 5: macro del modulo -- caricate
- 6: nessuna macro trovata nel modulo --
- 7: macro del modulo -- già caricate
- 8: nuova versione del file supplementare, seconda passata necessaria
- 9: -- non trovato/elaborato
- 10: non usare em in --
- 11: costruzione di un semplice supplemento
- 12: file di supplemento non ordinato, usare texutil
- 13: marcatura -- definita --
- 14: nuova pagina obbligata in lista a --
- 15: salvataggio del buffer --
- 16: composizione del buffer --
- 17: composizione verbatim del buffer --
- 18: sinonimo -- -- non esistente
- 19: significato (sinonimi) di -- caricato
- 20: significato (specie) di -- caricato
- 21: nessuna informazione supplementare caricata
- 22: usare un file supplementare valido
- 23: -- sistemato a --
- 24: Oggetti mobili
- 25: Riferimenti
- 26: Registri
- 27: Versione
-\stopmessages
-
-\startmessages norwegian library: systems
- title: system
- 1: innlesning av hjelpefila utsatt (typemode)
- 2: -- er lest inn
- 3: forsøker LaTeX
- 4: kommando -- er allerede definert
- 5: makroene i modul -- er lest inn
- 6: ingen makroer funnet i modul ---
- 7: makroene i modul -- er allerede lest inn
- 8: ny versjon av hjelpefil, andre gjennomkjøring nødvendig
- 9: -- ikke funnet/behandlet
- 10: ikke bruk em i --
- 11: lager enkel hjelpefil
- 12: hjelpefila er ikke sortert, bruk texutil
- 13: markering -- definert --
- 14: tvunget sideskift i liste ved --
- 15: lagrer Buffer --
- 16: tegnsetter buffer --
- 17: tegnsetter verbatim-buffer --
- 18: synonym -- -- eksisterer ikke
- 19: betydning (synonymer) av -- er lest inn
- 20: betydning (sorterer) av -- er lest inn
- 21: hjelpefila er ikke lest inn
- 22: bruk en gyldig hjelpefil
- 23: -- arrangert på --
- 24: Flytblokker
- 25: Referanser
- 26: Registere
- 27: Versjon
-\stopmessages
-
-\startmessages romanian library: systems
- title: sistem
- 1: se incarca utilitarul-fisierul este amanat (typemode)
- 2: -- s-a incarcat
- 3: incercati LaTeX
- 4: comanda -- este deja definita
- 5: macro-urile din modulul -- s-au incarcat
- 6: nu s-au gasit macro-uri in modulul --
- 7: macro-urile din modulul -- s-au incarcat deja
- 8: o noua versiune de fisier utilitar, este necesara o noua trecere
- 9: -- nu este gasit/procesat
- 10: nu folositi em in --
- 11: se creeaza un utilitar simplu
- 12: fisierul utilitar nu este sortat, folositi texutil
- 13: marcajul -- definit --
- 14: s-a fortat trecere pa pagina noua in lista la --
- 15: buffer salvat --
- 16: buffer-ul -- s-a cules
- 17: se culege buffer-ul verbatim --
- 18: sinonimul -- -- nu exista
- 19: intelesul (sinonimele) pentru -- incarcat
- 20: intelesul (ordinea) pentru -- incarcat
- 21: nici o data utilitara nu este incarcata
- 22: folositi un fisier utilitar valid
- 23: -- aranjat la --
- 24: Blocuri
- 25: Referinte
- 26: Registri
- 27: Versiune
-\stopmessages
-
-\startmessages dutch library: floatblocks
- title: plaatsblokken
- 1: -- hernummerd / -- => --
- 2: -- bewaard
- 3: -- verplaatst
- 4: -- geplaatst
- 5: volgorde aangepast
- 6: maximaal -- boven
- 7: maximaal -- onder
- 8: minder dan -- regels
- 9: volgorde verstoord
- 10: -- begrensd
- 11: geen blok opgegeven
- 12: niet gedefinieerd
-\stopmessages
-
-\startmessages english library: floatblocks
- title: floatblocks
- 1: -- renumbered / -- => --
- 2: -- saved
- 3: -- moved
- 4: -- placed
- 5: order adapted
- 6: n of top floats limited to --
- 7: n of bottom floats limited to --
- 8: less than -- lines
- 9: order disturbed
- 10: -- limited
- 11: no block given
- 12: undefined
-\stopmessages
-
-\startmessages german library: floatblocks
- title: Gleitobjektbloecke
- 1: -- neu nummeriert / -- => --
- 2: -- gespeichert
- 3: -- verschoben
- 4: -- plaziert
- 5: Reihenfolge angepasst
- 6: Anz. der oberen Gleitobjekte beschraengt auf --
- 7: Anz. der unteren Gleitobjekte beschraengt auf --
- 8: weniger als -- zeilen
- 9: Reigenfolge gestoert
- 10: -- begrenzt
- 11: kein Block gegeben
- 12: undefiniert
-\stopmessages
-
-\startmessages czech library: floatblocks
- title: plovouciobjekty
- 1: -- precislovano / -- => --
- 2: -- ulozeno
- 3: -- presunuto
- 4: -- umisteno
- 5: poradi prizpusobeno
- 6: pocet hornich plovoucich objektu je omezen na --
- 7: pocet spodnich plovoucich objektu je omezen na --
- 8: radku je mene nez --
- 9: poradi naruseno
- 10: -- omezeno
- 11: nedan zadny blok
- 12: nedefinovano
-\stopmessages
-
-\startmessages italian library: floatblocks
- title: oggetti mobili
- 1: -- rinumerato / -- => --
- 2: -- salavto
- 3: -- mosso
- 4: -- sistemato
- 5: ordine aggiustato
- 6: n di top floats limitato a --
- 7: n di bottom floats limitato a --
- 8: meno di -- righe
- 9: ordine disturbato
- 10: -- limitato
- 11: nessun oggetto specificato
- 12: non definito
-\stopmessages
-
-\startmessages norwegian library: floatblocks
- title: flytblokker
- 1: -- renummerert / -- => --
- 2: -- lagret
- 3: -- flyttet
- 4: -- plassert
- 5: rekkefølge tilpasset
- 6: maksimalt -- flytblokker øverst
- 7: maksimalt -- flytblokker nederst
- 8: mindre enn -- linjer
- 9: rekkefølge endret
- 10: -- begrenset
- 11: ingen blokk oppgitt
- 12: udefinert
-\stopmessages
-
-\startmessages romanian library: floatblocks
- title: Blocuri
- 1: -- renumerotat / -- => --
- 2: -- salvat
- 3: -- mutat
- 4: -- plasat
- 5: ordinea adaptata
- 6: nr. cadrelor de sus limitat la --
- 7: nr. blocurilor de jos limitat la --
- 8: mai putin de -- linii
- 9: ordinea deranjata
- 10: -- limitat
- 11: nu este dat nici un bloc
- 12: nedefinit
-\stopmessages
-
-\startmessages dutch library: layouts
- title: layout
- 1: teksthoogte aangepast met -- op pagina --
- 2: -- maal uitgestelde tekst tussengevoegd
- 3: -- maal tekst plaatsen uitstellen
- 4: margeblokken actief
- 5: margeblokken inactief
- 6: subpagina reeks -- verwerkt (aantal --)
- 7: beeldmerken berekenen
- 8: achtergronden berekenen
- 10: -- en -- tellen niet op tot 1.0
- 11: interlinie -- niet toegestaan in gridmode
-\stopmessages
-
-\startmessages english library: layouts
- title: layout
- 1: textheight adapted with -- at page --
- 2: -- times postponed text placed
- 3: -- times text postponed
- 4: marginblocks active
- 5: marginblocks inactive
- 6: subpage set -- processed (size --)
- 7: calculating logospace
- 8: calculating backgrounds
- 10: -- and -- don't add up to 1.0
- 11: spacing -- not permitted in gridmode
-\stopmessages
-
-\startmessages german library: layouts
- title: Layout
- 1: Texthoehe angepasst mit -- auf Seite --
- 2: -- mal verschobener Text plaziert
- 3: -- mal Text verschoben
- 4: marginalbloecke aktiv
- 5: marginalbloecke inaktiv
- 6: Unterseitenfolge -- verarbeitet (Groesse --)
- 7: berechne Platz des Logo
- 8: berechne Hintergrund
- 10: -- und -- ergeben zusammen nicht 1.0
- 11: Zwischenraum -- nicht im Grittermoduserlau
-\stopmessages
-
-\startmessages czech library: layouts
- title: layout
- 1: vyska textu prizpusobena s -- na strane --
- 2: -- krat odlozeny text umisten
- 3: -- krat text odlozen
- 4: okrajove bloky aktivni
- 5: okrajove bloky neaktivni
- 6: sada stran -- zpracovana (velikost --)
- 7: pocita se misto pro logo
- 8: pocita se pozadi
- 10: -- a -- nedava dohromady 1.0
- 11: svisla mezera -- neni povolena v pevnem radkovem rejstriku
-\stopmessages
-
-\startmessages italian library: layouts
- title: layout
- 1: altezza del testo adattata con -- a pagina --
- 2: posizionato testo posticipato -- volte
- 3: testo posticipato -- volte
- 4: blocchi in margine attivi
- 5: blocchi in margine inattivi
- 6: gruppo di sottopagine -- elaborato (dimensione --)
- 7: calcolo dello spazio per logo
- 8: calcolo dello sfondo
- 10: -- e -- non sommano a 1.0
- 11: spaziatura -- non permessa in modo griglia
-\stopmessages
-
-\startmessages norwegian library: layouts
- title: layout
- 1: teksthøyde tilpasset med -- på side --
- 2: -- ganger forskjøvet tekst plassert
- 3: -- ganger tekst forskjøvet
- 4: margblokker aktive
- 5: margblokker inaktive
- 6: delside sett -- behandlet (størrelse --)
- 7: beregner plass for logo
- 8: beregner bakgrunn
- 10: -- og -- er ikke 1.0 til sammen
- 11: mellomrom -- ikke tillatt i gridmodus
-\stopmessages
-
-\startmessages romanian library: layouts
- title: aranjamente
- 1: textheight adaptat cu -- la pagina --
- 2: textul amanat de -- ori a fost plasat
- 3: textul amanat de -- ori
- 4: blocuri marginale active
- 5: blocuri marginale inactive
- 6: setul -- de subpagini procesat (dimensiunea --)
- 7: se calculeaza spatiul pentru logo
- 8: se calculeaza fundalurile
- 10: -- si -- nu se adauga pana la 1.0
- 11: spatierea -- nu este permisa in gridmode
-\stopmessages
-
-% \CONTEXTtrue % Now we know that we can use ConTeXt commands.
-
-% \def\teststatus{stop}
-%
-% \def\doiftrue {\iftrue}
-% \def\doiffalse {\iffalse}
-%
-% \def\setstatus#1#2%
-% {\doifelse{\getvalue{#1\c!status}}{\v!start}
-% {\let#2=\doiftrue}
-% {\let#2=\doiffalse}}
-%
-% \setstatus{test}\iftest
-%
-% \iftest
-% \message{JA}
-% \else
-% \message{NEE}
-% \fi
-
-\def\convertexpanded#1#2#3% watch the double \v!ja expansion !
- {\ExpandFirstAfter\processaction
- [\getvalue{#1\c!expansie}]
- [ \v!ja=>{{\honorunexpanded\xdef\@@globalexpanded{#2}%
- \xdef\@@globalexpanded{\@@globalexpanded}}%
- \dodoglobal\convertcommand\@@globalexpanded\to#3},
- \v!commando=>{\dodoglobal\convertcommand #2\to#3},
- \s!default=>{\dodoglobal\convertargument#2\to#3},
- \s!unknown=>{\dodoglobal\convertargument#2\to#3}]}
-
-\def\herhaal {\dorepeat}
-\def\herhaler {\repeater}
-\def\herhaalmetcommando {\dorepeatwithcommand}
-
-% This permits things like ^\index{hans}^, where hans is
-% duplicated in the text.
-
-\newif\ifduplicate
-
-\bgroup
-\gdef\checkduplication% in line with Knuth
- {\ifmmode
- \def\next{^}%
- \else
- \let\next=\startduplication
- \fi
- \next}
-\gdef\insideduplication%
- {\ifmmode
- \def\next{^}%
- \else
- \let\next=\egroup
- \fi
- \next}
-\catcode`\^=\@@active
-\gdef\enableduplication%
- {\catcode`\^=\@@active
- \let^=\checkduplication}
-\gdef\disableduplication%
- {\catcode`\^=\@@superscript}
-\gdef\startduplication%
- {\bgroup
- \duplicatetrue
- \let^=\insideduplication}
-\egroup
-
-\def\verbatim#1%
- {\convertargument#1\to\ascii\ascii}
-
-% mogelijke optimalisaties:
-%
-% \ifx ...\else ...\fi
-% \ifvisible ... \fi
-
-% De opbouw van deze file
-%
-% Deze file bevat naast de verschillende Pragma-Macro's ook
-% helpinformatie bij deze macro's en templates. Een blok
-% helpinformatie wordt gekenmerkt door een %I.
-%
-% Een blok kan zijn opgedeeld in pagina's. In dat geval is
-% %I vervangen door %P. De eerste regel van een blok bevat
-% de titel van de informatie.
-%
-% Een template (voorgedefinieerde structuur) wordt gekenmerkt
-% door %T. Ook hier bevat de eerste regel een titel,
-% eventueel gevolgd door een mnemonic.
-%
-% Zowel de helpinformatie als de templates zijn in het
-% programma TeXEdit oproepbaar.
-%
-% Het programma TeXEdit kan t.z.t. worden ingesteld met
-% behulp van de onderstaande, door %S voorafgegane,
-% setupcommando's. Vooralsnog is een en ander 'hard' in het
-% programma geprogrammeerd.
-
-%S InputFile \input
-%S InputFile \omgeving \environment
-%S InputFile \projekt \project
-%S InputFile \produkt \product
-%S InputFile \onderdeel \component
-%S
-%S CheckStrings \start \stop
-%S CheckStrings \begin \end
-%S CheckStrings \begin \eind
-%S
-%S CheckChars { }
-%S CheckChars [ ]
-%S CheckChars ( )
-%S
-%S CheckChar $
-
-% Het <pagina>-karakter (FormFeed), wordt omgezet in \par
-
-\edef\oldlinefeed{\the\catcode`\^^L}
-
-\catcode`\^^L=\oldlinefeed
-
-\catcode`\^^L=\@@endofline
-
-% Maten
-%
-% De onderstaande instellingen worden gebruikt voor het
-% vastleggen van de zetspiegel en marges.
-
-\voffset=0pt % setting this to -1in let's go metapost crazy
-\hoffset=0pt % setting this to -1in let's go metapost crazy
-
-\newdimen\papierhoogte
-\newdimen\papierbreedte
-
-\newdimen\printpapierhoogte
-\newdimen\printpapierbreedte
-
-\newdimen\zethoogte
-\newdimen\zetbreedte
-
-\newdimen\teksthoogte
-\newdimen\tekstbreedte
-
-\newdimen\kopwit \kopwit=2cm
-\newdimen\rugwit \rugwit=2cm
-
-\newdimen\hoofdhoogte \hoofdhoogte=2cm
-\newdimen\voethoogte \voethoogte=2cm
-
-%\newdimen\kopkopwit \kopkopwit=0cm
-
-\newdimen\kopoffset \kopoffset=\!!zeropoint
-\newdimen\rugoffset \rugoffset=\!!zeropoint
-
-\newdimen\linkermargebreedte \linkermargebreedte=3cm
-\newdimen\rechtermargebreedte \rechtermargebreedte=\linkermargebreedte
-
-\newdimen\linkerrandbreedte \linkerrandbreedte=3cm
-\newdimen\rechterrandbreedte \rechterrandbreedte=\linkerrandbreedte
-
-\newdimen\bovenhoogte \bovenhoogte=1cm
-\newdimen\onderhoogte \onderhoogte=\bovenhoogte
-
-\def\margeafstand%
- {\@@lymargeafstand}
-
-\def\randafstand%
- {\@@lyrandafstand}
-
-\def\margebreedte%
- {\@@lymarge}
-
-\def\randbreedte%
- {\@@lyrand}
-
-\def\linkerrandafstand%
- {\ifdim\!!zeropoint<\linkerrandbreedte
- \@@lylinkerrandafstand
- \else
- \!!zeropoint
- \fi}
-
-\def\rechterrandafstand%
- {\ifdim\!!zeropoint<\rechterrandbreedte
- \@@lyrechterrandafstand
- \else
- \!!zeropoint
- \fi}
-
-\def\linkermargeafstand%
- {\ifdim\!!zeropoint<\linkermargebreedte
- \@@lylinkermargeafstand
- \else
- \!!zeropoint
- \fi}
-
-\def\rechtermargeafstand%
- {\ifdim\!!zeropoint<\rechtermargebreedte
- \@@lyrechtermargeafstand
- \else
- \!!zeropoint
- \fi}
-
-\def\bovenafstand%
- {\ifdim\!!zeropoint<\bovenhoogte
- \@@lybovenafstand
- \else
- \!!zeropoint
- \fi}
-
-\def\hoofdafstand%
- {\ifdim\!!zeropoint<\hoofdhoogte
- \@@lyhoofdafstand
- \else
- \!!zeropoint
- \fi}
-
-\def\voetafstand%
- {\ifdim\!!zeropoint<\voethoogte
- \@@lyvoetafstand
- \else
- \!!zeropoint
- \fi}
-
-\def\onderafstand%
- {\ifdim\!!zeropoint<\onderhoogte
- \@@lyonderafstand
- \else
- \!!zeropoint
- \fi}
-
-\newif\ifdubbelzijdig
-\dubbelzijdigfalse
-
-\newif\ifenkelzijdig
-\enkelzijdigtrue
-
-\def\doifsometextlineelse#1#2#3% ! omgekeerd !
- {\doifinsetelse{\getvalue{\??tk#1\v!tekst\c!status}}{\v!geen,\v!hoog}
- {#3}{#2}}
-
-% NOG EENS NAGAAN WANNEER NU GLOBAL EN WANNEER NIET
-
-\def\calculatevsizes% global needed in \resetlayoutregel
- {\redoglobal\teksthoogte=\zethoogte
- \doifsometextlineelse{\v!hoofd}
- {\redoglobal\advance\teksthoogte by -\hoofdhoogte
- \redoglobal\advance\teksthoogte by -\hoofdafstand}
- {}%
- \doifsometextlineelse{\v!voet}
- {\redoglobal\advance\teksthoogte by -\voethoogte
- \redoglobal\advance\teksthoogte by -\voetafstand}
- {}%
- \resetglobal
- \setvsize}
-
-\def\calculatereducedvsizes%
- {\teksthoogte=\zethoogte
- \doifsometextlineelse{\v!hoofd}
- {\advance\teksthoogte by -\hoofdhoogte
- \advance\teksthoogte by -\hoofdafstand}
- {\hoofdhoogte=\!!zeropoint}%
- \doifsometextlineelse{\v!voet}
- {\advance\teksthoogte by -\voethoogte
- \advance\teksthoogte by -\voetafstand}
- {\voethoogte=\!!zeropoint}}
-
-\def\calculatehsizes%
- {\tekstbreedte=\zetbreedte
- \doifsomething{\@@lytekstbreedte} % may be set to \tekstbreedte
- {\tekstbreedte=\@@lytekstbreedte} % which is tricky but ok
- \sethsize}
-
-\def\sethsize%
- {\global\hsize=\tekstbreedte}
-
-\def\setvsize%
- {\ifdim\vsize=\teksthoogte
- \else
- \bgroup
- \dimen0=-\vsize
- \advance\dimen0 by \teksthoogte
- \global\advance\vsize by \dimen0
- \ifdim\pagegoal<\maxdimen
- \advance\dimen0 by \pagegoal
- \global\pagegoal=\dimen0
- \fi
- \egroup
- \fi}
-
-% Algemeen
-%
-% De Pragma-macros zijn samengesteld met behulp van de
-% commandos van PlainTeX- en enkele TugBoat routines.
-%
-% Voor de volledigheid zijn in de definitie steeds de
-% {}-haakjes vermeld. Deze haakjes zijn niet altijd
-% nodig, Als bijvoorbeeld een paragraaf bewerkt wordt,
-% kunnen ze achterwege blijven.
-%
-% Instellingen worden opgegeven tussen []-haakjes,
-% meestal direct na het commando. Instellingen mogen
-% soms achterwege blijven.
-%
-% Een aantal veelgebruikte macro's zijn in TeXEdit op
-% naam en/of door middel van een mnemonic oproepbaar.
-
-% De onderstaande macro voert commando's uit, afhankelijk van
-% het karakter van het paginanummer.
-%
-% \doifonevenpaginaelse{then-commando}{else-commando}
-
-% NB \userpageno vervangen door \realpageno
-
-% \def\doifonevenpaginaelse#1#2%
-% {\ifodd\realpageno#1\else#2\fi}
-%
-% \def\doifbothsidesoverruled#1\orsideone#2\orsidetwo#3\od%
-% {\ifdubbelzijdig
-% \ifodd\realpageno#2\relax\else#3\relax\fi
-% \else
-% #1\relax
-% \fi}
-%
-% \def\doifbothsides#1\orsideone#2\orsidetwo#3\od%
-% {\ifdubbelzijdig
-% \ifenkelzijdig
-% #1\relax
-% \else
-% \ifodd\realpageno#2\relax\else#3\relax\fi
-% \fi
-% \else
-% #1\relax
-% \fi}
-
-%D When we start at an even page, we need to swap the layout
-%D differently. We cannot adapt the real page number, since
-%D it is used in cross referencing. The next switch is set
-%D when we start at an even page.
-
-\newif\ifshiftedrealpageno
-
-\def\doifonevenpaginaelse#1#2%
- {\ifshiftedrealpageno
- \ifodd\realpageno#2\else#1\fi
- \else
- \ifodd\realpageno#1\else#2\fi
- \fi}
-
-\def\doifbothsidesoverruled#1\orsideone#2\orsidetwo#3\od%
- {\ifdubbelzijdig
- \doifonevenpaginaelse{#2}{#3}\relax
- \else
- #1\relax
- \fi}
-
-\def\doifbothsides#1\orsideone#2\orsidetwo#3\od%
- {\ifdubbelzijdig
- \ifenkelzijdig
- #1\relax
- \else
- \doifonevenpaginaelse{#2}{#3}\relax
- \fi
- \else
- #1\relax
- \fi}
-
-\def\dostartglobaldefs#1#2%
- {\edef\!!stringa{\the\globaldefs}%
- \ifnum\globaldefs#10
- \globaldefs=-\globaldefs
- \fi
- \advance\globaldefs by #21
- \setevalue{@gd@\the\globaldefs}{\!!stringa}}
-
-\def\dostopglobaldefs%
- {\doifdefinedelse{@gd@\the\globaldefs}
- {\globaldefs=\getvalue{@gd@\the\globaldefs}\relax}
- {\globaldefs=0\relax}}
-
-\def\startlocal {\dostartglobaldefs>-}
-\def\stoplocal {\dostopglobaldefs}
-\def\startglobal {\dostartglobaldefs<+}
-\def\stopglobal {\dostopglobaldefs}
-
-\ifx\stelpapierformaatin\undefined
- \let\stelpapierformaatin\relax
-\fi
-
-\def\dodefinieerpapierformaat[#1][#2]%
- {\ifsecondargument
- \getparameters
- [\??pp#1] % geen \c!schaal, scheelt hash ruimte
- [\c!breedte=\@@ppbreedte,\c!hoogte=\@@pphoogte,
- \c!offset=\@@ppoffset,#2]%
- \else
- \getparameters[\??pp][#1]%
- \stelpapierformaatin
- \fi}
-
-\def\definieerpapierformaat%
- {\dodoubleempty\dodefinieerpapierformaat}
-
-\definieerpapierformaat
- [\c!breedte=210mm,\c!hoogte=297mm,\c!offset=0pt]
-
-\chardef\papermirror =0
-\chardef\printmirror =0
-\chardef\paperrotation =0
-\chardef\paperreverse =0
-\chardef\printrotation =0
-\chardef\printreverse =0
-\chardef\paperlandscape=0
-\chardef\printlandscape=0
-
-\def\papierschaal{1}
-
-\newif\ifnegateprintbox
-
-\def\dostelpapierrichtingin#1#2#3#4#5%
- {\global\chardef#2=0
- \global\chardef#5=0
- \gdef#3{0}%
- \gdef#4{0}%
- \global\negateprintboxfalse
- \processallactionsinset
- [#1]
- [ \v!liggend=>\global\chardef#2=1,
- \v!gespiegeld=>\global\chardef#5=1,
- \v!geroteerd=>\gdef#3{90}\gdef#4{270},
- \v!negatief=>\global\negateprintboxtrue,
- 90=>\gdef#3{90}\gdef#4{270},
- 180=>\gdef#3{180}\gdef#4{0},
- 270=>\gdef#3{270}\gdef#4{90}]}
-
-\ifx\calculatepaperoffsets\undefined
-
- \def\calculatepaperoffsets#1%
- {\scratchdimen=\getvalue{\??pp#1\c!offset}%
- \global\advance\papierbreedte by -2\scratchdimen
- \global\advance\papierhoogte by -2\scratchdimen}
-
-\fi
-
-\def\dostelpapierformaatin[#1][#2]%
- {\doifinstringelse{=}{#1}
- {\getparameters[\??pp][#1]}
- {\doifinstringelse{=}{#2}
- {\getparameters[\??pp#1][#2]}
- {\dodostelpapierformaatin[#1][#2]}}}
-
-\def\dodostelpapierformaatin[#1][#2]%
- {\ifsecondargument
- \xdef\herstelpapierformaat%
- {\noexpand\stelpapierformaatin[#1][#2]}%
- \dostelpapierrichtingin{#1}\paperlandscape\paperrotation\paperreverse\papermirror
- \dostelpapierrichtingin{#2}\printlandscape\printrotation\printreverse\printmirror
- \def\docommando##1%
- {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
- {\global\papierbreedte=\getvalue{\??pp##1\c!breedte}%
- \global\papierhoogte=\getvalue{\??pp##1\c!hoogte}%
- \calculatepaperoffsets{##1}%
- \xdef\papierformaat{##1}}}}%
- \processcommacommand[#1]\docommando
- \doifdefinedelse{\??pp#1\c!schaal}
- {\edef\papierschaal{\getvalue{\??pp#1\c!schaal}}}
- {\edef\papierschaal{1}}%
- \def\docommando##1%
- {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
- {\global\printpapierbreedte=\getvalue{\??pp##1\c!breedte}%
- \global\printpapierhoogte=\getvalue{\??pp##1\c!hoogte}%
- \xdef\printpapierformaat{##1}}}}%
- \processcommacommand[#2]\docommando
- \ifnum\paperlandscape>0
- \doglobal\swapdimens\papierbreedte\papierhoogte
- \fi
- \ifnum\printlandscape>0
- \doglobal\swapdimens\printpapierbreedte\printpapierhoogte
- \fi
- \ifdim\papierhoogte>\printpapierhoogte
- \global\printpapierhoogte=\papierhoogte
- \fi
- \ifdim\papierbreedte>\printpapierbreedte
- \global\printpapierbreedte=\papierbreedte
- \fi
- \calculatehsizes
- \calculatevsizes
- \global\newlogostrue
- \global\newbackgroundtrue
- \resetlayout
- \else\iffirstargument
- \stelpapierformaatin[#1][#2]%
- \else\ifx\papierformaat\undefined\else
- \herstelpapierformaat
- \fi\fi\fi}
-
-\let\herstelpapierformaat\relax
-
-\def\stelpapierformaatin%
- {\dodoubleempty\dostelpapierformaatin}
-
-\def\checkforems[#1]%
- {\def\docommando##1%
- {\beforesplitstring##1\at em\to\asciia
- \doifnot{\asciia}{##1}
- {\aftersplitstring\asciia\at=\to\asciia
- \doifsomething{\asciia}
- {\showmessage{\m!systems}{10}{##1}}}}%
- \processcommalist[#1]\docommando}
-
-\def\resetlayout%
- {\global\linkermargebreedte=\@@lylinkermarge
- \global\rechtermargebreedte=\@@lyrechtermarge
- \global\linkerrandbreedte=\@@lylinkerrand
- \global\rechterrandbreedte=\@@lyrechterrand
- \global\hoofdhoogte=\@@lyhoofd
- \global\voethoogte=\@@lyvoet
- \global\onderhoogte=\@@lyonder
- \global\bovenhoogte=\@@lyboven
- \global\rugwit=\@@lyrugwit
- \global\kopwit=\@@lykopwit
- \doifelse{\@@lygrid}{\v!ja}
- {\gridsnappingtrue}
- {\gridsnappingfalse}%
- \ifgridsnapping
- \widowpenalty=0 % is gewoon beter
- \clubpenalty =0 % zeker bij grids
- \else
- \widowpenalty=\defaultwidowpenalty
- \clubpenalty=\defaultclubpenalty
- \fi
- \stelwitruimtein
- \stelblankoin
- \doifelse{\@@lybreedte}{\v!midden}
- {\global\zetbreedte=\papierbreedte
- \global\advance\zetbreedte by -\rugwit
- \scratchdimen=\@@lysnijwit\relax
- \ifdim\scratchdimen=\!!zeropoint
- \scratchdimen=\rugwit
- \fi
- \global\advance\zetbreedte by -\scratchdimen}
- {\doifelse{\@@lybreedte}{\v!passend}
- {\global\zetbreedte=\papierbreedte
- \global\advance\zetbreedte by -\rugwit
- \scratchdimen=\rugwit
- \advance\scratchdimen by -\linkerrandbreedte
- \advance\scratchdimen by -\linkerrandafstand
-% \advance\scratchdimen by -\paginascheiding
- \advance\scratchdimen by -\linkermargebreedte
- \advance\scratchdimen by -\linkermargeafstand
- \ifdim\scratchdimen<\!!zeropoint
- \scratchdimen=\!!zeropoint
- \fi
- \global\advance\zetbreedte by -\rechtermargeafstand
- \global\advance\zetbreedte by -\rechtermargebreedte
-% \global\advance\zetbreedte by -\paginascheiding
- \global\advance\zetbreedte by -\rechterrandafstand
- \global\advance\zetbreedte by -\rechterrandbreedte
- \global\advance\zetbreedte by -\scratchdimen}
- {\global\zetbreedte=\@@lybreedte}}%
- \doifelse{\@@lyregels}{}
- {\doifelse{\@@lyhoogte}{\v!midden}
- {\global\zethoogte=\papierhoogte
- \global\advance\zethoogte by -\kopwit
- \scratchdimen=\@@lybodemwit\relax
- \ifdim\scratchdimen=\!!zeropoint
- \scratchdimen=\kopwit
- \fi
- \global\advance\zethoogte by -\scratchdimen}
- {\doifelse{\@@lyhoogte}{\v!passend}
- {\global\zethoogte=\papierhoogte
- \global\advance\zethoogte by -\kopwit
- \scratchdimen=\kopwit
- \advance\scratchdimen by -\bovenhoogte
- \advance\scratchdimen by -\bovenafstand
- \ifdim\scratchdimen<\!!zeropoint
- \scratchdimen=\!!zeropoint
- \fi
- \global\advance\zethoogte by -\onderafstand
- \global\advance\zethoogte by -\onderhoogte
- \global\advance\zethoogte by -\scratchdimen}
- {\global\zethoogte=\@@lyhoogte}}}
- {\global\zethoogte=\@@lyregels\lineheight
- \global\advance\zethoogte by \hoofdhoogte
- \global\advance\zethoogte by \voethoogte}%
- \rugoffset=\@@lyrugoffset
- \kopoffset=\@@lykopoffset
- \calculatehsizes
- \calculatevsizes
- \global\newlogostrue
- \global\newbackgroundtrue}
-
-\def\checklayout%
- {\doifsomething{\@@lyregels}
- {\ifdim\zethoogte=\@@lyregels\lineheight \else \resetlayout \fi}}
-
-\appendtoks \checklayout \to \everystarttext
-
-\newif\ifdoublesidedprint
-
-\def\presetcenterpagebox% in \stellayoutin !!!!!!!!!!!!!!!!
- {\doublesidedprintfalse
- \ExpandFirstAfter\processallactionsinset
- [\@@lyplaats]
- [ \v!midden=>{\stelpapierformaatin[\c!links=\hss,\c!rechts=\hss,\c!boven=\vss,\c!onder=\vss]},
- \v!links=>{\stelpapierformaatin[\c!links=,\c!rechts=\hss]},
- \v!rechts=>{\stelpapierformaatin[\c!links=\hss,\c!rechts=]},
- \v!onder=>{\stelpapierformaatin[\c!boven=\vss,\c!onder=]},
- \v!boven=>{\stelpapierformaatin[\c!boven=,\c!onder=\vss]},%
- \v!dubbelzijdig=>\doublesidedprinttrue,
- \v!enkelzijdig=>\doublesidedprintfalse]}
-
-\def\complexstellayoutin[#1]%
- {\ConvertToConstant\doifnot{#1}{\v!reset}
- {\getparameters[\??ly][#1]%
- \checkforems[#1]}%
- \resetlayout
- \presetcenterpagebox}
-
-\definecomplexorsimpleempty\stellayoutin
-
-\let\@@zahoogte=\!!zeropoint
-
-\def\dopushpagedimensions%
- {\xdef\oldteksthoogte{\the\teksthoogte}%
- \xdef\oldvoethoogte{\the\voethoogte}%
- \global\let\@@zahoogte=\@@zahoogte}
-
-\def\dopoppagedimensions%
- {\global\teksthoogte=\oldteksthoogte
- \global\voethoogte=\oldvoethoogte
- \resetlayout
- \global\let\pushpagedimensions=\dopushpagedimensions
- \global\let\poppagedimensions=\relax}
-
-\let\poppagedimensions=\relax
-\let\pushpagedimensions=\dopushpagedimensions
-
-% Elke \csname ... \endcsname wordt ook aangemaakt, dus ook
-% in een test met \doifdefined. Bij veel bladzijden kan dit
-% te veel macro's kosten. Vandaar de set \adaptedpages. Het
-% kost tijd, maar scheelt macro's.
-
-\def\adaptedpages{}
-
-\def\adaptpagedimensions%
- {\rawdoifinsetelse{\realfolio}{\adaptedpages}
- {\getvalue{\??za\realfolio}%
- \letbeundefined{\??za\realfolio}}
- {}}
-
-\def\checkpagedimensions%
- {\poppagedimensions
- \adaptpagedimensions}
-
-\def\reportpagedimensions%
- {\ifx\poppagedimensions\relax
- \else
- \spatie\@@zahoogte\spatie-
- \fi
- \realfolio}
-
-\def\dodopaslayoutaan[#1]%
- {\getparameters[\??za][\c!hoogte=,\c!regels=,#1]%
- \pushpagedimensions
- \doifelsenothing{\@@zaregels}
- {\showmessage{\m!layouts}{1}{\@@zahoogte,\realfolio}}
- {\showmessage{\m!layouts}{1}{\@@zaregels\space\v!regels,\realfolio}%
- \def\@@zahoogte{\@@zaregels\openlineheight}}%
- \doifelse{\@@zahoogte}{\v!max}
- {\balancedimensions{\teksthoogte}{\voethoogte}{\voethoogte}}
- {\balancedimensions{\teksthoogte}{\voethoogte}{\@@zahoogte}}%
- \ifdim\voethoogte<\!!zeropoint
- \global\advance\teksthoogte by \voethoogte
- \global\voethoogte=\!!zeropoint
- \global\xdef\@@zahoogte{\@@lyvoet\spatie(\v!max)}%
- \fi
- \setvsize
- \global\pagegoal=\vsize % nog corrigeren voor insertions ?
- \global\newlogostrue
- \global\newbackgroundtrue
- \global\let\pushpagedimensions=\relax
- \global\let\poppagedimensions=\dopoppagedimensions}
-
-\def\dopaslayoutaan[#1][#2]%
- {\doifelsenothing{#2}
- {\dodopaslayoutaan[#1]}
- {\def\docommando##1%
- {\addtocommalist{##1}\adaptedpages
- \setgvalue{\??za##1}{\dodopaslayoutaan[#2]}}%
- \processcommalist[#1]\docommando
- \adaptpagedimensions}}
-
-\def\paslayoutaan%
- {\dodoubleempty\dopaslayoutaan}
-
-\newif\ifmargeblokken
-
-\def\dostelmargeblokkenin[#1]%
- {\getparameters[\??mb][#1]%
- \doifelse{\@@mbstatus}{\v!start}%
- {\showmessage{\m!layouts}{4}{}%
- \margeblokkentrue
- \let\somenextfloat=\dosomenextfloat
- \let\startmargeblok=\dostartmargeblok
- \let\stopmargeblok=\dostopmargeblok}%
- {\showmessage{\m!layouts}{5}{}%
- \margeblokkenfalse
- \def\somenextfloat[##1]%
- {\someelsefloat[##1,\v!hier]}%
- \let\startmargeblok=\dontstartmargeblok
- \let\stopmargeblok=\dontstopmargeblok}}
-
-\def\stelmargeblokkenin%
- {\dosingleargument\dostelmargeblokkenin}
-
-\newbox\marginbox
-
-\def\dosomenextfloat[#1]%
- {\global\setbox\marginbox=\vbox
- {\hsize\@@mbbreedte
- \unvcopy\marginbox
- \ifvoid\marginbox\else\expandafter\@@mbtussen\fi
- \box\floatbox\filbreak}%
- \ifdim\ht\marginbox>\teksthoogte
- \dosavefloatinfo
- \else
- \doinsertfloatinfo
- \fi}
-
-\newbox\preparedmarginbox
-
-\def\reshapemargin%
- {\ifdim\ht\preparedmarginbox>\!!zeropoint
- \beginofshapebox
- \unvbox\preparedmarginbox
- \endofshapebox
- \reshapebox
- {\box\shapebox}%
- \setbox\preparedmarginbox=\vbox to \teksthoogte
- {\@@mbboven
- \flushshapebox
- \@@mbonder}%
- \fi}
-
-
-\def\plaatsrechtermargeblok%
- {\hskip\rechtermargebreedte}
-
-\def\plaatslinkermargeblok%
- {\hskip\linkermargebreedte}
-
-\def\checkmargeblokken%
- {\setbox\preparedmarginbox=\vbox
- {\forgetall
- \splittopskip\topskip
- \ifvoid\marginbox\else
- \ifdim\ht\marginbox>\teksthoogte
- \vsplit\marginbox to \teksthoogte
- \else
- \unvbox\marginbox
- \fi
- \fi}%
- \reshapemargin
- \setbox\preparedmarginbox=\vbox
- {\@@mbvoor\box\preparedmarginbox\@@mbna}%
- \def\rightmarginbox%
- {\def\plaatsrechtermargeblok%
- {\setbox\preparedmarginbox=\hbox to \rechtermargebreedte
- {\@@mblinks\box\preparedmarginbox\@@mbrechts}%
- \vsmashbox\preparedmarginbox
- \box\preparedmarginbox}}%
- \def\leftmarginbox%
- {\def\plaatslinkermargeblok%
- {\setbox\preparedmarginbox=\hbox to \linkermargebreedte
- {\@@mbrechts\box\preparedmarginbox\@@mblinks}%
- \vsmashbox\preparedmarginbox
- \box\preparedmarginbox}}%
- \processaction
- [\@@mbplaats]
- [ \v!inmarge=>\doifbothsidesoverruled
- \rightmarginbox
- \orsideone
- \rightmarginbox
- \orsidetwo
- \leftmarginbox
- \od,
- \v!midden=>\doifbothsidesoverruled
- \rightmarginbox
- \orsideone
- \leftmarginbox
- \orsidetwo
- \rightmarginbox
- \od,
- \v!links=>\leftmarginbox,
- \v!rechts=>\rightmarginbox,
- \s!unknown=>\setbox\preparedmarginbox=\hbox{}]}
-
-\def\dostartmargeblok% % 2 maal \vbox ivm \unvbox elders
- {\global\setbox\marginbox=\vtop\bgroup\vbox\bgroup
- \hsize\@@mbbreedte
- \ifvoid\marginbox\else
- \unvbox\marginbox
- \@@mbtussen
- \fi
- \steluitlijnenin[\@@mbuitlijnen]%
- \dostartattributes\??mb\c!letter\c!kleur{}%
- \begstrut\ignorespaces}
-
-\def\dostopmargeblok%
- {\unskip\endstrut
- \dostopattributes
- \egroup
- \egroup}
-
-\def\dontstartmargeblok%
- {\@@mbvoor
- \bgroup
- \dostartattributes\??mb\c!letter\c!kleur{}}
-
-\def\dontstopmargeblok%
- {\dostopattributes
- \egroup
- \@@mbna}
-
-\newcounter\nofpostponedblocks
-
-\newif\ifinuitstellen
-
-\newevery\everytopofpage\relax
-
-\appendtoks\the\everytopofpage\to\everystarttext
-\appendtoks\global\everytopofpage{}\to\everystoptext
-
-\def\douitstellen% PAS OP 2X MAIN-001
- {\the\everytopofpage
- \ifinuitstellen\else\ifcase\nofpostponedblocks\else % The \nof-test is
-\bgroup % needed
-\black % else problems inside split verbatim
-\restoreglobalbodyfont % else problems inside split verbatim
- \global\pagetotal\!!zeropoint % recently added
- \global\inuitstellentrue % definitely needed
- \dorecurse{\nofpostponedblocks} % else we can loose
- {\haalbuffer[buf-\recurselevel]} % or disorder floats
- \doflushfloats % new but potential dangerous % and that is something
- \doglobal\newcounter\nofpostponedblocks % we don't want, do we?
- \global\inuitstellenfalse % Anyhow, 'uitstellen'
-\egroup
- \fi\fi} % is still suboptimal.
-
-\setvalue{\e!start\e!uitstellen}%
- {\doglobal\increment\nofpostponedblocks
- \showmessage{\m!layouts}{3}{\nofpostponedblocks}%
- \dostartbuffer[buf-\nofpostponedblocks]
- [\e!start\e!uitstellen][\e!stop\e!uitstellen]}
-
-% \gotonextsubpage : voor de pagebody
-% \subpaginanummer : alleen in de voet/kopregels
-% \aantalsubpaginas : alleen in de voet/kopregels
-
-% \firstsubpage : eerste \realpageno, voor interne doeleinden
-% \prevsubpage : vorige \realpageno, voor interne doeleinden
-% \nextsubpage : volgende \realpageno, voor interne doeleinden
-% \lastsubpage : laatste \realpageno, voor interne doeleinden
-% \nofsubpages : laatste subpage (in berekeningen)
-% \subpageno : huidige subpage (in berekeningen)
-
-\newif\ifsubpaging
-\newif\ifshowingsubpage
-
-\definieernummer
- [\s!subpage]
-
-\stelnummerin
- [\s!subpage]
- [\c!wijze=\@@snwijze]
-
-\def\resetsubpaginanummer%
- {\resetnummer[\s!subpage]%
- \global\subpageno=\ruwenummer[\s!subpage]}
-
-\def\dostelsubpaginanummerin[#1]%
- {\doifelse{#1}{\v!reset}
- {\resetsubpaginanummer} % \resetnummer[\s!subpage]
- {\getparameters[\??sn][#1]%
- \processaction
- [\@@snstatus]
- [ \v!stop=>\ifsubpaging
- \else
- \subpagingfalse
- \fi
- \showingsubpagefalse,
- \v!start=>\subpagingtrue
- \showingsubpagetrue,
- \v!geen=>\subpagingtrue
- \showingsubpagefalse]}}
-
-\def\aantalsubpaginas%
- {\ifshowingsubpage
- \nofsubpages
- \else
- 0%
- \fi}
-
-\def\subpaginanummer%
- {\ifshowingsubpage
- \the\subpageno
- \else
- 0%
- \fi}
-
-\def\stelsubpaginanummerin%
- {\dosingleargument\dostelsubpaginanummerin}
-
-\def\newnofsubpages {0}
-\def\nofsubpages {0}
-\def\firstsubpage {1}
-\def\prevsubpage {1}
-\def\nextsubpage {1}
-\def\lastsubpage {1}
-
-\def\nextpage {1}
-\def\prevpage {1}
-
-\definetwopasslist{\s!subpage}
-
-\def\savenofsubpages%
- {\ifsubpaging
- \showmessage{\m!layouts}{6}{\newnofsubpages,\the\subpageno}%
- \immediatewriteutilitycommand%
- {\twopassentry%
- {\s!subpage}%
- {\newnofsubpages}%
- {\the\subpageno}}%
- \fi}
-
-\def\setsubpagenumbers%
- {\iftwopassdatafound
- \bgroup
- \xdef\nofsubpages{\twopassdata}%
- \xdef\firstsubpage{\realfolio}%
- \advance\realpageno by \nofsubpages
- \advance\realpageno by -1
- \xdef\lastsubpage{\realfolio}%
- \egroup
- \else
- \xdef\nofsubpages{0}%
- \fi}
-
-\def\gotonextsubpage% overlapt behoorlijk met realpage macro
- {\global\let\checksubpages=\relax
- \ifsubpaging
- \edef\oldsubpage{\the\subpageno}%
- \verhoognummer[\s!subpage]%
- \global\subpageno=\ruwenummer[\s!subpage]\relax
- \ifnum\subpageno=1
- \gettwopassdata{\s!subpage}%
- \setsubpagenumbers
- \ifnum\oldsubpage>0
- \showmessage{\m!layouts}{6}{\newnofsubpages,\oldsubpage}%
- \edef\next%
- {\writeutilitycommand%
- {\twopassentry%
- {\s!subpage}%
- {\newnofsubpages}%
- {\oldsubpage}}}%
- \next
- \fi
- \doglobal\increment\newnofsubpages\relax
- \fi
- \setglobalsystemreference\rt!page{\v!eerstesubpagina}\firstsubpage
- \setglobalsystemreference\rt!page{\v!laatstesubpagina}\lastsubpage
- \bgroup
- \ifnum\realpageno=\firstsubpage\relax
- \global\let\prevsubpage=\firstsubpage
- \setglobalsystemreference\rt!page{\v!sub\v!achteruit}\lastsubpage
- \else
- \xdef\prevsubpage{\realfolio}%
- \doglobal\decrement\prevsubpage
- \setglobalsystemreference\rt!page{\v!sub\v!achteruit}\prevsubpage
- \fi
- \setglobalsystemreference\rt!page{\v!vorigesubpagina}\prevsubpage
- \ifnum\realpageno=\lastsubpage\relax
- \global\let\nextsubpage=\lastsubpage
- \setglobalsystemreference\rt!page{\v!sub\v!vooruit}\firstsubpage
- \else
- \xdef\nextsubpage{\realfolio}%
- \doglobal\increment\nextsubpage
- \setglobalsystemreference\rt!page{\v!sub\v!vooruit}\nextsubpage
- \fi
- \setglobalsystemreference\rt!page{\v!volgendesubpagina}\nextsubpage
- \egroup
- \fi}
-
-\def\checksubpages%
- {\getfromtwopassdata{\s!subpage}{1}%
- \setsubpagenumbers
- \global\let\checksubpages=\relax}
-
-% Omdat \gotonextrealpage gebruik maakt van de hulpfile,
-% moet het initialiseren van \realpageno plaatsvinden in
-% een later stadium, namelijk zodra referenties worden
-% gebruikt (anders gaat het mis op nog niet gedefinieerde
-% lijstcommando's e.d.). De eerst aanroep vindt dan ook
-% plaats vlak nadat de hulpfile voor de eerste maal is
-% ingelezen.
-
-\countdef\realpageno = 0 \realpageno = 1
-\countdef\userpageno = 1 \userpageno = 1
-\countdef\subpageno = 2 \subpageno = 0 % !!
-\countdef\arrangeno = 3 \arrangeno = 0 % !!
-
-% we don't want conflicts when \pageno is used by other
-% packages, like CWEB, so we redefine \pageno
-
-\newcount\pageno \pageno = 1
-
-\def\setuserpageno#1%
- {\global\userpageno=#1\relax
- \global\pageno=\userpageno}
-
-\def\realfolio {\the\realpageno}
-\def\folio {\the\userpageno}
-\def\firstpage {1}
-\def\lastpage {1}
-\def\currentpage {\the\realpageno}
-
-\def\gotonextrealpage%
- {\global\advance\realpageno by 1
- \ifnum\realpageno>\lastpage
- \xdef\lastpage{\realfolio}%
- \fi
- \setglobalsystemreference\rt!page{\v!eerstepagina}\firstpage
- \setglobalsystemreference\rt!page{\v!laatstepagina}\lastpage
- \bgroup
- \ifnum\realpageno>1
- \advance\realpageno by -1
- \xdef\prevpage{\realfolio}%
- \setglobalsystemreference\rt!page{\v!achteruit}\prevpage
- \else
- \global\let\prevpage=\firstpage
- \setglobalsystemreference\rt!page{\v!achteruit}\lastpage
- \fi
- \setglobalsystemreference\rt!page{\v!vorigepagina}\prevpage
- \egroup
- \bgroup
- \ifnum\realpageno<\lastpage\relax
- \advance\realpageno by 1
- \xdef\nextpage{\realfolio}%
- \setglobalsystemreference\rt!page{\v!pagina}\nextpage
- \setglobalsystemreference\rt!page{\v!vooruit}\nextpage
- \bgroup
- \xdef\nextnextpage{\realfolio}%
- \ifodd\realpageno
- \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\nextnextpage
- \else
- \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\nextnextpage
- \fi
- \advance\realpageno by 1
- \xdef\nextnextpage{\realfolio}%
- \ifnum\realpageno>\lastpage\relax
- %\ifodd\realpageno
- % \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\lastpage
- %\else
- % \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\lastpage
- %\fi
- \else
- \ifodd\realpageno
- \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\nextnextpage
- \else
- \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\nextnextpage
- \fi
- \fi
- \egroup
- \else
- \global\let\nextpage=\lastpage
- \setglobalsystemreference\rt!page{\v!pagina}\firstpage
- \setglobalsystemreference\rt!page{\v!vooruit}\firstpage
- \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\lastpage
- \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\lastpage
- \fi
- \setglobalsystemreference\rt!page{\v!volgendepagina}\realfolio
- \egroup}
-
-\def\checkrealpage%
- {\global\realpageno=0
- \gotonextrealpage
- \global\let\checkrealpage=\relax}
-
-\def\savenofpages%
- {\advance\realpageno by -1
- \savecurrentvalue\lastpage{\realfolio}}%
-
-\def\totaalaantalpaginas%
- {\lastpage}
-
-\def\initializepaper%
- {\iflocation
- \dosetuppaper
- {\papierformaat}
- {\the\papierbreedte}
- {\the\papierhoogte}%
- \else
- \dosetuppaper
- {\printpapierformaat}
- {\the\printpapierbreedte}
- {\the\printpapierhoogte}%
- \fi}
-
-\def\myshipout#1%
- {\voorpagina % voor de pagebody dus !
- \dontshowcomposition
- \ifarrangingpages
- \actualarrange
- {\thisisrealpage{\realfolio}#1}%
- \else
- \actualshipout
- {\thisisrealpage{\realfolio}#1}%
- \fi
- \gotonextrealpage
- \napagina}
-
-\newbox\postponedcontent
-
-\def\flushatshipout%
- {\dowithnextbox
- {\global\setbox\postponedcontent=\hbox to \!!zeropoint
- {%\hskip-\maxdimen % niet hier, gaat mis in acrobat (clipt)
- \box\postponedcontent\box\nextbox}%
- \global\ht\postponedcontent=\!!zeropoint
- \global\dp\postponedcontent=\!!zeropoint
- \global\wd\postponedcontent=\!!zeropoint}%
- \hbox}
-
-% \starttypen
-% \def\pagestoshipout{1,3,5}
-% \stoptypen
-
-\newcounter\shippedoutpages
-\let\pagestoshipout\empty % {1,3,6}
-\chardef\whichpagetoshipout=0 % 0=all 1=odd 2=even
-
-\def\actualshipout#1%
- {\doglobal\increment\shippedoutpages
- \ifx\pagestoshipout\empty
- \ifcase\whichpagetoshipout\relax
- \donetrue
- \or % 1
- \ifodd\shippedoutpages\relax\donetrue\else\donefalse\fi
- \or % 2
- \ifodd\shippedoutpages\relax\donefalse\else\donetrue\fi
- \else
- \donetrue
- \fi
- \else
- \ExpandBothAfter\doifinsetelse{\shippedoutpages}{\pagestoshipout}
- \donetrue\donefalse
- \fi
- \ifdone
- \shipout\vbox
- {\forgetall
- \offinterlineskip
- \mindermeldingen
- \vskip-1in
- \hskip-1in
- \hbox
- {\setbox0=\hbox{#1}% just in case there are objects there
- \setbox\scratchbox=\hbox
- {\the\everyshipout
- \ifnum\realpageno=\lastpage\relax
- \the\everylastshipout
- \global\everylastshipout\emptytoks
- \fi}%
- \smashbox\scratchbox
- \box\scratchbox
- \box\postponedcontent % evt ver naar links !
- \box0}}%
- \else
- \message
- {[\ifarrangingpages arranged \fi page
- \ifarrangingpages\the\arrangeno\else\the\realpageno\fi\normalspace
- not flushed]}%
- \setbox0=\hbox{#1}%
- \deadcycles=0
- \fi}
-
-\def\actualarrange#1%
- {\setbox0=\hbox{\thisisrealpage{\realfolio}#1}%
- \pusharrangedpage0
- \deadcycles=0 }
-
-\def\goleftonpage%
- {\hskip-\linkermargeafstand
- \hskip-\linkermargebreedte
- %\hskip-\paginascheiding
- \hskip-\linkerrandafstand
- \hskip-\linkerrandbreedte}
-
-\def\doswapmargins%
- {\let\doswapmargins=\relax % to prevent local swapping
- \swapmacros\@@lylinkermargeafstand\@@lyrechtermargeafstand
- \swapmacros\@@lylinkerrandafstand\@@lyrechterrandafstand
- \swapdimens\linkermargebreedte\rechtermargebreedte
- \swapdimens\linkerrandbreedte\rechterrandbreedte}
-
-\def\doifmarginswapelse#1#2%
- {\doifbothsides#1\orsideone#1\orsidetwo#2\od}
-
-\def\swapmargins%
- {\doifmarginswapelse{}{\doswapmargins}}
-
-% Output routines
-%
-% \dopagecontents#1#2 : tekst, floats en footnotes
-% \dopagebody#1#2 : hoofd, \pagecontents, voet
-% \dooutput : outputroutine
-%
-% \ifinpagebody
-
-\def\doejectpage#1%
- {\bgroup % de \ifdim is nodig omdat
- \par % anders een eventuele
- \ifdim\pagetotal>\pagegoal\else % laatste regel boven de
- %\normalvfill % baseline te staan terwijl
- \normalvfil % baseline te staan terwijl
- \fi % de vorige bladzijden op
- #1% % de baseline staan
- \egroup}
-
-% ^^ NOG NETTER MAKEN, TEGELIJK MET MULTI COLUMNS EN ACHTERGRONDEN!
-
-\def\ejectpage%
- {\doejectpage\eject}
-
-\def\superejectpage%
- {\doejectpage\supereject}
-
-\def\ejectinsert%
- {\flushfootnotes
- \bgroup
- \noftopfloats=\!!thousand
- \nofbotfloats=0
- \doflushfloats
- \egroup}
-
-% De volgende macro's worden gedefinieerd in de module
-% colo-ini. Om resetten bij twee maal laden te voorkomen
-% checken we wel even. Anders krijgen we een mark-build-up.
-
-\newif\ifinpagebody
-
-\doifundefined{pushcolor} {\def\pushcolor{}}
-\doifundefined{popcolor} {\def\popcolor{}}
-\doifundefined{startcolorpage} {\def\startcolorpage{}}
-\doifundefined{stopcolorpage} {\def\stopcolorpage{}}
-
-% bewaren tvb documentatie
-%
-% \hbox to \hsize
-% {\en
-% \switchnaarkorps[5pt]%
-% \emergencystretch2em
-% \dimen0=\baselineskip
-% \baselineskip=\dimen0 plus 1pt
-% \hsize=.2\hsize
-% \vsize=2\hsize
-% \ruledvbox to \vsize{\input tufte \par}\hss
-% \ruledvbox to \vsize{\input tufte \par\kern-\prevdepth}\hss
-% \ruledvbox to \vsize{\input tufte \par\kern0pt}\hss
-% \ruledvbox to \vsize{\input tufte \par\vfill}\hss
-% \ruledvbox to \vsize{\input tufte \par\kern-\prevdepth\vfill}}
-%
-% \hbox to \hsize
-% {\en
-% \switchnaarkorps[5pt]%
-% \emergencystretch2em
-% \dimen0=\baselineskip
-% \baselineskip=\dimen0 plus 1pt
-% \hsize=.18\hsize
-% \vsize=2.5\hsize
-% \setbox0=\vbox{\input tufte\relax}%
-% \ruledvbox to \vsize{\unvcopy0}\hss
-% \ruledvbox to \vsize{\unvcopy0\kern-\dp0}\hss
-% \ruledvbox to \vsize{\unvcopy0\kern0pt}\hss
-% \ruledvbox to \vsize{\unvcopy0\vfill}\hss
-% \ruledvbox to \vsize{\unvcopy0\kern-\dp0\vfill}}
-
-\def\dopagecontents#1#2% \box<n> \unvbox<n>
- {\bgroup % niet breedte zetten, kan fractie zijn!
- \forgetall
- \boxmaxdepth=\maxdepth
- \setbox0=\vbox \ifbottomnotes to \teksthoogte \fi
- {\edef\currentpagedepth{\the\dp#2}% still to be derived from #1
- \dotopinsertions
- #1#2% \fuzzysnappedbox{#1}{#2}% goes wrong
- \pushcolor
- \ifgridsnapping
- \vskip-\currentpagedepth
- \vskip\openstrutdepth % \dp\strutbox
- \prevdepth\openstrutdepth % \dp\strutbox
- \dobotinsertions
- \vfil
- \else\ifr@ggedbottom
- \vskip-\currentpagedepth
- \vskip\openstrutdepth % \dp\strutbox
- \prevdepth\openstrutdepth % \dp\strutbox
- \dobotinsertions
- \vfil
- \else\ifb@selinebottom
- \kern-\currentpagedepth
- \kern\maxdepth
- \dobotinsertions
- \fi\fi\fi
- \ifdim\ht\footins>\!!zeropoint % beter dan \ifvoid\footins\else
- \kern\skip\footins
- \kern\ht\footins
- \fi}%
-\ifbottomnotes
- \ifgridsnapping
- \getnoflines\teksthoogte
- \advance\noflines by -1
- \scratchdimen=\noflines\lineheight
- \advance\scratchdimen by \topskip
- \else
- \scratchdimen=\ht0
- \fi
-\else
- \scratchdimen=\!!zeropoint
-\fi
- \setbox2=\hbox
- {\ifvoid\savedfootins \else
- \setbox\footins=\box\savedfootins
- \fi
- \lower\scratchdimen\vbox{\placefootnotes}}%
- \smashbox2
-\ifbottomnotes
- \ht0=\!!zeropoint
-\fi
-%% \setbox0= % todo, there must be a faster way to kill funny depths
- \vbox to \teksthoogte
- {\box0\box2\ifbottomnotes\else\vfill\fi}%
-%% \dp0=\!!zeropoint \box0 % new
- \egroup}
-
-\def\dodummypageskip#1%
- {\getvalue{\s!dummy\c!commando#1}}
-
-\setvalue{\s!dummy\c!commando\v!links}%
- {\hskip\linkerrandbreedte}
-
-\setvalue{\s!dummy\c!commando\v!rechts}%
- {\hskip\rechterrandbreedte}
-
-\setvalue{\s!dummy\c!commando\v!boven}%
- {\vskip\bovenhoogte} % \vbox to \bovenhoogte{\vss}}
-
-\setvalue{\s!dummy\c!commando\v!onder}%
- {\vskip\onderhoogte} % \vbox to \onderhoogte{\vss}}
-
-\def\plaatslinkerrandblok {\dodummypageskip\v!links}
-\def\plaatsrechterrandblok {\dodummypageskip\v!rechts}
-
-\def\plaatsboventekstblok {\dodummypageskip\v!boven}
-\def\plaatsondertekstblok {\dodummypageskip\v!onder}
-
-% kan tzt nog eens als:
-%
-% \newtoks\everyboventekstblok
-%
-%\def\plaatsboventekstblok%
-% {\vbox to \bovenhoogte
-% {\the\everyboventekstblok}
-%
-% \def\doplaatsboventekstblok#1%
-% {\vbox to \bovenhoogte
-% {\@@tkboventekstvoor#1\@@tkboventekstna\kern\!!zeropoint}%
-% \vskip-\bovenhoogte}
-%
-% \appendtoks\interactiemenus[\v!boven]\to\everyboventekstblok
-%
-% kan vaker, is namelijk sneller als commalist
-
-\newtoks\afterpage \newtoks\aftereverypage
-\newtoks\beforepage \newtoks\beforeeverypage
-
-\newif\ifshowgrid \showgridfalse
-
-\def\toongrid%
- {\tracegridsnappingtrue
- \showgridtrue}
-
-\def\doplaatstekstblok#1#2%
- {\bgroup
- \setbox0=\hbox to \zetbreedte
- {\hss % new
- \vbox to \teksthoogte % can be < \makeupwidth
- {\offinterlineskip % so don't change this
- \tekstbreedte=\zetbreedte %
- \doifsomething{\@@lytekstbreedte} %
- {\tekstbreedte=\@@lytekstbreedte}%
- \hsize=\tekstbreedte % local variant of \sethsize
- \boxmaxdepth\maxdepth %
- \noindent % the contents can be < \hsize
- \dopagecontents#1#2}%
- \hss}% new
-\ifsomebackgroundfound\v!tekst % sneller
- \setbox0=\hbox\localframed
- [\??ma\v!tekst]
- [\c!strut=\v!nee,\c!offset=\v!overlay,
- \c!breedte=\zetbreedte,\c!hoogte=\teksthoogte]
- {\dp0=\!!zeropoint\box0}%
-\fi
- \ht0=\teksthoogte
- \wd0=\zetbreedte
- \dp0=\!!zeropoint % new, maybe a reason for small shifts
- \ifshowgrid
- \setgridbox2\zetbreedte\teksthoogte
- \hbox{\color[red]{\box2}\hskip-\zetbreedte\box0}%
- \else
- \box0
- \fi
- \egroup}
-
-\def\getmainbox#1#2%
- {\setbox0=\vbox
- {\offinterlineskip % na \paginaletter !
- \calculatereducedvsizes
- \calculatehsizes
- \swapmargins
- \vskip\hoofdhoogte
- \vskip\hoofdafstand
- \hbox
- {\bgroup
- \swapmargins
- \goleftonpage
- \plaatslinkerrandblok
- \hskip\linkerrandafstand
- %\showpageseparation
- \plaatslinkermargeblok
- \hskip\linkermargeafstand
- \egroup
- \doplaatstekstblok#1#2%
- \bgroup
- \hskip\rechtermargeafstand
- \plaatstestinfo
- \plaatsrechtermargeblok
- %\showpageseparation
- \hskip\rechterrandafstand
- \plaatsrechterrandblok
- \egroup}%
- \vfill}
- \smashbox0
- \box0}
-
-\def\centerpagebox#1%
- {\printpapierbreedte=\papierschaal\printpapierbreedte
- \printpapierhoogte =\papierschaal\printpapierhoogte
- \setbox#1=\vbox to \printpapierhoogte
- {\@@ppboven
- \hbox to \printpapierbreedte
- {\ifdoublesidedprint
- \doifbothsides
- \@@pplinks\box#1\@@pprechts
- \orsideone
- \@@pplinks\box#1\@@pprechts
- \orsidetwo
- \@@pprechts\box#1\@@pplinks
- \od
- \else
- \@@pplinks\box#1\@@pprechts
- \fi}%
- \par
- \@@pponder}}
-
-\def\offsetprintbox#1%
- {\dimen0=\wd#1\dimen2=\ht#1\dimen4=\dp#1%
- \setbox#1=\vbox
- {\forgetall
- \offinterlineskip
- \vskip\kopoffset
- \doifbothsides
- \hskip\rugoffset
- \orsideone
- \hskip\rugoffset
- \orsidetwo
- \hskip-\rugoffset
- \od
- \box#1}%
- \wd#1=\dimen0\ht#1=\dimen2\dp#1=\dimen4}
-
-\def\replicatebox#1#2#3%
- {\setbox#1=\vbox
- {\forgetall
- \offinterlineskip
- \dorecurse{#3}
- {\hbox{\dorecurse{#2}{\copy#1\hskip\@@lydx}\unskip}%
- \vskip\@@lydy}
- \unskip}}
-
-\def\replicatepagebox#1%
- {\ifnum\@@lynx>0 \ifnum\@@lyny>0
- \replicatebox{#1}{\@@lynx}{\@@lyny}%
- \fi\fi}
-
-\def\rotatepagebodybox#1#2#3%
- {\ifnum#2#3>0
- \setbox#1=\vbox
- {\edef\somerotation%
- {\ifdubbelzijdig\ifodd\realpageno#2\else#3\fi\else#2\fi}%
- \dorotatebox\somerotation\hbox{\box#1}}%
- \fi}
-
-\def\rotatepaperbox#1%
- {\rotatepagebodybox{#1}\paperrotation\paperreverse}
-
-\def\rotateprintbox#1%
- {\rotatepagebodybox{#1}\printrotation\printreverse}
-
-\def\mirrorpagebodybox#1#2%
- {\ifcase#2\or
- \setbox#1=\vbox
- {\domirrorbox\vbox{\box#1}}%
- \fi}
-
-\def\mirrorpaperbox#1%
- {\mirrorpagebodybox{#1}\papermirror}
-
-\def\mirrorprintbox#1%
- {\mirrorpagebodybox{#1}\printmirror}
-
-\def\scalepagebox#1%
- {\ifdim\@@lyschaal pt=1pt \else
- \setbox#1=\vbox
- {\schaal[\c!sx=\@@lyschaal,\c!sy=\@@lyschaal]{\box#1}}%
- \papierbreedte=\@@lyschaal\papierbreedte
- \papierhoogte =\@@lyschaal\papierhoogte
- \fi}
-
-\def\negateprintbox#1%
- {\ifnegateprintbox
- \negatecolorbox{#1}%
- \fi}
-
-\def\buildpagebox#1%
- {\setbox#1=\vbox to \papierhoogte
- {\hsize\papierbreedte
- \vskip\kopwit
- \doifbothsides
- \hskip\rugwit
- \orsideone
- \hskip\rugwit
- \orsidetwo
- \hskip\papierbreedte
- \hskip-\rugwit
- \hskip-\zetbreedte
- \od
- \box#1}%
- \dp#1=\!!zeropoint}
-
-\def\pagecutmarksymbol%
- {\the\realpageno}%
-
-\def\addpagecutmarks#1%
- {\doif{\@@lymarkering}{\v!aan}
- {\let\cutmarksymbol=\pagecutmarksymbol
- \makecutbox{#1}}}
-
-\def\addpagecolormarks#1%
- {\doif{\@@lymarkering}{\v!kleur}
- {\let\cutmarksymbol=\pagecutmarksymbol
- \makecutbox{#1}%
- \ifnum\horizontalcutmarks>1 \chardef\colormarkoffset=4 \fi
- \ifnum\verticalcutmarks >1 \chardef\colormarkoffset=4 \fi
- \colormarkbox{#1}}}
-
-\newif\ifpagebodyornaments \pagebodyornamentstrue
-\newif\ifarrangingpages \arrangingpagesfalse
-
-\let\poparrangedpages=\relax
-\let\pusharrangedpage=\relax
-
-\def\reportarrangedpage#1%
- {\showmessage
- {\m!systems}{23}
- {\the\realpageno.\the\pageno\ifnum\subpageno>0 .\the\subpageno\fi,#1}}
-
-\def\buildpagebody#1#2%
- {\vbox
- {\beginrestorecatcodes
- \forgetall % igv problemen, check: \boxmaxdepth\maxdimen
-\ifnewbackground\enablemode[\systemmodeprefix\v!achtergrond]\fi
- \boxmaxdepth\maxdimen % new
- \mindermeldingen
- \setbox0=\vbox
- {\offinterlineskip
- \ifpagebodyornaments
- \getbackgroundbox
- \getlogobox
- \bgroup % else footnotes get inconsistent font/baseline
- \doconvertfont{\@@lyletter}{}%
- \offinterlineskip
- \gettextboxes
- \egroup
- \fi
- \getmainbox#1#2}% including footnotes
- \buildpagebox0
- \ifpagebodyornaments
- \addpagebackground0
- \fi
- \ifarrangingpages \else
- \addpagecutmarks0
- \replicatepagebox0
- \scalepagebox0
- \mirrorpaperbox0
- \rotatepaperbox0
- \addpagecolormarks0
- \centerpagebox0
-\addprintbackground0
- \mirrorprintbox0
- \rotateprintbox0
- \offsetprintbox0
- \negateprintbox0
- \fi
- \box0
- \endrestorecatcodes}}
-
-\def\addprintbackground#1%
- {\ifsomebackgroundfound\v!papier
- \setbox#1=\vbox\localframed
- [\??ma\v!papier]%
- [\c!offset=\v!overlay,\c!strut=\v!nee,
- \c!breedte=\printpapierbreedte,\c!hoogte=\printpapierhoogte]%
- {\noindent\box#1}%
- \fi}
-
-\def\finishpagebox#1%
- {\ifarrangingpages
- \addpagecutmarks#1%
- \addpagecolormarks#1%
- \centerpagebox#1%
- \mirrorprintbox#1%
- \rotateprintbox#1%
- \offsetprintbox#1%
- \negateprintbox#1%
- \fi}
-
-% TBV testdoeleinden:
-
-\def\dotoonprint[#1][#2][#3]%
- {\framed
- [\c!offset=\v!overlay,
- \c!strut=\v!nee]
- {\forgetall
- \mindermeldingen
- \globaldefs=-1
- \dimen0=\pagegoal
- \definieerpapierformaat[X][\c!breedte=4em, \c!hoogte=6em]%
- \definieerpapierformaat[Y][\c!breedte=12em,\c!hoogte=14em]%
- \stelpapierformaatin[#1,X][#2,Y]%
- \stellayoutin[#3]%
- \setbox0=\vbox
- {\framed
- [\c!offset=\v!overlay,\c!strut=\v!nee,
- \c!breedte=\papierbreedte,\c!hoogte=\papierhoogte]
- {\ss ABC\par DEF}}%
- \dubbelzijdigfalse
- \def\cutmarklength{.5em}%
- \addpagecutmarks0%
- \replicatepagebox0%
- \scalepagebox0%
- \mirrorpaperbox0%
- \rotatepaperbox0%
- \centerpagebox0%
- \mirrorprintbox0%
- \rotateprintbox0%
- \offsetprintbox0%
- \pagegoal=\dimen0
- \box0}}
-
-\def\toonprint%
- {\dotripleempty\dotoonprint}
-
-% \switchnaarkorps[8pt]
-%
-% \startcombinatie[4*4]
-% {\toonprint} {\strut}
-% {\toonprint[][][plaats=midden]} {\type{plaats=midden}}
-% {\toonprint[][][plaats=midden,markering=aan]} {\type{markering=aan}\break
-% \type{plaats=midden}}
-% {\toonprint[][][plaats=midden,markering=aan,nx=2]} {\type{markering=aan}\break
-% \type{plaats=midden}\break
-% \type{nx=2}}
-% {\toonprint[][][plaats=links]} {\type{plaats=links}}
-% {\toonprint[][][plaats=rechts]} {\type{plaats=rechts}}
-% {\toonprint[][][plaats={links,onder}]} {\type{plaats={links,onder}}}
-% {\toonprint[][][plaats={rechts,onder}]} {\type{plaats={rechts,onder}}}
-% {\toonprint[][][nx=2,ny=1]} {\type{nx=2,ny=1}}
-% {\toonprint[][][nx=1,ny=2]} {\type{nx=1,ny=2}}
-% {\toonprint[][][nx=2,ny=2]} {\type{nx=2,ny=2}}
-% {\toonprint[][][nx=2,ny=2,plaats=midden]} {\type{nx=2,ny=2}\break
-% \type{plaats=midden}}
-% {\toonprint[][][rugoffset=3pt]} {\type{rugoffset=.5cm}}
-% {\toonprint[][][kopoffset=3pt]} {\type{kopoffset=.5cm}}
-% {\toonprint[][][schaal=1.5]} {\type{schaal=1.5}}
-% {\toonprint[][][schaal=0.8]} {\type{schaal=0.8}}
-% \stopcombinatie
-%
-% \startcombinatie[3*4]
-% {\toonprint[liggend][][plaats=midden]} {\type{liggend}}
-% {\toonprint[][liggend][plaats=midden]} {\strut\break\type{liggend}}
-% {\toonprint[liggend][liggend][plaats=midden]} {\type{liggend}\break\type{liggend}}
-% {\toonprint[90][][plaats=midden]} {\type{90}}
-% {\toonprint[][90][plaats=midden]} {\strut\break\type{90}}
-% {\toonprint[90][90][plaats=midden]} {\type{90}\break\type{90}}
-% {\toonprint[180][][plaats=midden]} {\type{180}}
-% {\toonprint[][180][plaats=midden]} {\strut\break\type{180}}
-% {\toonprint[180][180][plaats=midden]} {\type{180}\break\type{180}}
-% {\toonprint[gespiegeld][][plaats=midden]} {\type{gespiegeld}}
-% {\toonprint[][gespiegeld][plaats=midden]} {\strut\break\type{gespiegeld}}
-% {\toonprint[gespiegeld][gespiegeld][plaats=midden]} {\type{gespiegeld}\break\type{gespiegeld}}
-% \stopcombinatie
-
-\chardef\normalpagebox=255
-
-\appendtoks \restoreglobalbodyfont \to \everypagebody
-\appendtoks \restorecolumnsettings \to \everypagebody
-
-\def\dopagebody#1#2%
- {\getallmarks
- \the\everypagebody
- \startcolorpage
- \gotonextsubpage % nog eens: als in pagina (tbv standaard opmaak)
- \dontshowboxes % dan hier blokkeren en verderop resetten
- \naastpagina
- \checkreferences
- \checkmargeblokken
- \dotoks\beforeeverypage
- \flushtoks\beforepage
- \inpagebodytrue\buildpagebody#1#2%
- \flushtoks\afterpage
- \dotoks\aftereverypage
- \resetpagina
- \updatelistreferences
- \resetlayoutregels % mischien in shipout
- \stopcolorpage}
-
-\def\beforefinaloutput%
- {}
-
-\def\afterfinaloutput%
- {\forgetall
- \vskip\!!zeropoint\relax
- \ifvoid\normalpagebox
- \else
- \unvbox\normalpagebox
- \penalty\outputpenalty
- \fi
- \ifnum\outputpenalty>-\@MM\relax
- \else
- \dosupereject
- \fi
- \inpagebodytrue % needed for enabling \blanko !
- \dosetbothinserts
- \setvsize % this is needed for interacting components, like floats and multicolumns
- \adaptfuzzypagegoal} % watch this hack!
-
-\def\setpagecounters%
- {\setuserpageno{\ruwenummer[\s!page]}%
- \doifelse{\@@snstatus}{\v!stop}
- {\global\subpageno=0}
- {\global\subpageno=\ruwenummer[\s!subpage]}}
-
-\newtoks\pageboundsettings
-
-\prependtoks \initializepaper \to \pageboundsettings
-
-\def\dofinaloutput#1#2%
- {\beforefinaloutput
- \the\everybeforeshipout
- \ifspecialbasedsettings
- \myshipout{\hbox{\hbox to \!!zeropoint{\the\pageboundsettings}\hbox{\dopagebody#1#2\setpagecounters}}}%
- \else
- \the\pageboundsettings
- \myshipout{\hbox{\dopagebody#1#2\setpagecounters}}%
- \fi
- \the\everyaftershipout
- \afterfinaloutput
- \popcolor} % ... and here ...
-
-\def\donofinaloutput#1#2%
- {\beforefinaloutput
- \the\everybeforeshipout
- \setpagecounters
- \message{[-\the\realpageno]}%
- \setbox0=\hbox
- {\the\everyshipout
- \dopagebody#1#2}%
- \deadcycles=0
- \gotonextrealpage
- \the\everyaftershipout
- \afterfinaloutput
- \popcolor} % ... and here
-
-\let\checkpageversion=\relax
-
-\def\finaloutput#1#2%
- {\checkpageversion
- \ifverwerken
- \ifgeselecteerd
- \dofinaloutput#1#2%
- \else
- \donofinaloutput#1#2%
- \fi
- \else
- \ifgeselecteerd
- \donofinaloutput#1#2%
- \else
- \dofinaloutput#1#2%
- \fi
- \fi
- \resetselectiepagina
- \verhoogpaginanummer
- \checkpagedimensions
- \ifnum\outputpenalty>-\@MM\relax
- \else
- \dosupereject
- \fi
- \douitstellen}
-
-\def\dooutput%
- {\finaloutput\unvbox\normalpagebox}
-
-\maxdeadcycles=1000
-
-\output={\dooutput}
-
-\newbox\leftlogos
-\newbox\rightlogos
-
-\newif\ifnewlogos
-
-% \logostatus
-%
-% 0 = niet plaatsen > 0
-% 1 = direkt plaatsen > 1
-% 2 = berekenen en plaatsen > 1
-% 3 = een pagina berekenen en plaatsen > 2
-
-\def\logostatus{0}
-
-\def\gedefinieerdebeeldmerken{}
-\def\teplaatsenbeeldmerken{}
-
-\def\dodefinieerbeeldmerk[#1][#2][#3][#4]%
- {\addtocommalist{#1}\gedefinieerdebeeldmerken
- \setvalue{\??lo#2#3}{#1}%
- \getparameters[\??lo#2#3][#4]%
- \gdef\logostatus{2}}
-
-\def\definieerbeeldmerk%
- {\doquadrupleargument\dodefinieerbeeldmerk}
-
-\def\complexplaatsbeeldmerken[#1]%
- {\xdef\teplaatsenbeeldmerken{#1}%
- \gdef\logostatus{3}}
-
-\def\simpleplaatsbeeldmerken%
- {\global\let\teplaatsenbeeldmerken=\gedefinieerdebeeldmerken
- \gdef\logostatus{3}}
-
-\definecomplexorsimple\plaatsbeeldmerken
-
-\def\doplaatsbeeldmerken#1#2%
- {\bgroup
- \setbox0=\vbox
- {\hbox
- {\ifnum\logostatus=3
- \def\docommando##1%
- {\ExpandBothAfter\doifinset{\getvalue{\??lo#1##1}}{\teplaatsenbeeldmerken}
- {#2{\hbox{\getvalue{\??lo#1##1\c!commando}}}}}%
- \else
- \def\docommando##1%
- {\doifvalue{\??lo#1##1\c!status}{\v!start}
- {#2{\hbox{\getvalue{\??lo#1##1\c!commando}}}}}%
- \fi
- \def\dodocommando##1##2##3##4##5##6%
- {\hskip\linkerrandafstand
- %\hskip\pageseparation
- \hbox to \linkermargebreedte{\docommando{##2}\hss}%
- \hskip\linkermargeafstand
- \hbox to \zetbreedte{\docommando{##3}\hss\docommando{##4}}%
- \hskip\rechtermargeafstand
- \hbox to \rechtermargebreedte{\hss\docommando{##5}}%
- %\hskip\pageseparation
- \hskip\rechterrandafstand
- \hbox to \rechterrandbreedte{\hss\docommando{##6}}}%
- \normalbaselines
- \hsmash
- {\hbox to \zetbreedte{\hss\docommando\c!midden\hss}}%
- \hsmash
- {\doifbothsides
- \hskip-\rugwit
- \orsideone
- \hskip-\rugwit
- \orsidetwo
- \hskip-\papierbreedte
- \hskip+\rugwit
- \hskip+\zetbreedte
- \od
- \hbox to \papierbreedte{\docommando\v!pagina\hss}}%
- \swapmargins
- \goleftonpage
- \doifbothsidesoverruled
- \dodocommando
- {\v!linkerrand}{\v!linkermarge}{\v!links}
- {\v!rechts}{\v!rechtermarge}{\v!rechterrand}%
- \orsideone
- \dodocommando
- {\v!linkerrand}{\v!linkermarge}{\v!links}
- {\v!rechts}{\v!rechtermarge}{\v!rechterrand}%
- \orsidetwo
- \dodocommando
- {\v!rechterrand}{\v!rechtermarge}{\v!rechts}
- {\v!links}{\v!linkermarge}{\v!linkerrand}%
- \od}}%
- \getboxheight\dimen0\of\box0\relax
- \vskip-\dimen0
- \box0
- \egroup}
-
-\def\setlogobox#1#2%
- {\global\setbox#1=\vbox to \papierhoogte
- {\offinterlineskip
- \mindermeldingen
- \calculatereducedvsizes
- #2\relax
- \vskip-\kopwit
- \doplaatsbeeldmerken\v!boven\vsmash
- \vskip\kopwit
- \doplaatsbeeldmerken\v!hoofd\vsmash
- \vskip\hoofdhoogte
- \vskip\hoofdafstand
- \doplaatsbeeldmerken\v!tekst\vsmash % evt \vbox
- \vskip\teksthoogte
- \vskip\voetafstand
- \vskip\voethoogte
- \doplaatsbeeldmerken\v!voet\vbox
- \vfilll
- \doplaatsbeeldmerken\v!onder\vbox%
- \vskip\kopwit}
- \smashbox#1}
-
-\def\setlogoboxes%
- {\showmessage{\m!layouts}{7}{}%
- \setlogobox\leftlogos\relax
- \ifdubbelzijdig
- \setlogobox\rightlogos\doswapmargins
- \fi}
-
-\def\getlogobox%
- {\ifnum\logostatus>0
- \ifnum\logostatus=3
- \setlogoboxes
- \gdef\logostatus{2}%
- \else\ifnum\logostatus=2
- \setlogoboxes
- \gdef\logostatus{1}%
- \else\ifnewlogos
- \gdef\logostatus{2}%
- \setlogoboxes
- \gdef\logostatus{1}%
- \global\newlogosfalse
- \fi\fi\fi
- \doifmarginswapelse
- {\copy\leftlogos}
- {\copy\rightlogos}%
- \fi}
-
-% Het gebruik van \skip's spaart \dimen's.
-
-\newskip\xpositie
-\newskip\ypositie
-
-\newskip\xafmeting
-\newskip\yafmeting
-
-\newskip\xoffset
-\newskip\yoffset
-
-\newbox\positiebox
-
-\def\startpositioneren%
- {\bgroup
- \xpositie=\!!zeropoint
- \ypositie=\!!zeropoint
- \xafmeting=\!!zeropoint
- \yafmeting=\!!zeropoint
- \xoffset=\!!zeropoint
- \yoffset=\!!zeropoint
- \hfuzz=30cm
- \vfuzz=30cm
- \setbox\positiebox=\hbox\bgroup}
-
-\def\stoppositioneren%
- {\doifnot{\@@psoffset}{\v!ja}
- {\global\xoffset=\!!zeropoint
- \global\yoffset=\!!zeropoint}%
- \global\advance\xafmeting by \xoffset
- \global\advance\yafmeting by \yoffset
- \egroup
- \vbox to \yafmeting
- {\vskip\yoffset
- \hbox to \xafmeting
- {\hskip\xoffset
- \box\positiebox
- \hfill}%
- \vfill}%
- \egroup}
-
-\def\resetpositioneren%
- {\getparameters[\??ps]
- [\c!status=\v!start,
- \c!eenheid=\s!cm,
- \c!factor=1,
- \c!xfactor=\@@psfactor,
- \c!yfactor=\@@psfactor,
- \c!schaal=1,
- \c!xschaal=\@@psschaal,
- \c!yschaal=\@@psschaal,
- \c!xstap=\v!absoluut,
- \c!ystap=\v!absoluut,
- \c!xoffset=\!!zeropoint,
- \c!yoffset=\!!zeropoint]}
-
-\resetpositioneren
-
-\def\stelpositionerenin%
- {\resetpositioneren
- \dodoubleargument\getparameters[\??ps]}%
-
-% \def\positioneer(#1,#2)#3% \nextbox
-% {\setbox0=\hbox{#3}%
-% \def\berekenpositioneren##1##2##3##4##5##6##7##8##9%
-% {\skip0=##1\@@pseenheid\relax
-% \skip0=##8\skip0\relax
-% \skip0=##9\skip0\relax
-% \doifelse{##2}{\v!relatief}%
-% {\advance\skip0 by ##3\relax
-% \advance\skip0 by ##4\relax
-% \def##4{\!!zeropoint}}%
-% {\advance\skip0 by ##4\relax}%
-% ##3=\skip0\relax
-% \doifnot{\@@psstatus}{\v!overlay}
-% {\skip2=##5\relax
-% \advance\skip2 by ##3\relax
-% \ifdim##3<-##7\relax\global##7=-##3\relax\fi
-% \ifdim\skip2>##6\relax\global##6=\skip2\relax\fi}}%
-% \berekenpositioneren{#1}{\@@psxstap}{\xpositie}
-% {\@@psxoffset}{\wd0}{\xafmeting}{\xoffset}
-% {\@@psxschaal}{\@@psxfactor}%
-% \skip4=\ht0 \advance\skip4 by \dp0
-% \berekenpositioneren{#2}{\@@psystap}{\ypositie}
-% {\@@psyoffset}{\skip4}{\yafmeting}{\yoffset}
-% {\@@psyschaal}{\@@psyfactor}%
-% \vbox to \!!zeropoint % kan beter.
-% {\vskip\ypositie
-% \hbox to \!!zeropoint
-% {\hskip\xpositie
-% \box0
-% \hskip-\xpositie}%
-% \vskip-\ypositie}%
-% \ignorespaces}
-
-\def\berekenpositioneren#1#2#3#4#5#6#7#8#9%
- {\setdimensionwithunit\scratchskip{#1}\@@pseenheid % \scratchskip=#1\@@pseenheid
- \scratchskip=#8\scratchskip
- \scratchskip=#9\scratchskip
- \advance\scratchskip by #4\relax
- \doif{#2}{\v!relatief}%
- {\advance\scratchskip by #3%
- \let#4\!!zeropoint}%
- #3=\scratchskip\relax
- \doifnot{\@@psstatus}{\v!overlay}
- {\scratchskip=#5\relax
- \advance\scratchskip by #3\relax
- \ifdim#3<-#7\relax\global#7=-#3\relax\fi
- \ifdim\scratchskip>#6\relax\global#6=\scratchskip\relax\fi}}
-
-\def\positioneer%
- {\dosingleempty\dopositioneer}
-
-\def\dopositioneer[#1]#2(#3,#4)%
- {\dowithnextbox
- {\bgroup
- \getparameters[\??ps][#1]%
- \dontcomplain
- \berekenpositioneren{#3}{\@@psxstap}{\xpositie}
- {\@@psxoffset}{\wd\nextbox}{\xafmeting}{\xoffset}
- {\@@psxschaal}{\@@psxfactor}%
- \scratchdimen=\ht\nextbox \advance\scratchdimen by \dp\nextbox
- \berekenpositioneren{#4}{\@@psystap}{\ypositie}
- {\@@psyoffset}{\scratchdimen}{\yafmeting}{\yoffset}
- {\@@psyschaal}{\@@psyfactor}%
- \vbox to \!!zeropoint % kan beter.
- {\vskip\ypositie
- \hbox to \!!zeropoint
- {\hskip\xpositie
- \box\nextbox
- \hskip-\xpositie}%
- \vskip-\ypositie}%
- \xdef\dopoppositioneer%
- {\xpositie=\the\xpositie
- \ypositie=\the\ypositie
- \noexpand\def\noexpand\@@psxoffset{\@@psxoffset}%
- \noexpand\def\noexpand\@@psyoffset{\@@psyoffset}}%
- \egroup
- \dopoppositioneer
- \ignorespaces}
- \hbox}
-
-\newif\ifbinnenkolommen
-\newif\if@@klbalanceren
-\newif\if@@kluitlijnen
-
-\binnenkolommenfalse
-
-\def\stelkolommenin%
- {\dodoubleargument\dostelkolommenin}
-
-\def\stelkolommenin[#1]%
- {\getparameters[\??kl][#1]%
- \nofcolumns=\@@kln\relax
- \processaction
- [\@@kllijn]
- [ \v!aan=>\let\betweencolumns=\linebetweencolumns,
- \v!uit=>\let\betweencolumns=\spacebetweencolumns,
- \s!default=>\let\betweencolumns=\spacebetweencolumns,
- \s!unknown=>\let\betweencolumns=\@@kllijn]}
-
-\def\linebetweencolumns%
- {\bgroup
- \startcolorpage
- \ifdim\@@klafstand>\!!zeropoint
- \dimen0=\@@klafstand
- \else
- \dimen0=\linewidth
- \fi
- \advance\dimen0 by -\linewidth
- \hskip.5\dimen0
- \vrule
- \!!width\linewidth
- \ifb@selinebottom\!!depth\strutdepth\fi
- \hskip.5\dimen0\relax
- \stopcolorpage
- \egroup}
-
-\def\spacebetweencolumns%
- {\hskip\@@klafstand}
-
-\presetlocalframed[\??kl]
-
-\def\backgroundfinishcolumnbox%
- {\doifinsetelse{\@@kloffset}{\v!geen,\v!overlay}
- {\let\@@kloffset\!!zeropoint}
- {\scratchdimen=\@@kloffset
- \advance\scratchdimen by -\@@kllijndikte
- \edef\@@kloffset{\the\scratchdimen}}%
- \localframed
- [\??kl]
- [\c!strut=\v!nee,
- \c!breedte=\v!passend,
- \c!hoogte=\v!passend,
- \c!uitlijnen=]}
-
-\let\restorecolumnsettings\relax
-
-\def\complexstartkolommen[#1]% %% \startkolommen
- {\bgroup
- \let\stopkolommen=\egroup
- \ifbinnenkolommen
- \else
- \stelkolommenin[#1]%
- \ifnum\@@kln>1\relax
- \witruimte
- \begingroup
- \doif{\@@kloptie}{\v!achtergrond}
- {\let\finishcolumnbox = \backgroundfinishcolumnbox
- \def\columntextoffset{\@@kloffset}}%
- \ifx\@@klcommando\empty\else
- \let\postprocesscolumnline\@@klcommando
- \fi
- \doifelsenothing{\@@klhoogte}
- {\heightencolumnsfalse}
- {\heightencolumnstrue}%
- \doifelse{\@@klrichting}{\v!rechts}
- {\reversecolumnsfalse}
- {\reversecolumnstrue}%
- \doifelse{\@@klbalanceren}{\v!ja}
- {\balancecolumnstrue}
- {\balancecolumnsfalse}%
- \processaction % ook nog: laatsteuitlijnen
- [\@@kluitlijnen]
- [ \v!ja=>\stretchcolumnstrue
- \inheritcolumnsfalse,
- \v!nee=>\stretchcolumnsfalse
- \inheritcolumnsfalse,
- \v!tekst=>\stretchcolumnsfalse
- \inheritcolumnstrue]%
- \nofcolumns=\@@kln
- %
- % probably more is needed, and how about nesting save's
- %
- \savecurrentblanko
- \savecurrentwitruimte
- \def\restorecolumnsettings%
- {\boxmaxdepth\maxdimen % done elsewhere
- \restorecurrentblanko
- \restorecurrentwitruimte}%
- %
- \edef\fixedcolumnheight{\@@klhoogte}%
-\edef\minbalancetoplines{\@@klnboven}%
- \steltolerantiein[\@@kltolerantie]% %% \startkolommen
- \stelblankoin[\@@klblanko]%
- \ifdim\tussenwit>\!!zeropoint
- \stelwitruimtein[\@@klblanko]%
- \fi
- \def\stopkolommen%
- {\endmulticolumns
- \global\binnenkolommenfalse
- \endgroup
- \egroup}%
- \global\binnenkolommentrue
- \beginmulticolumns
- \fi
- \fi}
-
-\definecomplexorsimpleempty\startkolommen
-
-%\def\kolom%
-% {\ifbinnenkolommen
-% \ejectcolumn
-% \fi}
-
-\def\preferredejectcolumn%
- {\goodbreak}
-
-% \def\forcedejectcolumn%
-% {\vfil
-% \penalty-200
-% \prevdepth=-1000pt % signals top of column to \blanko
-% \vfilneg}
-
-\def\forcedejectcolumn%
- {\par % todo: since
- {\testrulewidth\!!zeropoint\ruledvskip\teksthoogte} % we misuse a
- \penalty-200 % side effect
- \vskip-\teksthoogte
- \prevdepth=-1000pt} % signals top of column to \blanko
-
-\def\kolom%
- {\dosingleempty\dokolom}
-
-\def\dokolom[#1]%
- {\ifbinnenkolommen
- \iffirstargument
- \processaction
- [#1]
- [ \v!ja=>\forcedejectcolumn,
- \v!voorkeur=>\preferredejectcolumn]%
- \else
- \preferredejectcolumn
- \fi
- \fi}
-
-%D Undocumented and still under development.
-
-\def\startsimplecolumns%
- {\dosingleempty\dostartsimplecolumns}
-
-\def\dostartsimplecolumns[#1]%
- {\bgroup
- \getparameters[\??kl][\c!breedte=\hsize,\c!afstand=1.5\korpsgrootte,\c!n=2,#1]%
- \setrigidcolumnhsize\@@klbreedte\@@klafstand\@@kln
- \setbox\scratchbox=\vbox\bgroup
- \forgetall} % \blanko[\v!blokkeer]
-
-\def\stopsimplecolumns%
- {\removebottomthings
- \egroup
- \rigidcolumnbalance\scratchbox
- \egroup}
-
-\def\dotoonkader[#1][#2]%
- {\ifsecondargument
- \stelachtergrondenin
- [#1][#2]
- [\c!achtergrond=,
- \c!kader=\v!aan,
- \c!hoek=\v!recht,
- \c!kaderoffset=\!!zeropoint,
- \c!kaderdiepte=\!!zeropoint,
- \c!kaderkleur=]
- \else\iffirstargument
- \toonkader
- [\v!hoofd,\v!tekst,\v!voet]
- [#1]
- \else
- \toonkader
- [\v!hoofd,\v!tekst,\v!voet]
- [\v!linkerrand,\v!linkermarge,
- \v!tekst,
- \v!rechtermarge,\v!rechterrand]
- \fi\fi
- \stelachtergrondenin
- [\c!status=\v!herhaal]}
-
-\def\toonkader{\dodoubleempty\dotoonkader}
-
-\def\tooninstellingA#1#2%
- {#1&\PtToCm{\the#2}&\the#2&\tttf\string#2\cr}
-
-\def\tooninstellingB#1#2#3%
- {#1&&#2#3&\tttf\string#3\cr}
-
-\def\tooninstellingC#1#2% \relax is really needed here !
- {#1&\dimen0=#2\PtToCm{\the\dimen0}&\dimen0=#2\relax\the\dimen0&\tttf\string#2\cr}
-
-%\startinterface english
-
-\def\tooninstellingen% fallback
- {\noindent
- \vbox
- {\forgetall
- \mindermeldingen
- \switchtobodyfont[\v!klein]
- \tabskip\!!zeropoint
- \halign
- {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
- \tooninstellingA{paperheight} \paperheight
- \tooninstellingA{paperwidth} \paperwidth
- \tooninstellingA{printpaperheight} \printpaperheight
- \tooninstellingA{printpaperwidth} \printpaperwidth
- \noalign{\blanko}
- \tooninstellingA{topspace} \topspace
- \tooninstellingA{backspace} \backspace
- \tooninstellingA{height} \makeupheight
- \tooninstellingA{width} \makeupwidth
- \noalign{\blanko}
- \tooninstellingA{top} \topheight
- \tooninstellingC{topdistance} \topdistance
- \tooninstellingA{header} \headerheight
- \tooninstellingC{headerdistance} \headerdistance
- \tooninstellingA{textheight} \textheight
- \tooninstellingC{footerdistance} \footerdistance
- \tooninstellingA{footer} \footerheight
- \tooninstellingC{bottomdistance} \bottomdistance
- \tooninstellingA{bottom} \bottomheight
- \noalign{\blanko}
- \tooninstellingA{leftedge} \leftedgewidth
- \tooninstellingC{leftedgedistance} \leftedgedistance
- \tooninstellingA{leftmargin} \leftmarginwidth
- \tooninstellingC{leftmargindistance} \leftmargindistance
- \tooninstellingA{textwidth} \textwidth
- \tooninstellingC{rightmargindistance}\rightmargindistance
- \tooninstellingA{rightmargin} \rightmarginwidth
- \tooninstellingC{rightedgedistance} \rightedgedistance
- \tooninstellingA{rightedge} \rightedgewidth
- \noalign{\blanko}
- \tooninstellingB{bodyfontsize} \the \globalbodyfontsize
- \noalign{\blanko}
- \tooninstellingB{line} \relax \normallineheight
- \tooninstellingB{height} \relax \strutheightfactor
- \tooninstellingB{depth} \relax \strutdepthfactor
- \tooninstellingB{topskip} \relax \topskipfactor
- \tooninstellingB{maxdepth} \relax \maxdepthfactor}}}
-
-%\stopinterface
-
-\startinterface dutch
-
-\def\tooninstellingen%
- {\noindent
- \vbox
- {\forgetall
- \mindermeldingen
- \switchtobodyfont[\v!klein]
- \tabskip\!!zeropoint
- \halign
- {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
- \tooninstellingA{papierhoogte} \papierhoogte
- \tooninstellingA{papierbreedte} \papierbreedte
- \tooninstellingA{printpapierhoogte} \printpapierhoogte
- \tooninstellingA{printpapierbreedte} \printpapierbreedte
- \noalign{\blanko}
- \tooninstellingA{kopwit} \kopwit
- \tooninstellingA{rugwit} \rugwit
- \tooninstellingA{hoogte} \zethoogte
- \tooninstellingA{breedte} \zetbreedte
- \noalign{\blanko}
- \tooninstellingA{boven} \bovenhoogte
- \tooninstellingC{bovenafstand} \bovenafstand
- \tooninstellingA{hoofd} \hoofdhoogte
- \tooninstellingC{hoofdafstand} \hoofdafstand
- \tooninstellingA{teksthoogte} \teksthoogte
- \tooninstellingC{voetafstand} \voetafstand
- \tooninstellingA{voet} \voethoogte
- \tooninstellingC{onderafstand} \onderafstand
- \tooninstellingA{onder} \onderhoogte
- \noalign{\blanko}
- \tooninstellingA{linkerrand} \linkerrandbreedte
- \tooninstellingC{linkerrandafstand} \linkerrandafstand
- \tooninstellingA{linkermarge} \linkermargebreedte
- \tooninstellingC{linkermargeafstand} \linkermargeafstand
- \tooninstellingA{tekstbreedte} \tekstbreedte
- \tooninstellingC{rechtermargeafstand}\rechtermargeafstand
- \tooninstellingA{rechtermarge} \rechtermargebreedte
- \tooninstellingC{rechterrandafstand} \rechterrandafstand
- \tooninstellingA{rechterrand} \rechterrandbreedte
- \noalign{\blanko}
- \tooninstellingB{korps} \the \globalbodyfontsize
- \noalign{\blanko}
- \tooninstellingB{regel} \relax \normallineheight
- \tooninstellingB{hoogte} \relax \strutheightfactor
- \tooninstellingB{diepte} \relax \strutdepthfactor
- \tooninstellingB{boven} \relax \topskipfactor
- \tooninstellingB{onder} \relax \maxdepthfactor}}}
-
-\stopinterface
-
-\startinterface german
-
-\def\tooninstellingen%
- {\noindent
- \vbox
- {\forgetall
- \mindermeldingen
- \switchtobodyfont[\v!klein]
- \tabskip\!!zeropoint
- \halign
- {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
- \tooninstellingA{papierhoehe} \papierhoehe
- \tooninstellingA{papierbreite} \papierbreite
- \tooninstellingA{printpapierhoehe} \printpapierhoehe
- \tooninstellingA{printpapierbreite} \printpapierbreite
- \noalign{\blanko}
- \tooninstellingA{kopfweite} \kopfweite
- \tooninstellingA{rumpfweite} \rumpfweite
- \tooninstellingA{hoehe} \satzhoehe
- \tooninstellingA{breite} \satzbreite
- \noalign{\blanko}
- \tooninstellingA{oben} \hoeheoben
- \tooninstellingC{abstandoben} \abstandoben
- \tooninstellingA{kopfzeile} \kopfzeilenhoehe
- \tooninstellingC{kopfzeilenabstand} \kopfzeilenabstand
- \tooninstellingA{texthoehe} \texthoehe
- \tooninstellingC{fusszeileabstand} \fusszeileabstand
- \tooninstellingA{fusszeilen} \fusszeilenhoehe
- \tooninstellingC{abstandunten} \abstandunten
- \tooninstellingA{hoeheunten} \hoeheunten
- \noalign{\blanko}
- \tooninstellingA{linkerrand} \breitelinkerrand
- \tooninstellingC{abstandlinkerrand} \abstandlinkerrand
- \tooninstellingA{linkemarginal} \linkemarginalbreite
- \tooninstellingC{linkemarginalafstand} \linkemarginalafstand
- \tooninstellingA{textbreite} \textbreite
- \tooninstellingC{rechtemarginalafstand}\rechtemarginalafstand
- \tooninstellingA{rechtemarginal} \rechtemarginalbreite
- \tooninstellingC{abstandrechterrand} \abstandrechterrand
- \tooninstellingA{rechterrand} \breiterechterrand
- \noalign{\blanko}
- \tooninstellingB{fliesstext} \the \globalbodyfontsize
- \noalign{\blanko}
- \tooninstellingB{linie} \relax \normallineheight
- \tooninstellingB{hoehe} \relax \strutheightfactor
- \tooninstellingB{tiefe} \relax \strutdepthfactor
- \tooninstellingB{topskip} \relax \topskipfactor
- \tooninstellingB{maxdepth} \relax \maxdepthfactor}}}
-
-\stopinterface
-
-\startinterface czech
-
-\def\tooninstellingen%
- {\noindent
- \vbox
- {\forgetall
- \mindermeldingen
- \switchtobodyfont[\v!klein]
- \tabskip\!!zeropoint
- \halign
- {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
- \tooninstellingA{vyskapapiru} \vyskapapiru
- \tooninstellingA{sirkapapiru} \sirkapapiru
- \tooninstellingA{vyskatiskpapiru} \vyskatiskpapiru
- \tooninstellingA{sirkatiskpapiru} \sirkatiskpapiru
- \tooninstellingA{hornimezera} \hornimezera
- \tooninstellingA{spodnimezera} \spodnimezera
- \tooninstellingA{vyska} \vyskasazby
- \tooninstellingA{breite} \sirkasazby
- \tooninstellingA{vyskatextu} \vyskatextu
- \tooninstellingA{sirkatextu} \sirkatextu
- \tooninstellingA{horejsek} \vyskahorejsku
- \tooninstellingC{vzdalenosthorejsku} \vzdalenosthorejsku
- \tooninstellingA{zahlavi} \vyskazahlavi
- \tooninstellingC{vzdalenostzahlavi} \vzdalenostzahlavi
- \tooninstellingC{fusszeileabstand} \vzdalenostupati
- \tooninstellingA{upati} \vyskaupati
- \tooninstellingC{vzdalenostspodku} \vzdalenostspodku
- \tooninstellingA{spodek} \vyakaspodku
- \tooninstellingA{levyokraj} \sirkalevehookraje
- \tooninstellingC{vzdalenostlevehookraje}\vzdalenostlevehookraje
- \tooninstellingA{levamarginalie} \sirkalevemarginalie
- \tooninstellingC{vzdalenostlevemarginalie}\vzdalenostlevemarginalie
- \tooninstellingC{vzdalenostpravemarginalie}\vzdalenostpravemarginalie
- \tooninstellingA{pravamarginalie} \sirkapravemarginalie
- \tooninstellingC{vzdalenostpravehookraje}\vzdalenostpravehookraje
- \tooninstellingA{pravyokraj} \sirkapravehookraje
- \noalign{\blanko}
- \tooninstellingB{zakladnivelikost} \the \globalbodyfontsize
- \noalign{\blanko}
- \tooninstellingB{linka} \relax \normallineheight
- \tooninstellingB{vyska} \relax \strutheightfactor
- \tooninstellingB{hloubka} \relax \strutdepthfactor
- \tooninstellingB{topskip} \relax \topskipfactor
- \tooninstellingB{maxdepth} \relax \maxdepthfactor}}}
-
-\stopinterface
-
-\startinterface romanian
-
-\def\tooninstellingen%
- {\noindent
- \vbox
- {\forgetall
- \mindermeldingen
- \switchtobodyfont[\v!klein]
- \tabskip\!!zeropoint
- \halign
- {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
- \tooninstellingA{paperheight} \paperheight
- \tooninstellingA{paperwidth} \paperwidth
- \tooninstellingA{printpaperheight} \printpaperheight
- \tooninstellingA{printpaperwidth} \printpaperwidth
- \noalign{\blanko}
- \tooninstellingA{topspace} \topspace
- \tooninstellingA{backspace} \backspace
- \tooninstellingA{height} \makeupheight
- \tooninstellingA{width} \makeupwidth
- \noalign{\blanko}
- \tooninstellingA{top} \topheight
- \tooninstellingC{topdistance} \topdistance
- \tooninstellingA{header} \headerheight
- \tooninstellingC{headerdistance} \headerdistance
- \tooninstellingA{textheight} \textheight
- \tooninstellingC{footerdistance} \footerdistance
- \tooninstellingA{footer} \footerheight
- \tooninstellingC{bottomdistance} \bottomdistance
- \tooninstellingA{bottom} \bottomheight
- \noalign{\blanko}
- \tooninstellingA{leftedge} \leftedgewidth
- \tooninstellingC{leftedgedistance} \leftedgedistance
- \tooninstellingA{leftmargin} \leftmarginwidth
- \tooninstellingC{leftmargindistance} \leftmargindistance
- \tooninstellingA{textwidth} \textwidth
- \tooninstellingC{rightmargindistance}\rightmargindistance
- \tooninstellingA{rightmargin} \rightmarginwidth
- \tooninstellingC{rightedgedistance} \rightedgedistance
- \tooninstellingA{rightedge} \rightedgewidth
- \noalign{\blanko}
- \tooninstellingB{bodyfontsize} \the \globalbodyfontsize
- \noalign{\blanko}
- \tooninstellingB{line} \relax \normallineheight
- \tooninstellingB{height} \relax \strutheightfactor
- \tooninstellingB{depth} \relax \strutdepthfactor
- \tooninstellingB{topskip} \relax \topskipfactor
- \tooninstellingB{maxdepth} \relax \maxdepthfactor}}}
-
-\stopinterface
-
-\def\toonlayout% interfereert lelijk met een \typefile er na
- {\bgroup
- \pagina
- \toonkader
- \stellayoutin[\c!markering=\v!aan]
- \dorecurse{4}{\tooninstellingen\pagina}
- \egroup}
-
-\newif\iflowinmargin
-
-\def\stelinmargein%
- {\dodoubleempty\dostelinmargein}
-
-\def\dostelinmargein[#1][#2]%
- {\ifsecondargument
- \doifundefinedelse{\??im#1\c!offset}
- {\presetlocalframed
- [\??im#1]%
- \getparameters
- [\??im#1]
- [\c!kader=\v!uit,
- \c!offset=\v!overlay,
- \c!regel=1,
- \c!scheider=,
- \c!breedte=\v!ruim,
- \c!afstand=\!!zeropoint,
- \c!letter=\@@imletter,
- \c!kleur=\@@imkleur,
- \c!plaats=\@@implaats,
- \c!uitlijnen=\@@imuitlijnen,
- \c!voor=\@@imvoor,
- \c!na=\@@imna,
- #2]}
- {\getparameters[\??im#1][#2]}%
- \else
- \getparameters[\??im][#1]%
- \fi}
-
-\let\margetekstafstand = \!!zeropoint
-\def\margetekstregels {1}
-\def\margetekstnummer {0}
-\let\margetekstscheider = \empty
-
-\def\margestrutheight{\ht\strutbox}
-
-\def\maakmargetekstblok#1#2#3#4#5#6%
- {#4\relax
- \bgroup
- \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}
- {}%
- \processaction
- [\getvalue{\??im\margetekstnummer\c!uitlijnen}]
- [ \v!ja=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{#2},
- \v!nee=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{\v!normaal},
- \v!binnen=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{#2},
- \v!buiten=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{#3},
- \v!links=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{\v!links},
- \v!midden=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{\v!midden},
- \v!rechts=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{\v!rechts},
- \s!default=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{#2}]%
- \setbox0=\vbox\localframed
- [\??im\margetekstnummer]
- [\c!strut=\v!nee]
- {\decrement\margetekstregels
- \@@imvoor
- \doattributes
- {\??im\margetekstnummer}\c!letter\c!kleur
- {\dorecurse{\margetekstregels}{\strut\\}%
- \xdef\margestrutheight{\the\ht\strutbox}%
- \begstrut#6\endstrut\endgraf}%
- \@@imna}%
- \ht0=\ht\strutbox
- \box0
- \egroup
- #5\relax}
-
-\def\plaatsmargetekstscheider%
- {\ifnum\margincontent>0
- \bgroup
- \dimen0=\margetekstregels\lineheight
- \advance\dimen0 by -\lineheight
- \lower\dimen0\hbox{\margetekstscheider}%
- \egroup
- \fi}
-
-\def\linkermargetekstblok#1%
- {\maakmargetekstblok
- {\linkermargebreedte}
- {\v!links}{\v!rechts}
- {\llap{\plaatsmargetekstscheider}}{\hskip\margetekstafstand}
- {#1}}
-
-\def\rechtermargetekstblok#1%
- {\maakmargetekstblok
- {\rechtermargebreedte}
- {\v!rechts}{\v!links}
- {\hskip\margetekstafstand}{\rlap{\plaatsmargetekstscheider}}
- {#1}}
-
-\def\doplacemargintext#1#2#3%
- {\strut
- \setbox0=\hbox{#1}%
- \dimen0=\ht0
- \advance\dimen0 by \dp0
- \ifdim\dimen0>\marginheight
- \global\marginheight=\dimen0
- \fi
- \setbox0=\hbox
- {#2{\hskip#3\strut
- \iflowinmargin\else
- \dimen0=\dp\strutbox
- \advance\dimen0 by \margestrutheight
- \advance\dimen0 by -\ht\strutbox
- \raise\dimen0
- \fi
- \box0}}%
- \ht0=\!!zeropoint
- \dp0=\!!zeropoint
- \gdef\margestrutheight{\the\ht\strutbox}%
- %\vadjust{\box0}} % fails in high math lines, let it be
- %\hbox{\lower\dp\strutbox\box0}} % alas, wrong lapping, therefore useless
- \dopositionmarginbox0}
-
-%D This approach permits us to implement a better mechanism
-%D later.
-
-\ifx\dopositionmarginbox\undefined
- \def\dopositionmarginbox#1{\vadjust{\box#1}}
-\fi
-
-\def\doinlinker#1%
- {\doplacemargintext
- {\linkermargetekstblok{#1}\hskip\linkermargeafstand}
- \llap\!!zeropoint}
-
-\def\doinrechter#1%
- {\doplacemargintext
- {\hskip\rechtermargeafstand\rechtermargetekstblok{#1}}
- \rlap\hsize}
-
-\newcounter \nofmarginnotes
-\newif \iftrackingmarginnotes
-\newif \ifrightmargin % documenteren
-
-\definetwopasslist{\s!margin}
-
-\def\domarginreference%
- {\doglobal\increment\nofmarginnotes\relax
- \edef\writemarref%
- {\writeutilitycommand%
- {\twopassentry%
- {\s!margin}%
- {\nofmarginnotes}%
- {\noexpand\realfolio}}}%
- \writemarref}
-
-\def\dodoinmargenormal#1#2#3#4%
- {\iffirstsidefloatparagraph\geenwitruimte\fi % zo laat mogelijk
- \ifodd#1\relax
- \rightmargintrue
- #3{#4}%
- \else
- \rightmarginfalse
- #2{#4}%
- \fi}
-
-\def\doinmargenormal#1#2#3%
- {\bgroup
- \iftrackingmarginnotes
- \gettwopassdata{\s!margin}%
- \iftwopassdatafound
- \dodoinmargenormal\twopassdata#1#2{#3}%
- \else
- \dodoinmargenormal\realfolio#1#2{#3}%
- \fi
- \domarginreference
- \else
- \dodoinmargenormal\realfolio#1#2{#3}%
- \fi
- \egroup}
-
-\def\doinmargereverse#1#2#3%
- {\dodoinmargenormal\realfolio#2#1{#3}}
-
-\def\doinmarge[#1][#2][#3][#4][#5]#6%
- {\doifcommonelse{+,-,\v!laag}{#4}
- {\dodoinmarge[#1][#2][#3][#4][#5]{#6}}
- {\dodoinmarge[#1][#2][#3][][#4]{#6}}%
- \ignorespaces}
-
-\def\dodoinmarge[#1][#2][#3][#4][#5]#6%
- {\ignorespaces
- \doifinsetelse{\v!laag}{#4}
- {\lowinmargintrue}
- {\lowinmarginfalse}%
- \processaction
- [#1]
- [ \v!links=>#2{#6},
- \v!rechts=>#3{#6},
- \s!unknown=>\ifdubbelzijdig
- \doifcommonelse{+,-}{#4}
- {\doinmargereverse#2#3{#6}}
- {\doinmargenormal#2#3{#6}}%
- \else
- #2{#6}%
- \fi]%
- \rawpagereference{\s!mar}{#5}%
- \ignorespaces}
-
-\def\inlinker%
- {\indentation\doquintupleempty\doinmarge
- [\v!links][\doinlinker][\doinrechter]}
-
-\def\inrechter%
- {\indentation\doquintupleempty\doinmarge
- [\v!rechts][\doinlinker][\doinrechter]}
-
-\def\inmarge%
- {\doquintupleempty\doinmarge
- [\@@implaats][\doinlinker][\doinrechter]}
-
-\def\inanderemarge%
- {\doquintupleempty\doinmarge
- [\@@implaats][\doinrechter][\doinlinker]}
-
-\newcounter\margincontent
-
-\def\flushmargincontent% [#1][#2]#3% hier plaats 'globaal' (geen 1,2 enz)
- {\doinmarge[\@@implaats][\doinlinker][\doinrechter]} % [#1][#2]{#3}}
-
-\newdimen\marginheight
-
-\let\restoreinterlinepenalty=\relax
-
-\def\flushmargincontents%
- {\restoreinterlinepenalty % here?
- \ifnum\margincontent>0 % called quite often, so we
- \expandafter\doflushmargincontents % speed up the \fi scan by
- \fi} % using a \do..
-
-% \def\doflushmargincontents% % links + rechts
-% {\bgroup
-% \forgetall
-% \global\marginheight\!!zeropoint
-% \dorecurse{\margincontent}
-% {\bgroup
-% \edef\margetekstafstand {\getvalue{\??im\recurselevel\c!afstand}}%
-% \edef\margetekstregels {\getvalue{\??im\recurselevel\c!regel}}%
-% \edef\margetekstscheider{\getvalue{\??im\recurselevel\c!scheider}}%
-% \let\margetekstnummer=\recurselevel
-% \getvalue{\??im\recurselevel}%
-% \global\setvalue{\??im\recurselevel}{}%
-% \egroup}%
-% \ifdim\marginheight>\lineheight % This is something real dirty!
-% \advance\marginheight by \pagetotal
-% \advance\marginheight by \lineheight % a sort of bonus
-% \ifdim\marginheight>\pagegoal
-% \xdef\restoreinterlinepenalty%
-% {\global\let\restoreinterlinepenalty\relax
-% \global\interlinepenalty=\the\interlinepenalty}%
-% \global\interlinepenalty=10000
-% \fi
-% \else % We need the above because interlinepenalties overrule vadjusted \nobreaks.
-% %\vadjust
-% % {\forgetall
-% % \global\advance\marginheight by \lineheight
-% % \global\divide\marginheight by \lineheight
-% % \dorecurse{\number\marginheight}
-% % {\nobreak\vskip\lineheight}%
-% % \kern-\number\marginheight\lineheight}%
-% \vadjust{\nobreak}%
-% \fi
-% \doglobal\newcounter\margincontent
-% \egroup}
-
-\def\doflushmargincontents% % links + rechts
- {\bgroup
- \forgetall
- \global\marginheight\!!zeropoint
- \dorecurse{\margincontent}
- {\bgroup
- \edef\margetekstafstand {\getvalue{\??im\recurselevel\c!afstand}}%
- \edef\margetekstregels {\getvalue{\??im\recurselevel\c!regel}}%
- \edef\margetekstscheider{\getvalue{\??im\recurselevel\c!scheider}}%
- \let\margetekstnummer=\recurselevel
- \getvalue{\??im\recurselevel}%
- \global\setvalue{\??im\recurselevel}{}%
- \egroup}%
-\ifbinnenkolommen
- \donetrue % how fuzzy
-\else\ifdim\marginheight>\lineheight\relax
- \donetrue % how dirty
-\else
- \donefalse % how needed
-\fi\fi
-\ifdone
- \advance\marginheight by \pagetotal
- \advance\marginheight by \lineheight % a sort of bonus
- \ifdim\marginheight>\pagegoal
- \xdef\restoreinterlinepenalty%
- {\global\let\restoreinterlinepenalty\relax
- \global\interlinepenalty=\the\interlinepenalty}%
- \global\interlinepenalty=10000
- \fi
- \else % We need the above because interlinepenalties overrule vadjusted \nobreaks.
- %\vadjust
- % {\forgetall
- % \global\advance\marginheight by \lineheight
- % \global\divide\marginheight by \lineheight
- % \dorecurse{\number\marginheight}
- % {\nobreak\vskip\lineheight}%
- % \kern-\number\marginheight\lineheight}%
- \vadjust{\nobreak}%
- \fi
- \doglobal\newcounter\margincontent
- \egroup}
-
-% Some day: \definieermarkering[\v!margetitel]
-
-\def\docomplexmargewoord#1#2#3%
- {\@EA\setgvalue\@EA{\@EA\??im\@EA\margincontent\@EA}\@EA
- {\@EA\stelinmargein\@EA[\margincontent][]% see next macro
- \flushmargincontent[#1][#2]{#3}}}
-
-\def\complexmargewoord[#1][#2]#3%
- {\doglobal\increment\margincontent
- \stelinmargein[\margincontent][]% see next macro
- \ifsecondargument
- \doifnumberelse{#1}
- {\docomplexmargewoord{#2}{#1}{#3}}
- {\docomplexmargewoord{#1}{#2}{#3}}%
- \else
- \doifnumberelse{#1}
- {\docomplexmargewoord{}{#1}{#3}}
- {\docomplexmargewoord{#1}{}{#3}}%
- \fi}
-
-\def\margewoordpositie[#1]#2%
- {\ifnum#1>\margincontent
- \xdef\margincontent{#1}%
- \fi
- \stelinmargein[#1][]% when at outer level, saves local settings
- \setgvalue{\??im#1}%
- {\stelinmargein[#1][]% needed when par start outside group
- \flushmargincontent[][]{#2}}}
-
-\def\margewoord%
- {\dodoubleempty\complexmargewoord}
-
-\def\margetitel%
- {\margewoord}
-
-\def\margetekst%
- {\margewoord}
-
-\def\oplinker#1%
- {\strut
- \vadjust
- {\mindermeldingen
- \setbox0=\vtop{\forgetall\strut#1}%
- \getboxheight\dimen0\of\box0
- \vskip-\dimen0\
- \box0}}
-
-%D \macros
-%D {inleftside,inleftmargin,inrightmargin,inrightside}
-%D
-%D The fast and clean way of putting things in the margin is
-%D using \type{\rlap} or \type{\llap}. Unfortunately these
-%D macro's don't handle indentation, left and right skips. We
-%D therefore embed them in some macro's that (force and)
-%D remove the indentation and restore it afterwards.
-
-\def\inleftmargin#1%
- {\pushindentation
- \llap{#1\hskip\leftskip\hskip\linkermargeafstand}%
- \popindentation
- \ignorespaces}
-
-\def\inrightmargin#1%
- {\pushindentation
- \rlap{\hskip\hsize\hskip-\rightskip\hskip\rechtermargeafstand#1}%
- \popindentation
- \ignorespaces}
-
-\def\inleftside#1%
- {\inleftmargin
- {#1\relax
- \hskip\linkermargebreedte
- %\hskip\pageseparation
- \hskip\linkerrandafstand}}
-
-\def\inrightside#1%
- {\inrightmargin
- {\hskip\rechtermargebreedte
- \hskip\rechterrandafstand
- %\hskip\pageseparation
- #1}}
-
-%D We want to keep things efficient and therefore only handle
-%D situations like:
-%D
-%D \startbuffer
-%D \inleftside {fine} some text \par
-%D \strut \inleftmargin {fine} some text \par
-%D \noindent \inrightmargin {fine} some text \par
-%D \noindent \strut \inrightside {fine} some text \par
-%D \stopbuffer
-%D
-%D \typebuffer
-%D
-%D which looks like:
-%D
-%D \bgroup
-%D \haalbuffer
-%D \parindent 30pt
-%D \haalbuffer
-%D \egroup
-
-%D \macros
-%D {pushindentation,popindentation}
-%D
-%D The pushing and popping is done by:
-
-\newbox\indentationboxA
-\newbox\indentationboxB
-
-\def\pushindentation%
- {\bgroup
- \ifhmode
- \unskip
- \setbox\indentationboxA=\lastbox % get \strut if present
- \unskip
- \setbox\indentationboxB=\lastbox % get \indent generated box
- \unskip
- \else
- \hskip\!!zeropoint % switch to horizontal mode
- \unskip
- \setbox\indentationboxA=\lastbox % get \indent generated box
- \setbox\indentationboxB=\box\voidb@x
- \fi}
-
-\def\popindentation%
- {\box\indentationboxB\box\indentationboxA % put back the boxes
- \egroup}
-
-%D The only complication lays in \type{\strut}. In \PLAIN\
-%D \TEX\ a \type{\strut} is defined as:
-%D
-%D \starttypen
-%D \def\strut%
-%D {\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
-%D \stoptypen
-%D
-%D But what is a \type{\strut}? Normally it's a rule of width
-%D zero, but when made visual, it's a rule and a negative skip.
-%D The mechanism for putting things in the margins described
-%D here cannot handle this situation very well. One
-%D characteristic of \type{\strut} is that the \type{\unhcopy}
-%D results in entering horizontal mode, which in return leads
-%D to some indentation.
-%D
-%D To serve our purpose a bit better, the macro \type{\strut}
-%D can be redefined as:
-%D
-%D \starttypen
-%D \def\strut%
-%D {\relax\ifmmode\else\hskip0pt\fi\copy\strutbox}
-%D \stoptypen
-%D
-%D Or more compatible:
-%D
-%D \starttypen
-%D \def\strut%
-%D {\relax\ifmmode
-%D \copy\strutbox
-%D \else
-%D \bgroup\setbox\strutbox=\normalhbox{\box\strutbox}\unhcopy\strutbox\egroup
-%D \fi}
-%D \stoptypen
-%D
-%D In \CONTEXT\ however we save some processing time by putting
-%D an extra \type{\hbox} around the \type{\strutbox}.
-
-% dit zijn voorlopig lokale commando's
-
-\def\woordinlinker {\inleftmargin} % vervallen
-\def\woordinrechter{\inrechtermarge} % vervallen
-
-\def\woordinmarge%
- {\doquintupleempty\doinmarge
- [\@@implaats][\woordinlinker][\woordinrechter]}
-
-% Standaard is \count0 in Plain TeX de paginateller. Omwille
-% van de afhandeling van lokaal nummeren, definieren we
-% echter een eigen nummer.
-
-\definieernummer
- [\s!page]
- [\c!conversie=\@@nmconversie,
- \c!wijze=\@@nmwijze,
- \c!status=\@@nmstatus,
- \c!start=1]
-
-% \@@pnstatus global, but \@@nmstatus local and only start/stop
-
-\global\let\@@pnstatus\@@pnstatus
-
-%\def\dostelpaginanummerin[#1]%
-% {\getparameters
-% [\??pn]
-% [%\c!status=\v!start,
-% \c!nummer=,
-% #1]%
-% \global\let\@@pnstatus\@@pnstatus
-% \doifsomething{\@@pnnummer}
-% {\setnummer[\s!page]{\@@pnnummer}%
-% \setuserpageno{\ruwenummer[\s!page]}}}
-
-\def\dostelpaginanummerin[#1]%
- {\getparameters[\??pn][\c!nummer=,#1]%
- \global\let\@@pnstatus\@@pnstatus
- \doifsomething{\@@pnnummer}
- {\setnummer[\s!page]{\@@pnnummer}%
- \setuserpageno{\ruwenummer[\s!page]}}%
- % this makes starting at an even page possible
- \ifnum\realpageno=1 \ifodd\pageno \else
- \global\shiftedrealpagenotrue
- \fi \fi}
-
-\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}}
-
-\def\checkpagecounter%
- {\checknummer{\s!page}}
-
-\newif\ifpaginageblokkeerd
-\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
- \else
- \goodbreak
- \fi
- \fi}
-
-\let\resetcurrentsectionmarks=\relax
-
-% was: \resetsectionmarks[\firstsection], zie \handelpaginaaf
-
-\def\insertdummypage%
- {\ejectinsert % beter
- \hardespatie
- \vfill
- \ejectpage}
-
-\def\docomplexpagina[#1]%
- {\flushfootnotes
- \bgroup
- \processallactionsinset
- [#1]
- [ \v!reset=>\global\paginageblokkeerdfalse,
- \v!blokkeer=>\global\paginageblokkeerdtrue,
- \v!ja=>\ifpaginageblokkeerd\else
- \ejectinsert
- \ejectpage
- \ifbinnenkolommen
- \ejectpage % anders soms geen overgang
- \fi
- \fi,
- \v!opmaak=>\ifpaginageblokkeerd\else
- \eject
- \fi,
- \v!blanko=>\pagebodyornamentsfalse,
- \v!nee=>\ifpaginageblokkeerd\else
- \dosomebreak\nobreak
- \fi,
- \v!voorkeur=>{\ifpaginageblokkeerd\else
- \ifbinnenkolommen
- \dosomebreak\goodbreak
- \else
- \testpagina[3][\!!zeropoint]%
- \fi
- \fi},
- \v!grotevoorkeur=>{\ifpaginageblokkeerd\else
- \ifbinnenkolommen
- \dosomebreak\goodbreak
- \else
- \testpagina[5][\!!zeropoint]%
- \fi
- \fi},
- \v!leeg=>{\ejectinsert
- \ejectpage
- \doifnotvalue{\??tk\v!hoofd\v!tekst\c!status}{\v!stop}
- {\stelhoofdin[\c!status=\v!leeg]}%
- \doifnotvalue{\??tk\v!voet\v!tekst\c!status}{\v!stop}
- {\stelvoetin[\c!status=\v!leeg]}%
- \insertdummypage},
- \v!links=>{\ejectinsert
- \superejectpage
- \doifbothsidesoverruled
- \orsideone
- \resetcurrentsectionmarks
- \insertdummypage
- \orsidetwo
- \od},
- \v!rechts=>{\ejectinsert
- \superejectpage
- \doifbothsidesoverruled
- \orsideone
- \orsidetwo
- \resetcurrentsectionmarks
- \insertdummypage
- \od},
- \v!even=>\pagina
- \doifonevenpaginaelse
- {\resetcurrentsectionmarks\insertdummypage}{},
- \v!oneven=>\pagina
- \doifonevenpaginaelse
- {}{\resetcurrentsectionmarks\insertdummypage},
- \v!viertal=>{\ifdubbelzijdig
- \!!counta=\realpageno
- \!!countb=\realpageno
- \divide\!!counta by 4
- \divide\!!countb by 2
- \ifnum\!!counta=\!!countb
- \else
- \pagina
- \pagina[\v!leeg]%
- \pagina[\v!leeg]%
- \fi
- \fi},
- \v!laatste=>{\ejectinsert
- \superejectpage
- \doifbothsidesoverruled
- \naastpagina
- \orsideone
- \orsidetwo
- %\ifodd\realpageno \else % kan weer weg
- \geenhoofdenvoetregels
- \insertdummypage
- %\fi
- \od
- \filluparrangedpages},
- \s!unknown=>\doifinstringelse{+}{#1}
- {\ejectinsert\ejectpage
- \dorecurse{#1}{\insertdummypage}}
- {\doifnumberelse{#1}
- {\ejectinsert\ejectpage
- \doloop
- {\ifnum\userpageno<#1\relax
- \insertdummypage
- \else
- \exitloop
- \fi}}
- {}}]%
- \egroup}
-
-\def\complexpagina[#1]%
- {\expanded{\docomplexpagina[#1]}}
-
-\def\simplepagina%
- {\docomplexpagina[\v!ja]}
-
-\definecomplexorsimple\pagina
-
-\def\resetpagina%
- {\global\paginageblokkeerdfalse}
-
-% \getpagestatus
-% \ifrightpage als odd/enkelzijdig
-
-\newif\ifrightpage \rightpagetrue
-
-\newcounter \nofpagesets
-
-\definetwopasslist{\s!page}
-
-\def\dopagesetreference%
- {\doglobal\increment\nofpagesets\relax
- \edef\writepagref%
- {\writeutilitycommand
- {\twopassentry
- {\s!page}%
- {\nofpagesets}%
- {\noexpand\realfolio}}}%
- \writepagref}
-
-\def\getpagestatus% hierboven gebruiken
- {\ifdubbelzijdig
- \gettwopassdata{\s!page}%
- \iftwopassdatafound \else
- \let\twopassdata=\realpageno
- \fi
- \ifodd\twopassdata
- \global\rightpagetrue
- \else
- \global\rightpagefalse
- \fi
- \dopagesetreference
- \else
- \global\rightpagetrue
- \fi}
-
-
-% De onderstaande macro's lijken op het eerste gezicht vrij
-% ingewikkeld en omslachtig. Dit is het gevolg van een
-% dubbel optioneel zijn van argumenten: zowel het eerste als
-% de twee laatste argumenten zijn optioneel. Dit is mede het
-% gevolg van een uitbreiding naar marges en randen, waarbij
-% upward-compatibiliteit zwaar heeft gewogen.
-
-\def\dostellayouttekstin[#1][#2][#3]%
- {\ifthirdargument
- \getparameters[\??tk#1#2][#3]%
- \else
- \getparameters[\??tk#1\v!tekst][#2]%
- \fi
- \calculatevsizes}
-
-\def\stelbovenin {\dotripleempty\dostellayouttekstin[\v!boven]}
-\def\stelhoofdin {\dotripleempty\dostellayouttekstin[\v!hoofd]}
-\def\steltekstin {\dotripleempty\dostellayouttekstin[\v!tekst]}
-\def\stelvoetin {\dotripleempty\dostellayouttekstin[\v!voet]}
-\def\stelonderin {\dotripleempty\dostellayouttekstin[\v!onder]}
-
-\letvalue{\??tk\v!boven\v!tekst\c!status}=\v!normaal
-\letvalue{\??tk\v!hoofd\v!tekst\c!status}=\v!normaal
-\letvalue{\??tk\v!tekst\v!tekst\c!status}=\v!normaal
-\letvalue{\??tk\v!voet \v!tekst\c!status}=\v!normaal
-\letvalue{\??tk\v!onder\v!tekst\c!status}=\v!normaal
-
-\def\geenhoofdenvoetregels%
- {\stelhoofdin[\c!status=\v!leeg]%
- \stelvoetin[\c!status=\v!leeg]}
-
-\def\geenbovenenonderregels%
- {\stelbovenin[\c!status=\v!leeg]%
- \stelonderin[\c!status=\v!leeg]}
-
-% THIS: !!!
-
-\def\dolimitateteksten#1#2%
- {\doifelsevaluenothing{#1}{#2}{\limitatetext{#2}{\getvalue{#1}}{...}}}
-
-\def\doteksten#1#2#3#4#5#6%
- {\bgroup
- %\showcomposition % I need to test first
- \convertargument#6\to\ascii
- \doifsomething{\ascii}
- {\doattributes{#1#2}#3#4%
- {\doifvalue{#1\v!tekst\c!strut}{\v!ja}{\setstrut\strut}% here!
- \doifdefinedelse{\??mk\ascii\c!koppeling} % brrr
- {\dolimitateteksten{#1#2#5}{\haalmarkering[\ascii][\v!eerste]}}
- {\ConvertConstantAfter\doifelse{\v!paginanummer}{#6}
- {\@@plaatspaginanummer}
- {\ConvertConstantAfter\doifelse{\v!datum}{#6}
- {\currentdate} % #6{}{}{} -> {} needed for lookahead macros, like \uniqueMPgraphic
- {\opeenregel\dolimitateteksten{#1#2#5}{#6{}{}{}}}}}}}%
- \egroup}
-
-\def\dodoteksten#1#2#3#4#5#6%
- {\doifonevenpaginaelse
- {\doteksten{#1}{#2}#3{#4}} % #3 => provides three arguments
- {\doteksten{#1}{#2}#5{#6}}} % #5 => provides three arguments
-
-\def\dodododoteksten[#1][#2][#3][#4][#5][#6]%
- {\ifsixthargument
- \setvalue{\??tk#1#2\c!linkertekst}%
- {\dodoteksten{\??tk#1}{#2}
- {\c!linkerletter \c!linkerkleur \c!linkerbreedte }{#3}
- {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#6}}%
- \setvalue{\??tk#1#2\c!rechtertekst}%
- {\dodoteksten{\??tk#1}{#2}
- {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#4}
- {\c!linkerletter \c!linkerkleur \c!linkerbreedte }{#5}}%
- \else\iffifthargument
- \setvalue{\??tk#1\v!tekst\c!linkertekst}%
- {\dodoteksten{\??tk#1}{\v!tekst}
- {\c!linkerletter \c!linkerkleur \c!linkerbreedte }{#2}
- {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#5}}%
- \setvalue{\??tk#1\v!tekst\c!rechtertekst}%
- {\dodoteksten{\??tk#1}{\v!tekst}
- {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#3}
- {\c!linkerletter \c!linkerkleur \c!linkerbreedte }{#4}}%
- \else\iffourthargument
- \setvalue{\??tk#1#2\c!linkertekst}%
- {\dodoteksten{\??tk#1}{#2}
- {\c!linkerletter\c!linkerkleur\c!linkerbreedte}{#3}
- {\c!linkerletter\c!linkerkleur\c!linkerbreedte}{#3}}%
- \setvalue{\??tk#1#2\c!rechtertekst}%
- {\dodoteksten{\??tk#1}{#2}
- {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#4}
- {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#4}}%
- \else\ifthirdargument
- \setvalue{\??tk#1\v!tekst\c!linkertekst}%
- {\dodoteksten{\??tk#1}{\v!tekst}
- {\c!linkerletter\c!linkerkleur\c!linkerbreedte}{#2}
- {\c!linkerletter\c!linkerkleur\c!linkerbreedte}{#2}}%
- \setvalue{\??tk#1\v!tekst\c!rechtertekst}%
- {\dodoteksten{\??tk#1}{\v!tekst}
- {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#3}
- {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#3}}%
- \else\ifsecondargument % new
- \setvalue{\??tk#1\v!tekst\c!linkertekst}{}%
- \setvalue{\??tk#1\v!tekst\c!rechtertekst}{}%
- \setvalue{\??tk#1\v!tekst\c!middentekst}%
- {\doteksten{\??tk#1}{\v!tekst}\c!letter\c!kleur\c!breedte{#2}}%
- \else
- \dosixtupleempty\dodododoteksten[#1][\v!tekst][][][][]%
- \dosixtupleempty\dodododoteksten[#1][\v!marge][][][][]%
- \dosixtupleempty\dodododoteksten[#1][\v!rand] [][][][]%
- \fi\fi\fi\fi\fi}
-
-\def\stelboventekstenin {\dosixtupleempty\dodododoteksten[\v!boven]}
-\def\stelhoofdtekstenin {\dosixtupleempty\dodododoteksten[\v!hoofd]}
-\def\stelteksttekstenin {\dosixtupleempty\dodododoteksten[\v!tekst]}
-\def\stelvoettekstenin {\dosixtupleempty\dodododoteksten[\v!voet]}
-\def\stelondertekstenin {\dosixtupleempty\dodododoteksten[\v!onder]}
-
-\def\@@nmpre#1{\setbox0=\hbox{#1}\ifdim\wd0=\!!zeropoint\else\unhbox0\tfskip\fi}
-\def\@@nmpos#1{\setbox0=\hbox{#1}\ifdim\wd0=\!!zeropoint\else\tfskip\unhbox0\fi}
-
-\def\dodoplaatsteksten#1#2#3#4#5#6% \hsize toegevoegd
- {\hbox % \hss's niet meer wijzigen
- {\hbox to \linkerrandbreedte
- {\hsize\linkerrandbreedte
- \hss\getvalue{\??tk#1\v!rand#2}}%
- \hskip\linkerrandafstand
- %\hskip\pageseparation
- \hbox to \linkermargebreedte
- {\hsize\linkermargebreedte
- \hsmash{\hbox to \linkermargebreedte
- {\hss\getvalue{\??tk#1\v!marge#2}}}%
- \hsmash{\hbox to \linkermargebreedte
- {\hss#5{\??tk#1\v!marge\c!margetekst}}}%
- \hss}% let op: \smashed
- \hskip\linkermargeafstand
- \hbox to \zetbreedte
- {\hsize\zetbreedte
- \hsmash{\hbox to \zetbreedte
- {\@@nmpre{#5{\??tk#1\v!tekst\c!kantlijntekst}}%
- \getvalue{\??tk#1\v!tekst#2}\hss}}%
- \hsmash{\hbox to \zetbreedte
- {\hss\getvalue{\??tk#1\v!tekst#3}\hss}}%
- \hsmash{\hbox to \zetbreedte
- {\hss\getvalue{\??tk#1\v!tekst#4}%
- \@@nmpos{#6{\??tk#1\v!tekst\c!kantlijntekst}}}}%
- \hss}%
- \hskip\rechtermargeafstand
- \hbox to \rechtermargebreedte
- {\hsize\rechtermargebreedte
- \hsmash{\hbox to \rechtermargebreedte
- {\getvalue{\??tk#1\v!marge#4}\hss}}%
- \hsmash{\hbox to \rechtermargebreedte
- {#6{\??tk#1\v!marge\c!margetekst}\hss}}%
- \hss}% let op: \smashed
- %\hskip\pageseparation
- \hskip\rechterrandafstand
- \hbox to \rechterrandbreedte
- {\hsize\rechterrandbreedte
- \getvalue{\??tk#1\v!rand#4}\hss}}}
-
-\def\doplaatslayoutregel#1#2%
- {\ifdim#2>\!!zeropoint\relax % prevents pagenumbers when zero height
- \goleftonpage
- \hbox
- {\setbox0=\vbox to #2
- {\forgetall
- \vsize#2
- \normalbaselines
- \def\\{ \ignorespaces}%
- \def\crlf{ \ignorespaces}%
- \getvalue{\??tk#1\v!tekst\c!voor}%
- \doifbothsidesoverruled
- \dodoplaatsteksten#1\c!linkertekst\c!middentekst\c!rechtertekst
- \gobbleoneargument\getvalue
- \orsideone
- \dodoplaatsteksten#1\c!linkertekst\c!middentekst\c!rechtertekst
- \gobbleoneargument\getvalue
- \orsidetwo
- \dodoplaatsteksten#1\c!rechtertekst\c!middentekst\c!linkertekst
- \getvalue\gobbleoneargument
- \od
- \getvalue{\??tk#1\v!tekst\c!na}%
- \kern\!!zeropoint}% keep the \dp, beware of \vtops, never change this!
- \dp0=\!!zeropoint
- \box0}%
- \fi}
-
-% \stelhoofdin[status=normaal] \titel{NORMAAL} \dorecurse{8}{\input tufte} \pagina
-% \stelhoofdin[status=hoog] \titel{HOOG} \dorecurse{8}{\input tufte} \pagina
-% \stelhoofdin[status=leeg] \titel{LEEG} \dorecurse{8}{\input tufte} \pagina
-% \stelhoofdin[status=geen] \titel{GEEN} \dorecurse{8}{\input tufte} \pagina
-% \stelhoofdin[status=stop] \titel{STOP} \dorecurse{8}{\input tufte} \pagina
-
-\def\definieertekst%
- {\dosixtupleempty\dodefinieertekst}
-
-\def\dodefinieertekst[#1][#2][#3][#4][#5][#6]%
- {\ifsixthargument
- \setvalue{\??tk#2#1}{\dosixtupleempty\dodododoteksten[#2][#3][#4][#5][#6]}%
- \else\iffourthargument
- \setvalue{\??tk#2#1}{\dosixtupleempty\dodododoteksten[#2][#3][#4]}%
- \else
- \setvalue{\??tk#2#1}{\dosixtupleempty\dodododoteksten[#2][#3]}%
- \fi\fi}
-
-% \definieertekst[hoofdstuk][voet][paginanummer]
-% \stelkopin[hoofdstuk][hoofd=hoog,voet=hoofdstuk]
-% \stelhoofdtekstenin[paginanummer]
-% \stelvoettekstenin[links][rechts]
-% \hoofdstuk{eerste} \dorecurse{20}{\input tufte \relax}
-% \hoofdstuk{tweede} \dorecurse{20}{\input tufte \relax}
-
-% todo: commalist aflopen {empty,next} {first,empty}
-
-\def\plaatslayoutregel#1#2% % handelt o.b.v. tekst
- {\ExpandFirstAfter\processaction
- [\getvalue{\??tk#1\v!tekst\c!status}]
- [ \v!geen=>,
- \v!hoog=>, % is reset later on
- \v!start=>\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
- \doplaatslayoutregel{#1}{#2},
- \v!stop=>\vskip#2\relax,
- \v!leeg=>\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
- \vskip#2\relax,
- \v!geenmarkering=>\bgroup
- \setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
- \let\dohaalmarkering=\nohaalmarkering
- \doplaatslayoutregel{#1}{#2}%
- \egroup,
- \v!normaal=>\doplaatslayoutregel{#1}{#2},
- \s!default=>\doplaatslayoutregel{#1}{#2},
- \s!unknown=>\bgroup % new
- \setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
- \getvalue{\??tk#1\commalistelement}%
- \doplaatslayoutregel{#1}{#2}%
- \egroup]}
-
-\def\resetlayoutregel#1%
- {\doifvalue{\??tk#1\v!tekst\c!status}{\v!hoog}
- {\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}% ! global
- \doglobal\calculatevsizes
- \global\newlogostrue
- \global\newbackgroundtrue}}
-
-\def\resetlayoutregels%
- {\resetlayoutregel\v!boven
- \resetlayoutregel\v!hoofd
- \resetlayoutregel\v!tekst
- \resetlayoutregel\v!voet
- \resetlayoutregel\v!onder}
-
-\def\plaatsbovenregel {\plaatslayoutregel\v!boven\bovenhoogte}
-\def\plaatshoofdregel {\plaatslayoutregel\v!hoofd\hoofdhoogte}
-\def\plaatstekstregel {\plaatslayoutregel\v!tekst\teksthoogte}
-\def\plaatsvoetregel {\plaatslayoutregel\v!voet\voethoogte}
-\def\plaatsonderregel {\plaatslayoutregel\v!onder\onderhoogte}
-
-\def\gettextboxes% elders weghalen
- {\bgroup
- \setbox0=\vbox
- {\mindermeldingen
- \calculatereducedvsizes
- \swapmargins
- \forgetall
- \offinterlineskip
- \vskip-\bovenhoogte
- \vskip-\bovenafstand
- \plaatsbovenregel
- \vskip-\bovenhoogte
- \plaatsboventekstblok
- \vskip\bovenafstand
- \plaatshoofdregel
- \vskip\hoofdafstand
- \placepositionanchors
- \vskip-\teksthoogte
- \plaatstekstregel
- \vskip\voetafstand
- \plaatsvoetregel
- \vskip\onderafstand
- \plaatsonderregel
- \vskip-\onderhoogte
- \plaatsondertekstblok
- \plaatsversieaanduiding
- \vfilll}%
- \smashbox0
- \box0
- \egroup}
-
-\ifx\undefined\placepositionanchors
- \def\placepositionanchors{\vskip\teksthoogte}
-\fi
-
-\def\@@nmin {} % kan vervallen (upward compatibility)
-\def\@@nmplaats {} % mag {plaats, in} zijn
-
-\newcounter\@@pagenumberlocation
-
-\def\do@@plaatspaginanummer#1%
- {\ifnum#1=\@@pagenumberlocation\@@plaatspaginanummer\fi}
-
-\def\dodosetpagenumberlocation#1% tricky because of ...texts
- {\increment\@@pagenumberlocation
- \ifx\@@nmplaats\empty\else
- \def\dododosetpagenumberlocation##1%
- {\donetrue
- \setevalue{\??tk#1##1}%
- {\noexpand\do@@plaatspaginanummer{\@@pagenumberlocation}}}%
- \donefalse
- \ExpandFirstAfter\processallactionsinset
- [\@@nmplaats]
- [ \v!midden=>\dododosetpagenumberlocation{\v!tekst\c!middentekst},
- \v!links=>\dododosetpagenumberlocation{\v!tekst\c!linkertekst},
- \v!rechts=>\dododosetpagenumberlocation{\v!tekst\c!rechtertekst},
- \v!inlinker=>\dododosetpagenumberlocation{\v!marge\c!linkertekst},
- \v!inrechter=>\dododosetpagenumberlocation{\v!marge\c!rechtertekst},
- \v!inmarge=>\dododosetpagenumberlocation{\v!marge\ifdubbelzijdig
- \c!margetekst\else\c!rechtertekst\fi},
- \v!marge=>\dododosetpagenumberlocation{\v!marge\ifdubbelzijdig
- \c!margetekst\else\c!rechtertekst\fi},
- \v!opmarge=>\dododosetpagenumberlocation{\v!tekst\c!kantlijntekst},
- \v!kantlijn=>\dododosetpagenumberlocation{\v!tekst\c!kantlijntekst}]%
- \ifdone \else
- \dododosetpagenumberlocation{\v!tekst\c!middentekst}% default
- \fi
- \fi}
-
-\def\dosetpagenumberlocation%
- {\ExpandBothAfter\doifinsetelse{\v!hoofd}{\@@nmplaats,\@@nmin}
- {\dodosetpagenumberlocation\v!hoofd}
- {\dodosetpagenumberlocation\v!voet}}
-
-\def\dostelnummeringin[#1]%
- {\getparameters[\??nm][#1]%
- \preparepaginaprefix{\??nm}%
- \enkelzijdigfalse
- \dubbelzijdigfalse
- \ExpandFirstAfter\processallactionsinset
- [\@@nmvariant]
- [ \v!enkelzijdig=>\enkelzijdigtrue,
- \v!dubbelzijdig=>\dubbelzijdigtrue]%
- \ifdubbelzijdig
- \trackingmarginnotestrue
- \else
- \trackingmarginnotesfalse
- \fi
- \dosetpagenumberlocation
- \global\newbackgroundtrue
- \global\newlogostrue}
-
-\def\stelnummeringin%
- {\dosingleempty\dostelnummeringin}
-
-% listig: hangt af van \@@kolijst
-
-% erg fout
-%
-% \def\preparepaginaprefix#1%
-% {\def\dopreparepaginaprefix##1%
-% {\doifvalue{#1##1\c!nummer}{\v!ja}
-% {\setvalue{#1\getvalue{\??by##1}\c!nummer}{\v!ja}}}%
-% \processcommacommand[\@@kolijst]\dopreparepaginaprefix}
-%
-% nog fouter
-%
-% \def\preparepaginaprefix#1%
-% {\def\dopreparepaginaprefix##1%
-% {\doifelsevalue{#1##1\v!nummer}{\v!ja} % v
-% {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!ja}} % v
-% {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!nee}}}% % v
-% \processcommacommand[\@@kolijst]\dopreparepaginaprefix}
-%
-% best, beware, chapter (yes) can be followed by title (no)
-
-\def\preparepaginaprefix#1%
- {\def\dopreparepaginaprefix##1%
- {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!nee}}% %v
- \processcommacommand[\@@kolijst]\dopreparepaginaprefix
- \def\dopreparepaginaprefix##1%
- {\doifvalue{#1##1\v!nummer}{\v!ja} %v
- {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!ja}}}%
- \processcommacommand[\@@kolijst]\dopreparepaginaprefix}
-
-\def\dopaginaprefix#1#2%
- {\let\normaluchar\uchar\let\uchar\relax % ugly but needed
- \doifelsevalue{#1#2\v!nummer}{\v!ja} % \v! and no \c!
- {\@EA\beforesplitstring\@EA{\postprefix}\at:\to\preprefix
- \@EA\aftersplitstring\@EA{\postprefix}\at:\to\postprefix
- \let\uchar\normaluchar % ugly but needed
- \doifsomething{\preprefix}
- {\doifnot{\preprefix}{0}{\preprefix\@@nmnummerscheider}}}%
- {\@EA\aftersplitstring\@EA{\postprefix}\at:\to\postprefix
- \let\uchar\normaluchar}} % ugly but needed
-
-\def\paginaprefix#1[#2::#3::#4]% kan wat sneller ####1:0:
- {\bgroup
- \edef\postprefix{#3}%
- \def\donexttrackcommando##1%
- {\dopaginaprefix{#1}{##1}%
- \donexttracklevel{##1}}%
- \donexttrackcommando\firstsection
- \egroup}
-
-\unexpanded\def\@@plaatspaginanummer% called in empty tests
- %{\doif{\@@pnstatus}{\v!start}
- {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start}
- {{\@@nmcommando{\doattributes\??nm\c!letter\c!kleur{\completepagenumber}}}}}
-
-\def\@@plaatspaginascheider% still used ?
- %{\doif{\@@pnstatus}{\v!start}%
- {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start}
- {\@@nmtekstscheider}}
-
-\def\userfolio% naast realfolio
- {\nummer[\s!page]}
-
-\def\pagenumber%
- {\userfolio}
-
-\def\pageprefixes%
- {\def\donexttrackcommando##1%
- {\doifvalue{\??nm##1\v!nummer}{\v!ja} % v
- {\ifnum\countervalue{\??se##1}>0\relax
- \getvalue{##1\c!nummer}\@@nmnummerscheider
- \fi}%
- \doifsomething{\@@nmtekst}
- {\@@nmtekst\@@nmnummerscheider}%
- \donexttracklevel{##1}}%
- \donexttrackcommando{\firstsection}}
-
-\unexpanded\def\completepagenumber%
- {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start}
- {\@@nmlinks\labeltexts{\v!paginanummer}{\pageprefixes\pagenumber}\@@nmrechts}}
-
-\let\volledigepaginanummer\completepagenumber
-
-\unexpanded\def\plaatspaginanummer%
- {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start}
- {\labeltexts{\v!paginanummer}{\pagenumber}}}
-
-\def\translatednumber[#1::#2::#3]%
- {#3}
-
-% hier nog uti blokkeren
-
-% don't change this / test case:
-%
-% \setupbackgrounds[state=repeat]
-% \setupbackgrounds[text][text][background=whatever]
-% \couplepage[chapter][before={\defineoverlay[whatever][ON]}]
-% \setuphead[chapter][before={\pagetype[chapter]}]
-% \chapter{First} \page test \chapter{second} \page test
-
-\newif\ifgeselecteerd
-\geselecteerdtrue
-
-\newif\ifselecteren
-\selecterenfalse
-
-\newif\ifverwerken
-\verwerkentrue
-
-\def\selectie{}
-\def\paginasoort{}
-
-\let\naastpagina=\relax
-\let\napagina=\relax
-\let\voorpagina=\relax
-
-\def\dovoorpagina%
- {\doifsomething{\paginasoort}
- {\def\dododopagina##1%
- {\global\let\voorpagina=\relax
- \getvalue{\??pg##1\c!voor}}%
- \processcommacommand[\paginasoort]\dododopagina}}
-
-\def\dododonapagina#1%
- {\global\let\napagina=\relax
- \gdef\paginasoort{}%
- \getvalue{\??pg#1\c!na}}
-
-\def\donapagina%
- {\doifsomething{\paginasoort}
- {\def\dodopagina##1%
- {\doifelsevalue{\??pg##1\c!optie}{\v!dubbelzijdig}
- {\doifbothsidesoverruled
- \dododonapagina{##1}%
- \orsideone
- \dododonapagina{##1}%
- \orsidetwo
- \od}%
- {\dododonapagina{##1}}}%
- \processcommacommand[\paginasoort]\dodopagina}}
-
-\def\dosoortpagina[#1]%
- {\doglobal\addtocommalist{#1}\paginasoort
- \ifselecteren
- \ExpandBothAfter\doifcommon{#1}{\selectie}
- {\global\geselecteerdtrue}%
- \fi
- \gdef\voorpagina{\dovoorpagina}%
- \gdef\napagina{\donapagina}}
-
-\def\soortpagina%
- {\dosingleargument\dosoortpagina}
-
-\def\dokoppelpagina[#1][#2]%
- {\getparameters
- [\??pg]
- [\c!voor=,
- \c!na=,
- \c!optie=,
- #2]%
- \def\docommando##1%
- {\getparameters
- [\??pg##1]
- [\c!voor=\@@pgvoor,
- \c!na=\@@pgna,
- \c!optie=\@@pgoptie]}%
- \processcommalist[#1]\docommando}%
-
-\def\koppelpagina%
- {\dodoubleargument\dokoppelpagina}
-
-\def\doverwerkpagina[#1][#2]%
- {\processaction
- [#2]
- [ \v!ja=>\global\verwerkentrue,
- \v!nee=>\global\verwerkenfalse]%
- \gdef\selectie{#1}%
- \global\selecterentrue
- \global\geselecteerdfalse}
-
-\def\verwerkpagina%
- {\dodoubleargument\doverwerkpagina}
-
-\def\resetselectiepagina%
- {\ifselecteren
- \doifbothsidesoverruled
- \global\geselecteerdfalse
- \orsideone
- \orsidetwo
- \global\geselecteerdfalse
- \od
- \fi}
-
-\newif\iflocation
-
-\def\ifinteractief{\iflocation}
-
-\def\previoussectionformat{}
-\def\currentsectionformat{}
-
-\let\updatelistreferences=\relax
-\def\updatedlistreferences{}
-
-\def\setsectionlistreference#1#2%
- {\ifnum\countervalue{\??se\previoussection{#1}}>0\relax
- \xdef\previoussectionformat{\@@longformatnumber{\previoussection{#1}}}%
- \else
- \xdef\previoussectionformat{}%
- \fi
- \xdef\currentsectionformat{\@@longformatnumber{#1}}}
-
-\def\startlistreferences#1%
- {\thisissomeinternal{\s!lst}{#1\currentsectionformat}%
- \setxvalue{\s!lst:#1}{\realfolio}% to be sure
- \setxvalue{\s!lst:#1\currentsectionformat}{\realfolio}%
- \setxvalue{\e!vorigelokale#1}{\s!lst:#1\previoussectionformat}%
- \setxvalue{\e!huidigelokale#1}{\s!lst:#1\currentsectionformat}%
- \doifelse{\currentsectionformat}{}
- {\setglobalcrossreference
- {\e!vorige#1}{}{\realfolio}{}}
-%
- {\setglobalsystemreference\rt!list
- {\e!vorige#1}{\getvalue{\e!vorigelokale#1}}}%
-%
-% {\definereference[\e!vorige#1][\getvalue{\e!vorigelokale#1}]%
-%
- \def\stoplistreferences{\dostoplistreferences}}
-
-\def\dostoplistreferences#1%
- {\iflijstgeplaatst
- \addtocommalist{#1}\updatedlistreferences % nog global (\doglobal)
- \global\let\updatedlistreferences=\updatedlistreferences % een noodverbandje
- \gdef\updatelistreferences%
- {\def\docommando####1%
-%
- {\setglobalsystemreference\rt!list
- {\e!vorige####1}{\getvalue{\e!huidigelokale####1}}}%
-%
-% {\definereference[\e!vorige####1][\getvalue{\e!huidigelokale####1}]%
-%
- \processcommacommand[\updatedlistreferences]\docommando
- \global\let\updatelistreferences=\relax
- \global\let\updatedlistreferences=\empty}%
- \fi}
-
-\def\stoplistreferences%
- {\gobbleoneargument}
-
-% de rest
-
-\newcount\prefixteller
-
-\def\referenceprefix{}
-
-% \def\showlocation #1{#1}
-% \def\showcontrastlocation#1#2#3{#3}
-% \def\showcoloredlocation #1#2{#2}
-
-\unexpanded\def\referencepagenumber[#1]%
- {\paginaprefix\??rf[#1]\translatednumber[#1]}
-
-\newif\ifinregels
-\newif\ifregelnummersinmarge
-
-\def\stelregelsin%
- {\dodoubleargument\getparameters[\??rg]}
-
-\def\startregels%
- {\@@rgvoor
- \witruimte
- %\pagina[\v!voorkeur]} gaat mis na koppen, nieuw: later \nobreak
- \begingroup
- \def\@@rgstepyes{\parindent\!!zeropoint}%
- \def\@@rgstepno{\parindent\!!zeropoint}%
- \edef\@@rgparindent{\the\parindent}%
- \gdef\@@rglinesteptoggle{1}%
- \processaction
- [\@@rginspringen]
- [ \v!ja=>\def\@@rgstepyes{\parindent\@@rgparindent}%
- \def\@@rgstepno {\parindent\@@rgparindent},
- \v!oneven=>\def\@@rgstepyes{\parindent\!!zeropoint }%
- \def\@@rgstepno {\parindent\@@rgparindent},
- \v!even=>\def\@@rgstepno {\parindent\!!zeropoint }%
- \def\@@rgstepyes{\parindent\@@rgparindent}]%
- \inregelstrue
- \stelwitruimtein[\v!geen]%
- \obeylines
- \let\checkindentation=\relax
- \@@rgstepno
- \ignorespaces
- \gdef\afterfirstobeyedline% tzt two pass, net als opsomming
- {\gdef\afterfirstobeyedline%
- {\nobreak
- \global\let\afterfirstobeyedline\relax}}%
- \def\obeyedline%
- {\par
- \afterfirstobeyedline
- \ifdim\lastskip>\!!zeropoint
- \gdef\@@rglinesteptoggle{0}%
- \else
- \doglobal\increment\@@rglinesteptoggle
- \fi
- \ifodd\@@rglinesteptoggle\relax
- \@@rgstepyes
- \else
- \@@rgstepno
- \fi
- \futurelet\next\dobetweenthelines}%
- \GotoPar}
-
-% \def\dobetweenthelines%
-% {\convertcommand \next \to\!!stringa % very ugly and fuzzy
-% \convertargument\obeyedline\to\!!stringb % but needed anyway
-% \ifx\!!stringa\!!stringb % but alas, it fails
-% \@@rgtussen % hopelessly in non
-% \fi} % etex
-
-\def\dobetweenthelines%
- {\doifmeaningelse{\next}{\obeyedline}{\@@rgtussen}{}}
-
-\def\stopregels%
- {\endgroup
- \@@rgna}
-
-\newcount\linenumber
-\newcount\linestepper
-\newif\ifinregelnummeren
-
-% het gebruik van \setlocalreference scheelt een hash entry
-
-\def\dodoshowlinenumber% for use elsewhere, to be extended
- {\doschrijfregelnummer
- \global\advance\linenumber by 1\relax}%
-
-\def\regelweergave%
- {\convertnumber\@@rnconversie\linenumber}%
-
-\def\dostelregelnummerenin[#1]%
- {\getparameters
- [\??rn]
- [\c!start=1,
- \c!stap=1,
- #1]%
- \global\linenumber=1\relax}
-
-\def\stelregelnummerenin%
- {\dosingleargument\dostelregelnummerenin}
-
-\def\dostartnummerenLINE% % !! \everypar !!
- {\EveryPar{\schrijfregelnummer}}
-
-\def\dostopnummerenLINE%
- {\egroup}
-
-\def\dodoschrijfregelnummer%
- {\setbox0=\hbox{\regelweergave}%
- \vsmashbox0
- \ifregelnummersinmarge
- \llap{\hbox{\box0\hskip\linkermargeafstand}}%
- \else
- \llap{\hbox to \@@rnbreedte{\box0\hss}}%
- \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
- \fi
- \ifinregels
- \let\dostartnummeren=\dostartnummerenLINE
- \let\stopregelnummeren=\dostopnummerenLINE
- \def\schrijfregelnummer%
- {\doschrijfregelnummer
- \global\advance\linenumber by 1\relax}%
- \else
- \let\dostartnummeren=\dostartnummerenPAR
- \let\stopregelnummeren=\dostopnummerenPAR
- \def\schrijfregelnummer%
- {\global\advance\linenumber by -1\relax
- \doschrijfregelnummer}%
- \fi
- \dostartnummeren}
-
-\def\startregelnummeren%
- {\bgroup
- \inregelnummerentrue
- \complexorsimpleempty\startregelnummeren}
-
-\def\doschrijfregelnummer%
- {\ifnum\linenumber<\@@rnstart\relax
- \else
- \!!counta=\linenumber
- \divide\!!counta by \@@rnstap\relax
- \multiply\!!counta by \@@rnstap\relax
- \ifnum\!!counta=\linenumber
- \doattributes\??rn\c!letter\c!kleur{\dodoschrijfregelnummer}%
- \fi
- \fi}
-
-\def\eenregel[#1]%
- {\regelreferentie0[#1]\ignorespaces}
-
-\def\startregel[#1]%
- {\regelreferentie1[#1]\ignorespaces}
-
-\def\stopregel[#1]%
- {\unskip\regelreferentie2[#1]}
-
-% \def\inregellabel#1%
-% {\doifinstringelse{--}{#1}
-% {\labeltext{\v!regels}}
-% {\labeltext{\v!regel}}}
-%
-% \def\inregel#1[#2]%
-% {\doifelsenothing{#1}
-% {\in{\inregellabel{\currenttextreference}}[\@@rnprefix#2]}
-% {\in{#1}[\@@rnprefix#2]}}
-%
-% double labels:
-
-\def\inregel#1[#2]%
- {\doifelsenothing{#1}
- {\doifinstringelse{--}{\currenttextreference}
- {\in{\leftlabeltext\v!regels}{\rightlabeltext\v!regels}[\@@rnprefix#2]}
- {\in{\leftlabeltext\v!regel }{\rightlabeltext\v!regel }[\@@rnprefix#2]}}
- {\in{#1}[\@@rnprefix#2]}}
-
-\def\dostartnummerenPAR%
- {\beginofshapebox
- \doglobal\newcounter\linereference}
-
-% localcrossref heroverwegen
-
-\def\setlinereference#1#2#3#4%
- {\setxvalue{lrf:#1}{\noexpand\dogetlinereference{#2}{#3}{#4}}}
-
-\def\getlinereference#1%
- {\getvalue{lrf:#1}}
-
-\def\dogetlinereference#1#2#3%
- {\edef\linereferencename{#1}%
- \edef\linereferenceline{#2}%
- \edef\linereferenceplus{#3}}
-
-% 1 xxx xxx xxx xxx xxx xxx xxx
-% 2 xxx yyy yyy yyy yyy yyy yyy <= start y
-% 3 yyy yyy yyy yyy yyy yyy yyy
-% 4 yyy yyy yyy yyy yyy xxx xxx <= stop y
-% 5 xxx xxx xxx xxx xxx xxx xxx
-
-%\def\regelreferentie#1[#2]%
-% {\bgroup
-% \dimen0=\dp\strutbox
-% \doif{\@@rnrefereren}{\v!aan}
-% {\doglobal\increment\linereference
-% % start 1=>(n=y,l=0,p=1)
-% % stop 2=>(n=y,l=0,p=2)
-% \setxvalue{lrf:n:\linereference}{\@@rnprefix#2}%
-% \setxvalue{lrf:l:\linereference}{0}%
-% \setxvalue{lrf:p:\linereference}{#1}%
-% \advance\dimen0 by \linereference sp}%
-% \prewordbreak
-% \vrule \!!width \!!zeropoint \!!depth \dimen0 \!!height \!!zeropoint
-% \prewordbreak
-% \egroup}
-
-\def\regelreferentie#1[#2]%
- {\bgroup
- \dimen0=\dp\strutbox
- \doif{\@@rnrefereren}{\v!aan}
- {\doglobal\increment\linereference
- % start 1=>(n=y,l=0,p=1)
- % stop 2=>(n=y,l=0,p=2)
- \setlinereference{\linereference}{\@@rnprefix#2}{0}{#1}%
- \advance\dimen0 by \linereference sp}%
- \prewordbreak
- \vrule \!!width \!!zeropoint \!!depth \dimen0 \!!height \!!zeropoint
- \prewordbreak
- \egroup}
-
-\def\dostopnummerenPAR% dp's -> openstrutdepth
- {\endofshapebox
- \checkreferences
- \linestepper=0
- \reshapebox{\global\advance\linestepper by 1\relax}%
- \global\advance\linenumber by \linestepper
- \doifelse{\@@rnrefereren}{\v!aan}
- {\reshapebox % We are going back!
- {\global\advance\linenumber by -1
- \dimen0=\dp\shapebox
- \advance\dimen0 by -\dp\strutbox
- \ifdim\dimen0>\!!zeropoint\relax
- % 1=>4 | 2=>4 1=>2
- % start 1=>(n=y,l=2,p=1)
- % stop 2=>(n=y,l=4,p=2)
- \dostepwiserecurse{1}{\number\dimen0}{1}
- {\getlinereference\recurselevel
- \setlinereference\recurselevel
- {\linereferencename}{\the\linenumber}{\linereferenceplus}}%
- \fi}%
- \global\advance\linenumber by \linestepper
- \ifnum\linereference>0 % anders vreemde loop in paragraphs+recurse
- \dorecurse{\linereference}
- {\getlinereference\recurselevel
- \ifnum\linereferenceplus=2 % stop
- % ref y: text = 4 / Kan dit buiten referentie mechanisme om?
- \expanded{\setlocalcrossreference
- {\referenceprefix\linereferencename}{}{}{\linereferenceline}}%
- \fi}%
- \dorecurse{\linereference}
- {\getlinereference\recurselevel
- \ifnum\linereferenceplus<2 % start / lone
- \ifnum\linereferenceplus=1 % start
- \getreferenceelements{\linereferencename}% text = 4
- \ifnum\linereferenceline<0\currenttextreference\relax % 0 prevents error
- \edef\linereferenceline{\linereferenceline--\currenttextreference}%
- \fi
- \fi
- \expanded{\setlocalcrossreference
- {\referenceprefix\linereferencename}{}{}{\linereferenceline}}%
- \fi}%
- \global\let\scratchline=\linenumber % We are going back!
- \reshapebox
- {\doglobal\decrement\scratchline
- \hbox
- {\dorecurse{\linereference}
- {\getlinereference\recurselevel
- \getreferenceelements{\linereferencename}%
- \beforesplitstring\currenttextreference--\at--\to\firstline
- \ifnum\firstline=\scratchline\relax
- % beter een rawtextreference
- \textreference[\linereferencename]{\currenttextreference}%
- \expanded{\setlocalcrossreference
- {\referenceprefix\linereferencename}{}{}{0}}% ==done
- \fi}%
- \dimen0=\dp\shapebox
- \advance\dimen0 by -\dp\strutbox
- \ifdim\dimen0>\!!zeropoint\relax
- \dp\shapebox=\dp\strutbox
- \fi
- \schrijfregelnummer\box\shapebox}}% no \strut !
- \else
- \reshapebox{\hbox{\schrijfregelnummer\box\shapebox}}% no \strut !
- \fi}
- {\reshapebox{\global\advance\linenumber by -1}%
- \global\advance\linenumber by \linestepper
- \reshapebox{\hbox{\schrijfregelnummer\box\shapebox}}}% no \strut !
- \global\advance\linenumber by \linestepper
- \flushshapebox
- \egroup}
-
-\def\crlf%
- {\ifhmode\unskip\else\strut\fi\ifcase\raggedstatus\hfil\fi\break}
-
-\def\opeenregel%
- {\def\crlf{\ifhmode\unskip\fi\space}\let\\\crlf}
-
-\newcount\internalparagraphnumber
-
-\def\stelparagraafnummerenin%
- {\dosingleempty\dostelparagraafnummerenin}
-
-\def\dostelparagraafnummerenin[#1]%
- {\getparameters
- [\??ph][#1]%
- \processaction
- [\@@phstatus]
- [\v!start=>\let\showparagraphnumber\doshowparagraphnumberA,
- \v!stop=>\let\showparagraphnumber\relax,
- \v!regel=>\let\showparagraphnumber\doshowparagraphnumberB,
- \v!reset=>\global\internalparagraphnumber=0
- \let\showparagraphnumber\doshowparagraphnumberA]}
-
-\def\dodoshowparagraphnumber%
- {\global\advance\internalparagraphnumber 1
- \inleftmargin % \tf normalizes em
- {\tf{\doattributes\??ph\c!letter\c!kleur{\the\internalparagraphnumber}}%
- \kern\@@phafstand}}
-
-\def\doshowparagraphnumberA%
- {\ifprocessingverbatim
- \iflinepar\dodoshowparagraphnumber\fi
- \else
- \dodoshowparagraphnumber
- \fi}
-
-\def\doshowparagraphnumberB%
- {\ifinregelnummeren
- \doshowparagraphnumberA
- \fi}
-
-\newbox\opmaak
-
-\def\setopmaaklayout[#1]%
- {\stelvoetin [\c!status=\getvalue{\??do#1\c!voetstatus}]%
- \stelhoofdin[\c!status=\getvalue{\??do#1\c!hoofdstatus}]%
- \steltekstin[\c!status=\getvalue{\??do#1\c!tekststatus}]%
- \stelonderin[\c!status=\getvalue{\??do#1\c!onderstatus}]%
- \stelbovenin[\c!status=\getvalue{\??do#1\c!bovenstatus}]}
-
-\def\dododostartopmaak[#1]%
- {\doifvaluesomething{\??do#1\c!pagina}
- {\ExpandFirstAfter\pagina[\getvalue{\??do#1\c!pagina}]}%
- \soortpagina[#1]%
- \setopmaaklayout[#1]%
- \getvalue{\??do#1\c!commandos}%
- \global\setbox\opmaak=\vbox to \getvalue{\??do#1\c!hoogte}%
- \bgroup
- \forgetall
- \hsize=\getvalue{\??do#1\c!breedte}%
- \getvalue{\??do#1\c!boven}}
-
-\def\dododostopopmaak[#1]%
- {\getvalue{\??do#1\c!onder}%
- \egroup}
-
-\def\doshipoutopmaak[#1]%
- {\bgroup
- \getvalue{\??do#1\c!voor}%
- \box\opmaak
- \setopmaaklayout[#1]%
- \pagina
- \getvalue{\??do#1\c!na}%
- \ifdubbelzijdig
- \ifodd\realpageno\else
- \processaction
- [\getvalue{\??do#1\c!dubbelzijdig}]
- [ \v!ja=>\null\pagina\verlaagpaginanummer,
- \v!leeg=>\pagebodyornamentsfalse
- \null\pagina\verlaagpaginanummer]%
- \fi
- \fi
- \verlaagpaginanummer
- \egroup}
-
-\def\doflushopmaak[#1]%
- {\ifverwerken
- \ifgeselecteerd
- \doshipoutopmaak[#1]%
- \fi
- \else
- \ifgeselecteerd
- \else
- \doshipoutopmaak[#1]%
- \fi
- \fi
- \ifselecteren
- \global\geselecteerdfalse
- \fi}
-
-\def\dodostartopmaak[#1][#2]%
- {\begingroup
- \stelopmaakin[#1][#2]%
- \dododostartopmaak[#1]}
-
-%\def\dodostopopmaak[#1]%
-% {\dododostopopmaak[#1]%
-% \doflushopmaak[#1]%
-% \endgroup}
-
-\def\dodostopopmaak[#1]%
- {\dododostopopmaak[#1]%
- \doflushopmaak[#1]%
- \endgroup
- \calculatehsizes
- \calculatevsizes}
-
-\def\dostartopmaak[#1][#2]%
- {\iffirstargument
- \dodostartopmaak[#1][#2]%
- \def\stopopmaak%
- {\dodostopopmaak[#1]}%
- \else
- \pagina
- \stelhoofdin[\c!status=\v!leeg]
- \stelvoetin[\c!status=\v!leeg]
- \vbox to \teksthoogte % nog een topskip optie
- \bgroup
- \def\stopopmaak%
- {\egroup
- \eject}%
- \fi}
-
-\def\startopmaak%
- {\dodoubleempty\dostartopmaak}
-
-\def\dodefinieeropmaak[#1][#2]%
- {\getparameters
- [\??do#1]%
- [\c!breedte=\zetbreedte,
- \c!hoogte=\teksthoogte,
- \c!voffset=\!!zeropoint,
- \c!hoffset=\!!zeropoint,
- \c!commandos=,
- \c!pagina=\v!rechts,
- \c!dubbelzijdig=\v!leeg,
- \c!voor=,
- \c!boven=\vss,
- \c!onder=\vss,
- \c!na=,
- \c!onderstatus=\v!normaal,
- \c!bovenstatus=\v!normaal,
- \c!tekststatus=\v!normaal,
- \c!hoofdstatus=\v!stop,
- \c!voetstatus=\v!stop,
- #2]%
- \setvalue{\e!start#1\e!opmaak}%
- {\dodoubleempty\dodostartopmaak[#1]}%
- \setvalue{\e!stop#1\e!opmaak}%
- {\dodostopopmaak[#1]}}
-
-\def\definieeropmaak%
- {\dodoubleargument\dodefinieeropmaak}
-
-\def\dostelopmaakin[#1]%
- {\getparameters[\??do#1]}
-
-\def\stelopmaakin%
- {\dodoubleargument\dostelopmaakin}
-
-\def\stelplaatsblokkenin%
- {\dodoubleargument\getparameters[\??bk]}
-
-\def\stelblokkopjesin%
- {\dodoubleargument\getparameters[\??kj]}%
-
-\def\dostelplaatsblokin[#1][#2]%
- {\getparameters[\??fl#1][#2]}
-
-\def\stelplaatsblokin%
- {\dodoubleargument\dostelplaatsblokin}
-
-\def\dostelblokkopjein[#1][#2]%
- {\getparameters[\??kj#1][#2]}
-
-\def\stelblokkopjein%
- {\dodoubleargument\dostelblokkopjein}
-
-\def\doleegblok#1%
- {\localframed
- [\??fl#1][\c!kader=\v!aan]%
- {\getmessage{\m!floatblocks}{12}}}
-
-\def\docomplexplaatsblok[#1][#2][#3]#4%
- {\flushfootnotes
- \ifmargeblokken
- \doifinset{\v!marge}{#2}
- {\bgroup
- \everypar{\egroup\the\everypar}%
- \hsize=\@@mbbreedte}%
- \fi
- \global\insidefloattrue
- \dowithnextboxcontent
- {\postponefootnotes} % new
- {\docompletefloat
- {#1}{#3}{#1}{#2}{#1}{#4}
- {\box\nextbox}}%
- \vbox}
-
-\def\docomplexstarttekstblok[#1][#2][#3]%
- {\flushfootnotes
- \flushsidefloats % hoort eigenlijk niet hier
- \docomplexplaatsblok[#1][\v!tekst,#2,\v!links][#3]}
-
-\def\docomplexreserveerblok[#1][#2][#3][#4]#5%
- {\getvalue{\e!plaats#1}[#3][#4]{#5}{\localframed[\??fl#1][#2]{#1}}}
-
-\def\docomplexstartreserveertekstblok[#1][#2][#3][#4]%
- {\flushsidefloats % hoort eigenlijk niet hier
- \docomplexreserveerblok[#1][#2][\v!tekst,#3,\v!links][#4]}
-
-\def\dodefinieerplaatsblok[#1][#2]% #1=naam #2=meervoud
- {\presetlocalframed[\??fl#1]%
- \stelplaatsblokin
- [#1]
- [\c!breedte=15\korpsgrootte,
- \c!hoogte=10\korpsgrootte,
- \c!kader=\@@bkkader,
- \c!straal=\@@bkstraal,
- \c!hoek=\@@bkhoek,
- \c!plaats=\@@bkplaats,
- \c!achtergrond=\@@bkachtergrond,
- \c!achtergrondraster=\@@bkachtergrondraster,
- \c!achtergrondkleur=\@@bkachtergrondkleur,
- \c!achtergrondoffset=\@@bkachtergrondoffset,
- \c!bovenkader=\@@bkbovenkader,
- \c!onderkader=\@@bkonderkader,
- \c!linkerkader=\@@bklinkerkader,
- \c!rechterkader=\@@bkrechterkader,
- \c!kaderoffset=\@@bkkaderoffset,
- \c!paginaovergangen=]%
- \stelblokkopjein
- [#1]
- [\c!plaats=\@@kjplaats,
- %\c!voor=\@@kjvoor,
- \c!tussen=\@@kjtussen,
- %\c!na=\@@kjna,
- \c!breedte=\@@kjbreedte,
- \c!kopletter=\@@kjkopletter,
- \c!letter=\@@kjletter,
- \c!kleur=\@@kjkleur,
- \c!uitlijnen=\@@kjuitlijnen,
- \c!nummer=\@@kjnummer,
- \c!wijze=\@@kjwijze,
- \c!blokwijze=\@@kjblokwijze,
- \c!sectienummer=\@@kjsectienummer,
- \c!conversie=\@@kjconversie]%
- \doorlabelen
- [#1]
- [\c!tekst=#1,
- \c!plaats=\v!intekst,
- \c!wijze=\getvalue{\??kj#1\c!wijze},
- \c!blokwijze=\getvalue{\??kj#1\c!blokwijze},
- \c!sectienummer=\getvalue{\??kj#1\c!sectienummer},
- \c!conversie=\getvalue{\??kj#1\c!conversie}]%
- \presetlabeltext[#1=\Word{#1}~]%
- \presetheadtext[#2=\Word{#2}]%
- \definieerlijst[#1]%
- \setvalue{\e!plaats\e!lijstmet#2}%
- {\dodoubleempty\doplaatslijst[#1]}%
- \setvalue{\e!volledige\e!lijstmet#2}%
- {\dotripleempty\dodovolledigelijst[#1][#2]}%
- \setvalue{\e!plaats#1}%
- {\dotripleempty\docomplexplaatsblok[#1]}%
- \setvalue{\e!reserveer#1}%
- {\doquadrupleempty\docomplexreserveerblok[#1]}%
- \setvalue{\e!start#1\e!tekst}%
- {\dotripleempty\docomplexstarttekstblok[#1]}%
- \setvalue{\e!stop#1\e!tekst}%
- {\dostoptextfloat}%
- \setvalue{\e!start\e!reserveer#1\e!tekst}%
- {\doquadrupleempty\docomplexstartreserveertekstblok[#1]}%
- \setvalue{\e!stop\e!reserveer#1\e!tekst}%
- {\dostoptextfloat}%
- \setvalue{\e!lege#1}%
- {\doleegblok{#1}}%
- \setvalue{\e!leeg#1}%
- {\doleegblok{#1}}}
-
-\def\definieerplaatsblok%
- {\dodoubleargument\dodefinieerplaatsblok}
-
-% De onderstaande macro's ondersteunen het zetten van tekst
-% rond figuren. De macro's zijn ontworpen door Daniel Comenetz
-% en gepubliceerd in TUGBoat Volume 14 (1993), No. 1: Anchored
-% Figures at Either Margin. De macro's zijn slechts op enkele
-% punten door mij aangepast.
-
-% afhankelijke variabelen
-%
-% \overgap vervangen door \floatsidetopskip
-% \sidegap vervangen door \floatsideskip
-% \undergap vervangen door \floatsidebottomskip
-%
-% \prskp vervangen door \tussenwit
-
-% toegevoegde macro's/aanroepen
-%
-% \logsidefloat : loginformatie
-% \flushsidefloats : nodig voor koppen
-
-% recente wijzigingen:
-%
-% namen aangepast: \float... enz. i.p.v. \pic
-
-% Pas op: \EveryPar{\EveryPar{}\margetitel{whatever}}
-% \plaatsfiguur[links]{}{} moet goed gaan. In dat geval
-% begint de tekst terecht wat lager.
-
-\newdimen\sidefloatheight % includes the topskip
-\newdimen\sidefloatwidth
-\newdimen\sidefloathsize
-\newdimen\sidefloatvsize \def\nofloatvsize{-1pt }
-
-\newbox\floatbottom
-
-\newif\ifrightfloat
-\newif\ifmarginfloat
-\newif\ifroomforfloat
-\newif\iffloatshort
-\newif\iffloatflag
-\newif\iffloatrighteqo
-\newif\iffloatlefteqo
-
-\let\floatrighteqo=\eqno
-\let\floatleftleqo=\leqno
-
-% Watch it even more! In inner, gaat't mis omdat daar
-% pagetotal enz niet zijn aangepast. Inner kan overigens niet
-% betrouwbaar worden getest!
-
-% NOT TOEVOEGEN: \the\everytrace
-
-\everypar ={\flushfootnotes
- \ifinner\else\checksidefloat\fi
- \checkindentation
- \showparagraphnumber % here ?
- \flushmargincontents
- \flushcomments}
-\neverypar ={}
-\everydisplay={\flushfootnotes
- \adjustsidefloatdisplaylines}
-
-\def\flushsidefloats%
- {\par
- \!!heighta=\sidefloatvsize
- \advance\!!heighta by -\pagetotal
- \ifdim\!!heighta>\!!zeropoint
- \witruimte % nog checken op interferentie
- \kern\!!heighta
- \fi
- \global\sidefloatvsize=\nofloatvsize
- \global\floatflagfalse}
-
-\def\forgetsidefloats%
- {\global\sidefloatvsize=\nofloatvsize
- \global\floatflagfalse}
-
-\def\flushsidefloatsafterpar%
- {\xdef\oldpagetotal{\the\pagetotal}%
- \gdef\checksidefloat%
- {\dochecksidefloat
- \ifdim\oldpagetotal=\pagetotal \else
- \xdef\checksidefloat{\dochecksidefloat}%
- \flushsidefloats
- \fi}}
-
-\let\logsidefloat=\relax
-
-\def\pushpenalties%
- {\widowpenalty=1
- \clubpenalty=2
- \brokenpenalty=1
- \let\pushpenalties=\relax
- \edef\poppenalties%
- {\widowpenalty=\the\widowpenalty
- \clubpenalty=\the\clubpenalty
- \brokenpenalty=\the\brokenpenalty}}
-
-\let\poppenalties=\relax
-
-\def\restorepenalties%
- {\ifnum\outputpenalty=\!!tenthousand\relax
- \else
- \penalty\outputpenalty
- \fi}
-
-\def\sidefloatoutput%
- {\iffloatshort
- \unvbox\normalpagebox
- \setbox\floatbottom=\lastbox
- \ifdim\wd\floatbottom>\sidefloathsize
- \penalty-201
- \box\floatbottom
- \else
- \ifvoid\floatbottom
- \else
- \restoreleftindent
- \ifdim\wd\floatbottom<\sidefloathsize
- \parskip=\!!zeropoint
- %\noindent
- \vadjust{\penalty-1}%
- \iffloatlefteqo
- \global\floatlefteqofalse
- \else
- \global\advance\sidefloathsize by -\wd\floatbottom
- \iffloatrighteqo
- \global\floatrighteqofalse
- \else
- \global\divide\sidefloathsize by 2
- \fi
- \hskip\sidefloathsize
- \fi
- \fi
- \box\floatbottom
- \restorepenalties
- \fi
- \fi
- \global\holdinginserts=0
- \global\floatshortfalse
- \else
- \finaloutput\unvbox\normalpagebox
- \global\sidefloatvsize=\nofloatvsize
- \poppenalties
- \fi}
-
-\def\restoreleftindent%
- {\ifrightfloat
- \else
- \parskip=\!!zeropoint
- \noindent
- \vadjust{\penalty-1}%
- \hskip\sidefloatwidth
- \fi}
-
-\def\eqno%
- {\iffloatshort
- \global\floatrighteqotrue
- \fi
- \floatrighteqo}
-
-\def\leftmarginfloat#1%
- {\global\rightfloatfalse\marginfloattrue\putsidefloat{#1}}
-
-\def\rightmarginfloat#1%
- {\global\rightfloattrue\marginfloattrue\putsidefloat{#1}}
-
-\def\leftfloat#1%
- {\global\rightfloatfalse\marginfloatfalse\putsidefloat{#1}}
-
-\def\rightfloat#1%
- {\global\rightfloattrue\marginfloatfalse\putsidefloat{#1}}
-
-\def\putsidefloat#1%
- {\par
- \witruimte
- \previoussidefloat
- \stallsidefloat
-% \setbox\floatbox=\hbox{\vbox % pretty ugly, will be rewritten
-% {\vskip\ifmarginfloat-\sidefloattopskip\else\sidefloattopoffset\fi#1}}
- \setbox\floatbox=\hbox
- {\vbox{\vskip\ifmarginfloat-\fi\sidefloattopoffset#1}}%
- \measuresidefloat
- \ifroomforfloat
- \setsidefloat
- \else
- \tosssidefloat
- \measuresidefloat
- \stallsidefloat
- \setsidefloat
- \fi}
-
-\def\progresssidefloat%
- {\!!heighta=\sidefloatvsize
- \iffloatflag
- \advance\!!heighta by -\dimen3
- \global\floatflagfalse
- \else
- \advance\!!heighta by -\pagetotal
- \fi}
-
-\def\tosssidefloat%
- {\vfill\eject}
-
-\def\measuresidefloat%
- {\global\floatflagtrue
- \dimen3=\pagetotal
- \ifmarginfloat
- \global\sidefloatwidth=\!!zeropoint
- \else
- \global\sidefloatwidth=\wd\floatbox
- \global\advance\sidefloatwidth by \floatsideskip
- \fi
- \global\sidefloathsize=\hsize
- \global\advance\sidefloathsize by -\sidefloatwidth
- \global\sidefloatheight=\ht\floatbox
-\global\advance\sidefloatheight by \dp\floatbox
- \global\advance\sidefloatheight by \sidefloattopskip
- \global\sidefloatvsize=\sidefloatheight
- \global\advance\sidefloatvsize by \dimen3
- \dimen0=\sidefloatvsize
-% \advance\dimen0 by -\baselineskip
-%\ifgridsnapping
-% \advance\dimen0 by .5\openlineheight % \vsize slightly too large
-%\fi
- \ifdim\dimen0>.99\pagegoal \relax
- \roomforfloatfalse
- \else
- \dimen0=\pagegoal
- \advance\dimen0 by -\sidefloatvsize
- \ifdim\dimen0<\sidefloatbottomskip
- \global\advance\sidefloatvsize by \dimen0
- \global\floatshorttrue
- \pushpenalties
- \global\holdinginserts=1
- \else
- \global\advance\sidefloatvsize by \sidefloatbottomskip
- \global\floatshortfalse
- \fi
- \roomforfloattrue
- \fi}
-
-\def\setsidefloat%
- {\vbox{\strut}\vskip-\lineheight
- \kern\sidefloattopskip
- \edef\presidefloatdepth{\the\prevdepth}%
- \nointerlineskip
- \bgroup
- \everypar={}%
- \parskip=\!!zeropoint
- \logsidefloat
- \ifrightfloat
- \hfill
- \ifmarginfloat
- \rlap{\hskip\rechtermargeafstand\hskip\rightskip\unhbox\floatbox}%
- \else
- \unhbox\floatbox
- \fi
- \else
- \noindent
- \ifmarginfloat
- \llap{\unhbox\floatbox\hskip\leftskip\hskip\linkermargeafstand}%
- \else
- \unhbox\floatbox
- \fi
- \hfill
- \fi
- \egroup
- \par
- \kern-\sidefloatheight
- \penalty10001
- \normalbaselines
- \prevdepth=\presidefloatdepth
- %\noindent
- \resetsidefloatparagraph
- \ignorespaces}
-
-\newcount\sidefloatparagraph
-
-\def\iffirstsidefloatparagraph%
- {\ifnum\sidefloatparagraph=1\relax}
-
-\def\setsidefloatparagraph%
- {\global\advance\sidefloatparagraph by 1\relax}
-
-\def\resetsidefloatparagraph%
- {\global\sidefloatparagraph=0\relax}
-
-\def\dochecksidefloat%
- {\progresssidefloat
- \ifdim\!!heighta>\!!zeropoint
- \advance\!!heighta by \sidefloatbottomskip
- \!!counta=\!!heighta
- \divide\!!counta by \baselineskip
- \ifnum\!!counta>0
- \ifrightfloat
- \hangindent=-\sidefloatwidth
- \else
- \hangindent=\sidefloatwidth
- \fi
- \hangafter=-\!!counta
- \fi
- \setsidefloatparagraph
- \else
- \resetsidefloatparagraph
- \fi
- \parskip=\tussenwit}
-
-\def\checksidefloat%
- {\dochecksidefloat}
-
-\def\doadjustsidefloatdisplaylines%
- {\par
- \vskip-\parskip
- \noindent
- \ignorespaces}
-
-\def\adjustsidefloatdisplaylines%
- {\aftergroup\doadjustsidefloatdisplaylines}
-
-\def\previoussidefloat%
- {\progresssidefloat
- \ifdim\!!heighta>\!!zeropoint \relax
- \iffloatshort
- \global\floatshortfalse
- \tosssidefloat
- \else
- \kern\!!heighta
- \fi
- \fi}
-
-\def\stallsidefloat%
- {\!!counta=\pageshrink
- \divide\!!counta by \baselineskip
- \advance\!!counta by 1
- \parskip=\!!zeropoint
- \dorecurse{\!!counta}{\line{}}
- \kern-\!!counta\baselineskip
- \penalty0\relax}
-
-% 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
-
-\newif\ifsomefloatwaiting \somefloatwaitingfalse
-\newif\ifroomforfloat \roomforfloattrue
-\newif\ifnofloatpermitted \nofloatpermittedfalse
-\newif\iffloatsonpage \floatsonpagefalse
-
-\newcount\totalnoffloats \totalnoffloats=0
-\newcount\savednoffloats \savednoffloats=0
-\newcount\noffloatinserts \noffloatinserts=0
-
-\newbox\floatlist
-
-\newinsert\botins
-
-\skip\botins=\!!zeropoint
-\count\botins=\!!thousand
-\dimen\botins=\maxdimen
-
-\newdimen\topinserted
-\topinserted=\!!zeropoint
-
-\newdimen\botinserted
-\botinserted=\!!zeropoint
-
-\newif\ifflushingfloats
-\flushingfloatsfalse
-
-\newbox\floattext
-
-\newdimen\floattextwidth
-\newdimen\floattextheight
-
-\newbox\floatbox
-
-\newdimen\floatwidth
-\newdimen\floatheight
-
-% Er wordt bij \v!altijd als dat nodig is hernummerd.
-% Daarbij wordt gebruik gemaakt van de opgeslagen nummers en
-% volgorde.
-
-\definetwopasslist{\s!float}
-
-\def\dofloatreference%
- {\doglobal\increment\numberedfloat
- \edef\dodofloatreference%
- {\writeutilitycommand%
- {\twopassentry%
- {\s!float}%
- {\numberedfloat}%
- {\hetnummer}}}%
- \dodofloatreference}
-
-\def\redofloatorder#1%
- {\doglobal\increment\nofplacedfloats\relax
- \gettwopassdata{\s!float}%
- \iftwopassdatafound
- \doifnot{\hetnummer}{\twopassdata}
- {\edef\oldhetnummer{\hetnummer}%
- \xdef\hetnummer{\twopassdata}%
- \showmessage
- {\m!floatblocks}{1}
- {\nofplacedfloats,#1 \oldhetnummer,\hetnummer}}%
- \fi}
-
-% In \dofloatinfomessage wordt {{ }} gebruikt omdat anders
-% binnen \startuitstellen...\stopuitstellen geen goede
-% melding in de marge volgt: \ifinner is dan namelijk true.
-
-\def\dofloatinfomessage#1#2#3%
- {\bgroup
- \showmessage{\m!floatblocks}{#2}{#3}%
- \@EA\floatinfo\@EA#1\@EA{\currentmessagetext}%
- \egroup}
-
-\def\dosavefloatinfo%
- {\dofloatinfomessage{>}{2}{\the\totalnoffloats}}
-
-\def\dofloatflushedinfo%
- {\bgroup
- \!!counta=\totalnoffloats
- \advance\!!counta by -\savednoffloats
- \dofloatinfomessage{<}{3}{\the\!!counta}%
- \egroup}
-
-\def\doinsertfloatinfo%
- {\dofloatinfomessage{<}{4}{\the\totalnoffloats}}
-
-% ook voetnoten saven
-
-\def\dosavefloat%
- {\global\setbox\floatlist=\vbox
- {\nointerlineskip
- \box\floatbox
- \unvbox\floatlist}%
- \global\advance\savednoffloats by 1
- \global\somefloatwaitingtrue
- \dosavefloatinfo
- \nonoindentation}
-
-\def\doresavefloat%
- {\global\setbox\floatlist=\vbox
- {\nointerlineskip
- \unvbox\floatlist
- \box\floatbox}%
- \global\advance\savednoffloats by 1
- \global\somefloatwaitingtrue}
-
-\def\doreversesavefloat%
- {\global\setbox\floatlist=\vbox
- {\nointerlineskip
- \unvbox\floatlist
- \box\floatbox}%
- \global\advance\savednoffloats by 1
- \global\somefloatwaitingtrue
- \dosavefloatinfo}
-
-\def\checkwaitingfloats#1%
- {\ifsomefloatwaiting
- \doifinsetelse{\v!altijd}{#1}
- {\showmessage{\m!floatblocks}{5}{}}
- {\doflushfloats}%
- \fi}
-
-\def\doflushfloats%
- {\global\floatsonpagefalse
- \global\flushingfloatstrue
- \ifsomefloatwaiting
- \par
- \ifvmode\prevdepth=\maxdimen\fi % prevents whitespace
- \dodoflushfloats
- \fi
- \global\savednoffloats=0
- \global\somefloatwaitingfalse
- \global\flushingfloatsfalse}
-
-\def\dodoflushfloats% moet nog beter: als precies passend, niet onder baseline
- {\ifsomefloatwaiting
- \bgroup % \box\floatbox can be in use!
- \dogetfloat
- %\forgetall % NJET!
- \witruimte
- \blanko[\@@bkvoorwit]
- \flushfloatbox
- %\ifnum\savednoffloats>1 % REMOVED
- %\else
- \blanko[\@@bknawit]
- %\fi
- \egroup
- \dofloatflushedinfo
- \expandafter\dodoflushfloats
- \fi}
-
-\newbox\globalscratchbox
-
-\def\dogetfloat%
- {\ifsomefloatwaiting
- \global\setbox\floatlist=\vbox
- {\unvbox\floatlist
- \global\setbox\globalscratchbox=\lastbox}%
- \setbox\floatbox=\box\globalscratchbox % local !
- \global\advance\savednoffloats by -1\relax
- \ifnum\savednoffloats=0
- \global\somefloatwaitingfalse
- \fi
- \else
- \global\savednoffloats=0
- \global\setbox\floatbox=\box\voidb@x
- \fi}
-
-\def\dotopfloat%
- {\ifdim\topinserted=\!!zeropoint\relax
- \topofinserttrue
- \else
- \topofinsertfalse
- \fi
- \global\advance\topinserted by \ht\floatbox
- \global\advance\topinserted by \dp\floatbox
- \global\advance\topinserted by \floatbottomskip
- \insert\topins
- {\forgetall
- \iftopofinsert
- \kern-\lineskip\par\prevdepth=\maxdimen
- \else
- %\blanko[-\@@bknawit,\@@bkvoorwit]% inserts can't look back
- \betweenfloatblanko
- \fi
- \flushfloatbox
- \blanko[\@@bknawit]}%
- \doinsertfloatinfo}
-
-% The number of topinserts also influences the float order,
-% in this respect that when a moved float does not fit, but a
-% next one does, it is indeed placed. Take for instance a
-% sequence of 20 floats, large and small, where a large one
-% migrates and the next smaller one is inserted.
-
-\def\dodosettopinserts%
- {\ifnum\noffloatinserts<\noftopfloats
- \dogetfloat
- \ifdim\topinserted=\!!zeropoint\relax
- \topofinserttrue
- \else
- \topofinsertfalse
- \fi
- \global\advance\topinserted by \ht\floatbox
- \global\advance\topinserted by \dp\floatbox
- \global\advance\topinserted by \floatbottomskip\relax
- \ifdim\topinserted<\teksthoogte\relax
- \xdef\totaltopinserted{\the\topinserted}%
- \insert\topins
- {\forgetall
- \iftopofinsert
- \kern-\lineskip\par\prevdepth=\maxdimen
- \else
- %\blanko[-\@@bknawit,\@@bkvoorwit]% inserts can't look back
- \betweenfloatblanko
- \fi
- \flushfloatbox
- \blanko[\@@bknawit]}%
- \ifsomefloatwaiting
- \advance\noffloatinserts by 1
- \else
- \noffloatinserts=\noftopfloats\relax
- \fi
- \dofloatflushedinfo
- \else
- \doresavefloat
- \noffloatinserts=\noftopfloats\relax
- \fi
- \else
- \ifsomefloatwaiting
- \showmessage{\m!floatblocks}{6}{\the\noftopfloats}%
- \fi
- \let\dodosettopinserts=\relax
- \fi
- \dodosettopinserts}
-
-\def\dosettopinserts%
- {\bgroup
- \ifsomefloatwaiting
- \noffloatinserts=0
- \let\totaltopinserted=\!!zeropoint
- \dodosettopinserts
- \ifnum\@@bknonder=0
- \ifnum\@@bknregels>0
- \ifdim\totaltopinserted>\!!zeropoint\relax
- \dimen0=\lineheight
- \dimen0=\@@bknregels\dimen0
- \advance\dimen0 by \totaltopinserted\relax
- \ifdim\dimen0>\teksthoogte
- \showmessage{\m!floatblocks}{8}{\@@bknregels}%
- \vfilll\eject
- \fi
- \fi
- \fi
- \fi
- \fi
- \egroup}
-
-\def\dodosetbotinserts%
- {\ifnum\noffloatinserts<\nofbotfloats\relax
- \dogetfloat
- \global\advance\botinserted by \ht\floatbox\relax
- \global\advance\botinserted by \dp\floatbox\relax
- \global\advance\botinserted by \floattopskip\relax
- \ifdim\botinserted<\pagegoal\relax
- \insert\botins
- {\forgetall
- \blanko[\@@bkvoorwit]%
- \flushfloatbox}%
- \ifsomefloatwaiting
- \advance\noffloatinserts by 1
- \else
- \noffloatinserts=\nofbotfloats
- \fi
- \dofloatflushedinfo
- \else
- \doresavefloat
- \noffloatinserts=\nofbotfloats\relax
- \fi
- \global\nofloatpermittedtrue % vgl topfloats s!
- \else
- \ifsomefloatwaiting
- \showmessage{\m!floatblocks}{7}{\the\nofbotfloats}%
- \fi
- \let\dodosetbotinserts=\relax
- \fi
- \dodosetbotinserts}
-
-\def\dosetbotinserts%
- {\bgroup
- \ifsomefloatwaiting
- \noffloatinserts=0
- \dodosetbotinserts
- \fi
- \egroup}
-
-\def\dobotfloat%
- {\global\advance\botinserted by \ht\floatbox
- \global\advance\botinserted by \dp\floatbox
- \global\advance\botinserted by \floattopskip
- \insert\botins
- {\forgetall
- \blanko[\@@bkvoorwit]%
- \flushfloatbox}%
- %\global\nofloatpermittedtrue
- \doinsertfloatinfo}
-
-\def\dosetbothinserts%
- {\ifflushingfloats
- \global\topinserted=\!!zeropoint\relax
- \global\botinserted=\!!zeropoint\relax
- \else
- \global\topinserted=\!!zeropoint\relax
- \dosettopinserts
- \global\botinserted=\topinserted\relax
- \dosetbotinserts
- \fi}
-
-\def\dotopinsertions%
- {\ifvoid\topins\else
- \ifgridsnapping
- %\topsnaptogrid{\box\topins}
- \box\topins % already snapped
- \else
- \unvbox\topins
- \fi
- \fi
- \global\topinserted=\!!zeropoint\relax}
-
-\def\dobotinsertions%
- {\ifvoid\botins\else
- \ifgridsnapping
- \snaptogrid\hbox{\box\botins}
- \else
- \unvbox\botins
- \fi
- \fi
- \global\botinserted=\!!zeropoint\relax
- \global\nofloatpermittedfalse}
-
-\newif\iftopofinsert
-\newif\iftestfloatbox %\testfloatboxtrue
-
-%\def\flushfloatbox% nog verder doorvoeren en meer info in marge
-% {\iftestfloatbox
-% \ruledhbox{\box\floatbox}%
-% \else
-% \box\floatbox
-% \fi}
-
-% \testfloatboxtrue
-%
-% testfloatbox gaat mis, niet in midden, dus elders
-
-\def\flushfloatbox% nog verder doorvoeren en meer info in marge
- {\snaptogrid\hbox{\iftestfloatbox\ruledhbox\fi{\copy\floatbox}}}
-
-% beter de laatste skip buiten de \insert uitvoeren,
-% bovendien bij volle flush onder baseline.
-
-\def\betweenfloatblanko% assumes that \@@bknawit is present
- {\bgroup
- \setbox0=\vbox{\strut\blanko[\@@bkvoorwit]\strut}%
- \setbox2=\vbox{\strut\blanko[\@@bknawit]\strut}%
- \ifdim\ht0>\ht2
- \blanko[-\@@bknawit,\@@bkvoorwit]
- \fi
- \egroup}
-
-\def\doroomfloat%
- {\ifnofloatpermitted
- \global\roomforfloatfalse
- \else
- \dimen0=\pagetotal
- \advance\dimen0 by \ht\floatbox
- \advance\dimen0 by \dp\floatbox
- \advance\dimen0 by \floattopskip
- \advance\dimen0 by -\pageshrink % toegevoegd
-%\ifgridsnapping
-% \advance\dimen0 by .5\openlineheight % \vsize slightly too large
-%\fi
- \ifdim\dimen0>\pagegoal
- \global\roomforfloatfalse
- \else
- \global\roomforfloattrue
- \fi
- \fi}
-
-\def\doexecfloat% spacing between two successive must be better
- {\baselinecorrection
- \witruimte
- \blanko[\@@bkvoorwit]%
- \flushfloatbox
- \blanko[\@@bknawit]%
- \doinsertfloatinfo
- \doif{\@@bkspringvolgendein}{\v!nee}{\noindentation}} % new
-
-\def\somefixdfloat[#1]%
- {\doroomfloat
- \ifroomforfloat\else
- \goodbreak
- \fi
- \showmessage{\m!floatblocks}{9}{}%
- \doexecfloat}
-
-\def\somesidefloat[#1]% links, rechts NOG TESTEN EN AANPASSEN
- {\ifbinnenkolommen
- \someelsefloat[\v!hier]%
- \else
- \checkwaitingfloats{#1}%
- \def\logsidefloat%
- {\doinsertfloatinfo}%
- \setbox\floatbox=\vbox{\box\floatbox}%
- \wd\floatbox=\floatwidth
- \processfirstactioninset
- [#1]
- [ \v!links=>\leftfloat{\box\floatbox},
- \v!rechts=>\rightfloat{\box\floatbox},
- \v!inlinker=>\leftmarginfloat{\box\floatbox},
- \v!inrechter=>\rightmarginfloat{\box\floatbox},
- \v!inmarge=>{\doinmargenormal\leftmarginfloat
- \rightmarginfloat{\box\floatbox}}]%
- \doifinset{\v!lang}{#1}
- {\flushsidefloatsafterpar}%
- \fi}
-
-\def\sometextfloat[#1]% lang, links, rechts, hoog, midden, laag, offset
- {\checkwaitingfloats{#1}%
- \def\dostoptextfloat{\dodostoptextfloat[#1]}%
- \global\floattextwidth=\hsize
- \global\floatwidth=\wd\floatbox
- \global\floatheight=\ht\floatbox % forget about the depth
- \global\advance\floattextwidth by -\floatwidth
- \global\advance\floattextwidth by -\@@bkmarge\relax % was \tfskipsize
- \doifinsetelse{\v!lang}{#1}
- {\floattextheight=\pagegoal
- \advance\floattextheight by -\pagetotal
- \advance\floattextheight by -\bigskipamount % lelijk
- \ifdim\floattextheight>\teksthoogte
- \floattextheight=\teksthoogte
- \fi
- \boxmaxdepth=\!!zeropoint\relax % toegevoegd
- \ifdim\floattextheight<\floatheight
- \floattextheight=\floatheight
- \fi
- \setbox\floattext=\vbox to \floattextheight}
- {\setbox\floattext=\vbox}%
- \bgroup
-\forgetall\stelblankoin\stelwitruimtein % new, also needed for footnotes
- \blanko[\v!blokkeer]
- \hsize\floattextwidth
- \ignorespaces}
-
-\def\dodostoptextfloat[#1]%
- {\egroup
- \doifnotinset{\v!lang}{#1}%
- {\ifdim\ht\floattext<\floatheight
- \floattextheight=\floatheight
- \else
- \floattextheight=\ht\floattext
- \fi}%
- \setbox\floatbox=\vbox to \floattextheight
- {\hsize\floatwidth
- \doifinsetelse{\v!beide}{#1}%
- {\doifinsetelse{\v!laag}{#1}
- {\vfill\box\floatbox}
- {\doifinsetelse{\v!midden}{#1}
- {\vfill\box\floatbox\vfill}
- {\box\floatbox\vfill}}}
- {\box\floatbox\vfill}}%
- \setbox\floattext=\vbox to \floattextheight
- {\hsize\floattextwidth
- \doifinsetelse{\v!laag}{#1}
- {\vfill
- \box\floattext
- \doifinset{\c!offset}{#1}{\witruimte\blanko}}
- {\doifinsetelse{\v!midden}{#1}
- {\vfill
- \box\floattext
- \vfill}
- {\doifinset{\v!offset}{#1}{\witruimte\blanko}%
- \box\floattext
- \vfill}}}%
- \doifinsetelse{\v!rechts}{#1}%
- {\setbox\floatbox=\hbox to \hsize
- {\box\floattext
- \hfill
- \box\floatbox}}
- {\setbox\floatbox=\hbox to \hsize
- {\box\floatbox
- \hfill
- \box\floattext}}%
- \baselinecorrection
- \witruimte
- \blanko[\@@bkvoorwit]%
- \doifnotinset{\v!lang}{#1}%
- {\dp\floatbox=\openstrutdepth}% dp\strutbox}% % toegevoegd
- \box\floatbox
- \blanko[\@@bknawit]%
- \doinsertfloatinfo}
-
-\def\somefacefloat[#1]% links, rechts, midden, hoog, midden, laag
- {\checkwaitingfloats{#1}%
- \startnaast\box\floatbox\stopnaast
- \doinsertfloatinfo}
-
-\def\somepagefloat[#1]% links, rechts, midden, hoog, midden, laag
- {\checkwaitingfloats{#1}%
- \vbox to \teksthoogte
- {\doifnotinset{\v!hoog}{#1}{\vfill}%
- \box\floatbox
- \doifnotinset{\v!laag}{#1}{\vfill}}%
- \doinsertfloatinfo
- \pagina} % toegevoegd
-
-\def\someelsefloat[#1]%
- {\doifinsetelse{\v!hier}{#1}
- {\doifinsetelse{\v!altijd}{#1}
- {\pagina[\v!voorkeur]%
- \doroomfloat
- \ifroomforfloat
- \doexecfloat
- \else
- \showmessage{\m!floatblocks}{9}{}%
- \doreversesavefloat
- \fi}
- {\ifsomefloatwaiting
- \dosavefloat
- \else
- \pagina[\v!voorkeur]%
- \doroomfloat
- \ifroomforfloat
- \doexecfloat
- \else
- \dosavefloat
- \fi
- \fi}}
- {\doifinsetelse{\v!altijd}{#1}
- {\doroomfloat
- \ifroomforfloat
- \processallactionsinset
- [#1]
- [ \v!boven=>\dotopfloat,
- \v!onder=>\dobotfloat,
- \s!default=>\doexecfloat]%
- \else
- \showmessage{\m!floatblocks}{9}{}%
- \doreversesavefloat
- \fi}
- {\doroomfloat
- \ifroomforfloat
- \processallactionsinset
- [#1]
- [ \v!boven=>\dotopfloat,
- \v!onder=>\dobotfloat,
- \s!default=>\doexecfloat]%
- \else
- \dosavefloat
- \fi}}}
-
-% De onderstaande macro wordt gebruikt bij de macros
-% voor het plaatsen van tabellen en figuren (klopt niet
-% meer).
-%
-% \dofloat {plaats} {label1} {label2} {kader}
-%
-% \docompletefloat {nummer} {referentie} {lijst}
-% {plaats} {label1} {label2} {inhoud}
-%
-% \box\floatbox inhoud+referentie
-%
-% \do???float#1 #1 = boxnummer
-%
-% \ifinsidefloat wordt \true gezet voor \docompletefloat en \false
-% na float plaatsen; kan worden gebruikt om in
-% andere commando's witruimte te onderdrukken
-
-\newdimen\floattopskip \floattopskip=12pt
-\newdimen\floatbottomskip \floatbottomskip=12pt
-\newdimen\floatsideskip \floatsideskip=12pt
-
-\newdimen\sidefloattopskip \sidefloattopskip=\floattopskip
-\newdimen\sidefloatbottomskip \sidefloatbottomskip=\floatbottomskip
-\def\sidefloattopoffset {\openstrutdepth} % {\dp\strutbox}
-
-\newcount\noftopfloats \noftopfloats=2
-\newcount\nofbotfloats \nofbotfloats=0
-
-\def\calculatefloatskips%
- {{\def\calculatefloatskips##1##2%
- {\doifelsenothing{##2}
- {\global##1=\!!zeropoint}
- {\doifelse{##2}{\v!geen}
- {\global##1=\!!zeropoint}
- {\setbox0=\vbox{\witruimte\@EA\blanko\@EA[##2]}%
- \global##1=\ht0}}}%
- \calculatefloatskips\floattopskip\@@bkvoorwit
- \calculatefloatskips\floatbottomskip\@@bknawit
- \calculatefloatskips\sidefloattopskip\@@bkzijvoorwit
- \calculatefloatskips\sidefloatbottomskip\@@bkzijnawit
- \def\sidefloattopoffset{\openstrutdepth}% {\dp\strutbox}%
- \global\floatsideskip=\@@bkmarge\relax
- \global\noftopfloats=\@@bknboven\relax
- \global\nofbotfloats=\@@bknonder\relax}}
-
-\newif\ifinsidefloat
-
-\def\floatcaptionsuffix{} % an optional suffix
-\def\floatcaptionnumber{} % a logical counter
-
-\def\dosetfloatcaption#1#2#3%
- {\def\dofloattekst%
- {{\doattributes{\??kj#1}\c!letter\c!kleur{#3}}}%
- \doifelsevalue{\??kj#1\c!nummer}{\v!ja}
- {\def\dofloatnummer%
- {{\xdef\floatcaptionnumber{#1}%
- \hbox{\doattributes{\??kj#1}\c!kopletter\c!kopkleur
- {\strut#2\floatcaptionsuffix}}}%
- \ConvertToConstant\doifnot{#3}{}
- {\tfskip
- \emergencystretch=.5em}}}
- {\let\dofloatnummer=\empty}}
-
-\def\putborderedfloat#1\in#2\\%
- {\setbox#2=\vbox
- {\localframed
- [\??fl#1]
- [\c!breedte=\@@bkbreedte,
- \c!hoogte=\@@bkhoogte,
- \c!plaats=\v!normaal,
- \c!offset=\@@bkoffset]%
- {\box\floatbox}}}
-
-\newbox\captionbox
-
-\def\putcompletecaption#1#2#3#4%
- {\noindent
- \xdef\floatcaptionnumber{#1}%
- \doattributes{\??kj#1}\c!letter\c!kleur
- {\doifvalue{\??kj#1\c!nummer}{\v!ja}
- {\hbox{\doattributes{\??kj#1}\c!kopletter\c!kopkleur{\strut#2\floatcaptionsuffix}}%
- \ConvertToConstant\doifnot{#3}{}
- {\ifcase#4\relax
- \tfskip\emergencystretch=.5em
- \else
- \ifx\@@kjkjtussen\empty\else\unskip\@@kjkjtussen\fi
- \fi}}%
- \begstrut#3\endstrut\endgraf}}
-
-% \def\dosetpagfloat#1#2#3#4% \copy wegwerken
-% {\bgroup
-% \forgetall
-% \postponefootnotes
-% \mindermeldingen
-% %\showcomposition
-% \putborderedfloat#4\in4\\%
-% \def\locatefloat%
-% {\doregelplaats\@@flflplaats}%
-% \ConvertToConstant\doifelse{#3}{\v!geen}
-% {\global\setbox\floatbox=\vbox % pas op als wd groter dan hsize
-% {\ifbinnenkolommen\ifdim\wd4>\hsize
-% \let\locatefloat\relax
-% \fi\fi
-% \locatefloat{\copy4}}} % we need \wd4 later
-% {\setbox2=\hbox
-% {\footnotesenabledfalse\putcompletecaption{#4}{#2}{#3}{0}}%
-% \doifinsetelse{\@@kjkjplaats}{\v!hoog,\v!midden,\v!laag}
-% {\dimen0=\hsize
-% \advance\dimen0 by -\wd4\relax
-% \advance\dimen0 by -\@@bkmarge\relax % \was tfskipsize\relax
-% \ifdim\wd2>\dimen0\relax
-% \dimen2=1.3\dimen0\relax
-% \ifdim\wd2<\dimen2\relax
-% \dimen0=0.8\dimen0\relax
-% \fi
-% \fi
-% \setbox2=\vbox
-% {\forgetall
-% \hsize=\dimen0\relax
-% \raggedright
-% \putcompletecaption{#4}{#2}{#3}{1}}}
-% {\doifelse{\@@kjkjbreedte}{\v!max}
-% {\dosetraggedvbox{\@@kjkjuitlijnen}%
-% \setbox2=\raggedbox
-% {\hsize\wd4\relax
-% \putcompletecaption{#4}{#2}{#3}{0}}}
-% {\ifdim\wd2>\wd4\relax
-% \doifelse{\@@kjkjbreedte}{\v!passend}
-% {\ifdim\wd4<15\korpsgrootte\relax
-% \dimen0=15\korpsgrootte\relax
-% \else
-% \dimen0=\wd4\relax
-% \fi
-% \ifdim\wd4>\hsize
-% \setbox0=\vbox
-% {\forgetall
-% \hsize=1.0\wd4
-% \footnotesenabledfalse
-% \putcompletecaption{#4}{#2}{#3}{0}}%
-% \ifdim\ht0>\lineheight\relax
-% \setbox2=\vbox
-% {\forgetall
-% \hsize=0.9\wd4
-% \putcompletecaption{#4}{#2}{#3}{0}}%
-% \else
-% %\setbox2=\vbox % was 0, bug
-% % {\forgetall
-% % \hsize=1.0\wd4
-% % \putcompletecaption{#4}{#2}{#3}{0}}%
-% \setbox2=\hbox{\putcompletecaption{#4}{#2}{#3}{0}}%
-% \fi
-% \else
-% \setbox0=\vbox
-% {\forgetall
-% \dimen2=1.5\dimen0\relax
-% \ifdim\dimen2<\hsize
-% \hsize=\dimen2\relax
-% \fi
-% \footnotesenabledfalse
-% \putcompletecaption{#4}{#2}{#3}{0}}%
-% \ifdim\ht0>\lineheight\relax
-% \setbox2=\vbox
-% {\forgetall
-% \dimen2=1.2\dimen0\relax
-% \ifdim\dimen2<\hsize
-% \hsize=\dimen2\relax
-% \fi
-% \putcompletecaption{#4}{#2}{#3}{0}}%
-% \else
-% %\setbox2=\vbox % was 0, bug
-% % {\forgetall
-% % \dimen2=1.5\dimen0\relax
-% % \ifdim\dimen2<\hsize
-% % \hsize=\dimen2\relax
-% % \fi
-% % \putcompletecaption{#4}{#2}{#3}{0}}%
-% \setbox2=\hbox{\putcompletecaption{#4}{#2}{#3}{0}}%
-% \fi
-% \fi}
-% {\dosetraggedvbox{\@@kjkjuitlijnen}%
-% \setbox2=\raggedbox
-% {\hsize\@@kjkjbreedte
-% \putcompletecaption{#4}{#2}{#3}{0}}}%
-% \else
-% % \setbox2=\hbox % we want footnotes !
-% % {\putcompletecaption{#4}{#2}{#3}{0}}%
-% \raggedcenter % default
-% \dosetraggedvbox{\@@kjkjuitlijnen}%
-% \setbox2=\raggedbox
-% {\hsize\wd4
-% \putcompletecaption{#4}{#2}{#3}{0}}%
-% \fi}}%
-% \global\setbox\floatbox=\vbox
-% {\forgetall
-% \processaction
-% [\@@kjkjplaats]
-% [ \v!boven=>\locatefloat{\copy2}%
-% \endgraf\@@kjkjtussen
-% \locatefloat{\copy4},
-% \v!onder=>\locatefloat{\copy4}%
-% \endgraf\@@kjkjtussen
-% \locatefloat{\copy2},
-% \v!hoog=>\locatefloat
-% {\doifelse{\@@flflplaats}{\v!links}
-% {\copy4
-% \tfskip
-% \vbox to\ht4{\@@kjkjtussen\copy2\vfill}}
-% {\vbox to\ht4{\@@kjkjtussen\copy2\vfill}%
-% \tfskip
-% \copy4}},
-% \v!laag=>\locatefloat
-% {\doifelse{\@@flflplaats}{\v!links}
-% {\copy4
-% \tfskip
-% \vbox to\ht4
-% {\vfill\copy2\@@kjkjtussen}}
-% {\vbox to\ht4
-% {\vfill\copy2\@@kjkjtussen}%
-% \tfskip
-% \copy4}},
-% \v!midden=>\locatefloat
-% {\doifelse{\@@flflplaats}{\v!links}
-% {\copy4
-% \tfskip
-% \vbox to\ht4{\vfill\copy2\vfill}}
-% {\vbox to\ht4{\vfill\copy2\vfill}%
-% \tfskip
-% \copy4}},
-% \v!geen=>\locatefloat{\copy4}]}}%
-% % extended:
-% \postcenterfloatbox{\wd4}%
-% %\ifdim\wd4>\hsize
-% % \global\setbox\floatbox=
-% % \hbox to \ifbinnenkolommen\wd4\else\hsize\fi
-% % {\hss\box\floatbox\hss}%
-% %\fi
-% \egroup}
-
-% new
-
-\newbox\tempfloatbox
-\newbox\tempcaptionbox
-
-%\stelblokkopjesin[\c!breedte=5cm]
-%\stelblokkopjesin[\c!uitlijnen=\v!links]
-%\stelblokkopjesin[\c!uitlijnen=\v!rechts]
-
-\def\dosetpagfloat#1#2#3#4% \copy wegwerken
- {\bgroup
- \forgetall
- \postponefootnotes
- \mindermeldingen
- \putborderedfloat#4\in\tempfloatbox\\%
- \def\locatefloat%
- {\doregelplaats\@@flflplaats}%
- \ConvertToConstant\doifelse{#3}{\v!geen}
- {\dopreparenocaption{#1}{#2}{#3}{#4}
- \edef\width{\the\wd\floatbox}}
- {\setbox\tempcaptionbox=\hbox
- {\footnotesenabledfalse\putcompletecaption{#4}{#2}{#3}{0}}%
- \doifinsetelse{\@@kjkjplaats}{\v!hoog,\v!midden,\v!laag}
- {\dopreparesidecaption{#1}{#2}{#3}{#4}}
- {\doifelse{\@@kjkjbreedte}{\v!max}
- {\dopreparestackcaptionmax{#1}{#2}{#3}{#4}}
- {\ifdim\wd\tempcaptionbox>\wd\tempfloatbox % wider caption
- \doifelse{\@@kjkjbreedte}{\v!passend}
- {\dopreparestackcaptionaut{#1}{#2}{#3}{#4}}
- {\dopreparestackcaptionwid{#1}{#2}{#3}{#4}}%
- \else
- \dopreparestackcaptionmin{#1}{#2}{#3}{#4}%
- \fi}}
- \edef\width{\the\wd\tempfloatbox}%
- \buildfloatbox}%
- \postcenterfloatbox\width
- \egroup}
-
-\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}}}
-
-\def\dopreparestackcaptionmax#1#2#3#4%
- {\dosetraggedvbox{\@@kjkjuitlijnen}%
- \setbox\tempcaptionbox=\raggedbox
- {\hsize\wd\tempfloatbox
- \putcompletecaption{#4}{#2}{#3}{0}}}
-
-\def\captionminwidth {15\korpsgrootte}
-\def\captionovershoot {2em}
-
-\def\dopreparestackcaptionaut#1#2#3#4%
- {\doifsomething{\@@kjkjuitlijnen}
- {\ExpandBothAfter\doifnotinset{\v!midden}{\@@kjkjuitlijnen}
- {\let\captionovershoot\!!zeropoint}}%
- \ifdim\wd\tempfloatbox>\hsize
- % float is wider than \hsize
- \dosetraggedvbox\@@kjkjuitlijnen
- \setbox\scratchbox=\raggedbox % trial run
- {\hsize=\wd\tempfloatbox
- \footnotesenabledfalse
- \putcompletecaption{#4}{#2}{#3}{0}}%
- \ifdim\ht\scratchbox>\lineheight % more lines
- \dosetraggedvbox\@@kjkjuitlijnen
- \setbox\tempcaptionbox=\raggedbox
- {\hsize=\wd\tempfloatbox
- \advance\hsize -\captionovershoot\relax
- \ifdim\hsize<\captionminwidth\relax
- \hsize=\wd\tempfloatbox
- \fi
- \putcompletecaption{#4}{#2}{#3}{0}}%
- \else
- \setbox\tempcaptionbox=\raggedbox
- {\hsize=\wd\tempfloatbox
- \putcompletecaption{#4}{#2}{#3}{0}}%
- \fi
- \else
- % 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
- {\advance\scratchdimen \captionovershoot
- \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
- \dosetraggedvbox\@@kjkjuitlijnen
- \setbox\tempcaptionbox\raggedbox
- {\advance\scratchdimen \captionovershoot
- \ifdim\scratchdimen<\hsize \hsize=\scratchdimen \fi
- \putcompletecaption{#4}{#2}{#3}{0}}%
- \else
- % just over a line, don't use an overshoot
- \dosetraggedvbox\@@kjkjuitlijnen
- \setbox\tempcaptionbox=\raggedbox
- {\hsize\scratchdimen
- \putcompletecaption{#4}{#2}{#3}{0}}%
- \fi
- \fi}
-
-\def\dopreparestackcaptionwid#1#2#3#4%
- {\dosetraggedvbox\@@kjkjuitlijnen
- \setbox\tempcaptionbox=\raggedbox
- {\hsize\@@kjkjbreedte
- \putcompletecaption{#4}{#2}{#3}{0}}}
-
-\def\dopreparestackcaptionmin#1#2#3#4%
- {\raggedcenter % the default
- \dosetraggedvbox\@@kjkjuitlijnen % when given
- \setbox\tempcaptionbox=\raggedbox % vbox, keeps footnotes
- {\hsize\wd\tempfloatbox
- \putcompletecaption{#4}{#2}{#3}{0}}}
-
-\def\dopreparesidecaption#1#2#3#4%
- {\dimen0=\hsize
- \advance\dimen0 by -\wd\tempfloatbox
- \advance\dimen0 by -\@@bkmarge\relax % was \tfskipsize\relax
- \ifdim\wd\tempcaptionbox>\dimen0
- \dimen2=1.3\dimen0
- \ifdim\wd\tempcaptionbox<\dimen2
- \dimen0=0.8\dimen0
- \fi
- \fi
- \setbox\tempcaptionbox=\vbox
- {\hsize=\dimen0
- \raggedright
- \putcompletecaption{#4}{#2}{#3}{1}}}
-
-\def\buildfloatbox%
- {\global\setbox\floatbox=\vbox
- {\forgetall
- \processaction
- [\@@kjkjplaats]
- [ \v!boven=>\locatefloat{\box\tempcaptionbox}%
- \endgraf\@@kjkjtussen
- \locatefloat{\box\tempfloatbox},
- \v!onder=>\locatefloat{\box\tempfloatbox}%
- \endgraf\@@kjkjtussen
- \locatefloat{\box\tempcaptionbox},
- \v!hoog=>\locatefloat
- {\doifelse{\@@flflplaats}{\v!links}
- {\box\tempfloatbox
- \tfskip
- \vbox to\ht\tempfloatbox{\@@kjkjtussen\box\tempcaptionbox\vfill}}
- {\vbox to\ht\tempfloatbox{\@@kjkjtussen\box\tempcaptionbox\vfill}%
- \tfskip
- \box\tempfloatbox}},
- \v!laag=>\locatefloat
- {\doifelse{\@@flflplaats}{\v!links}
- {\box\tempfloatbox
- \tfskip
- \vbox to\ht\tempfloatbox
- {\vfill\box\tempcaptionbox\@@kjkjtussen}}
- {\vbox to\ht\tempfloatbox
- {\vfill\box\tempcaptionbox\@@kjkjtussen}%
- \tfskip
- \box\tempfloatbox}},
- \v!midden=>\locatefloat
- {\doifelse{\@@flflplaats}{\v!links}
- {\box\tempfloatbox
- \tfskip
- \vbox to\ht\tempfloatbox{\vfill\box\tempcaptionbox\vfill}}
- {\vbox to\ht\tempfloatbox{\vfill\box\tempcaptionbox\vfill}%
- \tfskip
- \box\tempfloatbox}},
- \v!geen=>\locatefloat{\box\tempfloatbox}]}}
-
-\newif\ifpostponecolumnfloats \postponecolumnfloatsfalse % don't change
-
-\def\postcenterfloatbox#1%
- {\ifbinnenkolommen
- \ifpostponecolumnfloats
- \scratchdimen=\makeupwidth
- \else
- \scratchdimen=#1\relax
- \fi
- \else\ifdim#1>\hsize
- \scratchdimen=\hsize
- \else
- \scratchdimen=\wd\floatbox
- \fi\fi
- \global\setbox\floatbox=\hbox to \scratchdimen
- {\hfill\box\floatbox\hfill}} % geen \hss, gaat mis in kolommen !
-
-\def\dosetparfloat#1#2#3#4%
- {\bgroup
- \forgetall
- \postponefootnotes
- \mindermeldingen
- %\showcomposition
- \putborderedfloat#4\in4\\
- \ConvertToConstant\doifelse{#3}{\v!geen}
- {\global\setbox\floatbox=\vbox{\box4}}
- {\setbox2=\hbox
- {\forgetall\putcompletecaption{#4}{#2}{#3}{0}}%
- \doifelse{\@@kjkjbreedte}{\v!max}
- {\dosetraggedvbox{\@@kjkjuitlijnen}%
- \setbox2=\raggedbox
- {\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}}%
- {\doifelse{\@@kjkjbreedte}{\v!passend}
- {\ifdim\wd2>\wd4\relax
- \setbox2=\vbox
- {\forgetall\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}%
- \else
- \setbox2=\hbox to \wd4
- {\hss\box2\hss}%
- \fi}
- {\dosetraggedvbox{\@@kjkjuitlijnen}%
- \setbox2=\raggedbox
- {\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}}}%
- \global\setbox\floatbox=\vbox
- {\processaction
- [\@@kjkjplaats]
- [ \v!boven=>\box2\endgraf\@@kjkjtussen\box4,
- \v!onder=>\box4\endgraf\@@kjkjtussen\box2,
- \v!geen=>\box4,
- \s!unknown=>\box4\endgraf\@@kjkjtussen\box2]}}%
- \egroup}
-
-\newif\ifparfloat
-
-\long\def\dosetfloatbox#1#2#3#4%
- {\ifvisible
- \par
- \doifcommonelse
- {#1}{\v!links,\v!rechts,\v!inlinker,\v!inrechter,\v!inmarge}
- {\global\parfloattrue}
- {\global\parfloatfalse}%
- \ifbinnenkolommen
- \global\parfloatfalse
- \fi
- \edef\@@kjkjbreedte {\getvalue{\??kj#4\c!breedte}}%
- \def \@@kjkjtussen {\getvalue{\??kj#4\c!tussen}}% geen \edef
- \edef\@@kjkjplaats {\getvalue{\??kj#4\c!plaats}}%
- \edef\@@kjkjuitlijnen{\getvalue{\??kj#4\c!uitlijnen}}%
- \edef\@@flflplaats {\getvalue{\??fl#4\c!plaats}}%
- \ifparfloat
- \dosetparfloat{#1}{#2}{#3}{#4}%
- \else
- \dosetpagfloat{#1}{#2}{#3}{#4}%
- \fi
- \setbox\floatbox=\hbox{\black\box\floatbox}%
- \global\floatheight=\ht\floatbox
- \global\advance\floatheight by \dp\floatbox
- \global\floatwidth=\wd\floatbox
- \global\advance\totalnoffloats by 1
- \doifnotinset{\v!marge}{#1} % gaat namelijk nog fout
- {\setbox\floatbox=\vbox
- {\parindent\!!zeropoint
- \ifvoorlopig
- \inleftmargin{\framed{\infofont\the\totalnoffloats}}%
- \fi
- \box\floatbox}}%
- \wd\floatbox=\floatwidth
- \dimen0=\floatheight
- \advance\dimen0 by \lineheight
- \ifdim\dimen0<\teksthoogte
- \else
- \global\floatheight=\teksthoogte
- \global\advance\floatheight by -\lineheight
- \ht\floatbox=\floatheight
- \dp\floatbox=\!!zeropoint
- \showmessage{\m!floatblocks}{10}{\the\totalnoffloats}%
- \fi
- \fi}
-
-\def\dogetfloatbox#1%
- {\ifvisible
- \let\next\relax % ivm eetex
- \processfirstactioninset
- [#1]
- [ \v!hier=>\def\next{\global\floatsonpagetrue\someelsefloat[#1]},
- \v!forceer=>\def\next{\global\floatsonpagetrue\somefixdfloat[#1]},
- \v!links=>\def\next{\global\floatsonpagetrue\somesidefloat[#1]\presetindentation},
- \v!rechts=>\def\next{\global\floatsonpagetrue\somesidefloat[#1]},
- \v!tekst=>\def\next{\global\floatsonpagetrue\sometextfloat[#1]},
- \v!boven=>\def\next{\someelsefloat[#1]\nonoindentation}, % !
- \v!onder=>\def\next{\global\floatsonpagetrue\someelsefloat[#1]},
- \v!marge=>\def\next{\somenextfloat[#1]\nonoindentation}, % !
- \v!pagina=>\def\next{\global\floatsonpagetrue\somepagefloat[#1]},
- \v!naast=>\def\next{\global\floatsonpagetrue\somefacefloat[#1]},
- \v!inmarge=>\def\next{\global\floatsonpagetrue\somesidefloat[#1]},
- \v!inlinker=>\def\next{\global\floatsonpagetrue\somesidefloat[#1]},
- \v!inrechter=>\def\next{\global\floatsonpagetrue\somesidefloat[#1]},
- \s!default=>\def\next{\global\floatsonpagetrue\someelsefloat[\v!hier,#1]},
- \s!unknown=>\def\next{\global\floatsonpagetrue\someelsefloat[\v!hier,#1]}]%
- \next
- \fi}
-
-\long\def\dofloat#1#2#3#4%
- {\dosetfloatbox{#1}{#2}{#3}{#4}%
- \dogetfloatbox{#1}}%
-
-\long\def\docompletefloat#1#2#3#4#5#6#7%
- {\flushsidefloats
- \calculatefloatskips
- \bgroup
- \global\setbox\floatbox=\vbox{#7}%
- \dimen0=\ht\floatbox
- \advance\dimen0 by \dp\floatbox
- \ifdim\dimen0=\!!zeropoint\relax
- \showmessage{\m!floatblocks}{11}{}%
- \global\setbox\floatbox=\vbox{\getvalue{\e!lege#3}}%
- \fi
- \ConvertToConstant\doifelse{#6}{\v!geen}
- {\global\setbox\floatbox=\vbox
- {\unvbox\floatbox
- \vss % gets rid of the depth
- \rawpagereference{\s!flt}{#2}}%
- \egroup\dofloat{#4}{}{#6}{#1}}
- {\doglobal\convertargument#6\to\asciititle % \asciititle is global
- \doifelsevalue{\??kj#1\c!nummer}{\v!ja}
- {\verhoognummer[#1]%
- \maakhetnummer[#1]%
- \global\setbox\floatbox=\vbox
- {\unvbox\floatbox % no \vss, keep the depth
- \dofloatreference
- \redofloatorder{#1}%
- \rawreference{\s!flt}{#2}{{\hetnummer}{\asciititle}}%
- \doschrijfnaarlijst{#3}{\hetnummer}{#6}{#3}}%
- \egroup\dofloat{#4}{\labeltexts{#5}{\hetnummer}}{#6}{#1}}
- {\global\setbox\floatbox=\vbox
- {\unvbox\floatbox % no \vss, keep the depth
- \rawreference{\s!flt}{#2}{{}{\asciititle}}}%
- \egroup\dofloat{#4}{}{#6}{#1}}}%
- \global\insidefloatfalse}
-
-\def\plaatsvolledig#1#2#3#4% kop, ref, tit, do
- {#1[#2]{#3}%
- #4%
- \pagina[\v!ja]}
-
-\definieernummer
- [\??si]
- [\c!wijze=\v!per\v!tekst,
- \c!conversie=\@@siconversie]
-
-\def\stelplaatsbloksplitsenin%
- {\dodoubleargument\getparameters[\??si]}
-
-% ook (continued)
-
-\def\dosplitsplaatsblok[#1]#2% nog dubbele refs
- {\ifbinnenkolommen % tzt ook nog figuren splitten
- % not yet supported
- \else
- \bgroup
- \insidefloattrue
- \getparameters[\??si][#1]%
- \resetnummer[\??si]%
- \def\floatcaptionsuffix{\nummer[\??si]}%
- \TABLEcaptionheight=\@@siregels\lineheight
-\def\docomplexpagina[##1]{\goodbreak}%
- \dowithnextbox
- {\forgetall
- \mindermeldingen
- \doloop
- {\setbox2\vsplit\nextbox to \lineheight
- \setbox2=\vbox{\unvbox2}
- \ifdim\ht2>\lineheight
- \verhoognummer[\??si]%
- \ifnum\ruwenummer[\??si]=1 \ifdim\ht\nextbox=\!!zeropoint
- \let\floatcaptionsuffix=\empty
- \fi\fi
- \bgroup
- #2{\unvbox2}
- \egroup
- \ifdim\ht\nextbox>\!!zeropoint
- \pagina
- \verlaagnummer[\floatcaptionnumber]%
- \fi
- \fi
- \ifdim\ht\nextbox>\!!zeropoint\else
- \expandafter\exitloop
- \fi}%
- \egroup}
- \vbox
- \fi}
-
-\def\splitsplaatsblok%
- {\dosingleempty\dosplitsplaatsblok}
-
-\newbox\facingbox
-\newbox\facingpage
-
-\newif\iffacingpages \facingpagesfalse
-
-\def\shipoutfacingpage%
- {\iffacingpages
- \ifnum\realpageno>1
- \bgroup
- \pagebodyornamentsfalse
- \setbox\facingpage=\vbox to \zethoogte
- {\unvbox\facingpage\vfil}%
- \myshipout{\buildpagebody\box\facingpage}%
- \egroup
- \else
- \global\setbox\facingpage=\box\voidb@x
- \fi
- \fi}
-
-\def\naastpagina%
- {\shipoutfacingpage}
-
-\def\facefloat% redefined
- {\startnaast\box\floatbox\stopnaast}
-
-\def\startnaast% beter: \dowithnextbox
- {\iffacingpages
- \global\setbox\facingbox=\vbox
- \bgroup
- \hsize=\zetbreedte
- \else
- \def\next{\gobbleuntil\stopnaast}%
- \expandafter\next
- \fi}
-
-\def\stopnaast%
- {\egroup
- \global\setbox\facingpage=\vbox
- {\ifvoid\facingpage
- \vskip\openstrutdepth % \dp\strutbox
- \else
- \unvbox\facingpage
- \fi
- \box\facingbox
- \blanko}}
-
-\def\dostelnaastplaatsenin[#1]%
- {\getparameters[\??np][#1]%
- \doifelse{\@@npstatus}{\v!start}
- {\global\facingpagestrue}
- {\global\facingpagesfalse}}
-
-\def\stelnaastplaatsenin%
- {\dosingleargument\dostelnaastplaatsenin}
-
-% Don't use \@@mawhatevercommand directly, use \getvalue instead.
-
-\newif\ifnewbackground
-\newif\ifsomebackground
-
-\newbox\leftbackground
-\newbox\rightbackground
-
-\def\ifsomebackgroundfound#1%
- {\edef\!!stringe{\??ma#1}%
- \doifelsevaluenothing{\!!stringe\c!achtergrond }
- {\doifelsevaluenothing{\!!stringe\c!voorgrondkleur}
- {\doifelsevalue{\!!stringe\c!kader }\v!aan\!!doneatrue
- {\doifelsevalue{\!!stringe\c!linkerkader }\v!aan\!!doneatrue
- {\doifelsevalue{\!!stringe\c!rechterkader}\v!aan\!!doneatrue
- {\doifelsevalue{\!!stringe\c!bovenkader }\v!aan\!!doneatrue
- {\doifelsevalue{\!!stringe\c!onderkader }\v!aan\!!doneatrue
- \!!doneafalse}}}}}
- \!!doneatrue}
- \!!doneatrue
- \if!!donea}
-
-\def\doaddpagebackground#1#2%
- {\ifsomebackgroundfound{#1}%
- \edef\setpagebackgrounddepth%
- {\dp#2=\the\dp#2}%
- \setbox#2=\vbox\localframed
- [\??ma#1]
- [\c!strut=\v!nee,\c!offset=\v!overlay,
- \c!breedte=\papierbreedte,\c!hoogte=\papierhoogte]
- {\dp#2=\!!zeropoint\box#2}%
- \setpagebackgrounddepth
- \fi}
-
-\def\addpagebackground#1%
- {\doifbothsidesoverruled
- \doaddpagebackground{\v!rechterpagina}{#1}%
- \orsideone
- \doaddpagebackground{\v!rechterpagina}{#1}%
- \orsidetwo
- \doaddpagebackground{\v!linkerpagina}{#1}%
- \od
- \doaddpagebackground{\v!pagina}{#1}}
-
-\let\pagebackgroundhoffset = \!!zeropoint
-\let\pagebackgroundvoffset = \!!zeropoint
-\let\pagebackgrounddepth = \!!zeropoint
-
-% #1 = breedte
-% #2 = hoogte
-% #3 = pos
-% #4 = pos
-
-%D Better (no zero dimension mp figs) and faster:
-
-\def\dododopagebodybackground#1#2#3#4%
- {\ifsomebackgroundfound{#3#4}%
- \ifdim#1>\!!zeropoint\relax
- \ifdim#2>\!!zeropoint\relax
- \localframed
- [\??ma#3#4]
- [\c!breedte=#1,\c!hoogte=#2,\c!offset=\v!overlay]
- {\getvalue{\??ma#3#4\c!commando}}% {\hsize=#1\vsize=#2....}
- \fi
- \fi
- \else
- \hskip#1%
- \fi}
-
-\def\dodopagebodybackground#1#2%
- {\setbox0=\vbox to #2
- \bgroup\hbox\bgroup
- \swapmargins
- \goleftonpage
- \dododopagebodybackground\linkerrandbreedte#2#1\v!linkerrand
- \hskip\linkerrandafstand
- %\hskip\pageseparation
- \dododopagebodybackground\linkermargebreedte#2#1\v!linkermarge
- \hskip\linkermargeafstand
- \dododopagebodybackground\zetbreedte#2#1\v!tekst
- \hskip\rechtermargeafstand
- \dododopagebodybackground\rechtermargebreedte#2#1\v!rechtermarge
- %\hskip\pageseparation
- \hskip\rechterrandafstand
- \dododopagebodybackground\rechterrandbreedte#2#1\v!rechterrand
- \egroup\egroup
- \wd0=\!!zeropoint\relax
- \box0\relax}
-
-\def\setbackgroundbox#1#2%
- {\global\setbox#1=\vbox
- {\offinterlineskip
- \mindermeldingen
- \calculatereducedvsizes
- #2\relax
- \vskip-\bovenhoogte
- \vskip-\bovenafstand
- \dodopagebodybackground\v!boven\bovenhoogte
- \vskip\bovenafstand
- \dodopagebodybackground\v!hoofd\hoofdhoogte
- \vskip\hoofdafstand
- \dodopagebodybackground\v!tekst\teksthoogte
- \vskip\voetafstand
- \dodopagebodybackground\v!voet\voethoogte
- \vskip\onderafstand
- \dodopagebodybackground\v!onder\onderhoogte
- \vfilll}%
- \smashbox#1}
-
-\def\setbackgroundboxes%
- {\ifsomebackground\ifnewbackground
- \showmessage{\m!layouts}{8}{}%
- \setbackgroundbox\leftbackground\relax
- \ifdubbelzijdig
- \setbackgroundbox\rightbackground\doswapmargins
- \fi
- %\global\newbackgroundfalse
- \doifnot{\@@mastatus}{\v!herhaal}{\global\newbackgroundfalse}%
- \doifelsevaluenothing{\??ma\v!tekst\v!tekst\c!achtergrond}
- {\global\let\pagebackgroundhoffset=\!!zeropoint
- \global\let\pagebackgroundvoffset=\!!zeropoint
- \global\let\pagebackgrounddepth =\!!zeropoint}
- {\bgroup
- \dimen0=\getvalue{\??ma\v!pagina\c!offset}%
- \doifnothing
- {\getvalue{\??ma\v!boven\v!tekst\c!achtergrond}%
- \getvalue{\??ma\v!onder\v!tekst\c!achtergrond}}
- {\xdef\pagebackgroundhoffset{\the\dimen0}}%
- \doifnothing
- {\getvalue{\??ma\v!tekst\v!rechterrand\c!achtergrond}%
- \getvalue{\??ma\v!tekst\v!linkerrand \c!achtergrond}}
- {\xdef\pagebackgroundvoffset{\the\dimen0}%
- \dimen0=\getvalue{\??ma\v!pagina\c!diepte}%
- \xdef\pagebackgrounddepth{\the\dimen0}}%
- \egroup}%
- \fi\fi}
-
-\def\getbackgroundbox%
- {\ifsomebackground
- \setbackgroundboxes
- \startinteractie
- \doifmarginswapelse
- {\copy\leftbackground}
- {\copy\rightbackground}%
- \stopinteractie
- \fi}
-
-% saves us hundreds of unused hash entries if not needed
-
-%\def\docheckbackgrounddefinitions% allocates about 1000 hash-entries
-% {\doifdefined{\??ma\v!pagina\c!achtergrond}% skip first pass
-% {\def\dodocommando##1##2%
-% {\copylocalframed[\??ma##1##2][\??ma\v!pagina]%
-% \getparameters[\??ma##1##2]
-% [\c!achtergrond=,\c!kader=,\c!kleur=,\c!raster=,
-% \c!onderkader=,\c!bovenkader=,\c!linkerkader=,\c!rechterkader=]%
-% \copyparameters
-% [\??ma##1##2\c!kader][\??ma##1##2]
-% [\c!kleur,\c!raster]%
-% \copyparameters
-% [\??ma##1##2\c!achtergrond][\??ma##1##2]
-% [\c!kleur,\c!raster]}%
-% \def\docommando##1%
-% {\dodocommando##1\v!linkerrand \dodocommando##1\v!linkermarge
-% \dodocommando##1\v!tekst
-% \dodocommando##1\v!rechtermarge \dodocommando##1\v!rechterrand}%
-% \docommando\v!boven \docommando\v!hoofd
-% \docommando\v!tekst
-% \docommando\v!voet \docommando\v!onder
-% \def\docheckbackgrounddefinitions%
-% {\global\somebackgroundtrue}}}
-
-\def\dostelachtergrondenin[#1][#2][#3]%
- {\ifthirdargument
- \global\somebackgroundtrue
- \def\docommando##1%
- {\doifinsetelse{##1}{\v!papier,\v!pagina,\v!linkerpagina,\v!rechterpagina}
- {\getparameters[\??ma##1][#3]%
- }%\dosetpageseparation}
- {\def\dodocommando####1%
- {\getparameters[\??ma##1####1][#3]}%
- \processcommalist[#2]\dodocommando}}%
- \processcommalist[#1]\docommando
- \else\ifsecondargument
- \global\somebackgroundtrue
- \doifcommonelse{#1}{\v!tekst,\v!papier,\v!pagina,\v!linkerpagina,\v!rechterpagina}
- {\def\docommando##1%
- {\getparameters[\??ma##1][#2]}%
- \processcommalist[#1]\docommando
- }%\dosetpageseparation}
- {\stelachtergrondenin
- [#1]%
- [\v!linkerrand,\v!linkermarge,\v!tekst,\v!rechtermarge,\v!rechterrand]%
- [#2]}%
- \else\iffirstargument
- \getparameters[\??ma][#1]%
- \fi\fi\fi
- \doifelse{\@@mastatus}{\v!stop}
- {\global\newbackgroundfalse}
- {\global\newbackgroundtrue}}
-
-\def\stelachtergrondenin%
- {\dotripleempty\dostelachtergrondenin}
-
-% a lot of setups, including short ones
-
-\presetlocalframed [\??ma\v!papier]
-\presetlocalframed [\??ma\v!pagina]
-\presetlocalframed [\??ma\v!linkerpagina]
-\presetlocalframed [\??ma\v!rechterpagina]
-
-\copyparameters
- [\??ma\v!papier\c!kader][\??ma\v!pagina]
- [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
-
-\copyparameters
- [\??ma\v!papier\c!achtergrond][\??ma\v!pagina]
- [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
-
-\copyparameters
- [\??ma\v!pagina\c!kader][\??ma\v!pagina]
- [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
-
-\copyparameters
- [\??ma\v!pagina\c!achtergrond][\??ma\v!pagina]
- [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
-
-\copyparameters
- [\??ma\v!linkerpagina\c!kader][\??ma\v!linkerpagina]
- [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
-
-\copyparameters
- [\??ma\v!linkerpagina\c!achtergrond][\??ma\v!linkerpagina]
- [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
-
-\copyparameters
- [\??ma\v!rechterpagina\c!kader][\??ma\v!rechterpagina]
- [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
-
-\copyparameters
- [\??ma\v!rechterpagina\c!achtergrond][\??ma\v!rechterpagina]
- [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
-
-\def\dodocommando#1#2%
- {\copylocalframed
- [\??ma#1#2][\??ma\v!pagina]%
- \getparameters
- [\??ma#1#2]
- [\c!achtergrond=,\c!kader=,\c!kleur=,\c!raster=\@@rsraster,
- \c!onderkader=,\c!bovenkader=,\c!linkerkader=,\c!rechterkader=]%
- \setvalue{\??ma#1#2\c!kleur}{\getvalue{\??ma\v!pagina\c!kleur }}%
- \setvalue{\??ma#1#2\c!raster}{\getvalue{\??ma\v!pagina\c!raster}}%
- \setvalue{\??ma#1#2\c!kaderkleur}{\getvalue{\??ma#1#2\c!kleur}}%
- \setvalue{\??ma#1#2\c!achtergrondkleur}{\getvalue{\??ma#1#2\c!kleur}}%
- \setvalue{\??ma#1#2\c!achtergrondraster}{\getvalue{\??ma#1#2\c!raster}}}
-
-\dodocommando\v!tekst\empty
-
-\def\docommando#1%
- {\dodocommando#1\v!linkerrand
- \dodocommando#1\v!linkermarge
- \dodocommando#1\v!tekst
- \dodocommando#1\v!rechtermarge
- \dodocommando#1\v!rechterrand}
-
-\docommando\v!boven
-\docommando\v!hoofd
-\docommando\v!tekst
-\docommando\v!voet
-\docommando\v!onder
-
-\let\dodocommando\relax \let\docommando\relax
-
-\def\currentproject {}
-\def\currentproduct {}
-\def\currentenvironment {}
-\def\currentcomponent {}
-
-\def\loadedfiles {}
-\def\processedfiles {}
-
-\let\geenfilesmeer=\relax
-
-\newcounter\textlevel
-\newcounter\fileprocesslevel
-
-\setvalue{\c!file::0}{\jobname}
-
-\def\processedfile% is used in styles, don't change !
- {\getvalue{\c!file::\fileprocesslevel}}
-
-%\def\processfile#1%
-% {\doglobal\increment\fileprocesslevel
-% \setxvalue{\c!file::\fileprocesslevel}{#1}%
-% \@EA\doglobal\@EA\addtocommalist\@EA{#1}\processedfiles
-% \readlocfile{#1}{}{}
-% \doglobal\decrement\fileprocesslevel}
-
-\def\processlocalfile#1#2%
- {\doglobal\increment\fileprocesslevel
- \setxvalue{\c!file::\fileprocesslevel}{#2}%
- \@EA\doglobal\@EA\addtocommalist\@EA{#2}\processedfiles
- #1{#2}{}{}% #1=\readlocfile|\readsetfile{dir} #2=filename
- \doglobal\decrement\fileprocesslevel}
-
-\def\processfile#1%
- {\relax
- \ifx\allinputpaths\empty
- \def\next{\processlocalfile\readlocfile}%
- \else
- \let\filepath\empty
- \def\docommando##1%
- {\doiffileelse{\pathplusfile{##1}{#1}}
- {\donetrue\def\filepath{##1}}
- {\donefalse}%
- \ifdone\expandafter\quitcommalist\fi}%
- \doifparentfileelse{#1} % new
- {\processcommacommand [\allinputpaths]\docommando}
- {\processcommacommand[.,\allinputpaths]\docommando}%
- \ifx\filepath\empty
- \def\next{\processlocalfile\readlocfile}% fall back ../../..
- \else
- \def\next{\processlocalfile{\readsetfile\filepath}}% file found
- \fi
- \fi
- \next{#1}}
-
-\let\allinputpaths\empty
-
-\def\usepath[#1]%
- {\def\docommando##1%
- {\doifelse{##1}{\v!reset}
- {\let\allinputpaths\empty}
- {\addtocommalist{##1}\allinputpaths}}%
- \processcommalist[#1]\docommando}
-
-\def\registreerfileinfo[#1#2]#3% geen \showmessage ?
- {\writestatus{\m!systems}{#1#2 file #3 at line \the\inputlineno}%
- \immediatewriteutility{f #1 {#3}}}
-
-\doifundefined{preloadfonts} {\let\preloadfonts=\relax}
-\doifundefined{preloadspecials} {\let\preloadspecials=\relax}
-
-\def\loadsystemfiles%
- {\readsysfile{\f!newfilename}
- {\showmessage{\m!systems}{2}{\f!newfilename}}{}%
- \readsysfile{\f!oldfilename}
- {\showmessage{\m!systems}{2}{\f!oldfilename}}{}%
- \readsysfile{\f!filfilename}
- {\showmessage{\m!systems}{2}{\f!filfilename}}{}%
- \readsysfile{\f!sysfilename}
- {\showmessage{\m!systems}{2}{\f!sysfilename}}{}}
-
-% test \@@svgebied
-
-\def\loadallsystemfiles#1%
- {\ifx\@@svgebied\empty
- \readsysfile{#1}{\showmessage{\m!systems}{2}{#1}}{}%
- \else
- \def\doloadsystemfile##1%
- {\readsetfile{##1}{#1}{\showmessage{\m!systems}{2}{#1}}{}}%
- \processcommacommand[\@@svgebied]\doloadsystemfile
- \fi}
-
-\def\loadsystemfiles%
- {\readsysfile{\f!newfilename}
- {\showmessage{\m!systems}{2}{\f!newfilename}}{}%
- \readsysfile{\f!oldfilename}
- {\showmessage{\m!systems}{2}{\f!oldfilename}}{}%
- \loadallsystemfiles\f!filfilename
- \loadallsystemfiles\f!sysfilename}
-
-%D Loading of \type {cont-usr.tex} (edited by the user)
-%D and \type {cont-fmt.tex} (generated by texexec).
-
-\def\loaduserspecifications
- {\readsysfile{\f!usrfilename}
- {\showmessage{\m!systems}{2}{\f!usrfilename}}{}%
- \readjobfile{\f!fmtfilename}
- {\showmessage{\m!systems}{2}{\f!fmtfilename}}{}}
-
-%D We don't want multiple jobfiles to interfere.
-
-\bgroup
-\catcode`\%=\@@other
-\xdef\texcommentsymbol{%}
-\egroup
-
-\def\loadoptionfile%
- {\readjobfile{\jobname.\f!optionextension}
- {\showmessage{\m!systems}{2}{\jobname.\f!optionextension}}%
- {}}
-
-% \newevery \everyjob \EveryJob
-% \appendtoks ... \to \everyjob
-
-\prependtoks \showcontextbanner \to \everyjob
-
-\appendtoks \loadsystemfiles \to \everyjob
-\appendtoks \preloadfonts \to \everyjob
-\appendtoks \settopskip \to \everyjob
-\appendtoks \preloadlanguages \to \everyjob
-\appendtoks \preloadspecials \to \everyjob
-\appendtoks \openspecialfile \to \everyjob
-%appendtoks \checkutilityfile \to \everyjob % obsolete
-\appendtoks \openutilities \to \everyjob
-\appendtoks \loadoptionfile \to \everyjob
-\appendtoks \loadtwopassdata \to \everyjob
-\appendtoks \setupfootnotes \to \everyjob % depends on bodyfont
-\appendtoks \initializeMPgraphics \to \everyjob % after loading system files
-
-\appendtoks \pagina[\v!laatste] \pagina \to \everybye
-\appendtoks \ifarrangingpages\poparrangedpages\fi \to \everybye
-\appendtoks \registreerfileinfo[end]{\jobname} \to \everybye
-
-\appendtoks \savenofpages \to \everybye
-\appendtoks \savenofsubpages \to \everybye
-
-\appendtoks \closeutilities \to \everygoodbye
-\appendtoks \stopcopyingblocks \to \everygoodbye
-\appendtoks \closespecialfile \to \everygoodbye
-
-\appendtoks \checkreferences \to \everystarttext % nieuw 4-12-1999
-
-\def\doateverystarttext%
- {\the\everystarttext
- \global\let\doateverystarttext\relax}
-
-\def\starttekst%
- {\doateverystarttext
- \ifnum\textlevel=0\relax
- \registreerfileinfo[begin]{\jobname}%
- \startcopyingblocks
- \fi
- \doglobal\increment\textlevel\relax}
-
-\def\stoptekst%
- {\doglobal\decrement\textlevel\relax
- \ifnum\textlevel>0 \else
- \the\everystoptext
- %\the\everybye %
- %\the\everygoodbye % == \end (new)
- %\expandafter\normalend %
- \expandafter\end
- \fi}
-
-\let\normalend=\end
-
-\def\end%
- {\ifnum\textlevel>0 \else
- \the\everybye
- \the\everygoodbye
- \global\everygoodbye\emptytoks % rather unneeded
- \global\everybye\emptytoks % but for sure
- \expandafter\normalend
- \fi}
-
-\def\doexecutefileonce#1%
- {\beforesplitstring#1\at.\to\currentfile
- \ExpandBothAfter\doifnotinset{\currentfile}{\loadedfiles}%
- {\ExpandFirstAfter\addtocommalist{\currentfile}\loadedfiles
- \doexecutefile{#1}}}
-
-\def\doexecutefile#1%
- {\registreerfileinfo[begin]{#1}
- \processfile{#1}%
- \registreerfileinfo[end]{#1}}
-
-\def\donotexecutefile#1%
- {}
-
-\def\verwerkfile#1 %
- {\doexecutefile{#1}}
-
-\def\omgeving #1 % at outermost level only
- {\def\startomgeving ##1 {}%
- \let\stopomgeving=\relax
- \startreadingfile
- \processfile{#1}% \readlocfile{#1}{}{}%
- \stopreadingfile}
-
-\newcounter\filelevel
-
-\def\!!donextlevel#1#2#3#4#5#6\\%
- {\beforesplitstring#6\at.\to#1
- \ifnum\filelevel=0\relax
- \starttekst
- \def\projekt ##1 {#2{##1}}%
- \def\omgeving ##1 {#3{##1}}%
- \def\produkt ##1 {#4{##1}}%
- \def\onderdeel ##1 {#5{##1}}%
- \fi
- \increment\filelevel\relax
- \ExpandFirstAfter\addtocommalist{#1}\loadedfiles}
-
-\def\doprevlevel%
- {\ifnum\filelevel=1
- \expandafter\stoptekst
- \else
- \decrement\filelevel\relax
- \expandafter\endinput
- \fi}
-
-\def\startprojekt #1 %
- {\!!donextlevel\currentproject
- \donotexecutefile\doexecutefileonce
- \doexecutefileonce\doexecutefile#1\\}
-
-\def\stopprojekt%
- {\doprevlevel}
-
-\def\startprodukt #1 %
- {\doateverystarttext
- \!!donextlevel\currentproduct
- \doexecutefileonce\doexecutefileonce
- \donotexecutefile\doexecutefile#1\\}
-
-\def\stopprodukt%
- {\doprevlevel}
-
-\def\startonderdeel #1 %
- {\doateverystarttext
- \!!donextlevel\currentcomponent
- \doexecutefileonce\doexecutefileonce
- \donotexecutefile\doexecutefile#1\\}
-
-\def\stoponderdeel%
- {\doprevlevel}
-
-\def\startomgeving #1 %
- {\!!donextlevel\currentenvironment
- \donotexecutefile\doexecutefileonce
- \donotexecutefile\donotexecutefile#1\\}
-
-\def\stopomgeving%
- {\doprevlevel}
-
-\long\def\skipdeelomgeving#1\stopdeelomgeving%
- {}
-
-\def\startdeelomgeving[#1]%
- {\def\partialenvironments{}%
- \def\docommando##1%
- {\beforesplitstring##1\at.\to\someevironment
- \ExpandFirstAfter\addtocommalist{\someevironment}\partialenvironments}%
- \processcommalist[#1]\docommando
- \ExpandBothAfter\doifcommonelse
- {\currentproject,\currentproduct,
- \currentcomponent,\currentenvironment}
- {\partialenvironments}
- {\let\stopdeelomgeving=\relax
- \let\next=\relax}
- {\let\next=\skipdeelomgeving}%
- \next}
-
-\def\startproduct{\startprodukt}
-\def\stopproduct {\stopprodukt}
-\def\startproject{\startprojekt}
-\def\stopproject {\stopprojekt}
-
-\def\project{\projekt}
-\def\product{\produkt}
-
-\def\deelomgeving #1 %
- {\doexecutefileonce{#1}}
-
-\expanded
- {\long\noexpand\def\csname\e!start\e!instellingen\endcsname##1 ##2\csname\e!stop\e!instellingen\endcsname%
- {\noexpand\long\noexpand\setvalue{\??su##1}{##2}}}
-
-\long\def\startsetups#1 #2\stopsetups% for international purposes
- {\long\setvalue{\??su#1}{#2}}
-
-\def\dodosetups#1%
- {\getvalue{\??su#1}}
-
-\def\dosetups[#1]%
- {\iffirstargument
- \dodosetups{#1}%
- \else
- \expandafter\dodosetups
- \fi}
-
-\def\setups%
- {\dosingleargument\dosetups}
-
-\newif\ifvoorlopig
-\voorlopigfalse
-
-\newif\ifconcept
-\conceptfalse
-
-\edef\utilityversion{1998.07.07} % was: 1996.03.15 % status variables
-\edef\utilityversion{1998.12.20} % was: 1998.07.07 % index attributes
-
-\def\doplaatsversieaanduiding#1#2%
- {\doifsomething{#2}
- {\@EA\convertargument#2\to\ascii
- \ #1: \ascii\
- \!!doneatrue}}
-
-\def\plaatsversieaanduiding% nog engels maken
- {\ifvoorlopig
- \vskip\!!sixpoint
- \hbox to \zetbreedte
- {\infofont
- \getmessage\m!systems{27}: \currentdate\
- \doplaatsversieaanduiding{Project}\currentproject
- \doplaatsversieaanduiding{Produkt}\currentproduct
- \doplaatsversieaanduiding{Onderdeel}\currentcomponent
- \if!!donea\else\ File: \jobname\fi
- \hss\reportpagedimensions}%
- \fi
- \ifconcept
- \vskip\!!sixpoint
- \hbox to \zetbreedte
- {\infofont
- Concept: \currentdate
- \hss\reportpagedimensions}%
- \fi}
-
-% tot hier
-
-\def\doversie[#1]%
- {\voorlopigfalse
- \conceptfalse
- \overfullrule=\!!zeropoint
- \processaction
- [#1]
- [\v!voorlopig=>\voorlopigtrue
- \overfullrule=5pt,
- \v!concept=>\concepttrue]}
-
-\def\versie%
- {\dosingleargument\doversie}
-
-% this will be inserts some day
-
-\newbox\referentieinfobox
-\newbox\registerinfobox
-\newbox\floatinfobox
-
-\def\dotestinfo#1#2#3%
- {\ifvoorlopig\ifinpagebody\else
- \begingroup
- \convertargument#3\to\ascii
- \xdef\extratestinfo%
- {#2 \ascii}%
- \gdef\totaltestinfo%
- {\global\setbox#1=\vbox
- {\unvbox#1\relax
- \hbox
- {\infofont
- \strut
- \expandafter\doboundtext\expandafter
- {\extratestinfo}
- {12em}
- {..}%
- \quad}}}%
- \endgroup
- \ifinner
- \aftergroup\totaltestinfo
- \else
- \totaltestinfo
- \fi
- \fi\fi}
-
-\def\referentieinfo%
- {\dotestinfo\referentieinfobox}
-
-\def\registerinfo%
- {\dotestinfo\registerinfobox}
-
-\def\floatinfo%
- {\dotestinfo\floatinfobox}
-
-\def\plaatstestinfo%
- {\setbox0=\vbox to \teksthoogte
- {\forgetall
- \infofont
- \hsize10em
- \ifvoid\floatinfobox\else
- \strut \getmessage\m!systems{24}
- \vskip\!!sixpoint
- \unvbox\floatinfobox
- \vskip\!!twelvepoint
- \fi
- \ifvoid\referentieinfobox\else
- \strut \getmessage\m!systems{25}
- \vskip\!!sixpoint
- \unvbox\referentieinfobox
- \vskip\!!twelvepoint
- \fi
- \ifvoid\registerinfobox\else
- \strut \getmessage\m!systems{26}
- \vskip\!!sixpoint
- \unvbox\registerinfobox
- \fi
- \vss}%
- \wd0=\!!zeropoint
- \box0\relax}
-
-% \docommando kan niet worden gebruikt omdat deze macro
-% soms lokaal wordt gebruikt
-
-% te zijner tijd:
-%
-% \definevariable {pc} % ProtectedCommand
-%
-% \def\executeprotected#1%
-% {\csname\??pc\string#1\endcsname}
-%
-% \def\defineprotected#1#2%
-% {\expandafter\def\csname\??pc\string#2\endcsname}
-%
-% \def\defineunprotected#1%
-% {\def#1}
-%
-% \def\doprotected%
-% {\ifx\next\define
-% \let\next=\defineprotected
-% \else
-% \let\next=\executeprotected
-% \fi
-% \next}
-%
-% \def\unexpanded%
-% {\futurelet\next\doprotected}
-%
-% \unexpanded\define\ziezo{ziezo}
-%
-% \unexpanded\ziezo
-
-\def\complexdefinieer[#1]#2#3%
- {\ifx#2\undefined
- \else
- \showmessage{\m!systems}{4}{\string#2}%
- \fi
- \ifcase0#1\def#2{#3}%
- \or\def#2##1{#3}%
- \or\def#2##1##2{#3}%
- \or\def#2##1##2##3{#3}%
- \or\def#2##1##2##3##4{#3}%
- \or\def#2##1##2##3##4##5{#3}%
- \or\def#2##1##2##3##4##5##6{#3}%
- \or\def#2##1##2##3##4##5##6##7{#3}%
- \or\def#2##1##2##3##4##5##6##7##8{#3}%
- \or\def#2##1##2##3##4##5##6##7##8##9{#3}%
- \else\def#2{#3}%
- \fi}
-
-\definecomplexorsimpleempty\definieer
-
-\unexpanded\def\naam#1%
- {\getvalue{#1}}
-
-\def\gebruikcommandos#1%
- {\bgroup
- \def\docommando##1%
- {\setbox0=\hbox{\getvalue{\string##1}##1}}%
- \processcommalist[#1]\docommando
- \egroup}
-
-\def\complexstart[#1]{\bgroup\getvalue{\e!start#1}}
-\def\complexstop [#1]{\getvalue{\e!stop #1}\egroup}
-
-\def\simplestart{\bgroup}
-\def\simplestop {\egroup}
-
-\definecomplexorsimple\start
-\definecomplexorsimple\stop
-
-\def\dodefinieerstartstop[#1][#2]%
- {\getparameters
- [\??be#1]
- [\c!voor=,
- \c!na=,
- \c!commandos=,
- \c!letter=,
- #2]%
-% \setvalue{\e!stel#1\e!in}[##1]%
-% {\dodoubleargument\getparameters[\??be##1]}%
- \unexpanded\setvalue{#1}%
- {\groupedcommand
- {\getvalue{\??be#1\c!commandos}%
- \dostartattributes{\??be#1}\c!letter\c!kleur}
- {\dostopattributes}}%
- \setvalue{\e!start#1}%
- {\getvalue{\??be#1\c!voor}%
- \bgroup
- \getvalue{\??be#1\c!commandos}%
- \dostartattributes{\??be#1}\c!letter\c!kleur{}}%
- \setvalue{\e!stop#1}%
- {\dostopattributes
- \egroup
- \getvalue{\??be#1\c!na}}}
-
-\def\definieerstartstop%
- {\dodoubleargument\dodefinieerstartstop}
-
-\def\stelstartstopin[#1]%
- {\dodoubleargument\getparameters[\??be#1]}
-
-% gejat van Knuth (zie \copyright, p356)
-
-\def\omcirkeld#1%
- {{\ooalign{\hfil\raise0.07ex\hbox{{\tfx#1}}\hfil\crcr\mathhexbox20D}}}
-
-\def\copyright
- {\omcirkeld{c}}
-
-\def\dosetupsystem[#1]%
- {\getparameters[\??sv][#1]%
- \setuprandomize[\@@svwillekeur]%
- \beforesplitstring\@@svresolutie\at dpi\to\@@svresolutie
- \let\outputresolution=\@@svresolutie}
-
-\def\setupsystem%
- {\dosingleargument\dosetupsystem}
-
-\def\setuprandomize[#1]%
- {\doifsomething{#1}
- {\bgroup
- \setrandomseed{-1}%
- \processaction
- [#1]
- [ \v!klein=>\divide\time 900, % 15 taco vragen hoe
- \v!middel=>\divide\time 1800, % 30 time werkt; nodig voor
- \v!groot=>\divide\time 3600, % 60 random pos deadlock
- \v!normaal=>,
- \s!default=>,
- \s!unknown=>\time=#1]%
- \nextrandom
- \egroup}}
-
-\def\outputfilename{\@@svfile}
-
-% Default-instellingen (verborgen)
-
-\resetutilities
-
-% Uitgestelde instellingen
-
-\def\dooutput{\sidefloatoutput} % redefinition of \dooutput
-
-% Default-instellingen (zichtbaar)
-
-\setupsystem
- [\c!gebied=,
- \c!resolutie=600dpi,
- \c!willekeur=,
- \c!file=\jobname,
- \c!korps=\normalizedlocalbodyfontsize] % of iets anders
-
-% Pas op:
-%
-% Omdat er geen fonts geladen zijn kunnen we bij de maten geen
-% em's gebruiken. Bij afstanden is dit geen probleem, omdat
-% deze pas een rol spelen als er al een font geladen is.
-
-\stellayoutin
- [ \c!kopwit=.08417508418\papierhoogte, % .08333 2.5cm
- \c!boven=\!!zeropoint,
- \c!bovenafstand=\!!zeropoint,
- \c!hoofd=.06734006734\papierhoogte, % .06667 2.0cm
- \c!hoofdafstand=\!!zeropoint,
- \c!hoogte=.84175084175\papierhoogte, % .83333 25.0cm
- \c!voetafstand=\@@lyhoofdafstand,
- \c!voet=.06734006734\papierhoogte, % .06667 2.0cm
- \c!onderafstand=\@@lybovenafstand,
- \c!onder=\!!zeropoint,
- \c!rugwit=.11904761905\papierbreedte, % 2.5cm
- \c!rand=\!!zeropoint,
- \c!randafstand=\@@lymargeafstand,
- \c!marge=.12649983170\papierbreedte, % snijwit-2*afstand
- \c!margeafstand=.02008341748\papierbreedte, % 12.0pt
- \c!linkerrand=\@@lyrand,
- \c!linkerrandafstand=\@@lyrandafstand,
- \c!linkermarge=\@@lymarge,
- \c!linkermargeafstand=\@@lymargeafstand,
- \c!breedte=.71428571429\papierbreedte, % 15.0cm
- \c!rechtermargeafstand=\@@lymargeafstand,
- \c!rechtermarge=\@@lymarge,
- \c!rechterrandafstand=\@@lyrandafstand,
- \c!rechterrand=\@@lyrand,
- \c!kopoffset=\!!zeropoint,
- \c!rugoffset=\!!zeropoint,
- \c!tekstbreedte=, % dangerous here \tekstbreedte
- \c!letter=,
- \c!markering=\v!uit,
- \c!plaats=, % \v!enkelzijdig, but empty is signal
- \c!schaal=1,
- \c!nx=1,
- \c!ny=1,
- \c!dx=\!!zeropoint,
- \c!dy=\!!zeropoint,
- \c!grid=\v!nee,
- \c!regels=,
- \c!snijwit=\!!zeropoint,
- \c!bodemwit=\!!zeropoint]
-
-% instellingen hierop terugvallen, bijvoorbeeld de volgende:
-
-\definieerpapierformaat [A0] [\c!breedte=841mm, \c!hoogte=1189mm]
-\definieerpapierformaat [A1] [\c!breedte=594mm, \c!hoogte=841mm]
-\definieerpapierformaat [A2] [\c!breedte=420mm, \c!hoogte=594mm]
-\definieerpapierformaat [A3] [\c!breedte=297mm, \c!hoogte=420mm]
-\definieerpapierformaat [A4] [\c!breedte=210mm, \c!hoogte=297mm]
-\definieerpapierformaat [A5] [\c!breedte=148mm, \c!hoogte=210mm]
-\definieerpapierformaat [A6] [\c!breedte=105mm, \c!hoogte=148mm]
-\definieerpapierformaat [A7] [\c!breedte=74mm, \c!hoogte=105mm]
-\definieerpapierformaat [A8] [\c!breedte=52mm, \c!hoogte=74mm]
-\definieerpapierformaat [A9] [\c!breedte=37mm, \c!hoogte=52mm]
-
-\definieerpapierformaat [B0] [\c!breedte=1000mm,\c!hoogte=1414mm]
-\definieerpapierformaat [B1] [\c!breedte=707mm, \c!hoogte=1000mm]
-\definieerpapierformaat [B2] [\c!breedte=500mm, \c!hoogte=707mm]
-\definieerpapierformaat [B3] [\c!breedte=354mm, \c!hoogte=500mm]
-\definieerpapierformaat [B4] [\c!breedte=250mm, \c!hoogte=354mm]
-\definieerpapierformaat [B5] [\c!breedte=177mm, \c!hoogte=250mm]
-\definieerpapierformaat [B6] [\c!breedte=125mm, \c!hoogte=177mm]
-\definieerpapierformaat [B7] [\c!breedte=88mm, \c!hoogte=125mm]
-\definieerpapierformaat [B8] [\c!breedte=63mm, \c!hoogte=88mm]
-\definieerpapierformaat [B9] [\c!breedte=44mm, \c!hoogte=63mm]
-
-\definieerpapierformaat [C0] [\c!breedte=917mm, \c!hoogte=1297mm]
-\definieerpapierformaat [C1] [\c!breedte=649mm, \c!hoogte=917mm]
-\definieerpapierformaat [C2] [\c!breedte=459mm, \c!hoogte=649mm]
-\definieerpapierformaat [C3] [\c!breedte=324mm, \c!hoogte=459mm]
-\definieerpapierformaat [C4] [\c!breedte=229mm, \c!hoogte=324mm]
-\definieerpapierformaat [C5] [\c!breedte=162mm, \c!hoogte=229mm]
-\definieerpapierformaat [C6] [\c!breedte=115mm, \c!hoogte=162mm]
-\definieerpapierformaat [C7] [\c!breedte=81mm, \c!hoogte=115mm]
-\definieerpapierformaat [C8] [\c!breedte=57mm, \c!hoogte=81mm]
-\definieerpapierformaat [C9] [\c!breedte=40mm, \c!hoogte=57mm]
-
-\definieerpapierformaat [S3] [\c!breedte=300pt, \c!hoogte=225pt]
-\definieerpapierformaat [S4] [\c!breedte=400pt, \c!hoogte=300pt]
-\definieerpapierformaat [S5] [\c!breedte=500pt, \c!hoogte=375pt]
-\definieerpapierformaat [S6] [\c!breedte=600pt, \c!hoogte=450pt]
-
-\definieerpapierformaat [CD] [\c!breedte=120mm, \c!hoogte=120mm]
-
-\definieerpapierformaat [letter] [\c!breedte=8.5in, \c!hoogte=11in]
-\definieerpapierformaat [2*letter] [\c!breedte=11in, \c!hoogte=17in]
-\definieerpapierformaat [legal] [\c!breedte=8.5in, \c!hoogte=14in]
-\definieerpapierformaat [folio] [\c!breedte=8.5in, \c!hoogte=13in]
-\definieerpapierformaat [executive] [\c!breedte=7.25in, \c!hoogte=10.5in]
-
-\definieerpapierformaat [envelope 9] [\c!breedte=8.88in, \c!hoogte=3.88in]
-\definieerpapierformaat [envelope 10] [\c!breedte=9.5in, \c!hoogte=4.13in]
-\definieerpapierformaat [envelope 11] [\c!breedte=10.38in,\c!hoogte=4.5in]
-\definieerpapierformaat [envelope 12] [\c!breedte=11.0in, \c!hoogte=4.75in]
-\definieerpapierformaat [envelope 14] [\c!breedte=11.5in, \c!hoogte=5.0in]
-\definieerpapierformaat [monarch] [\c!breedte=7.5in, \c!hoogte=3.88in]
-\definieerpapierformaat [check] [\c!breedte=8.58in, \c!hoogte=3.88in]
-\definieerpapierformaat [DL] [\c!breedte=220mm, \c!hoogte=110mm]
-
-% Let op: na \stellayoutin (omdat dit wordt aangeroepen).
-
-\stelpapierformaatin
- [A4][A4]
-
-\stelpapierformaatin
- [\c!boven=,
- \c!onder=\vss,
- \c!links=,
- \c!rechts=\hss]
-
-\stelkolommenin
- [\c!n=2,
- \c!nboven=1,
- \c!commando=,
- \c!richting=\v!rechts,
- \c!lijn=\v!uit,
- \c!tolerantie=\v!soepel,
- \c!afstand=1.5\korpsgrootte, % influenced by switching
- \c!hoogte=,
- \c!balanceren=\v!ja,
- \c!uitlijnen=\v!tekst,
- \c!blanko={\v!regel,\v!vast},
- \c!optie=,
- \c!lijndikte=\linewidth,
- \c!offset=.5\korpsgrootte]
-
-\stelhoofdtekstenin [\v!tekst] [] []
-\stelhoofdtekstenin [\v!marge] [] []
-\stelhoofdtekstenin [\v!rand] [] []
-
-\stelvoettekstenin [\v!tekst] [] []
-\stelvoettekstenin [\v!marge] [] []
-\stelvoettekstenin [\v!rand] [] []
-
-\stelteksttekstenin [\v!tekst] [] []
-\stelteksttekstenin [\v!marge] [] []
-\stelteksttekstenin [\v!rand] [] []
-
-\stelondertekstenin [\v!tekst] [] []
-\stelondertekstenin [\v!marge] [] []
-\stelondertekstenin [\v!rand] [] []
-
-\stelboventekstenin [\v!tekst] [] []
-\stelboventekstenin [\v!marge] [] []
-\stelboventekstenin [\v!rand] [] []
-
-\stelhoofdin [\c!status=\v!normaal,\c!voor=,\c!na=]
-\stelvoetin [\c!status=\v!normaal,\c!voor=,\c!na=]
-\steltekstin [\c!status=\v!normaal,\c!voor=,\c!na=]
-\stelbovenin [\c!status=\v!normaal,\c!voor=,\c!na=]
-\stelonderin [\c!status=\v!normaal,\c!voor=,\c!na=]
-
-\stelhoofdin [\c!na=\vss]
-\steltekstin [\c!voor=\vss,\c!na=\vss]
-\stelvoetin [\c!voor=\vss]
-
-\stelbovenin [\c!voor=\vss,\c!na=\vss]
-\stelonderin [\c!voor=\vss,\c!na=\vss]
-
-\stelhoofdin % \get??tk#1#2#3 would save quite some 3K in fmt size
- [\v!tekst]
- [\c!strut=\v!ja,
- \c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!hoofd\v!tekst\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!hoofd\v!tekst\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!hoofd\v!tekst\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!hoofd\v!tekst\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!hoofd\v!tekst\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!hoofd\v!tekst\c!breedte}]
-
-\stelhoofdin
- [\v!marge]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!hoofd\v!marge\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!hoofd\v!marge\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!hoofd\v!marge\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!hoofd\v!marge\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!hoofd\v!marge\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!hoofd\v!marge\c!breedte}]
-
-\stelhoofdin
- [\v!rand]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!hoofd\v!rand\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!hoofd\v!rand\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!hoofd\v!rand\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!hoofd\v!rand\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!hoofd\v!rand\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!hoofd\v!rand\c!breedte}]
-
-\stelvoetin
- [\v!tekst]
- [\c!strut=\v!ja,
- \c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!voet\v!tekst\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!voet\v!tekst\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!voet\v!tekst\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!voet\v!tekst\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!voet\v!tekst\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!voet\v!tekst\c!breedte}]
-
-\stelvoetin
- [\v!marge]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!voet\v!marge\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!voet\v!marge\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!voet\v!marge\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!voet\v!marge\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!voet\v!marge\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!voet\v!marge\c!breedte}]
-
-\stelvoetin
- [\v!rand]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!voet\v!rand\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!voet\v!rand\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!voet\v!rand\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!voet\v!rand\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!voet\v!rand\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!voet\v!rand\c!breedte}]
-
-\stelbovenin
- [\v!tekst]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!boven\v!tekst\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!boven\v!tekst\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!boven\v!tekst\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!boven\v!tekst\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!boven\v!tekst\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!boven\v!tekst\c!breedte}]
-
-\stelbovenin
- [\v!marge]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!boven\v!marge\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!boven\v!marge\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!boven\v!marge\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!boven\v!marge\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!boven\v!marge\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!boven\v!marge\c!breedte}]
-
-\stelbovenin
- [\v!rand]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!boven\v!rand\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!boven\v!rand\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!boven\v!rand\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!boven\v!rand\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!boven\v!rand\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!boven\v!rand\c!breedte}]
-
-\stelonderin
- [\v!tekst]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!onder\v!rand\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!onder\v!rand\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!onder\v!rand\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!onder\v!rand\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!onder\v!rand\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!onder\v!rand\c!breedte}]
-
-\stelonderin
- [\v!marge]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!onder\v!marge\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!onder\v!marge\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!onder\v!marge\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!onder\v!marge\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!onder\v!marge\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!onder\v!marge\c!breedte}]
-
-\stelonderin
- [\v!rand]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!onder\v!rand\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!onder\v!rand\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!onder\v!rand\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!onder\v!rand\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!onder\v!rand\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!onder\v!rand\c!breedte}]
-
-\steltekstin
- [\v!tekst]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!tekst\v!tekst\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!tekst\v!tekst\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!tekst\v!tekst\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!tekst\v!tekst\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!tekst\v!tekst\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!tekst\v!tekst\c!breedte}]
-
-\steltekstin
- [\v!marge]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!tekst\v!marge\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!tekst\v!marge\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!tekst\v!marge\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!tekst\v!marge\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!tekst\v!marge\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!tekst\v!marge\c!breedte}]
-
-\steltekstin
- [\v!rand]
- [\c!letter=,
- \c!kleur=,
- \c!linkertekst=,
- \c!middentekst=,
- \c!rechtertekst=,
- \c!kantlijntekst=,
- \c!margetekst=,
- \c!linkerletter=\getvalue{\??tk\v!tekst\v!rand\c!letter},
- \c!rechterletter=\getvalue{\??tk\v!tekst\v!rand\c!letter},
- \c!linkerkleur=\getvalue{\??tk\v!tekst\v!rand\c!kleur},
- \c!rechterkleur=\getvalue{\??tk\v!tekst\v!rand\c!kleur},
- \c!breedte=,
- \c!linkerbreedte=\getvalue{\??tk\v!tekst\v!rand\c!breedte},
- \c!rechterbreedte=\getvalue{\??tk\v!tekst\v!rand\c!breedte}]
-
-\stelblokkopjesin
- [\c!plaats=\v!onder,
- \c!voor=\blanko,
- \c!tussen={\blanko[\v!middel]},
- \c!na=\blanko,
- \c!breedte=\v!passend,
- \c!kopletter=\v!vet,
- \c!letter=\v!normaal,
- \c!kleur=,
- \c!uitlijnen=,
- \c!nummer=\v!ja,
- \c!wijze=\@@nrwijze,
- \c!blokwijze=\@@nrblokwijze,
- \c!sectienummer=\@@nrsectienummer,
- \c!conversie=\v!cijfers]
-
-\stelplaatsblokkenin
- [\c!plaats=\v!midden,
- \c!breedte=\v!passend,
- \c!hoogte=\v!passend,
- \c!offset=\v!overlay,
- \c!kader=\v!uit,
- \c!straal=.5\korpsgrootte,
- \c!hoek=\v!recht,
- \c!achtergrond=,
- \c!achtergrondraster=\@@rsraster,
- \c!achtergrondkleur=,
- \c!achtergrondoffset=\!!zeropoint,
- \c!bovenkader=,
- \c!onderkader=,
- \c!linkerkader=,
- \c!rechterkader=,
- \c!kaderoffset=\!!zeropoint,
- \c!voor=,
- \c!na=,
- \c!voorwit=\v!groot,
- \c!nawit=\v!groot,
- \c!zijvoorwit=\@@bkvoorwit,
- \c!zijnawit=\@@bknawit,
- \c!springvolgendein=\v!nee,
- \c!marge=1em,
- \c!nboven=2,
- \c!nonder=0,
- \c!nregels=4]
-
-\stelplaatsbloksplitsenin
- [\c!conversie=\v!letter, % \v!romeins
- \c!regels=3]
-
-\stelreferentielijstin
- [\c!letter=\v!normaal]
-
-\stelinmargein
- [\c!letter=\v!vet,
- \c!kleur=,
- \c!plaats=\v!beide,
- \c!uitlijnen=\v!binnen,
- \c!voor=,
- \c!na=]
-
-\stelinmargein
- [\v!links]
- [\c!plaats=\v!links]
-% \c!uitlijnen=\v!links] % njet
-
-\stelinmargein
- [\v!rechts]
- [\c!plaats=\v!rechts]
-% \c!uitlijnen=\v!rechts] % njet
-
-\versie
- [\v!definitief]
-
-\stelpaginanummerin
- [\c!status=\v!start,
- \c!nummer=1]
-
-\stelsubpaginanummerin
- [\c!wijze=\v!per\v!deel,
- \c!status=\v!stop]
-
-\stelregelnummerenin
- [\c!conversie=\v!cijfers,
- \c!start=1,
- \c!stap=1,
- \c!plaats=\v!inmarge,
- \c!letter=,
- \c!kleur=,
- \c!breedte=2em,
- \c!prefix=,
- \c!refereren=\v!aan]
-
-\stelparagraafnummerenin
- [\c!status=\v!stop,
- \c!letter=,
- \c!kleur=,
- \c!afstand=\ifregelnummersinmarge2em\else\!!zeropoint\fi]
-
-\definieeropmaak
- [\v!standaard]
- [\c!breedte=\zetbreedte,
- \c!hoogte=\teksthoogte,
- \c!voffset=\!!zeropoint,
- \c!hoffset=\!!zeropoint,
- \c!pagina=\v!rechts,
- \c!dubbelzijdig=\v!leeg]
-
-\stelpositionerenin
- [\c!eenheid=\s!cm,
- \c!factor=1,
- \c!schaal=1,
- \c!xstap=\v!absoluut,
- \c!ystap=\v!absoluut,
- \c!offset=\v!ja,
- \c!xoffset=\!!zeropoint,
- \c!yoffset=\!!zeropoint]
-
-\stelregelsin
- [\c!voor=\blanko,
- \c!na=\blanko,
- \c!tussen=\blanko,
- \c!inspringen=\v!nee]
-
-\stelkoppeltekenin
- [\c!teken=\compoundhyphen]
-
-\stelnaastplaatsenin
- [\c!status=\v!stop]
-
-\definieerplaatsblok
- [\v!figuur]
- [\v!figuren]
-
-\definieerplaatsblok
- [\v!tabel]
- [\v!tabellen]
-
-\stelplaatsblokin
- [\v!tabel]
- [\c!kader=\v!uit]
-
-\definieerplaatsblok
- [\v!intermezzo]
- [\v!intermezzos]
-
-\definieerplaatsblok
- [\v!grafiek]
- [\v!grafieken]
-
-\stelmargeblokkenin
- [\c!status=\v!start,
- \c!plaats=\v!inmarge,
- \c!breedte=\rechtermargebreedte,
- \c!letter=,
- \c!kleur=,
- \c!uitlijnen=,
- \c!links=,
- \c!rechts=,
- \c!boven=,
- \c!tussen=\blanko,
- \c!onder=\vfill,
- \c!voor=,
- \c!na=]
-
-\stelachtergrondenin
- [\c!status=\c!start]
-
-\stelachtergrondenin
- [\v!papier,\v!pagina,\v!linkerpagina,\v!rechterpagina]
- [\c!kader=\v!uit,
- \c!straal=.5\korpsgrootte,
- \c!hoek=\v!recht,
- \c!achtergrond=,
- \c!raster=\@@rsraster,
- \c!kleur=,
- \c!kaderoffset=\getvalue{\??ma\v!pagina\c!offset},
- \c!achtergrondoffset=\getvalue{\??ma\v!pagina\c!offset},
- \c!offset=\!!zeropoint, % later set to \v!overlay, watch out !
- %\c!scheider=\v!nee,
- \c!diepte=\!!zeropoint]
-
-\global\somebackgroundfalse
-
-\def\documentstyle%
- {\showmessage{\m!systems}{3}{}
- \stoptekst}
-
-\let\documentclass\documentstyle
-
-\protect \endinput
diff --git a/tex/context/base/main-002.tex b/tex/context/base/main-002.tex
deleted file mode 100644
index 6784b2a2a..000000000
--- a/tex/context/base/main-002.tex
+++ /dev/null
@@ -1,973 +0,0 @@
-%D \module
-%D [ file=main-002,
-%D version=1997.03.31,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=1B (to be split),
-%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.
-
-%D This module is still to be split and documented.
-
-\writestatus{loading}{Context Core Macros (2)}
-
-\unprotect
-
-%\def\checkinterlineskip%
-% {\ifvmode
-% \ifdim\lastskip>\!!zeropoint\relax
-% \nointerlineskip
-% \else\ifdim\lastkern>\!!zeropoint\relax
-% \nointerlineskip
-% \fi\fi
-% \fi}
-
-\def\horitems#1#2% #1=breedte #2=commandos
- {\dimen0=#1\relax
- \divide\dimen0 by \nofitems
- \!!counta=0\relax
- \def\docommando##1%
- {\advance\!!counta by 1\relax
- \processaction
- [\@@isuitlijnen]
- [ \v!links=>\hbox to \dimen0{\strut##1\hss},
- \v!rechts=>\hbox to \dimen0{\hss\strut##1},
- \v!midden=>\hbox to \dimen0{\hss\strut##1\hss},
- \v!marge=>\ifnum\!!counta=1\hss\else\hfill\fi
- \strut##1%
- \ifnum\!!counta=\nofitems\hss\else\hfill\fi,
- \s!default=>\hbox to \dimen0{\hss\strut##1\hss}, % midden
- \s!unknown=>\hbox to \dimen0{\strut##1\hss}]}% % links
- \hbox to #1{\hss#2\hss}}
-
-\def\veritems#1#2% #1=breedte #2=commandos
- {\dimen0=#1\relax
- \def\docommando##1%
- {\ifdim\dimen0<\!!zeropoint\relax % the - was a signal
- \hbox to -\dimen0{\hss\strut##1}%
- \else\ifdim\dimen0>\!!zeropoint\relax
- \hbox to \dimen0{\strut##1\hss}%
- \else
- \hbox{\strut##1}%
- \fi\fi}%
- \vbox{#2}}
-
-\def\dostelitemsin[#1]%
- {\getparameters[\??is][#1]%
- \doif{\@@isbreedte}{\v!onbekend}
- {\def\@@isbreedte{\hsize}}%
- \doifconversiondefinedelse{\@@issymbool}
- {\def\doitembullet##1{\convertnumber{\@@issymbool}{##1}}}
- {\doifsymboldefinedelse{\@@issymbool}
- {\def\doitembullet##1{\symbol[\@@issymbool]}}{}}}
-
-\def\makeitemsandbullets#1%
- {\doifelse{\@@isn}{\v!onbekend}
- {\getcommalistsize[#1]%
- \edef\nofitems{\commalistsize}}
- {\edef\nofitems{\@@isn}}%
- \setbox0=\hbox
- {\doitems
- {\@@isbreedte}
- {\processcommalist[#1]\docommando}}%
- \setbox2=\hbox
- {\doitems
- {\@@isbulletbreedte}
- {\dorecurse{\nofitems}
- {\docommando{\strut\doitembullet{\herhaler}}}}}}
-
-\def\dostartitems#1#2#3%
- {\let\doitems=#2
- \def\@@isbulletbreedte{#3}%
- \makeitemsandbullets{#1}%
- \@@isvoor}
-
-\def\dostopitems%
- {\@@isna
- \egroup}
-
-\setvalue{doitems\v!boven}#1%
- {\dostartitems{#1}\horitems\@@isbreedte
- \noindent\vbox
- {\forgetall
- \doifsomething{\@@issymbool}
- {\doifnot{\@@issymbool}{\v!geen}
- {\box2
- \@@istussen
- \nointerlineskip}}%
- \box0}%
- \dostopitems}
-
-\setvalue{doitems\v!onder}#1%
- {\dostartitems{#1}\horitems\@@isbreedte
- \noindent\vbox
- {\forgetall
- \box0
- \doifsomething{\@@issymbool}
- {\@@istussen
- \nointerlineskip
- \box2}}%
- \dostopitems}
-
-\setvalue{doitems\v!inmarge}#1%
- {\dostartitems{#1}{\veritems}{-1.5em}% - is a signal
- \noindent\hbox{\llap{\box2\hskip\linkermargeafstand}\box0}%
- \dostopitems}
-
-\setvalue{doitems\v!links}#1%
- {\advance\hsize by -1.5em\relax
- \dostartitems{#1}{\veritems}{1.5em}%
- \noindent\hbox{\box2\box0}%
- \dostopitems}
-
-\setvalue{doitems\v!rechts}#1%
- {\dostartitems{#1}{\veritems}{0em}%
- \noindent\hbox{\box0\hskip-\wd2\box2}%
- \dostopitems}
-
-\def\stelitemsin%
- {\dosingleargument\dostelitemsin}
-
-\def\complexitems[#1]%
- {\bgroup
- \stelitemsin[#1]%
- \parindent=\!!zeropoint
- \setlocalhsize
- \hsize=\localhsize
- \mindermeldingen
- \doifundefined{doitems\@@isplaats}%
- {\let\@@isplaats\v!links}%
- \getvalue{doitems\@@isplaats}}
-
-\definecomplexorsimpleempty\items
-
-
-% Te zijner tijd [plaats=boven,onder,midden] implementeren,
-% in dat geval moet eerst de maximale hoogte worden bepaald.
-%
-% Overigens kan een en ander mooier met \halign.
-
-\def\dodefinieeralineas[#1][#2]%
- {\setvalue{\s!do\s!next#1}%
- {\def\\{\getvalue{#1}}}%
- \setvalue{#1}%
- {\getvalue{\s!do\s!next#1}%
- \dostartalineas{#1}}%
- \setvalue{\e!volgende#1}%
- {\getvalue{#1}}%
- \setvalue{\e!start#1}%
- {\bgroup
- \setvalue{\s!do\s!next#1}{}%
- \setvalue{\e!stop#1}%
- {\getvalue{#1}%
- \egroup}%
- \getvalue{#1}}%
- \getparameters[\??al#1]%
- [\c!n=3,
- \c!voor=\blanko,
- \c!na=\blanko,
- \c!afstand=1em,
- \c!hoogte=\v!passend,
- \c!lijn=\v!uit,
- \c!commando=,
- \c!uitlijnen=,
- \c!tolerantie=\v!soepel,
- \c!letter=,
- \c!kleur=,
- \c!boven=,
- \c!boven=\vss,
- \c!onder=\vfill,
- #2]%
- \setvalue{\e!stel#1\e!in}%
- {\stelalineasin[#1]}%
- \dorecurse
- {\getvalue{\??al#1\c!n}}
- {\stelalineasin[#1][\recurselevel]
- [\c!breedte=,
- \c!onder=\getvalue{\??al#1\c!onder},
- \c!boven=\getvalue{\??al#1\c!boven},
- \c!hoogte=\getvalue{\??al#1\c!hoogte},
- \c!letter=\getvalue{\??al#1\c!letter},
- \c!kleur=\getvalue{\??al#1\c!kleur},
- \c!lijn=\getvalue{\??al#1\c!lijn},
- \c!uitlijnen=\getvalue{\??al#1\c!uitlijnen},
- \c!tolerantie=\getvalue{\??al#1\c!tolerantie},
- \c!afstand=\getvalue{\??al#1\c!afstand}]}%
- \stelalineasin[#1][1][\c!afstand=0em]}
-
-% nog monster
-%
-%\assignwidth
-% {\!!widtha}
-% {\getvalue{\??dd#1\c!breedte}}
-% {\doifelsevaluenothing{\??dd#1\c!monster}
-% {\hskip
-% {\doattributes
-% {\??al#1}\c!letter\c!kleur
-% {\getvalue{\??dd#1\c!monster}}}}
-% {0pt}
-
-\def\definieeralineas%
- {\dodoubleargument\dodefinieeralineas}
-
-\def\dostelalineasin[#1][#2][#3]%
- {\doifelse{#2}{\v!elk}
- {\dorecurse
- {\getvalue{\??al#1\c!n}}
- {\getparameters[\??al#1\herhaler][#3]}}
- {\ConvertToConstant\doifelse{#3}{}
- {\getparameters[\??al#1][#2]}
- {\def\docommando##1%
- {\getparameters[\??al#1##1][#3]}%
- \processcommalist[#2]\docommando}}}
-
-\def\stelalineasin%
- {\dotripleempty\dostelalineasin}
-
-\newcount\alteller
-\newcount\alnsize
-\newdimen\alhsize
-
-\def\doalinealijn#1#2%
- {\doifelsevalue{\??al#2\the\alteller\c!lijn}{\v!aan}
- {\expandafter\dimen2=#1\relax
- \hskip.5\dimen2
- \hskip-\linewidth
- \vrule\!!width\linewidth
- \hskip.5\dimen2}
- {\hskip#1}}
-
-\def\dostartalinea#1%
- {\doifelsevaluenothing{\??al#1\the\alteller\c!breedte}
- {\!!widtha=\alhsize\relax
- \divide\!!widtha by \alnsize}
- {\!!widtha=\getvalue{\??al#1\the\alteller\c!breedte}\relax}%
- \dostartattributes
- {\??al#1\the\alteller}\c!letter\c!kleur
- {}%
- \doifelsevalue{\??al#1\the\alteller\c!hoogte}{\v!passend}
- {\setbox0=\vtop}
- {\setbox0=\vtop to \getvalue{\??al#1\the\alteller\c!hoogte}}%
- \bgroup
- \blanko[\v!blokkeer]%
- \forgetall
- \getvalue{\??al#1\the\alteller\c!boven}%
- \getvalue{\??al#1\c!binnen}%
- \hsize=\!!widtha % setting \wd afterwards removed
- \getvalue{\??al#1\the\alteller\c!binnen}%
- \edef\!!stringa{\getvalue{\??al#1\the\alteller\c!uitlijnen}}% nodig?
- \expandafter\steluitlijnenin\expandafter[\!!stringa]%
- \edef\!!stringa{\getvalue{\??al#1\the\alteller\c!tolerantie}}% nodig?
- \expandafter\steltolerantiein\expandafter[\!!stringa]%
- \ignorespaces
- \endgraf
- \ignorespaces
- %
- % Nadeel van de onderstaande constructie is dat \everypar
- % binnen een groep kan staan en zo steeds \begstruts
- % worden geplaatst. Mooi is anders dus moet het anders!
- %
- % Hier is \Everypar niet nodig.
- %
- \everypar{\begstrut\everypar{}}%
- %
- \ignorespaces\geenspatie % dubbel: \ignorespaces
- \getvalue{\??al#1\the\alteller\c!commando}}
-
-\def\dostopalinea#1%
- {\ifvmode
- \removelastskip
- \else
- \unskip\endstrut\endgraf
- \fi
- \getvalue{\??al#1\the\alteller\c!onder}%
- \egroup
- \ifdim\wd0=\!!zeropoint % no data
- \wd0=\!!widtha
- \fi
- \box0
- \dostopattributes
- \ifnum\alteller<\getvalue{\??al#1\c!n}\relax
- \def\next{\doalinea{#1}}%
- \else
- \def\next{\dostopalineas{#1}}%
- \fi
- \next}
-
-\def\doalinea#1%
- {\global\advance\alteller by 1\relax
- \doifelsevaluenothing{\??al#1\the\alteller\c!afstand}
- {\doifnot{\the\alteller}{1}
- {\hskip\getvalue{\??al#1\c!afstand}}}
- {\doifelse{\the\alteller}{1}%
- {\hskip\getvalue{\??al#1\the\alteller\c!afstand}}
- {\doalinealijn{\getvalue{\??al#1\the\alteller\c!afstand}}{#1}}}%
- \setvalue{#1}{\dostopalinea{#1}}%
- \dostartalinea{#1}}
-
-\def\dostartalineas#1%
- {\global\alteller=0\relax
- \parindent=\!!zeropoint
- \setlocalhsize
- \alhsize=\localhsize
- \alnsize=\getvalue{\??al#1\c!n}\relax
- \dorecurse
- {\getvalue{\??al#1\c!n}}
- {\doifelsevaluenothing{\??al#1\recurselevel\c!afstand}
- {\doifnot{\recurselevel}{1}
- {\global\advance\alhsize by -\getvalue{\??al#1\c!afstand}\relax}}
- {\global\advance\alhsize by -\getvalue{\??al#1\recurselevel\c!afstand}\relax}%
- \doifvaluesomething{\??al#1\recurselevel\c!breedte}
- {\global\advance\alnsize by -1\relax
- \global\advance\alhsize by -\getvalue{\??al#1\recurselevel\c!breedte}\relax}}%
- %\witruimte % gaat fout bij \framed
- \getvalue{\??al#1\c!voor}%
- \leavevmode % gaat wel goed bij \framed
- \vbox\bgroup\hbox\bgroup
- \doalinea{#1}}
-
-\def\dostopalineas#1%
- {\egroup
- \egroup
- \par
- \getvalue{\??al#1\c!na}}%
-
-
-\def\dosteltabin[#1]%
- {\getparameters[\??ta]
- [\c!kopletter=\v!normaal,
- \c!kopkleur=,
- \c!letter=\v!normaal,
- \c!kleur=,
- \c!breedte=\v!ruim,
- \c!monster={\hskip4em},
- \c!voor=,
- \c!na=,
- #1]%
- \doordefinieren
- [tab]
- [\c!kopletter=\@@takopletter,
- \c!kopkleur=\@@takleur,
- \c!monster=\@@tamonster,
- \c!breedte=\@@tabreedte,
- \c!voor=\@@tavoor,
- \c!na=\@@tana]}
-
-\def\steltabin%
- {\dosingleargument\dosteltabin}
-
-
-% The following macro's are derived from PPCHTEX and
-% therefore take some LaTeX font-switching into account.
-
-\newif\ifloweredsubscripts
-
-% Due to some upward incompatibality of LaTeX to LaTeX2.09
-% and/or LaTeX2e we had to force \@@chemieletter. Otherwise
-% some weird \nullfont error comes up.
-
-\doifundefined{@@chemieletter}{\def\@@chemieletter{\rm}}
-
-\def\beginlatexmathmodehack%
- {\ifmmode
- \let\endlatexmathmodehack=\relax
- \else
- \def\endlatexmathmodehack{$}$\@@chemieletter
- \fi}
-
-\def\setsubscripts%
- {\beginlatexmathmodehack
- \def\dosetsubscript##1##2##3%
- {\dimen0=##3\fontdimen5##2%
- \setxvalue{@@\string##1\string##2}{\the##1##2\relax}%
- ##1##2=\dimen0\relax}%
- \def\dodosetsubscript##1##2%
- {\dosetsubscript{##1}{\textfont2}{##2}%
- \dosetsubscript{##1}{\scriptfont2}{##2}%
- \dosetsubscript{##1}{\scriptscriptfont2}{##2}}%
- %\dodosetsubscript{\fontdimen14}{?}%
- \dodosetsubscript{\fontdimen16}{.7}%
- \dodosetsubscript{\fontdimen17}{.7}%
- \global\loweredsubscriptstrue
- \endlatexmathmodehack}
-
-\def\resetsubscripts%
- {\ifloweredsubscripts
- \beginlatexmathmodehack
- \def\doresetsubscript##1##2%
- {\dimen0=\getvalue{@@\string##1\string##2}\relax
- ##1##2=\dimen0}%
- \def\dodoresetsubscript##1%
- {\doresetsubscript{##1}{\textfont2}%
- \doresetsubscript{##1}{\scriptfont2}%
- \doresetsubscript{##1}{\scriptscriptfont2}}%
- %\dodoresetsubscript{\fontdimen14}%
- \dodoresetsubscript{\fontdimen16}%
- \dodoresetsubscript{\fontdimen17}%
- \global\loweredsubscriptsfalse
- \endlatexmathmodehack
- \fi}
-
-\let\beginlatexmathmodehack = \relax
-\let\endlatexmathmodehack = \relax
-
-\def\chem#1#2#3%
- {\bgroup
- \setsubscripts
- \mathematics{\hbox{#1}_{#2}^{#3}}%
- \resetsubscripts
- \egroup}
-
-\def\celsius#1%
- {#1\mathematics{^\circ}C}
-
-\def\graden%
- {\mathematics{^\circ}}
-
-\def\inch%
- {\hbox{\rm\char125\relax}}
-
-\def\breuk#1#2%
- {\mathematics{#1\over#2}}
-
-%\def\bedrag#1%
-% {\mathematics{f~}\hbox{#1}}
-
-\def\bedragprefix{\mathematics{f\normalfixedspace}}
-\def\bedragsuffix{}
-
-\def\bedrag#1%
- {\strut\hbox\bgroup
- \let\normalfixedspace~%
- % \def~{\futurelet\next\dofixedspace}%
- % \def\dofixedspace%
- % {\hskip.5em\relax
- % \ifx\next,%
- % \hphantom{,}\let\next\gobbleoneargument
- % \else\ifx\next.%
- % \hphantom{.}\let\next\gobbleoneargument
- % \else
- % \let\next\relax
- % \fi\fi
- % \next}%
- % \bedragprefix#1\bedragsuffix
- \bedragprefix\digits{#1}\bedragsuffix
- \egroup}
-
-
-% \definieeralineas[test][n=3]
-%
-% \stelalineasin[test][3][breedte=4cm,uitlijnen=links]
-%
-% \startopelkaar
-% \test hans \\ ton \\ \bedrag{1.000,--} \\
-% \test hans \\ ton \\ \bedrag{~.~~1,--} \\
-% \test hans \\ ton \\ \bedrag{~.~~1,~~} \\
-% \test hans \\ ton \\ \bedrag{~.100,--} \\
-% \test hans \\ ton \\ \subtot{1.000,--} \\
-% \test hans \\ ton \\ \bedrag{1.000,--} \\
-% \test hans \\ ton \\ \bedrag{1.000,--} \\
-% \test hans \\ ton \\ \totaal{1.000,--} \\
-% \test hans \\ ton \\ \bedrag{nihil,--} \\
-% \test hans \\ ton \\ \totaal{nihil,--} \\
-% \test hans \\ ton \\ \subtot{nihil,--} \\
-% \stopopelkaar
-
-\def\doorsnede%
- {\hbox{\rlap/$\circ$} }
-
-\def\complexpunten[#1]%
- {\dimen0=.5em\relax
- \multiply\dimen0 by #1\relax
- \hbox to \dimen0
- {\leaders\hbox to .5em{\hss.\hss}\hss}}
-
-\def\simplepunten%
- {\complexpunten[5]}
-
-\definecomplexorsimple\punten
-
-\def\ongeveer%
- {\mathematics{\pm}}
-
-\def\permille%
- {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle00}}}
-
-\def\percent%
- {\mathematics{^{\scriptscriptstyle0}\kern-.25em/\kern-.2em_{\scriptscriptstyle0}}}
-
-\let\promille=\permille
-\let\procent =\percent
-
-\def\permine%
- {\dontleavehmode
- \bgroup
- \setbox0=\hbox
- {\mathematics{+}}%
- \hbox to \wd0
- {\hss
- \mathematics{^{\scriptscriptstyle-}\kern-.4em/\kern-.3em_{\scriptscriptstyle-}}%
- \hss}%
- \egroup}
-
-% for compatibility
-
-\def\unknown%
- {\dontleavehmode\punten[3]}
-
-% currency
-
-\def\dollar%
- {\bgroup
- \ifnum\fam=\itfam
- \sl
- \else\ifnum\fam=\bifam
- \bs
- \fi\fi
- \$%
- \egroup}
-
-\def\sterling%
- {\bgroup
- \ifnum\fam=\bffam
- \bi
- \else\ifnum\fam=\bifam
- \bi
- \else\ifnum\fam=\bsfam
- \bi
- \else
- \it
- \fi\fi\fi
- \$%
- \egroup}
-
-\def\florijn%
- {\bgroup
- \ifnum\fam=\bffam
- \bi
- \else\ifnum\fam=\bifam
- \bi
- \else\ifnum\fam=\bsfam
- \bi
- \else
- \it
- \fi\fi\fi
- 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}}
-
-% Tijden horen hier niet thuis en zullen in een aparte
-% module worden ondergebracht. voorlopig handhaven we ze nog
-% even. Een implementatie met \doordefinieren zou beter voldoen
-% omdat een en ander dan instelbaar wordt. Het is trouwens
-% zowieso beter het commando \tijd te reserveren voor de
-% systeemtijd.
-
-\def\tijd#1%
- {\setbox0=\hbox{00.00}%
- \hbox to \wd0{\hfill#1}}
-
-\def\tijdspan#1#2%
- {\hbox{\tijd{#1}~---~\tijd{#2}}}
-
-\def\activiteit#1#2%
- {\activity{\tijdspan{#1}{#2}}}
-
-\def\activiteit#1#2%
- {\sym{\tijdspan{#1}{#2}}}
-
-
-\def\dotoevoegen#1%
- {\def\next{#1}%
- \dorecurse{#1}{\inlinker{\next~+}\def\next{}\crlf}}
-
-\def\complextoevoegen[#1]%
- {\blanko
- \processaction
- [#1]
- [ \v!klein=>\dotoevoegen{3},
- \v!middel=>\dotoevoegen{6},
- \v!groot=>\dotoevoegen{9},
- \s!default=>\dotoevoegen{6},
- \s!unknown=>\dotoevoegen{#1}]
- \blanko}
-
-\definecomplexorsimpleempty\toevoegen
-
-
-\def\dorooster[#1]%
- {\begingroup
- \getparameters[\??rt]
- [\c!x=0,\c!y=0,
- \c!nx=10,\c!ny=10,
- \c!dx=.5,\c!dy=.5,
- \c!xstap=0,\c!ystap=0,
- \c!eenheid=\s!cm,
- \c!schaal=1,
- \c!factor=1,
- \c!offset=\v!ja,
- \c!plaats=\v!links,
- #1]%
- \startpositioneren
- \dimen0=\@@rtdx\@@rteenheid\relax
- \dimen0=\@@rtschaal\dimen0\relax
- \dimen0=\@@rtfactor\dimen0\relax
- \multiply\dimen0 by \@@rtnx\relax
- \dimen2=\@@rtdy\@@rteenheid\relax
- \dimen2=\@@rtschaal\dimen2\relax
- \dimen2=\@@rtfactor\dimen2\relax
- \multiply\dimen2 by \@@rtny\relax
- \def\horline
- {\vbox
- {\hrule
- \!!width \dimen0
- \!!height \linewidth
- \!!depth \!!zeropoint}}%
- \def\verline%
- {\vrule
- \!!width \linewidth
- \!!height \dimen2
- \!!depth \!!zeropoint}%
- \doglobal\newcounter\@@roosterc
- \doglobal\newcounter\@@roosterd
- \doglobal\newcounter\@@roostere
- \def\setlegend##1##2##3%
- {\gdef\@@roosterc{0}%
- \dimen0=2em\relax
- \dimen2=##2\@@rteenheid\relax
- \dimen2=\@@rtschaal\dimen2\relax
- \dimen2=\@@rtfactor\dimen2\relax
- \divide\dimen0 by \dimen2\relax
- \xdef\@@roostere{\number\dimen0}%
- \ifnum\@@roostere>50
- \gdef\@@roostere{100}%
- \else\ifnum\@@roostere>10
- \gdef\@@roostere{50}%
- \else\ifnum\@@roostere>5
- \gdef\@@roostere{10}%
- \else\ifnum\@@roostere>1
- \gdef\@@roostere{5}%
- \else
- \gdef\@@roostere{1}%
- \fi\fi\fi\fi
- \gdef\@@roosterd{0}%
- \def\legend%
- {\ifnum\@@roosterd=0\relax
- \vbox
- {\increment(\@@roosterc,##1)%
- \hbox to 2em{\hss\@@roosterc\hss}}%
- \global\let\@@roosterd=\@@roostere
- \fi
- \doglobal\decrement\@@roosterd
- \doglobal\increment(\@@roosterc,##1)}}%
- \def\draw##1##2##3##4##5##6##7##8##9%
- {\stelpositionerenin
- [\c!status=##8,
- \c!xstap=\v!absoluut,
- \c!ystap=\v!absoluut,
- \c!eenheid=\@@rteenheid,
- \c!schaal=\@@rtschaal,
- \c!factor=\@@rtfactor,
- \c!offset=\@@rtoffset,
- \c!xoffset=##6,
- \c!yoffset=##7]%
- \doifelse{##9}{\v!midden}
- {\scratchdimen=##3pt\scratchdimen=.5\scratchdimen
- \edef\@@psxx{\withoutpt\the\scratchdimen}%
- \scratchdimen=##4pt\scratchdimen=.5\scratchdimen
- \edef\@@psyy{\withoutpt\the\scratchdimen}%
- \scratchcounter=##2\advance\scratchcounter by -1
- \edef\@@pszz{\the\scratchcounter}}
- {\edef\@@psxx{0}\edef\@@psyy{0}\edef\@@pszz{##2}}%
- \positioneer(\@@psxx,\@@psyy){##1}%
- \stelpositionerenin
- [\c!status=##8,
- \c!xstap=\v!relatief,
- \c!ystap=\v!relatief,
- \c!schaal=\@@rtschaal,
- \c!factor=\@@rtfactor,
- \c!offset=\@@rtoffset,
- \c!eenheid=\@@rteenheid]%
- \dorecurse{\@@pszz}{\positioneer(##3,##4){##5}}}%
- \draw
- \verline\@@rtnx\@@rtdx0\verline\!!zeropoint\!!zeropoint\v!start\empty
- \draw
- \horline\@@rtny0\@@rtdy\horline\!!zeropoint\!!zeropoint\v!start\empty
- \tfx
- \doifnot{\@@rtxstap}{0}
- {\setlegend\@@rtxstap\@@rtdx\@@rtx
- \draw\legend\@@rtnx\@@rtdx0\legend{-1em}{-1.5em}\v!overlay\@@rtplaats}%
- \doifnot{\@@rtystap}{0}
- {\setlegend\@@rtystap\@@rtdy\@@rty
- \draw\legend\@@rtny0\@@rtdy\legend{-2em}{-.75ex}\v!overlay\@@rtplaats}%
- \stoppositioneren
- \endgroup}
-
-\def\rooster%
- {\dosingleempty\dorooster}
-
-% Dit wordt:
-%
-% \doorverwijzen[naam][instellingen] enz.
-%
-% waarbij <naam> bijvoorbeeld publicatie is. Dit levert:
-%
-% \start<naam>
-% \stop<naam>
-%
-% \beginvan<naam>
-% \eindvan<naam>
-%
-% \publicatie
-%
-% \volledigelijstmetpublicaties
-%
-% eigenlijk kan ook door... zo worden uitgebreid!
-
-\doornummeren
- [@publicatie]
- [\c!plaats=\v!links,
- \c!breedte=\@@pbbreedte,\c!hang=,\c!monster=,
- \c!voor=\@@pbvoor,\c!na=\@@pbna,\c!tussen=,
- \c!kopletter=\@@pbkopletter,\c!letter=,
- \c!kopkleur=\@@pbkopkleur,\c!kleur=,
- \c!wijze=\@@pbwijze,\c!blokwijze=\@@pbblokwijze,
- \c!tekst=,\c!links=\@@pblinks,\c!rechts=\@@pbrechts]
-
-\def\dostelpublicatiesin[#1]%
- {\getparameters[\??pb][#1]}
-
-\def\stelpublicatiesin%
- {\dosingleargument\dostelpublicatiesin}
-
-\def\apa@publicatie%
- {\doifsomething{\@@pb@naam}{\@@pb@naam,\spatie}%
- \doifsomething{\@@pb@titel}{{\sl\@@pb@titel}.\spatie}%
- \doifsomething{\@@pb@jaar}{(\@@pb@jaar).\spatie}%
- \doifsomething{\@@pb@plaats}{\@@pb@plaats\doifelsenothing{\@@pb@uitgever}{.}{:\spatie}}%
- \doifsomething{\@@pb@uitgever}{\@@pb@uitgever.}}
-
-\def\normaal@publicatie%
- {\@@pb@naam, \@@pb@titel, \@@pb@jaar, \@@pb@pagina, \@@pb@plaats, \@@pb@uitgever.}
-
-\def\complexstartpublicatie[#1]#2\stoppublicatie%
- {\bgroup%
- \def\dosetpublicatie%
- {\processcommalist
- [naam,titel,jaar,plaats,pagina,uitgever]
- \setpublicatie
- \ignorespaces}%
- \def\setpublicatie##1%
- {\setvalue{\??pb @##1}{}%
- \setvalue{##1}####1{\setvalue{\??pb @##1}{####1}\ignorespaces}}%
- \def\getpublicatie%
- {\doifsomething{\@@pbvariant}{\getvalue{\@@pbvariant @publicatie}}}%
- \doifelse{\@@pbnummeren}{\v!ja}%
- {\@publicatie[#1]\dosetpublicatie#2\getpublicatie\par}%
- {\@@pbvoor
- \dosetpublicatie\ignorespaces#2\getpublicatie
- \@@pbna}%
- \egroup}
-
-\definecomplexorsimpleempty\startpublicatie
-
-\def\publicatie#1[#2]%
- {\@@pblinks\in{#1}[#2]\@@pbrechts}
-
-
-\def\kenmerkdatum%
- {\currentdate[\v!kenmerk]}
-
-\def\dokenmerk[#1]%
- {\geenhoofdenvoetregels
- \bgroup
- \getparameters
- [\??km]
- [\c!bet=\unknown,\c!dat=\unknown,\c!ken=\unknown,
- \c!van=, \c!aan=, \c!ref=, #1]%
- % moet anders, hoort niet in 01b
- \assigntranslation[nl=referentie,en=reference,du=Referenz, sp=referencia]\to\@@@kmref
- \assigntranslation[nl=van, en=from, du=Von, sp=de]\to\@@@kmvan
- \assigntranslation[nl=aan, en=to, du=An, sp=a]\to\@@@kmaan
- \assigntranslation[nl=betreft, en=concerns, du=Betreff, sp=]\to\@@@kmbet
- \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|]
- \startdummy
- \NC\@@@kmbet\EQ\@@kmbet\NC\NR
- \NC\@@@kmdat\EQ\@@kmdat\NC\NR
- \NC\@@@kmken\EQ\expanded{\kap{\@@kmken}}\NC\NR
- \doifsomething{\@@kmvan\@@kmaan}{\NC\NC\NC\NR}%
- \doifsomething{\@@kmvan}{\NC\@@@kmvan\EQ\@@kmvan\NC\NR}%
- \doifsomething{\@@kmaan}{\NC\@@@kmaan\EQ\@@kmaan\NC\NR}%
- \doifsomething{\@@kmref}{\NC\NC\NC\NR\NC\@@@kmref\EQ\@@kmref\NC\NR}%
- \stopdummy
- \egroup}
-
-\def\kenmerk%
- {\dosingleargument\dokenmerk}
-
-% NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW
-% NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW
-
-\def\??ri{@@ri}
-
-\def\stelrijenin%
- {\dodoubleargument\getparameters[\??ri]}
-
-\def\complexstartrijen[#1]%
- {\bgroup
- \stelrijenin[#1]%
- \let\do@@rionder=\relax
- \def\rij%
- {\do@@rionder
- \egroup
- \dimen0=\vsize
- \divide\dimen0 by \@@rin
- \advance\dimen0 by -\lineskip
- \vbox to \dimen0
- \bgroup
- \@@riboven
- \let\do@@rionder=\@@rionder
- \ignorespaces}%
- \bgroup
- \rij}
-
-\definecomplexorsimpleempty\startrijen
-
-\def\stoprijen%
- {\do@@rionder
- \egroup
- \egroup}
-
-\stelrijenin
- [n=2,
- boven=,
- onder=\vfill]
-
-% NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW
-% NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW
-
-% Standaardinstellingen
-
-\stelitemsin
- [\c!plaats=\v!links,
- \c!symbool=5,
- \c!breedte=\hsize,
- \c!uitlijnen=\v!midden,
- \c!n=\v!onbekend,
- \c!voor=\blanko,
- \c!tussen={\blanko[\v!middel]},
- \c!na=\blanko]
-
-\steltabin
- [\c!plaats=\v!links]
-
-\stelpublicatiesin
- [\c!nummeren=\v!ja,
- \c!variant=\c!apa,
- \c!breedte=2em,
- \c!hang=,
- \c!monster=,
- \c!voor=,
- \c!na=,
- \c!tussen=,
- \c!kopletter=,
- \c!kopkleur=,
- \c!letter=,
- \c!kleur=,
- \c!blokwijze=\v!per\v!tekst,
- \c!wijze=\v!per\v!tekst,
- \c!tekst=,
- \c!links={[},
- \c!rechts={]}]
-
-\stelciterenin
- [\c!letter=\v!normaal,
- \c!kleur=,
- \c!voor=\startsmaller,
- \c!na=\stopsmaller]
-
-\protect
-
-\endinput
diff --git a/tex/context/base/main-003.tex b/tex/context/base/main-003.tex
deleted file mode 100644
index 5a5a06792..000000000
--- a/tex/context/base/main-003.tex
+++ /dev/null
@@ -1,830 +0,0 @@
-%D \module
-%D [ file=main-003,
-%D version=1997.03.31,
-%D title=\CONTEXT\ Core Macros,
-%D subtitle=1C (to be split),
-%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.
-
-%D This module is still to be split and documented.
-
-\writestatus{loading}{Context Core Macros (3)}
-
-\unprotect
-
-\startmessages dutch library: systems
- 41: externe file -- in groep -- bestaat niet
-\stopmessages
-
-\startmessages english library: systems
- 41: external file -- in group -- does not exist
-\stopmessages
-
-\startmessages german library: systems
- 41: Externe Datei -- in Gruppe -- existiert nicht
-\stopmessages
-
-\startmessages czech library: systems
- 41: externi soubor -- ve skupine -- neexistuje
-\stopmessages
-
-\startmessages italian library: systems
- 41: il file esterno -- del gruppo -- non esiste
-\stopmessages
-
-\startmessages norwegian library: systems
- 41: ekstern fil -- i gruppe -- eksisterer ikke
-\stopmessages
-
-\startmessages romanian library: systems
- 41: fisierul extern -- din grupul -- nu exista
-\stopmessages
-
-\definetabulate
- [\e!legenda]
- [|emj1|i1|mR|]
-
-\setuptabulate
- [\e!legenda]
- [\c!eenheid=.75em,\c!binnen=\setquicktabulate\leg,EQ={=}]
-
-\definetabulate
- [\e!legenda][\v!twee]
- [|emj1|emk1|i1|mR|]
-
-\definetabulate
- [\e!gegeven]
- [|R|ecmj1|i1mR|]
-
-\setuptabulate
- [\e!gegeven]
- [\c!eenheid=.75em,\c!binnen=\setquicktabulate\geg,EQ={=}]
-
-\unexpanded\def\xbox%
- {\bgroup\aftergroup\egroup\hbox\bgroup\tx\let\next=}
-
-\unexpanded\def\xxbox%
- {\bgroup\aftergroup\egroup\hbox\bgroup\txx\let\next=}
-
-% \def\mrm#1%
-% {$\rm#1$}
-
-%D \macros
-%D {definepairedbox, setuppairedbox, placepairedbox}
-%D
-%D Paired boxes, formally called legends, but from now on a
-%D legend is just an instance, are primarily meant for
-%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 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
-%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
-% \test right \test right,top \test right,bottom \test right,middle
-% \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%
-% {\pagina
-% \typebuffer[demo]
-% \def\test##1
-% {\startlinecorrection[blank]
-% \getbuffer[demo]%
-% \ruledhbox\placelegend
-% [bodyfont=6pt,location={##1}]
-% {\framed[width=.25\textwidth]{\tttf##1}}
-% {#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 {setuplegend, placelegend}
-%D
-%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 \type {bottom} or \type {right}. The macro macro is used as
-%D follows.
-%D
-%D \starttypen
-%D \placefigure
-%D {whow}
-%D {\placelegend
-%D {\externalfigure[cow]}
-%D {\starttabulation
-%D \NC 1 \NC head \NC \NR
-%D \NC 2 \NC legs \NC \NR
-%D \NC 3 \NC tail \NC \NR
-%D \stoptabulation}}
-%D
-%D \placefigure
-%D {whow}
-%D {\placelegend
-%D {\externalfigure[cow]}
-%D {\starttabulation[|l|l|l|l|]
-%D \NC 1 \NC head \NC 3 \NC tail \NC \NR
-%D \NC 2 \NC legs \NC \NC \NC \NR
-%D \stoptabulation}}
-%D
-%D \placefigure
-%D {whow}
-%D {\placelegend[n=2]
-%D {\externalfigure[cow]}
-%D {\starttabulation
-%D \NC 1 \NC head \NC \NR
-%D \NC 2 \NC legs \NC \NR
-%D \NC 3 \NC tail \NC \NR
-%D \stoptabulation}}
-%D
-%D \placefigure
-%D {whow}
-%D {\placelegend[n=2]
-%D {\externalfigure[cow]}
-%D {head \par legs \par tail}}
-%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 \stopitemize}}
-%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 \stopitemize}}
-%D \stoptypen
-
-% \def\setuplegend%
-% {\dodoubleargument\getparameters[\??ld]}
-%
-% \setuplegend
-% [\c!n=1,
-% \c!afstand=1em,
-% \c!tussen={\blanko[\v!middel]},
-% \c!breedte=\hsize,
-% \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
-% \dowithnextbox
-% {\switchtobodyfont[\@@ldkorps]% split under same regime
-% \scratchdimen=\wd\nextbox
-% \doifelse{\@@ldplaats}{\v!rechts}
-% {\vsize=\ht\nextbox
-% \vsize=\@@ldhoogte
-% \hsize=\zetbreedte
-% \advance\hsize by -\scratchdimen
-% \advance\hsize by -\@@ldafstand
-% \plaatsnaastelkaar{\box\nextbox}\bgroup}
-% {\hsize\scratchdimen
-% \plaatsonderelkaar{\box\nextbox}\bgroup}%
-% \hsize\@@ldbreedte
-% \doif{\@@ldplaats}{\v!rechts}{\hskip\@@ldafstand}%
-% \ifnum\@@ldn>1
-% \setrigidcolumnhsize\hsize\@@ldafstand\@@ldn
-% \fi
-% \dowithnextbox
-% {\doifelse{\@@ldplaats}{\v!rechts}
-% {\vbox to \vsize
-% {\ifnum\@@ldn>1
-% \rigidcolumnbalance\nextbox
-% \else
-% \box\nextbox
-% \fi
-% \vfill}}
-% {\vbox
-% {\@@ldtussen
-% \ifnum\@@ldn>1
-% \rigidcolumnbalance\nextbox
-% \else
-% \box\nextbox
-% \fi}}%
-% \egroup\egroup}%
-% \vbox
-% \bgroup
-% \forgetall
-% \tolerantTABLEbreaktrue % hm.
-% \blanko[\v!blokkeer]%
-% \everypar{\begstrut}%
-% \let\next=}
-% \hbox}
-
-\newbox\firstpairedbox
-\newbox\secondpairedbox
-
-\def\definepairedbox%
- {\dodoubleempty\dodefinepairedbox}
-
-\def\dodefinepairedbox[#1][#2]%
- {\getparameters
- [\??ld#1]
- [\c!n=1,
- \c!afstand=\bodyfontsize,
- \c!tussen={\blanko[\v!middel]},
- \c!breedte=\hsize,
- \c!hoogte=\vsize,
- \c!maxbreedte=\zetbreedte,
- \c!maxhoogte=\zethoogte,
- \c!korps=,
- \c!uitlijnen=,
- \c!plaats=\v!onder,
- #2]%
- \setvalue{\e!stel#1\e!in}{\setuppairedbox[#1]}%
- \setvalue{\e!plaats#1}{\placepairedbox[#1]}}
-
-\def\setuppairedbox%
- {\dodoubleempty\dosetuppairedbox}
-
-\def\dosetuppairedbox[#1]%
- {\getparameters[\??ld#1]}
-
-\def\placepairedbox%
- {\bgroup\dodoubleempty\doplacepairedbox}
-
-\def\doplacepairedbox[#1][#2]% watch the hsize/vsize tricks
- {\setuppairedbox[#1][#2]% % and don't change them
- \copyparameters
- [\??ld][\??ld#1]
- [\c!n,\c!afstand,\c!tussen,
- \c!breedte,\c!hoogte,\c!maxbreedte,\c!maxhoogte,
- \c!korps,\c!uitlijnen,\c!plaats]%
- \beforefirstpairedbox
- \dowithnextbox
- {\betweenbothpairedboxes
- \dowithnextbox
- {\afterbothpairedboxes
- \egroup}
- \vbox\bgroup
- \insidesecondpairedbox
- \let\next=}
- \hbox}
-
-\def\beforefirstpairedbox%
- {\chardef\pairedlocationa=1 % left
- \chardef\pairedlocationb=4 % middle
- \getfromcommacommand[\@@ldplaats][1]%
- \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
- [\commalistelement]
- [ \v!links=>\chardef\pairedlocationb=0,
- \v!rechts=>\chardef\pairedlocationb=1,
- \v!hoog=>\chardef\pairedlocationb=2,
- \v!boven=>\chardef\pairedlocationb=2,
- \v!laag=>\chardef\pairedlocationb=3,
- \v!onder=>\chardef\pairedlocationb=3,
- \v!midden=>\chardef\pairedlocationb=4]}
-
-\def\betweenbothpairedboxes%
- {\switchtobodyfont[\@@ldkorps]% split under same regime
- \setbox\firstpairedbox=\box\nextbox
- \ifnum\pairedlocationa<2
- \hsize\wd\firstpairedbox % trick
- \hsize=\@@ldbreedte
- \scratchdimen=\wd\firstpairedbox
- \advance\scratchdimen by \@@ldafstand
- \bgroup\advance\scratchdimen by \hsize
- \ifdim\scratchdimen>\@@ldmaxbreedte\relax
- \egroup
- \hsize=\@@ldmaxbreedte
- \advance\hsize by -\scratchdimen
- \else
- \egroup
- \fi
- \else
- \hsize\wd\firstpairedbox
- \hsize\@@ldbreedte % can be \hsize
- \ifdim\hsize>\@@ldmaxbreedte\relax \hsize=\@@ldmaxbreedte \fi % can be \hsize
- \fi
- \ifnum\@@ldn>1
- \setrigidcolumnhsize\hsize\@@ldafstand\@@ldn
- \fi}
-
-\def\afterbothpairedboxes%
- {\setbox\secondpairedbox=\vbox
- {\ifnum\@@ldn>1 \rigidcolumnbalance\nextbox \else \box\nextbox \fi}%
- \ifnum\pairedlocationa<2\hbox\else\vbox\fi\bgroup % hide vsize
- \forgetall
- \ifnum\pairedlocationa<2
- \scratchdimen=\maxoftwoboxdimens\ht\firstpairedbox\secondpairedbox
- \vsize=\scratchdimen
- \ifdim\scratchdimen<\@@ldhoogte\relax % can be \vsize
- \scratchdimen=\@@ldhoogte
- \fi
- \ifdim\scratchdimen>\@@ldmaxhoogte\relax
- \scratchdimen=\@@ldmaxhoogte
- \fi
- \valignpairedbox\firstpairedbox \scratchdimen
- \valignpairedbox\secondpairedbox\scratchdimen
- \else
- \scratchdimen=\maxoftwoboxdimens\wd\firstpairedbox\secondpairedbox
- \halignpairedbox\firstpairedbox \scratchdimen
- \halignpairedbox\secondpairedbox\scratchdimen
- \scratchdimen=\ht\secondpairedbox
- \vsize=\scratchdimen
- \ifdim\ht\secondpairedbox<\@@ldhoogte\relax % can be \vsize
- \scratchdimen=\@@ldhoogte\relax % \relax needed
- \fi
- \ifdim\scratchdimen>\@@ldmaxhoogte\relax % todo: totale hoogte
- \scratchdimen=\@@ldmaxhoogte\relax % \relax needed
- \fi
- \ifdim\scratchdimen>\ht\secondpairedbox
- \setbox\secondpairedbox\vbox to \scratchdimen
- {\ifnum\pairedlocationa=3 \vss\fi
- \box\secondpairedbox
- \ifnum\pairedlocationa=2 \vss\fi}%
- \fi
- \fi
- \ifcase\pairedlocationa
- \box\secondpairedbox\hskip\@@ldafstand\box\firstpairedbox \or
- \box\firstpairedbox \hskip\@@ldafstand\box\secondpairedbox\or
- \box\secondpairedbox\par \@@ldtussen \box\firstpairedbox \or
- \box\firstpairedbox \par \@@ldtussen \box\secondpairedbox\else
- \fi
- \egroup}
-
-\def\insidesecondpairedbox%
- {\forgetall
- \steluitlijnenin[\@@lduitlijnen]%
- \tolerantTABLEbreaktrue % hm.
- \blanko[\v!blokkeer]%
- \everypar{\begstrut}}
-
-\def\maxoftwoboxdimens#1#2#3%
- {#1\ifdim#1#2>#1#3 #2\else#3\fi}
-
-\def\valignpairedbox#1#2%
- {\setbox#1=\vbox to #2
- {\ifcase\pairedlocationb\or\or\or\vss\or\vss\fi
- \box#1\relax
- \ifcase\pairedlocationb\or\or\vss\or\or\vss\fi}}
-
-\def\halignpairedbox#1#2%
- {\setbox#1=\hbox to #2
- {\ifcase\pairedlocationb\or\hss\or\or\or\hss\fi
- \box#1\relax
- \ifcase\pairedlocationb\hss\or\or\or\or\hss\fi}}
-
-\definepairedbox[\e!legenda]
-
-\newcount\horcombinatie % counter
-\newcount\totcombinatie
-
-\def\stelcombinatiesin%
- {\dodoubleargument\getparameters[\??co]}
-
-\long\def\dodostartcombinatie[#1*#2*#3]%
- {\stelfractiesin
- [\c!n=\v!passend,
- \c!afstand=\@@coafstand]%
- \global\horcombinatie=#1\relax
- \global\totcombinatie=#2\relax
- \xdef\maxhorcombinatie{\the\horcombinatie}%
- \multiply\totcombinatie by \horcombinatie
- \tabskip=\!!zeropoint
- \doifelse{\@@cobreedte}{\v!passend}
- {\halign}
- {\halign to \@@cobreedte}%
- \bgroup&\hfil##\hfil&\tabskip\!!zeropoint \!!plus 1fill##\cr
- \docombinatie}
-
-% \def\docombinatie%
-% {\dowithnextbox
-% {\setbox0=\box\nextbox
-% \dowithnextbox
-% {\setbox2=\box\nextbox
-% \dodocombinatie}
-% \hbox}
-% \hbox}
-
-\def\docombinatie% we want to add struts but still ignore an empty box
- {\dowithnextbox%
- {\setbox0=\box\nextbox
- \dowithnextbox
- {\setbox2=\box\nextbox
- \dodocombinatie}
- \vtop\bgroup
- \def\next%
- {\futurelet\nexttoken\nextnext}
- \def\nextnext%
- {\ifx\nexttoken\egroup \else % the next box is empty
- \hsize\wd0
- \steluitlijnenin[\@@couitlijnen]
- \bgroup
- \aftergroup\endstrut
- \aftergroup\egroup
- \begstrut
- \fi}
- \afterassignment\next\let\nexttoken=}
- \hbox}
-
-\def\dodocombinatie%
- {\vbox
- {\forgetall % \stelwitruimtein[\v!geen]%
- \vbox
- {\copy0}%
- \ifdim\ht2>\!!zeropoint\relax % beter dan \wd2, nu \strut mogelijk
- \@@cotussen
- %\vtop
- % {\nointerlineskip % recently added
- % \hsize\wd0
- % \steluitlijnenin[\@@couitlijnen]% % \raggedcenter
- % \begstrut\unhbox2\endstrut}%
- \box2
- \fi}%
- \ifnum\totcombinatie>1
- \global\advance\totcombinatie by -1
- \global\advance\horcombinatie by -1
- \ifnum\horcombinatie=0
- \def\next%
- {\cr\noalign
- {\forgetall %\stelwitruimtein[\v!geen]%
- \nointerlineskip
- \@@cona
- \@@covoor
- \vss
- \nointerlineskip}%
- \global\horcombinatie=\maxhorcombinatie\relax
- \docombinatie}%
- \else
- \def\next%
- {&&&\hskip\@@coafstand&\docombinatie}%
- \fi
- \else
- \def\next%
- {\cr\egroup}%
- \fi
- \next}
-
-\def\complexdostartcombinatie[#1]%
- {\dodostartcombinatie[#1*1*]}
-
-\def\simpledostartcombinatie%
- {\complexdostartcombinatie[2]}
-
-\def\startcombinatie%
- {\bgroup
- \forgetall
- \doifelse{\@@cohoogte}{\v!passend}
- {\vbox}
- {\vbox to \@@cohoogte}%
- \bgroup
- \complexorsimple\dostartcombinatie}
-
-\def\stopcombinatie%
- {\egroup
- \egroup}
-
-\def\plaatsondernaastelkaar#1#2%
- {\bgroup
- \def\doplaatsondernaastelkaar%
- {#2\cr\omit\bgroup#2%
- \aftergroup#2%
- \aftergroup\cr
- \aftergroup\egroup
- \aftergroup\egroup
- \let\next=}%
- #1\bgroup##\cr
- \omit\bgroup#2%
- \aftergroup\doplaatsondernaastelkaar
- \let\next=}
-
-\def\plaatsonderelkaar%
- {\plaatsondernaastelkaar\halign\hss}
-
-\def\plaatsnaastelkaar%
- {\plaatsondernaastelkaar\valign\vss}
-
-\def\dogebruikexternefiles[#1][#2]%
- {\getparameters
- [\??fi#1]
- [\c!file=,
- \c!korps=,
- \c!optie=,
- #2]}
-
-\def\gebruikexternefiles%
- {\dodoubleargument\dogebruikexternefiles}
-
-\def\dostelexternefilesin[#1][#2]%
- {\doifundefinedelse{\??fi#1\c!file}
- {\gebruikexternefiles[#1][#2]}
- {\getparameters[\??fi#1][#2]}}
-
-\def\stelexternefilesin%
- {\dodoubleargument\dostelexternefilesin}
-
-\def\verwerkexternefile#1#2#3%
- {\bgroup
- \getparameters[\??fi#1][\c!file=,#3]%
- \doinputonce{\getvalue{\??fi#1\c!file}}%
- \ExpandFirstAfter\switchtobodyfont[\getvalue{\??fi#1\c!korps}]%
- \readsysfile{#2} % beter: loc of fix gebied
- {}
- {\showmessage{\m!systems}{41}{#2,#1}}%
- \egroup}
-
-\def\dogebruikexternefile[#1][#2][#3][#4]%
- {\stelexternefilesin[#1][]%
- \doinputonce{\getvalue{\??fi#1\c!file}}%
- \doifelsenothing{#2}
- {\setvalue{#3}{\verwerkexternefile{#1}{#3}{#4}}}
- {\setvalue{#2}{\verwerkexternefile{#1}{#3}{#4}}}}
-
-\def\gebruikexternefile%
- {\doquadrupleargument\dogebruikexternefile}
-
-
-\presetlocalframed[\??ro]
-
-\def\stelroterenin%
- {\dodoubleargument\getparameters[\??ro]}
-
-% \ht, \vfillvoor, \vfillna, \wd, \hfillvoor, \hfillna
-
-\def\dodostoproteer#1#2#3#4#5#6%
- {\dontshowcomposition
- \vbox to #1\nextbox
- {#2\relax
- \hbox to #4\nextbox
- {#5\relax % \number removes leading spaces too
- \edef\@@rorotatie{\number\@@rorotatie}%
- \doifelsenothing{\@@rorotatie}
- {\dostartrotation{90}}
- {\dostartrotation{\@@rorotatie}}%
- \wd\nextbox=\!!zeropoint
- \ht\nextbox=\!!zeropoint
- \box\nextbox
- \dostoprotation
- #6}
- #3}%
- \egroup}
-
-
-\def\dostoproteer%
- {\!!counta=\@@rorotatie
- \divide\!!counta by 90
- \ifcase\!!counta
- \dodostoproteer\ht\relax\vfill\wd\relax\hfill
- \or
- \dodostoproteer\wd\vfill\relax\ht\relax\hfill
- \or
- \dodostoproteer\ht\vfill\relax\wd\hfill\relax
- \or
- \dodostoproteer\wd\relax\vfill\ht\hfill\relax
- \or
- \dodostoproteer\ht\relax\vfill\wd\relax\hfill
- \else
- \def\@@rotatie{90}%
- \dodostoproteer\ht\relax\vfill\wd\relax\hfill
- \fi}
-
-\def\dorotatebox#1% {angle} \hbox/\vbox/\vtop
- {\bgroup
- \hbox\bgroup % compatibility hack
- \dowithnextbox
- {\edef\@@rorotatie{#1}%
- \setbox\nextbox=\vbox{\box\nextbox}%
- \dostoproteer
- \egroup}}
-
-\def\complexroteer[#1]%
- {\dowithnextbox
- {\getparameters[\??ro][#1]%
- \dostoproteer}%
- \vbox\localframed[\??ro][#1]}
-
-\def\roteer%
- {\bgroup % \roteer kan argument zijn
- \complexorsimpleempty\roteer}
-
-% schaal
-
-\def\doscalelikeafigure%
- {\doifsomething{\@@xyfactor\@@xyschaal\@@xyhfactor\@@xybreedte\@@xyhoogte}
- {\let \@@efschaal \@@xyschaal
- \let \@@effactor \@@xyfactor
- \let \@@efbfactor\@@xybfactor
- \let \@@efhfactor\@@xyhfactor
- \let \@@efbreedte\@@xybreedte
- \let \@@efhoogte \@@xyhoogte
- \let \@@epx \!!zeropoint
- \let \@@epy \!!zeropoint
- \edef\@@epw {\the\wd\nextbox}%
- \edef\@@eph {\the\ht\nextbox}%
- \setfactorfiguresize
- \setscalefiguresize
- \setdimensionfiguresize
- \convertfigureinsertscale\@@epx\figx\figxsca\scax
- \convertfigureinsertscale\@@epy\figy\figysca\scay
- \scratchdimen=\scax pt \divide\scratchdimen by 100
- \edef\@@xysx{\withoutpt\the\scratchdimen}%
- \scratchdimen=\scay pt \divide\scratchdimen by 100
- \edef\@@xysy{\withoutpt\the\scratchdimen}}}
-
-\def\doschaal[#1]%
- {\bgroup
- \forgetall
- \getparameters
- [\??xy]
- [\c!schaal=,\c!breedte=,\c!hoogte=,
- \c!factor=,\c!hfactor=,\c!bfactor=,
- \c!sx=1,\c!sy=1,#1]%
- \dowithnextbox
- {\dontshowcomposition
- \doscalelikeafigure
- \dimen0=\@@xysy\ht\nextbox
- \dimen2=\@@xysy\dp\nextbox
- \dimen4=\@@xysx\wd\nextbox
- \dimen6=\dimen0\advance\dimen6 by \dimen2
- \setbox\nextbox=\vbox to \dimen6
- {\ht\nextbox=\!!zeropoint
- \dp\nextbox=\!!zeropoint
- \vfill % erbij
- \dostartscaling\@@xysx\@@xysy\box\nextbox\dostopscaling}%
- \ht\nextbox=\dimen0
- \dp\nextbox=\dimen2
- \wd\nextbox=\dimen4
- \box\nextbox
- \egroup}
- \hbox}
-
-\def\schaal%
- {\dosingleempty\doschaal}
-
-% mirror
-
-\def\domirrorbox% \hbox/\vbox/\vtop
- {\bgroup
- \dowithnextbox
- {\dontshowcomposition
- \dimen0=\wd\nextbox
- \setbox\nextbox=\vbox
- {\dostartmirroring\hskip-\wd\nextbox\box\nextbox\dostopmirroring}%
- \wd\nextbox=\dimen0
- \box\nextbox
- \egroup}}
-
-\def\spiegel%
- {\domirrorbox\hbox}
-
-%\setbox0=\hbox{gans}
-%
-%\ruledhbox{\copy0 \schaal[sx=2,sy=2]{\copy0}}
-%
-%\spiegel{\ruledhbox{\copy0 \schaal{\box0}}}
-
-% verdelen \hsize in fracties, wordt nog wat algemener,
-% beetje vaag nu
-%
-% \fractie[n/m,elementen,afstand]
-%
-% \fractie[2/5,3,1em]
-% \fractie[2/5,3,1em]
-% \fractie[1/5,3,1em]
-%
-% \stelfractiesin[afstand=,aantal=] (passend,passend)
-
-\def\??fr{@@fr}
-
-\def\stelfractiesin%
- {\dodoubleargument\getparameters[\??fr]}
-
-\def\dodofractie[#1/#2,#3,#4,#5]%
- {\doifelsenothing{#3}
- {\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}
-
-\def\dofractie[#1]%
- {\dodofractie[#1,,,,,,]}
-
-\def\fractie%
- {\dosingleargument\dofractie}
-
-\stelfractiesin
- [\c!afstand=\tfskipsize,
- \c!n=\v!passend]
-
-% Standaardinstellingen
-
-\stelroterenin
- [\c!rotatie=90,
- \c!breedte=\v!passend,
- \c!hoogte=\v!passend,
- \c!offset=\v!overlay,
- \c!kader=\v!uit]
-
-\stelcombinatiesin
- [\c!breedte=\v!passend,
- \c!hoogte=\v!passend,
- \c!afstand=1em,
- \c!voor=\blanko,
- \c!tussen={\blanko[\v!middel]},
- \c!na=,
- \c!uitlijnen=\v!midden]
-
-\gebruikexternefiles
- [pictex]
- [\c!korps=\v!klein,
- \c!file=pictex]
-
-\gebruikexternefiles
- [table]
- [\c!file=table]
-
-\protect
-
-\endinput
diff --git a/tex/context/base/math-run.tex b/tex/context/base/math-run.tex
index b394de614..e0647172b 100644
--- a/tex/context/base/math-run.tex
+++ b/tex/context/base/math-run.tex
@@ -56,6 +56,7 @@
{\hbox to \encwidth{$\getvalue{##1}{}$\hss}%
\hbox to 1em{\tttf\purefamilyhex{##3}\hss}##1}\par}}
\readsysfile{\f!mathprefix tex}{}{}
+% \readsysfile{\f!mathprefix ams}{}{}
\stopcolumns
\stoptextrule
\egroup}
diff --git a/tex/context/base/math-tex.tex b/tex/context/base/math-tex.tex
index df66ee094..afd60c2fa 100644
--- a/tex/context/base/math-tex.tex
+++ b/tex/context/base/math-tex.tex
@@ -15,9 +15,10 @@
\mathcode`\ ="8000 \mathcode`\_="8000 \mathcode`\'="8000
-\definefamilysynonym [default] [lcgreek] [mi]
-\definefamilysynonym [default] [ucgreek] [mr]
-\definefamilysynonym [default] [vargreek] [mi]
+\definefamilysynonym [default] [lcgreek] [mi]
+\definefamilysynonym [default] [ucgreek] [mr]
+\definefamilysynonym [default] [vargreek] [mi]
+\definefamilysynonym [default] [blackboard] [mr]
\startmathcollection [default]
@@ -35,6 +36,7 @@
\definemathsymbol [mu] [nothing] [lcgreek] ["16]
\definemathsymbol [nu] [nothing] [lcgreek] ["17]
\definemathsymbol [xi] [nothing] [lcgreek] ["18]
+\definemathsymbol [omicron] [nothing] [lcgreek] ["6F]
\definemathsymbol [pi] [nothing] [lcgreek] ["19]
\definemathsymbol [rho] [nothing] [lcgreek] ["1A]
\definemathsymbol [sigma] [nothing] [lcgreek] ["1B]
@@ -74,6 +76,7 @@
\definemathsymbol [Mu] [alpha] [ucgreek] ["4D] % M
\definemathsymbol [Nu] [alpha] [ucgreek] ["4E] % N
\definemathsymbol [Xi] [alpha] [ucgreek] ["04]
+\definemathsymbol [Omicron] [alpha] [ucgreek] ["4F] % O
\definemathsymbol [Pi] [alpha] [ucgreek] ["05]
\definemathsymbol [Rho] [alpha] [ucgreek] ["52] % R
\definemathsymbol [Sigma] [alpha] [ucgreek] ["06]
@@ -481,6 +484,8 @@
\definemathcommand [r@@t] {\PLAINroot}
\definemathcommand [matrix] {\PLAINmatrix}
+\definemathcommand [over] {\normalover} % hack, to do
+
\stoprawmathcollection
\def\{{\lbrace}
diff --git a/tex/context/base/meta-fig.tex b/tex/context/base/meta-fig.tex
index 8cb9c6365..e86d4f913 100644
--- a/tex/context/base/meta-fig.tex
+++ b/tex/context/base/meta-fig.tex
@@ -56,12 +56,12 @@
% {\localframed[\??mp][#1]{\startMPcode#2\stopMPcode}}
% \edef\MPwd{\the\wd\scratchbox}
% \edef\MPht{\the\ht\scratchbox}
-% \definieerpapierformaat
+% \definepapersize
% [\s!dummy]
% [\c!breedte=\MPwd,
% \c!hoogte=\MPht]
% \startlocal % keep settings as local as can be
-% \stelpapierformaatin
+% \setuppapersize
% [\s!dummy][\s!dummy]
% \stellayoutin
% [\c!breedte=\MPwd,\c!hoogte=\MPht,
@@ -69,9 +69,9 @@
% \c!snijwit=\!!zeropoint,\c!bodemwit=\!!zeropoint,
% \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]
% \stoplocal % which saves us the trouble of push/pop
-% \getvalue{\e!start\v!standaard\e!opmaak}%
+% \startmakeup[\v!standaard]%
% \centerbox{\box\scratchbox}%
-% \getvalue{\e!stop\v!standaard\e!opmaak}%
+% \stopmakeup
% \egroup}
%
% \setupMPpage
@@ -96,12 +96,12 @@
{\egroup\egroup\egroup
\edef\fittingwd{\the\wd\scratchbox}
\edef\fittinght{\the\ht\scratchbox}
- \definieerpapierformaat
+ \definepapersize
[\s!dummy]
[\c!breedte=\fittingwd,
\c!hoogte=\fittinght]
\startlocal % keep settings as local as can be
- \stelpapierformaatin
+ \setuppapersize
[\s!dummy][\s!dummy]
\stellayoutin
[\c!breedte=\fittingwd,\c!hoogte=\fittinght,\c!plaats=\v!midden,
@@ -109,9 +109,9 @@
\c!snijwit=\!!zeropoint,\c!bodemwit=\!!zeropoint,
\c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]
\stoplocal % which saves us the trouble of push/pop
- \getvalue{\e!start\v!standaard\e!opmaak}%
+ \startmakeup[\v!standaard]%
\centerbox{\box\scratchbox}%
- \getvalue{\e!stop\v!standaard\e!opmaak}%
+ \stopmakeup
\egroup}
% MP pages
diff --git a/tex/context/base/meta-ini.tex b/tex/context/base/meta-ini.tex
index 3b7050659..d635571ee 100644
--- a/tex/context/base/meta-ini.tex
+++ b/tex/context/base/meta-ini.tex
@@ -79,6 +79,10 @@
graphictextdirective "\the\everyMPTEXgraphic" ;
\to \MPinitializations
+%D Some safeguards:
+
+\appendtoks \let\handlecompoundcharacter\string \to \everyMPgraphic
+
%D We save the number of graphics for the sake of \TEXEXEC.
\newcounter\totalnumberofMPgraphics
@@ -282,10 +286,12 @@
\def\doprepareMPvariable#1%
{\doifelsenothing{\getvalue{#1}}
{\setevalue{#1}{\MPcolor{black}}}
- {\doifcolorelse{\getvalue{#1}}
+ {\edef\!!stringa{\getvalue{#1}}%
+ \convertcommand\!!stringa\to\ascii % otherwise problems
+ \doifcolorelse{\ascii} % with 2\bodyfontsize
{\setevalue{#1}{\MPcolor{\getvalue{#1}}}}
{\setbox\scratchbox=\hbox{\scratchdimen=\getvalue{#1}sp}%
- \ifdim\wd\scratchbox=\!!zeropoint
+ \ifdim\wd\scratchbox=\zeropoint
\scratchcounter=\getvalue{#1}\relax
\setevalue{#1}{\the\scratchcounter}%
\else
@@ -329,7 +335,9 @@
%D The current data is loaded with:
\def\getMPdata%
- {\readlocfile{\MPdatafile}{}{}}
+ {\startreadingfile
+ \readlocfile{\MPdatafile}{}{}%
+ \stopreadingfile}
%D When we collect graphics in one file, we run into
%D troubles, since \METAPOST\ has a built in limit (of 4)
@@ -339,7 +347,9 @@
\def\getMPdata%
{\long\def\MPdata##1##2%
{\ifnum##1=\currentMPgraphic\relax##2\fi}%
- \readlocfile{\MPgraphicfile.mpd}{}{}}
+ \startreadingfile
+ \readlocfile{\MPgraphicfile.mpd}{}{}%
+ \stopreadingfile}
%D We have to enable this mechanism with:
@@ -385,7 +395,9 @@
{\dodoubleempty\dostartMPenvironment} % that reset gives \emptytoks
\long\def\dostartMPenvironment[#1][#2]#3\stopMPenvironment%
- {\doif{#1}{\s!reset}{\resetMPenvironment}%
+ {\doif{#1}{\s!reset}{\resetMPenvironment}% % reset mp toks
+ \doif{#1}{\v!globaal}{#3}% % use in main doc too
+ \doif{#1}{+}{#3}% % use in main doc too
\convertargument#3\to\ascii
\expandafter\appendtoks\ascii\to\everyMPTEXgraphic}
diff --git a/tex/context/base/meta-pag.tex b/tex/context/base/meta-pag.tex
index c51ff0e0b..b94a5b1db 100644
--- a/tex/context/base/meta-pag.tex
+++ b/tex/context/base/meta-pag.tex
@@ -30,36 +30,36 @@
boolean PageStateAvailable ; PageStateAvailable := true ;
boolean OnRightPage ; OnRightPage := true ;
def LoadPageState =
- OnRightPage := \MPonrightpage ;
- PageNumber := \realfolio ;
- PaperHeight := \the\papierhoogte ;
- PaperWidth := \the\papierbreedte ;
- PrintPaperHeight := \the\printpapierhoogte ;
- PrintPaperWidth := \the\printpapierbreedte ;
- TopSpace := \the\kopwit ;
- BackSpace := \the\rugwit ;
- MakeupHeight := \the\zethoogte ;
- MakeupWidth := \the\zetbreedte ;
- TopHeight := \the\bovenhoogte ;
- TopDistance := \bovenafstand ;
- HeaderHeight := \the\hoofdhoogte ;
- HeaderDistance := \hoofdafstand ;
- TextHeight := \the\teksthoogte ;
- FooterDistance := \voetafstand ;
- FooterHeight := \the\voethoogte ;
- BottomDistance := \onderafstand ;
- BottomHeight := \the\onderhoogte ;
- LeftEdgeWidth := \the\linkerrandbreedte ;
- LeftEdgeDistance := \linkerrandafstand ;
- LeftMarginWidth := \the\linkermargebreedte ;
- LeftMarginDistance := \linkermargeafstand ;
- TextWidth := \the\tekstbreedte ;
- RightMarginDistance := \rechtermargeafstand ;
- RightMarginWidth := \the\rechtermargebreedte ;
- RightEdgeDistance := \rechterrandafstand ;
- RightEdgeWidth := \the\rechterrandbreedte ;
- PageOffset := \MPpageoffset ;
- PageDepth := \MPpagedepth ;
+ OnRightPage := \MPonrightpage ;
+ PageNumber := \realfolio ;
+ PaperHeight := \the\papierhoogte ;
+ PaperWidth := \the\papierbreedte ;
+ PrintPaperHeight := \the\printpapierhoogte ;
+ PrintPaperWidth := \the\printpapierbreedte ;
+ TopSpace := \the\kopwit ;
+ BackSpace := \the\rugwit ;
+ MakeupHeight := \the\zethoogte ;
+ MakeupWidth := \the\zetbreedte ;
+ TopHeight := \the\bovenhoogte ;
+ TopDistance := \@the\bovenafstand ;
+ HeaderHeight := \the\hoofdhoogte ;
+ HeaderDistance := \@the\hoofdafstand ;
+ TextHeight := \the\teksthoogte ;
+ FooterDistance := \@the\voetafstand ;
+ FooterHeight := \the\voethoogte ;
+ BottomDistance := \@the\onderafstand ;
+ BottomHeight := \the\onderhoogte ;
+ LeftEdgeWidth := \the\linkerrandbreedte ;
+ LeftEdgeDistance := \@the\linkerrandafstand ;
+ LeftMarginWidth := \the\linkermargebreedte ;
+ LeftMarginDistance := \@the\linkermargeafstand ;
+ TextWidth := \the\tekstbreedte ;
+ RightMarginDistance := \@the\rechtermargeafstand ;
+ RightMarginWidth := \the\rechtermargebreedte ;
+ RightEdgeDistance := \@the\rechterrandafstand ;
+ RightEdgeWidth := \the\rechterrandbreedte ;
+ PageOffset := \MPpageoffset ;
+ PageDepth := \MPpagedepth ;
enddef ;
\stopuseMPgraphic
@@ -82,15 +82,23 @@
\def\MPonrightpage{false}%
\od}
-\def\freezeMPlayout% must be done more efficient
- {\freezedimenmacro\bovenafstand
- \freezedimenmacro\hoofdafstand
- \freezedimenmacro\voetafstand
- \freezedimenmacro\onderafstand
- \freezedimenmacro\linkerrandafstand
- \freezedimenmacro\linkermargeafstand
- \freezedimenmacro\rechtermargeafstand
- \freezedimenmacro\rechterrandafstand}
+\iffixedlayoutdimensions
+
+ \let\freezeMPlayout\relax
+
+\else
+
+ \def\freezeMPlayout% must be done more efficient
+ {\freezedimenmacro\bovenafstand
+ \freezedimenmacro\hoofdafstand
+ \freezedimenmacro\voetafstand
+ \freezedimenmacro\onderafstand
+ \freezedimenmacro\linkerrandafstand
+ \freezedimenmacro\linkermargeafstand
+ \freezedimenmacro\rechtermargeafstand
+ \freezedimenmacro\rechterrandafstand}
+
+\fi
%D We need to freeze the pagelayout before the backgrounds
%D are build, because the overlay will temporarily become
diff --git a/tex/context/base/meta-txt.tex b/tex/context/base/meta-txt.tex
index 2c93147cc..87605556d 100644
--- a/tex/context/base/meta-txt.tex
+++ b/tex/context/base/meta-txt.tex
@@ -11,7 +11,16 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D In this library some handy text manipulations are defined
+%D In this library some handy text manipulations are
+%D defined. Some can and will be improved as soon as the
+%D \TEX||\METAPOST\ interface is stable. Some of the
+%D solutions may look weird, which is entirely my fault,
+%D since I implemented them in the process of getting grip
+%D on this kind of manipulations. Undoubtly better
+%D \METAPOST\ code is possible, but my way of learning
+%D this kind of trickery happens to be by \quote {trial
+%D and error} and \quote {look and feel} (as well as
+%D identifying tricks in Hobby's code).
\unprotect
diff --git a/tex/context/base/mult-com.tex b/tex/context/base/mult-com.tex
index 54467f75e..d04ad2059 100644
--- a/tex/context/base/mult-com.tex
+++ b/tex/context/base/mult-com.tex
@@ -22,18 +22,19 @@
%D
%D The German translations were provided by Tobias Burnus,
%D the Czech ones by Tom Hudec, and the Italian ones
-%D by Giuseppe Bilottta. Here we include their comments.
+%D by Giuseppe Bilotta. Here we include their comments.
-%D Giuseppe Bilottta: \citaat {Having to choose between a
-%D full-length name and a shortcut, I decided to resort to the
-%D latter, especially in the case of commonly used commands,
-%D or when shortened commands become too short. This led to
-%D one inconsistency: footer (pi di pagina in Italian) became
-%D piedipagina as a standalone term, but is commonly shortened
-%D to pdp. Setupfooter becomes impostapdp, and so for all
-%D composed words: footnote (nota a pi di pagina) becomes
-%D notapdp; footnotetext (testo della nota a pi di pagina)
-%D becomes testonotapdp; and so on.}
+%D Giuseppe Bilotta: \citaat {Having to choose between a
+%D full|-|length name and a shortcut, I decided to resort to the
+%D latter, especially in the case of commonly used commands, or
+%D when shortened commands become too short. This led to one
+%D inconsistency: \tex{footer} (pi\`e di pagina in Italian) became
+%D \tex{piedipagina} as a standalone term, but is commonly
+%D shortened to \typ{-pdp}. \tex{setupfooter} becomes
+%D \tex{impostapdp}, and so for all composed words: \tex{footnote}
+%D (nota a pi\`e di pagina) becomes \tex{notapdp};
+%D \tex{footnotetext} (testo della nota a pi\`e di pagina) becomes
+%D \tex{testonotapdp}; and so on.}
\writestatus{loading}{Context Multilingual Macros / Commands}
@@ -65,7 +66,7 @@
traduci traduce
installlanguage: installeertaal installlanguage
installieresprache instalacejazyka
- linguainstallazione instalarelimba
+ installalingua instalarelimba
setuplanguage: steltaalin setuplanguage
stellespracheein nastavjazyk
impostalingua setarelimba
@@ -218,7 +219,7 @@
lettere litere
Characters: Letters Characters
Buchstaben Znaky
- Lettera Litere
+ Lettere Litere
unknown: onbekend unknown
unbekant neznamo
ignoto necunoscut
@@ -254,7 +255,7 @@
impostamaiuscole seteazamajuscule
kap: kap kap
kap kap
- kap kap
+ cap kap
KAP: KAP CAP
KAP KAP
CAP KAP
@@ -293,13 +294,13 @@
sopralinea barasus
overbars: overstrepen overbars
ueberstreichen nadtrzeni
- sopralineas supralinie
+ sopralinee supralinie
underbar: onderstreep underbar
unterstrichen podtrzeno
sottolinea sublinie
underbars: onderstrepen underbars
unterstreichen podtrzeni
- sottolineas sublinii
+ sottolinee sublinii
setupunderbar: stelonderstrepenin setupunderbar
stelleunterstreichenein nastavpodtrzeni
impostasottolinea seteazasublinie
@@ -512,7 +513,7 @@
impostarigovuoto seteazablanc
corrigeerwitruimte: corrigeerwitruimte correctwhitespace
korrigierezwischenraum korekcebilehomista
- correggiwhitespace corecteazaspatiualb
+ correggispaziobianco corecteazaspatiualb
fixedspaces: vastespaties fixedspaces
festesspatium tvrdemezery
spazifissi spatiifixate
@@ -527,7 +528,7 @@
spazio spatiu
geenwitruimte: geenwitruimte nowhitespace
keinzwischenraum zadnebilemisto
- nientewhitespace faraspatiualb
+ nientespaziobianco faraspatiualb
opelkaar: opelkaar packed
kleinerdurchschuss zhustene
impaccato impachetat
@@ -554,7 +555,7 @@
vaigiu injos
witruimte: witruimte whitespace
zwischenraum bilemisto
- whitespace spatiualb
+ spaziobianco spatiualb
nietinspringen: nietinspringen noindenting
nichteinziehen zadneodsazovani
nienterientro faraaliniat
@@ -617,10 +618,10 @@
impostapiustretto seteazaingust
definetabulate: definieertabulatie definetabulate
definieretabulator definujtabelaci
- definiscitabulate definestetabulatori
+ definiscitabulato definestetabulatori
setuptabulate: steltabulatiein setuptabulate
stelletabulatorein nastavtabelaci
- impostatabulate seteazatabulatori
+ impostatabulato seteazatabulatori
starttabel: starttabel starttable
starttabelle starttabulka
iniziatabella starttabel
@@ -672,37 +673,37 @@
stelsectiein: stelsectiein setupsection
stelleabschnittein nastavsekci
impostasezione seteazasectiune
- geenbovenenonderregels: geenbovenenonderregels notopandbottomlines
+ notopandbottomlines: geenbovenenonderregels notopandbottomlines
keinzeilenobenundunten zadnehorniadolniradky
nientelineecimafondo faraliniisussijos
- geenhoofdenvoetregels: geenhoofdenvoetregels noheaderandfooterlines
+ noheaderandfooterlines: geenhoofdenvoetregels noheaderandfooterlines
keinekopfundfusszeilen zadnezahlaviaupati
nientelineintestazionepdp faraliniiantetsisubsol
- stelbovenin: stelbovenin setuptop
+ setuptop: stelbovenin setuptop
stellenobenein nastavhorejsek
impostacima seteazasus
- stelboventekstenin: stelboventekstenin setuptoptexts
+ setuptoptexts: stelboventekstenin setuptoptexts
stelletextobenein nastavhornitexty
impostatesticima seteazatextesus
- stelhoofdin: stelhoofdin setupheader
+ setupheader: stelhoofdin setupheader
stellekopfzeileein nastavzahlavi
impostainstestazione seteazaantet
- stelhoofdtekstenin: stelhoofdtekstenin setupheadertexts
+ setupheadertexts: stelhoofdtekstenin setupheadertexts
stellekopfzeilentextein nastavtextyzahlavi
impostatestiintestazioni seteazatexteantet
stelnummeringin: stelnummeringin setuppagenumbering
stelleseitennummeriernungein nastavcislovanistran
impostanumerazionepagina seteazanumerotarepagina
- stelonderin: stelonderin setupbottom
+ setupbottom: stelonderin setupbottom
stelleuntenein nastavspodek
impostafondo seteazajos
- stelondertekstenin: stelondertekstenin setupbottomtexts
+ setupbottomtexts: stelondertekstenin setupbottomtexts
stelletextuntenein nastavdolnitexty
impostatestifondo seteazatextejos
- stelvoetin: stelvoetin setupfooter
+ setupfooter: stelvoetin setupfooter
stellefusszeileein nastavupati
impostapdp seteazasubsol
- stelvoettekstenin: stelvoettekstenin setupfootertexts
+ setupfootertexts: stelvoettekstenin setupfootertexts
stellefusszeilentextein nastavtextyupati
impostatestipdp seteazatextesubsol
stelpaginanummerin: stelpaginanummerin setuppagenumber
@@ -711,13 +712,13 @@
stelsubpaginanummerin: stelsubpaginanummerin setupsubpagenumber
stelleunterseitennummerein nastavpodcislostrany
impostanumerosottopagina seteazanumarsubpagina
- steltekstin: steltekstin setuptext
+ setuptext: steltekstin setuptext
stelletextein nastavtext
impostatesto seteazatext
- stelteksttekstenin: stelteksttekstenin setuptexttexts
+ setuptexttexts: stelteksttekstenin setuptexttexts
stelletexttexteein nastavtexttexty
impostatestotesti seteazatextetext
- definieertekst: definieertekst definetext
+ definetext: definieertekst definetext
definieretext definujtext
definiscitesto definestetext
pagenumber: paginanummer pagenumber
@@ -737,13 +738,13 @@
impostaelementi seteazaelemente
regellinks: regellinks leftaligned
linksbuendig zarovnanovlevo
- asinistra aliniatstanga % GB
+ allineasinistra aliniatstanga
regelmidden: regelmidden midaligned
zentriert zarovnanonastred
- alcentro aliniatcentru
+ allineacentro aliniatcentru
regelrechts: regelrechts rightaligned
rechtsbuendig zarovnanovpravo
- adestra aliniatdreapta
+ allineadestra aliniatdreapta
startkolommen: startkolommen startcolumns
startspalten startsloupce
iniziacolonne startcoloane
@@ -837,6 +838,9 @@
haalmarkering: haalmarkering getmarking
holebeschriftung ziskejznaceni
prendimarcatura adumarcaje % GB
+ definelayout: definieerlayout definelayout
+ definelayout definelayout
+ definiscilayout definelayout %%%
stellayoutin: stellayoutin setuplayout
stellelayoutein nastavvzhled
impostalayout seteazaaspect
@@ -852,40 +856,40 @@
verplaatsopgrid: verplaatsopgrid moveongrid
amgitterneuausrichten premistinamrizku
spostaagriglia mutapegrid
- tooninstellingen: tooninstellingen showsetups
+ showsetups: tooninstellingen showsetups
zeigeeinstellungen ukaznastaveni
mostraimpostazioni afiseazasetari
- toonkader: toonkader showframe
+ showframe: toonkader showframe
zeigerahmen ukazramecek
mostracornice afiseazarama
- toongrid: toongrid showgrid
+ showgrid: toongrid showgrid
zeigegitter ukazmrizku
mostragriglia afiseazagrid
- toonopbouw: toonopbouw showbuildup
- zeigeaufbau ukazstrukturu
- mostrabuildup afiseazabuildup
- toonlayout: toonlayout showlayout
+% toonopbouw: toonopbouw showbuildup
+% zeigeaufbau ukazstrukturu
+% mostrabuildup afiseazabuildup
+ showlayout: toonlayout showlayout
zeigelayout ukazvzhled
mostralyout afiseazaaspect
- toonprint: toonprint showprint
+ showprint: toonprint showprint
zeigedruck ukazvytisk
mostrastampa afiseazatiparire
toonstruts: toonstruts showstruts
zeigestruts ukazpodpery
mostrastruts afiseazastruts
- definieerpapierformaat: definieerpapierformaat definepapersize
+ definepapersize: definieerpapierformaat definepapersize
definierepapierformat definujvelikostpapiru
definiscidimensionicarta definestedimensiunehartie
- stelpapierformaatin: stelpapierformaatin setuppapersize
+ setuppapersize: stelpapierformaatin setuppapersize
stellepapierformatein nastavvelikostpapiru
impostadimensionicarta seteazadimensiunihartie
- stelarrangerenin: stelarrangerenin setuparranging
+ setuparranging: stelarrangerenin setuparranging
stelleanordnenein nastavusporadani
impostaparranging seteazaaranjareapag
versie: versie version
version verze
versione versiune
- stelachtergrondenin: stelachtergrondenin setupbackgrounds
+ setupbackgrounds: stelachtergrondenin setupbackgrounds
stellehintergruendeein nastavpozadi
impostasfondi seteazafundaluri
steluitlijnenin: steluitlijnenin setupalign
@@ -893,7 +897,7 @@
impostaallineamento seteazaalinierea
stelwitruimtein: stelwitruimtein setupwhitespace
stellezwischenraumein nastavbilamista
- impostawhitespace seteazaspatiualb
+ impostaspaziobianco seteazaspatiualb
setupinteraction: stelinteractiein setupinteraction
stelleinteraktionein nastavinterakci
impostainterazione seteazainteractiunea
@@ -924,10 +928,10 @@
bookmark: bookmark bookmark
bookmark zalozka
segnalibro semncarte
- definieerbeeldmerk: definieerbeeldmerk definelogo
+ definelogo: definieerbeeldmerk definelogo
definierelogo definujlogo
definiscilogo definestelogo
- plaatsbeeldmerken: plaatsbeeldmerken placelogos
+ placelogos: plaatsbeeldmerken placelogos
platzierelogo umistiloga
mettiloghi punelogouri
definecolor: definieerkleur definecolor
@@ -1353,7 +1357,7 @@
plaatssubformule: plaatssubformule placesubformula
platziereunterformel umistipodrovnici
mettisottoformula punesubformula
- stelformulesin: stelformulesin setupformulae
+ setupformulas: stelformulesin setupformulae
stelleformelnein nastavrovnice
impostaformule seteazaformule
formulenummer: formulenummer formulanumber
@@ -1482,16 +1486,16 @@
naam: naam name
name jmeno
nome nume
- definieeropmaak: definieeropmaak definemakeup
+ definemakeup: definieeropmaak definemakeup
definiereumbruch definujupravu
definiscimakeup definestemakeup % GB
- stelopmaakin: stelopmaakin setupmakeup
+ setupmakeup: stelopmaakin setupmakeup
stelleumbruchein nastavupravu
impostamakeup seteazamakeup
- startopmaak: startopmaak startmakeup
+ startmakeup: startopmaak startmakeup
startumbruch startuprava
iniziamakeup startmakeup
- stopopmaak: stopopmaak stopmakeup
+ stopmakeup: stopopmaak stopmakeup
stopumbruch stopuprava
terminamakeup stopmakeup
useexternalsoundtrack: gebruikexterngeluidsfragment useexternalsoundtrack
@@ -1533,16 +1537,16 @@
stelnaastplaatsenin: stelnaastplaatsenin setupoppositeplacing
stellegegenueberplatzierenein nastavumisteniprotejsku
impostaposizionamentoopposti seteazaplasareaopozita
- startpositioneren: startpositioneren startpositioning
+ startpositioning: startpositioneren startpositioning
startpositionieren startumistovani
iniziaposizionamento startpozitionare
- stoppositioneren: stoppositioneren stoppositioning
+ stoppositioning: stoppositioneren stoppositioning
stoppositionieren stopumistovani
terminaposizionamento stoppozitionare
- positioneer: positioneer position
+ position: positioneer position
position pozice
posizione pozitie
- stelpositionerenin: stelpositionerenin setuppositioning
+ setuppositioning: stelpositionerenin setuppositioning
stellepositionierenein nastavumistovani
impostaposizionamento setarepozitie
roteer: roteer rotate
diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex
index 490e65a95..68367053d 100644
--- a/tex/context/base/mult-con.tex
+++ b/tex/context/base/mult-con.tex
@@ -146,7 +146,7 @@
%D \stopcompressdefinitions
%D User defined commands are language specific, so we have to
-%D use variable when defining them. First we define some
+%D use variables when defining them. First we define some
%D general structuring variables:
%D \startcompressdefinitions
@@ -224,7 +224,7 @@
typing typing % GB
file: file file
datei soubor
- file fisier % GB
+ file fisier
\stopvariables
@@ -523,6 +523,9 @@
file: file file
datei soubor
file fisier
+ inputfile: inputfile inputfile
+ inputfile inputfile
+ inputfile inputfile % !!
formaat: formaat size
groesse velikost
dimensione dimensiune
@@ -1423,6 +1426,9 @@
groot: groot big
gross velke
grande mare
+ grootkorps: grootkorps bigbodyfont
+ bigbodyfont bigbodyfont
+ grossofontdeltesto bigbodyfont %%
grotevoorkeur: grotevoorkeur bigpreference
grosszuegig vysokapriorita
grandepreferenza preferintamare
@@ -1537,6 +1543,9 @@
kleinvetitalic: kleinvetitalic smallbolditalic
kleinfettitalic maletucnekurzivni
piccolograssettocorsivo micaldininclinat
+ kleinkorps: kleinkorps smallbodyfont
+ smallbodyfont smallbodyfont
+ piccolofontdelcorpo smallbodyfont %%
kleur: kleur color
farbe barevne
colore culoare
@@ -1675,9 +1684,9 @@
vanelkaar: vanelkaar unpacked
ungepackt rozbalene
unpacked despachetat
- opmaak: opmaak markup
+ opmaak: opmaak makeup
umbruch zlom
- markup marcaj
+ makeup marcaj
opmarge: opmarge atmargin
amrand naokraji
almargine lamargine
@@ -1695,10 +1704,10 @@
carta foaie
scherm: scherm display
bildschirm obrazovka
- display display % new
+ schermo display % new
omgekeerd: omgekeerd reverse
reverse reverse
- reverse reverse % new
+ invertito reverse % new
passend: passend fit
passend prizpusobive
adatta ajustat
@@ -2004,7 +2013,7 @@
afgebroken: afgebroken hyphenated
hyphenate hyphenated
sillabato despsilabe
- nietafgebroken: afgebroken nothyphenated
+ nietafgebroken: nietafgebroken nothyphenated
nothyphenated nothyphenated
nonsillabato nedespsilabe
diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex
index 0494b45d4..046ffe2db 100644
--- a/tex/context/base/mult-sys.tex
+++ b/tex/context/base/mult-sys.tex
@@ -318,6 +318,8 @@
\def\!!twelvepoint {12pt}
\def\!!fourteenpointfour {14.4pt}
+\ifx\z@\undefined \newdimen\zeropoint \else \let\zeropoint\z@ \fi
+
%D Variables are composed of a command specific tag and a user
%D supplied variable (system constant). The first tag \type{ag}
%D for instance is available as \type{\??ag} and expands to
@@ -456,6 +458,7 @@
\definesystemvariable {sy} % SYnchronisatie
\definesystemvariable {ta} % TAb
\definesystemvariable {tb} % TekstBlokken
+\definesystemvariable {td} % TextbackgrounDs
\definesystemvariable {te} % TEmplate
\definesystemvariable {tf} % TypeFace
\definesystemvariable {tg} % Tex paGe
@@ -578,6 +581,7 @@
\definefileconstant {styleprefix} {s-}
\definefileconstant {xstyleprefix} {x-}
\definefileconstant {privateprefix} {p-}
+\definefileconstant {thirdprefix} {t-}
%D \CONTEXT\ follows different strategies for finding files.
%D The macros that are responsible for this 'clever' searching
diff --git a/tex/context/base/page-bck.tex b/tex/context/base/page-bck.tex
new file mode 100644
index 000000000..5027d4ff2
--- /dev/null
+++ b/tex/context/base/page-bck.tex
@@ -0,0 +1,457 @@
+%D \module
+%D [ file=page-bck, % copied from main-001
+%D version=1997.03.31,
+%D title=\CONTEXT\ Page Macros,
+%D subtitle=Backgrounds,
+%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 (Backgrounds)}
+
+\unprotect
+
+\startmessages dutch library: layouts
+ 8: achtergronden berekenen
+\stopmessages
+
+\startmessages english library: layouts
+ 8: calculating backgrounds
+\stopmessages
+
+\startmessages german library: layouts
+ 8: berechne Hintergrund
+\stopmessages
+
+\startmessages czech library: layouts
+ 8: pocita se pozadi
+\stopmessages
+
+\startmessages italian library: layouts
+ 8: calcolo dello sfondo
+\stopmessages
+
+\startmessages norwegian library: layouts
+ 8: beregner bakgrunn
+\stopmessages
+
+\startmessages romanian library: layouts
+ 8: se calculeaza fundalurile
+\stopmessages
+
+%D \macros
+%D {recalculatebackgrounds}
+%D
+%D We use a couple of switches so that we can minimize the
+%D amount of background calculations. The main switch is set
+%D by the recalculate directive.
+%D
+%D \starttypen
+%D \recalculatebackgrounds
+%D \stoptypen
+%D
+%D Other modules may not directly set the switches
+%D themselves.
+
+\newif\ifnewbackground
+\newif\ifsomebackground
+
+\def\recalculatebackgrounds%
+ {\global\newbackgroundtrue}
+
+%D For special purposes, users can question the \type
+%D {*background} mode. This mode is only available when
+%D typesetting the pagebody.
+%D
+%D \starttypen
+%D \startmode[*background] ...
+%D \stoptypen
+
+\appendtoks
+ \ifnewbackground\enablemode[\systemmodeprefix\v!achtergrond]\fi
+\to \everypagebody
+
+%D \macros
+%D {addmainbackground, addtextbackground,
+%D addpagebackground, addprintbackground}
+%D
+%D Apart from the previously mentioned directive, the
+%D interface between this module and the other modules
+%D is made up by four macros that add background to parts of
+%D the layout.
+%D
+%D \starttypen
+%D \addmainbackground <box>
+%D \addtextbackground <box>
+%D \addpagebackground <box>
+%D \addprintbackground <box>
+%D \stoptypen
+
+%D To minimize calculations, we keep track of the state of the
+%D background of each area. A previous implementation did
+%D check each call to the background calculation macro, but
+%D using an intermediate usage flag instead of testing each
+%D time saves about 3\% on a run with a couple of backgrounds.
+%D (On the 824 pages maps bibliography runtime went down from
+%D 309 to 299 seconds.)
+
+\def\checkbackground#1%
+ {\edef\!!stringe{\??ma#1}%
+ \doifelsevaluenothing{\!!stringe\c!achtergrond }
+ {\doifelsevaluenothing{\!!stringe\c!voorgrondkleur}
+ {\doifelsevalue{\!!stringe\c!kader }\v!aan\!!doneatrue
+ {\doifelsevalue{\!!stringe\c!linkerkader }\v!aan\!!doneatrue
+ {\doifelsevalue{\!!stringe\c!rechterkader}\v!aan\!!doneatrue
+ {\doifelsevalue{\!!stringe\c!bovenkader }\v!aan\!!doneatrue
+ {\doifelsevalue{\!!stringe\c!onderkader }\v!aan\!!doneatrue
+ \!!doneafalse}}}}}
+ \!!doneatrue}
+ \!!doneatrue
+ \if!!donea
+ \expandafter\setusage\else\expandafter\resetusage
+ \fi{\??ma#1}}
+
+\def\ifsomebackgroundfound#1%
+ {\ifusage{\??ma#1}}
+
+\def\doifsomebackgroundelse#1#2#3%
+ {\ifusage{\??ma#1}#2\else#3\fi}
+
+%D The background mechanism falls back on the \type {\framed}
+%D macro. This means that all normal frame and overlay
+%D features can be used.
+
+\def\addsomebackground#1#2#3#4% area box width height / zero test added
+ {\ifdim#3>\zeropoint\ifdim#4>\zeropoint\ifsomebackgroundfound{#1}%
+ \setbox#2=\vbox\localframed
+ [\??ma#1]
+ [\c!strut=\v!nee,\c!offset=\v!overlay,
+ \c!breedte=#3,\c!hoogte=#4]
+ {\dp#2=\zeropoint\box#2}%
+%{\offinterlineskip\smashbox#2\box#2\endgraf
+% \getvalue{\??ma#1\c!commando}}%
+ \fi\fi\fi}
+
+%D There are quite some backgrounds. At the bottom layer,
+%D there is the {\em paper} background. This one is only
+%D used for special purposes, like annotations to documents.
+
+\def\addprintbackground#1%
+ {\addsomebackground
+ \v!papier{#1}\printpapierbreedte\printpapierhoogte}
+
+%D The page backgrounds can be put behind the {\em left
+%D page}, the {\em right page} or {\em each page}. As with
+%D the paper background, these are calculated on each page.
+
+\def\addpagebackground#1%
+ {\doifbothsidesoverruled
+ \addsomebackground\v!rechterpagina{#1}\papierbreedte\papierhoogte
+ \orsideone
+ \addsomebackground\v!rechterpagina{#1}\papierbreedte\papierhoogte
+ \orsidetwo
+ \addsomebackground\v!linkerpagina {#1}\papierbreedte\papierhoogte
+ \od
+ \addsomebackground\v!pagina{#1}\papierbreedte\papierhoogte}
+
+%D Then there are the 25 areas that make up the layout: {\em
+%D top, header, text, footer, bottom} times {\em left edge,
+%D left margin, text, right margin, right edge}. These are
+%D only recalculated when they change or when the \type
+%D {status} is set to \type {repeat}.
+
+\newbox\leftbackground
+\newbox\rightbackground
+
+\def\addmainbackground#1% todo: dimension spec
+ {\ifsomebackground
+ \ifnewbackground \setbackgroundboxes \fi
+ \setbox#1=\vbox
+ {\offinterlineskip
+ \doifmarginswapelse
+ {\copy\leftbackground}
+ {\copy\rightbackground}
+ \box#1}%
+ \fi}
+
+%D Finaly there is an aditional {\em text} background, again
+%D useful for special purposes only. This one is calculated
+%D each time.
+
+\def\addtextbackground#1%
+ {\addsomebackground\v!tekst{#1}\zetbreedte\teksthoogte}
+
+%D The next couple of macros implement the area backgrounds.
+%D As said, these are cached in dedicated boxes. The offsets
+%D and depth of the page are used for alignment purposes.
+
+\let\pagebackgroundhoffset = \!!zeropoint
+\let\pagebackgroundvoffset = \!!zeropoint
+\let\pagebackgrounddepth = \!!zeropoint
+
+\def\setbackgroundboxes%
+ {\showmessage{\m!layouts}{8}\empty
+ \setbackgroundbox\leftbackground\relax
+ \ifdubbelzijdig
+ \setbackgroundbox\rightbackground\doswapmargins
+ \fi
+ \doifnot{\@@mastatus}{\v!herhaal}{\global\newbackgroundfalse}%
+ \global\let\pagebackgroundhoffset=\!!zeropoint
+ \global\let\pagebackgroundvoffset=\!!zeropoint
+ \global\let\pagebackgrounddepth =\!!zeropoint
+ \doifsomebackgroundelse{\v!tekst\v!tekst}
+ {\bgroup
+ \scratchdimen=\getvalue{\??ma\v!pagina\c!offset}%
+ \doifsomebackgroundelse{\v!boven\v!tekst}\donothing
+ {\doifsomebackgroundelse{\v!onder\v!tekst}\donothing
+ {\xdef\pagebackgroundhoffset{\the\scratchdimen}}}%
+ \doifsomebackgroundelse{\v!tekst\v!rechterrand}\donothing
+ {\doifsomebackgroundelse{\v!tekst\v!linkerrand}\donothing
+ {\xdef\pagebackgroundvoffset{\the\scratchdimen}%
+ \scratchdimen=\getvalue{\??ma\v!pagina\c!diepte}%
+ \xdef\pagebackgrounddepth{\the\scratchdimen}}}%
+ \egroup}\donothing}
+
+\def\setbackgroundbox#1#2%
+ {\global\setbox#1=\vbox
+ {\dontcomplain
+ \calculatereducedvsizes
+ \offinterlineskip
+ #2\relax
+ \vskip-\bovenhoogte
+ \vskip-\bovenafstand
+ \dodopagebodybackground\v!boven\bovenhoogte
+ \vskip\bovenafstand
+ \dodopagebodybackground\v!hoofd\hoofdhoogte
+ \vskip\hoofdafstand
+ \dodopagebodybackground\v!tekst\teksthoogte
+ \vskip\voetafstand
+ \dodopagebodybackground\v!voet\voethoogte
+ \vskip\onderafstand
+ \dodopagebodybackground\v!onder\onderhoogte
+ \vfilll}%
+ \smashbox#1}
+
+\def\dodopagebodybackground#1#2%
+ {\ifdim#2>\zeropoint % added, faster
+ \setbox\scratchbox=\vbox to #2
+ \bgroup\hbox\bgroup
+ \swapmargins
+ \goleftonpage
+ \dododopagebodybackground\linkerrandbreedte #2#1\v!linkerrand
+ \hskip\linkerrandafstand
+ \dododopagebodybackground\linkermargebreedte #2#1\v!linkermarge
+ \hskip\linkermargeafstand
+ \dododopagebodybackground\zetbreedte #2#1\v!tekst
+ \hskip\rechtermargeafstand
+ \dododopagebodybackground\rechtermargebreedte#2#1\v!rechtermarge
+ \hskip\rechterrandafstand
+ \dododopagebodybackground\rechterrandbreedte #2#1\v!rechterrand
+ \egroup\egroup
+ \wd\scratchbox=\zeropoint
+ \box\scratchbox\relax
+ \fi}
+
+\def\dododopagebodybackground#1#2#3#4% width height pos pos
+ {\ifsomebackgroundfound{#3#4}%
+ \ifdim#2>\zeropoint\relax
+ \ifdim#1>\zeropoint\relax
+ \localframed
+ [\??ma#3#4]
+ [\c!breedte=#1,\c!hoogte=#2,\c!offset=\v!overlay]
+ {\getvalue{\??ma#3#4\c!commando}}% {\hsize=#1\vsize=#2....}
+ \else
+ \hskip#1%
+ \fi
+ \else
+ \hskip#1%
+ \fi
+ \else
+ \hskip#1%
+ \fi}
+
+%D The background mechanism is quite demanding in terms or
+%D resources. We used to delay these definitions till runtime
+%D usage, but since today's \TEX's are large, we now do the
+%D work on forehand.
+%D
+%D \starttypen
+%D \setupbackgrounds [settings]
+%D \setupbackgrounds [paper,page,text,..] [settings]
+%D \setupbackgrounds [top,...] [leftedge,...] [settings]
+%D \stoptypen
+%D
+%D \showsetup{\y!setupbackgrounds}
+%D
+%D Because the number of arguments runs from one to three,
+%D we need to check for it.
+
+\def\setupbackgrounds%
+ {\dotripleempty\dosetupbackgrounds}
+
+\def\dosetupbackgrounds[#1][#2][#3]%
+ {\ifthirdargument
+ \global\somebackgroundtrue
+ \def\docommando##1%
+ {\doifinsetelse{##1}{\v!papier,\v!pagina,\v!linkerpagina,\v!rechterpagina}
+ {\getparameters[\??ma##1][#3]\checkbackground{##1}}
+ {\def\dodocommando####1%
+ {\getparameters[\??ma##1####1][#3]\checkbackground{##1####1}}%
+ \processcommalist[#2]\dodocommando}}%
+ \processcommalist[#1]\docommando
+ \else\ifsecondargument
+ \global\somebackgroundtrue
+ \doifcommonelse{#1}{\v!tekst,\v!papier,\v!pagina,\v!linkerpagina,\v!rechterpagina}
+ {\def\docommando##1%
+ {\getparameters[\??ma##1][#2]\checkbackground{##1}}%
+ \processcommalist[#1]\docommando}%
+ {\setupbackgrounds
+ [#1]%
+ [\v!linkerrand,\v!linkermarge,\v!tekst,\v!rechtermarge,\v!rechterrand]%
+ [#2]}%
+ \else\iffirstargument
+ \getparameters[\??ma][#1]%
+ \fi\fi\fi
+ \doifelse{\@@mastatus}{\v!stop}
+ {\global\newbackgroundfalse}
+ {\global\newbackgroundtrue}}
+
+%D Each areas (currently there are $1+3+25+1=30$ of them)
+%D has its own low level framed object associated.
+
+\presetlocalframed [\??ma\v!papier]
+\presetlocalframed [\??ma\v!pagina]
+\presetlocalframed [\??ma\v!linkerpagina]
+\presetlocalframed [\??ma\v!rechterpagina]
+
+\copyparameters
+ [\??ma\v!papier\c!kader][\??ma\v!pagina]
+ [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
+
+\copyparameters
+ [\??ma\v!papier\c!achtergrond][\??ma\v!pagina]
+ [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
+
+\copyparameters
+ [\??ma\v!pagina\c!kader][\??ma\v!pagina]
+ [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
+
+\copyparameters
+ [\??ma\v!pagina\c!achtergrond][\??ma\v!pagina]
+ [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
+
+\copyparameters
+ [\??ma\v!linkerpagina\c!kader][\??ma\v!linkerpagina]
+ [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
+
+\copyparameters
+ [\??ma\v!linkerpagina\c!achtergrond][\??ma\v!linkerpagina]
+ [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
+
+\copyparameters
+ [\??ma\v!rechterpagina\c!kader][\??ma\v!rechterpagina]
+ [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
+
+\copyparameters
+ [\??ma\v!rechterpagina\c!achtergrond][\??ma\v!rechterpagina]
+ [\c!offset,\c!diepte,\c!straal,\c!hoek,\c!kleur,\c!raster]
+
+%D We save some keying by defining the areas using
+%D intermediate commands. The inheritance macro makes sure
+%D that copies are efficient.
+
+\def\dodocommando#1#2%
+ {\copylocalframed
+ [\??ma#1#2][\??ma\v!pagina]%
+ \getparameters
+ [\??ma#1#2]
+ [\c!achtergrond=,\c!kader=,\c!kleur=,\c!raster=\@@rsraster,
+ \c!onderkader=,\c!bovenkader=,\c!linkerkader=,\c!rechterkader=]%
+ \inheritparameter[\??ma][#1#2\c!kleur][\v!pagina\c!kleur]%
+ \inheritparameter[\??ma][#1#2\c!raster][\v!pagina\c!raster]%
+ \inheritparameter[\??ma][#1#2\c!kaderkleur][\v!pagina\c!kaderkleur]%
+ \inheritparameter[\??ma][#1#2\c!achtergrondkleur][\v!pagina\c!achtergrondkleur]%
+ \inheritparameter[\??ma][#1#2\c!achtergrondraster][\v!pagina\c!achtergrondraster]}
+
+%D The stand alone text area inherits from the page too.
+
+\dodocommando\v!tekst\empty
+
+%D We now define all 25 areas in a row.
+
+\def\docommando#1%
+ {\dodocommando#1\v!linkerrand
+ \dodocommando#1\v!linkermarge
+ \dodocommando#1\v!tekst
+ \dodocommando#1\v!rechtermarge
+ \dodocommando#1\v!rechterrand}
+
+\docommando\v!boven
+\docommando\v!hoofd
+\docommando\v!tekst
+\docommando\v!voet
+\docommando\v!onder
+
+%D We need some cleanup now.
+
+\let\dodocommando\relax \let\docommando\relax
+
+%D We now set up the individual areas to use reasonable
+%D defaults.
+
+\setupbackgrounds
+ [\c!status=\c!start]
+
+\setupbackgrounds
+ [\v!papier,\v!pagina,\v!linkerpagina,\v!rechterpagina]
+ [\c!kader=\v!uit,
+ \c!straal=.5\korpsgrootte,
+ \c!hoek=\v!recht,
+ \c!achtergrond=,
+ \c!raster=\@@rsraster,
+ \c!kleur=,
+ %\c!kaderoffset=\getvalue{\??ma\v!pagina\c!offset},
+ %\c!achtergrondoffset=\getvalue{\??ma\v!pagina\c!offset},
+ \c!offset=\!!zeropoint, % later set to \v!overlay, watch out !
+ \c!diepte=\!!zeropoint]
+
+\def\docommando#1%
+ {\inheritparameter[\??ma][#1\c!kaderoffset][\v!pagina\c!offset]%
+ \inheritparameter[\??ma][#1\c!achtergrondoffset][\v!pagina\c!offset]}
+
+\docommando\v!papier
+\docommando\v!pagina
+\docommando\v!linkerpagina
+\docommando\v!rechterpagina
+
+%D Again we clean up temporary macros.
+
+\let\docommando\relax
+
+%D Because we haven't really set up backgrounds yet, we set
+%D the main efficiency switch to false.
+
+\somebackgroundfalse
+
+\protect \endinput
+
+%D Removed \citeer {features}:
+%D
+%D \starttypen
+%D \startinteractie
+%D \doifmarginswapelse
+%D {\copy\leftbackground}
+%D {\copy\rightbackground}%
+%D \stopinteractie
+%D \stoptypen
+%D
+%D \starttypen
+%D \edef\setpagebackgrounddepth%
+%D {\dp#2=\the\dp#2}%
+%D \setbox#2=\vbox\localframed[\??ma#1]{...}
+%D \setpagebackgrounddepth
+%D \stoptypen
diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex
new file mode 100644
index 000000000..a400ffaa1
--- /dev/null
+++ b/tex/context/base/page-flt.tex
@@ -0,0 +1,1697 @@
+%D \module
+%D [ file=page-flt,
+%D version=2000.10.20,
+%D title=\CONTEXT\ OTR Macros,
+%D subtitle=Floating Bodies,
+%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 OTR Macros / Floating Bodies}
+
+\unprotect
+
+% naar supp-box.tex
+
+\def\voidbox{\box\voidb@x}
+
+\def\spreadhbox#1% rebuilds \hbox{<box><hss><box><hss><box>}
+ {\bgroup
+ \ifhbox#1\relax
+ \setbox2=\voidbox
+ \unhbox#1%
+ \doloop
+ {\unpenalty\unskip\unpenalty\unskip\unpenalty\unskip
+ \setbox0=\lastbox
+ \ifvoid0
+ \exitloop
+ \else
+ \setbox2=\hbox
+ {\ifhbox0 \spreadhbox0\else\box0\fi
+ \ifvoid2 \else\hss\unhbox2\fi}%
+ \fi}%
+ \ifvoid2\else\unhbox2\fi
+ \else
+ \box#1%
+ \fi
+ \egroup}
+
+\def\placefloats{\doflushfloats} % keep this one
+
+\startmessages dutch library: floatblocks
+ title: plaatsblokken
+ 1: -- hernummerd / -- => --
+ 2: -- bewaard
+ 3: -- verplaatst
+ 4: -- geplaatst
+ 5: volgorde aangepast
+ 6: maximaal -- boven
+ 7: maximaal -- onder
+ 8: minder dan -- regels
+ 9: volgorde verstoord
+ 10: -- begrensd
+ 11: geen blok opgegeven
+ 12: niet gedefinieerd
+\stopmessages
+
+\startmessages english library: floatblocks
+ title: floatblocks
+ 1: -- renumbered / -- => --
+ 2: -- saved
+ 3: -- moved
+ 4: -- placed
+ 5: order adapted
+ 6: n of top floats limited to --
+ 7: n of bottom floats limited to --
+ 8: less than -- lines
+ 9: order disturbed
+ 10: -- limited
+ 11: no block given
+ 12: undefined
+\stopmessages
+
+\startmessages german library: floatblocks
+ title: Gleitobjektbloecke
+ 1: -- neu nummeriert / -- => --
+ 2: -- gespeichert
+ 3: -- verschoben
+ 4: -- plaziert
+ 5: Reihenfolge angepasst
+ 6: Anz. der oberen Gleitobjekte beschraengt auf --
+ 7: Anz. der unteren Gleitobjekte beschraengt auf --
+ 8: weniger als -- zeilen
+ 9: Reigenfolge gestoert
+ 10: -- begrenzt
+ 11: kein Block gegeben
+ 12: undefiniert
+\stopmessages
+
+\startmessages czech library: floatblocks
+ title: plovouciobjekty
+ 1: -- precislovano / -- => --
+ 2: -- ulozeno
+ 3: -- presunuto
+ 4: -- umisteno
+ 5: poradi prizpusobeno
+ 6: pocet hornich plovoucich objektu je omezen na --
+ 7: pocet spodnich plovoucich objektu je omezen na --
+ 8: radku je mene nez --
+ 9: poradi naruseno
+ 10: -- omezeno
+ 11: nedan zadny blok
+ 12: nedefinovano
+\stopmessages
+
+\startmessages italian library: floatblocks
+ title: oggetti mobili
+ 1: -- rinumerato / -- => --
+ 2: -- salavto
+ 3: -- mosso
+ 4: -- sistemato
+ 5: ordine aggiustato
+ 6: n di top floats limitato a --
+ 7: n di bottom floats limitato a --
+ 8: meno di -- righe
+ 9: ordine disturbato
+ 10: -- limitato
+ 11: nessun oggetto specificato
+ 12: non definito
+\stopmessages
+
+\startmessages norwegian library: floatblocks
+ title: flytblokker
+ 1: -- renummerert / -- => --
+ 2: -- lagret
+ 3: -- flyttet
+ 4: -- plassert
+ 5: rekkefølge tilpasset
+ 6: maksimalt -- flytblokker øverst
+ 7: maksimalt -- flytblokker nederst
+ 8: mindre enn -- linjer
+ 9: rekkefølge endret
+ 10: -- begrenset
+ 11: ingen blokk oppgitt
+ 12: udefinert
+\stopmessages
+
+\startmessages romanian library: floatblocks
+ title: Blocuri
+ 1: -- renumerotat / -- => --
+ 2: -- salvat
+ 3: -- mutat
+ 4: -- plasat
+ 5: ordinea adaptata
+ 6: nr. cadrelor de sus limitat la --
+ 7: nr. blocurilor de jos limitat la --
+ 8: mai putin de -- linii
+ 9: ordinea deranjata
+ 10: -- limitat
+ 11: nu este dat nici un bloc
+ 12: nedefinit
+\stopmessages
+
+\def\stelplaatsblokkenin%
+ {\dodoubleargument\getparameters[\??bk]}
+
+\def\stelblokkopjesin%
+ {\dodoubleargument\getparameters[\??kj]}%
+
+\def\dostelplaatsblokin[#1][#2]%
+ {\getparameters[\??fl#1][#2]}
+
+\def\stelplaatsblokin%
+ {\dodoubleargument\dostelplaatsblokin}
+
+\def\dostelblokkopjein[#1][#2]%
+ {\getparameters[\??kj#1][#2]}
+
+\def\stelblokkopjein%
+ {\dodoubleargument\dostelblokkopjein}
+
+\def\doleegblok#1%
+ {\localframed
+ [\??fl#1][\c!kader=\v!aan]%
+ {\getmessage{\m!floatblocks}{12}}}
+
+\def\docomplexplaatsblok[#1][#2][#3]#4%
+ {\flushfootnotes
+ \ifmargeblokken
+ \doifinset{\v!marge}{#2}
+ {\bgroup
+ \everypar{\egroup\the\everypar}%
+ \hsize=\@@mbbreedte}%
+ \fi
+ \global\insidefloattrue
+ \dowithnextboxcontent
+ {\postponefootnotes} % new
+ {\docompletefloat
+ {#1}{#3}{#1}{#2}{#1}{#4}
+ {\box\nextbox}}%
+ \vbox}
+
+\def\docomplexstarttekstblok[#1][#2][#3]%
+ {\flushfootnotes
+ \flushsidefloats % hoort eigenlijk niet hier
+ \docomplexplaatsblok[#1][\v!tekst,#2,\v!links][#3]}
+
+\def\docomplexreserveerblok[#1][#2][#3][#4]#5%
+ {\getvalue{\e!plaats#1}[#3][#4]{#5}{\localframed[\??fl#1][#2]{#1}}}
+
+\def\docomplexstartreserveertekstblok[#1][#2][#3][#4]%
+ {\flushsidefloats % hoort eigenlijk niet hier
+ \docomplexreserveerblok[#1][#2][\v!tekst,#3,\v!links][#4]}
+
+\def\dodefinieerplaatsblok[#1][#2]% #1=naam #2=meervoud
+ {\presetlocalframed[\??fl#1]%
+ \stelplaatsblokin
+ [#1]
+ [\c!breedte=15\korpsgrootte,
+ \c!hoogte=10\korpsgrootte,
+ \c!kader=\@@bkkader,
+ \c!straal=\@@bkstraal,
+ \c!hoek=\@@bkhoek,
+ \c!plaats=\@@bkplaats,
+ \c!achtergrond=\@@bkachtergrond,
+ \c!achtergrondraster=\@@bkachtergrondraster,
+ \c!achtergrondkleur=\@@bkachtergrondkleur,
+ \c!achtergrondoffset=\@@bkachtergrondoffset,
+ \c!bovenkader=\@@bkbovenkader,
+ \c!onderkader=\@@bkonderkader,
+ \c!linkerkader=\@@bklinkerkader,
+ \c!rechterkader=\@@bkrechterkader,
+ \c!kaderoffset=\@@bkkaderoffset,
+ \c!paginaovergangen=]%
+ \stelblokkopjein
+ [#1]
+ [\c!plaats=\@@kjplaats,
+ %\c!voor=\@@kjvoor,
+ \c!tussen=\@@kjtussen,
+ %\c!na=\@@kjna,
+ \c!breedte=\@@kjbreedte,
+ \c!kopletter=\@@kjkopletter,
+ \c!letter=\@@kjletter,
+ \c!kleur=\@@kjkleur,
+ \c!uitlijnen=\@@kjuitlijnen,
+ \c!nummer=\@@kjnummer,
+ \c!wijze=\@@kjwijze,
+ \c!blokwijze=\@@kjblokwijze,
+ \c!sectienummer=\@@kjsectienummer,
+ \c!conversie=\@@kjconversie]%
+ \doorlabelen
+ [#1]
+ [\c!tekst=#1,
+ \c!plaats=\v!intekst,
+ \c!wijze=\getvalue{\??kj#1\c!wijze},
+ \c!blokwijze=\getvalue{\??kj#1\c!blokwijze},
+ \c!sectienummer=\getvalue{\??kj#1\c!sectienummer},
+ \c!conversie=\getvalue{\??kj#1\c!conversie}]%
+ \presetlabeltext[#1=\Word{#1}~]%
+ \presetheadtext[#2=\Word{#2}]%
+ \definieerlijst[#1]%
+ \setvalue{\e!plaats\e!lijstmet#2}%
+ {\dodoubleempty\doplaatslijst[#1]}%
+ \setvalue{\e!volledige\e!lijstmet#2}%
+ {\dotripleempty\dodovolledigelijst[#1][#2]}%
+ \setvalue{\e!plaats#1}%
+ {\dotripleempty\docomplexplaatsblok[#1]}%
+ \setvalue{\e!reserveer#1}%
+ {\doquadrupleempty\docomplexreserveerblok[#1]}%
+ \setvalue{\e!start#1\e!tekst}%
+ {\dotripleempty\docomplexstarttekstblok[#1]}%
+ \setvalue{\e!stop#1\e!tekst}%
+ {\dostoptextfloat}%
+ \setvalue{\e!start\e!reserveer#1\e!tekst}%
+ {\doquadrupleempty\docomplexstartreserveertekstblok[#1]}%
+ \setvalue{\e!stop\e!reserveer#1\e!tekst}%
+ {\dostoptextfloat}%
+ \setvalue{\e!lege#1}%
+ {\doleegblok{#1}}%
+ \setvalue{\e!leeg#1}%
+ {\doleegblok{#1}}}
+
+\def\definieerplaatsblok%
+ {\dodoubleargument\dodefinieerplaatsblok}
+
+% 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
+
+\newif\ifsomefloatwaiting \somefloatwaitingfalse
+\newif\ifroomforfloat \roomforfloattrue
+\newif\ifnofloatpermitted \nofloatpermittedfalse
+
+\newcount\totalnoffloats \totalnoffloats =0
+\newcount\savednoffloats \savednoffloats =0
+\newcount\noffloatinserts \noffloatinserts=0
+
+\newbox\floatlist
+\newbox\savedfloatlist
+
+%newinsert\topins
+\newinsert\botins
+\newinsert\lowins % below footnotes
+
+\skip \botins=\zeropoint \skip \lowins=\zeropoint
+\count\botins=\!!thousand \count\lowins=\!!thousand
+\dimen\botins=\maxdimen \dimen\lowins=\maxdimen
+
+\newdimen\topinserted \topinserted=\zeropoint
+\newdimen\botinserted \botinserted=\zeropoint
+
+\newif\ifflushingfloats \flushingfloatsfalse
+
+\newbox\floattext
+
+\newdimen\floattextwidth
+\newdimen\floattextheight
+
+\newbox\floatbox
+\newbox\savedfloatbox
+
+\newdimen\floatwidth
+\newdimen\floatheight
+
+% Er wordt bij \v!altijd als dat nodig is hernummerd.
+% Daarbij wordt gebruik gemaakt van de opgeslagen nummers en
+% volgorde.
+
+\definetwopasslist{\s!float}
+
+\def\dofloatreference%
+ {\doglobal\increment\numberedfloat
+ \edef\dodofloatreference%
+ {\writeutilitycommand%
+ {\twopassentry%
+ {\s!float}%
+ {\numberedfloat}%
+ {\hetnummer}}}%
+ \dodofloatreference}
+
+\def\redofloatorder#1%
+ {\doglobal\increment\nofplacedfloats\relax
+ \gettwopassdata{\s!float}%
+ \iftwopassdatafound
+ \doifnot{\hetnummer}{\twopassdata}
+ {\edef\oldhetnummer{\hetnummer}%
+ \xdef\hetnummer{\twopassdata}%
+ \showmessage
+ {\m!floatblocks}{1}
+ {\nofplacedfloats,#1 \oldhetnummer,\hetnummer}}%
+ \fi}
+
+% In \dofloatinfomessage wordt {{ }} gebruikt omdat anders
+% binnen \startuitstellen...\stopuitstellen geen goede
+% melding in de marge volgt: \ifinner is dan namelijk true.
+
+\def\dofloatinfomessage#1#2#3%
+ {\bgroup
+ \showmessage{\m!floatblocks}{#2}{#3}%
+ \@EA\floatinfo\@EA#1\@EA{\currentmessagetext}%
+ \egroup}
+
+\def\dosavefloatinfo%
+ {\dofloatinfomessage{>}{2}{\the\totalnoffloats}}
+
+\def\dofloatflushedinfo%
+ {\bgroup
+ \!!counta=\totalnoffloats
+ \advance\!!counta by -\savednoffloats
+ \dofloatinfomessage{<}{3}{\the\!!counta}%
+ \egroup}
+
+\def\doinsertfloatinfo%
+ {\dofloatinfomessage{<}{4}{\the\totalnoffloats}}
+
+% ook voetnoten saven
+
+% \def\dogetfloat%
+% {\ifsomefloatwaiting
+% \global\setbox\floatlist=\vbox
+% {\unvbox\floatlist
+% \global\setbox\globalscratchbox=\lastbox}%
+% \setbox\floatbox=\box\globalscratchbox % local !
+% \global\advance\savednoffloats by -1\relax
+% \ifnum\savednoffloats=0
+% \global\somefloatwaitingfalse
+% \fi
+% \else
+% \global\savednoffloats=0
+% \global\setbox\floatbox=\box\voidb@x
+% \fi}
+%
+% \def\dosavefloat%
+% {\global\setbox\floatlist=\vbox
+% {\nointerlineskip
+% \box\floatbox
+% \unvbox\floatlist}%
+% \global\advance\savednoffloats by 1
+% \global\somefloatwaitingtrue
+% \dosavefloatinfo
+% \nonoindentation}
+%
+% \def\doresavefloat%
+% {\global\setbox\floatlist=\vbox
+% {\nointerlineskip
+% \unvbox\floatlist
+% \box\floatbox}%
+% \global\advance\savednoffloats by 1
+% \global\somefloatwaitingtrue}
+%
+% \def\doreversesavefloat%
+% {\global\setbox\floatlist=\vbox
+% {\nointerlineskip
+% \unvbox\floatlist
+% \box\floatbox}%
+% \global\advance\savednoffloats by 1
+% \global\somefloatwaitingtrue
+% \dosavefloatinfo}
+
+% \def\Xdogetfloat%
+% {\ifcase\savednoffloats\global\somefloatwaitingfalse\fi
+% \ifsomefloatwaiting
+% \global\setbox\floatlist=\vbox
+% {\unvbox\floatlist
+% \global\setbox\globalscratchbox=\lastbox}%
+% \global\advance\savednoffloats by -1
+% \global\setbox\floatbox=\box\globalscratchbox
+% % \ifnum\savednoffloats=0
+% % \global\somefloatwaitingfalse
+% % \fi
+% \else
+% \global\savednoffloats=0
+% \global\setbox\floatbox=\box\voidb@x
+% \fi}
+
+\def\dogetfloat%
+ {\ifsomefloatwaiting
+ \global\setbox\floatlist=\vbox
+ {\unvbox\floatlist
+ \global\setbox\globalscratchbox=\lastbox}%
+ \ifcenterfloatbox
+ \ifdim\wd\globalscratchbox<\hsize
+ \setbox\floatbox=\hbox to \hsize{\hss\box\globalscratchbox\hss}%
+ \else
+ \setbox\floatbox=\box\globalscratchbox % local !
+ \fi
+ \else
+ \setbox\floatbox=\box\globalscratchbox % local !
+ \fi
+ \global\advance\savednoffloats by -1\relax
+ \ifnum\savednoffloats=0
+ \global\somefloatwaitingfalse
+ \fi
+ \else
+ \global\savednoffloats=0
+ \global\setbox\floatbox=\box\voidb@x
+ \fi}
+
+\def\uncenteredfloatbox%
+ {\ifcenterfloatbox
+ \ifhbox\floatbox\relax % remove centering
+ \ifdim\wd\floatbox=\hsize
+ \ifhbox\floatbox
+ \setbox\scratchbox=\hbox
+ {\unhbox\floatbox
+ \unskip\unskip
+ \global\setbox\globalscratchbox=\lastbox}%
+ \box\globalscratchbox
+ \else
+ \box\floatbox
+ \fi
+ \else
+ \box\floatbox
+ \fi
+ \else
+ \box\floatbox
+ \fi
+ \else
+ \box\floatbox
+ \fi}
+
+\def\dosavefloat%
+ {\global\setbox\floatlist=\vbox
+ {\nointerlineskip
+ \uncenteredfloatbox
+ \unvbox\floatlist}%
+ \global\advance\savednoffloats by 1
+ \global\somefloatwaitingtrue
+ \dosavefloatinfo
+ \nonoindentation}
+
+\def\doresavefloat%
+ {\global\setbox\floatlist=\vbox
+ {\nointerlineskip
+ \unvbox\floatlist
+ \uncenteredfloatbox}%
+ \global\advance\savednoffloats by 1
+ \global\somefloatwaitingtrue}
+
+\def\doreversesavefloat%
+ {\global\setbox\floatlist=\vbox
+ {\nointerlineskip
+ \unvbox\floatlist
+ \uncenteredfloatbox}%
+ \global\advance\savednoffloats by 1
+ \global\somefloatwaitingtrue
+ \dosavefloatinfo}
+
+\def\dosavefloatstatus%
+ {\global\setbox\savedfloatlist=\copy\floatlist
+ \global\setbox\savedfloatbox =\copy\floatbox
+ \xdef\dorestorefloatstatus%
+ {\global\setbox\floatlist=\box\savedfloatlist
+ \global\setbox\floatbox =\box\savedfloatbox
+ \savednoffloats=\the\savednoffloats}}
+
+\let\dorestorefloatstatus\relax
+
+\def\checkwaitingfloats#1%
+ {\ifsomefloatwaiting
+ \doifinsetelse{\v!altijd}{#1}
+ {\showmessage{\m!floatblocks}{5}{}}
+ {\doflushfloats}%
+ \fi}
+
+\ifx\doflushfloats\undefined \let\doflushfloats\relax \fi
+\ifx\flushfloatbox\undefined \let\flushfloatbox\relax \fi
+
+\newif\iftopofinsert
+\newif\iftestfloatbox
+\newif\ifcenterfloatbox \centerfloatboxtrue
+
+% beter de laatste skip buiten de \insert uitvoeren,
+% bovendien bij volle flush onder baseline.
+
+\def\betweenfloatblanko% assumes that \@@bknawit is present
+ {\bgroup
+ \setbox0=\vbox{\strut\blanko[\@@bkvoorwit]\strut}%
+ \setbox2=\vbox{\strut\blanko[\@@bknawit]\strut}%
+ \ifdim\ht0>\ht2
+ \blanko[-\@@bknawit,\@@bkvoorwit]
+ \fi
+ \egroup}
+
+\def\doplacefloatbox%
+ {%\forgetall % NJET!
+ \witruimte
+ \blanko[\@@bkvoorwit]
+ \flushfloatbox
+ \blanko[\@@bknawit]}
+
+\ifx\someherefloat\undefined \let\someherefloat\doplacefloatbox \fi
+\ifx\somefixdfloat\undefined \let\somefixdfloat\doplacefloatbox \fi
+\ifx\somepagefloat\undefined \let\somepagefloat\doplacefloatbox \fi
+\ifx\sometopsfloat\undefined \let\sometopsfloat\doplacefloatbox \fi
+\ifx\somebotsfloat\undefined \let\somebotsfloat\doplacefloatbox \fi
+
+\ifx\somesidefloat\undefined \let\somesidefloat\doplacefloatbox \fi
+\ifx\somefacefloat\undefined \let\somefacefloat\doplacefloatbox \fi
+\ifx\sometextfloat\undefined \let\sometextfloat\doplacefloatbox \fi
+
+\def\somepagefloat[#1]% links, rechts, midden, hoog, midden, laag
+ {\checkwaitingfloats{#1}%
+ \global\setbox\collectedpagefloats=\vbox
+ {\unvbox\collectedpagefloats
+ \vbox to \teksthoogte
+ {\doifnotinset{\v!hoog}{#1}{\vfill}
+ \box\floatbox
+ \doifnotinset{\v!laag}{#1}{\vfill}}
+ \goodbreak}%
+ \doinsertfloatinfo}
+
+\def\sometextfloat[#1]% lang, links, rechts, hoog, midden, laag, offset
+ {\checkwaitingfloats{#1}%
+ \def\dostoptextfloat{\dodostoptextfloat[#1]}%
+ \global\floattextwidth=\hsize
+ \global\floatwidth=\wd\floatbox
+ \global\floatheight=\ht\floatbox % forget about the depth
+ \global\advance\floattextwidth by -\floatwidth
+ \global\advance\floattextwidth by -\@@bkmarge\relax % was \tfskipsize
+ \doifinsetelse{\v!lang}{#1}
+ {\floattextheight=\pagegoal
+ \advance\floattextheight by -\pagetotal
+ \advance\floattextheight by -\bigskipamount % lelijk
+ \ifdim\floattextheight>\teksthoogte
+ \floattextheight=\teksthoogte
+ \fi
+ \boxmaxdepth=\zeropoint \relax % toegevoegd
+ \ifdim\floattextheight<\floatheight
+ \floattextheight=\floatheight
+ \fi
+ \setbox\floattext=\vbox to \floattextheight}
+ {\setbox\floattext=\vbox}%
+ \bgroup
+ \forgetall\stelblankoin\stelwitruimtein % new, also needed for footnotes
+ \blanko[\v!blokkeer]
+ \hsize\floattextwidth
+ \ignorespaces}
+
+\def\dodostoptextfloat[#1]%
+ {\egroup
+ \doifnotinset{\v!lang}{#1}%
+ {\ifdim\ht\floattext<\floatheight
+ \floattextheight=\floatheight
+ \else
+ \floattextheight=\ht\floattext
+ \fi}%
+ \setbox\floatbox=\vbox to \floattextheight
+ {\hsize\floatwidth
+ \doifinsetelse{\v!beide}{#1}%
+ {\doifinsetelse{\v!laag}{#1}
+ {\vfill\box\floatbox}
+ {\doifinsetelse{\v!midden}{#1}
+ {\vfill\box\floatbox\vfill}
+ {\box\floatbox\vfill}}}
+ {\box\floatbox\vfill}}%
+ \setbox\floattext=\vbox to \floattextheight
+ {\hsize\floattextwidth
+ \doifinsetelse{\v!laag}{#1}
+ {\vfill
+ \box\floattext
+ \doifinset{\c!offset}{#1}{\witruimte\blanko}}
+ {\doifinsetelse{\v!midden}{#1}
+ {\vfill
+ \box\floattext
+ \vfill}
+ {\doifinset{\v!offset}{#1}{\witruimte\blanko}%
+ \box\floattext
+ \vfill}}}%
+ \doifinsetelse{\v!rechts}{#1}%
+ {\setbox\floatbox=\hbox to \hsize
+ {\box\floattext
+ \hfill
+ \box\floatbox}}
+ {\setbox\floatbox=\hbox to \hsize
+ {\box\floatbox
+ \hfill
+ \box\floattext}}%
+ \baselinecorrection
+ \witruimte
+ \blanko[\@@bkvoorwit]%
+ \doifnotinset{\v!lang}{#1}%
+ {\dp\floatbox=\openstrutdepth}% dp\strutbox}% % toegevoegd
+ \box\floatbox
+ \blanko[\@@bknawit]%
+ \doinsertfloatinfo}
+
+\def\somefacefloat[#1]% links, rechts, midden, hoog, midden, laag
+ {\checkwaitingfloats{#1}%
+ \startnaast\box\floatbox\stopnaast
+ \doinsertfloatinfo}
+
+\def\someelsefloat[#1]%
+ {\doifinsetelse{\v!hier}{#1}
+ {\doifinsetelse{\v!altijd}{#1}
+ {\pagina[\v!voorkeur]%
+ \docheckiffloatfits
+ \ifroomforfloat
+ \placesomeherefloat[#1]%
+ \else
+ \showmessage{\m!floatblocks}{9}{}%
+ \doreversesavefloat
+ \fi}
+ {\ifsomefloatwaiting
+ \dosavefloat
+ \else
+ \pagina[\v!voorkeur]%
+ \docheckiffloatfits
+ \ifroomforfloat
+ \placesomeherefloat[#1]%
+ \else
+ \dosavefloat
+ \fi
+ \fi}}
+ {\doifinsetelse{\v!altijd}{#1}
+ {\docheckiffloatfits
+ \ifroomforfloat
+ \processallactionsinset
+ [#1]
+ [ \v!boven=>{\placesometopsfloat[#1]},
+ \v!onder=>{\placesomebotsfloat[#1]},
+ \s!unknown=>{\placesomeherefloat[#1]},
+ \s!default=>{\placesomeherefloat[#1]}]%
+ \else
+ \showmessage{\m!floatblocks}{9}{}%
+ \doreversesavefloat
+ \fi}
+ {\docheckiffloatfits
+ \ifroomforfloat
+ \processallactionsinset
+ [#1]
+ [ \v!boven=>{\placesometopsfloat[#1]},
+ \v!onder=>{\placesomebotsfloat[#1]},
+ \s!unknown=>{\placesomeherefloat[#1]},
+ \s!default=>{\placesomeherefloat[#1]}]%
+ \else
+ \dosavefloat
+ \fi}}}
+
+% De onderstaande macro wordt gebruikt bij de macros
+% voor het plaatsen van tabellen en figuren (klopt niet
+% meer).
+%
+% \dofloat {plaats} {label1} {label2} {kader}
+%
+% \docompletefloat {nummer} {referentie} {lijst}
+% {plaats} {label1} {label2} {inhoud}
+%
+% \box\floatbox inhoud+referentie
+%
+% \do???float#1 #1 = boxnummer
+%
+% \ifinsidefloat wordt \true gezet voor \docompletefloat en \false
+% na float plaatsen; kan worden gebruikt om in
+% andere commando's witruimte te onderdrukken
+
+\newdimen\floattopskip \floattopskip=12pt
+\newdimen\floatbottomskip \floatbottomskip=12pt
+\newdimen\floatsideskip \floatsideskip=12pt
+
+\newdimen\sidefloattopskip \sidefloattopskip=\floattopskip
+\newdimen\sidefloatbottomskip \sidefloatbottomskip=\floatbottomskip
+\def\sidefloattopoffset {\openstrutdepth} % {\dp\strutbox}
+
+\newcount\noftopfloats \noftopfloats=2
+\newcount\nofbotfloats \nofbotfloats=0
+
+\def\calculatefloatskips%
+ {{\def\calculatefloatskips##1##2%
+ {\doifelsenothing{##2}
+ {\global##1=\zeropoint}
+ {\doifelse{##2}{\v!geen}
+ {\global##1=\zeropoint}
+ {\setbox0=\vbox{\witruimte\@EA\blanko\@EA[##2]}%
+ \global##1=\ht0}}}%
+ \calculatefloatskips\floattopskip\@@bkvoorwit
+ \calculatefloatskips\floatbottomskip\@@bknawit
+ \calculatefloatskips\sidefloattopskip\@@bkzijvoorwit
+ \calculatefloatskips\sidefloatbottomskip\@@bkzijnawit
+ \def\sidefloattopoffset{\openstrutdepth}% {\dp\strutbox}%
+ \global\floatsideskip=\@@bkmarge\relax
+ \global\noftopfloats=\@@bknboven\relax
+ \global\nofbotfloats=\@@bknonder\relax}}
+
+\newif\ifinsidefloat
+
+\def\floatcaptionsuffix{} % an optional suffix
+\def\floatcaptionnumber{} % a logical counter
+
+\def\dosetfloatcaption#1#2#3%
+ {\def\dofloattekst%
+ {{\doattributes{\??kj#1}\c!letter\c!kleur{#3}}}%
+ \doifelsevalue{\??kj#1\c!nummer}{\v!ja}
+ {\def\dofloatnummer%
+ {{\xdef\floatcaptionnumber{#1}%
+ \hbox{\doattributes{\??kj#1}\c!kopletter\c!kopkleur
+ {\strut#2\floatcaptionsuffix}}}%
+ \ConvertToConstant\doifnot{#3}{}
+ {\tfskip
+ \emergencystretch=.5em}}}
+ {\let\dofloatnummer=\empty}}
+
+\def\putborderedfloat#1\in#2\\%
+ {\setbox#2=\vbox
+ {\localframed
+ [\??fl#1]
+ [\c!breedte=\@@bkbreedte,
+ \c!hoogte=\@@bkhoogte,
+ \c!plaats=\v!normaal,
+ \c!offset=\@@bkoffset]%
+ {\box\floatbox}}}
+
+\newbox\captionbox
+
+\def\putcompletecaption#1#2#3#4%
+ {\noindent
+ \xdef\floatcaptionnumber{#1}%
+ \doattributes{\??kj#1}\c!letter\c!kleur
+ {\doifvalue{\??kj#1\c!nummer}{\v!ja}
+ {\hbox{\doattributes{\??kj#1}\c!kopletter\c!kopkleur{\strut#2\floatcaptionsuffix}}%
+ \ConvertToConstant\doifnot{#3}{}
+ {\ifcase#4\relax
+ \tfskip\emergencystretch=.5em
+ \else
+ \ifx\@@kjkjtussen\empty\else\unskip\@@kjkjtussen\fi
+ \fi}}%
+ \begstrut#3\endstrut\endgraf}}
+
+% \def\dosetpagfloat#1#2#3#4% \copy wegwerken
+% {\bgroup
+% \forgetall
+% \postponefootnotes
+% \mindermeldingen
+% %\showcomposition
+% \putborderedfloat#4\in4\\%
+% \def\locatefloat%
+% {\doregelplaats\@@flflplaats}%
+% \ConvertToConstant\doifelse{#3}{\v!geen}
+% {\global\setbox\floatbox=\vbox % pas op als wd groter dan hsize
+% {\ifbinnenkolommen\ifdim\wd4>\hsize
+% \let\locatefloat\relax
+% \fi\fi
+% \locatefloat{\copy4}}} % we need \wd4 later
+% {\setbox2=\hbox
+% {\footnotesenabledfalse\putcompletecaption{#4}{#2}{#3}{0}}%
+% \doifinsetelse{\@@kjkjplaats}{\v!hoog,\v!midden,\v!laag}
+% {\dimen0=\hsize
+% \advance\dimen0 by -\wd4\relax
+% \advance\dimen0 by -\@@bkmarge\relax % \was tfskipsize\relax
+% \ifdim\wd2>\dimen0\relax
+% \dimen2=1.3\dimen0\relax
+% \ifdim\wd2<\dimen2\relax
+% \dimen0=0.8\dimen0\relax
+% \fi
+% \fi
+% \setbox2=\vbox
+% {\forgetall
+% \hsize=\dimen0\relax
+% \raggedright
+% \putcompletecaption{#4}{#2}{#3}{1}}}
+% {\doifelse{\@@kjkjbreedte}{\v!max}
+% {\dosetraggedvbox{\@@kjkjuitlijnen}%
+% \setbox2=\raggedbox
+% {\hsize\wd4\relax
+% \putcompletecaption{#4}{#2}{#3}{0}}}
+% {\ifdim\wd2>\wd4\relax
+% \doifelse{\@@kjkjbreedte}{\v!passend}
+% {\ifdim\wd4<15\korpsgrootte\relax
+% \dimen0=15\korpsgrootte\relax
+% \else
+% \dimen0=\wd4\relax
+% \fi
+% \ifdim\wd4>\hsize
+% \setbox0=\vbox
+% {\forgetall
+% \hsize=1.0\wd4
+% \footnotesenabledfalse
+% \putcompletecaption{#4}{#2}{#3}{0}}%
+% \ifdim\ht0>\lineheight\relax
+% \setbox2=\vbox
+% {\forgetall
+% \hsize=0.9\wd4
+% \putcompletecaption{#4}{#2}{#3}{0}}%
+% \else
+% %\setbox2=\vbox % was 0, bug
+% % {\forgetall
+% % \hsize=1.0\wd4
+% % \putcompletecaption{#4}{#2}{#3}{0}}%
+% \setbox2=\hbox{\putcompletecaption{#4}{#2}{#3}{0}}%
+% \fi
+% \else
+% \setbox0=\vbox
+% {\forgetall
+% \dimen2=1.5\dimen0\relax
+% \ifdim\dimen2<\hsize
+% \hsize=\dimen2\relax
+% \fi
+% \footnotesenabledfalse
+% \putcompletecaption{#4}{#2}{#3}{0}}%
+% \ifdim\ht0>\lineheight\relax
+% \setbox2=\vbox
+% {\forgetall
+% \dimen2=1.2\dimen0\relax
+% \ifdim\dimen2<\hsize
+% \hsize=\dimen2\relax
+% \fi
+% \putcompletecaption{#4}{#2}{#3}{0}}%
+% \else
+% %\setbox2=\vbox % was 0, bug
+% % {\forgetall
+% % \dimen2=1.5\dimen0\relax
+% % \ifdim\dimen2<\hsize
+% % \hsize=\dimen2\relax
+% % \fi
+% % \putcompletecaption{#4}{#2}{#3}{0}}%
+% \setbox2=\hbox{\putcompletecaption{#4}{#2}{#3}{0}}%
+% \fi
+% \fi}
+% {\dosetraggedvbox{\@@kjkjuitlijnen}%
+% \setbox2=\raggedbox
+% {\hsize\@@kjkjbreedte
+% \putcompletecaption{#4}{#2}{#3}{0}}}%
+% \else
+% % \setbox2=\hbox % we want footnotes !
+% % {\putcompletecaption{#4}{#2}{#3}{0}}%
+% \dosetraggedvbox{\@@kjkjuitlijnen}%
+% \setbox2=\raggedbox
+% {\hsize\wd4
+% \putcompletecaption{#4}{#2}{#3}{0}}%
+% \fi}}%
+% \global\setbox\floatbox=\vbox
+% {\forgetall
+% \processaction
+% [\@@kjkjplaats]
+% [ \v!boven=>\locatefloat{\copy2}%
+% \endgraf\@@kjkjtussen
+% \locatefloat{\copy4},
+% \v!onder=>\locatefloat{\copy4}%
+% \endgraf\@@kjkjtussen
+% \locatefloat{\copy2},
+% \v!hoog=>\locatefloat
+% {\doifelse{\@@flflplaats}{\v!links}
+% {\copy4
+% \tfskip
+% \vbox to\ht4{\@@kjkjtussen\copy2\vfill}}
+% {\vbox to\ht4{\@@kjkjtussen\copy2\vfill}%
+% \tfskip
+% \copy4}},
+% \v!laag=>\locatefloat
+% {\doifelse{\@@flflplaats}{\v!links}
+% {\copy4
+% \tfskip
+% \vbox to\ht4
+% {\vfill\copy2\@@kjkjtussen}}
+% {\vbox to\ht4
+% {\vfill\copy2\@@kjkjtussen}%
+% \tfskip
+% \copy4}},
+% \v!midden=>\locatefloat
+% {\doifelse{\@@flflplaats}{\v!links}
+% {\copy4
+% \tfskip
+% \vbox to\ht4{\vfill\copy2\vfill}}
+% {\vbox to\ht4{\vfill\copy2\vfill}%
+% \tfskip
+% \copy4}},
+% \v!geen=>\locatefloat{\copy4}]}}%
+% % extended:
+% \postcenterfloatbox{\wd4}%
+% %\ifdim\wd4>\hsize
+% % \global\setbox\floatbox=
+% % \hbox to \ifbinnenkolommen\wd4\else\hsize\fi
+% % {\hss\box\floatbox\hss}%
+% %\fi
+% \egroup}
+
+% new
+
+\newbox\tempfloatbox
+\newbox\tempcaptionbox
+
+%\stelblokkopjesin[\c!breedte=5cm]
+%\stelblokkopjesin[\c!uitlijnen=\v!links]
+%\stelblokkopjesin[\c!uitlijnen=\v!rechts]
+
+\def\dosetpagfloat#1#2#3#4% \copy wegwerken
+ {\bgroup
+ \forgetall
+ \postponefootnotes
+ \mindermeldingen
+ \putborderedfloat#4\in\tempfloatbox\\%
+ \def\locatefloat%
+ {\doregelplaats\@@flflplaats}%
+ \ConvertToConstant\doifelse{#3}{\v!geen}
+ {\dopreparenocaption{#1}{#2}{#3}{#4}
+ \edef\width{\the\wd\floatbox}}
+ {\setbox\tempcaptionbox=\hbox
+ {\footnotesenabledfalse\putcompletecaption{#4}{#2}{#3}{0}}%
+ \doifinsetelse{\@@kjkjplaats}{\v!hoog,\v!midden,\v!laag}
+ {\dopreparesidecaption{#1}{#2}{#3}{#4}}
+ {\doifelse{\@@kjkjbreedte}{\v!max}
+ {\dopreparestackcaptionmax{#1}{#2}{#3}{#4}}
+ {\ifdim\wd\tempcaptionbox>\wd\tempfloatbox % wider caption
+ \doifelse{\@@kjkjbreedte}{\v!passend}
+ {\dopreparestackcaptionaut{#1}{#2}{#3}{#4}}
+ {\dopreparestackcaptionwid{#1}{#2}{#3}{#4}}%
+ \else
+ \dopreparestackcaptionmin{#1}{#2}{#3}{#4}%
+ \fi}}
+ \edef\width{\the\wd\tempfloatbox}%
+ \buildfloatbox}%
+ \postcenterfloatbox\width
+ \egroup}
+
+\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}}}
+
+\def\dopreparestackcaptionmax#1#2#3#4%
+ {\dosetraggedvbox{\@@kjkjuitlijnen}%
+ \setbox\tempcaptionbox=\raggedbox
+ {\hsize\wd\tempfloatbox
+ \putcompletecaption{#4}{#2}{#3}{0}}}
+
+\def\captionminwidth {15\korpsgrootte}
+\def\captionovershoot {2em}
+
+\def\dopreparestackcaptionaut#1#2#3#4%
+ {\doifsomething{\@@kjkjuitlijnen}
+ {\ExpandBothAfter\doifnotinset{\v!midden}{\@@kjkjuitlijnen}
+ {\let\captionovershoot\!!zeropoint}}%
+ \ifdim\wd\tempfloatbox>\hsize
+ % float is wider than \hsize
+ \dosetraggedvbox\@@kjkjuitlijnen
+ \setbox\scratchbox=\raggedbox % trial run
+ {\hsize=\wd\tempfloatbox
+ \footnotesenabledfalse
+ \putcompletecaption{#4}{#2}{#3}{0}}%
+ \ifdim\ht\scratchbox>\lineheight % more lines
+ \dosetraggedvbox\@@kjkjuitlijnen
+ \setbox\tempcaptionbox=\raggedbox
+ {\hsize=\wd\tempfloatbox
+ \advance\hsize -\captionovershoot\relax
+ \ifdim\hsize<\captionminwidth\relax
+ \hsize=\wd\tempfloatbox
+ \fi
+ \putcompletecaption{#4}{#2}{#3}{0}}%
+ \else
+ \setbox\tempcaptionbox=\raggedbox
+ {\hsize=\wd\tempfloatbox
+ \putcompletecaption{#4}{#2}{#3}{0}}%
+ \fi
+ \else
+ % 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
+ {\advance\scratchdimen \captionovershoot
+ \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
+ \dosetraggedvbox\@@kjkjuitlijnen
+ \setbox\tempcaptionbox\raggedbox
+ {\advance\scratchdimen \captionovershoot
+ \ifdim\scratchdimen<\hsize \hsize=\scratchdimen \fi
+ \putcompletecaption{#4}{#2}{#3}{0}}%
+ \else
+ % just over a line, don't use an overshoot
+ \dosetraggedvbox\@@kjkjuitlijnen
+ \setbox\tempcaptionbox=\raggedbox
+ {\hsize\scratchdimen
+ \putcompletecaption{#4}{#2}{#3}{0}}%
+ \fi
+ \fi}
+
+\def\dopreparestackcaptionwid#1#2#3#4%
+ {\dosetraggedvbox\@@kjkjuitlijnen
+ \setbox\tempcaptionbox=\raggedbox
+ {\hsize\@@kjkjbreedte
+ \putcompletecaption{#4}{#2}{#3}{0}}}
+
+\def\dopreparestackcaptionmin#1#2#3#4%
+ {\raggedcenter % the default
+ \dosetraggedvbox\@@kjkjuitlijnen % when given
+ \setbox\tempcaptionbox=\raggedbox % vbox, keeps footnotes
+ {\hsize\wd\tempfloatbox
+ \putcompletecaption{#4}{#2}{#3}{0}}}
+
+\def\dopreparesidecaption#1#2#3#4%
+ {\dimen0=\hsize
+ \advance\dimen0 by -\wd\tempfloatbox
+ \advance\dimen0 by -\@@bkmarge\relax % was \tfskipsize\relax
+ \ifdim\wd\tempcaptionbox>\dimen0
+ \dimen2=1.3\dimen0
+ \ifdim\wd\tempcaptionbox<\dimen2
+ \dimen0=0.8\dimen0
+ \fi
+ \fi
+ \setbox\tempcaptionbox=\vbox
+ {\hsize=\dimen0
+ \raggedright
+ \putcompletecaption{#4}{#2}{#3}{1}}}
+
+\def\buildfloatbox%
+ {\global\setbox\floatbox=\vbox
+ {\forgetall
+ \processaction
+ [\@@kjkjplaats]
+ [ \v!boven=>\locatefloat{\box\tempcaptionbox}%
+ \endgraf\@@kjkjtussen
+ \locatefloat{\box\tempfloatbox},
+ \v!onder=>\locatefloat{\box\tempfloatbox}%
+ \endgraf\@@kjkjtussen
+ \locatefloat{\box\tempcaptionbox},
+ \v!hoog=>\locatefloat
+ {\doifelse{\@@flflplaats}{\v!links}
+ {\box\tempfloatbox
+ \tfskip
+ \vbox to\ht\tempfloatbox{\@@kjkjtussen\box\tempcaptionbox\vfill}}
+ {\vbox to\ht\tempfloatbox{\@@kjkjtussen\box\tempcaptionbox\vfill}%
+ \tfskip
+ \box\tempfloatbox}},
+ \v!laag=>\locatefloat
+ {\doifelse{\@@flflplaats}{\v!links}
+ {\box\tempfloatbox
+ \tfskip
+ \vbox to\ht\tempfloatbox
+ {\vfill\box\tempcaptionbox\@@kjkjtussen}}
+ {\vbox to\ht\tempfloatbox
+ {\vfill\box\tempcaptionbox\@@kjkjtussen}%
+ \tfskip
+ \box\tempfloatbox}},
+ \v!midden=>\locatefloat
+ {\doifelse{\@@flflplaats}{\v!links}
+ {\box\tempfloatbox
+ \tfskip
+ \vbox to\ht\tempfloatbox{\vfill\box\tempcaptionbox\vfill}}
+ {\vbox to\ht\tempfloatbox{\vfill\box\tempcaptionbox\vfill}%
+ \tfskip
+ \box\tempfloatbox}},
+ \v!geen=>\locatefloat{\box\tempfloatbox}]}}
+
+\newif\ifpostponecolumnfloats \postponecolumnfloatsfalse % don't change
+
+%\def\postcenterfloatbox#1%
+% {\ifbinnenkolommen
+% \ifpostponecolumnfloats
+% \scratchdimen=\zetbreedte
+% \else
+% \scratchdimen=#1\relax
+% \fi
+% \else\ifdim#1>\hsize
+% \scratchdimen=\hsize
+% \else
+% \scratchdimen=\wd\floatbox
+% \fi\fi
+% \global\setbox\floatbox=\hbox to \scratchdimen
+% {\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
+% \ifdim\floatwidth>\zetbreedte
+% \global\floatwidth\zetbreedte
+% \else\ifdim\floatwidth<\hsize
+% \global\floatwidth\hsize
+% \fi\fi
+% \global\setbox\floatbox=\hbox to \floatwidth
+% {\hss\box\floatbox\hss}}
+
+% \def\postcenterfloatbox#1% 2 of 4
+% {\global\setbox\floatbox=\hbox to \width % \wd\ifdim\wd2>\wd4 2\else4\fi
+% {\hss\box\floatbox\hss}%
+% \ifdim\wd\floatbox>\zetbreedte
+% \global\setbox\floatbox=\hbox to \zetbreedte
+% {\hss\box\floatbox\hss}%
+% \else\ifcenterfloatbox\ifdim\wd\floatbox<\hsize
+% % \global\setbox\floatbox=\hbox to \hsize
+% % {\hss\box\floatbox\hss}%
+% \fi\fi\fi
+% \global\floatwidth\wd\floatbox}
+
+\def\postcenterfloatbox#1%
+ {\ifbinnenkolommen
+ \ifpostponecolumnfloats
+ \scratchdimen=\zetbreedte
+ \else
+ \scratchdimen=#1\relax
+ \fi
+ \else\ifdim#1>\hsize
+ \scratchdimen=\hsize
+ \else
+ \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
+
+\def\dosetparfloat#1#2#3#4%
+ {\bgroup
+ \forgetall
+ \postponefootnotes
+ \mindermeldingen
+ %\showcomposition
+ \putborderedfloat#4\in4\\
+ \ConvertToConstant\doifelse{#3}{\v!geen}
+ {\global\setbox\floatbox=\vbox{\box4}}
+ {\setbox2=\hbox
+ {\forgetall\putcompletecaption{#4}{#2}{#3}{0}}%
+ \doifelse{\@@kjkjbreedte}{\v!max}
+ {\dosetraggedvbox{\@@kjkjuitlijnen}%
+ \setbox2=\raggedbox
+ {\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}}%
+ {\doifelse{\@@kjkjbreedte}{\v!passend}
+ {\ifdim\wd2>\wd4\relax
+ \setbox2=\vbox
+ {\forgetall\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}%
+ \else
+ \setbox2=\hbox to \wd4
+ {\hss\box2\hss}%
+ \fi}
+ {\dosetraggedvbox{\@@kjkjuitlijnen}%
+ \setbox2=\raggedbox
+ {\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}}}%
+ \global\setbox\floatbox=\vbox
+ {\processaction
+ [\@@kjkjplaats]
+ [ \v!boven=>\box2\endgraf\@@kjkjtussen\box4,
+ \v!onder=>\box4\endgraf\@@kjkjtussen\box2,
+ \v!geen=>\box4,
+ \s!unknown=>\box4\endgraf\@@kjkjtussen\box2]}}%
+ \egroup}
+
+\newif\ifparfloat
+
+\long\def\dosetfloatbox#1#2#3#4%
+ {\ifvisible
+ \par
+ \doifcommonelse
+ {#1}{\v!links,\v!rechts,\v!inlinker,\v!inrechter,\v!inmarge}
+ {\global\parfloattrue}
+ {\global\parfloatfalse}%
+ \ifbinnenkolommen
+ \global\parfloatfalse
+ \fi
+ \edef\@@kjkjbreedte {\getvalue{\??kj#4\c!breedte}}%
+ \def \@@kjkjtussen {\getvalue{\??kj#4\c!tussen}}% geen \edef
+ \edef\@@kjkjplaats {\getvalue{\??kj#4\c!plaats}}%
+ \edef\@@kjkjuitlijnen{\getvalue{\??kj#4\c!uitlijnen}}%
+ \edef\@@flflplaats {\getvalue{\??fl#4\c!plaats}}%
+ \ifparfloat
+ \dosetparfloat{#1}{#2}{#3}{#4}%
+ \else
+ \dosetpagfloat{#1}{#2}{#3}{#4}%
+ \fi
+ \setbox\floatbox=\hbox{\black\box\floatbox}%
+ \global\floatheight=\ht\floatbox
+ \global\advance\floatheight by \dp\floatbox
+ \global\floatwidth=\wd\floatbox
+ \global\advance\totalnoffloats by 1
+ \doifnotinset{\v!marge}{#1} % gaat namelijk nog fout
+ {\setbox\floatbox=\vbox
+ {\parindent\zeropoint
+ \ifvoorlopig
+ \inleftmargin{\framed{\infofont\the\totalnoffloats}}%
+ \fi
+ \box\floatbox}}%
+ \wd\floatbox=\floatwidth
+ \dimen0=\floatheight
+ \advance\dimen0 by \lineheight
+ \ifdim\dimen0<\teksthoogte
+ \else
+ \global\floatheight=\teksthoogte
+ \global\advance\floatheight by -\lineheight
+ \ht\floatbox=\floatheight
+ \dp\floatbox=\zeropoint
+ \showmessage{\m!floatblocks}{10}{\the\totalnoffloats}%
+ \fi
+ \fi}
+
+\newcounter\noxfloatlocations
+
+\def\dogetfloatbox#1%
+ {\ifvisible
+ \let\next\relax % ivm eetex
+ \processfirstactioninset
+ [#1]
+ [ \v!hier=>\def\next{\someelsefloat[#1]},
+ \v!forceer=>\def\next{\somefixdfloat[#1]},
+ \v!links=>\def\next{\somesidefloat[#1]\presetindentation},
+ \v!rechts=>\def\next{\somesidefloat[#1]},
+ \v!tekst=>\def\next{\sometextfloat[#1]},
+ \v!boven=>\def\next{\someelsefloat[#1]\nonoindentation}, % !
+ \v!onder=>\def\next{\someelsefloat[#1]},
+ \v!marge=>\def\next{\somenextfloat[#1]\nonoindentation}, % !
+ \v!pagina=>\def\next{\somepagefloat[#1]},
+ \v!naast=>\def\next{\somefacefloat[#1]},
+ \v!inmarge=>\def\next{\somesidefloat[#1]},
+ \v!inlinker=>\def\next{\somesidefloat[#1]},
+ \v!inrechter=>\def\next{\somesidefloat[#1]},
+ \s!default=>\def\next{\someelsefloat[\v!hier,#1]},
+ \s!unknown=>\def\next{\someelsefloat[\v!hier,#1]}]%
+ \next
+ \fi}
+
+\long\def\dofloat#1#2#3#4%
+ {\dosetfloatbox{#1}{#2}{#3}{#4}%
+ \dogetfloatbox{#1}}%
+
+\long\def\docompletefloat#1#2#3#4#5#6#7%
+ {\flushsidefloats
+ \calculatefloatskips
+ \bgroup
+ \global\setbox\floatbox=\vbox{#7}%
+ \dimen0=\ht\floatbox
+ \advance\dimen0 by \dp\floatbox
+ \ifdim\dimen0=\zeropoint
+ \showmessage{\m!floatblocks}{11}{}%
+ \global\setbox\floatbox=\vbox{\getvalue{\e!lege#3}}%
+ \fi
+ \ConvertToConstant\doifelse{#6}{\v!geen}
+ {\global\setbox\floatbox=\vbox
+ {\unvbox\floatbox
+ \vss % gets rid of the depth
+ \rawpagereference{\s!flt}{#2}}%
+ \egroup\dofloat{#4}{}{#6}{#1}}
+ {\doglobal\convertargument#6\to\asciititle % \asciititle is global
+ \doifelsevalue{\??kj#1\c!nummer}{\v!ja}
+ {\verhoognummer[#1]%
+ \maakhetnummer[#1]%
+ \global\setbox\floatbox=\vbox
+ {\unvbox\floatbox % no \vss, keep the depth
+ \dofloatreference
+ \redofloatorder{#1}%
+ \rawreference{\s!flt}{#2}{{\hetnummer}{\asciititle}}%
+ \doschrijfnaarlijst{#3}{\hetnummer}{#6}{#3}}%
+ \egroup\dofloat{#4}{\labeltexts{#5}{\hetnummer}}{#6}{#1}}
+ {\global\setbox\floatbox=\vbox
+ {\unvbox\floatbox % no \vss, keep the depth
+ \rawreference{\s!flt}{#2}{{}{\asciititle}}}%
+ \egroup\dofloat{#4}{}{#6}{#1}}}%
+ \global\insidefloatfalse}
+
+
+\newif\ifmargeblokken
+
+\def\dostelmargeblokkenin[#1]%
+ {\getparameters[\??mb][#1]%
+ \doifelse{\@@mbstatus}{\v!start}%
+ {\showmessage{\m!layouts}{4}{}%
+ \margeblokkentrue
+ \let\somenextfloat=\dosomenextfloat
+ \let\startmargeblok=\dostartmargeblok
+ \let\stopmargeblok=\dostopmargeblok}%
+ {\showmessage{\m!layouts}{5}{}%
+ \margeblokkenfalse
+ \def\somenextfloat[##1]%
+ {\someelsefloat[##1,\v!hier]}%
+ \let\startmargeblok=\dontstartmargeblok
+ \let\stopmargeblok=\dontstopmargeblok}}
+
+\def\stelmargeblokkenin%
+ {\dosingleargument\dostelmargeblokkenin}
+
+\newbox\marginbox
+
+\def\dosomenextfloat[#1]%
+ {\global\setbox\marginbox=\vbox
+ {\hsize\@@mbbreedte
+ \unvcopy\marginbox
+ \ifvoid\marginbox\else\expandafter\@@mbtussen\fi
+ \box\floatbox\filbreak}%
+ \ifdim\ht\marginbox>\teksthoogte
+ \dosavefloatinfo
+ \else
+ \doinsertfloatinfo
+ \fi}
+
+\newbox\preparedmarginbox
+
+\def\reshapemargin%
+ {\ifdim\ht\preparedmarginbox>\zeropoint
+ \beginofshapebox
+ \unvbox\preparedmarginbox
+ \endofshapebox
+ \reshapebox
+ {\box\shapebox}%
+ \setbox\preparedmarginbox=\vbox to \teksthoogte
+ {\@@mbboven
+ \flushshapebox
+ \@@mbonder}%
+ \fi}
+
+\def\plaatsrechtermargeblok%
+ {\hskip\rechtermargebreedte}
+
+\def\plaatslinkermargeblok%
+ {\hskip\linkermargebreedte}
+
+\def\checkmargeblokken%
+ {\ifvoid\marginbox\else\docheckmargeblokken\fi}
+
+\def\docheckmargeblokken% erg inefficient
+ {\setbox\preparedmarginbox=\vbox
+ {\forgetall
+ \splittopskip\topskip
+ \ifvoid\marginbox\else
+ \ifdim\ht\marginbox>\teksthoogte
+ \vsplit\marginbox to \teksthoogte
+ \else
+ \unvbox\marginbox
+ \fi
+ \fi}%
+ \reshapemargin
+ \setbox\preparedmarginbox=\vbox
+ {\@@mbvoor\box\preparedmarginbox\@@mbna}%
+ \def\rightmarginbox%
+ {\def\plaatsrechtermargeblok%
+ {\setbox\preparedmarginbox=\hbox to \rechtermargebreedte
+ {\@@mblinks\box\preparedmarginbox\@@mbrechts}%
+ \vsmashbox\preparedmarginbox
+ \box\preparedmarginbox}}%
+ \def\leftmarginbox%
+ {\def\plaatslinkermargeblok%
+ {\setbox\preparedmarginbox=\hbox to \linkermargebreedte
+ {\@@mbrechts\box\preparedmarginbox\@@mblinks}%
+ \vsmashbox\preparedmarginbox
+ \box\preparedmarginbox}}%
+ \processaction % traag
+ [\@@mbplaats]
+ [ \v!inmarge=>\doifbothsidesoverruled
+ \rightmarginbox
+ \orsideone
+ \rightmarginbox
+ \orsidetwo
+ \leftmarginbox
+ \od,
+ \v!midden=>\doifbothsidesoverruled
+ \rightmarginbox
+ \orsideone
+ \leftmarginbox
+ \orsidetwo
+ \rightmarginbox
+ \od,
+ \v!links=>\leftmarginbox,
+ \v!rechts=>\rightmarginbox,
+ \s!unknown=>\setbox\preparedmarginbox=\hbox{}]}
+
+\def\dostartmargeblok% % 2 maal \vbox ivm \unvbox elders
+ {\global\setbox\marginbox=\vtop\bgroup\vbox\bgroup
+ \hsize\@@mbbreedte
+ \ifvoid\marginbox\else
+ \unvbox\marginbox
+ \@@mbtussen
+ \fi
+ \steluitlijnenin[\@@mbuitlijnen]%
+ \dostartattributes\??mb\c!letter\c!kleur{}%
+ \begstrut\ignorespaces}
+
+\def\dostopmargeblok%
+ {\unskip\endstrut
+ \dostopattributes
+ \egroup
+ \egroup}
+
+\def\dontstartmargeblok%
+ {\@@mbvoor
+ \bgroup
+ \dostartattributes\??mb\c!letter\c!kleur{}}
+
+\def\dontstopmargeblok%
+ {\dostopattributes
+ \egroup
+ \@@mbna}
+
+\newcounter\nofpostponedblocks
+
+\newif\ifinuitstellen
+
+\newevery\everytopofpage\relax
+
+\appendtoks\the\everytopofpage \to\everystarttext
+\appendtoks\global\everytopofpage{}\to\everystoptext
+
+%\def\douitstellen%
+% {\the\everytopofpage
+% \ifinuitstellen\else\ifcase\nofpostponedblocks\else % The \nof-test is
+% \global\pagetotal\zeropoint % recently added
+% \global\inuitstellentrue % definitely needed
+% \dorecurse{\nofpostponedblocks} % else we can loose
+% {\haalbuffer[buf-\recurselevel]} % or disorder floats
+% \doflushfloats % new but potential dangerous % and that is something
+% \doglobal\newcounter\nofpostponedblocks % we don't want, do we?
+% \global\inuitstellenfalse % Anyhow, 'uitstellen'
+% \fi\fi} % is still suboptimal.
+
+\def\douitstellen%
+ {\the\everytopofpage
+ \ifvoid\collectedpagefloats\else
+ % message
+ \unvbox\collectedpagefloats
+ \fi
+ \ifinuitstellen\else\ifcase\nofpostponedblocks\else % The \nof-test is
+\bgroup
+\black % else problems inside split verbatim
+\restoreglobalbodyfont % else problems inside split verbatim
+ % message
+ \global\pagetotal\zeropoint % recently added
+ \global\inuitstellentrue % definitely needed
+ \dorecurse{\nofpostponedblocks} % else we can loose
+ {\haalbuffer[buf-\recurselevel]} % or disorder floats
+ \doflushfloats % new but potential dangerous % and that is something
+ \doglobal\newcounter\nofpostponedblocks % we don't want, do we?
+ \global\inuitstellenfalse % Anyhow, 'uitstellen'
+\egroup
+ \fi\fi} % is still suboptimal.
+
+\setvalue{\e!start\e!uitstellen}%
+ {\doglobal\increment\nofpostponedblocks
+ \showmessage{\m!layouts}{3}{\nofpostponedblocks}%
+ \dostartbuffer[buf-\nofpostponedblocks]
+ [\e!start\e!uitstellen][\e!stop\e!uitstellen]}
+
+\definieernummer
+ [\??si]
+ [\c!wijze=\v!per\v!tekst,
+ \c!conversie=\@@siconversie]
+
+\def\stelplaatsbloksplitsenin%
+ {\dodoubleargument\getparameters[\??si]}
+
+% ook (continued)
+
+\def\dosplitsplaatsblok[#1]#2% nog dubbele refs
+ {\ifbinnenkolommen % tzt ook nog figuren splitten
+ % not yet supported
+ \else
+ \bgroup
+ \insidefloattrue
+ \getparameters[\??si][#1]%
+ \resetnummer[\??si]%
+ \def\floatcaptionsuffix{\nummer[\??si]}%
+ \TABLEcaptionheight=\@@siregels\lineheight
+\def\docomplexpagina[##1]{\goodbreak}%
+ \dowithnextbox
+ {\forgetall
+ \mindermeldingen
+ \doloop
+ {\setbox2\vsplit\nextbox to \lineheight
+ \setbox2=\vbox{\unvbox2}
+ \ifdim\ht2>\lineheight
+ \verhoognummer[\??si]%
+ \ifnum\ruwenummer[\??si]=1 \ifdim\ht\nextbox=\zeropoint
+ \let\floatcaptionsuffix=\empty
+ \fi\fi
+ \bgroup
+ #2{\unvbox2}
+ \egroup
+ \ifdim\ht\nextbox>\zeropoint
+ \pagina
+ \verlaagnummer[\floatcaptionnumber]%
+ \fi
+ \fi
+ \ifdim\ht\nextbox>\zeropoint\else
+ \expandafter\exitloop
+ \fi}%
+ \egroup}
+ \vbox
+ \fi}
+
+\def\splitsplaatsblok%
+ {\dosingleempty\dosplitsplaatsblok}
+
+\def\dooutput{\sidefloatoutput} % redefinition of \dooutput
+
+\stelmargeblokkenin
+ [\c!status=\v!start,
+ \c!plaats=\v!inmarge,
+ \c!breedte=\rechtermargebreedte,
+ \c!letter=,
+ \c!kleur=,
+ \c!uitlijnen=,
+ \c!links=,
+ \c!rechts=,
+ \c!boven=,
+ \c!tussen=\blanko,
+ \c!onder=\vfill,
+ \c!voor=,
+ \c!na=]
+
+\definieerplaatsblok
+ [\v!figuur]
+ [\v!figuren]
+
+\definieerplaatsblok
+ [\v!tabel]
+ [\v!tabellen]
+
+\stelplaatsblokin
+ [\v!tabel]
+ [\c!kader=\v!uit]
+
+\definieerplaatsblok
+ [\v!intermezzo]
+ [\v!intermezzos]
+
+\definieerplaatsblok
+ [\v!grafiek]
+ [\v!grafieken]
+
+\stelblokkopjesin
+ [\c!plaats=\v!onder,
+ \c!voor=\blanko,
+ \c!tussen={\blanko[\v!middel]},
+ \c!na=\blanko,
+ \c!breedte=\v!passend,
+ \c!kopletter=\v!vet,
+ \c!letter=\v!normaal,
+ \c!kleur=,
+ \c!uitlijnen=,
+ \c!nummer=\v!ja,
+ \c!wijze=\@@nrwijze,
+ \c!blokwijze=\@@nrblokwijze,
+ \c!sectienummer=\@@nrsectienummer,
+ \c!conversie=\v!cijfers]
+
+\stelplaatsblokkenin
+ [\c!plaats=\v!midden,
+ \c!breedte=\v!passend,
+ \c!hoogte=\v!passend,
+ \c!offset=\v!overlay,
+ \c!kader=\v!uit,
+ \c!straal=.5\korpsgrootte,
+ \c!hoek=\v!recht,
+ \c!achtergrond=,
+ \c!achtergrondraster=\@@rsraster,
+ \c!achtergrondkleur=,
+ \c!achtergrondoffset=\!!zeropoint,
+ \c!bovenkader=,
+ \c!onderkader=,
+ \c!linkerkader=,
+ \c!rechterkader=,
+ \c!kaderoffset=\!!zeropoint,
+ \c!voor=,
+ \c!na=,
+ \c!voorwit=\v!groot,
+ \c!nawit=\v!groot,
+ \c!zijvoorwit=\@@bkvoorwit,
+ \c!zijnawit=\@@bknawit,
+ \c!springvolgendein=\v!nee,
+ \c!marge=1em,
+ \c!nboven=2,
+ \c!nonder=0,
+ \c!nregels=4]
+
+\stelplaatsbloksplitsenin
+ [\c!conversie=\v!letter, % \v!romeins
+ \c!regels=3]
+
+% float strategy
+
+\let\floatmethod\empty
+
+\def\dogetfloatbox#1%
+ {\ifvisible
+ \getfromcommalist[#1][1]%
+ \@EA\beforesplitstring\commalistelement\at:\to\floatmethod
+ \@EA\aftersplitstring \commalistelement\at:\to\floatcolumn
+% nog algemeen otr
+\ifx\OTRSETsetpreferedcolumnslot\undefined\else
+ \OTRSETsetpreferedcolumnslot\floatcolumn
+\fi
+% commando van maken
+ \doifundefined{\string\floatmethod\floatmethod}
+ {\let\floatmethod\v!hier}%
+ \getvalue{\string\floatmethod\floatmethod}[#1]%
+ \fi}
+
+\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
+
+\def\placesomeslotfloat {\OTRcommand\someslotfloat}
+\def\placesomeherefloat {\OTRcommand\someherefloat}
+\def\placesomefixdfloat {\OTRcommand\somefixdfloat}
+\def\placesomepagefloat {\OTRcommand\somepagefloat}
+\def\placesometopsfloat {\OTRcommand\sometopsfloat}
+\def\placesomebotsfloat {\OTRcommand\somebotsfloat}
+\def\placesomesidefloat {\OTRcommand\somesidefloat}
+\def\placesomefacefloat {\OTRcommand\somefacefloat}
+
+\def\someleftsidefloat [#1]{\somesidefloat[#1]\presetindentation}
+\def\somerightsidefloat [#1]{\somesidefloat[#1]}
+\def\sometopfloat [#1]{\someelsefloat[#1]\nonoindentation}
+\def\somebottomfloat [#1]{\someelsefloat[#1]}
+\def\somemarginfloat [#1]{\somenextfloat[#1]\nonoindentation}
+\def\someinleftmarginfloat [#1]{\somesidefloat[#1]}
+\def\someinrightmarginfloat[#1]{\somesidefloat[#1]}
+\def\someinmarginfloat [#1]{\somesidefloat[#1]}
+\def\someherefloat [#1]{\someelsefloat[\v!hier,#1]}
+
+\def\somefixdfloat {\placesomefixdfloat}
+\def\somepagefloat {\placesomepagefloat}
+\def\somefacefloat {\placesomefacefloat}
+\def\someslotfloat {\placesomeslotfloat}
+
+\protect \endinput
diff --git a/tex/context/base/core-pag.tex b/tex/context/base/page-imp.tex
index e6371100d..2225e31f9 100644
--- a/tex/context/base/core-pag.tex
+++ b/tex/context/base/page-imp.tex
@@ -2,7 +2,7 @@
%D [ file=core-pag,
%D version=1998.01.15,
%D title=\CONTEXT\ Core Macros,
-%D subtitle=Pagebody Building,
+%D subtitle=Pagebody Building (Imposition),
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
@@ -15,6 +15,92 @@
\unprotect
+% moved code:
+
+\def\myshipout#1%
+ {\voorpagina % voor de pagebody dus !
+ \dontshowcomposition
+ \ifarrangingpages
+ \actualarrange
+ {\thisisrealpage{\realfolio}#1}%
+ \else
+ \actualshipout
+ {\thisisrealpage{\realfolio}#1}%
+ \fi
+ \gotonextrealpage
+ \napagina}
+
+\newbox\postponedcontent
+
+\def\flushatshipout%
+ {\dowithnextbox
+ {\global\setbox\postponedcontent=\hbox to \!!zeropoint
+ {%\hskip-\maxdimen % niet hier, gaat mis in acrobat (clipt)
+ \box\postponedcontent\box\nextbox}%
+ \global\ht\postponedcontent=\!!zeropoint
+ \global\dp\postponedcontent=\!!zeropoint
+ \global\wd\postponedcontent=\!!zeropoint}%
+ \hbox}
+
+% \starttypen
+% \def\pagestoshipout{1,3,5}
+% \stoptypen
+
+\newcounter\shippedoutpages
+\let\pagestoshipout\empty % {1,3,6}
+\chardef\whichpagetoshipout=0 % 0=all 1=odd 2=even
+
+\def\actualshipout#1%
+ {\doglobal\increment\shippedoutpages
+ \ifx\pagestoshipout\empty
+ \ifcase\whichpagetoshipout\relax
+ \donetrue
+ \or % 1
+ \ifodd\shippedoutpages\relax\donetrue\else\donefalse\fi
+ \or % 2
+ \ifodd\shippedoutpages\relax\donefalse\else\donetrue\fi
+ \else
+ \donetrue
+ \fi
+ \else
+ \ExpandBothAfter\doifinsetelse{\shippedoutpages}{\pagestoshipout}
+ \donetrue\donefalse
+ \fi
+ \ifdone
+ \shipout\vbox
+ {\forgetall
+ \offinterlineskip
+ \mindermeldingen
+ \vskip-1in
+ \hskip-1in
+ \hbox
+ {\setbox0=\hbox{#1}% just in case there are objects there
+ \setbox\scratchbox=\hbox
+ {\the\everyshipout
+ \ifnum\realpageno=\lastpage\relax
+ \the\everylastshipout
+ \global\everylastshipout\emptytoks
+ \fi}%
+ \smashbox\scratchbox
+ \box\scratchbox
+ \box\postponedcontent % evt ver naar links !
+ \box0}}%
+ \else
+ \message
+ {[\ifarrangingpages arranged \fi page
+ \ifarrangingpages\the\arrangeno\else\the\realpageno\fi\normalspace
+ not flushed]}%
+ \setbox0=\hbox{#1}%
+ \deadcycles=0
+ \fi}
+
+\def\actualarrange#1%
+ {\setbox0=\hbox{\thisisrealpage{\realfolio}#1}%
+ \pusharrangedpage0
+ \deadcycles=0 }
+
+% so far for the moved code
+
\newbox\arrangedpageA
\newbox\arrangedpageB
@@ -42,7 +128,7 @@
\divide\scratchdimen by \arrangedpageY
\global\advance\papierhoogte by -2\scratchdimen}
-\def\stelarrangerenin[#1]%
+\def\setuparranging[#1]%
{\ifarrangingdisabled \else
\doifelse{#1}{\v!blokkeer}
{\global\arrangingdisabledtrue}
@@ -118,7 +204,7 @@
\s!default=>\global\arrangingpagesfalse]%
\doifcommonelse{#1}{90,270,\v!geroteerd}
{\swapmacros\horizontalcutmarks\verticalcutmarks}{}% ugly solution
- \stelpapierformaatin
+ \setuppapersize
\ifarrangingpages
\abortutilitygeneration
\fi
@@ -126,7 +212,7 @@
% cleaner, but unchecked, and incomplete
%
-% \def\dostelarrangereninXY#1#2#3#4#5#6#7#8%
+% \def\dosetuparrangingXY#1#2#3#4#5#6#7#8%
% {\global\chardef\arrangedpageX =#1%
% \global\chardef\arrangedpageY =#2%
% \global\chardef\arrangedpageT =#3%
@@ -136,11 +222,11 @@
% \global\let \poparrangedpages =#7%
% \global\let \handlearrangedpage=#8}
%
-% \def\dostelarrangereninOE#1#2%
+% \def\dosetuparrangingOE#1#2%
% {\gdef\arrangedrotationO{#1}%
% \gdef\arrangedrotationE{#2}}
%
-% \def\stelarrangerenin[#1]%
+% \def\setuparranging[#1]%
% {\ifarrangingdisabled \else
% \doifelse{#1}{\v!blokkeer}
% {\global\arrangingdisabledtrue}
@@ -156,35 +242,35 @@
% [ \v!gespiegeld=>\global\mirrorarrangedtrue,
% \v!dubbelzijdig=>\global\doublearrangedtrue,
% \v!negatief=>\global\negatearrangedtrue,
-% \v!geroteerd=>\dostelarrangereninOE{90}{270},
-% 90=>\dostelarrangereninOE{90}{270},
-% 180=>\dostelarrangereninOE{180}{0},
-% 270=>\dostelarrangereninOE{270}{90},
-% 2*16=>\dostelarrangereninXY{8}{4}{16}{5}{5}
+% \v!geroteerd=>\dosetuparrangingOE{90}{270},
+% 90=>\dosetuparrangingOE{90}{270},
+% 180=>\dosetuparrangingOE{180}{0},
+% 270=>\dosetuparrangingOE{270}{90},
+% 2*16=>\dosetuparrangingXY{8}{4}{16}{5}{5}
% \pusharrangedpageTHIRTYTWO
% \poparrangedpagesAB
% \relax,
-% 2*8=>\dostelarrangereninXY{4}{2}{8}{5}{3}
+% 2*8=>\dosetuparrangingXY{4}{2}{8}{5}{3}
% \pusharrangedpageSIXTEEN
% \poparrangedpagesAB
% \relax,
-% 2*4=>\dostelarrangereninXY{2}{2}{4}{3}{3}
+% 2*4=>\dosetuparrangingXY{2}{2}{4}{3}{3}
% \pusharrangedpageEIGHT
% \poparrangedpagesAB
% \relax,
-% 2*2=>\dostelarrangereninXY{2}{1}{2}{3}{2}
+% 2*2=>\dosetuparrangingXY{2}{1}{2}{3}{2}
% \pusharrangedpageFOUR
% \poparrangedpagesAB
% \relax,
-% 2SIDE=>\dostelarrangereninXY{2}{1}{2}{3}{2}
+% 2SIDE=>\dosetuparrangingXY{2}{1}{2}{3}{2}
% \pusharrangedpageSIDE
% \poparrangedpagesAB
% \relax,
-% 2UP=>\dostelarrangereninXY{2}{1}{4}{3}{2}
+% 2UP=>\dosetuparrangingXY{2}{1}{4}{3}{2}
% \pusharrangedpageTWO
% \poparrangedpagesTWO,
% \handlearrangedpageTWOUP,
-% 2DOWN=>\dostelarrangereninXY{1}{2}{4}{2}{3}
+% 2DOWN=>\dosetuparrangingXY{1}{2}{4}{2}{3}
% \pusharrangedpageTWO
% \poparrangedpagesTWO
% \handlearrangedpageTWODOWN,
@@ -193,7 +279,7 @@
% \s!default=>\global\arrangingpagesfalse]%
% \doifcommonelse{#1}{90,270,\v!geroteerd}
% {\swapmacros\horizontalcutmarks\verticalcutmarks}{}% ugly solution
-% \stelpapierformaatin
+% \setuppapersize
% \ifarrangingpages
% \abortutilitygeneration
% \fi
@@ -207,8 +293,8 @@
\advance\scratchcounter by \realpageno
\advance\scratchcounter by -1
\dorecurse{\scratchcounter}
- {\geenhoofdenvoetregels
- \insertdummypage}
+ {\noheaderandfooterlines
+ \ejectdummypage}
\fi}
\def\handlearrangedpageXY#1#2#3#4#5%
@@ -611,7 +697,10 @@
\hbox to \hsize
{\@@iplinks
\ifnum\combinedpagescounter>\@@ipn \else
- \externalfigure[#1][\c!pagina=\combinedpagescounter,\c!factor=\v!max,\c!kader=\@@ipkader]%
+ \externalfigure[#1]
+ [\c!pagina=\combinedpagescounter,
+ \c!factor=\v!max,
+ \c!kader=\@@ipkader]%
\fi
\@@iprechts}
\@@iponder}%
@@ -644,33 +733,33 @@
{\getparameters[\??pc][#1]%
\doifelse{\@@pcstatus}{\v!start}
{\doifinsetelse{\@@pcplaats}{\v!onder,\v!boven}
- {\stelpapierformaatin[\c!links=\hskip\@@pcoffset]%
+ {\setuppapersize[\c!links=\hskip\@@pcoffset]%
\adddimenmacro\papierhoogte\@@pcoffset\@@pcoffset\@@pcafstand\@@pchoogte\to\@@pcpaperheight
\adddimenmacro\papierbreedte\@@pcoffset\@@pcoffset\to\@@pcpaperwidth
\defineoverlay[pagecomment][\placepagecommentTB]}
- {\stelpapierformaatin[\c!boven=\vskip\@@pcoffset]%
+ {\setuppapersize[\c!boven=\vskip\@@pcoffset]%
\adddimenmacro\papierhoogte\@@pcoffset\@@pcoffset\to\@@pcpaperheight
\adddimenmacro\papierbreedte\@@pcoffset\@@pcoffset\@@pcafstand\@@pcbreedte\to\@@pcpaperwidth
\defineoverlay[pagecomment][\placepagecommentLR]}%
\processaction
[\@@pcplaats]
- [ \v!onder=>{\stelpapierformaatin[\c!onder =\vss,\c!boven =\vskip\@@pcoffset]},
- \v!boven=>{\stelpapierformaatin[\c!boven =\vss,\c!onder =\vskip\@@pcoffset]},
- \v!links=>{\stelpapierformaatin[\c!links =\hss,\c!rechts=\hskip\@@pcoffset]},
- \v!rechts=>{\stelpapierformaatin[\c!rechts=\hss,\c!links =\hskip\@@pcoffset]}]%
- \definieerpapierformaat
+ [ \v!onder=>{\setuppapersize[\c!onder =\vss,\c!boven =\vskip\@@pcoffset]},
+ \v!boven=>{\setuppapersize[\c!boven =\vss,\c!onder =\vskip\@@pcoffset]},
+ \v!links=>{\setuppapersize[\c!links =\hss,\c!rechts=\hskip\@@pcoffset]},
+ \v!rechts=>{\setuppapersize[\c!rechts=\hss,\c!links =\hskip\@@pcoffset]}]%
+ \definepapersize
[commentedpage]
[\c!hoogte=\@@pcpaperheight,
\c!breedte=\@@pcpaperwidth]%
- \let\@@pcprintpaperformat\printpapierformaat
- \stelpapierformaatin[\papierformaat][commentedpage]%
- \stelachtergrondenin[\v!papier][\c!achtergrond=pagecomment]}
+ \let\@@pcprintpapersize\printpapersize
+ \setuppapersize[\papersize][commentedpage]%
+ \setupbackgrounds[\v!papier][\c!achtergrond=pagecomment]}
{\doif{\@@pcstatus}{\v!stop} % else initialization invokes backgrounds
{% this should be tested first
- % \expanded{\stelpapierformaatin[\papierformaat][\@@pcprintpaperformat]}%
- \stelachtergrondenin[\v!papier][\c!achtergrond=]}}}
+ % \expanded{\setuppapersize[\papersize][\@@pcprintpapersize]}%
+ \setupbackgrounds[\v!papier][\c!achtergrond=]}}}
-\def\@@pcprintpaperformat{\printpapierformaat}
+\def\@@pcprintpapersize{\printpapersize}
\def\placepagecommentTB%
{\vbox to \printpapierhoogte
@@ -720,6 +809,42 @@
\c!hoogte=5cm,
\c!breedte=10cm]
-\protect
-
-\endinput
+\protect \endinput
+
+% This macro cuts a page into n parts that can be pasted
+% together.
+%
+% \def\slicepages%
+% {\dodoubleempty\doslicepages}
+%
+% \def\doslicepages[#1][#2]%
+% {\bgroup
+% \getfiguredimensions[#1]
+% \getparameters[\??ip][\c!n=1,#2]
+% \definepapersize
+% [\s!dummy][\c!hoogte=\figureheight,\c!breedte=\figurewidth]
+% \setuppapersize
+% [\s!dummy][\s!dummy]
+% \setuplayout
+% [\c!rugwit=\!!zeropoint,\c!kopwit=\!!zeropoint,
+% \c!hoogte=\v!midden,\c!breedte=\v!midden,
+% \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]
+% \dorecurse{\noffigurepages}
+% {\let\pslice=\recurselevel
+% \dorecurse{\@@ipn}
+% {\let\xslice\recurselevel
+% \dorecurse{\@@ipn}
+% {\let\yslice\recurselevel
+% \clip
+% [\c!nx=\@@ipn,\c!ny=\@@ipn,\c!x=\xslice,\c!y=\yslice]
+% {\schaal
+% [\c!schaal=\@@ipn000]
+% {\externalfigure[#1][\c!pagina=\pslice]}}
+% \pagina}}}
+% \egroup}
+%
+% \starttext
+%
+% \slicepages[slice1.pdf][n=3]
+%
+% \stoptext
diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex
new file mode 100644
index 000000000..f6f59dd92
--- /dev/null
+++ b/tex/context/base/page-ini.tex
@@ -0,0 +1,1511 @@
+%D \module
+%D [ file=page-ini,
+%D version=2000.10.20,
+%D title=\CONTEXT\ Page Macros,
+%D subtitle=Initializations,
+%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 / Initializations}
+
+%D This class of modules implements the output routines and
+%D floating body support. Although the modules are relatively
+%D new, the code herein is rather old. This reordering was
+%D needed when column sets were implemented and sharing code
+%D started to make sense.
+
+%D The history shows from the code, since both column
+%D mechanism use a different way of looping over columns.
+
+\unprotect
+
+\def\m!otr{otr}
+
+% message will be distributed
+
+\startmessages dutch library: systems
+ title: systeem
+ 1: laden hulpfile uitgesteld (typemode)
+ 2: -- geladen
+% 3: probeer LaTeX eens
+ 4: commando -- is al gedefinieerd
+ 5: macro's uit module -- geladen
+ 6: geen macro's in module -- gevonden
+ 7: macro's uit module -- reeds geladen
+ 8: nieuwe versie hulpfile, tweede run nodig
+ 9: -- niet gevonden/geplaatst
+ 10: gebruik geen em in --
+ 11: aanmaken basale hulpfile
+ 12: de hulpfile is niet gesorteerd, gebruik texutil
+ 13: markering -- gedefinieerd --
+ 14: geforceerde paginaovergang in lijst voor --
+ 15: wegschrijven buffer --
+ 16: inlezen buffer --
+ 17: verbatim inlezen buffer --
+ 18: synoniem -- -- bestaat niet
+ 19: betekenissen (synoniemen) van -- geladen
+ 20: betekenissen (sorteren) van -- geladen
+ 21: de hulpfile is niet geladen
+ 22: gebruik een goede hulpfile
+ 23: -- gearrangeerd op --
+ 24: Plaatsblokken
+ 25: Verwijzingen
+ 26: Registers
+ 27: Versie
+\stopmessages
+
+\startmessages english library: systems
+ title: system
+ 1: loading utility-file postponed (typemode)
+ 2: -- loaded
+% 3: try LaTeX
+ 4: command -- is already defined
+ 5: macros of module -- loaded
+ 6: no macros found in module --
+ 7: macros of module -- already loaded
+ 8: new version of utility file, second pass needed
+ 9: -- not found/processed
+ 10: don't use em in --
+ 11: building simple util
+ 12: the utility-file is not sorted, use texutil
+ 13: mark -- defined --
+ 14: forced newpage in list at --
+ 15: saving buffer --
+ 16: typesetting buffer --
+ 17: typesetting verbatim buffer --
+ 18: synonym -- -- does not exist
+ 19: meaning (synonyms) of -- loaded
+ 20: meaning (sorts) of -- loaded
+ 21: no utility data is loaded
+ 22: use a valid utilityfile
+ 23: -- arranged at --
+ 24: Floatblocks
+ 25: References
+ 26: Registers
+ 27: Version
+\stopmessages
+
+\startmessages german library: systems
+ title: system
+ 1: Laden der Hilfsdatei verschoben (tippenmodus)
+ 2: -- geladen
+% 3: Versuche LaTeX
+ 4: Befehl -- ist bereits definiert
+ 5: Makros aus Modul -- geladen
+ 6: Keine Makros in Modul -- gefunden
+ 7: Makros aus Modul -- bereits geladen
+ 8: Neue Version der Hilfsdatei, zweiter Durchlauf benoetigt
+ 9: -- nicht gefunden/verarbeitet
+ 10: Benutzte kein em in --
+ 11: Erstelle einfache Hilfdatei
+ 12: Die Hilfdatei ist nicht sortiert, verwende texutil
+ 13: Beschriftung -- definiert --
+ 14: Erzwungendes Seitenumbruch in Liste bei --
+ 15: Speichere Buffer --
+ 16: Setzte Buffer --
+ 17: Setzte tippen-Buffer --
+ 18: Synonym -- -- existiert nicht
+ 19: Bedeutung (synonyme) von -- geladen
+ 20: Bedeutung (sortieren) von -- geladen
+ 21: Die Hilfsdatei ist nicht geladen
+ 22: Benoetige gueltige Hilfsdateie
+ 23: -- angeordnet auf --
+ 24: Fliessbloecke
+ 25: Referenzen
+ 26: Register
+ 27: Version
+\stopmessages
+
+\startmessages czech library: systems
+ title: system
+ 1: nacteni pomocneho souboru odlozeno (typemode)
+ 2: -- nacteno
+% 3: zkuste LaTeX
+ 4: prikaz -- je jiz definovan
+ 5: makra z -- nactena
+ 6: zadna makra v -- nenalezena
+ 7: makra z -- jsou jiz nactena
+ 8: nova verze pomocneho souboru, je treba druheho behu
+ 9: -- nenalezeno/nezpracovano
+ 10: nepouzivejte em v --
+ 11: vytvarim jednoduchy pomocny soubor
+ 12: pomosny soubor neni setriden, pouzijte texutil
+ 13: znacka -- definovana --
+ 14: vynucena nova stranka v seznamu na --
+ 15: uklada se buffer --
+ 16: sazi se buffer --
+ 17: sazi se doslovny (verbatim) buffer --
+ 18: synonymum -- -- neexistuje
+ 19: vyznam (synonyma) -- nacten
+ 20: vyznam (trideni) -- nacten
+ 21: pomocny soubor necten
+ 22: pouzijte platny pomocny soubor
+ 23: -- upraveno na --
+ 24: plovouci bloky
+ 25: reference
+ 26: registry
+ 27: verze
+\stopmessages
+
+\startmessages italian library: systems
+ title: sistema
+ 1: caricamento dei file supplementari posticipato (typemode)
+ 2: -- caricato
+% 3: provare LaTeX
+ 4: comando -- già definito
+ 5: macro del modulo -- caricate
+ 6: nessuna macro trovata nel modulo --
+ 7: macro del modulo -- già caricate
+ 8: nuova versione del file supplementare, seconda passata necessaria
+ 9: -- non trovato/elaborato
+ 10: non usare em in --
+ 11: costruzione di un semplice supplemento
+ 12: file di supplemento non ordinato, usare texutil
+ 13: marcatura -- definita --
+ 14: nuova pagina obbligata in lista a --
+ 15: salvataggio del buffer --
+ 16: composizione del buffer --
+ 17: composizione verbatim del buffer --
+ 18: sinonimo -- -- non esistente
+ 19: significato (sinonimi) di -- caricato
+ 20: significato (specie) di -- caricato
+ 21: nessuna informazione supplementare caricata
+ 22: usare un file supplementare valido
+ 23: -- sistemato a --
+ 24: Oggetti mobili
+ 25: Riferimenti
+ 26: Registri
+ 27: Versione
+\stopmessages
+
+\startmessages norwegian library: systems
+ title: system
+ 1: innlesning av hjelpefila utsatt (typemode)
+ 2: -- er lest inn
+% 3: forsøker LaTeX
+ 4: kommando -- er allerede definert
+ 5: makroene i modul -- er lest inn
+ 6: ingen makroer funnet i modul ---
+ 7: makroene i modul -- er allerede lest inn
+ 8: ny versjon av hjelpefil, andre gjennomkjøring nødvendig
+ 9: -- ikke funnet/behandlet
+ 10: ikke bruk em i --
+ 11: lager enkel hjelpefil
+ 12: hjelpefila er ikke sortert, bruk texutil
+ 13: markering -- definert --
+ 14: tvunget sideskift i liste ved --
+ 15: lagrer Buffer --
+ 16: tegnsetter buffer --
+ 17: tegnsetter verbatim-buffer --
+ 18: synonym -- -- eksisterer ikke
+ 19: betydning (synonymer) av -- er lest inn
+ 20: betydning (sorterer) av -- er lest inn
+ 21: hjelpefila er ikke lest inn
+ 22: bruk en gyldig hjelpefil
+ 23: -- arrangert på --
+ 24: Flytblokker
+ 25: Referanser
+ 26: Registere
+ 27: Versjon
+\stopmessages
+
+\startmessages romanian library: systems
+ title: sistem
+ 1: se incarca utilitarul-fisierul este amanat (typemode)
+ 2: -- s-a incarcat
+% 3: incercati LaTeX
+ 4: comanda -- este deja definita
+ 5: macro-urile din modulul -- s-au incarcat
+ 6: nu s-au gasit macro-uri in modulul --
+ 7: macro-urile din modulul -- s-au incarcat deja
+ 8: o noua versiune de fisier utilitar, este necesara o noua trecere
+ 9: -- nu este gasit/procesat
+ 10: nu folositi em in --
+ 11: se creeaza un utilitar simplu
+ 12: fisierul utilitar nu este sortat, folositi texutil
+ 13: marcajul -- definit --
+ 14: s-a fortat trecere pa pagina noua in lista la --
+ 15: buffer salvat --
+ 16: buffer-ul -- s-a cules
+ 17: se culege buffer-ul verbatim --
+ 18: sinonimul -- -- nu exista
+ 19: intelesul (sinonimele) pentru -- incarcat
+ 20: intelesul (ordinea) pentru -- incarcat
+ 21: nici o data utilitara nu este incarcata
+ 22: folositi un fisier utilitar valid
+ 23: -- aranjat la --
+ 24: Blocuri
+ 25: Referinte
+ 26: Registri
+ 27: Versiune
+\stopmessages
+
+\startmessages dutch library: layouts
+ title: layout
+ 1: teksthoogte aangepast met -- op pagina --
+ 2: -- maal uitgestelde tekst tussengevoegd
+ 3: -- maal tekst plaatsen uitstellen
+ 4: margeblokken actief
+ 5: margeblokken inactief
+ 6: subpagina reeks -- verwerkt (aantal --)
+% 7: beeldmerken berekenen
+% 8: achtergronden berekenen
+ 10: -- en -- tellen niet op tot 1.0
+ 11: interlinie -- niet toegestaan in gridmode
+\stopmessages
+
+\startmessages english library: layouts
+ title: layout
+ 1: textheight adapted with -- at page --
+ 2: -- times postponed text placed
+ 3: -- times text postponed
+ 4: marginblocks active
+ 5: marginblocks inactive
+ 6: subpage set -- processed (size --)
+% 7: calculating logospace
+% 8: calculating backgrounds
+ 10: -- and -- don't add up to 1.0
+ 11: spacing -- not permitted in gridmode
+\stopmessages
+
+\startmessages german library: layouts
+ title: Layout
+ 1: Texthoehe angepasst mit -- auf Seite --
+ 2: -- mal verschobener Text plaziert
+ 3: -- mal Text verschoben
+ 4: marginalbloecke aktiv
+ 5: marginalbloecke inaktiv
+ 6: Unterseitenfolge -- verarbeitet (Groesse --)
+% 7: berechne Platz des Logo
+% 8: berechne Hintergrund
+ 10: -- und -- ergeben zusammen nicht 1.0
+ 11: Zwischenraum -- nicht im Grittermoduserlau
+\stopmessages
+
+\startmessages czech library: layouts
+ title: layout
+ 1: vyska textu prizpusobena s -- na strane --
+ 2: -- krat odlozeny text umisten
+ 3: -- krat text odlozen
+ 4: okrajove bloky aktivni
+ 5: okrajove bloky neaktivni
+ 6: sada stran -- zpracovana (velikost --)
+% 7: pocita se misto pro logo
+% 8: pocita se pozadi
+ 10: -- a -- nedava dohromady 1.0
+ 11: svisla mezera -- neni povolena v pevnem radkovem rejstriku
+\stopmessages
+
+\startmessages italian library: layouts
+ title: layout
+ 1: altezza del testo adattata con -- a pagina --
+ 2: posizionato testo posticipato -- volte
+ 3: testo posticipato -- volte
+ 4: blocchi in margine attivi
+ 5: blocchi in margine inattivi
+ 6: gruppo di sottopagine -- elaborato (dimensione --)
+% 7: calcolo dello spazio per logo
+% 8: calcolo dello sfondo
+ 10: -- e -- non sommano a 1.0
+ 11: spaziatura -- non permessa in modo griglia
+\stopmessages
+
+\startmessages norwegian library: layouts
+ title: layout
+ 1: teksthøyde tilpasset med -- på side --
+ 2: -- ganger forskjøvet tekst plassert
+ 3: -- ganger tekst forskjøvet
+ 4: margblokker aktive
+ 5: margblokker inaktive
+ 6: delside sett -- behandlet (størrelse --)
+% 7: beregner plass for logo
+% 8: beregner bakgrunn
+ 10: -- og -- er ikke 1.0 til sammen
+ 11: mellomrom -- ikke tillatt i gridmodus
+\stopmessages
+
+\startmessages romanian library: layouts
+ title: aranjamente
+ 1: textheight adaptat cu -- la pagina --
+ 2: textul amanat de -- ori a fost plasat
+ 3: textul amanat de -- ori
+ 4: blocuri marginale active
+ 5: blocuri marginale inactive
+ 6: setul -- de subpagini procesat (dimensiunea --)
+% 7: se calculeaza spatiul pentru logo
+% 8: se calculeaza fundalurile
+ 10: -- si -- nu se adauga pana la 1.0
+ 11: spatierea -- nu este permisa in gridmode
+\stopmessages
+
+\ifx\recalculatelayout\undefined
+
+ \let \recalculatelayout \relax
+
+\fi
+
+\ifx\recalculatelogos\undefined
+
+ \let \recalculatelogos \relax
+ \let \addlogobackground \gobbleoneargument % <box>
+
+\fi
+
+\ifx\recalculatebackgrounds\undefined
+
+ \let \recalculatebackgrounds \relax
+ \let \addmainbackground \gobbleoneargument % <box>
+ \let \addtextbackground \gobbleoneargument % <box>
+ \let \addpagebackground \gobbleoneargument % <box>
+ \let \addprintbackground \gobbleoneargument % <box>
+ \let \addstatusinfo \gobbleoneargument % <box>
+
+\fi
+
+% principle:
+%
+% multiple otr's
+%
+% (1) single column, simple routine (old one)
+% (2) multi column, collect and split routine (old one)
+% (3) multi column, page by page (new one, needed for taco)
+% (4) single column, spread handling (for fun)
+% (5) multi column, page by page, spread handling (as challenge)
+%
+% common components
+%
+% (1) float placement
+% (2) float flushing
+% (3) page body building
+% (4) ...
+%
+% ort
+%
+% + balancing
+% - mixed / one / multi / balancetofit
+% + backgrounds
+% + pre / post
+% + distances / heights
+% + ragged / baseline / normal
+% - pos sync
+% - last page
+%
+% - itemize / subtexts -> old mechanism
+%
+% floats
+%
+% - top / bottom / side / page / column / spead
+% - flush / packed flush / current page / next page / area
+%
+% footnotes
+%
+% + carry over pre column / local to column
+% + last column / pre last column / each column
+% - multiple classes
+% - area / page / end
+%
+% areas
+%
+% - top / bottom / mid in spread
+%
+% IMPORTANT
+%
+% switchtobodyfont in between ivm top
+
+% floats:
+%
+% tricky in balancing mode, a la huidige multi columns
+
+\startmessages dutch library: columns
+ title: kolommen
+ 1: maximaal -- kolommen
+ 2: gebruik eventueel \string\filbreak
+ 3: probleempje, probeer [balanceren=nee]
+ 4: plaatsblok boven nog niet mogelijk
+ 5: plaatsblok onder nog niet mogelijk
+ 6: -- plaatsblok(en) opgeschort
+ 7: balanceren afgebroken na 100 stappen
+ 8: gebalanceerd in -- stap(pen)
+ 9: uitlijnen controleren!
+ 10: (minder dan) 1 regel over
+ 11: plaatsblok te breed voor kolom
+ 12: plaatsblok verplaatst naar volgende kolom / --
+ 13: breed figuur geplaatst boven kolommen
+\stopmessages
+
+\startmessages english library: columns
+ title: columns
+ 1: only -- columns possible
+ 2: use \string\filbreak\space as alternative
+ 3: problems, disable balancing
+ 4: top float not yet supported
+ 5: bottom float not yet supported
+ 6: -- float(s) postponed
+ 7: balancing aborted after 100 steps
+ 8: balanced in -- step(s)
+ 9: check raggedness
+ 10: (less than) 1 line left
+ 11: float to wide for column
+ 12: float moved to next column / --
+ 13: wide float moved to top of columns
+\stopmessages
+
+\startmessages german library: columns
+ title: Spalten
+ 1: nur -- Spalten moeglich
+ 2: benutzte \string\filbreak\space als Alternative
+ 3: Problem, verwende [ausgleich=nein]
+ 4: Gleitobjekt oben ncoh nicht unterstuetzt
+ 5: Gleitobjekt unten ncoh nicht unterstuetzt
+ 6: -- Gleitobjekt(e) verschoben
+ 7: ausgleich nach 100 Schritten abgebrocheb
+ 8: ausgeglichen nach -- Schritt(en)
+ 9: Ausrichtung ueberpruefen
+ 10: (weniger als) 1 Zeile uebrig
+ 11: Gleitobjekt zu breit fuer Spalte
+ 12: Gleitobjekt in naechste Zeile verschoben / --
+ 13: breites Gleitobjekt an den Anfang der Spalten verschoben
+\stopmessages
+
+\startmessages czech library: columns
+ title: sloupce
+ 1: je mozno pouze -- sloupcu
+ 2: pouzijte \string\filbreak\space jako alternativu
+ 3: problem, vypina se vyvazovani
+ 4: horni plovouci objekt jeste neni podporovan
+ 5: spodni plovouci objekt jeste neni podporovan
+ 6: -- plovouci objekt(y) odlozeny
+ 7: vyvazovani ukonceno po 100 krocich
+ 8: vyvazeno v -- krocich
+ 9: kontrola nerovnost
+ 10: zbyl (mene nez) 1 radek
+ 11: plovouci objekt je pro sloupec prilis siroky
+ 12: plovouci objekt je presunut do nasledujiciho sloupce / --
+ 13: siroky plovouci objekt je presunut nad sloupce
+\stopmessages
+
+\startmessages italian library: columns
+ title: colonne
+ 1: solo -- colonne possibili
+ 2: in alternativa, usare \string\filbreak
+ 3: problemi, disabilitare il bilanciamento
+ 4: float in cima non ancora supportato
+ 5: float in fondo non ancora supportato
+ 6: -- float(s) posticipate
+ 7: bilanciamento annullato dopo 100 passi
+ 8: bilanciamento in -- passo/i
+ 9: controllare seghettamento
+ 10: (meno di) una riga rimasta
+ 11: oggetto mobile troppo ampio per la colonna
+ 12: oggetto mobile spostata alla colonna successiva / --
+ 13: oggetto mobile ampio spostato sopra le colonne
+\stopmessages
+
+\startmessages norwegian library: columns
+ title: kolonner
+ 1: maksimalt -- kolonner
+ 2: bruk \string\filbreak\space som et alternativ
+ 3: problemer, slår av balansering
+ 4: flytblokker øverst er ikke støttet enda
+ 5: flytblokker nedert er ikke støttet enda
+ 6: -- flytblokk forskjøvet
+ 7: balansering avbrutt etter 100 iterasjoner
+ 8: balansert etter -- iterasjoner
+ 9: kontroller tekstlayout!
+ 10: (mindre enn) 1 linje igjen
+ 11: flytblokk for bredt for kolonna
+ 12: flytblokk forskjøvet til neste kolonne / --
+ 13: bred flytblokk forksjøvet til toppen av kolonnene
+\stopmessages
+
+\startmessages romanian library: columns
+ title: coloane
+ 1: este posibil numai -- coloane
+ 2: folositi \string\filbreak\space ca alternativa
+ 3: probleme, se dezactiveaza alinierea
+ 4: cadrele top (top float) nu sunt inca suportate
+ 5: cadrele bottom (bottom float) nu sunt inca suportate
+ 6: -- blocurile sunt amanate
+ 7: alinierea este oprita dupa 100 de incercari
+ 8: aliniat in -- pas(i)
+ 9: verificat alinierea
+ 10: a mai ramas (mai putin de) 1 linie
+ 11: blocul este prea lat pentru coloana
+ 12: blocul este mutat pe urmatoarea coloana / --
+ 13: blocul lat este mutat in partea de sus a coloanelor
+\stopmessages
+
+%D In case we're not running \ETEX, we need to bypass a
+%D couple of primitives.
+
+\beginTEX \...discards
+
+ \chardef \savingvdiscards 1
+ \let \splitdiscards \relax
+ \let \pagediscards \relax
+
+\endTEX
+
+% ONE = single column
+% MUL = multi column
+% SET = columns sets
+
+\def\@@OTR{OTR}
+
+% \beginETEX \ifcsname
+%
+% \let\ifcs \ifcsname
+% \let\endcs\endcsname
+%
+% \endETEX
+%
+% \beginTEX \ifcsname
+%
+% \def\ifcs#1\endcs{\@EA\ifx\csname#1\endcsname\relax\else}
+%
+% \endTEX
+%
+% \def\OTRcommand#1%
+% {\csname\@@OTR
+% \ifcs\@@OTR\OTRidentifier\strippedcsname#1\endcs\OTRidentifier\fi
+% \strippedcsname#1\endcsname}
+
+\let\OTRdefault\empty
+
+\beginETEX \ifcsname
+
+\def\OTRcommand#1%
+ {\csname\@@OTR
+ \ifcsname\@@OTR\OTRidentifier\strippedcsname#1\endcsname
+ \OTRidentifier
+ \else\ifcsname\@@OTR\OTRdefault\strippedcsname#1\endcsname % fallback
+ \OTRidentifier
+ \fi\fi
+ \strippedcsname#1\endcsname}
+
+\endETEX
+
+\beginTEX
+
+\def\OTRcommand#1%
+ {\csname\@@OTR
+ \@EA\ifx\csname\@@OTR\OTRidentifier\strippedcsname#1\endcsname\relax
+ \@EA\ifx\csname\@@OTR\OTRdefault\strippedcsname#1\endcsname\relax % fallback
+ \else
+ \OTRdefault
+ \fi
+ \else
+ \OTRidentifier
+ \fi
+ \strippedcsname#1\endcsname}
+
+\endTEX
+
+% obsolete
+
+\def\installotr#1% andere naam, beter \connectotr of zo
+ {\def\OTRidentifier{#1}}
+
+\def\activateotr#1#2%
+ {\def\OTRidentifier{#1}%
+ \def\OTRdefault {#2}}
+
+%D The initialization of the \type {\hsize} and \type {\vsize}
+%D depends on the OTR used.
+
+\def\setvsize {\OTRcommand\setvsize}
+\def\sethsize {\OTRcommand\sethsize}
+\def\setfootnotehsize {\OTRcommand\setfootnotehsize}
+\def\finalsidefloatoutput {\OTRcommand\finalsidefloatoutput}
+\def\dopagecontents {\OTRcommand\dopagecontents}
+
+\def\dosettopinserts {\OTRcommand\dosettopinserts}
+\def\dosetbotinserts {\OTRcommand\dosetbotinserts}
+\def\dotopinsertions {\OTRcommand\dotopinsertions}
+\def\dobotinsertions {\OTRcommand\dobotinsertions}
+\def\dosetbothinserts {\OTRcommand\dosetbothinserts}
+
+\def\doflushfloats {\OTRcommand\doflushfloats}
+\def\flushfloatbox {\OTRcommand\flushfloatbox}
+\def\docheckiffloatfits {\OTRcommand\docheckiffloatfits}
+
+\def\someherefloat {\OTRcommand\someherefloat}
+\def\somefixdfloat {\OTRcommand\somefixdfloat}
+\def\somepagefloat {\OTRcommand\somepagefloat}
+\def\sometopsfloat {\OTRcommand\sometopsfloat}
+\def\somebotsfloat {\OTRcommand\somebotsfloat}
+\def\somesidefloat {\OTRcommand\somesidefloat}
+
+\def\nextcolumn {\OTRcommand\nextcolumn}
+
+% beter een \installotr#1 met #1 = macro en auto test
+
+\newif\iftraceotr
+
+\newcount\otrlevel
+
+\def\outputcounter{-100010}
+
+\def\doinvokeoutput%
+ {\iftraceotr
+ \expandafter\dodotracedoutput
+ \else
+ \expandafter\dodoinvokeoutput
+ \fi}
+
+\def\dodoinvokeoutput#1%
+ {\bgroup\par\penalty#1\relax\egroup}
+
+%\def\dodoinvokeoutput#1%
+% {\advance\otrlevel 1
+% \ifnum\otrlevel>1 \writestatus{otr}{nested output #1}\fi
+% \bgroup\par\penalty#1\relax\egroup
+% \advance\otrlevel -1 }
+
+\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}%
+ \dodoinvokeoutput{#1}%
+ \writestatus{\m!otr}{v:\the\vsize,g:\the\pagegoal,t:\the\pagetotal,f:\the\ht\footins}%
+ \writestatus{\m!otr}{stop \the\outputpenalty\space in column \number\mofcolumns}}
+
+\def\installoutput#1#2% \invoke \action
+ {\decrement\outputcounter
+ \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}
+
+\newtoks\mainoutput
+
+\mainoutput
+ {\doifdefinedelse{\@@OTR\the\outputpenalty}
+ {\getvalue{\@@OTR\the\outputpenalty}}
+ {\the\OTRcommand\output}}
+
+%\mainoutput
+% {\advance\otrlevel 1
+% \ifnum\otrlevel>1 \writestatus{otr}{nested main output}\fi
+% \doifdefinedelse{\@@OTR\the\outputpenalty}
+% {\getvalue{\@@OTR\the\outputpenalty}}
+% {\the\OTRcommand\output}%
+% \advance\otrlevel -1 }
+
+\output{\the\mainoutput}
+
+%D In order to force consistent use of variables, we
+%D predefine a lot of them here.
+
+%D The next two registers can be used to store pre column
+%D material as well as footnotes or so.
+
+\newbox\precolumnbox \newdimen\precolumnboxheight
+\newbox\postcolumnbox \newdimen\postcolumnboxheight
+
+%D We reserve a counter for the number of columns as well as
+%D the current column. Both are not to be changed by users!
+
+\newcount\nofcolumns \nofcolumns = 1
+\newcount\mofcolumns \mofcolumns = 1
+
+\chardef\maxnofcolumns = 50
+\chardef\allocatednofcolumns = 0
+
+%D The next dimensions reports the final column height
+
+\newdimen\finalcolumnheights
+\newcount\finalcolumnlines
+
+%D During initialization the temporary boxes are allocated.
+%D This enables us to use as much columns as we want, without
+%D exhausting the pool of boxes too fast. We could have packed
+%D them in one box, but we've got enough boxes.
+%D
+%D Two sets of boxes are declared, the txtboxes are used for
+%D the text, the topboxes are for moved column floats.
+
+\def\@col@{@col@}
+
+\def\initializecolumns#1%
+ {\ifnum#1>\maxnofcolumns
+ \showmessage{\m!columns}{1}{\maxnofcolumns}%
+ \nofcolumns=\maxnofcolumns
+ \else
+ \nofcolumns=#1\relax
+ \fi
+ \ifnum\nofcolumns>\allocatednofcolumns
+ \dorecurse\nofcolumns
+ {\ifnum\recurselevel>\allocatednofcolumns\relax
+ % \newbox\next \global\letvalue{\@col@-\recurselevel-t}=\next
+ \@EA\newbox\csname\@col@-\recurselevel-t\endcsname % text
+ \@EA\newbox\csname\@col@-\recurselevel-f\endcsname % foot
+ \@EA\newbox\csname\@col@-\recurselevel-h\endcsname % top insert
+ \@EA\newbox\csname\@col@-\recurselevel-l\endcsname % top insert
+ \fi}%
+ \global\chardef\allocatednofcolumns=\nofcolumns
+ \fi}
+
+\def\firstcolumnbox {\columntextbox1}
+\def\currentcolumnbox {\columntextbox\mofcolumns}
+\def\lastcolumnbox {\columntextbox\nofcolumns}
+
+\def\firsttopcolumnbox {\columntopbox 1}
+\def\currenttopcolumnbox{\columntopbox \mofcolumns}
+\def\lasttopcolumnbox {\columntopbox \nofcolumns}
+
+\def\columntextbox#1{\csname\@col@-\number#1-t\endcsname}
+\def\columnfootbox#1{\csname\@col@-\number#1-f\endcsname}
+\def\columntopbox #1{\csname\@col@-\number#1-h\endcsname}
+\def\columnbotbox #1{\csname\@col@-\number#1-l\endcsname}
+
+\def\columnsettextbox{\global\setbox\columntextbox}
+\def\columnsetfootbox{\global\setbox\columnfootbox}
+\def\columnsettopbox {\global\setbox\columntopbox}
+\def\columnsetbotbox {\global\setbox\columnbotbox}
+
+\def\columngettextbox{\copy\columntextbox}
+\def\columngetfootbox{\copy\columnfootbox}
+\def\columngettopbox {\copy\columntopbox}
+\def\columngetbotbox {\copy\columnbotbox}
+
+\def\columnerasetextboxes{\dorecurse\allocatednofcolumns{\columnsettextbox\recurselevel\emptybox}}
+\def\columnerasefootboxes{\dorecurse\allocatednofcolumns{\columnsetfootbox\recurselevel\emptybox}}
+\def\columnerasetopboxes {\dorecurse\allocatednofcolumns{\columnsettopbox \recurselevel\emptybox}}
+\def\columnerasebotboxes {\dorecurse\allocatednofcolumns{\columnsetbotbox \recurselevel\emptybox}}
+
+%D Without going in details we present two macro's which handle
+%D the columns. The action which is transfered by the the first
+%D and only parameter can do something with \type
+%D {\currentcolumnbox}. In case of the mid columns, \type
+%D {\firstcolumnbox} and \type {\lastcolumnbox} are handled
+%D outside these macro's.
+
+\def\dohandlecolumn#1%
+ {\mofcolumns=\recurselevel
+ \let\currentcolumn=\recurselevel
+ #1\relax}
+
+\def\dohandleallcolumns#1%
+ {\dorecurse{\nofcolumns}{\dohandlecolumn{#1}}}
+
+\def\dohandlerevcolumns#1%
+ {\dostepwiserecurse{\nofcolumns}{1}{-1}{\dohandlecolumn{#1}}}
+
+\def\dohandlemidcolumns#1%
+ {\dohandleallcolumns
+ {\ifnum\recurselevel>1\relax\ifnum\recurselevel<\nofcolumns\relax
+ \dohandlecolumn{#1}%
+ \fi\fi}}
+
+%D This register can be used as a temporary storage for page
+%D content.
+
+\newbox\restofpage
+
+%D Features.
+
+\newif\ifintermediatefootnotes
+\newif\ifcarryoverfootnotes %\carryoverfootnotestrue
+\newif\iflastcolumnfootnotes %\lastcolumnfootnotestrue
+\newif\ifbalancecolumns %\balancecolumnstrue
+\newif\ifbalancetoheight %\balancetoheighttrue
+\newif\ifforcecolumngrid \forcecolumngridtrue
+\newif\ifstretchcolumns \stretchcolumnsfalse
+\newif\ifinheritcolumns \inheritcolumnsfalse
+\newif\ifheightencolumns \heightencolumnsfalse
+
+\newif\ifbalancingcolumns
+\newif\ifcollectingcontent
+\newif\ifcolumnoverflow
+\newif\iffinalflushingfloats
+\newif\ifpackflushedfloats \packflushedfloatstrue % for the moment
+
+\newdimen\intercolumnwidth
+\newdimen\localcolumnwidth
+\newdimen\savedpagetotal
+
+\chardef\columndirection=0 % 0:lr 1:rl
+
+\def\minbalancetoplines {1}
+\def\minfreecolumnlines {2}
+
+\newif\ifrecentercolumnbox \recentercolumnboxtrue
+\newif\ifrerecentercolumnbox \rerecentercolumnboxtrue
+\newif\ifpackcolumnfloats \packcolumnfloatstrue
+
+\newbox\collectedpagefloats
+
+%D The \type {\ifdim} test is needed, because otherwise the
+%D last line of a text end up on top of the baseline instead of
+%D on the baseline, as is the case with preceding pages.
+%D Also, a \type {\vfil} better than a \type {\vfill}.
+
+\def\doejectpage%
+ {\par\ifdim\pagetotal>\pagegoal\else\normalvfil\fi}
+
+\def\ejectpage%
+ {\doejectpage\eject}
+
+\def\superejectpage%
+ {\doejectpage\supereject}
+
+\def\ejectinsert%
+ {\flushfootnotes
+ \bgroup
+ \noftopfloats=\!!thousand
+ \nofbotfloats=0
+ \doflushfloats
+ \egroup}
+
+\def\ejectdummypage%
+ {\ejectinsert
+ \hardespatie % will be different
+ \vfill
+ \ejectpage}
+
+\def\beforefinaloutput%
+ {}
+
+\def\afterfinaloutput%
+ {\forgetall
+ \vskip\!!zeropoint\relax
+ \ifvoid\normalpagebox
+ \else
+ \unvbox\normalpagebox
+ \penalty\outputpenalty
+ \fi
+ \ifnum\outputpenalty>-\@MM\relax
+ \else
+ \dosupereject
+ \fi
+ \inpagebodytrue % needed for enabling \blanko !
+ \dosetbothinserts % to be reconsidered !!!!!!!!!!!!!!
+ \setvsize % this is needed for interacting components, like floats and multicolumns
+ \adaptfuzzypagegoal} % watch this hack!
+
+\def\dofinaloutput#1#2%
+ {\beforefinaloutput
+ \the\everybeforeshipout
+ \ifspecialbasedsettings
+ \myshipout{\hbox{\hbox to \!!zeropoint{\the\pageboundsettings}\hbox{\dopagebody#1#2\setpagecounters}}}%
+ \else
+ \the\pageboundsettings
+ \myshipout{\hbox{\dopagebody#1#2\setpagecounters}}%
+ \fi
+ \the\everyaftershipout
+ \afterfinaloutput
+ \popcolor} % ... and here ...
+
+\def\donofinaloutput#1#2%
+ {\beforefinaloutput
+ \the\everybeforeshipout
+ \setpagecounters
+ \message{[-\the\realpageno]}%
+ \setbox0=\hbox
+ {\the\everyshipout
+ \dopagebody#1#2}%
+ \deadcycles=0
+ \gotonextrealpage
+ \the\everyaftershipout
+ \afterfinaloutput
+ \popcolor} % ... and here
+
+\def\finaloutput#1#2%
+ {\checkpageversion
+ \ifverwerken
+ \ifgeselecteerd
+ \dofinaloutput#1#2%
+ \else
+ \donofinaloutput#1#2%
+ \fi
+ \else
+ \ifgeselecteerd
+ \donofinaloutput#1#2%
+ \else
+ \dofinaloutput#1#2%
+ \fi
+ \fi
+ \resetselectiepagina
+ \verhoogpaginanummer
+ \checkpagedimensions
+ \ifnum\outputpenalty>-\@MM\relax
+ \else
+ \dosupereject
+ \fi
+ \douitstellen}
+
+\def\dooutput%
+ {\finaloutput\unvbox\normalpagebox}
+
+\maxdeadcycles=1000
+
+% will be installable tracer
+
+\newif\ifvoorlopig \voorlopigfalse
+\newif\ifconcept \conceptfalse
+
+\def\doplaatsversieaanduiding#1#2%
+ {\doifsomething{#2}
+ {\@EA\convertargument#2\to\ascii
+ \ #1: \ascii\
+ \!!doneatrue}}
+
+\def\plaatsversieaanduiding% nog engels maken
+ {\ifvoorlopig
+ \vskip\!!sixpoint
+ \hbox to \zetbreedte
+ {\infofont
+ \getmessage\m!systems{27}: \currentdate\
+ \doplaatsversieaanduiding{Project}\currentproject
+ \doplaatsversieaanduiding{Produkt}\currentproduct
+ \doplaatsversieaanduiding{Onderdeel}\currentcomponent
+ \if!!donea\else\ File: \jobname\fi
+ \hss\reportpagedimensions}%
+ \fi
+ \ifconcept
+ \vskip\!!sixpoint
+ \hbox to \zetbreedte
+ {\infofont
+ Concept: \currentdate
+ \hss\reportpagedimensions}%
+ \fi}
+
+% tot hier
+
+\def\doversie[#1]%
+ {\voorlopigfalse
+ \conceptfalse
+ \overfullrule=\!!zeropoint
+ \processaction
+ [#1]
+ [\v!voorlopig=>\voorlopigtrue\overfullrule=5pt,
+ \v!concept=>\concepttrue]}
+
+\def\versie%
+ {\dosingleargument\doversie}
+
+\def\addstatusinfo#1%
+ {\ifvoorlopig \donetrue \fi
+ \ifconcept \donetrue \fi
+ \ifdone
+ \setbox#1=\vbox to \papierhoogte
+ {\vsmashbox#1\box#1
+ \offinterlineskip
+ \vskip\topspace
+ \hsize\papierbreedte
+ \hfill\hbox{\plaatstestinfo\hskip.5cm}\vss
+ \settexthoffset\hskip\texthoffset
+ \tlap{\plaatsversieaanduiding}
+ \vskip.5cm}%
+ \fi}
+
+% 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
+ \convertargument#3\to\ascii
+ \xdef\extratestinfo%
+ {#2 \ascii}%
+ \gdef\totaltestinfo%
+ {\global\setbox#1=\vbox
+ {\unvbox#1\relax %\insert#1{%
+ \infofont \stelinterliniein
+ \hbox
+ {\strut
+ \expandafter\doboundtext\expandafter
+ {\extratestinfo}
+ {12em}
+ {..}%
+ \quad}}}%
+ \endgroup
+ \ifinner
+ \aftergroup\totaltestinfo
+ \else
+ \totaltestinfo
+ \fi
+ \fi\fi}
+
+\def\referentieinfo%
+ {\dotestinfo\referentieinfobox}
+
+\def\registerinfo%
+ {\dotestinfo\registerinfobox}
+
+\def\floatinfo%
+ {\dotestinfo\floatinfobox}
+
+\def\plaatstestinfo%
+ {\ifvoorlopig
+ \vbox to \zethoogte
+ {\forgetall
+ \infofont
+ \hsize10em
+ \ifvoid\floatinfobox\else
+ \strut \getmessage\m!systems{24}
+ \vskip\!!sixpoint
+ \unvbox\floatinfobox
+ \vskip\!!twelvepoint
+ \fi
+ \ifvoid\referentieinfobox\else
+ \strut \getmessage\m!systems{25}
+ \vskip\!!sixpoint
+ \unvbox\referentieinfobox
+ \vskip\!!twelvepoint
+ \fi
+ \ifvoid\registerinfobox\else
+ \strut \getmessage\m!systems{26}
+ \vskip\!!sixpoint
+ \unvbox\registerinfobox
+ \fi
+ \vss}
+ \fi}
+
+\versie[\v!definitief]
+
+% Output routines
+%
+% \dopagecontents#1#2 : tekst, floats en footnotes
+% \dopagebody#1#2 : hoofd, \pagecontents, voet
+% \dooutput : outputroutine
+%
+% \ifinpagebody
+
+% De volgende macro's worden gedefinieerd in de module
+% colo-ini. Om resetten bij twee maal laden te voorkomen
+% checken we wel even. Anders krijgen we een mark-build-up.
+
+\newif\ifinpagebody
+
+\ifx\pushcolor\undefined
+ \let \pushcolor \relax
+ \let \popcolor \relax
+ \let \startcolorpage \relax
+ \let \stopcolorpage \relax
+\fi
+
+% bewaren tvb documentatie
+%
+% \hbox to \hsize
+% {\en
+% \switchnaarkorps[5pt]%
+% \emergencystretch2em
+% \dimen0=\baselineskip
+% \baselineskip=\dimen0 plus 1pt
+% \hsize=.2\hsize
+% \vsize=2\hsize
+% \ruledvbox to \vsize{\input tufte \par}\hss
+% \ruledvbox to \vsize{\input tufte \par\kern-\prevdepth}\hss
+% \ruledvbox to \vsize{\input tufte \par\kern0pt}\hss
+% \ruledvbox to \vsize{\input tufte \par\vfill}\hss
+% \ruledvbox to \vsize{\input tufte \par\kern-\prevdepth\vfill}}
+%
+% \hbox to \hsize
+% {\en
+% \switchnaarkorps[5pt]%
+% \emergencystretch2em
+% \dimen0=\baselineskip
+% \baselineskip=\dimen0 plus 1pt
+% \hsize=.18\hsize
+% \vsize=2.5\hsize
+% \setbox0=\vbox{\input tufte\relax}%
+% \ruledvbox to \vsize{\unvcopy0}\hss
+% \ruledvbox to \vsize{\unvcopy0\kern-\dp0}\hss
+% \ruledvbox to \vsize{\unvcopy0\kern0pt}\hss
+% \ruledvbox to \vsize{\unvcopy0\vfill}\hss
+% \ruledvbox to \vsize{\unvcopy0\kern-\dp0\vfill}}
+
+\newtoks\afterpage \newtoks\aftereverypage
+\newtoks\beforepage \newtoks\beforeeverypage
+
+\newif\ifshowgrid \showgridfalse
+
+\def\showgrid%
+ {\tracegridsnappingtrue
+ \showgridtrue}
+
+\def\buildpagebox#1%
+ {\setbox#1=\vbox to \papierhoogte
+ {\hsize\papierbreedte
+ \vskip\kopwit
+ \doifbothsides
+ \hskip\rugwit
+ \orsideone
+ \hskip\rugwit
+ \orsidetwo
+ \hskip\papierbreedte
+ \hskip-\rugwit
+ \hskip-\zetbreedte
+ \od
+ \box#1}%
+ \dp#1=\!!zeropoint}
+
+\newif\ifpagebodyornaments \pagebodyornamentstrue
+\newif\ifarrangingpages \arrangingpagesfalse
+
+\let\poparrangedpages=\relax
+\let\pusharrangedpage=\relax
+
+\def\reportarrangedpage#1%
+ {\showmessage
+ {\m!systems}{23}
+ {\the\realpageno.\the\pageno\ifnum\subpageno>0 .\the\subpageno\fi,#1}}
+
+\newif\ifsavepagebody \newbox\savedpagebody
+
+\def\buildpagebody#1#2%
+ {\ifsavepagebody\global\setbox\savedpagebody\fi
+ \vbox
+ {\beginrestorecatcodes
+ \forgetall % igv problemen, check: \boxmaxdepth\maxdimen
+ \boxmaxdepth\maxdimen % new
+ \mindermeldingen
+ \setbox0=\vbox
+ {\offinterlineskip
+ \ifpagebodyornaments
+% \getbackgroundbox
+% \getlogobox
+ \bgroup % else footnotes get inconsistent font/baseline
+ \doconvertfont{\@@lyletter}{}% layoutparameter ?
+ \offinterlineskip
+ \gettextboxes
+ \egroup
+ \fi
+ \getmainbox#1#2}% including footnotes
+ \ifpagebodyornaments
+ \addmainbackground0%
+ \addlogobackground0%
+ \fi
+ \buildpagebox0%
+ \addstatusinfo0% new
+ \ifpagebodyornaments
+ \addpagebackground0%
+ \fi
+ \ifarrangingpages \else
+ \addpagecutmarks0%
+ \replicatepagebox0%
+ \scalepagebox0%
+ \mirrorpaperbox0%
+ \rotatepaperbox0%
+ \addpagecolormarks0%
+ \centerpagebox0%
+\addprintbackground0%
+ \mirrorprintbox0%
+ \rotateprintbox0%
+ \offsetprintbox0%
+ \negateprintbox0%
+ \fi
+ \box0%
+ \endrestorecatcodes}%
+ \ifsavepagebody\copy\savedpagebody\fi}
+
+\def\finishpagebox#1%
+ {\ifarrangingpages
+ \addpagecutmarks#1%
+ \addpagecolormarks#1%
+ \centerpagebox#1%
+ \mirrorprintbox#1%
+ \rotateprintbox#1%
+ \offsetprintbox#1%
+ \negateprintbox#1%
+ \fi}
+
+\chardef\normalpagebox=255
+
+\appendtoks \restoreglobalbodyfont \to \everypagebody
+\appendtoks \restorecolumnsettings \to \everypagebody
+
+\def\dopagebody#1#2%
+ {\getallmarks
+ \the\everypagebody
+ \startcolorpage
+ \gotonextsubpage % nog eens: als in pagina (tbv standaard opmaak)
+ \dontshowboxes % dan hier blokkeren en verderop resetten
+ \naastpagina
+ \checkreferences
+ \checkmargeblokken
+ \dotoks\beforeeverypage
+ \flushtoks\beforepage
+ \inpagebodytrue\buildpagebody#1#2%
+ \flushtoks\afterpage
+ \dotoks\aftereverypage
+ \resetpagina
+ \updatelistreferences
+ \resetlayoutlines % will go to \aftereverypage
+ \stopcolorpage}
+
+\newtoks\pageboundsettings
+
+\prependtoks \initializepaper \to \pageboundsettings
+
+\let\checkpageversion=\relax
+
+% not here
+
+\newif\ifpaginageblokkeerd
+\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
+ \else
+ \goodbreak
+ \fi
+ \fi}
+
+\let\resetcurrentsectionmarks=\relax
+
+% was: \resetsectionmarks[\firstsection], zie \handelpaginaaf
+
+\def\docomplexpagina[#1]%
+ {\flushfootnotes
+ \bgroup
+ \processallactionsinset
+ [#1]
+ [ \v!reset=>\global\paginageblokkeerdfalse,
+ \v!blokkeer=>\global\paginageblokkeerdtrue,
+ \v!ja=>\ifpaginageblokkeerd\else
+ \ejectinsert
+ \ejectpage
+ \ifbinnenkolommen
+ \ejectpage % anders soms geen overgang
+ \fi
+ \fi,
+ \v!opmaak=>\ifpaginageblokkeerd\else
+ \eject
+ \fi,
+ \v!blanko=>\pagebodyornamentsfalse,
+ \v!nee=>\ifpaginageblokkeerd\else
+ \dosomebreak\nobreak
+ \fi,
+ \v!voorkeur=>{\ifpaginageblokkeerd\else
+ \ifbinnenkolommen
+ \dosomebreak\goodbreak
+ \else
+ \testpagina[3][\!!zeropoint]%
+ \fi
+ \fi},
+ \v!grotevoorkeur=>{\ifpaginageblokkeerd\else
+ \ifbinnenkolommen
+ \dosomebreak\goodbreak
+ \else
+ \testpagina[5][\!!zeropoint]%
+ \fi
+ \fi},
+ \v!leeg=>{\ejectinsert
+ \ejectpage
+ \doifnotvalue{\??tk\v!hoofd\v!tekst\c!status}{\v!stop}
+ {\setupheader[\c!status=\v!leeg]}%
+ \doifnotvalue{\??tk\v!voet\v!tekst\c!status}{\v!stop}
+ {\setupfooter[\c!status=\v!leeg]}%
+ \ejectdummypage},
+ \v!links=>{\ejectinsert
+ \superejectpage
+ \doifbothsidesoverruled
+ \orsideone
+ \resetcurrentsectionmarks
+ \ejectdummypage
+ \orsidetwo
+ \od},
+ \v!rechts=>{\ejectinsert
+ \superejectpage
+ \doifbothsidesoverruled
+ \orsideone
+ \orsidetwo
+ \resetcurrentsectionmarks
+ \ejectdummypage
+ \od},
+ \v!even=>\pagina
+ \doifonevenpaginaelse
+ {\resetcurrentsectionmarks\ejectdummypage}{},
+ \v!oneven=>\pagina
+ \doifonevenpaginaelse
+ {}{\resetcurrentsectionmarks\ejectdummypage},
+ \v!viertal=>{\ifdubbelzijdig
+ \!!counta=\realpageno
+ \!!countb=\realpageno
+ \divide\!!counta by 4
+ \divide\!!countb by 2
+ \ifnum\!!counta=\!!countb
+ \else
+ \pagina
+ \pagina[\v!leeg]%
+ \pagina[\v!leeg]%
+ \fi
+ \fi},
+ \v!laatste=>{\ejectinsert
+ \superejectpage
+ \doifbothsidesoverruled
+ \naastpagina
+ \orsideone
+ \orsidetwo
+ %\ifodd\realpageno \else % kan weer weg
+ \noheaderandfooterlines
+ \ejectdummypage
+ %\fi
+ \od
+ \filluparrangedpages},
+ \s!unknown=>\doifinstringelse{+}{#1}
+ {\ejectinsert\ejectpage
+ \dorecurse{#1}{\ejectdummypage}}
+ {\doifnumberelse{#1}
+ {\ejectinsert\ejectpage
+ \doloop
+ {\ifnum\userpageno<#1\relax
+ \ejectdummypage
+ \else
+ \exitloop
+ \fi}}
+ {}}]%
+ \egroup}
+
+\def\complexpagina[#1]%
+ {\expanded{\docomplexpagina[#1]}}
+
+\def\simplepagina%
+% {\docomplexpagina[\v!ja]}
+ {\flushfootnotes
+ \ifpaginageblokkeerd\else
+ \ejectinsert
+ \ejectpage
+ \ifbinnenkolommen
+ \ejectpage % anders soms geen overgang
+ \fi
+ \fi}
+
+\definecomplexorsimple\pagina
+
+\def\resetpagina%
+ {\global\paginageblokkeerdfalse}
+
+% hier nog uti blokkeren
+
+% don't change this / test case:
+%
+% \setupbackgrounds[state=repeat]
+% \setupbackgrounds[text][text][background=whatever]
+% \couplepage[chapter][before={\defineoverlay[whatever][ON]}]
+% \setuphead[chapter][before={\pagetype[chapter]}]
+% \chapter{First} \page test \chapter{second} \page test
+
+\newif\ifgeselecteerd
+\geselecteerdtrue
+
+\newif\ifselecteren
+\selecterenfalse
+
+\newif\ifverwerken
+\verwerkentrue
+
+\def\selectie{}
+\def\paginasoort{}
+
+\let\naastpagina=\relax
+\let\napagina=\relax
+\let\voorpagina=\relax
+
+\def\dovoorpagina%
+ {\doifsomething{\paginasoort}
+ {\def\dododopagina##1%
+ {\global\let\voorpagina=\relax
+ \getvalue{\??pg##1\c!voor}}%
+ \processcommacommand[\paginasoort]\dododopagina}}
+
+\def\dododonapagina#1%
+ {\global\let\napagina=\relax
+ \gdef\paginasoort{}%
+ \getvalue{\??pg#1\c!na}}
+
+\def\donapagina%
+ {\doifsomething{\paginasoort}
+ {\def\dodopagina##1%
+ {\doifelsevalue{\??pg##1\c!optie}{\v!dubbelzijdig}
+ {\doifbothsidesoverruled
+ \dododonapagina{##1}%
+ \orsideone
+ \dododonapagina{##1}%
+ \orsidetwo
+ \od}%
+ {\dododonapagina{##1}}}%
+ \processcommacommand[\paginasoort]\dodopagina}}
+
+\def\dosoortpagina[#1]%
+ {\doglobal\addtocommalist{#1}\paginasoort
+ \ifselecteren
+ \ExpandBothAfter\doifcommon{#1}{\selectie}
+ {\global\geselecteerdtrue}%
+ \fi
+ \gdef\voorpagina{\dovoorpagina}%
+ \gdef\napagina{\donapagina}}
+
+\def\soortpagina%
+ {\dosingleargument\dosoortpagina}
+
+\def\dokoppelpagina[#1][#2]%
+ {\getparameters
+ [\??pg]
+ [\c!voor=,
+ \c!na=,
+ \c!optie=,
+ #2]%
+ \def\docommando##1%
+ {\getparameters
+ [\??pg##1]
+ [\c!voor=\@@pgvoor,
+ \c!na=\@@pgna,
+ \c!optie=\@@pgoptie]}%
+ \processcommalist[#1]\docommando}%
+
+\def\koppelpagina%
+ {\dodoubleargument\dokoppelpagina}
+
+\def\doverwerkpagina[#1][#2]%
+ {\processaction
+ [#2]
+ [ \v!ja=>\global\verwerkentrue,
+ \v!nee=>\global\verwerkenfalse]%
+ \gdef\selectie{#1}%
+ \global\selecterentrue
+ \global\geselecteerdfalse}
+
+\def\verwerkpagina%
+ {\dodoubleargument\doverwerkpagina}
+
+\def\resetselectiepagina%
+ {\ifselecteren
+ \doifbothsidesoverruled
+ \global\geselecteerdfalse
+ \orsideone
+ \orsidetwo
+ \global\geselecteerdfalse
+ \od
+ \fi}
+
+\protect \endinput
diff --git a/tex/context/base/page-lay.tex b/tex/context/base/page-lay.tex
new file mode 100644
index 000000000..b54a02bff
--- /dev/null
+++ b/tex/context/base/page-lay.tex
@@ -0,0 +1,1025 @@
+%D \module
+%D [ file=page-lay,
+%D version=2000.10.20, % copied from main-001
+%D title=\CONTEXT\ Page Macros,
+%D subtitle=Layout Specification,
+%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 / Layout Specification}
+
+% to be translated into english
+
+%D Before you start wondering why some of the page related
+%D modules skip upward or left in order to place elements, you
+%D must realize that the reference point is the top left
+%D corner of the main typesetting area. One reason for this
+%D choice is that it suited some viewers that displayed page
+%D areas. Another reason is that margins, edges and top and
+%D bottom areas are kind of virtual, while the header, text
+%D and footer areas normally determine the text flow.
+
+\unprotect
+
+%D First we get rid of the funny \TEX\ offset defaults of one
+%D inch by setting them to zero.
+
+\voffset = 0pt % setting this to -1in let's go metapost crazy
+\hoffset = 0pt % setting this to -1in let's go metapost crazy
+
+%D The dimensions related to layout areas are represented by
+%D real dimensions.
+
+\newdimen\papierhoogte \papierhoogte = 297mm
+\newdimen\papierbreedte \papierbreedte = 210mm
+
+\newdimen\printpapierhoogte \printpapierhoogte = 297mm
+\newdimen\printpapierbreedte \printpapierbreedte = 210mm
+
+\newdimen\zethoogte % calculated
+\newdimen\zetbreedte % calculated
+
+\newdimen\teksthoogte % calculated
+\newdimen\tekstbreedte % calculated
+
+\newdimen\kopwit \kopwit = 2cm
+\newdimen\rugwit \rugwit = \kopwit
+
+\newdimen\hoofdhoogte \hoofdhoogte = 2cm
+\newdimen\voethoogte \voethoogte = \hoofdhoogte
+
+\newdimen\kopoffset \kopoffset = 0pt
+\newdimen\rugoffset \rugoffset = \kopoffset
+
+\newdimen\linkermargebreedte \linkermargebreedte = 3cm
+\newdimen\rechtermargebreedte \rechtermargebreedte = \linkermargebreedte
+
+\newdimen\linkerrandbreedte \linkerrandbreedte = 3cm
+\newdimen\rechterrandbreedte \rechterrandbreedte = \linkerrandbreedte
+
+\newdimen\bovenhoogte \bovenhoogte = 0cm
+\newdimen\onderhoogte \onderhoogte = \bovenhoogte
+
+%D We can save some tokens and fuzzy parameters by using a
+%D symbolic name for the current set of layout parameters.
+
+\let\currentlayout\empty
+
+\def\layoutparameter#1%
+ {\ifundefined{\??ly\currentlayout#1}%
+ \getvalue{\??ly#1}%
+ \else
+ \getvalue{\??ly\currentlayout#1}%
+ \fi}
+
+%D Look how ugly a speed up looks:
+
+\beginTEX
+
+\def\layoutparameter#1%
+ {\csname\??ly\@EA\ifx\csname
+ \??ly\currentlayout#1\endcsname\relax\else\currentlayout
+ \fi#1\endcsname}
+
+\endTEX
+
+%D Its \ETEX\ counterpart is:
+
+\beginETEX \ifcsname
+
+\def\layoutparameter#1%
+ {\csname\??ly\ifcsname
+ \??ly\currentlayout#1\endcsname\currentlayout
+ \fi#1\endcsname}
+
+\endETEX
+
+%D Beause normal \TEX\ has at most 256 dimensions (of which a
+%D substantial part is already in use), we provide a way to
+%D generate a format with macro based alternatives. For a long
+%D time, this used to be the default case. Beware: only fixed
+%D dimensions can be used in calculations! By the way, the
+%D gain in speed can hardly be called impressive and is roughly
+%D 1 second on a 35 second run of 850 empty pages with a
+%D couple of backgrounds only (which is far less than one
+%D percent on a normal document).
+
+\newif\iffixedlayoutdimensions \fixedlayoutdimensionstrue
+
+\iffixedlayoutdimensions
+ \let\@the\the
+\else
+ \let\@the\empty
+\fi
+
+%D The next series of dimensions are complemented by left
+%D and rights ones.
+
+\iffixedlayoutdimensions
+
+ \newdimen \margeafstand
+ \newdimen \randafstand
+ \newdimen \margebreedte
+ \newdimen \randbreedte
+
+\else
+
+ \def\margeafstand{\layoutparameter\c!margeafstand}
+ \def\randafstand {\layoutparameter\c!randafstand}
+ \def\margebreedte{\layoutparameter\c!marge}
+ \def\randbreedte {\layoutparameter\c!rand}
+
+\fi
+
+%D Because a distance does not really makes sense when there
+%D is no area, we use a zero distance in case there is no
+%D area.
+
+\iffixedlayoutdimensions
+
+ \def\layoutdistance#1#2%
+ {\ifdim\zeropoint<#1\layoutparameter#2\else\zeropoint\fi}
+
+\else
+
+ \def\layoutdistance#1#2%
+ {\ifdim\!!zeropoint<#1\layoutparameter#2\else\!!zeropoint\fi}
+
+\fi
+
+%D The horizontal distances are:
+
+\iffixedlayoutdimensions
+
+ \newdimen \linkerrandafstand
+ \newdimen \rechterrandafstand
+ \newdimen \linkermargeafstand
+ \newdimen \rechtermargeafstand
+
+\else
+
+ \def\linkerrandafstand
+ {\layoutdistance\linkerrandbreedte\c!linkerrandafstand}
+
+ \def\rechterrandafstand%
+ {\layoutdistance\rechterrandbreedte\c!rechterrandafstand}
+
+ \def\linkermargeafstand%
+ {\layoutdistance\linkermargebreedte\c!linkermargeafstand}
+
+ \def\rechtermargeafstand%
+ {\layoutdistance\rechtermargebreedte\c!rechtermargeafstand}
+
+\fi
+
+%D The vertical distances are:
+
+\iffixedlayoutdimensions
+
+ \newdimen \bovenafstand
+ \newdimen \hoofdafstand
+ \newdimen \voetafstand
+ \newdimen \onderafstand
+
+\else
+
+ \def\bovenafstand{\layoutdistance\bovenhoogte\c!bovenafstand}
+ \def\hoofdafstand{\layoutdistance\hoofdhoogte\c!hoofdafstand}
+ \def\voetafstand {\layoutdistance\voethoogte \c!voetafstand }
+ \def\onderafstand{\layoutdistance\onderhoogte\c!onderafstand}
+
+\fi
+
+%D When fixed dimensions are used, we need to calculate the
+%D distances:
+
+\iffixedlayoutdimensions
+
+ \def\setlayoutdimensions%
+ {\global\margebreedte\layoutparameter\c!marge
+ \global\randbreedte \layoutparameter\c!rand
+ \global\margeafstand\layoutparameter\c!margeafstand
+ \global\randafstand \layoutparameter\c!randafstand
+ \global\linkerrandafstand \layoutdistance\linkerrandbreedte \c!linkerrandafstand
+ \global\rechterrandafstand \layoutdistance\rechterrandbreedte \c!rechterrandafstand
+ \global\linkermargeafstand \layoutdistance\linkermargebreedte \c!linkermargeafstand
+ \global\rechtermargeafstand\layoutdistance\rechtermargebreedte\c!rechtermargeafstand
+ \global\bovenafstand\layoutdistance\bovenhoogte\c!bovenafstand
+ \global\hoofdafstand\layoutdistance\hoofdhoogte\c!hoofdafstand
+ \global\global\voetafstand \layoutdistance\voethoogte \c!voetafstand
+ \global\onderafstand\layoutdistance\onderhoogte\c!onderafstand}
+
+\else
+
+ \let\setlayoutdimensions\relax
+
+\fi
+
+%D \macros
+%D {definepapersize}
+%D
+%D Before we start calculating layout dimensions, we will
+%D first take care of paper sizes. The first argument can be
+%D either an assignment (for defaults) or an identifier, in
+%D which case the second argument is an assignment.
+%D
+%D \showsetup{\y!definepapersize}
+
+\def\definepapersize%
+ {\dodoubleempty\dodefinepapersize}
+
+\def\dodefinepapersize[#1][#2]%
+ {\ifsecondargument
+ \getparameters
+ [\??pp#1] % geen \c!schaal, scheelt hash ruimte
+ [\c!breedte=\@@ppbreedte,
+ \c!hoogte=\@@pphoogte,
+ \c!offset=\@@ppoffset,
+ #2]%
+ \else
+ \getparameters[\??pp][#1]%
+ \setuppapersize
+ \fi}
+
+%D For the momenn we need to fake this macro.
+
+\ifx\setuppapersize\undefined
+ \let\setuppapersize\relax
+\fi
+
+%D We set the defaults to the dimensions of an A4 sheet of
+%D paper.
+
+\definepapersize
+ [\c!breedte=210mm,\c!hoogte=297mm,\c!offset=\!!zeropoint]
+
+%D \macros
+%D {setuppapersize}
+%D
+%D When setting up the papersize on which to typeset and
+%D print, we can also determine some more characteristics.
+%D
+%D \showsetup{\y!setuppapersize}
+%D
+%D We keep track of these features with the following
+%D variables.
+
+\chardef\papermirror =0 \chardef\printmirror =0
+\chardef\paperrotation =0 \chardef\printrotation =0
+\chardef\paperreverse =0 \chardef\printreverse =0
+\chardef\paperlandscape=0 \chardef\printlandscape=0
+
+\let\papersize\empty \let\printpapersize\empty
+
+\def\paperscale{1} \newif\ifnegateprintbox
+
+\def\setuppapersize%
+ {\dodoubleempty\dosetuppapersize}
+
+\def\dosetuppapersize[#1][#2]%
+ {\doifinstringelse{=}{#1}
+ {\getparameters[\??pp][#1]}
+ {\doifinstringelse{=}{#2}
+ {\getparameters[\??pp#1][#2]}
+ {\dodosetuppapersize[#1][#2]}}}
+
+\def\dodosetuppapersize[#1][#2]%
+ {\ifsecondargument
+ \xdef\restorepapersize%
+ {\noexpand\setuppapersize[#1][#2]}%
+ \dostelpapierrichtingin{#1}\paperlandscape\paperrotation\paperreverse\papermirror
+ \dostelpapierrichtingin{#2}\printlandscape\printrotation\printreverse\printmirror
+ \def\docommando##1%
+ {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
+ {\global\papierbreedte=\getvalue{\??pp##1\c!breedte}%
+ \global\papierhoogte=\getvalue{\??pp##1\c!hoogte}%
+ \calculatepaperoffsets{##1}%
+ \xdef\papersize{##1}}}}%
+ \processcommacommand[#1]\docommando
+ \doifdefinedelse{\??pp#1\c!schaal}
+ {\edef\paperscale{\getvalue{\??pp#1\c!schaal}}}
+ {\edef\paperscale{1}}%
+ \def\docommando##1%
+ {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
+ {\global\printpapierbreedte=\getvalue{\??pp##1\c!breedte}%
+ \global\printpapierhoogte=\getvalue{\??pp##1\c!hoogte}%
+ \xdef\printpapersize{##1}}}}%
+ \processcommacommand[#2]\docommando
+ \ifcase\paperlandscape\else
+ \doglobal\swapdimens\papierbreedte\papierhoogte
+ \fi
+ \ifcase\printlandscape\else
+ \doglobal\swapdimens\printpapierbreedte\printpapierhoogte
+ \fi
+ \ifdim\papierhoogte>\printpapierhoogte
+ \global\printpapierhoogte=\papierhoogte
+ \fi
+ \ifdim\papierbreedte>\printpapierbreedte
+ \global\printpapierbreedte=\papierbreedte
+ \fi
+ \calculatehsizes
+ \calculatevsizes
+ \recalculatelogos
+ \recalculatebackgrounds
+ \recalculatelayout
+ \else\iffirstargument
+ \setuppapersize[#1][#2]%
+ \else\ifx\papersize\undefined\else
+ \restorepapersize
+ \fi\fi\fi}
+
+\def\dostelpapierrichtingin#1#2#3#4#5%
+ {\global\chardef#2=0
+ \global\chardef#5=0
+ \gdef#3{0}%
+ \gdef#4{0}%
+ \global\negateprintboxfalse
+ \processallactionsinset
+ [#1]
+ [ \v!liggend=>\global\chardef#2=1,
+ \v!gespiegeld=>\global\chardef#5=1,
+ \v!geroteerd=>\gdef#3{90}\gdef#4{270},
+ \v!negatief=>\global\negateprintboxtrue,
+ 90=>\gdef#3{90}\gdef#4{270},
+ 180=>\gdef#3{180}\gdef#4{0},
+ 270=>\gdef#3{270}\gdef#4{90}]}
+
+\ifx\calculatepaperoffsets\undefined
+
+ \def\calculatepaperoffsets#1%
+ {\scratchdimen=\getvalue{\??pp#1\c!offset}%
+ \global\advance\papierbreedte by -2\scratchdimen
+ \global\advance\papierhoogte by -2\scratchdimen}
+
+\fi
+
+\let\restorepapersize\relax
+
+\def\checkforems[#1]%
+ {\def\docommando##1%
+ {\beforesplitstring##1\at em\to\asciia
+ \doifnot{\asciia}{##1}
+ {\aftersplitstring\asciia\at=\to\asciia
+ \doifsomething{\asciia}
+ {\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=0 % is gewoon beter
+ \clubpenalty =0 % zeker bij grids
+ \else
+ \widowpenalty=\defaultwidowpenalty
+ \clubpenalty =\defaultclubpenalty
+ \fi
+ \stelwitruimtein
+ \stelblankoin
+ \doifelse{\layoutparameter\c!breedte}{\v!midden}
+ {\global\zetbreedte=\papierbreedte
+ \global\advance\zetbreedte by -\rugwit
+ \scratchdimen=\layoutparameter\c!snijwit\relax
+ \ifdim\scratchdimen=\zeropoint
+ \scratchdimen=\rugwit
+ \fi
+ \global\advance\zetbreedte by -\scratchdimen}
+ {\doifelse{\layoutparameter\c!breedte}{\v!passend}
+ {\global\zetbreedte=\papierbreedte
+ \global\advance\zetbreedte by -\rugwit
+ \scratchdimen=\rugwit
+ \advance\scratchdimen by -\linkerrandbreedte
+ \advance\scratchdimen by -\linkerrandafstand
+ \advance\scratchdimen by -\linkermargebreedte
+ \advance\scratchdimen by -\linkermargeafstand
+ \ifdim\scratchdimen<\zeropoint
+ \scratchdimen=\zeropoint
+ \fi
+ \global\advance\zetbreedte by -\rechtermargeafstand
+ \global\advance\zetbreedte by -\rechtermargebreedte
+ \global\advance\zetbreedte by -\rechterrandafstand
+ \global\advance\zetbreedte by -\rechterrandbreedte
+ \global\advance\zetbreedte by -\scratchdimen}
+ {\global\zetbreedte=\layoutparameter\c!breedte}}%
+ \doifelse{\layoutparameter\c!regels}{}
+ {\doifelse{\layoutparameter\c!hoogte}{\v!midden}
+ {\global\zethoogte=\papierhoogte
+ \global\advance\zethoogte by -\kopwit
+ \scratchdimen=\layoutparameter\c!bodemwit\relax
+ \ifdim\scratchdimen=\zeropoint
+ \scratchdimen=\kopwit
+ \fi
+ \global\advance\zethoogte by -\scratchdimen}
+ {\doifelse{\layoutparameter\c!hoogte}{\v!passend}
+ {\global\zethoogte=\papierhoogte
+ \global\advance\zethoogte by -\kopwit
+ \scratchdimen=\kopwit
+ \advance\scratchdimen by -\bovenhoogte
+ \advance\scratchdimen by -\bovenafstand
+ \ifdim\scratchdimen<\zeropoint
+ \scratchdimen=\zeropoint
+ \fi
+ \global\advance\zethoogte by -\onderafstand
+ \global\advance\zethoogte by -\onderhoogte
+ \global\advance\zethoogte by -\scratchdimen}
+ {\global\zethoogte=\layoutparameter\c!hoogte}}}
+ {\global\zethoogte=\layoutparameter\c!regels\lineheight
+ \global\advance\zethoogte by \hoofdhoogte
+ \global\advance\zethoogte by \voethoogte}%
+ \rugoffset=\layoutparameter\c!rugoffset
+ \kopoffset=\layoutparameter\c!kopoffset
+ \calculatehsizes
+ \calculatevsizes
+ \recalculatelogos
+ \recalculatebackgrounds}
+
+\def\checklayout%
+ {\doifsomething{\layoutparameter\c!regels}
+ {\ifdim\zethoogte=\layoutparameter\c!regels\lineheight \else \recalculatelayout \fi}}
+
+\appendtoks \checklayout \to \everystarttext
+
+\def\checkcurrentlayout%
+ {\doifundefinedelse{\??ly\number\realfolio\c!status}
+ {\doifonevenpaginaelse
+ {\doifdefined{\??ly\v!oneven\c!status}{\stellayoutin[\v!oneven]}}
+ {\doifdefined{\??ly\v!even \c!status}{\stellayoutin[\v!even ]}}}
+ {\stellayoutin[\number\realfolio]}}
+
+\appendtoks \checkcurrentlayout \to \everyaftershipout
+
+\newif\ifdoublesidedprint
+
+\def\presetcenterpagebox% in \stellayoutin !!!!!!!!!!!!!!!!
+ {\doublesidedprintfalse
+ \ExpandFirstAfter\processallactionsinset
+ [\@@lyplaats]
+ [ \v!midden=>{\setuppapersize[\c!links=\hss,\c!rechts=\hss,\c!boven=\vss,\c!onder=\vss]},
+ \v!links=>{\setuppapersize[\c!links=,\c!rechts=\hss]},
+ \v!rechts=>{\setuppapersize[\c!links=\hss,\c!rechts=]},
+ \v!onder=>{\setuppapersize[\c!boven=\vss,\c!onder=]},
+ \v!boven=>{\setuppapersize[\c!boven=,\c!onder=\vss]},%
+ \v!dubbelzijdig=>\doublesidedprinttrue,
+ \v!enkelzijdig=>\doublesidedprintfalse]}
+
+\def\definelayout%
+ {\dodoubleargument\dodefinelayout}
+
+\def\dodefinelayout[#1][#2]%
+ {\getparameters[\??ly#1][\c!status=\v!start,#2]}
+
+\def\dodostellayoutin[#1][#2]%
+ {\ConvertToConstant\doifnot{#2}{\v!reset}
+ {\getparameters[\??ly#1][#2]%
+ \checkforems[#2]}}
+
+\def\dostellayoutin[#1][#2]%
+ {\let\currentlayout\empty
+ \ifsecondargument
+ \dodostellayoutin[#1][#2]%
+ \else\iffirstargument
+ \doifassignmentelse{#1}
+ {\dodostellayoutin[][#1]}
+ {\doifnot{#1}{\v!reset}{\def\currentlayout{#1}}}%
+ \fi\fi
+ \recalculatelayout
+ \presetcenterpagebox}
+
+\def\stellayoutin%
+ {\dodoubleempty\dostellayoutin}
+
+\let\@@zahoogte=\!!zeropoint
+
+\def\dopushpagedimensions%
+ {\xdef\oldteksthoogte{\the\teksthoogte}%
+ \xdef\oldvoethoogte{\the\voethoogte}%
+ \global\let\@@zahoogte=\@@zahoogte}
+
+\def\dopoppagedimensions%
+ {\global\teksthoogte=\oldteksthoogte
+ \global\voethoogte=\oldvoethoogte
+ \recalculatelayout
+ \global\let\pushpagedimensions=\dopushpagedimensions
+ \global\let\poppagedimensions=\relax}
+
+\let\poppagedimensions = \relax
+\let\pushpagedimensions = \dopushpagedimensions
+
+% Elke \csname ... \endcsname wordt ook aangemaakt, dus ook
+% in een test met \doifdefined. Bij veel bladzijden kan dit
+% te veel macro's kosten. Vandaar de set \adaptedpages. Het
+% kost tijd, maar scheelt macro's.
+
+\let\adaptedpages\empty
+
+\def\adaptpagedimensions%
+ {\rawdoifinsetelse{\realfolio}{\adaptedpages}
+ {\getvalue{\??za\realfolio}%
+ \letbeundefined{\??za\realfolio}}
+ {}}
+
+\def\checkpagedimensions%
+ {\poppagedimensions
+ \adaptpagedimensions}
+
+\def\reportpagedimensions%
+ {\ifx\poppagedimensions\relax
+ \else
+ \spatie\@@zahoogte\spatie-
+ \fi
+ \realfolio}
+
+\def\dodopaslayoutaan[#1]%
+ {\getparameters[\??za][\c!hoogte=,\c!regels=,#1]%
+ \pushpagedimensions
+ \doifelsenothing{\@@zaregels}
+ {\showmessage{\m!layouts}{1}{\@@zahoogte,\realfolio}}
+ {\showmessage{\m!layouts}{1}{\@@zaregels\space\v!regels,\realfolio}%
+ \def\@@zahoogte{\@@zaregels\openlineheight}}%
+ \doifelse{\@@zahoogte}{\v!max}
+ {\balancedimensions{\teksthoogte}{\voethoogte}{\voethoogte}}
+ {\balancedimensions{\teksthoogte}{\voethoogte}{\@@zahoogte}}%
+ \ifdim\voethoogte<\zeropoint
+ \global\advance\teksthoogte by \voethoogte
+ \global\voethoogte=\zeropoint
+ \global\xdef\@@zahoogte{\layoutparameter\c!voet\spatie(\v!max)}%
+ \fi
+ \setvsize
+ \global\pagegoal=\vsize % nog corrigeren voor insertions ?
+ \recalculatelogos
+ \recalculatebackgrounds
+ \global\let\pushpagedimensions=\relax
+ \global\let\poppagedimensions=\dopoppagedimensions}
+
+\def\dopaslayoutaan[#1][#2]%
+ {\doifelsenothing{#2}
+ {\dodopaslayoutaan[#1]}
+ {\def\docommando##1%
+ {\addtocommalist{##1}\adaptedpages
+ \setgvalue{\??za##1}{\dodopaslayoutaan[#2]}}%
+ \processcommalist[#1]\docommando
+ \adaptpagedimensions}}
+
+\def\paslayoutaan%
+ {\dodoubleempty\dopaslayoutaan}
+
+% describe interface
+
+%D Centering the paper area on the print area is determined
+%D by the \type {top}, \type {bottom}, \type {left} and \type
+%D {right} parameters.
+
+\def\centerpagebox#1%
+ {\printpapierbreedte=\paperscale\printpapierbreedte
+ \printpapierhoogte =\paperscale\printpapierhoogte
+ \setbox#1=\vbox to \printpapierhoogte
+ {\@@ppboven
+ \hbox to \printpapierbreedte
+ {\ifdoublesidedprint
+ \doifbothsides \@@pplinks \box#1\@@pprechts
+ \orsideone \@@pplinks \box#1\@@pprechts
+ \orsidetwo \@@pprechts\box#1\@@pplinks
+ \od \else \@@pplinks \box#1\@@pprechts
+ \fi}%
+ \par
+ \@@pponder}}
+
+\def\offsetprintbox#1%
+ {\ifdim\kopoffset=\zeropoint % \relax
+ \ifdim\rugoffset=\zeropoint
+ \donefalse
+ \else
+ \donetrue
+ \fi
+ \else
+ \donetrue
+ \fi
+ \ifdone
+ \edef\next{\wd#1\the\wd#1\ht#1\the\ht#1\dp#1\the\dp#1}%
+ \setbox#1=\vbox
+ {%\forgetall
+ \offinterlineskip
+ \vskip\kopoffset
+ \doifbothsides
+ \hskip\rugoffset
+ \orsideone
+ \hskip\rugoffset
+ \orsidetwo
+ \hskip-\rugoffset
+ \od
+ \box#1}%
+ \next
+ \fi}
+
+% \def\replicatebox#1#2#3%
+% {\setbox#1=\vbox
+% {%\forgetall
+% \offinterlineskip
+% \dorecurse{#3}
+% {\hbox{\dorecurse{#2}{\copy#1\hskip\@@lydx}\unskip}%
+% \vskip\@@lydy}
+% \unskip}}
+%
+% \def\replicatepagebox#1%
+% {\ifnum\@@lynx>0 \ifnum\@@lyny>0
+% \replicatebox{#1}{\@@lynx}{\@@lyny}%
+% \fi\fi}
+
+\def\replicatepagebox#1%
+ {\ifnum\@@lynx>1
+ \donetrue
+ \else\ifnum\@@lyny>1
+ \donetrue
+ \else
+ \donefalse
+ \fi\fi
+ \ifdone
+ \setbox#1=\vbox
+ {%\forgetall
+ \offinterlineskip
+ \dorecurse{\@@lyny}
+ {\hbox{\dorecurse{\@@lynx}{\copy#1\hskip\@@lydx}\unskip}%
+ \vskip\@@lydy}
+ \unskip}%
+ \fi}
+
+\def\rotatepagebodybox#1#2#3%
+ {\ifnum#2#3>0
+ \setbox#1=\vbox
+ {\edef\somerotation%
+ {\ifdubbelzijdig\ifodd\realpageno#2\else#3\fi\else#2\fi}%
+ \dorotatebox\somerotation\hbox{\box#1}}%
+ \fi}
+
+\def\rotatepaperbox#1%
+ {\rotatepagebodybox{#1}\paperrotation\paperreverse}
+
+\def\rotateprintbox#1%
+ {\rotatepagebodybox{#1}\printrotation\printreverse}
+
+\def\mirrorpagebodybox#1#2%
+ {\ifcase#2\or
+ \setbox#1=\vbox
+ {\domirrorbox\vbox{\box#1}}%
+ \fi}
+
+\def\mirrorpaperbox#1%
+ {\mirrorpagebodybox{#1}\papermirror}
+
+\def\mirrorprintbox#1%
+ {\mirrorpagebodybox{#1}\printmirror}
+
+\def\scalepagebox#1%
+ {\ifdim\@@lyschaal pt=1pt \else
+ \setbox#1=\vbox
+ {\schaal[\c!sx=\@@lyschaal,\c!sy=\@@lyschaal]{\box#1}}%
+ \papierbreedte=\@@lyschaal\papierbreedte
+ \papierhoogte =\@@lyschaal\papierhoogte
+ \fi}
+
+\def\negateprintbox#1%
+ {\ifnegateprintbox
+ \negatecolorbox{#1}%
+ \fi}
+
+\def\pagecutmarksymbol%
+ {\the\realpageno}%
+
+\def\addpagecutmarks#1%
+ {\doif{\@@lymarkering}{\v!aan}
+ {\let\cutmarksymbol=\pagecutmarksymbol
+ \makecutbox{#1}}}
+
+\def\addpagecolormarks#1%
+ {\doif{\@@lymarkering}{\v!kleur}
+ {\let\cutmarksymbol=\pagecutmarksymbol
+ \makecutbox{#1}%
+ \ifnum\horizontalcutmarks>1 \chardef\colormarkoffset=4 \fi
+ \ifnum\verticalcutmarks >1 \chardef\colormarkoffset=4 \fi
+ \colormarkbox{#1}}}
+
+\newif\ifdubbelzijdig \dubbelzijdigfalse
+\newif\ifenkelzijdig \enkelzijdigtrue
+
+\def\doifsometextlineelse#1#2#3% ! omgekeerd !
+ {\doifinsetelse{\getvalue{\??tk#1\v!tekst\c!status}}{\v!geen,\v!hoog}
+ {#3}{#2}}
+
+% NOG EENS NAGAAN WANNEER NU GLOBAL EN WANNEER NIET
+
+\def\calculatevsizes% global needed in \recalculatelayoutregel
+ {\redoglobal\teksthoogte=\zethoogte
+ \doifsometextlineelse \v!hoofd
+ {\redoglobal\advance\teksthoogte by -\hoofdhoogte
+ \redoglobal\advance\teksthoogte by -\hoofdafstand}
+ \donothing
+ \doifsometextlineelse \v!voet
+ {\redoglobal\advance\teksthoogte by -\voethoogte
+ \redoglobal\advance\teksthoogte by -\voetafstand}
+ \donothing
+ \resetglobal
+ \setvsize}
+
+\def\calculatereducedvsizes%
+ {\teksthoogte=\zethoogte
+ \doifsometextlineelse \v!hoofd
+ {\advance\teksthoogte by -\hoofdhoogte
+ \advance\teksthoogte by -\hoofdafstand}
+ {\hoofdhoogte=\zeropoint}%
+ \doifsometextlineelse \v!voet
+ {\advance\teksthoogte by -\voethoogte
+ \advance\teksthoogte by -\voetafstand}
+ {\voethoogte=\zeropoint}}
+
+\def\freezetextwidth% % \zetbreedte may be set to \tekstbreedte
+ {\tekstbreedte=\zetbreedte % which is a tricky but valid value
+ \doifsomething{\layoutparameter\c!tekstbreedte}
+ {\tekstbreedte=\layoutparaneter\c!tekstbreedte}}
+
+\def\calculatehsizes%
+ {\freezetextwidth
+ \sethsize}
+
+% De onderstaande macro voert commando's uit, afhankelijk van
+% het karakter van het paginanummer.
+%
+% \doifonevenpaginaelse{then-commando}{else-commando}
+
+%D When we start at an even page, we need to swap the layout
+%D differently. We cannot adapt the real page number, since
+%D it is used in cross referencing. The next switch is set
+%D when we start at an even page.
+
+\newif\ifshiftedrealpageno
+
+\def\doifonevenpaginaelse#1#2%
+ {\ifshiftedrealpageno
+ \ifodd\realpageno#2\else#1\fi
+ \else
+ \ifodd\realpageno#1\else#2\fi
+ \fi}
+
+\def\doifbothsidesoverruled#1\orsideone#2\orsidetwo#3\od%
+ {\ifdubbelzijdig
+ \doifonevenpaginaelse{#2}{#3}\relax
+ \else
+ #1\relax
+ \fi}
+
+\def\doifbothsides#1\orsideone#2\orsidetwo#3\od
+ {\ifdubbelzijdig
+ \ifenkelzijdig
+ #1\relax
+ \else
+ \doifonevenpaginaelse{#2}{#3}\relax
+ \fi
+ \else
+ #1\relax
+ \fi}
+
+\newdimen\texthoffset
+
+\def\settexthoffset%
+ {\doifbothsides
+ \texthoffset\rugwit
+ \orsideone
+ \texthoffset\rugwit
+ \orsidetwo
+ \texthoffset\papierbreedte
+ \advance\texthoffset-\rugwit
+ \advance\texthoffset-\zetbreedte
+ \od}
+
+\def\initializepaper%
+ {\iflocation
+ \dosetuppaper
+ {\papersize}
+ {\the\papierbreedte}
+ {\the\papierhoogte}%
+ \else
+ \dosetuppaper
+ {\printpapersize}
+ {\the\printpapierbreedte}
+ {\the\printpapierhoogte}%
+ \fi}
+
+\def\goleftonpage%
+ {\hskip-\linkermargeafstand
+ \hskip-\linkermargebreedte
+ \hskip-\linkerrandafstand
+ \hskip-\linkerrandbreedte}
+
+\iffixedlayoutdimensions
+
+ \def\doswapmargins%
+ {\let\doswapmargins=\relax % to prevent local swapping
+ \swapdimens\linkermargeafstand\rechtermargeafstand
+ \swapdimens\linkerrandafstand \rechterrandafstand
+ \swapdimens\linkermargebreedte\rechtermargebreedte
+ \swapdimens\linkerrandbreedte \rechterrandbreedte}
+
+\else
+
+ \def\dodoswapmargins#1#2%
+ {\edef\!!stringa{\layoutparameter#1}%
+ \edef\!!stringb{\layoutparameter#2}%
+ \letvalue{\??ly\currentlayout#1}\!!stringb
+ \letvalue{\??ly\currentlayout#2}\!!stringa}
+
+ \def\doswapmargins%
+ {\let\doswapmargins=\relax % to prevent local swapping
+ \dodoswapmargins\c!linkermargeafstand\c!rechtermargeafstand
+ \dodoswapmargins\c!linkerrandafstand \c!rechterrandafstand
+ \swapdimens\linkermargebreedte\rechtermargebreedte
+ \swapdimens\linkerrandbreedte \rechterrandbreedte}
+
+\fi
+
+\def\doifmarginswapelse#1#2%
+ {\doifbothsides#1\orsideone#1\orsidetwo#2\od}
+
+\def\swapmargins%
+ {\doifmarginswapelse{}{\doswapmargins}}
+
+%D \macros
+%D {showprint, showframe, showlayout, showsetups}
+%D
+%D We predefine a couple of tracing macros.
+%D
+%D \showsetup{\y!showprint}
+%D \showsetup{\y!showframe}
+%D \showsetup{\y!showlayout}
+%D \showsetup{\y!showsetups}
+
+\fetchruntimecommand \showprint {page-run}
+\fetchruntimecommand \showframe {page-run}
+\fetchruntimecommand \showlayout {page-run}
+\fetchruntimecommand \showsetups {page-run}
+
+%D The default dimensions are quite old and will not change.
+%D The funny fractions were introduced when we went from fixed
+%D dimensions to relative ones. Since \CONTEXT\ is a dutch
+%D package, the dimensions are based on the metric system. The
+%D asymmetrical layout is kind of handy for short
+%D quick||and||dirty stapled documents.
+%D
+%D Although valid, it is not a real good idea to use
+%D dimensions based on the \type {em} unit. First of all,
+%D since there are no fonts loaded yet, this dimension makes
+%D no sense, and second, you would loose track of values,
+%D since they could change while going to a new page,
+%D depending on the current font setting.
+
+\stellayoutin
+ [ \c!kopwit=.08417508418\papierhoogte, % 2.5cm
+ \c!boven=\!!zeropoint,
+ \c!bovenafstand=\!!zeropoint,
+ \c!hoofd=.06734006734\papierhoogte, % 2.0cm
+ \c!hoofdafstand=\!!zeropoint,
+ \c!hoogte=.84175084175\papierhoogte, % 25.0cm
+ \c!voetafstand=\layoutparameter\c!hoofdafstand,
+ \c!voet=.06734006734\papierhoogte, % 2.0cm
+ \c!onderafstand=\layoutparameter\c!bovenafstand,
+ \c!onder=\!!zeropoint,
+ \c!rugwit=.11904761905\papierbreedte, % 2.5cm
+ \c!rand=\!!zeropoint,
+ \c!randafstand=\layoutparameter\c!margeafstand,
+ \c!marge=.12649983170\papierbreedte, % snijwit-2*afstand
+ \c!margeafstand=.02008341748\papierbreedte, % 12.0pt
+ \c!linkerrand=\layoutparameter\c!rand,
+ \c!linkerrandafstand=\layoutparameter\c!randafstand,
+ \c!linkermarge=\layoutparameter\c!marge,
+ \c!linkermargeafstand=\layoutparameter\c!margeafstand,
+ \c!breedte=.71428571429\papierbreedte, % 15.0cm
+ \c!rechtermargeafstand=\layoutparameter\c!margeafstand,
+ \c!rechtermarge=\layoutparameter\c!marge,
+ \c!rechterrandafstand=\layoutparameter\c!randafstand,
+ \c!rechterrand=\layoutparameter\c!rand,
+ \c!kopoffset=\!!zeropoint,
+ \c!rugoffset=\!!zeropoint,
+ \c!tekstbreedte=, % dangerous option
+ \c!letter=,
+ \c!markering=\v!uit,
+ \c!plaats=, % \v!enkelzijdig, but empty is signal
+ \c!schaal=1,
+ \c!nx=1,
+ \c!ny=1,
+ \c!dx=\!!zeropoint,
+ \c!dy=\!!zeropoint,
+ \c!grid=\v!nee,
+ \c!regels=,
+ \c!snijwit=\!!zeropoint,
+ \c!bodemwit=\!!zeropoint]
+
+%D First we define a whole range of (DIN) papersizes,
+%D of which the A-series makes most sense.
+
+\definepapersize [A0] [\c!breedte=841mm,\c!hoogte=1189mm]
+\definepapersize [A1] [\c!breedte=594mm,\c!hoogte=841mm]
+\definepapersize [A2] [\c!breedte=420mm,\c!hoogte=594mm]
+\definepapersize [A3] [\c!breedte=297mm,\c!hoogte=420mm]
+\definepapersize [A4] [\c!breedte=210mm,\c!hoogte=297mm]
+\definepapersize [A5] [\c!breedte=148mm,\c!hoogte=210mm]
+\definepapersize [A6] [\c!breedte=105mm,\c!hoogte=148mm]
+\definepapersize [A7] [\c!breedte=74mm,\c!hoogte=105mm]
+\definepapersize [A8] [\c!breedte=52mm,\c!hoogte=74mm]
+\definepapersize [A9] [\c!breedte=37mm,\c!hoogte=52mm]
+
+\definepapersize [B0] [\c!breedte=1000mm,\c!hoogte=1414mm]
+\definepapersize [B1] [\c!breedte=707mm,\c!hoogte=1000mm]
+\definepapersize [B2] [\c!breedte=500mm,\c!hoogte=707mm]
+\definepapersize [B3] [\c!breedte=354mm,\c!hoogte=500mm]
+\definepapersize [B4] [\c!breedte=250mm,\c!hoogte=354mm]
+\definepapersize [B5] [\c!breedte=177mm,\c!hoogte=250mm]
+\definepapersize [B6] [\c!breedte=125mm,\c!hoogte=177mm]
+\definepapersize [B7] [\c!breedte=88mm,\c!hoogte=125mm]
+\definepapersize [B8] [\c!breedte=63mm,\c!hoogte=88mm]
+\definepapersize [B9] [\c!breedte=44mm,\c!hoogte=63mm]
+
+\definepapersize [C0] [\c!breedte=917mm,\c!hoogte=1297mm]
+\definepapersize [C1] [\c!breedte=649mm,\c!hoogte=917mm]
+\definepapersize [C2] [\c!breedte=459mm,\c!hoogte=649mm]
+\definepapersize [C3] [\c!breedte=324mm,\c!hoogte=459mm]
+\definepapersize [C4] [\c!breedte=229mm,\c!hoogte=324mm]
+\definepapersize [C5] [\c!breedte=162mm,\c!hoogte=229mm]
+\definepapersize [C6] [\c!breedte=115mm,\c!hoogte=162mm]
+\definepapersize [C7] [\c!breedte=81mm,\c!hoogte=115mm]
+\definepapersize [C8] [\c!breedte=57mm,\c!hoogte=81mm]
+\definepapersize [C9] [\c!breedte=40mm,\c!hoogte=57mm]
+
+%D Because there are no standardized screen sizes, we define
+%D a bunch of sizes with $4:3$ ratios. The \type {S6} size is
+%D nearly as wide as a sheet of \type {A4} paper.
+
+\definepapersize [S3] [\c!breedte=300pt,\c!hoogte=225pt]
+\definepapersize [S4] [\c!breedte=400pt,\c!hoogte=300pt]
+\definepapersize [S5] [\c!breedte=500pt,\c!hoogte=375pt]
+\definepapersize [S6] [\c!breedte=600pt,\c!hoogte=450pt]
+
+%D These are handy too:
+
+\definepapersize [S33] [\c!breedte=300pt,\c!hoogte=300pt]
+\definepapersize [S44] [\c!breedte=400pt,\c!hoogte=400pt]
+\definepapersize [S55] [\c!breedte=500pt,\c!hoogte=500pt]
+\definepapersize [S66] [\c!breedte=600pt,\c!hoogte=600pt]
+
+%D One may wonder if \TEX\ should be used for typesetting
+%D \CDROM\ covers, but it does not hurt to have the paper size
+%D ready.
+
+\definepapersize [CD] [\c!breedte=120mm, \c!hoogte=120mm]
+
+%D The next series is for our English speaking friends who
+%D decided to stick to non metric values.
+
+\definepapersize [letter] [\c!breedte=8.5in, \c!hoogte=11in]
+\definepapersize [2*letter] [\c!breedte=11in, \c!hoogte=17in]
+\definepapersize [legal] [\c!breedte=8.5in, \c!hoogte=14in]
+\definepapersize [folio] [\c!breedte=8.5in, \c!hoogte=13in]
+\definepapersize [executive] [\c!breedte=7.25in, \c!hoogte=10.5in]
+
+%D This set is for Tobias Burnus, who gave me the sizes.
+
+\definepapersize [envelope 9] [\c!breedte=8.88in, \c!hoogte=3.88in]
+\definepapersize [envelope 10] [\c!breedte=9.5in, \c!hoogte=4.13in]
+\definepapersize [envelope 11] [\c!breedte=10.38in,\c!hoogte=4.5in]
+\definepapersize [envelope 12] [\c!breedte=11.0in, \c!hoogte=4.75in]
+\definepapersize [envelope 14] [\c!breedte=11.5in, \c!hoogte=5.0in]
+\definepapersize [monarch] [\c!breedte=7.5in, \c!hoogte=3.88in]
+\definepapersize [check] [\c!breedte=8.58in, \c!hoogte=3.88in]
+\definepapersize [DL] [\c!breedte=220mm, \c!hoogte=110mm]
+
+%D We can now default to a reasonable size. We match the print
+%D paper size with the typeset paper size. This setting should
+%D come after the first layout specification (already done).
+
+\setuppapersize
+ [A4][A4]
+
+%D We also set some of the parameters that will be used when
+%D positioning the typeset paper onto the print paper.
+
+\setuppapersize
+ [\c!boven=,
+ \c!onder=\vss,
+ \c!links=,
+ \c!rechts=\hss]
+
+\protect \endinput
diff --git a/tex/context/base/page-lin.tex b/tex/context/base/page-lin.tex
new file mode 100644
index 000000000..d9c624815
--- /dev/null
+++ b/tex/context/base/page-lin.tex
@@ -0,0 +1,375 @@
+%D \module
+%D [ file=page-lin, % copied from main-001
+%D version=1997.03.31,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Line Numbering,
+%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 Core Macros / Line Numbering}
+
+\unprotect
+
+\newif\ifinregels
+\newif\ifregelnummersinmarge
+
+\def\stelregelsin%
+ {\dodoubleargument\getparameters[\??rg]}
+
+\def\startregels%
+ {\@@rgvoor
+ \witruimte
+ %\pagina[\v!voorkeur]} gaat mis na koppen, nieuw: later \nobreak
+ \begingroup
+ \def\@@rgstepyes{\parindent\!!zeropoint}%
+ \def\@@rgstepno{\parindent\!!zeropoint}%
+ \edef\@@rgparindent{\the\parindent}%
+ \gdef\@@rglinesteptoggle{1}%
+ \processaction
+ [\@@rginspringen]
+ [ \v!ja=>\def\@@rgstepyes{\parindent\@@rgparindent}%
+ \def\@@rgstepno {\parindent\@@rgparindent},
+ \v!oneven=>\def\@@rgstepyes{\parindent\!!zeropoint }%
+ \def\@@rgstepno {\parindent\@@rgparindent},
+ \v!even=>\def\@@rgstepno {\parindent\!!zeropoint }%
+ \def\@@rgstepyes{\parindent\@@rgparindent}]%
+ \inregelstrue
+ \stelwitruimtein[\v!geen]%
+ \obeylines
+ \let\checkindentation=\relax
+ \@@rgstepno
+ \ignorespaces
+ \gdef\afterfirstobeyedline% tzt two pass, net als opsomming
+ {\gdef\afterfirstobeyedline%
+ {\nobreak
+ \global\let\afterfirstobeyedline\relax}}%
+ \def\obeyedline%
+ {\par
+ \afterfirstobeyedline
+ \ifdim\lastskip>\zeropoint
+ \gdef\@@rglinesteptoggle{0}%
+ \else
+ \doglobal\increment\@@rglinesteptoggle
+ \fi
+ \ifodd\@@rglinesteptoggle\relax
+ \@@rgstepyes
+ \else
+ \@@rgstepno
+ \fi
+ \futurelet\next\dobetweenthelines}%
+ \GotoPar}
+
+% \def\dobetweenthelines%
+% {\convertcommand \next \to\!!stringa % very ugly and fuzzy
+% \convertargument\obeyedline\to\!!stringb % but needed anyway
+% \ifx\!!stringa\!!stringb % but alas, it fails
+% \@@rgtussen % hopelessly in non
+% \fi} % etex
+
+\def\dobetweenthelines%
+ {\doifmeaningelse{\next}{\obeyedline}{\@@rgtussen}{}}
+
+\def\stopregels%
+ {\endgroup
+ \@@rgna}
+
+\newcount\linenumber
+\newcount\linestepper
+\newif\ifinregelnummeren
+
+% het gebruik van \setlocalreference scheelt een hash entry
+
+\def\dodoshowlinenumber% for use elsewhere, to be extended
+ {\doschrijfregelnummer
+ \global\advance\linenumber by 1\relax}%
+
+\def\regelweergave%
+ {\convertnumber\@@rnconversie\linenumber}%
+
+\def\dostelregelnummerenin[#1]%
+ {\getparameters
+ [\??rn]
+ [\c!start=1,
+ \c!stap=1,
+ #1]%
+ \global\linenumber=1\relax}
+
+\def\stelregelnummerenin%
+ {\dosingleargument\dostelregelnummerenin}
+
+\def\dostartnummerenLINE% % !! \everypar !!
+ {\EveryPar{\schrijfregelnummer}}
+
+\def\dostopnummerenLINE%
+ {\egroup}
+
+\def\dodoschrijfregelnummer%
+ {\setbox0=\hbox{\regelweergave}%
+ \vsmashbox0%
+ \ifregelnummersinmarge
+ \llap{\hbox{\box0\hskip\linkermargeafstand}}%
+ \else
+ \llap{\hbox to \@@rnbreedte{\box0\hss}}%
+ \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
+ \fi
+ \ifinregels
+ \let\dostartnummeren=\dostartnummerenLINE
+ \let\stopregelnummeren=\dostopnummerenLINE
+ \def\schrijfregelnummer%
+ {\doschrijfregelnummer
+ \global\advance\linenumber by 1\relax}%
+ \else
+ \let\dostartnummeren=\dostartnummerenPAR
+ \let\stopregelnummeren=\dostopnummerenPAR
+ \def\schrijfregelnummer%
+ {\global\advance\linenumber by -1\relax
+ \doschrijfregelnummer}%
+ \fi
+ \dostartnummeren}
+
+\def\startregelnummeren%
+ {\bgroup
+ \inregelnummerentrue
+ \complexorsimpleempty\startregelnummeren}
+
+\def\doschrijfregelnummer%
+ {\ifnum\linenumber<\@@rnstart\relax
+ \else
+ \!!counta=\linenumber
+ \divide\!!counta by \@@rnstap\relax
+ \multiply\!!counta by \@@rnstap\relax
+ \ifnum\!!counta=\linenumber
+ \doattributes\??rn\c!letter\c!kleur{\dodoschrijfregelnummer}%
+ \fi
+ \fi}
+
+\def\eenregel[#1]%
+ {\regelreferentie0[#1]\ignorespaces}
+
+\def\startregel[#1]%
+ {\regelreferentie1[#1]\ignorespaces}
+
+\def\stopregel[#1]%
+ {\unskip\regelreferentie2[#1]}
+
+% \def\inregellabel#1%
+% {\doifinstringelse{--}{#1}
+% {\labeltext{\v!regels}}
+% {\labeltext{\v!regel}}}
+%
+% \def\inregel#1[#2]%
+% {\doifelsenothing{#1}
+% {\in{\inregellabel{\currenttextreference}}[\@@rnprefix#2]}
+% {\in{#1}[\@@rnprefix#2]}}
+%
+% double labels:
+
+\def\inregel#1[#2]%
+ {\doifelsenothing{#1}
+ {\doifinstringelse{--}{\currenttextreference}
+ {\in{\leftlabeltext\v!regels}{\rightlabeltext\v!regels}[\@@rnprefix#2]}
+ {\in{\leftlabeltext\v!regel }{\rightlabeltext\v!regel }[\@@rnprefix#2]}}
+ {\in{#1}[\@@rnprefix#2]}}
+
+\def\dostartnummerenPAR%
+ {\beginofshapebox
+ \doglobal\newcounter\linereference}
+
+% localcrossref heroverwegen
+
+\def\setlinereference#1#2#3#4%
+ {\setxvalue{lrf:#1}{\noexpand\dogetlinereference{#2}{#3}{#4}}}
+
+\def\getlinereference#1%
+ {\getvalue{lrf:#1}}
+
+\def\dogetlinereference#1#2#3%
+ {\edef\linereferencename{#1}%
+ \edef\linereferenceline{#2}%
+ \edef\linereferenceplus{#3}}
+
+% 1 xxx xxx xxx xxx xxx xxx xxx
+% 2 xxx yyy yyy yyy yyy yyy yyy <= start y
+% 3 yyy yyy yyy yyy yyy yyy yyy
+% 4 yyy yyy yyy yyy yyy xxx xxx <= stop y
+% 5 xxx xxx xxx xxx xxx xxx xxx
+
+%\def\regelreferentie#1[#2]%
+% {\bgroup
+% \dimen0=\dp\strutbox
+% \doif{\@@rnrefereren}{\v!aan}
+% {\doglobal\increment\linereference
+% % start 1=>(n=y,l=0,p=1)
+% % stop 2=>(n=y,l=0,p=2)
+% \setxvalue{lrf:n:\linereference}{\@@rnprefix#2}%
+% \setxvalue{lrf:l:\linereference}{0}%
+% \setxvalue{lrf:p:\linereference}{#1}%
+% \advance\dimen0 by \linereference sp}%
+% \prewordbreak
+% \vrule \!!width \!!zeropoint \!!depth \dimen0 \!!height \!!zeropoint
+% \prewordbreak
+% \egroup}
+
+\def\regelreferentie#1[#2]%
+ {\bgroup
+ \dimen0=\dp\strutbox
+ \doif{\@@rnrefereren}{\v!aan}
+ {\doglobal\increment\linereference
+ % start 1=>(n=y,l=0,p=1)
+ % stop 2=>(n=y,l=0,p=2)
+ \setlinereference{\linereference}{\@@rnprefix#2}{0}{#1}%
+ \advance\dimen0 by \linereference sp}%
+ \prewordbreak
+ \vrule \!!width \!!zeropoint \!!depth \dimen0 \!!height \!!zeropoint
+ \prewordbreak
+ \egroup}
+
+\def\dostopnummerenPAR% dp's -> openstrutdepth
+ {\endofshapebox
+ \checkreferences
+ \linestepper=0
+ \reshapebox{\global\advance\linestepper by 1\relax}%
+ \global\advance\linenumber by \linestepper
+ \doifelse{\@@rnrefereren}{\v!aan}
+ {\reshapebox % We are going back!
+ {\global\advance\linenumber by -1
+ \dimen0=\dp\shapebox
+ \advance\dimen0 by -\dp\strutbox\relax
+ \ifdim\dimen0>\zeropoint
+ % 1=>4 | 2=>4 1=>2
+ % start 1=>(n=y,l=2,p=1)
+ % stop 2=>(n=y,l=4,p=2)
+ \dostepwiserecurse{1}{\number\dimen0}{1}
+ {\getlinereference\recurselevel
+ \setlinereference\recurselevel
+ {\linereferencename}{\the\linenumber}{\linereferenceplus}}%
+ \fi}%
+ \global\advance\linenumber by \linestepper
+ \ifnum\linereference>0 % anders vreemde loop in paragraphs+recurse
+ \dorecurse{\linereference}
+ {\getlinereference\recurselevel
+ \ifnum\linereferenceplus=2 % stop
+ % ref y: text = 4 / Kan dit buiten referentie mechanisme om?
+ \expanded{\setlocalcrossreference
+ {\referenceprefix\linereferencename}{}{}{\linereferenceline}}%
+ \fi}%
+ \dorecurse{\linereference}
+ {\getlinereference\recurselevel
+ \ifnum\linereferenceplus<2 % start / lone
+ \ifnum\linereferenceplus=1 % start
+ \getreferenceelements{\linereferencename}% text = 4
+ \ifnum\linereferenceline<0\currenttextreference\relax % 0 prevents error
+ \edef\linereferenceline{\linereferenceline--\currenttextreference}%
+ \fi
+ \fi
+ \expanded{\setlocalcrossreference
+ {\referenceprefix\linereferencename}{}{}{\linereferenceline}}%
+ \fi}%
+ \global\let\scratchline=\linenumber % We are going back!
+ \reshapebox
+ {\doglobal\decrement\scratchline
+ \hbox
+ {\dorecurse{\linereference}
+ {\getlinereference\recurselevel
+ \getreferenceelements{\linereferencename}%
+ \beforesplitstring\currenttextreference--\at--\to\firstline
+ \ifnum\firstline=\scratchline\relax
+ % beter een rawtextreference
+ \textreference[\linereferencename]{\currenttextreference}%
+ \expanded{\setlocalcrossreference
+ {\referenceprefix\linereferencename}{}{}{0}}% ==done
+ \fi}%
+ \dimen0=\dp\shapebox
+ \advance\dimen0 by -\dp\strutbox\relax
+ \ifdim\dimen0>\zeropoint
+ \dp\shapebox=\dp\strutbox
+ \fi
+ \schrijfregelnummer\box\shapebox}}% no \strut !
+ \else
+ \reshapebox{\hbox{\schrijfregelnummer\box\shapebox}}% no \strut !
+ \fi}
+ {\reshapebox{\global\advance\linenumber by -1}%
+ \global\advance\linenumber by \linestepper
+ \reshapebox{\hbox{\schrijfregelnummer\box\shapebox}}}% no \strut !
+ \global\advance\linenumber by \linestepper
+ \flushshapebox
+ \egroup}
+
+\def\crlf%
+ {\ifhmode\unskip\else\strut\fi\ifcase\raggedstatus\hfil\fi\break}
+
+\def\opeenregel%
+ {\def\crlf{\ifhmode\unskip\fi\space}\let\\\crlf}
+
+\newcount\internalparagraphnumber
+
+\def\stelparagraafnummerenin%
+ {\dosingleempty\dostelparagraafnummerenin}
+
+\def\dostelparagraafnummerenin[#1]%
+ {\getparameters
+ [\??ph][#1]%
+ \processaction
+ [\@@phstatus]
+ [\v!start=>\let\showparagraphnumber\doshowparagraphnumberA,
+ \v!stop=>\let\showparagraphnumber\relax,
+ \v!regel=>\let\showparagraphnumber\doshowparagraphnumberB,
+ \v!reset=>\global\internalparagraphnumber=0
+ \let\showparagraphnumber\doshowparagraphnumberA]}
+
+\def\dodoshowparagraphnumber%
+ {\global\advance\internalparagraphnumber 1
+ \inleftmargin % \tf normalizes em
+ {\tf{\doattributes\??ph\c!letter\c!kleur{\the\internalparagraphnumber}}%
+ \kern\@@phafstand}}
+
+\def\doshowparagraphnumberA%
+ {\ifprocessingverbatim
+ \iflinepar\dodoshowparagraphnumber\fi
+ \else
+ \dodoshowparagraphnumber
+ \fi}
+
+\def\doshowparagraphnumberB%
+ {\ifinregelnummeren
+ \doshowparagraphnumberA
+ \fi}
+
+\stelregelnummerenin
+ [\c!conversie=\v!cijfers,
+ \c!start=1,
+ \c!stap=1,
+ \c!plaats=\v!inmarge,
+ \c!letter=,
+ \c!kleur=,
+ \c!breedte=2em,
+ \c!prefix=,
+ \c!refereren=\v!aan]
+
+\stelparagraafnummerenin
+ [\c!status=\v!stop,
+ \c!letter=,
+ \c!kleur=,
+ \c!afstand=\ifregelnummersinmarge2em\else\!!zeropoint\fi]
+
+\stelregelsin
+ [\c!voor=\blanko,
+ \c!na=\blanko,
+ \c!tussen=\blanko,
+ \c!inspringen=\v!nee]
+
+\protect \endinput
diff --git a/tex/context/base/page-log.tex b/tex/context/base/page-log.tex
new file mode 100644
index 000000000..15e7f3125
--- /dev/null
+++ b/tex/context/base/page-log.tex
@@ -0,0 +1,236 @@
+%D \module
+%D [ file=page-log, % moved here from main-001
+%D version=1997.03.31,
+%D title=\CONTEXT\ Page Macros,
+%D subtitle=Logos,
+%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 / Logos}
+
+\unprotect
+
+\startmessages dutch library: layouts
+ 7: beeldmerken berekenen
+\stopmessages
+
+\startmessages english library: layouts
+ 7: calculating logospace
+\stopmessages
+
+\startmessages german library: layouts
+ 7: berechne Platz des Logo
+\stopmessages
+
+\startmessages czech library: layouts
+ 7: pocita se misto pro logo
+\stopmessages
+
+\startmessages italian library: layouts
+ 7: calcolo dello spazio per logo
+\stopmessages
+
+\startmessages norwegian library: layouts
+ 7: beregner plass for logo
+\stopmessages
+
+\startmessages romanian library: layouts
+ 7: se calculeaza spatiul pentru logo
+\stopmessages
+
+%D Although logos can conveniently be implemented on top of
+%D background and text areas, we provide a dedicated mechanism
+%D here. One reason is that such a separate mechanism cannot
+%D interfere with the other ones, but an even more important
+%D reason is that logos are kind of special in the sense that
+%D they have a short life span and may change after the first
+%D page.
+
+%D \macros
+%D {recalculatelogos,addlogobackground}
+%D
+%D The interface to the other low level page building routines
+%D is provided by a macro that signals changes in layout
+%D specifications:
+%D
+%D \starttypen
+%D \recalculatelogos
+%D \stoptypen
+%D
+%D as well as a simple placement macro:
+%D
+%D \starttypen
+%D \addlogobackground <box>
+%D \stoptypen
+%D
+%D In no way the following boolean switch should be used
+%D directly.
+
+\newif\ifnewlogos
+
+\def\recalculatelogos
+ {\global\newlogostrue}
+
+%D The current state of logos is registered in a status
+%D variable \type {\logostatus}.
+%D
+%D \starttabulatie[|l|l|l|]
+%D \NC 0 \NC don't place \NC remains 0 \NC \NR
+%D \NC 1 \NC place now \NC remains 1 \NC \NR
+%D \NC 2 \NC calulate and place \NC becomes 1 \NC \NR
+%D \NC 3 \NC calculate and place once \NC becomes 2 \NC \NR
+%D \stoptabulatie
+
+\chardef\logostatus=0
+
+\def\addlogobackground#1% todo: dimension spec
+ {\ifcase\logostatus \else
+ \ifcase\logostatus
+ % no logos to take care of
+ \or % 1
+ \ifnewlogos
+ \chardef\logostatus=2
+ \setlogoboxes
+ \chardef\logostatus=1
+ \global\newlogosfalse
+ \fi
+ \or % 2
+ \setlogoboxes
+ \chardef\logostatus=1
+ \or % 3
+ \setlogoboxes
+ \global\chardef\logostatus=2
+ \fi
+ \setbox#1=\vbox
+ {\offinterlineskip
+ \doifmarginswapelse
+ {\copy\leftlogos}
+ {\copy\rightlogos}
+ \box#1}%
+ \fi}
+
+%D For efficiency reasons (and since logos seldom change inside
+%D a document) we can save the left and right hand (or first
+%D and following page) logos in boxes. The areas are slightly
+%D different from the ones used in backgrounds and text
+%D placement, but still related to the page layout. The {\em
+%D left} and {\em right edge}, as well as {\em top} and {\em
+%D bottom} touch the bounding box of the paper and are
+%D therefore not the sams as their background adn text
+%D counterparts. In addition there are {\em left}, {\em right}
+%D and {\em middle} areas as well as a {\em page} one.
+
+\newbox\leftlogos
+\newbox\rightlogos
+
+\def\setlogoboxes%
+ {\showmessage{\m!layouts}{7}\empty
+ \dosetlogobox\leftlogos\relax
+ \ifdubbelzijdig
+ \dosetlogobox\rightlogos\doswapmargins
+ \fi}
+
+\def\dosetlogobox#1#2%
+ {\global\setbox#1=\vbox to \papierhoogte
+ {\dontcomplain % needed here ?
+ \calculatereducedvsizes % needed here ?
+ \offinterlineskip
+ #2\relax
+ \vskip-\kopwit
+ \dodosetlogobox\v!boven\blap
+ \vskip\kopwit
+ \dodosetlogobox\v!hoofd\blap
+ \vskip\hoofdhoogte
+ \vskip\hoofdafstand
+ \dodosetlogobox\v!tekst\blap
+ \vskip\teksthoogte
+ \vskip\voetafstand
+ \vskip\voethoogte
+ \dodosetlogobox\v!voet \tlap
+ \vfilll
+ \dodosetlogobox\v!onder\tlap
+ \vskip\kopwit}
+ \smashbox#1}
+
+\def\dodosetlogobox#1#2%
+ {\hbox % width equals \zetbreedte
+ {\def\docommando##1%
+ {\donefalse
+ \ifnum\logostatus=3 \ExpandBothAfter
+ \doifinset{\getvalue{\??lo#1##1}}{\requestedlogos}\donetrue
+ \else
+ \doifvalue{\??lo#1##1\c!status}{\v!start}\donetrue
+ \fi
+ \ifdone
+ #2{\hbox{\getvalue{\??lo#1##1\c!commando}}}%
+ \fi}%
+ \def\dodocommando##1##2##3##4##5##6%
+ {\hsmash
+ {\hskip-\texthoffset
+ \hbox to \papierbreedte
+ {\rlap{\docommando##1}\hss\llap{\docommando##6}}%
+ \hskip-\papierbreedte
+ \hbox to \papierbreedte
+ {\hskip\texthoffset
+ \hskip-\linkermargebreedte
+ \hskip-\linkermargeafstand
+ \hbox to \linkermargebreedte{\docommando##2\hss}%
+ \hskip\linkermargeafstand
+ \hbox to \zetbreedte{\docommando##3\hss\docommando##4}%
+ \hskip\rechtermargeafstand
+ \hbox to \rechtermargebreedte{\hss\docommando##5}%
+ \hfill}}}%
+ \normalbaselines
+ \settexthoffset
+ \hsmash
+ {\hbox to \zetbreedte{\hss\docommando\c!midden\hss}}%
+ \hsmash
+ {\hskip-\texthoffset
+ \hbox to \papierbreedte{\docommando\v!pagina\hss}}%
+ \swapmargins
+ \doifbothsidesoverruled
+ \dodocommando
+ \v!linkerrand \v!linkermarge \v!links
+ \v!rechts \v!rechtermarge \v!rechterrand
+ \orsideone
+ \dodocommando
+ \v!linkerrand \v!linkermarge \v!links
+ \v!rechts \v!rechtermarge \v!rechterrand
+ \orsidetwo
+ \dodocommando
+ \v!rechterrand \v!rechtermarge \v!rechts
+ \v!links \v!linkermarge \v!linkerrand
+ \od}}
+
+%D The user interface is relatively simple and provides
+%D macros for assigning logos to logo areas as well as
+%D forcing placement.
+%D
+%D \showsetup{\y!definelogo}
+%D \showsetup{\y!placelogos}
+
+\let\definedlogos \empty
+\let\requestedlogos\empty
+
+\long\def\dodefinelogo[#1][#2][#3][#4]%
+ {\addtocommalist{#1}\definedlogos
+ \long\setvalue{\??lo#2#3}{#1}%
+ \getparameters[\??lo#2#3][#4]%
+ \global\chardef\logostatus=2 }
+
+\def\definelogo%
+ {\doquadrupleargument\dodefinelogo}
+
+\def\placelogos%
+ {\dosingleempty\doplacelogos}
+
+\def\doplacelogos[#1]%
+ {\xdef\requestedlogos{\iffirstargument#1\else\definedlogos\fi}%
+ \global\chardef\logostatus=3 }
+
+\protect \endinput
diff --git a/tex/context/base/page-lyr.tex b/tex/context/base/page-lyr.tex
index 530526f13..bdd08eaed 100644
--- a/tex/context/base/page-lyr.tex
+++ b/tex/context/base/page-lyr.tex
@@ -1,7 +1,7 @@
%D \module
%D [ file=page-lyr,
%D version=2000.10.20,
-%D title=\CONTEXT\ OTR Macros,
+%D title=\CONTEXT\ Page Macros,
%D subtitle=Layers,
%D author=Hans Hagen,
%D date=\currentdate,
@@ -11,9 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% logo space wil be reimplemented as layers
-
-\writestatus{loading}{Context OTR Macros / Layers}
+\writestatus{loading}{Context Page Macros / Layers}
\unprotect
@@ -112,7 +110,8 @@
\def\dodosetlayer[#1][#2]%
{\bgroup
- \global\newbackgroundtrue
+ \recalculatebackgrounds
+ \recalculatelogos
\doglobal\increment\currentlayerdata
\forgetall
\dontcomplain
@@ -221,7 +220,7 @@
%D {composedlayer}
%D
%D This is a handy shortcut, which saves a couple of braces
-%D when we use it as parametsr. This name also suits better
+%D when we use it as parameter. This name also suits better
%D to other layering commands.
\def\composedlayer#1{\flushlayer[#1]}
@@ -241,7 +240,6 @@
{\doresetlayer{#1}\doresetlayer{#1:\realfolio}}
%D \macros
-%D
%D {setMPlayer}
%D
%D The following layer macro uses the positions that are
@@ -291,5 +289,116 @@
[\c!achtergrond={\v!voorgrond,#1},
\c!kader=\v!uit,
\c!offset=\v!overlay,#2]}
+
+% Some day this (old) mechanism will be combined/integrated
+% in overlays
+
+\newskip\xposition \newskip\yposition
+\newskip\xdimension \newskip\ydimension
+\newskip\xoffset \newskip\yoffset
+\newbox\positionbox
+
+\def\startpositioning%
+ {\bgroup
+ \xposition \!!zeropoint \yposition\!!zeropoint
+ \xdimension\!!zeropoint \ydimension\!!zeropoint
+ \xoffset \!!zeropoint \yoffset \!!zeropoint
+ \hfuzz \papierbreedte \vfuzz \papierhoogte
+ \setbox\positionbox\hbox\bgroup}
+
+\def\stoppositioning%
+ {\doifnot{\@@psoffset}{\v!ja}
+ {\global\xoffset=\!!zeropoint
+ \global\yoffset=\!!zeropoint}%
+ \global\advance\xdimension by \xoffset
+ \global\advance\ydimension by \yoffset
+ \egroup
+ \vbox to \ydimension
+ {\vskip\yoffset
+ \hbox to \xdimension
+ {\hskip\xoffset
+ \box\positionbox
+ \hfill}
+ \vfill}%
+ \egroup}
+
+\def\resetpositioning%
+ {\getparameters[\??ps]
+ [\c!status=\v!start,
+ \c!eenheid=\s!cm,
+ \c!factor=1,
+ \c!schaal=1,
+ \c!xfactor=\@@psfactor,
+ \c!yfactor=\@@psfactor,
+ \c!xschaal=\@@psschaal,
+ \c!yschaal=\@@psschaal,
+ \c!xstap=\v!absoluut,
+ \c!ystap=\v!absoluut,
+ \c!xoffset=\!!zeropoint,
+ \c!yoffset=\!!zeropoint]}
+
+\def\setuppositioning%
+ {\resetpositioning
+ \dodoubleargument\getparameters[\??ps]}
+
+\def\calculateposition#1#2#3#4#5#6#7#8#9%
+ {\setdimensionwithunit\scratchskip{#1}\@@pseenheid
+ \scratchskip=#8\scratchskip
+ \scratchskip=#9\scratchskip
+ \advance\scratchskip by #4\relax
+ \doif{#2}{\v!relatief}%
+ {\advance\scratchskip by #3%
+ \let#4\!!zeropoint}%
+ #3=\scratchskip\relax
+ \doifnot{\@@psstatus}{\v!overlay}
+ {\scratchskip=#5\relax
+ \advance\scratchskip by #3\relax
+ \ifdim#3<-#7\relax \global#7=-#3\relax \fi
+ \ifdim\scratchskip>#6\relax \global#6=\scratchskip\relax \fi}}
+
+\def\position%
+ {\dosingleempty\doposition}
+
+\def\doposition[#1]#2(#3,#4)%
+ {\dowithnextbox
+ {\bgroup
+ \getparameters[\??ps][#1]%
+ \dontcomplain
+ \calculateposition{#3}\@@psxstap\xposition
+ \@@psxoffset{\wd\nextbox}\xdimension\xoffset
+ \@@psxschaal\@@psxfactor
+ \scratchdimen=\ht\nextbox \advance\scratchdimen by \dp\nextbox
+ \calculateposition{#4}\@@psystap\yposition
+ \@@psyoffset\scratchdimen\ydimension\yoffset
+ \@@psyschaal\@@psyfactor
+ \vbox to \!!zeropoint % kan beter.
+ {\vskip\yposition
+ \hbox to \!!zeropoint
+ {\hskip\xposition
+ \box\nextbox
+ \hss}
+ \vss}%
+ \xdef\dopoppositioning%
+ {\xposition=\the\xposition
+ \yposition=\the\yposition
+ \noexpand\def\noexpand\@@psxoffset{\@@psxoffset}%
+ \noexpand\def\noexpand\@@psyoffset{\@@psyoffset}}%
+ \egroup
+ \dopoppositioning
+ \ignorespaces}
+ \hbox}
+
+\resetpositioning
+
+\setuppositioning
+ [\c!eenheid=\s!cm,
+ \c!factor=1,
+ \c!schaal=1,
+ \c!xstap=\v!absoluut,
+ \c!ystap=\v!absoluut,
+ \c!offset=\v!ja,
+ \c!xoffset=\!!zeropoint,
+ \c!yoffset=\!!zeropoint]
+
\protect \endinput
diff --git a/tex/context/base/page-mak.tex b/tex/context/base/page-mak.tex
new file mode 100644
index 000000000..d40dde3c5
--- /dev/null
+++ b/tex/context/base/page-mak.tex
@@ -0,0 +1,186 @@
+%D \module
+%D [ file=page-mak, % copied from main-001,
+%D version=1997.03.31,
+%D title=\CONTEXT\ Page Macros,
+%D subtitle=Simple MakeUp,
+%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 / MakeUp}
+
+\unprotect
+
+%D \macros
+%D {definemakeup, setupmakeup, startmakeup}
+%D
+%D A makeup is a separate page, like a title page or colofon.
+%D There is one standard makeup page, but you can define more
+%D if needed.
+%D
+%D \starttypen
+%D \startstandardmakeup
+%D My Fancy Title
+%D \stopstandardmakeup
+%D \stoptypen
+%D
+%D The associated commands are:
+%D
+%D \showsetup{\y!definemakeup}
+%D \showsetup{\y!setupmakeup}
+%D \showsetup{\y!startmakeup}
+
+\def\definemakeup%
+ {\dodoubleargument\dodefinemakeup}
+
+\def\dodefinemakeup[#1][#2]%
+ {\getparameters
+ [\??do#1]%
+ [\c!breedte=\zetbreedte,
+ \c!hoogte=\teksthoogte,
+ \c!voffset=\!!zeropoint,
+ \c!hoffset=\!!zeropoint,
+ \c!commandos=,
+ \c!pagina=\v!rechts,
+ \c!dubbelzijdig=\v!leeg,
+ \c!voor=,
+ \c!boven=\vss,
+ \c!onder=\vss,
+ \c!na=,
+ \c!onderstatus=\v!normaal,
+ \c!bovenstatus=\v!normaal,
+ \c!tekststatus=\v!normaal,
+ \c!hoofdstatus=\v!stop,
+ \c!voetstatus=\v!stop,
+ #2]%
+ \setvalue{\e!start#1\e!opmaak}{\startmakeup[#1]}%
+ \setvalue{\e!stop #1\e!opmaak}{\stopmakeup}}
+
+\def\setupmakeup%
+ {\dodoubleargument\dosetupmakeup}
+
+\def\dosetupmakeup[#1]%
+ {\getparameters[\??do#1]}
+
+%D This will save us some 375 bytes in the format file.
+
+\def\makeupparameter#1{\getvalue{\??do\currentmakeup#1}}
+
+%D The \type{\start}||\type{\stop} macros are used for both
+%D the direct and indirect way. The parameterless call will
+%D build a simple box.
+
+\let\currentmakeup\empty
+
+\def\startmakeup%
+ {\dodoubleempty\dostartmakeup}
+
+\def\dostartmakeup[#1][#2]%
+ {\bgroup
+ \edef\currentmakeup{#1}%
+ \iffirstargument
+ \setupmakeup[\currentmakeup][#2]%
+ \let\stopmakeup\dodostopmakeup
+ \expandafter \dodostartmakeup
+ \else
+ \let\stopmakeup\donostopmakeup
+ \expandafter \donostartmakeup
+ \fi}
+
+%D The simple case:
+
+\def\donostartmakeup%
+ {\pagina
+ \setupheader[\c!status=\v!leeg]%
+ \setupfooter[\c!status=\v!leeg]%
+ \vbox to \teksthoogte\bgroup}
+
+\def\donostopmakeup%
+ {\egroup
+ \pagina
+ \egroup}
+
+%D The normal one:
+
+\newbox\makeupbox
+
+\def\dodostartmakeup%
+ {\doifvaluesomething{\??do\currentmakeup\c!pagina}
+ {\ExpandFirstAfter\pagina[\makeupparameter\c!pagina]}
+ \soortpagina[\currentmakeup]
+ \setupmakeuplayout
+ \makeupparameter\c!commandos
+ \global\setbox\makeupbox=\vbox to \makeupparameter\c!hoogte
+ \bgroup
+ \forgetall
+ \hsize=\makeupparameter\c!breedte
+ \makeupparameter\c!boven}
+
+\def\dodostopmakeup%
+ {\endgraf
+ \makeupparameter\c!onder
+ \egroup
+ \doflushmakeup
+ \egroup
+ \calculatehsizes
+ \calculatevsizes}
+
+%D Selective page processing is handled here. (Why?)
+
+\def\doflushmakeup
+ {\ifverwerken
+ \ifgeselecteerd
+ \doshipoutmakeup
+ \fi
+ \else
+ \ifgeselecteerd \else
+ \doshipoutmakeup
+ \fi
+ \fi
+ \ifselecteren
+ \global\geselecteerdfalse
+ \fi}
+
+\def\doshipoutmakeup%
+ {\makeupparameter\c!voor
+ \box\makeupbox
+ \setupmakeuplayout
+ \pagina
+ \makeupparameter\c!na
+ \ifdubbelzijdig \ifodd\realpageno\else
+ \processaction
+ [\makeupparameter\c!dubbelzijdig]
+ [ \v!ja=>\null\pagina\verlaagpaginanummer,
+ \v!leeg=>\setupmakeuplayout
+ \pagebodyornamentsfalse % hm, an old forgotten option
+ \null\pagina\verlaagpaginanummer]%
+ \fi \fi
+ \verlaagpaginanummer}
+
+%D The text surrounding the main body text can be influenced
+%D by setting their associated status variables. The
+%D connection between them is made by the following macro
+
+\def\setupmakeuplayout%
+ {\setupfooter[\c!status=\makeupparameter\c!voetstatus ]%
+ \setupheader[\c!status=\makeupparameter\c!hoofdstatus]%
+ \setuptext [\c!status=\makeupparameter\c!tekststatus]%
+ \setupbottom[\c!status=\makeupparameter\c!onderstatus]%
+ \setuptop [\c!status=\makeupparameter\c!bovenstatus]}
+
+%D The standard page template is defined as follows:
+
+\definemakeup
+ [\v!standaard]
+ [\c!breedte=\zetbreedte,
+ \c!hoogte=\teksthoogte,
+ \c!voffset=\!!zeropoint,
+ \c!hoffset=\!!zeropoint,
+ \c!pagina=\v!rechts,
+ \c!dubbelzijdig=\v!leeg]
+
+\protect \endinput
diff --git a/tex/context/base/page-mar.tex b/tex/context/base/page-mar.tex
new file mode 100644
index 000000000..4a163ed23
--- /dev/null
+++ b/tex/context/base/page-mar.tex
@@ -0,0 +1,525 @@
+%D \module
+%D [ file=page-mar, % moved here from main-001
+%D version=1997.03.31,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Marginal Things
+%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.
+
+%D This module is still to be split and documented.
+
+\writestatus{loading}{Context Core Macros / Maginal Things}
+
+\unprotect
+
+\newif\iflowinmargin
+
+\def\stelinmargein%
+ {\dodoubleempty\dostelinmargein}
+
+\def\dostelinmargein[#1][#2]%
+ {\ifsecondargument
+ \doifundefinedelse{\??im#1\c!offset}
+ {\presetlocalframed
+ [\??im#1]%
+ \getparameters
+ [\??im#1]
+ [\c!kader=\v!uit,
+ \c!offset=\v!overlay,
+ \c!regel=1,
+ \c!scheider=,
+ \c!breedte=\v!ruim,
+ \c!afstand=\!!zeropoint,
+ \c!letter=\@@imletter,
+ \c!kleur=\@@imkleur,
+ \c!plaats=\@@implaats,
+ \c!uitlijnen=\@@imuitlijnen,
+ \c!voor=\@@imvoor,
+ \c!na=\@@imna,
+ #2]}
+ {\getparameters[\??im#1][#2]}%
+ \else
+ \getparameters[\??im][#1]%
+ \fi}
+
+\let\margetekstafstand = \!!zeropoint
+\def\margetekstregels {1}
+\def\margetekstnummer {0}
+\let\margetekstscheider = \empty
+
+\def\margestrutheight{\ht\strutbox}
+
+\def\maakmargetekstblok#1#2#3#4#5#6%
+ {#4\relax
+ \bgroup
+ \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}
+ {}%
+ \processaction
+ [\getvalue{\??im\margetekstnummer\c!uitlijnen}]
+ [ \v!ja=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{#2},
+ \v!nee=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{\v!normaal},
+ \v!binnen=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{#2},
+ \v!buiten=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{#3},
+ \v!links=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{\v!links},
+ \v!midden=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{\v!midden},
+ \v!rechts=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{\v!rechts},
+ \s!default=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{#2}]%
+ \setbox0=\vbox\localframed
+ [\??im\margetekstnummer]
+ [\c!strut=\v!nee]
+ {\decrement\margetekstregels
+ \@@imvoor
+ \doattributes
+ {\??im\margetekstnummer}\c!letter\c!kleur
+ {\dorecurse{\margetekstregels}{\strut\\}%
+ \xdef\margestrutheight{\the\ht\strutbox}%
+ \begstrut#6\endstrut\endgraf}%
+ \@@imna}%
+ \ht0=\ht\strutbox
+ \box0
+ \egroup
+ #5\relax}
+
+\def\plaatsmargetekstscheider%
+ {\ifnum\margincontent>0
+ \bgroup
+ \dimen0=\margetekstregels\lineheight
+ \advance\dimen0 by -\lineheight
+ \lower\dimen0\hbox{\margetekstscheider}%
+ \egroup
+ \fi}
+
+\def\linkermargetekstblok#1%
+ {\maakmargetekstblok
+ {\linkermargebreedte}
+ {\v!links}{\v!rechts}
+ {\llap{\plaatsmargetekstscheider}}{\hskip\margetekstafstand}
+ {#1}}
+
+\def\rechtermargetekstblok#1%
+ {\maakmargetekstblok
+ {\rechtermargebreedte}
+ {\v!rechts}{\v!links}
+ {\hskip\margetekstafstand}{\rlap{\plaatsmargetekstscheider}}
+ {#1}}
+
+\def\doplacemargintext#1#2#3%
+ {\strut
+ \setbox0=\hbox{#1}%
+ \dimen0=\ht0
+ \advance\dimen0 by \dp0
+ \ifdim\dimen0>\marginheight
+ \global\marginheight=\dimen0
+ \fi
+ \setbox0=\hbox
+ {#2{\hskip#3\strut
+ \iflowinmargin\else
+ \dimen0=\dp\strutbox
+ \advance\dimen0 by \margestrutheight
+ \advance\dimen0 by -\ht\strutbox
+ \raise\dimen0
+ \fi
+ \box0}}%
+ \ht0=\!!zeropoint
+ \dp0=\!!zeropoint
+ \gdef\margestrutheight{\the\ht\strutbox}%
+ %\vadjust{\box0}} % fails in high math lines, let it be
+ %\hbox{\lower\dp\strutbox\box0}} % alas, wrong lapping, therefore useless
+ \dopositionmarginbox0}
+
+%D This approach permits us to implement a better mechanism
+%D later.
+
+\ifx\dopositionmarginbox\undefined
+ \def\dopositionmarginbox#1{\vadjust{\box#1}}
+\fi
+
+\def\doinlinker#1%
+ {\doplacemargintext
+ {\linkermargetekstblok{#1}\hskip\linkermargeafstand}
+ \llap\!!zeropoint}
+
+\def\doinrechter#1%
+ {\doplacemargintext
+ {\hskip\rechtermargeafstand\rechtermargetekstblok{#1}}
+ \rlap\hsize}
+
+\newcounter \nofmarginnotes
+\newif \iftrackingmarginnotes
+\newif \ifrightmargin % documenteren
+
+\definetwopasslist{\s!margin}
+
+\def\domarginreference%
+ {\doglobal\increment\nofmarginnotes\relax
+ \edef\writemarref%
+ {\writeutilitycommand%
+ {\twopassentry%
+ {\s!margin}%
+ {\nofmarginnotes}%
+ {\noexpand\realfolio}}}%
+ \writemarref}
+
+\def\dodoinmargenormal#1#2#3#4%
+ {\iffirstsidefloatparagraph\geenwitruimte\fi % zo laat mogelijk
+ \ifodd#1\relax
+ \rightmargintrue
+ #3{#4}%
+ \else
+ \rightmarginfalse
+ #2{#4}%
+ \fi}
+
+\def\doinmargenormal#1#2#3%
+ {\bgroup
+ \iftrackingmarginnotes
+ \gettwopassdata{\s!margin}%
+ \iftwopassdatafound
+ \dodoinmargenormal\twopassdata#1#2{#3}%
+ \else
+ \dodoinmargenormal\realfolio#1#2{#3}%
+ \fi
+ \domarginreference
+ \else
+ \dodoinmargenormal\realfolio#1#2{#3}%
+ \fi
+ \egroup}
+
+\def\doinmargereverse#1#2#3%
+ {\dodoinmargenormal\realfolio#2#1{#3}}
+
+\def\doinmarge[#1][#2][#3][#4][#5]#6%
+ {\doifcommonelse{+,-,\v!laag}{#4}
+ {\dodoinmarge[#1][#2][#3][#4][#5]{#6}}
+ {\dodoinmarge[#1][#2][#3][][#4]{#6}}%
+ \ignorespaces}
+
+\def\dodoinmarge[#1][#2][#3][#4][#5]#6%
+ {\ignorespaces
+ \doifinsetelse{\v!laag}{#4}
+ {\lowinmargintrue}
+ {\lowinmarginfalse}%
+ \processaction
+ [#1]
+ [ \v!links=>#2{#6},
+ \v!rechts=>#3{#6},
+ \s!unknown=>\ifdubbelzijdig
+ \doifcommonelse{+,-}{#4}
+ {\doinmargereverse#2#3{#6}}
+ {\doinmargenormal#2#3{#6}}%
+ \else
+ #2{#6}%
+ \fi]%
+ \rawpagereference{\s!mar}{#5}%
+ \ignorespaces}
+
+\def\inlinker%
+ {\indentation\doquintupleempty\doinmarge
+ [\v!links][\doinlinker][\doinrechter]}
+
+\def\inrechter%
+ {\indentation\doquintupleempty\doinmarge
+ [\v!rechts][\doinlinker][\doinrechter]}
+
+\def\inmarge%
+ {\doquintupleempty\doinmarge
+ [\@@implaats][\doinlinker][\doinrechter]}
+
+\def\inanderemarge%
+ {\doquintupleempty\doinmarge
+ [\@@implaats][\doinrechter][\doinlinker]}
+
+\newcounter\margincontent
+
+\def\flushmargincontent% [#1][#2]#3% hier plaats 'globaal' (geen 1,2 enz)
+ {\doinmarge[\@@implaats][\doinlinker][\doinrechter]} % [#1][#2]{#3}}
+
+\newdimen\marginheight
+
+\let\restoreinterlinepenalty=\relax
+
+\def\flushmargincontents%
+ {\restoreinterlinepenalty % here?
+ \ifnum\margincontent>0 % called quite often, so we
+ \expandafter\doflushmargincontents % speed up the \fi scan by
+ \fi} % using a \do..
+
+% \def\doflushmargincontents% % links + rechts
+% {\bgroup
+% \forgetall
+% \global\marginheight\!!zeropoint
+% \dorecurse{\margincontent}
+% {\bgroup
+% \edef\margetekstafstand {\getvalue{\??im\recurselevel\c!afstand}}%
+% \edef\margetekstregels {\getvalue{\??im\recurselevel\c!regel}}%
+% \edef\margetekstscheider{\getvalue{\??im\recurselevel\c!scheider}}%
+% \let\margetekstnummer=\recurselevel
+% \getvalue{\??im\recurselevel}%
+% \global\setvalue{\??im\recurselevel}{}%
+% \egroup}%
+% \ifdim\marginheight>\lineheight % This is something real dirty!
+% \advance\marginheight by \pagetotal
+% \advance\marginheight by \lineheight % a sort of bonus
+% \ifdim\marginheight>\pagegoal
+% \xdef\restoreinterlinepenalty%
+% {\global\let\restoreinterlinepenalty\relax
+% \global\interlinepenalty=\the\interlinepenalty}%
+% \global\interlinepenalty=10000
+% \fi
+% \else % We need the above because interlinepenalties overrule vadjusted \nobreaks.
+% %\vadjust
+% % {\forgetall
+% % \global\advance\marginheight by \lineheight
+% % \global\divide\marginheight by \lineheight
+% % \dorecurse{\number\marginheight}
+% % {\nobreak\vskip\lineheight}%
+% % \kern-\number\marginheight\lineheight}%
+% \vadjust{\nobreak}%
+% \fi
+% \doglobal\newcounter\margincontent
+% \egroup}
+
+\def\doflushmargincontents% % links + rechts
+ {\bgroup
+ \forgetall
+ \global\marginheight\!!zeropoint
+ \dorecurse{\margincontent}
+ {\bgroup
+ \edef\margetekstafstand {\getvalue{\??im\recurselevel\c!afstand}}%
+ \edef\margetekstregels {\getvalue{\??im\recurselevel\c!regel}}%
+ \edef\margetekstscheider{\getvalue{\??im\recurselevel\c!scheider}}%
+ \let\margetekstnummer=\recurselevel
+ \getvalue{\??im\recurselevel}%
+ \global\setvalue{\??im\recurselevel}{}%
+ \egroup}%
+\ifbinnenkolommen
+ \donetrue % how fuzzy
+\else\ifdim\marginheight>\lineheight\relax
+ \donetrue % how dirty
+\else
+ \donefalse % how needed
+\fi\fi
+\ifdone
+ \advance\marginheight by \pagetotal
+ \advance\marginheight by \lineheight % a sort of bonus
+ \ifdim\marginheight>\pagegoal
+ \xdef\restoreinterlinepenalty%
+ {\global\let\restoreinterlinepenalty\relax
+ \global\interlinepenalty=\the\interlinepenalty}%
+ \global\interlinepenalty=10000
+ \fi
+ \else % We need the above because interlinepenalties overrule vadjusted \nobreaks.
+ %\vadjust
+ % {\forgetall
+ % \global\advance\marginheight by \lineheight
+ % \global\divide\marginheight by \lineheight
+ % \dorecurse{\number\marginheight}
+ % {\nobreak\vskip\lineheight}%
+ % \kern-\number\marginheight\lineheight}%
+ \vadjust{\nobreak}%
+ \fi
+ \doglobal\newcounter\margincontent
+ \egroup}
+
+% Some day: \definieermarkering[\v!margetitel]
+
+\def\docomplexmargewoord#1#2#3%
+ {\@EA\setgvalue\@EA{\@EA\??im\@EA\margincontent\@EA}\@EA
+ {\@EA\stelinmargein\@EA[\margincontent][]% see next macro
+ \flushmargincontent[#1][#2]{#3}}}
+
+\def\complexmargewoord[#1][#2]#3%
+ {\doglobal\increment\margincontent
+ \stelinmargein[\margincontent][]% see next macro
+ \ifsecondargument
+ \doifnumberelse{#1}
+ {\docomplexmargewoord{#2}{#1}{#3}}
+ {\docomplexmargewoord{#1}{#2}{#3}}%
+ \else
+ \doifnumberelse{#1}
+ {\docomplexmargewoord{}{#1}{#3}}
+ {\docomplexmargewoord{#1}{}{#3}}%
+ \fi}
+
+\def\margewoordpositie[#1]#2%
+ {\ifnum#1>\margincontent
+ \xdef\margincontent{#1}%
+ \fi
+ \stelinmargein[#1][]% when at outer level, saves local settings
+ \setgvalue{\??im#1}%
+ {\stelinmargein[#1][]% needed when par start outside group
+ \flushmargincontent[][]{#2}}}
+
+\def\margewoord%
+ {\dodoubleempty\complexmargewoord}
+
+\def\margetitel%
+ {\margewoord}
+
+\def\margetekst%
+ {\margewoord}
+
+\def\oplinker#1%
+ {\strut
+ \vadjust
+ {\mindermeldingen
+ \setbox0=\vtop{\forgetall\strut#1}%
+ \getboxheight\dimen0\of\box0
+ \vskip-\dimen0\
+ \box0}}
+
+%D \macros
+%D {inleftside,inleftmargin,inrightmargin,inrightside}
+%D
+%D The fast and clean way of putting things in the margin is
+%D using \type{\rlap} or \type{\llap}. Unfortunately these
+%D macro's don't handle indentation, left and right skips. We
+%D therefore embed them in some macro's that (force and)
+%D remove the indentation and restore it afterwards.
+
+\def\inleftmargin#1%
+ {\pushindentation
+ \llap{#1\hskip\leftskip\hskip\linkermargeafstand}%
+ \popindentation
+ \ignorespaces}
+
+\def\inrightmargin#1%
+ {\pushindentation
+ \rlap{\hskip\hsize\hskip-\rightskip\hskip\rechtermargeafstand#1}%
+ \popindentation
+ \ignorespaces}
+
+\def\inleftside#1%
+ {\inleftmargin
+ {#1\relax
+ \hskip\linkermargebreedte
+ \hskip\linkerrandafstand}}
+
+\def\inrightside#1%
+ {\inrightmargin
+ {\hskip\rechtermargebreedte
+ \hskip\rechterrandafstand
+ #1}}
+
+%D We want to keep things efficient and therefore only handle
+%D situations like:
+%D
+%D \startbuffer
+%D \inleftside {fine} some text \par
+%D \strut \inleftmargin {fine} some text \par
+%D \noindent \inrightmargin {fine} some text \par
+%D \noindent \strut \inrightside {fine} some text \par
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D which looks like:
+%D
+%D \bgroup
+%D \haalbuffer
+%D \parindent 30pt
+%D \haalbuffer
+%D \egroup
+
+% dit zijn voorlopig lokale commando's
+
+\def\woordinlinker {\inleftmargin} % vervallen
+\def\woordinrechter{\inrechtermarge} % vervallen
+
+\def\woordinmarge%
+ {\doquintupleempty\doinmarge
+ [\@@implaats][\woordinlinker][\woordinrechter]}
+
+%
+
+\stelinmargein
+ [\c!letter=\v!vet,
+ \c!kleur=,
+ \c!plaats=\v!beide,
+ \c!uitlijnen=\v!binnen,
+ \c!voor=,
+ \c!na=]
+
+\stelinmargein
+ [\v!links]
+ [\c!plaats=\v!links]
+% \c!uitlijnen=\v!links] % njet
+
+\stelinmargein
+ [\v!rechts]
+ [\c!plaats=\v!rechts]
+% \c!uitlijnen=\v!rechts] % njet
+
+\newbox\facingbox
+\newbox\facingpage
+
+\newif\iffacingpages \facingpagesfalse
+
+\def\shipoutfacingpage%
+ {\iffacingpages
+ \ifnum\realpageno>1
+ \bgroup
+ \pagebodyornamentsfalse
+ \setbox\facingpage=\vbox to \zethoogte
+ {\unvbox\facingpage\vfil}%
+ \myshipout{\buildpagebody\box\facingpage}%
+ \egroup
+ \else
+ \global\setbox\facingpage=\box\voidb@x
+ \fi
+ \fi}
+
+\def\naastpagina%
+ {\shipoutfacingpage}
+
+\def\facefloat% redefined
+ {\startnaast\box\floatbox\stopnaast}
+
+\def\startnaast% beter: \dowithnextbox
+ {\iffacingpages
+ \global\setbox\facingbox=\vbox
+ \bgroup
+ \hsize=\zetbreedte
+ \else
+ \def\next{\gobbleuntil\stopnaast}%
+ \expandafter\next
+ \fi}
+
+\def\stopnaast%
+ {\egroup
+ \global\setbox\facingpage=\vbox
+ {\ifvoid\facingpage
+ \vskip\openstrutdepth % \dp\strutbox
+ \else
+ \unvbox\facingpage
+ \fi
+ \box\facingbox
+ \blanko}}
+
+\def\dostelnaastplaatsenin[#1]%
+ {\getparameters[\??np][#1]%
+ \doifelse{\@@npstatus}{\v!start}
+ {\global\facingpagestrue}
+ {\global\facingpagesfalse}}
+
+\def\stelnaastplaatsenin%
+ {\dosingleargument\dostelnaastplaatsenin}
+
+\stelnaastplaatsenin
+ [\c!status=\v!stop]
+
+\protect \endinput
diff --git a/tex/context/base/core-mul.tex b/tex/context/base/page-mul.tex
index d971889ce..40f211090 100644
--- a/tex/context/base/core-mul.tex
+++ b/tex/context/base/page-mul.tex
@@ -1,7 +1,7 @@
%D \module
-%D [ file=core-mul,
+%D [ file=page-mul, % was: core-mul
%D version=1998.03.15,
-%D title=\CONTEXT\ Core Macros,
+%D title=\CONTEXT\ OTR Macros,
%D subtitle=Multi Column Output,
%D author=Hans Hagen,
%D date=\currentdate,
@@ -11,10 +11,34 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\writestatus{loading}{Context Core Macros / Multi Column Output}
+\writestatus{loading}{Context OTR Macros / Simple Multi Column}
+
+%D This module is mostly a copy from the original multi column
+%D routine as implemented in \type {core-mul}. When the main
+%D OTR macro's were isolated in modules and when Kluwer
+%D Academic Publishers needed more advanced footnote support,
+%D this module became part of the OTR modules. As a result this
+%D module is no longer generic.
\unprotect
+% TO DO !
+
+\let\OTRMULsetvsize \OTRONEsetvsize
+\let\OTRMULsethsize \OTRONEsethsize
+\let\OTRMULsetfootnotehsize \OTRONEsetfootnotehsize
+\let\OTRMULdopagecontents \OTRONEdopagecontents
+\let\OTRMULfinalsidefloatoutput\OTRONEfinalsidefloatoutput
+\let\OTRMULflushfloatbox \OTRONEflushfloatbox
+
+\let\OTRMULdosettopinserts \relax
+\let\OTRMULdosetbotinserts \relax
+\let\OTRMULdotopinsertions \relax
+\let\OTRMULdobotinsertions \relax
+\let\OTRMULdosetbothinserts \relax
+
+\newtoks \OTRMULoutput
+
% check \count<insert> multiplications
% some day try this in balancing routine
@@ -33,125 +57,6 @@
%D circumstances things still went wrong. I considered all
%D calls to Platt's \type{\balancingerror} as undesirable.
-\startmessages dutch library: columns
- title: kolommen
- 1: maximaal -- kolommen
- 2: gebruik eventueel \string\filbreak
- 3: probleempje, probeer [balanceren=nee]
- 4: plaatsblok boven nog niet mogelijk
- 5: plaatsblok onder nog niet mogelijk
- 6: -- plaatsblok(en) opgeschort
- 7: balanceren afgebroken na 100 stappen
- 8: gebalanceerd in -- stap(pen)
- 9: uitlijnen controleren!
- 10: (minder dan) 1 regel over
- 11: plaatsblok te breed voor kolom
- 12: plaatsblok verplaatst naar volgende kolom / --
- 13: breed figuur geplaatst boven kolommen
-\stopmessages
-
-\startmessages english library: columns
- title: columns
- 1: only -- columns possible
- 2: use \string\filbreak\space as alternative
- 3: problems, disable balancing
- 4: top float not yet supported
- 5: bottom float not yet supported
- 6: -- float(s) postponed
- 7: balancing aborted after 100 steps
- 8: balanced in -- step(s)
- 9: check raggedness
- 10: (less than) 1 line left
- 11: float to wide for column
- 12: float moved to next column / --
- 13: wide float moved to top of columns
-\stopmessages
-
-\startmessages german library: columns
- title: Spalten
- 1: nur -- Spalten moeglich
- 2: benutzte \string\filbreak\space als Alternative
- 3: Problem, verwende [ausgleich=nein]
- 4: Gleitobjekt oben ncoh nicht unterstuetzt
- 5: Gleitobjekt unten ncoh nicht unterstuetzt
- 6: -- Gleitobjekt(e) verschoben
- 7: ausgleich nach 100 Schritten abgebrocheb
- 8: ausgeglichen nach -- Schritt(en)
- 9: Ausrichtung ueberpruefen
- 10: (weniger als) 1 Zeile uebrig
- 11: Gleitobjekt zu breit fuer Spalte
- 12: Gleitobjekt in naechste Zeile verschoben / --
- 13: breites Gleitobjekt an den Anfang der Spalten verschoben
-\stopmessages
-
-\startmessages czech library: columns
- title: sloupce
- 1: je mozno pouze -- sloupcu
- 2: pouzijte \string\filbreak\space jako alternativu
- 3: problem, vypina se vyvazovani
- 4: horni plovouci objekt jeste neni podporovan
- 5: spodni plovouci objekt jeste neni podporovan
- 6: -- plovouci objekt(y) odlozeny
- 7: vyvazovani ukonceno po 100 krocich
- 8: vyvazeno v -- krocich
- 9: kontrola nerovnost
- 10: zbyl (mene nez) 1 radek
- 11: plovouci objekt je pro sloupec prilis siroky
- 12: plovouci objekt je presunut do nasledujiciho sloupce / --
- 13: siroky plovouci objekt je presunut nad sloupce
-\stopmessages
-
-\startmessages italian library: columns
- title: colonne
- 1: solo -- colonne possibili
- 2: in alternativa, usare \string\filbreak
- 3: problemi, disabilitare il bilanciamento
- 4: float in cima non ancora supportato
- 5: float in fondo non ancora supportato
- 6: -- float(s) posticipate
- 7: bilanciamento annullato dopo 100 passi
- 8: bilanciamento in -- passo/i
- 9: controllare seghettamento
- 10: (meno di) una riga rimasta
- 11: oggetto mobile troppo ampio per la colonna
- 12: oggetto mobile spostata alla colonna successiva / --
- 13: oggetto mobile ampio spostato sopra le colonne
-\stopmessages
-
-\startmessages norwegian library: columns
- title: kolonner
- 1: maksimalt -- kolonner
- 2: bruk \string\filbreak\space som et alternativ
- 3: problemer, slår av balansering
- 4: flytblokker øverst er ikke støttet enda
- 5: flytblokker nedert er ikke støttet enda
- 6: -- flytblokk forskjøvet
- 7: balansering avbrutt etter 100 iterasjoner
- 8: balansert etter -- iterasjoner
- 9: kontroller tekstlayout!
- 10: (mindre enn) 1 linje igjen
- 11: flytblokk for bredt for kolonna
- 12: flytblokk forskjøvet til neste kolonne / --
- 13: bred flytblokk forksjøvet til toppen av kolonnene
-\stopmessages
-
-\startmessages romanian library: columns
- title: coloane
- 1: este posibil numai -- coloane
- 2: folositi \string\filbreak\space ca alternativa
- 3: probleme, se dezactiveaza alinierea
- 4: cadrele top (top float) nu sunt inca suportate
- 5: cadrele bottom (bottom float) nu sunt inca suportate
- 6: -- blocurile sunt amanate
- 7: alinierea este oprita dupa 100 de incercari
- 8: aliniat in -- pas(i)
- 9: verificat alinierea
- 10: a mai ramas (mai putin de) 1 linie
- 11: blocul este prea lat pentru coloana
- 12: blocul este mutat pe urmatoarea coloana / --
- 13: blocul lat este mutat in partea de sus a coloanelor
-\stopmessages
-
%D This completely new implementation can handle enough
%D situations for everyday documents, but is still far from
%D perfect. While at the moment the routine doesn't support
@@ -238,10 +143,6 @@
%D
%D \interface \type{\global\settopskip} \\
%D set \type{\topskip} \\
-%D \interface \type{\setcolumnwarnings} \\
-%D set \type{\badness} and \type{\fuzz} \\
-%D \interface \type{\setcolumninserts} \\
-%D set \type{\insert}'s \\
%D \interface \type{\setvsize} \\
%D set \type{\vsize} and \type{\pagegoal} \\
%D \interface \type{\sethsize} \\
@@ -280,9 +181,6 @@
\def\fixedcolumnheight {\teksthoogte}
\def\betweencolumns {\hskip\bodyfontsize}
-\def\setcolumnwarnings {\dontcomplaincolumnboxes}
-\def\setcolumninserts {\dontpermitcolumninserts}
-
\let\setcolumnfloats \relax % in CONTEXT used for floats
\let\flushcolumnfloats \relax % in CONTEXT used for floats
\let\flushcolumnfloat \relax % in CONTEXT used for floats
@@ -301,33 +199,7 @@
%D are applied to columns. The final values are used when
%D flushing the columns.
-\newcount\nofcolumns \nofcolumns=2
-
-\def\maxnofcolumns {16}
-\def\allocatednofcolumns {0}
-\def\minbalancetoplines {1}
-
-\newif\ifbalancecolumns \balancecolumnsfalse
-\newif\ifstretchcolumns \stretchcolumnsfalse
-\newif\ifinheritcolumns \inheritcolumnsfalse
-\newif\ifheightencolumns \heightencolumnsfalse
-
-\newbox\partialpage
-\newbox\restofpage
-
-\newbox\savedfloatlist
-
-\newdimen\intercolumnwidth
-\newdimen\localcolumnwidth
-\newdimen\partialpageheight
-\newdimen\savedpagetotal
-
-\newtoks\singlecolumnout
-
-%D The next dimension reports the final column height
-
-\newdimen\finalcolumnheights
-\newcount\finalcolumnlines
+\newtoks\singlecolumnout % remove that one
%D It's more convenient to use \type {\columnwidth} instead
%D of messing around with boxes each time.
@@ -343,85 +215,6 @@
\global\gutterwidth=\intercolumnwidth}%
\egroup}
-%D During initialization the temporary boxes are allocated.
-%D This enables us to use as much columns as we want, without
-%D exhausting the pool of boxes too fast. We could have packed
-%D them in one box, but we've got enough boxes.
-%D
-%D Two sets of boxes are declared, the txtboxes are used for
-%D the text, the topboxes are for moved column floats.
-
-\def\@@txtcol{@@txtcol}
-\def\@@topcol{@@topcol}
-
-\def\initializemulticolumns#1%
- {\ifnum#1>\maxnofcolumns\relax
- \showmessage{\m!columns}{1}{\maxnofcolumns}%
- \nofcolumns=\maxnofcolumns
- \else
- \nofcolumns=#1\relax
- \fi
- \ifnum\nofcolumns>\allocatednofcolumns\relax
- \dorecurse
- {#1}
- {\ifnum\recurselevel>\allocatednofcolumns\relax
- \newbox\next
- \global\letvalue{\@@txtcol\recurselevel}=\next
- \newbox\next
- \global\letvalue{\@@topcol\recurselevel}=\next
- \fi}%
- \xdef\allocatednofcolumns{\the\nofcolumns}%
- \fi
- \edef\firstcolumnbox{\getvalue{\@@txtcol1}}%
- \edef\firsttopcolumnbox{\getvalue{\@@topcol1}}%
- \edef\lastcolumnbox{\getvalue{\@@txtcol\the\nofcolumns}}%
- \edef\lasttopcolumnbox{\getvalue{\@@topcol\the\nofcolumns}}}
-
-%D Without going in details we present two macro's which
-%D handle the columns. The action which is transfered by the
-%D the first and only parameter can do something with
-%D \type{\currentcolumnbox}. In case of the mid columns,
-%D \type{\firstcolumnbox} and \type{\lastcolumnbox} are handled
-%D outside these macro's.
-
-%\def\dohandlemidcolumns#1%
-% {\dorecurse
-% {\nofcolumns}
-% {\ifnum\recurselevel>1
-% \ifnum\recurselevel<\nofcolumns\relax
-% \edef\currentcolumnbox{\getvalue{\@@txtcol\recurselevel}}%
-% \edef\currenttopcolumnbox{\getvalue{\@@topcol\recurselevel}}%
-% \let\currentcolumn=\recurselevel
-% #1\relax
-% \fi
-% \fi}}
-%
-%\def\dohandleallcolumns#1%
-% {\dorecurse
-% {\nofcolumns}
-% {\edef\currentcolumnbox{\getvalue{\@@txtcol\recurselevel}}%
-% \edef\currenttopcolumnbox{\getvalue{\@@topcol\recurselevel}}%
-% \let\currentcolumn=\recurselevel
-% #1\relax}}
-
-\def\dohandlecolumn#1%
- {\edef\currentcolumnbox {\getvalue{\@@txtcol\recurselevel}}%
- \edef\currenttopcolumnbox{\getvalue{\@@topcol\recurselevel}}%
- \let\currentcolumn=\recurselevel
- #1\relax}
-
-\def\dohandleallcolumns#1%
- {\dorecurse{\nofcolumns}{\dohandlecolumn{#1}}}
-
-\def\dohandlerevcolumns#1%
- {\dostepwiserecurse{\nofcolumns}{1}{-1}{\dohandlecolumn{#1}}}
-
-\def\dohandlemidcolumns#1%
- {\dohandleallcolumns
- {\ifnum\recurselevel>1\relax\ifnum\recurselevel<\nofcolumns\relax
- \dohandlecolumn{#1}%
- \fi\fi}}
-
%D Going to a new columns is done by means of a
%D \type{\ejectcolumn}. The following definition does not
%D always work.
@@ -457,19 +250,10 @@
{\showmessage{\m!columns}{3}{}%
\finaloutput\unvbox\normalpagebox}
-%D Here we present the two \type{\dont...} macro's, which are
-%D of course \CONTEXT||specific ones.
+\def\OTRMULsometopsfloat{\showmessage{\m!columns}{4}{}\someherefloat}
+\def\OTRMULsomebotsfloat{\showmessage{\m!columns}{5}{}\someherefloat}
-\def\dontcomplaincolumnboxes%
- {\mindermeldingen}
-
-\def\dontpermitcolumninserts%
- {\def\dotopfloat%
- {\showmessage{\m!columns}{4}{}%
- \doexecfloat}%
- \def\dobotfloat%
- {\showmessage{\m!columns}{5}{}%
- \doexecfloat}}
+\def\OTRMULsomeherefloat{\OTRONEsomeherefloat}
\def\getinsertionheights\to#1\\% \relax'm
{#1=\!!zeropoint
@@ -515,8 +299,8 @@
\global\vsize=-\columntextoffset
\global\multiply\vsize by 2
\global\advance\vsize by \columntextheight
- \ifdim\partialpageheight>\!!zeropoint
- \global\advance\vsize by -\partialpageheight
+ \ifdim\precolumnboxheight>\!!zeropoint
+ \global\advance\vsize by -\precolumnboxheight
\fi
\getinsertionheights\to\dimen0\\%
\global\advance\vsize by -\dimen0
@@ -535,7 +319,7 @@
%D multiplying \type{\vsize} and dividing \type{\hsize} by
%D \type{\nofcolumns}. More on this can be found in the
%D \TeX book. We save the top of the current page in box
-%D \type{\partialpage}.
+%D \type{\precolumnbox}.
%D
%D We manipulate \type{\topskip} a bit, just to be shure that
%D is has no flexibility. This has te be done every time a
@@ -555,7 +339,6 @@
%\setcolumntextheight\relax
\widowpenalty=0 % is gewoon beter
\clubpenalty=0 % zeker bij grids
- \brokenpenalty=0 % new
\ifsomefloatwaiting
\showmessage{\m!columns}{6}{\the\savednoffloats}%
\global\setbox\savedfloatlist=\box\floatlist
@@ -578,8 +361,7 @@
\fi
\appendtoks\topskip=1\topskip\to\everybodyfont
\the\everybodyfont
- \initializemulticolumns\nofcolumns
- \setcolumninserts
+ \initializecolumns\nofcolumns
\hangafter=0
\hangindent=\!!zeropoint
\everypar{}%
@@ -589,15 +371,16 @@
\fi
\global\savedpagetotal=\pagetotal
\global\singlecolumnout=\output
-% \global\output={\global\setbox\partialpage=\vbox{\unvbox\normalpagebox}}%
-\global\output={\global\setbox\partialpage=\vbox{\dotopinsertions\unvbox\normalpagebox}}%
+% \global\output={\global\setbox\precolumnbox=\vbox{\unvbox\normalpagebox}}%
+\global\output={\global\setbox\precolumnbox=\vbox{\dotopinsertions\unvbox\normalpagebox}}%
\eject % no \holdinginserts=1, can make footnote disappear !
- \global\partialpageheight=\ht\partialpage
+ \global\precolumnboxheight=\ht\precolumnbox
\global\output={\continuousmulticolumnsout}%
\setcolumnfloats
\dohandleallcolumns
{\global\setbox\currenttopcolumnbox=\box\voidb@x}%
\checkbegincolumnfootnotes
+\activateotr{MUL}{ONE}% todo ! ! ! !
\let\sethsize=\setcolumnhsize
\let\setvsize=\setcolumnvsize
\sethsize
@@ -615,7 +398,7 @@
%D reasoning to find out what happens and maybe I'm making
%D some mistake, but it works.
%D
-%D Voiding box \type{\partialpage} is sometimes necessary,
+%D Voiding box \type{\precolumnbox} is sometimes necessary,
%D e.g. when there is no text given between \type{\begin..}
%D and \type{\end..}. The \type{\par} is needed!
@@ -637,10 +420,11 @@
\eject % the prevdepth is important, try e.g. toclist in
\prevdepth\!!zeropoint % columns before some noncolumned text text
\global\output=\singlecolumnout
- \ifvoid\partialpage\else
- \unvbox\partialpage
+\global\output={\the\mainoutput}% % % % % todo
+ \ifvoid\precolumnbox\else
+ \unvbox\precolumnbox
\fi
- \global\partialpageheight=\!!zeropoint
+ \global\precolumnboxheight=\!!zeropoint
\endgroup % here
\nofcolumns=1
\setvsize % the outer one!
@@ -680,7 +464,7 @@
\def\setmulticolumnsout%
{\everypar{}%
- \setcolumnwarnings
+ \dontcomplain
\settopskip
\setmaxdepth
\topskip=1\topskip
@@ -690,7 +474,7 @@
\emergencystretch=\!!zeropoint\relax} % sometimes needed !
%D Flushing the page comes to pasting the columns together and
-%D appending the result to box \type{\partialpage}, if not
+%D appending the result to box \type{\precolumnbox}, if not
%D void. I've seen a lot of implementations in which some skip
%D was put between normal text and multi||column text. When we
%D don't want this, the baselines can be messed up. I hope the
@@ -701,7 +485,7 @@
%D don't blame me.
%D
%D One of the complications of flushing out the boxes is that
-%D \type{\partialpage} needs to be \type{\unvbox}'ed, otherwise
+%D \type{\precolumnbox} needs to be \type{\unvbox}'ed, otherwise
%D there is too less flexibility in the page when using
%D \type{\r@ggedbottom}. It took a lot of time before these
%D kind of problems were overcome. Using \type{\unvbox} at the
@@ -727,76 +511,6 @@
\edef\maxcolumndepth{\the\dp\currentcolumnbox}%
\fi}}
-% \def\flushcolumnedpage%
-% {\bgroup
-% \forgetall
-% \setmulticolumnsout
-% \showcomposition
-% \setmaxcolumndimensions
-% \postprocesscolumns
-% \dohandleallcolumns % \hbox i.v.m. \showcomposition
-% {\global\setbox\currentcolumnbox=\hbox to \localcolumnwidth
-% {\box\currentcolumnbox
-% \global\wd\currentcolumnbox=\localcolumnwidth
-% \ifheightencolumns
-% \global\ht\currentcolumnbox=\fixedcolumnheight
-% \fi}}%
-% \setmaxcolumndimensions
-% \overlaycolumnfootnotes
-% \setbox0=\vbox
-% {\hbox to \finalcolumntextwidth
-% {\ifreversecolumns
-% \@EA\dohandlerevcolumns
-% \else
-% \@EA\dohandleallcolumns
-% \fi
-% {\finishcolumnbox{\hbox
-% {\ifx\finishcolumnbox\relax\else\strut\fi
-% \box\currentcolumnbox}}%
-% \hfil}%
-% \unskip}}%
-% \scratchdimen=\!!zeropoint
-% \dohandleallcolumns
-% {\ifdim-\ht\currenttopcolumnbox<\scratchdimen
-% \scratchdimen=-\ht\currenttopcolumnbox
-% \fi
-% \global\setbox\currenttopcolumnbox=\box\voidb@x}%
-% \advance\scratchdimen by \ht0
-% \setbox2=\hbox to \columntextwidth
-% {\vrule\!!width\!!zeropoint\!!height\scratchdimen\!!depth\dp0
-% \dostepwiserecurse{2}{\nofcolumns}{1}{\hfil\betweencolumns}\hfil}%
-% \setbox0=\hbox
-% {\box0\hskip-\columntextwidth\color[black]{\box2}}%
-% \ifvoid\partialpage \else
-% \ifgridsnapping % do you believe this junk?
-% \scratchdimen=\savedpagetotal
-% \advance\scratchdimen by -\ht\partialpage
-% \advance\scratchdimen by -\dp\partialpage
-% \advance\scratchdimen by -\topskip
-% \box\partialpage
-% \kern\scratchdimen
-% \else
-% \unvbox\partialpage
-% \fi
-% \fi
-% \global\partialpageheight=\!!zeropoint
-% \setvsize
-% \dosomebreak\nobreak
-% \ifgridsnapping \else
-% \dimen0=\topskip
-% \advance\dimen0 by -\openstrutheight
-% \nointerlineskip
-% \vskip-\dimen0
-% \fi
-% \prevdepth\openstrutdepth
-% \nointerlineskip
-% \dp0=\!!zeropoint
-% \global\finalcolumnheights=\ht0
-% \getnoflines\finalcolumnheights
-% \global\finalcolumnlines=\noflines
-% \box0
-% \egroup}
-
\def\flushcolumnedpage%
{\bgroup
\forgetall
@@ -843,19 +557,19 @@
\hskip-\columntextwidth
\color[black]{\box\scratchbox}}%
\postprocesscolumnpagebox % new, acts upon \box\columnpagebox
- \ifvoid\partialpage \else
+ \ifvoid\precolumnbox \else
\ifgridsnapping % do you believe this junk?
\scratchdimen=\savedpagetotal
- \advance\scratchdimen by -\ht\partialpage
- \advance\scratchdimen by -\dp\partialpage
+ \advance\scratchdimen by -\ht\precolumnbox
+ \advance\scratchdimen by -\dp\precolumnbox
\advance\scratchdimen by -\topskip
- \box\partialpage
+ \box\precolumnbox
\kern\scratchdimen
\else
- \unvbox\partialpage
+ \unvbox\precolumnbox
\fi
\fi
- \global\partialpageheight=\!!zeropoint
+ \global\precolumnboxheight=\!!zeropoint
\setvsize
\dosomebreak\nobreak
\ifgridsnapping \else
@@ -1119,9 +833,9 @@
\dontshowcomposition
\dimen0=\columntextheight
\getinsertionheights\to\dimen2\\% toegevoegd ivm voetnoten
- \advance\dimen2 by \partialpageheight
+ \advance\dimen2 by \precolumnboxheight
\dimen0=\columntextheight
- \advance\dimen0 by -\partialpageheight
+ \advance\dimen0 by -\precolumnboxheight
\getinsertionheights\to\dimen2\\%
\advance\dimen0 by -\dimen2
\ifgridsnapping % evt altijd, nog testen
@@ -1170,8 +884,8 @@
\dohandleallcolumns
{\global\ht\currentcolumnbox=\dimen0}%
\fi
- \setbox\partialpage=\vbox{\flushcolumnedpage}%
- \finaloutput\box\partialpage
+ \setbox\precolumnbox=\vbox{\flushcolumnedpage}%
+ \finaloutput\box\precolumnbox
\sethsize
\setvsize
\flushcolumnfloats
@@ -1382,18 +1096,20 @@
\fi}
\def\setglobalcolumnfloats%
- {\everypar={}%
+ {\everypar\emptytoks
\let\flushcolumnfloat=\relax
- \let\doroomfloat=\relax
+ %\let\doroomfloat=\relax
+ \let\docheckiffloatfits=\relax
\let\flushcolumnfloats=\noflushcolumnfloats}
\def\setlocalcolumnfloats%
{\everypar=
{\flushfootnotes\flushcolumnfloat\flushmargincontents\checkindentation}%
\let\flushcolumnfloat=\doflushcolumnfloat
- \let\doroomfloat=\docolumnroomfloat
+ %\let\doroomfloat=\docolumnroomfloat
+ \let\docheckiffloatfits=\docolumnroomfloat
\let\flushcolumnfloats=\doflushcolumnfloats
-\let\doflushfloats\doflushcolumnfloats % new
+ \let\doflushfloats\doflushcolumnfloats % new
\let\dosetbothinserts=\relax
\let\dotopinsertions=\relax}
@@ -1418,51 +1134,12 @@
%D account when we calculate the available space. It's a pitty
%D that such things are no integral part of \TEX.
-% \def\getcolumnstatus\column#1\total#2\goal#3\\%
-% {\ifdim\pagegoal<\maxdimen
-% \dimen0=\pagegoal
-% \divide\dimen0 by \nofcolumns
-% \dimen2=\!!zeropoint
-% \count255=0\relax
-% \dimen8=\columntextheight
-% \advance\dimen8 by -\partialpageheight
-% %\advance\dimen8 by -\maxdepth % recently deleted
-% \def\dogetcolumnstatus%
-% {\advance\count255 by 1\relax
-% \advance\dimen2 by \ht\currenttopcolumnbox
-% \advance\dimen2 by \dp\currenttopcolumnbox
-% \dimen4=\dimen2\relax
-% \advance\dimen4 by \pagetotal
-% \dimen6=\count255\dimen8
-% \ifdim\dimen4>\dimen6
-% \else
-% \let\dogetcolumnstatus=\relax
-% \fi}%
-% \dohandleallcolumns{\dogetcolumnstatus}%
-% \ifdim\dimen4=\dimen6
-% \dimen4=\!!zeropoint
-% \advance\count255 by 1
-% \fi
-% #1=\count255
-% #2=\dimen4
-% #3=\dimen6
-% \else
-% #1=1
-% #2=\!!zeropoint
-% #3=\teksthoogte
-% \advance#3 by -\partialpageheight
-% \fi}
-
\def\getcolumnstatus\column#1\total#2\goal#3\\%
- {\ifdim\pagegoal<\maxdimen
- \dimen0=\pagetotal
- \else
- \dimen0=\!!zeropoint
- \fi
+ {\dimen0=\ifdim\pagegoal<\maxdimen \pagetotal \else \zeropoint \fi
\dimen2=\!!zeropoint
\count255=0
\dimen8=\columntextheight
- \advance\dimen8 by -\partialpageheight
+ \advance\dimen8 by -\precolumnboxheight
\def\dogetcolumnstatus%
{\advance\count255 by 1
\advance\dimen2 by \ht\currenttopcolumnbox
@@ -1488,7 +1165,7 @@
\xdef\insertionheight{\the\dimen0}%
\egroup
\else
- \global\let\insertionheight=\!!zeropoint
+ \global\let\insertionheight=\zeropoint
\fi}
\def\docolumnroomfloat%
@@ -1535,7 +1212,7 @@
\forgetall
\let\doflushcolumnfloat=\relax
\getcolumnstatus\column\count255\total\dimen0\goal\dimen2\\%
- \ifdim\dimen0>\!!zeropoint
+ \ifdim\dimen0>\zeropoint
\dogetfloat
\ifdim\wd\floatbox>\hsize
\doresavefloat
@@ -1552,7 +1229,7 @@
\ifnum\count255<\nofcolumns
\advance\count255 by 1
\edef\currenttopcolumnbox{\getvalue{\@@topcol\the\count255}}%
- \ifdim\ht\currenttopcolumnbox=\!!zeropoint
+ \ifdim\ht\currenttopcolumnbox=\zeropoint
\global\setbox\currenttopcolumnbox=\vbox
{\snaptogrid\vbox{\copy\floatbox}
\witruimte % nodig ?
@@ -1574,8 +1251,7 @@
\else
\ifhmode{\setbox0=\lastbox}\fi% waar is die er in geslopen
\par
- \ifdim\prevdepth<\!!zeropoint\relax % anders bovenaan kolom witruimte
- \else
+ \ifdim\prevdepth<\zeropoint \else % anders bovenaan kolom witruimte
\nobreak
\blanko[\@@bkvoorwit]
\nobreak
@@ -1621,9 +1297,9 @@
\blanko[\@@bknawit]}%
\else
\dogetfloat
-\ifdim\wd\floatbox>\finalcolumntextwidth % better somewhere else too
- \global\setbox\floatbox=\hbox to \finalcolumntextwidth{\hss\box\floatbox\hss}%
-\fi % otherwise the graphic may disappear
+ \ifdim\wd\floatbox>\finalcolumntextwidth % better somewhere else too
+ \global\setbox\floatbox=\hbox to \finalcolumntextwidth{\hss\box\floatbox\hss}%
+ \fi % otherwise the graphic may disappear
\ifdim\wd\floatbox>\hsize
\dimen0=\wd\floatbox
\advance\dimen0 by \intercolumnwidth
@@ -1689,8 +1365,6 @@
%D \normalizevbox{...}
%D \stoptypen
-\protect \endinput
-
% border case, should fit on one page
%
% \startkolommen
@@ -1700,3 +1374,193 @@
% 3 \input tufte \par \plaatsfiguur{}{\omlijnd[breedte=\hsize,hoogte=3cm]{3}}
%
% \stopkolommen
+
+\newif\ifbinnenkolommen
+\newif\if@@klbalanceren
+\newif\if@@kluitlijnen
+
+\binnenkolommenfalse
+
+\def\stelkolommenin%
+ {\dodoubleargument\dostelkolommenin}
+
+\def\stelkolommenin[#1]%
+ {\getparameters[\??kl][#1]%
+ \nofcolumns=\@@kln\relax
+ \processaction
+ [\@@kllijn]
+ [ \v!aan=>\let\betweencolumns=\linebetweencolumns,
+ \v!uit=>\let\betweencolumns=\spacebetweencolumns,
+ \s!default=>\let\betweencolumns=\spacebetweencolumns,
+ \s!unknown=>\let\betweencolumns=\@@kllijn]}
+
+\def\linebetweencolumns%
+ {\bgroup
+ \startcolorpage
+ \ifdim\@@klafstand>\!!zeropoint
+ \dimen0=\@@klafstand
+ \else
+ \dimen0=\linewidth
+ \fi
+ \advance\dimen0 by -\linewidth
+ \hskip.5\dimen0
+ \vrule
+ \!!width\linewidth
+ \ifb@selinebottom\!!depth\strutdepth\fi
+ \hskip.5\dimen0\relax
+ \stopcolorpage
+ \egroup}
+
+\def\spacebetweencolumns%
+ {\hskip\@@klafstand}
+
+\presetlocalframed[\??kl]
+
+\def\backgroundfinishcolumnbox%
+ {\doifinsetelse{\@@kloffset}{\v!geen,\v!overlay}
+ {\let\@@kloffset\!!zeropoint}
+ {\scratchdimen=\@@kloffset
+ \advance\scratchdimen by -\@@kllijndikte
+ \edef\@@kloffset{\the\scratchdimen}}%
+ \localframed
+ [\??kl]
+ [\c!strut=\v!nee,
+ \c!breedte=\v!passend,
+ \c!hoogte=\v!passend,
+ \c!uitlijnen=]}
+
+\let\restorecolumnsettings\relax
+
+\def\complexstartkolommen[#1]% %% \startkolommen
+ {\bgroup
+ \let\stopkolommen=\egroup
+ \ifbinnenkolommen
+ \else
+ \stelkolommenin[#1]%
+ \ifnum\@@kln>1\relax
+ \witruimte
+ \begingroup
+ \doif{\@@kloptie}{\v!achtergrond}
+ {\let\finishcolumnbox=\backgroundfinishcolumnbox
+ \let\columntextoffset=\@@kloffset}%
+ \ifx\@@klcommando\empty\else
+ \let\postprocesscolumnline\@@klcommando
+ \fi
+ \doifelsenothing{\@@klhoogte}
+ {\heightencolumnsfalse}
+ {\heightencolumnstrue}%
+ \doifelse{\@@klrichting}{\v!rechts}
+ {\reversecolumnsfalse}
+ {\reversecolumnstrue}%
+ \doifelse{\@@klbalanceren}{\v!ja}
+ {\balancecolumnstrue}
+ {\balancecolumnsfalse}%
+ \processaction % ook nog: laatsteuitlijnen
+ [\@@kluitlijnen]
+ [ \v!ja=>\stretchcolumnstrue
+ \inheritcolumnsfalse,
+ \v!nee=>\stretchcolumnsfalse
+ \inheritcolumnsfalse,
+ \v!tekst=>\stretchcolumnsfalse
+ \inheritcolumnstrue]%
+ \nofcolumns=\@@kln
+ %
+ % probably more is needed, and how about nesting save's
+ %
+ \savecurrentblanko
+ \savecurrentwitruimte
+ \def\restorecolumnsettings%
+ {\boxmaxdepth\maxdimen % done elsewhere
+ \restorecurrentblanko
+ \restorecurrentwitruimte}%
+ %
+ \edef\fixedcolumnheight{\@@klhoogte}%
+ \edef\minbalancetoplines{\@@klnboven}%
+ \steltolerantiein[\@@kltolerantie]% %% \startkolommen
+ \stelblankoin[\@@klblanko]%
+ \ifdim\tussenwit>\!!zeropoint
+ \stelwitruimtein[\@@klblanko]%
+ \fi
+ \def\stopkolommen%
+ {\endmulticolumns
+ \global\binnenkolommenfalse
+ \endgroup
+ \egroup}%
+ \global\binnenkolommentrue
+ \beginmulticolumns
+ \fi
+ \fi}
+
+\definecomplexorsimpleempty\startkolommen
+
+%\def\kolom%
+% {\ifbinnenkolommen
+% \ejectcolumn
+% \fi}
+
+\def\preferredejectcolumn%
+ {\goodbreak}
+
+% \def\forcedejectcolumn%
+% {\vfil
+% \penalty-200
+% \prevdepth=-1000pt % signals top of column to \blanko
+% \vfilneg}
+
+\def\forcedejectcolumn%
+ {\par % todo: since
+ {\testrulewidth\!!zeropoint\ruledvskip\teksthoogte} % we misuse a
+ \penalty-200 % side effect
+ \vskip-\teksthoogte
+ \prevdepth=-1000pt} % signals top of column to \blanko
+
+\def\kolom%
+ {\dosingleempty\dokolom}
+
+\def\dokolom[#1]%
+ {\ifbinnenkolommen
+ \iffirstargument
+ \processaction
+ [#1]
+ [ \v!ja=>\forcedejectcolumn,
+ \v!voorkeur=>\preferredejectcolumn]%
+ \else
+ \preferredejectcolumn
+ \fi
+ \fi}
+
+\stelkolommenin
+ [\c!n=2,
+ \c!nboven=1,
+ \c!commando=,
+ \c!richting=\v!rechts,
+ \c!lijn=\v!uit,
+ \c!tolerantie=\v!soepel,
+ \c!afstand=1.5\korpsgrootte, % influenced by switching
+ \c!hoogte=,
+ \c!balanceren=\v!ja,
+ \c!uitlijnen=\v!tekst,
+ \c!blanko={\v!regel,\v!vast},
+ \c!optie=,
+ \c!lijndikte=\linewidth,
+ \c!offset=.5\korpsgrootte]
+
+%D Undocumented and still under development.
+
+\def\startsimplecolumns%
+ {\dosingleempty\dostartsimplecolumns}
+
+\def\dostartsimplecolumns[#1]%
+ {\bgroup
+ \getparameters[\??kl][\c!breedte=\hsize,\c!afstand=1em,\c!n=2,#1]%
+ \setrigidcolumnhsize\@@klbreedte\@@klafstand\@@kln
+ \setbox\scratchbox=\vbox\bgroup
+ \forgetall} % \blanko[\v!blokkeer]
+
+\def\stopsimplecolumns%
+ {\removebottomthings
+ \egroup
+ \rigidcolumnbalance\scratchbox
+ \egroup}
+
+\protect \endinput
diff --git a/tex/context/base/page-new.tex b/tex/context/base/page-new.tex
new file mode 100644
index 000000000..af4729922
--- /dev/null
+++ b/tex/context/base/page-new.tex
@@ -0,0 +1,199 @@
+% We need to set the \dimen globally since we are in the
+% OTR. Unfortunately this interferes with local settings,
+% although we may assume that they will not cross page
+% boundaries.
+
+\def\OTRSETcheckcontent%
+ {\bgroup
+ \donefalse
+ \def\OTRSETcheckcontent##1%
+ {\setbox\scratchbox=##1\recurselevel
+ \setbox\scratchbox=\vbox{\unvbox\scratchbox}%
+ \ifdim\ht\scratchbox>\!!zeropoint\donetrue\fi}%
+ \dorecurse{\nofcolumns}
+ {\OTRSETcheckcontent\columngettextbox
+ \OTRSETcheckcontent\columngetfootbox
+ \OTRSETcheckcontent\columngettopbox
+ \OTRSETcheckcontent\columngetbotbox}%
+ \ifdone\egroup\donefalse\else\egroup\donetrue\fi}
+
+\def\OTRSETgetcolumntextheight#1% max - boven - top
+ {\scratchdimen=\OTRSETgetparameter\c!maxhoogte#1%
+ \advance\scratchdimen -\OTRSETgetparameter\c!bovenoffset#1%
+ \advance\scratchdimen -\ht\columntopbox#1%
+\advance\scratchdimen -\getvalue{\??mc\number\mofcolumns-f}%
+ \advance\scratchdimen -\ht\columnbotbox#1} % not used
+
+\def\OTRSETgetcolumnnaturalheight#1% max - boven - top
+ {\setbox\scratchbox=\vbox{\unvcopy\columntextbox#1}%
+ \scratchdimen=\ht\scratchbox
+ \advance\scratchdimen \OTRSETgetparameter\c!bovenoffset#1%
+ \advance\scratchdimen \ht\columntopbox#1%
+\advance\scratchdimen -\getvalue{\??mc\number\mofcolumns-f}%
+ \advance\scratchdimen \ht\columnbotbox#1} % not used
+
+\def\OTRSETdobalance% splitten in met en zonder footnotes
+ {\bgroup
+ \maxdeadcycles=1000
+ % collect content and notes
+ \bgroup
+ \OTRSEToutput
+ {\global\setbox1=\vbox{\unvbox\normalpagebox}%
+ \global\setbox3=\vbox{\unvbox\footins}}%
+ \vbox{\toonstruts\strut}\vskip-\lineheight % makes footnotes flush
+ \eject
+ \global\collectingcontentfalse
+ % check for footnotes only
+ \ifdim\ht1<\topskip % real dirty
+ \global\setbox1=\vbox{}
+ % fix height of first line
+ \ifdim\ht3>\!!zeropoint
+ \global\setbox3=\vbox
+ {\setfootnotebodyfont
+ \kern-\ht\strutbox
+ \kern\topskip
+ \unvbox3}
+ \fi
+ % prepare trial box
+ \global\setbox5=\vbox
+ {\ifdim\ht1>\!!zeropoint
+ \unvcopy1 \ifdim\ht3>\!!zeropoint \kern\skip\footins \fi
+ \fi
+ \ifdim\ht3>\!!zeropoint \unvcopy3 \fi}
+ \egroup
+ % erase old stuff
+ \columnerasetextboxes
+ \columnerasefootboxes
+ % prepare floats
+ \OTRSETdotopinsertions
+ \OTRSETdobotinsertions % not used can be removed
+ % calculate available space
+ \!!heighta=\!!zeropoint % available total height
+ \dorecurse{\nofcolumns}
+ {\OTRSETgetcolumntextheight\recurselevel
+ \OTRSETcalculatelines\scratchdimen
+ \advance\!!heighta by \scratchdimen}
+ % quick check
+ \ifdim\ht5>\!!heighta
+ % use normal routine
+ \columnerasetextboxes
+ \columnerasefootboxes
+ % TEMP, TODO, FORCE NEXT PASS !
+ \unvbox1
+ \unvbox3
+ \doglobal\addtocommalist{-\realfolio}\OTRSETbalancinglist
+ \donefalse
+ %\writestatus{\m!columns}{no balancing, text overflows height}%
+ \else\ifdim\ht5>\!!zeropoint \relax
+ % some text and/or notes
+ \donetrue
+ \else
+ \donefalse
+ \dorecurse{\nofcolumns}
+ {\ifdim\ht\columntopbox\recurselevel>\!!zeropoint \donetrue \fi}%
+ \ifdone
+ % no text and notes, but figures
+ \else
+ % no text, no notes, no figures
+ \doglobal\addtocommalist{-\realfolio}\OTRSETbalancinglist
+ \writestatus{\m!columns}{no balancing, nothing to be placed}%
+ \fi
+ \fi\fi
+ \ifdone
+ \ifdim\ht5>\!!zeropoint \relax
+ % balancing text and notes
+ %\writestatus{\m!columns}{text may fit, balancing}%
+ \newcounter\loopcounter
+ \newcounter\balancinglines
+ \doloop
+ {\increment\loopcounter\relax
+ % initialize
+ \columnerasetextboxes
+ \columnerasefootboxes
+ \setbox0=\copy5
+ \splittopskip=\topskip
+ % pre-split loop and quality calculation
+ %\writestatus{\m!columns}{pass \loopcounter: correction -\balancinglines}
+ \dorecurse{\nofcolumns}
+ {\OTRSETgetcolumntextheight\recurselevel
+ \OTRSETcalculatelines\scratchdimen
+ \!!heightc=\scratchdimen
+ \ifnum\recurselevel<\nofcolumns
+ \advance\!!heightc by -\balancinglines\lineheight
+ \fi
+ \columnsettextbox\recurselevel=\vsplit0 to \!!heightc}
+ % just one method
+ \OTRSETgetcolumnnaturalheight1 \dimen4=\scratchdimen
+ \OTRSETgetcolumnnaturalheight\nofcolumns \dimen6=\scratchdimen
+ %\writestatus{\m!columns}{first column: \the\dimen4}%
+ %\writestatus{\m!columns}{last column: \the\dimen6}%
+ \ifdim\dimen4=\dimen6
+ \donetrue % perfect balance
+ \else\ifdim\dimen4>\dimen6
+ \donefalse % not yet good enough
+ \increment\balancinglines % try again
+ \edef\balancingcount{\the\!!counta}
+ \else
+ \donetrue % worse balance
+ \ifnum\balancinglines>0 % take previous
+ \decrement\balancinglines
+ \fi
+ \fi\fi
+ % extra check
+ % \ifdim\ht0>\!!zeropoint\relax \donefalse \fi
+ % another check
+ \ifdone
+ %\writestatus{\m!columns}{balancing finished in pass \loopcounter}%
+ \else \ifnum\loopcounter>100 \donetrue
+ %\writestatus{\m!columns}{balancing aborted after pass \loopcounter}%
+ \else
+ %\writestatus{\m!columns}{balancing continued after pass \loopcounter}%
+ \fi \fi
+ % final balancing pass
+ \ifdone
+ \setbox0=\copy1
+ \setbox2=\copy3
+ \columnerasetextboxes
+ \columnerasefootboxes
+ \dorecurse{\nofcolumns}
+ {\OTRSETgetcolumntextheight\recurselevel
+ \OTRSETcalculatelines\scratchdimen
+ \!!heightc=\scratchdimen
+ \ifnum\recurselevel<\nofcolumns
+ \advance\!!heightc by -\balancinglines\lineheight
+ \fi
+ % split off text
+ \ifdim\ht0>\!!zeropoint
+ \columnsettextbox\recurselevel=\vsplit0 to \!!heightc
+ \setbox4=\vbox{\unvcopy\columntextbox\recurselevel}
+ \advance\!!heightc by -\ht4
+ \ifdim\ht0>\!!zeropoint
+ \columnsettextbox\recurselevel=\box4
+ \advance\!!heightc by \skip\footins
+ \fi
+ \fi
+ % split off footnotes
+ \ifdim\ht0>\!!zeropoint\relax \else
+ \ifdim\ht2>\!!zeropoint\relax
+ \setbox4=\vsplit2 to \!!heightc
+ \setbox\footins=\vbox{\unvbox4} % ugly and dirty trick
+ \ifdim\ht\columntextbox\recurselevel=\!!zeropoint\relax
+ \columnsettextbox\recurselevel=\hbox
+ {\raise\dp\strutbox\hbox % ugly but needed
+ {\setfootnotebodyfont % both these moves
+ \lower\dp\strutbox\hbox{\placefootnotes}}}
+ \else
+ \columnsetfootbox\recurselevel=\hbox{\placefootnotes}
+ \fi
+ \fi
+ \fi}
+ \exitloop
+ \fi}
+ \else
+ % no reason to balance floats
+ \fi
+ \fi
+ \doglobal\addtocommalist{\realfolio}\OTRSETbalancinglist
+ \OTRSETdoflush
+ \fi
+ \egroup}
diff --git a/tex/context/base/page-num.tex b/tex/context/base/page-num.tex
new file mode 100644
index 000000000..96576d42c
--- /dev/null
+++ b/tex/context/base/page-num.tex
@@ -0,0 +1,494 @@
+%D \module
+%D [ file=page-num, % moved here from main-001
+%D version=1997.03.31,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Numbering,
+%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 Core Macros (Numbering)}
+
+\unprotect
+
+% \gotonextsubpage : voor de pagebody
+% \subpaginanummer : alleen in de voet/kopregels
+% \aantalsubpaginas : alleen in de voet/kopregels
+
+% \firstsubpage : eerste \realpageno, voor interne doeleinden
+% \prevsubpage : vorige \realpageno, voor interne doeleinden
+% \nextsubpage : volgende \realpageno, voor interne doeleinden
+% \lastsubpage : laatste \realpageno, voor interne doeleinden
+% \nofsubpages : laatste subpage (in berekeningen)
+% \subpageno : huidige subpage (in berekeningen)
+
+\newif\ifsubpaging
+\newif\ifshowingsubpage
+
+\definieernummer
+ [\s!subpage]
+
+\stelnummerin
+ [\s!subpage]
+ [\c!wijze=\@@snwijze]
+
+\def\resetsubpaginanummer%
+ {\resetnummer[\s!subpage]%
+ \global\subpageno=\ruwenummer[\s!subpage]}
+
+\def\dostelsubpaginanummerin[#1]%
+ {\doifelse{#1}{\v!reset}
+ {\resetsubpaginanummer} % \resetnummer[\s!subpage]
+ {\getparameters[\??sn][#1]%
+ \processaction
+ [\@@snstatus]
+ [ \v!stop=>\ifsubpaging
+ \else
+ \subpagingfalse
+ \fi
+ \showingsubpagefalse,
+ \v!start=>\subpagingtrue
+ \showingsubpagetrue,
+ \v!geen=>\subpagingtrue
+ \showingsubpagefalse]}}
+
+\def\aantalsubpaginas%
+ {\ifshowingsubpage\nofsubpages\else0\fi}
+
+\def\subpaginanummer%
+ {\ifshowingsubpage\the\subpageno\else0\fi}
+
+\def\stelsubpaginanummerin%
+ {\dosingleargument\dostelsubpaginanummerin}
+
+\def\newnofsubpages {0}
+\def\nofsubpages {0}
+\def\firstsubpage {1}
+\def\prevsubpage {1}
+\def\nextsubpage {1}
+\def\lastsubpage {1}
+
+\def\nextpage {1}
+\def\prevpage {1}
+
+\definetwopasslist{\s!subpage}
+
+\def\savenofsubpages%
+ {\ifsubpaging
+ \showmessage{\m!layouts}{6}{\newnofsubpages,\the\subpageno}%
+ \immediatewriteutilitycommand%
+ {\twopassentry%
+ {\s!subpage}%
+ {\newnofsubpages}%
+ {\the\subpageno}}%
+ \fi}
+
+\def\setsubpagenumbers%
+ {\iftwopassdatafound
+ \bgroup
+ \xdef\nofsubpages{\twopassdata}%
+ \xdef\firstsubpage{\realfolio}%
+ \advance\realpageno by \nofsubpages
+ \advance\realpageno by -1
+ \xdef\lastsubpage{\realfolio}%
+ \egroup
+ \else
+ \xdef\nofsubpages{0}%
+ \fi}
+
+\def\gotonextsubpage% overlapt behoorlijk met realpage macro
+ {\global\let\checksubpages=\relax
+ \ifsubpaging
+ \edef\oldsubpage{\the\subpageno}%
+ \verhoognummer[\s!subpage]%
+ \global\subpageno=\ruwenummer[\s!subpage]\relax
+ \ifnum\subpageno=1
+ \gettwopassdata{\s!subpage}%
+ \setsubpagenumbers
+ \ifnum\oldsubpage>0
+ \showmessage{\m!layouts}{6}{\newnofsubpages,\oldsubpage}%
+ \edef\next%
+ {\writeutilitycommand%
+ {\twopassentry%
+ {\s!subpage}%
+ {\newnofsubpages}%
+ {\oldsubpage}}}%
+ \next
+ \fi
+ \doglobal\increment\newnofsubpages\relax
+ \fi
+ \setglobalsystemreference\rt!page{\v!eerstesubpagina}\firstsubpage
+ \setglobalsystemreference\rt!page{\v!laatstesubpagina}\lastsubpage
+ \bgroup
+ \ifnum\realpageno=\firstsubpage\relax
+ \global\let\prevsubpage=\firstsubpage
+\setglobalsystemreference\rt!page{\v!sub\v!achteruit}\lastsubpage
+ \else
+ \xdef\prevsubpage{\realfolio}%
+ \doglobal\decrement\prevsubpage
+\setglobalsystemreference\rt!page{\v!sub\v!achteruit}\prevsubpage
+ \fi
+ \setglobalsystemreference\rt!page{\v!vorigesubpagina}\prevsubpage
+ \ifnum\realpageno=\lastsubpage\relax
+ \global\let\nextsubpage=\lastsubpage
+\setglobalsystemreference\rt!page{\v!sub\v!vooruit}\firstsubpage
+ \else
+ \xdef\nextsubpage{\realfolio}%
+ \doglobal\increment\nextsubpage
+\setglobalsystemreference\rt!page{\v!sub\v!vooruit}\nextsubpage
+ \fi
+ \setglobalsystemreference\rt!page{\v!volgendesubpagina}\nextsubpage
+ \egroup
+ \fi}
+
+\def\checksubpages%
+ {\getfromtwopassdata{\s!subpage}{1}%
+ \setsubpagenumbers
+ \global\let\checksubpages=\relax}
+
+% Omdat \gotonextrealpage gebruik maakt van de hulpfile,
+% moet het initialiseren van \realpageno plaatsvinden in
+% een later stadium, namelijk zodra referenties worden
+% gebruikt (anders gaat het mis op nog niet gedefinieerde
+% lijstcommando's e.d.). De eerst aanroep vindt dan ook
+% plaats vlak nadat de hulpfile voor de eerste maal is
+% ingelezen.
+
+\countdef\realpageno = 0 \realpageno = 1
+\countdef\userpageno = 1 \userpageno = 1
+\countdef\subpageno = 2 \subpageno = 0 % !!
+\countdef\arrangeno = 3 \arrangeno = 0 % !!
+
+% we don't want conflicts when \pageno is used by other
+% packages, like CWEB, so we redefine \pageno
+
+\newcount\pageno \pageno = 1
+
+\def\setuserpageno#1%
+ {\global\userpageno=#1\relax
+ \global\pageno=\userpageno}
+
+\def\realfolio {\the\realpageno}
+\def\folio {\the\userpageno}
+\def\firstpage {1}
+\def\lastpage {1}
+\def\currentpage {\the\realpageno}
+
+\def\gotonextrealpage%
+ {\global\advance\realpageno by 1
+ \ifnum\realpageno>\lastpage
+ \xdef\lastpage{\realfolio}%
+ \fi
+ \setglobalsystemreference\rt!page{\v!eerstepagina}\firstpage
+ \setglobalsystemreference\rt!page{\v!laatstepagina}\lastpage
+ \bgroup
+ \ifnum\realpageno>1
+ \advance\realpageno by -1
+ \xdef\prevpage{\realfolio}%
+ \setglobalsystemreference\rt!page{\v!achteruit}\prevpage
+ \else
+ \global\let\prevpage=\firstpage
+ \setglobalsystemreference\rt!page{\v!achteruit}\lastpage
+ \fi
+ \setglobalsystemreference\rt!page{\v!vorigepagina}\prevpage
+ \egroup
+ \bgroup
+ \ifnum\realpageno<\lastpage\relax
+ \advance\realpageno by 1
+ \xdef\nextpage{\realfolio}%
+ \setglobalsystemreference\rt!page{\v!pagina}\nextpage
+ \setglobalsystemreference\rt!page{\v!vooruit}\nextpage
+ \bgroup
+ \xdef\nextnextpage{\realfolio}%
+ \ifodd\realpageno
+ \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\nextnextpage
+ \else
+ \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\nextnextpage
+ \fi
+ \advance\realpageno by 1
+ \xdef\nextnextpage{\realfolio}%
+ \ifnum\realpageno>\lastpage\relax
+ %\ifodd\realpageno
+ % \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\lastpage
+ %\else
+ % \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\lastpage
+ %\fi
+ \else
+ \ifodd\realpageno
+ \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\nextnextpage
+ \else
+ \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\nextnextpage
+ \fi
+ \fi
+ \egroup
+ \else
+ \global\let\nextpage=\lastpage
+ \setglobalsystemreference\rt!page{\v!pagina}\firstpage
+ \setglobalsystemreference\rt!page{\v!vooruit}\firstpage
+ \setglobalsystemreference\rt!page{\v!volgendeonevenpagina}\lastpage
+ \setglobalsystemreference\rt!page{\v!volgendeevenpagina}\lastpage
+ \fi
+ \setglobalsystemreference\rt!page{\v!volgendepagina}\realfolio
+ \egroup}
+
+\def\checkrealpage%
+ {\global\realpageno=0
+ \gotonextrealpage
+ \global\let\checkrealpage=\relax}
+
+\def\savenofpages%
+ {\advance\realpageno by -1
+ \savecurrentvalue\lastpage{\realfolio}}%
+
+\def\totaalaantalpaginas%
+ {\lastpage}
+
+\def\setpagecounters%
+ {\setuserpageno{\ruwenummer[\s!page]}%
+ \doifelse{\@@snstatus}{\v!stop}
+ {\global\subpageno=0}
+ {\global\subpageno=\ruwenummer[\s!subpage]}}
+
+% Standaard is \count0 in Plain TeX de paginateller. Omwille
+% van de afhandeling van lokaal nummeren, definieren we
+% echter een eigen nummer.
+
+\definieernummer
+ [\s!page]
+ [\c!conversie=\@@nmconversie,
+ \c!wijze=\@@nmwijze,
+ \c!status=\@@nmstatus,
+ \c!start=1]
+
+% \@@pnstatus global, but \@@nmstatus local and only start/stop
+
+\global\let\@@pnstatus\@@pnstatus
+
+\def\dostelpaginanummerin[#1]%
+ {\getparameters[\??pn][\c!nummer=,#1]%
+ \global\let\@@pnstatus\@@pnstatus
+ \doifsomething{\@@pnnummer}
+ {\setnummer[\s!page]{\@@pnnummer}%
+ \setuserpageno{\ruwenummer[\s!page]}}%
+ % this makes starting at an even page possible
+ \ifnum\realpageno=1 \ifodd\pageno \else
+ \global\shiftedrealpagenotrue
+ \fi \fi}
+
+\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}}
+
+\def\checkpagecounter%
+ {\checknummer{\s!page}}
+
+% \getpagestatus
+% \ifrightpage als odd/enkelzijdig
+
+\newif\ifrightpage \rightpagetrue
+
+\newcounter \nofpagesets
+
+\definetwopasslist{\s!page}
+
+\def\dopagesetreference%
+ {\doglobal\increment\nofpagesets\relax
+ \edef\writepagref%
+ {\writeutilitycommand
+ {\twopassentry
+ {\s!page}%
+ {\nofpagesets}%
+ {\noexpand\realfolio}}}%
+ \writepagref}
+
+\def\getpagestatus% hierboven gebruiken
+ {\ifdubbelzijdig
+ \gettwopassdata{\s!page}%
+ \iftwopassdatafound \else
+ \let\twopassdata=\realpageno
+ \fi
+ \ifodd\twopassdata
+ \global\rightpagetrue
+ \else
+ \global\rightpagefalse
+ \fi
+ \dopagesetreference
+ \else
+ \global\rightpagetrue
+ \fi}
+
+\def\@@nmin {} % kan vervallen (upward compatibility)
+\def\@@nmplaats {} % mag {plaats, in} zijn
+
+\newcounter\@@pagenumberlocation
+
+\def\do@@plaatspaginanummer#1%
+ {\ifnum#1=\@@pagenumberlocation\@@plaatspaginanummer\fi}
+
+\def\dodosetpagenumberlocation#1% tricky because of ...texts
+ {\increment\@@pagenumberlocation
+ \ifx\@@nmplaats\empty\else
+ \def\dododosetpagenumberlocation##1%
+ {\donetrue
+ \setevalue{\??tk#1##1}%
+ {\noexpand\do@@plaatspaginanummer{\@@pagenumberlocation}}}%
+ \donefalse
+ \ExpandFirstAfter\processallactionsinset
+ [\@@nmplaats]
+ [ \v!midden=>\dododosetpagenumberlocation{\v!tekst\c!middentekst},
+ \v!links=>\dododosetpagenumberlocation{\v!tekst\c!linkertekst},
+ \v!rechts=>\dododosetpagenumberlocation{\v!tekst\c!rechtertekst},
+ \v!inlinker=>\dododosetpagenumberlocation{\v!marge\c!linkertekst},
+ \v!inrechter=>\dododosetpagenumberlocation{\v!marge\c!rechtertekst},
+ \v!inmarge=>\dododosetpagenumberlocation{\v!marge\ifdubbelzijdig
+ \c!margetekst\else\c!rechtertekst\fi},
+ \v!marge=>\dododosetpagenumberlocation{\v!marge\ifdubbelzijdig
+ \c!margetekst\else\c!rechtertekst\fi},
+ \v!opmarge=>\dododosetpagenumberlocation{\v!tekst\c!kantlijntekst},
+ \v!kantlijn=>\dododosetpagenumberlocation{\v!tekst\c!kantlijntekst}]%
+ \ifdone \else
+ \dododosetpagenumberlocation{\v!tekst\c!middentekst}% default
+ \fi
+ \fi}
+
+\def\dosetpagenumberlocation%
+ {\ExpandBothAfter\doifinsetelse{\v!hoofd}{\@@nmplaats,\@@nmin}
+ {\dodosetpagenumberlocation\v!hoofd}
+ {\dodosetpagenumberlocation\v!voet}}
+
+\def\dostelnummeringin[#1]%
+ {\getparameters[\??nm][#1]%
+ \preparepaginaprefix{\??nm}%
+ \enkelzijdigfalse
+ \dubbelzijdigfalse
+ \ExpandFirstAfter\processallactionsinset
+ [\@@nmvariant]
+ [ \v!enkelzijdig=>\enkelzijdigtrue,
+ \v!dubbelzijdig=>\dubbelzijdigtrue]%
+ \ifdubbelzijdig
+ \trackingmarginnotestrue
+ \else
+ \trackingmarginnotesfalse
+ \fi
+ \dosetpagenumberlocation
+ \recalculatebackgrounds
+ \recalculatelogos}
+
+\def\stelnummeringin%
+ {\dosingleempty\dostelnummeringin}
+
+% listig: hangt af van \@@kolijst
+
+% erg fout
+%
+% \def\preparepaginaprefix#1%
+% {\def\dopreparepaginaprefix##1%
+% {\doifvalue{#1##1\c!nummer}{\v!ja}
+% {\setvalue{#1\getvalue{\??by##1}\c!nummer}{\v!ja}}}%
+% \processcommacommand[\@@kolijst]\dopreparepaginaprefix}
+%
+% nog fouter
+%
+% \def\preparepaginaprefix#1%
+% {\def\dopreparepaginaprefix##1%
+% {\doifelsevalue{#1##1\v!nummer}{\v!ja} % v
+% {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!ja}} % v
+% {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!nee}}}% % v
+% \processcommacommand[\@@kolijst]\dopreparepaginaprefix}
+%
+% best, beware, chapter (yes) can be followed by title (no)
+
+\def\preparepaginaprefix#1%
+ {\def\dopreparepaginaprefix##1%
+ {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!nee}}% %v
+ \processcommacommand[\@@kolijst]\dopreparepaginaprefix
+ \def\dopreparepaginaprefix##1%
+ {\doifvalue{#1##1\v!nummer}{\v!ja} %v
+ {\setvalue{#1\getvalue{\??by##1}\v!nummer}{\v!ja}}}%
+ \processcommacommand[\@@kolijst]\dopreparepaginaprefix}
+
+\def\dopaginaprefix#1#2%
+ {\let\normaluchar\uchar\let\uchar\relax % ugly but needed
+ \doifelsevalue{#1#2\v!nummer}{\v!ja} % \v! and no \c!
+ {\@EA\beforesplitstring\@EA{\postprefix}\at:\to\preprefix
+ \@EA\aftersplitstring\@EA{\postprefix}\at:\to\postprefix
+ \let\uchar\normaluchar % ugly but needed
+ \doifsomething{\preprefix}
+ {\doifnot{\preprefix}{0}{\preprefix\@@nmnummerscheider}}}%
+ {\@EA\aftersplitstring\@EA{\postprefix}\at:\to\postprefix
+ \let\uchar\normaluchar}} % ugly but needed
+
+\def\paginaprefix#1[#2::#3::#4]% kan wat sneller ####1:0:
+ {\bgroup
+ \edef\postprefix{#3}%
+ \def\donexttrackcommando##1%
+ {\dopaginaprefix{#1}{##1}%
+ \donexttracklevel{##1}}%
+ \donexttrackcommando\firstsection
+ \egroup}
+
+\unexpanded\def\@@plaatspaginanummer% called in empty tests
+ %{\doif{\@@pnstatus}{\v!start}
+ {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start}
+ {{\@@nmcommando{\doattributes\??nm\c!letter\c!kleur{\volledigepaginanummer}}}}}
+
+\def\@@plaatspaginascheider% still used ?
+ %{\doif{\@@pnstatus}{\v!start}%
+ {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start}
+ {\@@nmtekstscheider}}
+
+\def\userfolio% naast realfolio
+ {\nummer[\s!page]}
+
+\def\pagenumber%
+ {\userfolio}
+
+\def\pageprefixes%
+ {\def\donexttrackcommando##1%
+ {\doifvalue{\??nm##1\v!nummer}{\v!ja} % v
+ {\ifnum\countervalue{\??se##1}>0\relax
+ \getvalue{##1\c!nummer}\@@nmnummerscheider
+ \fi}%
+ \doifsomething{\@@nmtekst}
+ {\@@nmtekst\@@nmnummerscheider}%
+ \donexttracklevel{##1}}%
+ \donexttrackcommando{\firstsection}}
+
+\unexpanded\def\volledigepaginanummer%
+ {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start}
+ {\@@nmlinks\labeltexts{\v!paginanummer}{\pageprefixes\pagenumber}\@@nmrechts}}
+
+\unexpanded\def\plaatspaginanummer%
+ {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start}
+ {\labeltexts{\v!paginanummer}{\pagenumber}}}
+
+\def\translatednumber[#1::#2::#3]%
+ {#3}
+
+\unexpanded\def\referencepagenumber[#1]%
+ {\doifelsenothing{#1}{?}{\paginaprefix\??rf[#1]\translatednumber[#1]}}
+
+\stelpaginanummerin
+ [\c!status=\v!start,
+ \c!nummer=1]
+
+\stelsubpaginanummerin
+ [\c!wijze=\v!per\v!deel,
+ \c!status=\v!stop]
+
+\protect \endinput
diff --git a/tex/context/base/page-one.tex b/tex/context/base/page-one.tex
new file mode 100644
index 000000000..58e552a51
--- /dev/null
+++ b/tex/context/base/page-one.tex
@@ -0,0 +1,413 @@
+%D \module
+%D [ file=page-one,
+%D version=2000.10.20,
+%D title=\CONTEXT\ OTR Macros,
+%D subtitle=Default Routine,
+%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 OTR Macros / Default Routine}
+
+%D This is just the good old \CONTEXT\ output routine, which
+%D has been there right from the start.
+
+\unprotect
+
+% OTRONE: basic single column
+
+\activateotr{ONE}{} % the default one
+
+\newtoks\OTRONEoutput
+
+\def\OTRONEsethsize%
+ {\global\hsize=\tekstbreedte}
+
+\def\OTRONEsetvsize%
+ {\ifdim\vsize=\teksthoogte \else
+ \bgroup
+ \scratchdimen=-\vsize
+ \advance\scratchdimen by \teksthoogte
+ \global\advance\vsize by \scratchdimen
+ \ifdim\pagegoal<\maxdimen
+ \advance\scratchdimen by \pagegoal
+ \global\pagegoal=\scratchdimen
+ \fi
+ \egroup
+ \fi}
+
+\def\OTRONEdopagecontents#1#2% \box<n> \unvbox<n>
+ {\bgroup % niet breedte zetten, kan fractie zijn!
+ \setbox0=\vbox \ifbottomnotes to \teksthoogte \fi
+ {\edef\currentpagedepth{\the\dp#2}% still to be derived from #1
+ \dotopinsertions
+ #1#2%
+ \pushcolor
+ \ifgridsnapping
+ \vskip-\currentpagedepth
+ \vskip\openstrutdepth % \dp\strutbox
+ \prevdepth\openstrutdepth % \dp\strutbox
+ \dobotinsertions
+ \vfil
+ \else\ifr@ggedbottom
+ \vskip-\currentpagedepth
+ \vskip\openstrutdepth % \dp\strutbox
+ \prevdepth\openstrutdepth % \dp\strutbox
+ \dobotinsertions
+ \vfil
+ \else\ifb@selinebottom
+ \kern-\currentpagedepth
+ \kern\maxdepth
+ \dobotinsertions
+ \fi\fi\fi
+ \ifdim\ht\footins>\!!zeropoint % beter dan \ifvoid\footins\else
+ \kern\skip\footins
+ \kern\ht\footins
+ \fi}%
+ \ifbottomnotes
+ \ifgridsnapping
+ \getnoflines\teksthoogte
+ \advance\noflines by -1
+ \scratchdimen=\noflines\lineheight
+ \advance\scratchdimen by \topskip
+ \else
+ \scratchdimen=\ht0
+ \fi
+ \else
+ \scratchdimen=\!!zeropoint
+ \fi
+ \setbox2=\hbox
+ {\ifvoid\savedfootins \else
+ \setbox\footins=\box\savedfootins
+ \fi
+ \lower\scratchdimen\vbox{\placefootnotes}}%
+ \smashbox2% % needed here
+ \ifbottomnotes
+ \ht0=\!!zeropoint
+ \fi
+ \vbox to \teksthoogte
+ {\box0\box2\ifbottomnotes\else\vfill\fi}%
+ \egroup}
+
+\def\OTRONEfinalsidefloatoutput%
+ {\finaloutput\unvbox\normalpagebox}
+
+\def\OTRONEsetfootnotehsize%
+ {\hsize\@@vnbreedte}
+
+\OTRONEoutput%
+ {\sidefloatoutput}
+
+%D Insertions
+
+\newif\iftopofinsert
+
+\def\OTRONEdosettopinserts%
+ {\bgroup
+ \ifsomefloatwaiting
+ \noffloatinserts=0
+ \let\totaltopinserted=\!!zeropoint
+ \OTRONEdodosettopinserts
+ \ifnum\@@bknonder=0
+ \ifnum\@@bknregels>0
+ \ifdim\totaltopinserted>\!!zeropoint\relax
+ \dimen0=\lineheight
+ \dimen0=\@@bknregels\dimen0
+ \advance\dimen0 by \totaltopinserted\relax
+ \ifdim\dimen0>\teksthoogte
+ \showmessage{\m!floatblocks}{8}{\@@bknregels}%
+ \vfilll\eject
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \egroup}
+
+\def\OTRONEdodosettopinserts%
+ {\ifnum\noffloatinserts<\noftopfloats
+ \dogetfloat
+ \ifdim\topinserted=\!!zeropoint\relax
+ \topofinserttrue
+ \else
+ \topofinsertfalse
+ \fi
+ \global\advance\topinserted by \ht\floatbox
+ \global\advance\topinserted by \dp\floatbox
+ \global\advance\topinserted by \floatbottomskip\relax
+ \ifdim\topinserted<\teksthoogte\relax
+ \xdef\totaltopinserted{\the\topinserted}%
+ \insert\topins
+ {\forgetall
+ \iftopofinsert
+ \kern-\lineskip\par\prevdepth=\maxdimen
+ \else
+ %\blanko[-\@@bknawit,\@@bkvoorwit]% inserts can't look back
+ \betweenfloatblanko
+ \fi
+ \flushfloatbox
+ \blanko[\@@bknawit]}%
+ \ifsomefloatwaiting
+ \advance\noffloatinserts by 1
+ \else
+ \noffloatinserts=\noftopfloats\relax
+ \fi
+ \dofloatflushedinfo
+ \else
+ \doresavefloat
+ \noffloatinserts=\noftopfloats\relax
+ \fi
+ \else
+ \ifsomefloatwaiting
+ \showmessage{\m!floatblocks}{6}{\the\noftopfloats}%
+ \fi
+ \let\OTRONEdodosettopinserts=\relax
+ \fi
+ \OTRONEdodosettopinserts}
+
+\def\OTRONEdosetbotinserts%
+ {\bgroup
+ \ifsomefloatwaiting
+ \noffloatinserts=0
+ \OTRONEdodosetbotinserts
+ \fi
+ \egroup}
+
+\def\OTRONEdodosetbotinserts%
+ {\ifnum\noffloatinserts<\nofbotfloats\relax
+ \dogetfloat
+ \global\advance\botinserted by \ht\floatbox\relax
+ \global\advance\botinserted by \dp\floatbox\relax
+ \global\advance\botinserted by \floattopskip\relax
+ \ifdim\botinserted<\pagegoal\relax
+ \insert\botins
+ {\forgetall
+ \blanko[\@@bkvoorwit]%
+ \flushfloatbox}%
+ \ifsomefloatwaiting
+ \advance\noffloatinserts by 1
+ \else
+ \noffloatinserts=\nofbotfloats
+ \fi
+ \dofloatflushedinfo
+ \else
+ \doresavefloat
+ \noffloatinserts=\nofbotfloats\relax
+ \fi
+ \global\nofloatpermittedtrue % vgl topfloats s!
+ \else
+ \ifsomefloatwaiting
+ \showmessage{\m!floatblocks}{7}{\the\nofbotfloats}%
+ \fi
+ \let\OTRONEdodosetbotinserts=\relax
+ \fi
+ \OTRONEdodosetbotinserts}
+
+\def\OTRONEdosetbothinserts%
+ {\ifflushingfloats
+ \global\topinserted=\!!zeropoint
+ \global\botinserted=\!!zeropoint
+ \else
+ \global\topinserted=\!!zeropoint \OTRONEdosettopinserts
+ \global\botinserted=\!!zeropoint \OTRONEdosetbotinserts
+ \fi}
+
+\def\OTRONEdotopinsertions%
+ {\ifvoid\topins\else
+ \ifgridsnapping
+ %\topsnaptogrid{\box\topins}
+ \box\topins % already snapped
+ \else
+ \unvbox\topins
+ \fi
+ \fi
+ \global\topinserted=\!!zeropoint\relax}
+
+\def\OTRONEdobotinsertions%
+ {\ifvoid\botins\else
+ \ifgridsnapping
+ \snaptogrid\hbox{\box\botins}
+ \else
+ \unvbox\botins
+ \fi
+ \fi
+ \global\botinserted=\!!zeropoint\relax
+ \global\nofloatpermittedfalse}
+
+\def\OTRONEdoflushfloats%
+ {\global\flushingfloatstrue
+ \ifsomefloatwaiting
+ \par
+ \ifvmode\prevdepth=\maxdimen\fi % prevents whitespace
+ \OTRONEdodoflushfloats
+ \fi
+ \global\savednoffloats=0
+ \global\somefloatwaitingfalse
+ \global\flushingfloatsfalse}
+
+\def\OTRONEflushfloatbox% nog verder doorvoeren en meer info in marge
+ {\ifcenterfloatbox \ifdim\wd\floatbox<\hsize
+ \setbox\floatbox=\hbox to \hsize{\hss\box\floatbox\hss}%
+ \fi \fi
+ \snaptogrid\hbox{\iftestfloatbox\ruledhbox\fi{\copy\floatbox}}}
+
+% \def\OTRONEdodoflushfloats% moet nog beter: als precies passend, niet onder baseline
+% {\ifsomefloatwaiting
+% \bgroup % \box\floatbox can be in use!
+% \dogetfloat
+% \doplacefloatbox
+% \egroup
+% \dofloatflushedinfo
+% \expandafter\OTRONEdodoflushfloats
+% \fi}
+
+\def\OTRONEdodoflushfloats% much in common with OTRSET
+ {\ifsomefloatwaiting
+ \ifpackflushedfloats
+ \centerfloatboxfalse
+ \dogetfloat
+ \ifdim\wd\floatbox>\zetbreedte
+ \global\setbox\floatbox=\hbox to \zetbreedte{\hss\box\floatbox\hss}%
+ \fi
+ \OTRONEsetvsize
+ \!!widtha=\wd\floatbox
+ \dofloatflushedinfo
+ \doloop
+ {\ifsomefloatwaiting
+ \dosavefloatstatus
+ \dogetfloat
+ \advance\!!widtha by 1em % variable
+ \advance\!!widtha by \wd\floatbox\relax
+ \ifdim\!!widtha>\hsize
+ \dorestorefloatstatus
+ \global\somefloatwaitingtrue
+ \exitloop
+ \else
+ \global\setbox\floatbox=\hbox
+ {\ifcase\columndirection % nog document wide
+ \ifvoid\savedfloatbox\else
+ \ifhbox\savedfloatbox\unhbox\else\box\fi\savedfloatbox\hfil
+ \fi
+ \ifhbox\floatbox\unhbox\else\box\fi\floatbox
+ \else
+ \ifhbox\floatbox\unhbox\else\box\fi\floatbox
+ \ifvoid\savedfloatbox\else
+ \hfil\ifhbox\savedfloatbox\unhbox\else\box\fi\savedfloatbox
+ \fi
+ \fi}%
+ \dofloatflushedinfo
+ \fi
+ \else
+ \exitloop
+ \fi}%
+ \global\setbox\floatbox\hbox to \hsize
+ {\hfil\ifhbox\floatbox\unhbox\else\box\fi\floatbox\hfil}%
+ \else
+ %\bgroup % \box\floatbox can be in use!? messy
+ \dogetfloat
+ %\doplacefloatbox
+ %\egroup
+ \dofloatflushedinfo
+ \fi
+ \doplacefloatbox
+ \expandafter\OTRONEdodoflushfloats
+ \fi}
+
+\def\OTRONEdocheckiffloatfits% vervangen ivm downward comp
+ {\ifnofloatpermitted
+ \global\roomforfloatfalse
+ \else
+ \dimen0=\pagetotal
+ \advance\dimen0 by \ht\floatbox
+ \advance\dimen0 by \dp\floatbox
+ \advance\dimen0 by \floattopskip
+ \advance\dimen0 by -\pageshrink % toegevoegd
+%\message{c:\the\mofcolumns,t:\the\pagetotal,g:\the\pagegoal}%\wait
+ \ifdim\dimen0>\pagegoal
+ \global\roomforfloatfalse
+ \else
+ \global\roomforfloattrue
+ \fi
+ \fi}
+
+\def\OTRONEsomeherefloat[#1]% spacing between two successive must be better
+ {\baselinecorrection
+ \doplacefloatbox
+ \doinsertfloatinfo
+ \doif{\@@bkspringvolgendein}{\v!nee}{\noindentation}} % new
+
+\def\OTRONEsomefixdfloat[#1]%
+ {\docheckiffloatfits
+ \ifroomforfloat\else
+ \goodbreak
+ \fi
+ \showmessage{\m!floatblocks}{9}{}%
+ \someherefloat}
+
+\def\OTRONEsomesidefloat[#1]% links, rechts NOG TESTEN EN AANPASSEN
+ {\ifbinnenkolommen
+ \someelsefloat[\v!hier]%
+ \else
+ \checkwaitingfloats{#1}%
+ \def\logsidefloat%
+ {\doinsertfloatinfo}%
+ \setbox\floatbox=\vbox{\box\floatbox}%
+ \wd\floatbox=\floatwidth
+ \processfirstactioninset
+ [#1]
+ [ \v!links=>\leftfloat{\box\floatbox},
+ \v!rechts=>\rightfloat{\box\floatbox},
+ \v!inlinker=>\leftmarginfloat{\box\floatbox},
+ \v!inrechter=>\rightmarginfloat{\box\floatbox},
+ \v!inmarge=>{\doinmargenormal\leftmarginfloat
+ \rightmarginfloat{\box\floatbox}}]%
+ \doifinset{\v!lang}{#1}
+ {\flushsidefloatsafterpar}%
+ \fi}
+
+\def\OTRONEsomepagefloat[#1]% links, rechts, midden, hoog, midden, laag
+ {\checkwaitingfloats{#1}%
+ \vbox to \teksthoogte
+ {\doifnotinset{\v!hoog}{#1}{\vfill}%
+ \box\floatbox
+ \doifnotinset{\v!laag}{#1}{\vfill}}%
+ \doinsertfloatinfo
+ \pagina} % toegevoegd
+
+\def\OTRONEsometopsfloat[#1]%
+ {\ifdim\topinserted=\!!zeropoint\relax
+ \topofinserttrue
+ \else
+ \topofinsertfalse
+ \fi
+ \global\advance\topinserted by \ht\floatbox
+ \global\advance\topinserted by \dp\floatbox
+ \global\advance\topinserted by \floatbottomskip
+ \insert\topins
+ {\forgetall
+ \iftopofinsert
+ \kern-\lineskip\par\prevdepth=\maxdimen
+ \else
+ %\blanko[-\@@bknawit,\@@bkvoorwit]% inserts can't look back
+ \betweenfloatblanko
+ \fi
+ \flushfloatbox
+ \blanko[\@@bknawit]}%
+ \doinsertfloatinfo}
+
+\def\OTRONEsomebotsfloat[#1]%
+ {\global\advance\botinserted by \ht\floatbox
+ \global\advance\botinserted by \dp\floatbox
+ \global\advance\botinserted by \floattopskip
+ \insert\botins
+ {\forgetall
+ \blanko[\@@bkvoorwit]%
+ \flushfloatbox}%
+ %\global\nofloatpermittedtrue
+ \doinsertfloatinfo}
+
+\protect \endinput
diff --git a/tex/context/base/page-run.tex b/tex/context/base/page-run.tex
new file mode 100644
index 000000000..4301f460c
--- /dev/null
+++ b/tex/context/base/page-run.tex
@@ -0,0 +1,374 @@
+%D \module
+%D [ file=page-run,
+%D version=2000.10.20,
+%D title=\CONTEXT\ Page Macros,
+%D subtitle=Runtime Macros,
+%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 / Runtime Macros}
+
+\unprotect
+
+\gdef\doshowprint[#1][#2][#3]%
+ {\framed
+ [\c!offset=\v!overlay,
+ \c!strut=\v!nee]
+ {\forgetall
+ \mindermeldingen
+ \globaldefs=-1
+ \dimen0=\pagegoal
+ \definepapersize[X][\c!breedte=4em, \c!hoogte=6em]%
+ \definepapersize[Y][\c!breedte=12em,\c!hoogte=14em]%
+ \setuppapersize[#1,X][#2,Y]%
+ \stellayoutin[#3]%
+ \setbox0=\vbox
+ {\framed
+ [\c!offset=\v!overlay,\c!strut=\v!nee,
+ \c!breedte=\papierbreedte,\c!hoogte=\papierhoogte]
+ {\ss ABC\par DEF}}%
+ \dubbelzijdigfalse
+ \def\cutmarklength{.5em}%
+ \addpagecutmarks0%
+ \replicatepagebox0%
+ \scalepagebox0%
+ \mirrorpaperbox0%
+ \rotatepaperbox0%
+ \centerpagebox0%
+ \mirrorprintbox0%
+ \rotateprintbox0%
+ \offsetprintbox0%
+ \pagegoal=\dimen0
+ \box0}}
+
+\gdef\showprint%
+ {\dotripleempty\doshowprint}
+
+% \switchnaarkorps[8pt]
+%
+% \startcombinatie[4*4]
+% {\toonprint} {\strut}
+% {\toonprint[][][plaats=midden]} {\type{plaats=midden}}
+% {\toonprint[][][plaats=midden,markering=aan]} {\type{markering=aan}\break
+% \type{plaats=midden}}
+% {\toonprint[][][plaats=midden,markering=aan,nx=2]} {\type{markering=aan}\break
+% \type{plaats=midden}\break
+% \type{nx=2}}
+% {\toonprint[][][plaats=links]} {\type{plaats=links}}
+% {\toonprint[][][plaats=rechts]} {\type{plaats=rechts}}
+% {\toonprint[][][plaats={links,onder}]} {\type{plaats={links,onder}}}
+% {\toonprint[][][plaats={rechts,onder}]} {\type{plaats={rechts,onder}}}
+% {\toonprint[][][nx=2,ny=1]} {\type{nx=2,ny=1}}
+% {\toonprint[][][nx=1,ny=2]} {\type{nx=1,ny=2}}
+% {\toonprint[][][nx=2,ny=2]} {\type{nx=2,ny=2}}
+% {\toonprint[][][nx=2,ny=2,plaats=midden]} {\type{nx=2,ny=2}\break
+% \type{plaats=midden}}
+% {\toonprint[][][rugoffset=3pt]} {\type{rugoffset=.5cm}}
+% {\toonprint[][][kopoffset=3pt]} {\type{kopoffset=.5cm}}
+% {\toonprint[][][schaal=1.5]} {\type{schaal=1.5}}
+% {\toonprint[][][schaal=0.8]} {\type{schaal=0.8}}
+% \stopcombinatie
+%
+% \startcombinatie[3*4]
+% {\toonprint[liggend][][plaats=midden]} {\type{liggend}}
+% {\toonprint[][liggend][plaats=midden]} {\strut\break\type{liggend}}
+% {\toonprint[liggend][liggend][plaats=midden]} {\type{liggend}\break\type{liggend}}
+% {\toonprint[90][][plaats=midden]} {\type{90}}
+% {\toonprint[][90][plaats=midden]} {\strut\break\type{90}}
+% {\toonprint[90][90][plaats=midden]} {\type{90}\break\type{90}}
+% {\toonprint[180][][plaats=midden]} {\type{180}}
+% {\toonprint[][180][plaats=midden]} {\strut\break\type{180}}
+% {\toonprint[180][180][plaats=midden]} {\type{180}\break\type{180}}
+% {\toonprint[gespiegeld][][plaats=midden]} {\type{gespiegeld}}
+% {\toonprint[][gespiegeld][plaats=midden]} {\strut\break\type{gespiegeld}}
+% {\toonprint[gespiegeld][gespiegeld][plaats=midden]} {\type{gespiegeld}\break\type{gespiegeld}}
+% \stopcombinatie
+
+\gdef\doshowframe[#1][#2]%
+ {\ifsecondargument
+ \setupbackgrounds
+ [#1][#2]
+ [\c!achtergrond=,
+ \c!kader=\v!aan,
+ \c!hoek=\v!recht,
+ \c!kaderoffset=\!!zeropoint,
+ \c!kaderdiepte=\!!zeropoint,
+ \c!kaderkleur=]
+ \else\iffirstargument
+ \showframe
+ [\v!hoofd,\v!tekst,\v!voet]
+ [#1]
+ \else
+ \showframe
+ [\v!hoofd,\v!tekst,\v!voet]
+ [\v!linkerrand,\v!linkermarge,
+ \v!tekst,
+ \v!rechtermarge,\v!rechterrand]
+ \fi\fi
+ \setupbackgrounds
+ [\c!status=\v!herhaal]}
+
+\gdef\showframe{\dodoubleempty\doshowframe}
+
+\gdef\showsetupA#1#2%
+ {#1&\PtToCm{\the#2}&\the#2&\tttf\string#2\cr}
+
+\gdef\showsetupB#1#2#3%
+ {#1&&#2#3&\tttf\string#3\cr}
+
+\iffixedlayoutdimensions
+
+ \global\let\showsetupC=\showsetupA
+
+\else % we could have used \@the
+
+ \gdef\showsetupC#1#2% \relax is really needed here !
+ {#1&\scratchdimen=#2\PtToCm{\the\scratchdimen}&%
+ \scratchdimen=#2\relax\the\scratchdimen&\tttf\string#2\cr}
+
+\fi
+
+\startinterface dutch
+
+\gdef\showsetups%
+ {\noindent
+ \vbox
+ {\forgetall
+ \mindermeldingen
+ \switchtobodyfont[\v!klein]
+ \tabskip\!!zeropoint
+ \halign
+ {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
+ \showsetupA{papierhoogte} \papierhoogte
+ \showsetupA{papierbreedte} \papierbreedte
+ \showsetupA{printpapierhoogte} \printpapierhoogte
+ \showsetupA{printpapierbreedte} \printpapierbreedte
+ \showsetupA{kopwit} \kopwit
+ \showsetupA{rugwit} \rugwit
+ \showsetupA{hoogte} \zethoogte
+ \showsetupA{breedte} \zetbreedte
+ \showsetupA{boven} \bovenhoogte
+ \showsetupC{bovenafstand} \bovenafstand
+ \showsetupA{hoofd} \hoofdhoogte
+ \showsetupC{hoofdafstand} \hoofdafstand
+ \showsetupA{teksthoogte} \teksthoogte
+ \showsetupC{voetafstand} \voetafstand
+ \showsetupA{voet} \voethoogte
+ \showsetupC{onderafstand} \onderafstand
+ \showsetupA{onder} \onderhoogte
+ \showsetupA{linkerrand} \linkerrandbreedte
+ \showsetupC{linkerrandafstand} \linkerrandafstand
+ \showsetupA{linkermarge} \linkermargebreedte
+ \showsetupC{linkermargeafstand} \linkermargeafstand
+ \showsetupA{tekstbreedte} \tekstbreedte
+ \showsetupC{rechtermargeafstand}\rechtermargeafstand
+ \showsetupA{rechtermarge} \rechtermargebreedte
+ \showsetupC{rechterrandafstand} \rechterrandafstand
+ \showsetupA{rechterrand} \rechterrandbreedte
+ \showsetupB{korps} \the \globalbodyfontsize
+ \showsetupB{regel} \relax \normallineheight
+ \showsetupB{hoogte} \relax \strutheightfactor
+ \showsetupB{diepte} \relax \strutdepthfactor
+ \showsetupB{boven} \relax \topskipfactor
+ \showsetupB{onder} \relax \maxdepthfactor}}}
+
+\stopinterface
+
+\startinterface german
+
+\gdef\showsetups%
+ {\noindent
+ \vbox
+ {\forgetall
+ \mindermeldingen
+ \switchtobodyfont[\v!klein]
+ \tabskip\!!zeropoint
+ \halign
+ {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
+ \showsetupA{papierhoehe} \papierhoehe
+ \showsetupA{papierbreite} \papierbreite
+ \showsetupA{printpapierhoehe} \printpapierhoehe
+ \showsetupA{printpapierbreite} \printpapierbreite
+ \showsetupA{kopfweite} \kopfweite
+ \showsetupA{rumpfweite} \rumpfweite
+ \showsetupA{hoehe} \satzhoehe
+ \showsetupA{breite} \satzbreite
+ \showsetupA{oben} \hoeheoben
+ \showsetupC{abstandoben} \abstandoben
+ \showsetupA{kopfzeile} \kopfzeilenhoehe
+ \showsetupC{kopfzeilenabstand} \kopfzeilenabstand
+ \showsetupA{texthoehe} \texthoehe
+ \showsetupC{fusszeileabstand} \fusszeileabstand
+ \showsetupA{fusszeilen} \fusszeilenhoehe
+ \showsetupC{abstandunten} \abstandunten
+ \showsetupA{hoeheunten} \hoeheunten
+ \showsetupA{linkerrand} \breitelinkerrand
+ \showsetupC{abstandlinkerrand} \abstandlinkerrand
+ \showsetupA{linkemarginal} \linkemarginalbreite
+ \showsetupC{linkemarginalafstand} \linkemarginalafstand
+ \showsetupA{textbreite} \textbreite
+ \showsetupC{rechtemarginalafstand}\rechtemarginalafstand
+ \showsetupA{rechtemarginal} \rechtemarginalbreite
+ \showsetupC{abstandrechterrand} \abstandrechterrand
+ \showsetupA{rechterrand} \breiterechterrand
+ \showsetupB{fliesstext} \the \globalbodyfontsize
+ \showsetupB{linie} \relax \normallineheight
+ \showsetupB{hoehe} \relax \strutheightfactor
+ \showsetupB{tiefe} \relax \strutdepthfactor
+ \showsetupB{topskip} \relax \topskipfactor
+ \showsetupB{maxdepth} \relax \maxdepthfactor}}}
+
+\stopinterface
+
+\startinterface czech
+
+\gdef\showsetups%
+ {\noindent
+ \vbox
+ {\forgetall
+ \mindermeldingen
+ \switchtobodyfont[\v!klein]
+ \tabskip\!!zeropoint
+ \halign
+ {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
+ \showsetupA{vyskapapiru} \vyskapapiru
+ \showsetupA{sirkapapiru} \sirkapapiru
+ \showsetupA{vyskatiskpapiru} \vyskatiskpapiru
+ \showsetupA{sirkatiskpapiru} \sirkatiskpapiru
+ \showsetupA{hornimezera} \hornimezera
+ \showsetupA{spodnimezera} \spodnimezera
+ \showsetupA{vyska} \vyskasazby
+ \showsetupA{breite} \sirkasazby
+ \showsetupA{vyskatextu} \vyskatextu
+ \showsetupA{sirkatextu} \sirkatextu
+ \showsetupA{horejsek} \vyskahorejsku
+ \showsetupC{vzdalenosthorejsku} \vzdalenosthorejsku
+ \showsetupA{zahlavi} \vyskazahlavi
+ \showsetupC{vzdalenostzahlavi} \vzdalenostzahlavi
+ \showsetupC{fusszeileabstand} \vzdalenostupati
+ \showsetupA{upati} \vyskaupati
+ \showsetupC{vzdalenostspodku} \vzdalenostspodku
+ \showsetupA{spodek} \vyakaspodku
+ \showsetupA{levyokraj} \sirkalevehookraje
+ \showsetupC{vzdalenostlevehookraje} \vzdalenostlevehookraje
+ \showsetupA{levamarginalie} \sirkalevemarginalie
+ \showsetupC{vzdalenostlevemarginalie} \vzdalenostlevemarginalie
+ \showsetupC{vzdalenostpravemarginalie}\vzdalenostpravemarginalie
+ \showsetupA{pravamarginalie} \sirkapravemarginalie
+ \showsetupC{vzdalenostpravehookraje} \vzdalenostpravehookraje
+ \showsetupA{pravyokraj} \sirkapravehookraje
+ \showsetupB{zakladnivelikost} \the \globalbodyfontsize
+ \showsetupB{linka} \relax \normallineheight
+ \showsetupB{vyska} \relax \strutheightfactor
+ \showsetupB{hloubka} \relax \strutdepthfactor
+ \showsetupB{topskip} \relax \topskipfactor
+ \showsetupB{maxdepth} \relax \maxdepthfactor}}}
+
+\stopinterface
+
+\startinterface romanian
+
+\gdef\showsetups%
+ {\noindent
+ \vbox
+ {\forgetall
+ \mindermeldingen
+ \switchtobodyfont[\v!klein]
+ \tabskip\!!zeropoint
+ \halign
+ {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
+ \showsetupA{paperheight} \paperheight
+ \showsetupA{paperwidth} \paperwidth
+ \showsetupA{printpaperheight} \printpaperheight
+ \showsetupA{printpaperwidth} \printpaperwidth
+ \showsetupA{topspace} \topspace
+ \showsetupA{backspace} \backspace
+ \showsetupA{height} \makeupheight
+ \showsetupA{width} \makeupwidth
+ \showsetupA{top} \topheight
+ \showsetupC{topdistance} \topdistance
+ \showsetupA{header} \headerheight
+ \showsetupC{headerdistance} \headerdistance
+ \showsetupA{textheight} \textheight
+ \showsetupC{footerdistance} \footerdistance
+ \showsetupA{footer} \footerheight
+ \showsetupC{bottomdistance} \bottomdistance
+ \showsetupA{bottom} \bottomheight
+ \showsetupA{leftedge} \leftedgewidth
+ \showsetupC{leftedgedistance} \leftedgedistance
+ \showsetupA{leftmargin} \leftmarginwidth
+ \showsetupC{leftmargindistance} \leftmargindistance
+ \showsetupA{textwidth} \textwidth
+ \showsetupC{rightmargindistance}\rightmargindistance
+ \showsetupA{rightmargin} \rightmarginwidth
+ \showsetupC{rightedgedistance} \rightedgedistance
+ \showsetupA{rightedge} \rightedgewidth
+ \showsetupB{bodyfontsize} \the \globalbodyfontsize
+ \showsetupB{line} \relax \normallineheight
+ \showsetupB{height} \relax \strutheightfactor
+ \showsetupB{depth} \relax \strutdepthfactor
+ \showsetupB{topskip} \relax \topskipfactor
+ \showsetupB{maxdepth} \relax \maxdepthfactor}}}
+
+\stopinterface
+
+\ifx\showsetups\undefined
+
+ \gdef\showsetups% english is fallback
+ {\noindent
+ \vbox
+ {\forgetall
+ \mindermeldingen
+ \switchtobodyfont[\v!klein]
+ \tabskip\!!zeropoint
+ \halign
+ {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr
+ \showsetupA{paperheight} \paperheight
+ \showsetupA{paperwidth} \paperwidth
+ \showsetupA{printpaperheight} \printpaperheight
+ \showsetupA{printpaperwidth} \printpaperwidth
+ \showsetupA{topspace} \topspace
+ \showsetupA{backspace} \backspace
+ \showsetupA{height} \makeupheight
+ \showsetupA{width} \makeupwidth
+ \showsetupA{top} \topheight
+ \showsetupC{topdistance} \topdistance
+ \showsetupA{header} \headerheight
+ \showsetupC{headerdistance} \headerdistance
+ \showsetupA{textheight} \textheight
+ \showsetupC{footerdistance} \footerdistance
+ \showsetupA{footer} \footerheight
+ \showsetupC{bottomdistance} \bottomdistance
+ \showsetupA{bottom} \bottomheight
+ \showsetupA{leftedge} \leftedgewidth
+ \showsetupC{leftedgedistance} \leftedgedistance
+ \showsetupA{leftmargin} \leftmarginwidth
+ \showsetupC{leftmargindistance} \leftmargindistance
+ \showsetupA{textwidth} \textwidth
+ \showsetupC{rightmargindistance}\rightmargindistance
+ \showsetupA{rightmargin} \rightmarginwidth
+ \showsetupC{rightedgedistance} \rightedgedistance
+ \showsetupA{rightedge} \rightedgewidth
+ \showsetupB{bodyfontsize} \the \globalbodyfontsize
+ \showsetupB{line} \relax \normallineheight
+ \showsetupB{height} \relax \strutheightfactor
+ \showsetupB{depth} \relax \strutdepthfactor
+ \showsetupB{topskip} \relax \topskipfactor
+ \showsetupB{maxdepth} \relax \maxdepthfactor}}}
+
+\fi
+
+\gdef\showlayout% interfereert lelijk met een \typefile er na
+ {\bgroup
+ \pagina
+ \showframe
+ \stellayoutin[\c!markering=\v!aan]
+ \dorecurse{4}{\showsetups\pagina}
+ \egroup}
+
+\protect \endinput
diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex
new file mode 100644
index 000000000..560cd6438
--- /dev/null
+++ b/tex/context/base/page-set.tex
@@ -0,0 +1,1488 @@
+%D \module
+%D [ file=page-set,
+%D version=2000.10.20,
+%D title=\CONTEXT\ OTR Macros,
+%D subtitle=Column Sets,
+%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 OTR Macros / Column Sets}
+
+% todo : last longer than previous
+% todo : block span over last column if footnotes
+% todo : diagnosis balancing run
+% todo : separate footnote placement
+% todo : go on on same page with colset
+% todo : test page areas per page
+
+\unprotect
+
+\newcount\tofcolumns % total
+\newcount\lofcolumns % left
+\newcount\rofcolumns % right
+
+\newcount\columnfirstcell \columnfirstcell=1
+\newcount\columnlastcell
+\newcount\columnfreecells
+\newcount\currenthcell
+\newcount\currentvcell
+\newcount\columnhcells
+\newcount\columnvcells
+
+\newif\ifenoughcolumncells
+\newif\ifsomefreecolumncells
+\newif\ifcolumnspread
+\newif\iftracecolumnset % \tracecolumnsettrue
+
+\def\columnmaxcells {75} % runtime
+\def\columnmaxfreecells {0} % runtime
+\def\columngaplimit {0} % {5}
+
+\def\@otr@{otr}
+
+\def\OTRSETgridcell#1#2%
+ {\csname\@otr@:\number#1:\number#2\endcsname}
+
+\def\OTRSETgetgridcell#1#2%
+ {\box\csname\@otr@:\number#1:\number#2\endcsname}
+
+\def\OTRSETsetgridcell#1#2%
+ {\global\setbox\csname\@otr@:\number#1:\number#2\endcsname}
+
+\long\def\OTRSETdoifcellelse#1#2#3#4%
+ {\relax\ifvoid\csname\@otr@:\number#1:\number#2\endcsname#4\else#3\fi}
+
+\beginETEX \ifcsname
+
+\def\columnerasegridboxes%
+ {\bgroup
+ \increment\columnmaxcells
+ \ifodd\realpageno \else % we are on the other page
+ \columnspreadfalse
+ \fi
+ \ifcolumnspread
+ \dorecurse{\nofcolumns}
+ {\let\!!stringa\recurselevel
+ \scratchcounter=\recurselevel \advance\scratchcounter\lofcolumns
+ \edef\!!stringb{\the\scratchcounter}%
+ \dostepwiserecurse{0}{\columnmaxcells}{1}
+ {\ifcsname\@otr@:\!!stringa:\recurselevel\endcsname
+ \global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box
+ \ifcsname\@otr@:\!!stringb:\recurselevel\endcsname
+ \csname\@otr@:\!!stringb:\recurselevel\endcsname
+ %\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\csname\@otr@:\!!stringb:\recurselevel\endcsname
+ \else
+ \voidb@x
+ %\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\voidb@x
+ \expandafter\newbox\csname\@otr@:\!!stringb:\recurselevel\endcsname
+ \fi
+ \else
+ \expandafter\newbox\csname\@otr@:\!!stringa:\recurselevel\endcsname
+ \ifcsname\@otr@:\!!stringb:\recurselevel\endcsname
+ \global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\csname\@otr@:\!!stringb:\recurselevel\endcsname
+ \else
+ \expandafter\newbox\csname\@otr@:\!!stringb:\recurselevel\endcsname
+ \fi
+ \fi}}%
+ \else
+ \dorecurse{\tofcolumns}
+ {\let\!!stringa\recurselevel
+ \dostepwiserecurse{0}{\columnmaxcells}{1}
+ {\ifcsname\@otr@:\!!stringa:\recurselevel\endcsname
+ \global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\voidb@x
+ \else
+ \expandafter\newbox\csname\@otr@:\!!stringa:\recurselevel\endcsname
+ \fi}}%
+ \fi
+ \dorecurse{\tofcolumns}
+ {\global\setbox\csname\@otr@:\recurselevel:\columnmaxcells\endcsname\copy\placeholderboxa}%
+ \global\columnfirstcell=0
+ \global\columnlastcell=\columnfirstcell
+ \global\columnfreecells=\columnfirstcell
+ \egroup}
+
+\endETEX
+
+\beginTEX
+
+\def\columnerasegridboxes%
+ {\bgroup
+ \increment\columnmaxcells
+ \ifodd\realpageno \else % we are on the other page
+ \columnspreadfalse
+ \fi
+ \ifcolumnspread
+ \dorecurse{\nofcolumns}
+ {\let\!!stringa\recurselevel
+ \scratchcounter=\recurselevel \advance\scratchcounter\lofcolumns
+ \edef\!!stringb{\the\scratchcounter}%
+ \dostepwiserecurse{0}{\columnmaxcells}{1}
+ {\expandafter\ifx\csname\@otr@:\!!stringa:\recurselevel\endcsname\relax
+ \expandafter\newbox\csname\@otr@:\!!stringa:\recurselevel\endcsname
+ \expandafter\ifx\csname\@otr@:\!!stringb:\recurselevel\endcsname\relax
+ \expandafter\newbox\csname\@otr@:\!!stringb:\recurselevel\endcsname
+ \else
+ \global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\csname\@otr@:\!!stringb:\recurselevel\endcsname
+ \fi
+ \else
+ \global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box
+ \expandafter\ifx\csname\@otr@:\!!stringb:\recurselevel\endcsname\relax
+ \voidb@x
+ %\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\voidb@x
+ \expandafter\newbox\csname\@otr@:\!!stringb:\recurselevel\endcsname
+ \else
+ \csname\@otr@:\!!stringb:\recurselevel\endcsname
+ %\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\csname\@otr@:\!!stringb:\recurselevel\endcsname
+ \fi
+ \fi}}%
+ \else
+ \dorecurse{\tofcolumns}
+ {\let\!!stringa\recurselevel
+ \dostepwiserecurse{0}{\columnmaxcells}{1}
+ {\expandafter\ifx\csname\@otr@:\!!stringa:\recurselevel\endcsname\relax
+ \expandafter\newbox\csname\@otr@:\!!stringa:\recurselevel\endcsname
+ \else
+ \global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\voidb@x
+ \fi}}%
+ \fi
+ \dorecurse{\tofcolumns}
+ {\global\setbox\csname\@otr@:\recurselevel:\columnmaxcells\endcsname\copy\placeholderboxa}%
+ \global\columnfirstcell=0
+ \global\columnlastcell=\columnfirstcell
+ \global\columnfreecells=\columnfirstcell
+ \egroup}
+
+\endTEX
+
+\def\doOTRSETsetgridcells#1#2#3#4#5#6% placeholder col row wid hei {data}
+ {\!!countd=#2\advance\!!countd#4\advance\!!countd-1
+ \!!counte=#3\advance\!!counte#5\advance\!!counte-1
+ \dostepwiserecurse{#2}{\!!countd}{1}
+ {\!!countf=\recurselevel
+ \dostepwiserecurse{#3}{\!!counte}{1}
+ {\OTRSETsetgridcell\!!countf\recurselevel#1}}%
+ \dostepwiserecurse{#3}{\!!counte}{1}
+ {\global\wd\OTRSETgridcell{#2}\recurselevel=\hsize}%
+ \OTRSETsetgridcell{#2}\!!counte#6}
+
+\def\OTRSETsetgridcells%
+ {\doOTRSETsetgridcells{\copy\placeholderboxb}}
+
+\def\OTRSETerasegridcells#1#2#3#4%
+ {\doOTRSETsetgridcells{\box\voidb@x}{#1}{#2}{#3}{#4}{\box\voidb@x}}
+
+\def\OTRSETsetfreecells#1#2% col start
+ {\global\columnfirstcell=\ifnum#2=0 1\else#2\fi\relax
+ \ifnum\columnfirstcell>\columnmaxcells
+ \global\columnfreecells=0
+ \global\columnfirstcell=1
+ \global\columnlastcell=0
+ \global\somefreecolumncellsfalse
+ %\message{no cells a}%
+ \else
+ \doloop
+ {\ifnum\columnfirstcell>\columnmaxcells
+ \exitloop
+ \else
+ \OTRSETdoifcellelse{#1}\columnfirstcell
+ {\global\advance\columnfirstcell 1 }
+ {\exitloop}
+ \fi}%
+ \global\columnlastcell=\columnfirstcell
+ \doloop
+ {\ifnum\columnlastcell>\columnmaxcells
+ \exitloop
+ \else
+ \OTRSETdoifcellelse{#1}\columnlastcell
+ {\global\advance\columnlastcell -1 \exitloop}
+ {\global\advance\columnlastcell 1 }
+ \fi}%
+ \ifnum\columnfirstcell>\columnmaxcells
+ \global\columnfreecells=0
+ \global\columnfirstcell=1
+ \global\columnlastcell=0
+ \global\somefreecolumncellsfalse
+ %\message{no cells b}%
+ \else
+ \ifnum\columnlastcell>\columnmaxcells
+ \global\columnlastcell=\columnmaxcells
+ \fi
+ \global\columnfreecells=\columnlastcell
+ \global\advance\columnfreecells -\columnfirstcell
+ \global\advance\columnfreecells 1
+ \global\somefreecolumncellstrue
+ %\message{\number\columnfirstcell-\number\columnlastcell=\number\columnfreecells}%
+ \fi
+ \fi}
+
+\def\OTRSETgetmaxfreecells#1#2% col start
+ {\scratchcounter=0
+ \edef\columnmaxfreecells{0}%
+ \edef\columnfrmfreecells{0}%
+ \dostepwiserecurse{#2}{\columnmaxcells}{1}
+ {\OTRSETdoifcellelse{#1}{\recurselevel}
+ {\ifnum\columnmaxfreecells<\scratchcounter
+ \edef\columnmaxfreecells{\the\scratchcounter}%
+ \let\columnfrmfreecells\recurselevel
+ \fi
+ \scratchcounter=0 }
+ {\advance\scratchcounter 1 }}}
+
+\long\def\OTRSETrecurseRL#1%
+ {\dostepwiserecurse{\nofcolumns}{1}{-1}
+ {#1\hskip\OTRSETgetparameter\c!afstand\recurselevel}}
+
+\def\OTRSETmakegridbox%
+ {\ifcase\columndirection
+ \OTRSETdomakegridbox{1}{\nofcolumns}{+1}%
+ \else
+ \OTRSETdomakegridbox{\nofcolumns}{1}{-1}%
+ \fi}
+
+\def\OTRSETdomakegridbox#1#2#3%
+ {\hbox\bgroup
+ % test first !
+ \hbox to \zetbreedte
+ {\dostepwiserecurse{#1}{#2}{#3}
+ {\mofcolumns=\recurselevel
+ \localcolumnwidth=\OTRSETlocalwidth\mofcolumns
+ \setbox\scratchbox=\hbox\localframed
+ [\??mc\OTRSETidentifier\number\mofcolumns]%
+ [\c!breedte=\localcolumnwidth,\c!hoogte=\teksthoogte]%
+ {}%
+ \ifcase\columndirection
+ \hskip\OTRSETgetparameter\c!afstand\recurselevel\box\scratchbox
+ \else
+ \box\scratchbox\hskip\OTRSETgetparameter\c!afstand\recurselevel
+ \fi}}%
+ \hskip-\zetbreedte
+ % main text
+ \hbox to \zetbreedte
+ {\dostepwiserecurse{#1}{#2}{#3}
+ {\mofcolumns=\recurselevel
+ \localcolumnwidth=\OTRSETlocalwidth\mofcolumns
+ \offinterlineskip
+ \setbox\scratchbox=\vbox to \teksthoogte
+ {\topskipcorrection
+ \dorecurse{\columnmaxcells}
+ {\setbox\scratchbox=\hbox{\OTRSETgetgridcell\mofcolumns\recurselevel}%
+ \ht\scratchbox=\ht\strutbox
+ \dp\scratchbox=\dp\strutbox
+ \ifcase\columndirection
+ \box\scratchbox
+ \else
+ \hbox to \localcolumnwidth
+ {\hskip\localcolumnwidth\llap{\box\scratchbox}}
+ \fi
+ \par}}%
+ \wd\scratchbox=\localcolumnwidth % \tekstbreedte
+ \ifcase\columndirection
+ \hskip\OTRSETgetparameter\c!afstand\recurselevel\box\scratchbox
+ \else
+ \box\scratchbox\hskip\OTRSETgetparameter\c!afstand\recurselevel
+ \fi}}%
+ \egroup}
+
+\def\OTRSETflushfinalfootnotes
+ {\ifcase\lastcolumnlastcell \else
+ \setbox\scratchbox=\hbox
+ {\placefootnotes}%
+ \ifdim\ht\scratchbox>\zeropoint
+ \setbox\scratchbox=\hbox
+ {\hbox to \zeropoint{\OTRSETgetgridcell\nofcolumns\lastcolumnlastcell}%
+ \box\scratchbox}%
+ \ht\scratchbox\ht\strutbox
+ \dp\scratchbox\dp\strutbox
+ \OTRSETsetgridcell\nofcolumns\lastcolumnlastcell\box\scratchbox
+ \fi
+ \global\lastcolumnlastcell=0
+ \fi}
+
+\def\OTRSETdoflush
+ {\ifcollectingcontent
+ \global\mofcolumns=1
+ \else
+ \OTRSETdofinalflush
+ \OTRSETinitializecolumns
+ \OTRSETmanualbalance % or after \gotonextpage
+ %\OTRSETdoflushfloats
+ \OTRSETgotonextpage
+ \fi}
+
+\def\OTRSETdofinalflush % see \OTRSETdoflush
+ {\OTRSETflushfinalfootnotes
+ \placecolumntextareas
+ \OTRSETcentergridcells
+ \setbox\scratchbox=\OTRSETmakegridbox
+ \global\mofcolumns=\nofcolumns % otherwise problems in finaloutput
+ \finaloutput\box\scratchbox}
+
+\let\OTRSETbalancinglist\empty
+
+\appendtoks \OTRSETflushbalancinglist \to \everystoptext
+
+\def\OTRSETflushbalancinglist%
+ {\scratchcounter=0
+ \def\docommando##1%
+ {\advance\scratchcounter 1
+ \immediatewriteutilitycommand
+ {\twopassentry{\s!colset}{\the\scratchcounter}{##1}}}%
+ \processcommacommand[\OTRSETbalancinglist]\docommando}
+
+\definesystemvariable {mc}
+\definesystemvariable {mt}
+\definesystemconstant {colset}
+
+\definetwopasslist\s!colset
+
+\newdimen \OTRSETtextswidth
+\newdimen \OTRSETtextsheight
+\let \OTRSETidentifier=\empty
+
+\newtoks \OTRSEToutput
+
+\def\OTRSETgetparameter#1#2{\getvalue{\??mc\OTRSETidentifier\number#2#1}}
+\def\OTRSETsetparameter#1#2{\setvalue{\??mc\OTRSETidentifier\number#2#1}}
+
+\def\OTRSETsetvsize% snap per sectie (gap here?)
+ {\ifcollectingcontent \else % can be assigndimen
+ \OTRSETcheckinsert % added
+ \OTRSETsetfreecells\mofcolumns\columnfirstcell
+ \ifsomefreecolumncells
+ \global\vsize=\columnfreecells\lineheight
+ %\global\pagegoal=\vsize % niet nodig, tenzij binnen otr
+ \dosynchronizeoutput
+ \allowbreak % hm
+ \fi
+ \ifdim\ht\footins>\zeropoint % updates vsize
+ \insert\footins{\unvbox\footins}
+ \fi
+ \fi}
+
+\def\OTRSETsethsize%
+ {%\OTRSETassignwidth\OTRSETidentifier\to\localcolumnwidth
+ \localcolumnwidth=\OTRSETlocalwidth\mofcolumns
+ \tekstbreedte\localcolumnwidth
+ \hsize\localcolumnwidth}
+
+\def\OTRSETcheckfreelines%
+ {\OTRSETsetvsize}
+
+\def\doOTRSETcolumnseparator%
+ {\hbox to \zeropoint{\hss\red\vl\hss}}
+
+\let\OTRSETcolumnseparator\relax
+
+\def\showbreaks%
+ {\let\OTRSETcolumnseparator\doOTRSETcolumnseparator}
+
+\def\OTRSETnextcolumn%
+ {\ifhmode
+ \bgroup
+ \unskip\unskip\unskip
+ \parfillskip\!!zeropoint
+ \OTRSETcolumnseparator
+ \par
+ \egroup
+ \fi
+ \page\relax
+ \OTRSETsethsize}
+
+\newtoks\OTRSETeverystartofcolumn
+
+\newbox\OTRSETsavedfootnotes
+
+% \installoutput\OTRSETflushtextsofar goes wrong
+
+\def\OTRSETflushtextsofar
+ {\ifvoid\normalpagebox \else
+ \setbox\scratchbox=\vbox{\unvbox\normalpagebox}%
+ \OTRSETsavefootnotes
+ \OTRSEThandleflushedtext0
+ \fi}
+
+\def\OTRSETplacefootnotes
+ {\iflastcolumnfootnotes
+ \ifnum\nofcolumns=\mofcolumns
+ \ifintermediatefootnotes \placefootnotes \fi
+ \fi
+ \else
+ \placefootnotes
+ \fi}
+
+\def\OTRSETflushfootnotes
+ {\ifvoid\OTRSETsavedfootnotes \else
+ \iflastcolumnfootnotes
+ \ifnum\nofcolumns=\mofcolumns
+ \insert\footins{\unvbox\OTRSETsavedfootnotes}%
+ \fi
+ \else
+ \insert\footins{\unvbox\OTRSETsavedfootnotes}%
+ \fi
+ \fi}
+
+\def\OTRSETsavefootnotes
+ {\iflastcolumnfootnotes
+ \ifnum\nofcolumns=\mofcolumns
+ \else
+ \global\setbox\OTRSETsavedfootnotes=\vbox
+ {\unvbox\OTRSETsavedfootnotes\box\footins}%
+ \fi
+ \fi}
+
+\appendtoks \OTRSETflushfootnotes \to \OTRSETeverystartofcolumn
+
+\def\OTRSETnaturalflush%
+ {\setbox0=\vbox to \columnfreecells\lineheight
+ {\vskip-\topskip
+ \vskip\lineheight
+ \prevdepth\dp\strutbox
+ \unvbox\normalpagebox
+ \vfill}
+ \setbox2=\hbox
+ {\OTRSETplacefootnotes}
+ \setbox\scratchbox=\hbox
+ {\wd0=\!!zeropoint\box0\box2}
+ \dp\scratchbox=\dp\strutbox
+ \OTRSEThandleflushedtext1}
+
+\newcount\lastcolumnlastcell
+
+\def\OTRSEThandleflushedtext#1%
+ {\getnoflines{\ht\scratchbox}%
+ \wd\scratchbox=\hsize
+ \doOTRSETsetgridcells
+ {\copy\placeholderboxf}
+ {\mofcolumns}{\columnfirstcell}{1}{\noflines}
+ {\copy\scratchbox}% \box
+ \global\columnlastcell=\columnfirstcell
+ \global\advance\columnlastcell \noflines
+\global\lastcolumnlastcell\columnlastcell
+\global\advance\lastcolumnlastcell -1
+ % find next (acceptable) gap, todo: deadcycle
+\ifcase#1\else
+ \OTRSETfillgapsbetweencells\mofcolumns\columnlastcell
+\fi
+ \OTRSETfindnextgap
+ %\message{\the\mofcolumns,\the\columnfirstcell,\the\columnfreecells}\wait
+ \OTRSETsethsize
+ \OTRSETsetvsize}
+
+\def\OTRSETfindnextgap%
+ {\OTRSETsetfreecells\mofcolumns\columnlastcell
+ \ifsomefreecolumncells
+ % okay
+ \else
+ \global\advance\mofcolumns 1 \relax
+ \ifnum\mofcolumns>\nofcolumns
+ \OTRSETdoflush
+ \global\columnlastcell=1
+ \global\columnfirstcell=0
+ \OTRSETdoflushfloats
+ \else
+ \the\OTRSETeverystartofcolumn
+ \global\columnlastcell=1
+ \global\columnfirstcell=0
+ \fi
+ \fi}
+
+\def\OTRSETcheckfreelines{}
+
+\def\OTRSETfillgapsbetweencells#1#2% col
+ {\ifnum\columngaplimit>0
+ \donefalse
+ \dostepwiserecurse{#2}{\columnmaxcells}{1}
+ {\OTRSETdoifcellelse{#1}{\recurselevel}
+ {\ifdone
+ \!!countb=\recurselevel \advance\!!countb -\!!counta\relax
+ \ifnum\!!countb>1
+ \advance\!!countb -1
+ \ifnum\!!countb<\columngaplimit\relax
+ \!!countb=\recurselevel \advance\!!countb -1
+ \dostepwiserecurse{\!!counta}{\!!countb}{1}
+ {\OTRSETsetgridcell{#1}\recurselevel\copy\placeholderboxc}%
+ %\message{[gap]}%
+ \fi
+ \fi
+ \fi
+ \donefalse}
+ {\ifdone \else
+ \donetrue
+ \!!counta=\recurselevel
+ \fi}}%
+ \fi}
+
+\appendtoks
+ \OTRSETfillgapsbetweencells\mofcolumns1
+\to \OTRSETeverystartofcolumn
+
+%\def\OTRSETfreezeminimumgap#1%
+% {\OTRSETgetmaxfreecells{#1}{1}%
+% \ifnum\columnmaxfreecells>0
+% \!!countb=\columnfrmfreecells
+% \!!counta=\!!counta \advance\!!counta -\columnmaxfreecells
+% \dorecurse{\columnmaxcells}
+% {\ifnum\recurselevel<\!!counta\relax
+% \donetrue
+% \else\ifnum\recurselevel>\!!countb
+% \donetrue
+% \else
+% \donefalse
+% \fi\fi
+% \ifdone
+% \OTRSETdoifcellelse{#1}{\recurselevel}
+% {}{\OTRSETsetgridcell{#1}\recurselevel\copy\placeholderboxc}%
+% \fi}%
+% \fi}
+%
+%\def\OTRSETfillgaps#1#2#3% col from to
+% {\dostepwiserecurse{#2}{#3}{1}
+% {\OTRSETdoifcellelse{#1}{\recurselevel}
+% {}{\OTRSETsetgridcell{#1}\recurselevel\copy\placeholderboxc}}}
+%
+%\def\OTRSETfillbotgaps#1#2% col first
+% {\OTRSETfillgaps{#1}{#2}{\columnmaxcells}}
+%
+%\def\OTRSETfilltopgaps#1#2% col last
+% {\OTRSETfillgaps{#1}{1}{#2}}
+
+\newif\ifspancolumnslots \spancolumnslotstrue
+
+\def\OTRSETcheckcolumnslot#1%
+ {\enoughcolumncellstrue
+ \ifspancolumnslots \else \ifdim\wd#1>\hsize
+ \enoughcolumncellsfalse
+ \fi \fi
+ \ifenoughcolumncells
+ \getnoflines\pagetotal
+ \scratchcounter=\noflines
+ \getnoflines{\ht#1}%
+ \columnvcells=\noflines
+ \columnhcells=1
+ \advance\scratchcounter \columnvcells \relax
+ \ifnum\scratchcounter>\columnfreecells
+ \enoughcolumncellsfalse
+ \fi
+ \fi}
+
+\def\OTRSETstoreincolumnslotPAGE#1%
+ {\ifenoughcolumncells
+ % to do
+ \OTRSETsavebox{#1}%
+ \else
+ \OTRSETsavebox{#1}%
+ \fi}
+
+\def\OTRSETstoreincolumnslotHERE%
+ {\OTRSETflushtextsofar\OTRSETstoreincolumnslotTOPS}
+
+\def\OTRSETstoreincolumnslotTOPS#1%
+ {\OTRSETcheckcolumnslot{#1}%
+ \ifenoughcolumncells
+ \OTRSETcheckcolumnspace\mofcolumns\columnfirstcell{#1}%
+ \fi
+ \ifenoughcolumncells
+ \OTRSETsetgridcells\mofcolumns\columnfirstcell\columnhcells\columnvcells
+ {\hbox{\copy#1}}
+ \OTRSETsetvsize
+ \else
+ \OTRSETsavebox{#1}%
+ \fi}
+
+\def\OTRSETstoreincolumnslotBOTS#1%
+ {\edef\savedcolumnlastcell{\the\columnlastcell}%
+ \OTRSETcheckcolumnslot{#1}%
+ \ifenoughcolumncells
+ \advance\columnlastcell -\columnvcells \advance\columnlastcell 1
+% \OTRSETcheckcolumnspace\mofcolumns\columnfirstcell{#1}%
+ \OTRSETcheckcolumnspace\mofcolumns\columnlastcell{#1}%
+ \fi
+ \ifenoughcolumncells
+ \OTRSETsetgridcells\mofcolumns\columnlastcell\columnhcells\columnvcells
+ {\copy#1}
+ \OTRSETfillgapsbetweencells\mofcolumns\savedcolumnlastcell % -)
+ \OTRSETsetvsize
+ \else
+ \columnlastcell=\savedcolumnlastcell
+ \OTRSETsavebox{#1}%
+ \fi}
+
+\newdimen\totalcolumnspace
+
+\def\columnspacetopoffset{0}
+\def\columnspacebotoffset{0}
+
+\def\OTRSETcheckcolumnspace#1#2#3% col row box
+ {\columnhcells=1
+ \totalcolumnspace=\!!zeropoint
+ \scratchcounter=#1%
+ \enoughcolumncellstrue
+ \doloop
+% {\advance\totalcolumnspace \hsize
+ {\advance\totalcolumnspace \OTRSETlocalwidth\scratchcounter\relax % needed
+ \ifnum\wd#3>\totalcolumnspace\relax
+ \ifnum\scratchcounter=\nofcolumns
+ \enoughcolumncellsfalse
+ \exitloop
+ \else
+ \advance\columnhcells 1
+ \advance\scratchcounter 1
+ \advance\totalcolumnspace \OTRSETgetparameter\c!afstand\scratchcounter
+ \fi
+ \else
+ \exitloop
+ \fi}%
+ \ifenoughcolumncells
+ \getnoflines{\ht#3}%
+ \columnvcells=\noflines
+ \OTRSETcheckcolumncells{#1}{#2}\columnhcells\columnvcells
+ \fi}
+
+\def\OTRSETcheckcolumncells#1#2#3#4% col row wid hei
+ {\!!countd=#1\advance\!!countd#3\advance\!!countd-1\relax
+ \!!counte=#2\advance\!!counte#4\advance\!!counte-1\relax
+ \ifnum\!!counte>\columnmaxcells\relax
+ \enoughcolumncellsfalse
+ \else
+ \enoughcolumncellstrue
+%\def\columnspacetopoffset{0}%
+%\scratchcounter=#2\advance\scratchcounter-1\relax
+%\ifnum\scratchcounter>0
+% \dostepwiserecurse{#1}{\!!countd}{1}
+% {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\!!zeropoint
+% \def\columnspacetopoffset{1}%
+% \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\!!zeropoint
+% \def\columnspacetopoffset{1}%
+% \fi\fi}%
+% \advance\!!counte \columnspacetopoffset \relax
+% \advance\columnvcells \columnspacetopoffset \relax
+%\fi
+%\def\columnspacebotoffset{0}%
+%\scratchcounter=\!!counte
+%\advance\scratchcounter \columnvcells \relax
+%\ifnum\scratchcounter>\columnmaxcells\else
+% \dostepwiserecurse{#1}{\!!countd}{1}
+% {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\!!zeropoint
+% \def\columnspacebotoffset{1}%
+% \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\!!zeropoint
+% \def\columnspacebotoffset{1}%
+% \fi\fi}%
+% \advance\!!counte \columnspacebotoffset \relax
+% \advance\columnvcells \columnspacebotoffset \relax
+%\fi
+ \dostepwiserecurse{#1}{\!!countd}{1} % cols
+ {\ifenoughcolumncells
+ \!!countf=\recurselevel\relax
+ \dostepwiserecurse{#2}{\!!counte}{1} % rows
+ {\ifenoughcolumncells
+ \OTRSETdoifcellelse\!!countf\recurselevel
+ {\enoughcolumncellsfalse}{}%
+ \fi}%
+ \fi}%
+ \fi}
+
+\def\OTRSETsetpreferedcolumnslot#1%
+ {\doifsomething{#1}{\edef\preferedcolumn{#1}}}
+
+\OTRSETsetpreferedcolumnslot{\nofcolumns} % default ?
+
+\let\pofcolumns\mofcolumns
+\let\qofcolumns\mofcolumns
+
+\newif\ifquitincurrentcolumn
+
+\def\OTRSETstoreincolumnslotFXTB% fixed column
+ {\OTRSETstoreincolumnslotindeed
+ \pofcolumns\pofcolumns+\currenthcell1\columnmaxcells+\currentvcell}
+
+\def\OTRSETstoreincolumnslotFXBT% fixed column
+ {\OTRSETstoreincolumnslotindeed
+ \pofcolumns\pofcolumns+\currenthcell\columnmaxcells1-\currentvcell}
+
+\def\OTRSETstoreincolumnslotLRTB%
+ {\OTRSETstoreincolumnslotindeed
+ \mofcolumns\nofcolumns+\currenthcell1\columnmaxcells+\currentvcell}
+
+\def\OTRSETstoreincolumnslotLRBT%
+ {\OTRSETstoreincolumnslotindeed
+ \mofcolumns\nofcolumns+\currenthcell\columnmaxcells1-\currentvcell}
+
+\def\OTRSETstoreincolumnslotRLTB%
+ {\OTRSETstoreincolumnslotindeed
+ \nofcolumns\qofcolumns-\currenthcell1\columnmaxcells+\currentvcell}
+
+\def\OTRSETstoreincolumnslotRLBT%
+ {\OTRSETstoreincolumnslotindeed
+ \nofcolumns\qofcolumns-\currenthcell\columnmaxcells1-\currentvcell}
+
+\def\OTRSETstoreincolumnslotTBLR%
+ {\OTRSETstoreincolumnslotindeed
+ 1\columnmaxcells+\currentvcell\mofcolumns\nofcolumns+\currenthcell}
+
+\def\OTRSETstoreincolumnslotTBRL%
+ {\OTRSETstoreincolumnslotindeed
+ 1\columnmaxcells+\currentvcell\nofcolumns\qofcolumns-\currenthcell}
+
+\def\OTRSETstoreincolumnslotBTLR%
+ {\OTRSETstoreincolumnslotindeed
+ \columnmaxcells1-\currentvcell\mofcolumns\nofcolumns+\currenthcell}
+
+\def\OTRSETstoreincolumnslotBTRL%
+ {\OTRSETstoreincolumnslotindeed
+ \columnmaxcells1-\currentvcell\nofcolumns\qofcolumns-\currenthcell}
+
+\def\OTRSETstoreincolumnslotindeed#1#2#3#4#5#6#7#8#9%
+ {\OTRSETflushtextsofar
+ \ifnum\preferedcolumn<\mofcolumns
+ \let\pofcolumns\mofcolumns
+ \else
+ \let\pofcolumns\preferedcolumn
+ \fi
+ \ifquitincurrentcolumn
+ \ifnum\mofcolumns=\nofcolumns
+ \def\qofcolumns{\mofcolumns}%
+ \else
+ \scratchcounter=\mofcolumns
+ \advance\scratchcounter 1
+ \edef\qofcolumns{\the\scratchcounter}%
+ \fi
+ \else
+ \let\qofcolumns=\mofcolumns
+ \fi
+ \enoughcolumncellsfalse
+ \donefalse
+ \dostepwiserecurse{#1}{#2}{#31}
+ {\ifdone\else
+ #4=\recurselevel
+ \dostepwiserecurse{#5}{#6}{#71}
+ {\ifdone\else
+ #8=\recurselevel
+ \OTRSETcheckcolumnspace\currenthcell\currentvcell{#9}%
+ \ifenoughcolumncells \donetrue \fi
+ \fi}%
+ \fi}%
+ \ifdone
+ \enoughcolumncellstrue
+ \else
+ \enoughcolumncellsfalse
+ \fi
+ \ifenoughcolumncells
+% \ifnum\columnspacetopoffset>0\message{[+++]}\fi
+% \ifnum\columnspacebotoffset>0\message{[---]}\fi
+% \OTRSETsetgridcells\currenthcell\currentvcell\columnhcells\columnvcells
+% {\vbox
+% {\ifcase\columnspacetopoffset\else\ruledvskip\columnspacetopoffset\lineheight\fi
+% \copy#9
+% \ifcase\columnspacebotoffset\else\ruledvskip\columnspacebotoffset\lineheight\fi}}%
+ \OTRSETsetgridcells\currenthcell\currentvcell\columnhcells\columnvcells
+ {\copy#9}%
+ \ifnum\currenthcell=\mofcolumns\relax
+ \ifdim\ht\OTRSETsavedfootnotes>\zeropoint % \footins
+ \OTRSETsetfreecells\mofcolumns\columnfirstcell
+ \ifsomefreecolumncells
+ \getnoflines{\ht\OTRSETsavedfootnotes}% \footins
+ \ifnum\columnfreecells<\noflines
+ \global\somefreecolumncellsfalse
+ \else
+ %\message{[flt]}% float
+ \fi
+ \fi
+ \ifsomefreecolumncells
+ % ok, enough room for notes
+ %\message{[flt]}% float
+ \else % ?
+ \OTRSETsavebox{#9}%
+ \OTRSETerasegridcells\currenthcell\currentvcell\columnhcells\columnvcells
+ %\message{[clr]}% save box
+ \fi
+ \else
+ %\message{[flt]}% float
+ \fi
+ \else
+ %\message{[flt]}% float
+ \fi
+ \OTRSETsetvsize
+ %\message{[fnt]}% float
+ %\OTRSETflushfootnotes % not here, better a hook into \everypar
+ \else
+ %\message{[rej]}% save box
+ \OTRSETsavebox{#9}%
+ \fi}
+
+% \appendtoks \OTRSETflushfootnotes \to \everypar
+
+\def\columnslotspacing{2}
+
+\def\OTRSETstoreincolumnslot#1#2% {method} {box} % alleen last
+ {\dp#2=\!!zeropoint
+ \ifcase\columnslotspacing\else
+ \setbox#2=\vbox spread \columnslotspacing\lineheight
+ {\vss\box#2\vss}
+ \fi
+%\dp#2=\!!zeropoint
+ \doifdefinedelse{\strippedcsname\OTRSETstoreincolumnslot#1}
+ {\getvalue{\strippedcsname\OTRSETstoreincolumnslot#1}{#2}}
+ {\copy#2}}
+
+%\def\OTRSETsavebox#1%
+% {\setbox\floatbox=\box#1\dosavefloat}
+
+\def\OTRSETsavebox#1% clean up the skips
+ {\setbox\scratchbox=\vbox
+ {\unvbox#1\unskip\unskip\unskip
+ \global\setbox\floatbox\lastbox
+ }%\unskip\unskip\unskip\box\floatbox}%
+ \dosavefloat}
+
+\def\OTRSETflushfloatbox% nog verder doorvoeren en meer info in marge
+ {\iftestfloatbox\ruledhbox\fi{\box\floatbox}}
+
+\def\OTRSETdoflushfloats%
+ {\bgroup
+ \def\OTRSETsavebox##1{\!!doneafalse}%
+ \doloop
+ {\ifsomefloatwaiting
+ \dogetfloat
+ \ifdim\wd\floatbox>\zeropoint
+ \!!doneatrue
+ \dp\floatbox=\!!zeropoint
+ \OTRSETstoreincolumnslot{TBLR}\floatbox
+ \if!!donea
+ %\message{[flu]}%
+ \else
+ \doresavefloat
+ \exitloop
+ \fi
+ \else
+ %\message{[err]}% happens but why?
+ \fi
+ \else
+ \exitloop
+ \fi}
+ \egroup}
+
+\newif\ifcentergridcells \centergridcellstrue
+
+\def\OTRSETcentergridcells%
+ {\ifcentergridcells
+ \dorecurse{\nofcolumns}
+ {\currenthcell=\recurselevel
+ \dorecurse{\columnmaxcells}
+ {\currentvcell=\recurselevel\relax
+ \ifdim\ht\OTRSETgridcell\currenthcell\currentvcell>\zeropoint
+ \ifdim\dp\OTRSETgridcell\currenthcell\currentvcell=\zeropoint
+ \bgroup
+ \setbox\scratchbox=\OTRSETgetgridcell\currenthcell\currentvcell
+ \getnoflines{\ht\scratchbox}%
+ \!!counta=\currentvcell
+ \advance\!!counta -\noflines
+ \advance\!!counta 1
+ % first col always ok
+ \!!countb=\currenthcell
+ \!!countc=\currenthcell \advance\!!countc 1
+ \!!donebtrue
+ \dostepwiserecurse{\!!countc}{\nofcolumns}{1}
+ {\if!!doneb
+ \let\xrecurselevel\recurselevel
+ \dostepwiserecurse{\!!counta}{\currentvcell}{1}
+ {\ifdim\ht\OTRSETgridcell\xrecurselevel\recurselevel>\zeropoint
+ \!!donebfalse
+ \else\ifdim\wd\OTRSETgridcell\xrecurselevel\recurselevel>\zeropoint
+ \!!donebfalse
+ \fi\fi}%
+ \if!!doneb
+ \!!countb=\xrecurselevel
+ \fi
+ \fi}%
+% \totalcolumnspace=\hsize
+\totalcolumnspace=\OTRSETlocalwidth\currenthcell
+ \dostepwiserecurse{\!!countc}{\!!countb}{1}
+% {\advance\totalcolumnspace \hsize\relax
+{\advance\totalcolumnspace \OTRSETlocalwidth\recurselevel
+ \advance\totalcolumnspace \OTRSETgetparameter\c!afstand\recurselevel}%
+ \ifdim\totalcolumnspace>\wd\scratchbox
+ \setbox\scratchbox=\hbox to \totalcolumnspace{\hss\box\scratchbox\hss}%
+ % \wd\scratchbox=\hsize
+ \fi
+ \OTRSETsetgridcell\currenthcell\currentvcell\box\scratchbox
+ \egroup
+ \fi
+ \fi}}%
+ \fi}
+
+\def\OTRSETinitializecolumns%
+ {\columnspreadtrue % todo
+ \ifcolumnspread
+ \global\rofcolumns=\getvalue{\??mc\OTRSETidentifier\c!nrechts}
+ \global\lofcolumns=\getvalue{\??mc\OTRSETidentifier\c!nlinks}
+ \global\tofcolumns=\rofcolumns \relax
+ \ifodd\realpageno\relax
+ \global\nofcolumns=\rofcolumns
+ \else
+ \global\advance\tofcolumns\lofcolumns
+ \global\nofcolumns=\lofcolumns
+ \fi
+ \else
+ \global\nofcolumns=\getvalue{\??mc\OTRSETidentifier\c!n}
+ \global\rofcolumns=\nofcolumns
+ \global\lofcolumns=\nofcolumns
+ \global\tofcolumns=\nofcolumns
+ \fi
+\OTRSETassignwidths
+ \global\mofcolumns=1
+ \columnerasegridboxes
+ \initializecolumntextareas}
+
+% vanaf hier:
+
+\def\definecolumnset%
+ {\dodoubleargument\dodefinecolumnset}
+
+\def\dodefinecolumnset[#1][#2]%
+ {\getparameters[\??mc#1]
+ [\c!richting=\v!rechts,
+ \c!n=2,
+ \c!breedte=\v!passend,
+ \c!balanceren=\v!nee,
+ \c!afstand=1.5\bodyfontsize, % controleren
+ \c!nlinks=\getvalue{\??mc#1\c!n},
+ \c!nrechts=\getvalue{\??mc#1\c!n},
+ #2]%
+ \dorecurse{\getvalue{\??mc#1\c!nlinks}} % todo
+ {\dododefinecolumnset[#1][\recurselevel]}%
+ \dorecurse{\getvalue{\??mc#1\c!nrechts}} % todo
+ {\dododefinecolumnset[#1][\recurselevel]}%
+ \setupcolumnset[#1][1][\c!afstand=\!!zeropoint]}
+
+\def\dododefinecolumnset[#1][#2]%
+ {\presetlocalframed
+ [\??mc#1#2]%
+ \setupcolumnset
+ [#1][#2]
+ [\c!offset=\v!overlay,
+ \c!kader=\v!uit,
+ \c!uitlijnen=,
+ \c!afstand=1.5\bodyfontsize]}
+
+\def\setupcolumnset%
+ {\dotripleargument\dosetupcolumnset}
+
+\def\dosetupcolumnset[#1][#2][#3]%
+ {\ifthirdargument
+ \def\docommando##1%
+ {\doifelse{##1}{\v!elk}
+ {\dorecurse{\getvalue{\??mc#1\c!n}}{\docommando{\recurselevel}}}
+ {\getparameters[\??mc#1##1][#3]}}%
+ \processcommalist[#2]\docommando
+ \else
+ \getparameters[\??mc#1][#2]%
+ \fi}
+
+\def\OTRSETgotocolumn%
+ {\dosingleempty\doOTRSETgotocolumn}
+
+\def\doOTRSETgotocolumn[#1]% first|last|yes|<number>
+ {\doifnumberelse{#1}
+ {\OTRSETdummycolumn
+ \doloop
+ {\ifnum\mofcolumns<#1
+ \OTRSETdummycolumn
+ \else
+ \exitloop
+ \fi}}
+ {\processaction
+ [#1]
+ [ \v!ja=>\OTRSETdummycolumn,
+ \v!eerste=>{\doOTRSETgotocolumn[1]},
+ \v!laatste=>{\doOTRSETgotocolumn[\nofcolumns]},
+ \v!default=>\OTRSETdummycolumn]}}
+
+\def\OTRSETdummycolumn
+ {\vbox{\strut}
+ \vskip-\lineheight
+ \vfill
+ \eject}
+
+\newcounter\columnsetlevel
+\let\currentcolumnset\empty
+
+\def\startcolumnset%
+ {\dodoubleempty\dostartcolumnset}
+
+\def\dostartcolumnset[#1][#2]%
+ {\increment\columnsetlevel\relax
+ \ifnum\columnsetlevel=1
+ \OTRSETgetmanualbalance
+ \edef\savedfootnotedimen{\the\dimen\footins}% ugly
+ \bgroup
+ \def\currentcolumnset{#2}%
+ \binnenkolommentrue % will be different flag
+ %\let\redofloatorder\gobbleoneargument % will also be a flag
+ \let\kolom\OTRSETgotocolumn%
+ \activateotr{SET}{ONE} % andere naam, activate or so
+ \xdef\OTRSETlist{#1}
+ \OTRSETgotonextpage
+ \OTRSETassignwidths
+ \else
+ \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\dostopcolumnset%
+ {%\OTRSETdofinalflushfloats % yes/no
+ \ifbalancecolumns
+ \OTRSETdobalance
+ \else
+ \OTRSETnobalance
+ \fi}
+
+\def\OTRSETdobalance
+ {\OTRSETnobalance}
+
+\def\OTRSETmanualbalance
+ {\ifbalancecolumns
+ \ifnum\realpageno=\balancingpageno\relax
+ \ifnum\mofcolumns=1
+ \dorecurse\nofcolumns
+ {\!!counta=\recurselevel
+ \!!countb=\balancingcolumnmaxcells\!!counta
+ \advance\!!countb 1
+ \dostepwiserecurse\!!countb\columnmaxcells1
+ {\OTRSETsetgridcell\!!counta\recurselevel\copy\placeholderboxe}}%
+ \fi
+ \fi
+ \fi}
+
+\def\balancingcolumnmaxcells#1%
+ {\ifcsname\??mc\currentcolumnset\number#1\c!regels\endcsname
+ \csname\??mc\currentcolumnset\number#1\c!regels\endcsname
+ \else\ifcsname\??mc\currentcolumnset\c!regels\endcsname
+ \csname\??mc\currentcolumnset\c!regels\endcsname
+ \else
+ \savedcolumnmaxcells
+ \fi\fi}
+
+\def\OTRSETsetmanualbalance
+ {\doglobal\addtocommalist{\realfolio}\OTRSETbalancinglist}
+
+\def\OTRSETgetmanualbalance
+ {\gettwopassdata\s!colset
+ \iftwopassdatafound
+ \global\let\balancingpageno\twopassdata
+ \else
+ \doglobal\newcounter\balancingpageno
+ \fi
+ \global\balancingcolumnsfalse}
+
+
+\def\OTRSETnobalance
+ {\iflastcolumnfootnotes % testen ! optie
+ % inhibit flush of floats !
+ \dostepwiserecurse{\mofcolumns}{\nofcolumns}{1}
+ {\vskip-\lineheight\vbox{\strut}\vfill\eject}%
+ \else
+ \ifdim\pagetotal>\zeropoint
+ \vfill \eject \OTRSETdofinalflush
+ \fi
+ \fi}
+
+\def\OTRSETgotonextpage%
+ {\doifsomething{\OTRSETlist}
+ {\getfromcommacommand[\OTRSETlist][1]%
+ \global\let\OTRSETidentifier\commalistelement
+ \let\newcommalistelement\empty
+ \doglobal\replaceincommalist\OTRSETlist1%
+ \OTRSETrestart}}
+
+\def\OTRSETrestart% % weed
+ {\OTRSETinitializefeatures
+ \OTRSETflushpreposttext
+ \OTRSETinitializecolumns
+ \OTRSETcheckinsert
+ \OTRSETcheckgrid
+ \OTRSETsetvsize
+ \OTRSETsethsize
+ \OTRSETsetplaceholders
+ \OTRSEThandlepreposttext
+ \OTRSETsetvsize}
+
+\OTRSEToutput
+ {\OTRSETnaturalflush
+% \OTRSETgotonextpage
+ \OTRSETcheckfreelines
+ \OTRSETchecksidefloat}
+
+\def\OTRSETinitializefeatures%
+ {% number of lines
+ \getnoflines\teksthoogte\xdef\columnmaxcells{\the\noflines}
+ % direction
+ \doifelsevalue{\??mc\OTRSETidentifier\c!richting}{\v!rechts}
+ {\chardef\columndirection=0}
+ {\chardef\columndirection=1}
+ % balancing
+ \doifelsevalue{\??mc\OTRSETidentifier\c!balanceren}{\v!ja}
+ {\balancecolumnstrue}
+ {\balancecolumnsfalse}}
+
+\installoutput\OTRSETflushpreposttext
+ {\global\setbox\precolumnbox=\vbox{\unvbox\normalpagebox}%
+ \ifcarryoverfootnotes \else
+ \global\setbox\postcolumnbox=\vbox{\placefootnotes}%
+ \fi}
+
+\def\OTRSEThandlepreposttext%
+ {\getnoflines{\ht\precolumnbox}
+ \doOTRSETsetgridcells
+ {\copy\placeholderboxe}
+ 11\nofcolumns\noflines
+ {\box\precolumnbox}
+ \getnoflines{\ht\postcolumnbox}
+ \advance\columnfreecells -\noflines
+ \advance\columnfreecells 1
+ \doOTRSETsetgridcells
+ {\copy\placeholderboxe}
+ 1\columnfreecells\nofcolumns\noflines
+ {\box\postcolumnbox}}
+
+\def\OTRSETchecksidefloat%
+ {} % {\sidefloatoutput}
+
+\def\OTRSETfinalsidefloatoutput%
+ {}
+
+\def\OTRSETcheckgrid%
+ {\topskip=1\topskip
+ \ifforcecolumngrid
+ \widowpenalty=0
+ \clubpenalty=0
+ \brokenpenalty=0
+ \fi}
+
+\def\OTRSETcheckinsert%
+ {\iflastcolumnfootnotes
+ \ifnum\nofcolumns=\mofcolumns
+ \OTRSETforceinserts
+ \else
+ \OTRSETinhibitinserts
+ \fi
+ \else
+ \OTRSETforceinserts
+ \fi}
+
+\def\OTRSETforceinserts%
+ {\global\count\footins=1000
+ \global\skip\footins=1\baselineskip\relax}% plus 4\baselineskip\relax }
+
+\def\OTRSETinhibitinserts%
+ {\global\count\footins=0
+ \global\skip\footins=\!!zeropoint}
+
+% interface to footnotes
+
+%\def\OTRSETassignwidth#1\to#2%
+% {\doifelsevalue{\??mc#1\c!breedte}{\v!passend}
+% {#2=\zetbreedte
+% \scratchcounter=\getvalue{\??mc#1\c!nlinks}\relax
+%\ifnum\getvalue{\??mc#1\c!nrechts}>\scratchcounter
+% \scratchcounter=\getvalue{\??mc#1\c!nrechts}%
+%\fi
+% \dorecurse{\scratchcounter}
+% {\advance#2 -\getvalue{\??mc#1\recurselevel\c!afstand}}%
+% \divide#2 \scratchcounter}
+% {#2=\getvalue{\??mc#1\c!breedte}}}
+
+%\def\OTRSETassignwidth#1\to#2% assumes mofcolumns
+% {\doifelsevalue{\??mc#1\number\mofcolumns\c!breedte}{\v!passend}
+% {#2=\zetbreedte
+% \scratchcounter=0
+% \dorecurse{\getvalue{\??mc#1\c!n}}
+% {\doifelsevalue{\??mc#1\number\recurselevel\c!breedte}{\v!passend}
+% {\advance\scratchcounter by 1 }
+% {\advance#2 by -\getvalue{\??mc#1\recurselevel\c!breedte}}%
+% \advance#2 by -\getvalue{\??mc#1\recurselevel\c!afstand}}%
+% \divide#2 by \scratchcounter}
+% {#2=\getvalue{\??mc#1\number\mofcolumns\c!breedte}}}
+%
+% replaced by
+%
+%\def\OTRSETassignwidth#1\to#2% assumes mofcolumns
+% {#2=\OTRSETlocalwidth\mofcolumns}
+
+\def\OTRSETassignwidths%
+ {\scratchdimen=\zetbreedte
+ \scratchcounter=0
+ \dorecurse\nofcolumns
+ {\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}{\v!passend}
+ {\advance\scratchcounter by 1 }
+ {\advance\scratchdimen by -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}}%
+ \advance\scratchdimen by -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!afstand}}%
+ \divide\scratchdimen by \scratchcounter
+ \dorecurse\nofcolumns
+ {\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}{\v!passend}
+ {\dimen0=\scratchdimen}
+ {\dimen0=\getvalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}}%
+ \setxvalue{\??mc\recurselevel\??mc\c!breedte}{\the\dimen0}}}
+
+\def\OTRSETlocalwidth#1%
+ {\getvalue{\??mc\number#1\??mc\c!breedte}}
+
+\def\OTRSETsetfootnotehsize%
+ {%\ifcarryoverfootnotes
+ % \doifdefinedelse{\??mc\@@vnbreedte\c!n} % inherits from columnset
+ % {\OTRSETassignwidth\@@vnbreedte\to\hsize}
+ % {\hsize\@@vnbreedte}%
+ }%\fi}
+
+\newbox\placeholderboxa
+\newbox\placeholderboxb
+\newbox\placeholderboxc
+\newbox\placeholderboxd
+\newbox\placeholderboxe
+\newbox\placeholderboxf
+
+\def\columnplaceholder#1#2%
+ {\hbox
+ {\localcolortrue
+ \setbox\scratchbox\hbox to \hsize
+ {\iftracecolumnset
+ #2\hskip-.5ex\vrule\!!width1ex\!!height.5ex\!!depth.5ex\hss
+ \fi
+ \hss}%
+ \ifcase#1\relax
+ \ht\scratchbox\!!zeropoint
+ \dp\scratchbox\!!zeropoint
+ \wd\scratchbox\!!zeropoint
+ \else
+ \wd\scratchbox\hsize
+ \ht\scratchbox\ht\strutbox
+ \dp\scratchbox\dp\strutbox
+ \fi
+ \box\scratchbox}}
+
+\def\OTRSETsetplaceholders%
+ {\global\setbox\placeholderboxa\columnplaceholder0\cyan
+ \global\setbox\placeholderboxb\columnplaceholder0\green
+ \global\setbox\placeholderboxc\columnplaceholder0\blue
+ \global\setbox\placeholderboxd\columnplaceholder0\red
+ \global\setbox\placeholderboxe\columnplaceholder0\magenta
+ \global\setbox\placeholderboxf\columnplaceholder1\darkgray}
+
+\def\OTRSETshowstatus
+ {\iftracecolumnset
+ \llap{\tt\tfxx\blue(\number\columnfirstcell\#\number\columnfreecells)}%
+ \fi}
+
+\appendtoks \OTRSETshowstatus \to \everypar
+
+% page contents
+
+\def\OTRSETdopagecontents#1#2% takes two args: \box<n> \unvbox<n>
+ {\vbox to \teksthoogte
+ {\forgetall#1#2\pushcolor}}
+
+\def\OTRSETsomepagefloat {\def\floatmethod{PAGE}\OTRSETsomeslotfloat} % check
+\def\OTRSETsomeherefloat {\def\floatmethod{HERE}\OTRSETsomeslotfloat} % check
+\def\OTRSETsomeelsefloat {\def\floatmethod{HERE}\OTRSETsomeslotfloat} % check
+\def\OTRSETsometopfloat {\def\floatmethod{TOPS}\OTRSETsomeslotfloat} % check
+\def\OTRSETsomebottomfloat{\def\floatmethod{BOTS}\OTRSETsomeslotfloat} % check
+
+\def\OTRONEsomeslotfloat {\let\floatmethod\v!hier\OTRONEsomeelsefloat}
+
+\def\OTRSETflushfloatbox% nog verder doorvoeren en meer info in marge
+ {\iftestfloatbox\ruledhbox\fi{\box\floatbox}}
+
+\def\OTRSETsomeslotfloat[#1]%
+ {\setbox\floatbox=\vbox{\flushfloatbox}%
+ \dp\floatbox=\dp\strutbox
+ \@EA\uppercasestring\floatmethod\to\floatmethod
+ \OTRSETstoreincolumnslot\floatmethod\floatbox
+ \doinsertfloatinfo}
+
+% \def\definecolumnsetarea%
+% {\doquadrupleempty\dodefinecolumnsetarea}
+%
+% \def\dodefinecolumnsetarea[#1][#2][#3][#4]% test top n source
+% {\ifsecondargument
+% \doifundefinedelse{#4box}
+% {\@EA\newbox\csname#4box\endcsname}
+% {\@EA\setbox\csname#4box\endcsname=\box\voidb@x}%
+% \setvalue{\??mc#1#2\v!tekst#3}{\OTRSETflusharea{#1}{#2}{#3}}%
+% \setxvalue{#1#2#3source}{#4}%
+% \setgvalue{#4setup}%
+% {\OTRSETassignwidth#1\to\tekstbreedte
+% \getcolumnsettextssize[#1][#2][#3]}%
+% \fi}
+%
+% \def\startcolumnsetarea[#1]%
+% {\doifdefinedelse{#1box}
+% {\scratchcounter=\getvalue{#1box}%
+% \global\setbox\scratchcounter=\vbox\bgroup
+% \unvbox\scratchcounter
+% \getvalue{#1setup}
+% \hsize\OTRSETtextswidth}
+% {\setbox\scratchbox=\vbox\bgroup}}
+%
+% \def\stopcolumnsetarea%
+% {\endgraf
+% \vfill
+% \egroup}
+%
+% \def\OTRSETflusharea#1#2#3%
+% {\doifdefined{#1#2#3source}
+% {\scratchcounter=\getvalue{\getvalue{#1#2#3source}box}\relax
+% \ifvoid\scratchcounter\else
+% \ifdim\ht\scratchcounter>\vsize
+% \setbox\scratchbox=\vsplit\scratchcounter to \vsize
+% \unvbox\scratchbox
+% \else
+% \unvbox\scratchcounter
+% \fi
+% \fi}}
+
+% set ipv text
+
+% left right 1 2 3 +1 +2 +3
+
+\let\columnleftareas \empty
+\let\columnrightareas\empty
+
+% links rechts => odd, even, n, named
+
+\def\definecolumntextarea%
+ {\dotripleempty\dodefinecolumntextarea}
+
+\def\dodefinecolumntextarea[#1][#2][#3]%
+ {\ifthirdargument
+ \doifelse{#2}{\v!beide}
+ {\definecolumntextarea[#1][\v!links ][#3]%
+ \definecolumntextarea[#1][\v!rechts][#3]}
+ {\presetlocalframed
+ [\??mt#1#2]%
+ \processaction[#2]
+ [ \v!links=>\addtocommalist{#1}\columnleftareas,
+ \v!rechts=>\addtocommalist{#1}\columnrightareas]%
+ \getparameters[\??mt#1#2]
+ [\c!x=1,\c!y=1,\c!nx=1,\c!ny=1,
+ \c!offset=\v!overlay,\c!strut=\v!nee,\c!kader=\v!uit,
+ \c!status=\v!stop,#3]}%
+ \else
+ \definecolumntextarea[#1][\v!beide][#2]%
+ \fi}
+
+\def\setupcolumntextarea%
+ {\dotripleempty\dosetupcolumntextarea}
+
+\def\dosetupcolumntextarea[#1][#2]%
+ {\getparameters[\??mt#1#2]}
+
+\def\doinitializecolumntextareas#1#2%
+ {\def\docommando##1%
+ {\doifvalue{\??mt##1#2\c!status}{\v!start}
+ {\doOTRSETsetgridcells
+ {\copy\placeholderboxd}
+ {\getvalue{\??mt##1#2\c!x }}{\getvalue{\??mt##1#2\c!y }}
+ {\getvalue{\??mt##1#2\c!nx}}{\getvalue{\??mt##1#2\c!ny}}
+ {\copy\placeholderboxd}}}%
+ \processcommacommand[#1]\docommando}
+
+\def\initializecolumntextareas%
+ {\ifodd\realpageno
+ \doinitializecolumntextareas\columnrightareas\v!rechts
+ \else
+ \doinitializecolumntextareas\columnleftareas\v!links
+ \fi}
+
+\def\doplacecolumntextareas#1#2%
+ {\bgroup
+ \forgetall
+ \def\docommando##1%
+ {\doifvalue{\??mt##1#2\c!status}{\v!start}
+ {\!!counta=\getvalue{\??mt##1#2\c!x}%
+ \!!countb=\getvalue{\??mt##1#2\c!nx}%
+ \!!widtha=\!!countb\hsize
+ \!!heighta=\getvalue{\??mt##1#2\c!ny}\lineheight
+ \advance\!!countb \!!counta \advance\!!countb -1 \relax
+ \ifnum\!!countb>\nofcolumns
+ \!!countc=\!!countb
+ \advance\!!countc -\nofcolumns
+ \!!countb=\nofcolumns
+ \else
+ \!!countc=0
+ \fi
+ \advance\!!counta 1
+ \dostepwiserecurse{\!!counta}{\!!countb}{1}
+ {\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}%
+ \!!widthc=\!!widtha
+ \advance\!!widthc -\!!countc\hsize
+\!!widthb=\!!widthc
+ \ifodd\realpageno \else
+ \ifcase\!!countc\else
+ \advance\!!widtha 2\rugwit
+ \advance\!!widthc \rugwit
+ \dorecurse{\!!countc}
+ {\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}%
+ \fi
+ \fi
+% option
+\advance\!!heighta -\lineheight
+ \setbox\scratchbox=\vbox
+ {\localframed
+ [\??mt##1#2]
+ [\c!breedte=\!!widtha,\c!hoogte=\!!heighta]
+ {\getvalue{\??mt##1#2}}}%
+ \!!counta=\getvalue{\??mt##1#2\c!x}%
+ \!!countb=\getvalue{\??mt##1#2\c!y}%
+ \advance\!!countb \getvalue{\??mt##1#2\c!ny}%
+ \advance\!!countb -1
+ \OTRSETsetgridcell
+ {\!!counta}{\!!countb}
+ \hbox{\clip
+ [\c!breedte=\!!widthc,\c!hoogte=\!!heighta]
+ {\copy\scratchbox}}%
+ \ifcase\!!countc\else
+ \advance\!!counta \getvalue{\??mt##1#2\c!nx}%
+ \advance\!!counta -\!!countc
+ \advance\!!widtha -\!!widthc
+ \OTRSETsetgridcell
+ {\!!counta}{\!!countb}
+ \hbox{\hskip-\rugwit
+ \clip
+ [\c!breedte=\!!widtha,\c!hoogte=\!!heighta,
+ \c!hoffset=\!!widthc]
+ {\copy\scratchbox}}%
+ \fi}}%
+ \processcommacommand[#1]\docommando
+ \egroup}
+
+\def\placecolumntextareas%
+ {\ifodd\realpageno
+ \doplacecolumntextareas\columnrightareas\v!rechts
+ \else
+ \doplacecolumntextareas\columnleftareas\v!links
+ \fi}
+
+\def\setupcolumntextareatext%
+ {\dotripleempty\dosetupcolumntextareatext}
+
+\def\dosetupcolumntextareatext[#1][#2][#3]%
+ {\setvalue{\??mt#1#2}{#3}}
+
+\protect \endinput
diff --git a/tex/context/base/page-sid.tex b/tex/context/base/page-sid.tex
new file mode 100644
index 000000000..f50356b29
--- /dev/null
+++ b/tex/context/base/page-sid.tex
@@ -0,0 +1,341 @@
+%D \module
+%D [ file=page-sid,
+%D version=2000.10.20,
+%D title=\CONTEXT\ OTR Macros,
+%D subtitle=Side Floats,
+%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 OTR Macros / Side Floats}
+
+\unprotect
+
+% De onderstaande macro's ondersteunen het zetten van tekst
+% rond figuren. De macro's zijn ontworpen door Daniel Comenetz
+% en gepubliceerd in TUGBoat Volume 14 (1993), No. 1: Anchored
+% Figures at Either Margin. De macro's zijn slechts op enkele
+% punten door mij aangepast.
+
+% afhankelijke variabelen
+%
+% \overgap vervangen door \floatsidetopskip
+% \sidegap vervangen door \floatsideskip
+% \undergap vervangen door \floatsidebottomskip
+%
+% \prskp vervangen door \tussenwit
+
+% toegevoegde macro's/aanroepen
+%
+% \logsidefloat : loginformatie
+% \flushsidefloats : nodig voor koppen
+
+% recente wijzigingen:
+%
+% namen aangepast: \float... enz. i.p.v. \pic
+
+% Pas op: \EveryPar{\EveryPar{}\margetitel{whatever}}
+% \plaatsfiguur[links]{}{} moet goed gaan. In dat geval
+% begint de tekst terecht wat lager.
+
+\newdimen\sidefloatheight % includes the topskip
+\newdimen\sidefloatwidth
+\newdimen\sidefloathsize
+\newdimen\sidefloatvsize \def\nofloatvsize{-1pt }
+
+\newbox\floatbottom
+
+\newif\ifrightfloat
+\newif\ifmarginfloat
+\newif\ifroomforfloat
+\newif\iffloatshort
+\newif\iffloatflag
+\newif\iffloatrighteqo
+\newif\iffloatlefteqo
+
+\let\floatrighteqo=\eqno
+\let\floatleftleqo=\leqno
+
+% Watch it even more! In inner, gaat't mis omdat daar
+% pagetotal enz niet zijn aangepast. Inner kan overigens niet
+% betrouwbaar worden getest!
+
+\def\flushsidefloats%
+ {\par
+ \!!heighta=\sidefloatvsize
+ \advance\!!heighta by -\pagetotal
+ \ifdim\!!heighta>\!!zeropoint
+ \witruimte % nog checken op interferentie
+ \kern\!!heighta
+ \fi
+ \global\sidefloatvsize=\nofloatvsize
+ \global\floatflagfalse}
+
+\def\flushsidefloatsafterpar%
+ {\xdef\oldpagetotal{\the\pagetotal}%
+ \gdef\checksidefloat%
+ {\dochecksidefloat
+ \ifdim\oldpagetotal=\pagetotal \else
+ \xdef\checksidefloat{\dochecksidefloat}%
+ \flushsidefloats
+ \fi}}
+
+\def\forgetsidefloats%
+ {\global\sidefloatvsize=\nofloatvsize
+ \global\floatflagfalse}
+
+\let\logsidefloat=\relax
+
+\def\pushpenalties%
+ {\widowpenalty=1
+ \clubpenalty=2
+ \brokenpenalty=1
+ \let\pushpenalties=\relax
+ \edef\poppenalties%
+ {\widowpenalty=\the\widowpenalty
+ \clubpenalty=\the\clubpenalty
+ \brokenpenalty=\the\brokenpenalty}}
+
+\let\poppenalties=\relax
+
+\def\restorepenalties%
+ {\ifnum\outputpenalty=\!!tenthousand\relax
+ \else
+ \penalty\outputpenalty
+ \fi}
+
+\def\sidefloatoutput%
+ {\iffloatshort
+ \unvbox\normalpagebox
+ \setbox\floatbottom=\lastbox
+ \ifdim\wd\floatbottom>\sidefloathsize
+ \penalty-201
+ \box\floatbottom
+ \else
+ \ifvoid\floatbottom
+ \else
+ \restoreleftindent
+ \ifdim\wd\floatbottom<\sidefloathsize
+ \parskip=\!!zeropoint
+ %\noindent
+ \vadjust{\penalty-1}%
+ \iffloatlefteqo
+ \global\floatlefteqofalse
+ \else
+ \global\advance\sidefloathsize by -\wd\floatbottom
+ \iffloatrighteqo
+ \global\floatrighteqofalse
+ \else
+ \global\divide\sidefloathsize by 2
+ \fi
+ \hskip\sidefloathsize
+ \fi
+ \fi
+ \box\floatbottom
+ \restorepenalties
+ \fi
+ \fi
+ \global\holdinginserts=0
+ \global\floatshortfalse
+ \else
+ \finalsidefloatoutput % new
+ \global\sidefloatvsize=\nofloatvsize
+ \poppenalties
+ \fi}
+
+\def\finalsidefloatoutput% new
+ {\finaloutput\unvbox\normalpagebox}
+
+\def\restoreleftindent%
+ {\ifrightfloat \else
+ \parskip=\!!zeropoint
+ \noindent
+ \vadjust{\penalty-1}%
+ \hskip\sidefloatwidth
+ \fi}
+
+\def\eqno%
+ {\iffloatshort
+ \global\floatrighteqotrue
+ \fi
+ \floatrighteqo}
+
+\def\leftmarginfloat#1%
+ {\global\rightfloatfalse\marginfloattrue\putsidefloat{#1}}
+
+\def\rightmarginfloat#1%
+ {\global\rightfloattrue\marginfloattrue\putsidefloat{#1}}
+
+\def\leftfloat#1%
+ {\global\rightfloatfalse\marginfloatfalse\putsidefloat{#1}}
+
+\def\rightfloat#1%
+ {\global\rightfloattrue\marginfloatfalse\putsidefloat{#1}}
+
+\def\putsidefloat#1%
+ {\par
+ \witruimte
+ \previoussidefloat
+ \stallsidefloat
+ \setbox\floatbox=\hbox{\vbox % pretty ugly, will be rewritten
+ {\vskip\ifmarginfloat-\sidefloattopskip\else\sidefloattopoffset\fi#1}}
+ \measuresidefloat
+ \ifroomforfloat \else
+ \tosssidefloat
+ \measuresidefloat
+ \stallsidefloat
+ \fi
+ \setsidefloat}
+
+\def\progresssidefloat%
+ {\!!heighta=\sidefloatvsize
+ \iffloatflag
+ \advance\!!heighta by -\dimen3
+ \global\floatflagfalse
+ \else
+ \advance\!!heighta by -\pagetotal
+ \fi}
+
+\def\tosssidefloat%
+ {\vfill\eject}
+
+\def\measuresidefloat%
+ {\global\floatflagtrue
+ \dimen3=\pagetotal % global
+ \ifmarginfloat
+ \global\sidefloatwidth=\!!zeropoint
+ \else
+ \global\sidefloatwidth=\wd\floatbox
+ \global\advance\sidefloatwidth by \floatsideskip
+ \fi
+ \global\sidefloathsize=\hsize
+ \global\advance\sidefloathsize by -\sidefloatwidth
+ \global\sidefloatheight=\ht\floatbox
+ \global\advance\sidefloatheight by \dp\floatbox
+ \global\advance\sidefloatheight by \sidefloattopskip
+ \global\sidefloatvsize=\sidefloatheight
+ \global\advance\sidefloatvsize by \dimen3
+ \dimen0=\sidefloatvsize
+ \ifdim\dimen0>.99\pagegoal \relax
+ \roomforfloatfalse
+ \else
+ \dimen0=\pagegoal
+ \advance\dimen0 by -\sidefloatvsize
+ \ifdim\dimen0<\sidefloatbottomskip
+ \global\advance\sidefloatvsize by \dimen0
+ \global\floatshorttrue
+ \pushpenalties
+ \global\holdinginserts=1
+ \else
+ \global\advance\sidefloatvsize by \sidefloatbottomskip
+ \global\floatshortfalse
+ \fi
+ \roomforfloattrue
+ \fi}
+
+\def\setsidefloat% nilling everypar saves time and redudant pos's
+ {{\everypar\emptytoks\vbox{\strut}}\vskip-\lineheight
+ \kern\sidefloattopskip
+ \edef\presidefloatdepth{\the\prevdepth}%
+ \nointerlineskip
+ \bgroup
+ \everypar=\emptytoks
+ \parskip=\zeropoint
+ \logsidefloat
+ \ifrightfloat
+ \hfill
+ \ifmarginfloat
+ \rlap{\hskip\rechtermargeafstand\hskip\rightskip\unhbox\floatbox}%
+ \else
+ \unhbox\floatbox
+ \fi
+ \else
+ \noindent
+ \ifmarginfloat
+ \llap{\unhbox\floatbox\hskip\leftskip\hskip\linkermargeafstand}%
+ \else
+ \unhbox\floatbox
+ \fi
+ \hfill
+ \fi
+ \egroup
+ \par
+ \kern-\sidefloatheight
+ \penalty10001
+ \normalbaselines
+ \prevdepth=\presidefloatdepth
+ %\noindent
+ \resetsidefloatparagraph
+ \ignorespaces}
+
+\newcount\sidefloatparagraph
+
+\def\iffirstsidefloatparagraph%
+ {\ifnum\sidefloatparagraph=1 }
+
+\def\setsidefloatparagraph%
+ {\global\advance\sidefloatparagraph by 1 }
+
+\def\resetsidefloatparagraph%
+ {\global\sidefloatparagraph=0 }
+
+\def\dochecksidefloat%
+ {\progresssidefloat
+ \ifdim\!!heighta>\zeropoint
+% \advance\!!heighta by \sidefloatbottomskip
+% \!!counta=\!!heighta
+\scratchdimen=\!!heighta
+\advance\scratchdimen \ht\strutbox
+\!!counta=\scratchdimen
+ \divide\!!counta by \baselineskip
+ \ifnum\!!counta>0
+ \ifrightfloat
+ \hangindent=-\sidefloatwidth
+ \else
+ \hangindent=\sidefloatwidth
+ \fi
+ \hangafter=-\!!counta
+ \fi
+ \setsidefloatparagraph
+ \else
+ \resetsidefloatparagraph
+ \fi
+ \parskip=\tussenwit}
+
+\def\checksidefloat%
+ {\dochecksidefloat}
+
+\def\doadjustsidefloatdisplaylines%
+ {\par
+ \vskip-\parskip
+ \noindent
+ \ignorespaces}
+
+\def\adjustsidefloatdisplaylines%
+ {\aftergroup\doadjustsidefloatdisplaylines}
+
+\def\previoussidefloat%
+ {\progresssidefloat
+ \ifdim\!!heighta>\!!zeropoint \relax
+ \iffloatshort
+ \global\floatshortfalse
+ \tosssidefloat
+ \else
+ \kern\!!heighta
+ \fi
+ \fi}
+
+\def\stallsidefloat%
+ {\!!counta=\pageshrink
+ \divide\!!counta by \baselineskip
+ \advance\!!counta by 1
+ \parskip=\!!zeropoint
+ \dorecurse{\!!counta}{\line{}}
+ \kern-\!!counta\baselineskip
+ \penalty0 }
+
+\protect \endinput
diff --git a/tex/context/base/page-txt.tex b/tex/context/base/page-txt.tex
new file mode 100644
index 000000000..52e118958
--- /dev/null
+++ b/tex/context/base/page-txt.tex
@@ -0,0 +1,624 @@
+%D \module
+%D [ file=page-txt, % copied from main-001,
+%D version=1997.03.31,
+%D title=\CONTEXT\ Page Macros,
+%D subtitle=Texts,
+%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.
+
+% \setuplayouttext in manual
+
+\writestatus{loading}{Context Page Macros / Texts}
+
+\unprotect
+
+\let\dodummypageskip\gobbleoneargument % obsolete
+
+%D Interfainge between this and other modules is handled by
+%D the following macros. The current state of a text line
+%D (header, footer, etc.) is checked by:
+%D
+%D \starttypen
+%D \resetlayoutlines
+%D \stoptypen
+%D
+%D The main text box is finished by the following macro:
+%D
+%D \starttypen
+%D \getmainbox <box> <\vbox|\unvbox>
+%D \stoptypen
+%D
+%D The text lines are collected with:
+%D
+%D \starttypen
+%D \gettextboxes
+%D \stoptypen
+%D
+%D It is possible to extens the default content of the text
+%D areas by appending content to the following token list
+%D registers:
+
+\newtoks\toptextcontent \newtoks\leftedgetextcontent
+\newtoks\headertextcontent \newtoks\leftmargintextcontent
+\newtoks\footertextcontent \newtoks\rightmargintextcontent
+\newtoks\bottomtextcontent \newtoks\rightedgetextcontent
+
+\newtoks\texttextcontent
+
+%D \macros
+%D {setuptop, setupheader, setuptext,
+%D setupfooter, setupbottom}
+%D
+%D The macros in this module sometimes look a bit more complicated
+%D than needed, which is a direct result of the fact that their
+%D ancestors are quite old and upward compatibility is a must.
+%D
+%D \showsetup{\y!setuptop}
+%D \showsetup{\y!setupheader}
+%D \showsetup{\y!setuptext}
+%D \showsetup{\y!setupfooter}
+%D \showsetup{\y!setupbottom}
+
+\def\setuplayouttext%
+ {\dotripleempty\dosetuplayouttext}
+
+\def\dosetuplayouttext[#1][#2][#3]%
+ {\ifthirdargument
+ \getparameters[\??tk#1#2][#3]%
+ \else
+ \getparameters[\??tk#1\v!tekst][#2]%
+ \fi
+ \calculatevsizes}
+
+\def\setuptop {\dotripleempty\dosetuplayouttext[\v!boven]}
+\def\setupheader {\dotripleempty\dosetuplayouttext[\v!hoofd]}
+\def\setuptext {\dotripleempty\dosetuplayouttext[\v!tekst]}
+\def\setupfooter {\dotripleempty\dosetuplayouttext[\v!voet]}
+\def\setupbottom {\dotripleempty\dosetuplayouttext[\v!onder]}
+
+%D \macros
+%D {noheaderandfooterlines,notopandbottomlines}
+%D
+%D Although not really needed, the following shortcuts
+%D sometimes come in handy.
+%D
+%D \showsetup{\y!noheaderandfooterlines}
+%D \showsetup{\y!notopandbottomlines}
+
+\def\noheaderandfooterlines%
+ {\setupheader[\c!status=\v!leeg]%
+ \setupfooter[\c!status=\v!leeg]}
+
+\def\notopandbottomlines%
+ {\setuptop [\c!status=\v!leeg]%
+ \setupbottom[\c!status=\v!leeg]}
+
+%D \macros
+%D {setuptoptexts, setupheadertexts, setuptexttexts,
+%D setupfootertexts, setupbottomtexts}
+%D
+%D The next macros take one or more arguments. The exact setup
+%D depends on the number of arguments. Although not that
+%D intuitive, the current scheme evolved out of the original.
+%D When margin and edge texts as well as middle texts showed
+%D up, the current odd|/|even scheme surfaced.
+%D
+%D \showsetup{\y!setuptoptexts}
+%D \showsetup{\y!setupheadertexts}
+%D \showsetup{\y!setuptexttexts}
+%D \showsetup{\y!setupfootertexts}
+%D \showsetup{\y!setupbottomtexts}
+
+\def\setuptoptexts {\dosixtupleempty\dosetuptexts[\v!boven]}
+\def\setupheadertexts {\dosixtupleempty\dosetuptexts[\v!hoofd]}
+\def\setuptexttexts {\dosixtupleempty\dosetuptexts[\v!tekst]}
+\def\setupfootertexts {\dosixtupleempty\dosetuptexts[\v!voet ]}
+\def\setupbottomtexts {\dosixtupleempty\dosetuptexts[\v!onder]}
+
+%D The left, right and center variables can also be set
+%D directly using the previously discussed macros.
+
+\def\dosetuptexts[#1][#2][#3][#4][#5][#6]%
+ {\ifsixthargument
+ \setvalue{\??tk#1#2\c!linkertekst}%
+ {\dodoubletexts{\??tk#1}{#2}
+ {\c!linkerletter \c!linkerkleur \c!linkerbreedte }{#3}
+ {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#6}}%
+ \setvalue{\??tk#1#2\c!rechtertekst}%
+ {\dodoubletexts{\??tk#1}{#2}
+ {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#4}
+ {\c!linkerletter \c!linkerkleur \c!linkerbreedte }{#5}}%
+ \else\iffifthargument
+ \setvalue{\??tk#1\v!tekst\c!linkertekst}%
+ {\dodoubletexts{\??tk#1}\v!tekst
+ {\c!linkerletter \c!linkerkleur \c!linkerbreedte }{#2}
+ {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#5}}%
+ \setvalue{\??tk#1\v!tekst\c!rechtertekst}%
+ {\dodoubletexts{\??tk#1}\v!tekst
+ {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#3}
+ {\c!linkerletter \c!linkerkleur \c!linkerbreedte }{#4}}%
+ \else\iffourthargument
+ \setvalue{\??tk#1#2\c!linkertekst}%
+ {\dodoubletexts{\??tk#1}{#2}
+ {\c!linkerletter\c!linkerkleur\c!linkerbreedte}{#3}
+ {\c!linkerletter\c!linkerkleur\c!linkerbreedte}{#3}}%
+ \setvalue{\??tk#1#2\c!rechtertekst}%
+ {\dodoubletexts{\??tk#1}{#2}
+ {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#4}
+ {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#4}}%
+ \else\ifthirdargument
+ \setvalue{\??tk#1\v!tekst\c!linkertekst}%
+ {\dodoubletexts{\??tk#1}\v!tekst
+ {\c!linkerletter\c!linkerkleur\c!linkerbreedte}{#2}
+ {\c!linkerletter\c!linkerkleur\c!linkerbreedte}{#2}}%
+ \setvalue{\??tk#1\v!tekst\c!rechtertekst}%
+ {\dodoubletexts{\??tk#1}\v!tekst
+ {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#3}
+ {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#3}}%
+ \else\ifsecondargument % new
+ \letvalue{\??tk#1\v!tekst\c!linkertekst }\empty
+ \letvalue{\??tk#1\v!tekst\c!rechtertekst}\empty
+ \setvalue{\??tk#1\v!tekst\c!middentekst }%
+ {\dosingletexts{\??tk#1}\v!tekst\c!letter\c!kleur\c!breedte{#2}}%
+ \else
+ \dosixtupleempty\dosetuptexts[#1][\v!tekst][][][][]%
+ \dosixtupleempty\dosetuptexts[#1][\v!marge][][][][]%
+ \dosixtupleempty\dosetuptexts[#1][\v!rand ][][][][]%
+ \fi\fi\fi\fi\fi}
+
+%D Left and right texts are swapped on odd and even pages, but
+%D only when double sided typesetting is enabled.
+
+\def\dodoubletexts#1#2#3#4#5#6%
+ {\doifonevenpaginaelse
+ {\dosingletexts{#1}{#2}#3{#4}} % #3 => provides three arguments
+ {\dosingletexts{#1}{#2}#5{#6}}} % #5 => provides three arguments
+
+%D The next macro will be cleaned up amd made less messy and
+%D dependent.
+
+\def\dosingletexts#1#2#3#4#5#6%
+ {\bgroup
+ \convertargument#6\to\ascii
+ \doifsomething{\ascii}
+ {\doattributes{#1#2}#3#4%
+ {\doifvalue{#1\v!tekst\c!strut}{\v!ja}{\setstrut\strut}% here!
+ \doifdefinedelse{\??mk\ascii\c!koppeling} % brrr
+ {\dolimitatetexts{#1#2#5}{\haalmarkering[\ascii][\v!eerste]}}
+ {\ConvertConstantAfter\doifelse{\v!paginanummer}{#6}
+ {\@@plaatspaginanummer}
+ {\ConvertConstantAfter\doifelse{\v!datum}{#6}
+ {\currentdate} % #6{}{}{} -> {} needed for lookahead macros, like \uniqueMPgraphic
+ {\opeenregel\dolimitatetexts{#1#2#5}{#6{}{}{}}}}}}}%
+ \egroup}
+
+%D When specified, the texts are automatically limited in
+%D length.
+
+\def\dolimitatetexts#1#2%
+ {\doifelsevaluenothing{#1}{#2}{\limitatetext{#2}{\getvalue{#1}}{...}}}
+
+%D The placement of text is hooked into the token lists
+%D associated to the area at hand.
+
+\appendtoks \placelayouttextline\v!boven\bovenhoogte \to \toptextcontent
+\appendtoks \placelayouttextline\v!hoofd\hoofdhoogte \to \headertextcontent
+\appendtoks \placelayouttextline\v!tekst\teksthoogte \to \texttextcontent
+\appendtoks \placelayouttextline\v!voet \voethoogte \to \footertextcontent
+\appendtoks \placelayouttextline\v!onder\onderhoogte \to \bottomtextcontent
+
+%D Texts can be disables, moved up and ignored, depending in
+%D the \type {status} variable. This is handled by the next
+%D couple of macros. They look less readable then the original
+%D implementation, but because they are expanded quite often,
+%D we will not use:
+%D
+%D \starttypen
+%D \def\plaatslayoutregel#1#2% % handelt o.b.v. tekst
+%D {\ExpandFirstAfter\processaction
+%D [\getvalue{\??tk#1\v!tekst\c!status}]
+%D [ \v!geen=>,
+%D ......
+%D \v!start=>...]}
+%D \stoptypen
+%D
+%D Instead we will map the values of status onto macro
+%D expansions.
+
+\def\placelayouttextline#1#2% % handelt o.b.v. tekst
+ {\edef\textlinestatus{\getvalue{\??tk#1\v!tekst\c!status}}%
+ \doifdefinedelse{\string\placelayouttextline\textlinestatus}
+ {\getvalue{\string\placelayouttextline\textlinestatus}{#1}{#2}}
+ {\getvalue{\string\placelayouttextline\s!unknown}{#1}{#2}}}
+
+\letvalue{\string\placelayouttextline\v!normaal}\doplacelayouttextline
+\letvalue{\string\placelayouttextline }\doplacelayouttextline
+\letvalue{\string\placelayouttextline\v!geen }\gobbletwoarguments
+\letvalue{\string\placelayouttextline\v!hoog }\gobbletwoarguments
+
+\setvalue{\string\placelayouttextline\v!leeg}#1#2%
+ {\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
+ \vskip#2\relax}
+
+\setvalue{\string\placelayouttextline\v!start}#1#2%
+ {\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
+ \doplacelayouttextline{#1}{#2}}
+
+\setvalue{\string\placelayouttextline\v!stop}#1#2%
+ {\vskip#2\relax}
+
+\setvalue{\string\placelayouttextline\v!geenmarkering}#1#2%
+ {\bgroup
+ \setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
+ \let\dohaalmarkering=\nohaalmarkering
+ \doplacelayouttextline{#1}{#2}%
+ \egroup}
+
+\setvalue{\string\placelayouttextline\s!unknown}#1#2%
+ {\bgroup % new
+ \setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}%
+ \setlocallayoutline{#1\textlinestatus}%
+ \setlocallayoutline{#1\v!tekst\textlinestatus}%
+ \setlocallayoutline{#1\v!marge\textlinestatus}%
+ \setlocallayoutline{#1\v!rand\textlinestatus}%
+ \doplacelayouttextline{#1}{#2}%
+ \egroup}
+
+\def\setlocallayoutline#1%
+ {\ifundefined{\??tk#1}\else\getvalue{\??tk#1}\fi}
+
+%D The following macro has to be called after a page
+%D is flushed.
+
+\def\resetlayoutline#1% beware: global assignment
+ {\doifvalue{\??tk#1\v!tekst\c!status}{\v!hoog}
+ {\setgvalue{\??tk#1\v!tekst\c!status}{\v!normaal}\donetrue}}
+
+\def\resetlayoutlines%
+ {\donefalse
+ \resetlayoutline\v!boven
+ \resetlayoutline\v!hoofd
+ \resetlayoutline\v!tekst
+ \resetlayoutline\v!voet
+ \resetlayoutline\v!onder
+ \ifdone
+ \doglobal\calculatevsizes
+ \recalculatebackgrounds
+ \recalculatelogos
+ \fi}
+
+%D The next series of macros is not that easy to read,
+%D because they hook into the main page building macros. By
+%D using token list registers for the text content, we can
+%D easily hook in other code, like menu generators.
+
+\newbox\scratchpagebox
+
+\def\gettextboxes%
+ {\setbox\scratchpagebox=\vbox
+ {\mindermeldingen
+ \calculatereducedvsizes
+ \swapmargins
+ \offinterlineskip
+ \vskip-\bovenhoogte
+ \vskip-\bovenafstand
+ \the\toptextcontent
+ \vskip\bovenhoogte
+ \vskip\bovenafstand
+ \the\headertextcontent
+ \vskip\hoofdhoogte
+ \vskip\hoofdafstand
+ \placepositionanchors
+ \vskip-\teksthoogte
+ \the\texttextcontent
+ \vskip\teksthoogte
+ \vskip\voetafstand
+ \the\footertextcontent
+ \vskip\voethoogte
+ \vskip\onderafstand
+ \the\bottomtextcontent
+ \vskip\onderhoogte
+ \vfilll}%
+ \smashbox\scratchpagebox
+ \box\scratchpagebox}
+
+\def\getmainbox#1#2%
+ {\setbox\scratchpagebox=\vbox
+ {\offinterlineskip % na \paginaletter !
+ \calculatereducedvsizes
+ \calculatehsizes
+ \swapmargins
+ \vskip\hoofdhoogte
+ \vskip\hoofdafstand
+ \hbox to \zetbreedte
+ {\bgroup
+ \swapmargins
+ \goleftonpage
+ \the\leftedgetextcontent
+ \hskip\linkerrandbreedte
+ \hskip\linkerrandafstand
+ \the\leftmargintextcontent
+ \hskip\linkermargebreedte
+ \hskip\linkermargeafstand
+ \egroup
+ \settextpagecontent\scratchpagebox{#1}{#2}%
+ \addtextbackground\scratchpagebox
+ \addtextgridlayer\scratchpagebox
+ \box\scratchpagebox
+ \bgroup
+ \hskip\rechtermargeafstand
+ \the\rightmargintextcontent
+ \hskip\rechtermargebreedte
+ \hskip\rechterrandafstand
+ \the\rightedgetextcontent
+ \hskip\rechterrandbreedte
+ \egroup
+ \hss}}%
+ \smashbox\scratchpagebox
+ \box\scratchpagebox}
+
+%D The main text area has to be combined with some additional
+%D (tracing) information.
+
+\def\settextpagecontent#1#2#3% #2 and #3 will disappear
+ {\setbox#1=\hbox to \zetbreedte
+ {\hss % so don't change this
+ \vbox to \teksthoogte
+ {\offinterlineskip
+ \freezetextwidth
+ \hsize=\tekstbreedte % local variant of \sethsize
+ \boxmaxdepth\maxdepth
+ \noindent % content can be < \hsize
+ \dopagecontents#2#3}%
+ \hss}%
+ \dp#1=\zeropoint}
+
+\def\addtextgridlayer#1%
+ {\ifshowgrid
+ \setgridbox\scratchbox\zetbreedte\teksthoogte
+ \setbox#1=\hbox
+ {\color[red]{\box\scratchbox}%
+ \hskip-\zetbreedte\box#1}%
+ \fi}
+
+%D The placement of a whole line is handled by the next two
+%D macros. These are hooked into the general purpose token
+%D list registers mentioned before.
+
+\def\ignoredlinebreak{\unskip\space\ignorespaces}
+
+\def\doplacelayouttextline#1#2%
+ {\ifdim#2>\zeropoint\relax % prevents pagenumbers when zero height
+ \goleftonpage
+ \hbox
+ {\setbox\scratchpagebox=\vbox to #2
+ {%\forgetall
+ \vsize#2\relax
+ \normalbaselines
+ \let\\\ignoredlinebreak
+ \let\crlf\ignoredlinebreak
+ \getvalue{\??tk#1\v!tekst\c!voor}%
+ \doifbothsidesoverruled
+ \dodoplacelayouttextline#1\c!linkertekst\c!middentekst\c!rechtertekst
+ \gobbleoneargument\getvalue
+ \orsideone
+ \dodoplacelayouttextline#1\c!linkertekst\c!middentekst\c!rechtertekst
+ \gobbleoneargument\getvalue
+ \orsidetwo
+ \dodoplacelayouttextline#1\c!rechtertekst\c!middentekst\c!linkertekst
+ \getvalue\gobbleoneargument
+ \od
+ \getvalue{\??tk#1\v!tekst\c!na}%
+ \kern\zeropoint}% keep the \dp, beware of \vtops, never change this!
+ \dp\scratchpagebox=\zeropoint
+ \box\scratchpagebox}%
+ \vskip-#2\relax
+ \fi}
+
+\def\dodoplacelayouttextline#1#2#3#4#5#6% \hsize toegevoegd
+ {\hbox % \hss's niet meer wijzigen
+ {\ifdim\linkerrandbreedte>\zeropoint
+ \hbox to \linkerrandbreedte
+ {\hsize\linkerrandbreedte
+ \hss\getvalue{\??tk#1\v!rand#2}}%
+ \hskip\linkerrandafstand
+ \fi
+ \ifdim\linkermargebreedte>\zeropoint
+ \hbox to \linkermargebreedte
+ {\hsize\linkermargebreedte
+ \hbox to \linkermargebreedte
+ {\hss\getvalue{\??tk#1\v!marge#2}}%
+ \hskip-\linkermargebreedte
+ \hbox to \linkermargebreedte
+ {\hss#5{\??tk#1\v!marge\c!margetekst}}}%
+ \hskip\linkermargeafstand
+ \fi
+ \ifdim\zetbreedte>\zeropoint
+ \hbox to \zetbreedte
+ {\hsize\zetbreedte
+ \hbox to \zetbreedte
+ {\@@nmpre{#5{\??tk#1\v!tekst\c!kantlijntekst}}%
+ \getvalue{\??tk#1\v!tekst#2}\hss}%
+ \hskip-\zetbreedte
+ \hbox to \zetbreedte
+ {\hss\getvalue{\??tk#1\v!tekst#3}\hss}%
+ \hskip-\zetbreedte
+ \hbox to \zetbreedte
+ {\hss\getvalue{\??tk#1\v!tekst#4}%
+ \@@nmpos{#6{\??tk#1\v!tekst\c!kantlijntekst}}}}%
+ \fi
+ \ifdim\rechtermargebreedte>\zeropoint
+ \hskip\rechtermargeafstand
+ \hbox to \rechtermargebreedte
+ {\hsize\rechtermargebreedte
+ \hbox to \rechtermargebreedte
+ {\getvalue{\??tk#1\v!marge#4}\hss}%
+ \hskip-\rechtermargebreedte
+ \hbox to \rechtermargebreedte
+ {#6{\??tk#1\v!marge\c!margetekst}\hss}}%
+ \fi
+ \ifdim\rechterrandbreedte>\zeropoint
+ \hskip\rechterrandafstand
+ \hbox to \rechterrandbreedte
+ {\hsize\rechterrandbreedte
+ \getvalue{\??tk#1\v!rand#4}\hss}%
+ \fi}}
+
+%D The next twosome will be done differently (using an
+%D existing auxiliary macro).
+
+\def\@@nmpre#1{\setbox0=\hbox{#1}\ifdim\wd0=\zeropoint\else\unhbox0\tfskip\fi}
+\def\@@nmpos#1{\setbox0=\hbox{#1}\ifdim\wd0=\zeropoint\else\tfskip\unhbox0\fi}
+
+%D This code will move to \type {page-flt.tex}.
+
+\appendtoks
+ \plaatsrechtermargeblok \hskip-\rechtermargebreedte
+\to \rightmargintextcontent
+
+\appendtoks
+ \plaatslinkermargeblok \hskip-\linkermargebreedte
+\to \leftmargintextcontent
+
+%D The next hook will later be used for keeping track of
+%D positions, i.e.\ it will provide a proper (page
+%D dependent) reference point.
+
+\ifx\undefined\placepositionanchors
+ \def\placepositionanchors{\vskip\teksthoogte}
+\fi
+
+%D \macros
+%D {definetext}
+%D
+%D Some macros ago, we implemented the \type {status} option
+%D \type {unknown}. This one is used to take care of
+%D symbolic texts handlers.
+%D
+%D \showsetup{\y!definetext}
+%D
+%D The next example demonstrates how we can use this
+%D mechanism to provide page (event) dependent text lines.
+%D
+%D \starttypen
+%D \definetext[hoofdstuk][voet][paginanummer]
+%D \stelkopin[hoofdstuk][hoofd=hoog,voet=hoofdstuk]
+%D \setupheadertexts[paginanummer]
+%D \setupfootertexts[links][rechts]
+%D \hoofdstuk{eerste} \dorecurse{20}{\input tufte \relax}
+%D \hoofdstuk{tweede} \dorecurse{20}{\input tufte \relax}
+%D \stoptypen
+
+\def\definetext%
+ {\doseventupleempty\dodefinetext}
+
+\def\dodefinetext[#1][#2][#3][#4][#5][#6][#7]%
+ {\ifseventhargument
+ \setvalue{\??tk#2#3#1}{\dosixtupleempty\dosetuptexts[#2][#3][#4][#5][#6][#7]}%
+ \else\ifsixthargument
+ \setvalue{\??tk #2#1}{\dosixtupleempty\dosetuptexts[#2][#3][#4][#5][#6]}%
+ \else\iffifthargument
+ \setvalue{\??tk#2#3#1}{\dosixtupleempty\dosetuptexts[#2][#3][#4][#5]}%
+ \else\iffourthargument
+ \setvalue{\??tk #2#1}{\dosixtupleempty\dosetuptexts[#2][#3][#4]}%
+ \else
+ \setvalue{\??tk #2#1}{\dosixtupleempty\dosetuptexts[#2][#3]}%
+ \fi\fi\fi\fi}
+
+%D The rest of this file is dedicated to setting up the
+%D texts. This code is not that impressive.
+
+\setupheadertexts [\v!tekst] [] []
+\setupheadertexts [\v!marge] [] []
+\setupheadertexts [\v!rand] [] []
+
+\setupfootertexts [\v!tekst] [] []
+\setupfootertexts [\v!marge] [] []
+\setupfootertexts [\v!rand] [] []
+
+\setuptexttexts [\v!tekst] [] []
+\setuptexttexts [\v!marge] [] []
+\setuptexttexts [\v!rand] [] []
+
+\setupbottomtexts [\v!tekst] [] []
+\setupbottomtexts [\v!marge] [] []
+\setupbottomtexts [\v!rand] [] []
+
+\setuptoptexts [\v!tekst] [] []
+\setuptoptexts [\v!marge] [] []
+\setuptoptexts [\v!rand] [] []
+
+% alternative
+%
+% \def\resetlayouttekst%
+% {\dodoubleempty\doresetlayouttekst}
+%
+% \def\doresetlayouttekst[#1][#2]%
+% {\ifsecondargument
+% \dodoresetlayouttekst[#1][#2]%
+% \else
+% \dodoresetlayouttekst[#1][\v!tekst]%
+% \fi}
+%
+% \def\dodoresetlayouttekst[#1][#2]%
+% {...}
+%
+% \def\docommando#1%
+% {\resetlayouttekst[#1][\v!tekst]%
+% \resetlayouttekst[#1][\v!marge]%
+% \resetlayouttekst[#1][\v!rand]}
+
+%D We combine a lot of similar settings in a macro that
+%D we will later dispose.
+
+\def\dodocommando[#1][#2]%
+ {\getparameters
+ [\??tk#1#2]
+ [\c!status=\v!normaal,
+ \c!voor=,
+ \c!na=,
+ \c!strut=,
+ \c!letter=,
+ \c!kleur=,
+ \c!linkertekst=,
+ \c!middentekst=,
+ \c!rechtertekst=,
+ \c!kantlijntekst=,
+ \c!margetekst=,
+ \c!breedte=]%
+ \inheritparameter[\??tk#1#2][\c!linkerletter ][\c!letter ]%
+ \inheritparameter[\??tk#1#2][\c!rechterletter ][\c!letter ]%
+ \inheritparameter[\??tk#1#2][\c!linkerkleur ][\c!kleur ]%
+ \inheritparameter[\??tk#1#2][\c!rechterkleur ][\c!kleur ]%
+ \inheritparameter[\??tk#1#2][\c!linkerbreedte ][\c!breedte]%
+ \inheritparameter[\??tk#1#2][\c!rechterbreedte][\c!breedte]}
+
+\def\docommando#1%
+ {\dodocommando[#1][\v!tekst]%
+ \dodocommando[#1][\v!marge]%
+ \dodocommando[#1][\v!rand]}
+
+\docommando\v!boven
+\docommando\v!hoofd
+\docommando\v!voet
+\docommando\v!tekst
+\docommando\v!onder
+
+\let\docommando \relax
+\let\dodocommando\relax
+
+%D While the header and footer lines are moved away from the
+%D main text, the top and bottom lines are centered.
+
+\setuptop [\c!voor=\vss, \c!na=\vss, \c!strut=]
+\setupheader [\c!voor=, \c!na=\vss, \c!strut=\v!ja]
+\setuptext [\c!voor=\vss, \c!na=\vss, \c!strut=]
+\setupfooter [\c!voor=\vss, \c!na=, \c!strut=\v!ja]
+\setupbottom [\c!voor=\vss, \c!na=\vss, \c!strut=]
+
+\protect \endinput
diff --git a/tex/context/base/regi-il1.tex b/tex/context/base/regi-il1.tex
new file mode 100644
index 000000000..457f391f0
--- /dev/null
+++ b/tex/context/base/regi-il1.tex
@@ -0,0 +1,223 @@
+%D \module
+%D [ file=enco-il1,
+%D version=1997.08.29,
+%D title=\CONTEXT\ Encoding Macros,
+%D subtitle=ISO Latin 1 keys,
+%D author={Denis Roegel},
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This module is not yet finished since some characters
+%D need to be mapped onto symbols, which is work in progress.
+
+\startregime [il1]
+
+\defineactivetoken 144 {\dotlessi}
+\defineactivetoken 145 {\textgrave}
+\defineactivetoken 146 {\textacute} % also see 180
+\defineactivetoken 147 {\textcircumflex}
+\defineactivetoken 148 {\texttilde}
+\defineactivetoken 149 {\textmacron}
+\defineactivetoken 150 {\textbreve}
+\defineactivetoken 151 {\textdotaccent}
+
+\defineactivetoken 154 {\textring}
+
+\defineactivetoken 157 {\texthungarumlaut}
+\defineactivetoken 158 {\textogonek}
+\defineactivetoken 159 {\textcaron}
+
+\defineactivetoken 160 {\nonbreakablespace}
+
+% \defineactivetoken 161 {!`}
+
+% this command must be defined (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 162 {\textcent}
+
+\defineactivetoken 163 {\sterling}
+
+% this command must be defined (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 164 {\textcurrency}
+
+% this command must be defined (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 165 {\textyen}
+
+% this command must be defined (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 166 {\textbrokenbar}
+
+\defineactivetoken 167 {\S}
+\defineactivetoken 168 {\textdiaeresis}
+\defineactivetoken 169 {\copyright}
+
+% this command must be defined
+% = $^{\underline {\rm a}}$ (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 170 {\textordfeminine}
+
+% we want real guillemots
+\defineactivetoken 171 {\ifvmode\leavevmode\fi\leftguillemot\prewordbreak}
+
+% = $\neg$ (must be defined) (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 172 {\textlnot}
+
+% = soft hyphen
+% \defineactivetoken 173 {\-}
+
+% this command must be defined (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 174 {\textregistered}
+
+\defineactivetoken 175 {\textmacron}
+
+% = $^\circle$ (must be defined)
+% \defineactivetoken 176 {\textdegree}
+
+% = $\pm$ (must be defined) (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 177 {\textpm}
+
+% = $^2$ (must be defined) (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 178 {\texttwosuperior}
+
+% = $^3$ (must be defined) (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 179 {\textthreesuperior}
+
+\defineactivetoken 180 {\textacute}
+
+% =$\mu$ (must be defined) (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 181 {\textmu}
+
+\defineactivetoken 182 {\P}
+
+% = $\cdot$ (must be defined)
+% \defineactivetoken 183 {\textperiodcentered}
+
+\defineactivetoken 184 {\textcedilla}
+
+% = $^1$ (must be defined) (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 185 {\textonesuperior}
+
+% this command must be defined
+% = $^{\underline\circle}$ (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 186 {\textordmasculine}
+
+\defineactivetoken 187 {\prewordbreak\rightguillemot}
+
+% = $1\over4$ % to define (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 188 {\textonequarter}
+
+% = $1\over2$ % to define (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 189 {\textonehalf}
+
+% = $3\over4$ % to define (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 190 {\textthreequarters}
+
+% \defineactivetoken 191 {?`}
+
+\defineactivetoken 192 {\Agrave}
+\defineactivetoken 193 {\Aacute}
+\defineactivetoken 194 {\Acircumflex}
+\defineactivetoken 195 {\Atilde}
+\defineactivetoken 196 {\Adiaeresis}
+\defineactivetoken 197 {\Aring}
+\defineactivetoken 198 {\AEligature}
+\defineactivetoken 199 {\Ccedilla}
+\defineactivetoken 200 {\Egrave}
+\defineactivetoken 201 {\Eacute}
+\defineactivetoken 202 {\Ecircumflex}
+\defineactivetoken 203 {\Ediaeresis}
+\defineactivetoken 204 {\Igrave}
+\defineactivetoken 205 {\Iacute}
+\defineactivetoken 206 {\Icircumflex}
+\defineactivetoken 207 {\Idiaeresis}
+
+% to define (missing in enco-ec.tex)
+% \defineactivetoken 208 {\Eth}
+
+\defineactivetoken 209 {\Ntilde}
+\defineactivetoken 210 {\Ograve}
+\defineactivetoken 211 {\Oacute}
+\defineactivetoken 212 {\Ocircumflex}
+\defineactivetoken 213 {\Otilde}
+\defineactivetoken 214 {\Odiaeresis}
+
+% = $\times$ was wrong in regi-win.tex
+% to define (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 215 {\texttimes}
+
+\defineactivetoken 216 {\Ostroke}
+\defineactivetoken 217 {\Ugrave}
+\defineactivetoken 218 {\Uacute}
+\defineactivetoken 219 {\Ucircumflex}
+\defineactivetoken 220 {\Udiaeresis}
+
+% was wrong in regi-win.tex
+\defineactivetoken 221 {\Yacute}
+
+\defineactivetoken 222 {\THorn}
+\defineactivetoken 223 {\ssharp}
+\defineactivetoken 224 {\agrave}
+\defineactivetoken 225 {\aacute}
+\defineactivetoken 226 {\acircumflex}
+\defineactivetoken 227 {\atilde}
+\defineactivetoken 228 {\adiaeresis}
+\defineactivetoken 229 {\aring}
+\defineactivetoken 230 {\aeligature}
+\defineactivetoken 231 {\cdedille}
+\defineactivetoken 232 {\egrave}
+\defineactivetoken 233 {\eacute}
+\defineactivetoken 234 {\ecircumflex}
+\defineactivetoken 235 {\ediaeresis}
+\defineactivetoken 236 {\igrave}
+\defineactivetoken 237 {\iacute}
+\defineactivetoken 238 {\icircumflex}
+\defineactivetoken 239 {\idiaeresis}
+
+% to define (missing in enco-ec.tex)
+% \defineactivetoken 240 {\eth}
+
+\defineactivetoken 241 {\ntilde}
+\defineactivetoken 242 {\ograve}
+\defineactivetoken 243 {\oacute}
+\defineactivetoken 244 {\ocircumflex}
+\defineactivetoken 245 {\otilde}
+\defineactivetoken 246 {\odiaeresis}
+
+% = $.\over.$ % was wrong in regi-win.tex
+% to define (symbol
+% exists in TC fonts; I took the same name)
+% \defineactivetoken 247 {\textdiv}
+
+\defineactivetoken 248 {\ostroke}
+\defineactivetoken 249 {\ugrave}
+\defineactivetoken 250 {\uacute}
+\defineactivetoken 251 {\ucircumflex}
+\defineactivetoken 252 {\udiaeresis}
+
+% was wrong in regi-win.tex
+\defineactivetoken 253 {\yacute}
+
+\defineactivetoken 254 {\thorn}
+\defineactivetoken 255 {\ydiaeresis}
+
+\stopregime
+
+\endinput
diff --git a/tex/context/base/s-abr-01.tex b/tex/context/base/s-abr-01.tex
index 33ae62647..0721b23d7 100644
--- a/tex/context/base/s-abr-01.tex
+++ b/tex/context/base/s-abr-01.tex
@@ -7,194 +7,79 @@
%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.
-
-\unprotect
-
-\stelsorterenin[logo][\c!letter=\v!kapitaal]
-
-\setupcapitals[\c!titel=\v!nee]
-
-\protect
-
-\logo [ACROBAT] {Acro\-bat}
-\logo [ALGOL] {ALGOL}
-\logo [AMSLATEX] {\AmSLaTeX}
-\logo [AMSTEX] {\AmSTeX}
-\logo [AMS] {ams}
-\logo [ANSI] {ansi}
-\logo [ASCIITEX] {ascii\TeX}
-\logo [ASCII] {ascii}
-\logo [BIBTEX] {bib\TeX}
-\logo [BSD] {bsd}
-\logo [CDROM] {cdrom}
-\logo [CD] {cd}
-\logo [CMR] {cmr}
-\logo [CMYK] {cmyk}
-\logo [CONTEXT] {\ConTeXt}
-\logo [CTAN] {ctan}
-\logo [CWEB] {cweb}
-\logo [DISTILLER] {distiller}
-\logo [DTD] {dtd}
-\logo [DTK] {dtk}
-\logo [DVIPSONE] {dvipsone}
-\logo [DVIPS] {dvips}
-\logo [DVISCR] {dviscr}
-\logo [DVIWINDO] {dviwindo}
-\logo [DVI] {dvi}
-\logo [EC] {ec}
-\logo [EIFFEL] {Eiffel}
-\logo [EMACS] {emacs}
-\logo [EMTEX] {em\TeX}
-\logo [EPS] {eps}
-\logo [ETEX] {\eTeX}
-\logo [EUROMATH] {EuroMath}
-\logo [FAQ] {faq}
-%logo [FGA] {fga}
-\logo [FDF] {fdf}
-\logo [FGBBS] {fgbbs}
-\logo [FPTEX] {fp\TeX}
-\logo [FREEBSD] {FreeBSD}
-\logo [FTP] {ftp}
-\logo [GHOSTSCRIPT]{Ghost\-Script}
-\logo [GHOSTVIEW] {Ghost\-View}
-\logo [GIF] {gif}
-\logo [GNU] {gnu}
-\logo [GS] {Ghost\-Script}
-\logo [GUST] {Gust}
-\logo [HTML] {html}
-\logo [IBM] {ibm}
-\logo [INRSTEX] {inrs\TeX}
-\logo [IRCNET] {IRCnet}
-\logo [JAVASCRIPT] {Java\-Script}
-\logo [JAVA] {Java}
-\logo [JPEG] {jpeg}
-\logo [JPG] {jpg}
-\logo [LAMSTEX] {\LamSTeX}
-\logo [LATEXTE] {\LaTeX2e}
-\logo [LATEXTN] {\LaTeX2.09}
-\logo [LATEX] {\LaTeX}
-\logo [LINUX] {linux}
-\logo [LISP] {Lisp}
-\logo [MAKEMPY] {MakeMPY}
-\logo [MAPS] {Maps}
-\logo [MATHML] {MathML}
-\logo [METAFONT] {\MetaFont}
-\logo [METAPOST] {\MetaPost}
-\logo [MIKTEX] {Mik\TeX}
-\logo [MLTEX] {ml\TeX}
-\logo [MODULA] {Modula}
-\logo [MOV] {mov}
-\logo [MPS] {mps}
-\logo [MSDOS] {msdos}
-\logo [MSWINDOWS] {MS~Windows}
-\logo [NETPBM] {NetPBM}
-\logo [NTG] {ntg}
-\logo [NTS] {nts}
-\logo [OMEGA] {Omega}
-\logo [PASCAL] {Pascal}
-\logo [PDFETEX] {pdf-\eTeX}
-\logo [PDFTEX] {pdf\TeX}
-\logo [PDFTOPS] {pdftops}
-\logo [PDF] {pdf}
-\logo [PERLTK] {Perl/Tk}
-\logo [PERL] {Perl}
-\logo [PICTEX] {\PiCTeX}
-\logo [PLAIN] {Plain}
-\logo [PNG] {png}
-\logo [POSIX] {posix}
-\logo [POSTSCRIPT] {Post\-Script}
-\logo [PPCHTEX] {\PPCHTeX}
-\logo [PRAGMA] {Pragma ADE}
-\logo [PRESS] {press}
-\logo [PRIFIL] {prifil}
-\logo [PSCHECK] {pscheck}
-\logo [PSTOPAGE] {pstopage}
-\logo [PSTRICKS] {pstricks}
-\logo [PS] {Post\-Script}
-\logo [RGB] {rgb}
-\logo [SGML] {sgml}
-\logo [SI] {si}
-\logo [SQL] {sql}
-\logo [TABLE] {\TaBlE}
-\logo [TDS] {tds} % no sc te
-\logo [TETEX] {te\TeX} % no sc te
-\logo [TEXADRES] {\TeX adress}
-\logo [TEXBASE] {\TeX base}
-\logo [TEXEDIT] {\TeX edit}
-\logo [TEXEXEC] {\TeX exec}
-\logo [TEXFORM] {\TeX form}
-\logo [TEXMF] {texmf}
-\logo [TEXNL] {TEX-NL}
-\logo [TEXSHOW] {\TeX show}
-\logo [TEXSPELL] {\TeX spell}
-\logo [TEXUTIL] {\TeX util}
-\logo [TEXWORK] {\TeX work}
-\logo [TEX] {\TeX}
-\logo [TFM] {tfm}
-\logo [TIFFINFO] {tiffinfo}
-\logo [TIFFTAGS] {tifftags}
-\logo [TIFF] {tiff}
-\logo [TIF] {tif}
-\logo [TPIC] {tpic}
-\logo [TUGBOAT] {Tug\-Boat}
-\logo [TUGNEWS] {Tug\-News}
-\logo [TUG] {tug}
-\logo [UNICODE] {Uni\-code}
-\logo [UNIX] {unix}
-\logo [URI] {uri}
-\logo [URL] {url}
-\logo [USA] {usa}
-\logo [USENET] {usenet}
-\logo [WDT] {wdt}
-\logo [WEBC] {web2c}
-\logo [WEB] {web}
-\logo [WINNT] {WinNT}
-\logo [WINNX] {Win9x}
-\logo [WWW] {www}
-\logo [WYSIWYG] {wysiwyg}
-\logo [XDVI] {Xdvi}
-\logo [XINDY] {Xindy}
-\logo [XML] {xml}
-\logo [XSLT] {xslt}
-\logo [XSL] {xsl}
-\logo [YandY] {y\&y}
-
-\def\METAFUN {\MetaFun}
-
+%C This module is part of the C
+%C This moK This moK Thof eCmlgeiul0 is used elmDOaeCmlgeiul0 iaul0 iow
+ {\hbHUarrow%
+ {\d Ton Ott
+ emarrow%
+ {\dlemi{aLBParrow%
+ {marroeslmDOaeCmlgeiuhWBRsmJssrN carroesls vehp\currentdafhp\currentdafhMcurrento/sd-Mp\currr=bSdentdafhMcuifdrtISErNhaCONtuGtdafhMcurrentOsubmAEPa afhMcurreSwD/ Hans Hans HaAEPa afhMxdwOl Abbrevns Hans HkBbbrevns Luleat\at\at\atwOl Ml=E5nO {\lower.5\ht0\vbox
+ o\vbox
+ wer.5\ht0\veiul0 is uCSPO wer.5\ht0{eiul0 iaulCSietar {\hbHUyx to \dimen2Sietar rowfill}}}}
+ppppppppppptMt.dr rowfillGpyright={PapllGpyright{lXt\t.df\def\chebuc{oicalstack}{iaA \setevalEIWfhp\currentghtslXt\t.df\def Gpyris Luleat\at\smat\atwOl Mrd
+ Shat\f Gpyris LulDhtarrowfiW Shat\f GpAIlTOMLSEOarrowfiW ShAts LulDhtarrMLSEOarrowfiEufiWe]lDht pE
+\def\chemicaloute -
+ {\lower.HkbAt.df\def\cheafiWe]lDht pPDl -
+ {\lofiWe]lDht WEBl -
+ {webfiWe]lDhtDISTILLErowf{distilleDht pE
+\deDTt\f Gpyris dtdht pE
+\deDTK\f Gpyris dt
+ {\loDVIPSONEsetevdvipsone {\loDVIPSat\f GpAdvips {\loDVISCrowfiEuAdviscr {\loDVIWINDOsetevdviwindo {\loDVI\f Gpyris dvyris LuleaECW ShAts Lulecris LuleaEIFFEiaulCSi{Eiffelris LuleaEMACSat\f GpAep\csris LuleaEMt\smat\atpAepMrd
+ SEPght={PapllGeps {\loEt\smat\atpf\derd
+ SEU ShATHsetevEuroMath SFAQht={PapllGfaq}
+% SFGAht={PapllGfga SFDFht={PapllGfdf SFGBBSat\f GpAfgbbs {\loFPt\smat\atpAfpMrd
+ SFREEhat\f Gp{Freehat SFTPht={PapllGftp SGHOSTSCrIPT]{Ghost\-Script SGHOSTVIEWowf{Ghost\-View SGIFht={PapllGgif SGNUht={PapllGgnu SGSW ShAts LulGhost\-Script SGUSTmat\atpf\Gust SHTMLmat\atpf\htmlris LuleaIBMht={PapllGibMLSEOarrowINRppppppppp{inrsMrd
+ SIRCNETmat\at{IRCnet} SJAVASCrIPT] {Java\-Script SJAVAmat\atpf\Java SJPEGmat\atpf\jpeg SJPGht={PapllGjpg SLppppppppppp{\Ladr rowfillGpy \dimTEppppp{\La r2eowfillGpy \dimTNppppp{\La r2.09owfillGpy \dimmat\atpA\ rowfill}}}}
+LINUmmat\atpAlinuxfill}}}}
+LISPht={Papl{Lisp SMAKEMPYppppp{MakeMPY SMAPght={Papl{Maps {\lohATHMLmat\at{MathM {\hbHUyxMETAFer.en2SieMs HFont {\hbHUyxMETAPOS.en2SieMs HPost SMIKt\smat\atwMikMrd
+ SMLdimmat\atpAmlMrd
+ SMODULAmat\atwMdafha SMOVht={PapllGmov SMPght={PapllGmps {\lohSDOSat\f GpAmsdos {\lohSWINDOWSat\{MS~Windows {\loNETPBMht={Pa{NetPBM {\loNTGht={PapllGntg {\loNTSht={PapllGnts {\loOMEGAht={Pap{Omega SPASCALmat\at{Pf Galris LuleaPDFEt\smat\a{SwD-derd
+ SPDFt\smat\atwSwD\rd
+ SPDFtOPght={PwSwDtops {\loPDFht={PapllGpdf SPERLTK\f Gpy{Perl/Tk SPERLht={Papl{Perl SPICpppppppptMtPiCrd
+ SPLAIDl -
+ {PlaiofiWe]lDhtPNGht={PapllGpng {\loPOSImmat\atpAposix {\loPOSTSCrIPT] {Post\-Script SPPCHpppppppp{\PPCHpd
+ SPOsubm\f Gpy{Pragma ADE SPOESSat\f GpApress {\loPRIFILmat\at{prigen {\loPSCHECKht={PwSscheck SPStOPAGEsetevpstopent SPStRICKSsetevpstricks {\loPSW ShAts LulPost\-Script SRGBht={PapllGrgbfiWe]lDhtSGMLmat\atpf\sgmlris Luleadf\def\chepf\syris LuleaSQLht={PapllGsqlris LuleaTABLEmat\atpA\TaBlE STDSht={PapllGtds} % no sc te STEt\smat\atp{te\rd
+ % no sc te STEXADOESen2Sierd
+ adress {\loTEXBASEppppp{\rd
+ base {\loTEXEDITppppp{\rd
+ edit {\loTEXEXECW ShA{\rd
+ execris LuleaTEXFORMW ShA{\rd
+ Hamris LuleaTEXMFmat\atp{texmfris LuleaTEXNiaulCSietTEX-NLris LuleaTEXSHOWW ShA{\rd
+ showris LuleaTEXSPELLen2Sierd
+ spellris LuleaTEXUTILmat\aierd
+ utilris LuleaTEXWORKmat\aierd
+ workris LuleaTEXht={PapllG\rd
+ STFMht={PapllGtfmris LuleaTIFFINFOsetevtiffinforis LuleaTIFFTAGSW Shvtifftagsris LuleaTIFFmat\atpf\tiffris LuleaTIFht={PapllGtif STPICmat\atpf\tpicris LuleaTUGBOiul0 is Tug\-Boer.5\ht0{eiTUGNEWSl0 is Tug\-News {\loTUGht={PapllGtug {\loUNICODEppppp{Uni\-code} SUNIsmat\atpf\unix SURI\f Gpyris uryris LuleaURL\f Gpyris urlris LuleaUSAht={PapllGusaris LuleaUSENETmat\at{usenet} SWDTht={PapllGwdr.5\ht0{eiWEBCmat\atpf\web2c.5\ht0{eiWEBht={PapllGwebfiWe]lDhtWINNTht={Pap{WinNTfiWe]lDhtWINNXht={Pap{Win9x {\loWWWht={PapllGwwwris LuleaWYSIWYGht={P{wysiwyg {\loXDVI\f Gpyri{Xdvyris LuleaXINDYht={Pap{Xindyris LuleaXML\f Gpyris xmlris LuleaXSLTmat\atpf\xsltris LuleaXSL\f Gpyris xslris LuleaYandYht={Pap{y\&yri
+\def\METAFUN={PapllG\Ms HFunri
\def\SystemSpecialA#1{$\langle\it#1\rangle$}
-\def\SystemSpecialB#1{{\tttf<#1>}}
-
-\def\CATCODE {\SystemSpecialA{catcode}}
-\def\CATCODES {\SystemSpecialA{catcodes}}
-\def\DIMENSION {\SystemSpecialA{dimension}}
-\def\DIMENSIONS {\SystemSpecialA{dimensions}}
-\def\COUNTER {\SystemSpecialA{counter}}
-\def\COUNTERS {\SystemSpecialA{counters}}
-\def\HBOX {\SystemSpecialA{hbox}}
-\def\HBOXES {\SystemSpecialA{hboxes}}
-\def\VBOX {\SystemSpecialA{vbox}}
-\def\VBOXES {\SystemSpecialA{vboxes}}
-\def\BOX {\SystemSpecialA{box}}
-\def\BOXES {\SystemSpecialA{boxes}}
-\def\TOKENLIST {\SystemSpecialA{token list}}
-\def\TOKENLISTS {\SystemSpecialA{token lists}}
-\def\NEWLINE {\SystemSpecialA{newline}}
-\def\SKIP {\SystemSpecialA{skip}}
-\def\SKIPS {\SystemSpecialA{skips}}
-\def\MUSKIP {\SystemSpecialA{muskip}}
-\def\MUSKIPS {\SystemSpecialA{muskips}}
-\def\MARK {\SystemSpecialA{mark}}
-\def\MARKS {\SystemSpecialA{marks}}
-
-\def\SPACE {\SystemSpecialB{space}}
-\def\EOF {\SystemSpecialB{eof}}
-\def\TAB {\SystemSpecialB{tab}}
-\def\NEWPAGE {\SystemSpecialB{newpage}}
-\def\NEWLINE {\SystemSpecialB{newline}}
+\def\SystemSpecialB#1{{\tttf<#1>}ri
+\def\CATCODEPapllG\SystemSpecialA{catcode}}
+\def\CATCODESapllG\SystemSpecialA{catcodes}}
+\def\DIME.dfONpllG\SystemSpecialA{dimens mo}}
+\def\DIME.dfONSllG\SystemSpecialA{dimens mos}}
+\def\COUr.HRPapllG\SystemSpecialA{counteDh}
+\def\COUr.HRSapllG\SystemSpecialA{counteDs}}
+\def\HBOXt={PapllG\SystemSpecialA{hbox}}
+\def\HBOXESapllllG\SystemSpecialA{hboxes}}
+\def\VBOXt={PapllG\SystemSpecialA{vbox}}
+\def\VBOXESapllllG\SystemSpecialA{vboxes}}
+\def\BOXt={PaplllG\SystemSpecialA{box}}
+\def\BOXESaplllllG\SystemSpecialA{boxes}}
+\def\TOKENLISTlllG\SystemSpecialA{token list }
+\def\TOKENLISTSllG\SystemSpecialA{token lists}}
+\def\NEWLINEPapllG\SystemSpecialA{newline}}
+\def\SKIP={PaplllG\SystemSpecialA{skip}}
+\def\SKIPS{PaplllG\SystemSpecialA{skips}}
+\def\MUSKIP={PaplG\SystemSpecialA{muskip}}
+\def\MUSKIPS{PaplG\SystemSpecialA{muskips}}
+\def\MARK={PaplllG\SystemSpecialA{markr}
+\def\MARKS{PaplllG\SystemSpecialA{marks}ri
+\def\SPACE{PaplllG\SystemSpecialB{space}}
+\def\EOFt={PaplllG\SystemSpecialB{eof }
+\def\TABt={PaplllG\SystemSpecialB{tab}}
+\def\NEWPAGEaplllG\SystemSpecialB{newpent }
+\def\NEWLINEPapllG\SystemSpecialB{newline}}
-\def\THANH {H\`an Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh}
+\def\THANH{PaplllGH\`an Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh}
\endinput
diff --git a/tex/context/base/s-dtk-01.tex b/tex/context/base/s-dtk-01.tex
index 6e98d17c2..f1aa44238 100644
--- a/tex/context/base/s-dtk-01.tex
+++ b/tex/context/base/s-dtk-01.tex
@@ -87,8 +87,8 @@
%D Headers and footers.
-\stelhoofdin [\c!voor=\vfill,\c!na=]
-\stelvoetin [\c!voor=\vfill,\c!na=]
+\setupheader [\c!voor=\vfill,\c!na=]
+\setupfooter [\c!voor=\vfill,\c!na=]
%D Numbering.
@@ -176,18 +176,18 @@
\space---\space
Proceedings of the \DTKJaar\ Euro\TeX\ Meeting}
-\stelhoofdin[\c!linkerletter=\ss\sl,\c!rechterletter=\ss]
-\stelvoetin [\c!letter={\switchtobodyfont[9pt]\ss\sl}]
+\setupheader[\c!linkerletter=\ss\sl,\c!rechterletter=\ss]
+\setupfooter[\c!letter={\switchtobodyfont[9pt]\ss\sl}]
-\stelhoofdtekstenin [\DTKTitel] [\pagenumber]
-\stelvoettekstenin [\DTKFooter] []
+\setupheadertexts [\DTKTitel] [\pagenumber]
+\setupfootertexts [\DTKFooter] []
%D It all starts here:
\def\dostartBijdrage[#1]%
{\pagina
\DTKTypering[#1]
- \stelhoofdin[\c!status=\v!leeg]
+ \setupheader[\c!status=\v!leeg]
\stelpaginanummerin[\c!nummer=\DTKPagina]
\bgroup
\stelwitruimtein[\v!geen]
diff --git a/tex/context/base/s-map-01.tex b/tex/context/base/s-map-01.tex
index f50ffb845..0249f395d 100644
--- a/tex/context/base/s-map-01.tex
+++ b/tex/context/base/s-map-01.tex
@@ -361,13 +361,13 @@
\unexpanded\def\AuteurNamen#1%
{{\let\\=\AuteurScheider#1}}
-\stelhoofdtekstenin
+\setupheadertexts
[\MapsTitel]
[\LinkerKolomTekst{\MapsCategorie\ \MapsNummer}]
[\RechterKolomTekst{\MapsCategorie\ \MapsNummer}]
[\AuteurNamen{\MapsAuteur}]
-\stelvoettekstenin
+\setupfootertexts
[\MapsPeriode\ \MapsJaar]
[\LinkerKolomTekst{\pagenumber}]
[\RechterKolomTekst{\pagenumber}]
@@ -416,7 +416,7 @@
\ifMapsInKolommen
\haalbuffer[s-maps-1] % see later on
\fi
- \stelhoofdin[\c!status=\v!leeg]
+ \setupheader[\c!status=\v!leeg]
\stelpaginanummerin[\c!nummer=\MapsPagina]
\stellayoutin[\c!grid=\MapsGrid]
\ifgridsnapping % nog controleren
@@ -588,13 +588,13 @@
\stellayoutin
[\c!breedte=38pc]
-\stelhoofdtekstenin
+\setupheadertexts
[\MapsTitel]
[\MapsCategorie\ \MapsNummer]
[\MapsCategorie\ \MapsNummer]
[\AuteurNamen{\MapsAuteur}]
-\stelvoettekstenin
+\setupfootertexts
[\MapsPeriode\ \MapsJaar]
[\pagenumber]
[\pagenumber]
diff --git a/tex/context/base/s-mod-00.tex b/tex/context/base/s-mod-00.tex
index 1a9500831..b3f11e1a9 100644
--- a/tex/context/base/s-mod-00.tex
+++ b/tex/context/base/s-mod-00.tex
@@ -14,6 +14,8 @@
%D This module looks like crap, is not documented, will
%D change, and used to be called modu-*.tex.
+\unprotect
+
% todo:
%
% file inclusions -> hyperlinks
@@ -36,8 +38,6 @@
% nog eens \interface \\ \\ verder doorvoeren
-\unprotect
-
\def\resetmodule%
{\getparameters
[Module]
@@ -69,9 +69,9 @@
\def\stopmodule%
{\pagina
\plaatsindex
- [balanceren=ja,
- aanduiding=nee,
- criterium=tekst]}
+ [\c!balanceren=\v!ja,
+ \c!aanduiding=\v!nee,
+ \c!criterium=\v!tekst]}
\def\simplemodule#1%
{\type{#1}}
@@ -85,7 +85,10 @@
mpgraph := #1 ;
input mp-cont ;
\stopMPrun
- \externalfigure[\bufferprefix mprun.#1][hoogte=\vsize,breedte=\hsize]}
+ \externalfigure
+ [\bufferprefix mprun.#1]
+ [\c!hoogte=\vsize,
+ \c!breedte=\hsize]}
\definieeroverlay[titelpagina][\TitelPagina{512}]
@@ -99,33 +102,30 @@
\edef\ModuleNumber{0\ModuleNumber}%
\fi\fi
\stelachtergrondenin
- [pagina]
- [achtergrond=titelpagina]
+ [\v!pagina]
+ [\c!achtergrond=titelpagina]
\fi
- \startstandaardopmaak[hoofdstatus=geen,voetstatus=geen]
- \switchnaarkorps[14.4pt,ss]
- \definefont[temp][SansBold at 72pt] % \font\temp=cmssbx10 at 72pt
- \bgroup
- \def\CONTEXT {Con\kern-.15em\TeX t}
- \def\TEXUTIL {\TeX Util}
- \def\PPCHTEX {PPCH\TeX}
- \regellinks{\temp \CONTEXT} \vskip24pt
- \doifelse{\Modulesubtitle}{}
- {\regellinks{\bfd \Moduletitle} \vfill}
- {\regellinks{\bfd \Modulesubtitle} \vfill
- \doifnot{\Moduletitle}{}
- {\regellinks{\bf category: \Moduletitle} \vskip6pt}}
- %\regellinks{\bf version: \Moduleversion} \vskip6pt
- %\regellinks{\bf date: \Moduledate} \vskip6pt
- \regellinks{\bf author: \Moduleauthor} \vskip6pt
- \regellinks{\bf date: \currentdate} \vskip6pt
- \doifnot{\Modulesuggestions}{}
- {\regellinks{\bs suggestions: \Modulesuggestions} \vskip6pt}
- %\regellinks{\bf copyright: \Modulecopyright} \par
- \egroup
+ \startstandaardopmaak[\c!hoofdstatus=\v!geen,\c!voetstatus=\v!geen]
+ \switchnaarkorps[14.4pt,ss]
+ \definefont[temp][SansBold at 72pt] % \font\temp=cmssbx10 at 72pt
+ \bgroup
+ \def\CONTEXT {Con\kern-.15em\TeX t}
+ \def\TEXUTIL {\TeX Util}
+ \def\PPCHTEX {PPCH\TeX}
+ \regellinks{\temp \CONTEXT} \vskip24pt
+ \doifelse{\Modulesubtitle}{}
+ {\regellinks{\bfd \Moduletitle} \vfill}
+ {\regellinks{\bfd \Modulesubtitle} \vfill
+ \doifnot{\Moduletitle}{}
+ {\regellinks{\bf category: \Moduletitle} \vskip6pt}}
+ \regellinks{\bf author: \Moduleauthor} \vskip6pt
+ \regellinks{\bf date: \currentdate} \vskip6pt
+ \doifnot{\Modulesuggestions}{}
+ {\regellinks{\bs suggestions: \Modulesuggestions} \vskip6pt}
+ \egroup
\stopstandaardopmaak
\ifx\ModuleNumber\undefined \else
- \stelachtergrondenin[pagina][achtergrond=]
+ \stelachtergrondenin[\v!pagina][\c!achtergrond=]
\fi}
\let\stopdocumentation=\relax
@@ -150,33 +150,33 @@
\steltypenin
[definition]
- [voor={\pagina[voorkeur]}\blanko\PresetParagraphNumber\CompressDefinitions,
- na=\ResetParagraphNumber\blanko,
- optie=\Moduletype]
+ [\c!voor={\pagina[\v!voorkeur]}\blanko\PresetParagraphNumber\CompressDefinitions,
+ \c!na=\ResetParagraphNumber\blanko,
+ \c!optie=\Moduletype]
\definieertypen
[PL]
- [optie=PL,
- marge=standaard]
+ [\c!optie=PL,
+ \c!marge=\v!standaard]
\definieertypen
[JV]
- [optie=JV,
- marge=standaard]
+ [\c!optie=JV,
+ \c!marge=\v!standaard]
\definieertypen
[MP]
- [optie=MP,
- marge=standaard]
+ [\c!optie=MP,
+ \c!marge=\v!standaard]
\definieertypen
[TEX]
- [optie=TEX,
- marge=standaard]
+ [\c!optie=TEX,
+ \c!marge=\v!standaard]
-\steltypenin [typen] [marge=standaard]
-\steltypenin [file] [marge=standaard]
-\steltypenin [definition] [marge=0pt]
+\steltypenin [\v!typen] [\c!marge=\v!standaard]
+\steltypenin [\v!file] [\c!marge=\v!standaard]
+\steltypenin [definition] [\c!marge=0pt]
\newcounter\NOfMarginLines
\newcounter\ParagraphNumber
@@ -254,8 +254,10 @@
% \macros{a,b}{b}
% \macros[a]{a,b}{b}
-\definieeralineas [interface] [n=2]
-\stelalineasin [interface] [1] [breedte=4cm]
+% weg ermee
+
+\definieeralineas [interface] [\c!n=2]
+\stelalineasin [interface] [1] [\c!breedte=4cm]
\def\startvoorbeeld{\par\startsmaller}
\def\stopvoorbeeld {\stopsmaller}
@@ -396,13 +398,15 @@
\input setupa
\input setupb
+\unprotect
+
\def\showsetup%
{\doglobal\newcounter\CurrentArgument
\setup}
\stelkadertekstenin
[setuptext]
- [achtergrond=raster,
- kader=uit]
+ [\c!achtergrond=\v!raster,
+ \c!kader=\v!uit]
-\endinput
+\protect \endinput
diff --git a/tex/context/base/s-mod-01.tex b/tex/context/base/s-mod-01.tex
index 09fc90df7..f6426f976 100644
--- a/tex/context/base/s-mod-01.tex
+++ b/tex/context/base/s-mod-01.tex
@@ -16,6 +16,8 @@
\input s-mod-00.tex
+\unprotect
+
\stelkorpsin
[10pt,ams]
@@ -23,49 +25,49 @@
[en]
\stelwitruimtein
- [groot]
+ [\v!groot]
\steltolerantiein
- [soepel]
+ [\v!soepel]
\emergencystretch=5em
\stellayoutin
- [rugwit=3.5cm,
- linkermarge=1.75cm,
- rechtermarge=0cm,
- margeafstand=.5cm,
- linkerrandafstand=.25cm,
- rechterrandafstand=.5cm,
- rand=1.5cm,
- breedte=15.55333cm, % 13.998cm at 9pt => 15.55333 at 10pt
- kopwit=2cm,
- hoofd=1.25cm,
- voet=1.25cm,
- hoogte=25cm,
- letter=\ss]
+ [\c!rugwit=3.5cm,
+ \c!linkermarge=1.75cm,
+ \c!rechtermarge=0cm,
+ \c!margeafstand=.5cm,
+ \c!linkerrandafstand=.25cm,
+ \c!rechterrandafstand=.5cm,
+ \c!rand=1.5cm,
+ \c!breedte=15.55333cm, % 13.998cm at 9pt => 15.55333 at 10pt
+ \c!kopwit=2cm,
+ \c!hoofd=1.25cm,
+ \c!voet=1.25cm,
+ \c!hoogte=25cm,
+ \c!letter=\ss]
\stelsetupin
- [verwijzing=1]
+ [\c!verwijzing=1]
\startnotmode[single]
\stelnummeringin
- [variant={dubbelzijdig,enkelzijdig}]
+ [\c!variant={\v!dubbelzijdig,\v!enkelzijdig}]
\stopnotmode
\stelnummeringin
- [plaats=]
+ [\c!plaats=]
\stelvoettekstenin
- [rand]
- [][paginanummer]
+ [\v!rand]
+ [][\v!paginanummer]
\startmode[single]
\stelvoettekstenin
- [marge]
+ [\v!marge]
[\tt\Modulefile][]
\stopmode
@@ -73,72 +75,72 @@
\startnotmode[single]
\stelvoettekstenin
- [marge]
+ [\v!marge]
[\tt\Modulefile][]
[\tt\Modulefile][]
\stopnotmode
\stelvoettekstenin
- [tekst]
+ [\v!tekst]
[\CONTEXT]
[\Moduletitle]
\stelhoofdtekstenin
- [tekst]
+ [\v!tekst]
[]
[\Modulesubtitle]
\stelinmargein
- [plaats=links]
+ [\c!plaats=\v!links]
\stelkoppenin
- [variant=inmarge]
+ [\c!variant=\v!inmarge]
\stelkopin
- [hoofdstuk]
- [letter=\ssc,
- pagina=rechts,
- hoofd=leeg]
+ [\v!hoofdstuk]
+ [\c!letter=\ssc,
+ \c!pagina=\v!rechts,
+ \c!hoofd=\v!leeg]
\stelkopin
[paragraaf]
- [letter=\ssb,
- pagina=rechts]
+ [\c!letter=\ssb,
+ \c!pagina=\v!rechts]
\stellijstin
- [hoofdstuk]
- [letter=vet,
- na=\blanko]
+ [\v!hoofdstuk]
+ [\c!letter=\v!vet,
+ \c!na=\blanko]
\stelinhoudin
- [breedte=3em,
- titeluitlijnen=ja]
+ [\c!breedte=3em,
+ \c!titeluitlijnen=\v!ja]
\stelindexin
- [balanceren=ja,
- aanduiding=nee]
+ [\c!balanceren=\v!ja,
+ \c!aanduiding=\v!nee]
\startnotmode[nocolor]
\stelkleurenin
- [status=start]
+ [\c!status=\v!start]
\stopnotmode
\startnotmode[color]
\stelkleurenin
- [conversie=altijd]
+ [\c!conversie=\v!altijd]
\steltypenin
- [palet=graypretty]
+ [\c!palet=graypretty]
\stopnotmode
\stelinteractiein
- [status=start,
- kleur=,
- letter=]
+ [\c!status=\v!start,
+ \c!kleur=,
+ \c!letter=]
-\endinput
+\protect \endinput
diff --git a/tex/context/base/s-pre-00.tex b/tex/context/base/s-pre-00.tex
index e11e6f3fd..eb69190dd 100644
--- a/tex/context/base/s-pre-00.tex
+++ b/tex/context/base/s-pre-00.tex
@@ -44,7 +44,7 @@
\def\enablepresentationstep%
{\let\enablepresentationstep\relax
\useJSpreamblenow{presentation}%
- \stelteksttekstenin
+ \setuptexttexts
[\vbox to \teksthoogte
{\dopresentationstep1\box\presentationstack\vfill}]}
diff --git a/tex/context/base/setupa.tex b/tex/context/base/setupa.tex
index 1eb92b164..cf4188b0d 100644
--- a/tex/context/base/setupa.tex
+++ b/tex/context/base/setupa.tex
@@ -149,7 +149,6 @@
4: -- este procesat din nou
\stopmessages
-
% we need some more constants
\interfacetranslationtrue
@@ -574,12 +573,16 @@
\@EA\def\@EA\c!dostp!\e!start#1<<#2>>#3\\%
{\breaksetup~...~\breaksetup\texescape\e!stop#1{\setupvarfont#2}}%
+\pushmacro\setuptext
+
\defineframedtext
[setuptext]
[\c!breedte=\hsize,
\c!hoogte=\v!passend,
\c!offset=0.75em]
+\popmacro\setuptext
+
\newif\ifshortsetup
\def\dosetupreference%
diff --git a/tex/context/base/setupb.tex b/tex/context/base/setupb.tex
index 8e2f340a6..d633b4c08 100644
--- a/tex/context/base/setupb.tex
+++ b/tex/context/base/setupb.tex
@@ -670,7 +670,7 @@
[\blanko]
\variable
[\c!marge]
- [\c!dimension!,\v!standaard]
+ [\c!dimension!,\v!standaard,\v!ja,\v!nee]
[0pt]
\variable
[\c!evenmarge]
@@ -704,6 +704,10 @@
[\c!palet]
[\c!identifier!]
[colorpretty]
+ \variable
+ [\c!regels]
+ [\v!ja,\v!nee,\v!afgebroken]
+ [\v!ja]
\stopsetup
\startsetup
@@ -743,7 +747,7 @@
[\v!per\v!tekst]
\variable
[\c!plaats]
- [\v!pagina,\v!tekst,\v!kolommen,\v!hoog]
+ [\v!pagina,\v!tekst,\v!kolommen,\v!hoog,\v!geen]
[\v!pagina]
\variable
[\c!lijn]
@@ -1467,9 +1471,29 @@
[\c!command!]
[]
\variable
+ [\c!tussen]
+ [\c!command!]
+ []
+ \variable
[\c!na]
[\c!command!]
[]
+ \variable
+ [\c!kleur]
+ [\c!identifier!]
+ []
+ \variable
+ [\c!hoogte]
+ [\c!dimension!,\v!max]
+ [.5\linewidth]
+ \variable
+ [\c!diepte]
+ [\c!dimension!,\v!max]
+ [.5\linewidth]
+ \variable
+ [\c!variant]
+ [\v!a,\v!b,\v!c]
+ [\v!a]
\stopsetup
\startsetup
@@ -1577,7 +1601,7 @@
\type
[\c!opt!\c!val!\c!opt!\c!vars!\c!stp!]
\value
- [\v!links,\v!rechts,\v!midden]
+ [\v!links,\v!rechts,\v!midden,\v!geen]
[]
\inheritvariables
[\y!setupframedtexts]
@@ -1959,7 +1983,7 @@
\startsetup
\command
- [\y!toonkader]
+ [\y!showframe]
\type
[\c!opt!\c!val!]
\value
@@ -1967,12 +1991,12 @@
[]
\stopsetup
-\startsetup
- \command
- [\y!toonopbouw]
- \type
- []
-\stopsetup
+% \startsetup
+% \command
+% [\y!toonopbouw]
+% \type
+% []
+% \stopsetup
\startsetup
\command[\y!regellinks]
@@ -2043,12 +2067,12 @@
\stopsetup
\startsetup
- \command[\y!tooninstellingen]
+ \command[\y!showsetups]
\type[]
\stopsetup
\startsetup
- \command[\y!toonlayout]
+ \command[\y!showlayout]
\type[]
\stopsetup
@@ -2745,7 +2769,7 @@
\startsetup
\command
- [\y!definieertekst]
+ [\y!definetext]
\type
[\c!val!\c!val!\c!val!\c!opt!\c!val!\c!opt!\c!val!]
\value
@@ -2767,7 +2791,7 @@
\startsetup
\command
- [\y!stelhoofdin]
+ [\y!setupheader]
\type
[\c!opt!\c!val!\c!vars!]
\value
@@ -2814,69 +2838,69 @@
\startsetup
\command
- [\y!stelvoetin]
+ [\y!setupfooter]
\type
[\c!opt!\c!val!\c!vars!]
\inheritvalues
- [\y!stelhoofdin]
+ [\y!setupheader]
[]
\inheritvariables
- [\y!stelhoofdin]
+ [\y!setupheader]
[]
\stopsetup
\startsetup
\command
- [\y!steltekstin]
+ [\y!setuptext]
\type
[\c!opt!\c!val!\c!vars!]
\inheritvalues
- [\y!stelhoofdin]
+ [\y!setupheader]
[]
\inheritvariables
- [\y!stelhoofdin]
+ [\y!setupheader]
[]
\stopsetup
\startsetup
\command
- [\y!stelbovenin]
+ [\y!setuptop]
\type
[\c!opt!\c!val!\c!vars!]
\inheritvalues
- [\y!stelhoofdin]
+ [\y!setupheader]
[]
\inheritvariables
- [\y!stelhoofdin]
+ [\y!setupheader]
[]
\stopsetup
\startsetup
\command
- [\y!stelonderin]
+ [\y!setupbottom]
\type
[\c!opt!\c!val!\c!vars!]
\inheritvalues
- [\y!stelhoofdin]
+ [\y!setupheader]
[]
\inheritvariables
- [\y!stelhoofdin]
+ [\y!setupheader]
[]
\stopsetup
\startsetup
- \command[\y!geenhoofdenvoetregels]
+ \command[\y!noheaderandfooterlines]
\type[]
\stopsetup
\startsetup
- \command[\y!geenbovenenonderregels]
+ \command[\y!notopandbottomlines]
\type[]
\stopsetup
\startsetup
\command
- [\y!stelhoofdtekstenin]
+ [\y!setupheadertexts]
\type
[\c!opt!\c!val!\c!val!\c!val!]
\value
@@ -2892,7 +2916,7 @@
\startsetup
\command
- [\y!stelvoettekstenin]
+ [\y!setupfootertexts]
\type
[\c!opt!\c!val!\c!val!\c!val!]
\value
@@ -2908,7 +2932,7 @@
\startsetup
\command
- [\y!stelteksttekstenin]
+ [\y!setuptexttexts]
\type
[\c!opt!\c!val!\c!val!\c!val!]
\value
@@ -2924,7 +2948,7 @@
\startsetup
\command
- [\y!stelboventekstenin]
+ [\y!setuptoptexts]
\type
[\c!opt!\c!val!\c!val!\c!val!]
\value
@@ -2940,7 +2964,7 @@
\startsetup
\command
- [\y!stelondertekstenin]
+ [\y!setupbottomtexts]
\type
[\c!opt!\c!val!\c!val!\c!val!]
\value
@@ -3044,7 +3068,7 @@
[\c!identifier!]
[]
\value
- [\v!eerste,\v!laatste,\v!vorige,\v!beide,\v!alles]
+ [\v!eerste,\v!laatste,\v!vorige,\v!beide,\v!alles,\v!huidige]
[]
\stopsetup
@@ -3226,7 +3250,7 @@
\startsetup
\command
- [\y!toongrid]
+ [\y!showgrid]
\type
[]
\stopsetup
@@ -3657,7 +3681,7 @@
\startsetup
\command
- [\y!stelpositionerenin]
+ [\y!setuppositioning]
\type
[\c!vars!]
\variable
@@ -3692,7 +3716,7 @@
\startsetup
\command
- [\y!startpositioneren]
+ [\y!startpositioning]
\type
[\c!stp!]
\stopsetup
@@ -4216,9 +4240,11 @@
[\v!start]
\stopsetup
+% todo: \definieerformule
+
\startsetup
\command
- [\y!stelformulesin]
+ [\y!setupformulas]
\type
[\c!vars!]
\variable
@@ -4233,6 +4259,46 @@
[\c!rechts]
[\c!text!]
[{)}]
+ \variable
+ [\c!uitlijnen]
+ [\v!links,\v!midden,\v!rechts]
+ []
+ \variable
+ [\c!strut]
+ [\v!ja,\v!nee]
+ [\v!nee]
+ \variable
+ [\c!afstand]
+ [\c!dimension!]
+ [1em]
+ \variable
+ [\c!marge]
+ [\c!dimension!,\v!standaard,\v!ja,\v!nee]
+ [0pt]
+ \variable
+ [\c!linkermarge]
+ [\c!dimension!]
+ [0pt]
+ \variable
+ [\c!rechtermarge]
+ [\c!dimension!]
+ [0pt]
+ \variable
+ [\c!springvolgendein]
+ [\v!ja,\v!nee]
+ [\v!nee]
+ \variable
+ [\c!variant]
+ [\c!identifier!]
+ [\s!default]
+ \variable
+ [\c!voorwit]
+ [\c!dimension!]
+ [0pt]
+ \variable
+ [\c!na]
+ [\c!dimension!]
+ [0pt]
\stopsetup
\startsetup
@@ -4483,7 +4549,7 @@
\startsetup
\command
- [\y!definieerpapierformaat]
+ [\y!definepapersize]
\type
[\c!val!\c!vars!]
\value
@@ -4509,7 +4575,7 @@
\startsetup
\command
- [\y!stelpapierformaatin]
+ [\y!setuppapersize]
\type
[\c!vals!\c!opt!\c!vals!]
\value
@@ -4524,7 +4590,7 @@
\startsetup
\command
- [\y!stelarrangerenin]
+ [\y!setuparranging]
\type
[\c!vals!]
\value
@@ -4536,14 +4602,14 @@
\startsetup
\command
- [\y!toonprint]
+ [\y!showprint]
\type
[\c!vals!\c!vals!\c!vars!]
\inheritvariables
- [\y!stelpapierformaatin]
+ [\y!setuppapersize]
[]
\inheritvariables
- [\y!stelpapierformaatin]
+ [\y!setuppapersize]
[]
\inheritvariables
[\y!stellayoutin]
@@ -4552,7 +4618,7 @@
\startsetup
\command
- [\y!definieerbeeldmerk]
+ [\y!definelogo]
\type
[\c!val!\c!val!\c!val!\c!vars!]
\value
@@ -4579,7 +4645,7 @@
\startsetup
\command
- [\y!plaatsbeeldmerken]
+ [\y!placelogos]
\type
[\c!opt!\c!vals!]
\value
@@ -4718,6 +4784,14 @@
[\v!geen,\v!leeg,\v!hoog,\v!geenmarkering]
[]
\variable
+ [\c!tekst]
+ [\v!geen,\v!leeg,\v!hoog,\v!geenmarkering]
+ []
+ \variable
+ [\c!voet]
+ [\v!geen,\v!leeg,\v!hoog,\v!geenmarkering]
+ []
+ \variable
[\c!voor]
[\c!command!]
[\blanko]
@@ -4873,6 +4947,10 @@
[\c!number!]
[4]
\variable
+ [\c!start]
+ [\c!number!]
+ [1]
+ \variable
[\c!voor]
[\c!command!]
[]
@@ -4952,7 +5030,8 @@
\value
[a,A,KA,n,N,m,r,R,KR,\c!number!,\v!verder,
\v!standaard,\c!repeat!\v!ruim,\c!repeat!\v!aanelkaar,\v!opelkaar,
- \v!afsluiter,\v!aansluitend,\v!opmarge,\v!inmarge,\v!intro,\v!kolommen]
+ \v!afsluiter,\v!aansluitend,\v!opmarge,\v!inmarge,\v!intro,
+ \v!kolommen]
[\v!standaard]
\inheritvariables
[\y!stelopsommingin]
@@ -5361,33 +5440,33 @@
\startsetup
\command
- [\y!definieeropmaak]
+ [\y!definemakeup]
\type
[\c!val!\c!vars!]
\value
[\c!identifier!]
[]
\inheritvariables
- [\y!stelopmaakin]
+ [\y!setupmakeup]
[]
\stopsetup
\startsetup
\command
- [\y!startopmaak]
+ [\y!startmakeup]
\type
[\c!val!\c!opt!\c!vars!\c!stp!]
\value
[\c!identifier!]
[]
\inheritvariables
- [\y!stelopmaakin]
+ [\y!setupmakeup]
[]
\stopsetup
\startsetup
\command
- [\y!stelopmaakin]
+ [\y!setupmakeup]
\type
[\c!val!\c!vars!]
\value
@@ -5693,7 +5772,7 @@
\startsetup
\command
- [\y!positioneer]
+ [\y!position]
\type
[\c!poss!\c!arg!]
\value
@@ -5732,7 +5811,7 @@
\startsetup
\command
- [\y!stelachtergrondenin]
+ [\y!setupbackgrounds]
\type
[\c!opt!\c!val!\c!opt!\c!vals!\c!vars!]
\value
@@ -8592,7 +8671,7 @@
[\c!identifier!]
[]
\inheritvariables
- [\y!stelpositionerenin]
+ [\y!setuppositioning]
[]
\stopsetup
@@ -8605,7 +8684,7 @@
[\c!identifier!]
[]
\inheritvariables
- [\y!stelpositionerenin]
+ [\y!setuppositioning]
[]
\stopsetup
diff --git a/tex/context/base/spec-dpm.tex b/tex/context/base/spec-dpm.tex
index 5b009efd4..de5b90329 100644
--- a/tex/context/base/spec-dpm.tex
+++ b/tex/context/base/spec-dpm.tex
@@ -307,23 +307,23 @@
\newif\ifsharePDFactions \sharePDFactionsfalse
\def\doPDFaction width #1 height #2 action #3%
- {\ifcase\similarreference\relax
- \xdef\lastPDFaction{<<#3>>}%
- \or
- \ifsharePDFactions
- \immediate\pdfobj{<<#3>>}\xdef\lastPDFaction{\the\pdflastobj\space0 R}%
- \else
- \xdef\lastPDFaction{<<#3>>}%
- \fi
- \fi
- \ifcollectreferenceactions \else
+ {\ifcollectreferenceactions
+ \xdef\lastPDFaction{#3}%
+ \else
\bgroup
+ \xdef\lastPDFaction{<<#3>>}%
+ % this is yet untested
+ % \ifcase\similarreference\relax\or\ifsharePDFactions
+ % \global\advance\nofPDFsimilar by 1
+ % \special{pdf: object @PDF::sim:\the\nofPDFsimilar\space\lastPDFaction}%
+ % \xdef\lastPDFaction{@PDF::sim:\the\nofPDFsimilar}%
+ % \fi\fi
\scratchdimen=#1sp\edef\width {\the\scratchdimen\space}%
\scratchdimen=#2sp\edef\height{\the\scratchdimen\space}%
\special{pdf: ann width \width height \height
<</Subtype /Link /Border [0 0 0]
\ifhighlighthyperlinks \else /H /N \fi
- /A \lastPDFaction>>}%
+ /A \lastPDFaction\space>>}%
\egroup
\fi}
diff --git a/tex/context/base/spec-dvi.tex b/tex/context/base/spec-dvi.tex
index 7951e20b3..97428cbb3 100644
--- a/tex/context/base/spec-dvi.tex
+++ b/tex/context/base/spec-dvi.tex
@@ -61,7 +61,8 @@
%D \macros
%D {dosetposition,
-%D dosetpositionwhd}
+%D dosetpositionwhd,
+%D dosetpositionplus}
%D
%D The next specials only identify a position. It is up to
%D a \DVI\ postprocessing utility to merge the right commands
@@ -74,8 +75,9 @@
%D format:
%D
%D \starttypen
-%D \pospxy {identifier}{page}{x}{y}
-%D \pospxywhd{identifier}{page}{x}{y}{w}{h}{d}
+%D \pospxy {identifier}{page}{x}{y}
+%D \pospxywhd {identifier}{page}{x}{y}{w}{h}{d}
+%D \pospxyplus{identifier}{page}{x}{y}{w}{h}{d}{list}
%D \stoptypen
%D
%D The postprocessor should, of course, provide the \type
@@ -87,6 +89,9 @@
\definespecial\dosetpositionwhd#1#2#3#4%
{\special{pos:pxywhd "#1" #2 #3 #4}}
+\definespecial\dosetpositionplus#1#2#3#4#5%
+ {\special{pos:pxyplus "#1" #2 #3 #4 #5}}
+
%D The next special tells the position postprocessor what
%D page dimensions were used.
diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex
index 22880a2ff..cfc3e89ce 100644
--- a/tex/context/base/spec-fdf.tex
+++ b/tex/context/base/spec-fdf.tex
@@ -23,7 +23,7 @@
%D The \ACROBAT\ programs are not bug free. By setting the next
%D switch, we will at least try to prevent problems.
-\newif\ifovercomePDFbugs \overcomePDFbugstrue
+\newif\ifovercomePDFbugs \overcomePDFbugsfalse % true
\def\setPDFdestination#1%
{\bgroup
@@ -183,11 +183,32 @@
\let\lastPDFaction\empty
+%D We can safe a couple of references by moving this code
+%D to the specific drivers.
+%D
+%D The following code used to work okay, but as with any
+%D update of Acrobat Viewers, upward compatibility was
+%D just a dream.
+
\def\doPDFsetupopenaction%
- {\doPDFaddtocatalog{/OpenAction \lastPDFaction}}
+ {\doPDFaddtocatalog{/OpenAction <<\lastPDFaction>>}}
\def\doPDFsetupcloseaction%
- {\doPDFaddtocatalog{/CloseAction \lastPDFaction}}
+ {\doPDFaddtocatalog{/CloseAction <<\lastPDFaction>>}}
+
+%D So, starting with version~5 viewers, when the open actions
+%D started yto give problems, for testing purposes we
+%D decided use indirect actions.
+
+%\def\doPDFsetupopenaction%
+% {\doPDFdictionaryobject class FDF name local:openaction data \lastPDFaction
+% \doPDFgetobjectreference{FDF}{local:openaction}\PDFobjectreference
+% \doPDFaddtocatalog{/OpenAction \PDFobjectreference}}
+%
+%\def\doPDFsetupcloseaction%
+% {\doPDFdictionaryobject class FDF name local:closeaction data \lastPDFaction
+% \doPDFgetobjectreference{FDF}{local:closeaction}\PDFobjectreference
+% \doPDFaddtocatalog{/CloseAction \PDFobjectreference}}
\let\PDFopenpageaction \empty
\let\PDFclosepageaction\empty
@@ -204,8 +225,8 @@
\ifx\PDFclosepageaction\empty\!!donebfalse\else\donetrue\!!donebtrue\fi
\ifdone
\doPDFpageattribute
- {/AA <<\if!!donea/O \PDFopenpageaction \fi
- \if!!doneb/C \PDFclosepageaction\fi>>}%
+ {/AA <<\if!!donea/O <<\PDFopenpageaction >> \fi
+ \if!!doneb/C <<\PDFclosepageaction>> \fi>>}%
\fi
\global\let\PDFopenpageaction \empty
\global\let\PDFclosepageaction\empty}
@@ -495,6 +516,7 @@
%{\ifnum#2>0 /Dur #2 \fi
{\ifnum0<0#2 /Dur #2 \fi
\ifx\PDFpagetransitions\empty\else/Trans <<\PDFpagetransitions>>\fi}}
+% \ifx\PDFpagetransitions\empty\else/Trans <</Type /Trans \PDFpagetransitions>>\fi}}
%D \macros
%D {doPDFinsertmov}
@@ -1009,7 +1031,7 @@
\doPDFannotationobject class FDF name #1 width #2 height #3 data
{/Subtype /Widget /T (#1) /FT /Tx
/MaxLen \ifcase0#5 1000 \else#5 \fi
- /DV (#4) /V ()
+ /DV (#4) /V () % (#4) % value added
/Ff \FDFflag\space
/F \FDFplus\space
/DA (\FDFattributes)
@@ -1023,7 +1045,7 @@
{/T (#1) /FT /Tx
/MaxLen \ifcase0#5 1000 \else#5 \fi
/Kids [\FDFkids]
- /DV (#4) /V ()
+ /DV (#4) /V () % (#4) % value added
/Ff \FDFflag\space
/F \FDFplus\space
/DA (\FDFattributes)
@@ -1116,8 +1138,8 @@
\newif\ifFDFvalues
-\def\doFDFpresetpushcheckfield#1#2#3#4#5#6#7#8%
- {\bgroup
+\def\doFDFpresetpushcheckfield#1#2#3#4#5#6#7#8% in acro<5 (\FDFdefault)
+ {\bgroup % in acro>5 /\FDFdefault
\ifcase#8\relax\FDFvaluesfalse\else\FDFvaluestrue\fi
\setFDFswitches[#5]%
\setFDFactions[#7]%
@@ -1126,7 +1148,7 @@
\doFDFdefault{#6}{#4}%
\doPDFannotationobject class FDF name #1 width #2 height #3 data
{/Subtype /Widget /T (#1) /FT /Btn
- \ifFDFvalues /DV (\FDFdefault) /V ()\fi
+ \ifFDFvalues /DV /\FDFdefault\space /V ()\fi
/Ff \FDFflag\space
/F \FDFplus\space
\FDFappearance\space
@@ -1138,7 +1160,7 @@
\doPDFdictionaryobject class FDF name #1 data
{/T (#1) /FT /Btn
/Kids [\FDFkids]
- \ifFDFvalues /DV (\FDFdefault) /V ()\fi
+ \ifFDFvalues /DV /\FDFdefault\space /V ()\fi
/Ff \FDFflag\space
/F \FDFplus\space
\FDFactions}%
diff --git a/tex/context/base/spec-ini.tex b/tex/context/base/spec-ini.tex
index ffa0b8014..77c5e0d0c 100644
--- a/tex/context/base/spec-ini.tex
+++ b/tex/context/base/spec-ini.tex
@@ -258,6 +258,14 @@
\def\@@specarg@@{@@specarg@@}
\def\@@specexc@@{@@specexc@@}
+% not faster
+%
+% \def\@@specfil@@{@sp@f@}
+% \def\@@speclst@@{@sp@l@}
+% \def\@@speccat@@{@sp@c@}
+% \def\@@specarg@@{@sp@a@}
+% \def\@@specexc@@{@sp@e@}
+
\let\currentspecial =\empty
\let\currentspecialfile=\empty
\let\preloadedspecials =\empty
@@ -569,87 +577,6 @@
\def\doifspecialavailableelse#1#2#3%
{\doifelsevaluenothing{\@@speclst@@\string#1}{#3}{#2}}
-% %D This is some new, experimental code, used for testing some
-% %D proposals of Laurent Siebenmann on behalf of the
-% %D \kap{EMJ} discussionlist.
-%
-% \newif\ifexternalspecials \externalspecialsfalse
-% \newif\ifspecialstatus \specialstatustrue
-%
-% \newwrite\specialfile
-%
-% \def\openspecialfile%
-% {\immediate\openout\specialfile=\jobname.etc\relax}
-%
-% \def\closespecialfile%
-% {\immediate\closeout\specialfile}
-%
-% \let\internalspecial=\special
-%
-% \def\externalspecial#1%
-% {\internalspecial{}%
-% \immediate\write\specialfile{\currentspecialdriver\space: #1}}
-%
-% \def\doinstallspecial[#1][#2][#3]%
-% {\setvalue{\@@specexc@@\string#1}{}%
-% \setvalue{\@@speclst@@\string#1}{}%
-% \setvalue{\@@speccat@@\string#1}{#2}%
-% \setvalue{\@@specarg@@\string#1}{#3}%
-% \addtocommalist{\string#1}\@@allspecials
-% \def#1{\executespecial#1}}
-%
-% \def\resetspecials%
-% {\def\docommando##1%
-% {\setvalue{\@@specexc@@##1}{}%
-% \setvalue{\@@speclst@@##1}{}}%
-% \processcommacommand[\@@allspecials]\docommando
-% \showmessage{\m!specials}{3}{\preloadedspecials}}
-%
-% \def\executespecials#1#2%
-% {\edef\supportedspecials{\getvalue{\@@speclst@@\string#1}}%
-% \def\doonespecial##1%
-% {\doifdefined{##1\string#1}
-% {\def\currentspecialdriver{##1}%
-% \getvalue{##1\string#1}#2\relax}}%
-% \ifexternalspecials
-% \let\special=\externalspecial
-% \doifelse{\supportedspecials}{}
-% {\ifspecialstatus
-% \immediate\write\specialfile{}%
-% \immediate\write\specialfile{skipping : \string#1}
-% \immediate\write\specialfile{}%
-% \fi}
-% {\ifspecialstatus
-% \immediate\write\specialfile{}%
-% \immediate\write\specialfile{executing : \string#1}%
-% \immediate\write\specialfile{supported : \supportedspecials}%
-% \fi
-% \immediate\write\specialfile{}%
-% \processcommacommand[\supportedspecials]\doonespecial}%
-% \else
-% \let\special=\internalspecial
-% \doifelse{\getvalue{\@@speccat@@\string#1}}{or}
-% {\doonespecial{\getvalue{\@@specexc@@\string#1}}}
-% {\processcommacommand[\supportedspecials]\doonespecial}%
-% \fi}
-%
-% \def\definespecial#1%
-% {\ifx#1\undefined
-% \showmessage{\m!specials}{4}{\string#1}%
-% \def\next%
-% {\def\@@illegalspecial@@}%
-% \else
-% \def\next%
-% {\edef\@@newspeclst@@{\getvalue{\@@speclst@@\string#1}}%
-% \addtocommalist{\currentspecial}\@@newspeclst@@
-% \setevalue{\@@speclst@@\string#1}{\@@newspeclst@@}%
-% \setevalue{\@@specexc@@\string#1}{\currentspecial}%
-% \setvalue{\currentspecial\string#1}}%
-% \fi
-% \next}
-%
-% %D So far for the experiment.
-
%D The following libraries are defined. Two postscript
%D drivers are supported, as well as two mechanisms for
%D interactive texts.
@@ -1450,7 +1377,8 @@
\installspecial[\doinsertcomment] [and] [7]
%D \macros
-%D {dosetposition, dosetpositionwhd, dosetpositionpapersize}
+%D {dosetposition, dosetpositionwhd, dosetpositionplus,
+%D dosetpositionpapersize}
%D
%D Not natural to \TEX, but available in \PDFTEX, and by
%D means of postprocessed \DVI, we can save and call upon
@@ -1459,6 +1387,7 @@
%D \starttypen
%D \dosetposition {identifier}
%D \dosetpositionwhd {identifier} {width} {height} {depth}
+%D \dosetpositionplus {identifier} {width} {height} {depth} {list}
%D \dosetpositionpapersize {width} {height}
%D \stoptypen
%D
@@ -1467,6 +1396,7 @@
\installspecial [\dosetposition] [or] [1]
\installspecial [\dosetpositionwhd] [or] [4]
+\installspecial [\dosetpositionplus] [or] [5]
\installspecial [\dosetpositionpapersize] [or] [2]
%D So far for the installation. For quite some time the
diff --git a/tex/context/base/spec-pdf.tex b/tex/context/base/spec-pdf.tex
index 6b1565eff..576d99925 100644
--- a/tex/context/base/spec-pdf.tex
+++ b/tex/context/base/spec-pdf.tex
@@ -326,55 +326,23 @@
\newif\ifsharePDFactions \sharePDFactionstrue
-% \def\doPDFaction width #1 height #2 action #3%
-% {\bgroup
-% \ScaledPointsToBigPoints{#1}\width
-% \ScaledPointsToBigPoints{#2}\height
-% \ifnum\similarreference=1
-% %\ifsharePDFactions
-% % \global\advance\nofPDFsimilar by 1
-% % \special
-% % {\@@insertpostscriptretain
-% % [ /_objdef {PDF::sim:\the\nofPDFsimilar} /type /dict /OBJ pdfmark
-% % [ {PDF::sim:\the\nofPDFsimilar} << #3 >> /PUT pdfmark}%
-% % \xdef\lastFDFaction{{PDF::sim:\the\nofPDFsimilar}}%
-% %\else
-% \xdef\lastFDFaction{<<#3>>}%
-% %\fi
-% \fi
-% \special
-% {\@@insertpostscriptretain
-% [ \ifcase\similarreference
-% /Action <<#3>>
-% \else
-% /Action \lastFDFaction\space
-% \fi
-% /Rect [0 0 \width\space \height]
-% /Border [0 0 0]
-% /Subtype /Link
-% /ANN
-% pdfmark}%
-% \egroup}
-
\def\doPDFaction width #1 height #2 action #3%
- {\bgroup
- \ScaledPointsToBigPoints{#1}\width
- \ScaledPointsToBigPoints{#2}\height
- \ifcase\similarreference\relax
+ {\ifcollectreferenceactions
+ \xdef\lastPDFaction{#3}%
+ \else
+ \bgroup
\xdef\lastPDFaction{<<#3>>}%
- \or
- %\ifsharePDFactions
- % \global\advance\nofPDFsimilar by 1
- % \special
- % {\@@insertpostscriptretain
- % [ /_objdef {PDF::sim:\the\nofPDFsimilar} /type /dict /OBJ pdfmark
- % [ {PDF::sim:\the\nofPDFsimilar} << #3 >> /PUT pdfmark}%
- % \xdef\lastPDFaction{{PDF::sim:\the\nofPDFsimilar}}%
- %\else
- \xdef\lastPDFaction{<<#3>>}%
- %\fi
- \fi
- \ifcollectreferenceactions \else
+ % does not work well with distiller 4
+ % \ifcase\similarreference\relax\or\ifsharePDFactions
+ % \global\advance\nofPDFsimilar by 1
+ % \special
+ % {\@@insertpostscriptretain
+ % [ /_objdef {PDF::sim:\the\nofPDFsimilar} /type /dict /OBJ pdfmark
+ % [ {PDF::sim:\the\nofPDFsimilar} \lastPDFaction\space /PUT pdfmark}%
+ % \xdef\lastPDFaction{{PDF::sim:\the\nofPDFsimilar}}%
+ % \fi\fi
+ \ScaledPointsToBigPoints{#1}\width
+ \ScaledPointsToBigPoints{#2}\height
\special
{\@@insertpostscriptretain
[ /Action \lastPDFaction\space
@@ -384,8 +352,8 @@
/Subtype /Link
/ANN
pdfmark}%
- \fi
- \egroup}
+ \egroup
+ \fi}
\def\doPDFannotation width #1 height #2 data #3%
{\bgroup
diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex
index 2c830b47b..7dba68e6f 100644
--- a/tex/context/base/spec-tpd.tex
+++ b/tex/context/base/spec-tpd.tex
@@ -750,7 +750,7 @@
\definespecial\doregistercalculationset{\doFDFregistercalculationset}
%D \macros
-%D {dosetposition, dosetpositionwdh}
+%D {dosetposition, dosetpositionwdh, dosetpositionplus}
%D
%D Opposite to its \DVI\ counterpart, the \PDFTEX\ backend
%D can provide positional information directly. Since
@@ -794,6 +794,15 @@
{\noexpand\number\pdflastypos}%
{#2}{#3}{#4}}
+\definespecial\dosetpositionplus#1#2#3#4#5%
+ {\pdfsavepos
+ \dolazysavepositionplus
+ {#1}%
+ {\noexpand\realfolio}%
+ {\noexpand\number\pdflastxpos}%
+ {\noexpand\number\pdflastypos}%
+ {#2}{#3}{#4}{#5}}
+
%D \macros
%D {doPDFdestination}
%D
@@ -816,17 +825,14 @@
\ifnum\pdftexversion>13
\def\doPDFaction width #1 height #2 action #3%
- {\ifcase\similarreference\relax
+ {\ifcollectreferenceactions
+ \xdef\lastPDFaction{#3}%
+ \else
\xdef\lastPDFaction{<<#3>>}%
- \or
- \ifsharePDFactions
- \immediate\pdfobj{<<#3>>}%
+ \ifcase\similarreference\relax\or\ifsharePDFactions
+ \immediate\pdfobj{\lastPDFaction}%
\xdef\lastPDFaction{\the\pdflastobj\space0 R}%
- \else
- \xdef\lastPDFaction{<<#3>>}%
- \fi
- \fi
- \ifcollectreferenceactions \else
+ \fi\fi
\pdfannot
width #1sp height #2sp depth 0sp
{/Subtype /Link
@@ -838,17 +844,14 @@
\else
\def\doPDFaction width #1 height #2 action #3%
- {\ifcase\similarreference\relax
+ {\ifcollectreferenceactions
+ \xdef\lastPDFaction{#3}%
+ \else
\xdef\lastPDFaction{<<#3>>}%
- \or
- \ifsharePDFactions
- \immediate\pdfobj{<<#3>>}%
+ \ifcase\similarreference\relax\or\ifsharePDFactions
+ \immediate\pdfobj{\lastPDFaction}%
\xdef\lastPDFaction{\the\pdflastobj\space0 R}%
- \else
- \xdef\lastPDFaction{<<#3>>}%
- \fi
- \fi
- \ifcollectreferenceactions \else
+ \fi\fi
\pdfannotlink % could be \pdfannot if not the - problem was there
width #1sp height #2sp depth 0sp
user {/Subtype /Link
diff --git a/tex/context/base/supp-box.tex b/tex/context/base/supp-box.tex
index c2640e157..c31c2f0ec 100644
--- a/tex/context/base/supp-box.tex
+++ b/tex/context/base/supp-box.tex
@@ -29,6 +29,15 @@
\ifx\globalscratchbox\undefined \newbox\globalscratchbox \fi
%D \macros
+%D {resetbox, emptybox}
+%D
+%D Let's start with an easy one. The next macro hides the
+%D ugly \type {@} in \type {\voidb@x}.
+
+\def\emptybox {\box\voidb@x}
+\def\resetbox#1{\setbox#1\box\voidb@x}
+
+%D \macros
%D {nextdepth}
%D
%D Let's start with a rather simple declaration. Sometimes we
@@ -46,9 +55,9 @@
%D one is presented first.
\def\smashbox#1%
- {\wd#1=\!!zeropoint
- \ht#1=\!!zeropoint
- \dp#1=\!!zeropoint}
+ {\wd#1=\zeropoint
+ \ht#1=\zeropoint
+ \dp#1=\zeropoint}
%D \macros
%D {hsmashbox,vsmashbox}
@@ -57,11 +66,35 @@
%D the mode, horizontal or vertical, one can use:
\def\hsmashbox#1%
- {\wd#1=\!!zeropoint}
+ {\wd#1=\zeropoint}
\def\vsmashbox#1%
- {\ht#1=\!!zeropoint
- \dp#1=\!!zeropoint}
+ {\ht#1=\zeropoint
+ \dp#1=\zeropoint}
+
+%D The next implementation is less sensitive for spurious
+%D spaces.
+
+\newcount\registercount
+
+\def\dowithregister#1%
+ {\def\dodowithregister{#1}%
+ \afterassignment\dodowithregister\registercount}
+
+\def\smashbox%
+ {\dowithregister
+ {\wd\registercount\zeropoint
+ \ht\registercount\zeropoint
+ \dp\registercount\zeropoint}}
+
+\def\hsmashbox%
+ {\dowithregister
+ {\wd\registercount\zeropoint}}
+
+\def\vsmashbox%
+ {\dowithregister
+ {\ht\registercount\zeropoint
+ \dp\registercount\zeropoint}}
%D \macros
%D {hsmash,vsmash,
@@ -88,7 +121,7 @@
%
% The best:
-\def\dosomesmash#1%
+\def\dosomesmash#1% (begin|end)group ipv (b|e)group ?
{\bgroup\dowithnextbox{#1\nextbox\box\nextbox\egroup}}
\def\hsmash {\dosomesmash\hsmashbox\normalhbox}
@@ -96,6 +129,112 @@
\def\hsmashed{\dosomesmash\smashbox \normalhbox}
\def\vsmashed{\dosomesmash\smashbox \normalvbox}
+%D \macros
+%D {smash}
+%D
+%D This smash alternative takes an optional arg [whdtb] as
+%D well as is potentially catcode safer. It is needed by the
+%D math module (although the \type {\leavevmode} is not added
+%D here).
+
+\def\smash%
+ {\futurelet\nexttoken\dosmash}
+
+\def\dosmash%
+ {\ifx\nexttoken[%
+ \@EA\dodosmash
+ \else
+ \@EA\dodosmash\@EA[\@EA h\@EA d\@EA]%
+ \fi}
+
+% \def\smash% test
+% {\doifnextcharelse{[}{\dodosmash}{\dodosmash[hd]}}
+
+\def\dodosmash[#1]%
+ {\edef\@@smash{#1}\futurelet\nexttoken\dododosmash}
+
+\def\dododosmash%
+ {\ifmmode
+ \def\next##1{\mathpalette\mathsm@sh{##1}}%
+ \else\ifx\nexttoken\bgroup
+ \let\next\finsm@sh
+ \else
+ \def\next##1{\finsm@sh{##1}}%
+ \fi\fi
+ \next}
+
+\def\mathsm@sh#1#2% redefined plain macro
+ {\finsm@sh{$\m@th#1{#2}$}}
+
+\def\makesm@sh#1% redefined plain macro (handles t b h d w)
+ {\if#1w\wd\nextbox\z@\else
+ \if#1h\ht\nextbox\z@\else
+ \if#1d\dp\nextbox\z@\else
+ \if#1t\ht\nextbox\z@\else
+ \if#1b\dp\nextbox\z@\fi\fi\fi\fi\fi}
+
+\def\finsm@sh% redefined plain macro
+ {\dowithnextbox
+ {\@EA\handletokens\@@smash\with\makesm@sh\box\nextbox}\hbox}
+
+%D \starttabulatie[|l|l|]
+%D \NC w \NC \ruledhbox{\smash [w]{This is some great smashing, isn't it?}} \NC \NR
+%D \NC h \NC \ruledhbox{\smash [h]{This is some great smashing, isn't it?}} \NC \NR
+%D \NC d \NC \ruledhbox{\smash [d]{This is some great smashing, isn't it?}} \NC \NR
+%D \NC tb \NC \ruledhbox{\smash [tb]{This is some great smashing, isn't it?}} \NC \NR
+%D \NC whd \NC \ruledhbox{\smash[whd]{This is some great smashing, isn't it?}} \NC \NR
+%D \stoptabulatie
+
+%D \macros
+%D {phantom, hphantom, vphantom, mathstrut}
+%D
+%D The next implementation of \type {\phantom} cum suis does
+%D not grab an argument in the non||math case, which is better.
+
+\def\phantom {\ph@nt\nextbox\nextbox\nextbox}
+\def\vphantom{\ph@nt\nextbox\nextbox\voidb@x}
+\def\hphantom{\ph@nt\voidb@x\voidb@x\nextbox}
+
+%D Due to a complicated call to \type {\mathpallete} and
+%D thereby \type {\mathchoice}, the next macro looks ugly.
+%D We also take care of non||braced arguments.
+
+\def\ph@nt#1#2#3%
+ {\def\doph@nt%
+ {\ifmmode
+ \def\mathph@nt####1####2{\makeph@nt#1#2#3{$\m@th####1{####2}$}}%
+ \def\nextph@nt{\mathpalette\mathph@nt}%
+ \else\ifx\nextph@nt\bgroup
+ \def\nextph@nt{\makeph@nt#1#2#3}%
+ \else
+ \def\nextph@nt####1{\makeph@nt#1#2#3{####1}}%
+ \fi\fi
+ \nextph@nt}%
+ \futurelet\nextph@nt\doph@nt}
+
+\def\makeph@nt#1#2#3%
+ {\begingroup
+ \dowithnextbox
+ {\setbox\scratchbox\null
+ \ht\scratchbox\ht#1\dp\scratchbox\dp#2\wd\scratchbox\wd#3%
+ \box\scratchbox
+ \endgroup}
+ \hbox}
+
+% used in table
+%
+% \let\ifv@\undefined \let\v@true\undefined \let\v@false\undefined
+% \let\ifh@\undefined \let\h@true\undefined \let\h@false\undefined
+
+\let\finph@nt\undefined
+
+% %D We have to redefine plain's \type {\mathstrut}. Well,
+% %D this is not longer needed.
+% %D
+% %D \starttypen
+% %D \def\mathstrut{\vphantom{(}}
+% %D \stoptypen
+
%D \macros
%D {getboxheight}
%D
@@ -120,7 +259,7 @@
%D \stoptypen
\def\getboxheight#1\of#2\box#3%
- {#1=\ht#3\advance#1 by \dp#3\relax}
+ {#1=\ht#3\advance#1\dp#3\relax}
%D \macros
%D {doiftextelse, doiftext}
@@ -137,7 +276,7 @@
\def\doiftextelse#1#2#3%
{\bgroup
\setbox0=\hbox{#1}%
- \ifdim\wd0>\!!zeropoint
+ \ifdim\wd0>\zeropoint
\egroup#2%
\else
\egroup#3%
@@ -255,8 +394,25 @@
%D Now we can redefine \type {\dowithnextbox} as follows:
\def\dowithnextbox%
- {\dowithnextboxcontent{}}
-
+ {\dowithnextboxcontent\empty}
+
+%D \macros
+%D {llap, rlap, tlap, blap}
+%D
+%D Some well known friends.
+
+\def\rlap{\begingroup\dowithnextbox{\normalhbox to \zeropoint
+ {\box\nextbox\normalhss}\endgroup}\normalhbox}
+
+\def\llap{\begingroup\dowithnextbox{\normalhbox to \zeropoint
+ {\normalhss\box\nextbox}\endgroup}\normalhbox}
+
+\def\tlap{\begingroup\dowithnextbox{\normalvbox to \zeropoint
+ {\normalvss\box\nextbox}\endgroup}\normalvbox}
+
+\def\blap{\begingroup\dowithnextbox{\normalvbox to \zeropoint
+ {\box\nextbox\normalvss}\endgroup}\normalvbox}
+
%D \macros
%D {beginofshapebox,
%D reshapebox, doreshapebox,
@@ -397,22 +553,22 @@
{\doreshapebox
{#1}
{\penalty\shapepenalty}
- {\kern\shapekern}
- {\vskip\shapeskip}}
+ {\kern \shapekern }
+ {\vskip \shapeskip }}
%\def\doreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip
% {\setbox\newshapebox=\normalvbox
% \bgroup
% \unvcopy\oldshapebox
-% \setbox\newshapebox=\box\voidb@x
+% \resetbox\newshapebox
% \shapecounter=0
% \doloop{\dodoreshapebox{#1}{#2}{#3}{#4}}%
% \unvbox\newshapebox
% \egroup}
%
%\def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip
-% {\ifdim\lastskip=\!!zeropoint\relax
-% \ifdim\lastkern=\!!zeropoint\relax
+% {\ifdim\lastskip=\zeropoint\relax
+% \ifdim\lastkern=\zeropoint\relax
% \ifnum\lastpenalty=0
% \setbox\shapebox=\lastbox
% \ifvoid\shapebox
@@ -454,20 +610,20 @@
\newbox\tmpshapebox
\def\doreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip
- {\ifdim\ht\oldshapebox=\!!zeropoint
+ {\ifdim\ht\oldshapebox=\zeropoint
\setbox\newshapebox=\normalvbox{}%
\else
\setbox\newshapebox=\normalvbox
{\unvcopy\oldshapebox
- \setbox\newshapebox=\box\voidb@x
+ \resetbox\newshapebox
\shapecounter=0
\doloop{\dodoreshapebox{#1}{#2}{#3}{#4}}}%
\setbox\newshapebox\box\tmpshapebox
\fi}
\def\dodoreshapebox#1#2#3#4% \shapebox, \shapepenalty, \shapekern, \shapeskip
- {\ifdim\lastskip=\!!zeropoint\relax
- \ifdim\lastkern=\!!zeropoint\relax
+ {\ifdim\lastskip=\zeropoint\relax
+ \ifdim\lastkern=\zeropoint\relax
\ifnum\lastpenalty=0
\setbox\shapebox=\lastbox
\ifvoid\shapebox
@@ -519,7 +675,7 @@
\reshapingboxtrue
\hbox to \shapesignal{\strut\hss} % plus \strut
\prevdepth\dp\strutbox % hm
- }%\nointerlineskip} % suppress parskip
+ }%\nointerlineskip} % suppress parskip
\def\endofshapebox%
{\endgraf
@@ -529,16 +685,16 @@
\let\endshapebox =\endofshapebox
%\def\flushshapebox%
-% {\ifdim\ht\newshapebox=\!!zeropoint\relax
+% {\ifdim\ht\newshapebox=\zeropoint\relax
% \else
% % make \prevdepth legal
% % \par before the next \vskip gives far worse results
-% \ifdim\parskip>\!!zeropoint\vskip\parskip\else\par\fi
+% \ifdim\parskip>\zeropoint\vskip\parskip\else\par\fi
% % and take a look
% \ifdim\prevdepth=-1000pt
-% \prevdepth=\!!zeropoint
+% \prevdepth=\zeropoint
% \fi
-% \ifdim\prevdepth<\!!zeropoint\relax
+% \ifdim\prevdepth<\zeropoint\relax
% % something like a line or a signal or ...
% \donetrue
% \else\ifinner
@@ -564,16 +720,16 @@
\def\flushshapebox%
{\bgroup
- \ifdim\ht\newshapebox=\!!zeropoint\relax
+ \ifdim\ht\newshapebox=\zeropoint\relax
\else
% make \prevdepth legal
% \par before the next \vskip gives far worse results
- \ifdim\parskip>\!!zeropoint\vskip\parskip\else\par\fi
+ \ifdim\parskip>\zeropoint\vskip\parskip\else\par\fi
% and take a look
\ifdim\prevdepth=-1000pt
- \prevdepth=\!!zeropoint
+ \prevdepth=\zeropoint
\fi
- \ifdim\prevdepth<\!!zeropoint\relax
+ \ifdim\prevdepth<\zeropoint\relax
% something like a line or a signal or ...
\donetrue
\else\ifinner
@@ -587,7 +743,7 @@
{\everypar\emptytoks\vbox{\strut}}\nobreak
\kern-\lineheight % geen \vskip
\kern-\parskip
-% \vskip-\dp\strutbox
+ % \vskip-\dp\strutbox
\fi\fi\fi
\scratchdimen\dp\newshapebox
\unvbox\newshapebox
@@ -614,7 +770,7 @@
% \omlijnd[offset=0pt,hoogte=8mm,uitlijnen={rechts,laho}]{\bfa test}
\def\innerflushshapebox%
- {\ifdim\ht\newshapebox=\!!zeropoint\relax
+ {\ifdim\ht\newshapebox=\zeropoint\relax
\else
\unvcopy\newshapebox\relax
% \kern-\dp\newshapebox\relax
@@ -641,8 +797,8 @@
\def\shapedhbox%
{\dowithnextbox
- {\ht\nextbox=\!!zeropoint
- \dp\nextbox=\!!zeropoint
+ {\ht\nextbox=\zeropoint
+ \dp\nextbox=\zeropoint
\box\nextbox}
\hbox}
@@ -691,7 +847,7 @@
\widowpenalty=0
\clubpenalty=0
\setbox0=\vbox
- {\hsize\!!zeropoint \ #3}%
+ {\hsize\zeropoint \ #3}%
\ifnum#1>0
\dorecurse{#1}
{\setbox2=\hbox
@@ -710,7 +866,7 @@
{\unvbox2
\setbox2=\lastbox
\hbox{\unhbox2}}}%
- \ifdim\ht0>\!!zeropoint
+ \ifdim\ht0>\zeropoint
\repeat}%
\ht0=\ht\strutbox
\dp0=\dp\strutbox
@@ -768,7 +924,7 @@
\def\dodoboundtext#1%
{\setbox2=\hbox{#1}%
\advance\dimen0 by -\wd2
- \ifdim\dimen0>\!!zeropoint\relax#1\fi}%
+ \ifdim\dimen0>\zeropoint\relax#1\fi}%
\def\doboundtext#1#2#3%
{\hbox
@@ -829,7 +985,7 @@
%D \unvbox\nextbox
%D \setbox\nextbox=\lastbox
%D \global\setbox1=\hbox
-%D {\unhbox\nextbox\unskip\kern\!!zeropoint\box\scratchbox\unskip}}%
+%D {\unhbox\nextbox\unskip\kern\zeropoint\box\scratchbox\unskip}}%
%D \unhbox1
%D \else
%D \unhbox\nextbox
@@ -852,7 +1008,7 @@
{\widowpenalty=0
\clubpenalty=0
\scratchdimen=#1\relax
- \ifdim\scratchdimen<\!!zeropoint\relax % we'll take the last line
+ \ifdim\scratchdimen<\zeropoint\relax % we'll take the last line
\donefalse
\scratchdimen=-\scratchdimen
\else
@@ -868,9 +1024,9 @@
\veryraggedright
\strut
\ifdone \else
- \parfillskip=\!!zeropoint
- \rightskip=\!!zeropoint
- \hskip\!!zeropoint \!!plus 1\!!fill % \hsize
+ \parfillskip=\zeropoint
+ \rightskip=\zeropoint
+ \hskip\zeropoint \!!plus 1\!!fill % \hsize
\fi
\unhcopy0}%
\ifdim\ht\nextbox>\ht\strutbox
@@ -887,7 +1043,7 @@
\setbox\nextbox=\lastbox
\global\setbox1=\hbox
{\ifdone
- \unhbox\nextbox\unskip\kern\!!zeropoint\box\scratchbox
+ \unhbox\nextbox\unskip\kern\zeropoint\box\scratchbox
\else
\box\scratchbox\unhbox\nextbox
\fi
@@ -1014,7 +1170,7 @@
{%\hyphenpenalty10000 % this one fails in \url breaking,
\lefthyphenmin=\!!maxcard % but this trick works ok, due to them
\righthyphenmin=\!!maxcard % total>63, when no hyphenation is done
- \hsize\!!zeropoint
+ \hsize\zeropoint
\unhcopy0}% == #1
\ifdim\ht0=\ht2
\isolatedwordsfalse
@@ -1037,7 +1193,7 @@
{\unhbox4
\unskip\unpenalty % remove end of line stuff
\global\dimen1=\lastkern}}}}}%
- \ifdim\ht2>\!!zeropoint\relax
+ \ifdim\ht2>\zeropoint\relax
\ifdim\dimen1=\compoundbreakpoint
\allowbreak
\else
@@ -1046,7 +1202,7 @@
\repeat
\unskip}%
\unhbox0\unskip
- \ifdim\isolatedlastskip=\!!zeropoint\relax\else % added
+ \ifdim\isolatedlastskip=\zeropoint\relax\else % added
\hskip\isolatedlastskip
\fi
\fi
@@ -1152,8 +1308,8 @@
\bgroup
\mindermeldingen
\forgetall
- \setbox0=\hbox{\vrule\!!width \!!zeropoint#1}%
- \setbox2=\vbox{\hrule\!!height\!!zeropoint#1}%
+ \setbox0=\hbox{\vrule\!!width \zeropoint#1}%
+ \setbox2=\vbox{\hrule\!!height\zeropoint#1}%
\advance\vsize by \ht2
\advance\hsize by \wd0
\vbox to \vsize
@@ -1212,10 +1368,10 @@
{\bgroup
\dowithnextbox
{\setlocalhsize
- \setbox0=\hbox{\vrule\!!width\!!zeropoint#1}%
- \setbox2=\vbox{\hrule\!!height\!!zeropoint#1}%
- \hsize\ifdim\wd0=\!!zeropoint\hsize\else\wd0\fi
- \vsize\ifdim\ht2=\!!zeropoint\vsize\else\ht2\fi
+ \setbox0=\hbox{\vrule\!!width\zeropoint#1}%
+ \setbox2=\vbox{\hrule\!!height\zeropoint#1}%
+ \hsize\ifdim\wd0=\zeropoint\hsize\else\wd0\fi
+ \vsize\ifdim\ht2=\zeropoint\vsize\else\ht2\fi
\vbox to \vsize{\vss\hbox to \hsize{\hss\box\nextbox\hss}\vss}%
\egroup}%
\hbox}
@@ -1265,7 +1421,7 @@
\setbox\rigidcolumnbox=\vbox
{\line{}\goodbreak\unvbox#1\removebottomthings}%
\splittopskip=\openstrutheight
- \setbox\scratchbox=\vsplit\rigidcolumnbox to \!!zeropoint
+ \setbox\scratchbox=\vsplit\rigidcolumnbox to \zeropoint
\scratchdimen=\ht\rigidcolumnbox
\divide\scratchdimen by \rigidcolumns
\getnoflines\scratchdimen
@@ -1335,7 +1491,7 @@
\def\stopvboxtohbox%
{\egroup
- \dp0=\!!zeropoint
+ \dp0=\zeropoint
\ht0=\vboxtohboxfactor\wd0
\box0
\egroup}
@@ -1356,7 +1512,7 @@
% \dimen0=\globalvhwidth
% \dimen0=\vboxtohboxfactor\dimen0
% \advance\dimen0 by \globalvhlines\lineheight
-% \dp0=\!!zeropoint
+% \dp0=\zeropoint
% \ht0=\dimen0
% %\writestatus{guessed size}
% % {w:\the\wd0\space\space
@@ -1413,16 +1569,16 @@
\fi
\ht\hhbox=\ht\strutbox
\dp\hhbox=\dp\strutbox
- \ifdim\hhboxindent=\!!zeropoint\else
+ \ifdim\hhboxindent=\zeropoint\else
\setbox\hhbox=\hbox{\hskip-\hhboxindent\box\hhbox}%
- \hhboxindent=\!!zeropoint
+ \hhboxindent=\zeropoint
\fi
\global\lasthhboxwidth=\wd\hhbox
#2\relax
\ifvoid\unhhedbox
\exitloop
\else
- \hskip\!!zeropoint \!!plus \!!zeropoint
+ \hskip\zeropoint \!!plus \zeropoint
\fi}%
\egroup}
@@ -1479,13 +1635,13 @@
\def\doifcontent#1#2#3%
{\dowithnextbox
{\ifhbox\nextbox
- \ifdim\wd\nextbox>\!!zeropoint
+ \ifdim\wd\nextbox>\zeropoint
#1\unhbox\nextbox#2\relax
\else
#3\relax
\fi
\else
- \ifdim\ht\nextbox>\!!zeropoint
+ \ifdim\ht\nextbox>\zeropoint
#1\unvbox\nextbox#2\relax
\else
#3\relax
@@ -1522,7 +1678,7 @@
\def\processboxes#1%
{\bgroup
\def\doprocessbox{#1}% #1 can be redefined halfway
- \setbox\processbox=\box\voidb@x
+ \resetbox\processbox
\afterassignment\dogetprocessbox\let\next=}
\def\endprocessboxes%
@@ -1598,10 +1754,10 @@
\fi
\ifdim\ht\nextbox>\ht\processbox
\setbox\processbox=\vbox to \ht\nextbox
- {\dp\processbox=\!!zeropoint\vss\box\processbox\vss}%
+ {\dp\processbox=\zeropoint\vss\box\processbox\vss}%
\else
\setbox\nextbox=\vbox to \ht\processbox
- {\dp\nextbox=\!!zeropoint\vss\box\nextbox\vss}%
+ {\dp\nextbox=\zeropoint\vss\box\nextbox\vss}%
\fi
\dp\nextbox=\scratchdimen
\dp\processbox=\scratchdimen
@@ -1769,8 +1925,8 @@
\def\boxofsize#1%
{\bgroup
- \sizeofbox\!!zeropoint
- \scratchdimen\!!zeropoint
+ \sizeofbox\zeropoint
+ \scratchdimen\zeropoint
\def\docommando%
{\advance\sizeofbox\scratchdimen
\futurelet\next\dodocommando}%
@@ -1781,7 +1937,6 @@
\@EA\afterassignment\@EA\docommando\@EA\scratchdimen
\fi}%
\docommando}
-
%D Some new, still undocumented features:
@@ -1812,7 +1967,7 @@
\prevdepth\dp\strutbox
\doloop
{\advance\dimen0 by -\lineheight
- \ifdim\dimen0<\!!zeropoint
+ \ifdim\dimen0<\zeropoint
\exitloop
\else
\nobreak
@@ -1830,11 +1985,11 @@
\bgroup
\setbox0=\hbox
{\hskip-1pt\vrule\!!width2pt\!!height2pt\!!depth2pt}%
- \wd0=\!!zeropoint\ht0=\!!zeropoint\dp0=\!!zeropoint\box0
+ \smashbox0\box0
\egroup
\else
\hbox
- {\vrule\!!width\!!zeropoint\!!height\!!zeropoint\!!depth\!!zeropoint}%
+ {\vrule\!!width\zeropoint\!!height\zeropoint\!!depth\zeropoint}%
\fi}
\def\placedbox%
@@ -1956,7 +2111,7 @@
% {\doifdefined{\@@stackbox#1}
% {\doifdefined{\@@stacktag#2}
% {\setbox\scratchbox=\vbox
-% {\splittopskip\!!zeropoint
+% {\splittopskip\zeropoint
% \setbox0=\copy\csname\@@stackbox#1\endcsname
% \dimen0=\getvalue{\@@stacktag#2}pt
% \advance\dimen0 by -\!!onepoint
@@ -2007,7 +2162,7 @@
{\doifdefined{\@@stackbox#1}
{\doifdefined{\@@stacktag#1:#2}
{\setbox\scratchbox=\vbox
- {\splittopskip\!!zeropoint
+ {\splittopskip\zeropoint
\setbox0=\copy\csname\@@stackbox#1\endcsname
\dimen0=\getvalue{\@@stacktag#1:#2}pt
\advance\dimen0 by -\!!onepoint
@@ -2068,7 +2223,7 @@
%D leave the \type {\prevdepth} untouched.
\def\removedepth%
- {\ifvmode \ifdim\prevdepth>\!!zeropoint \kern-\prevdepth \fi \fi}
+ {\ifvmode \ifdim\prevdepth>\zeropoint \kern-\prevdepth \fi \fi}
\def\obeydepth%
{\par \removedepth \ifvmode \kern\dp\strutbox \fi}
@@ -2113,10 +2268,10 @@
%
% \def\appendvbox#1% % uses \box8
% {\bgroup
-% \ifdim\prevdepth<\!!zeropoint
-% \ifdim\pagetotal=\!!zeropoint
+% \ifdim\prevdepth<\zeropoint
+% \ifdim\pagetotal=\zeropoint
% \setbox8=\vtop{\unvcopy#1}%
-% \hrule\c!!height\!!zeropoint
+% \hrule\c!!height\zeropoint
% \kern-\ht8
% \box#1\relax
% \else
@@ -2124,7 +2279,7 @@
% \fi
% \else
% \dimen0=\prevdepth
-% \hrule\c!!height\!!zeropoint
+% \hrule\c!!height\zeropoint
% \setbox8=\vtop{\unvcopy#1}%
% \dimen2=\baselineskip
% \advance\dimen2 by -\dimen0
@@ -2178,7 +2333,7 @@
\def\halfwaybox%
{\dowithnextbox
- {\dp\nextbox\!!zeropoint
+ {\dp\nextbox\zeropoint
\setbox\nextbox=\hbox{\lower.5\ht\nextbox\box\nextbox}%
\box\nextbox}
\hbox}
diff --git a/tex/context/base/supp-emp.tex b/tex/context/base/supp-emp.tex
index 2f8a72710..b8ff6dbf8 100644
--- a/tex/context/base/supp-emp.tex
+++ b/tex/context/base/supp-emp.tex
@@ -379,4 +379,4 @@
%D Also, it is always good to have more roads to reach the same
%D goal.
-\protect \endinput
+\endinput
diff --git a/tex/context/base/supp-eps.tex b/tex/context/base/supp-eps.tex
index c9374b08e..a7d84344f 100644
--- a/tex/context/base/supp-eps.tex
+++ b/tex/context/base/supp-eps.tex
@@ -78,17 +78,17 @@
\doprocessfile\scratchread{#1}\doprocessEPSline
\egroup
\ifnum\EPSfound>0
- #2=\EPSllx bp % Using \EPSllx bp instead of
- #4=\EPSurx bp % \dimen0=1bp and \EPSllx\dimen0
- #3=\EPSlly bp % is more accurate (.005pt).
- #5=\EPSury bp
- \scratchdimen=\EPSllx bp \advance#4 -\scratchdimen
- \scratchdimen=\EPSlly bp \advance#5 -\scratchdimen
+ #2=\EPSllx bp% Using \EPSllx bp instead of
+ #4=\EPSurx bp% \dimen0=1bp and \EPSllx\dimen0
+ #3=\EPSlly bp% is more accurate (.005pt).
+ #5=\EPSury bp%
+ \scratchdimen=\EPSllx bp\advance#4 -\scratchdimen
+ \scratchdimen=\EPSlly bp\advance#5 -\scratchdimen
\else
- #2=\!!zeropoint
- #3=\!!zeropoint
- #4=\!!zeropoint
- #5=\!!zeropoint
+ #2=\zeropoint
+ #3=\zeropoint
+ #4=\zeropoint
+ #5=\zeropoint
\fi
%\message{[bbox #1: \EPSllx\space\EPSurx\space\EPSlly\space\EPSury]}%
\global\let\MPllx\EPSllx \global\let\MPlly\EPSlly
diff --git a/tex/context/base/supp-fil.tex b/tex/context/base/supp-fil.tex
index 611183d2f..c7d447c29 100644
--- a/tex/context/base/supp-fil.tex
+++ b/tex/context/base/supp-fil.tex
@@ -247,17 +247,16 @@
\immediate\openin\scratchread=\readfilename\relax
\ifeof\scratchread
\immediate\closein\scratchread
- \decrement\readlevel
- \ifnum\readlevel>0\relax
- \doreadfile{\pathplusfile{\f!parentpath}{#1}}{#2}{#3}%
+ \decrement\readlevel\relax
+ \ifnum\readlevel>0
+ \def\next{\doreadfile{\pathplusfile{\f!parentpath}{#1}}{#2}{#3}}%
\else
- #3%
+ \def\next{#3}%
\fi
\else
- \immediate\closein\scratchread
- #2% % we skip over the \fi
- \@EA\dodoreadfile % so that we can end a
- \fi} % document here too
+ \def\next{\immediate\closein\scratchread#2\dodoreadfile}%
+ \fi
+ \next}
\def\dodoreadfile%
{\the\everyreadfile % hook, for instance for \enableXML
diff --git a/tex/context/base/supp-lan.tex b/tex/context/base/supp-lan.tex
index 9193dbf54..c1f1299a0 100644
--- a/tex/context/base/supp-lan.tex
+++ b/tex/context/base/supp-lan.tex
@@ -663,7 +663,7 @@
\def\activedododotextmodediscretionary#1#2%
{\convertargument#2\to\discretionarytoken
\def\textmodediscretionary{\getvalue{textmodediscretionary\string#1}}%
- \ifx#1\nextnext % takec care of ||| and +++ and ......
+ \ifx#1\nextnext % takes care of ||| and +++ and ......
\prewordbreak\discretionary{\hbox{$#1$}}{}{\hbox{$#1$}}%
\allowbreak\postwordbreak
\def\nextnextnext{\afterassignment\egroup\let\next=}%
@@ -935,8 +935,21 @@
\endETEX
+%D \macros
+%D {nonbreakablespace}
+%D
+%D The following macro is taken from plain \TEX.
+
+\def\nonbreakablespace{\penalty\!!tenthousand\ }
+
+\let~\nonbreakablespace
+
+% under testing:
+%
+% \unexpanded\def~{\nonbreakablespace}
+
%D \macros
-%D {midworddiscretionary}
+%D {midworddiscretionary}
%D
%D If needed, one can add a discretionary hyphen using \type
%D {\midworddiscretionary}. This macro does the same as
diff --git a/tex/context/base/supp-mis.tex b/tex/context/base/supp-mis.tex
index a13775bb4..a2a7a925d 100644
--- a/tex/context/base/supp-mis.tex
+++ b/tex/context/base/supp-mis.tex
@@ -17,13 +17,28 @@
\ifx \undefined \writestatus \else \expandafter \endinput \fi
-\def\StartLatexHack% Sigh. Why doesn't latex handle this itself
+%D Because \LATEX\ has no safe package loading mechanism, we
+%D need to take care of possible interference.
+
+\def\StartLatexHack%
{\edef\StopLatexHack
{\catcode`\noexpand/=\the\catcode`/
+ \catcode`\noexpand:=\the\catcode`:
+ \catcode`\noexpand;=\the\catcode`;
\catcode`\noexpand"=\the\catcode`"
\catcode`\noexpand<=\the\catcode`<
\catcode`\noexpand>=\the\catcode`>}%
- \catcode`/=12 \catcode`"=12 \catcode`<=12 \catcode`>=12 }
+ \catcode`/=12 \catcode`:=12 \catcode`;=12
+ \catcode`"=12 \catcode`<=12 \catcode`>=12 }
+
+%D This hack is needed especially for \LATEX\ users who use
+%D the Babel package. The Germans have active \type {"}'s, the
+%D Poles have \type {/}, while the French have \type {:} and
+%D \type {;} defines as command (thanks to Daniel Flipo for
+%D pointing that out and testing). Potentially active \type
+%D {?}'s and \type {!}'s are less dangerous since they are
+%D handled by the \type {\protect} and \type {\unprotect}
+%D macros.
\StartLatexHack
@@ -142,7 +157,8 @@
\ifnocontextobject \scratchbox \do \newbox \scratchbox \fi
\ifnocontextobject \scratchread \do \newread \scratchread \fi
\ifnocontextobject \scratchwrite \do \newwrite \scratchwrite \fi
-
+\ifnocontextobject \zeropoint \do \newdimen \zeropoint \fi
+
\ifnocontextobject \nextbox \do \newbox \nextbox \fi
\ifnocontextobject \nextdepth \do \newdimen \nextdepth \fi
diff --git a/tex/context/base/supp-mps.tex b/tex/context/base/supp-mps.tex
index 015efa871..6bde0b2c5 100644
--- a/tex/context/base/supp-mps.tex
+++ b/tex/context/base/supp-mps.tex
@@ -293,14 +293,17 @@
{\ifforceMPTEXgraphic
\global\MPTEXgraphictrue
\else
- \expandafter\convertargument #1\to\asciiA
- \convertargument etex\to\asciiB
- \convertargument text\to\asciiC
+ \expandafter\convertargument #1\to\asciiA
+ \convertargument etex\to\asciiB
+ \convertargument textext\to\asciiC % geen "text"
+ \convertargument graphictext\to\asciiD % geen "text"
\expandtwoargsafter\doifinstringelse{\asciiB}{\asciiA}
{\global\MPTEXgraphictrue}
{\expandtwoargsafter\doifinstringelse{\asciiC}{\asciiA}
{\global\MPTEXgraphictrue}
- {\global\MPTEXgraphicfalse}}%
+ {\expandtwoargsafter\doifinstringelse{\asciiD}{\asciiA}
+ {\global\MPTEXgraphictrue}
+ {\global\MPTEXgraphicfalse}}}%
\fi}
\def\flushMPTEXgraphic%
@@ -568,10 +571,10 @@
\startMPgraphic#2\stopMPgraphic
\doifobjectssupportedelse{}{\useMPboxfalse}%
\ifuseMPbox
- \douseMPbox{MP:#1}%
+ \expandafter \douseMPbox
\else
- \nouseMPbox{MP:#1}%
- \fi
+ \expandafter \nouseMPbox
+ \fi {MP:#1}%
\getvalue{MP:#1}%
\egroup}
@@ -823,7 +826,7 @@
\setbox0=\hbox
{\hskip-\maxdimen
\doprocessfile\scratchread{#1}\handleMPfont}%
- \smashbox0
+ \smashbox0%
\box0
\egroup
\fi}
@@ -885,9 +888,7 @@
%D ignored. Only lines starting with \type{(} are interpreted.
\def\dohandleMPfont#1#2\relax%
- {\if#1(%
- \expandafter\includeMPcharacters\fileline\relax
- \fi}
+ {\if#1(\expandafter\includeMPcharacters\fileline\relax\fi}
\def\handleMPfont%
{\expandafter\dohandleMPfont\fileline\relax}
@@ -1317,7 +1318,7 @@
\ifnum#1< -99 \dodoMPdivtenC#1\else
\ifnum#1< -9 \dodoMPdivtenD#1\else
\ifnum#1< 0 \dodoMPdivtenE#1\else
- 0\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+ 0 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
\def\dodoMPdivtenA#1#2#3#4#5#6{#1#2#3#4#5.#6}
\def\dodoMPdivtenB #1#2#3#4#5{#1#2#3#4.#5}
diff --git a/tex/context/base/supp-mrk.tex b/tex/context/base/supp-mrk.tex
index bb912a776..40458a621 100644
--- a/tex/context/base/supp-mrk.tex
+++ b/tex/context/base/supp-mrk.tex
@@ -14,6 +14,9 @@
%D Remark: due to the lack of \type {\clearmark}, the \ETEX\
%D dedicated mechanism is not yet operational.
+%D This module has deverted so much from the original that i
+%D can probably rewrite it to a more efficient one now.
+
% for testing etex, can be much faster than normal
%
% \unprotect
@@ -45,7 +48,7 @@
% \def\getbotmark {\getmark\botmarks}
% \def\getsplitbotmark {\getmark\splitbotmarks}
% \def\getsplittopmark {\getmark\splitfirstmarks}
-%
+%
% \def\getmark#1#2%
% {\ifcase\csname mrk\strippedcsname#2\endcsname\else
% \expandafter#1\expandafter#2%
@@ -183,10 +186,11 @@
%D We've also introduced some constants, one for the lists and
%D three for composing the mark commands.
-\def\@@marklist@@ {marklist}
-\def\@@marktop@@ {top}
-\def\@@markbot@@ {bot}
-\def\@@markfirst@@ {first}
+\def\@@marklist@@ {marklist}
+\def\@@marktop@@ {top}
+\def\@@markbot@@ {bot}
+\def\@@markfirst@@ {first}
+\def\@@markcurrent@@ {current}
%D The next one is new too. All defined marks are packed in a
%D comma seperated list. This could of course have been a token
@@ -217,11 +221,11 @@
%D command name constructors of Jim. This alternative leads to
%D a more readable source (we hope).
-\def\makemarknames#1%
+\def\makemarknames#1% kan genest werken
{\bgroup
\escapechar=-1
\xdef\markname{\string#1}%
- \xdef\marklist{\@@marklist@@\string#1}%
+ \xdef\marklist{\@@marklist@@\markname}%
\egroup}
%D \macros
@@ -239,9 +243,10 @@
{\bgroup
\makemarknames{#1}%
#2%
- \global\letvalue{\@@marktop@@ \markname}\empty
- \global\letvalue{\@@markfirst@@\markname}\empty
- \global\letvalue{\@@markbot@@ \markname}\empty
+ \global\letvalue{\@@markcurrent@@\markname}\empty
+ \global\letvalue{\@@marktop@@ \markname}\empty
+ \global\letvalue{\@@markfirst@@ \markname}\empty
+ \global\letvalue{\@@markbot@@ \markname}\empty
\setgvalue{\marklist}{\domark0{}}% beware of halfway definitions
\long\gdef#1{\addmarker#1}%
\egroup}
@@ -254,11 +259,12 @@
%D Some more natural interfacing macros:
-\def\gettopmark #1{\getvalue{\@@marktop@@ \strippedcsname#1}}
-\def\getbottommark #1{\getvalue{\@@markbot@@ \strippedcsname#1}}
-\def\getfirstmark #1{\getvalue{\@@markfirst@@\strippedcsname#1}}
-\def\getsplitbottommark#1{\getvalue{\@@markbot@@ \strippedcsname#1}}
-\def\getsplitfirstmark #1{\getvalue{\@@markfirst@@\strippedcsname#1}}
+\def\getcurrentmark #1{\getvalue{\@@markcurrent@@\strippedcsname#1}}
+\def\gettopmark #1{\getvalue{\@@marktop@@ \strippedcsname#1}}
+\def\getbottommark #1{\getvalue{\@@markbot@@ \strippedcsname#1}}
+\def\getfirstmark #1{\getvalue{\@@markfirst@@ \strippedcsname#1}}
+\def\getsplitbottommark#1{\getvalue{\@@markbot@@ \strippedcsname#1}}
+\def\getsplitfirstmark #1{\getvalue{\@@markfirst@@ \strippedcsname#1}}
\let\getbotmark \getbottommark
\let\getsplitbotmark\getsplitbottommark
@@ -287,6 +293,7 @@
\long\def\addmarker#1#2%
{\bgroup
\makemarknames{#1}%
+ \setgvalue{\@@markcurrent@@\markname}{#2}%
\global\advance\currentmarker by 1
\normalmark{\the\currentmarker}%
\@EA\!!toksa\@EA=\@EA\@EA\@EA{\csname\marklist\endcsname}%
@@ -296,7 +303,7 @@
\noexpand\domark
\the\currentmarker{#2}}%
\else
- \!!toksb=\@EA{#2}% one level
+ \!!toksb=\@EA{#2}% one level, why ? handy for cs
\setxvalue{\marklist}%
{\the\!!toksa
\noexpand\domark
@@ -334,9 +341,11 @@
\edef\botmarker{0\normalbotmark}%
\!!toksb={}%
\nofirstmarkertrue
+% does more worse than good
\let\fi=\relax
\let\or=\relax
\let\else=\relax
+%
\let\domark=\doscanmarks
\getvalue{\marklist}\lastmark
%\message{markstatus : [\the\!!toksa\the\!!toksb\the\!!toksc]}%
@@ -354,9 +363,11 @@
\edef\botmarker{0\normalsplitbotmark}%
\!!toksb={}%
\nofirstmarkertrue
+% does more worse than good
\let\fi=\relax
\let\or=\relax
\let\else=\relax
+%
\let\domark=\doscanmarks
\getvalue{\marklist}\lastmark
% \@EA\global\@EA\let\csname\marklist\endcsname=\savedmarklist
@@ -529,16 +540,20 @@
\def\newmark#1%
{\newmarks#1%
+ \global\letvalue{\@@markcurrent@@\string#1}\empty
\expandafter\gdef\csname\@m@\number#1\endcsname{0}}
\long\def\setmark#1#2%
- {\expandafter\gdef\csname\@m@\number#1\endcsname{1}%
+ {\setgvalue{\@m@\number#1}{1}%
+ \setgvalue{\@@markcurrent@@\string#1}{#2}%
\ifexpandmarks
\expanded{\normalmarks#1{#2}}%
\else
\normalmarks#1{#2}%
\fi}
+\def\getcurrentmark #1{\getvalue{\@@markcurrent@@\strippedcsname#1}}
+
\def\gettopmark {\getsomemark\topmarks}
\def\getbottommark {\getsomemark\botmarks}
\def\getfirstmark {\getsomemark\firstmarks}
diff --git a/tex/context/base/supp-pdf.tex b/tex/context/base/supp-pdf.tex
index 1d6ee9d7e..3716caa5b 100644
--- a/tex/context/base/supp-pdf.tex
+++ b/tex/context/base/supp-pdf.tex
@@ -214,7 +214,7 @@
\fi}
%D We use the general macro \type{\doprocessfile} and feed this
-%D with a line handling macro that changed it's behavior when
+%D with a line handling macro that changes it's behavior when
%D the stream operators are encountered.
\def\handlePDFline%
@@ -386,7 +386,7 @@
%D In \POSTSCRIPT\ arguments precede the operators. Due to the
%D fact that in some translations we need access to those
-%D arguments, as well as that sometimes we have to skip them,
+%D arguments, and also because sometimes we have to skip them,
%D we stack them up. The stack is one||dimensional for non path
%D operators and two||dimensional for operators inside a path.
%D This is because we have to save the whole path for
@@ -423,7 +423,7 @@
%D \stoptypen
%D
%D When setting an argument, the exact position on the stack
-%D depend on the current value of the \COUNTERS\
+%D depends on the current value of the \COUNTERS\
%D \type{\nofMPsegments} and \type{\nofMParguments}.
\newcount\nofMPsegments
@@ -437,7 +437,7 @@
%D \stoptypen
%D
%D We use the prefix \type{@@MP} to keep the stack from
-%D conflicting with existing macros. To speed up things bit
+%D conflicting with existing macros. To speed up things a bit
%D more, we use the constant \type{\@@MP}.
\def\@@MP{@@MP}
@@ -445,8 +445,7 @@
\def\setMPargument#1%
{\advance\nofMParguments by 1
\expandafter\def
- \csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname%
- {\do#1}}
+ \csname\@@MP\the\nofMPsegments\the\nofMParguments\endcsname{\do#1}}
\def\gMPa#1%
{\csname\@@MP0\number#1\endcsname}
@@ -463,7 +462,7 @@
{\csname\@@MP#10\endcsname}
%D When we reset the stack, we can assume that all further
-%D comment is to be ignored as well as handled in strings.
+%D comment is to be ignored and handled in strings.
%D By redefining the reset macro after the first call, we
%D save some run time. Only use this macro after all
%D comments are processed and use the simple alternative
@@ -492,7 +491,7 @@
%D special meaning in \TEX, like \type{$} and \type{{}}.
%D
%D A previous solution made \type{\} an active character and
-%D let it look ahead for a number or character. W ehad to
+%D let it look ahead for a number or characters. We had to
%D abandon this scheme because of the need for verbatim
%D support. The next solution involved some \CATCODE\
%D trickery but works well.
@@ -662,7 +661,7 @@
{\PDFcode{\!MP{\gMPa1} g
\!MP{\gMPa1} G}}
-%D Begining and ending the graphics is taken care of by the
+%D Beginning and ending the graphics is taken care of by the
%D macro \type{\handleMPgraphic}, which is redefined when
%D the first graphics operator is met.
@@ -695,7 +694,7 @@
\let\handleMPgraphic=\handleMPbegingraphic
%D We check for three kind of bounding boxes: the normal one
-%D and two high precission ones:
+%D and two high precision ones:
%D
%D \starttypen
%D BoundingBox: llx lly ucx ucy
@@ -764,7 +763,7 @@
\let\handleMPsequence=\dohandleMPsequence
\handleMPsequence}
-%D \METAPOST\ draws it dots by moving to a location and
+%D \METAPOST\ draws its dots by moving to a location and
%D invoking \type{0 0 rlineto}. This operator is not
%D available in \PDF. Our solution is straightforward: we draw
%D a line from $(current\_x, current\_y)$ to itself. This
@@ -776,12 +775,14 @@
%D These saved coordinates are also used when we handle the
%D texts. Text handling proved to be a bit of a nuisance, but
-%D finaly I saw the light. It proved that we also had to
+%D finally I saw the light. It proved that we also had to
%D take care of \type{(split arguments)}.
\def\setMPfshowfont#1#2%
{\font\temp=#1\space at #2\relax\temp}
+\let\MPfshowcommand\empty
+
\def\handleMPfshow%
{\bgroup
\setbox\scratchbox=\hbox
@@ -805,25 +806,26 @@
\setMPfshowfont{\gMPa\nofMParguments}\size
\advance\nofMParguments by -1
\temp
- \ifnum\nofMParguments=1
- \def\do(##1){##1}%
- \gMPa1%
- \else
- \scratchcounter=1
- \def\dodo##1%
- {\edef\!!stringa{##1}\ifx\!!stringa\space\MPspacechar\else##1\fi}%
- \def\do(##1{\dodo{##1}}%
- \gMPa\scratchcounter\MPspacechar
- \let\do\relax
- \loop
- \advance\scratchcounter by 1
- \ifnum\scratchcounter<\nofMParguments\relax
- \gMPa\scratchcounter\MPspacechar
- \repeat
- \def\do##1){\dodo{##1}}%
- \gMPa\scratchcounter
- \fi
- \unskip}%
+ \MPfshowcommand
+ {\ifnum\nofMParguments=1
+ \def\do(##1){##1}%
+ \gMPa1%
+ \else
+ \scratchcounter=1
+ \def\dodo##1%
+ {\edef\!!stringa{##1}\ifx\!!stringa\space\MPspacechar\else##1\fi}%
+ \def\do(##1{\dodo{##1}}%
+ \gMPa\scratchcounter\MPspacechar
+ \let\do\relax
+ \loop
+ \advance\scratchcounter by 1
+ \ifnum\scratchcounter<\nofMParguments\relax
+ \gMPa\scratchcounter\MPspacechar
+ \repeat
+ \def\do##1){\dodo{##1}}%
+ \gMPa\scratchcounter
+ \fi
+ \unskip}}%
%
% this fails in latest pdftex's
%
@@ -855,7 +857,7 @@
%D However, the following implementation is more robust, since
%D some fonts have funny visible spaces in the space slot. This
%D gives a mismatch between the space that \METAPOST\ took into
-%D account and the \quote {natural} space. This only happens in
+%D account and the \citeer {natural} space. This only happens in
%D labels, since \type {btex}||\type {etex} thingies don't have
%D spaces. This phenomena showed up when preparing the
%D \METAFUN\ manual, where Palatino fonts are used. We can
@@ -869,7 +871,7 @@
%D arguments. Dashes however need a bit different treatment,
%D otherwise \PDF\ viewers complain loudly. Another
%D complication is that one argument comes after the \type{]}.
-%D When reading the data, we simple ignore the array boundary
+%D When reading the data, we simply ignore the array boundary
%D characters. We save ourselves some redundant newlines and
%D at the same time keep the output readable by packing the
%D literals.
@@ -887,11 +889,11 @@
\PDFcode{\somestring}%
\egroup}
-%D The \type{setlinewidth} commands look a bit complicated. There are
-%D two alternatives, that alsways look the same. As John Hobby
-%D says:
+%D The \type{setlinewidth} commands looks a bit complicated. There are
+%D two alternatives, that result in a similar look in both
+%D $x$- and $y$-dorection. As John Hobby says:
%D
-%D \startsmaller
+%D \startsmaller \switchtobodyfont[ss]
%D \starttypen
%D x 0 dtransform exch truncate exch idtransform pop setlinewidth
%D 0 y dtransform truncate idtransform setlinewidth pop
@@ -927,13 +929,13 @@
\next}
%D The most complicated command is \type{concat}. \METAPOST\
-%D applies this operator to \type{stoke}. At that moment the
+%D applies this operator to \type{stroke}. At that moment the
%D points set by \type{curveto} and \type{moveto}, are already
%D fixed. In \PDF\ however the \type{cm} operator affects the
%D points as well as the pen (stroke). Like more \PDF\
-%D operators, \type{cm} is a defined in a bit ambiguous way.
+%D operators, \type{cm} is defined in a bit ambiguous way.
%D The only save route for non||circular penshapes, is saving
-%D teh path, recalculating the points and applying the
+%D the path, recalculating the points and applying the
%D transformation matrix in such a way that we can be sure
%D that its behavior is well defined. This comes down to
%D inverting the path and applying \type{cm} to that path as
@@ -964,7 +966,7 @@
\dohandleMPpath}
%D Most paths are drawn with simple round pens. Therefore we've
-%D split up the routinein two.
+%D split up the routine in two.
\def\flushnormalMPpath%
{\scratchcounter=\nofMPsegments
@@ -1029,16 +1031,20 @@
%D more constants. There is however not much need for further
%D optimization because penshapes usually are round and
%D therefore need no transformation. Nevertheless we move the
-%D factor to the outer level and use bit different \type{pt}
+%D factor to the outer level and use a bit different \type{pt}
%D removal macro. Although the values represent base points,
%D we converted them to pure points, simply because those can
%D be converted back.
\def\MPconcatfactor{256}
+% \def\doMPreducedimen#1
+% {\count0=\MPconcatfactor
+% \advance\dimen#1 \ifdim\dimen#1>\!!zeropoint .5\else -.5\fi\count0
+% \divide\dimen#1 \count0\relax}
+
\def\doMPreducedimen#1
{\count0=\MPconcatfactor
- \advance\dimen#1 \ifdim\dimen#1>\!!zeropoint .5\else -.5\fi\count0
\divide\dimen#1 \count0\relax}
\def\doMPexpanddimen#1
@@ -1064,9 +1070,53 @@
{\dimen 8=\!!zeropoint % t_x
\dimen10=\!!zeropoint} % t_y
+%D \starttypen
+%D \def\doMPconcat#1#2#3#4%
+%D {\dimen12=#1 pt \doMPreducedimen12 % p_x
+%D \dimen14=#3 pt \doMPreducedimen14 % p_y
+%D %
+%D \dimen16 \dimen 0
+%D \multiply \dimen16 \dimen 6
+%D \dimen20 \dimen 2
+%D \multiply \dimen20 \dimen 4
+%D \advance \dimen16 -\dimen20
+%D %
+%D \dimen18 \dimen12
+%D \multiply \dimen18 \dimen 6
+%D \dimen20 \dimen14
+%D \multiply \dimen20 \dimen 4
+%D \advance \dimen18 -\dimen20
+%D \dimen20 \dimen 4
+%D \multiply \dimen20 \dimen10
+%D \advance \dimen18 \dimen20
+%D \dimen20 \dimen 6
+%D \multiply \dimen20 \dimen 8
+%D \advance \dimen18 -\dimen20
+%D %
+%D \multiply \dimen12 -\dimen 2
+%D \multiply \dimen14 \dimen 0
+%D \advance \dimen12 \dimen14
+%D \dimen20 \dimen 2
+%D \multiply \dimen20 \dimen 8
+%D \advance \dimen12 \dimen20
+%D \dimen20 \dimen 0
+%D \multiply \dimen20 \dimen10
+%D \advance \dimen12 -\dimen20
+%D %
+%D \doMPreducedimen16
+%D \divide \dimen18 \dimen16 \doMPexpanddimen18
+%D \divide \dimen12 \dimen16 \doMPexpanddimen12
+%D %
+%D \edef#2{\withoutpt{\the\dimen18}}% % p_x^\prime
+%D \edef#4{\withoutpt{\the\dimen12}}} % p_y^\prime
+%D \stoptypen
+
+%D The following optimization resulted from some tests by
+%D and email exchanges with Sanjoy Mahajan.
+
\def\doMPconcat#1#2#3#4%
- {\dimen12=#1 pt \doMPreducedimen12 % p_x
- \dimen14=#3 pt \doMPreducedimen14 % p_y
+ {\dimen12=#1 pt \doMPreducedimen12 % p_x
+ \dimen14=#3 pt \doMPreducedimen14 % p_y
%
\dimen16 \dimen 0
\multiply \dimen16 \dimen 6
@@ -1096,22 +1146,29 @@
\multiply \dimen20 \dimen10
\advance \dimen12 -\dimen20
%
- \doMPreducedimen16
- \divide \dimen18 \dimen16 \doMPexpanddimen18
- \divide \dimen12 \dimen16 \doMPexpanddimen12
+ \ifdim\dimen16>1pt
+ \ifdim\dimen16>256pt
+ \doMPreducedimen16
+ \divide \dimen18 \dimen16 \doMPexpanddimen18
+ \divide \dimen12 \dimen16 \doMPexpanddimen12
+ \else
+ \divide \dimen18 \dimen16 \doMPexpanddimen18 \doMPexpanddimen18
+ \divide \dimen12 \dimen16 \doMPexpanddimen12 \doMPexpanddimen12
+ \fi
+ \fi
%
- \edef#2{\withoutpt{\the\dimen18}}% % p_x^\prime
- \edef#4{\withoutpt{\the\dimen12}}} % p_y^\prime
+ \edef#2{\withoutpt{\the\dimen18}}% % p_x^\prime
+ \edef#4{\withoutpt{\the\dimen12}}} % p_y^\prime
%D The following explanation of the conversion process was
%D posted to the \PDFTEX\ mailing list by Tanmoy. The original
%D macro was part of a set of macro's that included sinus and
-%D cosinus calculation as well as scaling and translating. The
+%D cosinus calculations as well as scaling and translating. The
%D \METAPOST\ to \PDF\ conversion however only needs
%D transformation.
-%D \start \switchnaarkorps [ss]
-%D
+%M \start \switchnaarkorps [ss]
+
%D Given a point $(U_x, U_y)$ in user coordinates, the business
%D of \POSTSCRIPT\ is to convert it to device space. Let us say
%D that the device space coordinates are $(D_x, D_y)$. Then, in
@@ -1268,7 +1325,7 @@
%D Again matrix notation comes in handy (i.e. someone has
%D already solved the problem for us): we need the inverse
%D transformation matrix. The inverse transformation matrix can
-%D be calculated very easily: it is
+%D be calculated very easily:
%D
%D \plaatsformule
%D \startformule
@@ -1301,7 +1358,7 @@
%D \plaatsformule
%D \startformule
%D P_x^\prime = { { s_y(p_x-t_x) + r_y(t_y-p_y) } \over
-%D { s_x*s_y-r_x*r_y } }
+%D { s_x s_y-r_x r_y } }
%D \stopformule
%D
%D \plaatsformule
@@ -1330,9 +1387,9 @@
%D cosine, I know that the terms are small (because I never
%D have an angle greater than 45 degrees), so I chose to
%D apportion the factor in a different way.
-%D
-%D \stop
-%D
+
+%M \stop
+
%D The path is output using the values saved on the stack. If
%D needed, all coordinates are recalculated.
@@ -1405,7 +1462,7 @@
\fi
\handleMPsequence}
-%D The main conversion command is
+%D The main conversion command is:
%D
%D \starttypen
%D \convertMPtoPDF {filename} {x scale} {y scale}
@@ -1423,7 +1480,7 @@
%D {makeMPintoPDFobject,lastPDFMPobject}
%D
%D For experts there are a few more options. When attributes
-%D are to be added, the code muts be embedded in an object
+%D are to be added, the code must be embedded in an object
%D accompanied with the appropriate directives. One can
%D influence this process with \type {\makeMPintoPDFobject}.
%D
@@ -1592,7 +1649,7 @@
%D \macros
%D {twodigitMPoutput}
%D
-%D We can limit the precission to two digits after the comma
+%D We can limit the precision to two digits after the comma
%D by saying:
%D
%D \starttypen
diff --git a/tex/context/base/supp-vis.tex b/tex/context/base/supp-vis.tex
index 8d0a41d07..ffa518a5a 100644
--- a/tex/context/base/supp-vis.tex
+++ b/tex/context/base/supp-vis.tex
@@ -240,8 +240,14 @@
%D option off in those (unpredictable) situations, we just
%D redefine a few \PLAIN\ macros.
-\def\rlap#1{\normalhbox to \!!zeropoint{#1\normalhss}}
-\def\llap#1{\normalhbox to \!!zeropoint{\normalhss#1}}
+\ifx\tlap\undefined
+
+ \def\rlap#1{\normalhbox to \!!zeropoint{#1\normalhss}}
+ \def\llap#1{\normalhbox to \!!zeropoint{\normalhss#1}}
+ \def\blap#1{\normalvbox to \!!zeropoint{#1\normalvss}}
+ \def\tlap#1{\normalvbox to \!!zeropoint{\normalvss#1}}
+
+\fi
\def~{\normalpenalty\!!tenthousand\ }
@@ -723,7 +729,7 @@
\egroup
\setbox0=\normalhbox
{\normalhskip-4\testrulewidth\copy0\copy2}%
- \smashbox0
+ \smashbox0%
\box0
\egroup}
@@ -825,12 +831,12 @@
\setvisiblevfilbox0\to422%
\setbox2=\normalvcue
{\normalhskip -#3\testrulewidth\copy0}%
- \smashbox2
+ \smashbox2%
\copy2
\bgroup
\setbox2=\normalvcue
{\normalhskip -2\testrulewidth\copy0}%
- \smashbox2
+ \smashbox2%
\copy2
\cleaders
\normalvbox to 12\testrulewidth
@@ -838,7 +844,7 @@
#1%
\setbox2=\normalvbox
{\normalvskip-2\testrulewidth\copy2}%
- \smashbox2
+ \smashbox2%
\box2
\egroup
\box2
diff --git a/tex/context/base/symb-ini.tex b/tex/context/base/symb-ini.tex
index 1a56505b2..d2a0842d6 100644
--- a/tex/context/base/symb-ini.tex
+++ b/tex/context/base/symb-ini.tex
@@ -126,7 +126,7 @@
%D
%D To simplify defining figure symbols, we offer:
%D
-%D \showsetup{\y!definesymbol}
+%D \showsetup{\y!definefiguresymbol}
%D
%D By default, such symbols scale along the current bodyfont
%D size.
@@ -378,6 +378,14 @@
\def\gobackjumpcharacter%
{\hbox{\gobackwardcharacter\kern-.5em\gobackwardcharacter}}
-\protect
+% temporarily here
+
+% gejat van Knuth (zie \copyright, p356)
+
+\def\omcirkeld#1%
+ {{\ooalign{\hfil\raise0.07ex\hbox{{\tfx#1}}\hfil\crcr\mathhexbox20D}}}
+
+\def\copyright
+ {\omcirkeld{c}}
-\endinput
+\protect \endinput
diff --git a/tex/context/base/syst-etx.tex b/tex/context/base/syst-etx.tex
index 20c7f2653..db56ae6bb 100644
--- a/tex/context/base/syst-etx.tex
+++ b/tex/context/base/syst-etx.tex
@@ -29,7 +29,7 @@
\chardef\@@scrollmode = 2
\chardef\@@errorstopmode = 3
-%D Constants to be used with \type {\nodetype}.
+%D Constants to be used with \type {\lastnodetype}.
\chardef\@@charnode = 0
\chardef\@@hlistnode = 1
diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex
index 85bb8fbe5..01a88d803 100644
--- a/tex/context/base/syst-ext.tex
+++ b/tex/context/base/syst-ext.tex
@@ -1831,6 +1831,16 @@
{\def#3{##2}}%
\@EA\dosplitstring#1@@@#2@@@\\}
+%D \macros
+%D {splitstring}
+%D
+%D A bonus macro.
+
+\def\splitstring#1\at#2\to#3\and#4%
+ {\def\dosplitstring##1#2##2@@@##3\\%
+ {\def#3{##1}\def#4{##2}}%
+ \@EA\dosplitstring#1@@@#2@@@\\}
+
%D \macros
%D {removesubstring}
%D
@@ -1959,15 +1969,16 @@
{\def\doreplaceincommalist##1%
{\ifnum\commalistcounter=#2\relax
\ifx\newcommalistelement\empty\else
- \ifnum\commalistcounter=1
+ \ifx\newcommalist\empty
\let\newcommalist\newcommalistelement
\else
- \@EA\@EA\@EA\def\@EA\@EA\@EA\newcommalist\@EA\@EA\@EA{\@EA\newcommalist\@EA,\newcommalistelement}%
+ \@EA\@EA\@EA\def\@EA\@EA\@EA\newcommalist\@EA\@EA\@EA
+ {\@EA\newcommalist\@EA,\newcommalistelement}%
\fi
\fi
\def\commalistelement{##1}%
\else
- \ifnum\commalistcounter=1
+ \ifx\newcommalist\empty
\ifx\nexttoken\bgroup % is known -)
\def\newcommalist{{##1}}%
\else
@@ -2459,6 +2470,16 @@
\fi
\next}
+% cleaner but less clear
+%
+% \def\executeifdefined#1%
+% {\ifundefined{#1}%
+% \executedfalse \let\next\gobbleoneargument
+% \else
+% \executedtrue \def\next##1{\getvalue{#1}}%
+% \fi
+% \next}
+
%D We considered an alternative imlementation accepting
%D commands directly, like:
%D
@@ -3315,7 +3336,7 @@
\def\@And #1#2{0\ifcase#1#2 \@EA 0\else \@EA 1\fi}
%D \macros
-%D {setdimensionwithunit}
+%D {setdimensionwithunit, freezedimensionwithunit}
%D
%D The next assignments are all valid:
%D
@@ -3323,6 +3344,8 @@
%D \setdimensionwithunit\scratchdimen{10} {cm}
%D \setdimensionwithunit\scratchdimen{10cm}{cm}
%D \setdimensionwithunit\scratchdimen{10cm}{}
+%D \freezedimensionwithunit\SomeWidth{\textwidth}
+%D \freezedimensionwithunit\SomeDepth{\dp\strutbox}
%D \stoptypen
%D
%D As an alternative for the next macro we can use a global
@@ -3332,6 +3355,19 @@
\def\setdimensionwithunit#1#2#3% number unit dimension / nice trick
{\afterassignment\gobblefourarguments#1=#2#3pt\relax\empty\empty\empty\empty}
+\def\freezedimensionwithunit#1#2%
+ {\setdimensionwithunit\scratchdimen#1{#2}\edef#1{\the\scratchdimen}}
+
+%D \macros
+%D {doifsometokselse}
+%D
+%D Not that fast I guess, but here's a way to test for token
+%D registers being empty.
+
+\def\doifsometokselse#1#2#3%
+ {\edef\!!stringa{\the#1}%
+ \ifx\!!stringa\empty#3\else#2\fi}
+
\protect
\endinput
diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex
index c43dc7ca1..89d7e9bd3 100644
--- a/tex/context/base/syst-gen.tex
+++ b/tex/context/base/syst-gen.tex
@@ -318,8 +318,10 @@
%D inside the argument. Later on we will meet some more clever
%D alternatives to this command.
-\def\expanded#1%
- {\edef\@@expanded{\noexpand#1}\@@expanded}
+\let\@@expanded\empty
+
+\long\def\expanded#1%
+ {\long\edef\@@expanded{\noexpand#1}\@@expanded}
%D \macros
%D {expandoneargafter,expandtwoargsafter}
@@ -538,7 +540,7 @@
\beginETEX \detokenize
-\def\donottest#1{#1}% \detokenize{#1}}
+\def\donottest#1{#1} % {\detokenize{#1}}
\endETEX
@@ -1898,8 +1900,8 @@
\beginTEX
-\def\p!doifinstringelse#1#2%
- {\def\pp!doifinstringelse##1#1##2##3\war%
+\long\def\p!doifinstringelse#1#2%
+ {\long\def\pp!doifinstringelse##1#1##2##3\war%
{\csname if\if##2@fals\else tru\fi e\endcsname}%
\expanded{\pp!doifinstringelse#2#1@@\noexpand\war}} % expand #2 here
@@ -1907,8 +1909,8 @@
\beginETEX \unless
-\def\p!doifinstringelse#1#2%
- {\def\pp!doifinstringelse##1#1##2##3\war%
+\long\def\p!doifinstringelse#1#2%
+ {\long\def\pp!doifinstringelse##1#1##2##3\war%
{\unless\if##2@}%
\expanded{\pp!doifinstringelse#2#1@@\noexpand\war}} % expand #2 here
@@ -1927,8 +1929,8 @@
%D possible, the latter alternative does minimal (one level)
%D expansion.
-\def\p!doifincsnameelse#1#2%
- {\def\pp!doifincsnameelse##1#1##2##3\war%
+\long\def\p!doifincsnameelse#1#2%
+ {\long\def\pp!doifincsnameelse##1#1##2##3\war%
{\csname\if##2@iffalse\else iftrue\fi\endcsname}%
\@EA\pp!doifincsnameelse#2#1@@\war}
@@ -2338,6 +2340,19 @@
\let\getexpandedparameters=\geteparameters
+%D This one is slightly faster:
+
+\def\dogetparameters#1[#2]#3[#4%
+ {\if\noexpand#4]%
+ \expandafter\gobbleoneargument
+ \else
+ \def\p!dogetparameter##1{\p!doassign#1[#2][##1==\relax]}%
+ \expandafter\xdogetparameters
+ \fi#4}
+
+\def\xdogetparameters#1]%
+ {\processcommalist[#1]\p!dogetparameter}
+
%D \macros
%D {getemptyparameters}
%D
@@ -2386,8 +2401,8 @@
\def\copyparameters[#1]#2[#3]#4[#5]%
{\doifnot{#1}{#3}
- {\def\docopyparameter##1%
- {\docopyvalue{#1}{#3}{##1}}%
+ {\def\docopyparameter{\docopyvalue{#1}{#3}}%
+ %\def\docopyparameter##1{\docopyvalue{#1}{#3}{##1}}%
\processcommalist[#5]\docopyparameter}}
%D \macros
@@ -2410,8 +2425,14 @@
%D \doifassignmentelse {...} {then ...} {else ...}
%D \stoptypen
-\def\doifassignmentelse%
- {\doifinstringelse{=}}
+% not robust
+%
+% \def\doifassignmentelse%
+% {\doifinstringelse{=}}
+
+\def\doifassignmentelse#1%
+ {\convertargument#1\to\ascii
+ \doifinstringelse{=}{\ascii}}
%D \macros
%D {ifparameters,checkparameters}
@@ -2639,13 +2660,13 @@
%D us to do some checking, we reimplemented the non||empty
%D ones.
-\def\dosingleargument {\chardef\expectedarguments=1 \dosingleempty }
-\def\dodoubleargument {\chardef\expectedarguments=2 \dodoubleempty }
-\def\dotripleargument {\chardef\expectedarguments=3 \dotripleempty }
-\def\doquadrupleargument {\chardef\expectedarguments=4 \doquadrupleempty }
-\def\doquintupleargument {\chardef\expectedarguments=5 \doquintupleempty }
-\def\dosixtupleargument {\chardef\expectedarguments=6 \dosixtupleempty }
-\def\doseventupleargument{\chardef\expectedarguments=7 \doseventupleempty}
+\def\dosingleargument {\chardef\expectedarguments 1 \dosingleempty }
+\def\dodoubleargument {\chardef\expectedarguments 2 \dodoubleempty }
+\def\dotripleargument {\chardef\expectedarguments 3 \dotripleempty }
+\def\doquadrupleargument {\chardef\expectedarguments 4 \doquadrupleempty }
+\def\doquintupleargument {\chardef\expectedarguments 5 \doquintupleempty }
+\def\dosixtupleargument {\chardef\expectedarguments 6 \dosixtupleempty }
+\def\doseventupleargument{\chardef\expectedarguments 7 \doseventupleempty}
%D \macros
%D {iffirstagument,ifsecondargument,ifthirdargument,
@@ -3048,13 +3069,13 @@
\def\complexorsimple#1%
{\setnameofcommand{#1}%
\doifnextcharelse{[}
- {\firstargumenttrue\getvalue{\s!complex\nameofcommand}}
- {\firstargumentfalse\getvalue{\s!simple\nameofcommand}}}
+ {\firstargumenttrue \getvalue{\s!complex\nameofcommand}}
+ {\firstargumentfalse\getvalue{\s!simple \nameofcommand}}}
\def\complexorsimpleempty#1%
{\setnameofcommand{#1}%
\doifnextcharelse{[}
- {\firstargumenttrue\getvalue{\s!complex\nameofcommand}}
+ {\firstargumenttrue \getvalue{\s!complex\nameofcommand}}
{\firstargumentfalse\getvalue{\s!complex\nameofcommand}[]}}
\def\setnameofcommand#1%
@@ -3212,21 +3233,29 @@
%D \type {\if} and friends, in practice we will use a
%D slightly more complicated macro.
-\let\normalif \if
-\let\normalifx \ifx
-\let\normalifnum \ifnum
-\let\normalifdim \ifdim
-\let\normalifcat \ifcat
-\let\normalifcase \ifcase
-\let\normalor \or
-\let\normalelse \else
-\let\normalfi \fi
+\let\normalif \if
+\let\normalifx \ifx
+\let\normalifnum \ifnum
+\let\normalifdim \ifdim
+\let\normalifcat \ifcat
+\let\normalifcase \ifcase
+\let\normalifcsname \ifcsname
+\let\normalor \or
+\let\normalelse \else
+\let\normalfi \fi
\def\beginrobusttest
{\bgroup
- \let\if\relax\let\ifx\relax\let\ifnum\relax\let\ifcase\relax
- \let\ifcat\relax\let\ifdim\relax
- \let\or\relax\let\else\relax\let\fi\relax}
+ \let\if \relax
+ \let\ifx \relax
+ \let\ifnum \relax
+ \let\ifdim \relax
+ \let\ifcat \relax
+ \let\ifcase \relax
+ \let\ifcsname\relax
+ \let\or \relax
+ \let\else \relax
+ \let\fi \relax}
\let\endrobusttest\egroup
@@ -3252,34 +3281,72 @@
% \beginrobusttest
% \futurelet\nextargument\nextnextargument}
+% \def\dogetgroupargument#1#2%
+% {\def\nextnextargument%
+% {\normalifx\nextargument\bgroup
+% \endrobusttest
+% \noshowargumenterror
+% \def\nextargument{#1\dodogetargument}%
+% %\normalelse\normalifx\nextargument\lineending % this can be an option
+% % \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}%
+% %\normalelse\normalifx\nextargument\blankspace % but may never be default
+% % \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}%
+% \normalelse
+% \endrobusttest
+% \doshowargumenterror
+% \def\nextargument{#2\dodogetargument{}}%
+% \normalfi%\normalfi\normalfi % so let's get rid of it
+% \nextargument}%
+% \beginrobusttest
+% \futurelet\nextargument\nextnextargument}
+
+% we need to use an \ifcase in order to honor the \normal...
+
+\def \permitspacesbetweengroups{\chardef\@@permitspacesbetweengroups=0 }
+\def\dontpermitspacesbetweengroups{\chardef\@@permitspacesbetweengroups=1 }
+
+\dontpermitspacesbetweengroups
+
\def\dogetgroupargument#1#2%
- {\def\nextnextargument%
- {\normalifx\nextargument\bgroup
+ {\def\nextnextargument%
+ {\normalifx\nextargument\bgroup
\endrobusttest
\noshowargumenterror
\def\nextargument{#1\dodogetargument}%
- %\normalelse\normalifx\nextargument\lineending % this can be an option
- % \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}%
- %\normalelse\normalifx\nextargument\blankspace % but may never be default
- % \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}%
\normalelse
- \endrobusttest
- \doshowargumenterror
- \def\nextargument{#2\dodogetargument{}}%
- \normalfi%\normalfi\normalfi % so let's get rid of it
+ \normalifcase\@@permitspacesbetweengroups
+ \normalifx\nextargument\lineending
+ \endrobusttest
+ \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}%
+ \normalelse\normalifx\nextargument\blankspace
+ \endrobusttest
+ \def\nextargument{\bgroup\def\\ {\egroup\dogetgroupargument#1#2}\\}%
+ \normalelse
+ \endrobusttest
+ \doshowargumenterror
+ \def\nextargument{#2\dodogetargument{}}%
+ \normalfi\normalfi
+ \normalelse
+ \endrobusttest
+ \doshowargumenterror
+ \def\nextargument{#2\dodogetargument{}}%
+ \normalfi
+ \normalfi
\nextargument}%
\beginrobusttest
\futurelet\nextargument\nextnextargument}
\def\dosinglegroupempty#1%
{\def\dodogetargument%
- {#1}%
+ {\dontpermitspacesbetweengroups
+ #1}%
\dogetgroupargument\firstargumenttrue\firstargumentfalse}
\def\dodoublegroupempty#1%
{\def\dodogetargument##1%
{\def\dodogetargument%
- {#1{##1}}%
+ {\dontpermitspacesbetweengroups
+ #1{##1}}%
\dogetgroupargument\secondargumenttrue\secondargumentfalse}%
\dogetgroupargument\firstargumenttrue\firstargumentfalse}
@@ -3287,7 +3354,8 @@
{\def\dodogetargument##1%
{\def\dodogetargument####1%
{\def\dodogetargument%
- {#1{##1}{####1}}%
+ {\dontpermitspacesbetweengroups
+ #1{##1}{####1}}%
\dogetgroupargument\thirdargumenttrue\thirdargumentfalse}%
\dogetgroupargument\secondargumenttrue\secondargumentfalse}%
\dogetgroupargument\firstargumenttrue\firstargumentfalse}
@@ -3297,7 +3365,8 @@
{\def\dodogetargument####1%
{\def\dodogetargument########1%
{\def\dodogetargument%
- {#1{##1}{####1}{########1}}%
+ {\dontpermitspacesbetweengroups
+ #1{##1}{####1}{########1}}%
\dogetgroupargument\fourthargumenttrue\fourthargumentfalse}%
\dogetgroupargument\thirdargumenttrue\thirdargumentfalse}%
\dogetgroupargument\secondargumenttrue\secondargumentfalse}%
@@ -3309,7 +3378,8 @@
{\def\dodogetargument########1%
{\def\dodogetargument################1%
{\def\dodogetargument%
- {#1{##1}{####1}{########1}{################1}}%
+ {\dontpermitspacesbetweengroups
+ #1{##1}{####1}{########1}{################1}}%
\dogetgroupargument\fifthargumenttrue\fifthargumentfalse}%
\dogetgroupargument\fourthargumenttrue\fourthargumentfalse}%
\dogetgroupargument\thirdargumenttrue\thirdargumentfalse}%
diff --git a/tex/context/base/syst-new.tex b/tex/context/base/syst-new.tex
index 9224725d2..c733145ab 100644
--- a/tex/context/base/syst-new.tex
+++ b/tex/context/base/syst-new.tex
@@ -13,6 +13,10 @@
\unprotect
+\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey % [bypasses k!prefix]
+ {\@EA\@EA\@EA\def\@EA\csname\@EA#1\@EA#3\@EA
+ \endcsname\@EA{\csname#1#5\endcsname}}
+
% \buildarray[test][aa,bb,cc,dd,ee,ff]
% \setarrayelement{test}{1}{qq}
% \arrayelement{test}{1}
@@ -135,8 +139,8 @@
%D Standaard kan een spatie (zoals ~) uitrekken. Dit is in
%D overzichten niet altijd de bedoeling, vandaar:
-\def\fixedspace%
- {\hskip\fontdimen2\font\relax}
+%\def\fixedspace%
+% {\hskip\fontdimen2\font\relax}
%\def\ExpandSecondAfter#1#2#3%
% {\!!toksa={#2}%
@@ -259,7 +263,69 @@
% \expandafter\dodorawrecurse
% \fi}%
% \dodorawrecurse}
+
+% This permits things like ^\index{hans}^, where hans is
+% duplicated in the text.
+
+\newif\ifduplicate
+
+\bgroup
+
+\gdef\checkduplication% in line with Knuth
+ {\ifmmode\expandafter^\else\expandafter\startduplication\fi}
+
+\gdef\insideduplication%
+ {\ifmmode\expandafter^\else\expandafter\egroup\fi}
+
+\catcode`\^=\@@active
+
+\gdef\enableduplication%
+ {\catcode`\^=\@@active \let^\checkduplication}
+
+\gdef\disableduplication%
+ {\catcode`\^=\@@superscript}
+
+\gdef\startduplication%
+ {\bgroup \duplicatetrue \let^\insideduplication}
+
+\egroup
+
+\def\gobbleassigndimen#1\\{}
+\def\assigndimen#1#2%
+ {\afterassignment\gobbleassigndimen#1=#2\!!zeropoint\\}
+
+\def\setusage#1%
+ {\@EA\let\csname#1\endcsname\iftrue}
+
+\def\resetusage#1%
+ {\@EA\let\csname#1\endcsname\iffalse}
+
+\beginTEX
+
+\def\ifusage#1%
+ {\@EA\ifx\csname#1\endcsname\relax
+ \resetusage{#1}%
+ \fi
+ \csname#1\endcsname}
+
+\endTEX
+
+\beginETEX \ifcsname
+
+\def\ifusage#1%
+ {\ifcsname#1\endcsname\else
+ \resetusage{#1}%
+ \fi
+ \csname#1\endcsname}
+
+\endETEX
+
+%D Very handy, more efficient than \type{{}}, and more readable
+%D than \type {\empty}.
+
+\let\donothing\empty
+
\protect
\endinput
diff --git a/tex/context/base/type-siz.tex b/tex/context/base/type-siz.tex
index f71ac14d1..fdc743cf4 100644
--- a/tex/context/base/type-siz.tex
+++ b/tex/context/base/type-siz.tex
@@ -32,9 +32,10 @@
\stoptypescript
\starttypescript [math] [default] [size]
- \definebodyfont
- [17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt]
- [mm] [default]
+ \definebodyfont
+% [17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt]
+ [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt]
+ [mm] [default]
\stoptypescript
\starttypescript [boldmath] [default] [size]
diff --git a/tex/context/base/verb-ini.tex b/tex/context/base/verb-ini.tex
index 7e7f23fcf..2c7ad75e9 100644
--- a/tex/context/base/verb-ini.tex
+++ b/tex/context/base/verb-ini.tex
@@ -502,20 +502,16 @@
%D characters with special meanings. This macro is not used
%D in the verbatim macros, but is best defined in this module.
-\def\doprocesscatcodes#1%
- {\ifeightbitcharacters
- \scratchcounter=255
- \else
- \scratchcounter=127
- \fi
+\def\doprocesscatcodes#1% using a toks does not speed this up
+ {\scratchcounter\ifeightbitcharacters 255\else 127\fi\relax
\loop
\savecatcode
#1\relax
- \advance\scratchcounter by -1
+ \advance\scratchcounter -1
\ifnum\scratchcounter>-1
\repeat
- \let\savecatcode=\relax
- \let\restorecatcodes=\dorestorecatcodes}
+ \let\savecatcode\relax
+ \let\restorecatcodes\dorestorecatcodes}
\def\uncatcodespecials%
{\doprocesscatcodes
diff --git a/tex/context/base/x-fig-00.tex b/tex/context/base/x-fig-00.tex
index 4d80e3653..f5ab3e963 100644
--- a/tex/context/base/x-fig-00.tex
+++ b/tex/context/base/x-fig-00.tex
@@ -38,6 +38,14 @@
%D <comment>I bet that you've seen this cow before.</comment>
%D </figure>
%D
+%D <figure>
+%D <dummy width="4cm" height="3cm">non existent</dummy>
+%D <label>a european cow</label>
+%D <copyright>Nobody</copyright>
+%D <comment>When will we talk about European cows?</comment>
+%D </figure>
+%D
+%D
%D </figurelibrary>
%D \stoptypen
%D
@@ -54,8 +62,8 @@
%D \externalfigure[a dutch cow][width=4cm]
%D \stoptypen
%D
-%D This module overloads this command so that it first
-%D searched in the list of databases.
+%D This module overloads this command so that a figure is
+%D it first searched in the list of databases.
%D
%D \starttypen
%D \usefigurebases[yourfile]
@@ -85,6 +93,7 @@
\defineXMLignore [status]
\defineXMLpush [file]
\defineXMLpush [label]
+\defineXMLpush [dummy]
\defineXMLenvironment [figure] \figbase@StartFigure \figbase@StopFigure
\stopXMLnamespace
@@ -102,12 +111,13 @@
{\startnointerference
\startXMLnamespace[-][figbase]
\resetfigurefilebase
- \XMLassign{file} {}
- \XMLassign{label}{}
+ \XMLerase{file}
+ \XMLerase{dummy}
+ \XMLerase{label}
\xdef\figurefilebase{#1}%
\doglobal\newcounter\figurefilepage
\def\askedlabel{#2}
- \processXMLfile{#1.xml}
+ \processXMLfilegrouped{#1.xml} % grouped ?
\stopXMLnamespace
\stopnointerference}
@@ -145,7 +155,7 @@
{\let\figurebaselist\empty}
{\appendtocommalist{#1}\figurebaselist}}
-\endinput
+\protect \endinput
\usefigurebase[figtest]
diff --git a/tex/context/base/x-fig-01.tex b/tex/context/base/x-fig-01.tex
index b640e039d..b64992a6f 100644
--- a/tex/context/base/x-fig-01.tex
+++ b/tex/context/base/x-fig-01.tex
@@ -1,5 +1,5 @@
%D \module
-%D [ file=x-fig-00,
+%D [ file=x-fig-01,
%D version=2001.03.21,
%D title=\CONTEXT\ Style File,
%D subtitle=Figure Base Generation,
@@ -11,8 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-%D See \type {x-fig-01.tex} for more information on how to use
-%D and generate figure databses. This file loads the file
+%D See \type {x-fig-00.tex} for more information on how to use
+%D and generate figure databases. This file loads the file
%D named \type {\inputfilename} (\TEXEXEC\ will set this
%D variable). You can apply this style to a database by
%D saying:
@@ -34,7 +34,7 @@
%D \som the document is split into three sections: first each
%D figure is shown at its own page, then an overview of
%D figures is shown with some data alongside, and
-%D finaly an index and table of contents shows up
+%D finally an index and table of contents shows up
%D \som there is no title page, which means that one can
%D access a figure by page number without offset
%D \som the document is opened at the first overview page,
@@ -75,8 +75,9 @@
\def\StartFigureA%
{\bgroup
- \XMLassign{file}{unknown}
+ \XMLassign{file}{buffer}
\defineXMLpush[file]
+ \defineXMLpush[dummy]
\defineXMLpush[label]
\defineXMLpush[copyright]
\defineXMLpush[comment]
@@ -84,6 +85,17 @@
\defineoverlay[page][\overlaybutton{to:\CurrentPage}]
+\startbuffer
+ \framed
+ [width=\XMLpar{dummy}{width}{12cm},
+ height=\XMLpar{dummy}{height}{8cm},
+ background=color,
+ backgroundcolor=gray,
+ foregroundcolor=darkred,
+ frame=off]
+ {\bf \XMLpop{dummy}}
+\stopbuffer
+
\def\StopFigureA%
{\doglobal\increment\CurrentPage
\setupbackgrounds[page][background=page]
diff --git a/tex/context/base/xtag-ext.tex b/tex/context/base/xtag-ext.tex
index d092ca2dd..9bf9f89a9 100644
--- a/tex/context/base/xtag-ext.tex
+++ b/tex/context/base/xtag-ext.tex
@@ -11,11 +11,9 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\unprotect
-
\beginTEX
\writestatus{xml}{sorry, xml is only supported in (pdf)etex}
- \endinput
+ \expandafter \endinput
\endTEX
\writestatus{loading}{Context XML Macros (extras)}
@@ -59,8 +57,7 @@
\unprotect}
\def\donostartXMLnamespace#1%
- {\protect
- \edef\XMLnamespace{#1}%
+ {\edef\XMLnamespace{#1}%
\let\@@XMLelement\normal@@XMLelement}
\def\dodostartXMLnamespace#1#2%
@@ -68,7 +65,37 @@
\edef\@@XMLelement{\@@XMLelement:#2}}
\def\stopXMLnamespace%
- {\popmacro\@@XMLnamespace
+ {\protect
+ \popmacro\@@XMLnamespace
\popmacro\@@XMLelement}
+%D Context Directives:
+
+\def\@@CTXML{@@CTXML}
+
+\def\defineXMLdirective%
+ {\dodoubleempty\dodefineXMLdirective}
+
+\def\dodefineXMLdirective[#1][#2]#3%
+ {\defineXMLprocessor[context-#1-directive]{\dohandleXMLdirective{#1}{#3}}%
+ \ifsecondargument
+ \setvalue{\@@CTXML-#1-#2}{#3}%
+ \fi}
+
+\def\dohandleXMLdirective#1#2#3%
+% {\dodohandleXMLdirective#3 dummy dummy dummy\end{#1}{#2}}
+ {\dodohandleXMLdirective#3 @ @ @\end{#1}{#2}}
+
+\def\dodohandleXMLdirective#1 #2 #3 #4\end#5#6%
+ {\doifdefinedelse{\@@CTXML-#5-#1}
+ {\getvalue{\@@CTXML-#5-#1}[#2=#3]}
+ {#6[#2=#3]}}
+
+% \defineXMLdirective [mathml] \setupMMLappearance % [#1][#2=#3]
+% \defineXMLdirective [flowchart] [shapes] \setupFLOWshapes % [#2=#3]
+% \defineXMLdirective [flowchart] [lines] \setupFLOWlines % [#2=#3]
+
+\defineXMLprocessor [context-begin-group] {\begingroup\gobbleoneargument}
+\defineXMLprocessor [context-end-group] {\endgroup \gobbleoneargument}
+
\protect \endinput
diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex
index 7be11a1db..fed3e7c2b 100644
--- a/tex/context/base/xtag-ini.tex
+++ b/tex/context/base/xtag-ini.tex
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+% etex optimized
+
\unprotect
\def\unspaced#1%
@@ -28,6 +30,9 @@
{\convertargument#1\to#2%
\@EA\edef\@EA#2\@EA{\@EA\unspaced\@EA{#2}}}
+\def\unspaceafter#1#2%
+ {\edef\ascii{\dounspaced#2\end}\@EA#1\@EA{\ascii}}
+
\protect
\beginTEX
@@ -114,6 +119,8 @@
\def\@@XMLdata {\@@XML dat}
\def\@@XMLcode {\@@XML cod}
\def\@@XMLinstruction {\@@XML ins}
+\def\@@XMLmap {\@@XML map}
+\def\@@XMLlist {\@@XML lst}
\newtoks\XMLtoks
\newtoks\XMLresetlist
@@ -265,13 +272,15 @@
%D to determine if we're dealing with a comment or processing
%D instruction. We need a bit of grouping because we have to
%D mess up with catcodes. We probably have to treat a few
-%D more catcode and first character cases.
+%D more catcode and first character cases. We need to use
+%D \type {\begingroup} here, otherwise we get funny spaces in
+%D math.
\protect
\long\def\doXMLelement#1%
- {\bgroup % maybe tab and space needs some treatment too: \catcode`\ =10 % \@@space
- \catcode`\^^M= 10
+ {\begingroup % maybe tab and space needs some treatment too: \catcode`\ =10 % \@@space
+ \catcode`\^^M=10
\if#1!\let\next \xdoXMLelement \else
\if#1?\let\next \ydoXMLelement \else
\let\next \zdoXMLelement \fi\fi
@@ -280,11 +289,11 @@
%D By using a few {\expandafter}'s we can us a \type {\next}
%D construction. We could speed the first char test up a bit
%D by using an installer and something \typ {\getvalue
-%D {#1doXMLelement}} (todo).
+%D {#1doXMLelement}} (todo).
\long\def\doXMLelement#1%
- {\bgroup % maybe tab and space needs some treatment too: \catcode`\ =10 % \@@space
- \catcode`\^^M= 10
+ {\begingroup % maybe tab and space needs some treatment too: \catcode`\ =10 % \@@space
+ \catcode`\^^M=10\relax
\if#1!\expandafter \xdoXMLelement \else
\if#1?\expandafter\expandafter\expandafter \ydoXMLelement \else
\expandafter\expandafter\expandafter \zdoXMLelement \fi\fi
@@ -294,7 +303,7 @@
%D on top of the verbatim environment.
\long\def\xdoXMLelement !#1 % !-- --> or !xyz >
- {\egroup
+ {\endgroup
\doifelse{#1}{--}
{\long\def\nextelement{\gobbleuntil{-->}}}
{\doifelse{#1}{[CDATA[}
@@ -310,12 +319,12 @@
%D later.
\long\def\ydoXMLelement#1 #2?>% ?target ?>
- {\egroup\dodoXMLprocessor{#1}{#2}}
+ {\endgroup\dodoXMLprocessor{#1}{#2}}
%D The normal elements are handled by \type {\dodoXMLelement}.
\long\def\zdoXMLelement#1>%
- {\egroup\dodoXMLelement#1 >}
+ {\endgroup\dodoXMLelement#1 >}
%D Now we switch to unprotected mode again.
@@ -382,19 +391,23 @@
\let\currentXMLarguments\empty
\let\currentXMLelement \empty
+\newtoks\everyXMLelement
+
\long\def\dodoXMLelement#1 #2>%
- {\getvalue{\@@XMLpars:#1}% parameter list
- \def\!!stringa{#2}%
+ {\def\!!stringa{#2}%
\def\!!stringb{/ }%
\ifx\!!stringa\empty
\let\currentXMLarguments\empty
\def\currentXMLelement{#1}%
+ \the\everyXMLelement
\else\ifx\!!stringa\!!stringb
\let\currentXMLarguments\empty
\def\currentXMLelement{#1/}%
+ \the\everyXMLelement
\else
\def\currentXMLelement{#1}%
\def\currentXMLarguments{#2}%
+ \the\everyXMLelement
%\getXMLarguments\currentXMLelement{#2}%
\dogetXMLarguments\currentXMLelement#2>%
\fi \fi
@@ -431,8 +444,24 @@
{\unspaceargument#1\to\ascii
\long\setvalue{\@@XMLentity:\@EA\firstofoneargument\ascii}{#2}}
+% we need to be able to do:
+%
+% \defineXMLentity[amp] {\FunnyAmp} \def\FunnyAmp#1;{\getXMLentity{#1}}
+%
+% \defineXMLentity [pound] {(why not use euro's?)}
+%
+% \startXMLdata
+% test &amp;pound; test
+% \stopXMLdata
+%
+% so we need an ifless implementation of:
+
\gdef\doXMLentity#1;%
- {\ifXMLrawentities#1\else\executeXMLentity{#1}\fi}
+ {\ifXMLrawentities
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\executeXMLentity
+ \fi{#1}}
\def\executeXMLentity#1% internal ! ! !
{\getXMLentity{#1}}
@@ -446,21 +475,75 @@
\gdef\doifXMLentityelse#1#2#3%
{\ifundefined{\@@XMLentity:#1}#3\else#2\fi}
+% \long\def\getXMLarguments#1#2%
+% {\dogetXMLarguments{#1}#2>}
+%
+% \long\def\dogetXMLarguments#1%
+% {\XMLtoks\emptytoks
+% \def\@@XMLclass{#1}%
+% \let\dodoparseXMLarguments\doparseXMLarguments
+% \doparseXMLarguments}
+%
+% \def\dosetXMLargument#1%
+% {\setvalue{\@@XMLvariable:\@@XMLclass:\@@XMLname}{#1}%
+% %\message{[\@@XMLname=#1]}%
+% \let\dodoparseXMLarguments\doparseXMLarguments
+% \dodoparseXMLarguments}
+
+% see \defineXML... commands:
+%
+% [key=val] => \presetXMLarguments{element} => default key/vals
+% [blabla] => \theXMLarguments{blabla} => user key/vals
+% [blabla] [key=val] => \presetXMLarguments{element} => default key/vals
+% \theXMLarguments{blabla} => user key/vals
+%
+% <element key="val"> stored in case of [blabla] else set as \XMLpar
+%
+% see m-steps for an example of usage
+
\long\def\getXMLarguments#1#2%
{\dogetXMLarguments{#1}#2>}
\long\def\dogetXMLarguments#1%
{\XMLtoks\emptytoks
- \def\@@XMLclass{#1}%
+ \ifcsname\@@XMLmap:#1\endcsname
+ \let\dosetXMLargument\dosetXMLargumentB
+ \else
+ \def\@@XMLclass{#1}%
+ \let\dosetXMLargument\dosetXMLargumentA
+ \fi
\let\dodoparseXMLarguments\doparseXMLarguments
\doparseXMLarguments}
-\def\dosetXMLargument#1%
+\def\dosetXMLargumentA#1%
{\setvalue{\@@XMLvariable:\@@XMLclass:\@@XMLname}{#1}%
- %\message{[\@@XMLname=#1]}%
\let\dodoparseXMLarguments\doparseXMLarguments
+ %\message{[\@@XMLclass][\@@XMLname=#1]}\wait
\dodoparseXMLarguments}
+\def\dosetXMLargumentB#1%
+ {\setevalue{\@@XMLmap:\@@XMLmapmap}%
+ {\@EA\ifx\csname\@@XMLmap:\@@XMLmapmap\endcsname\empty\else
+ \csname\@@XMLmap:\@@XMLmapmap\endcsname,%
+ \fi
+ \@@XMLname=#1}%
+ \let\dodoparseXMLarguments\doparseXMLarguments
+ %\message{[\@@XMLprefix][\@@XMLname=#1]}\wait
+ \dodoparseXMLarguments}
+
+\appendtoks
+ \resetXMLarguments\currentXMLelement
+\to \everyXMLelement
+
+\def\resetXMLarguments#1%
+ {\ifcsname\@@XMLmap:#1\endcsname
+ \@EA\let\@EA\@@XMLmapmap\csname\@@XMLmap:#1\endcsname
+ \@EA\let\csname\@@XMLmap:\@@XMLmapmap\endcsname\empty
+ \fi}
+
+\def\theXMLarguments#1%
+ {\ifcsname\@@XMLmap:#1\endcsname\csname\@@XMLmap:#1\endcsname\fi}
+
\long\def\doparseXMLarguments#1% space goes ok
{\if#1>%
\let\dodoparseXMLarguments\empty
@@ -485,8 +568,6 @@
%D is left to the imagination of the reader. These macros
%D will be improved.
-%D
-
\bgroup
\catcode`<=\@@active
@@ -523,78 +604,114 @@
{\long\setvalue{\@@XMLelement:#1/}{\long\setvalue{\@@XMLdata:#1}{}}%
\long\setvalue{\@@XMLelement:#1}##1</#1>{\long\setvalue{\@@XMLdata:#1}{##1}}}
+\long\gdef\dododefineXMLenvironmentpush#1#2#3%
+ {\long\setvalue{\@@XMLelement:#1/}{#2\long\setvalue{\@@XMLdata:#1}{}#3}%
+ \long\setvalue{\@@XMLelement:#1}##1</#1>{#2\long\setvalue{\@@XMLdata:#1}{##1}#3}}
+
\long\gdef\dododefineXMLprocess#1%
{\long\setvalue{\@@XMLelement:#1/}{}%
\long\setvalue{\@@XMLelement:#1}{}%
\long\setvalue{\@@XMLelement:/#1}{}}
-\long\gdef\dododefineXMLnested#1#2#3%
- {\long\setvalue{\@@XMLelement:#1}{\getXMLgrouped{#1}{#2}{#3}}}
+\long\gdef\dododefineXMLnestedenvironment#1#2#3%
+ {\long\setvalue{\@@XMLelement:#1}{\getXMLgroupedenvironment{#1}{#2}{#3}}}
+
+\long\gdef\dododefineXMLnestedargument#1#2%
+ {\long\setvalue{\@@XMLelement:#1}{\getXMLgroupedargument{#1}{#2}}}
\egroup
%D The high level definition macros.
-\def\defineXMLsingular {\dodoubleempty\dodefineXMLsingular}
-\def\defineXMLcommand {\dodoubleempty\dodefineXMLcommand}
-\def\defineXMLgrouped {\dodoubleempty\dodefineXMLgrouped}
-\def\defineXMLargument {\dodoubleempty\dodefineXMLargument}
-\def\defineXMLignore {\dodoubleempty\dodefineXMLignore}
-\def\defineXMLpickup {\dodoubleempty\dodefineXMLpickup}
-\def\defineXMLenvironment{\dodoubleempty\dodefineXMLenvironment}
-\def\defineXMLpush {\dodoubleempty\dodefineXMLpush}
-\def\defineXMLprocess {\dodoubleempty\dodefineXMLprocess}
-\def\defineXMLnested {\dodoubleempty\dodefineXMLnested}
+\def\defineXMLsingular {\dotripleempty\dodefineXMLsingular}
+\def\defineXMLcommand {\dotripleempty\dodefineXMLcommand}
+\def\defineXMLgrouped {\dotripleempty\dodefineXMLgrouped}
+\def\defineXMLargument {\dotripleempty\dodefineXMLargument}
+\def\defineXMLignore {\dotripleempty\dodefineXMLignore}
+\def\defineXMLpickup {\dotripleempty\dodefineXMLpickup}
+\def\defineXMLenvironment {\dotripleempty\dodefineXMLenvironment}
+\def\defineXMLpush {\dotripleempty\dodefineXMLpush}
+\def\defineXMLenvironmentpush{\dotripleempty\dodefineXMLenvironmentpush}
+\def\defineXMLprocess {\dotripleempty\dodefineXMLprocess}
+
+% goes for all types
+
+\def\defineXMLnested {\dotripleempty\dodefineXMLnestedenvironment}
+\def\defineXMLnestedenvironment{\dotripleempty\dodefineXMLnestedenvironment}
+\def\defineXMLnestedargument {\dotripleempty\dodefineXMLnestedargument}
+
+\long\def\dodefineXMLsingular[#1][#2][#3]#4%
+ {\defineXMLmethod\dododefineXMLsingular{#1}{#2}{#3}{#4}{}}
+
+\long\def\dodefineXMLcommand[#1][#2][#3]#4%
+ {\defineXMLmethod\dododefineXMLcommand{#1}{#2}{#3}{#4}{}}
+
+\long\def\dodefineXMLgrouped[#1][#2][#3]#4%
+ {\defineXMLmethod\dododefineXMLgrouped{#1}{#2}{#3}{#4}{}}
-\long\def\dodefineXMLsingular[#1][#2]#3%
- {\defineXMLmethod\dododefineXMLsingular{#1}{#2}{#3}{}}
+\long\def\dodefineXMLargument[#1][#2][#3]#4%
+ {\defineXMLmethod\dododefineXMLargument{#1}{#2}{#3}{#4}{}}
-\long\def\dodefineXMLcommand[#1][#2]#3%
- {\defineXMLmethod\dododefineXMLcommand{#1}{#2}{#3}{}}
+\long\def\dodefineXMLignore[#1][#2][#3]%
+ {\defineXMLmethod\dododefineXMLignore{#1}{#2}{#3}{}{}}
-\long\def\dodefineXMLgrouped[#1][#2]#3%
- {\defineXMLmethod\dododefineXMLgrouped{#1}{#2}{#3}{}}
+\long\def\dodefineXMLpickup[#1][#2][#3]#4#5%
+ {\defineXMLmethod\dododefineXMLpickup{#1}{#2}{#3}{#4}{#5}}
-\long\def\dodefineXMLargument[#1][#2]#3%
- {\defineXMLmethod\dododefineXMLargument{#1}{#2}{#3}{}}
+\long\def\dodefineXMLenvironment[#1][#2][#3]#4#5%
+ {\defineXMLmethod\dododefineXMLenvironment{#1}{#2}{#3}{#4}{#5}}
-\long\def\dodefineXMLignore[#1][#2]%
- {\defineXMLmethod\dododefineXMLignore{#1}{#2}{}{}}
+\long\def\dodefineXMLpush[#1][#2][#3]%
+ {\defineXMLmethod\dododefineXMLpush{#1}{#2}{#3}{}{}}
-\long\def\dodefineXMLpickup[#1][#2]#3#4%
- {\defineXMLmethod\dododefineXMLpickup{#1}{#2}{#3}{#4}}
+\long\def\dodefineXMLenvironmentpush[#1][#2][#3]#4#5%
+ {\defineXMLmethod\dododefineXMLenvironmentpush{#1}{#2}{#3}{#4}{#5}}
-\long\def\dodefineXMLenvironment[#1][#2]#3#4%
- {\defineXMLmethod\dododefineXMLenvironment{#1}{#2}{#3}{#4}}
+\long\def\dodefineXMLprocess[#1][#2][#3]%
+ {\defineXMLmethod\dododefineXMLprocess{#1}{#2}{#3}{}{}}
-\long\def\dodefineXMLpush[#1][#2]%
- {\defineXMLmethod\dododefineXMLpush{#1}{#2}{}{}}
+\long\def\dodefineXMLnestedenvironment[#1][#2][#3]#4#5%
+ {\defineXMLmethod\dododefineXMLnestedenvironment{#1}{#2}{#3}{#4}{#5}}
-\long\def\dodefineXMLprocess[#1][#2]%
- {\defineXMLmethod\dododefineXMLprocess{#1}{#2}{}{}}
+\long\def\dodefineXMLnestedargument[#1][#2][#3]#4%
+ {\defineXMLmethod\dododefineXMLnestedargument{#1}{#2}{#3}{#4}{}}
-\long\def\dodefineXMLnested[#1][#2]#3#4%
- {\defineXMLmethod\dododefineXMLnested{#1}{#2}{#3}{#4}}
+% [key=val] => \presetXMLarguments{element} => default key/vals
+% [blabla] => \theXMLarguments{blabla} => user key/vals
+% [blabla] [key=val] => \presetXMLarguments{element} => default key/vals
+% \theXMLarguments{blabla} => user key/vals
-\long\def\defineXMLmethod#1#2#3#4#5% command element pars begin end
+\long\def\defineXMLmethod#1#2#3#4#5#6% command element [map] [parlst] begin end
{\ifsecondargument
- \doifassignmentelse{#3}
- {\setvalue{\@@XMLpars:#2}{\getrawparameters[\@@XMLvariable:#2:][#3]}}
- {}% ? ? ?
- % \def\docommando##1% can be made faster
- % {\expanded{\XMLtoks{\the\XMLtoks\def\csname\@@XMLvariable:##1\endcsname{}}}}%
- % \XMLtoks\emptytoks\processcommalist[#3]\docommando}%
+ \setXMLarguments{#2}{#3}{#4}%
\fi
\ifignoreXMLcase
- \lowercasestring#2\to\ascii \@EA#1\@EA{\ascii}{#4}{#5}%
- \uppercasestring#2\to\ascii \@EA#1\@EA{\ascii}{#4}{#5}%
+ \lowercasestring#2\to\ascii \@EA#1\@EA{\ascii}{#5}{#6}%
+ \uppercasestring#2\to\ascii \@EA#1\@EA{\ascii}{#5}{#6}%
\else
- #1{#2}{#4}{#5}%
+ #1{#2}{#5}{#6}%
\fi}
+\def\setXMLarguments#1#2#3% element [tag] settings
+ {\doifassignmentelse{#2}
+ {\setvalue{\@@XMLpars:#1}{\getrawparameters[\@@XMLvariable:#1:][#2]}}
+ {\setvalue{\@@XMLmap :#1}{#2}% later we can init vars by this name
+ \doifsomething{#3}{\setvalue{\@@XMLpars:#1}{\getrawparameters[#2][#3]}}}}
+
+\def\presetXMLarguments#1%
+ {\getvalue{\@@XMLpars:#1}}
+
+\prependtoks
+ \presetXMLarguments\currentXMLelement
+\to \everyXMLelement
+
\def\doifXMLdataelse#1#2#3% % \relax too, so no etex
-% {\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax
- {\ifundefined{\@@XMLdata:#1}%
+% wrong
+% {\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax
+% slow
+% {\ifundefined{\@@XMLdata:#1}%
+% etex
+ {\unless\ifcsname\@@XMLdata:#1\endcsname
#3%
\else\expandafter\ifx\csname\@@XMLdata:#1\endcsname\empty
#3%
@@ -604,11 +721,23 @@
#2%
\fi\fi\fi}
-\def\XMLpop#1%
-% {\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax\else
-% \csname\@@XMLdata:#1\endcsname
-% \fi}
- {\ifundefined{\@@XMLdata:#1}\else\getvalue{\@@XMLdata:#1}\fi}
+\def\XMLpop#1% one level
+% wrong
+% {\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax\else
+% \csname\@@XMLdata:#1\endcsname
+% \fi}
+% slow, hm was not commented
+% {\ifundefined{\@@XMLdata:#1}\else\getvalue{\@@XMLdata:#1}\fi}
+% etex
+ {\ifcsname\@@XMLdata:#1\endcsname\csname\@@XMLdata:#1\endcsname\fi}
+
+\def\XMLpopdata#1% see m-steps for usage
+ {\unless\ifcsname\@@XMLdata:#1\endcsname
+ \else\expandafter\ifx\csname\@@XMLdata:#1\endcsname\empty
+ \else\expandafter\ifx\csname\@@XMLdata:#1\endcsname\relax
+ \else
+ \@EA\@EA\@EA\XMLdata\@EA\@EA\@EA{\csname\@@XMLdata:#1\endcsname}%
+ \fi\fi\fi}
\def\XMLappend#1#2%
{\edef\!!stringa{\@@XMLdata:#1}%
@@ -641,6 +770,12 @@
\def\XMLshow#1%
{\showvalue{\@@XMLdata:#1\endcsname}}
+\def\XMLunspace#1%
+ {\ifcsname\@@XMLdata:#1\endcsname
+ \setevalue{\@@XMLdata:#1}%
+ {\@EA\@EA\@EA\dounspaced\csname\@@XMLdata:#1\endcsname\end}%
+ \fi}
+
\def\defXMLlowerclean#1% lowercase ! evt tzt upper too
{\bgroup
\lccode`\#=32\lccode`\$=32\lccode`\%=32\lccode`\\=32\lccode`\^=32
@@ -659,38 +794,77 @@
\def\mapXMLvalue#1#2#3% td align center -> middle
{\setvalue{\@@XMLvalue:#1:#2:#3}}
+% \def\XMLvar#1#2#3% td align center
+% {\ifundefined{\@@XMLvariable:#1:#2}%
+% \XMLval{#1}{#2}{#3}%
+% \else
+% \XMLval{#1}{#2}{\getvalue{\@@XMLvariable:#1:#2}}%
+% \fi}
+%
+% \def\XMLval#1#2#3%
+% {\ifundefined{\@@XMLvalue:#1:#2}%
+% #3%
+% \else
+% \getvalue{\@@XMLvalue:#1:#2}%
+% \fi}
+%
+% \def\XMLpar#1#2#3%
+% {\ifundefined{\@@XMLvariable:#1:#2}%
+% #3%
+% \else
+% \getvalue{\@@XMLvariable:#1:#2}%
+% \fi}
+%
+% speedup
+
\def\XMLvar#1#2#3% td align center
- {\ifundefined{\@@XMLvariable:#1:#2}%
- \XMLval{#1}{#2}{#3}%
+ {\ifcsname\@@XMLvariable:#1:#2\endcsname
+ \XMLval{#1}{#2}{\csname\@@XMLvariable:#1:#2\endcsname}%
\else
- \XMLval{#1}{#2}{\getvalue{\@@XMLvariable:#1:#2}}%
+ \XMLval{#1}{#2}{#3}% evt inline code
\fi}
\def\XMLval#1#2#3%
- {\ifundefined{\@@XMLvalue:#1:#2}%
- #3%
+ {\ifcsname\@@XMLvalue:#1:#2\endcsname
+ \csname\@@XMLvalue:#1:#2\endcsname
\else
- \getvalue{\@@XMLvalue:#1:#2}%
+ #3%
\fi}
\def\XMLpar#1#2#3%
- {\ifundefined{\@@XMLvariable:#1:#2}%
- #3%
+ {\ifcsname\@@XMLvariable:#1:#2\endcsname
+ \csname\@@XMLvariable:#1:#2\endcsname
\else
- \getvalue{\@@XMLvariable:#1:#2}%
+ #3%
\fi}
+% so far for speedup
+
+\defineXMLsingular [begingroup] {\begingroup}
+\defineXMLsingular [endgroup] {\endgroup}
+
\def\XMLstr#1%
{{\enableXML\scantokens{#1}\unskip}}
-\def\XMLstrpar#1#2#3%
- {{\enableXML
- \ifundefined{\@@XMLvariable:#1:#2}%
- \scantokens{#3}%
- \else
- \scantokens\@EA\@EA\@EA
- {\csname\@@XMLvariable:#1:#2\endcsname}\unskip
- \fi}}
+\def\XMLstr#1% test
+ {\scantokens{\begingroup\enableXML#1<endgroup/>}}
+
+%\def\XMLstrpar#1#2#3%
+% {{\enableXML
+% \ifundefined{\@@XMLvariable:#1:#2}%
+% \scantokens{#3}%
+% \else
+% \scantokens\@EA\@EA\@EA
+% {\csname\@@XMLvariable:#1:#2\endcsname}\unskip
+% \fi}}
+
+\def\XMLstrpar#1#2#3% test
+ {\ifundefined{\@@XMLvariable:#1:#2}%
+ \scantokens{\begingroup\enableXML#3<endgroup/>}%
+ \else
+ \scantokens\@EA\@EA\@EA{\@EA\begingroup\@EA\enableXML
+ \csname\@@XMLvariable:#1:#2\endcsname<endgroup/>}%
+ \fi}
\def\doifXMLvarelse#1#2#3#4% geen etex, \relax too
{\expandafter\ifx\csname\@@XMLvariable:#1:#2\endcsname\relax#4\else
@@ -712,9 +886,17 @@
\def\gotoXML%
{\afterassignment\dogotoXML\let\nexttoken=}
-%D
+%D Saves tokens and typing.
+
+\def\XMLownvar {\XMLvar \currentXMLelement}
+\def\XMLownval {\XMLval \currentXMLelement}
+\def\XMLownpar {\XMLpar \currentXMLelement}
+\def\XMLownstrpar {\XMLstrpar \currentXMLelement}
+\def\doifXMLownvarelse{\doifXMLvarelse\currentXMLelement}
+\def\doifXMLownvalelse{\doifXMLvalelse\currentXMLelement}
+\def\doifXMLownparelse{\doifXMLparelse\currentXMLelement}
-\beginETEX \scantokens
+%D
\long\def\startXMLcode[#1] #2 \stopXMLcode
{\setgvalue{\@@XMLcode:#1}{\startXMLdata#2\stopXMLdata}}
@@ -723,7 +905,7 @@
{\getvalue{\@@XMLcode:#1}}
% \long\def\startXMLdata#1\stopXMLdata%
-% {\bgroup\enableXML\scantokens{#1}\egroup}
+% {\begingroup\enableXML\scantokens{#1}\endgroup}
%
% \defineXMLentity[tex-backslash] {\catchXMLpar}
%
@@ -732,30 +914,26 @@
% \else\texescape\fi\else\texescape\fi\else\texescape\fi}
\long\def\startXMLdata
- {\bgroup
+ {\begingroup
\catcode`\^^I=\@@space
\catcode`\^^M=\@@space
\catcode`\^^L=\@@space
\dostartXMLdata}
-\long\def\dostartXMLdata#1\stopXMLdata
- {\enableXML\scantokens{#1}\egroup}
+% \long\def\dostartXMLdata#1\stopXMLdata
+% {\enableXML\scantokens{#1}\endgroup}
\long\def\dostartXMLdata#1\stopXMLdata
- {\enableXML\scantokens{#1}\ifhmode\unskip\unskip\fi\egroup}
+ {\enableXML\scantokens{#1}\ifhmode\unskip\unskip\fi\endgroup}
-\def\XMLdata#1%
- {{\enableXML\scantokens{#1}\ifhmode\unskip\unskip\fi}}
-
-\endETEX
-
-\beginTEX
-
-\long\def\startXMLcode[#1] #2 \stopXMLcode%
- {{\infofont[embedded XML code only works in ETEX]}\par}
-
-\endTEX
+\unexpanded\def\XMLdata#1% % \unexpanded added 22/5/2001
+ {\begingroup
+ \enableXML\scantokens{#1}\ifhmode\unskip\unskip\fi
+ \endgroup}
+\unexpanded\def\XMLdata#1% % grouping changed 20/5/2001
+ {\scantokens{\begingroup\enableXML#1<endgroup/>}}
+
%D
\def\bXMLs{\ifignoreXMLspaces\ignorespaces\fi}
@@ -819,11 +997,11 @@
\def\doprocessXMLbuffer[#1]%
{\doifelsenothing{#1}
{\doprocessXMLbuffer[\jobname]}
- {\bgroup
+ {\begingroup
\def\dodoprocessXMLbuffer##1%
{\enableXML\processXMLfile{\TEXbufferfile{##1}}}%
\processcommalist[#1]\dodoprocessXMLbuffer
- \egroup}}
+ \endgroup}}
%D Loading specific modules takes place with \type
%D {\useXMLfilters}.
@@ -880,7 +1058,7 @@
\dogetgrouped}%
\dogetgrouped}
-% cleaner but hardly faster unless big strings are passed
+%D Cleaner but hardly faster unless big strings are passed.
\long\gdef\docountXMLgrouped#1\end#2\end
{\long\def\dosplitstring##1#2##2@@##3\end%
@@ -907,6 +1085,32 @@
\dogetgrouped}%
\dogetgrouped}
+%D More versatile.
+
+\long\unexpanded\gdef\getXMLgroupedenvironment#1#2#3%
+ {\def\dodogetgrouped{\@EA#2\the\groupedtoks#3}%
+ \getXMLgrouped{#1}}
+
+\long\unexpanded\gdef\getXMLgroupedargument#1#2%
+ {\def\dodogetgrouped{\@EA#2\@EA{\the\groupedtoks}}%
+ \getXMLgrouped{#1}}
+
+\long\unexpanded\gdef\getXMLgrouped#1%
+ {\groupedtoks\emptytoks
+ \scratchcounter=0
+ \long\def\dogetgrouped##1</#1>%
+ {\appendtoks##1\to\groupedtoks
+ \docountXMLgrouped##1\end<#1>\end
+ \docountXMLgrouped##1\end<#1 \end
+ \ifcase\scratchcounter
+ \let\dogetgrouped\dodogetgrouped
+ \else
+ \advance\scratchcounter -1
+ \appendtoks</#1>\to\groupedtoks
+ \fi
+ \dogetgrouped}%
+ \dogetgrouped}
+
\egroup
% {pre}{pos}{before}{after}
diff --git a/tex/context/base/xtag-map.tex b/tex/context/base/xtag-map.tex
new file mode 100644
index 000000000..32648acd7
--- /dev/null
+++ b/tex/context/base/xtag-map.tex
@@ -0,0 +1,555 @@
+%D \module
+%D [ file=xtag-map,
+%D version=2000.12.20,
+%D title=\CONTEXT\ XML Support,
+%D subtitle=Remapping,
+%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.
+
+%D There is a more versatile mapper available in \type {xtag-rem.tex}!
+
+\beginTEX
+ \endinput
+\endTEX
+
+\writestatus{loading}{Context XML Macros (remap)}
+
+%D A fundamental characteristic of \TEX\ is that much
+%D processing depends on picking up one or more arguments and
+%D acting upon them. In \type {xtag-ini} we have implemented
+%D the normal (high) level interface between \XML\ and
+%D \CONTEXT, and there we already saw some ways to pick up an
+%D element as argument.
+%D
+%D In this module we will implement a preprocessor. An element
+%D that feeds its content to the preprocessor, becomes a token
+%D list consisting of \TEX\ macros, which in turn may expand to
+%D their meanings.
+%D
+%D This module is only tested with \ETEX. In principle we can
+%D make it work with good old \TEX, but we see no objection
+%D against using \ETEX, especially since it's part of every
+%D grown up \TEX\ distribution.
+
+\unprotect
+
+%D A careful reader will notice that we do a full expansion of
+%D the content of the element, although commands that are
+%D protected will stay untouched. In this stage we also
+%D collect key|/|value pairs and pass them onto the \TEX\
+%D macros if needed. Again, we need a fully expandable parser
+%D to handle this, which make the core macros slightly
+%D unreadable.
+%D
+%D The interface presented here evolved from an older module,
+%D written on top of \type {m-sgml}, that could take care of
+%D \MATHML\ (version 1). The implementation here is more
+%D advanced in the sense that it permits all kind of parsers.
+
+\def\findendofXMLelement#1% better use a few expandafters
+ {\if#1>0 \else % space prevents auto \relax
+ \if#1"\endofXMLelementD \else
+ \if#1'\endofXMLelementS \else
+ \if#1/1 \endofXMLelement \else
+ \endofXMLelementN \fi\fi\fi\fi}
+
+\def\endofXMLelementD#1\fi\fi\fi\fi#2"{\fi\fi \findendofXMLelement}
+\def\endofXMLelementS#1\fi\fi\fi\fi#2'{\fi\fi\fi \findendofXMLelement}
+\def\endofXMLelementN#1\fi\fi\fi\fi {\fi\fi\fi\fi\findendofXMLelement}
+\def\endofXMLelement #1\fi\fi\fi\fi#2>{\fi\fi\fi\fi}
+
+\newif\ifremapXMLunknown
+
+\def\doremapXMLelement#1#2#3#4%
+ {\expandafter\ifx\csname\@@XML#1:#2\endcsname\relax#4\else
+ \csname\@@XML#1:#2\endcsname#3%
+ \fi}
+
+\long\def\remapXMLelement#1#2 #3>% todo: we need to get rid of the end /
+ {\if#1!%
+ % ignore all comment
+ \else\if#1?%
+ % ignore all instructions
+ \remapXMLpi#2 #3>%
+ \else\ifcase\findendofXMLelement#2#3>%
+ \if#1/%
+ \expandafter\ifx\csname\@@XML#2:M\endcsname\relax
+ \ifremapXMLunknown\remapXMLone{\s!unknown}{#2}\fi
+ \else
+ \remapXMLone{#2}{}%
+ \fi
+ \else
+ \expandafter\ifx\csname\@@XML#1#2:M\endcsname\relax
+ \ifremapXMLunknown\remapXMLtwo{\s!unknown}{#1#2}\fi
+ \else
+ \remapXMLtwo{#1#2}{#3}%
+ \fi
+ \fi
+ \else
+ \expandafter\ifx\csname\@@XML#1#2:M\endcsname\relax
+ \expandafter\ifx\csname\@@XML#1#2/:M\endcsname\relax
+ \ifremapXMLunknown\remapXMLthree{\s!unknown/}{#1#2}\fi
+ \else
+ \remapXMLthree{#1#2/}{#3}%
+ \fi
+ \else
+ \remapXMLthree{#1#2}{#3}%
+ \fi
+ \fi\fi\fi}
+
+\unexpanded\def\xmlr#1#2{\csname\@@XML#1:#2\endcsname}
+
+\def\@@XMLremap{XMLremap}
+
+\def\remapXMLone#1#2%
+ {\ifcase\csname\@@XMLremap\csname\@@XML#1:M\endcsname\endcsname
+ \or % GCPA
+ \XMLeg\XMLeg
+ \or % GCP-
+ \XMLeg
+ \or % GC-A
+ \XMLeg\XMLeg
+ \or % GC--
+ \XMLeg
+ \or % -CPA
+ \XMLeg
+ \or % -CP-
+ %
+ \or % -C-A
+ \XMLeg
+ \or % -C--
+ %
+ \or % G---
+ \XMLeg
+ \or % GLR-
+ \xmlr{#1}{R}\XMLeg
+ \or % -LR-
+ \xmlr{#1}{R}%
+ \fi}
+
+\def\remapXMLtwo#1#2%
+ {\ifcase\csname\@@XMLremap\csname\@@XML#1:M\endcsname\endcsname
+ \or % GCPA
+ \XMLbg\xmlr{#1}{X}{#2}\XMLbg
+ \or % GCP-
+ \XMLbg\xmlr{#1}{X}{#2}%
+ \or % GC-A
+ \XMLbg\xmlr{#1}{X}\XMLbg
+ \or % GC--
+ \XMLbg\xmlr{#1}{X}%
+ \or % -CPA
+ \xmlr{#1}{X}{#2}\XMLbg
+ \or % -CP-
+ \xmlr{#1}{X}{#2}%
+ \or % -C-A
+ \xmlr{#1}{X}\XMLbg
+ \or % -C--
+ \xmlr{#1}{X}%
+ \or % G---
+ \XMLbg
+ \or % GLR-
+ \XMLbg\xmlr{#1}{L}%
+ \or % -LR-
+ \xmlr{#1}{L}%
+ \fi}
+
+\def\remapXMLthree#1#2%
+ {\ifcase\csname\@@XMLremap\csname\@@XML#1:M\endcsname\endcsname
+ \or % GCPA
+ \XMLbg\xmlr{#1}{X}{#2}\XMLbg\XMLeg\XMLeg
+ \or % GCP-
+ \XMLbg\xmlr{#1}{X}{#2}\XMLeg
+ \or % GC-A
+ \XMLbg\xmlr{#1}{X}\XMLbg\XMLeg\XMLeg
+ \or % GC--
+ \XMLbg\xmlr{#1}{X}\XMLeg
+ \or % -CPA
+ \xmlr{#1}{X}{#2}\XMLbg\XMLeg
+ \or % -CP-
+ \xmlr{#1}{X}{#2}%
+ \or % -C-A
+ \xmlr{#1}{X}\XMLbg\XMLeg
+ \or % -C--
+ \xmlr{#1}{X}%
+ \or % G---
+ \XMLbg\XMLeg
+ \fi}
+
+\@EA\scratchtoks\@EA{\string{} \edef\XMLbg{\the\scratchtoks}
+\@EA\scratchtoks\@EA{\string}} \edef\XMLeg{\the\scratchtoks}
+
+\chardef\XMLremapGCPA = 1 % {\command {arg} { } }
+\chardef\XMLremapGCP = 2 % {\command {arg} } %
+\chardef\XMLremapGCA = 3 % {\command { } }
+\chardef\XMLremapGC = 4 % {\command } %
+\chardef\XMLremapCPA = 5 % \command {arg} { }
+\chardef\XMLremapCP = 6 % \command {arg} %
+\chardef\XMLremapCA = 7 % \command { }
+\chardef\XMLremapC = 8 % \command %
+\chardef\XMLremapG = 9 % { }
+\chardef\XMLremapGLR = 10 % { \bcom \ecom }
+\chardef\XMLremapLR = 11 % \bcom \ecom
+
+\protect
+
+\def\remapXMLpi#1 #2?#3>%
+ {\xmlr{procins/}{X}{#1}{#2}}
+
+\unprotect
+
+%D The remapping is controlled by only a few definition
+%D macros, that both deal with elements. We distinguish
+%D between normal and empty elements.
+%D
+%D \starttypen
+%D \remapXMLsequence [name] [result map] \unexpandablecommand
+%D \remapXMLsequence [name] [result map] \unexpandablecommand
+%D \stoptypen
+%D
+%D The \MATHML\ module demonstrates how these can be used.
+%D The element is converted into a sequence with one or more
+%D of the following components.
+%D
+%D \starttypen
+%D { \command {parameters} {argument} }
+%D \stoptypen
+%D
+%D The following combinations are supported.
+%D
+%D \starttabulatie[|c|c|c|c|c|]
+%D \NC GCPA \NC grouped \NC command \NC parameters \NC argument \NC \NR
+%D \NC GCP \NC grouped \NC command \NC parameters \NC \NC \NR
+%D \NC GCA \NC grouped \NC command \NC \NC argument \NC \NR
+%D \NC GC \NC grouped \NC command \NC \NC \NC \NR
+%D \NC CPA \NC \NC command \NC parameters \NC argument \NC \NR
+%D \NC CP \NC \NC command \NC parameters \NC \NC \NR
+%D \NC CA \NC \NC command \NC \NC argument \NC \NR
+%D \NC C \NC \NC command \NC \NC \NC \NR
+%D \NC G \NC grouped \NC \NC \NC \NC \NR
+%D \stoptabulatie
+%D
+%D Empty elements (singular ones) never get an argument,
+%D which makes sense, since they have at most parameters.
+
+\def\remapXMLsequence{\dotripleargument\doremapXML []}
+\def\remapXMLsingular{\dotripleargument\doremapXML[/]}
+
+\def\doremapXML[#1][#2][#3]%
+ {\doifinstringelse{LR}{#3}
+ {\let\next\doremapXMLtwo}
+ {\let\next\doremapXMLone}%
+ \next[#1][#2][#3]}
+
+\def\doremapXMLone[#1][#2][#3]#4%
+ {\setvalue{\@@XML#2#1:M}{#3}%
+ \setvalue{\@@XML#2#1:X}{#4}}
+
+\def\doremapXMLtwo[#1][#2][#3]#4#5%
+ {\setvalue{\@@XML#2:M}{#3}%
+ \setvalue{\@@XML#2:L}{#4}%
+ \setvalue{\@@XML#2:R}{#5}}
+
+\let\dowithentity\empty
+
+%D We handle unknown elements with:
+
+\remapXMLsingular[procins] [CPA] \doXMLprocins
+
+\def\doXMLprocins#1#2{\dodoXMLprocessor{?#1}{#2}}
+
+\remapXMLsingular [\s!unknown] [CPA] \doXMLunknownSI
+\remapXMLsequence [\s!unknown] [CPA] \doXMLunknownSE
+
+\def\doXMLunknownSI#1#2{\hbox{\tttf[#1]}}
+\def\doXMLunknownSE#1#2{\hbox{\tttf[#1:\enspace\ignorespaces#2\unskip]}}
+
+%D In a similar way, we can remap entities.
+
+\def\remapXMLentity%
+ {\xmlrent}
+
+\unexpanded\def\xmlrent#1%
+ {\getXMLentity{#1}}
+
+%D The remapping is taken care of by the following macro,
+%D which takes three arguments.
+%D
+%D \starttypen
+%D \XMLremapdata{before}{after}{content}
+%D \stoptypen
+%D
+%D After the remapping, the content is executed (expanded)
+%D under the normal \TEX\ catcode regime. The intermediate
+%D result can be traced by turning on the following switch.
+
+\newif\iftraceXMLremapping
+
+\newtoks \everyXMLremapping
+
+\appendtoks
+ \defineXMLentity[tex-hash]{\letterhash}%
+ \defineXMLentity[tex-bar]{\myspecialvert}%
+\to \everyXMLremapping
+
+\def\setnormalXMLentities%
+ {\defineXMLentity[tex-hash]\letterhash
+ \defineXMLentity[tex-dollar]\letterdollar
+ \defineXMLentity[tex-percent]\letterpercent
+ \defineXMLentity[tex-backslash]\letterbackslash
+ \defineXMLentity[tex-hat]\letterhat
+ \defineXMLentity[tex-underscore]\letterunderscore
+ \defineXMLentity[tex-leftbrace]\letterbgroup
+ \defineXMLentity[tex-rightbrace]\letteregroup
+ \defineXMLentity[tex-bar]\letterbar}
+
+\let\XMLremappedpar\empty
+
+\long\def\XMLremapdata#1#2#3%
+ {\bgroup
+ \pushmacro\doXMLelement
+ \pushmacro\doXMLentity % ##2 removes leading spaces
+ \long\def\doXMLelement##1>##2{\remapXMLelement##1 >##2}%
+ \def\doXMLentity ##1;##2{\remapXMLentity{##1}##2}%
+ \enableXML % sets entities
+ \enableXMLexpansion
+ \let\par\XMLremappedpar
+ \the\everyXMLremapping
+ %\ignorelines
+ \catcode`\^^I=\@@space
+ \catcode`\^^M=\@@space
+ \catcode`\^^L=\@@space
+ \catcode`\^^Z=\@@space
+ \xdef\remappedXMLdata{#3\empty}%
+ \let\par\endgraf
+ \popmacro\doXMLentity
+ \popmacro\doXMLelement
+ \disableXMLexpansion
+ \catcode`\{=\@@begingroup
+ \catcode`\}=\@@endgroup
+ \catcode`\\=\@@escape
+ \iftraceXMLremapping
+ \bgroup
+ \convertcommand\remappedXMLdata\to\ascii
+ \tttf\veryraggedright\ascii\par
+ \writestatus{XML}{\ascii}%
+ \egroup
+ \fi
+ #1\scantokens\@EA{\remappedXMLdata\empty\empty}#2%
+ \egroup}
+
+% rename to better names
+
+\newtoks \XMLRtoks
+\newcount \nofXMLRchildren
+
+\def\naturalxmlr#1#2{\getvalue{\@@XML#1:#2}}
+
+\def\ignoreXMLRelement#1#2{}
+\def\normalXMLRelement#1#2{#2}
+
+\let\nextXMLRelement \empty
+\let\firstXMLRelement \empty
+\let\secondXMLRelement\empty
+
+% \def\withnextXMLRelement#1%
+% {\pushmacro\dowithnextXMLRelement
+% \def\dowithnextXMLRelement##1##2##3##4##5%
+% {\popmacro\dowithnextXMLRelement
+% \def\nextXMLRelement{##1{##2}{##3}{##4}{##5}}%
+% #1}%
+% \doifnextcharelse\empty\empty\dowithnextXMLRelement}
+%
+% better and faster:
+
+\def\dowithnextXMLRelement#1#2#3#4#5#6%
+ {\def\nextXMLRelement{#2{#3}{#4}{#5}{#6}}#1}%
+
+\def\withnextXMLRelement#1%
+ {\doifnextcharelse\empty\empty{\dowithnextXMLRelement{#1}}}
+
+\def\withnexttwoXMLRelements#1%
+ {\pushmacro\firstXMLRelement
+ \pushmacro\secondXMLRelement
+ \withnextXMLRelement
+ {\let\firstXMLRelement\nextXMLRelement
+ \withnextXMLRelement
+ {\let\secondXMLRelement\nextXMLRelement
+ #1%
+ \popmacro\secondXMLRelement
+ \popmacro\firstXMLRelement}}}
+
+\def\withnextthreeXMLRelements#1% korter, met two
+ {\pushmacro\firstXMLRelement
+ \pushmacro\secondXMLRelement
+ \pushmacro\thirdXMLRelement
+ \withnextXMLRelement
+ {\let\firstXMLRelement\nextXMLRelement
+ \withnextXMLRelement
+ {\let\secondXMLRelement\nextXMLRelement
+ \withnextXMLRelement
+ {\let\thirdXMLRelement\nextXMLRelement
+ #1%
+ \popmacro\thirdXMLRelement
+ \popmacro\secondXMLRelement
+ \popmacro\firstXMLRelement}}}}
+
+\def\doifXMLRchildelse#1#2#3#4%
+ {\pushmacro\xmlr
+ \def\next{#4}%
+ \def\xmlr##1##2##3##4% the / should be sorted out in the mapper
+ {\rawdoifinsetelse{##1}{#1}
+ {\def\next{#3}}
+ {\doif{##1}{#1/}{\def\next{#3}}}}%
+ #2\empty
+ \popmacro\xmlr
+ \next}
+
+\def\doifXMLRchild#1#2#3%
+ {\pushmacro\xmlr
+ \let\next\empty
+ \def\xmlr##1##2##3##4% the / should be sorted out in the mapper
+ {\rawdoifinsetelse{##1}{#1}
+ {\def\next{#3}}
+ {\doif{##1}{#1/}{\def\next{#3}}}}%
+ #2\empty
+ \popmacro\xmlr
+ \next}
+
+\def\encapsulateXMLRchild#1#2#3#4#5%
+ {\pushmacro\xmlr
+ \def\xmlr##1##2##3##4%
+ {\doifelse{##1}{#1}
+ {\def\next{\doencapsulateXMLRchild{#2}{#3}{#4}{##4}}}
+ {\let\next\empty}%
+ \next}%
+ #5\empty
+ \popmacro\xmlr}
+
+\def\encapsulateXMLRchildren#1#2#3#4#5%
+ {\pushmacro\xmlr
+ \pushmacro\betweenXMLRchild
+ \def\betweenXMLRchild{\def\betweenXMLRchild{#3}}%
+ \def\xmlr##1##2##3##4%
+ {\rawdoifinsetelse{##1}{#1}
+ {\pushmacro\xmlr
+ \let\xmlr\naturalxmlr
+ \betweenXMLRchild\xmlr{##1}{##2}{##3}{##4}%
+ \popmacro\xmlr}
+ {}}%
+ #2#5\empty#4%
+ \popmacro\betweenXMLRchild
+ \popmacro\xmlr}
+
+\def\doencapsulateXMLRchild#1#2#3#4%
+ {\pushmacro\xmlr
+ \pushmacro\betweenXMLRchild
+ \def\betweenXMLRchild{\def\betweenXMLRchild{#2}}%
+ \def\xmlr##1##2##3##4%
+ {\pushmacro\xmlr
+ \let\xmlr\naturalxmlr
+ \betweenXMLRchild\xmlr{##1}{##2}{##3}{##4}%
+ \popmacro\xmlr}%
+ #1#4\empty#3%
+ \popmacro\betweenXMLRchild
+ \popmacro\xmlr}
+
+\let\encapsulateXMLR\doencapsulateXMLRchild
+
+\def\withnextXMLRelementelse#1#2%
+ {\def\xdowithnextXMLRelement##1##2##3##4##5%
+ {\def\nextXMLRelement{##1{##2}{##3}{##4}{##5}}#1}%
+ \def\xnowithnextXMLRelement%
+ {\let\nextXMLRelement\empty#2}%
+ \doifnextcharelse\xmlr\xdowithnextXMLRelement\xnowithnextXMLRelement}
+
+\def\encapsulatenextXMLRelements#1#2#3#4% oude bewaren
+ {\pushmacro\betweenXMLRchild
+ \pushmacro\afterXMLRchild
+ \def\betweenXMLRchild{#1\def\betweenXMLRchild{#2}}%
+ \let\afterXMLRchild\empty
+ \withnextXMLRelementelse
+ {\betweenXMLRchild
+ \def\afterXMLRchild{#3}%
+ \nextXMLRelement
+ \doifnextcharelse\empty\xnowithnextXMLRelement\xdowithnextXMLRelement}
+ {\afterXMLRchild
+ \popmacro\afterXMLRchild
+ \popmacro\betweenXMLRchild}%
+ #4}
+
+\def\collectXMLRchild#1#2%
+ {\XMLRtoks\emptytoks
+ \pushmacro\xmlr
+ \def\xmlr##1##2##3##4%
+ {\doif{##1}{#1}{\appendtoks##4\to\XMLRtoks}}%
+ #2\empty
+ \popmacro\xmlr}
+
+\def\collectbetweenXMLRchild#1#2#3%
+ {\XMLRtoks\emptytoks
+ \pushmacro\xmlr
+ \pushmacro\betweenXMLRchild
+ \def\betweenXMLRchild{\def\betweenXMLRchild{\appendtoks#2\to\XMLRtoks}}%
+ \def\xmlr##1##2##3##4%
+ {\rawdoifinsetelse{##1}{#1}
+ {\betweenXMLRchild\appendtoks\xmlr{##1}{##2}{##3}{##4}\to\XMLRtoks}{}}%
+ #3\empty
+ \popmacro\betweenXMLRchild
+ \popmacro\xmlr}
+
+\def\dorawcollectbetweenXMLR#1#2%
+ {\pushmacro\xmlr
+ \pushmacro\betweenXMLRchild
+ \def\betweenXMLRchild{\def\betweenXMLRchild{#1}}%
+ \def\xmlr##1##2##3##4%
+ {\betweenXMLRchild\appendtoks\xmlr{##1}{##2}{##3}{##4}\to\XMLRtoks}%
+ #2\empty
+ \popmacro\betweenXMLRchild
+ \popmacro\xmlr}
+
+\def\rawcollectbetweenXMLR%
+ {\XMLRtoks\emptytoks\dorawcollectbetweenXMLR}
+
+\def\docollectbetweenXMLR#1%
+ {\dorawcollectbetweenXMLR{\appendtoks#1\to\XMLRtoks}}
+
+\def\collectbetweenXMLR%
+ {\XMLRtoks\emptytoks\docollectbetweenXMLR}
+
+\def\processXMLRchildren#1%
+ {\pushmacro\xmlr
+ \let\xmlr\naturalxmlr
+ #1\empty
+ \popmacro\xmlr}
+
+\def\processXMLRchild#1#2% slow but more versatile
+ {\pushmacro\xmlr
+ \XMLRtoks\emptytoks
+ \def\xmlr##1##2##3##4%
+ {\rawdoifinsetelse{##1}{#1}
+ {\appendtoks\xmlr{##1}{##2}{##3}{##4}\to\XMLRtoks}{}}%
+ #2%
+ \popmacro\xmlr
+ \the\XMLRtoks\empty}
+
+\def\countXMLRchildren#1%
+ {\pushmacro\xmlr
+ \nofXMLRchildren=0
+ \def\xmlr##1##2##3##4{\advance\nofXMLRchildren 1 }
+ #1\empty
+ \popmacro\xmlr}
+
+\def\countXMLRchild#1#2%
+ {\pushmacro\xmlr
+ \nofXMLRchildren=0
+ \def\xmlr##1##2##3##4%
+ {\rawdoifinsetelse{##1}{#1}{\advance\nofXMLRchildren 1 }{}}
+ #2\empty
+ \popmacro\xmlr}
+
+\protect \endinput
diff --git a/tex/context/base/xtag-mea.tex b/tex/context/base/xtag-mea.tex
new file mode 100644
index 000000000..d56d6c54b
--- /dev/null
+++ b/tex/context/base/xtag-mea.tex
@@ -0,0 +1,152 @@
+% filtered from html files by Patrick Ion
+%
+% ISOAMSA Characters Extended
+%
+% Added Math Symbols: Arrow Relations
+
+\defineMMLentity angzarr E248 {unknown} angle with down zig-zag arrow
+\defineMMLentity cirmid E250 {unknown} circle, mid below
+\defineMMLentity cudarrl E23E {unknown} left, curved, down arrow
+\defineMMLentity cudarrr E400 {unknown} right, curved, down arrow
+\defineMMLentity cularr 21B6 {unknown} left curved arrow
+\defineMMLentity cularrp E24A {unknown} curved left arrow with plus
+\defineMMLentity curarr 21B7 {unknown} right curved arrow
+\defineMMLentity curarrm E249 {unknown} curved right arrow with minus
+\defineMMLentity Darr 21A1 {unknown} down two-headed arrow
+\defineMMLentity dArr 21D3 {\Downarrow} down double arrow
+\defineMMLentity ddarr 21CA {unknown} two down arrows
+\defineMMLentity DDotrahd E238 {unknown} right arrow with dotted stem
+\defineMMLentity dfisht E24C {unknown} down fish tail
+\defineMMLentity dHar E227 {unknown} down harpoon-left, down harpoon-right
+\defineMMLentity dharl 21C3 {unknown} down harpoon-left
+\defineMMLentity dharr 21C2 {unknown} down harpoon-rt
+\defineMMLentity duarr E216 {unknown} down arrow, up arrow
+\defineMMLentity duhar E217 {unknown} down harp, up harp
+\defineMMLentity dzigrarr 21DD {unknown} right long zig-zag arrow
+\defineMMLentity erarr E236 {unknown} equal, right arrow below
+\defineMMLentity hArr 21D4 {\Leftrightarrow} left and right double arrow
+\defineMMLentity harr 2194 {\leftrightarrow} left and right arrow
+\defineMMLentity harrcir E240 {unknown} left and right arrow with a circle
+\defineMMLentity harrw 21AD {unknown} left and right arr-wavy
+\defineMMLentity hoarr E243 {unknown} horizontal open arrow
+\defineMMLentity imof 22B7 {unknown} image of
+\defineMMLentity lAarr 21DA {unknown} left triple arrow
+\defineMMLentity Larr 219E {unknown} twoheadleftarrow
+\defineMMLentity larrbfs E220 {unknown} left arrow-bar, filled square
+\defineMMLentity larrfs E222 {unknown} left arrow, filled square
+\defineMMLentity larrhk 21A9 {unknown} left arrow-hooked
+\defineMMLentity larrlp 21AB {unknown} left arrow-looped
+\defineMMLentity larrpl E23F {unknown} left arrow, plus
+\defineMMLentity larrsim E24E {unknown} left arrow, similar
+\defineMMLentity larrtl 21A2 {unknown} left arrow-tailed
+\defineMMLentity lAtail E23D {unknown} left double arrow-tail
+\defineMMLentity latail E23C {unknown} left arrow-tail
+\defineMMLentity lBarr E206 {unknown} left doubly broken arrow
+\defineMMLentity lbarr E402 {unknown} left broken arrow
+\defineMMLentity ldca E21A {unknown} left down curved arrow
+\defineMMLentity ldrdhar E22C {unknown} left harpoon-down over right harpoon-down
+\defineMMLentity ldrushar E228 {unknown} left-down-right-up harpoon
+\defineMMLentity ldsh 21B2 {unknown} left down angled arrow
+\defineMMLentity lfisht E214 {unknown} left fish tail
+\defineMMLentity lHar E225 {unknown} left harpoon-up over left harpoon-down
+\defineMMLentity lhard 21BD {\leftharpoondown} left harpoon-down
+\defineMMLentity lharu 21BC {\leftharpoonup} left harpoon-up
+\defineMMLentity lharul E22E {unknown} left harpoon-up over long dash
+\defineMMLentity llarr 21C7 {unknown} two left arrows
+\defineMMLentity llhard E231 {unknown} left harpoon-down below long dash
+\defineMMLentity loarr E242 {unknown} left open arrow
+\defineMMLentity lrarr 21C6 {unknown} left arr over right arr
+\defineMMLentity lrhar 21CB {unknown} left harp over r
+\defineMMLentity lrhard E22F {unknown} right harpoon-down below long dash
+\defineMMLentity lsh 21B0 {\Lsh} Lsh
+\defineMMLentity lurdshar E229 {unknown} left-up-right-down harpoon
+\defineMMLentity luruhar E22B {unknown} left harpoon-up over right harpoon-up
+\defineMMLentity Map E212 {unknown} twoheaded mapsto
+\defineMMLentity map 21A6 {\mapsto} mapsto
+\defineMMLentity midcir E20F {unknown} mid, circle below
+\defineMMLentity mumap 22B8 {unknown} multimap
+\defineMMLentity nearhk E20D {unknown} NE arrow-hooked
+\defineMMLentity neArr 21D7 {unknown} NE pointing double arrow
+\defineMMLentity nearr 2197 {\nearrow} NE pointing arrow
+\defineMMLentity nesear E20E {unknown} NE \& SE arrows
+\defineMMLentity nhArr 21CE {unknown} not left and right double arr
+\defineMMLentity nharr 21AE {unknown} not left and right arrow
+\defineMMLentity nlArr 21CD {unknown} not implied by
+\defineMMLentity nlarr 219A {unknown} not left arrow
+\defineMMLentity nrArr 21CF {unknown} not implies
+\defineMMLentity nrarr 219B {unknown} not right arrow
+\defineMMLentity nrarrc E21D {unknown} not right arrow-curved
+\defineMMLentity nrarrw E21B {unknown} not right arrow-wavy
+\defineMMLentity nvhArr* 21CE {unknown} not, vert, left and right double arrow
+\defineMMLentity nvlArr 21CD {unknown} not, vert, left double arrow
+\defineMMLentity nvrArr 21CF {unknown} not, vert, right double arrow
+\defineMMLentity nwarhk E20C {unknown} NW arrow-hooked
+\defineMMLentity nwArr 21D6 {unknown} NW pointing double arrow
+\defineMMLentity nwarr 2196 {\nwarrow} NW pointing arrow
+\defineMMLentity nwnear E211 {unknown} NW \& NE arrows
+\defineMMLentity olarr 21BA {unknown} left arr in circle
+\defineMMLentity orarr 21BB {unknown} right arr in circle
+\defineMMLentity origof 22B6 {unknown} original of
+\defineMMLentity rAarr 21DB {unknown} right triple arrow
+\defineMMLentity Rarr 21A0 {unknown} twoheadrightarrow
+\defineMMLentity rarrap E235 {unknown} approximate, right arrow above
+\defineMMLentity rarrbfs E221 {unknown} right arrow-bar, filled square
+\defineMMLentity rarrc E21C {unknown} right arrow-curved
+\defineMMLentity rarrfs E223 {unknown} right arrow, filled square
+\defineMMLentity rarrhk 21AA {\hookrightarrow} right arrow-hooked
+\defineMMLentity rarrlp 21AC {unknown} right arrow-looped
+\defineMMLentity rarrpl E21E {unknown} right arrow, plus
+\defineMMLentity rarrsim E24D {unknown} right arrow, similar
+\defineMMLentity Rarrtl E239 {unknown} right two-headed arrow with tail
+\defineMMLentity rarrtl 21A3 {unknown} right arrow-tailed
+\defineMMLentity rarrw 219D {unknown} right arrow-wavy
+\defineMMLentity rAtail E23B {unknown} right double arrow-tail
+\defineMMLentity ratail 21A3 {unknown} right arrow-tail
+\defineMMLentity RBarr E209 {unknown} twoheaded right broken arrow
+\defineMMLentity rBarr E207 {unknown} right doubly broken arrow
+\defineMMLentity rbarr E405 {unknown} right broken arrow
+\defineMMLentity rdca E219 {unknown} right down curved arrow
+\defineMMLentity rdldhar E22D {unknown} right harpoon-down over left harpoon-down
+\defineMMLentity rdsh 21B3 {unknown} right down angled arrow
+\defineMMLentity rfisht E215 {unknown} right fish tail
+\defineMMLentity rHar E224 {unknown} right harpoon-up over right harpoon-down
+\defineMMLentity rhard 21C1 {\rightharpoondown} right harpoon-down
+\defineMMLentity rharu 21C0 {\rightharpoonup} right harpoon-up
+\defineMMLentity rharul E230 {unknown} right harpoon-up over long dash
+\defineMMLentity rlarr 21C4 {unknown} right arr over left arr
+\defineMMLentity rlhar 21CC {unknown} right harp over l
+\defineMMLentity roarr E241 {unknown} right open arrow
+\defineMMLentity rrarr 21C9 {unknown} two right arrows
+\defineMMLentity rsh 21B1 {\Rsh} Rsh
+\defineMMLentity ruluhar E22A {unknown} right harpoon-up over left harpoon-up
+\defineMMLentity searhk E20B {unknown} SE arrow-hooked
+\defineMMLentity seArr 21D8 {unknown} SE pointing double arrow
+\defineMMLentity searr 2198 {\searrow} SE pointing arrow
+\defineMMLentity seswar E406 {unknown} SE \& SW arrows
+\defineMMLentity simrarr E234 {unknown} similar, right arrow below
+\defineMMLentity slarr E233 {unknown} short left arrow
+\defineMMLentity srarr E232 {unknown} short right arrow
+\defineMMLentity swarhk E20A {unknown} SW arrow-hooked
+\defineMMLentity swArr 21D9 {unknown} SW pointing double arrow
+\defineMMLentity swarr 2199 {\swarrow} SW pointing arrow
+\defineMMLentity swnwar E210 {unknown} SW \& NW arrows
+\defineMMLentity Uarr 219F {unknown} up two-headed arrow
+\defineMMLentity uArr 21D1 {\Uparrow} up double arrow
+\defineMMLentity Uarrocir E237 {unknown} up two-headed arrow above circle
+\defineMMLentity udarr 21C5 {unknown} up arrow, down arrow
+\defineMMLentity udhar E218 {unknown} up harp, down harp
+\defineMMLentity ufisht E24B {unknown} up fish tail
+\defineMMLentity uHar E226 {unknown} up harpoon-left, up harpoon-right
+\defineMMLentity uharl 21BF {unknown} up harpoon-left
+\defineMMLentity uharr 21BE {unknown} up harp-r
+\defineMMLentity uuarr 21C8 {unknown} two up arrows
+\defineMMLentity vArr 21D5 {\Updownarrow} up \& down double arrow
+\defineMMLentity varr 2195 {\updownarrow} up \& down arrow
+\defineMMLentity xhArr E202 {unknown} long left and right double arr
+\defineMMLentity xharr E203 {unknown} long left and right arr
+\defineMMLentity xlArr E200 {unknown} long left double arrow
+\defineMMLentity xlarr E201 {unknown} long left arrow
+\defineMMLentity xmap E208 {unknown} longmapsto
+\defineMMLentity xrArr E204 {unknown} long right double arr
+\defineMMLentity xrarr E205 {unknown} long right arrow
+\defineMMLentity zigrarr E244 {unknown} right zig-zag arrow
diff --git a/tex/context/base/xtag-meb.tex b/tex/context/base/xtag-meb.tex
new file mode 100644
index 000000000..88bedb00f
--- /dev/null
+++ b/tex/context/base/xtag-meb.tex
@@ -0,0 +1,124 @@
+% filtered from html files by Patrick Ion
+%
+% ISOAMSB Characters Extended
+%
+% Added Math Symbols: Binary Operators
+
+\defineMMLentity ac E207 {unknown} most positive
+\defineMMLentity acE E290 {unknown} most positive, two lines below
+\defineMMLentity amalg E251 {\amalg} amalgamation or coproduct
+\defineMMLentity barvee 22BD {unknown} bar, vee
+\defineMMLentity Barwed 2306 {unknown} logical and, double bar above
+\defineMMLentity barwed 22BC {unknown} logical and, bar above
+\defineMMLentity bsolb E280 {unknown} reverse solidus in square
+\defineMMLentity Cap 22D2 {unknown} double intersection
+\defineMMLentity capand E281 {unknown} intersection, and
+\defineMMLentity capbrcup E271 {unknown} intersection, bar, union
+\defineMMLentity capcap E273 {unknown} intersection, intersection, joined
+\defineMMLentity capcup E26F {unknown} intersection above union
+\defineMMLentity capdot E261 {unknown} intersection, with dot
+\defineMMLentity caps E275 {unknown} intersection, serifs
+\defineMMLentity ccaps E279 {unknown} closed intersection, serifs
+\defineMMLentity ccups E278 {unknown} closed union, serifs
+\defineMMLentity ccupssm E27A {unknown} closed union, serifs, smash product
+\defineMMLentity coprod 2210 {\coprod} coproduct operator
+\defineMMLentity Cup 22D3 {unknown} double union
+\defineMMLentity cupbrcap E270 {unknown} union, bar, intersection
+\defineMMLentity cupcap E26E {unknown} union above intersection
+\defineMMLentity cupcup E272 {unknown} union, union, joined
+\defineMMLentity cupdot 228D {unknown} union, with dot
+\defineMMLentity cupor E282 {unknown} union, or
+\defineMMLentity cups E274 {unknown} union, serifs
+\defineMMLentity cuvee 22CE {unknown} curly logical or
+\defineMMLentity cuwed 22CF {unknown} curly logical and
+\defineMMLentity Dagger 2021 {\ddagger} double dagger relation
+\defineMMLentity dagger 2020 {\dagger} dagger relation
+\defineMMLentity diam 22C4 {unknown} open diamond
+\defineMMLentity divonx 22C7 {unknown} division on times
+\defineMMLentity eplus E268 {unknown} equal, plus
+\defineMMLentity hercon 22B9 {unknown} hermitian conjugate matrix
+\defineMMLentity intcal 22BA {\intercal} intercal
+\defineMMLentity iprod E259 {unknown} interior product
+\defineMMLentity loplus E25C {unknown} plus sign in left half circle
+\defineMMLentity lotimes E25E {unknown} multiply sign in left half circle
+\defineMMLentity lthree 22CB {unknown} leftthreetimes
+\defineMMLentity ltimes 22C9 {unknown} times sign, left closed
+\defineMMLentity midast 2217 {\ast} centered asterisk
+\defineMMLentity minusb 229F {unknown} minus sign in box
+\defineMMLentity minusd 2238 {unknown} minus sign, dot above
+\defineMMLentity minusdu E25B {unknown} minus sign, dot below
+\defineMMLentity ncap E284 {unknown} bar, intersection
+\defineMMLentity ncup E283 {unknown} bar, union
+\defineMMLentity oast 229B {unknown} asterisk in circle
+\defineMMLentity ocir 229A {unknown} small circle in circle
+\defineMMLentity odash 229D {unknown} hyphen in circle
+\defineMMLentity odiv E285 {unknown} divide in circle
+\defineMMLentity odot 2299 {\odot} middle dot in circle
+\defineMMLentity odsold E286 {unknown} dot, solidus, dot in circle
+\defineMMLentity ofcir E287 {unknown} filled circle in circle
+\defineMMLentity ogt E289 {unknown} greater-than in circle
+\defineMMLentity ohbar E260 {unknown} circle with horizontal bar
+\defineMMLentity olcir E409 {unknown} large circle in circle
+\defineMMLentity olt E288 {unknown} less-than in circle
+\defineMMLentity omid E40A {unknown} vertical bar in circle
+\defineMMLentity ominus 2296 {\ominus} minus sign in circle
+\defineMMLentity opar E28A {unknown} parallel in circle
+\defineMMLentity operp E28B {unknown} perpendicular in circle
+\defineMMLentity oplus 2295 {\oplus} plus sign in circle
+\defineMMLentity osol 2298 {unknown} solidus in circle
+\defineMMLentity Otimes E28C {unknown} multiply sign in double circle
+\defineMMLentity otimes 2297 {\otimes} multiply sign in circle
+\defineMMLentity otimesas E28D {unknown} multiply sign in circle, circumflex accent
+\defineMMLentity ovbar E40B {unknown} circle with vertical bar
+\defineMMLentity plusacir E26A {unknown} plus, circumflex accent above
+\defineMMLentity plusb 229E {unknown} plus sign in box
+\defineMMLentity pluscir E266 {unknown} plus, small circle above
+\defineMMLentity plusdo 2214 {unknown} plus sign, dot above
+\defineMMLentity plusdu E25A {unknown} plus sign, dot below
+\defineMMLentity pluse E267 {unknown} plus, equals
+\defineMMLentity plussim E26C {unknown} plus, similar below
+\defineMMLentity plustwo E269 {unknown} plus, two; Nim-addition
+\defineMMLentity race E40C {unknown} reverse most positive, line below
+\defineMMLentity roplus E25D {unknown} plus sign in right half circle
+\defineMMLentity rotimes E40D {unknown} multiply sign in right half circle
+\defineMMLentity rthree 22CC {unknown} rightthreetimes
+\defineMMLentity rtimes 22CA {unknown} times sign, right closed
+\defineMMLentity sdot 22C5 {\cdot} small middle dot
+\defineMMLentity sdotb 22A1 {unknown} small dot in box
+\defineMMLentity setmn 2216 {unknown} reverse solidus
+\defineMMLentity simplus E26B {unknown} plus, similar above
+\defineMMLentity smashp E264 {unknown} smash product
+\defineMMLentity solb E27F {unknown} solidus in square
+\defineMMLentity sqcap 2293 {\sqcap} square intersection
+\defineMMLentity sqcaps E277 {unknown} square intersection, serifs
+\defineMMLentity sqcup 2294 {\sqcup} square union
+\defineMMLentity sqcups E276 {unknown} square union, serifs
+\defineMMLentity ssetmn E844 {unknown} sm reverse solidus
+\defineMMLentity sstarf 22C6 {\star} small star, filled, low
+\defineMMLentity subdot E262 {unknown} subset, with dot
+\defineMMLentity sum 2211 {\sum} summation operator
+\defineMMLentity supdot E263 {unknown} superset, with dot
+\defineMMLentity timesb 22A0 {unknown} multiply sign in box
+\defineMMLentity timesbar E28E {unknown} multiply sign, bar below
+\defineMMLentity timesd E26D {unknown} times, dot
+\defineMMLentity tridot 25EC {unknown} dot in triangle
+\defineMMLentity triminus E27C {unknown} minus in triangle
+\defineMMLentity triplus E27B {unknown} plus in triangle
+\defineMMLentity trisb E27E {unknown} triangle, serifs at bottom
+\defineMMLentity tritime E27D {unknown} multiply in triangle
+\defineMMLentity uplus 228E {\uplus} plus sign in union
+\defineMMLentity veebar 22BB {unknown} logical or, bar below
+\defineMMLentity wedbar E265 {unknown} wedge, bar below
+\defineMMLentity wreath 2240 {unknown} wreath product
+\defineMMLentity xcap 22C2 {\bigcap} intersection operator
+\defineMMLentity xcirc 25CB {\bigcirc} large circle
+\defineMMLentity xcup 22C3 {\bigcup} union operator
+\defineMMLentity xdtri 25BD {\bigtriangledown} big down triangle, open
+\defineMMLentity xodot 2299 {\bigodot} circle dot operator
+\defineMMLentity xoplus 2295 {\bigoplus} circle plus operator
+\defineMMLentity xotime 2297 {\bigotimes} circle times operator
+\defineMMLentity xsqcup 2294 {\bigsqcup} square union operator
+\defineMMLentity xuplus 228E {\biguplus} biguplus
+\defineMMLentity xutri 25B3 {\bigtriangleup} big up triangle, open
+\defineMMLentity xvee 22C1 {\bigvee} logical and operator
+\defineMMLentity xwedge 22C0 {\bigwedge} logical or operator
diff --git a/tex/context/base/xtag-mec.tex b/tex/context/base/xtag-mec.tex
new file mode 100644
index 000000000..9e941897c
--- /dev/null
+++ b/tex/context/base/xtag-mec.tex
@@ -0,0 +1,28 @@
+% filtered from html files by Patrick Ion
+%
+% ISOAMSC Characters Extended
+%
+% Added Math Symbols: Delimiters
+
+\defineMMLentity dlcorn 231E {unknown} lower left corner
+\defineMMLentity drcorn 231F {unknown} lower right corner
+\defineMMLentity gtlPar E296 {unknown} double left parenthesis, greater
+\defineMMLentity langd E297 {unknown} left angle, dot
+\defineMMLentity lbrke E299 {unknown} left bracket, equal
+\defineMMLentity lbrksld E29D {unknown} left bracket, solidus bottom corner
+\defineMMLentity lbrkslu E29B {unknown} left bracket, solidus top corner
+\defineMMLentity lceil 2308 {\lceil} left ceiling
+\defineMMLentity lfloor 230A {\lfloor} left floor
+\defineMMLentity lmoust E294 {\lmoustache} left moustache
+\defineMMLentity lparlt E292 {unknown} left parenthesis, lt
+\defineMMLentity ltrPar E295 {unknown} double right parenthesis, less
+\defineMMLentity rangd E298 {unknown} right angle, dot
+\defineMMLentity rbrke E29A {unknown} right bracket, equal
+\defineMMLentity rbrksld E29C {unknown} right bracket, solidus bottom corner
+\defineMMLentity rbrkslu E29E {unknown} right bracket, solidus top corner
+\defineMMLentity rceil 2309 {\rceil} right ceiling
+\defineMMLentity rfloor 230B {\rfloor} right floor
+\defineMMLentity rmoust E293 {\rmoustache} right moustache
+\defineMMLentity rpargt E291 {unknown} right paren, gt
+\defineMMLentity ulcorn 231C {unknown} upper left corner
+\defineMMLentity urcorn 231D {unknown} upper right corner
diff --git a/tex/context/base/xtag-meh.tex b/tex/context/base/xtag-meh.tex
new file mode 100644
index 000000000..95e244d35
--- /dev/null
+++ b/tex/context/base/xtag-meh.tex
@@ -0,0 +1,166 @@
+% filtered from html files by Patrick Ion
+%
+% ISOTECH Characters Extended
+%
+% General Technical
+
+\defineMMLentity acd E3A6 {unknown} ac current
+\defineMMLentity aleph 2135 {\aleph} aleph, Hebrew
+\defineMMLentity And E374 {unknown} double logical and
+\defineMMLentity and 2227 {\wedge} logical and
+\defineMMLentity andand E36E {unknown} two logical and
+\defineMMLentity andd E394 {unknown} and, horizontal dash
+\defineMMLentity andslope E50A {unknown} sloping large and
+\defineMMLentity andv E391 {unknown} and with middle stem
+\defineMMLentity angrt 221F {unknown} right (90 degree) angle
+\defineMMLentity angsph 2222 {unknown} angle-spherical
+\defineMMLentity angst 212B {\AA} Angstrom capital A, ring
+\defineMMLentity ap 2248 {\approx} approximate
+\defineMMLentity apacir E38C {unknown} approximate, circumflex accent
+\defineMMLentity awconint 2233 {unknown} contour integral, anti-clockwise
+\defineMMLentity awint E39B {unknown} anti clock-wise integration
+\defineMMLentity becaus 2235 {unknown} because
+\defineMMLentity bernou 212C {unknown} Bernoulli function (script capital B)
+\defineMMLentity bne E388 {unknown} reverse not equal
+\defineMMLentity bnequiv E387 {unknown} reverse not equivalent
+\defineMMLentity bNot E3AD {unknown} reverse not with two horizontal strokes
+\defineMMLentity bnot 2310 {unknown} reverse not
+\defineMMLentity bottom 22A5 {unknown} bottom
+\defineMMLentity cap 2229 {\cap} intersection
+\defineMMLentity Cconint 2230 {unknown} triple contour integral operator
+\defineMMLentity cirfnint E395 {unknown} circulation function
+\defineMMLentity compfn 2218 {\circ} composite function (small circle)
+\defineMMLentity cong 2245 {\cong} congruent with
+\defineMMLentity Conint 222F {unknown} double contour integral operator
+\defineMMLentity conint 222E {\oint} contour integral operator
+\defineMMLentity ctdot 22EF {\cdots} three dots, centered
+\defineMMLentity cup 222A {\cup} union or logical sum
+\defineMMLentity cwconint 2232 {unknown} contour integral, clockwise
+\defineMMLentity cwint 2231 {unknown} clockwise integral
+\defineMMLentity cylcty 232D {unknown} cylindricity
+\defineMMLentity disin E3A0 {unknown} set membership, long horizontal stroke
+\defineMMLentity Dot 0308 {unknown} dieresis or umlaut mark
+\defineMMLentity DotDot 20DC {unknown} four dots above
+\defineMMLentity dsol E3A9 {unknown} solidus, bar above
+\defineMMLentity dtdot 22F1 {\ddots} three dots, descending
+\defineMMLentity dwangle E3AA {unknown} large downward pointing angle
+\defineMMLentity elinters E3A7 {unknown} electrical intersection
+\defineMMLentity epar 22D5 {unknown} parallel, equal; equal or parallel
+\defineMMLentity eparsl E384 {unknown} parallel, slanted, equal; homothetically co
+\defineMMLentity equiv 2261 {\equiv} identical with
+\defineMMLentity eqvparsl E386 {unknown} equivalent, equal; congruent and parallel
+\defineMMLentity exist 2203 {\exists} at least one exists
+\defineMMLentity fltns E381 {unknown} flatness
+\defineMMLentity forall 2200 {\forall} for all
+\defineMMLentity fpartint E396 {unknown} finite part integral
+\defineMMLentity ge 2265 {\geq} greater-than-or-equal
+\defineMMLentity hamilt 210B {unknown} Hamiltonian (script capital H)
+\defineMMLentity iff E365 {unknown} if and only if
+\defineMMLentity iinfin E372 {unknown} infinity sign, incomplete
+\defineMMLentity imped E50B {unknown} impedance
+\defineMMLentity infin 221E {\infty} infinity
+\defineMMLentity infintie E50C {unknown} tie, infinity
+\defineMMLentity Int 222C {unknown} double integral operator
+\defineMMLentity int 222B {\int} integral operator
+\defineMMLentity intlarhk E39A {unknown} integral, left arrow with hook
+\defineMMLentity isin 220A {\in} set membership
+\defineMMLentity isindot E39C {unknown} set membership, dot above
+\defineMMLentity isinE E39E {unknown} set membership, two horizontal strokes
+\defineMMLentity isins E3A4 {unknown} set membership, vertical bar on horizontal
+\defineMMLentity isinsv E3A2 {unknown} large set membership, vertical bar on horiz
+\defineMMLentity isinv 2208 {unknown} set membership, variant
+\defineMMLentity lagran 2112 {unknown} Lagrangian (script capital L)
+\defineMMLentity Lang 300A {unknown} left angle bracket, double
+\defineMMLentity lang 3008 {\langle} left angle bracket
+\defineMMLentity lArr 21D0 {\Leftarrow} is implied by
+\defineMMLentity lbbrk 3014 {unknown} left broken bracket
+\defineMMLentity le 2264 {\leq} less-than-or-equal
+\defineMMLentity loang 3018 {unknown} left open angular bracket
+\defineMMLentity lobrk 301A {unknown} left open bracket
+\defineMMLentity lopar E379 {unknown} left open parenthesis
+\defineMMLentity lowast 2217 {unknown} low asterisk
+\defineMMLentity minus 2212 {unknown} minus sign
+\defineMMLentity mnplus 2213 {\mp} minus-or-plus sign
+\defineMMLentity nabla 2207 {\nabla} del, Hamilton operator
+\defineMMLentity ne 2260 {\ne} not equal
+\defineMMLentity nedot E38A {unknown} not equal, dot
+\defineMMLentity nhpar E38D {unknown} not, horizontal, parallel
+\defineMMLentity ni 220D {unknown} contains
+\defineMMLentity nis E3A5 {unknown} contains, vertical bar on horizontal stroke
+\defineMMLentity nisd E3A1 {unknown} contains, long horizontal stroke
+\defineMMLentity niv 220B {\ni} contains, variant
+\defineMMLentity Not E3AC {unknown} not with two horizontal strokes
+\defineMMLentity notin 2209 {\notin} negated set membership
+\defineMMLentity notindot E39D {unknown} negated set membership, dot above
+\defineMMLentity notinE E50D {unknown} negated set membership, two horizontal strokes
+\defineMMLentity notinva E370 {unknown} negated set membership, variant
+\defineMMLentity notinvb E37B {unknown} negated set membership, variant
+\defineMMLentity notinvc E37C {unknown} negated set membership, variant
+\defineMMLentity notni 220C {unknown} negated contains
+\defineMMLentity notniva 220C {unknown} negated contains, variant
+\defineMMLentity notnivb E37D {unknown} contains, variant
+\defineMMLentity notnivc E37E {unknown} contains, variant
+\defineMMLentity nparsl E389 {unknown} not parallel, slanted
+\defineMMLentity npart E390 {unknown} not partial differential
+\defineMMLentity npolint E399 {unknown} line integration, not including the pole
+\defineMMLentity nvinfin E38E {unknown} not, vert, infinity
+\defineMMLentity olcross E3A8 {unknown} circle, cross
+\defineMMLentity Or E375 {unknown} double logical or
+\defineMMLentity or 2228 {\vee} logical or
+\defineMMLentity ord E393 {unknown} or, horizontal dash
+\defineMMLentity order 2134 {unknown} order of (script small o)
+\defineMMLentity oror E50E {unknown} two logical or
+\defineMMLentity orslope E3AE {unknown} sloping large or
+\defineMMLentity orv E392 {unknown} or with middle stem
+\defineMMLentity par 2225 {\parallel} parallel
+\defineMMLentity parsl E382 {unknown} parallel, slanted
+\defineMMLentity part 2202 {\partial} partial differential
+\defineMMLentity permil 2030 {unknown} per thousand
+\defineMMLentity perp 22A5 {\perp} perpendicular
+\defineMMLentity pertenk 2031 {unknown} per 10 thousand
+\defineMMLentity phmmat 2133 {unknown} physics M-matrix (script capital M)
+\defineMMLentity pointint E376 {unknown} integral around a point operator
+\defineMMLentity Prime 2033 {unknown} double prime or second
+\defineMMLentity prime 2032 {\prime} prime or minute
+\defineMMLentity profalar 232E {unknown} all-around profile
+\defineMMLentity profline 2312 {unknown} profile of a line
+\defineMMLentity profsurf 2313 {unknown} profile of a surface
+\defineMMLentity prop 221D {\propto} is proportional to
+\defineMMLentity qint E378 {unknown} quadruple integral operator
+\defineMMLentity qprime E371 {unknown} quadruple prime
+\defineMMLentity quatint E377 {unknown} quaternion integral operator
+\defineMMLentity radic 221A {\surd} radical
+\defineMMLentity Rang 300B {unknown} right angle bracket, double
+\defineMMLentity rang 3009 {\rangle} right angle bracket
+\defineMMLentity rArr 21D2 {\Rightarrow} implies
+\defineMMLentity rbbrk 3015 {unknown} right broken bracket
+\defineMMLentity roang 3019 {unknown} right open angular bracket
+\defineMMLentity robrk 301B {unknown} right open bracket
+\defineMMLentity ropar E37A {unknown} right open parenthesis
+\defineMMLentity rppolint E397 {unknown} line integration, rectangular path around pole
+\defineMMLentity scpolint E398 {unknown} line integration, semi-circular path around pole
+\defineMMLentity sim 223C {\sim} similar
+\defineMMLentity simdot E38B {unknown} similar, dot
+\defineMMLentity sime 2243 {\simeq} similar, equals
+\defineMMLentity smeparsl E385 {unknown} similar, parallel, slanted, equal
+\defineMMLentity square 25A1 {\square} square
+\defineMMLentity squarf 25A0 {unknown} square, filled
+\defineMMLentity strns E380 {unknown} straightness
+\defineMMLentity sub 2282 {\subset} subset or is implied by
+\defineMMLentity sube 2286 {\subseteq} subset, equals
+\defineMMLentity sup 2283 {\supset} superset or implies
+\defineMMLentity supe 2287 {\supseteq} superset, equals
+\defineMMLentity tdot 20DB {unknown} three dots above
+\defineMMLentity there4 2234 {unknown} therefore
+\defineMMLentity tint 222D {unknown} triple integral operator
+\defineMMLentity top 22A4 {\top} top
+\defineMMLentity topbot 2336 {unknown} top and bottom
+\defineMMLentity topcir E383 {unknown} top, circle below
+\defineMMLentity tprime 2034 {unknown} triple prime
+\defineMMLentity utdot 22F0 {unknown} three dots, ascending
+\defineMMLentity uwangle E3AB {unknown} large upward pointing angle
+\defineMMLentity vangrt 22BE {unknown} right angle, variant (with arc)
+\defineMMLentity veeeq 225A {unknown} logical or, equals
+\defineMMLentity Verbar 2016 {\Vert} double vertical bar
+\defineMMLentity wedgeq 2259 {unknown} corresponds to (wedge, equals)
+\defineMMLentity xnis E3A3 {unknown} large contains, vertical bar on horizontal stroke
diff --git a/tex/context/base/xtag-men.tex b/tex/context/base/xtag-men.tex
new file mode 100644
index 000000000..d548c8394
--- /dev/null
+++ b/tex/context/base/xtag-men.tex
@@ -0,0 +1,98 @@
+% filtered from html files by Patrick Ion
+%
+% ISOAMSN Characters Extended
+%
+% Added Math Symbols: Negated Relations
+
+\defineMMLentity gnap E411 {unknown} greater, not approximate
+\defineMMLentity gnE 2269 {unknown} greater, not double equals
+\defineMMLentity gne 2269 {unknown} greater, not equals
+\defineMMLentity gnsim 22E7 {unknown} greater, not similar
+\defineMMLentity gvnE E2A1 {unknown} gt, vert, not double equals
+\defineMMLentity lnap E2A2 {unknown} less, not approximate
+\defineMMLentity lnE 2268 {unknown} less, not double equals
+\defineMMLentity lne 2268 {unknown} less, not equals
+\defineMMLentity lnsim 22E6 {unknown} less, not similar
+\defineMMLentity lvnE E2A4 {unknown} less, vert, not double equals
+\defineMMLentity nap 2249 {unknown} not approximate
+\defineMMLentity napE E2C7 {unknown} not approximately equal or equal to
+\defineMMLentity napid E2BC {unknown} not approximately identical to
+\defineMMLentity ncong 2247 {unknown} not congruent with
+\defineMMLentity ncongdot E2C5 {unknown} not congruent, dot
+\defineMMLentity nequiv 2262 {unknown} not identical with
+\defineMMLentity ngE 2271 {unknown} not greater, double equals
+\defineMMLentity nge E2A6 {unknown} not greater-than-or-equal
+\defineMMLentity nges 2271 {unknown} not gt-or-equals, slanted
+\defineMMLentity nGg E2CE {unknown} not triple greater than
+\defineMMLentity ngsim 2275 {unknown} not greater, similar
+\defineMMLentity nGt E2CA {unknown} not, vert, much greater than
+\defineMMLentity ngt 226F {unknown} not greater-than
+\defineMMLentity nGtv E2CC {unknown} not much greater than, variant
+\defineMMLentity nlE 2270 {unknown} not less, double equals
+\defineMMLentity nle E2A7 {unknown} not less-than-or-equal
+\defineMMLentity nles 2270 {unknown} not less-or-equals, slant
+\defineMMLentity nLl E2CD {unknown} not triple less than
+\defineMMLentity nlsim 2274 {unknown} not less, similar
+\defineMMLentity nLt E2C9 {unknown} not, vert, much less than
+\defineMMLentity nlt 226E {unknown} not less-than
+\defineMMLentity nltri 22EA {unknown} not left triangle
+\defineMMLentity nltrie 22EC {unknown} not left triangle, equals
+\defineMMLentity nLtv E2CB {unknown} not much less than, variant
+\defineMMLentity nmid 2224 {unknown} negated mid
+\defineMMLentity npar 2226 {unknown} not parallel
+\defineMMLentity npr 2280 {unknown} not precedes
+\defineMMLentity nprcue 22E0 {unknown} not curly precedes, equals
+\defineMMLentity npre E412 {unknown} not precedes, equals
+\defineMMLentity nrtri 22EB {unknown} not right triangle
+\defineMMLentity nrtrie 22ED {unknown} not right triangle, equals
+\defineMMLentity nsc 2281 {unknown} not succeeds
+\defineMMLentity nsccue 22E1 {unknown} not succeeds, curly equals
+\defineMMLentity nsce E413 {unknown} not succeeds, equals
+\defineMMLentity nsim 2241 {unknown} not similar
+\defineMMLentity nsime 2244 {unknown} not similar, equals
+\defineMMLentity nsmid E2AA {unknown} negated short mid
+\defineMMLentity nspar E2AB {unknown} not short par
+\defineMMLentity nsqsube 22E2 {unknown} not, square subset, equals
+\defineMMLentity nsqsupe 22E3 {unknown} not, square superset, equals
+\defineMMLentity nsub 2284 {unknown} not subset
+\defineMMLentity nsubE 2288 {unknown} not subset, double equals
+\defineMMLentity nsube 2288 {unknown} not subset, equals
+\defineMMLentity nsup 2285 {unknown} not superset
+\defineMMLentity nsupE 2289 {unknown} not superset, double equals
+\defineMMLentity nsupe 2289 {unknown} not superset, equals
+\defineMMLentity ntgl 2279 {unknown} not greater, less
+\defineMMLentity ntlg 2278 {unknown} not less, greater
+\defineMMLentity ntvgl 2279 {unknown} not, vert, greater, less
+\defineMMLentity ntvlg 2278 {unknown} not, vert, less, greater
+\defineMMLentity nvap E2C6 {unknown} not, vert, approximate
+\defineMMLentity nVDash 22AF {unknown} not double vert, double dash
+\defineMMLentity nVdash 22AE {unknown} not double vertical, dash
+\defineMMLentity nvDash 22AD {unknown} not vertical, double dash
+\defineMMLentity nvdash 22AC {unknown} not vertical, dash
+\defineMMLentity nvge 2271 {unknown} not, vert, greater-than-or-equal
+\defineMMLentity nvgt 226F {unknown} not, vert, greater-than
+\defineMMLentity nvle 2270 {unknown} not, vert, less-than-or-equal
+\defineMMLentity nvlt 226E {unknown} not, vert, less-than
+\defineMMLentity nvltrie E2D0 {unknown} not, vert, left triangle, equals
+\defineMMLentity nvrtrie E2CF {unknown} not, vert, right triangle, equals
+\defineMMLentity nvsim E415 {unknown} not, vert, similar
+\defineMMLentity parsim E2C8 {unknown} parallel, similar
+\defineMMLentity prnap 22E8 {unknown} precedes, not approx
+\defineMMLentity prnE E2B3 {unknown} precedes, not double equals
+\defineMMLentity prnsim 22E8 {unknown} precedes, not similar
+\defineMMLentity rnmid E2D1 {unknown} reverse nmid
+\defineMMLentity scnap 22E9 {unknown} succeeds, not approx
+\defineMMLentity scnE E2B5 {unknown} succeeds, not double equals
+\defineMMLentity scnsim 22E9 {unknown} succeeds, not similar
+\defineMMLentity simne 2246 {unknown} similar, not equals
+\defineMMLentity solbar E416 {unknown} solidus, bar through
+\defineMMLentity subnE 228A {unknown} subset, not double equals
+\defineMMLentity subne 228A {unknown} subset, not equals
+\defineMMLentity supnE 228B {unknown} superset, not double equals
+\defineMMLentity supne 228B {unknown} superset, not equals
+\defineMMLentity vnsub 2284 {unknown} not subset, variant
+\defineMMLentity vnsup 2285 {unknown} not superset, variant
+\defineMMLentity vsubnE E2B8 {unknown} subset not double equals, variant
+\defineMMLentity vsubne E2B9 {unknown} subset, not equals, variant
+\defineMMLentity vsupnE E2BB {unknown} super not double equals, variant
+\defineMMLentity vsupne E2BA {unknown} superset, not equals, variant
diff --git a/tex/context/base/xtag-meo.tex b/tex/context/base/xtag-meo.tex
new file mode 100644
index 000000000..f19f80fbe
--- /dev/null
+++ b/tex/context/base/xtag-meo.tex
@@ -0,0 +1,58 @@
+% filtered from html files by Patrick Ion
+%
+% ISOAMSO Characters Extended
+%
+% Added Math Symbols: Ordinary
+
+\defineMMLentity ang 2220 {\angle} angle
+\defineMMLentity ange E2D6 {unknown} angle, equal
+\defineMMLentity angmsd 2221 {unknown} angle-measured
+\defineMMLentity angmsdaa E2D9 {unknown} angle-measured, arrow, up, right
+\defineMMLentity angmsdab E2DA {unknown} angle-measured, arrow, up, left
+\defineMMLentity angmsdac E2DB {unknown} angle-measured, arrow, down, right
+\defineMMLentity angmsdad E2DC {unknown} angle-measured, arrow, down, left
+\defineMMLentity angmsdae E2DD {unknown} angle-measured, arrow, right, up
+\defineMMLentity angmsdaf E2DE {unknown} angle-measured, arrow, left, up
+\defineMMLentity angmsdag E2DF {unknown} angle-measured, arrow, right, down
+\defineMMLentity angmsdah E2E0 {unknown} angle-measured, arrow, left, down
+\defineMMLentity angrtvb E418 {unknown} right angle-measured
+\defineMMLentity angrtvbd E2E1 {unknown} right angle-measured, dot
+\defineMMLentity bbrk E2EE {unknown} bottom square bracket
+\defineMMLentity bbrktbrk E419 {unknown} bottom above top square bracket
+\defineMMLentity bemptyv E41A {unknown} reversed circle, slash
+\defineMMLentity beth 2136 {unknown} beth, Hebrew
+\defineMMLentity boxbox E2E6 {unknown} two joined squares
+\defineMMLentity bprime 2035 {unknown} reverse prime
+\defineMMLentity bsemi E2ED {unknown} reverse semi-colon
+\defineMMLentity cemptyv E2E8 {unknown} circle, slash, small circle above
+\defineMMLentity cirE E41B {unknown} circle, two horizontal stroked to the right
+\defineMMLentity cirscir E41C {unknown} circle, small circle to the right
+\defineMMLentity comp 2201 {unknown} complement sign
+\defineMMLentity daleth 2138 {unknown} daleth, Hebrew
+\defineMMLentity demptyv E2E7 {unknown} circle, slash, bar above
+\defineMMLentity ell 2113 {\ell} cursive small l
+\defineMMLentity empty E2D3 {unknown} letter O slashed
+\defineMMLentity emptyv 2205 {unknown} circle, slash
+\defineMMLentity gimel 2137 {unknown} gimel, Hebrew
+\defineMMLentity iiota 2129 {unknown} inverted iota
+\defineMMLentity image 2111 {\Im} imaginary
+\defineMMLentity imath 0131 {\imath} small i, no dot
+\defineMMLentity jmath E2D4 {unknown} small j, no dot
+\defineMMLentity laemptyv E2EA {unknown} circle, slash, left arrow above
+\defineMMLentity lltri E2E5 {unknown} lower left triangle
+\defineMMLentity lrtri E2E3 {unknown} lower right triangle
+\defineMMLentity mho 2127 {unknown} conductance
+\defineMMLentity nang E2D8 {unknown} not, vert, angle
+\defineMMLentity nexist 2204 {unknown} negated exists
+\defineMMLentity oS E41D {unknown} capital S in circle
+\defineMMLentity plank E2D5 {unknown} Planck's over 2pi
+\defineMMLentity plankv 210F {unknown} variant Planck's over 2pi
+\defineMMLentity raemptyv E2E9 {unknown} circle, slash, right arrow above
+\defineMMLentity range E2D7 {unknown} reverse angle, equal
+\defineMMLentity real 211C {\Re} real
+\defineMMLentity tbrk E2EF {unknown} top square bracket
+\defineMMLentity trpezium E2EC {unknown} trapezium
+\defineMMLentity ultri E2E4 {unknown} upper left triangle
+\defineMMLentity urtri E2E2 {unknown} upper right triangle
+\defineMMLentity vzigzag E2EB {unknown} vertical zig-zag line
+\defineMMLentity weierp 2118 {\wp} Weierstrass p
diff --git a/tex/context/base/xtag-mer.tex b/tex/context/base/xtag-mer.tex
new file mode 100644
index 000000000..becff584a
--- /dev/null
+++ b/tex/context/base/xtag-mer.tex
@@ -0,0 +1,185 @@
+% filtered from html files by Patrick Ion
+%
+% ISOAMSR Characters Extended
+%
+% Added Math Symbols: Relations
+
+\defineMMLentity apE E315 {unknown} approximately equal or equal to
+\defineMMLentity ape 224A {unknown} approximate, equals
+\defineMMLentity apid 224B {unknown} approximately identical to
+\defineMMLentity asymp 224D {\asymp} asymptotically equal to
+\defineMMLentity Barv E311 {unknown} vert, double bar (over)
+\defineMMLentity bcong 224C {unknown} reverse congruent
+\defineMMLentity bepsi E420 {unknown} such that
+\defineMMLentity bowtie 22C8 {unknown} bowtie
+\defineMMLentity bsim 223D {unknown} reverse similar
+\defineMMLentity bsime 22CD {unknown} reverse similar, equals
+\defineMMLentity bsolhsub E34D {unknown} reverse solidus, subset
+\defineMMLentity bump 224E {unknown} bumpy equals
+\defineMMLentity bumpe 224F {unknown} bumpy equals, equals
+\defineMMLentity cire 2257 {unknown} circle, equals
+\defineMMLentity Colon 2237 {unknown} two colons
+\defineMMLentity Colone E30E {unknown} double colon, equals
+\defineMMLentity colone 2254 {unknown} colon, equals
+\defineMMLentity congdot E314 {unknown} congruent, dot
+\defineMMLentity csub E351 {unknown} subset, closed
+\defineMMLentity csube E353 {unknown} subset, closed, equals
+\defineMMLentity csup E352 {unknown} superset, closed
+\defineMMLentity csupe E354 {unknown} superset, closed, equals
+\defineMMLentity cuepr 22DE {unknown} curly equals, precedes
+\defineMMLentity cuesc 22DF {unknown} curly equals, succeeds
+\defineMMLentity Dashv E30F {unknown} double dash, vertical
+\defineMMLentity dashv 22A3 {\dashv} dash, vertical
+\defineMMLentity easter 225B {unknown} equal, asterisk above
+\defineMMLentity ecir 2256 {unknown} circle on equals sign
+\defineMMLentity ecolon 2255 {unknown} equals, colon
+\defineMMLentity eDDot E309 {unknown} equal with four dots
+\defineMMLentity eDot 2251 {unknown} equals, even dots
+\defineMMLentity efDot 2252 {unknown} equals, falling dots
+\defineMMLentity eg E328 {unknown} equal-or-greater
+\defineMMLentity egs 22DD {unknown} equal-or-gtr, slanted
+\defineMMLentity egsdot E324 {unknown} equal-or-greater, slanted, dot inside
+\defineMMLentity el E327 {unknown} equal-or-less
+\defineMMLentity els 22DC {unknown} eq-or-less, slanted
+\defineMMLentity elsdot E323 {unknown} equal-or-less, slanted, dot inside
+\defineMMLentity equest 225F {unknown} equal with questionmark
+\defineMMLentity equivDD E318 {unknown} equivalent, four dots above
+\defineMMLentity erDot 2253 {unknown} equals, rising dots
+\defineMMLentity esdot 2250 {unknown} equals, single dot above
+\defineMMLentity Esim E317 {unknown} equal, similar
+\defineMMLentity esim 2242 {unknown} equals, similar
+\defineMMLentity fork 22D4 {unknown} pitchfork
+\defineMMLentity forkv E31B {unknown} fork, variant
+\defineMMLentity frown 2322 {\frown} down curve
+\defineMMLentity gap 2273 {unknown} greater, approximate
+\defineMMLentity gE 2267 {unknown} greater, double equals
+\defineMMLentity gEl 22DB {unknown} gt, double equals, less
+\defineMMLentity gel 22DB {unknown} greater, equals, less
+\defineMMLentity ges E421 {unknown} gt-or-equal, slanted
+\defineMMLentity gescc E358 {unknown} greater than, closed by curve, equal, slanted
+\defineMMLentity gesdot E31E {unknown} greater-than-or-equal, slanted, dot inside
+\defineMMLentity gesdoto E320 {unknown} greater-than-or-equal, slanted, dot above
+\defineMMLentity gesdotol E322 {unknown} greater-than-or-equal, slanted, dot above left
+\defineMMLentity gesl E32C {unknown} greater, equal, slanted, less
+\defineMMLentity gesles E332 {unknown} greater, equal, slanted, less, equal, slanted
+\defineMMLentity Gg 22D9 {unknown} triple gtr-than
+\defineMMLentity gl 2277 {unknown} greater, less
+\defineMMLentity gla E330 {unknown} greater, less, apart
+\defineMMLentity glE E32E {unknown} greater, less, equal
+\defineMMLentity glj E32F {unknown} greater, less, overlapping
+\defineMMLentity gsim 2273 {unknown} greater, similar
+\defineMMLentity gsime E334 {unknown} greater, similar, equal
+\defineMMLentity gsiml E336 {unknown} greater, similar, less
+\defineMMLentity Gt 226B {unknown} double greater-than sign
+\defineMMLentity gtcc E356 {unknown} greater than, closed by curve
+\defineMMLentity gtcir E326 {unknown} greater than, circle inside
+\defineMMLentity gtdot 22D7 {unknown} greater than, with dot
+\defineMMLentity gtquest E32A {unknown} greater than, questionmark above
+\defineMMLentity gtrarr E35F {unknown} greater than, right arrow
+\defineMMLentity homtht 223B {unknown} homothetic
+\defineMMLentity lap 2272 {unknown} less, approximate
+\defineMMLentity lat E33A {unknown} larger than
+\defineMMLentity late E33C {unknown} larger than or equal
+\defineMMLentity lates E33E {unknown} larger than or equal, slanted
+\defineMMLentity lE 2266 {unknown} less, double equals
+\defineMMLentity lEg 22DA {unknown} less, double equals, greater
+\defineMMLentity leg 22DA {unknown} less, equals, greater
+\defineMMLentity les E425 {unknown} less-than-or-equals, slant
+\defineMMLentity lescc E357 {unknown} less than, closed by curve, equal, slanted
+\defineMMLentity lesdot E31D {unknown} less-than-or-equal, slanted, dot inside
+\defineMMLentity lesdoto E31F {unknown} less-than-or-equal, slanted, dot above
+\defineMMLentity lesdotor E321 {unknown} less-than-or-equal, slanted, dot above right
+\defineMMLentity lesg E32B {unknown} less, equal, slanted, greater
+\defineMMLentity lesges E331 {unknown} less, equal, slanted, greater, equal, slanted
+\defineMMLentity lg 2276 {unknown} less, greater
+\defineMMLentity lgE E32D {unknown} less, greater, equal
+\defineMMLentity Ll 22D8 {unknown} triple less-than
+\defineMMLentity lsim 2272 {unknown} less, similar
+\defineMMLentity lsime E333 {unknown} less, similar, equal
+\defineMMLentity lsimg E335 {unknown} less, similar, greater
+\defineMMLentity Lt 226A {unknown} double less-than sign
+\defineMMLentity ltcc E355 {unknown} less than, closed by curve
+\defineMMLentity ltcir E325 {unknown} less than, circle inside
+\defineMMLentity ltdot 22D6 {unknown} less than, with dot
+\defineMMLentity ltlarr E35E {unknown} less than, left arrow
+\defineMMLentity ltquest E329 {unknown} less than, questionmark above
+\defineMMLentity ltrie 22B4 {unknown} left triangle, equals
+\defineMMLentity mcomma E31A {unknown} minus, comma above
+\defineMMLentity mDDot 223A {unknown} minus with four dots, geometric properties
+\defineMMLentity mid 2223 {\mid} mid
+\defineMMLentity mlcp E30A {unknown} transversal intersection
+\defineMMLentity models 22A7 {\models} models
+\defineMMLentity mstpos 223E {unknown} most positive
+\defineMMLentity Pr E35C {unknown} double precedes
+\defineMMLentity pr 227A {\prec} precedes
+\defineMMLentity prap 227E {unknown} precedes, approximate
+\defineMMLentity prcue 227C {unknown} precedes, curly equals
+\defineMMLentity prE 227C {unknown} precedes, double equals
+\defineMMLentity pre 227C {\preceq} precedes, equals
+\defineMMLentity prsim 227E {unknown} precedes, similar
+\defineMMLentity prurel 22B0 {unknown} element precedes under relation
+\defineMMLentity ratio 2236 {unknown} ratio
+\defineMMLentity rtrie 22B5 {unknown} right triangle, equals
+\defineMMLentity rtriltri E359 {unknown} right triangle above left triangle
+\defineMMLentity Sc E35D {unknown} double succeeds
+\defineMMLentity sc 227B {\succ} succeeds
+\defineMMLentity scap 227F {unknown} succeeds, approximate
+\defineMMLentity sccue 227D {unknown} succeeds, curly equals
+\defineMMLentity scE 227E {unknown} succeeds, double equals
+\defineMMLentity sce 227D {\succeq} succeeds, equals
+\defineMMLentity scsim 227F {unknown} succeeds, similar
+\defineMMLentity sdote E319 {unknown} equal, dot below
+\defineMMLentity sfrown E426 {unknown} small down curve
+\defineMMLentity simg E30C {unknown} similar, greater
+\defineMMLentity simgE E338 {unknown} similar, greater, equal
+\defineMMLentity siml E30B {unknown} similar, less
+\defineMMLentity simlE E337 {unknown} similar, less, equal
+\defineMMLentity smid E301 {unknown} shortmid
+\defineMMLentity smile 2323 {\smile} up curve
+\defineMMLentity smt E339 {unknown} smaller than
+\defineMMLentity smte E33B {unknown} smaller than or equal
+\defineMMLentity smtes E33D {unknown} smaller than or equal, slanted
+\defineMMLentity spar E302 {unknown} short parallel
+\defineMMLentity sqsub 228F {unknown} square subset
+\defineMMLentity sqsube 2291 {\sqsubseteq} square subset, equals
+\defineMMLentity sqsup 2290 {unknown} square superset
+\defineMMLentity sqsupe 2292 {\sqsupseteq} square superset, equals
+\defineMMLentity ssmile E303 {unknown} small up curve
+\defineMMLentity Sub 22D0 {unknown} double subset
+\defineMMLentity subE 2286 {unknown} subset, double equals
+\defineMMLentity subedot E34F {unknown} subset, equals, dot
+\defineMMLentity submult E343 {unknown} subset, multiply
+\defineMMLentity subplus E341 {unknown} subset, plus
+\defineMMLentity subrarr E33F {unknown} subset, right arrow
+\defineMMLentity subsim E345 {unknown} subset, similar
+\defineMMLentity subsub E349 {unknown} subset above subset
+\defineMMLentity subsup E347 {unknown} subset above superset
+\defineMMLentity Sup 22D1 {unknown} double superset
+\defineMMLentity supdsub E34C {unknown} superset, subset, dash joining them
+\defineMMLentity supE 2287 {unknown} superset, double equals
+\defineMMLentity supedot E350 {unknown} superset, equals, dot
+\defineMMLentity suphsol E34E {unknown} superset, solidus
+\defineMMLentity suphsub E34B {unknown} superset, subset
+\defineMMLentity suplarr E340 {unknown} superset, left arrow
+\defineMMLentity supmult E344 {unknown} superset, multiply
+\defineMMLentity supplus E342 {unknown} superset, plus
+\defineMMLentity supsim E346 {unknown} superset, similar
+\defineMMLentity supsub E348 {unknown} superset above subset
+\defineMMLentity supsup E34A {unknown} superset above superset
+\defineMMLentity thkap E306 {unknown} thick approximate
+\defineMMLentity thksim E429 {unknown} thick similar
+\defineMMLentity topfork E31C {unknown} fork with top
+\defineMMLentity trie 225C {unknown} triangle, equals
+\defineMMLentity twixt 226C {unknown} between
+\defineMMLentity Vbar E30D {unknown} double vert, bar (under)
+\defineMMLentity vBar E310 {unknown} vert, double bar (under)
+\defineMMLentity vBarv E312 {unknown} double bar, vert over and under
+\defineMMLentity VDash 22AB {unknown} double vert, double dash
+\defineMMLentity Vdash 22A9 {unknown} double vertical, dash
+\defineMMLentity vDash 22A8 {unknown} vertical, double dash
+\defineMMLentity vdash 22A2 {\vdash} vertical, dash
+\defineMMLentity Vdashl E313 {unknown} vertical, dash (long)
+\defineMMLentity vltri 22B2 {\triangleleft} left triangle, open, variant
+\defineMMLentity vprop 221D {unknown} proportional, variant
+\defineMMLentity vrtri 22B3 {\triangleright} right triangle, open, variant
+\defineMMLentity Vvdash 22AA {unknown} triple vertical, dash
diff --git a/tex/context/base/xtag-mmc.tex b/tex/context/base/xtag-mmc.tex
new file mode 100644
index 000000000..195ea4a72
--- /dev/null
+++ b/tex/context/base/xtag-mmc.tex
@@ -0,0 +1,1223 @@
+%D \module
+%D [ file=xtag-mmc,
+%D version=2000.12.20,
+%D title=\CONTEXT\ XML Support,
+%D subtitle=Math ML,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{Context XML Macros (content math ml)}
+
+% this is the first, experimental, shabby implementation, as
+% always, the third will do -)
+
+% okay, now this is the second one, with a more kid based
+% approach, which we needed for proper nesting, but the
+% code is still too ugly
+
+\unprotect
+
+\def\getmmlarguments#1#2#3#4#5#6% {class} {defaults} mmlargs
+ {\getXMLarguments{#1}{#2 #5}}%
+
+\def\doifMMLoperatorelse#1#2#3% temp hack
+ {\pushmacro\xmlrent
+ \let\xmlrent\firstofoneargument
+ \edef\mmloperator{#1}%
+ \@EA\unspaceargument\mmloperator\to\mmloperator
+ \popmacro\xmlrent
+ \doifXMLentityelse\mmloperator
+ {\doifdefinedelse{doMMLcFN\mmloperator}{#2}{#3}}
+ {#3}}
+
+\remapXMLsequence [ci] [CPA] \MMLcCI
+\remapXMLsequence [cn] [CPA] \MMLcCN
+\remapXMLsequence [csymbol] [CPA] \MMLcCSYMBOL
+
+\setupMMLappearance[polar][\c!variant=\v!a] % a|b|c
+
+\def\MMLcpolar#1%
+ {\doifdefinedelse{MMLcdopolar\@@MMLpolarvariant}
+ {\getvalue{MMLcdopolar\@@MMLpolarvariant}{#1}}
+ {#1}}
+
+\def\MMLcdopolara#1%
+ {\def\MMLcsep{,}\getXMLentity{polar}\left(#1\right)}
+
+\def\MMLcdopolarb#1%
+ {\def\MMLcsep##1\empty%
+ {\getXMLentity{exponentiale}^{##1\mskip2mu\getXMLentity{imaginaryi}}}#1}
+
+\def\MMLcdopolarc#1%
+ {\def\MMLcsep##1\empty%
+ {\getXMLentity{exp}\left(##1\mskip2mu\getXMLentity{imaginaryi}\right)}#1}
+
+\def\MMLccartesian#1%
+ {\def\MMLcsep{+}#1\getXMLentity{imaginaryi}}
+
+% float will be obsolete, an is replace by e-notation
+
+\setupMMLappearance[float][\c!symbool=\v!nee] % \v!ja|dot
+
+\def\MMLcfloat#1%
+ {\doifelse{\@@MMLfloatsymbool}{\v!nee}
+ {{\rm#1}} % make sure that e shows up ok
+ {% we should ignore \entities !
+ \beforesplitstring#1\at e\to\first
+ \aftersplitstring #1\at e\to\last
+ \ifx\first\empty #1\else
+ \ifx\last \empty #1\else
+ \first
+ \doifelse{\@@MMLfloatsymbool}{dot}{\cdot}{\times}%
+ 10^{\last}%
+ \fi\fi}}
+
+% we now have:
+
+\setupMMLappearance[enotation][\c!symbool=\v!nee] % \v!ja|dot
+
+\def\MMLcenotation#1%
+ {\doifelse{\@@MMLenotationsymbool}{\v!nee}
+ {\def\MMLcsep%
+ {\unskip{\rm e}\ignorespaces}}
+ {\def\MMLcsep##1\empty
+ {\doifelse{\@@MMLenotationsymbool}{dot}{\cdot}{\times}10^{##1}}}%
+ #1\empty}
+
+\def\MMLcCI#1% #2% can be sped up with \doifundefined ...
+ {\getXMLarguments{ci}{type="" #1}%
+ \doifXMLparelse{ci}{type}
+ {\processaction
+ [\XMLpar{ci}{type}{}]
+ [ set=>\let\next\MMLcCIset,
+ vector=>\let\next\MMLcCIvector,
+ matrix=>\let\next\MMLcCImatrix,
+ function=>\let\next\MMLcCIfunction,
+complex-cartesian=>\let\next\MMLccartesian,
+ complex=>\let\next\MMLccartesian,
+ complex-polar=>\let\next\MMLcpolar,
+ polar=>\let\next\MMLcpolar,
+ fn=>\let\next\MMLcCIfunction,
+ unknown=>\let\next\firstofoneargument]} % integer constant real float
+ {\let\next\firstofoneargument}%
+ \next}
+
+\def\MMLcCIset#1%
+ {{\blackboard#1}}
+
+\def\widevec#1%
+ {\vbox{\m@th\ialign{##\crcr
+ \rightarrowfill\crcr\noalign{\nointerlineskip}%
+ $\hfil\displaystyle{#1}\hfil$\crcr}}}
+
+\def\MMLcCIvector#1%
+ {\widevec{#1}}
+
+\def\MMLcCImatrix#1%
+ {{\bi#1}}
+
+\def\MMLcCIfunction#1%
+ {\doifMMLoperatorelse{#1}
+ {\let\next\MMLcCIdefault}
+ {\let\next\MMLcFNdefault}%
+ \next{}{#1}}
+
+\def\MMLcCIdefault#1#2% #1=dummy
+ {#2\!% \getXMLentity{NegThinSpace}%
+ \doifnextcharelse\xmlr
+ {\encapsulatenextXMLRelements{\left(}{,}{\right)}}
+ {}}
+
+\def\MMLcCN#1% #2% can be sped up with \doifundefined ...
+ {\getXMLarguments{cn}{type="" #1}%
+ \doifXMLparelse{cn}{type}
+ {\processaction
+ [\XMLpar{cn}{type}{}]
+ [ integer=>\let\next\MMLcCNinteger,
+ logical=>\let\next\MMLcCNlogical,
+ rational=>\let\next\MMLcCNrational,
+complex-cartesian=>\let\next\MMLccartesian,
+ complex=>\let\next\MMLccartesian,
+ complex-polar=>\let\next\MMLcpolar,
+ polar=>\let\next\MMLcpolar,
+ e-notation=>\let\next\MMLcenotation, % new
+ float=>\let\next\MMLcfloat, % obsolete
+ real=>\let\next\MMLcfloat, % ?
+ unknown=>\let\next\firstofoneargument]}
+ {\let\next\firstofoneargument}
+ \next}
+
+\setupMMLappearance[base][\c!symbool=\v!cijfers] % cijfers|letters|tekst|nee
+
+\def\MMLcCNinteger#1%
+ {\doifXMLparelse{cn}{base}
+ {\def\MMLcCNbase{\XMLpar{cn}{base}{}}%
+ \doifelse{\@@MMLbasesymbool}{\v!nee}
+ {\MMLcCNbasedata{#1}}
+ {\MMLcCNbasedata{#1}_{\hbox{$\rm\scriptscriptstyle
+ \processaction
+ [\@@MMLbasesymbool]
+ [\v!letters=>\MMLcCNbasestring BODH,
+ \v!tekst=>\MMLcCNbasestring{BIN}{OCT}{DEC}{HEX},
+ \s!unknown=>\MMLcCNbase]$}}}}
+ {#1}}
+
+\def\MMLcCNbasedata#1%
+ {\ifnum\MMLcCNbase>10{\rm#1}\else#1\fi}
+
+\def\MMLcCNbasestring#1#2#3#4%
+ {\ifnum\MMLcCNbase= 2 #1\else
+ \ifnum\MMLcCNbase= 8 #2\else
+ \ifnum\MMLcCNbase=10 #3\else
+ \ifnum\MMLcCNbase=16 #4\else
+ \MMLcCNbase \fi\fi\fi\fi}
+
+\def\MMLcCNlogical#1%
+ {{\rm#1}}
+
+\def\MMLcCNrational#1%
+ {\ConvertConstantAfter\doifinstringelse{sep}{#1}
+ {\doMMLcCNrational#1\empty}
+ {#1}}
+
+\def\doMMLcCNrational#1\xmlr#2#3#4#5\empty
+ {\hbox{$\frac{#1}{#5}$}}
+
+\def\MMLcCSYMBOL#1#2% TO DO
+ {\getXMLarguments{csymbol}{encoding="text" #1}%
+ \doifelse{\XMLpar{csymbol}{encoding}{}}{text}
+ {{\rm#2}}{#2}}
+
+%%% basic content elements
+
+\remapXMLsequence [apply] [CPA] \MMLcAPPLY
+
+\newcount\@MMLlevel \def\MMLcreset{\@MMLlevel=0 }
+
+\let\MMLctempresetlist\empty \def\setMMLcreset{\edef\MMLctempresetlist}
+
+\def\MMLcmainresetlist%
+ {times/,divide/,power/,%
+ lt/,gt/,eq/,leq/,geq/,%
+ in/,inverse/,%
+ fn,%
+ floor/,ceiling/,%
+ mean/,
+ abs/,int/,limit/,sum/,product/%
+ outerproduct/,innerproduct/,scalarproduct/}
+
+\def\MMLcfunctionlist
+ {sin/,arcsin/,sinh/,arcsinh/,%
+ cos/,arccos/,cosh/,arccosh/,%
+ tan/,arctan/,tanh/,arctanh/,%
+ cot/,arccot/,coth/,arccoth/,%
+ csc/,arccsc/,csch/,arccsch/,%
+ sec/,arcsec/,sech/,arcsech/,%
+ ln/,exp/,log/,%
+ abs/,int/,limit/,sum/,product/%
+ fn} % ?
+
+\def\MMLcconstructlist
+ {diff/,partialdiff/,apply}
+
+% better: no () here but explicitly when needed, which is in
+% less cases
+
+\def\MMLcAPPLY#1#2%
+ {\pushmacro\xmlr
+ \@EA\@EA\@EA\doifXMLRchild\@EA\@EA\@EA{\@EA\MMLcmainresetlist\@EA,\MMLctempresetlist}{#2}
+ {\MMLcreset}%
+ \ifcase\@MMLlevel
+ \getXMLarguments{apply}{open="" close="" #1}%
+ \else
+ \getXMLarguments{apply}{open="(" close=")" #1}%
+ \fi
+ \doifXMLparelse{apply}{open}{\left\XMLpar{apply}{open}{}}{}%
+ \advance\@MMLlevel+1
+ \begingroup
+ \let\MMLctempresetlist\empty
+ \let\xmlr\naturalxmlr % beter een \pushmacro\xmlr
+ #2\empty
+ \endgroup % ook level push
+ \advance\@MMLlevel-1
+ \doifXMLparelse{apply}{close}{\right\XMLpar{apply}{close}{}}{}%
+ \popmacro\xmlr}
+
+\remapXMLsequence [reln] [CPA] \MMLcRELN
+
+\def\MMLcRELN%
+ {\writestatus{XML}{MathML element "reln" is obsolete}\MMLcAPPLY}
+
+\remapXMLsequence [fn] [CPA] \MMLcFN
+
+\def\MMLcFN#1#2% neg space needed because of \left
+ {\doifXMLRchildelse{ci}{#2}
+ {\collectXMLRchild{ci}{#2}%
+ \@EA\doifMMLoperatorelse\@EA{\the\XMLRtoks}
+ {\let\next\MMLcFNoperator}
+ {\let\next\MMLcFNdefault}}
+ {\let\next\MMLcFNdefault}%
+ \next{#1}{#2}}
+
+\def\MMLcFNdefault#1#2% neg space needed because of \left
+ {#2\!% \getXMLentity{NegThinSpace}%
+ \MMLcreset\encapsulatenextXMLRelements{\left(}{,}{\right)}}
+
+% special function handlers
+
+\def\MMLcFNoperator
+ {\getvalue{doMMLcFN\mmloperator}}
+
+\def\doMMLcFNplusminus#1#2#3\empty
+ {\countXMLRchildren{#3}%
+ \ifcase\nofXMLRchildren\or
+ #2#3%
+ \else
+ \encapsulateXMLR{\left(}{#2}{\right)}{\MMLcreset#3}%
+ \fi}
+
+\let\doMMLcFNminusplus\doMMLcFNplusminus
+
+\def\doMMLcFNcontinued#1#2#3\empty
+ {#3\getXMLentity{continued}}
+
+% so far for the special handlers
+
+\remapXMLsequence [interval] [CPA] \MMLcINTERVAL
+
+\def\MMLcINTERVAL#1#2%
+ {\withnexttwoXMLRelements
+ {\getXMLarguments{interval}{closure="closed" #1}%
+ \processaction
+ [\XMLpar{interval}{closure}{closed}]
+ [ closed=>{[\firstXMLRelement,\secondXMLRelement]},
+ open-closed=>{(\firstXMLRelement,\secondXMLRelement]},
+ closed-open=>{[\firstXMLRelement,\secondXMLRelement)},
+ open=>{(\firstXMLRelement,\secondXMLRelement)},
+ \s!unknown=>{[\firstXMLRelement,\secondXMLRelement]}]}%
+ #2\empty}
+
+\remapXMLsingular [inverse] [CPA] \MMLcINVERSE
+
+\def\MMLcINVERSE#1#2%
+ {\withnextXMLRelement
+ {\nextXMLRelement\empty^{-1}% \empty kills MMLcfunction lookahead
+ \withnextXMLRelement
+ {\ifx\nextXMLRelement\empty \else
+ \left[\nextXMLRelement\right]%
+ \fi}}}
+
+\remapXMLsingular [sep] [CPA] \MMLcSEP
+
+\def\MMLcSEP#1#2{\MMLcsep} \def\MMLcsep{\,}
+
+\remapXMLsequence [condition] [CPA] \MMLcCONDITION
+
+\def\MMLcCONDITION#1#2%
+ {\pushmacro\MMLcBVAR
+ \doifXMLRchild{bvar}{#2}{\processXMLRchild{bvar}{#2}\mid}%
+ \let\MMLcBVAR\ignoreXMLRelement
+ \processXMLRchildren{#2}%
+ \popmacro\MMLcBVAR}
+
+\remapXMLsequence [declare] [CPA] \MMLcDECLARE
+
+\setupMMLappearance[declare][\c!status=\v!start]
+
+\def\MMLcDECLARE#1#2%
+ {\doif{\@@MMLdeclarestatus}{\v!start}
+ {\withnextXMLRelement
+ {\getXMLentity{declare}\nextXMLRelement
+ \countXMLRchildren{#2}%
+ \ifnum\nofXMLRchildren>1
+ \;% \getXMLentity{ThickSpace}%
+ \getXMLentity{as}%
+ \;% \getXMLentity{ThickSpace}%
+ \fi}%
+ #2\empty}}
+
+\remapXMLsequence [lambda] [CPA] \MMLcLAMBDA
+
+\setupMMLappearance[lambda][\c!variant=b]
+
+\def\MMLcLAMBDA#1#2%
+ {\doifelse{\@@MMLlambdavariant}{a}
+ {\encapsulateXMLR{\getXMLentity{lambda}(}{,}{)}{#2}}
+ {\countXMLRchild{bvar}{#2}%
+ \ifnum\nofXMLRchildren>1
+ \collectXMLRchild{bvar}{#2}%
+ \encapsulateXMLR{\left(}{,}{\right)}{\the\XMLRtoks}%
+ \else
+ \processXMLRchild{bvar}{#2}%
+ \fi
+ \getXMLentity{mapsto}%
+ \processXMLRchild{apply,reln,ci,cn}{#2}}}
+
+\remapXMLsingular [compose] [CPA] \MMLcCOMPOSE
+
+\def\MMLcCOMPOSE#1#2#3\empty
+ {\doifMMLfunctionelse{#3}
+ {\encapsulateXMLR{\left(}{\circ}{\right)}{#3}}
+ {\encapsulateXMLR{}{\circ}{}{#3}}}
+
+\remapXMLsingular [ident] [CPA] \MMLcIDENT
+
+\def\MMLcIDENT#1#2{\getXMLentity{identity}}
+
+\remapXMLsingular [domain] [CPA] \MMLcDOMAIN
+\remapXMLsingular [codomain] [CPA] \MMLcCODOMAIN
+
+\def\MMLcDOMAIN #1#2#3\empty
+ {\getXMLentity{domain}(\MMLcreset\processXMLRchildren{#3})}
+
+\def\MMLcCODOMAIN#1#2#3\empty
+ {\getXMLentity{codomain}(\MMLcreset\processXMLRchildren{#3})}
+
+\remapXMLsingular [image] [CPA] \MMLcIMAGE
+
+\def\MMLcIMAGE#1#2%
+ {\withnextXMLRelement{\getXMLentity{image}(\nextXMLRelement)}}
+
+\remapXMLsequence [domainofapplication] [CPA] \MMLcDOMAINOFAPPLICATION
+
+\def\MMLcDOMAINOFAPPLICATION#1#2{#2}
+
+\remapXMLsequence [piecewise] [CPA] \MMLcPIECEWISE
+\remapXMLsequence [piece] [CPA] \MMLcPIECE
+\remapXMLsequence [otherwise] [CPA] \MMLcOTHERWISE
+
+\def\MMLcPIECEWISE#1#2%
+ {\cases{#2}}
+
+\def\MMLcPIECE#1#2%
+ {\withnexttwoXMLRelements
+ {\@EA\XMLRtoks\@EA{\firstXMLRelement\@col@amp@}%
+ \@EA\appendtoks\@EA\mathematics\@EA{\secondXMLRelement}\to\XMLRtoks
+ \the\XMLRtoks\crcr}%
+ #2}%
+
+\def\MMLcOTHERWISE#1#2%
+ {#2\@col@amp@\mathematics{\getXMLentity{otherwise}}\crcr}
+
+%%% arithmic, algebra and logic
+
+\remapXMLsingular [quotient] [CPA] \MMLcQUOTIENT
+
+\def\MMLcQUOTIENT#1#2%
+ {\withnexttwoXMLRelements{\lfloor\firstXMLRelement/\secondXMLRelement\rfloor}}
+
+\remapXMLsingular [factorial] [CPA] \MMLcFACTORIAL
+
+\def\MMLcFACTORIAL#1#2%
+ {\withnextXMLRelement{\nextXMLRelement !}}
+
+\remapXMLsingular [divide] [CPA] \MMLcDIVIDE
+
+\setupMMLappearance [divide] [\c!niveau=\!!maxcard]
+
+\def\MMLcDIVIDE#1#2%
+ {\withnexttwoXMLRelements
+ {\increment\MMLcDIVIDElevel
+ \ifnum\MMLcDIVIDElevel>\@@MMLdivideniveau\space
+ \firstXMLRelement/\secondXMLRelement
+ \else
+ \frac{\MMLcreset\firstXMLRelement}{\MMLcreset\secondXMLRelement}%
+ \fi
+ \decrement\MMLcDIVIDElevel}}
+
+\remapXMLsingular [min] [CPA] \MMLcMIN
+\remapXMLsingular [max] [CPA] \MMLcMAX
+
+\def\MMLcMIN#1#2#3\empty
+ {\encapsulateXMLR
+ {\min\doifXMLRchild{bvar}{#3}{_{\processXMLRchild{bvar}{#3}}}\left\{}
+ {,}{\right\}}{#3}}
+
+\def\MMLcMAX#1#2#3\empty
+ {\encapsulateXMLR
+ {\max\doifXMLRchild{bvar}{#3}{_{\processXMLRchild{bvar}{#3}}}\left\{}
+ {,}{\right\}}{#3}}
+
+\remapXMLsingular [minus] [CPA] \MMLcMINUS
+\remapXMLsingular [plus] [CPA] \MMLcPLUS
+
+\setupMMLappearance[sign][\c!reductie=\v!ja]
+
+\def\MMLcMINUS
+ {\doifelse{\@@MMLsignreductie}{\v!ja}
+ {\expandafter\MMLcMINUSyes}{\expandafter\MMLcMINUSno}}
+
+\def\MMLcPLUS
+ {\doifelse{\@@MMLsignreductie}{\v!ja}
+ {\expandafter\MMLcPLUSyes}{\expandafter\MMLcPLUSno}}
+
+\def\MMLcMINUSno#1#2#3\empty
+ {\countXMLRchildren{#3}%
+ \encapsulateXMLR{\ifcase\nofXMLRchildren\or-\fi}{-}{}{#3}}
+
+\def\MMLcPLUSno#1#2#3\empty
+ {\countXMLRchildren{#3}%
+ \encapsulateXMLR{\ifcase\nofXMLRchildren\or+\fi}{+}{}{#3}}
+
+\def\MMLcMINUSyes#1#2#3\empty
+ {\setMMLcreset{\MMLcfunctionlist}%
+ \countXMLRchildren{#3}%
+ \encapsulateXMLR{\ifcase\nofXMLRchildren\or-\fi}{-}{}{#3}}
+
+\def\MMLcPLUSyes#1#2#3\empty
+ {\setMMLcreset{plus/,minus/,\MMLcfunctionlist,\MMLcconstructlist}%
+ \encapsulatenextXMLRelements
+ {}
+ {\doifXMLRchildelse{apply}{\nextXMLRelement}%
+ {\collectXMLRchild{apply}{\nextXMLRelement}%
+ \doifXMLRchildelse{minus/}{\the\XMLRtoks}
+ {\countXMLRchildren{\the\XMLRtoks}
+ \ifnum\nofXMLRchildren>2 +\else\fi}{+}}
+ {+}}
+ {}
+ {#3\empty}}
+
+\remapXMLsingular [power] [CPA] \MMLcPOWER
+
+\setupMMLappearance[power][\c!reductie=\v!ja]
+
+\let\MMLpowerelement\empty
+
+\def\MMLcPOWER#1#2%
+ {\withnexttwoXMLRelements
+ {\doifXMLRchildelse{apply}{\firstXMLRelement}
+ {\doifelse{\@@MMLpowerreductie}{\v!ja}
+ {\collectXMLRchild{apply}{\firstXMLRelement}%
+ \@EA\doifXMLRchildelse\@EA{\MMLcfunctionlist}{\the\XMLRtoks}
+ {\let\MMLpowerelement\secondXMLRelement
+ \MMLcreset\firstXMLRelement\empty}
+ {\left(\MMLcreset\firstXMLRelement\empty\right)^{\MMLcreset\secondXMLRelement}}}
+ {\left(\MMLcreset\firstXMLRelement\empty\right)^{\MMLcreset\secondXMLRelement}}}
+ {\firstXMLRelement^{\MMLcreset\secondXMLRelement}}}}
+
+\remapXMLsingular [rem] [CPA] \MMLcREM
+
+\def\MMLcREM#1#2%
+ {\withnexttwoXMLRelements
+ {\firstXMLRelement\getXMLentity{mod}\secondXMLRelement}}
+
+\remapXMLsingular [times] [CPA] \MMLcTIMES
+
+\setupMMLappearance[times][\c!symbool=\v!nee]
+
+\def\MMLcTIMES#1#2#3\empty
+ {\setMMLcreset{\MMLcfunctionlist,\MMLcconstructlist}%
+ \doifelse{\@@MMLtimessymbool}{\v!ja}
+ {\encapsulateXMLR{}{\times}{}{#3\empty}}
+ {\doifelse{\@@MMLtimessymbool}{dot}
+ {\encapsulateXMLR{}{\cdot}{}{#3\empty}}
+ {#3\empty}}}
+
+\remapXMLsingular [root] [CPA] \MMLcROOT
+
+\def\MMLcROOT#1#2#3\empty%
+ {\doifXMLRchildelse{degree}{#3}
+ {\root\processXMLRchild{degree}{#3}\of
+ {\let\MMLcDEGREE\ignoreXMLRelement
+ \MMLcreset\processXMLRchildren{#3}}}
+ {\sqrt{\MMLcreset\processXMLRchildren{#3}}}}
+
+\remapXMLsingular [gcd] [CPA] \MMLcGCD
+
+\def\MMLcGCD#1#2#3\empty{\encapsulateXMLR{\gcd(}{,}{)}{#3}}
+
+\remapXMLsingular [and] [CPA] \MMLcAND
+\remapXMLsingular [or] [CPA] \MMLcOR
+\remapXMLsingular [xor] [CPA] \MMLcXOR
+\remapXMLsingular [implies] [CPA] \MMLcIMPLIES
+
+\def\MMLcAND #1#2#3\empty{\encapsulateXMLR{}{\getXMLentity{and}}{}{#3}}
+\def\MMLcOR #1#2#3\empty{\encapsulateXMLR{}{\getXMLentity{or}}{}{#3}}
+\def\MMLcXOR #1#2#3\empty{\encapsulateXMLR{}{\getXMLentity{xor}}{}{#3}}
+\def\MMLcIMPLIES#1#2#3\empty{\encapsulateXMLR{}{\getXMLentity{implies}}{}{#3}}
+
+\remapXMLsingular [not] [CPA] \MMLcNOT
+
+\def\MMLcNOT#1#2#3\empty{\getXMLentity{not}\processXMLRchildren{#3}}
+
+\remapXMLsingular [forall] [CPA] \MMLcFORALL
+\remapXMLsingular [exists] [CPA] \MMLcEXISTS
+
+\def\MMLcFORALL%
+ {\getXMLentity{forall}%
+ \!% \getXMLentity{NegThinSpace}%
+ \MMLcFORALLandEXISTS}
+
+\def\MMLcEXISTS%
+ {\getXMLentity{exists}%
+ \MMLcFORALLandEXISTS}
+
+\def\MMLcFORALLandEXISTS#1#2#3\empty
+ {\MMLcreset
+ _{\encapsulateXMLRchildren{bvar}{}{,}{}{#3}}%
+ \doifXMLRchildelse{condition}{#3}
+ {\;% \getXMLentity{ThickSpace}%
+ \processXMLRchild{condition}{#3}
+ \doifXMLRchildelse{apply,reln,ci,cn}{#3}
+ {\countXMLRchild{apply,reln,ci,cn}{#3}%
+ \ifcase\nofXMLRchildren\or % == snelle volgende
+ \encapsulateXMLRchildren{apply,reln,ci,cn}
+ {\left\vert}%
+ {}
+ {\right.}
+ {#3\empty}%
+ \else % special case
+ \pushmacro\MMLcCONDITION
+ \let\MMLcCONDITION\gobbletwoarguments
+ \collectbetweenXMLRchild{apply,reln,ci,cn}{\hfill\crcr}{#3}%
+ \left\vert\matrix{\the\XMLRtoks}\right.%
+ \popmacro\MMLcCONDITION
+ \fi}
+ {}}
+ {:\processXMLRchild{apply,reln,ci,cn}{#3\empty}}}
+
+\remapXMLsingular [abs] [CPA] \MMLcABS
+
+\def\MMLcABS#1#2#3\empty
+ {\left\vert\MMLcreset\processXMLRchildren{#3}\right\vert}
+
+\remapXMLsingular [conjugate] [CPA] \MMLcCONJUGATE
+
+\def\MMLcCONJUGATE#1#2#3\empty%
+ {\overline{\MMLcreset\processXMLRchildren{#3}}}
+
+\remapXMLsingular [arg] [CPA] \MMLcARG
+
+\def\MMLcARG#1#2#3\empty
+ {\getXMLentity{arg}(\MMLcreset\processXMLRchildren{#3})}
+
+\remapXMLsingular [real] [CPA] \MMLcREAL
+\remapXMLsingular [imaginary] [CPA] \MMLcIMAGINARY
+
+\def\MMLcREAL#1#2#3\empty
+ {\getXMLentity{real}(\MMLcreset\processXMLRchildren{#3})}
+
+\def\MMLcIMAGINARY#1#2#3\empty
+ {\getXMLentity{imaginary}(\MMLcreset\processXMLRchildren{#3})}
+
+\remapXMLsingular [lcm] [CPA] \MMLcLCM
+
+\def\MMLcLCM#1#2#3\empty
+ {\encapsulateXMLR{\getXMLentity{lcm}(}{,}{)}{#3}}
+
+\remapXMLsingular [floor] [CPA] \MMLcFLOOR
+\remapXMLsingular [ceiling] [CPA] \MMLcCEILING
+
+\def\MMLcFLOOR#1#2#3\empty
+ {\getXMLentity{lfloor}\processXMLRchildren{#3}\getXMLentity{rfloor}}
+
+\def\MMLcCEILING#1#2#3\empty
+ {\getXMLentity{lceiling}\processXMLRchildren{#3}\getXMLentity{rceiling}}
+
+%%% relations
+
+\remapXMLsingular [eq] [CPA] \MMLcEQ
+\remapXMLsingular [neq] [CPA] \MMLcNEQ
+\remapXMLsingular [gt] [CPA] \MMLcGT
+\remapXMLsingular [lt] [CPA] \MMLcLT
+\remapXMLsingular [geq] [CPA] \MMLcGEQ
+\remapXMLsingular [leq] [CPA] \MMLcLEQ
+\remapXMLsingular [equivalent] [CPA] \MMLcEQUIVALENT
+\remapXMLsingular [approx] [CPA] \MMLcAPPROX
+\remapXMLsingular [factorof] [CPA] \MMLcFACTOROF
+
+\setupMMLappearance[relation][\c!uitlijnen=\v!nee]
+
+\def\noMMLcrelation#1#2%
+ {\encapsulatenextXMLRelements{}{#1}{}#2\empty}
+
+\def\lastMMLcrelation#1#2%
+ {\countXMLRchildren{#2}%
+ \rawcollectbetweenXMLR
+ {\advance\nofXMLRchildren -1
+ \ifnum\nofXMLRchildren>1
+ \appendtoks\@col@amp@#1\crcr\to\XMLRtoks
+ \else
+ \appendtoks\@col@amp@#1\to\XMLRtoks
+ \fi}
+ {#2}%
+ \eqalign{\the\XMLRtoks\crcr}}
+
+\def\firstMMLcrelation#1#2%
+ {\nofXMLRchildren=0
+ \rawcollectbetweenXMLR
+ {\advance\nofXMLRchildren 1
+ \ifnum\nofXMLRchildren=1
+ \appendtoks\@col@amp@#1\to\XMLRtoks
+ \else
+ \appendtoks\crcr\@col@amp@#1\to\XMLRtoks
+ \fi}
+ {#2}%
+ \eqalign{\the\XMLRtoks\crcr}}
+
+\def\leftMMLcrelation#1#2%
+ {\collectbetweenXMLR{\@col@amp@#1\crcr}{#2}%
+ \eqalign{\the\XMLRtoks}}
+
+\def\rightMMLcrelation#1#2%
+ {\collectbetweenXMLR{\crcr#1{}\@col@amp@}{#2}% watch the {}
+ \prependtoks\@col@amp@\to\XMLRtoks
+ \eqalign{\the\XMLRtoks\crcr}}
+
+\def\MMLcrelation#1#2\empty
+ {\MMLcreset
+ \processaction
+ [\@@MMLrelationuitlijnen]
+ [\v!laatste=>\let\next\lastMMLcrelation ,
+ \v!eerste=>\let\next\firstMMLcrelation,
+ \v!ja=>\let\next\leftMMLcrelation ,
+ \v!links=>\let\next\leftMMLcrelation ,
+ \v!rechts=>\let\next\rightMMLcrelation,
+ \s!default=>\let\next\noMMLcrelation ,
+ \s!unknown=>\let\next\noMMLcrelation ]
+ \next{#1}{#2}}
+
+\def\MMLcEQ #1#2{\MMLcrelation=}
+\def\MMLcNEQ #1#2{\MMLcrelation\neq}
+\def\MMLcGT #1#2{\MMLcrelation>}
+\def\MMLcLT #1#2{\MMLcrelation<}
+\def\MMLcGEQ #1#2{\MMLcrelation\geq}
+\def\MMLcLEQ #1#2{\MMLcrelation\leq}
+\def\MMLcEQUIVALENT#1#2{\MMLcrelation\equiv}
+\def\MMLcAPPROX #1#2{\MMLcrelation\approx}
+\def\MMLcFACTOROF #1#2{\MMLcrelation\mid}
+
+%%% calculus and vector calculus
+
+\setupMMLappearance[int][\c!plaats=\v!boven]
+
+\remapXMLsingular [int] [CPA] \MMLcINT
+
+\def\doMMLlimits#1%
+ {\doifelsevalue{@@MML#1\c!plaats}{\v!boven}{\limits}{\nolimits}}
+
+\def\MMLcINT#1#2#3\empty
+ {\pushmacro\xmlr
+ \MMLcreset
+ \doifXMLRchildelse{domainofapplication}{#3}
+ {\int\doMMLlimits{int}_{\processXMLRchild{domainofapplication}{#3}}}
+ {\doifXMLRchildelse{condition}{#3}
+ {\int\doMMLlimits{int}_{\processXMLRchild{condition}{#3}}}
+ {\doifXMLRchildelse{lowlimit}{#3}
+ {\int\doMMLlimits{int}
+ _{\processXMLRchild{lowlimit}{#3}}
+ ^{\processXMLRchild {uplimit}{#3}}}
+ {\int}}}%
+ \doifXMLRchildelse{apply}{#3}
+ {\doifMMLfunctionelse{#3}%
+ {\MMLcreset % TEST
+ \processXMLRchild{apply}{#3}}
+ {\left(\MMLcreset % TEST
+ \processXMLRchild{apply}{#3}\right)}}
+ {\MMLcreset % TEST
+ \processXMLRchild{ci}{#3}}%
+ \doifXMLRchild{bvar}{#3}
+ {\,% \getXMLentity{ThinSpace}%
+ {\rm\getXMLentity{mathematicald}}\processXMLRchild{bvar}{#3}}%
+ \popmacro\xmlr}
+
+\remapXMLsingular [diff] [CPA] \MMLcDIFF
+
+\setupMMLappearance[diff][\c!plaats=\v!boven]
+
+\def\MMLcDIFF#1#2#3\empty
+ {\pushmacro\xmlr
+ \MMLcreset
+ \doifXMLRchildelse{bvar}{#3}
+ {\frac
+ {{\rm \getXMLentity{mathematicald}}%
+ \collectXMLRchild{bvar}{#3}%
+ \let\MMLcDEGREE\superMMLcelement
+ \expanded{\processXMLRchild{degree}{\the\XMLRtoks}}%
+ \doif{\@@MMLdiffplaats}{\v!boven}
+ {\doifXMLRchildelse{ci}{#3}
+ {\processXMLRchild{ci}{#3}}
+ {\doifMMLfunctionelse{#3}
+ {\MMLcreset\processXMLRchild{apply}{#3}}
+ {\left(\MMLcreset\processXMLRchild{apply}{#3}\right)}}}}
+ {\let\MMLcDEGREE\superMMLcelement
+ \begingroup\rm\getXMLentity{mathematicald}\endgroup
+ \processXMLRchild{bvar}{#3}}%
+ \doifnot{\@@MMLdiffplaats}{\v!boven}
+ {\left(\MMLcreset\processXMLRchild{apply,ci}{#3}\right)}}
+ {\processXMLRchildren{#3}^\prime}%
+ \popmacro\xmlr}
+
+\remapXMLsingular [partialdiff] [CPA] \MMLcPARTIALDIFF
+
+\def\MMLcBVARpartialdiff#1#2%
+ {\getXMLentity{differentiald}\processXMLRchild{apply,reln,ci,cn}{#2}
+ \doifXMLRchild{degree}{#2}{^{\processXMLRchild{degree}{#2}}}}
+
+\def\MMLcPARTIALDIFF#1#2#3\empty
+ {\pushmacro\xmlr
+ \doifXMLRchildelse{list}{#3}
+ {\getXMLentity{capitaldifferentiald}_{\encapsulateXMLRchild{list}{}{,}{}{#3}}%
+ \processXMLRchild{apply,reln,ci,cn}{#3}}
+ {\countXMLRchild{bvar}{#3}%
+ \ifnum\nofXMLRchildren>0
+ \pushmacro\MMLcDEGREE
+ \pushmacro\MMLcBVAR
+ \frac
+ {\doifXMLRchildelse{degree}{#3}
+ {\collectXMLRchild{degree}{#3}}
+ {\collectXMLRchild{bvar}{#3}%
+ \expanded{\collectXMLRchild{degree}{\the\XMLRtoks}}}%
+ \getXMLentity{differentiald}^{\encapsulateXMLR{}{+}{}{\the\XMLRtoks}}%
+ \let\MMLcDEGREE\gobbletwoarguments
+ \doifMMLfunctionelse{#3}{\MMLcreset}{}%
+ \processXMLRchild{apply,reln,ci,cn}{#3}}
+ {\let\MMLcBVAR\MMLcBVARpartialdiff
+ \processXMLRchild{bvar}{#3}}%
+ \popmacro\MMLcBVAR
+ \popmacro\MMLcDEGREE
+ \else
+ \processXMLRchild{apply,reln,ci,cn}{#3}%
+ \fi}%
+ \popmacro\xmlr}
+
+\def\doifMMLfunctionelse#1#2#3%
+ {\collectXMLRchild{apply}{#1}%
+ \doifXMLRchildelse{fn}{\the\XMLRtoks#1}
+ {#2}
+ {\doifXMLRchildelse{ci}{\the\XMLRtoks#1}
+ {\pushmacro\xmlr
+ \getXMLarguments{dummy}{type=""}%
+ \def\xmlr{\getmmlarguments{dummy}{}}%
+ \the\XMLRtoks % what if more than one ?
+ \popmacro\xmlr
+ \doif{\XMLpar{dummy}{type}{}}{fn}{#2}{#3}}
+ {#2}}}
+
+\def\subMMLcelement #1#2{^{#2}}
+\def\superMMLcelement#1#2{^{#2}}
+
+\remapXMLsequence [lowlimit][CPA] \MMLcLOWLIMIT
+\remapXMLsequence [uplimit] [CPA] \MMLcUPLIMIT
+\remapXMLsequence [bvar] [CPA] \MMLcBVAR
+\remapXMLsequence [degree] [CPA] \MMLcDEGREE
+
+\def\MMLcLOWLIMIT#1#2{#2}
+\def\MMLcUPLIMIT #1#2{#2}
+\def\MMLcBVAR #1#2{#2}
+\def\MMLcDEGREE #1#2{#2}
+
+\remapXMLsingular [divergence] [CPA] \MMLcDIVERGENCE
+\remapXMLsingular [grad] [CPA] \MMLcGRAD
+\remapXMLsingular [curl] [CPA] \MMLcCURL
+\remapXMLsingular [laplacian] [CPA] \MMLcLAPLACIAN
+
+\def\MMLcDIVERGENCE#1#2#3\empty{\getXMLentity{divergence}\processXMLRchildren{#3}}
+\def\MMLcGRAD #1#2#3\empty{\getXMLentity{grad}\processXMLRchildren{#3}}
+\def\MMLcCURL #1#2#3\empty{\getXMLentity{curl}\processXMLRchildren{#3}}
+\def\MMLcLAPLACIAN #1#2#3\empty{\getXMLentity{laplacian}\processXMLRchildren{#3}}
+
+%%% theory of sets
+
+\remapXMLsequence [set] [CPA] \MMLcSET
+
+\def\MMLcSET#1#2%
+ {\doifXMLRchildelse{condition}{#2}
+ {\{\processXMLRchild{bvar}{#2}\,\vert\,\processXMLRchild{condition}{#2}\}}
+ {\encapsulateXMLR{\{}{,}{\}}{#2}}}
+
+\remapXMLsequence [list] [CPA] \MMLcLIST
+
+\def\MMLcLIST#1#2{\encapsulateXMLR{[} {,}{]} {#2}}
+
+\remapXMLsingular [union] [CPA] \MMLcUNION
+\remapXMLsingular [intersect] [CPA] \MMLcINTERSECT
+\remapXMLsingular [in] [CPA] \MMLcIN
+\remapXMLsingular [notin] [CPA] \MMLcNOTIN
+\remapXMLsingular [subset] [CPA] \MMLcSUBSET
+\remapXMLsingular [prsubset] [CPA] \MMLcPRSUBSET
+\remapXMLsingular [notsubset] [CPA] \MMLcNOTSUBSET
+\remapXMLsingular [notprsubset] [CPA] \MMLcNOTPRSUBSET
+\remapXMLsingular [setdiff] [CPA] \MMLcSETDIFF
+
+\def\MMLcset#1{\withnexttwoXMLRelements{\firstXMLRelement#1\secondXMLRelement}}
+
+\def\MMLcUNION #1#2{\MMLcset\cup}
+\def\MMLcINTERSECT #1#2{\MMLcset\cap}
+\def\MMLcIN #1#2{\MMLcset\in}
+\def\MMLcNOTIN #1#2{\MMLcset{\not\in}}
+\def\MMLcSUBSET #1#2{\MMLcset\subset}
+\def\MMLcPRSUBSET #1#2{\MMLcset\subseteq}
+\def\MMLcNOTSUBSET #1#2{\MMLcset{\not\subset}}
+\def\MMLcNOTPRSUBSET #1#2{\MMLcset{\not\subseteq}}
+\def\MMLcSETDIFF #1#2{\MMLcset\setminus}
+
+\remapXMLsingular [card] [CPA] \MMLcCARD
+
+\def\MMLcCARD#1#2#3\empty{\encapsulateXMLR{\vert}{}{\vert}{#3}}
+
+\remapXMLsingular [cartesianproduct] [CPA] \MMLcCARTESIANPRODUCT
+
+\def\MMLcCARTESIANPRODUCT#1#2#3\empty{\encapsulateXMLR{}{\times}{}{#3}}
+
+%%% sequences and series
+
+\remapXMLsingular [sum] [CPA] \MMLcSUM
+\remapXMLsingular [product] [CPA] \MMLcPRODUCT
+
+\def\MMLcSUM {\MMLcSUMandPRODUCT{sum}\sum}
+\def\MMLcPRODUCT{\MMLcSUMandPRODUCT{product}\prod}
+
+\setupMMLappearance[sum][\c!plaats=\v!boven]
+\setupMMLappearance[product][\c!plaats=\v!boven]
+
+\def\stackMMLsubscripts#1%
+ {\vbox
+ {\baselineskip\!!zeropoint % hack, taco vragen
+ \halign{$\scriptstyle\hss##\hss$\cr#1\crcr}}}
+
+\def\MMLcSUMandPRODUCT#1#2#3#4\empty
+ {\pushmacro\xmlr
+ \doifXMLRchildelse{condition,bvar,lowlimit}{#4}
+ {\def\MMLcSUMlow
+ {_{\doifXMLRchildelse{condition}{#4}
+ {\collectXMLRchild{condition}{#4}%
+ \expanded{\collectbetweenXMLR{\crcr}{\the\XMLRtoks}}%
+ \stackMMLsubscripts{\the\XMLRtoks}}
+ {\doifXMLRchild{bvar}{#4}
+ {\processXMLRchild{bvar}{#4}%
+ \doifXMLRchild{lowlimit}{#4}{=}}%
+ \processXMLRchild{lowlimit}{#4}}}}}
+ {\let\MMLcSUMlow\empty}%
+ \doifXMLRchildelse{uplimit}{#4}
+ {\def\MMLcSUMup{^{\processXMLRchild{uplimit}{#4}}}}
+ {\let\MMLcSUMup\empty}%
+ \MMLcreset#2\doMMLlimits{#1}\MMLcSUMup\MMLcSUMlow
+ \MMLcreset
+ \processXMLRchild{apply,ci}{#4}%
+ \popmacro\xmlr}
+
+\remapXMLsingular [limit] [CPA] \MMLcLIMIT
+
+\setupMMLappearance[limit][\c!plaats=\v!boven]
+
+\def\MMLcLIMIT#1#2#3\empty
+ {\pushmacro\xmlr
+ \MMLcreset
+ \lim\doMMLlimits{limit}_
+ {\MMLcreset
+ \doifXMLRchildelse{condition}{#3}
+ {\processXMLRchild{condition}{#3}}
+ {\doifXMLRchild{bvar}{#3}
+ {\processXMLRchild{bvar}{#3}\rightarrow}%
+ \processXMLRchild{lowlimit}{#3}}}%
+ \processXMLRchild{apply}{#3}%
+ \popmacro\xmlr}
+
+\remapXMLsingular [tendsto] [CPA] \MMLcTENDSTO
+
+\def\MMLcTENDSTO#1#2%
+ {\getXMLarguments{tendsto}{type="default" #1}%
+ \withnexttwoXMLRelements
+ {\MMLcreset\firstXMLRelement
+ \processaction
+ [\XMLpar{tendsto}{type}{default}]
+ [ above=>\downarrow,
+ below=>\uparrow,
+ unknown=>\rightarrow]%
+ \MMLcreset\secondXMLRelement}}
+
+%%% elementary classical functions
+
+\remapXMLsingular [exp] [CPA] \MMLcEXP
+
+\def\MMLcEXP#1#2#3\empty
+ {\getXMLentity{exponentiale}^{\MMLcreset#3}}
+
+\remapXMLsingular [ln] [CPA] \MMLcLN
+
+%\def\MMLcLN#1#2#3\empty
+% {\ln\left(\MMLcreset#3\right)}
+
+\def\MMLcLN#1#2%
+ {\doMMLcfunction{ln}}
+
+\remapXMLsingular [log] [CPA] \MMLcLOG
+
+\setupMMLappearance[log][\c!plaats=\v!rechts]
+
+\def\MMLcLOG#1#2#3\empty
+ {\pushmacro\MMLcLOGBASE
+ \let\MMLcLOGBASE\secondoftwoarguments
+ \doifXMLRchildelse{logbase}{#3}
+ {\doifelse{\@@MMLlogplaats}{\v!links}
+ {\mathop{{}^{\processXMLRchild{logbase}{#3}}\!\getXMLentity{log}}}
+ {\getXMLentity{log}_{\processXMLRchild{logbase}{#3}}}}
+ {\getXMLentity{log}}%
+ \let\MMLcLOGBASE\ignoreXMLRelement
+ \nodoMMLcfunction#3\empty
+ \popmacro\MMLcLOGBASE}
+
+\remapXMLsequence [logbase] [CPA] \MMLcLOGBASE
+
+\def\MMLcLOGBASE#1#2{#2}
+
+\remapXMLsingular [sin] [CPA] \MMLcSIN
+\remapXMLsingular [arcsin] [CPA] \MMLcARCSIN
+\remapXMLsingular [sinh] [CPA] \MMLcSINH
+\remapXMLsingular [arcsinh] [CPA] \MMLcARCSINH
+\remapXMLsingular [cos] [CPA] \MMLcCOS
+\remapXMLsingular [arccos] [CPA] \MMLcARCCOS
+\remapXMLsingular [cosh] [CPA] \MMLcCOSH
+\remapXMLsingular [arccosh] [CPA] \MMLcARCCOSH
+\remapXMLsingular [tan] [CPA] \MMLcTAN
+\remapXMLsingular [arctan] [CPA] \MMLcARCTAN
+\remapXMLsingular [tanh] [CPA] \MMLcTANH
+\remapXMLsingular [arctanh] [CPA] \MMLcARCTANH
+\remapXMLsingular [cot] [CPA] \MMLcCOT
+\remapXMLsingular [arccot] [CPA] \MMLcARCCOT
+\remapXMLsingular [coth] [CPA] \MMLcCOTH
+\remapXMLsingular [arccoth] [CPA] \MMLcARCCOTH
+\remapXMLsingular [csc] [CPA] \MMLcCSC
+\remapXMLsingular [arccsc] [CPA] \MMLcARCCSC
+\remapXMLsingular [csch] [CPA] \MMLcCSCH
+\remapXMLsingular [arccsch] [CPA] \MMLcARCCSCH
+\remapXMLsingular [sec] [CPA] \MMLcSEC
+\remapXMLsingular [arcsec] [CPA] \MMLcARCSEC
+\remapXMLsingular [sech] [CPA] \MMLcSECH
+\remapXMLsingular [arcsech] [CPA] \MMLcARCSECH
+
+\setupMMLappearance[function][\c!reductie=\v!ja]
+
+\def\doMMLcfunction#1%
+ {\doifnextcharelse\xmlr{\dodoMMLcfunction{#1}}{\getXMLentity{#1}}}
+
+\def\dodoMMLcfunction#1%
+ {\getXMLentity{#1}%
+ \nodoMMLcfunction}
+
+\def\nodoMMLcfunction#1\empty
+ {\ifx\MMLpowerelement\empty\else
+ ^{\MMLcreset\MMLpowerelement\empty}\!\let\MMLpowerelement\empty
+ \fi
+ \doifelse{\@@MMLfunctionreductie}{\v!ja}
+ {\doifXMLRchildelse{apply}{#1}
+ {\collectXMLRchild{apply}{#1}%
+ \@EA\doifXMLRchildelse\@EA{\MMLcfunctionlist}{\the\XMLRtoks}
+ {\MMLcreset#1\empty}
+ {\left(\MMLcreset#1\empty\right)}}
+ {\MMLcreset#1\empty}}
+ {\left(\MMLcreset#1\empty\right)}}
+
+\def\MMLcSIN #1#2{\doMMLcfunction{sin}}
+\def\MMLcARCSIN #1#2{\doMMLcfunction{arcsin}}
+\def\MMLcSINH #1#2{\doMMLcfunction{sinh}}
+\def\MMLcARCSINH#1#2{\doMMLcfunction{arcsinh}}
+\def\MMLcCOS #1#2{\doMMLcfunction{cos}}
+\def\MMLcARCCOS #1#2{\doMMLcfunction{arccos}}
+\def\MMLcCOSH #1#2{\doMMLcfunction{cosh}}
+\def\MMLcARCCOSH#1#2{\doMMLcfunction{arccosh}}
+\def\MMLcTAN #1#2{\doMMLcfunction{tan}}
+\def\MMLcARCTAN #1#2{\doMMLcfunction{arctan}}
+\def\MMLcTANH #1#2{\doMMLcfunction{tanh}}
+\def\MMLcARCTANH#1#2{\doMMLcfunction{arctanh}}
+\def\MMLcCOT #1#2{\doMMLcfunction{cot}}
+\def\MMLcARCCOT #1#2{\doMMLcfunction{arccot}}
+\def\MMLcCOTH #1#2{\doMMLcfunction{coth}}
+\def\MMLcARCCOTH#1#2{\doMMLcfunction{arccoth}}
+\def\MMLcCSC #1#2{\doMMLcfunction{csc}}
+\def\MMLcARCCSC #1#2{\doMMLcfunction{arccsc}}
+\def\MMLcCSCH #1#2{\doMMLcfunction{csch}}
+\def\MMLcARCCSCH#1#2{\doMMLcfunction{arccsch}}
+\def\MMLcSEC #1#2{\doMMLcfunction{sec}}
+\def\MMLcARCSEC #1#2{\doMMLcfunction{arcsec}}
+\def\MMLcSECH #1#2{\doMMLcfunction{sech}}
+\def\MMLcARCSECH#1#2{\doMMLcfunction{arcsech}}
+
+%%% statistics
+
+\remapXMLsingular [mean] [CPA] \MMLcMEAN
+\remapXMLsingular [sdev] [CPA] \MMLcSDEV
+\remapXMLsingular [variance] [CPA] \MMLcVARIANCE
+\remapXMLsingular [median] [CPA] \MMLcMEDIAN
+\remapXMLsingular [mode] [CPA] \MMLcMODE
+
+\def\MMLcMEAN #1#2{\withnextXMLRelement{\overline{\nextXMLRelement}}}
+\def\MMLcSDEV #1#2{\withnextXMLRelement{\sigma(\MMLcreset\nextXMLRelement)}}
+\def\MMLcVARIANCE#1#2{\withnextXMLRelement{\sigma(\MMLcreset\nextXMLRelement)^2}}
+\def\MMLcMEDIAN #1#2{\withnextXMLRelement{\getXMLentity{median}(\MMLcreset\nextXMLRelement)}}
+\def\MMLcMODE #1#2{\withnextXMLRelement{\getXMLentity{mode}(\MMLcreset\nextXMLRelement)}}
+
+\remapXMLsingular [moment] [CPA] \MMLcMOMENT
+\remapXMLsequence [momentabout] [CPA] \MMLcMOMENTABOUT
+
+\def\MMLcMOMENT#1#2#3\empty
+ {\left\langle\processXMLRchild{apply,reln,ci,cn}{#3}%
+ ^{\processXMLRchild{degree}{#3}}\right\rangle}
+
+\def\MMLcMOMENTABOUT#1#2{}
+
+%%% linear algebra
+
+\remapXMLsequence [vector] [CPA] \MMLcVECTOR
+
+\setupMMLappearance[vector][\c!richting=\v!horizontaal] % \v!vertikaal
+
+\def\MMLcVECTOR#1#2%
+ {\countXMLRchildren{#2}%
+ \ifnum\nofXMLRchildren>1
+ \doifelse{\@@MMLvectorrichting}{\v!horizontaal}
+ {\encapsulateXMLR{\left(}{,}{\right)}{#2}}
+ {\collectbetweenXMLR{\crcr}{#2}%
+ \MMLcreset\left(\matrix{\the\XMLRtoks}\right)}%
+ \else
+ \overrightarrow{#2}%
+ \fi}
+
+\remapXMLsequence [matrix] [CPA] \MMLcMATRIX
+\remapXMLsequence [matrixrow] [CPA] \MMLcMATRIXROW
+
+\unexpanded\def\@col@amp@{&}
+
+\def\doMMLcMATRIX#1#2#3%
+ {\pushmacro\MMLcMATRIXROW
+ \let\MMLcMATRIXROW\normalMMLcMATRIXROW
+ \MMLcreset
+ \ifcase#1\matrix{#3}\else\left(\matrix{#3}\right)\fi
+ \popmacro\MMLcMATRIXROW}
+
+\def\MMLcMATRIX#1#2%
+ {\doMMLcMATRIX1{#1}{#2}}
+
+\def\MMLcMATRIXROW#1#2%
+ {\collectbetweenXMLR{\@col@amp@}{#2}\the\XMLRtoks\crcr}
+
+\let\normalMMLcMATRIXROW\MMLcMATRIXROW
+
+\def\MMLcMATRIXROW#1#2%
+ {\collectbetweenXMLR{\@col@amp@}{#2}%
+ \left(\matrix{\the\XMLRtoks\crcr}\right)}
+
+\remapXMLsingular [determinant] [CPA] \MMLcDETERMINANT
+
+% \def\MMLcDETERMINANT#1#2{\getXMLentity{determinant}} % optie
+
+\def\MMLcDETERMINANT#1#2\empty
+ {\pushmacro\MMLcMATRIX
+ \def\MMLcMATRIX##1##2{\doMMLcMATRIX0{##1}{##2}}%
+ \left|#2\empty\right|%
+ \popmacro\MMLcMATRIX}
+
+\remapXMLsingular [transpose] [CPA] \MMLcTRANSPOSE
+
+\def\MMLcTRANSPOSE#1#2{\withnextXMLRelement{\nextXMLRelement^{\rm T}}}
+
+\remapXMLsingular [selector] [CPA] \MMLcSELECTOR
+
+\def\MMLcSELECTOR#1#2#3\empty
+ {\pushmacro\xmlr
+ \withnextXMLRelement
+ {\mathinner{\nextXMLRelement}% hm, assumes a matrix or so
+ \doMMLcSELECTOR}%
+ #3\empty
+ \popmacro\xmlr}
+
+\def\doMMLcSELECTOR#1\empty
+ {_{\encapsulateXMLR{}{,}{}{#1\empty}}}
+
+\remapXMLsingular [vectorproduct] [CPA] \MMLcVECTORPRODUCT
+\remapXMLsingular [scalarproduct] [CPA] \MMLcSCALARPRODUCT
+\remapXMLsingular [outerproduct] [CPA] \MMLcOUTERPRODUCT
+
+\def\MMLcvector#1%
+ {\withnexttwoXMLRelements{\firstXMLRelement#1\secondXMLRelement}}
+
+\def\MMLcVECTORPRODUCT#1#2{\MMLcvector{\getXMLentity{vectorproduct}}#2}% #2?%
+\def\MMLcSCALARPRODUCT#1#2{\MMLcvector{\getXMLentity{scalarproduct}}#2}
+\def\MMLcOUTERPRODUCT #1#2{\MMLcvector{\getXMLentity{outerproduct}}#2}
+
+%%% semantic mapping elements
+
+\remapXMLsequence [semantics] [CPA] \MMLcSEMANTICS
+
+\def\MMLcSEMANTICS#1#2%
+ {\doifXMLRchildelse{annotation}{#2}
+ {\processXMLRchild{annotation}{#2}}
+ {#2}}
+
+\remapXMLsequence [annotation] [CPA] \MMLcANNOTATION
+
+\def\MMLcANNOTATION#1#2%
+ {\getXMLarguments{annotation}{encoding="" #1}%
+ \doif{\XMLpar{annotation}{encoding}{}}{TeX}%
+ {\begingroup
+ \setnormalXMLentities
+ \let\xmlrent\expandedXMLentity
+ \edef\mmlascii{#2}%
+ \setnormalcatcodes
+ \ifx\mmlascii\empty
+ \donefalse
+ \else
+ \def\do##1##2\end % hack
+ {\edef\!!stringa{\string##1}%
+ \edef\!!stringb{\letterdollar}%
+ \ifx\!!stringa\!!stringb
+ \donetrue
+ \else
+ \donefalse
+ \fi}%
+ \expandafter\do\mmlascii\end
+ \fi
+ \ifdone
+ \hbox{\scantokens\@EA{\mmlascii}}%
+ \else
+ \scantokens\@EA{\mmlascii}%
+ \fi
+ \endgroup}}
+
+\remapXMLsequence [annotation-xml] [CPA] \MMLcANNOTATIONXML
+
+\def\MMLcANNOTATIONXML#1#2{}
+
+%%% constant and symbol elements
+
+\remapXMLsingular [integers] [CPA] \MMLcINTEGERS
+\remapXMLsingular [reals] [CPA] \MMLcREALS
+\remapXMLsingular [rationals] [CPA] \MMLcRATIONALS
+\remapXMLsingular [naturalnumbers] [CPA] \MMLcNATURALNUMBERS
+\remapXMLsingular [complexes] [CPA] \MMLcCOMPLEXES
+\remapXMLsingular [primes] [CPA] \MMLcPRIMES
+\remapXMLsingular [exponentiale] [CPA] \MMLcEXPONENTIALE
+\remapXMLsingular [imaginaryi] [CPA] \MMLcIMAGINARYI
+\remapXMLsingular [notanumber] [CPA] \MMLcNOTANUMBER
+\remapXMLsingular [true] [CPA] \MMLcTRUE
+\remapXMLsingular [false] [CPA] \MMLcFALSE
+\remapXMLsingular [emptyset] [CPA] \MMLcEMPTYSET
+\remapXMLsingular [pi] [CPA] \MMLcPI
+\remapXMLsingular [eulergamma] [CPA] \MMLcEULERGAMMA
+\remapXMLsingular [infinity] [CPA] \MMLcINFINITY
+
+\ifx\blackboard\undefined \let\blackboard\empty \fi
+
+\def\MMLcINTEGERS #1#2{{\blackboard Z}}
+\def\MMLcREALS #1#2{{\blackboard R}}
+\def\MMLcRATIONALS #1#2{{\blackboard Q}}
+\def\MMLcNATURALNUMBERS#1#2{{\blackboard N}}
+\def\MMLcCOMPLEXES #1#2{{\blackboard C}}
+\def\MMLcPRIMES #1#2{{\blackboard P}}
+\def\MMLcEXPONENTIALE #1#2{\getXMLentity{ExponentialE}}
+\def\MMLcIMAGINARYI #1#2{\getXMLentity{ImaginaryI}}
+\def\MMLcNOTANUMBER #1#2{\mathop{\rm NaN}}
+\def\MMLcTRUE #1#2{\mathop{\rm true}}
+\def\MMLcFALSE #1#2{\mathop{\rm false}}
+\def\MMLcEMPTYSET #1#2{\mathop{\hbox{\O}}}
+\def\MMLcPI #1#2{\pi}
+\def\MMLcEULERGAMMA #1#2{\gamma}
+\def\MMLcINFINITY #1#2{\infty}
+
+\protect \endinput
diff --git a/tex/context/base/xtag-mml.tex b/tex/context/base/xtag-mml.tex
new file mode 100644
index 000000000..27d4d10d0
--- /dev/null
+++ b/tex/context/base/xtag-mml.tex
@@ -0,0 +1,513 @@
+%D \module
+%D [ file=xtag-mml,
+%D version=2000.12.20,
+%D title=\CONTEXT\ XML Support,
+%D subtitle=Math ML,
+%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.
+
+\ifx\remapXMLsequence\undefined \input xtag-map.tex \relax \fi % temp hack
+
+\writestatus{loading}{Context XML Macros (math ml)}
+
+% Since I only had the draft of mml 2 as example of
+% rendering, there are probably a lot of omissions and
+% misinterpretations. At least I learned some bits and
+% pieces of math rendering.
+%
+% The main complications were not so much the math, but to
+% find the most efficient way to handle elements without
+% spacing beging messed up. The first implementation was
+% aimed at getting reasonable output, this second
+% implementation is already better in terms of handling
+% nesting, and I will definitely need a third one that has
+% more efficient and less ugly code.
+%
+% The TeX part is not that complicated and once the
+% preprocessor was okay, the rest way just a lot of keying
+% and testing. It all comes down to gobbling, redefining,
+% and not so much to parsing.
+
+\unprotect
+
+\def\setupMMLappearance[#1]%
+ {\dodoubleargument\getparameters[@@MML#1]}
+
+\defineXMLprocessor[context-mathml-directive]{\contextXMLmathml}
+
+\def\contextXMLmathml#1%
+ {\docontextXMLmathml#1 dummy dummy dummy\end}
+
+\def\docontextXMLmathml#1 #2 #3 #4\end
+ {\setupMMLappearance[#1][#2=#3]}
+
+% == \defineXMLdirective [mathml] \setupMMLappearance
+
+\defineXMLargument [math] \doXMLmath
+\defineXMLargument [imath] \doXMLimath
+\defineXMLargument [dmath] \doXMLdmath
+
+\unexpanded\def\doXMLmath {\ifhmode\@EA\doXMLimath\else\@EA\doXMLdmath\fi}
+\unexpanded\def\doXMLimath{\XMLremapdata{$}{$}}
+\unexpanded\def\doXMLdmath{\XMLremapdata{\dostartformula{}}{\dostopformula}}
+
+\defineXMLenvironment [formula]
+ {\dostartXMLformula{formula}\placeformula}
+ {\dostopXMLformula}
+
+\defineXMLenvironment [subformula]
+ {\dostartXMLformula{subformula}\placesubformula}
+ {\dostopXMLformula}
+
+\def\dostartXMLformula#1#2%
+ {\doifXMLparelse{#1}{label}
+ {\expanded{#2[\XMLpar{#1}{label}{}]{\XMLpar{#1}{sublabel}{}}}%
+ \startformula}
+ {\startformula}}
+
+\def\dostopXMLformula%
+ {\stopformula}
+
+\ifx\XMLRtoks\undefined \newtoks\XMLRtoks \fi
+
+\def\convertasciiafter#1#2%
+ {\convertargument#2\to\asciiafter
+ \@EA#1\@EA{\asciiafter}}
+
+\def\checkMMLoperator#1#2% temp hack
+ {\unspaceargument#1\to\ascii
+ \doifXMLentityelse\ascii{\getXMLentity\ascii}{#2}}
+
+% this will be done in a more safe way
+
+\def\MMLtodo#1{\enspace\hbox{\rm#1}\enspace}
+
+% this goes to core-mat
+
+\def\mathortext#1#2{\ifmmode#1\else#2\fi}
+
+\def\normalorfiller #1#2{#1}
+\def\normalordelimiter#1#2{#2}
+
+\def\enabledelimiter {\let\normalordelimiter\secondoftwoarguments}
+\def\disabledelimiter{\let\normalordelimiter\firstoftwoarguments}
+
+\def\enablefiller {\let\normalorfiller\secondoftwoarguments}
+\def\disablefiller {\let\normalorfiller\firstoftwoarguments}
+
+\def\mathopnolimits#1{\mathop{\rm#1}\nolimits}
+
+% Auxiliary macros
+
+\bgroup \obeylines
+
+\gdef\defineMMLentity%
+ {\bgroup\obeylines\xdefineMMLentity}
+
+\gdef\xdefineMMLentity #1 #2 #3 #4
+ {\egroup\dodefineMMLentity{#1}{#2}{#3}{#4}}
+
+\gdef\defineMMLsynonym%
+ {\bgroup\obeylines\xdefineMMLsynonym}
+
+\gdef\xdefineMMLsynonym #1 #2
+ {\egroup\dodefineMMLsynonym{#1}{#2}}
+
+\egroup
+
+% some more
+
+\def\showMMLentity#1%
+ {\bgroup
+ \doifXMLentityelse{#1}
+ {\let\left\empty\let\right\empty\mathematics{\getXMLentity{#1}{}}}
+ {\getXMLentity{unknown}}%
+ \egroup}
+
+\newbox\unknownXMLentity
+\setbox\unknownXMLentity\hbox{\inframed[strut=no,offset=1pt]{\ttx ?}}
+
+\defineXMLentity [unknown] {\copy\unknownXMLentity}
+
+% the definitions
+
+\ifx\blackboard\undefined
+ \def\blackboard{\ifx\Bbb\undefined\else\expandafter\Bbb\fi}
+\fi
+
+% basic entities, greek
+
+\defineXMLentity [alpha] {\mathematics \alpha}
+\defineXMLentity [beta] {\mathematics \beta}
+\defineXMLentity [gamma] {\mathematics \gamma}
+\defineXMLentity [delta] {\mathematics \delta}
+\defineXMLentity [epsilon] {\mathematics \epsilon}
+\defineXMLentity [zeta] {\mathematics \zeta}
+\defineXMLentity [eta] {\mathematics \eta}
+\defineXMLentity [theta] {\mathematics \theta}
+\defineXMLentity [iota] {\mathematics \iota}
+\defineXMLentity [kappa] {\mathematics \kappa}
+\defineXMLentity [lambda] {\mathematics \lambda}
+\defineXMLentity [theta] {\mathematics \theta}
+\defineXMLentity [mu] {\mathematics \mu}
+\defineXMLentity [nu] {\mathematics \nu}
+\defineXMLentity [xi] {\mathematics \xi}
+\defineXMLentity [pi] {\mathematics \pi}
+\defineXMLentity [rho] {\mathematics \rho}
+\defineXMLentity [sigma] {\mathematics \sigma}
+\defineXMLentity [tau] {\mathematics \tau}
+\defineXMLentity [upsilon] {\mathematics \upsilon}
+\defineXMLentity [phi] {\mathematics \phi}
+\defineXMLentity [chi] {\mathematics \chi}
+\defineXMLentity [psi] {\mathematics \psi}
+\defineXMLentity [omega] {\mathematics \omega}
+
+\defineXMLentity [varepsilon] {\mathematics \varepsilon}
+\defineXMLentity [vartheta] {\mathematics \vartheta}
+\defineXMLentity [varpi] {\mathematics \varpi}
+\defineXMLentity [varrho] {\mathematics \varrho}
+\defineXMLentity [varsigma] {\mathematics \varsigma}
+\defineXMLentity [varphi] {\mathematics \varphi}
+
+\defineXMLentity [epsilonv] {\mathematics \varepsilon}
+\defineXMLentity [thetav] {\mathematics \vartheta}
+\defineXMLentity [piv] {\mathematics \varpi}
+\defineXMLentity [rhov] {\mathematics \varrho}
+\defineXMLentity [sigmav] {\mathematics \varsigma}
+\defineXMLentity [phiv] {\mathematics \varphi}
+
+\defineXMLentity [epsi] {\mathematics \epsilon}
+\defineXMLentity [epsiv] {\mathematics \varepsilon}
+
+\defineXMLentity [Alpha] {A}
+\defineXMLentity [Beta] {B}
+\defineXMLentity [Gamma] {\mathematics \Gamma}
+\defineXMLentity [Delta] {\mathematics \Delta}
+\defineXMLentity [Epsilon] {E}
+\defineXMLentity [Zeta] {Z}
+\defineXMLentity [Eta] {N}
+\defineXMLentity [Theta] {\mathematics \Theta}
+\defineXMLentity [Iota] {I}
+\defineXMLentity [Kappa] {K}
+\defineXMLentity [Lambda] {\mathematics \Lambda}
+\defineXMLentity [Mu] {M}
+\defineXMLentity [Nu] {N}
+\defineXMLentity [Xi] {\mathematics \Xi}
+\defineXMLentity [Pi] {\mathematics \Pi}
+\defineXMLentity [Ro] {R}
+\defineXMLentity [Sigma] {\mathematics \Sigma}
+\defineXMLentity [Tau] {T}
+\defineXMLentity [Upsilon] {\mathematics \Upsilon}
+\defineXMLentity [Phi] {\mathematics \Phi}
+\defineXMLentity [Chi] {X}
+\defineXMLentity [Psi] {\mathematics \Psi}
+\defineXMLentity [Omega] {\mathematics \Omega}
+
+% basic entities, hebrew
+
+\defineXMLentity [aleph] {\mathematics \aleph}
+
+% basic entities, functions
+
+\defineXMLentity [abs] {\mathopnolimits{abs}}
+\defineXMLentity [arg] {\mathopnolimits{arg}}
+\defineXMLentity [codomain] {\mathopnolimits{codomain}}
+\defineXMLentity [curl] {\mathopnolimits{curl}}
+\defineXMLentity [determinant] {\mathopnolimits{det}}
+\defineXMLentity [divergence] {\mathopnolimits{div}}
+\defineXMLentity [domain] {\mathopnolimits{domain}}
+\defineXMLentity [false] {\mathopnolimits{false}}
+\defineXMLentity [gcd] {\mathopnolimits{gcd}}
+\defineXMLentity [grad] {\mathopnolimits{grad}}
+\defineXMLentity [identity] {\mathopnolimits{id}}
+\defineXMLentity [image] {\mathopnolimits{image}}
+\defineXMLentity [lcm] {\mathopnolimits{lcm}}
+\defineXMLentity [max] {\mathopnolimits{max}}
+\defineXMLentity [median] {\mathopnolimits{median}}
+\defineXMLentity [min] {\mathopnolimits{min}}
+\defineXMLentity [mode] {\mathopnolimits{mode}}
+\defineXMLentity [mod] {\mathopnolimits{mod}}
+\defineXMLentity [notanumber] {\mathopnolimits{NaN}}
+\defineXMLentity [otherwise] {\mathopnolimits{otherwise}}
+\defineXMLentity [true] {\mathopnolimits{true}}
+\defineXMLentity [declare] {\mathopnolimits{declare}}
+\defineXMLentity [as] {\mathopnolimits{as}}
+\defineXMLentity [polar] {\mathopnolimits{Polar}}
+
+\defineXMLentity [mathematicald] {d}
+
+\defineXMLentity [imaginaryi] {{\rm i}}
+\defineXMLentity [differentiald] {\partial}
+\defineXMLentity [exponentiale] {{\rm e}}
+\defineXMLentity [capitaldifferentiald] {D}
+
+\defineXMLentity [ii] {\getXMLentity{imaginaryi}}
+\defineXMLentity [dd] {\getXMLentity{differentiald}}
+\defineXMLentity [ee] {\getXMLentity{exponentiale}}
+\defineXMLentity [DD] {\getMMLentity{capitaldifferentiald}}
+
+\defineXMLentity [ImaginaryI] {\getXMLentity{imaginaryi}}
+\defineXMLentity [DifferentialD] {\getXMLentity{differentiald}}
+\defineXMLentity [ExponentialE] {\getXMLentity{exponentiale}}
+\defineXMLentity [CapitalDifferentialD] {\getXMLentity{differentiald}}
+
+\defineXMLentity [NaN] {\getXMLentity{notanumber}}
+\defineXMLentity [NotANumber] {\getXMLentity{notanumber}}
+
+\defineXMLentity [and] {\wedge}
+\defineXMLentity [exists] {\exists}
+\defineXMLentity [forall] {\forall}
+\defineXMLentity [implies] {\Rightarrow}
+\defineXMLentity [not] {\neg}
+\defineXMLentity [or] {\vee}
+\defineXMLentity [xor] {\mathopnolimits{xor}}
+
+\defineXMLentity [imaginary] {\Im}
+\defineXMLentity [real] {\Re}
+
+\defineXMLentity [lceiling] {\lceil}
+\defineXMLentity [rceiling] {\rceil}
+
+\defineXMLentity [lfloor] {\lfloor}
+\defineXMLentity [rfloor] {\rfloor}
+
+\defineXMLentity [ne] {\neq}
+\defineXMLentity [neq] {\neq}
+\defineXMLentity [gt] {>}
+\defineXMLentity [lt] {<}
+\defineXMLentity [ge] {\geq}
+\defineXMLentity [geq] {\geq}
+\defineXMLentity [le] {\leq}
+\defineXMLentity [leq] {\leq}
+
+\defineXMLentity [equivalent] {\equiv}
+\defineXMLentity [equiv] {\equiv}
+\defineXMLentity [approx] {\approx}
+
+\defineXMLentity [factorof] {\mid}
+\defineXMLentity [mapsto] {\mapsto}
+
+\defineXMLentity [int] {\int}
+\defineXMLentity [prime] {\prime}
+\defineXMLentity [laplacian] {\nabla^2}
+\defineXMLentity [partial] {\partial}
+
+\defineXMLentity [union] {\cup}
+\defineXMLentity [intersect] {\cap}
+\defineXMLentity [in] {\in}
+\defineXMLentity [notin] {\not\in}
+\defineXMLentity [subset] {\subset}
+\defineXMLentity [prsubset] {\subseteq}
+\defineXMLentity [notsubset] {\not\subset}
+\defineXMLentity [notprsubset] {\not\subseteq}
+\defineXMLentity [setdiff] {\setminus}
+
+\defineXMLentity [card] {\vert}
+\defineXMLentity [cartesianproduct] {\times}
+
+\defineXMLentity [sum] {\sum}
+\defineXMLentity [prod] {\prod}
+\defineXMLentity [product] {\prod}
+\defineXMLentity [lim] {\lim}
+
+\defineXMLentity [exp] {\exp}
+\defineXMLentity [ln] {\ln}
+\defineXMLentity [log] {\log}
+
+\defineXMLentity [sin] {\mathopnolimits{sin}}
+\defineXMLentity [arcsin] {\mathopnolimits{arcsin}}
+\defineXMLentity [sinh] {\mathopnolimits{sinh}}
+\defineXMLentity [arcsinh] {\mathopnolimits{arcsinh}}
+\defineXMLentity [cos] {\mathopnolimits{cos}}
+\defineXMLentity [arccos] {\mathopnolimits{arccos}}
+\defineXMLentity [cosh] {\mathopnolimits{cosh}}
+\defineXMLentity [arccosh] {\mathopnolimits{arccosh}}
+\defineXMLentity [tan] {\mathopnolimits{tan}}
+\defineXMLentity [arctan] {\mathopnolimits{arctan}}
+\defineXMLentity [tanh] {\mathopnolimits{tanh}}
+\defineXMLentity [arctanh] {\mathopnolimits{arctanh}}
+\defineXMLentity [cot] {\mathopnolimits{cot}}
+\defineXMLentity [arccot] {\mathopnolimits{arccot}}
+\defineXMLentity [coth] {\mathopnolimits{coth}}
+\defineXMLentity [arccoth] {\mathopnolimits{arccoth}}
+\defineXMLentity [csc] {\mathopnolimits{csc}}
+\defineXMLentity [arccsc] {\mathopnolimits{arccsc}}
+\defineXMLentity [csch] {\mathopnolimits{csch}}
+\defineXMLentity [arccsch] {\mathopnolimits{arccsch}}
+\defineXMLentity [sec] {\mathopnolimits{sec}}
+\defineXMLentity [arcsec] {\mathopnolimits{arcsec}}
+\defineXMLentity [sech] {\mathopnolimits{sech}}
+\defineXMLentity [arcsech] {\mathopnolimits{arcsech}}
+
+\defineXMLentity [transpose] {^{\rm T}}
+
+\defineXMLentity [plusminus] {\pm}
+\defineXMLentity [minusplus] {\mp}
+
+\defineXMLentity [vectorproduct] {\times}
+\defineXMLentity [scalarproduct] {\cdot}
+\defineXMLentity [outerproduct] {\otimes}
+
+\defineXMLentity [integers] {{\blackboard Z}}
+\defineXMLentity [reals] {{\blackboard R}}
+\defineXMLentity [rationals] {{\blackboard Q}}
+\defineXMLentity [naturalnumbers] {{\blackboard N}}
+\defineXMLentity [complexes] {{\blackboard C}}
+\defineXMLentity [primes] {{\blackboard P}}
+
+\defineXMLentity [emptyset] {\emptyset}
+\defineXMLentity [pi] {\pi}
+\defineXMLentity [eulergamma] {\gamma}
+\defineXMLentity [infinity] {\mathematics{\infty}}
+
+\defineXMLentity [InvisibleTimes] {}
+\defineXMLentity [InvisibleComma] {}
+\defineXMLentity [ApplyFunction] {}
+
+\defineXMLentity [it] {\getXMLentity{InvisibleTines}}
+\defineXMLentity [ic] {\getXMLentity{InvisibleComma}}
+\defineXMLentity [af] {\getXMLentity{ApplyFunction}}
+
+\defineXMLentity [PlusMinus] {\getXMLentity{plusminus}}
+
+\defineXMLentity [infin] {\getXMLentity{infinity}}
+\defineXMLentity [infty] {\getXMLentity{infinity}}
+\defineXMLentity [part] {\getXMLentity{differentiald}}
+
+\defineXMLentity [RightArrow] {\normalorfiller\rightarrow\rightarrowfill}
+\defineXMLentity [LeftArrow] {\normalorfiller\leftarrow\leftarrowfill}
+\defineXMLentity [UnderBrace] {\normalorfiller\empty\upbracefill}
+\defineXMLentity [OverBrace] {\normalorfiller\empty\downbracefill}
+\defineXMLentity [UnderBar] {\normalorfiller\hrule\hrulefill}
+\defineXMLentity [OverBar] {\normalorfiller\hrule\hrulefill}
+\defineXMLentity [Hat] {\normalorfiller\empty\empty} % todo
+
+\defineXMLentity [Tab] {\hskip4em}
+\defineXMLentity [NewLine] {\mathortext\empty\crlf}
+\defineXMLentity [IndentingNewLine] {\mathortext\empty\crlf}
+
+\defineXMLentity [NoBreak] {\nobreak}
+\defineXMLentity [GoodBreak] {\goodbreak}
+\defineXMLentity [BadBreak] {\nobreak}
+
+\defineXMLentity [Space] {\getXMLentity{MediumSpace}}
+\defineXMLentity [NonBreakingSpace] {\getXMLentity{MediumSpace}}
+\defineXMLentity [ZeroWidthSpace] {}
+
+\def\somespaceentity#1#2%
+ {\mathortext
+ {\mskip#1mu}
+ {\unskip\hskip#2em\strut\hskip\!!zeropoint\ignorespaces}\relax}
+
+\defineXMLentity [VeryThinSpace] {\somespaceentity {2}{.125}}
+\defineXMLentity [ThinSpace] {\somespaceentity {3}{.25}}
+\defineXMLentity [MediumSpace] {\somespaceentity {4}{.5}}
+\defineXMLentity [ThickSpace] {\somespaceentity {5}{1}}
+\defineXMLentity [NegativeVeryThinSpace] {\somespaceentity{-2}{-.125}}
+\defineXMLentity [NegativeThinSpace] {\somespaceentity{-3}{-.25}}
+\defineXMLentity [NegativeMediumSpace] {\somespaceentity{-4}{-.5}}
+\defineXMLentity [NegativeThickSpace] {\somespaceentity{-5}{-1}}
+
+\defineXMLentity [NegVeryThinSpace] {\getXMLentity{NegativeVeryThinSpace}}
+\defineXMLentity [NegThinSpace] {\getXMLentity{NegativeThinSpace}}
+\defineXMLentity [NegMediumSpace] {\getXMLentity{NegativeMediumSpace}}
+\defineXMLentity [NegThickSpace] {\getXMLentity{NegativeThickSpace}}
+
+\defineXMLentity [nbsp] {\getXMLentity{NonBreakingSpace}}
+\defineXMLentity [thinsp] {\getXMLentity{ThinSpace}}
+\defineXMLentity [medsp] {\getXMLentity{MediumSpace}}
+\defineXMLentity [thicksp] {\getXMLentity{ThickSpace}}
+
+\defineXMLentity [larr] {\getXMLentity{LeftArrow}}
+\defineXMLentity [rarr] {\getXMLentity{RightArrow}}
+
+\defineXMLentity [lbrace] {\normalordelimiter{\{}{\left \{}}
+\defineXMLentity [rbrace] {\normalordelimiter{\}}{\right\}}}
+\defineXMLentity [lbracket] {\normalordelimiter{[}{\left [}}
+\defineXMLentity [rbracket] {\normalordelimiter{]}{\right]}}
+\defineXMLentity [lparenthesis] {\normalordelimiter{(}{\left (}}
+\defineXMLentity [rparenthesis] {\normalordelimiter{)}{\right)}}
+\defineXMLentity [langle] {\normalordelimiter{\langle}{\left \langle}}
+\defineXMLentity [rangle] {\normalordelimiter{\rangle}{\right\rangle}}
+
+\defineXMLentity [lang] {\getXMLentity{langle}}
+\defineXMLentity [rang] {\getXMLentity{rangle}}
+\defineXMLentity [lbrack] {\getXMLentity{lbracket}}
+\defineXMLentity [rbrack] {\getXMLentity{rbracket}}
+\defineXMLentity [lparent] {\getXMLentity{lparenthesis}}
+\defineXMLentity [rparent] {\getXMLentity{rparenthesis}}
+
+\bgroup
+\catcode`\{=12 \doglobal\convertargument{\to\mmllbrace
+\catcode`\}=12 \doglobal\convertargument}\to\mmlrbrace
+\egroup
+
+\@EA \defineXMLentity \@EA [\mmllbrace] {\getXMLentity{lbrace}}
+\@EA \defineXMLentity \@EA [\mmlrbrace] {\getXMLentity{rbrace}}
+
+\defineXMLentity [{[}] {\getXMLentity{lbracket}}
+\defineXMLentity [{]}] {\getXMLentity{lbracket}}
+\defineXMLentity [{(}] {\getXMLentity{lparenthesis}}
+\defineXMLentity [{)}] {\getXMLentity{rparenthesis}}
+
+\defineXMLentity [times] {\times}
+\defineXMLentity [minus] {-}
+\defineXMLentity [plus] {+}
+\defineXMLentity [plusmn] {\pm}
+
+\defineXMLentity [nabla] {\nabla}
+
+\def\myspecialvert{\mathematics{\vert}} % temp hack, should stretch
+
+\defineXMLentity [+] {+}
+\defineXMLentity [-] {-}
+\defineXMLentity [(] {(}
+\defineXMLentity [)] {)}
+\defineXMLentity [<] {\mathematics{<}}
+\defineXMLentity [>] {\mathematics{>}}
+\defineXMLentity [|] {\myspecialvert}
+\defineXMLentity [/] {/}
+\defineXMLentity [*] {\times}
+\defineXMLentity [=] {=}
+
+\defineXMLentity [++] {++}
+\defineXMLentity [--] {--}
+\defineXMLentity [//] {//}
+\defineXMLentity [**] {\times\times}
+\defineXMLentity [==] {==}
+
+\defineXMLentity [quot] {"}
+
+\defineXMLentity [triangle] {\mathematics\triangle}
+\defineXMLentity [otimes] {\mathematics\otimes}
+\defineXMLentity [oplus] {\mathematics\oplus}
+\defineXMLentity [cup] {\mathematics\cup}
+\defineXMLentity [cap] {\mathematics\cap}
+\defineXMLentity [dot] {\mathematics\cdot}
+\defineXMLentity [sim] {\mathematics\sim}
+\defineXMLentity [circ] {\mathematics\circ}
+\defineXMLentity [dagger] {\mathematics\dagger}
+\defineXMLentity [cdots] {\mathematics\cdots}
+
+\defineXMLentity [...] {\getXMLentity{cdots}}
+\defineXMLentity [continued] {\getXMLentity{cdots}}
+
+\defineXMLentity [sub] {\getXMLentity{subset}}
+\defineXMLentity [sube] {\getXMLentity{prsubset}}
+\defineXMLentity [notprsubset] {\getXMLentity{notprsubset}}
+
+\defineXMLentity [ndash] {\endash}
+\defineXMLentity [mdash] {\emdash}
+
+\defineXMLentity [tex-bar] {\mathematics{\vert}}
+\defineXMLentity [tex-dollar] {\dollar}
+\defineXMLentity [tex-backslash] {\backslash}
+\defineXMLentity [tex-leftbrace] {\mathematics{\{}}
+\defineXMLentity [tex-rightbrace] {\mathematics{\}}}
+
+\protect \endinput
diff --git a/tex/context/base/xtag-mmp.tex b/tex/context/base/xtag-mmp.tex
new file mode 100644
index 000000000..1748e83e6
--- /dev/null
+++ b/tex/context/base/xtag-mmp.tex
@@ -0,0 +1,472 @@
+%D \module
+%D [ file=xtag-mmp,
+%D version=2000.12.20,
+%D title=\CONTEXT\ XML Support,
+%D subtitle=Math ML,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{Context XML Macros (presentational math ml)}
+
+\unprotect
+
+\def\convertasciiafter#1#2%
+ {\convertargument#2\to\asciiafter
+ \@EA#1\@EA{\asciiafter}}
+
+%
+
+\def\checkMMLoperator#1#2% temp hack
+ {\unspaceargument#1\to\ascii
+ \doifXMLentityelse\ascii{\getXMLentity\ascii}{#2}}
+
+\remapXMLsequence [mi] [CPA] \MMLpMI
+\remapXMLsequence [mn] [CPA] \MMLpMN
+\remapXMLsequence [mo] [CPA] \MMLpMO
+
+\def\MMLpmath#1#2%
+ {\begingroup
+ \getXMLarguments{mstyle}{#1}\setMMLpmathstyle{mstyle}#2%
+ \endgroup}
+
+\def\MMLpMI#1#2%
+ {\MMLpmath{#1}{\checkMMLoperator{#2}{#2}}}
+
+\def\MMLpMN#1#2%
+ {\begingroup\rm\MMLpmath{#1}{#2}\endgroup}
+
+\def\MMLpMO#1#2% yes or no
+ {\checkMMLoperator
+ {#2}
+ {\ConvertConstantAfter\doifinstringelse{\xmlrent}{#2}
+ {#2}{\hbox{\MMLpmath{#1}{\ignorespaces#2\unskip}}}}} % \hbox ?
+
+\remapXMLsequence [mfenced] [CPA] \MMLpFENCED
+
+\let\normalright=\right
+\let\normalleft =\left
+
+\def\doMMLleft #1{\pushmacro\left \let\left \empty\normalleft #1\popmacro\left}
+\def\doMMLright#1{\pushmacro\right\let\right\empty\normalright#1\popmacro\right}
+
+\let\MMLpopen \empty
+\let\MMLpclose\empty
+
+\def\MMLpFENCED#1#2%
+ {\getXMLarguments{mfenced}{open="(" close=")" separators="" #1}%
+ \edef\MMLpopen {\XMLpar{mfenced}{open}{}}%
+ \edef\MMLpclose{\XMLpar{mfenced}{close}{}}%
+ \ifx\MMLpopen\empty\else\doMMLleft\MMLpopen\fi
+ \pushmacro\MMLpopen
+ \pushmacro\MMLpclose
+ \doifXMLparelse{mfenced}{separators}
+ {\resetMMLseparator
+ \encapsulateXMLR
+ {}%
+ {\pushmacro\myspecialvert % hack
+ \def\myspecialvert{\;\vrule\;}%
+ \grabMMLseparator{\XMLpar{mfenced}{separators}}%
+ \popmacro\myspecialvert}
+ {}%
+ {#2\empty}}
+ {#2}%
+ \popmacro\MMLpclose
+ \popmacro\MMLpopen
+ \ifx\MMLpclose\empty
+ \ifx\MMLpopen\empty\else\right.\fi
+ \else\doMMLright\MMLpclose\fi}
+
+\def\resetMMLseparator%
+ {\newcounter\MMLxxcounter
+ \let\lastMMLseparator\empty}
+
+\def\grabMMLseparator#1%
+ {\increment\MMLxxcounter
+ \newcounter\MMLyycounter
+ \expanded{\dograbMMLseparator#1\noexpand\relax}}
+
+\def\dograbMMLseparator%
+ {\increment\MMLyycounter
+ \doifnextcharelse\relax
+ {\lastMMLseparator\gobbleoneargument}
+ {\doifnextcharelse\xmlrent\grabMMLseparatora\grabMMLseparatorb}}
+
+\def\grabMMLseparatora#1\xmlrent#2%
+ {\ifnum\MMLxxcounter=\MMLyycounter\space
+ \def\lastMMLseparator{\xmlrent{#2}}%
+ \fi
+ \dograbMMLseparator}
+
+\def\grabMMLseparatorb#1%
+ {\ifnum\MMLxxcounter=\MMLyycounter\space
+ \def\lastMMLseparator{#1}%
+ \fi
+ \dograbMMLseparator}
+
+\remapXMLsequence [menclose] [CPA] \MMLpENCLOSE
+
+\def\MMLpENCLOSE#1#2%
+ {\getXMLarguments{menclose}{notation="" #1}%
+ \doifelse{\XMLpar{menclose}{notation}{}}{longdiv}
+ {\overline{)#2}}
+ {#2}}
+
+\remapXMLsequence [mfrac] [CPA] \MMLpFRAC
+
+\def\MMLpFRAC#1#2% \above is suboptimal since the spacing changes
+ {\withnexttwoXMLRelements
+ {\getXMLarguments{mfrac}{linethickness="" #1}%
+ \doifXMLparelse{mfrac}{linethickness}
+ {\edef\theXMLpar{\XMLpar{mfrac}{linethickness}{1}}%
+ \processaction
+ [\theXMLpar]
+ [ thin=>\scratchdimen=.2pt,
+ medium=>\scratchdimen=.4pt,
+ thick=>\scratchdimen=.8pt,
+ unknown=>\setdimensionwithunit\scratchdimen{\theXMLpar}{}]%
+ {{\firstXMLRelement}\above\scratchdimen{\secondXMLRelement}}}
+ {\frac{\firstXMLRelement}{\secondXMLRelement}}}%
+ #2}
+
+\remapXMLsequence [ms] [CPA] \MMLpSTRING
+
+\def\MMLpSTRING#1#2%
+ {\MMLpTEXT{#1}
+ {\getXMLarguments{mstyle}{#1}%
+ \getXMLarguments{ms}{lquote="\xmlrent{quot}" rquote="\xmlrent{quot}" #1}%
+ \XMLpar{ms}{lquote}{}\ignorespaces#2\unskip\unskip\XMLpar{ms}{rquote}{}}}
+
+\remapXMLsequence [mstyle] [CPA] \MMLpSTYLE
+
+\getXMLarguments
+ {mstyle}
+ {fontweight="" fontstyle="" mathstyle="" background="" color=""}%
+
+\def\MMLpSTYLE#1#2%
+ {\getXMLarguments{mstyle}{#1}#2}
+
+\remapXMLsequence [mtext] [CPA] \MMLpTEXT
+\remapXMLsequence [merror] [CPA] \MMLpERROR
+\remapXMLsequence [mphantom] [CPA] \MMLpPHANTOM
+\remapXMLsequence [mpadded] [CPA] \MMLpPADDED
+
+\def\MMLpTEXT#1#2%
+ {\hbox
+ {\getXMLarguments{mstyle}{#1}%
+ \doMMPpbackground{mstyle}
+ {\doMMPpcolor{mstyle}
+ {\setMMLptextstyle{mstyle}%
+ \ignorespaces#2\unskip\unskip}}}}
+
+\def\setMMLpstyle#1%
+ {\doifdefined{MMLpstyle:#1}{\getvalue{MMLpstyle:#1}}}
+
+\def\defineMMLstyle[#1]#2%
+ {\setvalue{MMLpstyle:#1}{#2}}
+
+\defineMMLstyle[normal] {\tf} \defineMMLstyle[double-stuck] {\bf}
+\defineMMLstyle[bolditalic] {\bi} \defineMMLstyle[bold-italic] {\bi}
+\defineMMLstyle[boldslanted]{\bs} \defineMMLstyle[bold-slanted] {\bs}
+\defineMMLstyle[boldnormal] {\bf} \defineMMLstyle[bold] {\bf}
+\defineMMLstyle[slanted] {\sl} \defineMMLstyle[normalslanted]{\sl}
+\defineMMLstyle[italic] {\it} \defineMMLstyle[normalitalic] {\it}
+\defineMMLstyle[fraktur] {\bf} \defineMMLstyle[bold-fraktur] {\bf}
+\defineMMLstyle[script] {\tf} \defineMMLstyle[bold-script] {\bf}
+
+% and all kind of other crappy names
+
+\def\setMMLptextstyle#1%
+ {\setMMLpstyle{\XMLpar{#1}{fontweight}{}\XMLpar{#1}{fontstyle}{}}}
+
+\def\setMMLpmathstyle#1%
+ {\setMMLpstyle{\XMLpar{#1}{mathvariant}{}}}
+
+\def\doMMPpcolor#1#2%
+ {\doifXMLparelse{#1}{color}{\color[\XMLpar{#1}{color}{}]{#2}}{#2}}
+
+\def\doMMPpbackground#1#2%
+ {\doifXMLparelse{#1}{background}
+ {\inframed
+ [\c!kader=\v!uit,
+ \c!achtergrond=\v!kleur,
+ \c!achtergrondkleur=\XMLpar{#1}{background}{}]
+ {#2}}
+ {#2}}
+
+\def\MMLpERROR #1#2{\hbox{$\displaystyle#2$}}
+\def\MMLpPHANTOM#1#2{\phantom{\ignorespaces{}#2\unskip}} % watch spacing {} hack
+\def\MMLpPADDED #1#2{#2}
+
+\remapXMLsequence [mrow] [CPA] \MMLpROW
+
+\def\MMLpROW#1#2{#2}
+
+\remapXMLsequence [msqrt] [CPA] \MMLpSQRT
+\remapXMLsequence [mroot] [CPA] \MMLpROOT
+
+\def\MMLpSQRT#1#2%
+ {\sqrt{#2}}
+
+\def\MMLpROOT#1#2%
+ {\withnexttwoXMLRelements{\root{\secondXMLRelement}\of{\firstXMLRelement}}#2}
+
+\remapXMLsequence [msup] [CPA] \MMLpSUP
+\remapXMLsequence [msub] [CPA] \MMLpSUB
+
+\setupMMLappearance[scripts][\c!variant=\v!a]
+
+\def\MMLpSUBP#1#2%
+ {\withnexttwoXMLRelements
+ {\doifelse{\@@MMLscriptsvariant}{\v!a}
+ {{\firstXMLRelement}#1{\secondXMLRelement}} % both {} essential
+ {\firstXMLRelement#1{\secondXMLRelement}}}%
+ #2}
+
+\def\MMLpSUP#1{\MMLpSUBP^}
+\def\MMLpSUB#1{\MMLpSUBP_}
+
+\remapXMLsequence [msubsup] [CPA] \MMLpSUBSUP
+
+\def\MMLpSUBSUP#1#2%
+ {\withnextthreeXMLRelements
+ {\firstXMLRelement_{\secondXMLRelement}^{\thirdXMLRelement}}%
+ #2}
+
+\remapXMLsequence [mover] [CPA] \MMLpOVER
+\remapXMLsequence [munder] [CPA] \MMLpUNDER
+\remapXMLsequence [munderover] [CPA] \MMLpUNDEROVER
+
+% hack, cannot be nested
+
+\def\MMLpUNDER#1#2{\withnexttwoXMLRelements\doMMLpUNDER#2}
+\def\MMLpOVER #1#2{\withnexttwoXMLRelements\doMMLpOVER #2}
+
+\def\doMMLfiller#1%
+ {\pushmacro\doMMLfiller
+ \let\doMMLfiller\gobbleoneargument
+ \gdef\dodoMMLfiller{\disablefiller\mathematics{#1}}%
+ \setbox\scratchbox=\hbox
+ {\def\normalorfiller##1##2%
+ {\gdef\dodoMMLfiller{\enablefiller#1}%
+ \let\normalorfiller\gobbletwoarguments}%
+ $#1$}%
+ \popmacro\doMMLfiller
+ \dodoMMLfiller}
+
+\def\doMMLpUNDER%
+ {\mathop{\vtop{\m@th\ialign{\hss##\hss\crcr
+ \disabledelimiter\doMMLfiller\firstXMLRelement
+ \crcr\noalign{\kern3\p@\nointerlineskip}%
+ \disabledelimiter\doMMLfiller\secondXMLRelement
+ \crcr\noalign{\kern3\p@}}}}\limits}
+
+\def\doMMLpOVER%%
+ {\mathop{\vbox{\m@th\ialign{\hss##\hss\crcr\noalign{\kern3\p@}%
+ \disabledelimiter\doMMLfiller\secondXMLRelement
+ \crcr\noalign{\kern3\p@\nointerlineskip}%
+ \disabledelimiter\doMMLfiller\firstXMLRelement
+ \crcr}}}\limits}
+
+\def\MMLpUNDEROVER#1#2%
+ {\withnextthreeXMLRelements
+ {\firstXMLRelement
+ _{\disablefiller\disabledelimiter\secondXMLRelement}%
+ ^{\disablefiller\disabledelimiter\thirdXMLRelement}}#2}
+
+\remapXMLsequence [mtable] [CPA] \MMLpTABLE
+\remapXMLsequence [mtr] [CPA] \MMLpTR
+\remapXMLsequence [mtd] [CPA] \MMLpTD
+\remapXMLsequence [mlabeledtr] [CPA] \MMLpLABELEDTR
+
+\unexpanded\def\@col@amp@{&}
+
+\def\MMLpTR#1#2{\collectbetweenXMLR{\@col@amp@}{#2}\the\XMLRtoks\crcr}
+\def\MMLpTD#1#2{#2}
+
+\def\MMLpLABELEDTR{\MMLpTR}
+
+\def\MMLpTABLEmapper#1#2#3%
+ {\doifXMLparelse{mtable}{#1}
+ {\newcounter\MMLcounter
+ \def\docommando##1%
+ {\increment\MMLcounter
+ \let\MMLpREMAP\doMMLpREMAP
+ \def\MMLsetting{##1}#3% remap list
+ \expanded{\setupTABLE[column][\MMLcounter][#2=\MMLsetting]}}%
+ \expanded{\processseparatedlist[\XMLpar{mtable}{#1}{}][ ]\noexpand\docommando}}
+ {}}
+
+\def\MMLpTABLEmap#1#2#3%
+ {\doifXMLparelse{mtbl}{#1}
+ {\edef\MMLsetting{\XMLpar{mtbl}{#1}{}}#3% remap list
+ \edef\theMMLpTABLEmap{#2=\MMLsetting,\theMMLpTABLEmap}}
+ {}}
+
+\def\doMMLpREMAP#1#2%
+ {\doif{\MMLsetting}{#1}
+ {\def\MMLsetting{#2}%
+ \let\MMLpREMAP\gobbletwoarguments}}
+
+\let\MMLpREMAP\doMMLpREMAP
+
+\def\doMMLpTABLE#1#2%
+ {\begingroup
+ \getXMLarguments{mtable}
+ {columnalign="" columnspacing=".25ex" rowspacing=".25ex"
+ frame="" color="" background="" #1}%
+ \setupTABLE[\c!kader=\v!uit]%
+ \MMLpTABLEmapper{background}{\c!achtergrondkleur}{}%
+ \MMLpTABLEmapper{color}{\c!kleur}{}%
+ \MMLpTABLEmapper{frame}{\c!kader}
+ {\MMLpREMAP{none}{off}\MMLpREMAP{solid}{on}}%
+ \MMLpTABLEmapper{columnalign}{\c!uitlijnen}
+ {\MMLpREMAP{left}{right}%
+ \MMLpREMAP{right}{left}%
+ \MMLpREMAP{center}{middle}}%
+ \setMMLpunit{\XMLpar{mtable}{rowspacing}{}}{.25ex}%
+ \let\MMLpTABLEoffset\MMLpunit
+ \let\MMLpTR\doMMLpTR
+ \let\MMLpTD\doMMLpTD
+ \bTABLE[\c!achtergrond=\v!kleur,\c!offset=\MMLpTABLEoffset]#2\eTABLE
+ \endgroup}
+
+\def\doMMLpTR#1#2%
+ {\doifXMLRchildelse{mtd}{#2}
+ {\bTR\ignorespaces#2\unskip\eTR}
+ {\bTR\doMMLpTD{#1}{#2}\eTR}}
+
+\def\doMMLpTD#1#2%
+ {\getXMLarguments{mtbl}
+ {columnalign="" columnspacing="" rowspacing=""
+ frame="" color="" background="" #1}%
+ \let\theMMLpTABLEmap\empty
+ \MMLpTABLEmap{background}{\c!achtergrondkleur}{}%
+ \MMLpTABLEmap{color}{\c!kleur}{}%
+ \MMLpTABLEmap{frame}{\c!kader}
+ {\MMLpREMAP{none}{off}\MMLpREMAP{solid}{on}}%
+ \MMLpTABLEmap{columnalign}{\c!uitlijnen}
+ {\MMLpREMAP{left}{right}\MMLpREMAP{right}{left}}%
+ \@EA\bTD\@EA[\theMMLpTABLEmap]$\ignorespaces#2\unskip$\eTD}
+
+\setupMMLappearance[mtable][\c!variant=\v!a]
+
+\def\MMLpTABLE%
+ {\doifelse{\@@MMLmtablevariant}{\v!a}
+ {\expandafter\MMLpTABLEa}
+ {\expandafter\MMLpTABLEb}}
+
+\def\MMLpTABLEa#1#2%
+ {\begingroup
+ \doifelsenothing{#1}
+ {\global\setfalse\mmlTABLEargs}
+ {\global\settrue\mmlTABLEargs}%
+ \ifconditional\mmlTABLEargs \else
+ \setbox\scratchbox=\hbox
+ {$\displaystyle
+ \def\MMLpTABLE##1##2%
+ {\ifconditional\mmlTABLEargs \else
+ \doifelsenothing{##1}{##2}{\global\settrue\mmlTABLEargs}%
+ \fi}%
+ \let\MMLpTR\MMLpTABLE
+ \let\MMLpTD\MMLpTABLE
+ #2$}%
+ \fi
+ \ifconditional\mmlTABLEargs
+ \let\MMLpTABLE\doMMLpTABLE
+ \def\next{\MMLpTABLE{#1}}%
+ \else
+ \let\next\matrix
+ \fi
+ \next{#2}%
+ \endgroup}
+
+\let\MMLpTABLEb\doMMLpTABLE
+
+\remapXMLsingular [mspace] [CPA] \MMLpSPACE
+
+\def\setMMLpunit#1#2%
+ {\setbox\scratchbox=\hbox
+ {\edef\ascii{#1}%
+ \@EA\aftersplitstring\ascii\at.\to\ascii
+ \scratchcounter=\ifx\ascii\empty#1\else\ascii\fi
+ \unskip\unskip}%
+ \ifdim\wd\scratchbox=\!!zeropoint
+ \edef\MMLpunit{#1em}%
+ \else
+ \edef\ascii{#1}\convertcommand\ascii\to\ascii
+ \convertasciiafter\doifinstringelse{em}{\ascii}{\edef\MMLpunit{#1}}{%
+ \convertasciiafter\doifinstringelse{ex}{\ascii}{\edef\MMLpunit{#1}}{%
+ \convertasciiafter\doifinstringelse{pt}{\ascii}{\edef\MMLpunit{#1}}{%
+ \edef\MMLpunit{#2}}}}%
+ \fi}
+
+\def\MMLpSPACE#1#2%
+ {\getXMLarguments{mspace}{width=".5em" #1}%
+ \setMMLpunit{\XMLpar{mspace}{width}{}}{.5em}%
+ \hskip\MMLpunit\relax}
+
+
+\remapXMLsingular [mglyph] [CPA] \MMLpGLYPH
+
+\def\MMLpGLYPH#1#2% we assume \definefont usage
+ {\getXMLarguments{mglyph}{fontfamily="" index="1" alt="" #1}%
+ \def\MMLpglyph{\XMLpar{mglyph}{fontfamily}{}}%
+ \doifelsenothing{\MMLpglyph}
+ {\hbox{\tttf[fontfamily unspecified]}}
+ {\doifdefinedelse{\MMLpglyph}
+ {\hbox{\getvalue{\MMLpglyph}\char0\XMLpar{mglyph}{index}{1}}}
+ {\doifelsenothing{\XMLpar{mglyph}{alt}{}}
+ {\hbox{\tttf[unknown fontfamily \XMLpar{mglyph}{fontfamily}{}]}}
+ {\hbox{\tttf\XMLpar{mglyph}{alt}{}}}}}}
+
+\remapXMLsingular [malignmark] [CPA] \MMLpALIGNMARK
+
+\def\MMLpALIGNMARK#1#2%
+ {}
+
+\remapXMLsingular [none] [CPA] \MMLpNONE
+\remapXMLsingular [mprescripts] [CPA] \MMLpMPRESCRIPTS
+\remapXMLsequence [mmultiscripts] [CPA] \MMLpMULTISCRIPTS
+
+\def\MMLpNONE #1#2{}
+\def\MMLpMPRESCRIPTS#1#2{}
+
+\def\MMLpMULTISCRIPTS#1#2%
+ {\pushmacro\xmlr
+ \let\xmlr\pMULTISCRIPTmmlPRE
+ \donefalse \scratchcounter=0 #2\empty
+ \let\xmlr\pMULTISCRIPTmmlPOST
+ \donetrue \scratchcounter=0 #2\empty
+ \popmacro\xmlr}
+
+\def\pMULTISCRIPTmmlPRE#1#2#3#4%
+ {\ifdone
+ \ifodd\scratchcounter
+ ^{\naturalxmlr{#1}{#2}{#3}{#4}}{}%
+ \else
+ _{\naturalxmlr{#1}{#2}{#3}{#4}}%
+ \fi
+ \else
+ \doif{mprescripts/}{#1}{\donetrue{}}% weak, the / here
+ \fi
+ \ifdone \advance\scratchcounter 1 \fi}
+
+\def\pMULTISCRIPTmmlPOST#1#2#3#4%
+ {\ifdone
+ \ifnum\scratchcounter=0
+ \naturalxmlr{#1}{#2}{#3}{#4}%
+ \else\ifodd\scratchcounter
+ _{\naturalxmlr{#1}{#2}{#3}{#4}}%
+ \else
+ ^{\naturalxmlr{#1}{#2}{#3}{#4}}{}%
+ \fi\fi
+ \fi
+ \doif{mprescripts/}{#1}{\donefalse}% weak, the / here
+ \ifdone \advance\scratchcounter 1 \fi}
+
+\protect \endinput
diff --git a/tex/context/base/xtag-mxa.tex b/tex/context/base/xtag-mxa.tex
new file mode 100644
index 000000000..5e83367df
--- /dev/null
+++ b/tex/context/base/xtag-mxa.tex
@@ -0,0 +1,101 @@
+\defineMMLsynonym bkarow rbarr
+\defineMMLsynonym circlearrowleft olarr
+\defineMMLsynonym circlearrowright orarr
+\defineMMLsynonym curvearrowleft cularr
+\defineMMLsynonym curvearrowright curarr
+\defineMMLsynonym dbkarow rBarr
+\defineMMLsynonym DoubleDownArrow dArr
+\defineMMLsynonym DoubleLeftRightArrow hArr
+\defineMMLsynonym DoubleLongLeftArrow xlArr
+\defineMMLsynonym DoubleLongLeftRightArrow xhArr
+\defineMMLsynonym DoubleLongRightArrow xrArr
+\defineMMLsynonym DoubleUpArrow uArr
+\defineMMLsynonym DoubleUpDownArrow vArr
+\defineMMLsynonym Downarrow dArr
+\defineMMLsynonym DownArrowUpArrow duarr
+\defineMMLsynonym downdownarrows ddarr
+\defineMMLsynonym downharpoonleft dharl
+\defineMMLsynonym downharpoonright dharr
+\defineMMLsynonym DownLeftVector lhard
+\defineMMLsynonym DownRightVector rhard
+\defineMMLsynonym drbkarow RBarr
+\defineMMLsynonym Equilibrium rlhar
+\defineMMLsynonym hksearow searhk
+\defineMMLsynonym hkswarow swarhk
+\defineMMLsynonym hookleftarrow larrhk
+\defineMMLsynonym hookrightarrow rarrhk
+\defineMMLsynonym LeftArrowRightArrow lrarr
+\defineMMLsynonym leftarrowtail larrtl
+\defineMMLsynonym LeftDownVector dharl
+\defineMMLsynonym leftharpoondown lhard
+\defineMMLsynonym leftharpoonup lharu
+\defineMMLsynonym leftleftarrows llarr
+\defineMMLsynonym LeftRightArrow harr
+\defineMMLsynonym Leftrightarrow hArr
+\defineMMLsynonym leftrightarrow harr
+\defineMMLsynonym leftrightarrows lrarr
+\defineMMLsynonym leftrightharpoons lrhar
+\defineMMLsynonym leftrightsquigarrow harrw
+\defineMMLsynonym LeftUpVector uharl
+\defineMMLsynonym LeftVector lharu
+\defineMMLsynonym Lleftarrow lAarr
+\defineMMLsynonym LongLeftArrow xlarr
+\defineMMLsynonym Longleftarrow xlArr
+\defineMMLsynonym longleftarrow xlarr
+\defineMMLsynonym LongLeftRightArrow xharr
+\defineMMLsynonym Longleftrightarrow xhArr
+\defineMMLsynonym longleftrightarrow xharr
+\defineMMLsynonym longmapsto xmap
+\defineMMLsynonym LongRightArrow xrarr
+\defineMMLsynonym Longrightarrow xrArr
+\defineMMLsynonym longrightarrow xrarr
+\defineMMLsynonym looparrowleft larrlp
+\defineMMLsynonym looparrowright rarrlp
+\defineMMLsynonym LowerLeftArrow swarr
+\defineMMLsynonym LowerRightArrow searr
+\defineMMLsynonym Lsh lsh
+\defineMMLsynonym mapsto map
+\defineMMLsynonym multimap mumap
+\defineMMLsynonym nearrow nearr
+\defineMMLsynonym nLeftarrow nlArr
+\defineMMLsynonym nleftarrow nlarr
+\defineMMLsynonym nLeftrightarrow nhArr
+\defineMMLsynonym nleftrightarrow nharr
+\defineMMLsynonym nRightarrow nrArr
+\defineMMLsynonym nrightarrow nrarr
+\defineMMLsynonym nwarrow nwarr
+\defineMMLsynonym ReverseEquilibrium lrhar
+\defineMMLsynonym ReverseUpEquilibrium duhar
+\defineMMLsynonym RightArrowLeftArrow rlarr
+\defineMMLsynonym rightarrowtail rarrtl
+\defineMMLsynonym RightDownVector dharr
+\defineMMLsynonym rightharpoondown rhard
+\defineMMLsynonym rightharpoonup rharu
+\defineMMLsynonym rightleftarrows rlarr
+\defineMMLsynonym rightleftharpoons rlhar
+\defineMMLsynonym rightrightarrows rrarr
+\defineMMLsynonym rightsquigarrow rarrw
+\defineMMLsynonym RightTeeArrow map
+\defineMMLsynonym RightUpVector uharr
+\defineMMLsynonym RightVector rharu
+\defineMMLsynonym Rrightarrow rAarr
+\defineMMLsynonym Rsh rsh
+\defineMMLsynonym searrow searr
+\defineMMLsynonym ShortLeftArrow slarr
+\defineMMLsynonym ShortRightArrow srarr
+\defineMMLsynonym swarrow swarr
+\defineMMLsynonym toea nesear
+\defineMMLsynonym tosa seswar
+\defineMMLsynonym twoheadleftarrow Larr
+\defineMMLsynonym twoheadrightarrow Rarr
+\defineMMLsynonym Uparrow uArr
+\defineMMLsynonym UpArrowDownArrow udarr
+\defineMMLsynonym UpDownArrow varr
+\defineMMLsynonym Updownarrow vArr
+\defineMMLsynonym updownarrow varr
+\defineMMLsynonym UpEquilibrium udhar
+\defineMMLsynonym upharpoonleft uharl
+\defineMMLsynonym upharpoonright uharr
+\defineMMLsynonym UpperLeftArrow nwarr
+\defineMMLsynonym UpperRightArrow nearr
+\defineMMLsynonym upuparrows uuarr
diff --git a/tex/context/base/xtag-mxb.tex b/tex/context/base/xtag-mxb.tex
new file mode 100644
index 000000000..c325a9e44
--- /dev/null
+++ b/tex/context/base/xtag-mxb.tex
@@ -0,0 +1,55 @@
+\defineMMLsynonym ast midast
+\defineMMLsynonym Backslash setmn
+\defineMMLsynonym barwedge barwed
+\defineMMLsynonym bigcap xcap
+\defineMMLsynonym bigcirc xcirc
+\defineMMLsynonym bigcup xcup
+\defineMMLsynonym bigodot xodot
+\defineMMLsynonym bigoplus xoplus
+\defineMMLsynonym bigotimes xotime
+\defineMMLsynonym bigsqcup xsqcup
+\defineMMLsynonym bigtriangledown xdtri
+\defineMMLsynonym bigtriangleup xutri
+\defineMMLsynonym biguplus xuplus
+\defineMMLsynonym bigvee xvee
+\defineMMLsynonym bigwedge xwedge
+\defineMMLsynonym boxminus minusb
+\defineMMLsynonym boxplus plusb
+\defineMMLsynonym boxtimes timesb
+\defineMMLsynonym cdot sdot
+\defineMMLsynonym circledast oast
+\defineMMLsynonym circledcirc ocir
+\defineMMLsynonym circleddash odash
+\defineMMLsynonym CircleDot odot
+\defineMMLsynonym CircleMinus ominus
+\defineMMLsynonym CirclePlus oplus
+\defineMMLsynonym CircleTimes otimes
+\defineMMLsynonym Coproduct coprod
+\defineMMLsynonym curlyvee cuvee
+\defineMMLsynonym curlywedge cuwed
+\defineMMLsynonym ddagger Dagger
+\defineMMLsynonym diamond diam
+\defineMMLsynonym divideontimes divonx
+\defineMMLsynonym dotminus minusd
+\defineMMLsynonym dotplus plusdo
+\defineMMLsynonym dotsquare sdotb
+\defineMMLsynonym doublebarwedge Barwed
+\defineMMLsynonym intercal intcal
+\defineMMLsynonym Intersection xcap
+\defineMMLsynonym intprod iprod
+\defineMMLsynonym leftthreetimes lthree
+\defineMMLsynonym oslash osol
+\defineMMLsynonym rightthreetimes rthree
+\defineMMLsynonym setminus setmn
+\defineMMLsynonym smallsetminus ssetmn
+\defineMMLsynonym SquareIntersection sqcap
+\defineMMLsynonym SquareUnion sqcup
+\defineMMLsynonym Star sstarf
+\defineMMLsynonym star sstarf
+\defineMMLsynonym Sum sum
+\defineMMLsynonym Union xcup
+\defineMMLsynonym UnionPlus uplus
+\defineMMLsynonym Vee xvee
+\defineMMLsynonym VerticalTilde wreath
+\defineMMLsynonym Wedge xwedge
+\defineMMLsynonym wr wreath
diff --git a/tex/context/base/xtag-mxc.tex b/tex/context/base/xtag-mxc.tex
new file mode 100644
index 000000000..e692f2a24
--- /dev/null
+++ b/tex/context/base/xtag-mxc.tex
@@ -0,0 +1,10 @@
+\defineMMLsynonym LeftCeiling lceil
+\defineMMLsynonym LeftFloor lfloor
+\defineMMLsynonym llcorner dlcorn
+\defineMMLsynonym lmoustache lmoust
+\defineMMLsynonym lrcorner drcorn
+\defineMMLsynonym RightCeiling rceil
+\defineMMLsynonym RightFloor rfloor
+\defineMMLsynonym rmoustache rmoust
+\defineMMLsynonym ulcorner ulcorn
+\defineMMLsynonym urcorner urcorn
diff --git a/tex/context/base/xtag-mxh.tex b/tex/context/base/xtag-mxh.tex
new file mode 100644
index 000000000..3cf0103c8
--- /dev/null
+++ b/tex/context/base/xtag-mxh.tex
@@ -0,0 +1,67 @@
+\defineMMLsynonym approx ap
+\defineMMLsynonym Because becaus
+\defineMMLsynonym because becaus
+\defineMMLsynonym blacksquare squarf
+\defineMMLsynonym bot bottom
+\defineMMLsynonym circ compfn
+\defineMMLsynonym ClockwiseContourIntegral cwconint
+\defineMMLsynonym Congruent equiv
+\defineMMLsynonym ContourIntegral conint
+\defineMMLsynonym CounterClockwiseContourIntegral awconint
+\defineMMLsynonym Del nabla
+\defineMMLsynonym DoubleContourIntegral Conint
+\defineMMLsynonym DoubleLeftArrow lArr
+\defineMMLsynonym DoubleRightArrow rArr
+\defineMMLsynonym DoubleVerticalBar par
+\defineMMLsynonym DownTee top
+\defineMMLsynonym Element isinv
+\defineMMLsynonym Exists exist
+\defineMMLsynonym ForAll forall
+\defineMMLsynonym geq ge
+\defineMMLsynonym GreaterEqual ge
+\defineMMLsynonym iiiint qint
+\defineMMLsynonym iiint tint
+\defineMMLsynonym Implies rArr
+\defineMMLsynonym in isin
+\defineMMLsynonym Integral int
+\defineMMLsynonym langle lang
+\defineMMLsynonym LeftAngleBracket lang
+\defineMMLsynonym Leftarrow lArr
+\defineMMLsynonym leq le
+\defineMMLsynonym MinusPlus mnplus
+\defineMMLsynonym mp mnplus
+\defineMMLsynonym NotElement notin
+\defineMMLsynonym NotEqual ne
+\defineMMLsynonym NotReverseElement notniva
+\defineMMLsynonym oint conint
+\defineMMLsynonym parallel par
+\defineMMLsynonym PartialD part
+\defineMMLsynonym Proportional prop
+\defineMMLsynonym propto prop
+\defineMMLsynonym rangle rang
+\defineMMLsynonym ReverseElement niv
+\defineMMLsynonym RightAngleBracket rang
+\defineMMLsynonym Rightarrow rArr
+\defineMMLsynonym simeq sime
+\defineMMLsynonym SmallCircle compfn
+\defineMMLsynonym Sqrt radic
+\defineMMLsynonym Subset sub
+\defineMMLsynonym subset sub
+\defineMMLsynonym subseteq sube
+\defineMMLsynonym SubsetEqual sube
+\defineMMLsynonym SuchThat ni
+\defineMMLsynonym Superset sup
+\defineMMLsynonym SupersetEqual supe
+\defineMMLsynonym supset sup
+\defineMMLsynonym supseteq supe
+\defineMMLsynonym Therefore there4
+\defineMMLsynonym therefore there4
+\defineMMLsynonym Tilde sim
+\defineMMLsynonym TildeEqual sime
+\defineMMLsynonym TildeFullEqual cong
+\defineMMLsynonym TildeTilde ap
+\defineMMLsynonym TripleDot tdot
+\defineMMLsynonym UpTee perp
+\defineMMLsynonym vee or
+\defineMMLsynonym Vert Verbar
+\defineMMLsynonym wedge and
diff --git a/tex/context/base/xtag-mxn.tex b/tex/context/base/xtag-mxn.tex
new file mode 100644
index 000000000..35eeade9a
--- /dev/null
+++ b/tex/context/base/xtag-mxn.tex
@@ -0,0 +1,84 @@
+\defineMMLsynonym gnapprox gnap
+\defineMMLsynonym gneq gne
+\defineMMLsynonym gneqq gnE
+\defineMMLsynonym gvertneqq gvnE
+\defineMMLsynonym lnapprox lnap
+\defineMMLsynonym lneq lne
+\defineMMLsynonym lneqq lnE
+\defineMMLsynonym lvertneqq lvnE
+\defineMMLsynonym napprox nap
+\defineMMLsynonym ngeq nge
+\defineMMLsynonym ngeqq ngE
+\defineMMLsynonym ngeqslant nges
+\defineMMLsynonym ngtr ngt
+\defineMMLsynonym nleq nle
+\defineMMLsynonym nleqq nlE
+\defineMMLsynonym nleqslant nles
+\defineMMLsynonym nless nlt
+\defineMMLsynonym NotCongruent nequiv
+\defineMMLsynonym NotDoubleVerticalBar npar
+\defineMMLsynonym NotGreater ngt
+\defineMMLsynonym NotGreaterEqual nge
+\defineMMLsynonym NotGreaterFullEqual ngE
+\defineMMLsynonym NotGreaterGreater nGtv
+\defineMMLsynonym NotGreaterLess ntvgl
+\defineMMLsynonym NotGreaterSlantEqual nges
+\defineMMLsynonym NotGreaterTilde ngsim
+\defineMMLsynonym NotLeftTriangle nltri
+\defineMMLsynonym NotLeftTriangleEqual nltrie
+\defineMMLsynonym NotLess nlt
+\defineMMLsynonym NotLessEqual nle
+\defineMMLsynonym NotLessFullEqual nlE
+\defineMMLsynonym NotLessGreater ntvlg
+\defineMMLsynonym NotLessLess nLtv
+\defineMMLsynonym NotLessSlantEqual nles
+\defineMMLsynonym NotLessTilde nlsim
+\defineMMLsynonym NotPrecedes npr
+\defineMMLsynonym NotPrecedesEqual npre
+\defineMMLsynonym NotPrecedesSlantEqual nprcue
+\defineMMLsynonym NotRightTriangle nrtri
+\defineMMLsynonym NotRightTriangleEqual nrtrie
+\defineMMLsynonym NotSquareSubsetEqual nsqsube
+\defineMMLsynonym NotSquareSupersetEqual nsqsupe
+\defineMMLsynonym NotSubset vnsub
+\defineMMLsynonym NotSucceeds nsc
+\defineMMLsynonym NotSucceedsEqual nsce
+\defineMMLsynonym NotSucceedsSlantEqual nsccue
+\defineMMLsynonym NotSuperset vnsup
+\defineMMLsynonym NotTilde nsim
+\defineMMLsynonym NotTildeEqual nsime
+\defineMMLsynonym NotTildeFullEqual ncong
+\defineMMLsynonym NotTildeTilde nap
+\defineMMLsynonym NotVerticalBar nmid
+\defineMMLsynonym nparallel npar
+\defineMMLsynonym nprec npr
+\defineMMLsynonym npreceq npre
+\defineMMLsynonym nshortmid nsmid
+\defineMMLsynonym nshortparallel nspar
+\defineMMLsynonym nsimeq nsime
+\defineMMLsynonym nsubset vnsub
+\defineMMLsynonym nsubseteq nsube
+\defineMMLsynonym nsubseteqq nsubE
+\defineMMLsynonym nsucc nsc
+\defineMMLsynonym nsucceq nsce
+\defineMMLsynonym nsupset vnsup
+\defineMMLsynonym nsupseteq nsupe
+\defineMMLsynonym nsupseteqq nsupE
+\defineMMLsynonym ntriangleleft nltri
+\defineMMLsynonym ntrianglelefteq nltrie
+\defineMMLsynonym ntriangleright nrtri
+\defineMMLsynonym ntrianglerighteq nrtrie
+\defineMMLsynonym precnapprox prnap
+\defineMMLsynonym precneqq prnE
+\defineMMLsynonym precnsim prnsim
+\defineMMLsynonym subsetneq subne
+\defineMMLsynonym subsetneqq subnE
+\defineMMLsynonym succnapprox scnap
+\defineMMLsynonym succneqq scnE
+\defineMMLsynonym succnsim scnsim
+\defineMMLsynonym supsetneq supne
+\defineMMLsynonym supsetneqq supnE
+\defineMMLsynonym varsubsetneq vsubne
+\defineMMLsynonym varsubsetneqq vsubnE
+\defineMMLsynonym varsupsetneq vsupne
+\defineMMLsynonym varsupsetneqq vsupnE
diff --git a/tex/context/base/xtag-mxo.tex b/tex/context/base/xtag-mxo.tex
new file mode 100644
index 000000000..045b4f406
--- /dev/null
+++ b/tex/context/base/xtag-mxo.tex
@@ -0,0 +1,14 @@
+\defineMMLsynonym angle ang
+\defineMMLsynonym backprime bprime
+\defineMMLsynonym circledS oS
+\defineMMLsynonym complement comp
+\defineMMLsynonym emptyset empty
+\defineMMLsynonym hbar plank
+\defineMMLsynonym hslash plankv
+\defineMMLsynonym Im image
+\defineMMLsynonym measuredangle angmsd
+\defineMMLsynonym nexists nexist
+\defineMMLsynonym NotExists nexist
+\defineMMLsynonym Re real
+\defineMMLsynonym varnothing emptyv
+\defineMMLsynonym wp weierp
diff --git a/tex/context/base/xtag-mxr.tex b/tex/context/base/xtag-mxr.tex
new file mode 100644
index 000000000..ed1498f81
--- /dev/null
+++ b/tex/context/base/xtag-mxr.tex
@@ -0,0 +1,112 @@
+\defineMMLsynonym approxeq ape
+\defineMMLsynonym backcong bcong
+\defineMMLsynonym backepsilon bepsi
+\defineMMLsynonym backsim bsim
+\defineMMLsynonym backsimeq bsime
+\defineMMLsynonym between twixt
+\defineMMLsynonym Bumpeq bump
+\defineMMLsynonym bumpeq bumpe
+\defineMMLsynonym circeq cire
+\defineMMLsynonym coloneq colone
+\defineMMLsynonym Cup smile
+\defineMMLsynonym CupCap asymp
+\defineMMLsynonym curlyeqprec cuepr
+\defineMMLsynonym curlyeqsucc cuesc
+\defineMMLsynonym ddotseq eDDot
+\defineMMLsynonym doteq esdot
+\defineMMLsynonym doteqdot eDot
+\defineMMLsynonym DotEqual esdot
+\defineMMLsynonym DoubleRightTee vDash
+\defineMMLsynonym eqcirc ecir
+\defineMMLsynonym eqcolon ecolon
+\defineMMLsynonym eqsim esim
+\defineMMLsynonym eqslantgtr egs
+\defineMMLsynonym eqslantless els
+\defineMMLsynonym EqualTilde esim
+\defineMMLsynonym fallingdotseq efDot
+\defineMMLsynonym geqq gE
+\defineMMLsynonym geqslant ges
+\defineMMLsynonym gg Gt
+\defineMMLsynonym ggg Gg
+\defineMMLsynonym GreaterEqualLess gel
+\defineMMLsynonym GreaterFullEqual gE
+\defineMMLsynonym GreaterLess gl
+\defineMMLsynonym GreaterSlantEqual ges
+\defineMMLsynonym GreaterTilde gsim
+\defineMMLsynonym gtrapprox gap
+\defineMMLsynonym gtrdot gtdot
+\defineMMLsynonym gtreqless gel
+\defineMMLsynonym gtreqqless gEl
+\defineMMLsynonym gtrless gl
+\defineMMLsynonym gtrsim gsim
+\defineMMLsynonym HumpDownHump bump
+\defineMMLsynonym HumpEqual bumpe
+\defineMMLsynonym LeftTee dashv
+\defineMMLsynonym LeftTriangle vltri
+\defineMMLsynonym LeftTriangleEqual ltrie
+\defineMMLsynonym leqq lE
+\defineMMLsynonym leqslant les
+\defineMMLsynonym lessapprox lap
+\defineMMLsynonym lessdot ltdot
+\defineMMLsynonym lesseqgtr leg
+\defineMMLsynonym lesseqqgtr lEg
+\defineMMLsynonym LessEqualGreater leg
+\defineMMLsynonym LessFullEqual lE
+\defineMMLsynonym LessGreater lg
+\defineMMLsynonym lessgtr lg
+\defineMMLsynonym lesssim lsim
+\defineMMLsynonym LessSlantEqual les
+\defineMMLsynonym LessTilde lsim
+\defineMMLsynonym ll Lt
+\defineMMLsynonym NestedGreaterGreater Gt
+\defineMMLsynonym NestedLessLess Lt
+\defineMMLsynonym pitchfork fork
+\defineMMLsynonym prec pr
+\defineMMLsynonym precapprox prap
+\defineMMLsynonym preccurlyeq prcue
+\defineMMLsynonym Precedes pr
+\defineMMLsynonym PrecedesEqual pre
+\defineMMLsynonym PrecedesSlantEqual prcue
+\defineMMLsynonym PrecedesTilde prsim
+\defineMMLsynonym preceq pre
+\defineMMLsynonym precsim prsim
+\defineMMLsynonym Proportion Colon
+\defineMMLsynonym questeq equest
+\defineMMLsynonym RightTee vdash
+\defineMMLsynonym RightTriangle vrtri
+\defineMMLsynonym RightTriangleEqual rtrie
+\defineMMLsynonym risingdotseq erDot
+\defineMMLsynonym shortmid smid
+\defineMMLsynonym shortparallel spar
+\defineMMLsynonym smallfrown sfrown
+\defineMMLsynonym smallsmile ssmile
+\defineMMLsynonym sqsubset sqsub
+\defineMMLsynonym sqsubseteq sqsube
+\defineMMLsynonym sqsupset sqsup
+\defineMMLsynonym sqsupseteq sqsupe
+\defineMMLsynonym SquareSubset sqsub
+\defineMMLsynonym SquareSubsetEqual sqsube
+\defineMMLsynonym SquareSuperset sqsup
+\defineMMLsynonym SquareSupersetEqual sqsupe
+\defineMMLsynonym Subset Sub
+\defineMMLsynonym subseteqq subE
+\defineMMLsynonym succ sc
+\defineMMLsynonym succapprox scap
+\defineMMLsynonym succcurlyeq sccue
+\defineMMLsynonym Succeeds sc
+\defineMMLsynonym SucceedsEqual sce
+\defineMMLsynonym SucceedsSlantEqual sccue
+\defineMMLsynonym SucceedsTilde scsim
+\defineMMLsynonym succeq sce
+\defineMMLsynonym succsim scsim
+\defineMMLsynonym Supset Sup
+\defineMMLsynonym supseteqq supE
+\defineMMLsynonym thickapprox thkap
+\defineMMLsynonym thicksim thksim
+\defineMMLsynonym trianglelefteq ltrie
+\defineMMLsynonym triangleq trie
+\defineMMLsynonym trianglerighteq rtrie
+\defineMMLsynonym varpropto vprop
+\defineMMLsynonym vartriangleleft vltri
+\defineMMLsynonym vartriangleright vrtri
+\defineMMLsynonym VerticalBar mid
diff --git a/tex/context/base/xtag-run.tex b/tex/context/base/xtag-run.tex
index 234238f4f..8da6ab9e3 100644
--- a/tex/context/base/xtag-run.tex
+++ b/tex/context/base/xtag-run.tex
@@ -1,5 +1,5 @@
%D \module
-%D [ file=xtag-vis,
+%D [ file=xtag-run,
%D version=2001.01.10,
%D title=\CONTEXT\ XML Support,
%D subtitle=Visualization,
diff --git a/tex/context/extra/setup-qr.tex b/tex/context/extra/setup-qr.tex
index a2636b8a0..27dd501a8 100644
--- a/tex/context/extra/setup-qr.tex
+++ b/tex/context/extra/setup-qr.tex
@@ -112,7 +112,7 @@
\startinterface english \strut commands \par \stopinterface
\startinterface german \strut befehle \par \stopinterface
\startinterface czech \strut prikazy \par \stopinterface
- \startinterface italian \strut commands (?) \par \stopinterface
+ \startinterface italian \strut comandi \par \stopinterface
\startinterface romanian \strut comenzile \par \stopinterface
\vfill
\definefont[test][RegularBold at 150pt]\test\setstrut
@@ -138,7 +138,7 @@
\startinterface english \strut commands \par \stopinterface
\startinterface german \strut befehle \par \stopinterface
\startinterface czech \strut prikaz\'y \par \stopinterface
- \startinterface czech \strut commands (?) \par \stopinterface
+ \startinterface italian \strut comandi \par \stopinterface
\startinterface romanian \strut comenzile \par \stopinterface
\vfill
\strut \currentdate \par
@@ -146,7 +146,7 @@
\startinterface english \strut english \par \stopinterface
\startinterface german \strut deutsch \par \stopinterface
\startinterface czech \strut \^cesk\'y \par \stopinterface
- \startinterface italian \strut itialiano (?) \par \stopinterface
+ \startinterface italian \strut italiano \par \stopinterface
\startinterface romanian \strut rom\^{a}n\u{a} \par \stopinterface
\stopopmaak