diff options
Diffstat (limited to 'tex')
190 files changed, 21108 insertions, 12854 deletions
diff --git a/tex/context/base/colo-ini.tex b/tex/context/base/colo-ini.tex index f88d3b094..c23efdf38 100644 --- a/tex/context/base/colo-ini.tex +++ b/tex/context/base/colo-ini.tex @@ -14,6 +14,7 @@ \writestatus{loading}{Context Color Macros} %D To do: stroke versus fill color +%D 1000 100 10 -> constants \unprotect @@ -219,7 +220,10 @@ %D \setvalue{\??cr name}{S:s:a:t} %D \stoptypen -\let\colorlist\empty +\newif\iffreezecolors \freezecolorsfalse + +\let\colorlist \empty +\let\currentspotcolor\empty \def\@@cl@@z{0} \def\@@cl@@o{1} @@ -227,36 +231,168 @@ \def\@@resetcolorparameters {\let\@@cl@@r\@@cl@@z\let\@@cl@@g\@@cl@@z\let\@@cl@@b\@@cl@@z \let\@@cl@@c\@@cl@@z\let\@@cl@@m\@@cl@@z\let\@@cl@@y\@@cl@@z - \let\@@cl@@k\@@cl@@z\let\@@cl@@s\@@cl@@z - \let\@@cl@@t\@@cl@@z\let\@@cl@@a\@@cl@@z} + \let\@@cl@@k\@@cl@@z\let\@@cl@@s\@@cl@@z\let\@@cl@@p\@@cl@@o + \let\@@cl@@t\@@cl@@z\let\@@cl@@a\@@cl@@z\let\@@cl@@n\empty} \def\@@cl@@A{\@@cl@@a} % a hook for symbolic conversion, see below -\def\colorZpattern{S:\@@cl@@z:\@@cl@@A:\@@cl@@t} -\def\colorSpattern{S:\@@cl@@s:\@@cl@@A:\@@cl@@t} -\def\colorCpattern{C:\@@cl@@c:\@@cl@@m:\@@cl@@y:\@@cl@@k:\@@cl@@A:\@@cl@@t} -\def\colorRpattern{R:\@@cl@@r:\@@cl@@g:\@@cl@@b:\@@cl@@A:\@@cl@@t} +%D Handling a few nested \type{\cs}'s is no problem (\type +%D {\@EA\@EAEAEA\@EA}) but we need a full expansion, so I +%D tried one of the fully expandable primitives using a sort +%D of delimited thing. I tried \type {\number} first, but this +%D does not work, but \type {\romannumeral} does. Actually, +%D \type{\romannumeral0} returns nothing, so it's a perfect +%D candidate for this kind of hackery. This reminds me that I +%D have to look into David Karstrup's (check spelling) +%D Euro\TeX\ 2002 article because he is using \type +%D {\romannumeral} for loops (repetitive \quote {m} stuff). + +% \def\x{\y}\def\y{\z}\def\z{0:1:1:1} +% +% \def\bla #1:#2:#3\end{} +% +% \@EA\bla\romannumeral\x\end + +\def\colorXpattern{0S:\@@cl@@z:\@@cl@@z:\@@cl@@z} +\def\colorZpattern{0S:\@@cl@@z:\@@cl@@A:\@@cl@@t} +\def\colorSpattern{0S:\@@cl@@s:\@@cl@@A:\@@cl@@t} +\def\colorCpattern{0C:\@@cl@@c:\@@cl@@m:\@@cl@@y:\@@cl@@k:\@@cl@@A:\@@cl@@t} +\def\colorRpattern{0R:\@@cl@@r:\@@cl@@g:\@@cl@@b:\@@cl@@A:\@@cl@@t} +\def\colorPpattern{0P:\@@cl@@n:\@@cl@@p:\@@cl@@A:\@@cl@@t} -\def\definecolor - {\dodoubleargument\dodefinecolor} +%D The extra 0 catches empty colors specs (needed for the +%D \type {\MPcolor} and \type {\PDFcolor} conversion (\type +%D {\@@cr} equals \type {\relax}!). + +\def\handlecolorwith#1{\@EA#1\romannumeral0} -\def\dodefinecolor[#1][#2]% - {\addtocommalist{#1}\colorlist - \doifassignmentelse{#2} +%D Next comes the main definition macro. + +\def\definecolor {\dodoubleargument\dodefinecolor} +\def\defineglobalcolor{\dodoubleargument\dodefineglobalcolor} +\def\definenamedcolor {\dodoubleargument\dodefinenamedcolor} + +\def\dodefinecolor {\dododefinecolor\relax \setvalue \setevalue1} +\def\dodefineglobalcolor{\dododefinecolor\doglobal\setgvalue\setxvalue1} +\def\dodefinenamedcolor {\dododefinecolor\doglobal\setvalue \setevalue0} + +% keep this for readability +% +% \def\dodefinecolor[#1][#2]% +% {\addtocommalist{#1}\colorlist +% \doifassignmentelse{#2} +% {\@@resetcolorparameters +% \getparameters[\??cl @@][#2]% +% \doifelse{\@@cl@@r\@@cl@@g\@@cl@@b}{\@@cl@@z\@@cl@@z\@@cl@@z} +% {\doifelse{\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k}{\@@cl@@z\@@cl@@z\@@cl@@z\@@cl@@z} +% {\doifelse\@@cl@@s\@@cl@@z +% {\showmessage\m!colors8{{[#2]},#1}% +% \setevalue{\??cr#1}{\colorZpattern}} +% {\setevalue{\??cr#1}{\colorSpattern}}} +% {\setevalue{\??cr#1}{\colorCpattern}}} +% {\setevalue{\??cr#1}{\colorRpattern}}} +% {\doifdefinedelse{\??cr#2} +% {\doifelse{#1}{#2} +% {% this way we can freeze \definecolor[somecolor][somecolor] +% % and still prevent cyclic definitions +% \iffreezecolors\setevalue{\??cr#1}{\getvalue{\??cr#2}}\fi} +% {\iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi +% {\??cr#1}{\getvalue{\??cr#2}}}} +% {\showmessage\m!colors3{#1}}}% +% \unexpanded\setvalue{#1}{\color[#1]}} % \unexpanded toegevoegd + +\def\dododefinecolor#1#2#3#4[#5][#6]% #2==set(g)value #3==set[e|x]value + {#1\addtocommalist{#5}\colorlist + \doifassignmentelse{#6} {\@@resetcolorparameters - \getparameters[\??cl @@][#2]% + \getparameters[\??cl @@][#6]% \doifelse{\@@cl@@r\@@cl@@g\@@cl@@b}{\@@cl@@z\@@cl@@z\@@cl@@z} {\doifelse{\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k}{\@@cl@@z\@@cl@@z\@@cl@@z\@@cl@@z} - {\doifelse{\@@cl@@s}{\@@cl@@z} - {\showmessage{\m!colors}{8}{{[#2]},#1}% - \setevalue{\??cr#1}{\colorZpattern}} - {\setevalue{\??cr#1}{\colorSpattern}}} - {\setevalue{\??cr#1}{\colorCpattern}}} - {\setevalue{\??cr#1}{\colorRpattern}}} - {\doifdefinedelse{\??cr#2} - {\setevalue{\??cr#1}{\getvalue{\??cr#2}}} - {\showmessage{\m!colors}{3}{#1}}}% - \unexpanded\setvalue{#1}{\color[#1]}} % \unexpanded toegevoegd + {\doifelse\@@cl@@s\@@cl@@z + {\showmessage\m!colors8{{[#6]},#5}% + #3{\??cr#5}{\colorZpattern}} + {#3{\??cr#5}{\colorSpattern}}} + {#3{\??cr#5}{\colorCpattern}}} + {#3{\??cr#5}{\colorRpattern}}} + {\doifdefinedelse{\??cr#6} + {\doifelse{#5}{#6} + {% this way we can freeze \definecolor[somecolor][somecolor] + % and still prevent cyclic definitions + \iffreezecolors#3{\??cr#5}{\getvalue{\??cr#6}}\fi} + {\iffreezecolors\@EA#3\else\@EA#2\fi + {\??cr#5}{\getvalue{\??cr#6}}}} + {\showmessage\m!colors3{#5}}}% + \ifcase#4\or + \unexpanded#2{#5}{\switchtocolor[#5]}% \unexpanded toegevoegd + \fi} + +%D New and experimental. + +\let\allspotcolors\empty + +\def\definespotcolor % [name] [color] [p=,t=,a=] + {\dotripleempty\dodefinespotcolor} + +\def\dodefinespotcolor[#1][#2][#3]% + {\doifnot{#1}{#2} + {\@@resetcolorparameters + \edef\@@cl@@n{#2}% + \getparameters[\??cl @@][#3]% + \doifnothing\@@cl@@p{\let\@@cl@@p\!!plusone}% + \doglobal\addtocommalist{#2}\allspotcolors + \setevalue{\??cr#1}{\colorPpattern}% + \setvalue{#1}{\switchtocolor[#1]}}} + +\let\usedspotcolors\empty + +\def\registerusedspotcolors + {\ifx\allspotcolors\empty \else + \bgroup + \let\usedspotcolors\empty + \def\docommando##1% + {\doifdefined{\??cs##1}{\addtocommalist{##1}\usedspotcolors}}% + \processcommacommand[\allspotcolors]\docommando + \savecurrentvalue\usedspotcolors\usedspotcolors + \egroup + \fi} + +\let\usedcolorchannels\empty + +\def\registerusedcolorchannels + {\bgroup + \doifdefinedelse{\??cs c} + {\def\usedcolorchannels{c,m,y,k}}% + {\let\usedcolorchannels\empty}% + \doifdefined{\??cs r} + {\addtocommalist{r,g,b}\usedcolorchannels}% + \doifdefined{\??cs s} + {\ExpandBothAfter\doifnotinset{k}\usedcolorchannels + {\addtocommalist{s}\usedcolorchannels}}% + \savecurrentvalue\usedcolorchannels\usedcolorchannels + \egroup} + +\prependtoks + \registerusedspotcolors + \registerusedcolorchannels +\to \everylastshipout + +\def\registerusedspotcolor#1% + {\global\@EA\chardef\csname\??cs#1\endcsname\zerocount} + +%D We now redefine the color definition macro so that you +%D can define both normal and spotcolors. + +\def\definecolor + {\dotripleempty\dodefinewhatevercolor} + +\def\dodefinewhatevercolor[#1][#2][#3]% + {\ifthirdargument + \doifassignmentelse{#2} + {\dododefinecolor[#1][#2,#3]}% actually this is an error + {\dodefinespotcolor[#1][#2][#3]}% + \else + \dodefinecolor[#1][#2]% + \fi} %D The names of colors are stored in a comma separated list %D only for the purpose of showing them with \type {\showcolor}. @@ -264,8 +400,24 @@ %D \typebuffer %D \haalbuffer %D -%D This color shows up as \color[SomeKindOfRed]{some kind +%D This color shows up as \color [SomeKindOfRed] {some kind %D of red}. +%D +%D \starttypen +%D \setupcolors[state=start] +%D +%D \definecolor[mygreen][green] +%D \definecolor[green][g=.5] +%D +%D \startcolor[mygreen]test\stopcolor +%D +%D \setupcolors[expansion=no] +%D +%D \definecolor[mygreen][green] +%D \definecolor[green][g=.5] +%D +%D \startcolor[mygreen]test\stopcolor +%D \stoptypen %D \macros %D {setupcolor} @@ -290,11 +442,11 @@ \let\colorstyle\empty -\def\setupcolor% +\def\setupcolor {\dosingleargument\dosetupcolor} \def\dosetupcolor[#1]% - {\doifnot{#1}{\colorstyle} + {\doifnot{#1}\colorstyle {\def\colorstyle{#1}% \processcommalist[#1]\dodosetupcolor}} @@ -327,6 +479,7 @@ \newif\ifRGBsupported \newif\ifCMYKsupported +\newif\ifSPOTsupported \newif\ifpreferGRAY \newif\ifGRAYprefered \newif\ifreduceCMYK @@ -381,9 +534,9 @@ \def\dowithcolor#1#2% #1=\action #2=color {\ifincolor\ifpermitcolormode \ifcsname\??cr\currentpalet#2\endcsname - \@EAEAEA#1\csname\??cr\currentpalet#2\endcsname\od + \handlecolorwith#1\csname\??cr\currentpalet#2\endcsname\od \else\ifcsname\??cr#2\endcsname - \@EAEAEA#1\csname\??cr#2\endcsname\od + \handlecolorwith#1\csname\??cr#2\endcsname\od \fi\fi \fi\fi} @@ -395,22 +548,33 @@ {\ifincolor\ifpermitcolormode \@EA\ifx\csname\??cr\currentpalet#2\endcsname\relax \@EA\ifx\csname\??cr#2\endcsname\relax \else - \@EAEAEA#1\csname\??cr#2\endcsname\od + \handlecolorwith#1\csname\??cr#2\endcsname\od \fi \else - \@EAEAEA#1\csname\??cr\currentpalet#2\endcsname\od + \handlecolorwith#1\csname\??cr\currentpalet#2\endcsname\od \fi \fi\fi} \endTEX \def\startcolormode % includes \ifincolor\ifpermitcolormode - {\dowithcolor\execcolorRCS} + {%\dostoptransparency % needed for: {test \trans test \notrans test} + \conditionalstoptransparency + \dowithcolor\execcolorRCSP} \def\stopcolormode {\ifincolor\ifpermitcolormode + \dostoptransparency + \dostopcolormode + \fi\fi} + +\def\restorecolormode + {\ifincolor\ifpermitcolormode \dostoptransparency \dostopcolormode + \ifx\maintextcolor\empty \else + \startcolormode\maintextcolor + \fi \fi\fi} %D Color modes are entered using the next set of commands. @@ -420,54 +584,277 @@ %D The, for this module redundant, check if we are in color %D mode is needed when we use these macros in other modules. -\def\execcolorRCS#1:% +\chardef\currentcolorchannel=0 + +\newif\iffilterspotcolor \filterspotcolorfalse +\newif\ifdoingspotcolor \doingspotcolorfalse + +\def\registercolorchannel#1% + {\ifdoingspotcolor \else + \global\expandafter\chardef\csname\??cs#1\endcsname\zerocount + \fi} + +\def\execcolorRCSP#1:% {\csname execcolor#1\endcsname} -\def\execcolorR#1:#2:#3:% +\def\execcolorR + {\iffilterspotcolor + \@EA\noexeccolor + \else + \@EA\doexeccolorR + \fi} + +\def\execcolorC + {\iffilterspotcolor + \@EA\noexeccolor + \else + \@EA\doexeccolorC + \fi} + +\def\execcolorS + {\iffilterspotcolor + \@EA\noexeccolorS + \else + \@EA\doexeccolorS + \fi} + +\def\execcolorP + {\iffilterspotcolor + \@EA\doexeccolorPP + \else\ifcase\currentcolorchannel + \@EAEAEA\doexeccolorP + \else + \@EAEAEA\noexeccolorP + \fi\fi} + +\def\doexeccolorR#1:#2:#3:% {\edef\@@cl@@r{#1}\edef\@@cl@@g{#2}\edef\@@cl@@b{#3}% \ifpreferGRAY\ifx\@@cl@@r\@@cr@@g\ifx\@@cl@@r\@@cl@@b \GRAYpreferedtrue \fi\fi\fi \ifincolor\else\RGBsupportedfalse\CMYKsupportedfalse\fi \ifGRAYprefered - \dostartgraycolormode\@@cl@@r + \registercolorchannel\c!s + \let\@@cl@@s\@@cl@@r + \normalizeGRAY + \doexeccolorgray \else\ifRGBsupported - \dostartrgbcolormode\@@cl@@r\@@cl@@g\@@cl@@b + \registercolorchannel\c!r + \normalizeRGB + \doexeccolorrgb \else\ifCMYKsupported + \registercolorchannel\c!c \convertRGBtoCMYK\@@cl@@r\@@cl@@g\@@cl@@b - \dostartcmykcolormode\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k +\normalizeCMYK + \doexeccolorcmyk \else + \registercolorchannel\c!s \convertRGBtoGRAY\@@cl@@r\@@cl@@g\@@cl@@b - \dostartgraycolormode\@@cl@@s +\normalizeGRAY + \doexeccolorgray \fi\fi\fi \exectransparency} - -\def\execcolorC#1:#2:#3:#4:% + +\def\doexeccolorC#1:#2:#3:#4:% {\edef\@@cl@@c{#1}\edef\@@cl@@m{#2}\edef\@@cl@@y{#3}\edef\@@cl@@k{#4}% \ifpreferGRAY\ifx\@@cl@@k\@@cl@@z\ifx\@@cl@@c\@@cr@@m\ifx\@@cl@@c\@@cl@@y \GRAYpreferedtrue \fi\fi\fi\fi \ifincolor\else\RGBsupportedfalse\CMYKsupportedfalse\fi \ifGRAYprefered - \dostartgraycolormode\@@cl@@c + \registercolorchannel\c!s + \let\@@cl@@s\@@cl@@c + \normalizeGRAY + \doexeccolorgray \else\ifCMYKsupported + \registercolorchannel\c!c \ifreduceCMYK \convertCMYKtoCMY\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k - \fi - \dostartcmykcolormode\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k +% \else +% \normalizeCMYK +% \fi +\fi +\normalizeCMYK + \doexeccolorcmyk \else\ifRGBsupported + \registercolorchannel\c!r \convertCMYKtoRGB\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k - \dostartrgbcolormode\@@cl@@r\@@cl@@g\@@cl@@b +\normalizeRGB + \doexeccolorrgb \else + \registercolorchannel\c!s \convertCMYKtoGRAY\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k - \dostartgraycolormode\@@cl@@s +\normalizeGRAY + \doexeccolorgray \fi\fi\fi \exectransparency} - -\def\execcolorS#1:% - {\dostartgraycolormode{#1}% + +\def\doexeccolorS#1:% + {\edef\@@cl@@s{#1}% + \registercolorchannel\c!s + \normalizeGRAY + \doexeccolorgray \exectransparency} +\def\doexeccolorP#1:#2:% + {\edef\@@cl@@n{#1}% + \edef\@@cl@@p{#2}% + \registerusedspotcolor\@@cl@@n + \ifSPOTsupported + \dowithcolor\registerspotcolor\@@cl@@n + \dostartspotcolormode\@@cl@@n\@@cl@@p + \else + \doingspotcolortrue + \let\spotcolorfactor\@@cl@@p + \factorizecolortrue % using counter and array + \dowithcolor\execcolorRCSP\@@cl@@n + \factorizecolorfalse +\let\spotcolorfactor\@@cl@@o + \doingspotcolorfalse + \fi + \exectransparency} + +\def\doexeccolorPP#1:#2:% + {\edef\@@cl@@n{#1}% + \edef\@@cl@@p{#2}% + \registerusedspotcolor\@@cl@@n + \ifx\@@cl@@n\currentspotcolor + \normalizeSPOT + \dostartgraycolormode\@@cl@@p % was spotcolormode + \else + \dostartgraycolormode\@@cl@@o + \fi + \exectransparency} + +\def\doexeccolorrgb + {\ifcase\currentcolorchannel + \dostartrgbcolormode\@@cl@@r\@@cl@@g\@@cl@@b + \or \or \or \or + \or \dostartgraycolormode\@@cl@@r + \or \dostartgraycolormode\@@cl@@g + \or \dostartgraycolormode\@@cl@@b + \fi} + +\def\doexeccolorcmyk + {\ifcase\currentcolorchannel + \dostartcmykcolormode\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k + \or \negatecolorcomponent\@@cl@@c\dostartgraycolormode\@@cl@@c + \or \negatecolorcomponent\@@cl@@m\dostartgraycolormode\@@cl@@m + \or \negatecolorcomponent\@@cl@@y\dostartgraycolormode\@@cl@@y + \or \negatecolorcomponent\@@cl@@k\dostartgraycolormode\@@cl@@k + \fi} + +\def\doexeccolorgray + {\ifcase\currentcolorchannel + \dostartgraycolormode\@@cl@@s + \or \or \or + \or \dostartgraycolormode\@@cl@@s + \or \or \or + \or \dostartgraycolormode\@@cl@@s + \fi} + +%D When filtering colors, we need to either erase +%D the background, or ignore the foreground. + +\newif\ifhidesplitcolor \hidesplitcolortrue + +\def\noexeccolor#1\od + {\dostartgraycolormode\@@cl@@o} + +\let\noexeccolorS\noexeccolor +\let\noexeccolorP\noexeccolor + +%D For the sake of postprocessing (i.e.\ color separation) +%D we can normalize colors, which comes down to giving equal +%D values an equal accuracy and format. This feature is +%D turned off by default due to a speed penalty. This macro +%D also handles spot color precentages. + +\newif\iffactorizecolor +\newif\ifnormalizecolor + +\def\spotcolorfactor{1} + +\def\normalizecolor#1% + {\colordimen#1\thousandpoint + \colordimen\spotcolorfactor\colordimen + \colorcount\colordimen + \advance\colorcount \medcard + \divide\colorcount \maxcard + \edef#1{\realcolorvalue\colorcount}} + +\def\normalizespotcolor#1% + {\colordimen-#1\thousandpoint + \advance\colordimen\thousandpoint + \colorcount\colordimen + \advance\colorcount \medcard + \divide\colorcount \maxcard + \edef#1{\realcolorvalue\colorcount}} + +\def\donormalizeRGB + {\normalizecolor\@@cl@@r + \normalizecolor\@@cl@@g + \normalizecolor\@@cl@@b} + +\def\normalizeRGB + {\ifnormalizecolor + \donormalizeRGB + \else\iffactorizecolor + \donormalizeRGB + \fi\fi} + +\def\donormalizeCMYK + {\normalizecolor\@@cl@@c + \normalizecolor\@@cl@@m + \normalizecolor\@@cl@@y + \normalizecolor\@@cl@@k} + +\def\normalizeCMYK + {\ifnormalizecolor + \donormalizeCMYK + \else\iffactorizecolor + \donormalizeCMYK + \fi\fi} + +\def\donormalizeGRAY + {\normalizecolor\@@cl@@s} + +\def\normalizeGRAY + {\ifnormalizecolor + \donormalizeGRAY + \else\iffactorizecolor + \donormalizeGRAY + \fi\fi} + +\def\normalizeSPOT + {\normalizespotcolor\@@cl@@p} + +%D We need to register spot colors (i.e.\ resources need to +%D be created. + +\def\registerspotcolor#1:% + {\ifundefined{\??cl:\c!p:\@@cl@@n}% + \letgvalue{\??cl:\c!p:\@@cl@@n}\empty + \@EA\@EA\csname registerspotcolor#1\endcsname + \else + \@EA\dontregistersplotcolor + \fi} + +\def\dontregistersplotcolor#1\od + {} + +\def\registerspotcolorR#1:#2:#3:#4\od + {\doregisterrgbspotcolor\@@cl@@n{#1}{#2}{#3}} + +\def\registerspotcolorC#1:#2:#3:#4:#5\od + {\doregistercmykspotcolor\@@cl@@n{#1}{#2}{#3}{#4}} + +\def\registerspotcolorS#1:#2\od + {\doregistergrayspotcolor\@@cl@@n{#1}} + +\def\registerspotcolorP#1:#2:#3\od + {\doregistergrayspotcolor\@@cl@@n{#2}} + %D Transparency is handled similar for all three color modes. We %D can turn transparency off with the following switch: @@ -480,24 +867,46 @@ \expandafter\noexectransparency \fi} +%\def\doexectransparency#1:#2\od +% {\global\@EA\chardef\csname\@@currenttransparent\endcsname % nasty +% \ifcase#1\space +% \zerocount +% \else +% \plusone +% \dostarttransparency{#1}{#2}% +% \fi} + \def\doexectransparency#1:#2\od - {\global\@EA\chardef\csname\@@currenttransparent\endcsname % nasty - \ifcase#1\space - \zerocount + {\ifcase#1\space + \global\intransparentfalse \else - \plusone + \global\intransparentfalse \dostarttransparency{#1}{#2}% + \global\intransparenttrue \fi} \def\noexectransparency#1\od {} -%D Todo: minimize resets. +%D Experimental: minimize transparency resets. -\def\conditionalstoptransparancy - {\ifcase\csname\@@currenttransparent\endcsname\or +\newif\ifintransparent \newif\ifoptimizetransparency + +\def\conditionalstoptransparency + {\iffilterspotcolor \dostoptransparency - \fi} + \else\ifcase\currentcolorchannel + \ifoptimizetransparency + \ifintransparent + \dostoptransparency + \global\intransparentfalse + \fi + \else + \dostoptransparency + \fi + \else + \dostoptransparency + \fi\fi} %D We now use the \type {\@@cl@@A} hook to implement %D symbolic names. These are converted into numbers @@ -566,20 +975,38 @@ %D \stopregistercolor %D \stoptypen -\let\maintextcolor\empty +\let\maintextcolor\empty \def\defaulttextcolor{black} + +% \def\starttextcolor[#1]% +% {\doifsomething{#1} +% {\bgroup +% \def\stoptextcolor % also goes ok with \page after +% {\let\maintextcolor\empty % this one because the top of +% \stopregistercolor % page sets the color right (side +% \egroup}% % effect) +% \def\starttextcolor[##1]% +% {\bgroup +% \let\stoptextcolor\egroup}% +% \startregistercolor[#1]% +% \edef\maintextcolor{#1}}} -\def\starttextcolor[#1]% +\def\@@themaintextcolor{themaintextcolor} + +\def\starttextcolor[#1]% {\doifsomething{#1} {\bgroup - \def\stoptextcolor % also goes ok with \page after - {\let\maintextcolor\empty % this one because the top of - \stopregistercolor % page sets the color right (side - \egroup}% % effect) + \def\stoptextcolor % also goes ok with \page after + {\let\maintextcolor\empty % this one because the top of + \stopregistercolor % page sets the color right (side + \egroup}% % effect) \def\starttextcolor[##1]% {\bgroup - \let\stoptextcolor\egroup}% - \startregistercolor[#1]% - \def\maintextcolor{#1}}} + % \@@themaintextcolor==##1 is catched in \definecolor + \definecolor[\@@themaintextcolor][##1]% + \let\stoptextcolor\egroup}% + \startregistercolor[\@@themaintextcolor]% + \definecolor[\@@themaintextcolor][#1]% + \let\maintextcolor\@@themaintextcolor}} \let\stoptextcolor\relax @@ -589,20 +1016,42 @@ \ifx\initializemaintextcolor\undefined - % \let\initializemaintextcolor\relax +% \def\initializemaintextcolor +% {\doifsomething\@@cltekstkleur +% {\appendtoks\starttextcolor[\@@cltekstkleur]\to\everystarttext +% \appendtoks\stoptextcolor \to\everystoptext +% \let\initializemaintextcolor\relax}} - \def\initializemaintextcolor - {\doifsomething{\@@cltekstkleur} - {\appendtoks\starttextcolor[\@@cltekstkleur]\to\everystarttext - \appendtoks\stoptextcolor \to\everystoptext - \let\initializemaintextcolor\relax}} + % global ? + \def\initializemaintextcolor + {\doifelsenothing\@@cltekstkleur + {\let\maintextcolor\empty} + {\let\maintextcolor\@@themaintextcolor + \definecolor[\@@themaintextcolor][\@@cltekstkleur]% + \doinitializemaintextcolor}} + + \def\doinitializemaintextcolor + {\appendtoks\starttextcolor[\@@themaintextcolor]\to\everystarttext + \appendtoks\stoptextcolor \to\everystoptext + \let\doinitializemaintextcolor\relax} + \fi %D The next macro can be used to return to the (normal) %D page color. This macro is used in the same way as %D \type {\color}. +\def\localstarttextcolor + {\ifx\maintextcolor\empty + \startcolormode\defaulttextcolor + \else + \startcolormode\maintextcolor + \fi} + +\def\localstoptextcolor + {\stopcolormode} + \def\restoretextcolor {\ifx\maintextcolor\empty \expandafter\dorestoretextcolor @@ -611,7 +1060,7 @@ \fi} \def\dorestoretextcolor - {\color[black]} + {\color[\defaulttextcolor]} %D We use some reserved names for local color components. %D Consistent use of these scratch variables saves us @@ -665,17 +1114,17 @@ \else 0\fi} \def\doconvertCMYKtoRGB#1\k#2\to#3% - {\ifdim#2\s!pt<#1\s!pt + {\ifdim#2\s!pt>#1\s!pt % >= problem, repaired 2/12/2002 + \let#3\@@cl@@z % k >= color + \else \colordimen1\s!pt \advance\colordimen -#1\s!pt \advance\colordimen -#2\s!pt - \multiply\colordimen 1000 + \multiply\colordimen \!!thousand\relax % 1000 \colorcount\colordimen \advance\colorcount \medcard \divide\colorcount \maxcard \edef#3{\realcolorvalue\colorcount}% - \else % k >= color - \let#3\@@cl@@z \fi} \def\convertCMYKtoRGB#1#2#3#4% @@ -685,12 +1134,12 @@ \def\doconvertRGBtoCMYK#1\to#2% {\colordimen#1\s!pt - \multiply\colordimen 1000 + \multiply\colordimen \!!thousand\relax % 1000 \colorcount\colordimen \advance\colorcount \medcard \divide\colorcount \maxcard \colorcount-\colorcount - \advance\colorcount 1000 + \advance\colorcount \!!thousand\relax % 1000 \edef#2{\realcolorvalue\colorcount}} \def\convertRGBtoCMYK#1#2#3% @@ -735,7 +1184,7 @@ %\else % \colordimen\colordimen \fi - \multiply\colordimen 1000 + \multiply\colordimen \!!thousand\relax % 1000 \colorcount\colordimen \advance\colorcount \medcard \divide\colorcount \maxcard @@ -752,71 +1201,112 @@ %D booleans that control local and global behavior (more on %D that later) and conversion to other color spaces. +\let\currentspotcolor \empty +\let\previousspotcolor\empty + \newif\ifincolor \newif\iflocalcolor -\def\setupcolors% +\def\setupcolors {\dosingleargument\dosetupcolors} +\def\resetcolorsplitting + {\chardef\currentcolorchannel\zerocount + \let\currentspotcolor\empty + \filterspotcolorfalse} + +\def\colorsplitsuffix{\ifcase\currentcolorchannel\else-\@@clsplitsen\fi} +\def\colorsplitprefix{\ifcase\currentcolorchannel\else\@@clsplitsen-\fi} + +\ifx\resetsystemmode\undefined + \let\setsystemmode \gobbleoneargument + \let\resetsystemmode\gobbleoneargument +\fi + +\def\setcolorsplitting + {\resetsystemmode{\v!kleur\colorsplitsuffix}% + \resetcolorsplitting + \processaction + [\@@clsplitsen] + [ c=>\chardef\currentcolorchannel1,% + m=>\chardef\currentcolorchannel2,% + y=>\chardef\currentcolorchannel3,% + k=>\chardef\currentcolorchannel4,% + r=>\chardef\currentcolorchannel5,% + g=>\chardef\currentcolorchannel6,% + b=>\chardef\currentcolorchannel7,% + s=>\chardef\currentcolorchannel8,% + \v!nee=>,% \currentcolorchannel0,% all colors + \s!default=>,% \currentcolorchannel0,% all colors + \s!unknown=>\filterspotcolortrue + \edef\currentspotcolor{\commalistelement}]% + \setsystemmode{\v!kleur\colorsplitsuffix}% + \iffilterspotcolor \let\@@clrgb\v!nee \fi} + \def\dosetupcolors[#1]% - {\getparameters[\??cl][#1]% - \doifelse\@@clreductie\v!ja - \reduceCMYKtrue - \reduceCMYKfalse - \doifelse\@@clrgb\v!nee - {\ifRGBsupported \showmessage\m!colors {9}\v!rgb\RGBsupportedfalse\fi} - {\ifRGBsupported\else\showmessage\m!colors{10}\v!rgb\RGBsupportedtrue \fi}% - \doifelse\@@clcmyk\v!nee - {\ifCMYKsupported \showmessage\m!colors {9}\v!cmyk\CMYKsupportedfalse\fi} - {\ifCMYKsupported\else\showmessage\m!colors{10}\v!cmyk\CMYKsupportedtrue \fi}% - \doifelse\@@clmpcmyk\v!nee - {\ifMPcmyk \showmessage\m!colors {9}{\v!mp\v!cmyk}\MPcmykfalse\fi} - {\ifMPcmyk\else\showmessage\m!colors{10}{\v!mp\v!cmyk}\MPcmyktrue \fi}% -% \processaction -% [\@@clconversie] -% [ \v!ja=>\preferGRAYtrue, -% \v!nee=>\preferGRAYfalse, -% \v!altijd=>\preferGRAYtrue -% \RGBsupportedfalse -% \CMYKsupportedfalse, -% \s!default=>\preferGRAYfalse, -% \s!unknown=>\preferGRAYfalse]% -% - \preferGRAYfalse - \processaction - [\@@clconversie] - [ \v!ja=>\preferGRAYtrue, - \v!altijd=>\preferGRAYtrue\RGBsupportedfalse\CMYKsupportedfalse]% -% - \ifRGBsupported - \converttoGRAYfalse - \forcegrayMPcolorsfalse - \else\ifCMYKsupported - \converttoGRAYfalse - \forcegrayMPcolorsfalse - \convertMPcolorstrue - \ifreduceCMYK - \reduceMPcolorstrue - \fi - \else - \ifconverttoGRAY\else\showmessage\m!colors{11}\empty\fi - \converttoGRAYtrue - \forcegrayMPcolorstrue - \convertMPcolorsfalse - \reduceMPcolorsfalse - \fi\fi - \processaction - [\@@clstatus] - [\v!globaal=>\ifincolor\else\showmessage\m!colors1\colorstyle\fi - \incolortrue\localcolorfalse, - \v!lokaal=>\ifincolor\else\showmessage\m!colors2\colorstyle\fi - \incolortrue\localcolortrue, - \v!start=>\ifincolor\else\showmessage\m!colors1\colorstyle\fi - \incolortrue\localcolorfalse - \let\@@clstatus\v!globaal, - \v!stop=>\incolorfalse\localcolorfalse - \forcegrayMPcolorstrue]% - \initializemaintextcolor} + {\getparameters[\??cl][#1]% + \doifelse\@@clspot\v!ja + \SPOTsupportedtrue + \SPOTsupportedfalse + \doifelsenothing\@@clsplitsen + \resetcolorsplitting + \setcolorsplitting + \doifelse\@@clreductie\v!ja + \reduceCMYKtrue + \reduceCMYKfalse + \doifelse\@@clexpansie\v!ja + \freezecolorstrue + \freezecolorsfalse + \doifelse\@@clcriterium\v!alles + \hidesplitcolortrue + \hidesplitcolorfalse + \doifelse\@@clrgb\v!nee + {\ifRGBsupported \showmessage\m!colors {9}\v!rgb\RGBsupportedfalse\fi} + {\ifRGBsupported\else\showmessage\m!colors{10}\v!rgb\RGBsupportedtrue \fi}% + \doifelse\@@clcmyk\v!nee + {\ifCMYKsupported \showmessage\m!colors {9}\v!cmyk\CMYKsupportedfalse\fi} + {\ifCMYKsupported\else\showmessage\m!colors{10}\v!cmyk\CMYKsupportedtrue \fi}% + % todo : mpspot + \doifelse\@@clmpcmyk\v!nee + {\ifMPcmykcolors \showmessage\m!colors {9}{\v!mp\v!cmyk}\MPcmykcolorsfalse\fi} + {\ifMPcmykcolors\else\showmessage\m!colors{10}{\v!mp\v!cmyk}\MPcmykcolorstrue \fi}% + \doifelse\@@clmpspot\v!nee + {\ifMPspotcolors \showmessage\m!colors {9}{\v!mp\v!spot}\MPspotcolorsfalse\fi} + {\ifMPspotcolors\else\showmessage\m!colors{10}{\v!mp\v!spot}\MPspotcolorstrue \fi}% + \preferGRAYfalse + \processaction + [\@@clconversie] + [ \v!ja=>\preferGRAYtrue, + \v!altijd=>\preferGRAYtrue\RGBsupportedfalse\CMYKsupportedfalse]% + \ifRGBsupported + \converttoGRAYfalse + \forcegrayMPcolorsfalse + \else\ifCMYKsupported + \converttoGRAYfalse + \forcegrayMPcolorsfalse + \convertMPcolorstrue + \ifreduceCMYK + \reduceMPcolorstrue + \fi + \else + \ifconverttoGRAY\else\showmessage\m!colors{11}\empty\fi + \converttoGRAYtrue + \forcegrayMPcolorstrue + \convertMPcolorsfalse + \reduceMPcolorsfalse + \fi\fi + \processaction + [\@@clstatus] + [\v!globaal=>\ifincolor\else\showmessage\m!colors1\colorstyle\fi + \incolortrue\localcolorfalse, + \v!lokaal=>\ifincolor\else\showmessage\m!colors2\colorstyle\fi + \incolortrue\localcolortrue, + \v!start=>\ifincolor\else\showmessage\m!colors1\colorstyle\fi + \incolortrue\localcolorfalse + \let\@@clstatus\v!globaal, + \v!stop=>\incolorfalse\localcolorfalse + \forcegrayMPcolorstrue]% + \initializemaintextcolor} %D \macros %D {doifcolorelse} @@ -929,16 +1419,21 @@ \def\@@currentcolorstop {\??cl\the\colorlevel S} \def\@@currenttransparent{\??cl\the\colorlevel T} +\def\currentcolor + {\csname + \ifundefined\@@currentcolorname\s!empty\else\@@currentcolorname\fi + \endcsname} + \def\dodoglobalstartcolor - {\global\@EA\let\@EA\currentcolor\csname\@@currentcolorname\endcsname + {\global\@EA\let\@EA\@@currentcolor\csname\@@currentcolorname\endcsname \global\advance\colorlevel \@@colorplus \global\@EA\let\csname\@@currentcolorname\endcsname\@@askedcolor - %\debuggerinfo{\m!colors} + %\debuggerinfo\m!colors % {start \@@askedcolor\space at level \the\colorlevel}% \ifx\@@askedcolor\empty - \global\@EA\let\csname\@@currentcolorname\endcsname\currentcolor + \global\@EA\let\csname\@@currentcolorname\endcsname\@@currentcolor \global\@EA\let\csname\@@currentcolorstop\endcsname\donoglobalstopcolor - \else\ifx\@@askedcolor\currentcolor + \else\ifx\@@askedcolor\@@currentcolor \global\@EA\let\csname\@@currentcolorstop\endcsname\donoglobalstopcolor \else \doifcolorelse\@@askedcolor @@ -968,35 +1463,43 @@ \def\dodoglobalstopcolor {\ifcase\colorlevel \else \donoglobalstopcolor - \global\@EA\let\@EA\previouscolor\csname\@@currentcolorname\endcsname + \global\@EA\let\@EA\@@previouscolor\csname\@@currentcolorname\endcsname \ifcase\colorlevel\relax - \docolormark\empty - \dostoptransparency - \dostopcolormode - \else % let's do a bit redundant testing here - \docolormark\previouscolor - \ifx\previouscolor\empty - \dostoptransparency + \ifpermitcolormode + \docolormark\empty + \conditionalstoptransparency \dostopcolormode + \fi + \else % let's do a bit redundant testing here + \docolormark\@@previouscolor + \ifx\@@previouscolor\empty + \ifpermitcolormode + \conditionalstoptransparency + \dostopcolormode + \fi \else - \doifcolorelse\previouscolor - {\ifx\currentcolor\previouscolor\else + \doifcolorelse\@@previouscolor + {\ifx\@@currentcolor\@@previouscolor\else % alternatively we could let \startcolormode handle this - \dostoptransparency % really needed - % \dostopcolormode % less safe but more efficient - \startcolormode\previouscolor + \ifpermitcolormode + \conditionalstoptransparency % really needed + % more safe but less efficient: \dostopcolormode + \fi + \startcolormode\@@previouscolor \fi} - {\dostoptransparency - \dostopcolormode}% + {\ifpermitcolormode + \conditionalstoptransparency + \dostopcolormode + \fi}% \fi \fi \fi} \def\donoglobalstopcolor {\ifcase\colorlevel \else - \global\@EA\let\@EA\currentcolor\csname\@@currentcolorname\endcsname + \global\@EA\let\@EA\@@currentcolor\csname\@@currentcolorname\endcsname %\debuggerinfo{\m!colors} - % {stop \currentcolor\normalspace at level \the\colorlevel}% + % {stop \@@currentcolor\normalspace at level \the\colorlevel}% \global\advance\colorlevel \@@colorminus \fi} @@ -1068,14 +1571,14 @@ %D the colors temporary have to be reset. After the page is %D shipped out, we have to revive the current color. %D -%D We use \type{\marks} to keep track of colors across page +%D We use \type{\mark}s to keep track of colors across page %D boundaries. Unfortunately standard \TEX\ supports only one mark, %D and using this one for color support only would be a waste. %D We therefore use an adapted version of J.~Fox's multiple mark %D mechanism as (re|)|implemented in \module{supp-mrk}. -\doifdefinedelse{newmark} - {\newmark\colormark} +\doifdefinedelse{rawnewmark} + {\rawnewmark\colormark} {\let\colormark\gobbleoneargument} %D Using this mark mechanism with lots of colors has one @@ -1107,7 +1610,7 @@ {\edef\newcolormark{#1}% \ifx\newcolormark\lastcolormark\else \global\let\lastcolormark\newcolormark - \@EA\setmark\@EA\colormark\@EA{\lastcolormark}% + \@EA\rawsetmark\@EA\colormark\@EA{\lastcolormark}% \fi} %D \macros @@ -1117,21 +1620,35 @@ %D to resetting the color to black, while popping restores the %D color state to that of before the break. -\def\topofpagecolor{\getbotmark\colormark} % see postponing +\def\topofpagecolor{\rawgetbotmark\colormark} % see postponing \def\pushcolor {\stopcolormode} \def\popcolor - {\doifsomething{\getbotmark\colormark} - {%\debuggerinfo{\m!colors}{popping \getbotmark\colormark}% - \startcolormode{\getbotmark\colormark}}} + {\doifsomething{\rawgetbotmark\colormark} + {%\debuggerinfo\m!colors{popping \getbotmark\colormark}% + \startcolormode{\rawgetbotmark\colormark}}} -\def\popsplitcolor% +\def\popsplitcolor {\getsplitmarks\colormark % hier wel - \doifsomething{\getsplitbotmark\colormark} - {%\debuggerinfo{\m!colors}{split popping \getsplitbotmark\colormark}% - \startcolormode{\getsplitbotmark\colormark}}} + \doifsomething{\rawgetsplitbotmark\colormark} + {%\debuggerinfo\m!colors{split popping \getsplitbotmark\colormark}% + \startcolormode{\rawgetsplitbotmark\colormark}}} + +% Private macro: only needed in test cases (like multiple +% seprations in one file); no user command! + +\def\resynccolor + {\ifdim\pagetotal=\zeropoint + \popcolor + \else\ifx\@@currentcolor\empty + \ifx\maintextcolor\empty\else + \startcolormode\maintextcolor + \fi + \else + \startcolormode\@@currentcolor + \fi\fi} %D \macros %D {startcolorpage, stopcolorpage} @@ -1143,16 +1660,20 @@ %D easy. It also supports nested colors in page backgrounds %D and texts. -\def\startcolorpage% +\def\startcolorpage {\bgroup \let\@@colorplus \minusone \let\@@colorminus\plusone \let\docolormark\gobbleoneargument \edef\savedcolorlevel{\the\colorlevel}% \global\colorlevel\zerocount % before \localstartcolor of - \localstartcolor[black]} % course, ugly bug removed + \ifx\maintextcolor\empty % course, ugly bug removed + \localstartcolor[\defaulttextcolor]% + \else + \localstartcolor[\maintextcolor]% + \fi} -\def\stopcolorpage% +\def\stopcolorpage {\localstopcolor \global\colorlevel\savedcolorlevel \egroup} @@ -1173,6 +1694,8 @@ {\groupedcommand {\startcolor[#1]}\stopcolor} +\let\switchtocolor\color + \unexpanded\def\graycolor[#1]% not \gray because this is a color {\groupedcommand {\RGBsupportedfalse\CMYKsupportedfalse\startcolor[#1]}\stopcolor} @@ -1258,6 +1781,9 @@ \def\doformatgrayS#1:#2:#3\od {\dodoformatcolor{#1}} +\def\doformatgrayP#1:#2:#3:#4\od + {\dowithcolor\doformatcolor{#1}} + \def\doformatgray#1:% {\getvalue{doformatgray#1}} @@ -1278,7 +1804,7 @@ \def\localstartraster[#1]% {\doifelsenothing{#1} - {\dostartgraymode{\@@rsraster}} + {\dostartgraymode\@@rsraster} {\dostartgraymode{#1}}} \def\localstopraster @@ -1352,21 +1878,22 @@ %D This saves us some typing in for instance the modules that %D deal with pretty verbatim typesetting. -\def\definepalet% +\def\definepalet {\dodoubleargument\dodefinepalet} \def\dodefinepalet[#1][#2]% {\doifassignmentelse{#2} - {\setvalue{\??pa#1}{}% + {\showmessage\m!colors6{#1}% + \letvalue{\??pa#1}\empty \setevalue{\??pa\??pa#1}{#2}% - \showmessage{\m!colors}{6}{#1}% \def\dodododefinepalet[##1=##2]% {\doifvaluesomething{\??pa#1} {\setevalue{\??pa#1}{\getvalue{\??pa#1},}}% \setevalue{\??pa#1}{\getvalue{\??pa#1}##1}% \doifdefinedelse{\??cr##2} - {\setevalue{\??cr#1:##1}{\getvalue{\??cr##2}}} - {\setevalue{\??cr#1:##1}{S:0:0:0}}}% + {\iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi + {\??cr#1:##1}{\getvalue{\??cr##2}}} + {\letvalue{\??cr#1:##1}\colorXpattern}}% \def\dododefinepalet##1% {\dodododefinepalet[##1]}% \processcommalist[#2]\dododefinepalet} @@ -1440,7 +1967,7 @@ %D defining each color separate, it also loads faster and takes %D less bytes. -\def\definecolorgroup% +\def\definecolorgroup {\dotripleempty\dodefinecolorgroup} \def\dodefinecolorgroup[#1][#2][#3]% @@ -1450,11 +1977,12 @@ [ \v!cmyk=>\edef\currentcolorspace{C}, \v!rgb=>\edef\currentcolorspace{R}, \v!gray=>\edef\currentcolorspace{S}, + \v!spot=>\edef\currentcolorspace{P}, \v!s=>\edef\currentcolorspace{S}, \s!unknown=>\edef\currentcolorspace{R}]% - \colorcount=0 + \colorcount\zerocount \def\dododefinecolorgroup##1% - {\advance\colorcount 1 + {\advance\colorcount \plusone \setevalue{\??cr#1:\the\colorcount}{\currentcolorspace:##1:0:0}}% \processcommalist[#3]\dododefinecolorgroup \else @@ -1589,7 +2117,7 @@ \fetchruntimecommand \showcolor {\f!colorprefix\s!run} %D \macros -%D {negativecolorbox} +%D {negatecolorcomponent, negativecolorbox} %D %D Sometimes, especially when we deal with typesetting %D devices, we want to reverse the color scheme. Instead of @@ -1602,8 +2130,13 @@ %D %D will negate the colors in box zero. +\def\negatecolorcomponent#1% #1 = \macro + {\scratchdimen\!!onepoint\advance\scratchdimen-#1\s!pt + \ifdim\scratchdimen<\zeropoint\scratchdimen\zeropoint\fi + \edef#1{\@EA\withoutpt\the\scratchdimen}} + \def\negatecolorbox#1% - {\setbox#1=\hbox + {\setbox#1\hbox {\dostartnegative \localstartcolor[white]% \vrule\!!height\ht#1\!!depth\dp#1\!!width\wd#1% @@ -1612,7 +2145,7 @@ \box#1\dostopnegative}} %D \macros -%D {ifMPgraphics, ifMPcmyk, MPcolor} +%D {ifMPgraphics, ifMPcmykcolors, MPcolor} %D %D A very special macro is \type{\MPcolor}. This one can be %D used to pass a \CONTEXT\ color to \METAPOST. @@ -1626,81 +2159,97 @@ %D {MPcmyk}, only \kap{RGB} colors and gray scales are %D supported. -\newif\ifMPcmyk % \MPcmykfalse +\newif\ifMPcmykcolors % \MPcmykcolorsfalse +\newif\ifMPspotcolors % \MPspotcolorsfalse \beginTEX -\def\MPcolor#1% +\def\scaledMPcolor#1#2% {\ifMPgraphics - \@EA\@EA\@EA\doMPcolor + \handlecolorwith\doMPcolor \csname\??cr\@EA - \ifx\csname\??cr\currentpalet#1\endcsname\relax\else\currentpalet\fi - #1\endcsname - :::::::\end + \ifx\csname\??cr\currentpalet#2\endcsname\relax\else\currentpalet\fi + #2\endcsname + :::::::\end#1\end \else - #1% + #2% \fi} \endTEX \beginETEX \ifcsname -\def\MPcolor#1% +\def\scaledMPcolor#1#2% {\ifMPgraphics - \@EA\@EA\@EA\doMPcolor + \handlecolorwith\doMPcolor \csname\??cr - \ifcsname\??cr\currentpalet#1\endcsname\currentpalet\fi - #1\endcsname - :::::::\end + \ifcsname\??cr\currentpalet#2\endcsname\currentpalet\fi + #2\endcsname + :::::::\end#1\end \else - #1% + #2% \fi} \endETEX +\def\MPcolor{\scaledMPcolor1} + %D Before we had transparancy available, the following %D conversion macro was available: %D %D \starttypen %D \def\doMPcolor#1:#2:#3:#4:#5:#6:#7:#8\end %D {\if #1R(#2,#3,#4)% -%D \else\if#1C\ifMPcmyk cmyk(#2,#3,#4,#5)\else(1-#2-#5,1-#3-#5,1-#4-#5)\fi +%D \else\if#1C\ifMPcmykcolors cmyk(#2,#3,#4,#5)\else(1-#2-#5,1-#3-#5,1-#4-#5)\fi %D \else\if#1S(#2,#2,#2)% %D \else (0,0,0)% %D \fi\fi\fi} %D \stoptypen %D %D In order to be useful, this macro is to be fully -%D expandabele. The next alternative also handles transparant -%D colors. We could have packaged everything in one macro, but -%D splitting it up is not only more readable, but also faster -%D (because less arguments have to be skipped) - -\def\doMPcolor#1:% - {\if#1R% - \@EA\doMPrgb - \else\if#1C\ifMPcmyk - \@EA\@EAEAEA\@EA\doMPcmykY - \else - \@EA\@EAEAEA\@EA\doMPcmykN - \fi\else\if#1S% - \@EA\@EAEAEA\@EA\doMPgray - \else - \@EA\@EAEAEA\@EA\doMPblack - \fi\fi\fi} - -\def\transparentMP{transparent} -\def\cmykspecialMP{cmyk} +%D expandabele. + +\def\doMPcolor#1:% #1 can be \relax ! ! ! i.e. an empty color + {\csname + MPc\@EA\ifx\csname MPc\string#1\endcsname\relax B\else#1\fi + \endcsname} + +\def\MPcR{\doMPrgb} +\def\MPcC{\ifMPcmykcolors\@EA\doMPcmykY\else\@EA\doMPcmykN\fi} +\def\MPcS{\doMPgray} +\def\MPcP{\ifMPspotcolors\@EA\doMPspotY\else\@EA\doMPspotN\fi} +\def\MPcB{\doMPblack} + +\def\transparentMP {transparent} +\def\cmykMP {scaledcmyk} +\def\cmykASrgbMP {scaledcmykasrgb} % not really needed any more +\def\rgbMP {scaledrgb} +\def\grayMP {scaledgray} +\def\processMP {spotcolor} \def\doMPtransparent#1#2:#3:#4\end {\ifcase#2\space(#1)\else\transparentMP(#2,#3,(#1))\fi} -\def\doMPgray #1:{\doMPtransparent{#1,#1,#1}} -\def\doMPrgb #1:#2:#3:{\doMPtransparent{#1,#2,#3}} -\def\doMPcmykY#1:#2:#3:#4:{\doMPtransparent{\cmykspecialMP(#1,#2,#3,#4)}} -\def\doMPcmykN#1:#2:#3:#4:{\doMPtransparent{1-#1-#4,1-#2-#4,1-#3-#4}} +\def\doMPgray#1:#2\end#3\end + {\doMPtransparent{\grayMP(#1,#3)}#2\end} + +\def\doMPrgb#1:#2:#3:#4\end#5\end + {\doMPtransparent{\rgbMP(#1,#2,#3,#5)}#4\end} + +\def\doMPcmykY#1:#2:#3:#4:#5\end#6\end + {\doMPtransparent{\cmykMP(#1,#2,#3,#4,#6)}#5\end} + +\def\doMPcmykN#1:#2:#3:#4:#5\end#6\end + {\doMPtransparent{\cmykASrgbMP(#1,#2,#3,#4,#6)}#5\end} -\def\doMPblack#1:#2:#3:#4:#5:#6:#7\end{(0,0,0)} +\def\doMPspotY#1:#2:#3\end#4\end + {\doMPtransparent{\processMP("#1",#2)}#3\end} + +\def\doMPspotN#1:#2:#3\end#4\end + {\scaledMPcolor{#2}{#1}} + +\def\doMPblack#1\end#2\end + {(0,0,0)} %D \macros %D {PDFcolor,FDFcolor} @@ -1708,24 +2257,37 @@ %D Similar alternatives are avaliable for \PDF: \def\PDFcolor#1% - {\@EA\@EA\@EA\doPDFcolor\csname\??cr#1\endcsname:::::::\end} + {\handlecolorwith\doPDFcolor\csname\??cr#1\endcsname:::::::\end} \def\doPDFcolor#1:#2:#3:#4:#5:#6:#7:#8\end {\if #1R#2 #3 #4 rg% \else\if#1C#2 #3 #4 #5 k% \else\if#1S#2 g% - \else 0 g% - \fi\fi\fi} + \else\if#1P#3 g% todo + \else 0 g% + \fi\fi\fi\fi} + +\def\PDFcolorvalue#1% + {\handlecolorwith\doPDFcolorvalue\csname\??cr#1\endcsname:::::::\end} + +\def\doPDFcolorvalue#1:#2:#3:#4:#5:#6:#7:#8\end + {\if #1R#2 #3 #4% + \else\if#1C#2 #3 #4 #5% + \else\if#1S#2% + \else\if#1P#3% + \else 0% + \fi\fi\fi\fi} \def\FDFcolor#1% - {\@EA\@EA\@EA\doFDFcolor\csname\??cr#1\endcsname:::::::\end} + {\handlecolorwith\doFDFcolor\csname\??cr#1\endcsname:::::::\end} \def\doFDFcolor#1:#2:#3:#4:#5:#6:#7:#8\end {[\if #1R#2 #3 #4% \else\if#1C#2 #3 #4 #5% \else\if#1S#2% - \else 0% - \fi\fi\fi]} + \else\if#1P#3% todo + \else 0% + \fi\fi\fi\fi]} %D \macros %D {everyshapebox} @@ -1744,12 +2306,64 @@ \c!reductie=\v!nee, \c!rgb=\v!ja, \c!cmyk=\v!ja, + \c!spot=\v!ja, \c!mp\c!cmyk=\@@clcmyk, - \c!tekstkleur=] + \c!mp\c!spot=\@@clspot, + \c!expansie=\v!nee, + \c!tekstkleur=, + \c!splitsen=\v!nee, + \c!criterium=\v!alles] \setupcolor [\v!rgb] +%D For the moment we keep the next downward compatibility +%D switch, i.e.\ expanded colors. However, predefined colors +%D and palets are no longer expanded (which is what I wanted +%D in the first place). +%D +%D Well, in case we want to do color separation and use CMYK +%D colors only, this is dangerous since unwanted remapping may +%D take place. Especially when we redefine already defined +%D colors in another color space (e.g. darkgreen is +%D predefined in RGB color space, so a redefinition in CMYK +%D coordinates before RGB mode is disabled, would give +%D unexpected results due to the already frozen color spec.) +%D +%D So, from now on, colors are not frozen any more! + +% \appendtoks\setupcolors[\c!expansie=\v!ja]\to\everyjob + +%D The next macro is for instance used in figure splitting: + +\def\doifseparatingcolorselse + {\iffilterspotcolor + \@EA\firstoftwoarguments + \else\ifcase\currentcolorchannel + \@EAEAEA\secondoftwoarguments + \else + \@EAEAEA\firstoftwoarguments + \fi\fi} + +\def\doifcolorchannelelse#1% + {\doifseparatingcolorselse + {\doifelsenothing{#1} + \secondoftwoarguments + {\doifelse{#1}\@@clsplitsen + \firstoftwoarguments + \secondoftwoarguments}} + \secondoftwoarguments} + +\def\resetcolorseparation + {\filterspotcolorfalse + \chardef\currentcolorchannel\zerocount} + +%D These can be used in selecting specific files (like +%D figuredatabases). + +\def\colorchannelprefix{\doifseparatingcolorselse\@@clsplitsen\empty-} +\def\colorchannelsuffix{-\doifseparatingcolorselse\@@clsplitsen\empty} + %D As we can see, color support is turned off by default. %D Reduction of gray colors to gray scales is turned on. diff --git a/tex/context/base/colo-rgb.tex b/tex/context/base/colo-rgb.tex index 5f5a21638..39f34d569 100644 --- a/tex/context/base/colo-rgb.tex +++ b/tex/context/base/colo-rgb.tex @@ -29,7 +29,7 @@ \definecolor [magenta] [r=1, g=0, b=1] \definecolor [yellow] [r=1, g=1, b=0] -\definecolor [white] [r=1, g=1, b=1] +\definecolor [white] [s=1] % [r=1, g=1, b=1] \definecolor [black] [s=0] \definecolor [gray] [s=.9] @@ -270,6 +270,8 @@ %D Like colors, we first define the english colorgroups. These %D colorgroups are tuned for distinctive gray scale printing. +% todo : more efficient and real gray + \definecolorgroup [gray] [0.95:0.95:0.95, diff --git a/tex/context/base/colo-run.tex b/tex/context/base/colo-run.tex index 0b6c6da68..1355c9365 100644 --- a/tex/context/base/colo-run.tex +++ b/tex/context/base/colo-run.tex @@ -1,11 +1,11 @@ \unprotect -\gdef\showpalet% +\gdef\showpalet {\dodoubleargument\doshowpalet} \gdef\doshowpalet[#1][#2]% {\doifdefined{\??pa#1} - {\doifinsetelse{\v!vertikaal}{#2} + {\doifinsetelse\v!vertikaal{#2} {\showverticalpalet[#1][#2]} {\showhorizontalpalet[#1][#2]}}} @@ -13,13 +13,13 @@ {\localvbox {\offinterlineskip \setuppalet[#1] - \def\rule% + \def\rule {\vrule\!!width3em\!!height\ht\strutbox\!!depth\dp\strutbox} - \tabskip\!!zeropoint + \tabskip\zeropoint \def\doshowpalet##1% - {\doifinsetelse{\v!nummer}{#2}{##1\hskip.5em}{}& + {\doifinsetelse\v!nummer{#2}{##1\hskip.5em}{}& \color[##1]{\rule}\graycolor[##1]{\rule}& - \doifinset{\v!waarde}{#2}{\hskip.5em\colorvalue{##1}}\crcr} + \doifinset\v!waarde{#2}{\hskip.5em\colorvalue{##1}}\crcr} \halign {\hss##&\hss##\hss&##\cr &\doifinset{\v!naam}{#2}{\strut#1}&\cr% @@ -29,30 +29,30 @@ {\localvbox {\offinterlineskip \setuppalet[#1] - \tabskip\!!zeropoint - \!!widtha=\!!zeropoint - \doifinset{\v!nummer}{#2} + \tabskip\zeropoint + \!!widtha\zeropoint + \doifinset\v!nummer{#2} {\def\doshowpalet##1% - {\setbox0=\hbox{##1}% - \ifdim\!!widtha<\wd0\!!widtha=\wd0\fi}% + {\setbox0\hbox{##1}% + \ifdim\!!widtha<\wd0\!!widtha\wd0\fi}% \processpalet[#1]\doshowpalet}% - \advance\!!widtha by 1em + \advance\!!widtha 1em \ifdim\!!widtha<5em - \!!widtha=5em + \!!widtha5em \fi \halign {##&&\hbox to \!!widtha{\hss##\hss}\cr - \doifinset{\v!nummer}{#2} + \doifinset\v!nummer{#2} {\def\doshowpalet##1{&\strut##1}% \processpalet[#1]\doshowpalet}\cr - \doifinset{\v!naam}{#2}{#1\hskip.5em}% + \doifinset\v!naam{#2}{#1\hskip.5em}% \def\doshowpalet##1% {&\color[##1]{\vrule\!!width\!!widtha\!!height\ht\strutbox\!!depth\!!zeropoint}}% \processpalet[#1]\doshowpalet\crcr \def\doshowpalet##1% {&\graycolor[##1]{\vrule\!!width\!!widtha\!!height\!!zeropoint\!!depth\dp\strutbox}}% \processpalet[#1]\doshowpalet\crcr - \doifinset{\v!waarde}{#2} + \doifinset\v!waarde{#2} {\def\doshowpalet##1% {&\vbox {\hsize\!!widtha @@ -67,12 +67,12 @@ \gdef\processpalet[#1]% {\expanded{\globalprocesscommalist[\getvalue{\??pa#1}]}} -\gdef\showcolorgroup% +\gdef\showcolorgroup {\dodoubleargument\doshowcolorgroup} \gdef\doshowcolorgroup[#1][#2]% {\doifdefined{\??cr#1:1} - {\doifinsetelse{\v!vertikaal}{#2} + {\doifinsetelse\v!vertikaal{#2} {\showverticalcolorgroup[#1][#2]} {\showhorizontalcolorgroup[#1][#2]}}} @@ -80,24 +80,24 @@ {\localvbox {\offinterlineskip \setuppalet - \tabskip\!!zeropoint - \def\rule% + \tabskip\zeropoint + \def\rule {\vrule\!!width4em\!!height\ht\strutbox\!!depth\dp\strutbox} \def\colorformatseparator{\strut\cr} \def\dodoshowgroup##1% {\halign {\hss####\hss\cr - \doifinset{\v!nummer}{#2}{\strut##1}\cr + \doifinset\v!nummer{#2}{\strut##1}\cr \color[#1:##1]{\vrule\!!width4em\!!height\ht\strutbox\!!depth\!!zeropoint}\cr \graycolor[#1:##1]{\vrule\!!width4em\!!height\!!zeropoint\!!depth\dp\strutbox}\cr - \doifinset{\v!waarde}{#2}{\colorvalue{#1:##1}\strut}\crcr}} + \doifinset\v!waarde{#2}{\colorvalue{#1:##1}\strut}\crcr}} \def\doshowgroup##1% {\doifdefined{\??cr#1:##1} {\vbox{\dodoshowgroup{##1}}}} \hbox - {\doifinset{\v!naam}{#2} + {\doifinset\v!naam{#2} {\strut - \doifinsetelse{\v!waarde}{#2} + \doifinsetelse\v!waarde{#2} {\raise3\lineheight\hbox{#1\hskip.5em}} {#1}% \hskip.5em}% @@ -108,17 +108,17 @@ {\localvbox {\offinterlineskip \setuppalet - \tabskip\!!zeropoint - \def\rule% + \tabskip\zeropoint + \def\rule {\vrule\!!width2.5em\!!height\ht\strutbox\!!depth\dp\strutbox} \def\doshowgroup##1% {\doifdefined{\??cr#1:##1} - {\doifinset{\v!nummer}{#2}{##1\hskip.5em}& + {\doifinset\v!nummer{#2}{##1\hskip.5em}& \color[#1:##1]{\rule}\graycolor[#1:##1]{\rule}& - \doifinset{\v!waarde}{#2}{\hskip.5em\colorvalue{#1:##1}}\crcr}} + \doifinset\v!waarde{#2}{\hskip.5em\colorvalue{#1:##1}}\crcr}} \halign {\hss##&\hss##\hss&##\hss\cr - &\doifinset{\v!naam}{#2}{\strut#1}&\crcr + &\doifinset\v!naam{#2}{\strut#1}&\crcr \doshowgroup1\doshowgroup2\doshowgroup3\doshowgroup4% \doshowgroup5\doshowgroup6\doshowgroup7\doshowgroup8}}} @@ -126,7 +126,7 @@ {\bgroup \setupcolor[#1] \stelwitruimtein[\v!geen] - \def\rule% + \def\rule {\vrule\!!width4em\!!height\ht\strutbox\!!depth\dp\strutbox} \def\docommand##1% {\hbox @@ -139,7 +139,7 @@ \processcommacommand[\colorlist]\docommand \egroup} -\gdef\comparepalet% +\gdef\comparepalet {\dosingleargument\docomparepalet} \gdef\docomparepalet[#1]% @@ -154,15 +154,16 @@ {\offinterlineskip \setuppalet[#2] \getcommacommandsize[\getvalue{\??pa#2}] - \!!widtha=2em\relax - \hsize=\commalistsize\!!widtha + \!!widtha2em\relax + \hsize\commalistsize\!!widtha \def\rule% {\vrule\!!width.5\!!widtha\!!height2.25ex\!!depth-.75ex} \def\dododocomparepalet##1% {\hbox - {\setbox0=\hbox + {\setbox0\hbox {#1[##1]{\vrule\!!width\hsize\!!height3ex}}% - \wd0=\!!zeropoint\box0 + \wd0\zeropoint + \box0 \hbox to \hsize {\def\dododocomparepalet####1% {\hbox to \!!widtha @@ -171,7 +172,7 @@ \endgraf} \processcommacommand[\getvalue{\??pa#2}]\dododocomparepalet}} -\gdef\comparecolorgroup% +\gdef\comparecolorgroup {\dosingleargument\docomparecolorgroup} \gdef\docomparecolorgroup[#1]% @@ -183,21 +184,22 @@ \gdef\dodocomparecolorgroup#1[#2]% {\localvbox - {\!!counta=0 + {\!!counta\zerocount \dorecurse{15} - {\doifdefined{\??cr#2:\recurselevel}{\advance\!!counta by 1}} - \!!widtha=2em\relax - \hsize=\!!counta\!!widtha - \def\rule% + {\doifdefined{\??cr#2:\recurselevel}{\advance\!!counta\plusone}} + \!!widtha2em\relax + \hsize\!!counta\!!widtha + \def\rule {\vrule\!!width.5\!!widtha\!!height2.25ex\!!depth-.75ex} \def\dododocomparecolorgroup##1% {\hbox to \hsize - {\setbox0=\hbox + {\setbox0\hbox {#1[#2:##1]{\vrule\!!width\hsize\!!height3ex}}% - \wd0=\!!zeropoint\box0 + \wd0\zeropoint + \box0 \hbox to \hsize - {\hss\dorecurse{\!!counta}{#1[#2:\recurselevel]{\rule}\hss}}} + {\hss\dorecurse\!!counta{#1[#2:\recurselevel]{\rule}\hss}}} \endgraf} - \dorecurse{\!!counta}{\dododocomparecolorgroup\recurselevel}}} + \dorecurse\!!counta{\dododocomparecolorgroup\recurselevel}}} \protect \endinput diff --git a/tex/context/base/cont-cz.tex b/tex/context/base/cont-cz.tex index 05ac01287..84c0a5ca2 100644 --- a/tex/context/base/cont-cz.tex +++ b/tex/context/base/cont-cz.tex @@ -26,6 +26,6 @@ \installlanguage [\s!sk] [\c!status=\v!start] \installlanguage [\s!cz] [\c!status=\v!start] -\setupbodyfont [csr,rm,12pt] +\setupbodyfont [csr,ams,rm,12pt] \protect \errorstopmode \dump \endinput diff --git a/tex/context/base/cont-de.tex b/tex/context/base/cont-de.tex index 9e75bc0cf..314122ab9 100644 --- a/tex/context/base/cont-de.tex +++ b/tex/context/base/cont-de.tex @@ -31,6 +31,6 @@ \installlanguage [deo] [\c!status=\v!start] -\setupbodyfont [cmr,rm,12pt] +\setupbodyfont [cmr,ams,rm,12pt] \protect \errorstopmode \dump \endinput diff --git a/tex/context/base/cont-en.tex b/tex/context/base/cont-en.tex index bfd38e7ea..b84470695 100644 --- a/tex/context/base/cont-en.tex +++ b/tex/context/base/cont-en.tex @@ -29,6 +29,6 @@ \installlanguage [\s!it] [\c!status=\v!start] \installlanguage [\s!nl] [\c!status=\v!start] -\setupbodyfont [cmr,rm,12pt] +\setupbodyfont [cmr,ams,rm,12pt] \protect \errorstopmode \dump \endinput diff --git a/tex/context/base/cont-fil.tex b/tex/context/base/cont-fil.tex index f576bc699..d605583bb 100644 --- a/tex/context/base/cont-fil.tex +++ b/tex/context/base/cont-fil.tex @@ -34,6 +34,10 @@ \definefilesynonym [fig-fake] [fig-02] \definefilesynonym [fig-missing] [fig-06] +\definefilesynonym [res-make] [res-01] +\definefilesynonym [res-base] [res-04] +\definefilesynonym [res-trace] [res-08] + \definefilesynonym [pre-general] [pre-00] \definefilesynonym [pre-original] [pre-01] diff --git a/tex/context/base/cont-it.tex b/tex/context/base/cont-it.tex index 21d6418c7..4957f966e 100644 --- a/tex/context/base/cont-it.tex +++ b/tex/context/base/cont-it.tex @@ -29,6 +29,6 @@ \installlanguage [\s!it] [\c!status=\v!start] %\installlanguage [\s!nl] [\c!status=\v!start] -\setupbodyfont [cmr,rm,12pt] +\setupbodyfont [cmr,ams,rm,12pt] \protect \errorstopmode \dump \endinput diff --git a/tex/context/base/cont-log.tex b/tex/context/base/cont-log.tex index a8183398a..fc08efb60 100644 --- a/tex/context/base/cont-log.tex +++ b/tex/context/base/cont-log.tex @@ -29,41 +29,42 @@ {\def\next{#2}}% \next} -\unexpanded\def\CMRkern% +\unexpanded\def\CMRkern {\doifCMRfontelse{\kern}{\scratchdimen=}} -\def\TeX% +\def\TeX {T% \kern-.1667em\lower.5ex\hbox{E}% \kern-.125emX} -\def\ConTeXt% +\def\ConTeXt {C% \CMRkern-.0333emo% \CMRkern-.0333emn% - \CMRkern-.1667em\TeX% +% \CMRkern-.1667em\TeX% + \CMRkern-.0667em\TeX% \CMRkern-.0333emt} -\def\PPCHTeX% +\def\PPCHTeX {ppch\TeX} -\def\PRAGMA% +\def\PRAGMA {Pragma ADE} -%\def\LaTeX% +%\def\LaTeX % {L% % \kern-.30em\raise.3ex\hbox{\txx A}% % \kern-.18em\TeX} -\def\LaTeX% requested by erik frambach +\def\LaTeX % requested by erik frambach {{\setbox\scratchbox\hbox{L}% - \scratchdimen=\ht\scratchbox + \scratchdimen\ht\scratchbox \setbox\scratchbox\hbox{\txx A}% L\kern-.55\wd\scratchbox \raise\scratchdimen\hbox{\lower\ht\scratchbox\copy\scratchbox}% \kern-.2\wd\scratchbox\TeX}} -\def\TaBlE% +\def\TaBlE {T% \kern-.27em\lower.5ex\hbox{A}% \kern-.18emB% diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 1ebd70ba1..e7269d251 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -12,309 +12,901 @@ %C details. % manual : offsetbox alignbox - -% todo achtergronden in kolommen +% todo achtergronden in kolommen %D This file is loaded at runtime, thereby providing an %D excellent place for hacks and new features. \unprotect -% we don't register the paragraph characteristics, only the -% width +\def\filluparrangedpages % beware: \realpageno is 1 ahead + {\ifarrangingpages + \scratchcounter\realpageno + \advance\scratchcounter \minusone + \dosetmodulo\scratchcounter\arrangedpageT\scratchcounter + \ifcase\scratchcounter\else + \advance\scratchcounter \plusone + \dostepwiserecurse\scratchcounter\arrangedpageT\plusone + {\noheaderandfooterlines\ejectdummypage}% + \fi + \fi} + +% experiment, not yet to be used -\appendtoks - \setinnerparpositions % see "techniek" for application -\to \everytabulate +\def\displaybreak + {\ifhmode + \removeunwantedspaces + \ifcase\raggedstatus\hfill\fi + \strut\penalty-9999 % \break fails on case (3) + \fi} -\def\OTRSETnaturalflush - {\bgroup - \forgetall % new - \setbox0\vbox to \columnfreecells\lineheight - {\vskip-\topskip - \vskip\lineheight - \prevdepth\dp\strutbox - \unvbox\normalpagebox - \vfill}% - \setbox2\hbox - {\OTRSETplacebottomnotes}% - \setbox\scratchbox\hbox - {\wd0=\zeropoint\box0\box2}% - \dp\scratchbox\dp\strutbox - \OTRSEThandleflushedtext1 - \egroup} +\def\startdisplay{\displaybreak\ignorespaces\startopelkaar} +\def\stopdisplay {\stopopelkaar\displaybreak\ignorespaces} -\appendtoks \checkcurrentlayout \to \everystarttext +\def\tightvbox + {\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\vbox} +\def\tightvtop + {\dowithnextbox{\ht\nextbox\zeropoint\box\nextbox}\vtop} + +% cleaner -\def\flushfootnotes {\flushnotes} -\def\doflushfootnotes{\doflushnotes} +\def\@@nmpre#1{\doiftext{#1}{{#1}\tfskip}} +\def\@@nmpos#1{\doiftext{#1}{\tfskip{#1}}} + +% newer + +\def\@@nmprepos#1#2#3#4#5% + {\doifelsenothing\@@nmbreedte + {\doiftext{#5}{#1{#5}#2}} + {\doiftext{#5}{\hbox to \@@nmbreedte{#3{#5}#4}}}} + +\def\@@nmpre{\@@nmprepos\empty\tfskip\relax\hss} +\def\@@nmpos{\@@nmprepos\tfskip\empty\hss\relax} + +\def\doprocesstabskipline#1% + {\bgroup + \scratchcounter\plusone + \dodoprocesstabskipline#1\relax + \egroup} + +\def\dodoprocesstabskipline#1% + {\ifnum\scratchcounter>\spacespertab\relax + \donetrue \else \donefalse \advance + \fi \scratchcounter \plusone + \ifx#1\relax \else + \ifcase\tabskipmode + % can't happen + \or + % go on + \else\ifnum`#1<128 + % ok, no special character + \else\ifnum\catcode`#1=\active + % quits parsing, else utf lookahead problems + \chardef\tabskipmode\zerocount + \fi\fi\fi + \ifcase\tabskipmode + \@EAEAEA#1% + \else + \@EAEAEA#1\@EAEAEA\dodoprocesstabskipline + \fi + \fi} + +\setuptyping[\c!tab=\s!ascii] % better default than \v!yes -\def\usesubpath[#1]% - {\ifx\allinputpaths\empty - \edef\allinputpaths{#1}% +% obey eigennummer + +\def\doresetsectioncounters#1% + {\resetcounter{\??se#1}% + \letgvalue{\??se#1\c!eigennummer}\relax + \donexttracklevel{#1}} + +\def\@@shortsectionnumber#1% + {\@EA\ifx\csname\??se#1\c!eigennummer\endcsname\relax + \@EA\ifx\csname\??se#1\@@sectieblok\c!conversie\endcsname\relax + \@EA\ifx\csname\??se#1\c!conversie\endcsname\relax + \@@sectionvalue{#1}% + \else + \@@sectionconversion{#1}{\@@sectionvalue{#1}}% + \fi + \else + \@@sectionconversion{#1}{\@@sectionvalue{#1}}% + \fi \else - \def\docommando##1% - {\def\dodocommando####1{\addtocommalist{##1/####1}\allinputpaths}% - \processcommalist[#1]\dodocommando}% - \processcommacommand[\allinputpaths]\docommando + \csname\??se#1\c!eigennummer\endcsname \fi} + +\def\setsomeheadconversion#1#2% + {\someheadconversionfalse + \doifelsevalue{\??ko#1\c!eigennummer}\v!ja + {\setgvalue{\??se\@@sectie\c!eigennummer}{#2}% + \def\someheadconversion{#2}} + {\letgvalue{\??se\@@sectie\c!eigennummer}\relax + \bepaalkopnummer[#1]% + \@EA\ifx\csname\??se\@@sectie\@@sectieblok\c!kopconversie\endcsname\relax + \@EA\ifx\csname\??se\@@sectie\c!kopconversie\endcsname\relax + \def\someheadconversion{#2}% + \else + \@EA\ifx\csname\??se\@@sectie\c!kopconversie\endcsname\empty + \def\someheadconversion{#2}% + \else + \someheadconversiontrue + \def\someheadconversion% + {\fullsectionnumber{#1}{\getvalue{\??se\@@sectie\c!kopconversie}}{#2}}% + \fi + \fi + \else + \@EA\ifx\csname\??se\@@sectie\@@sectieblok\c!kopconversie\endcsname\empty + \def\someheadconversion{#2}% + \else + \someheadconversiontrue + \def\someheadconversion% + {\fullsectionnumber{#1}{\getvalue{\??se\@@sectie\@@sectieblok\c!kopconversie}}{#2}}% + \fi + \fi}} -\newif\ifboxhasframe +% pretty important (esp since we now ignore shipouts) +% +% actually we should nil all writes, marks, specials -\def\startlocalframed[#1][#2]% +\appendtoks \globallet\popcolor\relax \to \everylastshipout + +\def\doscalelikeafigure % quite dirty and potential interference possible + {\doifsomething{\@@xyfactor\@@xyhfactor\@@xybfactor\@@xyschaal + \@@xybreedte\@@xyhoogte\@@xyregels} + {\let \@@efschaal \@@xyschaal + \let \@@effactor \@@xyfactor + \let \@@efbfactor\@@xybfactor + \let \@@efhfactor\@@xyhfactor + \let \@@efbreedte\@@xybreedte + \let \@@efhoogte \@@xyhoogte + \let \@@efregels \@@xyregels + \let \@@epx \!!zeropoint + \let \@@epy \!!zeropoint + \edef\@@epw {\the\wd\nextbox}% + \edef\@@eph {\the\ht\nextbox}% + \figwid\zeropoint \figxsca\plusone % see note * (core-fig) + \fighei\zeropoint \figysca\plusone % see note * (core-fig) + \checkfiguresettings + \setfactorfiguresize + \setscalefiguresize + \setdimensionfiguresize + \convertfigureinsertscale\@@epx\figx\figxsca\scax + \convertfigureinsertscale\@@epy\figy\figysca\scay + \scratchdimen\scax\s!pt \divide\scratchdimen 100 + \edef\@@xysx{\withoutpt\the\scratchdimen}% + \scratchdimen\scay\s!pt \divide\scratchdimen 100 + \edef\@@xysy{\withoutpt\the\scratchdimen}}} + +\def\doschaal[#1]% {\bgroup - \inframedtrue - \edef\@@framed{#1}% - % this piece of pre expansion is needed (sometimes used in frameoffset) - % \doifvaluesomething{\@@framed\c!lijndikte} % obsolete - % {\ruledlinewidth\getvalue{\@@framed\c!lijndikte}}% obsolete - % this piece of pre expansion is needed (sometimes used circular) - \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 ! - \fi - % to get the right spacing - \doifvaluesomething{\@@framed\c!voorgrondletter} - {\@EA\doconvertfont\csname\@@framed\c!voorgrondletter\endcsname\empty}% - % beware, both the frame and background offset can be overruled - % - % the next macros are visible - \edef\localoffset{\getvalue{\@@framed\c!offset }}% - \edef\localwidth {\getvalue{\@@framed\c!breedte }}% - \edef\localheight{\getvalue{\@@framed\c!hoogte }}% - \edef\localformat{\getvalue{\@@framed\c!uitlijnen}}% - \edef\localstrut {\getvalue{\@@framed\c!strut }}% - % these are not - \edef\@@localframing {\getvalue{\@@framed\c!kader }}% - \edef\@@locallocation{\getvalue{\@@framed\c!plaats}}% - % - \ifx\@@localframing\v!overlay % no frame, no offset, no framewidth - \boxhasframefalse - \let\localoffset\v!overlay - \else\ifx\@@localframing\v!geen % no frame, no framewidth - \boxhasframefalse - \else - \boxhasframetrue - \fi\fi - \ifboxhasframe - \doifvaluesomething{\@@framed\c!lijndikte} - {\ruledlinewidth\getvalue{\@@framed\c!lijndikte}\relax - \ifinheritruledlinewidth\linewidth\ruledlinewidth\fi}% - \else - \ruledlinewidth\zeropoint - \fi - \ifx\localformat\empty - \boxhasformatfalse - \else - \boxhasformattrue - \dosetraggedcommand\localformat - \edef\dobeforeframedbox{\raggedtopcommand\getvalue{\@@framed\c!boven}}% - \edef\doafterframedbox {\getvalue{\@@framed\c!onder}\raggedbottomcommand}% - \fi - \ifx\localoffset\v!geen - \boxhasoffsetfalse - \boxhasstrutfalse - \boxisoverlaidfalse - \@@localoffset\ruledlinewidth - \else\ifx\localoffset\v!overlay -% \ifx\@@localframing\v!nee \boxhasframefalse \fi % test first - \boxhasoffsetfalse - \boxhasstrutfalse - \boxisoverlaidtrue - \@@localoffset\zeropoint - \else - \boxhasoffsettrue - \boxhasstruttrue - \boxisoverlaidfalse - \ifx\localoffset\v!default % new per 2-6-2000 - \let\localoffset\defaultframeoffset - \letvalue{\@@framed\c!offset}\defaultframeoffset + \forgetall + \getparameters + [\??xy] + [\c!schaal=,\c!breedte=,\c!hoogte=,\c!regels=, + \c!factor=,\c!hfactor=,\c!bfactor=, + \c!sx=1,\c!sy=1,#1]% + \dowithnextbox + {\dontshowcomposition + \ifdim\ht\nextbox>\zeropoint \ifdim\wd\nextbox>\zeropoint + \doscalelikeafigure + \dimen0=\@@xysy\ht\nextbox + \dimen2=\@@xysy\dp\nextbox + \dimen4=\@@xysx\wd\nextbox + \dimen6=\dimen0\advance\dimen6 \dimen2 +% \setbox\nextbox\vbox to \dimen6 +% {\ht\nextbox\zeropoint +% \dp\nextbox\zeropoint +% \vfill % erbij +% \dostartscaling\@@xysx\@@xysy\box\nextbox\dostopscaling}% + \setbox\nextbox\hbox + {\smashbox\nextbox + \dostartscaling\@@xysx\@@xysy\box\nextbox\dostopscaling}% + \ht\nextbox\dimen0 + \dp\nextbox\dimen2 + \wd\nextbox\dimen4 + \fi \fi + \box\nextbox + \egroup} + \hbox} + +\def\incrementvalue#1% + {\expandafter\increment\csname#1\endcsname} + +\def\decrementvalue#1% + {\expandafter\decrement\csname#1\endcsname} + +% \translateMPinput{il2-pl} +% +% \startMPenvironment[global] +% \setupbodyfont[plr] +% \stopMPenvironment +% +% \TeX: ± ¶ +% +% \startMPcode +% draw btex MetaPost: ± ¶ etex scaled 5 ; +% \stopMPcode + +\def\doMPpositiongraphic#1#2% tag setups + {\bgroup + \def\@@meta{#1:}% + \setupMPvariables[#2]% + \prepareMPpositionvariables + \MPshiftdrawingtrue + \def\doMPpositiongraphic##1##2% + {{% new, see (techniek) + \def\@@meta{##1:}% + \setupMPvariables[#2,##2]% + \prepareMPpositionvariables + % and needed + \getvalue{MPG:##1}}}% temp hack + \setbox\positiongraphicbox\hbox + {\ignorespaces + \executeifdefined{MPM:#1}{\executeifdefined{MPG:#1}\donothing}% + \removelastspace}% + \smashbox\positiongraphicbox + \box\positiongraphicbox + \egroup} + +\writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!} + +\def\columnhbreak + {\ifhmode + \bgroup + \removeunwantedspaces + \parfillskip\zeropoint + \OTRSETcolumnseparator + \par + \egroup + \fi} + +\installcolumnbreakhandler {SET} \v!lokaal + {\columnhbreak + \ejectinsert + \ejectpage} % brrr + % no \OTRSETsethsize, can be mid smaller (like tabulate) + +% We need to make sure that we really leave the column; mid +% column we may end up in an empty gap, and we don;t want to +% stay there (basically such a gap is a small empty page +% then). + +\installcolumnbreakhandler {SET} \v!ja + {\columnhbreak + \edef\savedmofcolumns{\the\mofcolumns}% + \edef\savedrealpageno{\the\realpageno}% + \ejectinsert + \ejectpage % brrr + \doloop + {\ifnum\savedmofcolumns=\mofcolumns + \ifnum\savedrealpageno=\realpageno + \OTRSETdummycolumn + \else + \exitloop + \fi + \else + \exitloop + \fi}} + +% testcase : pascal demo-bbi, paragraaf/aanduiding koppen + +\ifx\lastskipinotr\undefined \newskip\lastskipinotr \fi + +\installoutput\OTRSETflushpreposttext + {\global\setbox\precolumnbox\vbox + {\unvbox\normalpagebox + \global\lastskipinotr\lastskip}% + \ifdim\lastskipinotr>\zeropoint + \global\setbox\precolumnbox\hbox + {\lower\strutdepth\box\precolumnbox}% + \fi + \global\dp\precolumnbox\strutdepth + \ifcarryoverfootnotes \else + \global\setbox\postcolumnbox\vbox{\placebottomnotes}% + \fi} + +\def\dopositionaction#1% test saves hash entry in etex + {\ifundefined{\POSactionprefix#1::}\else + \ifnum\MPp{#1}>\zerocount % new +\setbox\scratchbox\hbox + \bgroup + \traceposstring\clap\red{<#1>}% + \the\everyinsertpositionaction + \the\everypositionaction + \ifcollectMPpositiongraphics + % can save a lot of run time + \pushMPdrawing + \MPshiftdrawingtrue + \resetMPdrawing + \getvalue{\POSactionprefix#1::}% + \ifMPdrawingdone + \getMPdrawing + \fi + \resetMPdrawing + \popMPdrawing + \else + \getvalue{\POSactionprefix#1::}% + \fi + \cleanuppositionaction{#1}% + \egroup +\smashedbox\scratchbox \else - \let\defaultframeoffset\localoffset + % shouldn't happen too often + \traceposstring\clap\cyan{<#1>}% \fi - \@@localoffset\localoffset - \advance\@@localoffset \ruledlinewidth - \fi\fi - \ifx\localwidth\v!passend - \ifboxhasformat - \boxhaswidthtrue - \!!widtha\hsize + \fi} + +\def\MPspacechar{\char32\relax} % old solution does not work with math + +\def\begintbl + {\doglobal\newcounter\colTBL + \doglobal\newcounter\rowTBL + \doglobal\decrement\rowTBL + \tabskip\zeropoint + \halign\bgroup +\registerparoptions + \ignorespaces##\unskip&&\ignorespaces##\unskip\cr} + +% \startcolumnset[two] \input tufte +% \startcolumnsetspan[two] \input tufte \stopcolumnsetspan +% \input tufte \stopcolumnset + +%D Well, here comes some real trickery. When we have the 100\% +%D spot color or black color, we don't want to erase the +%D background. So, instead we hide the content by giving it +%D zero transparency. + +% todo : #1#2#3 met #2 > of < and #3 een threshold + +% \newif\ifhidesplitcolor \hidesplitcolortrue + +\def\dohidecolor#1#2% + {\ifhidesplitcolor + \ifx#1#2% + \dostartgraycolormode\@@cl@@o \else - \boxhaswidthfalse + \fullytransparentcolor \fi - \else\ifx\localwidth\v!ruim - \boxhaswidthtrue - \!!widtha\hsize \else - \boxhaswidthtrue - \!!widtha\localwidth - \fi\fi - \ifx\localheight\v!passend - \boxhasheightfalse % no longer: \boxhasstrutfalse - \else\ifx\localheight\v!ruim - \boxhasheightfalse + \dostartgraycolormode\@@cl@@o + \fi} + +\def\dovidecolor#1#2% + {\ifhidesplitcolor + \ifx#1#2% + \fullytransparentcolor + \else + \dostartgraycolormode\@@cl@@o + \fi \else - \boxhasheighttrue - \!!heighta\localheight - \fi\fi - % this should be an option ! ! ! ! - \ifdim\!!widtha=\hsize - \parindent\zeropoint - \setlocalhsize - \!!widtha\localhsize - \fi - % i.e. disable (colsetbackgroundproblemintechniek) - \advance\!!widtha -2\@@localoffset - \advance\!!heighta -2\@@localoffset - \ifx\localstrut\v!nee - \boxhasstrutfalse + \dostartgraycolormode\@@cl@@o + \fi} + +\def\fullytransparentcolor + {\dostartgraycolormode\@@cl@@o % better than z + %\global\@EA\chardef\csname\@@currenttransparent\endcsname\plusone + %\global\intransparenttrue + \dostarttransparency10} + +\def\noexeccolorS#1:#2\od + {\edef\@@cl@@s{#1}% + \dohidecolor\@@cl@@s\@@cl@@o} + +\def\noexeccolorP#1:#2:#3\od + {\edef\@@cl@@p{#2}% + \dohidecolor\@@cl@@p\@@cl@@z} + +\def\doexeccolorPP#1:#2:% + {\edef\@@cl@@n{#1}% + \edef\@@cl@@p{#2}% + \registerusedspotcolor\@@cl@@n + \ifx\@@cl@@n\currentspotcolor + \normalizeSPOT + \dostartgraycolormode\@@cl@@p % was spotcolormode + \else + \dovidecolor\@@cl@@p\@@cl@@o \fi - \ifboxhasstrut - \setstrut - \let\localbegstrut\begstrut - \let\localendstrut\endstrut - \let\localstrut \strut + \exectransparency} + +% now in cont-loc.tex, for the sake of testing. +% +% %D When \type {\somecolor} is issued, we can savely assume +% %D grouping. Using \type {\groupedcommand} here (i.e.\ the +% %D definition of \type {\color}) is unsafe because in +% %D interferes with for instance switching attributes. +% +% \def\switchtocolor[#1]% +% {\bgroup\startcolor[#1] +% \aftergroup\stopcolor +% \aftergroup\egroup} + +% this supports: +% +% \starttypen +% \placelist[section][criterium=chapter,number=1] \blank +% \placelist[section][criterium=chapter,number=2] \blank +% \placelist[section][criterium=chapter,number=3] \blank +% +% \chapter{first} \section{AA} \section{BB} +% \chapter{second} \section{CC} \section{DD} +% \chapter{third} \section{EE} \section{FF} +% \stoptypen + +\def\dosettoclevel#1#2% + {\ifundefined{#1#2\c!nummer}% + \dosetfilterlevel{\getvalue{#1#2\c!criterium}}\empty \else - \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 - % \let\localstrut \relax % save afterall - %\fi\fi + \doifelsevaluenothing{#1#2\c!nummer}% + {\dosetfilterlevel{\getvalue{#1#2\c!criterium}}\empty} + {\setsectieenkoppeling{\getvalue{#1#2\c!criterium}}% + \dosetfilterlevel + {\previoussection\@@sectie}% + {\getvalue{#1#2\c!nummer}}}% + \fi} + +\def\GetPar + {\expanded + {\dowithpar + {\the\BeforePar + \BeforePar\emptytoks} + {\the\AfterPar + \BeforePar\emptytoks + \AfterPar\emptytoks}}} + +\def\GotoPar + {\expanded + {\dogotopar + {\the\BeforePar + \BeforePar\emptytoks}}} + +\def\@@somedefinitie#1[#2]#3% + {\dowithpar + {\bgroup\executedoordefinitie{#1}[#2]{#3}}% + {\@@stopdefinitie{#1}}} + +% test this for a long time, esp since from now on, by default +% \commands are not expanded + +\setupreferencing + [\c!expansie=\v!nee] + +\def\dotextreference[#1]#2% + {\bgroup + \def\asciia{#1}% + \convertexpanded\??rf{#2}\asciib + \@EA\rawtextreference\@EA\s!txt\@EA\asciia\@EA{\asciib}% + \egroup} + +\def\dopagereference[#1]% + {\rawpagereference\s!pag{#1}} + +\def\doreference[#1]#2% + {\bgroup + \def\asciia{#1}% + \convertexpanded\??rf{#2}\asciib + \@EA\rawreference\@EA\s!ref\@EA\asciia\@EA{\asciib}% + \egroup} + +\def\hyphenationpoint + {\hskip\zeropoint} + +\def\hyphenated#1% + {\bgroup + \!!counta\zerocount + \def\hyphenated##1{\advance\!!counta\plusone}% + \handletokens#1\with\hyphenated + \!!countb\plusone + \def\hyphenated##1% + {##1% + \advance\!!countb\plusone\relax + \ifnum\!!countb>2 \ifnum\!!countb<\!!counta + \hyphenationpoint + \fi\fi}% + \handletokens#1\with\hyphenated + \egroup} + +\def\obeysupersubletters + {\let\super\normalsuper + \let\suber\normalsuber + \let\normalsuper\letterhat + \let\normalsuber\letterunderscore + \enablesupersub} + +\def\obeysupersubmath + {\let\normalsuper\letterhat + \let\normalsuber\letterunderscore + \enablesupersub} + +%\let\normaltype\type +% +%\def\type#1% +% {\expanded{\normaltype{\detokenize{#1}}}} + +% {x123 \os x123} {\tfa x123 \os x123} {x123 \tx x123 \os x123} +% \definefontsynonym[OldStyle][Serif] +% {x123 \os x123} {\tfa x123 \os x123} {x123 \tx x123 \os x123} + +% testen : +% +% \appendtoks +% \let\registerparoptions\relax +% \to \everyforgetall + +\newsignal\noblanksignal + +\def\docomplexdoblanko[#1]% pas op \relax's zijn nodig ivm volgende \if + {\global\blankoresetfalse + \global\blankoblokkeerfalse + \global\blankogeenwitfalse + \global\lokaalblankoflexibelfalse + \global\lokaalblankovastfalse + \global\blankoskip\zeropoint + \global\blankoforceerfalse + \blankobuitenfalse + \expanded{\rawprocesscommalist[#1]}\doblanko + \ifdim\blankoskip=\zeropoint\relax + \iflokaalblankoflexibel + \doglobal\advance\blankoskip \currentblanko + \else\iflokaalblankovast + \doglobal\advance\blankoskip \currentblanko + \fi\fi \fi - \ifboxhasheight - \let\\\vboxednewline - \ifboxhaswidth - \let\hairline\vboxedhairline - \ifboxhasformat - \let\next\doformatboxSomeFormat - \else - \let\next\doformatboxNoFormat + \ifblankobuiten + \else + \par + \ifvmode %in pos fonts gaat dit mis + \ifblankoforceer%\ifdim\prevdepth>\zeropoint\else + % -1000pt signals top of page or column (\ejectcolumn) + \vbox{\strut}\kern-\lineheight \fi - \else - \let\hairline\hboxedhairline - \ifboxhasformat - \let\next\doformatboxHeight + \ifblankoblokkeer + \global\doeblankofalse + \ifgridsnapping + \ifdim\prevdepth<\zeropoint + % brrr + \else + % dirty trick: smaller blanks are ignored after + % a larger one, so 10 lines is probably safe; first make + % sure that we honor penalties + \scratchcounter\lastpenalty + % now comes the trick (cross our fingers that this works + % well in multi columns; maybe an ifinner test is needed + % \vskip-10\lineheight + % \ifnum\scratchcounter=\zerocount \else \penalty\lastpenalty \fi + % \vskip 10\lineheight + % allas, this leads to overfull pages, so we try this: + \kern-\noblanksignal + \ifnum\scratchcounter=\zerocount + \else + \penalty\lastpenalty + \fi + \kern\noblanksignal + % end-of-dirty-trick + \fi + \else + \ifdim\prevdepth<\zeropoint + % brrr + \else + % ensure at least a proper prevdepth, this should be + % an option + \vskip-\prevdepth + \vskip\strutdepth + \prevdepth\strutdepth + \fi + % the old crappy piece of code + \edef\oldprevdepth{\the\prevdepth}% + \prevdepth\newprevdepth + \fi \else - \let\next\doformatboxVSize + \global\doeblankotrue \fi - \fi - \else - \ifboxhaswidth - \ifboxhasformat - \let\hairline\vboxedhairline - \let\\\vboxednewline - \let\next\doformatboxWidth - \else - \let\hairline\hboxedhairline - \let\\\hboxednewline - \let\next\doformatboxHSize + \ifblankoreset + \global\doeblankotrue + \ifgridsnapping + % let's play safe and not fool around with the depth, if + % only because it took a lot of effort to sort out the grid + % stuff in the first place + \else + \ifdim\prevdepth=\newprevdepth + \prevdepth\oldprevdepth + \fi + \fi + \fi + \ifdoeblanko + \ifdim1\lastskip<1\blankoskip\relax + % else when \blanko[2*groot] + \blanko[3*groot] with parskip + % equaling 1*groot, gives a groot=\parskip so adding a small + % value makes it distinguishable; can also be done at parskip + % setting time (better) + \global\advance\blankoskip \mindimen\relax % = skip + % test this on 2* + 3* and parskip groot + \ifblankogeenwit + \global\advance\blankoskip -\parskip + \else + \ifdim\lastskip=\parskip + \else % force this due to previous comment + \ifdim\parskip>\zeropoint\relax + \ifdim\blankoskip<\parskip\relax + \global\blankoskip\zeropoint + \else + \global\advance\blankoskip -\parskip + \fi + \fi + \fi + \fi + \ifblankoflexibel \else + \blankoskip1\blankoskip + \fi + \iflokaalblankovast + \blankoskip1\blankoskip + \fi + \iflokaalblankoflexibel + \blankoskip1\blankoskip + \!!plus\skipgluefactor\blankoskip + \!!minus\skipgluefactor\blankoskip + \fi + \ifgridsnapping + \ifdim\lastkern=\noblanksignal + \global\doeblankofalse + \fi + \else + \ifdim\prevdepth=\newprevdepth + \global\doeblankofalse + \fi + \fi + \ifdoeblanko + \iffuzzyvskip + \removelastfuzzyvskip + \fuzzyvskip\blankoskip\relax + \else + \removelastskip + \vskip\blankoskip\relax + \fi + \fi + \else + \iffuzzyvskip + \removelastfuzzyvskip + \fuzzyvskip\blankoskip\relax + \else + % new, test this on pascal + \ifdim\blankoskip<\zeropoint + \advance\blankoskip-\lastskip + \removelastskip + \ifdim\blankoskip>\zeropoint + \vskip\blankoskip + \else + \vskip\zeropoint + \fi + \else + % also new + \ifdim\blankoskip=\zeropoint + \ifblankogeenwit + \geenwitruimte + \fi + \fi + \fi + \fi + \fi \fi - \else - \let\hairline\hboxedhairline - \let\\\hboxednewline - \let\next\doformatboxNoSize - \fi - \fi - \edef\framedwidth % a new feature, visible fo ruser - {\ifdim\!!widtha >\zeropoint\the\!!widtha \else\zeropoint\fi}% - \edef\framedheight% a new feature, visible fo ruser - {\ifdim\!!heighta>\zeropoint\the\!!heighta\else\zeropoint\fi}% - % first alternative - %\def\dowithframedbox% - % {\let\postprocessframebox\undefined %new - % \aftergroup\stoplocalframed}% - % \afterassignment\dowithframedbox - % \setbox\framebox=\next} - % second alternative - %\dowithnextbox - % {\setbox\framebox=\box\nextbox - % \let\postprocessframebox\undefined %new - % \stoplocalframed} - % \next} - % third alternative - \afterassignment\dodowithframebox - \setbox\framebox\next} - -\def\stoplocalframed% - {\dontshowcomposition - \ifboxhasformat - \ifx\localwidth\v!passend - \ifreshapeframebox\doreshapeframedbox\fi - \boxhaswidthfalse - \else - \resetshapeframebox \fi - \else - \resetshapeframebox - \fi - \ifboxhaswidth - \wd\framebox\!!widtha \fi - \ifboxhasheight - \ht\framebox\!!heighta - \fi - \doifvalue{\@@framed\c!leeg}\v!ja - {\setbox\scratchbox\null - \wd\scratchbox\wd\framebox - \ht\scratchbox\ht\framebox - \dp\scratchbox\dp\framebox - \setbox\framebox\box\scratchbox}% - \stopregistercolor - \docolorframebox - \ifboxhasoffset - \dooffsetframebox - \fi - \ifboxisoverlaid \else - \dolocateframebox - \fi - \ifx\postprocessframebox\undefined \else - \postprocessframebox\framebox - \fi - \edef\overlaylinecolor{\getvalue{\@@framed\c!kaderkleur}}% - \edef\overlaylinewidth{\the\ruledlinewidth}% \@@... - \ifboxhasframe % real or invisible frame - \doframedbox - \fi - \doifvaluesomething{\@@framed\c!achtergrond}\dobackedbox - \ifx\@@locallocation\v!laag - \doinlineframedbox - \else\ifx\@@locallocation\v!diepte - \doloweredframedbox - \fi\fi - \box\framebox - \egroup + \global\fuzzyvskipfalse + \presetindentation} + +\def\processfilelinesverbatim#1#2#3% + {\bgroup + \let\saveddoflushverbatimline\doflushverbatimline + \let\saveddoemptyverbatimline\doemptyverbatimline + \def\checkverbatimfileline##1% + {\ifnum\verbatimlinenumber<#2\else + \ifnum\verbatimlinenumber>#3\else + ##1% + \fi\fi}% + \def\doflushverbatimline + {\checkverbatimfileline\saveddoflushverbatimline}% + \def\doemptyverbatimline + {\checkverbatimfileline\saveddoemptyverbatimline}% + \processfileverbatim{#1}% \egroup} + +\def\typefile + {\dodoubleempty\dotypefile} + +\def\dotypefile[#1][#2]#3% + {\ifsecondargument + \dodotypefile[#1][#2]{#3}% + \else\iffirstargument + \doifassignmentelse{#1} + {\dodotypefile[\v!file][#1]{#3}} + {\dodotypefile[#1][]{#3}}% + \else + \dodotypefile[\v!file][]{#3}% + \fi\fi} + +\def\dosetuptypelinenumbering#1#2% + {\setuptyping[#1][\c!start=,\c!stop=,\c!stap=,\c!nregels=,#2]% + \doifelsevalue{\??tp#1\c!nummeren}\v!file + {\stelregelnummerenin[\c!methode=\v!file]% + \donetrue} + {\doifelsevalue{\??tp#1\c!nummeren}\v!regel + {% \stelregelnummerenin defaults start/step to 1/1, so we need + \doifvaluenothing{\??tp#1\c!start}{\setvalue{\??tp#1\c!start}{1}}% + \doifvaluenothing{\??tp#1\c!stap }{\setvalue{\??tp#1\c!stap }{1}}% + \stelregelnummerenin + [\c!methode=\v!type, + \c!start=\getvalue{\??tp#1\c!start}, + \c!stap=\getvalue{\??tp#1\c!stap}]% + \donetrue} + {\donefalse}}% + \ifdone + \def\beginofverbatimlines{\startregelnummeren}% + \def\endofverbatimlines {\stopregelnummeren }% + \fi} + +\def\dodotypefile[#1][#2]#3% + {\getvalue{\??tp#1\c!voor}% + \doiflocfileelse{#3} + {\startopelkaar % includes \bgroup + \dosetuptypelinenumbering{#1}{#2}% + \doifinset{\getvalue{\??tp#1\c!optie}}{\v!commandos,\v!schuin,\v!normaal} + {\setuptyping[#1][\c!optie=\v!geen]}% + \doifvalue{\??tp#1\c!optie}\v!kleur + {\expandafter\aftersplitstring#3\at.\to\prettyidentifier + \letvalue{\??tp#1\c!optie}\prettyidentifier}% + \initializetyping{#1}% + \startverbatimcolor + \makelocreadfilename{#3}% + \doifundefinedelse{\??tp#3\v!globaal\c!start} + {\scratchcounter\zerocount} + {\scratchcounter\getvalue{\??tp#3\v!globaal\c!start}}% + \advance\scratchcounter\plusone + \setxvalue{\??tp#3\v!globaal\c!start}{\the\scratchcounter}% + \doifelsevaluenothing{\??tp#1\c!start} + {\processfileverbatim\readfilename} + {\doifvalue{\??tp#1\c!start}\v!verder + {\setevalue{\??tp#1\c!start}% + {\getvalue{\??tp#3\v!globaal\c!start}}}% + \doifelsevaluenothing{\??tp#1\c!stop} + {\doifelsevaluenothing{\??tp#1\c!nregels} + {\processfileverbatim\readfilename} + {\scratchcounter\getvalue{\??tp#1\c!start}% + \advance\scratchcounter\getvalue{\??tp#1\c!nregels}% + \advance\scratchcounter\minusone + \setxvalue{\??tp#3\v!globaal\c!start}% + {\the\scratchcounter}% + \processfilelinesverbatim\readfilename + {\getvalue{\??tp#1\c!start}} + {\getvalue{\??tp#3\v!globaal\c!start}}}}% + {\processfilelinesverbatim\readfilename + {\getvalue{\??tp#1\c!start}} + {\getvalue{\??tp#1\c!stop }}}}% + \stopverbatimcolor + \stopopelkaar} % includes \egroup + {\bgroup + \expanded{\convertargument#3}\to\ascii + \tttf[\makemessage\m!verbatims1\ascii]% + \showmessage\m!verbatims1\ascii + \egroup}% + \getvalue{\??tp#1\c!na}} + +% \setuptyping[file][numbering=file] +% +% \typefile[start=2,nlines=3]{zapf} +% \typefile[start=continue,nlines=13]{zapf} +% \typefile{zapf} +% +% \setuptyping[file][numbering=line] +% +% \typefile[start=4,step=3]{zapf} +% \typefile{zapf} -%D This alternative is slower, since it works on top of the -%D color (stack) mechanism, but it does provide nesting. +\def\startgridcorrection + {\dosingleempty\dostartgridcorrection} + +\def\dostartgridcorrection[#1]% + {\ifgridsnapping + \iffirstargument\doifsomething{#1}{\verplaatsopgrid[#1]}\fi + \snaptogrid\vbox\bgroup + \else + \startbaselinecorrection + \fi} + +\def\stopgridcorrection + {\ifgridsnapping + \egroup + \else + \stopbaselinecorrection + \fi} + +\def\checkgridsnapping + {\lineskip\ifgridsnapping\zeropoint\else\normallineskip\fi} + +\def\splittblbox#1% #1 <> 0/2 + {\ifinsidefloat + \unvbox#1% + \else + % spacing between rows gets lost in split + \setbox4\vbox + {\doifsomething\tbltbltussenwit{\blank[\tbltbltussenwit]}}% + \setbox2\vbox + {}% + \dorecurse\noftblheadlines + {\setbox0\vsplit#1 to \lineheight + \setbox2\vbox{\unvcopy2\unvcopy0}}% + \ifcase\noftblheadlines\else\unvcopy2\fi + \donefalse + \doloop + {\setbox0\vsplit#1 to \lineheight + \ifdim\pagegoal<\maxdimen + \setbox0\vbox{\unvbox0}% + \dimen0\ht0 + \advance\dimen0\ht4 + \advance\dimen0\pagetotal + \ifdim\dimen0>\pagegoal + \bgroup \pagina \egroup % make sure that local vars are kept + \ifcase\noftblheadlines\else\unvcopy2\fi + \fi + \fi + \ifdone + \doifsomething\tbltbltussenwit{\blank[\tbltbltussenwit]}% + \fi + \unvbox0 + \allowbreak + \ifvoid#1 \exitloop \else \donetrue \fi}% + \fi} + +\def\startplaatsen + {\dosingleempty\dostartplaatsen} + +\def\dostartplaatsen[#1]% tzt n*links etc + {\endgraf + \noindent\bgroup + \setlocalhsize + \hbox to \localhsize\bgroup + \doifnot{#1}\v!links\hss + \def\stopplaatsen + {\unskip\unskip\unskip + \doifnot{#1}\v!rechts\hss + \egroup + \egroup + \endgraf}% + \gobblespacetokens} + +% \startplaatsen[links] bla \stopplaatsen + +% we don't register the paragraph characteristics, only the +% width + +\appendtoks + \setinnerparpositions % see "techniek" for application +\to \everytabulate + +\appendtoks \checkcurrentlayout \to \everystarttext + +\def\flushfootnotes {\flushnotes} +\def\doflushfootnotes{\doflushnotes} + +%D This alternative is slower, since it works on top of the +%D color (stack) mechanism, but it does provide nesting. \def\dosetrastercolor#1% {\edef\@@cl@@s{#1}% \ifx\@@cl@@s\empty - \let\@@rsraster + \let\@@cl@@s\@@rsraster \fi \setevalue{\??cr\??rs}{\colorSpattern}} -\def\localstartraster[#1]% - {\bgroup\dosetrastercolor{#1}\localstartcolor[\??rs]} +% beware, don't add extra grouping, else color in tables +% fails -\def\localstopraster - {\localstopcolor\egroup} +\def\localstartraster[#1]% + {\ifincolor\dosetrastercolor{#1}\localstartcolor[\??rs]\fi} \def\startraster[#1]% - {\bgroup\dosetrastercolor{#1}\startcolor[\??rs]} + {\ifincolor\dosetrastercolor{#1}\startcolor[\??rs]\fi} -\def\stopraster - {\stopcolor\egroup} +\def\localstopraster{\ifincolor\localstopcolor\fi} +\def\stopraster {\ifincolor\stopcolor\fi} \def\fontclassname#1#2% {\ifcsname\??ff#1#2\endcsname @@ -329,24 +921,32 @@ {\dotripleargument\dodefineclassfontsynonym} \def\dodefineclassfontsynonym[#1][#2][#3]% - {\definefontsynonym[#1][\fontclassname{#2}{#3}]} + {\definefontsynonym[#1][\fontclassname{#2}{#3}]} -%\definefontsynonym [KopFont] [\fontclassname{officina}{SerifBold}] +%\definefontsynonym [KopFont] [\fontclassname{officina}{SerifBold}] % -%\defineclassfontsynonym [KopFont] [officina] [SerifBold] +%\defineclassfontsynonym [KopFont] [officina] [SerifBold] -\def\woordrechts % zie naw +\def\woordrechts % zie naw {\groupedcommand - {\hfill\allowbreak\strut\hfill\hbox} - {\parfillskip\zeropoint\par}} + {\removeunwantedspaces + \hfill + \hskip\zeropoint % permit break, \allowbreak fails here + \strut + \hfill + \quad % decent spacing + \hbox} + {\parfillskip\zeropoint + \par}} -\def\startkolomopmaak % don't change +\def\startkolomopmaak % don't change {\bgroup - \getrawnoflines\teksthoogte % teksthoogte kan topskip hebben, dus raw + \getrawnoflines\teksthoogte % teksthoogte kan topskip hebben, dus raw \scratchdimen\noflines\lineheight \advance\scratchdimen-\lineheight \advance\scratchdimen\topskip - \setbox\scratchbox\vbox to \scratchdimen\bgroup} + \setbox\scratchbox + \ifcase\showgridstate\vbox\else\ruledvbox\fi to \scratchdimen\bgroup} \def\stopkolomopmaak {\egroup @@ -355,9 +955,7 @@ \box\scratchbox \egroup} -\writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!} - -% todo : hoe komt box er uit +% todo : hoe komt box er uit \long\def\startexternalfigure {\dotripleempty\dostartexternalfigure} @@ -365,11 +963,11 @@ \long\def\dostartexternalfigure[#1][#2][#3]#4\stopexternalfigure {\gdef\figuredescription{#4}% \externalfigure[#1][#2][#3]% - \global\let\figuredescription\empty} + \globallet\figuredescription\empty} \let\figuredescription\empty -% very experimental +% very experimental \def\redoanalyzefigurefiles#1% {\ifcase\figurestatus @@ -391,257 +989,6 @@ \doanalyzefigurefiles\doanalyzefigurefilesB \doanalyzefigurefiles\doanalyzefigurefilesC} -\def\regelweergave - {\@@rnlinks\convertnumber\@@rnconversie\linenumber\@@rnrechts} - -% extension to page-lin - -\def\dodoschrijfregelnummer% - {% beware of em's, the font is already switched ! - \setbox\scratchbox\hbox - {\setbox0\hbox{\@@rncommando{\regelweergave}}\vsmashbox0% - \ifcase\linenumberlocation - \rlap{\hbox to \@@rnbreedte{\box0\hss}}% was \llap, nog testen !! - \or - %\llap{\hbox to \@@rnbreedte{\hss\box0\hskip\linkermargeafstand}}% - \inleftmargin - {\forgetall - \doifelse\@@rnbreedte\v!marge - {\hsize\linkermargebreedte}{\hsize\@@rnbreedte}% - \alignedline\@@rnuitlijnen\v!rechts{\box0\hskip\@@rnafstand}}% - \else - \inrightmargin - {\forgetall - \doifelse\@@rnbreedte\v!marge - {\hsize\rechtermargebreedte}{\hsize\@@rnbreedte}% - \alignedline\@@rnuitlijnen\v!links{\hskip\@@rnafstand\box0}}% - \fi}% - \vsmashbox\scratchbox - \box\scratchbox} - -\stelregelnummerenin - [\c!breedte=\ifcase\linenumberlocation2em\else\v!marge\fi, - \c!links=, - \c!rechts=, - \c!commando=, - \c!afstand=\zeropoint, - \c!uitlijnen=\ifcase\linenumberlocation\v!rechts\or\v!rechts\or\v!links\fi] - -% another one - -\newevery \everylinenumber \relax - -\let\normaldodoschrijfregelnummer\dodoschrijfregelnummer - -\def\dodoschrijfregelnummer - {\normaldodoschrijfregelnummer - \the\everylinenumber} - -% new - -\newcounter\linenotecounter -\newtoks \collectedlinenotes -\newif \iftracelinenotes - -\appendtoks - \the\collectedlinenotes -\to \everylinenumber - -\appendtoks - \global\collectedlinenotes\emptytoks -\to \beforeeverylinenumbering - -\def\handlelinenote#1#2% - {\bgroup - \expanded{\beforesplitstring#1}\at--\to\linenotelinenumber - \ifnum\linenotelinenumber=\linenumber\relax - % todo: \onlyfootnote{#1}{#2}% == configurable - \setupfootnotes[\c!nummercommando=\gobbleoneargument]% - \footnotetext{#1: #2}% - \fi - \egroup} - -\def\tracedlinenote#1% - {\iftracelinenotes - \hbox to \zeropoint - {\forgetall - \localcolortrue - \hsize\zeropoint - \hss - \vbox to \strutheight{\llap{\red\infofont\setstrut\linenotecounter}\vss}% - {\blue\vl}% - \vbox to \strutheight{\rlap{\red\infofont\setstrut#1}\vss}% - \hss}% - \prewordbreak - \fi} - -\def\linenote#1% - {\doglobal\increment\linenotecounter - \doifreferencefoundelse{\??rr:\linenotecounter}% - {\doglobal\@EA\appendtoks\@EA\handlelinenote\@EA - {\currenttextreference}{#1}\to\collectedlinenotes} - {}% - \tracedlinenote\empty - \expanded{\eenregel[\??rr:\linenotecounter]}} - -\def\startlinenote[#1]#2% - {\doifreferencefoundelse{\??rr:#1}% - {\doglobal\@EA\appendtoks\@EA\handlelinenote\@EA - {\currenttextreference}{#2}\to\collectedlinenotes} - {}% - \tracedlinenote{#1}% - \startregel[\??rr:#1]} - -\def\stoplinenote[#1]% - {\stopregel[\??rr:#1]} - -% \startbuffer[test] -% \startlinenumbering[100] -% test \linenote {oeps} test test test test test test -% test \startlinenote [well] {oeps} test test test test test test -% test \linenote {oeps} test test test test test test -% test \linenote {oeps} test test test test test test -% test \linenote {oeps} test test test test test test -% test \linenote {oeps} test test test test test test -% test \stoplinenote [well] test test test test test test -% \stoplinenumbering -% \stopbuffer -% -% {\typebuffer[test] \getbuffer[test]} \page -% -% \startbuffer[setup] -% \setuplinenumbering -% [align=left] -% \stopbuffer -% -% {\typebuffer[setup] \getbuffer[setup,test]} \page -% -% \startbuffer[setup] -% \setuplinenumbering -% [width=1em, -% align=left] -% \stopbuffer -% -% {\typebuffer[setup] \getbuffer[setup,test]} \page -% -% \startbuffer[setup] -% \setuplinenumbering -% [width=2em, -% distance=.5em, -% align=left] -% \stopbuffer -% -% {\typebuffer[setup] \getbuffer[setup,test]} \page -% -% \startbuffer[setup] -% \setuplinenumbering -% [width=2em, -% align=middle] -% \stopbuffer -% -% {\typebuffer[setup] \getbuffer[setup,test]} \page -% -% \startbuffer[setup] -% \setuplinenumbering -% [conversion=romannumerals, -% start=1, -% step=1, -% location=text, -% style=slanted, -% color=blue, -% width=1.5em] -% \stopbuffer -% -% {\typebuffer[setup] \startnarrower\getbuffer[setup,test]\stopnarrower} \page -% -% \startbuffer[setup] -% \setuplinenumbering -% [width=4em, -% left=--, -% right=--, -% align=middle] -% \stopbuffer -% -% {\typebuffer[setup] \getbuffer[setup,test]} \page -% -% \startbuffer[setup-1] -% \setuplinenumbering -% [style=\bfxx, -% command=\WatchThis] -% \stopbuffer -% -% \startbuffer[setup-2] -% \def\WatchThis#1% -% {\ifodd\linenumber -% \definecolor[linecolor][red]% -% \else -% \definecolor[linecolor][green]% -% \fi -% \inframed -% [offset=1pt,frame=off,background=color,backgroundcolor=linecolor] -% {#1}} -% \stopbuffer -% -% {\typebuffer[setup-1,setup-2] \getbuffer[setup-1,setup-2,test]} \page -% -% \startbuffer[setup-1] -% \setuplinenumbering -% [location=inright, -% style=\bfxx, -% command=\WatchThis] -% \stopbuffer -% -% {\typebuffer[setup-1] \getbuffer[setup-1,setup-2,test]} \page - -\def\OTRSETgotocell#1#2% not that robust - {\endgraf - \gdef\gotocellcounter{0}% - \doloop - {\ifnum\mofcolumns<#1\relax - \doglobal\increment\gotocellcounter\relax - \ifnum\gotocellcounter>#1\relax - \line{\strut}\crlf - \line{\strut}\crlf - \kolom % \column - \writestatus{columnset}{quitting goto cell}% - \exitloop - \else - \kolom % \column - \fi - \else - \exitloop - \fi}% - \ifnum\mofcolumns=#1\relax - \ifnum#2>1 - \scratchcounter=0 - \currenthcell\mofcolumns - \currentvcell#2\advance\currentvcell -1 - \dorecurse\currentvcell - {\OTRSETdoifcellelse\mofcolumns\recurselevel\donothing - {\advance\scratchcounter1\relax}} - \getnoflines\pagetotal - \advance\scratchcounter-\noflines - \ifnum\scratchcounter>0 - \dorecurse\scratchcounter{\line{\strut}}% - \fi - \fi - \fi - \OTRSETsetvsize} - -\def\setlocalfloatdimensions#1#2% experimental ! ! ! ! - {\doifvaluesomething{\??fl#1\c!maxbreedte} - {\scratchdimen=\getvalue{\??fl#1\c!maxbreedte}\relax - \ifdim\wd\nextbox>\scratchdimen - \setbox\nextbox=\hbox to \scratchdimen - {\doifcommonelse{\v!rechts,\v!inrechter,\v!links,\v!inlinker}{#2} - {\doifnotcommon{\v!rechts,\v!inrechter}{#2}\hss - \box\nextbox - \doifnotcommon{\v!links ,\v!inlinker }{#2}\hss}% - {\doifvalue{\??fl#1\c!plaats}\v!rechts\hss - \box\nextbox - \doifvalue{\??fl#1\c!plaats}\v!links \hss}}% - \fi}} - \def\phantombox[#1]% {\hbox\bgroup \getparameters @@ -663,212 +1010,40 @@ {\long\noexpand\def\noexpand\xdostartsetups##1##2\csname\e!stop\e!instellingen\endcsname% {\egroup \long\noexpand\setvalue{\??su##1}{##2}}} - -\def\startsetups#1 % for international purposes - {\bgroup - \catcode`\^^M=\@@ignore - \dostartsetups{#1}} - -\long\def\dostartsetups#1#2\stopsetups - {\egroup - \long\setvalue{\??su#1}{#2}} - -\def\definefont - {\dotripleempty\dodefinefont} - -\def\dodefinefont[#1][#2][#3]% [name][spec][1.6 | line=10pt | setup_id] - {\doifinstringelse{ }{#2} - {\ifthirdargument - \unexpanded\setvalue{#1}{\redodefinefont{#1}{#2}{#3}}% - \else - \unexpanded\setvalue{#1}{\dododefinefont{#1}{#2}}% - \fi} - {\definefont[#1][#2 sa 1][#3]}} - -\def\redodefinefont#1#2#3% - {\dododefinefont{#1}{#2}% - \doifnumberelse{#3} - {\stelinterliniein[#3]\stelspatieringin} - {\doifassignmentelse{#3} - {\stelinterliniein[#3]\stelspatieringin} - {\setups[#3]}}} - -% \def\defineclassfont -% {\doquadrupleempty\dodefineclassfont} -% -% \def\dodefineclassfont[#1][#2][#3][#4]% #2 = class -% {\iffourthargument -% \definefont[#1][#2#3][#4]% -% %\else\ifthirdargument -% % \definefont[#1][#2#3]% -% \else -% \definefont[#1][#2]% -% \fi} - -% todo, but now more easy to do:\definepage - -\def\docomplexpagina[#1]% - {\flushnotes - \bgroup - \def\dodocomplexpagina##1% - {\csname - @@\v!pagina\ifundefined{@@\v!pagina##1}\s!unknown\else##1\fi - \endcsname}% - \processcommalist[#1]\dodocomplexpagina - \egroup} - -\def\installpagehandler#1#2% - {\setvalue{@@\v!pagina#1}{#2}} - -\installpagehandler \s!unknown - {\let\@@pagespecification\commalistelement - \doifinstringelse{+}\@@pagespecification - {\ejectinsert\ejectpage - \dorecurse\@@pagespecification\ejectdummypage} - {\doifnumberelse\@@pagespecification - {\ejectinsert\ejectpage - \doloop - {\ifnum\userpageno<\@@pagespecification\relax - \ejectdummypage - \else - \exitloop - \fi}} - {}}} - -\installpagehandler \s!default - {} % do nothing if empty - -\installpagehandler \v!reset - {\global\paginageblokkeerdfalse} - -\installpagehandler \v!blokkeer - {\global\paginageblokkeerdtrue} - -\installpagehandler \v!ja - {\ifpaginageblokkeerd\else - \ejectinsert - \ejectpage - \ifbinnenkolommen - \ejectpage % anders soms geen overgang - \fi - \fi} - -\installpagehandler \v!opmaak - {\ifpaginageblokkeerd\else - \eject - \fi} - -\installpagehandler \v!blanko - {\pagebodyornamentsfalse} - -\installpagehandler \v!nee - {\ifpaginageblokkeerd\else - \dosomebreak\nobreak - \fi} - -\installpagehandler \v!voorkeur - {\ifpaginageblokkeerd\else - \ifbinnenkolommen - \dosomebreak\goodbreak - \else - \testpagina[3][\!!zeropoint]% - \fi - \fi} - -\installpagehandler \v!grotevoorkeur - {\ifpaginageblokkeerd\else - \ifbinnenkolommen - \dosomebreak\goodbreak - \else - \testpagina[5][\!!zeropoint]% - \fi - \fi} - -\installpagehandler \v!leeg - {\ejectinsert - \ejectpage - \doifnotvalue{\??tk\v!hoofd\c!status}{\v!stop} - {\setupheader[\c!status=\v!leeg]}% - \doifnotvalue{\??tk\v!voet\c!status}{\v!stop} - {\setupfooter[\c!status=\v!leeg]}% - \ejectdummypage} - -\installpagehandler \v!links - {\ejectinsert - \superejectpage - \doifbothsidesoverruled - \orsideone - \resetcurrentsectionmarks - \ejectdummypage - \orsidetwo - \od} - -\installpagehandler \v!rechts - {\ejectinsert - \superejectpage - \doifbothsidesoverruled - \orsideone - \orsidetwo - \resetcurrentsectionmarks - \ejectdummypage - \od} - -\installpagehandler \v!even - {\pagina - \doifonevenpaginaelse - {\resetcurrentsectionmarks\ejectdummypage}{}} - -\installpagehandler \v!oneven - {\pagina - \doifonevenpaginaelse - {}{\resetcurrentsectionmarks\ejectdummypage}} - -\installpagehandler \v!viertal - {\ifdubbelzijdig - \!!counta=\realpageno - \!!countb=\realpageno - \divide\!!counta 4 - \divide\!!countb 2 - \ifnum\!!counta=\!!countb - \else - \pagina - \pagina[\v!leeg]% - \pagina[\v!leeg]% - \fi - \fi} - -\installpagehandler \v!laatste - {\ejectinsert - \superejectpage\relax - \doifbothsidesoverruled - \naastpagina - \orsideone - \orsidetwo - %\ifodd\realpageno \else % kan weer weg - \noheaderandfooterlines - \ejectdummypage - %\fi - \od - \filluparrangedpages} - -\beginETEX \dimexpr - -\definepapersize - [oversized] - [\c!breedte=\dimexpr(\papierbreedte+1.5cm), - \c!hoogte=\dimexpr(\papierhoogte+1.5cm)] - -\definepapersize - [doublesized] - [\c!breedte=\dimexpr(\papierbreedte), - \c!hoogte=\dimexpr(2\papierhoogte)] - -\definepapersize - [doubleoversized] - [\c!breedte=\dimexpr(\papierhoogte+1.5cm), - \c!hoogte=\dimexpr(2\papierbreedte+1.5cm)] - -\endETEX + +%\def\startsetups % for international purposes +% {\bgroup +% \doifnextcharelse[\startsetupsA\startsetupsB} +% +%\def\startsetupsA[#1]% +% {\catcode`\^^M=\@@ignore +% \dostartsetups{#1}} +% +%\def\startsetupsB#1 % space delimited +% {\catcode`\^^M=\@@ignore +% \dostartsetups{#1}} +% +%\long\def\dostartsetups#1#2\stopsetups +% {\egroup +% \long\setvalue{\??su#1}{#2}} + +\def\startsetups % for international purposes + {\bgroup\doifnextcharelse[{\startsetupsA\stopsetups}% + {\startsetupsB\stopsetups}} + +\def\startlocalsetups % for nested purposes + {\bgroup\doifnextcharelse[{\startsetupsA\stoplocalsetups}% + {\startsetupsB\stoplocalsetups}} + +\def\startsetupsA#1[#2]% + {\catcode`\^^M=\@@ignore + \dostartsetups#1{#2}} + +\def\startsetupsB#1#2 % space delimited + {\startsetupsA#1[#2]}% + +\long\def\dostartsetups#1#2% watch out: not \grabuntil + {\dograbuntil#1{\egroup\long\setvalue{\??su#2}}} \newtoks\everyfirstparagraphintro \newtoks\everynextparagraphintro @@ -881,10 +1056,10 @@ \def\dosetupparagraphintro[#1][#2]% {\processallactionsinset [#1] - [ \v!reset=>\global\chardef\everyparagraphintro=0 + [ \v!reset=>\global\chardef\everyparagraphintro0 \global\everyfirstparagraphintro\emptytoks \global\everynextparagraphintro \emptytoks, - \v!eerste=>\global\chardef\everyparagraphintro=1 + \v!eerste=>\global\chardef\everyparagraphintro1 \doglobal\appendtoks#2\to\everyfirstparagraphintro, \v!volgende=>\ifcase\everyparagraphintro\global\chardef\everyparagraphintro=2\fi \doglobal\appendtoks#2\to\everynextparagraphintro, @@ -897,7 +1072,7 @@ % no data \or % first data - \global\chardef\everyparagraphintro=2 + \global\chardef\everyparagraphintro2 \scratchtoks\everyfirstparagraphintro \global\everyfirstparagraphintro\emptytoks \or @@ -932,35 +1107,6 @@ %D some paragraph \par %D \stoptypen -\def\@@themaintextcolor{themaintextcolor} - -\def\starttextcolor[#1]% - {\doifsomething{#1} - {\bgroup - \def\stoptextcolor % also goes ok with \page after - {\let\maintextcolor\empty % this one because the top of - \stopregistercolor % page sets the color right (side - \egroup}% % effect) - \def\starttextcolor[##1]% - {\bgroup - \definecolor[\@@themaintextcolor][##1]% - \let\stoptextcolor\egroup}% - \startregistercolor[\@@themaintextcolor]% - \definecolor[\@@themaintextcolor][#1]% - \let\maintextcolor\@@themaintextcolor}} - -\def\initializemaintextcolor - {\doifelsenothing\@@cltekstkleur - {\let\maintextcolor\empty} - {\let\maintextcolor\@@themaintextcolor - \definecolor[\@@themaintextcolor][\@@cltekstkleur]% - \doinitializemaintextcolor}} - -\def\doinitializemaintextcolor - {\appendtoks\starttextcolor[\@@themaintextcolor]\to\everystarttext - \appendtoks\stoptextcolor \to\everystoptext - \let\doinitializemaintextcolor\relax} - % wrong names \newif\ifpagechanged \let\lastchangedpage\empty @@ -974,10 +1120,10 @@ \fi \fi \ifpagechanged - \global\letvalue{\s!paragraph:p:#1}\twopassdata - \global\let\lastchangedpage\twopassdata + \letgvalue{\s!paragraph:p:#1}\twopassdata + \globallet\lastchangedpage\twopassdata \else - \global\let\lastchangedpage\realfolio + \globallet\lastchangedpage\realfolio \fi \doparagraphreference} @@ -998,15 +1144,15 @@ {\ifcase#1\relax \processaction [#2] - [ \v!hoog=>\bbox{\box\nextbox}, - \v!laag=>\tbox{\box\nextbox}, - \v!midden=>\vcenter{\box\nextbox}, - \v!laho=>\vcenter{\box\nextbox}, - \s!unknown=>\tbox{\box\nextbox}, - \s!default=>\tbox{\box\nextbox}]% + [ \v!hoog=>\bbox {\flushnextbox}, + \v!laag=>\tbox {\flushnextbox}, + \v!midden=>\vcenter{\flushnextbox}, + \v!laho=>\vcenter{\flushnextbox}, + \s!unknown=>\tbox {\flushnextbox}, + \s!default=>\tbox {\flushnextbox}]% \else \startbaselinecorrection - \noindent\box\nextbox + \noindent\flushnextbox \stopbaselinecorrection \fi} @@ -1074,10 +1220,10 @@ \def\doTableinterline% #1 {\ifnum\currentTABLEcolumn>\maxTABLEcolumn \chuckTABLEautorow - \else\ifnum\currentTABLEcolumn=0 + \else\ifnum\currentTABLEcolumn=\zerocount \TABLEnoalign - {\global\let\checkTABLEautorow\empty - \global\let\chuckTABLEautorow\empty}% + {\globalletempty\checkTABLEautorow + \globalletempty\chuckTABLEautorow}% \else \setTABLEerror\TABLEmissingcolumn \handleTABLEerror @@ -1112,37 +1258,34 @@ \let\placefloatlabeltext \placefloatcaptiontext \let\placefloatlabelreference \placefloatcaptionreference -\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} - \def\obeyfollowingtoken{{}} % end \cs scanning \def\gobbleparameters{\doquadrupleempty\dogobbleparameters} \def\dogobbleparameters[#1][#2][#3][#4]{} -\def\setvariables% +% \setvariables[xx][titel=] +% \setvariables[xx][titel=test test] +% \setvariables[xx][titel=test $x=1$ test] % fatal error reported +% \setvariables[xx][titel=test {$x=1$} test] +% \setvariables[xx][titel] % fatal error reported +% \setvariables[xx][titel=e] + +\def\??vars{@@vars} + +\def\setvariables {\dodoubleargument\dosetvariables} \def\dosetvariables[#1][#2]% - {\def\currentvariableclass{#1}% - \getparameters[vars:#1:][#2]} - -% \def\getvariable#1#2% -% {\ifundefined{vars:#1:#2}\else\getvalue{vars:#1:#2}\fi} + {\errorisfataltrue + \def\currentvariableclass{#1}% + \getrawparameters[\??vars:#1:][#2]% + \errorisfatalfalse} \def\getvariable#1#2% to be sped up - {\csname\ifundefined{vars:#1:#2}empty\else vars:#1:#2\fi\endcsname} + {\csname\ifundefined{\??vars:#1:#2}\s!empty\else\??vars:#1:#2\fi\endcsname} + +\def\showvariable#1#2% + {\showvalue{\ifundefined{\??vars:#1:#2}\s!empty\else\??vars:#1:#2\fi}} \let\currentvariableclass\empty @@ -1297,20 +1440,20 @@ \setupcolumnspan[#1]% \forgetall \ifbinnenkolommen - \advance\hsize by \intercolumnwidth - \hsize=\@@ksn\hsize - \advance\hsize by -\intercolumnwidth + \advance\hsize \intercolumnwidth + \hsize\@@ksn\hsize + \advance\hsize -\intercolumnwidth \fi \dowithnextbox - {\setbox\columnspanbox=\box\nextbox - \ifbinnenkolommen\wd\columnspanbox=\hsize\fi + {\setbox\columnspanbox\flushnextbox + \ifbinnenkolommen\wd\columnspanbox\hsize\fi \postprocesscolumnspanbox\columnspanbox - \scratchdimen=\ht\columnspanbox - \setbox\columnspanbox=\hbox % depth to be checked, probably option! + \scratchdimen\ht\columnspanbox + \setbox\columnspanbox\hbox % depth to be checked, probably option! {\localframed[\??ks][\c!offset=\v!overlay]{\box\columnspanbox}}% - \ht\columnspanbox=\scratchdimen - \dp\columnspanbox=\dp\strutbox - \wd\columnspanbox=\hsize + \ht\columnspanbox\scratchdimen + \dp\columnspanbox\dp\strutbox + \wd\columnspanbox\hsize \ifbinnenkolommen \ifnum\@@ksn>1 \setvsize @@ -1322,10 +1465,10 @@ \else \snaptogrid\vbox{\vphantom{\copy\columnspanbox}} \fi}% - \wd\currenttopcolumnbox=\hsize - \global\advance\vsize by -\ht\currenttopcolumnbox + \wd\currenttopcolumnbox\hsize + \global\advance\vsize -\ht\currenttopcolumnbox \fi} - \global\pagegoal=\vsize + \global\pagegoal\vsize \else \snaptogrid\vbox{\box\columnspanbox} \fi @@ -1345,6 +1488,23 @@ \def\stopcolumnspan% {\egroup} +\def\backgroundline[#1]% + %{\doifsomething{#1}{\dobackgroundline{#1}}\hbox} + {\doifcolorelse{#1}{\dobackgroundline{#1}\hbox}\hbox} + +\def\dobackgroundline#1% + {\dowithnextbox + {\hbox + {\localcolortrue + \startcolor[#1]% + \vrule + \!!width \wd\nextbox + \!!height\ht\nextbox + \!!depth \dp\nextbox + \stopcolor + \hskip-\wd\nextbox + \box\nextbox}}} + %D For Ton. To be documented. \def\plaatsexterndocument[#1]% @@ -1370,4 +1530,3 @@ \readfile {cont-loc} {} {} \endinput - diff --git a/tex/context/base/cont-nl.tex b/tex/context/base/cont-nl.tex index 974790061..259ce0b1b 100644 --- a/tex/context/base/cont-nl.tex +++ b/tex/context/base/cont-nl.tex @@ -29,6 +29,6 @@ \installlanguage [\s!nl] [\c!status=\v!start] \installlanguage [\s!it] [\c!status=\v!start] -\setupbodyfont [cmr,rm,12pt] +\setupbodyfont [cmr,ams,rm,12pt] \protect \errorstopmode \dump \endinput diff --git a/tex/context/base/cont-ro.tex b/tex/context/base/cont-ro.tex index 1e24d4844..48f8c6164 100644 --- a/tex/context/base/cont-ro.tex +++ b/tex/context/base/cont-ro.tex @@ -25,6 +25,6 @@ \installlanguage [\s!de] [\c!status=\v!start] \installlanguage [\s!ro] [\c!status=\v!start] -\setupbodyfont [cmr,rm,12pt] +\setupbodyfont [cmr,ams,rm,12pt] \protect \errorstopmode \dump \endinput diff --git a/tex/context/base/cont-uk.tex b/tex/context/base/cont-uk.tex index b7ade6157..dbfb0263a 100644 --- a/tex/context/base/cont-uk.tex +++ b/tex/context/base/cont-uk.tex @@ -29,10 +29,6 @@ \installlanguage [\s!nl] [\c!status=\v!start] \installlanguage [\s!it] [\c!status=\v!start] -\setupbodyfont [cmr,rm,12pt] +\setupbodyfont [cmr,ams,rm,12pt] -\protect - -\dump - -\endinput +\protect \errorstopmode \dump \endinput diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 81b6b4d9a..cc22ab771 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -15,7 +15,7 @@ \catcode`\{=1 \catcode`\}=2 -\def\contextversion{2002.6.7} +\def\contextversion{2002.12.20} %D Welcome to the main module. When this module is ran through %D \type{initex} or \type{tex -i} or \type{whatevertex} using @@ -34,8 +34,6 @@ \input syst-pln.tex % stripped plain \input syst-prm.tex % saved primitives (will be extended) -\input math-pln.tex % basic plain math - \input syst-etx.tex % etex \input syst-omg.tex % omega \input syst-gen.tex @@ -43,6 +41,8 @@ \input syst-new.tex \input syst-con.tex +\input math-pln.tex % basic plain math + %D To enable selective loading, we say: \CONTEXTtrue @@ -132,8 +132,10 @@ \input hand-ini.tex \input regi-ini.tex \input lang-ini.tex +\input unic-ini.tex \input colo-ini.tex +%input colo-sep.tex \input spec-mis.tex \input spec-ini.tex @@ -222,6 +224,7 @@ \input core-tbl.tex \input core-int.tex \input core-ntb.tex +\input core-ltb.tex %D Like languages, fonts, encodings and symbols, \METAPOST\ %D support is also organized in its own class of modules. @@ -287,8 +290,13 @@ \input xtag-exp.tex \input xtag-pre.tex \input xtag-xsd.tex +\input xtag-rng.tex %input xtag-ent.tex +%D How about this: + +\input meta-xml.tex + %D The next two modules implement some additional %D functionality concenring classes of documents and output. %D These modules probably will be replaced some day. @@ -398,7 +406,7 @@ \stopinterface -\edef\copyrightversion% +\edef\copyrightversion {Copyright 1990-\the\normalyear\normalspace / PRAGMA ADE / J. Hagen - A.F. Otten} @@ -411,7 +419,7 @@ %D Let's quit this file when doing a \type {cont-..} generation. -\doifparentfileelse{context}{\let\next\relax}{\let\next\endinput} \next +\doifparentfileelse{context}{\donothing}{\endinput} %D Unless we're generating a \type {cont-..} format, we also %D do the following. @@ -483,10 +491,18 @@ \protect -%D Finally we load some fonts. +%D Finally we (pre)load some fonts. \setupbodyfont [cmr,rm,12pt] +%D The next hook can be used to generate a local (extended) +%D format. This file is only searched for at the current +%D path. + +% \readlocfile{cont-def.tex} +% {\writestatus{loading}{adding extensions from cont-def}} +% {} + %D Now dumping the format is all that's left to be done. \errorstopmode \dump diff --git a/tex/context/base/core-box.tex b/tex/context/base/core-box.tex index fe52203ab..f8003f20f 100644 --- a/tex/context/base/core-box.tex +++ b/tex/context/base/core-box.tex @@ -19,10 +19,19 @@ \unprotect -\definelayer[\v!tekst-2][\c!positie=\v!ja] -\definelayer[\v!tekst-1][\c!positie=\v!ja] -\definelayer[\v!tekst+1][\c!positie=\v!ja] -\definelayer[\v!tekst+2][\c!positie=\v!ja] +% \definelayer[\v!tekst-2][\c!positie=\v!ja] +% \definelayer[\v!tekst-1][\c!positie=\v!ja] +% \definelayer[\v!tekst+1][\c!positie=\v!ja] +% \definelayer[\v!tekst+2][\c!positie=\v!ja] + +% we need to set the size, else we get dimensions depending +% on the content, which in itsel fis ok, but can lead to loops +% due to rounding errors (happened in demo-obv) + +\definelayer[\v!tekst-2][\c!positie=\v!ja,\c!breedte=\overlaywidth,\c!hoogte=\overlayheight] +\definelayer[\v!tekst-1][\c!positie=\v!ja,\c!breedte=\overlaywidth,\c!hoogte=\overlayheight] +\definelayer[\v!tekst+1][\c!positie=\v!ja,\c!breedte=\overlaywidth,\c!hoogte=\overlayheight] +\definelayer[\v!tekst+2][\c!positie=\v!ja,\c!breedte=\overlaywidth,\c!hoogte=\overlayheight] \def\internaltextoverlay#1% will become more generic and installable {\startoverlay % i.e. probably an overlay by itself @@ -34,6 +43,8 @@ % {\hbox to \zeropoint{\positionoverlay{\v!tekst#1}\hss}% % \composedlayer{\v!tekst#1}} +% todo: share info, so that tuo will be smaller + \defineoverlay[\v!tekst-2][\internaltextoverlay{-2}] \defineoverlay[\v!tekst-1][\internaltextoverlay{-1}] \defineoverlay[\v!tekst+1][\internaltextoverlay{+1}] @@ -70,16 +81,16 @@ {\bgroup \checktextbackgrounds \setbox\scratchbox\null - \wd\scratchbox\wd\nextbox - \ht\scratchbox\ht\nextbox - \dp\scratchbox\dp\nextbox + \wd\scratchbox\nextboxwd + \ht\scratchbox\nextboxht + \dp\scratchbox\nextboxdp \setlayer [anchor] [\c!breedte=\wd\scratchbox, \c!hoogte=\ht\scratchbox, \c!offset=\!!zeropoint, #2,#3] - {\setlayer[#1]{\box\nextbox}}% + {\setlayer[#1]{\flushnextbox}}% \framed [#2, \c!achtergrond=anchor, @@ -158,7 +169,7 @@ {\rotate [\c!plaats=\v!hoog, \c!rotatie=\getvalue{\??cb#1\c!rotatie}] - {\box\nextbox}}}% + {\flushnextbox}}}% \advance\@@layerysiz\dp\csname\@@collectorbox#1\endcsname \@@layerxpos\getvalue{\??cb#1\c!x}% \advance\@@layerxpos\getvalue{\??cb#1\c!hoffset}% @@ -175,7 +186,7 @@ \@@layerxpos-\@@layerxpos \fi}% \setbox\nextbox\hbox - {\alignedbox[\getvalue{\??cb#1\c!plaats}]\vbox{\box\nextbox}}% + {\alignedbox[\getvalue{\??cb#1\c!plaats}]\vbox{\flushnextbox}}% \boxmaxdepth\zeropoint % really needed, nice example \global\advance\boxhdisplacement\@@layerxpos \ifdim\boxhdisplacement<\zeropoint @@ -185,14 +196,14 @@ \fi \global\advance\boxvdisplacement\@@layerypos \ifdim\boxvdisplacement<\zeropoint - \global\setbox\csname\@@collectorbox#1\endcsname=\hbox + \global\setbox\csname\@@collectorbox#1\endcsname\hbox {\lower-\boxvdisplacement \box\csname\@@collectorbox#1\endcsname}% \fi \@@layerxsiz\wd\csname\@@collectorbox#1\endcsname \@@layerysiz\ht\csname\@@collectorbox#1\endcsname \advance\@@layerysiz\dp\csname\@@collectorbox#1\endcsname - \global\setbox\csname\@@collectorbox#1\endcsname=\hbox + \global\setbox\csname\@@collectorbox#1\endcsname\hbox {\box\csname\@@collectorbox#1\endcsname \hskip-\@@layerxsiz \hskip\@@layerxpos\relax @@ -201,9 +212,9 @@ \fi \lower\@@layerypos\hbox {\ifdim\boxvdisplacement<\zeropoint - \lower-\boxvdisplacement\box\nextbox + \lower-\boxvdisplacement\flushnextbox \else - \box\nextbox + \flushnextbox \fi}}% \ifdim\wd\csname\@@collectorbox#1\endcsname<\@@layerxsiz \global\wd\csname\@@collectorbox#1\endcsname\@@layerxsiz @@ -249,7 +260,7 @@ \dowithnextbox {\setcollector [caption] - {\box\nextbox}% + {\flushnextbox}% \setcollector [caption][#1] {\getparameters[\??du][#2]% @@ -288,7 +299,7 @@ \def\dolayeredtext[#1][#2]#3% {\bgroup \dowithnextbox - {\!!widtha\nextboxwd + {\!!widtha \nextboxwd \!!heighta\nextboxht \bgroup % preserve \nextbox \setlayer @@ -306,7 +317,7 @@ \c!achtergrond={\v!voorgrond,caption}, \c!breedte=\!!widtha, \c!hoogte=\!!heighta] - {\box\nextbox}% + {\flushnextbox}% \egroup}% \hbox} @@ -379,7 +390,7 @@ % % \affiliation{drawing}{\externalfigure[hakker][width=3cm]} -% pas op: aanpassen aan nieuwe layer hoek ankers +% pas op: aanpassen aan nieuwe layer hoek ankers en columnset \newcounter\nofbleeds % per pag @@ -408,7 +419,7 @@ \!!donebfalse % right \!!donecfalse % top \!!donedfalse % bottom -% replace this part ! + % replace this part ! todo: default location \processaction [\@@bgplaats] [ t=>\!!donectrue\let\@@bghoffset\!!zeropoint, @@ -503,16 +514,58 @@ \fi} \def\dosetlayerframedT[#1][#2][#3]% - {\dowithnextbox{\setlayer[#1][#2]{\box\nextbox}}% + {\dowithnextbox{\setlayer[#1][#2]{\flushnextbox}}% \hbox\framed[#3]} \def\dosetlayerframedS[#1][#2][#3]% {\dowithnextbox {\setlayer [#1] - [\c!breedte=\wd\nextbox,\c!hoogte=\ht\nextbox, + [\c!breedte=\nextboxwd,\c!hoogte=\nextboxht, \c!offset=\!!zeropoint,#2] - {\box\nextbox}}% + {\flushnextbox}}% \hbox\framed[\c!plaats=\v!normaal,#2]} + +\def\setlayertext + {\dotripleempty\dosetlayertext} +\def\dosetlayertext[#1][#2][#3]% + {\bgroup + \getparameters + [\??lx] + [\c!uitlijnen=, + \c!breedte=\hsize, + \c!kleur=, + \c!letter=, + #3]% + \dowithnextboxcontent + {\forgetall + \hsize\@@lxbreedte + \expanded{\steluitlijnenin[\@@lxuitlijnen]}% + \dosetfontattribute\??lx\c!letter} + {\setlayer[#1][#2]{\strut\color[\@@lxkleur]{\flushnextbox}}% + \egroup}% + \vtop} + +% \setupbackgrounds +% [page] +% [background=pagefigures] +% +% \definelayer +% [pagefigures] +% [x=-2mm, +% y=-2mm, +% width=\paperwidth, +% height=\paperheight] +% +% \definelayerpreset [lefttop] [location=rb] +% \definelayerpreset [righttop] [corner={right,top},location={left,bottom}] +% \definelayerpreset [leftbottom] [corner={left,bottom},location={right,top}] +% \definelayerpreset [rightbottom] [corner={right,bottom},location={left,top}] +% +% \setlayer[pagefigures][preset=lefttop] +% \setlayer[pagefigures][preset=righttop] +% \setlayer[pagefigures][preset=leftbottom] +% \setlayer[pagefigures][preset=rightbottom] + \protect \endinput diff --git a/tex/context/base/core-buf.tex b/tex/context/base/core-buf.tex index 46db44213..bb08de0cf 100644 --- a/tex/context/base/core-buf.tex +++ b/tex/context/base/core-buf.tex @@ -129,7 +129,12 @@ \unprotect -\def\resetbuffer% +% more accurate +% +% \@EA\convertcommand\csname\e!start\e!buffer\endcsname\to\beginofblock % else a space +% \@EA\convertcommand\csname\e!stop\e!buffer \endcsname\to\endofblock + +\def\resetbuffer {\dosingleempty\doresetbuffer} \def\doresetbuffer[#1]% @@ -146,43 +151,42 @@ %D For Willy's nested commented buffers, we need the \type %D {\delcharacter} trick. -% \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 ! ! ! ! +%\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} +% {\let\next\secondoftwoarguments} +% {\doifincsnameelse\endofblock\next +% {\ifnum\nestedbufferlevel=\zerocount +% \let\next\firstoftwoarguments +% \else +% \decrement\nestedbufferlevel\relax +% \let\next\secondoftwoarguments +% \fi} +% {\doifincsnameelse\beginofblock\next +% {\increment\nestedbufferlevel\relax +% \let\next\secondoftwoarguments} +% {\let\next\secondoftwoarguments}}}% +% \next} + +\long\def\processnextbufferline#1% {\relax % checken waarom eerdere macro dit nodig heeft / supp-mps run \convertargument#1 \to\next \doifinstringelse{\delcharacter\texcommentsymbol}{\delcharacter\next} - {\let\next\secondoftwoarguments} - {\doifincsnameelse{\endofblock}{\next} - {\ifnum\nestedbufferlevel=0 - \let\next\firstoftwoarguments + {\secondoftwoarguments} + {\doifincsnameelse\endofblock\next + {\ifnum\nestedbufferlevel=\zerocount + \expandafter\firstoftwoarguments \else \decrement\nestedbufferlevel\relax - \let\next\secondoftwoarguments + \expandafter\secondoftwoarguments \fi} - {\doifincsnameelse{\beginofblock}{\next} + {\doifincsnameelse\beginofblock\next {\increment\nestedbufferlevel\relax - \let\next\secondoftwoarguments} - {\let\next\secondoftwoarguments}}}% - \next} + \secondoftwoarguments} + {\secondoftwoarguments}}}} -\def\dostartbuffer% +\def\dostartbuffer {\bgroup \obeylines % nodig, anders gaat 't fout als direct \starttabel (bv) \doquadrupleempty\dodostartbuffer} @@ -196,17 +200,16 @@ \next} \def\dododostartbuffer[#1][#2][#3][#4]% - {%\showmessage{\m!systems}{15}{#2}% - \doifelsevalue{\??bu#1\c!alinea}{\v!ja} + {%\showmessage\m!systems{15}{#2}% + \doifelsevalue{\??bu#1\c!alinea}\v!ja {\segmentatebuffertrue} {\doifnumberelse{\getvalue{\??bu#1\c!alinea}} - {\segmentatebuffertrue} - {\segmentatebufferfalse}}% + \segmentatebuffertrue\segmentatebufferfalse}% \doifelse{#4}{} {\letbeundefined{\e!stop\e!buffer}% % \let\stopbuffer=\relax % \undefined \@EA\@EA\@EA\convertargument\@EA\e!start\e!buffer\to\beginofblock % else a space \@EA\@EA\@EA\convertargument\@EA\e!stop\e!buffer\to\endofblock - \let\processnextblockline=\processnextbufferline} + \let\processnextblockline\processnextbufferline} {\letbeundefined{#4}% \letvalue{#4}=\relax % \undefined \@EA\convertargument\csname#3\endcsname\to\beginofblock \@EA\convertargument\csname#4\endcsname\to\endofblock}% @@ -219,7 +222,7 @@ \getvalue{#4}}% \doifelsenothing{#2} {\message{<\TEXbufferfile{\jobname}>}% - \immediate\openout\tmpblocks\TEXbufferfile{\jobname}} + \immediate\openout\tmpblocks\TEXbufferfile\jobname} {\message{<\TEXbufferfile{#2}>}% \immediate\openout\tmpblocks\TEXbufferfile{#2}}% \ifsegmentatebuffer @@ -234,7 +237,7 @@ % \setbuffer[name]#2\endbuffer : saves to file #1.tmp -\def\setbuffer[#1]#2\endbuffer% +\def\setbuffer[#1]#2\endbuffer {\immediate\openout\tmpblocks=\TEXbufferfile{#1}% \convertargument#2\to\ascii \immediate\write\tmpblocks{\ascii}% @@ -242,17 +245,17 @@ \def\dobuffer#1[#2]#3% {\def\dodobuffer##1% - {%\showmessage{\m!systems}{#1}{##1}% + {%\showmessage\m!systems{#1}{##1}% \beginrestorecatcodes \doifdefinedelse{\??bu##1\c!nummer} - {#3{\TEXbufferfile{def-\getvalue{\??bu##1\c!nummer}}}{}{}} - {#3{\TEXbufferfile{##1}}{}{}}% + {#3{\TEXbufferfile{def-\getvalue{\??bu##1\c!nummer}}}\donothing\donothing} + {#3{\TEXbufferfile{##1}}\donothing\donothing}% \endrestorecatcodes}% \doifelsenothing{#2} {\dodobuffer\jobname} {\processcommalist[#2]\dodobuffer}} -\def\processTEXbuffer% +\def\processTEXbuffer {\dodoubleempty\doprocessTEXbuffer} \def\doprocessTEXbuffer[#1][#2]% @@ -270,7 +273,7 @@ \let\getbuffer \processTEXbuffer % handy \let\haalbuffer\processTEXbuffer % will move to mult-com.tex -\def\typebuffer% +\def\typebuffer {\dodoubleempty\dotypebuffer} \def\dotypebuffer[#1][#2]% @@ -280,7 +283,7 @@ \dobuffer{17}[#2]\typefile \fi} -\def\stelbufferin% +\def\stelbufferin {\dodoubleempty\dostelbufferin} \def\dostelbufferin[#1][#2]% @@ -293,8 +296,8 @@ \def\dodefinieerbuffer[#1]% {\iffirstargument % else problems \doglobal\increment\nofdefinedbuffers - \setevalue{\??bu#1\c!nummer}{\nofdefinedbuffers}% - \setvalue {\??bu#1\c!alinea}{\v!nee}% + \letvalue{\??bu#1\c!nummer}\nofdefinedbuffers + \letvalue{\??bu#1\c!alinea}\v!nee \setevalue{\e!start#1}% {\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}% \setevalue{\e!haal#1}% @@ -303,9 +306,32 @@ {\noexpand\dodotypebuffer[#1][def-\nofdefinedbuffers]}% \fi} -\def\definieerbuffer% +\def\definieerbuffer {\dosingleargument\dodefinieerbuffer} +% yet another undocumented feature, but who cares: + +\let\startfilebuffer\startbuffer + +\def\usememorybuffers{\let\startbuffer\startmemorybuffer} +\def\usefilebuffers {\let\startbuffer\startfilebuffer} + +\def\startmemorybuffer + {\dosingleempty\dostartmemorybuffer} + +\long\def\dostartmemorybuffer[#1]#2\stopbuffer + {\setbuffer[\iffirstargument#1\else\jobname\fi]#2\endbuffer} + +% \long\def\startcrap#1\stopcrap +% {\usememorybuffers#1\usefilebuffers} % or {{...}} +% +% \startcrap +% \startbuffer +% some awful code +% \stopbuffer +% \placefigure{crap}{\getbuffer} +% \stopcrap + % TODO: no grouping due to sidefloats \expandafter \convertargument \gobbleoneargument @ \to \emptybufferline @@ -320,20 +346,20 @@ \newcount\currentbufferparagraph -\def\getbufferparagraphs% +\def\getbufferparagraphs {\dodoubleempty\dogetbufferparagraphs} \def\dosetbufferoffset#1% {\doifnumberelse{\getvalue{\??bu#1\c!alinea}} - {\currentbufferparagraph=-\getvalue{\??bu#1\c!alinea}} - {\currentbufferparagraph=0}% + {\currentbufferparagraph-\getvalue{\??bu#1\c!alinea}} + {\currentbufferparagraph \zerocount}% \relax} \def\dogetbufferparagraphs[#1][#2]% {\iffirstargument \ifsecondargument \dosetbufferoffset{#1}% - \doifelse{#2}{\v!alles} + \doifelse{#2}\v!alles {\def\startbufferparagraph{\normalbufferparagraph{#1}}} {\def\startbufferparagraph{\filterbufferparagraph{#1}{#2}}}% \def\stopbufferparagraph{\dostopbufferparagraph{#1}}% @@ -361,17 +387,17 @@ \def\dostartbufferparagraph#1% {\par\getvalue{\??bu#1\c!voor}} -\def\normalbufferparagraph% - {\advance\currentbufferparagraph 1 - \ifnum\currentbufferparagraph>0 +\def\normalbufferparagraph + {\advance\currentbufferparagraph \plusone + \ifnum\currentbufferparagraph>\zerocount \expandafter\dostartbufferparagraph \else \expandafter\gobbleoneargument \fi} \def\filterbufferparagraph#1#2% - {\advance\currentbufferparagraph 1 - \ifnum\currentbufferparagraph>0 + {\advance\currentbufferparagraph \plusone + \ifnum\currentbufferparagraph>\zerocount \doifinsetelse{\the\currentbufferparagraph}{#2} {\let\next\dostartbufferparagraph} {\let\next\fakebufferparagraph}% @@ -380,48 +406,35 @@ \fi \next{#1}} -\long\def\gobblebufferparagraph#1#2\stopbufferparagraph% +\long\def\gobblebufferparagraph#1#2\stopbufferparagraph {} \def\fakebufferparagraph#1% {\bgroup \def\stopbufferparagraph{\dostopbufferparagraph{#1}\egroup\egroup}% - \setbox\scratchbox=\vbox\bgroup\dostartbufferparagraph{#1}} + \setbox\scratchbox\vbox\bgroup\dostartbufferparagraph{#1}} \def\blockversion {1996.03.10} \def\@@blockerrormessage% - {\showmessage{\m!textblocks}{1}{}% - \global\let\@@blockerrormessage=\relax} + {\showmessage\m!textblocks1\empty + \global\let\@@blockerrormessage\relax} \def\thisisblockversion#1% - {\doifnot{\blockversion}{#1}% - {\@@blockerrormessage\endinput}} + {\doifnot\blockversion{#1}{\@@blockerrormessage\endinput}} -\def\stopcopyingblocks% +\def\stopcopyingblocks {\ifcopyingblocks \immediate\closeout\outblocks \copyblockfile \global\copyingblocksfalse \fi} -% \def\dodosetblockcounters[#1:#2]#3% -% {\setvalue{\??se\s!old#3}{#1}% -% \doifnot{#3}{\lastsection} -% {\dodosetblockcounters[#2:0]{\getvalue{\??se#3\c!na}}}} -% -% \def\dosetblockcounters[#1#2::#3]% -% {\ifblockpermitted -% \dodosetblockcounters[#3:0]\firstsection -% \setsectiontype[#1]% -% \def\@@sectionvalue##1{\getvalue{\??se\s!old##1}}% -% \def\@@sectionconversion##1##2{##2}% to get rid of {##2} -% \fi} - \def\dodosetblockcounters[#1]#2% {\expanded{\setvalue{\??se\s!old#2}{\@@filterheadpart[#1]}}% - \doifnot{#2}{\lastsection} - {\expanded{\dodosetblockcounters[\@@filtertailpart[#1]]}{\getvalue{\??se#2\c!na}}}} + \doifnot{#2}\lastsection + {\expanded{\dodosetblockcounters[\@@filtertailpart[#1]]}% + {\getvalue{\??se#2\c!na}}}} % ???? \def\dosetblockcounters[#1]% {\ifblockpermitted @@ -433,26 +446,19 @@ \let\blockstatus\empty -\def\setblockcounters% +\def\setblockcounters {\ifx\blockstatus\empty \else \@EA\dosetblockcounters\@EA[\blockstatus]% \fi} -%\def\getblockstatus#1% -% {\dosetblklevel{\getvalue{\??by\@@bscriterium}}% -% \doifblklevelelse[#1] -% {\global\blockpermittedtrue} -% {\global\blockpermittedfalse}% -% \def\blockstatus{#1}} - -\def\getblockstatus#1% - {\dosetblklevel{\getvalue{\??by\@@bscriterium}}% +\def\getblockstatus#1% is this still ok + {\dosetfilterlevel{\getvalue{\??by\@@bscriterium}}\empty \expanded{\doifblklevelelse[#1\sectionseparator\sectionseparator0]} {\global\blockpermittedtrue} {\global\blockpermittedfalse}% \def\blockstatus{#1}} -\def\setupblockparameters% +\def\setupblockparameters {\dodoubleargument\dosetupblockparameters} \def\dosetupblockparameters[#1][#2]% @@ -461,14 +467,14 @@ \beginTEX \def\blockparameter#1#2% - {\csname\@EA\ifx\csname\??tb#1#2\endcsname\relax empty\else\??tb#1#2\fi\endcsname} + {\csname\@EA\ifx\csname\??tb#1#2\endcsname\relax\s!empty\else\??tb#1#2\fi\endcsname} \endTEX \beginETEX \ifcsname \def\blockparameter#1#2% - {\@EA\csname\ifcsname\??tb#1#2\endcsname\??tb#1#2\else empty\fi\endcsname} + {\@EA\csname\ifcsname\??tb#1#2\endcsname\??tb#1#2\else\s!empty\fi\endcsname} \endETEX @@ -493,13 +499,13 @@ % oeps, got bugged \def\setblocklevel#1% sign - {\global\advance\blocklevel by #11 + {\global\advance\blocklevel #11 \ifcase\blocklevel\doingblocksfalse\else\doingblockstrue\fi} -\def\opentmpblock% +\def\opentmpblock {\immediate\openout\tmpblocks=\TEXbufferfile{\f!utilityfilename\the\blocklevel}} -\def\closetmpblock% +\def\closetmpblock {\immediate\write\tmpblocks{}% een lege regel is handig voor \par commando's \immediate\closeout\tmpblocks} @@ -521,10 +527,10 @@ \immediate\write\tmpblocks{\string#1}}% \fi} -\def\startcopyingblocks% +\def\startcopyingblocks {\global\copyingblocksfalse} -\def\checkcopyingblocks% +\def\checkcopyingblocks {\ifcopyingblocks \else \immediate\openout\outblocks\f!utilityfilename.\f!blockextension @@ -533,21 +539,21 @@ \global\copyingblockstrue \fi} -\def\stopcopyingblocks% +\def\stopcopyingblocks {\ifcopyingblocks \immediate\closeout\outblocks \copyblockfile \global\copyingblocksfalse \fi} -\def\geenblokkenmeer% +\def\geenblokkenmeer {\stopcopyingblocks} \def\copyblockfile {\ifcopyingblocks \begingroup - \showmessage{\m!textblocks}{2}{\jobname.\f!blockextension}% - \openlocin{\inpblocks}{\f!utilityfilename.\f!blockextension}% + \showmessage\m!textblocks2{\jobname.\f!blockextension}% + \openlocin\inpblocks{\f!utilityfilename.\f!blockextension}% \immediate\openout\outblocks\jobname.\f!blockextension \setupcopyblock \catcode`\^^M=\@@ignore\relax @@ -565,26 +571,26 @@ \def\loadallblocks#1% {\beginrestorecatcodes -\catcode`\^^M=\@@endofline\relax + \catcode`\^^M=\@@endofline\relax \readjobfile{#1.\f!blockextension} - {\showmessage{\m!textblocks}{3}{#1.\f!blockextension}} - {\showmessage{\m!textblocks}{4}{}}% + {\showmessage\m!textblocks3{#1.\f!blockextension}} + {\showmessage\m!textblocks4\empty}% \endrestorecatcodes} -\def\setupcopyblock% - {\makeallother % \dostepwiserecurse{1}{255}{1}{\catcode\recurselevel=\@@other}% +\def\setupcopyblock + {\makeallother \obeylines} -\def\writeoutblocks% +\def\writeoutblocks {\immediate\write\outblocks} % readable % % \def\processnextblocklineAB#1#2#3% % {\convertargument#1 \to\next -% \doifinstringelse{\endofblockA}{\next} +% \doifinstringelse\endofblockA\next % {\def\next{#2}} -% {\doifinstringelse{\endofblockB}{\next} +% {\doifinstringelse\endofblockB\next % {\def\next{#2}} % {\def\next{#3}}}% % \next} @@ -598,7 +604,7 @@ % % even more -\def\processnextblocklineAB#1% #2#3% +\long\def\processnextblocklineAB#1% #2#3% {\convertargument#1 \to\next \doifinstringelse\endofblockA\next \firstoftwoarguments @@ -634,7 +640,7 @@ % % faster -\def\processnextblockline#1% #2#3% +\long\def\processnextblockline#1% #2#3% {\convertargument#1 \to\next \ifx\next\emptybufferline \ifsegmentatebuffer \emptybufferlinetrue \fi @@ -663,15 +669,15 @@ \def\skipblock#1% {\checkcopyingblocks \@EA\convertargument\string\thiswasblock{#1}\to\endofblock -%testen : \expanded{\convertargument\string\thiswasblock{#1}\noexpand\to\noexpand\endofblock}% - \let\openblock=\begingroup - \let\closeblock=\endgroup + %testen : \expanded{\convertargument\string\thiswasblock{#1}\noexpand\to\noexpand\endofblock}% + \let\openblock\begingroup + \let\closeblock\endgroup \openblock \setupcopyblock \skipblockline} -\def\doafterblock#1#2{} -\def\dobeforeblock#1#2{} +\let\doafterblock \gobbletwoarguments +\let\dobeforeblock\gobbletwoarguments \def\thisisblock#1% {\executeifdefined{\s!thisisblock#1}{\skipblock{#1}}} @@ -683,16 +689,16 @@ {\checkcopyingblocks \obeylines \@EA\@EA\@EA\convertargument\@EA\string\csname\e!eindvan#1\endcsname\to\endofblockA -%testen: \expanded{\convertargument\string\csname\e!eindvan#1\endcsname\to\endofblockA}% + %testen: \expanded{\convertargument\string\csname\e!eindvan#1\endcsname\to\endofblockA}% \@EA\convertargument\string\eindvanblok[#1]\to\endofblockB % MULTI LINGUAL MAKEN - \def\openblock% + \def\openblock {\dobeforeblock{#1}{#2}% \opentmpblock \begingroup \makesectionformat \immediate\write\outblocks{}% \immediate\write\outblocks{\string\thisisblock{#1}{\sectionformat}[#2]}}% - \def\closeblock% + \def\closeblock {\immediate\write\outblocks{}% handig voor \par commando's \immediate\write\outblocks{\string\thiswasblock{#1}}% \endgroup @@ -703,16 +709,16 @@ \setupcopyblock \copyblocklineAB} -\def\copyblock% +\def\copyblock {\let\opentmpblock\empty \let\closetmpblock\empty \let\writetmpblock\gobbleoneargument \saveblock} -\def\loadoneblock% +\def\loadoneblock {\edef\blockfilename{\TEXbufferfile{\f!utilityfilename\the\blocklevel}}% \setblocklevel+% - \readjobfile{\blockfilename}{}{}% + \readjobfile\blockfilename\donothing\donothing \setblocklevel-}% \def\dodefinieerblok[#1]% @@ -726,13 +732,13 @@ \c!letter=, \c!file=\jobname]} -\def\definieerblok% +\def\definieerblok {\dosingleargumentwithset\dodefinieerblok} \def\dostelblokin[#1][#2]% {\getparameters[\??tb#1][#2]} -\def\stelblokin% +\def\stelblokin {\dodoubleargumentwithset\dostelblokin} \def\passeerblok[#1]% @@ -741,9 +747,8 @@ \def\doverbergblok[#1][#2][#3]% {\doifassignmentelse{#3} - {\def\next{\dodoverbergblok[#1][#2][][#3]}} - {\def\next{\dodoverbergblok[#1][#2][#3][]}}% - \next} + {\dodoverbergblok[#1][#2][][#3]} + {\dodoverbergblok[#1][#2][#3][]}} \def\dodoverbergblok[#1][#2][#3][#4]% {\doifelsenothing{#2} @@ -758,8 +763,8 @@ {\global\blockpermittedtrue \edef\bloktitel{#1:#3}}}}% \ifblockpermitted - \showwarning{\m!textblocks}{5}{\bloktitel}% - \def\next% + \showwarning\m!textblocks5\bloktitel + \def\next {\def\dobeforeblock####1####2% {\begingroup}% \def\doafterblock####1####2% @@ -768,20 +773,20 @@ \saveblock{#1}{#3#4}}% \else \doifinsetelse{+}{#3} - {\showwarning{\m!textblocks}{6}{\bloktitel}% - \def\next% + {\showwarning\m!textblocks6\bloktitel + \def\next {\def\dobeforeblock####1####2% {\begingroup \global\visiblefalse}% \def\doafterblock####1####2% - {{\setbox0=\vbox + {{\setbox0\vbox {\catcode`\^^M=\@@endofline\relax \loadoneblock \par}}% \endgroup}% \saveblock{#1}{#3#4}}}% - {\showwarning{\m!textblocks}{7}{\bloktitel}% - \def\next% + {\showwarning\m!textblocks7\bloktitel + \def\next {\def\dobeforeblock####1####2% {\begingroup \globaldefs=-1\relax}% @@ -797,7 +802,7 @@ {\bgroup\obeylines\dotripleempty\doverbergblok[##1][#2]}}% \processcommalist[#1]\docommando} -\def\verbergblokken% +\def\verbergblokken {\dodoubleempty\doverbergblokken} \def\doexecuteloadedblock#1#2% @@ -805,20 +810,20 @@ \bgroup % before \c!voor (think of: \c!voor=\startitemize) \dosetupblockparameters[#1][#2]% voor 'voor'? \getvalue{\??tb#1\c!voor}% - \doattributes{\??tb#1}\c!letter\c!kleur{}% + \dostartattributes{\??tb#1}\c!letter\c!kleur\empty \visibletrue \catcode`\^^M=\@@endofline\relax \getvalue{\??tb#1\c!binnen}% \loadoneblock \par + \dostopattributes \getvalue{\??tb#1\c!na} \egroup} \def\dohandhaafblok[#1][#2][#3]% {\doifassignmentelse{#3} - {\def\next{\dodohandhaafblok[#1][#2][][#3]}} - {\def\next{\dodohandhaafblok[#1][#2][#3][]}}% - \next} + {\dodohandhaafblok[#1][#2][][#3]} + {\dodohandhaafblok[#1][#2][#3][]}} \def\dodohandhaafblok[#1][#2][#3][#4]% {\doifelsenothing{#2} @@ -827,25 +832,25 @@ {\doifcommonelse{#2}{#3} {\global\blockpermittedtrue \edef\bloktitel{#1:#2}} - {\doifinsetelse{\v!alles}{#2} - {\doifelse{#3}{} + {\doifinsetelse\v!alles{#2} + {\doifelsenothing{#3} {\global\blockpermittedtrue \edef\bloktitel{#1}} {\global\blockpermittedfalse \edef\bloktitel{#1:#3}}} {\global\blockpermittedfalse - \doifelse{#3}{} + \doifelsenothing{#3} {\edef\bloktitel{#1}} {\edef\bloktitel{#1:#3}}}}}% \ifblockpermitted - \showwarning{\m!textblocks}{8}{\bloktitel}% + \showwarning\m!textblocks8\bloktitel \def\dobeforeblock##1##2% {\begingroup}% \def\doafterblock##1##2% {\endgroup \doexecuteloadedblock{#1}{#4}}% \else - \showwarning{\m!textblocks}{9}{\bloktitel}% + \showwarning\m!textblocks9\bloktitel \fi \saveblock{#1}{#3#4}} @@ -891,36 +896,37 @@ \doifinset{-}{#3}{\settrue\dummyblockstatus}% \fi \ifconditional\dummyblockstatus - \showwarning{\m!textblocks}{10}{\bloktitel}% + \showwarning\m!textblocks{10}\bloktitel \setvalue{\s!thiswasblock#1}% {\par \egroup \setblocklevel-}% - \def\next% - {\setbox0=\vbox\bgroup + \def\next + {\setbox0\vbox\bgroup \ifconditional\blockassignmentstatus \dosetupblockparameters[#1][#3]% \fi}% \else - \showwarning{\m!textblocks}{11}{\bloktitel}% + \showwarning\m!textblocks{11}\bloktitel \setvalue{\s!thiswasblock#1}% {\par + \dostopattributes \getvalue{\??tb#1\c!na}% \egroup \setblocklevel-}% - \def\next% + \def\next {\bgroup \ifconditional\blockassignmentstatus \dosetupblockparameters[#1][#3]% \fi \getvalue{\??tb#1\c!voor}% - \doattributes{\??tb#1}\c!letter\c!kleur{}% + \dostartattributes{\??tb#1}\c!letter\c!kleur\empty \visibletrue \getvalue{\??tb#1\c!binnen}}% \fi \else - \def\next% - {\showwarning{\m!textblocks}{12}{\bloktitel}% + \def\next + {\showwarning\m!textblocks{12}\bloktitel \skipblock{#1}}% \fi \next} @@ -938,15 +944,15 @@ {\loadallblocks{\getvalue{\??tb\commalistelement\c!file}}}% \endgroup} -\def\dogebruikblokken% +\def\dogebruikblokken {\begingroup \doassign[\??bs][\c!criterium=\v!alles]% \dodoubleempty\dodogebruikblokken} -\def\gebruikblokken% +\def\gebruikblokken {\setfalse\processblockstatus\dogebruikblokken} -\def\verwerkblokken% +\def\verwerkblokken {\settrue \processblockstatus\dogebruikblokken} \def\doselecteerblokken[#1][#2][#3]% @@ -956,7 +962,7 @@ {\getparameters[\??bs][#3]% \dogebruikblokken[#1][#2]}}% -\def\selecteerblokken% +\def\selecteerblokken {\begingroup \doassign[\??bs][\c!criterium=\v!alles]% \dotripleempty\doselecteerblokken} @@ -970,7 +976,8 @@ {\setblocklevel+\bgroup \dodoubleempty\doforceerblok[##1]}% \setvalue{\e!eindvan##1}% - {\getvalue{\??tb##1\c!na}% + {\dostopattributes + \getvalue{\??tb##1\c!na}% \egroup\setblocklevel-}}% \processcommalist[#1]\docommando} @@ -982,7 +989,7 @@ \dosetupblockparameters[#1][#2]% \fi \getvalue{\??tb#1\c!voor}% - \doattributes{\??tb#1}\c!letter\c!kleur{}% + \dostartattributes{\??tb#1}\c!letter\c!kleur\empty \getvalue{\??tb#1\c!binnen}} \def\passeerblokken[#1]% @@ -996,7 +1003,7 @@ \processcommalist[#1]\docommando} \def\dopasseerblok[#1][#2]% - {\def\closeblock% + {\def\closeblock {\egroup\setblocklevel-}% \checkcopyingblocks \obeylines diff --git a/tex/context/base/core-con.tex b/tex/context/base/core-con.tex index 75ac2395c..1f3af8029 100644 --- a/tex/context/base/core-con.tex +++ b/tex/context/base/core-con.tex @@ -239,7 +239,7 @@ %D \showsetup{\y!month} %D \showsetup{\y!MONTH} -\def\month% +\def\month {\doconvertmonth} \def\MONTH#1% @@ -281,7 +281,7 @@ \def\getdayoftheweek#1#2#3% {\bgroup \!!counta#3\relax - \advance\!!counta -1 + \advance\!!counta \minusone \!!countb\!!counta \multiply\!!countb 365 \advance\!!countb \ifcase#2\relax @@ -305,7 +305,7 @@ \advance\!!countb \!!countc % \DoMod\!!countb by7to\!!countb \dosetmodulo\!!countb7\!!countb - \advance\!!countb 1 + \advance\!!countb \plusone \@EA\egroup\@EA\normalweekday\the\!!countb\relax} \def\dayoftheweek#1#2#3% @@ -346,7 +346,7 @@ %D \showsetup{\y!weekday} %D \showsetup{\y!WEEKDAY} -\def\weekday% +\def\weekday {\doconvertday} \def\WEEKDAY#1% @@ -473,7 +473,7 @@ \newsignal\datesignal -\def\dobetweendates% +\def\dobetweendates {\ifdim\lastskip=\datesignal\relax\else \unskip\space \hskip\datesignal\relax @@ -555,21 +555,21 @@ [\!!stringa] [ \v!dag=>\betweendates\the\normalday, %\v!dag+=>\betweendates\ordinaldaynumber\normalday, - \v!dag+=>\betweendates\convertnumber{\v!day+}\normalday, + \v!dag+=>\betweendates\convertnumber{\v!dag+}\normalday, \v!maand=>\betweendates\month\normalmonth, \v!jaar=>\betweendates\the\normalyear, \v!spatie=>\unskip\ \hskip\datesignal,% optimization -) \ =>\unskip\ \hskip\datesignal,% optimization -) d=>\convertnumber\v!dag\normalday, %d+=>\ordinaldaynumber\normalday, - d+=>\convertnumber{\v!day+}\normalday, + d+=>\convertnumber{\v!dag+}\normalday, m=>\convertnumber\v!maand\normalmonth, j=>\convertnumber\v!jaar\normalyear, y=>\convertnumber\v!jaar\normalyear, w=>\betweendates\dayoftheweek\normalday\normalmonth\normalyear, dd=>\ifnum\normalday >9 \else0\fi\the\normalday, - %dd+=>\ordinaldaynumber{\ifnum\normalday >9 \else0\fi\the\normalday}, - dd+=>\convertnumber{\v!day+}{\ifnum\normalday >9 \else0\fi\the\normalday}, + %dd+=>\ordinaldaynumber{\ifnum\normalday >9 \else0\fi\the\normalday}, + dd+=>\convertnumber{\v!dag+}{\ifnum\normalday >9 \else0\fi\the\normalday}, mm=>\ifnum\normalmonth>9 \else0\fi\the\normalmonth, jj=>\expandafter\gobbletwoarguments\the\normalyear, yy=>\expandafter\gobbletwoarguments\the\normalyear, @@ -584,7 +584,7 @@ \fi \egroup} -\def\simplecurrentdate% +\def\simplecurrentdate {\expanded{\complexcurrentdate[\currentdatespecification]}} \definecomplexorsimple\currentdate @@ -775,7 +775,7 @@ \def\convertnumber#1% {\csname\??cv \@EA\ifx\csname\??cv\currentlanguage#1\endcsname\relax - \@EA\ifx\ifcsname\??cv#1\endcsname\relax + \@EA\ifx\csname\??cv#1\endcsname\relax \s!default \else #1% @@ -787,7 +787,7 @@ \def\doifconversiondefinedelse#1% {\@EA\ifx\csname\??cv\currentlanguage#1\endcsname\relax - \@EA\ifx\ifcsname\??cv#1\endcsname\relax + \@EA\ifx\csname\??cv#1\endcsname\relax \@EAEAEA\secondoftwoarguments \else \@EAEAEA\firstoftwoarguments diff --git a/tex/context/base/core-dat.tex b/tex/context/base/core-dat.tex index fac66ce02..c2d13f864 100644 --- a/tex/context/base/core-dat.tex +++ b/tex/context/base/core-dat.tex @@ -201,7 +201,7 @@ %D processing a record, no grouping is applied. \def\getrecordentry #1{\getvalue{\??db:#1}} -\def\resetrecordentry #1{\global\letvalue{\??db:#1}\empty} +\def\resetrecordentry #1{\letgvalueempty{\??db:#1}} \def\assignrecordentry#1{\setgvalue{\??db:#1}} \long\def\skiprecord#1\stoprecord% @@ -263,7 +263,7 @@ \egroup %\the\everyrecord \getvalue{\??db#1\c!commando}{##1}}% - \showmessage{\m!databases}{1}{\askedrecords}% + \showmessage\m!databases1\askedrecords \def\doprocessrecords##1% {\readjobfile{##1} {\showmessage{\m!databases}{2}{(job)}} @@ -283,7 +283,4 @@ %D block moving mechaism, the current implementation is %D prefered out of speed reasons. -\protect - -\endinput - +\protect \endinput diff --git a/tex/context/base/core-des.tex b/tex/context/base/core-des.tex index 443d65b41..c3f5145e5 100644 --- a/tex/context/base/core-des.tex +++ b/tex/context/base/core-des.tex @@ -55,10 +55,10 @@ \def\@@definitiehang#1#2#3% {\processaction [\getvalue{\??dd#1\c!hang}] - [ \v!geen=>\let\next=#2, - 0=>\let\next=#2, - \s!unknown=>\let\next=#3, - \s!default=>\let\next=#2]% + [ \v!geen=>\let\next#2,% + 0=>\let\next#2,% + \s!unknown=>\let\next#3,% + \s!default=>\let\next#2]% \next{#1}} \def\@@definitielinkspure#1[#2]#3% @@ -66,9 +66,9 @@ \noindent\ignorespaces \leftskip\@@leftdefinitieskip \rightskip\@@rightdefinitieskip - \advance\leftskip by \!!widtha + \advance\leftskip \!!widtha \@@makedefinitiepurebox{#1}\raggedright - \advance\leftskip by \!!widthb + \advance\leftskip \!!widthb \llap {\hbox to \leftskip {\hskip\@@leftdefinitieskip @@ -80,7 +80,7 @@ \noindent\ignorespaces \leftskip\@@leftdefinitieskip \rightskip\@@rightdefinitieskip - \advance\rightskip by \!!widtha + \advance\rightskip \!!widtha \@@makedefinitiepurebox{#1}\raggedleft \rlap {\hskip\hsize @@ -88,66 +88,66 @@ \hskip-\rightskip \copy\@@definitiebox \hskip\@@rightdefinitieskip}% - \advance\rightskip by \!!widthb + \advance\rightskip \!!widthb \@@dodefinitie{#1}} \def\@@makedefinitiepurebox#1#2% - {\setbox\@@definitiebox=\vtop + {\setbox\@@definitiebox\vtop {\mindermeldingen \hsize\!!widtha - \leftskip\!!zeropoint - \rightskip\!!zeropoint + \leftskip\zeropoint + \rightskip\zeropoint #2\steluitlijnenin[\getvalue{\??dd#1\c!uitlijnen}]% \unhcopy\@@definitiebox}% - \ht\@@definitiebox=\ht\strutbox - \dp\@@definitiebox=\dp\strutbox} + \ht\@@definitiebox\ht\strutbox + \dp\@@definitiebox\dp\strutbox} \def\@@definitielinkshang#1[#2]#3% {\@@dostartdefinitie{#1}[#2]{#3}% \mindermeldingen - \advance\!!widtha by \!!widthb - \hangindent=\!!widtha - \@@makedefinitiehangbox{#1}{\raggedright}{\advance\rightskip by \!!widthb}% + \advance\!!widtha \!!widthb + \hangindent\!!widtha + \@@makedefinitiehangbox{#1}{\raggedright}{\advance\rightskip \!!widthb}% \noindent\ignorespaces \llap {\dontshowcomposition - \vtop to \!!zeropoint{\box\@@definitiebox}}% + \vtop to \zeropoint{\box\@@definitiebox}}% \@@dodefinitie{#1}}% \def\@@definitierechtshang#1[#2]#3% {\@@dostartdefinitie{#1}[#2]{#3}% \mindermeldingen - \advance\!!widtha by \!!widthb - \hangindent=-\!!widtha - \@@makedefinitiehangbox{#1}{\raggedleft}{\advance\leftskip by \!!widthb}% + \advance\!!widtha \!!widthb + \hangindent-\!!widtha + \@@makedefinitiehangbox{#1}{\raggedleft}{\advance\leftskip \!!widthb}% \noindent\ignorespaces \rlap {\mindermeldingen \dontshowcomposition \dimen0=\hsize - \advance\dimen0 by -\leftskip - \advance\dimen0 by -\rightskip + \advance\dimen0 -\leftskip + \advance\dimen0 -\rightskip \hbox to \dimen0 - {\hss\vtop to \!!zeropoint{\box\@@definitiebox}}}% + {\hss\vtop to \zeropoint{\box\@@definitiebox}}}% \@@dodefinitie{#1}} \def\@@makedefinitiehangbox#1#2#3% - {\setbox\@@definitiebox=\vtop % \vbox gaat fout in hang + {\setbox\@@definitiebox\vtop % \vbox gaat fout in hang {\forgetall \mindermeldingen \hsize\!!widtha #2\steluitlijnenin[\getvalue{\??dd#1\c!uitlijnen}]#3% \unhcopy\@@definitiebox}% - \ht\@@definitiebox=\ht\strutbox - \dp\@@definitiebox=\dp\strutbox + \ht\@@definitiebox\ht\strutbox + \dp\@@definitiebox\dp\strutbox \doifinsetelse{\getvalue{\??dd#1\c!hang}}{\v!passend,\v!ruim} {\dimen0=\ht\@@definitiebox - \advance\dimen0 by \dp\@@definitiebox - \doifvalue{\??dd#1\c!hang}{\v!ruim} - {\advance\dimen0 by .5\ht\strutbox}% + \advance\dimen0 \dp\@@definitiebox + \doifvalue{\??dd#1\c!hang}\v!ruim + {\advance\dimen0 .5\ht\strutbox}% \getnoflines{\dimen0}% - \hangafter=-\noflines} - {\hangafter=-\getvalue{\??dd#1\c!hang}}}% + \hangafter-\noflines} + {\hangafter-\getvalue{\??dd#1\c!hang}}}% \setvalue{@@definitie\v!boven}#1[#2]#3% {%\pagina[\v!voorkeur]% % Weg ermee! @@ -205,47 +205,30 @@ \setvalue{@@definitie\v!aanelkaar}#1[#2]#3% {\processaction [\getvalue{\??dd#1\c!breedte}] - [\v!passend=>\let\next=\@@definitieaanelkaarpassend, - \v!ruim=>\let\next=\@@definitieaanelkaarruim, - \s!unknown=>\let\next=\@@definitieaanelkaarbreed, - \s!default=>\let\next=\@@definitieaanelkaarruim]% + [\v!passend=>\let\next\@@definitieaanelkaarpassend, + \v!ruim=>\let\next\@@definitieaanelkaarruim, + \s!unknown=>\let\next\@@definitieaanelkaarbreed, + \s!default=>\let\next\@@definitieaanelkaarruim]% \next{#1}[#2]{#3}} -% \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 -% \advance\leftskip by \skip0 -% \fi -% \hskip-\skip0 % no hang in the first line -% \unhcopy\@@definitiebox -% \ifdim\!!widthb=\!!zeropoint -% \kern.75em % another default -% \else -% \kern\!!widthb -% \fi -% \ignorespaces -% \@@dodefinitie{#1}} - \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 - \ifnum\insidedefinition=1 \ifdim\leftskip>\!!zeropoint - \leftskipadaption=\leftskip - \fi \fi + \advance\leftskip -\leftskipadaption \relax + \ifdim\leftskipadaption=\zeropoint + \leftskipadaption1.5em % just some default + \ifnum\insidedefinition=\plusone + \ifdim\leftskip>\zeropoint \relax + \leftskipadaption\leftskip + \fi + \fi \fi - \ifnum\insidedefinition=1 - \advance\leftskip by \leftskipadaption + \ifnum\insidedefinition=\plusone + \advance\leftskip \leftskipadaption \fi \hskip-\leftskipadaption \unhcopy\@@definitiebox - \ifdim\!!widthb=\!!zeropoint + \ifdim\!!widthb=\zeropoint \kern.75em % another default \else \kern\!!widthb @@ -253,39 +236,6 @@ \ignorespaces \@@dodefinitie{#1}} -% \def\@@dostartdefinitie#1[#2]#3% -% {\getvalue{\??dd#1\c!voor}% -% \begingroup -% \doadaptleftskip{\getvalue{\??dd#1\c!marge}}% -% \showcomposition -% \setbox\@@definitiebox=\hbox -% {\forgetall -% \mindermeldingen -% \def\\{\crcr}% -% % \doattributes -% % {\??dd#1}\c!kopletter\c!kopkleur -% % {\doifelsevalue{\??dd#1\c!plaats}{\v!aanelkaar} -% % {\@@definitiewoord{#1}[#2]{#3}{#3}} -% % {\@@definitiewoord{#1}[#2]{#3}{\vbox{\halign{\strut##\hss\cr#3\crcr}}}}}}% -% \doifelsevalue{\??dd#1\c!plaats}{\v!aanelkaar} -% {\@@definitiewoord{#1}[#2]{#3}{#3}} -% {\@@definitiewoord{#1}[#2]{#3}{\vbox{\halign{\strut##\hss\cr#3\crcr}}}}}% -% \!!widthb=\getvalue{\??dd#1\c!afstand}\relax -% \ifdim\!!widthb=\!!zeropoint\relax -% \doifvalue{\??dd#1\c!breedte}{\v!ruim}{\!!widthb=1em}% -% \fi -% \assignwidth -% {\!!widtha} -% {\getvalue{\??dd#1\c!breedte}} -% {\doifelsevaluenothing{\??dd#1\c!monster} -% {\unhcopy\@@definitiebox} -% {\doattributes -% {\??dd#1}\c!kopletter\c!kopkleur -% {\getvalue{\??dd#1\c!tekst}\getvalue{\??dd#1\c!monster}}}} -% {\!!widthb}% -% %\getvalue{\??dd#1\s!do\c!lokaal}% -% \parindent=\!!zeropoint\relax} % \noindent\ignorespaces - %D A new key 'titeluitlijnen' in definitions. \chardef\insidedefinition=0 @@ -298,16 +248,16 @@ \begingroup \doadaptleftskip{\getvalue{\??dd#1\c!marge}}% \showcomposition - \setbox\@@definitiebox=\hbox + \setbox\@@definitiebox\hbox {\forgetall \mindermeldingen \def\\{\crcr}% - \doifelsevalue{\??dd#1\c!plaats}{\v!aanelkaar} + \doifelsevalue{\??dd#1\c!plaats}\v!aanelkaar {\@@definitiewoord{#1}[#2]{#3}{#3}} {\@@definitiewoord{#1}[#2]{#3}{\vbox{\halign{\strut##\hss\cr#3\crcr}}}}}% - \!!widthb=\getvalue{\??dd#1\c!afstand}\relax - \ifdim\!!widthb=\!!zeropoint\relax - \doifvalue{\??dd#1\c!breedte}{\v!ruim}{\!!widthb=1em}% + \!!widthb\getvalue{\??dd#1\c!afstand}\relax + \ifdim\!!widthb=\zeropoint\relax + \doifvalue{\??dd#1\c!breedte}\v!ruim{\!!widthb=1em}% \fi \assignwidth {\!!widtha} @@ -319,8 +269,8 @@ {\getvalue{\??dd#1\c!tekst}\getvalue{\??dd#1\c!monster}}}} {\!!widthb}% %\getvalue{\??dd#1\s!do\c!lokaal}% - \parindent=\!!zeropoint\relax - \doifelsevalue{\??dd#1\c!titeluitlijnen}{\v!nee} + \parindent\zeropoint\relax + \doifelsevalue{\??dd#1\c!titeluitlijnen}\v!nee {\edef\@@leftdefinitieskip {\the\leftskip }% \edef\@@rightdefinitieskip{\the\rightskip}} {\ifcase\insidedefinition @@ -328,33 +278,31 @@ \edef\@@rightdefinitieskip{\the\rightskip}% \fi}% \ifcase\insidedefinition - \chardef\insidedefinition=1 + \chardef\insidedefinition1 \or - \chardef\insidedefinition=2 + \chardef\insidedefinition2 \fi} % now happens elsewhere : \noindent\ignorespaces \def\@@stopdefinitie#1% {\par \dostopattributes \endgroup - \egroup % temporary hack \getvalue{\??dd#1\c!na}% - \doifvalue{\??dd#1\c!springvolgendein}{\v!nee}{\noindentation}} + \egroup % temporary hack + \doifvalue{\??dd#1\c!springvolgendein}\v!nee\noindentation} \def\@@dodefinitie#1% - {\dostartattributes{\??dd#1}\c!letter\c!kleur{}% + {\dostartattributes{\??dd#1}\c!letter\c!kleur\empty \ignorespaces} \def\@@somedefinitie#1[#2]#3% {\bgroup % temporary hack - %\BeforePar{\getvalue{\??dd#1}[#2]{#3}}% \BeforePar{\executedoordefinitie{#1}[#2]{#3}}% \AfterPar{\@@stopdefinitie{#1}}% \GetPar} \def\@@startsomedefinitie#1[#2]#3% {\bgroup % temporary hack - %\BeforePar{\getvalue{\??dd#1}[#2]{#3}}% \BeforePar{\executedoordefinitie{#1}[#2]{#3}}% \GotoPar} @@ -383,7 +331,7 @@ [\s!do\c!status=\v!stop, \s!do\c!commando=\normal@@definitiewoord, #2]% - \doifvalue{\??dd#1\c!plaats}{\v!boven}% + \doifvalue{\??dd#1\c!plaats}\v!boven {\doassign[\??dd#1][\c!tussen={\blanko}]}% \setvalue{#1}% {\dodoubleempty\@@definitie[#1]}% @@ -393,16 +341,14 @@ {\@@stopdefinitie{#1}}}% \def\@@startdefinitie[#1][#2]% - {\doifelsevalue{\??dd#1\s!do\c!status}{\v!start} - {\def\next{\@@startsomedefinitie{#1}[#2]{}}} - {\def\next{\dowithwargument{\@@startsomedefinitie{#1}[#2]}}}% - \next} + {\doifelsevalue{\??dd#1\s!do\c!status}\v!start + {\@@startsomedefinitie{#1}[#2]{}} + {\dowithwargument{\@@startsomedefinitie{#1}[#2]}}} \def\@@definitie[#1][#2]% - {\doifelsevalue{\??dd#1\s!do\c!status}{\v!start} - {\def\next{\@@somedefinitie{#1}[#2]{}}} - {\def\next{\dowithwargument{\@@somedefinitie{#1}[#2]}}}% - \next} + {\doifelsevalue{\??dd#1\s!do\c!status}\v!start + {\@@somedefinitie{#1}[#2]{}} + {\dowithwargument{\@@somedefinitie{#1}[#2]}}} \def\doordefinieren% {\dodoubleemptywithset\dodoordefinieren} @@ -449,18 +395,18 @@ \def\special@@definitiewoord#1#2#3#4[#5]#6#7% {\strut - \doifelsevalue{\??dd#1\c!nummer}{\v!nee} + \doifelsevalue{\??dd#1\c!nummer}\v!nee {\!!doneafalse} {\doifelse{#5}{-} {\!!doneafalse} {\!!doneatrue}}% - \chardef\definitiekoppeling=0 + \chardef\definitiekoppeling0 \iflocation \doifvaluesomething{\??dd#1\c!koppeling} {\processaction % genereert > of < [\getvalue{\??dd#1\c!koppelwijze}] - [ \v!lokaal=>\chardef\definitiekoppeling=1, % old: default - \v!globaal=>\chardef\definitiekoppeling=2]}% new: global crosslinking + [ \v!lokaal=>\chardef\definitiekoppeling1, % old: default + \v!globaal=>\chardef\definitiekoppeling2]}% new: global crosslinking \fi \stelnummerin % the number is called indirectly [\getvalue{\??dd#1\??dd\c!nummer}] @@ -469,11 +415,10 @@ \getvalue{\e!volgende#2#1}% \iflocation \bgroup - \setvalue{\??dd#1\c!sectienummer}{\v!ja}% + \letvalue{\??dd#1\c!sectienummer}\v!ja \protectconversion - %\maakvoorafgaandenummer[#1]% \maakvoorafgaandenummer[\getvalue{\??dd#1\??dd\c!nummer}]% -\preparethenumber{\??dd#1}\voorafgaandenummer\preparednumber + \preparethenumber{\??dd#1}\voorafgaandenummer\preparednumber \ifcase\definitiekoppeling \or \xdef\internaldoornummer{#3{#1}}% \rawreference{\s!num}{#1:\internaldoornummer}{}% @@ -483,9 +428,8 @@ \fi \egroup \fi - %\maakvoorafgaandenummer[#1]% \maakvoorafgaandenummer[\getvalue{\??dd#1\??dd\c!nummer}]% -\preparethenumber{\??dd#1}\voorafgaandenummer\preparednumber + \preparethenumber{\??dd#1}\voorafgaandenummer\preparednumber \hbox {\let\normalkap\relax % sorry, uppercase causes troubles \doattributes % \nocase primitive needed @@ -497,15 +441,13 @@ \edef\localconnection{\getvalue{\??dd#1\c!koppeling}:\internaldoornummer}% \doifreferencefoundelse{\localconnection} {\in[\localconnection]}{}% genereert > of < - %\in[\localconnection]% \fi\fi}% \doifnot{#5}{-}{\rawreference{\s!num}{#5}{#3{#1}}}% \else % Why was this strange expansion needed? \hbox {\edef\!!stringa{\showdnpuretext{#2#1}}% nog eens testen binnen \expanded \expanded{\doattributes{\??dd#1}\noexpand\c!kopletter\noexpand\c!kopkleur - {\noexpand\getvalue{\??dd#1\c!commando}% - {\!!stringa}}}% + {\noexpand\getvalue{\??dd#1\c!commando}{\!!stringa}}}% \doifnot{#5}{-}{\rawreference{\s!num}{#5}{}}}% \fi} @@ -586,7 +528,6 @@ \c!monster,\c!hang,\c!uitlijnen,\c!voor,\c!tussen,\c!na, \c!niveaus,\c!wijze,\c!blokwijze,\c!scheider,\c!marge, \c!springvolgendein,\c!afsluiter,\c!sectienummer,\c!nummer]% -% \ConvertToConstant\doifinstringelse{=}{#4} \doifassignmentelse{#4} {\getparameters[\??dd#3#1]% [\c!tekst=#1,\??dd\c!nummer=#1,\c!conversie=, @@ -594,13 +535,13 @@ {\doifelsenothing{#4} {\getparameters[\??dd#3#1]% [\c!tekst=#1,\??dd\c!nummer=#1,\c!conversie=, -\c!afsluiter=, + \c!afsluiter=, \c!links=,\c!rechts=,\c!koppeling=,\c!koppelwijze=,#4]}% {\copyparameters[\??dd#3#1][\??dd#3#4] [\c!plaats,\c!kopletter,\c!letter,\c!kleur,\c!kopkleur, \c!breedte,\c!nummer,\c!afstand,\c!commando,\c!marge, \c!monster,\c!hang,\c!uitlijnen,\c!voor,\c!tussen,\c!na, -\c!afsluiter, + \c!afsluiter, \c!springvolgendein,\c!links,\c!rechts,\c!koppeling,\c!koppelwijze]% \getparameters[\??dd#3#1] [\c!tekst=#1,\??dd\c!nummer=#4,\c!conversie=,#5]}}% @@ -652,17 +593,17 @@ {\dodosteldoorspringenin[][#1]} {\dodoubleargumentwithset\dodosteldoorspringenin[#1][#2]}} -\def\steldoorspringenin% +\def\steldoorspringenin {\dodoubleempty\dosteldoorspringenin} -\def\startdoorspringen% +\def\startdoorspringen {\witruimte \@@dsvoor \dosomebreak{\goodbreak}% \pagina[\v!voorkeur] \begingroup - \parskip=\!!zeropoint\relax} + \parskip\zeropoint\relax} -\def\stopdoorspringen% +\def\stopdoorspringen {\endgroup \@@dsna} @@ -680,8 +621,8 @@ {\??ds#1}\c!kopletter\c!kopkleur {\getvalue{\??ds#1\c!monster}\getvalue{\??ds#1\c!scheider}}} {\getvalue{\??ds#1\c!afstand}}% - \advance\!!widtha by \getvalue{\??ds#1\c!afstand}% - \setbox2=\hbox to \!!widtha + \advance\!!widtha \getvalue{\??ds#1\c!afstand}% + \setbox2\hbox to \!!widtha {\doattributes {\??ds#1}\c!kopletter\c!kopkleur {\strut @@ -689,7 +630,7 @@ \hss \getvalue{\??ds#1\c!scheider}% \hskip\getvalue{\??ds#1\c!afstand}}}% - \parindent\!!zeropoint + \parindent\zeropoint \hskip#2\!!widtha\indent\box2% \hangindent#3\!!widtha \doattributes{\??ds#1}\c!letter\c!kleur{}% #4}% diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex index f322875fa..73b83cd26 100644 --- a/tex/context/base/core-fig.tex +++ b/tex/context/base/core-fig.tex @@ -159,11 +159,13 @@ \newif\ifskipexternalfigures % \skipexternalfigurestrue +%newif\ifsplitexternalfigures + %D A last switch inhibits running \TEXUTIL. Lets do it when %D possible. \newif\ifrunutilityfile % \runutilityfiletrue -\newif\ifconsultutilityfile \consultutilityfiletrue +\newif\ifconsultutilityfile \consultutilityfiletrue %D When I ever decide to change the format of the figure %D directory file that \TEXUTIL\ produces, the next number @@ -237,14 +239,16 @@ %D method scans the utility files for files with the same name, %D but different type. +\let\figurepathlist\empty + \def\doanalyzefigurefiles#1% - {\let\dodododoanalyzefigurefiles=#1% + {\let\dodododoanalyzefigurefiles#1% \processcommacommand[\@@eftype]\dodoanalyzefigurefiles} \def\dodoanalyzefigurefiles#1% {\ifcase\figurestatus \def\@@efcurrenttype{#1}% - \processcommacommand[\@@ex@@gebied]\dododoanalyzefigurefiles + \processcommacommand[\figurepathlist]\dododoanalyzefigurefiles \fi} \def\dododoanalyzefigurefiles#1% @@ -257,21 +261,21 @@ {\@@effilename.\figureextension{\@@efcurrenttype}}% \to\@@efcurrentfile \dodododoanalyzefigurefiles} - {}% + \donothing \fi} %D Here is our first method: we scan the file directly, parse %D the utility file next, and finaly run \TEXUTIL. The latter %D two of course only take place when the first scan fails. -\def\doanalyzefigurefilesA% +\def\doanalyzefigurefilesA {\ifcase\figurestatus \@@eftrace{locating \@@efcurrentfile\space as \@@efcurrenttype}% \doiffileelse\@@efcurrentfile {\getfiguredimensionsA \getfiguredimensionsB \getfiguredimensionsC} - {}% + \donothing \fi} %D It is possible to let \TEX\ determine the dimensions itself. @@ -286,25 +290,25 @@ % 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} + {\doifinsetelse\@@efextension{\c!tex,\c!tmp} {\ifx\@@efcurrentpath\empty\executedfalse\else\executedtrue\fi} - {\executedfalse}% + \executedfalse \ifexecuted - \global\setbox\foundexternalfigure=\vbox + \global\setbox\foundexternalfigure\vbox {\insidefloattrue \forgetall - \blanko[\v!blokkeer] % niet meer weg ! + \blanko[\v!blokkeer]% niet meer weg ! \startreadingfile - \readfile{#1}{}{}% + \readfile{#1}\donothing\donothing \stopreadingfile \endgraf \removelastskip}% - \global\setbox\foundexternalfigure=\hbox + \global\setbox\foundexternalfigure\hbox {\raise\dp\foundexternalfigure\box\foundexternalfigure}% - #3=\zeropoint - #4=\zeropoint - #5=\wd\foundexternalfigure - #6=\ht\foundexternalfigure + #3\zeropoint + #4\zeropoint + #5\wd\foundexternalfigure + #6\ht\foundexternalfigure \else \@@eftrace{ignored}% \fi} @@ -315,28 +319,28 @@ \def\@@dogetfiguresize{dogetfiguresize} -\def\getfiguredimensionsA% +\def\getfiguredimensionsA {\ifcase\figurestatus \@@eftrace{analyzing \@@efcurrentfile\space on \@@efcurrentpath\space as \@@efcurrenttype}% - \!!widthb=\zeropoint % ? + \!!widthb\zeropoint % ? \doifdefinedelse{\@@dogetfiguresize\@@efcurrenttype} {\executedtrue \getvalue{\@@dogetfiguresize\@@efcurrenttype}% - {\@@efcurrentfile}{\@@efpagina}% - {\!!widtha}{\!!heighta}{\!!widthb}{\!!heightb}} - {\executedfalse}% + \@@efcurrentfile\@@efpagina + \!!widtha\!!heighta\!!widthb\!!heightb} + \executedfalse \ifexecuted \donetrue \ifdim\!!widtha=\zeropoint\relax\ifdim\!!heighta=\zeropoint\relax \ifdim\!!widthb=\zeropoint\relax\ifdim\!!heightb=\zeropoint\relax - \showmessage{\m!figures}{10}{\@@efcurrentfile}% + \showmessage\m!figures{10}\@@efcurrentfile \@@eftrace{zero}% \donefalse \fi\fi \fi\fi - \doifelse{\@@efcurrenttype}{\c!mps} + \doifelse\@@efcurrenttype\c!mps {\ifcase\EPScreator \executedfalse \else @@ -351,7 +355,7 @@ \fi \ifexecuted \chardef\figurestatus=3 - \doifelse{\@@efcurrenttype}{\c!eps} + \doifelse\@@efcurrenttype\c!eps {\ifcase\EPScreator \@@eftrace{found}% \else @@ -376,10 +380,10 @@ \def\dogetfiguresizeeps#1#2#3#4#5#6% {\dogetEPSboundingbox{#1}{#3}{#4}{#5}{#6}} -\def\dogetfiguresizemps% +\def\dogetfiguresizemps {\dogetfiguresizeeps} -\def\getfiguredimensionsB% +\def\getfiguredimensionsB {\ifcase\figurestatus\ifcase\figurefilemode\else %\def\@@efloadname{\@@efcurrentpath\f!pathseparator\@@exfile}% \assignfullfilename\@@efcurrentpath\@@exfile\to\@@efloadname @@ -388,10 +392,10 @@ on \@@efcurrentpath\space for \@@effilenametype}% \pushendofline - \let\presetfigure=\presetfigureA -\startreadingfile - \readsetfile{\@@efcurrentpath}{\@@exfile}\relax\relax -\stopreadingfile + \startreadingfile + \let\presetfigure\presetfigureA + \readsetfile\@@efcurrentpath\@@exfile\donothing\donothing + \stopreadingfile \popendofline \@@eftrace{\ifcase\figurestatus not \fi found}% \fi\fi} @@ -400,19 +404,18 @@ {\ifcase\figurestatus \@EA\DOIF\@EA{\@@effilenametype}{#1} % hm, tzt ook nog eens met pad/naam {\getparameters[\??ep][#2]% - \ExpandBothAfter\doif{\@@epe}{\@@efcurrenttype} - {\chardef\figurestatus=4 + \ExpandBothAfter\doif\@@epe\@@efcurrenttype + {\chardef\figurestatus4 \let\@@eftype\@@efcurrenttype \let\@@effullname\@@efcurrentfile}}% \else \endinput \fi} -\def\getfiguredimensionsC% +\def\getfiguredimensionsC {\ifconsultutilityfile \ifrunutilityfile \ifcase\figurestatus\ifcase\figurefilemode\else - %\doif{\@@efcurrenttype}{\c!tex} % oeps, was wrong - \doifnotinset{\@@efextension}{\c!tex,\c!tmp} + \doifnotinset\@@efextension{\c!tex,\c!tmp} {\doiffileelse\@@efcurrentfile {\edef\@@effilenametype{\@@effilename.\@@efcurrenttype}% \@@eftrace{running texutil on \@@effilenametype}% @@ -421,10 +424,10 @@ {texutil --fig --out=\@@efloadname\space\@@effilenametype}% \@@eftrace{analyzing \@@efloadname\space on \@@effilenametype}% \pushendofline -\startreadingfile - \let\presetfigure=\presetfigureB - \readsetfile{.}{\@@efloadname}\relax\relax -\stopreadingfile + \startreadingfile + \let\presetfigure\presetfigureB + \readsetfile{.}\@@efloadname\donothing\donothing + \stopreadingfile \popendofline \@@eftrace{\ifcase\figurestatus not \fi found}} {}}% @@ -440,7 +443,7 @@ %D The second pass over types and directories uses the %D utilility files. -\def\doanalyzefigurefilesB% +\def\doanalyzefigurefilesB {\ifconsultutilityfile\ifcase\figurestatus\ifcase\figurefilemode\else %\def\@@efloadname{\@@efcurrentpath\f!pathseparator\@@exfile}% \assignfullfilename\@@efcurrentpath\@@exfile\to\@@efloadname @@ -449,10 +452,10 @@ on \@@efcurrentpath\space for \@@effilenametype}% \pushendofline - \let\presetfigure=\presetfigureC -\startreadingfile - \readsetfile{\@@efcurrentpath}{\@@exfile}\relax\relax -\stopreadingfile + \startreadingfile + \let\presetfigure\presetfigureC + \readsetfile\@@efcurrentpath\@@exfile\donothing\donothing + \stopreadingfile \popendofline \@@eftrace{\ifcase\figurestatus not \fi found}% \fi\fi\fi} @@ -461,8 +464,8 @@ {\ifcase\figurestatus \@EA\DOIF\@EA{\@@effilenametype}{#1} {\getparameters[\??ep][#2]% - \doif{\@@epe}{\@@efcurrenttype} - {\chardef\figurestatus=4 + \doif\@@epe\@@efcurrenttype + {\chardef\figurestatus4 \let\@@eftype\@@efcurrenttype \let\@@effullname\@@efcurrentfile}}% \else @@ -472,7 +475,7 @@ %D The last and third pass mainly differs from the second in %D being more tolerant. -\def\doanalyzefigurefilesC% +\def\doanalyzefigurefilesC {\ifconsultutilityfile\ifcase\figurestatus\ifcase\figurefilemode\else %\def\@@efloadname{\@@efcurrentpath\f!pathseparator\@@exfile}% \assignfullfilename\@@efcurrentpath\@@exfile\to\@@efloadname @@ -480,10 +483,10 @@ on \@@efcurrentpath\space for \@@effilename.* surrogate}% \pushendofline - \let\presetfigure=\presetfigureD -\startreadingfile - \readsetfile{\@@efcurrentpath}{\@@exfile}\relax\relax -\stopreadingfile + \startreadingfile + \let\presetfigure\presetfigureD + \readsetfile\@@efcurrentpath\@@exfile\donothing\donothing + \stopreadingfile \popendofline \@@eftrace{\ifcase\figurestatus not \fi found}% \fi\fi\fi} @@ -492,12 +495,12 @@ {\ifcase\figurestatus \@EA\DOIFINSTRINGELSE\@EA{\@@effilename.}{#1} {\getparameters[\??ep][#2]% - \ExpandBothAfter\doifinsetelse{\@@epe}{\@@efcurrenttype} - {\chardef\figurestatus=4 + \ExpandBothAfter\doifinsetelse\@@epe\@@efcurrenttype + {\chardef\figurestatus4 \let\@@eftype\@@efcurrenttype \let\@@effullname\@@efcurrentfile} - {}} - {}% + \donothing} + \donothing \else \endinput \fi} @@ -507,8 +510,9 @@ %D versions don't match. \def\thisisfigureversion#1% - {\doifnot{\figureversion}{#1} - {\showmessage{\m!figures}{7}{\@@efloadname}\endinput}} + {\doifnot\figureversion{#1} + {\showmessage\m!figures7\@@efloadname + \endinput}} %D Some files, take for instance movies, cannot easilly be %D parsed on dimensions, that is, not yet. Although the current @@ -518,28 +522,26 @@ %D can disable \type{preset}. When no preset is needed, we only %D locate the file. -\def\locatepresetfigurefiles% +\def\locatepresetfigurefiles {\processcommacommand[\@@eftype]\dolocatepresetfigurefiles} \def\dolocatepresetfigurefiles#1% {\def\@@efcurrenttype{#1}% - \processcommacommand[\@@ex@@gebied]\dodolocatepresetfigurefiles} + \processcommacommand[\figurepathlist]\dodolocatepresetfigurefiles} \def\dodolocatepresetfigurefiles#1% {\ifcase\figurestatus \doiffileinsertionsupportedelse\@@efcurrenttype - {%\edef\@@efcurrentfile% - % {#1\f!pathseparator\@@effilename.\figureextension{\@@efcurrenttype}}% - \assignfullfilename + {\assignfullfilename {#1}{\@@effilename.\figureextension{\@@efcurrenttype}}% \to\@@efcurrentfile \@@eftrace{only searching for \@@efcurrentfile}% \doiffileelse\@@efcurrentfile - {\chardef\figurestatus=1 + {\chardef\figurestatus\plusone \let\@@eftype\@@efcurrenttype \let\@@effullname\@@efcurrentfile} - {}} - {}% + \donothing} + \donothing \fi} %D All these macros are in some way called by the macro \type @@ -548,17 +550,17 @@ % bools gebruiken -\def\setnaturalfiguresize% - {\doifsomething{\@@efbreedte} - {\global\figwid=\@@efbreedte}% - \doifsomething{\@@efhoogte} - {\global\fighei=\@@efhoogte}% - \doifsomething{\@@efschaal} - {\figxsca=\@@efschaal - \figysca=\@@efschaal}} - -\def\setfactorfiguresize% - {\doifinsetelse{\@@effactor}{\v!max,\v!passend,\v!ruim} +\def\setnaturalfiguresize + {\doifsomething\@@efbreedte + {\global\figwid\@@efbreedte}% + \doifsomething\@@efhoogte + {\global\fighei\@@efhoogte}% + \doifsomething\@@efschaal + {\figxsca\@@efschaal + \figysca\@@efschaal}} + +\def\setfactorfiguresize + {\doifinsetelse\@@effactor{\v!max,\v!passend,\v!ruim} {\doapplyfiguresize \ifdim\@@epw>\@@eph\relax \docalculatefigurenorm\figwid\@@effactor\@@efmaxbreedte\hsize\@@efhsize @@ -568,12 +570,12 @@ \docalculatefigurescales\fighei\@@eph\figwid\@@epw \fi \!!doneatrue} - {\doifinsetelse{\@@efhfactor}{\v!max,\v!passend,\v!ruim} + {\doifinsetelse\@@efhfactor{\v!max,\v!passend,\v!ruim} {\doapplyfiguresize \docalculatefigurenorm\fighei\@@efhfactor\@@efmaxhoogte\figurevsize\@@efvsize \docalculatefigurescales\fighei\@@eph\figwid\@@epw \!!doneatrue} - {\doifinsetelse{\@@efbfactor}{\v!max,\v!passend,\v!ruim} + {\doifinsetelse\@@efbfactor{\v!max,\v!passend,\v!ruim} {\doapplyfiguresize \docalculatefigurenorm\figwid\@@efbfactor\@@efmaxbreedte\hsize\@@efhsize \docalculatefigurescales\figwid\@@epw\fighei\@@eph @@ -584,35 +586,35 @@ \!!doneafalse}}}% \if!!donea \ifdim\figwid>\@@efhsize\relax - \global\fighei=\zeropoint - \global\figwid=\@@efhsize + \global\fighei\zeropoint + \global\figwid\@@efhsize \else\ifdim\fighei>\@@efvsize\relax - \global\fighei=\@@efvsize - \global\figwid=\zeropoint + \global\fighei\@@efvsize + \global\figwid\zeropoint \fi\fi \fi} -\def\setscalefiguresize% - {\doifsomething{\@@efschaal} +\def\setscalefiguresize + {\doifsomething\@@efschaal {\doapplyfigurescale\figwid\@@epw\figxsca \doapplyfigurescale\fighei\@@eph\figysca - \global\figwid=\zeropoint - \global\fighei=\zeropoint - \doifelsenothing{\@@efmaxbreedte} - {\doifsomething{\@@efmaxhoogte} + \global\figwid\zeropoint + \global\fighei\zeropoint + \doifelsenothing\@@efmaxbreedte + {\doifsomething\@@efmaxhoogte {\ifdim\@@eph>\@@efmaxhoogte - \global\fighei=\@@efmaxhoogte + \global\fighei\@@efmaxhoogte \fi}} {\ifdim\@@epw>\@@efmaxbreedte - \global\figwid=\@@efmaxbreedte + \global\figwid\@@efmaxbreedte \fi}}} \def\dosetdimensionfiguresize#1#2#3% {#1\relax - \doifsomething{\@@efmaxbreedte} - {\ifdim\figwid>\@@efmaxbreedte\global\figwid=\@@efmaxbreedte#2\relax\fi}% - \doifsomething{\@@efmaxhoogte} - {\ifdim\fighei>\@@efmaxhoogte \global\fighei=\@@efmaxhoogte #3\relax\fi}} + \doifsomething\@@efmaxbreedte + {\ifdim\figwid>\@@efmaxbreedte\global\figwid\@@efmaxbreedte#2\relax\fi}% + \doifsomething\@@efmaxhoogte + {\ifdim\fighei>\@@efmaxhoogte \global\fighei\@@efmaxhoogte #3\relax\fi}} \def\setdimensionfiguresize {\ifdim\figwid>\zeropoint\relax @@ -645,50 +647,55 @@ \fi \fi} -\def\setupexternalfigures% +\def\setupexternalfigures {\dosingleempty\dosetupexternalfigures} \def\dosetupexternalfigures[#1]% needs a good clean up {\getparameters[\??ex][#1]% \getparameters[\??ef][#1]% dangerous for figs with backgrounds - \doifelsenothing{\@@explaats} % fig file paths - {\scratchcounter=3 } - {\doifelsenothing{\@@exfile} % tuf file paths - {\scratchcounter=3 } - {\scratchcounter=0 - \ExpandBothAfter\doifinset{\v!lokaal}{\@@explaats} + \checkfiguresettings + \doifelsenothing\@@explaats % fig file paths + {\scratchcounter3 } + {\doifelsenothing\@@exfile % tuf file paths + {\scratchcounter3 } + {\scratchcounter0 + \ExpandBothAfter\doifinset\v!lokaal\@@explaats {\advance\scratchcounter 1 }% - \ExpandBothAfter\doifinset{\v!globaal}{\@@explaats} + \ExpandBothAfter\doifinset\v!globaal\@@explaats {\advance\scratchcounter 2 }}}% - \chardef\figurefilemode=\scratchcounter + \chardef\figurefilemode\scratchcounter\relax \ifcase\figurefilemode - \let\@@ex@@gebied\f!currentpath + \let\figurepathlist\f!currentpath \or % lokaal - \let\@@ex@@gebied\f!currentpath + \let\figurepathlist\f!currentpath \or % globaal - \let\@@ex@@gebied\@@exgebied + \let\figurepathlist\@@exgebied \or % lokaal,globaal / non empty gebied - \edef\@@ex@@gebied{\f!currentpath\ifx\@@exgebied\empty\else,\fi\@@exgebied}% + \edef\figurepathlist{\f!currentpath\ifx\@@exgebied\empty\else,\fi\@@exgebied}% \fi - \ExpandBothAfter\doifinset{\v!default}{\@@explaats} - {\edef\@@ex@@gebied{\@@ex@@gebied,}}% default tex path search + \ExpandBothAfter\doifinset\v!default\@@explaats + {\edef\figurepathlist{\figurepathlist,}}% default tex path search \ifx\@@exfile\empty - \chardef\figurefilemode=0 + \chardef\figurefilemode\zerocount \fi} %D The next one is for instance used in symbols: -\def\resetexternalfigures% +\def\resetexternalfigures {\setupexternalfigures [\c!optie=,\c!maxbreedte=,\c!maxhoogte=, + %\c!splitskleur=,% needed ? + \c!voorgrondkleur=, \c!kader=\v!uit,\c!achtergrond=]} %D Since we only need to reset some parameters, we can %D better use a faster alternative: -\def\resetexternalfigures% +\def\resetexternalfigures {\getparameters[\??ef] [\c!optie=,\c!maxbreedte=,\c!maxhoogte=, + %\c!splitskleur=,% needed ? + \c!voorgrondkleur=, \c!kader=\v!uit,\c!achtergrond=]} %D This one dropped the runtime of the \MAPS\ bibliography @@ -715,118 +722,87 @@ [ \v!max=>\global#1=#4\relax, \v!passend=>\global#1=#5\relax, \v!ruim=>\global#1=#5\relax - \global\advance #1 by -4\@@exkorps\relax, + \global\advance #1 -4\@@exkorps\relax, \s!default=>\doifsomething{#3}{\global#1=#3\relax}, \s!unknown=>\global#1=\@@exkorps\relax - \global\divide#1 by \!!ten\relax - \global\multiply#1 by #2\relax]} + \global\divide#1 \!!ten\relax + \global\multiply#1 #2\relax]} \def\docalculatefigurescales#1#2#3#4% {\dimen0=#1\relax % #1 = new 1-value \dimen2=#2\relax % #2 = old 1-value - \divide\dimen2 by \!!thousand - \divide\dimen0 by \dimen2 - \figxsca=\dimen0 % x scale - \figysca=\dimen0 % y scale + \divide\dimen2 \!!thousand + \divide\dimen0 \dimen2 + \figxsca\dimen0 % x scale + \figysca\dimen0 % y scale \dimen2=#4\relax % #4 = old 2-value - \divide\dimen2 by \!!thousand - \multiply\dimen2 by \dimen0 + \divide\dimen2 \!!thousand + \multiply\dimen2 \dimen0 #3=\dimen2 } % #3 = new 2-value \def\docalculatefigurescale#1#2#3% {\dimen0=#1\relax % #1 = new value \dimen2=#2\relax % #2 = old value - \divide\dimen2 by \!!thousand - \divide\dimen0 by \dimen2 + \divide\dimen2 \!!thousand + \divide\dimen0 \dimen2 #3=\dimen0 } % #3 = schaal \def\doapplyfigurescale#1#2#3% {\global#1=#2\relax - \ifcase0\@@efschaal\relax + \ifcase0\@@efschaal\relax % beter: doifnum... #3=\!!thousand \else #3=\@@efschaal - \fi - \relax % important ! + \fi\relax % important ! \ifnum#3=\!!thousand\else - \global\divide#1 by \!!thousand - \global\multiply#1 by #3\relax + \global\divide #1 \!!thousand + \global\multiply#1 #3\relax \fi} \newdimen\figurevsize % we cannot manipulate any global vsize ! -% \def\doapplyfiguresize% -% {\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 -% \doifelsenothing{\@@efhoogte} -% {\edef\@@efvsize{\the\scratchdimen}} -% {\let\@@efvsize=\@@efhoogte}% -% \doifelsenothing{\@@efbreedte} -% {\edef\@@efhsize{\the\hsize}} -% {\let\@@efhsize=\@@efbreedte}} - -\def\doapplyfiguresize% - {\doifelsenothing{\@@efmaxhoogte} - {\figurevsize=\teksthoogte +\def\doapplyfiguresize + {\doifelsenothing\@@efmaxhoogte + {\figurevsize\teksthoogte \ifinner - \figurevsize =\vsize % \teksthoogte =\vsize - \scratchdimen=\vsize % \scratchdimen=\teksthoogte + \figurevsize \vsize % \teksthoogte =\vsize + \scratchdimen\vsize % \scratchdimen=\teksthoogte \else\ifinsidefloat - \figurevsize =\vsize % \teksthoogte =\vsize - \scratchdimen=\vsize % \scratchdimen=\teksthoogte + \figurevsize \vsize % \teksthoogte =\vsize + \scratchdimen\vsize % \scratchdimen=\teksthoogte \else\ifinpagebody - \figurevsize =\vsize % \teksthoogte =\vsize - \scratchdimen=\vsize % \scratchdimen=\teksthoogte - \else + \figurevsize \vsize % \teksthoogte =\vsize + \scratchdimen\vsize % \scratchdimen=\teksthoogte + \else % hm, there should be an option to force this \ifdim\pagegoal<\maxdimen \ifdim\pagetotal<\pagegoal - \scratchdimen=\pagegoal - \advance\scratchdimen by -\pagetotal + \scratchdimen\pagegoal + \advance\scratchdimen -\pagetotal \else - \scratchdimen=\figurevsize % \teksthoogte + \scratchdimen\figurevsize % \teksthoogte \fi \else - \scratchdimen=\figurevsize % \teksthoogte + \scratchdimen\figurevsize % \teksthoogte \fi \fi\fi\fi} - {\figurevsize=\@@efmaxhoogte}% - \doifelsenothing{\@@efhoogte} + {\figurevsize\@@efmaxhoogte}% + \doifelsenothing\@@efhoogte {\edef\@@efvsize{\the\scratchdimen}} - {\let\@@efvsize=\@@efhoogte}% - \doifelsenothing{\@@efbreedte} + {\let\@@efvsize\@@efhoogte}% + \doifelsenothing\@@efbreedte {\edef\@@efhsize{\the\hsize}} - {\let\@@efhsize=\@@efbreedte}} + {\let\@@efhsize\@@efbreedte}} \def\convertfigureinsertscale#1#2#3#4% - {\scratchdimen=#1\relax + {\scratchdimen#1\relax \ifnum#3=\!!thousand\else % better 1000 100 10 ranges, evt round 2sp - \divide\scratchdimen by \!!thousand - \multiply\scratchdimen by #3\relax + \divide\scratchdimen \!!thousand + \multiply\scratchdimen #3\relax \fi - \scratchdimen=-\scratchdimen % beter hier - dan in driver - \edef#2{\scratchdimen}% - \scratchdimen=#3pt - \divide\scratchdimen by \!!ten + \scratchdimen-\scratchdimen % beter hier - dan in driver + \edef#2{\the\scratchdimen}% oeps, \the vergeten + \scratchdimen#3\s!pt + \divide\scratchdimen \!!ten \edef#4{\@EA\withoutpt\@EA{\the\scratchdimen}}} \newbox\foundexternalfigure @@ -865,17 +841,294 @@ % become replaced by its xml counterpart; for that I first % need to patch texutil. +\def\checkfiguresettings + {\doifsomething\@@efregels + {\scratchdimen\@@efregels\lineheight + \edef\@@efhoogte{\the\scratchdimen}}} + +% \def\calculateexternalfigure[#1][#2][#3][#4][#5][#6]% +% {\mindermeldingen +% \setupexternalfigures +% \the\externalfigureresets % hook, see resource libraries +% \global\figwid\zeropoint \figxsca\plusone % see note * +% \global\fighei\zeropoint \figysca\plusone % see note * +% \global\setbox\foundexternalfigure\box\voidb@x +% \edef\expandedfigurename{#3}% needed e.g. in [\get...] cases +% \expandafter\beforesplitstring\expandedfigurename\at.\to\@@effilename +% \expandafter\aftersplitstring \expandedfigurename\at.\to\@@efextension +% \doifelse\@@effilename{mprun} +% {\edef\@@effilepref{\bufferprefix}} +% {\let \@@effilepref\empty}% +% \edef\@@effilename{\@@effilepref\@@effilename}% +% \restorecatcodes % recently added; we presume local use +% \def\@@eflabel{#2}% +% \global\let\externalfigurelog\empty +% \getparameters +% [\??ep] +% [\c!e=\s!unknown, +% \c!w=15\korpsgrootte,\c!h=10\korpsgrootte, +% \c!x=\!!zeropoint,\c!y=\!!zeropoint, +% \c!t=,\c!s=,\c!a=,\c!f=\@@effilename]% +% \getparameters +% [\??ef] +% [\c!type=\s!unknown,\c!methode=\@@eftype,\c!symbool=\v!nee, +% \c!object=\@@exobject,\c!preset=\v!ja, +% \c!pagina=0,\c!sturing=\v!nee,\c!preview=\v!nee,\c!herhaal=\v!nee, +% \c!maxbreedte=\@@exmaxbreedte,\c!maxhoogte=\@@exmaxhoogte, +% \c!schaal=,\c!breedte=,\c!hoogte=,\c!scherm=,\c!regels=, +% %\c!voorgrondkleur=, +% \c!splitsen=, +% \c!factor=,\c!hfactor=,\c!bfactor=]% +% \doif\@@efextension\c!mov\presetfiguremov +% \doif\@@efextension\c!avi\presetfigureavi +% #1[#4][#5][#6]% +% % lines -> height +% \checkfiguresettings +% % new, color separation +% \doifseparatingcolorselse +% {\let\@@efvoorgrondkleur\empty +% \doifelsenothing\@@efsplitsen +% {\splitexternalfiguresfalse} +% {\doifcolorchannelelse\@@efsplitsen +% {\splitexternalfiguresfalse} +% {\let\@@efobject\v!nee +% \splitexternalfigurestrue}}} +% {\splitexternalfiguresfalse}% +% % new, fake color in gray bitmaps +% \doifsomething\@@efvoorgrondkleur +% {\getparameters[\??ef] +% [\c!achtergrond={\v!voorgrond,\v!kleur}, +% \c!achtergrondkleur=\@@efvoorgrondkleur]}% +% % +% \doif\@@efreset\v!ja \resetexternalfigures +% \doif\@@eftype \c!mov\presetfiguremov +% \doif\@@eftype \c!avi\presetfigureavi +% % hack +% \doif\@@efmethode\c!mov +% {\doifsomething\@@efextension{\presetundefinedfigure\@@efextension}}% +% % +% \doif\@@eftype\v!buffer +% {\ifx\@@efextension\empty +% \let\@@efextension\c!tmp +% \fi +% \let\@@eftype\c!tex}% +% %\@EA\doifnumberelse\@EA{\@@efextension} % new, test first +% %{\def\@@eftype{\c!mps}} +% %{% +% \processaction +% [\@@efextension] +% [ \c!tex=>\let\@@eftype\c!tex, +% \c!tmp=>\let\@@eftype\c!tex +% \edef\@@effilepref{\bufferprefix}% +% \edef\@@effilename{\@@effilepref\@@effilename}, +% \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 +% \edef\@@efobjectname{\@@effilename-\@@eftype-\@@efextension-\@@efpagina}% +% \doifelse\@@efobject\v!nee +% \donefalse +% {\doifspecialavailableelse\dostartscaling +% {\doifobjectssupportedelse +% {\doifobjectfoundelse{FIG}{\@@efobjectname}{\donetrue}{\donefalse}} +% \donefalse} +% \donefalse}% +% % redo message, only filename +% \doifparentfileelse\@@effilename +% {\@EA\removefromcommalist\@EA{\jobsuffix}\figuretypes +% \let\@@efextension\empty +% \showmessage\m!figures9\@@effilename +% \donefalse} +% \donothing +% \ifdone +% \getobjectdimensions{FIG}{\@@efobjectname}% +% \geteparameters % e ! +% [\??ep] +% [\c!x=\!!zeropoint,\c!y=\!!zeropoint, +% \c!w=\objectwidth,\c!h=\objectheight]% +% \chardef\figurestatus=5 +% \edef\@@effullname{\@@effilepref#3}% +% \else +% \doifelse{#2}\s!figurepreset +% {\def\figureextension##1{\@@efextension}% +% \edef\@@effullname{\@@effilepref#3}}% +% {\ifx\@@efextension\empty +% \dogetcommacommandelement1\from\@@eftype\to\commalistelement +% \edef\@@effullname{\@@effilename.\commalistelement}% +% \def\figureextension##1{##1}% +% \else +% \@EA\doifnumberelse\@EA{\@@efextension} +% {\let\@@eftype\c!mps}\donothing +% \edef\@@effullname{\@@effilename.\@@efextension}% +% \def\figureextension##1{\@@efextension}% +% \fi}% +% \doifelse\@@efpreset\v!nee +% {\doifelse\@@eftype\s!unknown +% {\chardef\figurestatus0 +% \let\@@eftype\figuretypes +% \locatepresetfigurefiles} +% {\chardef\figurestatus1 }} +% {\doifelse\@@eftype\s!unknown +% {\let\@@eftype\figuretypes} +% {\@EA\removefromcommalist\@EA{\@@eftype}\figuretypes +% \edef\@@eftype{\ifx\@@eftype\empty\else\@@eftype,\fi\figuretypes}}% +% \ifx\@@efextension\empty\else +% \ExpandBothAfter\doifinsetelse\@@efextension\@@eftype +% {\@EA\removefromcommalist\@EA{\@@efextension}\@@eftype +% \edef\@@eftype{\@@efextension,\@@eftype}}% +% \donothing +% \fi +% \doifelse{#2}\s!figurepreset +% {\chardef\figurestatus4 +% %\def\@@efloadname{\f!currentpath\f!pathseparator\@@exfile}% +% \assignfullfilename\f!currentpath\@@exfile\to\@@efloadname +% \let\@@eftype\@@epe} +% {\chardef\figurestatus\zerocount +% \analyzefigurefiles}}% +% \let\@@epe\@@eftype +% \edef\@@efextension{\figureextension{\@@eftype}}% dirty trick +% \global\figwid\zeropoint \figxsca\plusone +% \global\fighei\zeropoint \figysca\plusone +% \doif\v!kader\@@exoptie +% {\let\@@efkader\v!aan}% +% \fi +% \ifcase\figurestatus +% \let\@@efkader\v!aan +% \let\@@efobject\v!nee +% \showmessage\m!figures1{\@@effilename}% +% \or +% \showmessage\m!figures2{\@@effullname}% +% \or +% \showmessage\m!figures3{\@@effullname,\@@eflenttype}% +% \or +% \showmessage\m!figures4{\@@effullname}% +% \or +% \showmessage\m!figures5{\@@effullname,\@@efloadname}% +% \or % no message +% \doifnot\@@efsymbool\v!ja +% {\showmessage\m!figures8{\@@effullname}}% +% \fi +% \ifdim\@@epw=\zeropoint \chardef\figurestatus1 \fi +% \ifdim\@@eph=\zeropoint \chardef\figurestatus1 \fi +% \ifnum\figurestatus=1 % unknown dimensions, take width or height or scale +% \setnaturalfiguresize +% \xdef\naturalfigurewidth{\the\figwid}% +% \xdef\naturalfigureheight{\the\fighei}% +% \let\@@efkader\v!uit +% \else +% \global\let\naturalfigurewidth\@@epw +% \global\let\naturalfigureheight\@@eph +% \setfactorfiguresize +% \setscalefiguresize +% \setdimensionfiguresize +% \fi +% \convertfigureinsertscale\@@epx\figx\figxsca\scax +% \convertfigureinsertscale\@@epy\figy\figysca\scay +% \iftraceexternalfigures +% \message +% {\externalfigurelog +% [\@@effullname: +% t={\@@eftype}\space m={\@@efmethode}\space l=\@@eflabel\space +% w=\number\figwid\space h=\number\fighei\space +% \c!sx=\scax\space\c!sy=\scay\space +% ox=\figx\space oy=\figy]}% +% \fi +% \doif\v!leeg\@@exoptie +% {\skipexternalfigurestrue +% \let\@@efkader\v!uit}% ? ? +% \doifelsenothing\@@efpagina % NIEUW ?? +% {\let\@@efoptions\empty} +% {\let\@@efoptions\@@efpagina}% +% \doif\@@efpreview\v!ja{\addtocommalist\v!preview\@@efoptions}% +% \doif\@@efsturing\v!ja{\addtocommalist\v!sturing\@@efoptions}% +% \doif\@@efherhaal\v!ja{\addtocommalist\v!herhaal\@@efoptions}% +% \doif\@@eftype\c!mps +% {\ifcase\EPSspecial\else\ifinobject\else +% \@@eftrace{special mps, object forced}% +% \doglobal\increment\forcedMPSobject +% \edef\@@efobjectname{\c!mps::\forcedMPSobject}% +% \let\@@efobject\v!ja +% \fi\fi}% +% \global\let\lastfigureobjectname\@@efobjectname +% \doifelse\@@efobject\v!nee +% \donefalse +% {\doifobjectssupportedelse\donetrue\donefalse}% +% \ifdone +% \doifobjectfoundelse{FIG}\@@efobjectname +% \donothing +% {\bgroup % to be cleaned up +% \figwid\@@epw % local ? +% \fighei\@@eph % local ? +% \scratchdimen\@@epx\scratchdimen-\scratchdimen +% \edef\@@epx{\the\scratchdimen}% +% \scratchdimen\@@epy\scratchdimen-\scratchdimen +% \edef\@@epy{\the\scratchdimen}% +% %\scratchdimen\@@epw\edef\@@epw{\the\scratchdimen}% +% %\scratchdimen\@@eph\edef\@@eph{\the\scratchdimen}% +% \setbox0\vbox to \fighei +% {\vfill +% \ifdim\wd\foundexternalfigure=\zeropoint +% \doinsertfile +% {\@@eftype,\@@efmethode}{\@@effullname,\@@eflabel} +% {100}{100}\@@epx\@@epy\@@epw\@@eph\@@efoptions +% \else\ifskipexternalfigures +% \ruledhbox +% {\backgroundline +% [\@@efsplitskleur]{\fakebox\foundexternalfigure}}% +% \else +% \box\foundexternalfigure +% \fi\fi}% +% \wd0=\figwid +% \setobject{FIG}\@@efobjectname\vbox{\box0}% +% \setxvalue{\@@efobjectname\c!n}{\number\nofinsertpages}% +% \egroup}% +% \fi +% \xdef\figurewidth {\the\figwid}% +% \xdef\figureheight{\the\fighei}% +% \global\setbox\foundexternalfigure\vbox to \fighei +% {\vfill +% \hsize\figwid +% \ifdone +% \dimen0=\scax\s!pt\divide\dimen0 100\edef\scax{\@EA\withoutpt\the\dimen0}% +% \dimen0=\scay\s!pt\divide\dimen0 100\edef\scay{\@EA\withoutpt\the\dimen0}% +% \schaal[\c!sx=\scax,\c!sy=\scay]{\dowithfigure{\getobject{FIG}{\@@efobjectname}}}% +% \xdef\noffigurepages{\number\getvalue{\@@efobjectname\c!n}}% +% \else\ifdim\wd\foundexternalfigure=\zeropoint +% \dowithfigure +% {\doinsertfile +% {\@@eftype,\@@efmethode}{\@@effullname,\@@eflabel} +% \scax\scay\figx\figy\figwid\fighei\@@efoptions}% +% \xdef\noffigurepages{\number\nofinsertpages}% +% \else +% \dimen0=\scax\s!pt\divide\dimen0 100\edef\scax{\@EA\withoutpt\the\dimen0}% +% \dimen0=\scay\s!pt\divide\dimen0 100\edef\scay{\@EA\withoutpt\the\dimen0}% +% \schaal[\c!sx=\scax,\c!sy=\scay]{\dowithfigure{\box\foundexternalfigure}}% +% \xdef\noffigurepages{\number\nofinsertpages}% +% \fi\fi +% \global\let\appliedfigurexscale\scax +% \global\let\appliedfigureyscale\scay}% +% \global\wd\foundexternalfigure\figwid +% \finalizeexternalfigure{#2}{#3}} + +\chardef\splitexternalfigure=0 % 0 nosplit 1 split/yes 2 split/no + \def\calculateexternalfigure[#1][#2][#3][#4][#5][#6]% {\mindermeldingen \setupexternalfigures \the\externalfigureresets % hook, see resource libraries - \global\figwid\zeropoint \figxsca1 % see note * - \global\fighei\zeropoint \figysca1 % see note * - \global\setbox\foundexternalfigure=\box\voidb@x + \global\figwid\zeropoint \figxsca\plusone % see note * + \global\fighei\zeropoint \figysca\plusone % see note * + \global\setbox\foundexternalfigure\box\voidb@x \edef\expandedfigurename{#3}% needed e.g. in [\get...] cases \expandafter\beforesplitstring\expandedfigurename\at.\to\@@effilename \expandafter\aftersplitstring \expandedfigurename\at.\to\@@efextension - \doifelse{\@@effilename}{mprun} + \doifelse\@@effilename{mprun} {\edef\@@effilepref{\bufferprefix}} {\let \@@effilepref\empty}% \edef\@@effilename{\@@effilepref\@@effilename}% @@ -894,25 +1147,47 @@ \c!object=\@@exobject,\c!preset=\v!ja, \c!pagina=0,\c!sturing=\v!nee,\c!preview=\v!nee,\c!herhaal=\v!nee, \c!maxbreedte=\@@exmaxbreedte,\c!maxhoogte=\@@exmaxhoogte, - \c!schaal=,\c!breedte=,\c!hoogte=,\c!scherm=, + \c!schaal=,\c!breedte=,\c!hoogte=,\c!scherm=,\c!regels=, + %\c!voorgrondkleur=, + \c!splitsen=, \c!factor=,\c!hfactor=,\c!bfactor=]% - \doif{\@@efextension}{\c!mov}{\presetfiguremov}% - \doif{\@@efextension}{\c!avi}{\presetfigureavi}% + \doif\@@efextension\c!mov\presetfiguremov + \doif\@@efextension\c!avi\presetfigureavi #1[#4][#5][#6]% - \doif{\@@efreset}{\v!ja}{\resetexternalfigures}% - \doif{\@@eftype}{\c!mov}{\presetfiguremov}% - \doif{\@@eftype}{\c!avi}{\presetfigureavi}% -% hack -\doif{\@@efmethode}{\c!mov}{\doifsomething{\@@efextension}{\presetundefinedfigure\@@efextension}}% -% - \doif{\@@eftype}{\v!buffer} + % lines -> height + \checkfiguresettings + % new, color separation + \doifseparatingcolorselse + {\let\@@efvoorgrondkleur\empty + \doifelsenothing\@@efsplitsen + {\chardef\splitexternalfigure0} + {\doifcolorchannelelse\@@efsplitsen + {\let\@@efobject\v!nee % ? + \chardef\splitexternalfigure1} + {\chardef\splitexternalfigure2}}} + {\chardef\splitexternalfigure0}% + \relax % ends \chardef + % new, fake color in gray bitmaps + \doifsomething\@@efvoorgrondkleur + {\getparameters[\??ef] + [\c!achtergrond={\v!voorgrond,\v!kleur}, + \c!achtergrondkleur=\@@efvoorgrondkleur]}% + % + \doif\@@efreset\v!ja \resetexternalfigures + \doif\@@eftype \c!mov\presetfiguremov + \doif\@@eftype \c!avi\presetfigureavi + % hack + \doif\@@efmethode\c!mov + {\doifsomething\@@efextension{\presetundefinedfigure\@@efextension}}% + % + \doif\@@eftype\v!buffer {\ifx\@@efextension\empty \let\@@efextension\c!tmp \fi \let\@@eftype\c!tex}% -%\@EA\doifnumberelse\@EA{\@@efextension} % new, test first -%{\def\@@eftype{\c!mps}} -%{% + %\@EA\doifnumberelse\@EA{\@@efextension} % new, test first + %{\def\@@eftype{\c!mps}} + %{% \processaction [\@@efextension] [ \c!tex=>\let\@@eftype\c!tex, @@ -921,7 +1196,7 @@ \edef\@@effilename{\@@effilepref\@@effilename}, \c!avi=>\presetfigureavi, \c!mov=>\presetfiguremov]% -%}% + %}% \edef\figuretypes{\figuretypes,\c!tex}% \ifx\@@eftype\c!tex % Since tex code can have positional stuff and worse, @@ -930,20 +1205,20 @@ \let\@@efobject\v!nee \fi \edef\@@efobjectname{\@@effilename-\@@eftype-\@@efextension-\@@efpagina}% - \doifelse{\@@efobject}{\v!nee} - {\donefalse} + \doifelse\@@efobject\v!nee + \donefalse {\doifspecialavailableelse\dostartscaling {\doifobjectssupportedelse - {\doifobjectfoundelse{FIG}{\@@efobjectname}{\donetrue}{\donefalse}} - {\donefalse}} - {\donefalse}}% + {\doifobjectfoundelse{FIG}\@@efobjectname\donetrue\donefalse} + \donefalse} + \donefalse}% % redo message, only filename - \doifparentfileelse{\@@effilename} + \doifparentfileelse\@@effilename {\@EA\removefromcommalist\@EA{\jobsuffix}\figuretypes - \let\@@efextension=\empty - \showmessage{\m!figures}{9}{\@@effilename}% + \let\@@efextension\empty + \showmessage\m!figures9\@@effilename \donefalse} - {}% + \donothing \ifdone \getobjectdimensions{FIG}{\@@efobjectname}% \geteparameters % e ! @@ -953,7 +1228,7 @@ \chardef\figurestatus=5 \edef\@@effullname{\@@effilepref#3}% \else - \doifelse{#2}{\s!figurepreset} + \doifelse{#2}\s!figurepreset {\def\figureextension##1{\@@efextension}% \edef\@@effullname{\@@effilepref#3}}% {\ifx\@@efextension\empty @@ -962,72 +1237,63 @@ \def\figureextension##1{##1}% \else \@EA\doifnumberelse\@EA{\@@efextension} - {\def\@@eftype{\c!mps}}{}% + {\let\@@eftype\c!mps}\donothing \edef\@@effullname{\@@effilename.\@@efextension}% \def\figureextension##1{\@@efextension}% \fi}% -% \ifcase\figurefilemode -% \let\@@ex@@gebied\f!currentpath -% \or % lokaal -% \let\@@ex@@gebied\f!currentpath -% \or % globaal -% \let\@@ex@@gebied\@@exgebied -% \or % lokaal,globaal / non empty gebied -% \edef\@@ex@@gebied{\f!currentpath\ifx\@@exgebied\empty\else,\fi\@@exgebied}% -% \fi - \doifelse{\@@efpreset}{\v!nee} - {\doifelse{\@@eftype}{\s!unknown} - {\chardef\figurestatus=0 - \let\@@eftype=\figuretypes + \doifelse\@@efpreset\v!nee + {\doifelse\@@eftype\s!unknown + {\chardef\figurestatus0 + \let\@@eftype\figuretypes \locatepresetfigurefiles} - {\chardef\figurestatus=1 }} - {\doifelse{\@@eftype}{\s!unknown} - {\let\@@eftype=\figuretypes} + {\chardef\figurestatus1 }} + {\doifelse\@@eftype\s!unknown + {\let\@@eftype\figuretypes} {\@EA\removefromcommalist\@EA{\@@eftype}\figuretypes \edef\@@eftype{\ifx\@@eftype\empty\else\@@eftype,\fi\figuretypes}}% \ifx\@@efextension\empty\else - \ExpandBothAfter\doifinsetelse{\@@efextension}{\@@eftype} + \ExpandBothAfter\doifinsetelse\@@efextension\@@eftype {\@EA\removefromcommalist\@EA{\@@efextension}\@@eftype \edef\@@eftype{\@@efextension,\@@eftype}}% - {}% + \donothing \fi - \doifelse{#2}{\s!figurepreset} - {\chardef\figurestatus=4 + \doifelse{#2}\s!figurepreset + {\chardef\figurestatus4 %\def\@@efloadname{\f!currentpath\f!pathseparator\@@exfile}% \assignfullfilename\f!currentpath\@@exfile\to\@@efloadname - \let\@@eftype=\@@epe} - {\chardef\figurestatus=0 + \let\@@eftype\@@epe} + {\chardef\figurestatus\zerocount \analyzefigurefiles}}% - \let\@@epe=\@@eftype + \let\@@epe\@@eftype \edef\@@efextension{\figureextension{\@@eftype}}% dirty trick - \global\figwid=\zeropoint \figxsca=1 - \global\fighei=\zeropoint \figysca=1 - \doif{\v!kader}{\@@exoptie} - {\let\@@efkader=\v!aan}% + \global\figwid\zeropoint \figxsca\plusone + \global\fighei\zeropoint \figysca\plusone + \doif\v!kader\@@exoptie + {\let\@@efkader\v!aan}% \fi \ifcase\figurestatus \let\@@efkader\v!aan \let\@@efobject\v!nee - \showmessage{\m!figures}{1}{\@@effilename}% + \showmessage\m!figures1{\@@effilename}% \or - \showmessage{\m!figures}{2}{\@@effullname}% + \showmessage\m!figures2{\@@effullname}% \or - \showmessage{\m!figures}{3}{\@@effullname,\@@eflenttype}% + \showmessage\m!figures3{\@@effullname,\@@eflenttype}% \or - \showmessage{\m!figures}{4}{\@@effullname}% + \showmessage\m!figures4{\@@effullname}% \or - \showmessage{\m!figures}{5}{\@@effullname,\@@efloadname}% + \showmessage\m!figures5{\@@effullname,\@@efloadname}% \or % no message - \doifnot{\@@efsymbool}{\v!ja} - {\showmessage{\m!figures}{8}{\@@effullname}}% + \doifnot\@@efsymbool\v!ja + {\showmessage\m!figures8{\@@effullname}}% \fi - \ifdim\@@epw=\zeropoint \chardef\figurestatus=1 \fi - \ifdim\@@eph=\zeropoint \chardef\figurestatus=1 \fi + \ifdim\@@epw=\zeropoint \chardef\figurestatus1 \fi + \ifdim\@@eph=\zeropoint \chardef\figurestatus1 \fi \ifnum\figurestatus=1 % unknown dimensions, take width or height or scale \setnaturalfiguresize \xdef\naturalfigurewidth{\the\figwid}% \xdef\naturalfigureheight{\the\fighei}% - \let\@@efkader=\v!uit + \let\@@efkader\v!uit \else \global\let\naturalfigurewidth\@@epw \global\let\naturalfigureheight\@@eph @@ -1043,18 +1309,19 @@ [\@@effullname: t={\@@eftype}\space m={\@@efmethode}\space l=\@@eflabel\space w=\number\figwid\space h=\number\fighei\space - sx=\scax\space sy=\scay\space ox=\figx\space oy=\figy]}% + \c!sx=\scax\space\c!sy=\scay\space + ox=\figx\space oy=\figy]}% \fi - \doif{\v!leeg}{\@@exoptie} + \doif\v!leeg\@@exoptie {\skipexternalfigurestrue - \let\@@efkader=\v!uit}% ? ? - \doifelsenothing{\@@efpagina} % NIEUW ?? + \let\@@efkader\v!uit}% ? ? + \doifelsenothing\@@efpagina % NIEUW ?? {\let\@@efoptions\empty} {\let\@@efoptions\@@efpagina}% - \doif{\@@efpreview}{\v!ja}{\addtocommalist\v!preview\@@efoptions}% - \doif{\@@efsturing}{\v!ja}{\addtocommalist\v!sturing\@@efoptions}% - \doif{\@@efherhaal}{\v!ja}{\addtocommalist\v!herhaal\@@efoptions}% - \doif{\@@eftype}{\c!mps} + \doif\@@efpreview\v!ja{\addtocommalist\v!preview\@@efoptions}% + \doif\@@efsturing\v!ja{\addtocommalist\v!sturing\@@efoptions}% + \doif\@@efherhaal\v!ja{\addtocommalist\v!herhaal\@@efoptions}% + \doif\@@eftype\c!mps {\ifcase\EPSspecial\else\ifinobject\else \@@eftrace{special mps, object forced}% \doglobal\increment\forcedMPSobject @@ -1062,12 +1329,12 @@ \let\@@efobject\v!ja \fi\fi}% \global\let\lastfigureobjectname\@@efobjectname - \doifelse{\@@efobject}{\v!nee} - {\donefalse} - {\doifobjectssupportedelse{\donetrue}{\donefalse}}% + \doifelse\@@efobject\v!nee + \donefalse + {\doifobjectssupportedelse\donetrue\donefalse}% \ifdone - \doifobjectfoundelse{FIG}{\@@efobjectname} - {} + \doifobjectfoundelse{FIG}\@@efobjectname + \donothing {\bgroup % to be cleaned up \figwid\@@epw % local ? \fighei\@@eph % local ? @@ -1077,77 +1344,160 @@ \edef\@@epy{\the\scratchdimen}% %\scratchdimen\@@epw\edef\@@epw{\the\scratchdimen}% %\scratchdimen\@@eph\edef\@@eph{\the\scratchdimen}% - \setbox0=\vbox to \fighei + \setbox0\vbox to \fighei {\vfill \ifdim\wd\foundexternalfigure=\zeropoint \doinsertfile {\@@eftype,\@@efmethode}{\@@effullname,\@@eflabel} - {100}{100} - {\@@epx}{\@@epy} - {\@@epw}{\@@eph} - {\@@efoptions}% + {100}{100}\@@epx\@@epy\@@epw\@@eph\@@efoptions \else\ifskipexternalfigures - \ruledhbox{\fakebox\foundexternalfigure}% + \ruledhbox + {\backgroundline + [\@@efsplitskleur]{\fakebox\foundexternalfigure}}% \else \box\foundexternalfigure \fi\fi}% \wd0=\figwid - \setobject{FIG}{\@@efobjectname}\vbox{\box0}% + \setobject{FIG}\@@efobjectname\vbox{\box0}% \setxvalue{\@@efobjectname\c!n}{\number\nofinsertpages}% \egroup}% \fi \xdef\figurewidth {\the\figwid}% \xdef\figureheight{\the\fighei}% - \global\setbox\foundexternalfigure=\vbox to \fighei + \global\setbox\foundexternalfigure\vbox to \fighei {\vfill \hsize\figwid \ifdone - \dimen0=\scax pt\divide\dimen0 by 100\edef\scax{\@EA\withoutpt\the\dimen0}% - \dimen0=\scay pt\divide\dimen0 by 100\edef\scay{\@EA\withoutpt\the\dimen0}% - \schaal[sx=\scax,sy=\scay]{\dowithfigure{\getobject{FIG}{\@@efobjectname}}}% + \dimen0=\scax\s!pt\divide\dimen0 100\edef\scax{\@EA\withoutpt\the\dimen0}% + \dimen0=\scay\s!pt\divide\dimen0 100\edef\scay{\@EA\withoutpt\the\dimen0}% + \schaal[\c!sx=\scax,\c!sy=\scay]{\dowithfigure{\getobject{FIG}{\@@efobjectname}}}% \xdef\noffigurepages{\number\getvalue{\@@efobjectname\c!n}}% \else\ifdim\wd\foundexternalfigure=\zeropoint \dowithfigure {\doinsertfile {\@@eftype,\@@efmethode}{\@@effullname,\@@eflabel} - {\scax}{\scay} - {\figx}{\figy} - {\figwid}{\fighei} - {\@@efoptions}}% + \scax\scay\figx\figy\figwid\fighei\@@efoptions}% \xdef\noffigurepages{\number\nofinsertpages}% \else - \dimen0=\scax pt\divide\dimen0 100\edef\scax{\@EA\withoutpt\the\dimen0}% - \dimen0=\scay pt\divide\dimen0 100\edef\scay{\@EA\withoutpt\the\dimen0}% - \schaal[sx=\scax,sy=\scay]{\dowithfigure{\box\foundexternalfigure}}% + \dimen0=\scax\s!pt\divide\dimen0 100\edef\scax{\@EA\withoutpt\the\dimen0}% + \dimen0=\scay\s!pt\divide\dimen0 100\edef\scay{\@EA\withoutpt\the\dimen0}% + \schaal[\c!sx=\scax,\c!sy=\scay]{\dowithfigure{\box\foundexternalfigure}}% \xdef\noffigurepages{\number\nofinsertpages}% \fi\fi \global\let\appliedfigurexscale\scax \global\let\appliedfigureyscale\scay}% - \global\wd\foundexternalfigure=\figwid + \global\wd\foundexternalfigure\figwid \finalizeexternalfigure{#2}{#3}} +\let\figurelabel \empty +\let\figurefilename\empty +\let\figurefiletype\empty +\let\figurefilepage\empty + +% \def\finalizeexternalfigure#1#2% +% {\pushmacro\figurewidth +% \pushmacro\figureheight +% \pushmacro\figurelabel +% \pushmacro\figurefilename +% \pushmacro\figurefiletype +% \pushmacro\figurefilepage +% \xdef\figurewidth {\the\figwid}% +% \xdef\figureheight {\the\fighei}% +% \xdef\figurelabel {#1}% +% \xdef\figurefilename{#2}% +% \xdef\figurefiletype{\@@eftype}% +% \xdef\figurefilepage{\@@efpagina}% +% \global\setbox\foundexternalfigure\vbox +% {\forgetall +% \ifcase\figurestatus +% \resetsystemmode\v!figuur +% \let\figurefiletype\empty +% \else +% \setsystemmode \v!figuur % beter resource +% \fi +% \ifconditional\externalfigurelevel % probably background +% \ifskipexternalfigures +% % nothing +% \else\ifsplitexternalfigures +% % nothing +% \else\ifcase\figurestatus +% % nothing +% \else +% \the\externalfigurepostprocessors +% \box\foundexternalfigure +% \fi\fi\fi +% \else +% \feedbackexternalfigure +% \settrue\externalfigurelevel +% \ifskipexternalfigures +% \externalfigurereplacement{#1}{#2}{skipped}% +% \else\ifsplitexternalfigures +% \backgroundline +% [\@@efsplitskleur]{\fakebox\foundexternalfigure}% +% \else\ifcase\figurestatus +% \externalfigurereplacement{#1}{#2}{unknown}% +% \else +% \the\externalfigurepostprocessors +% \doifelse\@@efreset\v!ja +% {\ht\foundexternalfigure\figureheight +% \dp\foundexternalfigure\zeropoint +% \wd\foundexternalfigure\figurewidth +% \box\foundexternalfigure} +% {\localframed % should also be applied to high res ! +% [\??ef] +% [\c!offset=\v!overlay, +% \c!breedte=\figurewidth, +% \c!hoogte=\figureheight] +% {\vfilll\box\foundexternalfigure}}% +% \fi\fi\fi +% \fi}% +% \popmacro\figurefilepage +% \popmacro\figurefiletype +% \popmacro\figurefilename +% \popmacro\figurelabel +% \popmacro\figureheight +% \popmacro\figurewidth} + \def\finalizeexternalfigure#1#2% {\pushmacro\figurewidth \pushmacro\figureheight - \xdef\figurewidth {\the\figwid}% - \xdef\figureheight{\the\fighei}% + \pushmacro\figurelabel + \pushmacro\figurefilename + \pushmacro\figurefiletype + \pushmacro\figurefilepage + \xdef\figurewidth {\the\figwid}% + \xdef\figureheight {\the\fighei}% + \xdef\figurelabel {#1}% + \xdef\figurefilename{#2}% + \xdef\figurefiletype{\@@eftype}% + \xdef\figurefilepage{\@@efpagina}% \global\setbox\foundexternalfigure\vbox {\forgetall + \ifcase\figurestatus + \resetsystemmode\v!figuur + \let\figurefiletype\empty + \else + \setsystemmode \v!figuur % beter resource + \fi \ifconditional\externalfigurelevel % probably background \ifskipexternalfigures % nothing \else\ifcase\figurestatus % nothing - \else + \else\ifnum\splitexternalfigure=2\else \the\externalfigurepostprocessors \box\foundexternalfigure - \fi\fi + \fi\fi\fi \else + \feedbackexternalfigure \settrue\externalfigurelevel \ifskipexternalfigures \externalfigurereplacement{#1}{#2}{skipped}% \else\ifcase\figurestatus \externalfigurereplacement{#1}{#2}{unknown}% + \else\ifnum\splitexternalfigure=2 + \backgroundline[\@@efsplitskleur] + {\fakebox\foundexternalfigure}% \else \the\externalfigurepostprocessors \doifelse\@@efreset\v!ja @@ -1160,21 +1510,37 @@ [\c!offset=\v!overlay, \c!breedte=\figurewidth, \c!hoogte=\figureheight] - {\vfilll\box\foundexternalfigure}}% - \fi\fi + {\vfilll + \ifnum\splitexternalfigure=1 + % hm, eigenlijk in dit geval achtergrondkleur +\hidesplitcolorfalse % really needed + \backgroundline[\@@efsplitskleur] + {\box\foundexternalfigure}% + \else % = 0, no split mode + \box\foundexternalfigure + \fi}}% + \fi\fi\fi \fi}% + \popmacro\figurefilepage + \popmacro\figurefiletype + \popmacro\figurefilename + \popmacro\figurelabel \popmacro\figureheight \popmacro\figurewidth} + \def\externalfigurereplacement#1#2#3% - {\expanded{\localframed + {\setupcolors + [\c!status=\v!lokaal]% + \expanded{\localframed [\??ef] [\c!breedte=\figurewidth, \c!hoogte=\figureheight, \c!achtergrond=\v!raster, - \c!achtergrondraster=.5, + \c!achtergrondraster=.8, %\c!kader=\ifincolor\v!uit\else\v!aan\fi] - \c!kader=\ifincolor\@@efkader\else\v!aan\fi]}% + %\c!kader=\ifincolor\@@efkader\else\v!aan\fi]}% + \c!kader=\@@efkader]}% {\ttx \nohyphens name: \expanded{\verbatimstring{#1}}\\% file: \expanded{\verbatimstring{#2}}\\% @@ -1183,6 +1549,8 @@ \newtoks\externalfigureresets \newtoks\externalfigurepostprocessors +\let\feedbackexternalfigure\relax % \gobblefourarguments + \gdef\appliedfigurexscale{1} \gdef\appliedfigureyscale{1} @@ -1213,7 +1581,7 @@ \def\calculateexternalscreenfigure[#1][#2][#3][#4][#5][#6]% {\ifx\@@efscherm\empty\else - \doifnot{\@@efobject}{\v!nee} + \doifnot\@@efobject\v!nee {\doifobjectssupportedelse {\doifspecialavailableelse\doregisterfigure {\bgroup @@ -1240,7 +1608,7 @@ \def\dogetfiguredimensions[#1][#2]% {{\let\immediate\relax % very dirty but prevents flushing, will change - \setbox0=\hbox{\externalfigure[#1][#2,\c!scherm=,\c!object=\v!nee]}}} + \setbox0\hbox{\externalfigure[#1][#2,\c!scherm=,\c!object=\v!nee]}}} % use the next one when the object must be forgotten (xobj % nums can migrate to the next object; maybe it should @@ -1257,7 +1625,7 @@ \newconditional\externalfigurelevel -\def\doplaceexternalfigure% used direct and indirect +\def\doplaceexternalfigure % used direct and indirect {\dosixtupleempty\dodoplaceexternalfigure} \def\dodoplaceexternalfigure[#1][#2][#3][#4][#5][#6]% @@ -1323,7 +1691,7 @@ {\setvalue{\??ef\??ef#1}{\doplaceexternalfigure[\doprecopfigure][#1][#2][#3][#4]}}}% \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} % upward compatible -\def\douseexternalfigure[#1][#2][#3][#4]% +\def\douseexternalfigure[#1][#2][#3][#4]% {\doifelsenothing{#1} {\doifsomething{#2} {\dosetuseexternalfigure[#2][#2][#3][#4]}} @@ -1331,7 +1699,7 @@ {\dosetuseexternalfigure[#1][#1][#3][#4]} {\dosetuseexternalfigure[#1][#2][#3][#4]}}} -\def\useexternalfigure% +\def\useexternalfigure {\doquadrupleempty\douseexternalfigure} \def\doexternalfigure[#1][#2][#3]% @@ -1349,18 +1717,14 @@ %D Two alternatives, more settings needed. -\def\showexternalfigurea% +\def\showexternalfigurea {\bgroup \mindermeldingen \def\presetfigure[##1][##2]% - {%\useexternalfigure - % [\s!figurepreset][##1] - % [\c!kader=\v!aan,\c!breedte=6cm][##2]% - \getvalue{\e!start\v!figuur\e!tekst}[\v!links][] + {\getvalue{\e!start\v!figuur\e!tekst}[\v!links][] {\v!geen} {\hbox -% {\getvalue{\s!figurepreset}% -{\externalfigure[##1][\c!kader=\v!aan,\c!breedte=6cm][##2]% + {\externalfigure[##1][\c!kader=\v!aan,\c!breedte=6cm][##2]% \tfskip \framed[\c!breedte=\figurewidth,\c!hoogte=\figureheight]{}}}% {\tfa ##1}% @@ -1377,14 +1741,14 @@ \endgraf \getvalue{\e!stop\v!figuur\e!tekst}}% \pushendofline - \readjobfile{\@@exfile}{}{}% was \readlocfile + \readjobfile\@@exfile\donothing\donothing \popendofline \egroup} \def\showexternalfigureb% instelbaar maken {\bgroup \def\total{5}% - \global\let\allfigures=\empty + \globalletempty\allfigures \doglobal\newcounter\figurecounter \mindermeldingen \def\docommando##1{##1&}% @@ -1392,20 +1756,16 @@ {\crcr \noalign{\nobreak\vskip.5em}% \@EA\globalprocesscommalist\@EA[\allfigures]\docommando - \global\let\allfigures=\empty + \globalletempty\allfigures \crcr \noalign{\vskip1em\goodbreak}}% \def\presetfigure[##1][##2]% {\vbox - {\divide\hsize by \total - \advance\hsize by -1em - %\useexternalfigure - % [\s!figurepreset][##1] - % [\c!kader=\v!aan,\c!factor=\v!max,\c!breedte=\hsize][##2]% + {\divide\hsize \total + \advance\hsize -1em \externalfigure [##1] - [\c!kader=\v!aan,\c!factor=\v!max,\c!breedte=\hsize][##2]% - }%\getvalue{\s!figurepreset}}% + [\c!kader=\v!aan,\c!factor=\v!max,\c!breedte=\hsize][##2]}% \doglobal\addtocommalist{##1}\allfigures %\getvalue{\s!figurepreset}% \doglobal\increment\figurecounter @@ -1419,16 +1779,16 @@ \pushendofline \tabskip\zeropoint \!!plus 1fill \halign to \hsize - {&\hss##\hss\cr\readjobfile{\@@exfile}{}{}\crcr % was \readlocfile + {&\hss##\hss\cr\readjobfile\@@exfile\donothing\donothing\crcr \figurecaptions} \popendofline \egroup} -\def\showexternalfigurec% +\def\showexternalfigurec {\bgroup \def\presetfigure[##1][##2]{\pagefigure[##1]} \pushendofline - \readjobfile{\@@exfile}{}{} + \readjobfile\@@exfile\donothing\donothing \popendofline \egroup} @@ -1437,7 +1797,7 @@ \def\dopagefigure[#1][#2]% {\bgroup - \getparameters[\??ex][\c!offset=\!!zeropoint,#2] + \getparameters[\??ex][\c!offset=\!!zeropoint,#2]% \startTEXpage[\c!offset=\@@exoffset]% \externalfigure[#1][#2]% \stopTEXpage @@ -1452,7 +1812,7 @@ \getvalue{showexternalfigure\@@exvariant}% \egroup} -\def\showexternalfigures% +\def\showexternalfigures {\dosingleempty\doshowexternalfigures} \def\overlayfigure#1% @@ -1464,20 +1824,20 @@ \newdimen\efxsteps \newdimen\efysteps -\def\calculateefsteps% - {\ifnum0\@@exxmax=0 - \ifnum0\@@exymax=0 +\def\calculateefsteps + {\ifnum0\@@exxmax=\zerocount + \ifnum0\@@exymax=\zerocount \def\@@exymax{24}% \fi - \efysteps=\figureheight \divide\efysteps by \@@exymax - \efxsteps=\efysteps + \efysteps\figureheight \divide\efysteps \@@exymax + \efxsteps\efysteps \dimen0=\figurewidth - \advance\dimen0 by \efysteps - \divide\dimen0 by \efysteps + \advance\dimen0 \efysteps + \divide \dimen0 \efysteps \edef\@@exxmax{\number\dimen0}% \else - \efxsteps=\figurewidth \divide\efxsteps by \@@exxmax - \efysteps=\figureheight \divide\efysteps by \@@exymax + \efxsteps\figurewidth \divide\efxsteps \@@exxmax + \efysteps\figureheight \divide\efysteps \@@exymax \fi} \def\efcomment#1(#2,#3)#4(#5,#6)% {kader}(x,y)(h,b)[...]{tekst} @@ -1524,21 +1884,19 @@ \naarbox{\copy0}[#4]} \def\efmark(#1,#2)#3(#4,#5)#6[#7]% - {\advance\efreference by 1 + {\advance\efreference \plusone \position(#1,#2) {\hbox{\the\efreference}}% \position(#1,#2) - {\gotosomeinternal - {\s!vwb}{#7}{\realfolio} - {\efdomarker(#4,#5){\v!aan}{\thisissomeinternal{\s!vwa}{#7}}}}} + {\gotosomeinternal\s!vwb{#7}\realfolio + {\efdomarker(#4,#5)\v!aan{\thisissomeinternal\s!vwa{#7}}}}} \def\eftext#1(#2,#3)#4(#5,#6)#7[#8]% - {\advance\efreference by 1 + {\advance\efreference \plusone \hbox {\quad - \thisissomeinternal{\s!vwb}{#8}% - \gotosomeinternal - {\s!vwa}{#8}{\realfolio} + \thisissomeinternal\s!vwb{#8}% + \gotosomeinternal \s!vwa{#8}\realfolio {\hbox to 1.5em{\the\efreference\presetgoto\hfill}}% \quad#1 (#2,#3) (#5,#6) [#8]\hfill}% \endgraf} @@ -1565,7 +1923,7 @@ \def\placestartfigure[#1][#2][#3]#4\placestopfigure[#5]% {\hbox - {\setbox0=\hbox + {\setbox0\hbox {\useexternalfigure[\s!dummy][#2][#3,#5]% \externalfigure[\s!dummy]}% \calculateefsteps @@ -1581,7 +1939,7 @@ \def\colorbar##1[##2]% {}% \position(0,0){\box0}% - \linewidth=1pt + \linewidth1pt \setuppositioning [\c!eenheid=pt, \c!xschaal=\withoutpt{\the\efxsteps}, @@ -1590,7 +1948,7 @@ \ignorespaces#4% \def\referring(##1,##2)##3(##4,##5)##6[##7]% {}% - \let\marking=\referring + \let\marking\referring \def\remark% {\efcomment\v!nee}% \def\colorbar##1[##2]% @@ -1599,11 +1957,11 @@ \stoppositioning \box\colorbarbox}} -\def\dodostartfigure[#1][#2][#3]#4\stopfigure% +\def\dodostartfigure[#1][#2][#3]#4\stopfigure {\doifelse{\v!test}{\@@exoptie} {\teststartfigure[#1][#2][#3]#4\teststopfigure - \def\@@exhokjes{\v!aan}} - {\def\@@exhokjes{\v!uit}}% + \let\@@exhokjes\v!aan} + {\let\@@exhokjes\v!uit}% \setvalue{\??ef\??ef#1}% {\dosingleempty{\placestartfigure[#1][#2][#3]#4\placestopfigure}}% \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} @@ -1613,19 +1971,19 @@ \def\teststartfigure[#1][#2][#3]#4\teststopfigure% {\begingroup - \setbox0=\hbox + \setbox0\hbox {\useexternalfigure[\s!dummy][#2][\c!bfactor=\v!max]% \externalfigure[\s!dummy]}% - \def\referring% + \def\referring {\efmark}% - \def\marking% + \def\marking {\efmark}% - \def\remark% + \def\remark {\efcomment\v!ja}% \def\colorbar##1[##2]% {}% - \efreference=0 - \setbox0=\vbox + \efreference\zerocount + \setbox0\vbox {\hsize240pt \startpositioning \calculateefsteps @@ -1647,11 +2005,11 @@ \c!xschaal=\withoutpt{\the\efxsteps}, \c!yschaal=\withoutpt{\the\efysteps}, \c!factor=1]% - \linewidth=1pt + \linewidth1pt \ignorespaces#4\relax \stoppositioning \vfill}% - \efreference=0 + \efreference\zerocount \def\referring% {\eftext{$\rightarrow$}}% \def\marking% @@ -1660,15 +2018,15 @@ {\efnocomment}% \def\colorbar##1[##2]% {}% - \setbox2=\vbox + \setbox2\vbox {{\tfa\doifelsenothing{#1}{#2}{#1}} \blanko \tfxx#4 \vfilll}% \ifdim\ht0>\ht2 - \ht2=\ht0 + \ht2\ht0 \else - \ht0=\ht2 + \ht0\ht2 \fi \hbox {\hskip3em @@ -1677,10 +2035,10 @@ \endgroup} \def\dodostartfigure[#1][#2][#3]#4\stopfigure% - {\doifelse{\v!test}{\@@exoptie} + {\doifelse\v!test\@@exoptie {\teststartfigure[#1][#2][#3]#4\teststopfigure - \def\@@exhokjes{\v!aan}} - {\def\@@exhokjes{\v!uit}}% + \let\@@exhokjes\v!aan} + {\let\@@exhokjes\v!uit}% \setvalue{\??ef\??ef#1}% {\dosingleempty{\placestartfigure[#1][#2][#3]#4\placestopfigure}}% \doifundefined{#1}{\setvalue{#1}{\getexternalfigure{#1}}}} @@ -1740,36 +2098,36 @@ \ifdim\@@cphoogte>\zeropoint \dimen2=\@@cphoogte \dimen6=\ht\nextbox - \advance\dimen6 by -\@@cpvoffset - \advance\dimen6 by -\dimen2 + \advance\dimen6 -\@@cpvoffset + \advance\dimen6 -\dimen2 \else \dimen2=\ht\nextbox \divide\dimen2 \@@cpny \dimen6=-\@@cpy\dimen2 \advance\dimen6 -\@@cpsy\dimen2 - \advance\dimen6 \dimen2 + \advance\dimen6 \dimen2 \dimen2=\@@cpsy\dimen2 \advance\dimen6 \ht\nextbox \fi - \setbox\nextbox=\hbox + \setbox\nextbox\hbox {\hskip-\dimen4\lower\dimen6\box\nextbox}% \wd\nextbox\zeropoint \ht\nextbox\zeropoint \dp\nextbox\zeropoint - \setbox\nextbox=\hbox - {\dostartclipping{\@@cpmp}{\dimen0}{\dimen2}% + \setbox\nextbox\hbox + {\dostartclipping\@@cpmp{\dimen0}{\dimen2}% \box\nextbox \dostopclipping}% - \wd\nextbox=\dimen0 - \ht\nextbox=\dimen2 - \dp\nextbox=\zeropoint + \wd\nextbox\dimen0 + \ht\nextbox\dimen2 + \dp\nextbox\zeropoint \box\nextbox \egroup}% \hbox} \def\clip{\dosingleempty\doclip} -\def\setupclipping% +\def\setupclipping {\dodoubleargument\getparameters[\??cp]} %D defining sound tracks: @@ -1793,7 +2151,7 @@ {\iflocation \doifdefined{\??sd:#1}{\doifvaluesomething{\??sd:#1} {\doinsertsoundtrack{\getvalue{\??sd:#1}}{#1}\@@sdoptie - \setgvalue{\??sd:#1}{}}}% + \letgvalueempty{\??sd:#1}}}% \fi} \setexecutecommandcheck {startsound} \checksoundtrack @@ -1823,6 +2181,7 @@ \c!hoek=\v!recht, \c!kader=\v!uit, \c!achtergrond=, % new + \c!splitskleur=white, \c!plaats={\v!lokaal,\v!globaal}] \setupexternalfigures @@ -1834,12 +2193,11 @@ [buffer] [\jobname] [\c!type=\v!buffer,\c!object=\v!nee] \setupclipping - [\c!nx=2,\c!x=1,\c!sx=1, - \c!ny=2,\c!y=1,\c!sy=1, + [\c!n=1, % was 2 + \c!nx=\@@cpn,\c!x=1,\c!sx=1, + \c!ny=\@@cpn,\c!y=1,\c!sy=1, \c!breedte=\!!zeropoint,\c!hoogte=\!!zeropoint, \c!hoffset=\!!zeropoint,\c!voffset=\!!zeropoint, \c!mp=] -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/core-fil.tex b/tex/context/base/core-fil.tex index 39fb5be66..2aaf377e3 100644 --- a/tex/context/base/core-fil.tex +++ b/tex/context/base/core-fil.tex @@ -80,13 +80,13 @@ %D \usemodules[pictex,chemie,eenheid] %D \stoptypen -\def\definefilesynonym% +\def\definefilesynonym {\dodoubleempty\dodefinefilesynonym} \def\dodefinefilesynonym[#1][#2]% {\doifdefined{\??fs#1} {\doifnotvalue{\??fs#1}{#2} - {\showmessage{\m!files}{1}{#1 (#2),\getvalue{\??fs#1}}}}% + {\showmessage\m!files1{#1 (#2),\getvalue{\??fs#1}}}}% \doifelse{#1}{#2} {\letbeundefined{\??fs#1}{#2}} {\setevalue{\??fs#1}{#2}}} @@ -170,7 +170,7 @@ \dododousemodules\f!thirdprefix {#2}} {\dododousemodules{#1-}{#2}}% \ifconditional\moduleisloaded\else - \showmessage{\m!systems}{6}{#2}% + \showmessage\m!systems6{#2}% \fi} \def\dousemodules[#1][#2]% @@ -257,10 +257,10 @@ {\doifnotflagged{#2} {\let#1\undefined \startreadingfile - \bgroup + \startnointerference % \bgroup \cleanupfeatures % better \setnormalcatcodes / test first \readfile{#2}\donothing\donothing - \egroup + \stopnointerference % \egroup \stopreadingfile \doglobal\setflag{#2}}% \ifx#1\undefined diff --git a/tex/context/base/core-fld.tex b/tex/context/base/core-fld.tex index 2ed365849..a397e97d2 100644 --- a/tex/context/base/core-fld.tex +++ b/tex/context/base/core-fld.tex @@ -14,6 +14,11 @@ % \appendtocommalist versus \addtocommalist % % * as default trigger in radiofields ? +% +% beware: weblink plugin truncates on length, while save as doesn't; +% more precise: (1) first time right string is sent, (2) +% internal string truncated, (3) second time truncated +% string is sent. \writestatus{loading}{Context Field Macros} @@ -34,7 +39,7 @@ {} {\settightobject{SYM}{#1}\hbox{\symbol[#1]}% \flushatshipout - {\setbox0=\hbox{\hskip-\maxdimen\getobject{SYM}{#1}}% + {\setbox0\hbox{\hskip-\maxdimen\getobject{SYM}{#1}}% \smashbox0\box0}}} \def\presetfieldsymbols[#1]% slow @@ -117,7 +122,6 @@ {\@@FieldWidth} {\@@FieldHeight} {\@@FieldDefault} -% opties {\@@fdoptie} {\@@FieldValues} {\@@fdklikin,\@@fdklikuit,\@@fdgebiedin,\@@fdgebieduit,\@@fdnatoets,% @@ -205,7 +209,7 @@ \let\tracefields\tracefieldstrue -\def\doshowfields[#1]% todo: tabulate van maken +\def\doshowfields[#1]% todo: tabulate van maken en runtime {\bgroup \switchtobodyfont[8pt,tt] \doifsomething{#1}{\def\collectedfields{#1}} @@ -240,7 +244,7 @@ \immediate\write\scratchwrite{use \tracefieldstrue}% \else \def\normalizedfieldmode##1##2##3% - {\edef\@@FieldMode% + {\edef\@@FieldMode {\ifcase##1 loner \or parent \or clone \or copy \fi \ifcase##2 \else(done)\fi}} \def\dosetfield##1##2##3##4##5##6##7##8##9% @@ -253,7 +257,7 @@ \immediate\closeout\scratchwrite \egroup} -\def\logfields% +\def\logfields {\dosingleempty\doLogFields} %D \starttypen @@ -342,14 +346,14 @@ \def\setmainfieldkid#1#2% {\immediatewriteutilitycommand{\fieldreference{#1}{#2}}} -\def\checkfieldreferences% +\def\checkfieldreferences {\startnointerference \protectlabels - \doutilities{fieldreferences}{\jobname}{}{}{}% + \doutilities{fieldreferences}\jobname\empty\relax\relax \global\let\checkfieldreferences\relax \stopnointerference} -\def\setfieldreferences% +\def\setfieldreferences {\def\fieldreference##1##2% {\ifundefined{\r!widget##1} \setxvalue{\r!widget##1}{##2}% @@ -378,24 +382,24 @@ %D english examns publishing on demand document went down from %D 1350 seconds to less than 950 on a 650 Mhz pentium. -\def\definefield% +\def\definefield {\definemainfieldfalse\doquintupleempty\dodefinefield} -\def\definemainfield% +\def\definemainfield {\definemainfieldtrue \doquintupleempty\dodefinefield} -\let\collectedfields=\empty +\let\collectedfields\empty \newcounter\numberoffields \newcounter\totalnumberoffields -\def\savenumberoffields% +\def\savenumberoffields {\ifcase\numberoffields\relax\else \savecurrentvalue\totalnumberoffields\numberoffields \fi} \appendtoks \savenumberoffields \to \everybye % \everylastshipout -% \def\presetfieldreferences% +% \def\presetfieldreferences % {\ifnum\totalnumberoffields>0 % \definereference[AtOpenInitializeForm][\v!ResetForm]% % \fi} @@ -410,7 +414,7 @@ \doifundefinedelse{define#2field} {\writestatus\m!fields{unknown field type #2}} {\doifundefined{fielddata\currentfieldname} - {\getmainfieldkids{\currentfieldname}% + {\getmainfieldkids\currentfieldname \ifdefinemainfield \ifx\@@FieldKids\empty \let\@@FieldMode\fieldlonermode @@ -484,19 +488,29 @@ {\dogetcommacommandelement1\from#4\to\SavedFieldDefault \dogetcommacommandelement1\from\SavedFieldDefault\to\SavedFieldDefault} {\def\SavedFieldDefault{#5}}% +% when opt works +% \@EA\beforesplitstring\SavedFieldDefault\at=>\to\SavedFieldDefault \ifx\@@FieldKids\empty \setfield{#1}{#2}{}{}{#4}{#3}{\@@FieldMode\@@FieldFree\@@FieldAuto}{}{\SavedFieldDefault}% \else \setfield{#1}{#2}{}{}{#4,\@@FieldKids}{#3}{\@@FieldMode\@@FieldFree\@@FieldAuto}{}{\SavedFieldDefault}% \fi +% \def\docommando##1% - {\doifelse{##1}{\SavedFieldDefault} + {\doifelse{##1}\SavedFieldDefault {\def\@@FieldDefault{##1}}% {\let\@@FieldDefault\empty}% \setfield{##1}{#2}{#1}{}{}{#3}{\@@FieldMode\@@FieldFree\@@FieldAuto}{}{\@@FieldDefault}}% +% when opt works +% \def\docommando##1% +% {\@EA\beforesplitstring##1\at=>\to\FieldValue +% \doifelse\FieldValue\SavedFieldDefault +% {\let\@@FieldDefault\FieldValue}% +% {\let\@@FieldDefault\empty}% +% \setfield\FieldValue{#2}{#1}{}{}{#3}{\@@FieldMode\@@FieldFree\@@FieldAuto}{}{\@@FieldDefault}}% \processcommalist[#4]\docommando \else - \writestatus{\m!fields}{pass values too}% + \writestatus\m!fields{pass values too}% \fi} \def\definesubfield% @@ -507,7 +521,7 @@ \def\docommando##1% {\getfield{##1}% \ifx\@@FieldType\empty - \writestatus{\m!fields}{unknown field ##1}% to do + \writestatus\m!fields{unknown field ##1}% to do \else \doifsomething{#2} {\edef\@@FieldGroup{#2}}% @@ -519,7 +533,7 @@ \fi}% \processcommalist[#1]\docommando \else - \writestatus{\m!fields}{pass fieldname, setupgroup, values and default}% + \writestatus\m!fields{pass fieldname, setupgroup, values and default}% \fi} \def\doclonefield[#1][#2][#3][#4]% parent children setupgroup values @@ -527,7 +541,7 @@ \getfield{#1}% \iftrialtypesetting\else \ifx\@@FieldType\empty - \writestatus{\m!fields}{unknown field #1}% + \writestatus\m!fields{unknown field #1}% \else \let\@@FieldMode=\fieldparentmode %\def\docommando##1{\addtocommalist{##1}\@@FieldKids}% @@ -552,7 +566,7 @@ \fi \fi \else - \writestatus{\m!fields}{pass parent field and clones}% + \writestatus\m!fields{pass parent field and clones}% \fi} \def\clonefield% @@ -586,7 +600,7 @@ \fi \fi \else - \writestatus{\m!fields}{pass parent field and copies}% + \writestatus\m!fields{pass parent field and copies}% \fi} \def\copyfield% @@ -822,7 +836,8 @@ {\presetlocalframed[\??fd]% \localframed [\??fd] - [\c!n=12,\c!strut=\v!nee,\c!kleur=,\c!letter=,\c!optie=, + [\c!n=1024, % beware: weblink plug in truncates + \c!strut=\v!nee,\c!kleur=,\c!letter=,\c!optie=, \c!klikin=,\c!klikuit=,\c!gebiedin=,\c!gebieduit=, \c!focusin=,\c!focusuit=, \c!natoets=,\c!formatteer=,\c!valideer=,\c!bereken=, @@ -843,13 +858,13 @@ \newcounter\nofsystemfields -\def\nextsystemfield% +\def\nextsystemfield {\doglobal\increment\nofsystemfields \def\currentsystemfield{sys::\nofsystemfields}} %D An example: -\def\fillinfield% +\def\fillinfield {\dosingleempty\dofillinfield} \def\dofillinfield[#1]#2% @@ -865,12 +880,13 @@ \setbox0=\hbox{#2}% \setbox2=\hbox{\therightanswer}% \dimen0=\ifdim\wd0>\wd2 \wd0 \else \wd2 \fi - \advance\dimen0 by .2em + \advance\dimen0 .2em \definefield [\currentsystemfield][line][systemfield]% \setupfield [systemfield] - [\c!n=100,\c!plaats=\v!laag,\c!strut=\v!ja,\c!veldoffset=0pt, + [\c!n=1024, % beware: weblink plugin truncates + \c!plaats=\v!laag,\c!strut=\v!ja,\c!veldoffset=0pt, \c!hoogte=1.2\openlineheight,\c!breedte=\dimen0,\c!offset=\v!overlay, \c!letter=,\c!uitlijnen=\v!midden,\c!kader=\v!uit, \c!kleur=red,\c!veldachtergrondkleur=white,\c!veldkaderkleur=blue, @@ -889,7 +905,7 @@ {\bgroup \setupfields[\v!reset]% \useJSscripts[fld]% - \setbox0=\hbox + \setbox0\hbox {\mindermeldingen \nextsystemfield \setbox0=\hbox{#2}% @@ -905,15 +921,15 @@ [\c!kader=\v!uit, \c!gebieduit=JS(Hide_Field{\currentsystemfield:txt}), \c!optie=\v!verborgen]% - \hbox to \!!zeropoint - {\dimen0=\wd2\advance\dimen0 by -\wd0 - \doifelse{#1}{\v!links} + \hbox to \zeropoint + {\dimen0\wd2\advance\dimen0 -\wd0 + \doifelse{#1}\v!links {\hskip-\dimen0} - {\doif{#1}{\v!midden} + {\doif{#1}\v!midden {\hskip-.5\dimen0}}% - \lower\openlineheight\hbox to \!!zeropoint + \lower\openlineheight\hbox to \zeropoint {\fitfield[\currentsystemfield:txt]}}% - \dimen0=\ifdim\wd0=\!!zeropoint 3em\else\wd0\fi + \dimen0=\ifdim\wd0=\zeropoint 3em\else\wd0\fi \definesymbol [\currentsystemfield:but] [{\framed[\c!hoogte=2ex,\c!breedte=\dimen0,\c!kader=\v!uit]{}}]% @@ -926,7 +942,7 @@ \c!optie=, \c!gebiedin=JS(Vide_Field{\currentsystemfield:txt}), \c!gebieduit=JS(Hide_Field{\currentsystemfield:txt})]% - \lower2ex\hbox to \!!zeropoint + \lower2ex\hbox to \zeropoint {\fitfield[\currentsystemfield:but]}% #2}% \ht0=\ht\strutbox\dp0=\dp\strutbox\box0 @@ -976,17 +992,17 @@ \getvalue{fieldstack:#1}\setgvalue{fieldstack:#1}{[#1]}% \fi} -\def\fieldstack% +\def\fieldstack {\dotripleempty\dofieldstack} %D When submitting a form, we need to tell the driver module %D that we want \FDF\ or \HTML. -\def\setupforms% +\def\setupforms {\dodoubleargument\getparameters[\??fr]} \def\checksubmitform#1% - {\setsubmitoutputformat{\@@frmethode}} + {\setsubmitoutputformat\@@frmethode} \setexecutecommandcheck {submitform} \checksubmitform diff --git a/tex/context/base/core-fnt.tex b/tex/context/base/core-fnt.tex index 1235439b0..9bd68420a 100644 --- a/tex/context/base/core-fnt.tex +++ b/tex/context/base/core-fnt.tex @@ -98,8 +98,8 @@ \def\cap@@visualize{\tx}} \def\userealcaps% - {\let\cap@@uppercase=\relax - %\let\cap@@lowercase=\relax % Definitely not! + {\let\cap@@uppercase\relax + %\let\cap@@lowercase\relax % Definitely not! \def\cap@@visualize{\sc}} \usepseudocaps @@ -454,7 +454,7 @@ \def\underbarmethodc#1#2#3% PERIOD {\hbox to #1 {\dimen4=#3 - \advance\dimen4 by .2ex + \advance\dimen4 .2ex \hskip-.25em \xleaders \hbox{\hskip.25em\lower\dimen4\hbox{.}} @@ -462,11 +462,11 @@ \def\dododounderbar#1#2#3% {\startmathmode - \setbox0=\hbox{#3}% - \setbox2=\hbox{\color[\@@onlijnkleur]{\getvalue{underbarmethod\@@onvariant}{\wd0}{#1}{#2}}}% - \wd0=\zeropoint - \ht2=\ht0 - \dp2=\dp0 + \setbox0\hbox{#3}% + \setbox2\hbox{\color[\@@onlijnkleur]{\getvalue{underbarmethod\@@onvariant}{\wd0}{#1}{#2}}}% + \wd0\zeropoint + \ht2\ht0 + \dp2\dp0 \box0\box2 \stopmathmode} @@ -475,17 +475,17 @@ \dimen0=\@@ononderoffset \dimen0=\underbarlevel\dimen0 \ifdone \else - %\advance\dimen0 by -1pt - \advance\dimen0 by -\ht\strutbox + %\advance\dimen0 -1pt + \advance\dimen0 -\ht\strutbox \fi \dimen2=\dimen0 - \advance\dimen2 by \@@onlijndikte + \advance\dimen2 \@@onlijndikte \dododounderbar{-\dimen0}{\dimen2}{#1}% \egroup} \def\betweenunderbarwords% {\bgroup - \setbox0=\hbox + \setbox0\hbox {\dodounderbar{\hskip\fontdimen2\font}}% \nobreak \hskip\zeropoint\!!minus\fontdimen4\font @@ -528,7 +528,7 @@ {\bgroup \dimen0=\@@onbovenoffset \dimen2=\dimen0 - \advance\dimen2 by \@@onlijndikte + \advance\dimen2 \@@onlijndikte \dododounderbar{\dimen2}{-\dimen0}{#1}% \egroup} @@ -675,12 +675,13 @@ \setupinitial [\c!status=\v!stop, + \c!plaats=\v!tekst, \c!n=3, \s!font=initial] \def\placeinitial% - {\doif{\@@dcstatus}{\v!start} - {\ifnum\@@dcn>0 \AutoDroppedCaps \fi}} + {\doifelse\@@dcplaats\v!marge{\chardef\DropMode1}{\chardef\DropMode0}% + \doif\@@dcstatus\v!start{\ifnum\@@dcn>0 \AutoDroppedCaps\fi}} \let\checkinitial\CheckDroppedCaps diff --git a/tex/context/base/core-gen.tex b/tex/context/base/core-gen.tex index f9866284a..679dbcddc 100644 --- a/tex/context/base/core-gen.tex +++ b/tex/context/base/core-gen.tex @@ -225,16 +225,13 @@ %D met 1~em vermeerderd. \def\assignwidth#1#2#3#4% - {\doifelse{#2}{} - {\setbox0=\hbox{#3}% - #1=\wd0} + {\doifelsenothing{#2} + {\setbox0\hbox{#3}% + #1\wd0} {\doifinsetelse{#2}{\v!passend,\v!ruim} {\setbox0=\hbox{#3}% - #1=\wd0 - \doif{#2}{\v!ruim} - {\advance#1 by #4}}% + #1\wd0 + \doif{#2}\v!ruim{\advance#1 #4}}% {#1=#2}}}% -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/core-grd.tex b/tex/context/base/core-grd.tex index d15ad7bce..d659289b9 100644 --- a/tex/context/base/core-grd.tex +++ b/tex/context/base/core-grd.tex @@ -75,7 +75,7 @@ three=blue, four=gray] -\def\setbaselinecorrections% +\def\setbaselinecorrections {\setbox0\hbox{\setstrut\strut}% \setbox2\hbox{(}% \dimen0\ht0\advance\dimen0 -\ht2 @@ -92,27 +92,28 @@ \def\donegtopbaselinecorrection{\kern\thenegtopbaselinecorrection} \def\donegbotbaselinecorrection{\kern\thenegbotbaselinecorrection} -\def\showbaselinecorrection% - {\def\dobaselinecorrection% visualization is not watertight! +\def\showbaselinecorrection + {\def\dobaselinecorrection % visualization is not watertight! {\bgroup - \kern-\prevdepth - \setbox0=\null - \wd0=\hsize\dp0=\dp\strutbox +\ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi + \setbox0\null + \wd0\hsize + \dp0\dp\strutbox \nointerlineskip \ruledvbox{\box0}% \egroup - \prevdepth=\dp\strutbox}% - \def\dotopbaselinecorrection% + \prevdepth\dp\strutbox}% + \def\dotopbaselinecorrection {\hrule\!!height\thetopbaselinecorrection}% - \def\dobotbaselinecorrection% + \def\dobotbaselinecorrection {\hrule\!!height\thebotbaselinecorrection}} -\def\dobaselinecorrection% - {\kern-\prevdepth +\def\dobaselinecorrection + {\ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi \kern\dp\strutbox - \prevdepth=\dp\strutbox} + \prevdepth\dp\strutbox} -\def\baselinecorrection% +\def\baselinecorrection {\endgraf \ifvmode \ifdim\prevdepth<\maxdimen @@ -128,22 +129,22 @@ % m-steps.tex, where we apply a \localhsize to the \vbox, in % order to follow narrower and side floats ! -\def\startbaselinecorrection% +\def\startbaselinecorrection {\baselinecorrection \ifvmode \bgroup - \setbox\scratchbox=\vbox\bgroup + \setbox\scratchbox\vbox\bgroup \ignorespaces - \let\stopbaselinecorrection=\dostopbaselinecorrection + \let\stopbaselinecorrection\dostopbaselinecorrection \else - \let\stopbaselinecorrection=\relax + \let\stopbaselinecorrection\relax \fi} %D We do a bit more checking than needed. The pageborder check %D is not needed, but I want to look the visualization as good %D as possible too. -\def\dostopbaselinecorrection% I have to check columns yet. +\def\dostopbaselinecorrection % I have to check columns yet. {\endgraf \egroup \topbaselinecorrection @@ -153,17 +154,16 @@ \let\stopbaselinecorrection=\relax -\def\offbaselinecorrection% Can be used inside correction. - {\def\startbaselinecorrection% - {\bgroup - \let\stopbaselinecorrection=\egroup}} +\def\offbaselinecorrection % Can be used inside correction. + {\def\startbaselinecorrection + {\bgroup\let\stopbaselinecorrection\egroup}} %D \macros %D {topbaselinecorrection,botbaselinecorrection} %D %D The actual top and bottom corrections are implemented as: -\def\topbaselinecorrection% +\def\topbaselinecorrection {\ifvmode \bgroup \setbaselinecorrections @@ -207,7 +207,7 @@ \egroup \fi} -\def\botbaselinecorrection% +\def\botbaselinecorrection {\ifvmode \bgroup \setbaselinecorrections @@ -217,41 +217,6 @@ \egroup \fi} -%D An old one, still to be translated: -%D -%D \macros -%D {getnoflines, getrawnoflines} -%D -%D Het commando \type{\getnoflines} converteert een hoogte -%D (dimensie) in een aantal regels en kent dit toe aan -%D \type{\noflines}. -%D -%D \starttypen -%D \getnoflines{dimensie} -%D \stoptypen -%D -%D Er wordt gedeeld door \type{\openlineheight} en een hoogte -%D van~0pt komt overeen met 0~regels. The raw alternative -%D does not round. - -\newcount\noflines -\newdimen\noflinesheight - -\def\dogetnoflines#1#2% - {\noflinesheight=#2\relax - \ifdim\noflinesheight=\zeropoint - \noflines=0 - \else - \divide\noflinesheight \openlineheight - \noflines=\noflinesheight - #1\ifdim\noflines\openlineheight=#2\relax \else - \advance\noflines 1 - \fi\fi - \fi} - -\def\getnoflines {\dogetnoflines\iftrue } % compensated -\def\getrawnoflines{\dogetnoflines\iffalse} % no compensation - %D Still very experimental and therefore undocumented. \newif\ifgridsnapping % UNDER DEVELOPMENT, USE WITH CARE @@ -261,14 +226,14 @@ \def\positiveextrasnap {\gdef\extrasnapsign{+}} \def\negativeextrasnap {\gdef\extrasnapsign{-}} -\def\extrasnapreset {\global\chardef\@@extrasnap=0 +\def\extrasnapreset {\global\chardef\@@extrasnap0 \positiveextrasnap} -\def\extrasnapbefore {\global\chardef\@@extrasnap=1 } -\def\extrasnaparound {\global\chardef\@@extrasnap=2 } -\def\extrasnapafter {\global\chardef\@@extrasnap=3 } +\def\extrasnapbefore {\global\chardef\@@extrasnap1 } +\def\extrasnaparound {\global\chardef\@@extrasnap2 } +\def\extrasnapafter {\global\chardef\@@extrasnap3 } -\def\enablepresnapcorrection {\global\chardef\@@presnap=0 } -\def\disablepresnapcorrection {\global\chardef\@@presnap=1 } +\def\enablepresnapcorrection {\global\chardef\@@presnap\zerocount} +\def\disablepresnapcorrection {\global\chardef\@@presnap\plusone} \extrasnapreset \enablepresnapcorrection @@ -284,7 +249,7 @@ \let\presnapskip \!!zeropoint \def\presnap {-} \let\postsnapskip\!!zeropoint \let\postsnap\presnap -\def\tracedsnapping% +\def\tracedsnapping {\iftracegridsnapping \llap {\infofont @@ -328,211 +293,24 @@ % \fi % \fi} -\def\forcedpresnapcorrection +\def\forcedpresnapcorrection % test this on 'details' {\ifforcepresnap \ifvmode \else \par \fi % new % we don't want top of page space when 'top' option %\vbox{\strut}\nobreak\vskip-\openlineheight - \vbox{\strut}\vskip-\openlineheight -%\ifdim\pagetotal>\topskip \else -%% eigenlijk signal -%\writestatus{grid}{removing dummy at top of page}% -%\bgroup -%\output{\setbox\scratchbox\box255}% -%\penalty\outputpenalty -%\egroup -%\fi + %\vbox{\strut}\vskip-\openlineheight + % nobreak really needed + \allowbreak\vbox{\strut}\nobreak\vskip-\openlineheight + %\ifdim\pagetotal>\topskip \else + % eigenlijk signal + %\writestatus{grid}{removing dummy at top of page}% + %\bgroup + %\output{\setbox\scratchbox\box255}% + %\penalty\outputpenalty + %\egroup + %\fi \fi} -% \def\dodosnaptogrid -% {\dowithnextbox -% {\bgroup -% \ifdim\nextboxht<\teksthoogte % handle special case (like page fig) -% \ifcase\@@alignsnapbox\relax -% \ifcase\@@alignsnap\else % 1=top 2=high 3=middle 4=low -% \ifshowgridboxes -% \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\box\nextbox}}}% -% \fi -% \getnoflines{\ht\nextbox}% -% \setbox\nextbox\vbox to \noflines\lineheight -% {\ifnum\@@alignsnap=1 \kern\lineheight\kern-\topskip\fi -% \ifnum\@@alignsnap>2 \vfill\fi -% \box\nextbox -% \ifnum\@@alignsnap<4 \vfill\fi}% -% \fi -% \ifshowgridboxes -% \setbox\nextbox\hbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}% -% \fi -% \forgetall -% \par -% \ifvbox\nextbox -% \setbox\nextbox\hbox{\box\nextbox}% don't ask -% \fi -% \scratchskip\lastskip -% \edef\presnapskip{\the\lastskip}% -% % mixing single/double columns sometimes goes wrong, -% % check 'som' document -% \ifbinnenkolommen -% \forcepresnaptrue -% \fi -% \forcedpresnapcorrection -% \ifdim\ht\nextbox>\ht\strutbox -% \scratchdimen\ht\nextbox -% \ifcase\@@presnap\relax -% \ifdim\scratchskip>\zeropoint\relax -% \scratchcounter\scratchskip -% \advance\scratchcounter -\openlineheight -% \ifnum\scratchcounter<0 -% \scratchcounter-\scratchcounter -% \fi -% \ifnum\scratchcounter<10 % \lastkip is about \openlineheight -% \advance\scratchdimen -\openstrutdepth -% \edef\presnapskip{*\presnapskip}% -% \else\ifdim\scratchskip>\openlineheight -% %<\openlineheight \else -% \advance\scratchdimen -\openstrutdepth -% \edef\presnapskip{*\presnapskip}% -% \fi\fi -% \fi -% \fi -% \getnoflines\scratchdimen -% \advance\noflines -1 -% \ifnum\noflines>0 -% \scratchdimen\noflines\lineheight -% \else -% \scratchdimen\zeropoint -% \fi -% \else -% \scratchdimen\zeropoint -% \fi -% \ifnum\@@extrasnap=1 \advance\scratchdimen \extrasnapsign\lineheight \fi -% \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi -% \edef\presnap{\the\scratchdimen}% -% \ifstrutsnapping -% \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi -% \fi -% \ifdim\dp\nextbox>\dp\strutbox -% \getnoflines{\dp\nextbox}% -% \advance\noflines -1 -% \ifnum\noflines>0 -% \scratchdimen\noflines\lineheight -% \else -% \scratchdimen\zeropoint -% \fi -% \else -% \scratchdimen\zeropoint -% \fi -% \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi -% \ifnum\@@extrasnap=3 \advance\scratchdimen \extrasnapsign\lineheight \fi -% \edef\postsnap{\the\scratchdimen}% -% \ifstrutsnapping -% \ht\nextbox\ht\strutbox -% \dp\nextbox\dp\strutbox -% \else -% \scratchdimen\presnap -% \advance\scratchdimen \ht\strutbox -% \ht\nextbox\scratchdimen -% \scratchdimen\postsnap -% \advance\scratchdimen \dp\strutbox -% \dp\nextbox\scratchdimen -% \fi -% \hbox{\tracedsnapping\box\nextbox}% -% \ifstrutsnapping -% \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi -% \fi -% \else -% \scratchdimen\ht\nextbox\relax -% \ifcase\@@alignsnapbox -% % can't happen here -% \or -% \getrawnoflines\scratchdimen -% \else -% \getnoflines \scratchdimen -% \fi -% \scratchdimen\noflines\lineheight\relax -% \advance\scratchdimen-\strutdepth -% \ifnum\pagetotal>\zeropoint -% \else % disable this as option -% \advance\scratchdimen-\strutheight -% \advance\scratchdimen+\topskip -% \fi -% \dimen0=\scratchdimen -% \dimen2=\strutdepth -% \ifshowgridboxes -% \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\box\nextbox}}}% -% \fi -% \dp\nextbox\dp\strutbox -% \dimen4=\ht\nextbox -% \dimen6=\dp\nextbox -% \setbox\nextbox\vbox to \scratchdimen -% {\forgetall -% \ifnum\@@alignsnap>2 \vfill\fi % 3 4 -% \iftracegridsnapping -% \scratchdimen\@@alignsnapamount\relax -% \setbox\scratchbox\hbox -% {\ifdim\scratchdimen<\zeropoint -% \tracedgridamount\zeropoint{-\scratchdimen}% -% \else -% \tracedgridamount\scratchdimen\zeropoint -% \fi}% -% \smashbox\scratchbox -% \setbox\nextbox\hbox{\box\scratchbox\box\nextbox}% -% \fi -% \setbox\nextbox\hbox -% {\scratchdimen\@@alignsnapamount\relax -% \ifcase\@@alignsnapdepth\or -% % don't change this ever ! -% \ifdim\dimen0<\lineheight -% % otherwise it is ok, but ending up inside -% % the next paragraph is seldom what we want, -% % so we move one line up -% \advance\scratchdimen-\lineheight -% \advance\scratchdimen\strutheight -% \else -% % otherwise we can move down to the -% % baseline -% \advance\scratchdimen\dimen6 -% \fi -% \fi -% \lower\scratchdimen\box\nextbox}% -% \ht\nextbox\dimen4 -% \dp\nextbox\dimen6 -% \box\nextbox -% \nointerlineskip % \offinterlineskip -% \ifnum\@@alignsnap<4 \vfill\fi % 2 3 -% \kern\zeropoint}% -% \ifshowgridboxes -% \setbox\nextbox\vbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}% -% \fi -% \let\presnapskip\@@alignsnapamount -% \ifnum\@@alignsnap>2 \def\presnap {+}\fi -% \ifnum\@@alignsnap<4 \def\postsnap{+}\fi -% \setbox\nextbox\hbox{\tracedsnapping\box\nextbox}% -% \par -% \ht\nextbox\dimen0 -% \dp\nextbox\dimen2 -% \forcedpresnapcorrection -% \nointerlineskip -% \box\nextbox -% \fi -% \else -% \setbox\nextbox\vbox to \teksthoogte -% {\ifdim\nextboxdp=\zeropoint -% \hbox{\lower\strutdepth\box\nextbox} -% \else % this branch is yet untested -% \vss -% \hbox{\lower\nextboxdp\box\nextbox} -% \vskip-\strutdepth -% \fi}% -% \nextboxdp\strutdepth -% \box\nextbox -% \fi -% \extrasnapreset -% \enablepresnapcorrection -% \global\chardef\@@alignsnap0 -% \global\chardef\@@alignsnapbox0 -% \egroup}} - \newif\ifboxedsnapping \boxedsnappingtrue \def\dodosnaptogrid @@ -600,16 +378,16 @@ \ifnum\@@extrasnap=2 \advance\scratchdimen \extrasnapsign.5\lineheight \fi \edef\presnap{\the\scratchdimen}% \ifstrutsnapping -\ifboxedsnapping - \getrawnoflines\scratchdimen - \advance\scratchdimen-\noflines\lineheight - \vskip\scratchdimen % disappears at top of page - \dorecurse\noflines{\vbox{\strut}\nobreak}% -\else \ifdim\scratchdimen=\zeropoint - % nothing to skip -\else % disappears at top of page - \vskip\scratchdimen -\fi \fi + \ifboxedsnapping + \getrawnoflines\scratchdimen + \advance\scratchdimen-\noflines\lineheight + \vskip\scratchdimen % disappears at top of page + \dorecurse\noflines{\vbox{\strut}\nobreak}% + \else \ifdim\scratchdimen=\zeropoint + % nothing to skip + \else % disappears at top of page + \vskip\scratchdimen + \fi \fi \fi \ifdim\dp\nextbox>\dp\strutbox \getnoflines{\dp\nextbox}% @@ -704,7 +482,8 @@ \ifshowgridboxes \setbox\nextbox\vbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}% \fi - \let\presnapskip\@@alignsnapamount + \scratchdimen\@@alignsnapamount + \edef\presnapskip{\the\scratchdimen}% \ifnum\@@alignsnap>2 \def\presnap {+}\fi \ifnum\@@alignsnap<4 \def\postsnap{+}\fi \setbox\nextbox\hbox{\tracedsnapping\box\nextbox}% @@ -729,21 +508,19 @@ \fi \extrasnapreset \enablepresnapcorrection - \global\chardef\@@alignsnap0 - \global\chardef\@@alignsnapbox0 + \global\chardef\@@alignsnap\zerocount + \global\chardef\@@alignsnapbox\zerocount \egroup}} \def\tracedgridamount#1#2% {\color[grid:four]{\vrule\!!width\wd\nextbox\!!height#1\!!depth#2}} -\def\snaptomathgrid% probably not working ok, also kind of obsolete +\def\snaptomathgrid % probably not working ok, also kind of obsolete {\ifgridsnapping \dowithnextbox - {\blanko[\v!regel] - \snaptogrid\vbox{\box\nextbox} - \blanko[\v!regel]} + {\blanko[\v!regel]\snaptogrid\vbox{\box\nextbox}\blanko[\v!regel]} \vbox\bgroup - \let\setdisplayskips=\relax + \let\setdisplayskips\relax \abovedisplayskip\zeropoint \abovedisplayshortskip\zeropoint \belowdisplayskip\zeropoint @@ -751,14 +528,14 @@ \@EA\let\@EA\next \fi} -\def\topsnaptogrid% +\def\topsnaptogrid {\ifgridsnapping \dowithnextbox - {\scratchdimen=\ht\nextbox - \advance\scratchdimen by -\ht\strutbox - \advance\scratchdimen by \topskip - \ht\nextbox=\scratchdimen - \dp\nextbox=\zeropoint + {\scratchdimen\ht\nextbox + \advance\scratchdimen -\ht\strutbox + \advance\scratchdimen \topskip + \ht\nextbox\scratchdimen + \dp\nextbox\zeropoint \box\nextbox \kern\lineheight \kern-\topskip @@ -766,61 +543,68 @@ \hbox \fi} -\def\centertogrid% - {\ifgridsnapping - \dowithnextbox - {\bgroup - \par - \scratchdimen=\ht\nextbox - \advance\scratchdimen by \dp\nextbox - \getnoflines\scratchdimen - \setbox\nextbox=\vbox to \noflines\lineheight - {\forgetall - \vskip\zeropoint plus \ht\nextbox - \copy\nextbox - \kern.5\dp\strutbox % VOORLOPIGE WAARDE - \vskip\zeropoint plus \dp\nextbox} - \noindent\snaptogrid\vbox{\box\nextbox}% - \egroup} - \hbox - \fi} +% The old one (to be kept): +% +% \def\centertogrid +% {\ifgridsnapping +% \dowithnextbox +% {\bgroup +% \par +% \scratchdimen\ht\nextbox +% \advance\scratchdimen \dp\nextbox +% \getnoflines\scratchdimen +% \setbox\nextbox\vbox to \noflines\lineheight +% {\forgetall +% \vskip\zeropoint \!!plus \ht\nextbox +% \copy\nextbox +% \kern.5\dp\strutbox % VOORLOPIGE WAARDE +% \vskip\zeropoint \!!plus \dp\nextbox} +% \noindent\snaptogrid\vbox{\box\nextbox}% +% \egroup} +% \hbox +% \fi} +% +% The new implementation, using one of the placement +% options, will be configurable some day ... + +\def\centertogrid % usage: see ie pascal / stepcharts + {\snaptogrid[\v!midden,.5\dp\strutbox]\vbox} \ifx\startbaselinecorrection\undefined \wait \fi % change order \let\normalstartbaselinecorrection=\startbaselinecorrection -\def\startbaselinecorrection% +\def\startbaselinecorrection {\ifgridsnapping \centertogrid\bgroup - \let\stopbaselinecorrection=\egroup + \let\stopbaselinecorrection\egroup \else \normalstartbaselinecorrection \fi} \def\setgridbox#1#2#3% - {\setbox#1=\ruledvbox to #3 % given size + {\setbox#1\ruledvbox to #3 % given size {\forgetall \resetteststrut \offinterlineskip - \hsize=#2 + \hsize#2% \baselinerulefalse \ruledvbox % calculated size -% {\getnoflines{#3}% - {\getrawnoflines{#3}% + {\getrawnoflines{#3}% \getnoflines{#3}% \vskip\topskip \vskip-\ht\strutbox - \scratchdimen=#2\advance\scratchdimen by \lineheight - \dorecurse - {\noflines} + \scratchdimen#2\advance\scratchdimen \lineheight + \dorecurse\noflines {\strut \hskip-.5\lineheight \rlap - {\hskip\scratchdimen\hskip2pt\infofont + {\hskip\scratchdimen + \hskip2pt\infofont \hbox to 1em{\hss\recurselevel}}% \vrule \!!height .5\testrulewidth - \!!depth .5\testrulewidth - \!!width \scratchdimen + \!!depth .5\testrulewidth + \!!width \scratchdimen \par}} \vfill}} @@ -839,14 +623,15 @@ {\ifgridsnapping\doifsomething{#1}{\dodoverplaatsopgrid[#1]}\fi} \def\dodoverplaatsopgrid[#1]% some day : speed up - {\global\chardef\@@alignsnap0 - \global\chardef\@@alignsnapbox0 - \global\chardef\@@alignsnapdepth0 + {\global\chardef\@@alignsnap\zerocount + \global\chardef\@@alignsnapbox\zerocount + \global\chardef\@@alignsnapdepth\zerocount \global\let\@@alignsnapamount\!!zeropoint \donefalse \expanded{\processallactionsinset[#1]} [\v!standaard=>, \v!normaal=>, % to be sure + \v!ja=>, % to be sure \v!boven=>\gridwarning+\positiveextrasnap\extrasnapbefore, \v!onder=>\gridwarning+\positiveextrasnap\extrasnapafter, \v!beide=>\positiveextrasnap\extrasnaparound, @@ -869,13 +654,13 @@ \s!default=>, \s!unknown=>\@@unknowngriddisplacement]} -\def\verplaatsopgrid% +\def\verplaatsopgrid {\dosingleempty\doverplaatsopgrid} \def\doplaatsopgrid[#1]% {\doverplaatsopgrid[#1]\snaptogrid\vbox} -\def\plaatsopgrid% +\def\plaatsopgrid {\dosingleempty\doplaatsopgrid} %D Snapping is rather robust as long as we use whole lines. @@ -903,7 +688,7 @@ \newbox\fuzzysnapbox \newbox\fuzzysnapsplit -%\def\dosyncfuzzyvskip% +%\def\dosyncfuzzyvskip % {\ifvmode\ifdim\lastskip<\lineheight\ifdim\lastskip>\zeropoint % \bgroup % \endgraf @@ -927,7 +712,7 @@ % \global\fuzzysnapdonetrue % \fi} -\def\dosyncfuzzyvskip% +\def\dosyncfuzzyvskip {\ifvmode\ifdim\lastskip<\lineheight\ifdim\lastskip>\zeropoint \bgroup \endgraf\forgetall\vbox{\strut}\nobreak\vskip\lineheight @@ -949,7 +734,7 @@ \def\setfuzzymark#1#2#3% #1/#2 => error recovery {\ifgridsnapping \global\fuzzysnappingtrue - \global\advance\fuzzymarker by \ifodd\fuzzymarker#1\else#2\fi + \global\advance\fuzzymarker \ifodd\fuzzymarker#1\else#2\fi \nobreak \ifshowfuzzyskips \hbox{\color[grid:three] @@ -959,17 +744,14 @@ \fi %[\the\fuzzymarker] %\expandafter\fuzzymark\expandafter{\the\fuzzymarker}% - \expandafter\setmark\expandafter\fuzzymark\expandafter{\the\fuzzymarker}% + \expandafter\rawsetmark\expandafter\fuzzymark\expandafter{\the\fuzzymarker}% \nobreak \fi} -\def\beginfuzzysnapping% odd - {\setfuzzymark21\v!start} +\def\beginfuzzysnapping{\setfuzzymark21\v!start} % odd +\def\endfuzzysnapping {\setfuzzymark12\v!stop } % even -\def\endfuzzysnapping% even - {\setfuzzymark12\v!stop} - -\def\removelastfuzzyvskip% +\def\removelastfuzzyvskip {\ifgridsnapping \iffuzzysnapping \ifdim\lastskip<\openlineheight @@ -986,21 +768,21 @@ \def\docheckfuzzysnap#1% {\bgroup \mindermeldingen - \setbox\fuzzysnapbox=\copy#1\relax - \setbox\fuzzysnapsplit=\vsplit\fuzzysnapbox to 1\lineheight - \let\topfuzzymark=\empty % indeed here ... no real mark + \setbox\fuzzysnapbox\copy#1\relax + \setbox\fuzzysnapsplit\vsplit\fuzzysnapbox to 1\lineheight + \let\topfuzzymark\empty % indeed here ... no real mark \getsplitmarks\fuzzymark % \ifcase0\topfuzzymark - \ifcase0\getsplittopmark\fuzzymark - \global\chardef\fuzzysnappedleft=0 + \ifcase0\rawgetsplittopmark\fuzzymark + \global\chardef\fuzzysnappedleft\zerocount \global\fuzzysnappedfalse % \else\ifodd\topfuzzymark - \else\ifodd\getsplittopmark\fuzzymark - \global\chardef\fuzzysnappedleft=1 - \global\fuzzysnappedtrue + \else\ifodd\rawgetsplittopmark\fuzzymark + \global\chardef\fuzzysnappedleft\plusone + \global\fuzzysnappedtrue \else \global\chardef\fuzzysnappedleft=2 - \global\fuzzysnappedtrue + \global\fuzzysnappedtrue \fi\fi \iffuzzysnapped \else \doloop @@ -1011,13 +793,13 @@ %\let\topfuzzymark=\empty % ... but not here \getsplitmarks\fuzzymark % \ifcase0\topfuzzymark - \ifcase0\getsplittopmark\fuzzymark + \ifcase0\rawgetsplittopmark\fuzzymark % continue % \else\ifodd\topfuzzymark - \else\ifodd\getsplittopmark\fuzzymark + \else\ifodd\rawgetsplittopmark\fuzzymark \exitloop \else - \global\chardef\fuzzysnappedleft=1 + \global\chardef\fuzzysnappedleft\plusone \global\fuzzysnappedtrue \exitloop \fi\fi @@ -1026,13 +808,13 @@ \egroup} \def\getfuzzysnapcorrection#1% - {\global\let\presnapcorrection =\relax - \global\let\postsnapcorrection=\relax + {\global\let\presnapcorrection \relax + \global\let\postsnapcorrection\relax \ifgridsnapping\iffuzzysnapping \docheckfuzzysnap{#1}% \iffuzzysnapped \iftracegridsnapping - \gdef\presnapcorrection% + \gdef\presnapcorrection {\color[grid:four]{\hrule\!!height.5\openlineheight\!!width\hsize}}% \else \gdef\presnapcorrection{\kern.5\openlineheight}% @@ -1047,7 +829,7 @@ #1#2% \postsnapcorrection} -\def\adaptfuzzypagegoal% +\def\adaptfuzzypagegoal {\ifgridsnapping\iffuzzysnapping\ifcase\fuzzysnappedleft\or % see dopagecontents \scratchdimen\pagegoal \advance\scratchdimen -.5\openlineheight @@ -1056,4 +838,8 @@ \global\chardef\fuzzysnappedleft0 \fi\fi\fi} +%D New: + +\let\checkgridsnapping\relax + \protect \endinput diff --git a/tex/context/base/core-int.tex b/tex/context/base/core-int.tex index 4a9d08375..4f87cf5d0 100644 --- a/tex/context/base/core-int.tex +++ b/tex/context/base/core-int.tex @@ -8,8 +8,8 @@ %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. %D Still to be done properly. @@ -137,12 +137,12 @@ \def\stelkoppelingenin% {\dodoubleargument\getparameters[\??lk]} -\def\definieerkoppeling[#1]% % local loading ! +\def\definieerkoppeling[#1]% % local loading ! {\doifundefined{\s!link:#1:\s!list} {\expanded{\definetwopasslist{\s!link:#1}}% \expanded{\doloadtwopassdata{\s!link:#1}}% \getfirsttwopassdata{\s!link:#1}% - \setxvalue{\s!link:#1:f}{\twopassdata}% + \setxvalue{\s!link:#1:f}{\twopassdata}% \getlasttwopassdata{\s!link:#1}% \setxvalue{\s!link:#1:l}{\twopassdata}% \setxvalue{\s!link:#1:s}{\noftwopassitems}% @@ -159,7 +159,7 @@ \edef\firstlink{0\getvalue{\s!link:#1:f}}% \edef\lastlink{0\getvalue{\s!link:#1:l}}% \edef\currentlink{0\getvalue{\s!link:#1:n}}% - \edef\prevlink{0\getvalue{\s!link:#1:c}}% + \edef\prevlink{0\getvalue{\s!link:#1:c}}% \iftwopassdatafound \edef\nextlink{0\twopassdata}% \setxvalue{\s!link:#1:n}{\nextlink}% @@ -199,17 +199,17 @@ \fi \egroup} -\def\definieerkoppeling[#1]% % local loading ! +\def\definieerkoppeling[#1]% % local loading ! {\doifundefined{\s!link:#1:\s!list} {\expanded{\definetwopasslist{\s!link:#1}}% \expanded{\doloadtwopassdata{\s!link:#1}}% \getfirsttwopassdata{\s!link:#1}% - \let\firstlink=\twopassdata + \let\firstlink\twopassdata \getlasttwopassdata{\s!link:#1}% - \let\lastlink=\twopassdata - \let\noflinks=\noftwopassitems + \let\lastlink\twopassdata + \let\noflinks\noftwopassitems \gettwopassdata{\s!link:#1}% - \let\currentlink=\twopassdata - \let\nextlink=\twopassdata + \let\currentlink\twopassdata + \let\nextlink\twopassdata \setxvalue{\s!link:#1:}% {\firstlink:\lastlink:\noflinks:\currentlink:\nextlink}}} @@ -261,7 +261,7 @@ \let\setupinteractionscreens\empty -\def\berekeninteractiescherm% +\def\berekeninteractiescherm {\doifelse\@@scbreedte\v!passend {\!!widtha\linkerrandbreedte \advance\!!widtha \linkerrandafstand @@ -302,9 +302,9 @@ % may be set! ConTeXt is the producer but we no longer % mention the pragma site, since we don't want to be bothered % with remarks about third party documents and/or associated -% with documents produced outside our control. +% with documents produced outside our control. -\def\doprepareidentity +\def\doprepareidentity {\let\!!stringa\@@iatrefwoord \let\@@iatrefwoord\empty \def\doprepareidentity##1{\edef\@@iatrefwoord @@ -312,45 +312,28 @@ \@EA\processcommacommand\@EA[\!!stringa]\doprepareidentity \global\let\doprepareidentity\relax} -\def\initializeidentity - {\iflocation +\def\doinitializeidentity#1% + {%\iflocation \doprepareidentity - \expanded{\dosetupidentity - {\@@iatitel}% - {\@@iasubtitel}% - {\@@iaauteur}% - {ConTeXt/user/\jobname.tex}% - {\@@iadatum}% - {\@@iatrefwoord}}% - \global\let\initializeidentity\relax - \fi} - -\appendtoks \initializeidentity \to \everyshipout - -% \def\initializepaper% -% {\bgroup -% \doif\@@pcstatus\v!start\locationfalse -% \iflocation % without screen settings -% \egroup -% \dosetuppaper -% {\papersize} -% {\the\papierbreedte} -% {\the\papierhoogte}% -% \else -% \egroup -% \dosetuppaper -% {\printpapersize} -% {\the\printpapierbreedte} -% {\the\printpapierhoogte}% -% \fi} - -\def\initializepaper% + \expanded + {\dosetupidentity + {\@@iatitel}{\@@iasubtitel}{\@@iaauteur}{#1}% + {\@@iadatum}{\@@iatrefwoord}}% + \global\let\initializeidentity\relax + }%\fi} + +\def\initializeidentity % not to be changed ! + {\doinitializeidentity{ConTeXt/user/\jobname.tex}} + +\appendtoks \initializeidentity \to \everyshipout + +\def\initializepaper {\bgroup - \ifx\@@pplinks \empty - \ifx\@@pprechts\empty - \ifx\@@ppboven \empty - \ifx\@@pponder \empty - \ifx\@@pcstatus\v!start + \ifx\@@pplinks \empty + \ifx\@@pprechts\empty + \ifx\@@ppboven \empty + \ifx\@@pponder \empty + \ifx\@@pcstatus\v!start \locationfalse\fi\else \locationfalse\fi\else \locationfalse\fi\else @@ -364,16 +347,16 @@ \dosetuppaper\printpapersize\printpapierbreedte\printpapierhoogte \fi} -\appendtoks \initializepaper \to \everyshipout +\appendtoks \initializepaper \to \everyshipout \def\doinitializepaper {\bgroup \berekeninteractiescherm - \ifdim\!!widtha>\papierbreedte\ifdim\!!widtha>\zeropoint - \papierbreedte\!!widtha + \ifdim\!!widtha>\papierbreedte\ifdim\!!widtha>\zeropoint + \papierbreedte\!!widtha \fi\fi - \ifdim\!!heighta>\papierhoogte\ifdim\!!heighta>\zeropoint - \papierhoogte\!!heighta + \ifdim\!!heighta>\papierhoogte\ifdim\!!heighta>\zeropoint + \papierhoogte\!!heighta \fi\fi \dosetuppaper {\printpapersize} @@ -383,59 +366,26 @@ \let\@@pcscreendata\empty -% \def\dosetupinteractionscreens% met a, b en \number -% {\doifnot{\@@pcstatus}{\v!start} -% {\bgroup -% \berekeninteractiescherm -% \processaction -% [\@@scoptie] -% [ \v!max=>\!!counte=1, -% \v!bookmark=>\!!counte=2, -% \s!unknown=>\!!counte=0, -% \s!default=>\!!counte=0]% -% \edef\temp% -% {{\number\rugoffset}{\number\kopoffset}% -% {\number\!!widtha}{\number\!!heighta}% -% {\the\!!counte}}% -% \doifnot{\the\!!widtha\the\!!heighta}{\@@pcscreendata} -% {\xdef\@@pcscreendata{\the\!!widtha\the\!!heighta}% -% \showmessage{\m!interactions}{1} % niet waterdicht -% {\@EA\withoutpt\the\!!widtha,\@EA\withoutpt\the\!!heighta}}% -% % need to be split: dimensions for each page -% % and mode per document and only once ! -% \dosetupscreen -% {\rugoffset}{\kopoffset} -% {\!!widtha}{\!!heighta} -% {\the\!!counte}% -% \egroup}} - -\def\dosetupinteractionscreens% met a, b en \number +\def\dosetupinteractionscreens % met a, b en \number {\doifnot\@@pcstatus\v!start\dodosetupinteractionscreens} -\setvalue{\??sc\c!optie\v!max }{1} % tzt share with driver -\setvalue{\??sc\c!optie\v!bookmark}{2} % tzt share with driver -\setvalue{\??sc\c!optie\v!passend }{3} % tzt share with driver +\setvalue{\??sc\c!optie\v!max }{1} % tzt share with driver +\setvalue{\??sc\c!optie\v!bookmark}{2} % tzt share with driver +\setvalue{\??sc\c!optie\v!passend }{3} % tzt share with driver -\def\dodosetupinteractionscreens% met a, b en \number +\def\dodosetupinteractionscreens % met a, b en \number {\bgroup \berekeninteractiescherm - % slow, called each page - % \processaction - % [\@@scoptie] - % [ \v!max=>\!!counte=1, - % \v!bookmark=>\!!counte=2, - % \s!unknown=>\!!counte=0, - % \s!default=>\!!counte=0]% - % fast, tzt installable \!!counte=0\getvalue{\??sc\c!optie\@@scoptie}\relax - % + % niet waterdicht \doifnot{\the\!!widtha\the\!!heighta}\@@pcscreendata {\xdef\@@pcscreendata{\the\!!widtha\the\!!heighta}% - \showmessage{\m!interactions}{1} % niet waterdicht - {\@EA\withoutpt\the\!!widtha,\@EA\withoutpt\the\!!heighta}}% - % need to be split: dimensions for each page - % and mode per document and only once ! + \showmessage\m!interactions + 1{\@EA\withoutpt\the\!!widtha,\@EA\withoutpt\the\!!heighta}}% + % needs to be split: dimensions for each page + % and mode per document and only once ! \dosetupscreen\rugoffset\kopoffset\!!widtha\!!heighta{\the\!!counte}% + \dosetupcropbox\rugoffset\kopoffset\!!widtha\!!heighta \egroup} \def\dostelinteractieschermin[#1]% @@ -445,9 +395,9 @@ \let\setupinteractionscreens\dosetupinteractionscreens \fi} -\appendtoks \setupinteractionscreens \to \everyshipout +\appendtoks \setupinteractionscreens \to \everyshipout -\def\stelinteractieschermin% +\def\stelinteractieschermin {\dosingleempty\dostelinteractieschermin} %D Due to requests I finally decided to support bookmarks, a @@ -482,7 +432,7 @@ %\let\flushpostponedbookmark\relax -\def\flushpostponedbookmark% +\def\flushpostponedbookmark {\the\postponedbookmarks \global\postponedbookmarks\emptytoks} @@ -493,31 +443,20 @@ \writestatus{system}{clashing bookmarks: \ascii}% ECHTE MESSAGE MAKEN \egroup \fi -% \gdef\flushpostponedbookmark% -% {\global\let\flushpostponedbookmark\relax -% \schrijfnaarlijst[\@@bookmark]{}{#1}}} \doglobal\prependtoks \schrijfnaarlijst[\@@bookmark]{}{#1}% \to\postponedbookmarks} \def\complexbookmark[#1]#2% -% {\schrijfnaarlijst[#1]{}{#2}} {\doglobal\appendtoks\schrijfnaarlijst[#1]{}{#2}\to\postponedbookmarks} \definecomplexorsimple\bookmark -% \def\insertbookmark[#1]#2% -% {\bgroup -% \doifreferencefoundelse{#1} -% {\doinsertbookmark{0}{0}{#2}{\currentrealreference}}{1} -% {\unknownreference{#1}}% -% \egroup} - \newif\iftracebookmarks \tracebookmarksfalse \let\tracebookmarks\tracebookmarkstrue -\def\placebookmarks% +\def\placebookmarks {\dodoubleempty\doplacebookmarks} \def\doplacebookmarks[#1][#2]% @@ -527,9 +466,9 @@ \ifsecondargument \edef\openbookmarklist{#2}% \else - \let\openbookmarklist=\empty + \let\openbookmarklist\empty \fi - \global\let\bookmarklevellist=\empty + \global\let\bookmarklevellist\empty \def\bookmarklevelcount{0}% \doprocessbookmarks[#1]\dogetbookmarkelement \dolijstelement{}{}{}{}{}{}% needed to finish the first pass @@ -542,42 +481,40 @@ \fi} \def\doprocessbookmarks[#1]#2% - {\let\dolijstelement=#2\relax - \scratchcounter=0 + {\let\dolijstelement#2\relax + \scratchcounter\zerocount \def\docommando##1% - {\advance\scratchcounter by 1 + {\advance\scratchcounter \plusone \getlistlevel[##1]\listlevel{\the\scratchcounter}% \setxvalue{\@@bookcount\the\scratchcounter}{1}% \setxvalue{\@@booklevel##1}{\listlevel}}% \processcommalist[#1]\docommando \setxvalue{\@@bookcount0}{1}% - \global\chardef\currentbookmarklevel=0 - \global\chardef\previousbookmarklevel=0 - \doutilities{#1,\@@bookmark}{\jobname}{#1}{}{}} + \global\chardef\currentbookmarklevel\zerocount + \global\chardef\previousbookmarklevel\zerocount + \doutilities{#1,\@@bookmark}\jobname{#1}\relax\relax} \def\dodogetbookmarkelement#1#2#3#4#5#6% - {%\doifsomething{#1} - % {\global\chardef\currentbookmarklevel=\getvalue{\@@booklevel#1}}% - \doifelsenothing{#1} - {\global\chardef\currentbookmarklevel=0\relax} - {\global\chardef\currentbookmarklevel=\getvalue{\@@booklevel#1}\relax}% + {\doifelsenothing{#1} + {\global\chardef\currentbookmarklevel\zerocount} + {\global\chardef\currentbookmarklevel\getvalue{\@@booklevel#1}\relax}% \ifnum\currentbookmarklevel>\previousbookmarklevel \setxvalue{\@@bookcount\the\currentbookmarklevel}{1}% \else\ifnum\currentbookmarklevel<\previousbookmarklevel \bgroup - \!!counta=\previousbookmarklevel + \!!counta\previousbookmarklevel \doloop - {\let\bookmarktag=\empty - \!!countb=\!!counta - \advance\!!countb by -1 - \dorecurse{\!!countb} - {\edef\bookmarktag% + {\let\bookmarktag\empty + \!!countb\!!counta + \advance\!!countb \minusone + \dorecurse\!!countb + {\edef\bookmarktag {\bookmarktag\getvalue{\@@bookcount\recurselevel}:}}% - \edef\bookmarklevelcount% + \edef\bookmarklevelcount {\getvalue{\@@bookcount\the\!!counta}}% - \xdef\bookmarklevellist% + \xdef\bookmarklevellist {\bookmarklevellist/\bookmarktag:\bookmarklevelcount/}% - \advance\!!counta by -1 + \advance\!!counta \minusone \ifnum\!!counta=\currentbookmarklevel \exitloop \fi}% @@ -587,19 +524,17 @@ \@EA\doglobal\@EA\increment\csname \@@bookcount\the\previousbookmarklevel\endcsname\relax \fi\fi \global\utilitydonetrue - \global\chardef\previousbookmarklevel=\currentbookmarklevel} + \global\chardef\previousbookmarklevel\currentbookmarklevel} -\def\getbookmarklevelcount% +\def\getbookmarklevelcount {\@EA\def\@EA\docommando\@EA[\@EA##\@EA1\@EA/\bookmarktag:##2/##3]% {\def\bookmarklevelcount{##2}}% \@EA\@EA\@EA\docommando\@EA\@EA\@EA[\@EA\bookmarklevellist\@EA/\bookmarktag:0/]} \def\dodoputbookmarkelement#1#2#3#4#5#6% - {%\doifsomething{#1} - % {\global\chardef\currentbookmarklevel=\getvalue{\@@booklevel#1}}% - \doifelsenothing{#1} - {\global\chardef\currentbookmarklevel=0\relax} - {\global\chardef\currentbookmarklevel=\getvalue{\@@booklevel#1}\relax}% + {\doifelsenothing{#1} + {\global\chardef\currentbookmarklevel\zerocount} + {\global\chardef\currentbookmarklevel\getvalue{\@@booklevel#1}\relax}% \ifnum\currentbookmarklevel>\previousbookmarklevel \setxvalue{\@@bookcount\the\currentbookmarklevel}{1}% \else\ifnum\currentbookmarklevel<\previousbookmarklevel @@ -607,55 +542,51 @@ \else \@EA\doglobal\@EA\increment\csname \@@bookcount\the\previousbookmarklevel\endcsname\relax \fi\fi - \let\bookmarktag=\empty + \let\bookmarktag\empty \!!countb\currentbookmarklevel - \dorecurse{\!!countb} - {\edef\bookmarktag% + \dorecurse\!!countb + {\edef\bookmarktag {\bookmarktag\getvalue{\@@bookcount\recurselevel}:}}% \getbookmarklevelcount \iftracebookmarks \bgroup \par \bookmarktag\quad - \dorecurse{\currentbookmarklevel}{\quad}\unskip#1\quad + \dorecurse\currentbookmarklevel{\quad}\unskip#1\quad (\bookmarklevelcount)\quad \egroup \fi - \global\chardef\previousbookmarklevel=\currentbookmarklevel + \global\chardef\previousbookmarklevel\currentbookmarklevel \global\utilitydonetrue \insertsomebookmark - {#1} - {\the\currentbookmarklevel} - {\bookmarklevelcount} - {#4} - {#6}} + {#1}{\the\currentbookmarklevel}{\bookmarklevelcount}{#4}{#6}} \def\dogetbookmarkelement#1#2#3#4#5#6% - {\doifnot{#1}{\@@bookmark} + {\doifnot{#1}\@@bookmark {\dodogetbookmarkelement{#1}{#2}{#3}{#4}{#5}{#6}}} \def\doputbookmarkelement#1#2#3#4#5#6% - {\doifelse{#1}{\@@bookmark} + {\doifelse{#1}\@@bookmark {\localbookmark{#4}} {\flushbookmark \dodoputbookmarkelement{#1}{#2}{#3}{#4}{#5}{#6}}} -\let\flushbookmark=\relax -\let\localbookmark=\gobbleoneargument +\let\flushbookmark\relax +\let\localbookmark\gobbleoneargument \def\insertsomebookmark#1#2#3#4#5% - {\gdef\flushbookmark% + {\gdef\flushbookmark {\doinsertsomebookmark{#1}{#2}{#3}{#4}{#5}{g}}% \gdef\localbookmark##1% {\doinsertsomebookmark{#1}{#2}{#3}{##1}{#5}{l}}} \def\doinsertsomebookmark#1#2#3#4#5#6% {\global\utilitydonetrue - \global\let\localbookmark=\gobbleoneargument - \global\let\flushbookmark=\relax - \doifinstringelse{#1}{\openbookmarklist} - {\chardef\openbookmark=1} - {\chardef\openbookmark=0}% + \global\let\localbookmark\gobbleoneargument + \global\let\flushbookmark\relax + \doifinstringelse{#1}\openbookmarklist + {\chardef\openbookmark\plusone} + {\chardef\openbookmark\zerocount}% \iftracebookmarks(#6: #4)\quad(\the\openbookmark)\par\fi \doinsertbookmark{#2}{#3}{#4}{#5}{\openbookmark}} @@ -677,8 +608,8 @@ \def\testinteractiemenu#1% {\iflocation - \doifelse{\@@iamenu}{\v!aan} - {\doifelsevalue{\??am#1\c!status}{\v!start} + \doifelse\@@iamenu\v!aan + {\doifelsevalue{\??am#1\c!status}\v!start {\global\locationmenupermittedtrue} {\global\locationmenupermittedfalse}} {\global\locationmenupermittedfalse}% @@ -697,10 +628,10 @@ \setevalue{\??am##1\c!blokkade}{\interactieblokkade}}}% \processcommalist[#2]\dodoblokkeerinteractiemenu} -\def\blokkeerinteractiemenu% +\def\blokkeerinteractiemenu {\dotripleempty\doblokkeerinteractiemenu[\addtocommalist]} -\def\geefinteractiemenuvrij% +\def\geefinteractiemenuvrij {\dotripleempty\doblokkeerinteractiemenu[\removefromcommalist]} % ja : kader/achtergrond met tekst @@ -711,78 +642,7 @@ \newif\iflocationdummy \newif\ifskippedmenuitem -% \def\dosetlocationbox#1[#2]#3#4% -% {\global\skippedmenuitemfalse -% \setbox\locationbox=\hbox -% {% anders cyclische aanroep ! -% \resetgoto -% \iflocationdummy -% \edef\locationboxborder{\getvalue{#1\c!kader}}% -% \edef\locationboxbackground{\getvalue{#1\c!achtergrond}}% -% \else -% \edef\locationboxborder{\v!uit}% -% \edef\locationboxbackground{}% -% \fi -% \localframed[#1] -% [\c!kader=\locationboxborder, -% \c!achtergrond=\locationboxbackground, -% #2] -% {\dolocationattributes{#1}\c!letter\c!kleur{#3}}}% -% \hbox{#4{\box\locationbox}}} -% -% \def\setlocationboxyes#1[#2]#3[#4]% -% {\ifx\currentouterreference\empty -% \ifrealreferencepage\!!doneatrue\else\!!doneafalse\fi -% %\doifelse{\currentrealreference}{\realfolio} -% % {\!!doneatrue}{\!!doneafalse}% -% \else -% \!!doneafalse -% \fi -% \if!!donea -% %\ifcase0\getvalue{#1\c!zelfdepagina}\relax -% \ifcase0\getvalue{\??am\??am\getvalue{#1\c!zelfdepagina}}\relax -% \bgroup -% \locationdummytrue -% \setevalue{#1\c!kleur}{\getvalue{#1\c!contrastkleur}}% -% \dosetlocationbox{#1}[#2,\c!leeg=\v!nee]{#3}{\gotolocation{#4}}% -% \egroup -% \or -% \locationdummytrue -% \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{\gotolocation{#4}}% -% \or -% \locationdummyfalse -% \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{\gotolocation{#4}}% -% \or -% \locationdummyfalse -% \global\skippedmenuitemtrue -% \fi -% \else -% \locationdummytrue -% \dosetlocationbox{#1}[#2,\c!leeg=\v!nee]{#3}{\gotolocation{#4}}% -% \fi} -% -% \def\setlocationboxnop#1[#2]#3[#4]% -% %{\ifcase\getvalue{#1\c!onbekendeverwijzing}\relax -% {\ifcase\getvalie{\??am\??am\getvalue{#1\c!onbekendeverwijzing}}\relax -% \locationdummytrue -% \dosetlocationbox{#1}[#2,\c!leeg=\v!nee]{#3}{}% -% \or -% \locationdummytrue -% \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{}% -% \or -% \locationdummyfalse -% \dosetlocationbox{#1}[#2,\c!leeg=\v!ja]{#3}{}% -% \or -% \locationdummyfalse -% \global\skippedmenuitemtrue -% \fi} -% -% \def\setlocationbox#1[#2]#3[#4]% -% {\doifreferencepermittedelse{#4}{\csname#1\c!blokkade\endcsname} -% {\setlocationboxyes{#1}[#2]{#3}[#4]} -% {\setlocationboxnop{#1}[#2]{#3}[#4]}} - -\newif\iflocationempty +\newif\iflocationempty \newif\iflocationclick % ja : kader/achtergrond met tekst @@ -796,14 +656,14 @@ % \setupinteractionmenu[right][samepage=none, unknownreference=none] % % \startinteractionmenu[right] -% \but [firstpage] first \\ -% \but [lastpage] last \\ -% \but [somepage] crap \\ +% \but [firstpage] first \\ +% \but [lastpage] last \\ +% \but [somepage] crap \\ % \stopinteractionmenu \def\dosetlocationboxcontent#1[#2]#3[#4]% {\global\skippedmenuitemfalse - \setbox\locationbox=\hbox + \setbox\locationbox\hbox {\resetgoto % anders cyclische aanroep ! \localframed[#1][#2] {\dolocationattributes{#1}\c!letter\c!kleur{#3}}}% @@ -813,15 +673,15 @@ \hbox{\box\locationbox}% \fi} -\let\dosetlocationboxyes\dosetlocationboxcontent +\let\dosetlocationboxyes\dosetlocationboxcontent -\def\dosetlocationboxempty#1[% - {\dosetlocationboxcontent{#1}[\c!leeg=\v!ja} +\def\dosetlocationboxempty#1[% + {\dosetlocationboxcontent{#1}[\c!leeg=\v!ja,} -\def\dosetlocationboxno#1[% +\def\dosetlocationboxno#1[% {\dosetlocationboxcontent{#1}[\c!leeg=\v!ja,\c!kader=,\c!achtergrond=,} -\def\dosetlocationboxnone#1[#2]#3[#4]% +\def\dosetlocationboxnone#1[#2]#3[#4]% {\global\skippedmenuitemtrue} \def\setlocationboxyes#1% @@ -859,7 +719,7 @@ \fi{#1}} \def\setlocationbox#1[#2]#3[#4]% - {\bgroup % really needed ! + {\bgroup % really needed ! \edef\permittedreferences{\csname#1\c!blokkade\endcsname}% \doifreferencepermittedelse{#4} {\setlocationboxyes{#1}[#2]{#3}[#4]} @@ -911,37 +771,9 @@ \newtoks\everysetmenucommands -% \def\setamboxcommands#1#2% -% {\def\@@amboxcommand##1\\% -% {\bgroup -% \leavevmode\ignorespaces##1\unskip\relax -% \ifskippedmenuitem \else -% \getvalue{\??am#1#2}% -% \fi -% \egroup -% \ignorespaces}% -% \doglobal\newcounter\currentamposition %%% experiment -% \def\currentmenu{#1}% to be sure -% % here, but could go into \everysetmenucommands -% \def\raw[##1]##2\\% -% {\@@amboxcommand\naarbox{\ignorespaces##2\unskip}[##1]\\}% -% \def\but[##1]##2\\% -% {\@@amboxcommand\do@@amposition{#1}{##1}{\setlocationbox{\??am#1}[]{\ignorespaces##2\unskip}[##1]}\\}% -% \def\got[##1]##2\\% pas op! offset -% {\@@amboxcommand\setlocationbox{\??am#1}[\c!kader=\v!uit,\c!achtergrond=]{\ignorespaces##2\unskip}[##1]\\}% -% \def\nop##1\\% -% {\@@amboxcommand\phantom{\localframed[\??am#1][]{}}\\}% -% \def\txt##1\\% -% {\@@amboxcommand\localframed[\??am#1][\c!kader=\v!uit,\c!achtergrond=]{\ignorespaces##1\unskip}\\}% -% \def\rul##1\\% ook \do@@amposition ! -% {\@@amboxcommand\localframed[\??am#1][]{\ignorespaces##1\unskip}\\}% -% \def\com##1\\% -% {\ignorespaces##1\unskip\ignorespaces}% -% \the\everysetmenucommands} - \def\setamboxcommands#1#2% {\def\currentmenu{#1}% % kan nog eerder - \def\currentsubmenu{#2}% % ? ? + \def\currentsubmenu{#2}% % ? ? \doglobal\newcounter\currentamposition \the\everysetmenucommands} @@ -995,9 +827,9 @@ \let\currentmenu\empty -% beware : never change the concept of pbgoffset +% beware : never change the concept of pbgoffset -\def\@@amhbox#1#2#3#4% +\def\@@amhbox#1#2#3#4% {\def\currentmenu{#3}% \testinteractiemenu{#3}% \iflocationmenupermitted @@ -1010,10 +842,10 @@ \advance\dimen0 \pagebackgroundhoffset \advance\dimen0 -\getvalue{\??am#3\c!linkeroffset}% \advance\dimen0 -\getvalue{\??am#3\c!rechteroffset}% - \setbox0=\hbox to \dimen0 + \setbox0\hbox to \dimen0 {\forgetall \executeamboxcommands{#3}{#4}\c!links\c!midden\c!rechts}% - \setbox0=\hbox{\do@@ammenuposition{#3}{\box0}}% + \setbox0\hbox{\do@@ammenuposition{#3}{\box0}}% \wd0=\zetbreedte % geen \ht=#2 setting (yet) \hskip-\pagebackgroundhoffset @@ -1036,14 +868,14 @@ \advance\dimen0 \pagebackgrounddepth \advance\dimen0 -\getvalue{\??am#3\c!bovenoffset}% \advance\dimen0 -\getvalue{\??am#3\c!onderoffset}% - \setbox0=\vbox to \dimen0 + \setbox0\vbox to \dimen0 {\forgetall % Voor't geval de afstand %\stelblankoin[\v!standaard]% % (tijdelijk) is aangepast. \restorestandardblank \hsize#2\relax \executeamboxcommands{#3}{#4}\c!voor\c!tussen\c!na}% - \setbox0=\vbox{\hbox{\do@@ammenuposition{#3}{\box0}}}% - \setbox0=\vbox + \setbox0\vbox{\hbox{\do@@ammenuposition{#3}{\box0}}}% + \setbox0\vbox {\vskip-\pagebackgroundvoffset \vskip\getvalue{\??am#3\c!bovenoffset}% \ht0=\zeropoint @@ -1080,47 +912,47 @@ {\getvalue{\??am\c!menu#1}} \def\horizontaalinteractiemenu#1#2#3#4% - {\ifdim#2>\zeropoint % new - \dimen2=\zeropoint - \setbox0=\hbox + {\ifdim#2>\zeropoint % new + \dimen2\zeropoint + \setbox0\hbox {\def\docommando##1% - {\doifnotvalue{\??am##1\c!status}{\v!geen} + {\doifnotvalue{\??am##1\c!status}\v!geen {\hskip\dimen2 - \setbox2=\hbox to #2 + \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}% + \doifelsevalue{\??am##1\c!afstand}\v!overlay + {\dimen2\zeropoint + \wd2\zeropoint}% {\dimen2=\getvalue{\??am##1\c!afstand}}% \box2}}% \startinteractie \processcommacommand[\getvalue{\??am#1}]\docommando - \stopinteractie}% + \stopinteractie}% \wd0=#2\relax \box0\relax \fi} \def\vertikaalinteractiemenu#1#2#3#4% - {\ifdim#2>\zeropoint % new - \dimen2=\zeropoint - \setbox0=\vbox + {\ifdim#2>\zeropoint % new + \dimen2\zeropoint + \setbox0\vbox {\def\docommando##1% - {\doifnotvalue{\??am##1\c!status}{\v!geen} + {\doifnotvalue{\??am##1\c!status}\v!geen {\vskip\dimen2 - \setbox2=\vbox to #2 + \setbox2\vbox to #2 {\getvalue{\??am##1#3}\interactiemenu[##1]\getvalue{\??am##1#4}}% - \doifelsevalue{\??am##1\c!afstand}{\v!overlay} - {\dimen2=\zeropoint + \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}% + \stopinteractie}% \ht0=#2\relax - \dp0=\zeropoint + \dp0\zeropoint \box0\relax \fi} @@ -1129,17 +961,7 @@ \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} +% todo : \defineinteractionmenuclass \def\interactiemenus[#1]% {\iflocation @@ -1157,8 +979,50 @@ \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 +% this can be implemented with the following command (which +% is new, undocumented, experimental, untested, etc etc) + +\def\defineinteractionmenuclass + {\dodoubleargument\dodefineinteractionmenuclass} + +\def\dodefineinteractionmenuclass[#1][#2]% tag hori|veri + {\doifelse{#2}\v!vertikaal + {\setvalue{\??am\??am\c!menu#1}% + {\vertikaalinteractiemenu + {#1}{\getvalue{\??am#1\c!breedte}}\c!voor\c!na}} + {\setvalue{\??am\??am\c!menu#1}% + {\horizontaalinteractiemenu + {#1}{\getvalue{\??am#1\c!hoogte}}\c!links\c!rechts}}} + +% \setupinteraction[menu=on,state=start] +% +% \defineinteractionmenuclass[test] [vertical] +% \defineinteractionmenuclass[another][horizontal] +% +% \defineinteractionmenu[test] [left][state=start,width=4cm] +% \defineinteractionmenu[another][top] [state=start,height=1cm] +% +% \startinteractionmenu[test] +% \but [firstpage] test-a \\ +% \but [nextpage] test-b \\ +% \stopinteractionmenu +% +% \startinteractionmenu[another] +% \but [firstpage] test-a \\ +% \but [nextpage] test-b \\ +% \stopinteractionmenu +% +% \setupheadertexts[{\interactiemenu[another]}] +% +% \starttext +% +% test \interactionmenu[test] \page +% test \interactionmenu[test] \page +% +% \stoptext + +%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 %D off). We could have achieved something similar with modes. \def\local@@ambox#1#2#3#4% don't change skipping, this one works! @@ -1172,105 +1036,48 @@ \egroup} \unprotected\def\includemenu[#1]% - {\doifvalue{\??am#1\c!status}{\v!lokaal} + {\doifvalue{\??am#1\c!status}\v!lokaal {\bgroup - \setvalue{\??am#1\c!status}{\v!start}% + \letvalue{\??am#1\c!status}\v!start \let\@@amvbox\local@@ambox \let\@@amhbox\local@@ambox \getvalue{\??am\c!menu#1}% \egroup}} -%D We also need an explicit position control some day. I'll +%D We also need an explicit position control some day. I'll %D do that when I need it. [The stacking order.] -% \newif\ifextendedmenu -% -% \def\dodefinieerinteractiemenu[#1][#2][#3]% -% {\ConvertToConstant\doifelse{#3}{} -% {\setvalue{\??am\c!menu#1}% -% {\extendedmenufalse\dointeractiemenu{#1}{#2}}% -% \setvalue{\@@dodolijstelement#1}% -% {\def\dosomelijstelement{\dodomenulijstelement{#1}}}} % of #2 ? -% {\setvalue{\??am\c!menu#1}% -% {\extendedmenufalse\dointeractiemenu{#1}{}}% -% \setvalue{\@@dodolijstelement#1}% -% {\def\dosomelijstelement{\dodomenulijstelement{#1}}}% -% \presetlocalframed[\??am#1]% -% \letvalue{\??am#1\c!blokkade}\empty -% \edef\!!stringe{\getvalue{\??am#2}}% -% \addtocommalist{#1}\!!stringe -% \letvalue{\??am#2}=\!!stringe -% \doifnot{#1}{#2} -% {\copyparameters[\??am#1][\??am#2] -% [\c!links,\c!midden,\c!rechts,\c!voor,\c!na,\c!tussen, -% \c!breedte,\c!hoogte,\c!afstand,\c!offset,\c!kader, -% \c!achtergrond,\c!achtergrondkleur,\c!achtergrondraster, -% \c!letter,\c!kleur,\c!contrastkleur,\c!zelfdepagina,\c!onbekendeverwijzing, -% \c!linkeroffset,\c!rechteroffset,\c!bovenoffset,\c!onderoffset]}% -% % \ConvertToConstant\doifinstringelse{=}{#3} -% \doifassignmentelse{#3} -% {\getparameters[\??am#1][\c!plaats=#2,#3]}% -% {\doifnot{#2}{#3} -% {\copyparameters[\??am#1][\??am#3] -% [\c!links,\c!midden,\c!rechts,\c!voor,\c!na,\c!tussen, -% \c!breedte,\c!hoogte,\c!afstand,\c!offset,\c!kader, -% \c!achtergrond,\c!achtergrondkleur,\c!achtergrondraster, -% \c!letter,\c!kleur,\c!zelfdepagina,\c!onbekendeverwijzing, -% \c!linkeroffset,\c!rechteroffset,\c!bovenoffset,\c!onderoffset]}% -% \getparameters[\??am#1][\c!plaats=#2]}}} -% -%\def\dodostelinteractiemenuin[#1][#2]% -% {\def\docommando##1% -% {\getparameters[\??am##1][#2]% -% \dododostelinteractiemenuin{\??am##1\c!onbekendeverwijzing}% -% \dododostelinteractiemenuin{\??am##1\c!zelfdepagina}}% -% \processcommalist[#1]\docommando} -% -%\def\dostelinteractiemenuin[#1][#2]% -%% {\ConvertToConstant\doifinstringelse{=}{#2} -% {\doifassignmentelse{#2} -% {\dodostelinteractiemenuin[#1][#2]} -% {\dodefinieerinteractiemenu[#1][#2][]}} - -% \def\dododostelinteractiemenuin#1% -% {\processaction -% [\getvalue{#1}] -% [ \v!ja=>\setvalue{#1}{0}, -% \v!leeg=>\setvalue{#1}{1}, -% \v!nee=>\setvalue{#1}{2}, -% \v!geen=>\setvalue{#1}{3}, -% \s!default=>\setvalue{#1}{1}]} - -% for the moment we will support the old method +% for the moment we will support the old method % % \stelinteractiemenuin[right][{abc[xyz]},...] % \stelinteractiemenuin[right][key=val,...] - + \newif\ifextendedmenu -\def\definieerinteractiemenu% +\def\definieerinteractiemenu {\dotripleempty\dodefinieerinteractiemenu} -\def\dodefinieerinteractiemenu[#1][#2]% compatibility hack - {\doifinstringelse{[}{#2} - {\dodostelinteractielijstmenuinx} - {\dododefinieerinteractiemenu }% +\def\dodefinieerinteractiemenu[#1][#2]% compatibility hack + {\convertargument#2\to\ascii % will disappear soon + \doifinstringelse[\ascii + \dodostelinteractielijstmenuinx + \dododefinieerinteractiemenu [#1][#2]} % [name] [location] -% [name] [location] [pars] +% [name] [location] [pars] -\def\dododefinieerinteractiemenu[#1][#2][#3]% - {% main settings - \letvalue{\??am\c!menu#1}\empty +\def\dododefinieerinteractiemenu[#1][#2][#3]% + {% main settings + \letvalue{\??am\c!menu#1}\empty % \setvalue{\??am\c!menu#1}% % {\extendedmenufalse\dointeractiemenu{#1}{}}% \setvalue{\@@dodolijstelement#1}% {\def\dosomelijstelement{\dodomenulijstelement{#1}}}% \presetlocalframed[\??am#1]% - % register location + % register location \expanded{\addtocommalist{#1}\@EA\noexpand\csname\??am#2\endcsname}% - % inherit settings + % inherit settings \doifnot{#1}{#2} {\copyparameters[\??am#1][\??am#2] [\c!links,\c!midden,\c!rechts,\c!voor,\c!na,\c!tussen, @@ -1278,21 +1085,21 @@ \c!achtergrond,\c!achtergrondkleur,\c!achtergrondraster, \c!letter,\c!kleur,\c!contrastkleur,\c!zelfdepagina,\c!onbekendeverwijzing, \c!linkeroffset,\c!rechteroffset,\c!bovenoffset,\c!onderoffset]}% - % additional settings + % additional settings \getparameters[\??am#1][\c!plaats=#2,\c!blokkade=,#3]} \def\stelinteractiemenuin {\dodoubleargument\dostelinteractiemenuin} -\def\dostelinteractiemenuin[#1][#2% compatibillity hack - {\doifnextcharelse\bgroup - {\dodostelinteractielijstmenuiny[#1][#2} - {\dodostelinteractiemenuin [#1][#2}} +\def\dostelinteractiemenuin[#1][% compatibillity hack + {\doifnextcharelse\bgroup % will disappear soon + {\dodostelinteractielijstmenuiny[#1][} + {\dodostelinteractiemenuin [#1][}} -\def\dodostelinteractielijstmenuinx[#1][#2][#3]% compatibillity hack +\def\dodostelinteractielijstmenuinx[#1][#2][#3]% compatibillity hack {\setvalue{\??am\c!menu#1}{\extendedmenufalse\dointeractiemenu{#1}{#2}}} -\def\dodostelinteractielijstmenuiny[#1][#2]% compatibillity hack +\def\dodostelinteractielijstmenuiny[#1][#2]% compatibillity hack {\setvalue{\??am\c!menu#1}% {\extendedmenufalse\dointeractiemenu{#1}{#2}}} @@ -1300,11 +1107,11 @@ {\def\docommando##1{\getparameters[\??am##1][#2]}% \processcommalist[#1]\docommando} -\setvalue{\??am\??am\v!ja }{0} -\setvalue{\??am\??am\v!leeg}{1} -\setvalue{\??am\??am\v!nee }{2} -\setvalue{\??am\??am\v!geen}{3} -\setvalue{\??am\??am }{1} % default +\setvalue{\??am\??am\v!ja }{0} +\setvalue{\??am\??am\v!leeg}{1} +\setvalue{\??am\??am\v!nee }{2} +\setvalue{\??am\??am\v!geen}{3} +\setvalue{\??am\??am }{1} % default \processbetween{\e!interactiemenu}\dostartinteractiemenu @@ -1314,15 +1121,18 @@ \def\dodostartinteractiemenu[#1]#2\dodostopinteractiemenu {\setvalue{\??am\c!menu#1}{\extendedmenutrue\dointeractiemenu{#1}{#2}}} -\def\dodomenulijstelement#1#2#3#4#5#6#7% +\def\resetinteractionmenu[#1]% + {\letvalue{\??am\c!menu#1}\empty} + +\def\dodomenulijstelement#1#2#3#4#5#6#7% {\setbox0=\hbox {\let\gotolocation\gobbleoneargument % hack to catch last [] -%\locationclickfalse % ipv ^ +%\locationclickfalse % ipv ^ \docheckrealreferencepage{#7}% \setlocationboxyes {\??am#1}% % needed ! []% no settings - {\limitatetext{#5}{\getvalue{\??li#2\c!maxbreedte}}{\unknown}}% % needed ! + {\limitatetext{#5}{\getvalue{\??li#2\c!maxbreedte}}{\unknown}}% % needed ! []}% normally the destination, catch by gobble \@@amboxcommand\do@@amposition{#1}{#7}% beware, we pass the pagenumber {\ignorespaces\linklisttoelement{#2}{#3}{#6}{#7}{\box0}\unskip}\\} @@ -1341,22 +1151,6 @@ \definecomplexorsimple\scherm -% \def\domenubutton[#1][#2]#3[#4]% -% {\bgroup -% \locationdummytrue -% \iffirstargument -% \ifsecondargument -% \setlocationbox{\??am#1}[#2]{#3}[#4]% -% \else -% \doifassignmentelse{#1} -% {\setlocationbox\??bt[#1]{#3}[#4]} -% {\setlocationbox{\??am#1}[]{#3}[#4]}% -% \fi -% \else -% \setlocationbox\??bt[]{#3}[#4]% -% \fi -% \egroup} - \unexpanded\def\menubutton {\dodoubleempty\domenubutton} @@ -1370,7 +1164,7 @@ {\@EAEAEA\domenubuttonD}% \fi \else - \@EA\domenubuttonA + \@EA\domenubuttonA \fi[#1]} \def\domenubuttonA[#1][#2]#3[#4]% normal button, no parameters @@ -1393,7 +1187,7 @@ \def\domenubuttonD[#1][#2]#3[#4]% menu button, no parameters {\bgroup - %\locationdummytrue + %\locationdummytrue \setlocationbox{\??am#1}[]{#3}[#4]% \egroup} @@ -1440,7 +1234,7 @@ \ifvmode \@EA\setmark\@EA\syncmarker\@EA{\synccounter} % \marking[\syncmarker]{\synccounter}% \else - \showmessage{\m!interactions}{4}{\synccounter}% + \showmessage\m!interactions4\synccounter \fi \fi\fi} @@ -1450,17 +1244,17 @@ \def\dostelsynchronisatiein[#1]% {\getparameters[\??sy][#1]% - \doifelse{\@@systatus}{\v!start} - {\synchronisationtrue} - {\synchronisationfalse}} + \doifelse\@@systatus\v!start + \synchronisationtrue + \synchronisationfalse} -\def\stelsynchronisatiein% +\def\stelsynchronisatiein {\dosingleargument\dostelsynchronisatiein} -\def\definieersynchronisatie% +\def\definieersynchronisatie {\dosingleargument\dodefinieersynchronisatie} -\def\stelsynchronisatiebalkin% +\def\stelsynchronisatiebalkin {\dodoubleargument\getparameters[\??ba]} \presetlocalframed[\??ba] @@ -1477,10 +1271,10 @@ {\leaders\hrule\!!depth1ex\!!height-.5ex\hfil}% \def\boven##1##2##3% {\dimen0=\wd0 - \divide\dimen0 by 3 - \multiply\dimen0 by ##2\relax + \divide\dimen0 3 + \multiply\dimen0 ##2\relax \dimen2=.25em - \advance\dimen0 by -##3\dimen2 + \advance\dimen0 -##3\dimen2 %\gotodestination % {}{#1}{\syncprefix:##1}{} % {\hbox to \dimen0{\color[\locationcolor\@@bakleur]{\onder}}}}% @@ -1494,7 +1288,7 @@ \check\gettopmark\top \check\getfirstmark\first \check\getbotmark\bot - \setbox2=\hbox to \wd0 + \setbox2\hbox to \wd0 {\ifnum\top=\first\relax \ifnum\first=\bot\relax \boven\first30\relax @@ -1562,12 +1356,12 @@ %\setupinteraction[\c!breedte=\!!zeropoint]% \setinteractionparameter\c!breedte\!!zeropoint \setupblackrules[\c!hoogte=\v!max,\c!diepte=\v!max]% maten ?? - \!!widthb=\@@ibbreedte\relax - \advance\!!widthb by -2.75em\relax - \!!widtha=\!!widthb\relax - \divide\!!widtha by \lastpage\relax + \!!widthb\@@ibbreedte + \advance\!!widthb -2.75em\relax + \!!widtha\!!widthb + \divide\!!widtha \lastpage\relax \bgroup - \advance\realpageno by -1\relax + \advance\realpageno \minusone \ifvoid\meterbox \bgroup \processaction @@ -1577,20 +1371,20 @@ \v!groot=>\dimen0=1em\relax, \s!unknown=>\dimen0=\!!widtha]% \ifdim\!!widtha<\dimen0\relax - \!!counta=\dimen0\relax - \!!countb=\!!widtha - \divide\!!counta by \!!countb + \!!counta\dimen0\relax + \!!countb\!!widtha + \divide\!!counta \!!countb \else - \!!counta=\@@ibstap\relax + \!!counta\@@ibstap\relax \fi \!!widtha=\!!counta\!!widtha - \setbox0=\hbox{\blackrule[\c!breedte=\!!widtha]}% - \global\setbox\meterbox=\hbox to \!!widthb + \setbox0\hbox{\blackrule[\c!breedte=\!!widtha]}% + \global\setbox\meterbox\hbox to \!!widthb {\hss \for \teller=1 \to \lastpage \step \!!counta \do {\gotorealpage{}{}{\teller}{\copy0}}% \hss}% - \global\wd\meterbox=\zeropoint\relax + \global\wd\meterbox\zeropoint \egroup \fi \egroup @@ -1609,17 +1403,17 @@ \setupblackrules[\c!breedte=\!!widtha]% \ifnum\realpageno>1\relax \!!counta=\realpageno - \advance\!!counta by -2\relax - \hskip\zeropoint\!!plus\!!counta sp\relax % cm gives overflow + \advance\!!counta -2\relax + \hskip\zeropoint\!!plus\!!counta \s!sp\relax % cm gives overflow \doganaareenpagina\??ib\blackrule\prevpage \fi \color[\@@ibcontrastkleur]{\blackrule[\c!breedte=.5em]}% \ifnum\realpageno<\lastpage\relax \doganaareenpagina\??ib\blackrule\nextpage \!!counta=\lastpage\relax - \advance\!!counta by -\realpageno - \advance\!!counta by -1\relax - \hskip\zeropoint\!!plus\!!counta sp\relax % cm gives overflow + \advance\!!counta -\realpageno + \advance\!!counta \minusone + \hskip\zeropoint\!!plus\!!counta \s!sp\relax % cm gives overflow \fi}% \hss \doganaareenpagina\??ib\blackrule\lastpage}% @@ -1630,28 +1424,28 @@ \def\interactiebalkc% {\iflocation - \ifnum\lastpage>1 + \ifnum\lastpage>\plusone \hbox to \@@ibbreedte {\setupblackrules[\c!hoogte=\@@ibhoogte,\c!diepte=\@@ibdiepte]% \def\gotox##1% {\doganaareenpagina{}{\blackrule[\c!breedte=##1]}}% \dimen0=\@@ibbreedte\relax - \advance\dimen0 by -4em - \!!counta=\lastpage - \advance\!!counta by -1 - \divide\dimen0 by \!!counta - \!!counta=\realpageno - \advance\!!counta by -1 - \!!widtha=\!!counta\dimen0\relax - \!!countb=\lastpage - \advance\!!countb by -\realpageno - \!!widthb=\!!countb\dimen0 + \advance\dimen0 -4em + \!!counta\lastpage + \advance\!!counta \minusone + \divide\dimen0 \!!counta + \!!counta\realpageno + \advance\!!counta \minusone + \!!widtha\!!counta\dimen0 + \!!countb\lastpage + \advance\!!countb -\realpageno + \!!widthb\!!countb\dimen0 \startcolor[\locationcolor\@@ibkleur]% \gotox{1em}\firstpage \hss - \gotox{\!!widtha}\prevpage + \gotox\!!widtha\prevpage \color[\@@ibcontrastkleur]{\blackrule[\c!breedte=1em]}% - \gotox{\!!widthb}\nextpage + \gotox\!!widthb\nextpage \hss \gotox{1em}\lastpage \stopcolor}% @@ -1660,27 +1454,27 @@ \def\interactiebalkd% {\iflocation\ifshowingsubpage - \ifnum\nofsubpages>1 + \ifnum\nofsubpages>\plusone \hbox \bgroup %\setupinteraction[\c!breedte=\!!zeropoint]% \setinteractionparameter\c!breedte\!!zeropoint \ifbalksymbool % beter: 3 chars assign en 3*box \setupsymbolset[\@@iasymboolset]% - \setbox0=\hbox{\symbol[\v!vorige]}% - \setbox2=\hbox{\symbol[\v!ergens]}% - \setbox4=\hbox{\symbol[\v!volgende]}% + \setbox0\hbox{\symbol[\v!vorige]}% + \setbox2\hbox{\symbol[\v!ergens]}% + \setbox4\hbox{\symbol[\v!volgende]}% \else - \setbox0=\hbox + \setbox0\hbox {\vrule \!!height\@@ibhoogte \!!depth\@@ibdiepte \!!width\@@ibbreedte}% - \setbox2=\copy0 - \setbox4=\copy0 + \setbox2\copy0 + \setbox4\copy0 \fi \startcolor[\locationcolor\@@ibkleur]% - \for\teller=1\to\nofsubpages\step1\do + \for\teller=1\to\nofsubpages\step1\do % brr, \dostepwiserecurse {\bgroup \increment(\teller,\firstsubpage)\relax \decrement\teller\relax @@ -1703,14 +1497,14 @@ \def\interactiebalke% KAN WORDEN GECOMBINEERD MET D {\iflocation\ifshowingsubpage - \ifnum\nofsubpages>1 + \ifnum\nofsubpages>\plusone \bgroup - \!!widthb=\@@ibafstand - \multiply\!!widthb by \nofsubpages - \advance\!!widthb by -\@@ibafstand % (n-1) - \!!widtha=\@@ibbreedte - \advance\!!widtha by -\!!widthb - \divide\!!widtha by \nofsubpages\relax + \!!widthb\@@ibafstand + \multiply\!!widthb \nofsubpages + \advance\!!widthb -\@@ibafstand % (n-1) + \!!widtha\@@ibbreedte + \advance\!!widtha -\!!widthb + \divide\!!widtha \nofsubpages\relax \ifdim\!!widtha<\@@ibafstand\relax \interactiebalkf \else @@ -1721,17 +1515,17 @@ \bgroup \ifbalksymbool \setupsymbolset[\@@iasymboolset]% - \setbox0=\hbox{\symbol[\v!vorige]}% - \setbox2=\hbox{\symbol[\v!ergens]}% - \setbox4=\hbox{\symbol[\v!volgende]}% + \setbox0\hbox{\symbol[\v!vorige]}% + \setbox2\hbox{\symbol[\v!ergens]}% + \setbox4\hbox{\symbol[\v!volgende]}% \else - \setbox0=\hbox + \setbox0\hbox {\vrule \!!height\@@ibhoogte \!!depth\@@ibdiepte \!!width\!!widtha}% - \setbox2=\copy0 - \setbox4=\copy0 + \setbox2\copy0 + \setbox4\copy0 \fi \startcolor[\locationcolor\@@ibkleur]% \for\teller=1\to\nofsubpages\step1\do @@ -1759,55 +1553,55 @@ \def\interactiebalkf% !! KAN WORDEN GECOMBINEERD MET D !! {\iflocation\ifshowingsubpage - \ifnum\nofsubpages>1 + \ifnum\nofsubpages>\plusone %\setupinteraction[\c!breedte=\!!zeropoint]% \setinteractionparameter\c!breedte\!!zeropoint \noindent \hbox to \@@ibbreedte \bgroup - \!!countb=0 + \!!countb\zerocount \loop - \advance\!!countb by 1 - \!!countc=\nofsubpages - \divide\!!countc by \!!countb - \advance\!!countc by 1 - \!!widthb=\@@ibafstand - \multiply\!!widthb by \!!countc - \advance\!!widthb by -\@@ibafstand - \!!widtha=\@@ibbreedte - \advance\!!widtha by -\!!widthb - \divide\!!widtha by \!!countc + \advance\!!countb \plusone + \!!countc\nofsubpages + \divide\!!countc \!!countb + \advance\!!countc \plusone + \!!widthb\@@ibafstand + \multiply\!!widthb \!!countc + \advance\!!widthb -\@@ibafstand + \!!widtha\@@ibbreedte + \advance\!!widtha -\!!widthb + \divide\!!widtha \!!countc \ifdim\!!widtha<\@@ibafstand\relax \repeat -\advance\!!countc by -2 -\!!widtha=-\@@ibafstand +\advance\!!countc -2 +\!!widtha-\@@ibafstand \!!widtha=\!!countc\!!widtha -\advance\!!widtha by \@@ibbreedte -\advance\!!countc by 1 -\divide\!!widtha by \!!countc +\advance\!!widtha \@@ibbreedte +\advance\!!countc \plusone +\divide\!!widtha \!!countc \ifbalksymbool \setupsymbolset[\@@iasymboolset]% - \setbox0=\hbox{\symbol[\v!vorige]}% - \setbox4=\hbox{\symbol[\v!ergens]}% - \setbox8=\hbox{\symbol[\v!volgende]}% - \setbox2=\copy4 - \setbox6=\copy4 + \setbox0\hbox{\symbol[\v!vorige]}% + \setbox4\hbox{\symbol[\v!ergens]}% + \setbox8\hbox{\symbol[\v!volgende]}% + \setbox2\copy4 + \setbox6\copy4 \else - \setbox0=\hbox + \setbox0\hbox {\vrule \!!height\@@ibhoogte \!!depth\@@ibdiepte \!!width\!!widtha}% - \setbox4=\copy0 - \setbox8=\copy0 - \setbox2=\hbox + \setbox4\copy0 + \setbox8\copy0 + \setbox2\hbox {\vrule \!!height.5\ht0 \!!depth.5\dp0 \!!width\!!widtha}% - \ht2=\ht0 - \dp2=\dp0 - \setbox6=\copy2 + \ht2\ht0 + \dp2\dp0 + \setbox6\copy2 \fi \def\gotox##1% {\ifnum\teller=\realpageno @@ -1817,15 +1611,15 @@ \else \gotorealpage{}{}{\teller}{\copy##1}% \fi - \!!countf=0 + \!!countf\zerocount \hss}% \startcolor[\locationcolor\@@ibkleur]% - \!!countc=\realpageno \advance\!!countc by -2 - \!!countd=\realpageno \advance\!!countd by 2 - \!!countf=0 + \!!countc\realpageno \advance\!!countc -2 + \!!countd\realpageno \advance\!!countd 2 + \!!countf\zerocount \for\teller=\firstsubpage\to\lastsubpage\step1\do {\!!doneafalse - \advance\!!countf by 1 + \advance\!!countf \plusone \ifnum\teller=\firstsubpage\relax \!!doneatrue \fi \ifnum\teller=\lastsubpage\relax \!!doneatrue \fi \ifnum\teller>\!!countc \ifnum\teller<\!!countd \!!doneatrue \fi\fi @@ -1872,19 +1666,19 @@ \def\checkinteractiebalk#1#2#3% {\ifdim\@@ibbreedte=\zeropoint\def\@@ibbreedte{#1}\fi - \doifnothing{\@@ibhoogte}{\def\@@ibhoogte{#2}}% - \doifnothing{\@@ibdiepte}{\def\@@ibdiepte{#3}}} + \doifnothing\@@ibhoogte{\def\@@ibhoogte{#2}}% + \doifnothing\@@ibdiepte{\def\@@ibdiepte{#3}}} \def\complexinteractiebalk[#1]% - {\doifelse{#1}{\v!reset} - {\global\setbox\meterbox=\box\voidb@x}% + {\doifelse{#1}\v!reset + {\global\setbox\meterbox\box\voidb@x}% {\bgroup \iflocation \checksubpages % goes wrong / loads \numberofpages too \getparameters[\??ib][#1]% - \doif{\@@ibstatus}{\v!start} + \doif\@@ibstatus\v!start {\startinteractie - \processaction % breedte defaults ! + \processaction % breedte defaults ! [\@@ibvariant] [ c=>\checkinteractiebalk{.5em}\v!max \v!max, d=>\checkinteractiebalk{.5em}{.5em} \!!zeropoint, @@ -1892,8 +1686,8 @@ f=>\checkinteractiebalk{.5em}{.5em} \!!zeropoint, \s!default=>\checkinteractiebalk{10em}\v!ruim\!!zeropoint, \s!unknown=>\checkinteractiebalk{10em}\v!ruim\!!zeropoint]% - \doifelse{\@@ibsymbool}{\v!ja} - {\balksymbooltrue}{\balksymboolfalse}% + \doifelse\@@ibsymbool\v!ja + \balksymbooltrue\balksymboolfalse \getvalue{interactiebalk\@@ibvariant}% \stopinteractie}% \fi @@ -1931,8 +1725,8 @@ \def\profilepage{} -\let\dosetprofilepage=\relax -\let\dogetprofilepage=\relax +\let\dosetprofilepage\relax +\let\dogetprofilepage\relax \def\processprofile#1[#2]% {\iflocation @@ -1950,7 +1744,7 @@ \else \doendofprofile \fi}}% - \def\processedprofiles{}% + \let\processedprofiles\empty \def\doprocessprofile##1% {\doifelse{\@@pfoptie}{\v!test}% {\goodbreak\blanko\nobreak\tt[\spatie @@ -1983,12 +1777,12 @@ {\processprofile1[#1]% \egroup}% \def\next{\processprofile0[#1]}% % \DoAfterFi \processprofile0[#1]% - \else % ^^^^^^^^^^ will be obsolete - \let\next\relax % since ugly and never used + \else % ^^^^^^^^^^ will be obsolete + \let\next\relax % since ugly and never used \fi \next} -\let\stopprofiel=\relax +\let\stopprofiel\relax \def\dovolgprofiel#1[#2]% {\iflocation @@ -2007,7 +1801,7 @@ \def\volgprofiel#1[#2]% {\iflocation - \doif{\@@pfoptie}{\v!test}{\pagereference[\c!profiel!!#2]}% + \doif\@@pfoptie\v!test{\pagereference[\c!profiel!!#2]}% \dovolgprofiel{#1}[#2]% \fi} @@ -2094,10 +1888,10 @@ \def\checkrecentcontributions% {\gettwopassdata{\s!versionbegin}% \iftwopassdatafound - \!!counta=\twopassdata\relax + \!!counta\twopassdata\relax \gettwopassdata{\s!versionend}% \iftwopassdatafound - \!!countb=\twopassdata\relax + \!!countb\twopassdata\relax \doglobal\increment\versionorder\relax \writeutilitycommand% {\twopassentry% @@ -2111,12 +1905,12 @@ {\the\!!countb}}% \for\teller=\!!counta\to\!!countb\step1\do% {\@EA\doglobal\@EA\addtocommalist\@EA{\teller}{\recentcontributions}}% - \let\next=\checkrecentcontributions + \let\next\checkrecentcontributions \else - \let\next=\relax + \let\next\relax \fi \else - \let\next=\relax + \let\next\relax \fi \next} @@ -2131,13 +1925,13 @@ \def\complexstartversie[#1]% {\bgroup - \doifelse{\actualprofile}{}% + \doifelsenothing\actualprofile {\startprofiel[#1]}% {\startprofiel[#1,\actualprofile]}% \def\docomplexstartversie##1% {\stripcharacter.\from##1\to\actualversion - \ifnum\versionlevel>0\relax - \ifnum\actualversion=0\relax + \ifnum\versionlevel>\zerocount\relax + \ifnum\actualversion=\zerocount \setpageversion\actualversion % unknown version \else \ifnum\actualversion<\minimumversion\relax @@ -2157,8 +1951,8 @@ \def\stopversie% {\stopprofiel \doglobal\decrement\versionlevel - \ifnum\versionlevel<0\relax - \showmessage{\m!versions}{1}{}% + \ifnum\versionlevel<\zerocount + \showmessage\m!versions1\empty \else \resetpageversion \egroup @@ -2178,28 +1972,28 @@ \fi\fi}} \egroup -\def\markeerversie% - {\showmessage{\m!versions}{2}{}% - \let\setpageversion=\dosetpageversion - \let\resetpageversion=\relax - \let\checkpageversion=\relax} +\def\markeerversie + {\showmessage\m!versions2\empty + \let\setpageversion\dosetpageversion + \let\resetpageversion\relax + \let\checkpageversion\relax} -\def\selecteerversie% +\def\selecteerversie {\checkrecentcontributions - \showmessage{\m!versions}{3}{\recentcontributions}% - \let\setpageversion=\gobbleoneargument - \let\resetpageversion=\relax - \let\checkpageversion=\docheckpageversion + \showmessage\m!versions3\recentcontributions + \let\setpageversio\gobbleoneargument + \let\resetpageversion\relax + \let\checkpageversion\docheckpageversion \setversion} \def\dodefinieerversie[#1][#2]% {\setvalue{\c!versie!!#1}{#2}% \definieerprofiel[#1][#2]} -\def\definieerversie% +\def\definieerversie {\dodoubleargument\dodefinieerversie} -\def\volgversie% +\def\volgversie {\volgprofiel} \def\volgprofielversie#1[#2][#3]% @@ -2217,16 +2011,16 @@ \def\dostelpaginaovergangenin[#1]% {\doifelsenothing{#1} - {\doifnot{\@@scwachttijd}{\v!geen} + {\doifnot\@@scwachttijd\v!geen {\let\setpagetransition\setsomepagedelay}} - {\doifelse{#1}{\v!start} - {\doifnot{\@@scwachttijd}{\v!geen} + {\doifelse{#1}\v!start + {\doifnot\@@scwachttijd\v!geen {\let\setpagetransition\setsomepagedelay}} {\doglobal\newcounter\currentpagetransition \doifinsetelse{#1}{\v!reset,\v!stop} {\let\setpagetransition\relax} {\let\setpagetransition\setsomepagetransition - \doifinsetelse{\v!willekeurig}{#1} + \doifinsetelse\v!willekeurig{#1} {\randomtransitionstrue}{\randomtransitionsfalse}% \edef\userpagetransitions{#1}% \@EA\removefromcommalist\@EA{\v!willekeurig}\userpagetransitions @@ -2234,26 +2028,26 @@ \let\userpagetransitions\pagetransitions \fi}}}} -\def\setsomepagedelay% +\def\setsomepagedelay {\expanded{\dosetpagetransition{0}{\@@scwachttijd}}} -\def\setsomepagetransition% +\def\setsomepagetransition {\iflocation \ifrandomtransitions \expanded{\getcommalistsize[\userpagetransitions]}% - \getrandomnumber{\currentpagetransition}{1}{\commalistsize}% + \getrandomnumber\currentpagetransition1\commalistsize \else \doglobal\increment\currentpagetransition \fi \expanded{\getfromcommalist[\userpagetransitions][\currentpagetransition]}% - \doifnumberelse{\commalistelement} + \doifnumberelse\commalistelement {\expanded{\getfromcommalist[\pagetransitions][\commalistelement]}} {}% \ifx\commalistelement\empty \doglobal\newcounter\currentpagetransition \setsomepagetransition \else - \doifelse{\@@scwachttijd}{\v!geen} + \doifelse\@@scwachttijd\v!geen {\expanded{\dosetpagetransition{\commalistelement}{0}}} {\expanded{\dosetpagetransition{\commalistelement}{\@@scwachttijd}}}% \fi @@ -2295,19 +2089,19 @@ \def\horizontalgrowingbar\pos#1\min#2\max#3\height#4\depth#5\\% {\hbox to \hsize - {\scratchcounter=#1\relax - \advance\scratchcounter by -#2\relax - \advance\scratchcounter by 1\relax + {\scratchcounter#1% + \advance\scratchcounter -#2% + \advance\scratchcounter \plusone \leaders\vrule\hskip\zeropoint\!!plus \scratchcounter\!!fill - \vrule\!!width\zeropoint\!!height#4\!!depth#5\relax + \vrule\!!width\zeropoint\!!height#4\!!depth#5% \hskip\zeropoint\!!plus #3\!!fill \hskip\zeropoint\!!plus-#1\!!fill}} \def\verticalgrowingbar\pos#1\min#2\max#3\width#4\\% {\vbox to \vsize - {\scratchcounter=#1\relax - \advance\scratchcounter by -#2\relax - \advance\scratchcounter by 1\relax + {\scratchcounter#1% + \advance\scratchcounter -#2% + \advance\scratchcounter \plusone \leaders\hrule\vskip\zeropoint\!!plus\scratchcounter\!!fill \hrule\!!width#4\!!height\zeropoint\!!depth\zeropoint \vskip\zeropoint\!!plus #3\!!fill @@ -2315,85 +2109,60 @@ \newbox\commentbox -\def\doflushcommentanchors% +\def\doflushcommentanchors {\inmarge{\hbox{\raise\ht\strutbox\box\commentbox}}} -\def\flushcommentanchors% in everypar so indirect +\def\flushcommentanchors % in everypar so indirect {\ifvoid\commentbox\else \doflushcommentanchors \fi} -\def\stelcommentaarin% +\def\stelcommentaarin {\dodoubleargument\getparameters[\??cc]} \setvalue{\e!start\e!commentaar}% the dummy triple gobbles trailing spaces {\dotripleempty\dostartcommentaar} -\def\commentaar% +\def\commentaar {\dodoubleempty\docommentaar} \def\dodocommentaar#1% {\!!widtha\@@ccbreedte \!!heighta\@@cchoogte - \doifelse{\@@ccoptie}{\v!max} + \doifelse\@@ccoptie\v!max {\def\@@ccopen{1}}{\def\@@ccopen{0}}% - \doifelse{\@@ccoptie}{\v!buffer} + \doifelse\@@ccoptie\v!buffer {\def\@@cccollect{1}}{\def\@@cccollect{0}}% \doinsertcomment \@@cctitel\!!widtha\!!heighta \@@cckleur\@@ccopen\@@ccsymbool \@@cccollect{#1}} -%\def\dopreparecommentaar#1#2% -% {\doifassignmentelse{#1} -% {\getparameters[\??cc][#1]} -% {\getparameters[\??cc][\c!titel=#1,#2]}} -% -%\def\dostartcommentaar[#1][#2][#3]% -% {\bgroup -% \dopreparecommentaar{#1}{#2}% -% \bgroup -% \obeylines -% \doif{\@@ccspatie}{\v!ja}{\obeyspaces}% -% \long\def\docommando##1% -% {\egroup -% \global\setbox\commentbox=\hbox -% {\dodocommentaar{##1}% -% \hskip\ifvoid\commentbox\@@ccmarge\else\@@ccafstand\fi -% \box\commentbox}% -% \egroup}% -% \grabuntil{\e!stop\e!commentaar}\docommando} -% -%\def\docommentaar[#1][#2]#3% -% {\bgroup -% \dopreparecommentaar{#1}{#2}% -% \hbox to \zeropoint -% {\hskip-\@@ccmarge -% \raise\ht\strutbox\hbox{\dodocommentaar{#3}}}% -% \egroup -% \ignorespaces} - \def\dopreparecommentaar#1#2% {\doifassignmentelse{#1} {\getparameters[\??cc][#1]} {\getparameters[\??cc][\c!titel=#1,#2]}% \obeylines - \doif{\@@ccspatie}{\v!ja}{\obeyspaces}} + \doif\@@ccspatie\v!ja\obeyspaces} \def\dostartcommentaar[#1][#2][#3]% {\bgroup - \dopreparecommentaar{#1}{#2}% - \long\def\docommando##1% - {\global\setbox\commentbox=\hbox - {\dodocommentaar{##1}% - \hskip\ifvoid\commentbox\@@ccmarge\else\@@ccafstand\fi - \box\commentbox}% - \egroup}% + \doifelse\@@ccstatus\v!start + {\dopreparecommentaar{#1}{#2}% + \long\def\docommando##1% + {\global\setbox\commentbox\hbox + {\dodocommentaar{##1}% + \hskip\ifvoid\commentbox\@@ccmarge\else\@@ccafstand\fi + \box\commentbox}% + \egroup}}% + {\long\def\docommando##1% + {\egroup}}% \grabuntil{\e!stop\e!commentaar}\docommando} \def\docommentaar[#1][#2]#3% - {\hbox to \!!zeropoint - {\dopreparecommentaar{#1}{#2}% - \hskip-\@@ccmarge - \raise\ht\strutbox\hbox{\dodocommentaar{#3}}}% + {\doif\@@ccstatus\v!start + {\hbox to \zeropoint + {\dopreparecommentaar{#1}{#2}% + \hskip-\@@ccmarge + \raise\ht\strutbox\hbox{\dodocommentaar{#3}}}}% \ignorespaces} % \startcommentaar @@ -2426,26 +2195,26 @@ % (actually not) documented? Anyhow, by providing this % functionality we demonstrate that \pdfTeX\ can do it. By % the way, it's funny that when in Acrobat we scale up the -% text, the symbols scale down. +% text, the symbols scale down. % \stopcommentaar % \definesymbol [comment-normal][{\externalfigure[koe.pdf]}] % \definesymbol [comment-down] [{\externalfigure[koe.pdf]}] -% +% % \def\CowSymbol#1#2% % {\scale % [\c!hoogte=#1] % {\startMPcode -% loadfigure "koe.mp" number 1 ; -% refill currentpicture withcolor #2 ; +% loadfigure "koe.mp" number 1 ; +% refill currentpicture withcolor #2 ; % \stopMPcode}} -% -% \definesymbol [comment-normal] +% +% \definesymbol [comment-normal] % [\CowSymbol{4ex}{red}] -% -% \definesymbol [comment-down] +% +% \definesymbol [comment-down] % [\CowSymbol{4ex}{green}] -% +% % \setupcomment % [\c!symbool={comment-normal,comment-down}, % \c!optie=\v!buffer] @@ -2458,7 +2227,7 @@ % jammer, tussen/midden had erin gemoeten; \c!commando toevoegen \def\registermenucommand#1% - {{\textonly\noindent#1\space}} % no math switching + {{\textonly\noindent#1\space}} % no math switching \def\doregistermenubuttons[#1][#2]% [menu id] [register] {\bgroup @@ -2474,10 +2243,10 @@ [\c!onbekendeverwijzing=\v!ja,\c!zelfdepagina=\v!ja] {##1}[#1:##1]}}% \fi - \handletokens abcdefghijklmnopqrstuvwxyz\with\docommando % moet anders + \handletokens abcdefghijklmnopqrstuvwxyz\with\docommando % moet anders \egroup} -\def\registermenubuttons% +\def\registermenubuttons {\dodoubleempty\doregistermenubuttons} \stelkoppelingenin @@ -2560,19 +2329,19 @@ \def\plaatslinkerrandtekstblok % Is \hss/\hsize really needed here? {\hbox to \linkerrandbreedte % (check outer level and settings) - {\hsize\linkerrandbreedte + {\hsize\linkerrandbreedte \hss \interactiemenus[\v!links]}} \def\plaatsrechterrandtekstblok % Is \hss/\hsize really needed here? {\hbox to \rechterrandbreedte % (check outer level and settings) - {\hsize\rechterrandbreedte + {\hsize\rechterrandbreedte \interactiemenus[\v!rechts]% \hss}} \def\plaatsboventekstblok {\vbox to \bovenhoogte - {\vsize\bovenhoogte + {\vsize\bovenhoogte % \getvalue{\??tk\v!boven\v!tekst\c!voor} \getvalue{\??tk\v!boven\c!voor} \interactiemenus[\v!boven] @@ -2582,7 +2351,7 @@ \def\plaatsondertekstblok {\vbox to \onderhoogte - {\vsize\onderhoogte + {\vsize\onderhoogte % \getvalue{\??tk\v!onder\v!tekst\c!voor} \getvalue{\??tk\v!onder\c!voor} \interactiemenus[\v!onder] @@ -2597,8 +2366,8 @@ \appendtoks \plaatsboventekstblok \vskip-\bovenhoogte \to \toptextcontent \appendtoks \plaatsondertekstblok \vskip-\onderhoogte \to \bottomtextcontent -\fi - +\fi + \stelinteractieschermin [\c!breedte=\printpapierbreedte, \c!hoogte=\printpapierhoogte, @@ -2664,7 +2433,8 @@ [\v!reset] \stelcommentaarin - [\c!marge=2.5em, + [\c!status=\v!start, + \c!marge=2.5em, \c!afstand=1em, \c!breedte=.3\tekstbreedte, \c!hoogte=.2\teksthoogte, diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex index 7659dd9c2..2f0185db4 100644 --- a/tex/context/base/core-itm.tex +++ b/tex/context/base/core-itm.tex @@ -90,7 +90,7 @@ \def\dolistreference {\immediatewriteutilitycommand - {\twopassentry% + {\twopassentry {\s!list}% {\currentlist}% {\currentlist:\noflistelements}}} @@ -131,7 +131,7 @@ \def\doitemreference#1,#2,#3\\% {\ifnum\itemlevel>#1 - \ifnum#1>0 \tempsymbol \fi + \ifnum#1>\zerocount \tempsymbol \fi \getvalue{\@@currentitemsymbol{#2}}% \doitemreference#2,#3\\% \fi} @@ -140,7 +140,7 @@ {\expandafter\doitemreference\itemreferences,,\\} \def\packitems - {\ifnum\itemlevel=0 \else \packeditemstrue \fi} + {\ifcase\itemlevel \else \packeditemstrue \fi} \def\dosetupitemgroupvariable[#1]% [#2]% niveau instellingen {\doifelsenothing{#1} @@ -259,7 +259,7 @@ % \fi} \def\setitemlevel#1% - {\ifnum\itemlevel>0\relax + {\ifnum\itemlevel>\zerocount \firstlisttrue \doifnotinset\v!verder{#1} {\doifinset{0}{#1}{\setitemparameter\itemlevel\c!start{0}}% @@ -267,7 +267,7 @@ {\setcounter{\@@itemcounter\itemlevel}{\getitemparameter\itemlevel\c!start}% \minuscounter{\@@itemcounter\itemlevel}% \letitemparameter\itemlevel\c!start\empty}}% - \def\tempnumber% + \def\tempnumber {\countervalue{\@@itemcounter\itemlevel}}% \doifelse{\getitemparameter\itemlevel\c!plaatsafsluiter}\v!ja {\def\tempsymbol{\getitemparameter\itemlevel\c!afsluiter}} @@ -295,7 +295,7 @@ \doifsomething{\getitemparameter\itemlevel\c!linkertekst} {\let\tempsymbol\empty}% \fi - \def\listitem% + \def\listitem {\getitemparameter\itemlevel {\iftextitems\c!linkertekst\else\c!links\fi}% \getvalue{\@@localitemsymbol\itemlevel}\tempsymbol @@ -306,7 +306,7 @@ \def\calculatelistwidth#1#2% {#2=\getitemparameter{#1}\c!afstand\relax - \ifnum\getitemparameter{#1}\c!factor>0 + \ifnum\getitemparameter{#1}\c!factor>\zerocount \ifdim#2=\zeropoint #2=.5em\fi \fi \multiply#2 \getitemparameter{#1}\c!factor @@ -355,31 +355,31 @@ \doglobal\increment(\itemlevel,\itemincrement)% \initializeitemgrouplevel\itemlevel % safeguard \begingroup - \ifnum\itemlevel=1 % NIEUW + \ifnum\itemlevel=\plusone % NIEUW \doadaptleftskip{\getitemparameter1\c!marge}% \fi \dosetraggedcommand{\getitemparameter\itemlevel\c!uitlijnen}\raggedcommand \doifsomething{\getitemparameter\itemlevel\c!inspringen} {\expanded{\stelinspringenin[\getitemparameter\itemlevel\c!inspringen]}}% \doifinset\v!kolommen{#1}% - {\ifbinnenkolommen\else\ifnum\itemcolumndepth=0 - \global\let\itemcolumndepth\itemlevel + {\ifbinnenkolommen\else\ifnum\itemcolumndepth=\zerocount + \globallet\itemcolumndepth\itemlevel \getitemparameter\itemlevel\c!voor \processfirstactioninset [#1] - [ \v!een=>\!!counta=1\relax, - \v!twee=>\!!counta=2\relax, - \v!drie=>\!!counta=3\relax, - \v!vier=>\!!counta=4\relax, - \v!vijf=>\!!counta=5\relax, + [ \v!een=>\!!counta1\relax, + \v!twee=>\!!counta2\relax, + \v!drie=>\!!counta3\relax, + \v!vier=>\!!counta4\relax, + \v!vijf=>\!!counta5\relax, \s!unknown=>\@EA\!!counta\getitemparameter\itemlevel\c!n]% % new \edef\columneditemleftskip{\the\leftskip}% \def\postprocesscolumnbox##1% - {\scratchdimen=\columneditemleftskip + {\scratchdimen\columneditemleftskip \divide\scratchdimen \nofcolumns \hbox{\hskip\columneditemleftskip\hbox{\box##1}}}% - \scratchdimen=-\columneditemleftskip + \scratchdimen-\columneditemleftskip \multiply\scratchdimen \nofcolumns \advance\scratchdimen \columneditemleftskip \advance\scratchdimen \hsize @@ -401,14 +401,14 @@ \subitemfalse \symbolitemfalse \let\marsymbol\relax - \global\let\somdestination\empty + \globallet\somdestination\empty \let\symsymbol\empty \the\itemgroupcommands \setitemlevel{#1}% \getitemparameter\itemlevel\empty \doifelsenothing{#1} % iffirstargument {\edef\@@opsymbool{\getitemparameter\itemlevel\c!symbool}% - \global\letvalue{\@@globalitemsymbol\itemlevel}\empty + \letgvalueempty{\@@globalitemsymbol\itemlevel}% \global\letitemparameter\itemlevel\v!verder\empty \setitemmark\@@opsymbool \dosetupitemgroupvariable[\itemlevel][#2]} @@ -428,7 +428,7 @@ \itemintrotrue \fi\fi \ifparagraphitems - \ifnum\itemlevel>1 + \ifnum\itemlevel>\plusone \letitemparameter\itemlevel\c!tussen\empty \fi \else\ifpackeditems @@ -447,14 +447,14 @@ \else \par \fi - \ifnum\itemcolumndepth=0 \dolistreference \fi % beware ! + \ifnum\itemcolumndepth=\zerocount \dolistreference \fi % beware ! \iffirstlist \else \endgroup \fi % toegevoegd, eerste \som opent groep \ifnum\itemcolumndepth=\itemlevel\relax \stopkolommen \doglobal\newcounter\itemcolumndepth \getitemparameter\itemlevel\c!na \else - \ifnum\itemlevel=1 + \ifnum\itemlevel=\plusone \doitembreak\allowbreak % toegevoegd \getitemparameter1\c!na \doif\@@oospringvolgendein\v!nee\noindentation @@ -502,7 +502,7 @@ \unskip}} \def\itemgroupmargin#1% - {\def\marsymbol% + {\def\marsymbol {\llap {\doitemattributes\itemlevel\c!marletter\c!markleur{#1}% \hskip\leftskip\hskip\linkermargeafstand}}% @@ -533,13 +533,13 @@ \fi \ignorespaces \increment\noflistelements - \ifnum\itemcolumndepth=0 \ifoptimizeitems - \ifnum\noflistelements=1 % tgv bv kolommen/nesting + \ifnum\itemcolumndepth=\zerocount \ifoptimizeitems + \ifnum\noflistelements=\plusone % tgv bv kolommen/nesting \findtwopassdata\s!list{\noflists:}% % wordt soms de volgorde \fi % verstoord, vandaar \find -\iftwopassdatafound - \ifcase0\twopassdata\relax \twopassdatafoundfalse \fi -\fi + \iftwopassdatafound + \ifcase0\twopassdata\relax \twopassdatafoundfalse \fi + \fi \iftwopassdatafound \ifnum\twopassdata=3 \ifnum\noflistelements>1 @@ -573,7 +573,7 @@ \fi\fi}% \doifsomething\somdestination {\setbox8=\hbox{\naar{\box8}[\somdestination]}}% - \global\let\somdestination\empty + \globallet\somdestination\empty \dimen2=\getitemparameter\itemlevel\c!breedte\relax % new, prevents loops when symbol is (not yet found) graphic \ht8=\strutheight @@ -597,9 +597,11 @@ \fi \fi \fi +\forceunexpanded % needed for m conversion (\os) / i need to look into this \setevalue{\@@currentitemsymbol\itemlevel}% {\getvalue{\@@localitemsymbol\itemlevel}}% still problems with \uchar ? %{\noexpand\getvalue{\@@localitemsymbol\itemlevel}}% no, spoils subrefs + \resetunexpanded \headitemfalse \subitemfalse \symbolitemfalse @@ -750,10 +752,10 @@ \setvalue{\e!start#1}{\startitemgroup[#1]}% \setvalue{\e!stop#1}{\stopitemgroup}% \setvalue{\e!stel#1\e!in}{\setupitemgroup[#1]}% -\getparameters[\??ig#1][\c!niveaus=3,#2]% -\ifnum\getvalue{\??ig#1\c!niveaus}<\maxitemlevel\relax - \letvalue{\??ig#1\c!niveaus}\maxitemlevel -\fi + \getparameters[\??ig#1][\c!niveaus=3,#2]% + \ifnum\getvalue{\??ig#1\c!niveaus}<\maxitemlevel\relax + \letvalue{\??ig#1\c!niveaus}\maxitemlevel + \fi \dorecurse{\getvalue{\??ig#1\c!niveaus}}{\initializeitemgrouplevel\recurselevel}% \popmacro\currentitemgroup}} diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex index c986a5e56..9df225d31 100644 --- a/tex/context/base/core-job.tex +++ b/tex/context/base/core-job.tex @@ -35,22 +35,22 @@ \unprotect -\def\currentproject {} -\def\currentproduct {} -\def\currentenvironment {} -\def\currentcomponent {} +\let \currentproject \empty +\let \currentproduct \empty +\let \currentenvironment \empty +\let \currentcomponent \empty -\def\loadedfiles {} -\def\processedfiles {} +\let \loadedfiles \empty +\let \processedfiles \empty -\let\geenfilesmeer=\relax +\let \geenfilesmeer \relax \newcounter\textlevel \newcounter\fileprocesslevel \setvalue{\c!file::0}{\jobname} -\def\processedfile% is used in styles, don't change ! +\def\processedfile % is used in styles, don't change ! {\getvalue{\c!file::\fileprocesslevel}} %\def\processfile#1% @@ -64,7 +64,8 @@ {\doglobal\increment\fileprocesslevel \setxvalue{\c!file::\fileprocesslevel}{#2}% \@EA\doglobal\@EA\addtocommalist\@EA{#2}\processedfiles - #1{#2}{}{}% #1=\readlocfile|\readsetfile{dir} #2=filename + % #1=\readlocfile|\readsetfile{dir} #2=filename + #1{#2}\donothing\donothing \doglobal\decrement\fileprocesslevel} \def\processfile#1% @@ -92,57 +93,68 @@ \def\usepath[#1]% {\def\docommando##1% - {\doifelse{##1}{\v!reset} + {\doifelse{##1}\v!reset {\let\allinputpaths\empty} {\addtocommalist{##1}\allinputpaths}}% \processcommalist[#1]\docommando} +\def\usesubpath[#1]% new, see webschrift for usage + {\ifx\allinputpaths\empty + \edef\allinputpaths{#1}% + \else + \def\docommando##1% + {\def\dodocommando####1{\addtocommalist{##1/####1}\allinputpaths}% + \processcommalist[#1]\dodocommando}% + \processcommacommand[\allinputpaths]\docommando + \fi} + \def\registreerfileinfo[#1#2]#3% geen \showmessage ? - {\writestatus{\m!systems}{#1#2 file #3 at line \the\inputlineno}% + {\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% +% \def\loadsystemfiles % {\reportprotectionstate -% \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}}{}} +% \readsysfile\f!newfilename +% {\showmessage\m!systems2\f!newfilename}\donothing +% \readsysfile\f!oldfilename +% {\showmessage\m!systems2\f!oldfilename}\donothing +% \readsysfile\f!filfilename +% {\showmessage\m!systems2\f!filfilename}\donothing +% \readsysfile\f!sysfilename +% {\showmessage\m!systems2\f!sysfilename}\donothing} % % test \@@svgebied \def\loadallsystemfiles#1% {\ifx\@@svgebied\empty - \readsysfile{#1}{\showmessage{\m!systems}{2}{#1}}{}% + \readsysfile{#1}{\showmessage\m!systems2{#1}}\donothing \else \def\doloadsystemfile##1% - {\readsetfile{##1}{#1}{\showmessage{\m!systems}{2}{#1}}{}}% + {\readsetfile{##1}{#1}{\showmessage\m!systems2{#1}}\donothing}% \processcommacommand[\@@svgebied]\doloadsystemfile \fi} -\def\loadsystemfiles% +\def\loadsystemfiles {\reportprotectionstate - \readsysfile{\f!newfilename} - {\showmessage{\m!systems}{2}{\f!newfilename}}{}% - \readsysfile{\f!oldfilename} - {\showmessage{\m!systems}{2}{\f!oldfilename}}{}% + \readsysfile\f!newfilename + {\showmessage\m!systems2\f!newfilename}\donothing + \readsysfile\f!oldfilename + {\showmessage\m!systems2\f!oldfilename}\donothing \loadallsystemfiles\f!filfilename - \loadallsystemfiles\f!sysfilename} + \loadallsystemfiles\f!sysfilename + }%\loadallsystemfiles\f!modfilename} %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}}{}} + {\readsysfile\f!usrfilename + {\showmessage\m!systems2\f!usrfilename}\donothing + \readjobfile\f!fmtfilename + {\showmessage\m!systems2\f!fmtfilename}\donothing} %D We don't want multiple jobfiles to interfere. @@ -151,11 +163,11 @@ \xdef\texcommentsymbol{%} \egroup -\def\loadoptionfile% +\def\loadoptionfile {\readjobfile{\jobname.\f!optionextension} - {\showmessage{\m!systems}{2}{\jobname.\f!optionextension}}% - %{\showmessage{\m!systems}{2}{\jobname.\f!optionextension}}} - {\writestatus{\m!systems}{no \jobname.\f!optionextension}}} + {\showmessage\m!systems2{\jobname.\f!optionextension}}% + %{\showmessage\m!systems2{\jobname.\f!optionextension}}} + {\writestatus\m!systems {no \jobname.\f!optionextension}}} % \newevery \everyjob \EveryJob % \appendtoks ... \to \everyjob @@ -190,21 +202,32 @@ \prependtoks \loadtwopassdata \to \everystarttext % moved 28-02-2002 \appendtoks \checkreferences \to \everystarttext % new 04-12-1999 -\def\doateverystarttext% +% Most natural ... +% +% \def\doateverystarttext +% {\the\everystarttext +% \global\let\doateverystarttext\relax} +% +% ... most practical, since we can load env's in a +% something.run file (nested \starttext's; see for +% instance x-res-08, where we definitely want to +% open the file!). + +\def\doateverystarttext {\the\everystarttext - \global\let\doateverystarttext\relax} + \global\everystarttext\emptytoks} -\def\starttekst% +\def\starttekst {\doateverystarttext - \ifnum\textlevel=0 - \registreerfileinfo[begin]{\jobname}% - \expandafter\startcopyingblocks + \ifnum\textlevel=\zerocount + \registreerfileinfo[begin]{\jobname}% + \expandafter\startcopyingblocks \fi \doglobal\increment\textlevel\relax} -\def\stoptekst% +\def\stoptekst {\doglobal\decrement\textlevel\relax - \ifnum\textlevel>0 \else + \ifnum\textlevel>\zerocount \else \the\everystoptext %\the\everybye % %\the\everygoodbye % == \end (new) @@ -217,23 +240,23 @@ \let\normalend=\end -\def\end% - {\ifnum\textlevel>0 \else +\def\end + {\ifnum\textlevel>\zerocount \else \the\everybye \the\everygoodbye - \global\everygoodbye\emptytoks % rather unneeded - \global\everybye\emptytoks % but for sure + \global\everybye \emptytoks % rather unneeded + \global\everygoodbye\emptytoks % but for sure \expandafter\normalend \fi} \def\doexecutefileonce#1% {\beforesplitstring#1\at.\to\currentfile - \fullexpandtwoargsafter\doifnotinset{\currentfile}{\loadedfiles}% - {\fullexpandoneargafter\addtocommalist{\currentfile}\loadedfiles + \fullexpandtwoargsafter\doifnotinset\currentfile\loadedfiles + {\fullexpandoneargafter\addtocommalist\currentfile\loadedfiles \doexecutefile{#1}}} \def\doexecutefile#1% - {\registreerfileinfo[begin]{#1} + {\registreerfileinfo[begin]{#1}% \processfile{#1}% \registreerfileinfo[end]{#1}} @@ -269,8 +292,8 @@ \increment\filelevel\relax \fullexpandoneargafter\addtocommalist{#1}\loadedfiles} -\def\doprevlevel% - {\ifnum\filelevel=1 +\def\doprevlevel + {\ifnum\filelevel=\plusone \expandafter\stoptekst \else \decrement\filelevel\relax @@ -282,7 +305,7 @@ \donotexecutefile\doexecutefileonce \doexecutefileonce\doexecutefile#1\\} -\def\stopprojekt% +\def\stopprojekt {\doprevlevel} \def\startprodukt #1 % @@ -291,7 +314,7 @@ \doexecutefileonce\doexecutefileonce \donotexecutefile\doexecutefile#1\\} -\def\stopprodukt% +\def\stopprodukt {\doprevlevel} \def\startonderdeel #1 % @@ -300,7 +323,7 @@ \doexecutefileonce\doexecutefileonce \donotexecutefile\doexecutefile#1\\} -\def\stoponderdeel% +\def\stoponderdeel {\doprevlevel} \def\startomgeving #1 % @@ -308,17 +331,17 @@ \donotexecutefile\doexecutefileonce \donotexecutefile\donotexecutefile#1\\} -\def\stopomgeving% +\def\stopomgeving {\doprevlevel} \def\startdeelomgeving[#1]% {\let\loadedlocalenvironments\empty \def\docommando##1% {\beforesplitstring##1\at.\to\someevironment - \fullexpandoneargafter\addtocommalist{\someevironment}\loadedlocalenvironments}% + \fullexpandoneargafter\addtocommalist\someevironment\loadedlocalenvironments}% \processcommalist[#1]\docommando \fullexpandtwoargsafter\doifcommonelse % no longer next needed - {\currentproject,\currentproduct, + {\currentproject,\currentproduct,% \currentcomponent,\currentenvironment} {\loadedlocalenvironments} {\letvalue{\e!stop\e!deelomgeving}\relax} @@ -342,8 +365,8 @@ \long\def\startsetups#1 #2\stopsetups% for international purposes {\long\setvalue{\??su#1}{#2}} -\def\dodosetups#1% - {\getvalue{\??su#1}} +\def\setups + {\dosingleargument\dosetups} \def\dosetups[#1]% {\iffirstargument @@ -352,8 +375,11 @@ \expandafter\dodosetups \fi} -\def\setups% - {\dosingleargument\dosetups} +\def\dodosetups#1% + {\getvalue{\??su#1}} + +\def\doifsetupselse#1% + {\doifdefinedelse{\??su#1}} % Het <pagina>-karakter (FormFeed), wordt omgezet in \par diff --git a/tex/context/base/core-lst.tex b/tex/context/base/core-lst.tex index d103360d0..24c712337 100644 --- a/tex/context/base/core-lst.tex +++ b/tex/context/base/core-lst.tex @@ -96,7 +96,7 @@ {\begingroup \convertargument#2\to\ascii \makesectionformat - \doifelse{\@@nmstatus}{\v!start} + \doifelse{\@@nmstatus}\v!start {\def\dopaginanummer{\noexpand\pagenumber}} {\def\dopaginanummer{0}}% \edef\schrijfwegnaarlijst% @@ -115,21 +115,29 @@ \def\listbetween#1% {\executeifdefined{#1\c!tussen}\gobblethreearguments} +%\def\@@livariantaa% nr - tit - pag +% {\def\lijstfill{\hskip .5em}% +% \def\lijstskip{0em}% +% \def\lijstwidth{0pt}} + \def\@@livarianta% nr - tit - pag - {\def\lijstfill{\hskip 1.25em}% +% {\def\lijstfill{\hskip 1.75em}% was \hskip.5em\hskip 1.25em + {\def\lijstfill{\hskip .25em}% omdat nu check \def\lijstskip{0em}% \def\lijstwidth{2em}} \def\@@livariantb% nr - tit - fill - pag - {\def\lijstfill{\hfill}% + {\def\lijstfill{\hfill}% was \hskip.5em\hfill \def\lijstskip{5em}% \def\lijstwidth{2em}} \def\@@livariantc% nr - tit - dots - pag - {\def\lijstfill{\leaders\hbox to .5em{\hss.\hss}\hfill\hskip.5em}% + {\def\lijstfill{\hskip.5em\lijstdots\hskip.5em}% \def\lijstskip{5em}% \def\lijstwidth{0pt}} +\def\lijstdots{\leaders\hbox to .5em{\hss.\hss}\hfill} + \def\@@livariant% {\lijstvariantb} @@ -154,7 +162,7 @@ \def\dodoresetlijst#1% {\let\geenlijst\empty \setvalue{#1\c!tussen}{\gobblefourarguments{#1}}% - \setvalue{#1\c!lijst}{\gobblesixarguments{#1}}} + \setvalue{#1\c!lijst }{\gobblesixarguments{#1}}} \let\geenlijst\empty @@ -197,7 +205,6 @@ \c!scheider=\@@koscheider, \c!afsluiter=, \c!expansie=]% -% \ConvertToConstant\doifinstringelse{=}{#2} \doifassignmentelse{#2} {\getparameters[\??li#1][#2]} {\ConvertToConstant\doifnot{#2}{} @@ -216,30 +223,45 @@ \setvalue{\s!reset#1}% {\dodoresetlijst{#1}}} -\def\definieerlijst% +\def\definieerlijst {\dotripleempty\dodefinieerlijst} \def\iflijstgeplaatst{\ifutilitydone} -\def\dobeginoflist% +\def\plaatslijst + {\dodoubleempty\doplaatslijst} + +\def\plaatsruwelijst + {\dodoubleempty\doplaatsruwelijst} + +\def\dobeginoflist {\begingroup \startopelkaar[\v!blanko]} -\def\doendoflist% +\def\doendoflist {\stopopelkaar \endgroup} \def\doplaatslijst[#1][#2]% {\dobeginoflist + \plaatsruwelijst[#1][#2]% + \doendoflist} + +\def\plaatsruwelijst[#1][#2]% + {\begingroup \dogetcommalistelement1\from#1\to\firstlistelement \dostellijstin[#1][#2]% - \doifvalue{\??li\firstlistelement\c!koppeling}{\v!aan} + \doifvalue{\??li\firstlistelement\c!koppeling}\v!aan {\startlistreferences{#1}}% - \dosettoclevel{\getvalue{\??li\firstlistelement\c!criterium}}% - \doutilities{#1}{\jobname}{#1}{}{\par}% + \dosettoclevel\??li\firstlistelement + \honorlocalfilterlevel + \doutilities{#1}\jobname{#1}\relax\par \stoplistreferences{#1}% - \doendoflist - \dosetlistmode} + \dosetlistmode + \endgroup} + +\def\dosettoclevel#1#2% + {\dosetfilterlevel{\getvalue{#1#2\c!criterium}}\empty} \def\dosetlistmode {\iflijstgeplaatst @@ -248,9 +270,6 @@ \resetsystemmode\v!lijst \fi} -\def\plaatslijst - {\dodoubleempty\doplaatslijst} - \def\dodovolledigelijst[#1][#2][#3]% enkelvoud, meervoud, instellingen {\systemsuppliedtitle[#2]{\headtext{#2}} \doplaatslijst[#1][#3]} @@ -277,34 +296,43 @@ \def\dohandlelistnumber#1{\separatednumber{#1}} +% new + +\let\currentlistsymbol\empty + +\def\listsymbol[#1]#2% + {{\dosetlistsymbol{#1}{#2}\currentlistsymbol}} + +% + \def\dosetlistsymbol#1#2% kan sneller, default case afvangen {\processaction [\getvalue{\??li#1\c!symbool}] - [ \v!geen=>\def\listsymbol% + [ \v!geen=>\def\currentlistsymbol% {\doassigndimen{\dimen0}{\getvalue{\??li#1\c!breedte}}{1.5em}% \hbox to \dimen0{}}, - 1=>\def\listsymbol% + 1=>\def\currentlistsymbol% {\strut$\bullet$}, - 2=>\def\listsymbol% + 2=>\def\currentlistsymbol% {\vrule\!!width1em\!!height1ex\!!depth\zeropoint}, - 3=>\def\listsymbol% very slow + 3=>\def\currentlistsymbol% very slow {{\doassigndimen{\dimen0}{\getvalue{\??li#1\c!breedte}}{1.5em}% \doassigndimen{\dimen2}{\getvalue{\??li#1\c!hoogte}}{1ex}% \doassigndimen{\dimen4}{\getvalue{\??li#1\c!diepte}}{0pt}% \vrule\!!width\dimen0\!!height\dimen2\!!depth\dimen4}}, - \s!unknown=>\def\listsymbol{\getvalue{\??li#1\c!symbool}}, - \s!default=>\doifelsevalue{\??li#1\c!prefix}{\v!nee} % ook nog eerste + \s!unknown=>\def\currentlistsymbol{\getvalue{\??li#1\c!symbool}}, + \s!default=>\doifelsevalue{\??li#1\c!prefix}\v!nee % ook nog eerste {\edef\splitlistsymbol{\removefirstprefix{#2}}} - {\doifelsevalue{\??li#1\c!prefix}{\v!geen} + {\doifelsevalue{\??li#1\c!prefix}\v!geen {\edef\splitlistsymbol{\removeallprefixes{#2}}}% {\def\splitlistsymbol{#2}}}% geen \edef ivm enz - \def\listsymbol% kan iets efficienter met \ifdone - {\doifvalue{\??li#1\c!label}{\v!ja}{\leftlabeltext{#1}}% + \def\currentlistsymbol% kan iets efficienter met \ifdone + {\doifvalue{\??li#1\c!label}\v!ja{\leftlabeltext{#1}}% \strut \def\numberseparator{\getvalue{\??li#1\c!scheider}}% \@EA\dohandlelistnumber\@EA{\splitlistsymbol}% \getvalue{\??li#1\c!afsluiter}% - \doifvalue{\??li#1\c!label}{\v!ja}{\rightlabeltext{#1}}}]} + \doifvalue{\??li#1\c!label}\v!ja{\rightlabeltext{#1}}}]} \def\@@dodolijstelement{dodolijstelement} @@ -349,9 +377,9 @@ %\showcomposition \let\@@iabreedte\!!zeropoint % moet boolean worden \bgroup - \edef\lijstelementen% + \edef\lijstelementen {\getvalue{\??li#1\c!paginaovergangen}}% - \ExpandBothAfter\doifinset{#3}{\lijstelementen}% + \ExpandBothAfter\doifinset{#3}\lijstelementen {\showmessage{\m!systems}{14}{#3}% \pagina}% \egroup @@ -363,14 +391,13 @@ \def\dolistattributes#1#2#3% {\doifvaluesomething{\??li#1#3} - %{\setupinteraction[\c!kleur=,\c!contrastkleur=]}% {\resetinteractionparameter\c!kleur \resetinteractionparameter\c!contrastkleur}% \doattributes{\??li#1}{#2}{#3}} \def\dodocommandlijstelement#1#2#3#4#5#6% {\doifdefinedelse{\??li#1\c!commando} - {\getvalue{\??li#1\c!commando} + {\getvalue{\??li#1\c!commando}% {#3}{#4}{\paginaprefix\??li#1[#5]\translatednumber[#5]}} {[#1: #3 - #4 - \paginaprefix\??li#1[#5]\translatednumber[#5]]}} @@ -379,7 +406,7 @@ {\noindent % new and needed \hbox {\doifelsevalue{\??li#1\c!interactie}{##1} % \??li ipv \??ia - {\setbox0=\hbox{\showcontrastlocation{\??li#1}{#6}{##2}}% + {\setbox0\hbox{\showcontrastlocation{\??li#1}{#6}{##2}}% \linklisttoelement{#1}{#2}{#5}{#6}{\box0}}%{\copy0}}% {##2}}}% \getvalue{\??li#1\c!voor}% can be \hskip @@ -396,13 +423,13 @@ \makelijstelement\v!alles {\makelijstelement\v!sectienummer {\dolistattributes{#1}\c!nummerletter\c!nummerkleur - {\getvalue{\??li#1\c!nummercommando}{\listsymbol}}}% + {\getvalue{\??li#1\c!nummercommando}{\currentlistsymbol}}}% \makelijstelement\v!tekst {\dolistattributes{#1}\c!tekstletter\c!tekstkleur {\let\\=\newlineinlist \dontconvertfont \getvalue{\??li#1\c!tekstcommando}{#4}}}% - \doifvalue{\??li#1\c!paginanummer}{\v!ja} + \doifvalue{\??li#1\c!paginanummer}\v!ja {\doifsomething{#5} {\makelijstelement\v!paginanummer {\dolistattributes{#1}\c!paginaletter\c!paginakleur @@ -428,10 +455,10 @@ \leftskip\getvalue{\??li#1\c!marge}% na de \endgraf ! \getvalue{\??li#1\c!voor}% \!!widthc\getvalue{\??li#1\c!afstand}% - \doifelsevalue{\??li#1\c!breedte}{\v!passend} + \doifelsevalue{\??li#1\c!breedte}\v!passend {\!!widtha\zeropoint} {\doifelsenothing{#3} - {\doifelsevalue{\??li#1\c!titeluitlijnen}{\v!ja} + {\doifelsevalue{\??li#1\c!titeluitlijnen}\v!ja {\!!widtha\zeropoint \!!widthc\zeropoint} {\!!widtha\getvalue{\??li#1\c!breedte}}} @@ -440,22 +467,22 @@ \endgraf \def\makelijstelement##1##2% {\doifelsevalue{\??li#1\c!interactie}{##1} - {\setbox0=\hbox{\showcontrastlocation{\??ia}{#6}{##2}}% + {\setbox0\hbox{\showcontrastlocation\??ia{#6}{##2}}% \linklisttoelement{#1}{#2}{#5}{#6}{\box0}}%{\copy0}}% {\hbox{##2}}}% - \doifvalue{\??li#1\c!interactie}{\v!tekst} % not supported + \doifvalue{\??li#1\c!interactie}\v!tekst % not supported {\setlistparameter{#1}\c!interactie\v!alles}% \makelijstelement\v!alles {\hbox to \hsize - {\dostartattributes{\??li#1}\c!letter\c!kleur{}% new + {\dostartattributes{\??li#1}\c!letter\c!kleur\empty \!!widthb\hsize - \setbox2=\hbox \ifdim\!!widtha>\zeropoint to \!!widtha \fi + \setbox2\hbox \ifdim\!!widtha>\zeropoint to \!!widtha \fi {\makelijstelement\v!sectienummer {\dolistattributes{#1}\c!nummerletter\c!nummerkleur - {\getvalue{\??li#1\c!nummercommando}{\listsymbol}}% + {\getvalue{\??li#1\c!nummercommando}{\currentlistsymbol}}% \hfill}}% - \setbox4=\hbox - {\doifvalue{\??li#1\c!paginanummer}{\v!ja} + \setbox4\hbox + {\doifvalue{\??li#1\c!paginanummer}\v!ja {\doifsomething{#5} % \lijstwidth is new ; temp hack {\hbox \ifdim\lijstwidth>\zeropoint to \lijstwidth\fi {\hfill @@ -466,13 +493,13 @@ \translatednumber[#5]}}}}}}}% \vbox {\hsize\!!widthb -\expanded{\steluitlijnenin[\getvalue{\??li#1\c!uitlijnen}]}% + \expanded{\steluitlijnenin[\getvalue{\??li#1\c!uitlijnen}]}% \ifdim\!!widtha<\hsize \hangindent=\wd2 \dimen2=\!!widthc % \getvalue{\??li#1\c!afstand}% - \advance\hangindent by \dimen2 + \advance\hangindent \dimen2 \hangafter=1 -\doifvalue{\??li#1\c!hang}{\v!nee}{\hangafter=0 }% + \doifvalue{\??li#1\c!hang}\v!nee{\hangafter\zerocount}% \ifdim\wd4=\zeropoint % \ifvoid4 % we kunnen gewoon afbreken aan het eind \else @@ -482,7 +509,7 @@ \fi \fi \else - \dimen2=\zeropoint + \dimen2\zeropoint \fi \parindent\zeropoint\relax \leavevmode @@ -498,7 +525,7 @@ \ifdim\wd4=\zeropoint\relax % \ifvoid4 % \ifdim\!!widtha<\hsize \hfill\strut \fi % spoils align \else - \nobreak\hskip.5em\lijstfill + \nobreak\lijstfill \box4\relax \relax \fi}% @@ -521,35 +548,35 @@ \ifvmode \noindent\leavevmode % leavevmode ? ? ? \fi - \doifvalue{\??li#1\c!interactie}{\v!tekst} % not supported + \doifvalue{\??li#1\c!interactie}\v!tekst % not supported {\setlistparameter{#1}\c!interactie\v!sectienummer}% - \doifvalue{\??li#1\c!interactie}{\v!alles} % not supported + \doifvalue{\??li#1\c!interactie}\v!alles % not supported {\setlistparameter{#1}\c!interactie\v!sectienummer}% \def\makelijstelement##1##2% {\doifelsevalue{\??li#1\c!interactie}{##1} - {\setbox0=\hbox{\showcontrastlocation{\??ia}{#6}{##2}}% + {\setbox0\hbox{\showcontrastlocation\??ia{#6}{##2}}% \linklisttoelement{#1}{#2}{#5}{#6}{\box0}}%{\copy0}}% {\hbox{##2}}}% \setbox4=\hbox - {\doifvalue{\??li#1\c!paginanummer}{\v!ja} + {\doifvalue{\??li#1\c!paginanummer}\v!ja {\doifsomething{#5} {\makelijstelement\v!paginanummer {\dolistattributes{#1}\c!paginaletter\c!paginakleur {\getvalue{\??li#1\c!paginacommando} {\paginaprefix\??li#1[#5]% \translatednumber[#5]}}}}}}% -\donetrue -\doifnothing{#3}{\doifvaluenothing{\??li#1\c!symbool}{\donefalse}}% -\ifdone - \hbox - {\getvalue{\??li#1\c!links}% - \makelijstelement\v!sectienummer - {\dolistattributes{#1}\c!nummerletter\c!nummerkleur - {\getvalue{\??li#1\c!nummercommando}{\listsymbol}}}% - \getvalue{\??li#1\c!rechts}% - \hskip.5em}% - \nobreak -\fi + \donetrue + \doifnothing{#3}{\doifvaluenothing{\??li#1\c!symbool}\donefalse}% + \ifdone + \hbox + {\getvalue{\??li#1\c!links}% + \makelijstelement\v!sectienummer + {\dolistattributes{#1}\c!nummerletter\c!nummerkleur + {\getvalue{\??li#1\c!nummercommando}{\currentlistsymbol}}}% + \getvalue{\??li#1\c!rechts}% + \hskip.5em}% + \nobreak + \fi \tolerance3500 % niet zomaar veranderen \dolistattributes{#1}\c!tekstletter\c!tekstkleur {\let\\=\newlineinlist @@ -592,9 +619,9 @@ \hbox {#1% in case E nils the strut \let\\=\newlineinlist - \setbox0=\hbox - {#2{\showcontrastlocation{\??ia}{#8} - {\dostartattributes{\??li#3}\c!letter\c!kleur{}% + \setbox0\hbox + {#2{\showcontrastlocation\??ia{#8}% + {\dostartattributes{\??li#3}\c!letter\c!kleur\empty \ignorespaces\dontconvertfont\setstrut \begstrut \doifelsenothing{\??li#3\c!maxbreedte} @@ -659,9 +686,8 @@ \let\dolijstelement\dolijstelementX \dostellijstin[#1][#2]% \dogetcommalistelement1\from#1\to\commalistelement - \dosettoclevel{\getvalue{\??li\commalistelement\c!criterium}}% - \setbox0=\vbox - {\doutilities{#1}{\jobname}{#1}{}{\par}}% + \dosettoclevel\??li\commalistelement + \setbox0\vbox{\doutilities{#1}\jobname{#1}\relax\par}% \xdef\utilitylistheight{\the\ht0}% \xdef\utilitylistwidth {\the\wd0}% \endgroup @@ -735,18 +761,18 @@ % \let\doschrijfnaarreferentielijst=\gobblethreearguments \stelreferentielijstin[#1][#2,\c!status=\v!stop]% \dogetcommalistelement1\from#1\to\commalistelement - \dosettoclevel{\getvalue{\??rl\commalistelement\c!criterium}}% - \doutilities{#1}{\jobname}{#1}{}{\par}% + \dosettoclevel\??rl\commalistelement + \doutilities{#1}\jobname{#1}\relax\par \endgroup} \def\plaatsreferentielijst% {\dodoubleempty\doplaatsreferentielijst} \def\doschrijfnaarreferentielijst#1#2#3% - {\doifvalue{\??rl#1\c!status}{\v!start} + {\doifvalue{\??rl#1\c!status}\v!start {\begingroup \makesectionformat - \doifelse{\@@nmstatus}{\v!start} + \doifelse{\@@nmstatus}\v!start {\def\dopaginanummer{\noexpand\pagenumber}} {\def\dopaginanummer{0}}% \edef\schrijfwegnaarlijst% @@ -772,7 +798,7 @@ \def\schrijfnaarreferentielijst[#1]#2% #1=class #2=data #3=visualization {\dowithnextbox - {\doifelsevalue{\??rl#1\c!status}{\v!start} + {\doifelsevalue{\??rl#1\c!status}\v!start {\doglobal\increment\referencecounter % must be resolved due to #2 \referentiebutton {\box\nextbox @@ -822,48 +848,21 @@ \def\stelsamengesteldelijstin% {\dodoubleargument\dostelsamengesteldelijstin} -% \def\doplaatssamengesteldelijst[#1][#2]% -% {\begingroup -% \getparameters[\??ih#1][#2]% -% \dosettoclevel{\getvalue{\??ih#1\c!criterium}}% -% \edef\samengesteldelijst{\getvalue{\??ih#1\c!lijst}}% om voorlopig nog -% \stripspaces\from\samengesteldelijst\to\samengesteldelijst % compatible te -% \ExpandFirstAfter\doifnumberelse{\getvalue{\??ih#1\c!niveau}}% blijven -% {\!!counta=\getvalue{\??ih#1\c!niveau}% met de vorige implementatie -% \advance\!!counta by 1\relax% accepteren we ook nummers (0==deel) -% \getfromcommacommand[\samengesteldelijst][\!!counta]% -% \edef\maximumlijst{\commalistelement}}% -% {\edef\maximumlijst{\getvalue{\??ih#1\c!niveau}}}% -% \!!counta=\getvalue{\??se\getvalue{\??ko\maximumlijst \c!sectie}\c!niveau}% -% \let\!!stringa=\samengesteldelijst -% \let\samengesteldelijst=\empty -% \def\docommando##1% -% {\ifnum\getvalue{\??se\getvalue{\??ko##1\c!sectie}\c!niveau}>\!!counta -% \else -% \addtocommalist{##1}\samengesteldelijst -% \fi}% -% \processcommacommand[\!!stringa]\docommando -% \doifvalue{\??ih#1\c!koppeling}{\v!aan} -% {\startlistreferences{#1}}% -% \ExpandFirstAfter\dodoplaatssamengesteldelijst[\samengesteldelijst][#2]% -% \stoplistreferences{#1}% -% \endgroup} - \def\doplaatssamengesteldelijst[#1][#2]% {\begingroup \getparameters[\??ih#1][#2]% - \dosettoclevel{\getvalue{\??ih#1\c!criterium}}% + \dosettoclevel\??ih{#1}% \edef\samengesteldelijst{\getvalue{\??ih#1\c!lijst}}% %\stripspaces\from\samengesteldelijst\to\samengesteldelijst - \doifelsevalue{\??ih#1\c!niveau}{\v!huidige} % criterium=vorige,niveau=huidige + \doifelsevalue{\??ih#1\c!niveau}\v!huidige % criterium=vorige,niveau=huidige {\!!counta=0\@@koniveau} % hm: \@@koniveau {\fullexpandoneargafter\doifnumberelse{\getvalue{\??ih#1\c!niveau}}% in verband - {\!!counta=\getvalue{\??ih#1\c!niveau}% met de vorige implementatie - \advance\!!counta by 1 % accepteren we ook nummers (0==deel) + {\!!counta\getvalue{\??ih#1\c!niveau}% met de vorige implementatie + \advance\!!counta \plusone % accepteren we ook nummers (0==deel) \getfromcommacommand[\samengesteldelijst][\!!counta]% \edef\maximumlijst{\commalistelement}}% {\edef\maximumlijst{\getvalue{\??ih#1\c!niveau}}}% - \!!counta=\getvalue{\??se\getvalue{\??ko\maximumlijst\c!sectie}\c!niveau}}% + \!!counta\getvalue{\??se\getvalue{\??ko\maximumlijst\c!sectie}\c!niveau}}% \let\!!stringa\samengesteldelijst \let\samengesteldelijst\empty \def\docommando##1% @@ -872,7 +871,7 @@ \addtocommalist{##1}\samengesteldelijst \fi}% \processcommacommand[\!!stringa]\docommando - \doifvalue{\??ih#1\c!koppeling}{\v!aan} + \doifvalue{\??ih#1\c!koppeling}\v!aan {\startlistreferences{#1}}% \ExpandFirstAfter\dodoplaatssamengesteldelijst[\samengesteldelijst][#2]% \stoplistreferences{#1}% @@ -882,7 +881,7 @@ \def\dodoplaatssamengesteldelijst[#1][#2]% {\dobeginoflist \dostellijstin[#1][#2]% - \doutilities{#1}{\jobname}{#1}{}{\par}% + \doutilities{#1}\jobname{#1}\relax\par \doendoflist} \def\dovolledigesamengesteldelijst[#1][#2]% @@ -945,16 +944,16 @@ \def\showremaininglistlength% {\bgroup - \ifnum\listlengthcounter>1 - \scratchdimen=\pagetotal - \setbox\scratchbox=\vbox + \ifnum\listlengthcounter>\plusone + \scratchdimen\pagetotal + \setbox\scratchbox\vbox {\@@llvoor\par\hbox{\strut}\par\hbox{\strut}\par\@@llna} - \advance\scratchdimen by \ht\scratchbox - \advance\scratchdimen by \dp\scratchbox + \advance\scratchdimen \ht\scratchbox + \advance\scratchdimen \dp\scratchbox \ifdim\scratchdimen>\pagegoal \@@llvoor \nobreak\hbox to \hsize - {\doifnot{\@@llnummer}{\v!ja}{\let\listlengthcounter\empty}% + {\doifnot\@@llnummer\v!ja{\let\listlengthcounter\empty}% \doattributes\??ll\c!letter\c!kleur{\@@lllinks\listlengthcounter\@@llrechts}} \@@llna \fi @@ -964,5 +963,5 @@ \stelreferentielijstin [\c!letter=\v!normaal] - + \protect \endinput diff --git a/tex/context/base/core-ltb.tex b/tex/context/base/core-ltb.tex new file mode 100644 index 000000000..03d314a7e --- /dev/null +++ b/tex/context/base/core-ltb.tex @@ -0,0 +1,742 @@ +%D \module +%D [ file=core-ltb, +%D version=2002.10.31, +%D title=\CONTEXT\ Core Macros, +%D subtitle=Line Tables, +%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. + +\beginTEX + \expandafter \endinput +\endTEX + +% Experimental, undocumented, and currently only ETeX. + +% \BH \BC .. \EC \BC .. \EC \EH % append +% \BR \BC .. \EC \BC .. \EC \ER +% +% or +% +% \NC .. \NC .. \NC \NR (todo: optional last \NC) + +% alternative: +% +% (1) direct run, save content in macro, but only if needed +% +% todo +% +% (2) buffered table content +% +% \startbuffer +% \startlinetablehead +% \stoplinetablehead +% \startlinetablebody +% \stoplinetablebody +% \stopbuffer +% +% \processlinetablebuffer[buffer] +% +% in buffer : head and body +% +% (3) unbuffered run, multipass +% +% - run with starting width zero / prev run +% - clip on prev run +% - flush real widths + +\writestatus{loading}{Context Core Macros / Line Tables} + +\unprotect + +\chardef\linetablesplitstatus\zerocount +\chardef\linetableheadstatus \zerocount + +\edef\??ler{\??le:r:} +\edef\??lec{\??le:c:} +\edef\??lew{\??le:w:} + +\newif\iflinetablepreroll +\newif\ifinlinetable + +\newcount\linetablecolumn +\newcount\linetablesubcol +\newdimen\linetablewidth +\newdimen\linetableheight +\newbox \linetablecell + +\let\noflinetablecolumns\!!zerocount +\let\noflinetablerows \!!zerocount +\let\noflinetablelines \!!zerocount +\let\noflinetableparts \!!zerocount +\let\linetablepart \!!plusone +\let\linetablestep \!!plusone +\let\linetableline \!!zerocount +\let\linetablerow \!!zerocount +\let\linetablerows \!!zerocount + +\initializetablebox \zerocount % holds repeater + +\chardef\linetablehmode \zerocount +\chardef\linetablepage \zerocount +\chardef\linetablerepeat\zerocount + +\def\setuplinetable + {\dotripleempty\dosetuplinetable} + +\def\dosetuplinetable[#1][#2][#3]% + {\ifthirdargument + \getparameters[\??le:#1:#2][#3]% + \else\ifsecondargument + \getparameters[\??lec#1][#2]% + \else + \getparameters[\??le][#1]% + \fi\fi} + +\setuplinetable + [\c!n=\!!maxcard, + \c!regels=\!!maxcard, + \c!nx=\plusone, + \c!nlinks=0, + \c!herhaal=\v!ja, % when \c!nlinks>0, repeat on both pages + \c!voor=, + \c!na=, + \c!tussen=\pagina, + \c!afstand=\zeropoint, + \c!rek=\v!nee, + \c!uitlijnen=\c!rechts, + \c!linkeroffset=.25ex, + \c!rechteroffset=\linetableparameter\c!linkeroffset, + \c!maxbreedte=\zeropoint, + \c!breedte=5em, + \c!hoogte=\v!passend, % \v!regel = faster + \c!achtergrond=, + \c!achtergrondkleur=] + +\def\linetableparameter#1% + {\csname\??le#1\endcsname} + +\def\doifelselinetablecparameter#1% + {\ifcsname\??lec\number\linetablecolumn#1\endcsname + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +\def\linetablecparameter#1% + {\csname + \ifcsname\??lec\number\linetablecolumn#1\endcsname + \??lec\number\linetablecolumn + \else + \??le + \fi + #1\endcsname} + +\def\linetablerparameter#1% faster, leaner and meaner + {\csname + \ifnum\linetablerow=\zerocount % geen ifcase + \ifcsname\??ler\v!hoofd#1\endcsname + \??ler\v!hoofd#1% + \else\ifcsname\??ler0#1\endcsname + \??ler0#1% + \else + \s!empty + \fi\fi + \else + \ifcsname\??ler\number\linetablerow#1\endcsname + \??ler\number\linetablerow#1% + \else\ifcsname\??ler\v!oddeven\linetablerow#1\endcsname + \??ler\v!oddeven\linetablerow#1% + \else + \s!empty + \fi\fi + \fi + \endcsname} + +\def\setnoftableslines + {\doifelse{\linetableparameter\c!regels}\v!passend + {% nearly the same as core-tab, so same bugs + \ifdim\pagegoal<\maxdimen + \scratchdimen\pagegoal + \advance\scratchdimen -\pagetotal + \else + \scratchdimen\teksthoogte + \fi + \advance\scratchdimen -\dp\strutbox + \ifdim\prevdepth<\maxdimen\ifdim\prevdepth>\zeropoint + \global\advance\scratchdimen -\dp\strutbox + \global\advance\scratchdimen -\parskip + \fi\fi + \getrawnoflines\scratchdimen + \xdef\noflinetablelines{\the\noflines}} + {\xdef\noflinetablelines{\linetableparameter\c!regels}}} + +\def\startlinetablecell + {\dosingleempty\dostartlinetablecell} + +\def\dostartlinetablecell[#1]% + {\global\setbox\linetablecell\hbox\bgroup + \iffirstargument + \getparameters[\??lec\number\linetablecolumn][#1]% + \fi + \xdef\linetablestep{\linetablecparameter\c!nx}% + \ifcase\linetablestep\or + \scratchdimen\linetablecparameter\c!breedte + \else + \scratchdimen\zeropoint + \scratchcounter\linetablecolumn + \dorecurse\linetablestep + {\advance\scratchdimen\linetablecparameter\c!breedte + \global\advance\linetablecolumn\plusone}% + \global\linetablecolumn\scratchcounter + \fi + \chardef\linetablemode + \iflinetablepreroll + \ifdim\scratchdimen>\zeropoint \zerocount \else \plustwo \fi + \else + \zerocount + \fi + \ifcase\linetablemode + \ifcase\linetablehmode + % nothing + \or + % fit, keep it simple + \or + \chardef\linetablemode\plusone % line + \else + % some already calculated height + \fi + \fi + \setbox\scratchbox\hbox + \bgroup + \dontcomplain + \hskip\linetablecparameter\c!linkeroffset\relax + % 0 = width, unknown height + % 1 = width, fixed height + % 2 = no width, auto hsize + \ifnum\linetablemode<\plustwo + \advance\scratchdimen-\linetablecparameter\c!linkeroffset + \advance\scratchdimen-\linetablecparameter\c!rechteroffset + \fi + \ifcase\linetablemode + \dosetraggedcommand{\linetablecparameter\c!uitlijnen}% + \vtop \ifdim\linetableheight>\zeropoint to\linetableheight \fi \bgroup + \hsize\scratchdimen + \raggedcommand + \else + \setalignmentswitch{\linetablecparameter\c!uitlijnen}% + \hbox \ifcase\linetablemode \or to\scratchdimen \fi \bgroup + \ifcase\alignmentswitch\hss\or\hss\fi + \fi + \dostartattributes{\??lec\number\linetablecolumn}\c!letter\c!kleur\empty + \begstrut \ignorespaces} + +\def\stoplinetablecell + {\unskip \endstrut + \dostopattributes + \ifcase\linetablemode + \endgraf + \else + \ifcase\alignmentswitch\else\hss\fi + \fi + \egroup + \hskip\linetablecparameter\c!rechteroffset + \egroup + \iflinetablepreroll + \box\scratchbox + \else + \doif{\linetablecparameter\c!achtergrond}\v!kleur + {\backgroundline[\linetablecparameter\c!achtergrondkleur]}% + {\box\scratchbox}% + \fi + \egroup} + +\def\savelinetablepart + {\global\setbox\tablebox\linetablepart + \ifnum\linetablepart=\zerocount + \box\scratchbox % just storing + \else + \vbox + {\ifvoid\tablebox\linetablepart\else\unvbox\tablebox\linetablepart\fi + \doif{\linetablerparameter\c!achtergrond}\v!kleur + {\backgroundline[\linetablerparameter\c!achtergrondkleur]}% + {\box\scratchbox}% is also arg to \backgroundline + \endgraf + \linetablerparameter\c!na}% + \fi} + +\def\flushlinetableparts + {\doglobal\increment\linetableline + \ifnum\linetableline<\noflinetablelines + % keep collecting + \else + \iflinetablepreroll + % forget about them + \else + \doifelse{\linetableparameter\c!regels}\v!passend + {\scratchdimen\pagetotal} + {\scratchdimen\zeropoint}% + \dorecurse\noflinetableparts + {\let\linetablepart\recurselevel + \ifdim\scratchdimen>\zeropoint + \ifnum\recurselevel>\plusone + \setbox\scratchbox\vbox to \scratchdimen{\vss}% + \dp\scratchbox\strutdepth + \wd\scratchbox\hsize + \box\scratchbox + \else + \obeydepth + \fi + \fi + \dp\tablebox\linetablepart\strutdepth + \hbox to \hsize{\box\tablebox\linetablepart\hss}% + \ifnum\linetablepart<\noflinetableparts\relax + \linetableparameter\c!tussen + \fi}% + \ifnum\linetablerows<\noflinetablerows\relax + \linetableparameter\c!tussen + \else + % after, later + \fi + \chardef\linetableheadstatus\plusthree + \global\setbox\tablebox\zerocount\emptybox % here + \fi + % reset \linetablerow will be an option, currently + % starts at zero after split + \globallet\linetablerow\!!zerocount + \globallet\linetableline\!!zerocount + \global\chardef\linetablepage\zerocount + \global\linetablewidth\zeropoint + \setnoftableslines + \fi} + +\def\startlinetablepart + {\global\linetablesubcol\zerocount + \setbox\scratchbox\hbox\bgroup\ignorespaces} + +\def\stoplinetablepart + {\ifnum\linetablepart>\zerocount + \unskip \unskip % remove last intercolumn skip (distance+fill) + \fi + \egroup + \iflinetablepreroll \else + \ifcase\linetablepart + % we're collecting the repeater + \else + \scratchdimen\hsize \advance\scratchdimen-\wd\scratchbox + \ifdim\scratchdimen>\linetableparameter\c!rek\else + \setbox\scratchbox\hbox to \hsize{\unhbox\scratchbox}% + \fi + \fi + \fi} + +\def\checklinetablepart + {\global\advance\linetablewidth\wd\linetablecell + \global\advance\linetablecolumn\linetablestep + \global\advance\linetablesubcol\linetablestep + \relax + %\message{\the\linetablecolumn,\the\linetablesubcol}\wait + % from now on the column counter is already incremented + \ifcase\linetablesplitstatus + \iflinetablepreroll \else + \box\linetablecell + % the columncounter is one ahead ! + \hskip\linetablecparameter\c!afstand + \fi +%%% + \donefalse + \ifcase\linetablerepeat\else + % van te voren berekenen + \scratchcounter\linetablecolumn\advance\scratchcounter-2 + \ifnum\linetablerepeat=\scratchcounter + \donetrue % collecting repeater + \fi + \fi +%%%% + \ifdone + % collecting repeater + \else + \ifnum\linetablecolumn>\getvalue{\??le::\linetablepart}\relax + \donetrue + \fi + \fi + \ifdone + \stoplinetablepart + \iflinetablepreroll \else + \savelinetablepart + \fi + \ifcase\linetablepage \or + \global\chardef\linetablepage \plustwo + \else + \global\chardef\linetablepage \plusone + \fi + \doglobal\increment\linetablepart + \global\linetablewidth\wd\tablebox\zerocount + \startlinetablepart + \fi + \else + \donefalse +\!!doneafalse + \ifcase\linetablerepeat\else + % van te voren berekenen + \scratchcounter\linetablecolumn \advance\scratchcounter-2 + \ifnum\linetablerepeat=\scratchcounter + \donetrue % collecting repeater + \fi + \fi + \ifdone +\!!doneatrue + % collecting repeater + \else\ifdim\linetablewidth>\hsize + \donetrue + \else + \global\advance\linetablewidth\linetablecparameter\c!afstand\relax + \ifdim\linetablewidth>\hsize % ? + \donetrue + \fi + \fi\fi + \ifdone + \stoplinetablepart + \savelinetablepart + \ifcase\linetablepage \or + \global\chardef\linetablepage \plustwo + \else + \global\chardef\linetablepage \plusone + \fi + \doglobal\increment\linetablepart + \ifnum\linetablepart>\noflinetableparts + \globallet\noflinetableparts\linetablepart + \initializetablebox\linetablepart + \fi + \global\linetablewidth\wd\linetablecell + \startlinetablepart + \if!!doneb \else \ifcase\linetablerepeat \else + % check for left/right page + \ifcase\linetablepage\donetrue\or\donetrue\or\donefalse\fi\ifdone + % insert repeater + \global\advance\linetablewidth\wd\tablebox\zerocount + \iflinetablepreroll\kern\wd\else\unhcopy\fi\tablebox\zerocount + \fi + \fi \fi + \fi + \iflinetablepreroll \else + \box\linetablecell + % the columncounter is one ahead ! + \hskip\linetablecparameter\c!afstand + \hfill + \fi + \fi} + +% \linetableparameter\c!var -> \@@levar (when no classes) + +\def\startlinetablerun % to do: quit when nested + {\bgroup + \inlinetabletrue + % autowidth + \doif{\linetableparameter\c!maxbreedte}\v!passend + {\setuplinetable[\c!maxbreedte=\zeropoint]}% + \processaction + [\linetableparameter\c!rek] + [\v!nee=>{\setuplinetable[\c!rek=\maxdimen]}% no stretch + \v!ja=>{\setuplinetable[\c!rek=\zerocount]}]% max stretch + \chardef\linetablerepeat\linetableparameter\c!nlinks + \chardef\linetablesplitstatus % = + \ifdim\linetableparameter\c!maxbreedte>\zeropoint + \zerocount \else \plusone + \fi + % optional prevdepth correction + \iflinetablepreroll + \globallet\noflinetablerows\!!zerocount + \else + \linetableparameter\c!voor + \fi + \globallet\linetablerows\!!zerocount + \globallet\noflinetablecolumns\!!zerocount + \globallet\noflinetableparts\!!zerocount + \!!counta\zerocount + \def\docommando##1% + {\doglobal\increment\noflinetableparts + \advance\!!counta##1% + \setxvalue{\??le::\noflinetableparts}{\the\!!counta}}% + \processcommacommand[\linetableparameter\c!n]\docommando + \initializetableboxes\noflinetableparts + \ifcase\linetablerepeat + \globallet\linetablepart\!!plusone + \else + \globallet\linetablepart\!!zerocount % repeater + \fi + \globallet\linetablestep\!!plusone + \globallet\linetableline\!!zerocount + \globallet\linetablerow \!!zerocount + \global\linetablecolumn \zerocount + \global\linetablesubcol \zerocount + \global\linetablewidth \zeropoint + \setnoftableslines + \checklinetablepage + \let\BR\linetableBR + \let\ER\linetableER + \let\BH\linetableBR + \let\EH\linetableER + \let\BC\linetableBC + \let\EC\linetableEC + \let\NC\linetableNC + \let\NR\linetableNR + \flushlinetablehead} + +\def\stoplinetablerun + {\globallet\linetableline\!!maxcard + \chardef\linetableheadstatus\zerocount % blocked + \flushlinetableparts + \iflinetablepreroll \else + \linetableparameter\c!na + \fi + \globallet\linetablepart \!!zerocount + \globallet\noflinetableparts\!!zerocount + \egroup} + +\def\checklinecolumnwidth + {\ifundefined{\??lew\number\linetablecolumn}% + \donetrue + \else\ifdim\getvalue{\??lew\number\linetablecolumn}<\wd\linetablecell + \donetrue + \else + \donefalse + \fi\fi + \ifdone + \setxvalue{\??lew\number\linetablecolumn}{\the\wd\linetablecell}% + \fi} + +\def\checklinecolumnwidth + {\ifcsname\??lew\number\linetablecolumn\endcsname + \ifdim\csname\??lew\number\linetablecolumn\endcsname<\wd\linetablecell + \donetrue + \else + \donefalse + \fi + \else + \donetrue + \fi + \ifdone + \setxvalue{\??lew\number\linetablecolumn}{\the\wd\linetablecell}% + \fi} + +\def\checklinecolumnwidth + {\expandafter\xdef\csname\??lew\number\linetablecolumn\endcsname + {\expandafter\ifx\csname\??lew\number\linetablecolumn\endcsname\relax + \the\wd\linetablecell + \else\ifdim\csname\??lew\number\linetablecolumn\endcsname<\wd\linetablecell + \the\wd\linetablecell + \else + \csname\??lew\number\linetablecolumn\endcsname + \fi\fi}} + +\def\linetableER + {\dosingleempty\dolinetableBR} + +\def\dolinetableBR[#1]% #1 not yet implemented + {\ifnum\linetableheadstatus=1\else + \doglobal\increment\linetablerow + \doglobal\increment\linetablerows + \fi + \global\linetablecolumn\plusone + \global\linetablesubcol\plusone + \xdef\linetableheight{\linetablerparameter\c!hoogte}% +% +% \ifx\linetableheight\empty +% % nothing +% \else\ifx\linetableheight\v!passend +% % keep it simple +% \else\ifx\linetableheight\v!regel +% \chardef\linetablemode\plusone +% \else +% \!!heighta\linetableheight +% \advance\!!heighta-\strutdepth +% \fi\fi\fi +% + \linetableheight\zeropoint + \edef\!!stringa{\linetablerparameter\c!hoogte}% + \ifx\!!stringa\empty + \chardef\linetablehmode\zerocount + \else\ifx\!!stringa\v!passend + \chardef\linetablehmode\plusone + \else\ifx\!!stringa\v!regel + \chardef\linetablehmode\plustwo + \else + \linetableheight\!!stringa + \advance\linetableheight-\strutdepth + \fi\fi\fi +% + \startlinetablepart} + +\def\linetableBC + {\startlinetablecell} + +\def\linetableEC + {\stoplinetablecell + \iflinetablepreroll + \checklinecolumnwidth + \fi + \checklinetablepart} + +\def\linetableER + {\stoplinetablecell + % no \box\linetablecell, i.e. dummy columnn, last \NC \NR + \stoplinetablepart + \savelinetablepart + \advance\linetablecolumn \minusone + \ifnum\linetablecolumn>\noflinetablecolumns + \xdef\noflinetablecolumns{\number\linetablecolumn}% + \fi + \flushlinetableparts + \global\linetablecolumn\zerocount + \global\linetablewidth \zeropoint + \ifcase\linetablerepeat + \globallet\linetablepart\!!plusone + \else + \globallet\linetablepart\!!zerocount % repeater + \fi + \checklinetablepage + \flushlinetablehead} + +\def\checklinetablepage + {\global\chardef\linetablepage\zerocount + \ifcase\linetablerepeat \else \ifcase\linetablepage + \doif{\linetableparameter\c!herhaal}\v!nee + {\global\chardef\linetablepage\doifoddpageelse\plusone\plustwo}% + \fi \fi} + +\def\flushlinetablehead + {\ifcase\linetableheadstatus + % 0 blocked + \or + % 1 doing head + \or + % 2 head done + \or + % 3 trigger flush + \chardef\linetableheadstatus\plusone + \the\@@linetablehead\relax + \chardef\linetableheadstatus\plustwo + \fi} + +\def\linetableNC % first time special treatment + {\relax + \ifcase\linetablecolumn + \linetableBR + \else + \linetableEC + \fi + \linetableBC} + +\def\linetableNR + {\linetableER} + +\def\startlinetable + {\startlinetablerun} + +\def\stoplinetable + {\stoplinetablerun} + +\def\startlinetableanalysis + {\bgroup + \linetableprerolltrue + \trialtypesettingtrue + \startlinetablerun} + +\def\stoplinetableanalysis + {\stoplinetablerun + \egroup + \globallet\noflinetablerows\linetablerows + \dorecurse\noflinetablecolumns % global, from last run {\linetableparameter\c!n} + {%\writestatus{linetable}{\recurselevel->\getvalue{\??lew\recurselevel}}% + \setevalue{\??lec\recurselevel\c!breedte}{\getvalue{\??lew\recurselevel}}% + \letgvalue{\??lew\recurselevel}\!!zeropoint}} % init next table + +\newtoks \@@linetablehead + +\long\def\startlinetablehead#1\stoplinetablehead + {\ifinlinetable + \@@linetablehead\emptytoks + \fi + \chardef\linetableheadstatus3 % full + \@@linetablehead{#1}% + \ifinlinetable + \flushlinetablehead + \fi} + +\def\linetableBH + {\ifx\EC\relax + % signal, grabbing lines + \else + \@@linetablehead\emptytoks + \fi + \pushmacro\BC + \pushmacro\EC + \def\BC##1\EC{\appendtoks##1\to\@@linetablehead}% + \let\EC\relax} % signal + +\def\linetableEH + {\popmacro\EC + \popmacro\BC + \@EA\startlinetablehead\the\@@linetablehead\stoplinetablehead} + +\let\startlinetablebody\donothing +\let\stoplinetablebody \donothing + +\def\processlinetablebuffer + {\dosingleempty\doprocesslinetablebuffer} + +\def\doprocesslinetablebuffer[#1]% + {\bgroup + \let\startlinetable\donothing + \let\stoplinetable \donothing + \startlinetableanalysis\getbuffer[#1]\stoplinetableanalysis + \startlinetablerun \getbuffer[#1]\stoplinetablerun + \egroup} + +\def\processlinetablefile#1% + {\bgroup + \let\startlinetable\donothing + \let\stoplinetable \donothing + \startlinetableanalysis\readfile{#1}\donothing\donothing\stoplinetableanalysis + \startlinetablerun \readfile{#1}\donothing\donothing\stoplinetablerun + \egroup} + +\protect \endinput + +\doifnotmode{demo}{\endinput} + +\setuplinetable[n=6,m={2,2,2},regels=25] + +\setuplinetable[c][1][width=2cm,background=color,backgroundcolor=red] +\setuplinetable[c][4][width=3cm,background=color,backgroundcolor=yellow] +\setuplinetable[c][6][width=3cm,background=color,backgroundcolor=magenta] +\setuplinetable[r][odd][background=color,backgroundcolor=gray] +\setuplinetable[r][even][background=color,backgroundcolor=green] + +\starttext + +\showframe \showstruts + +\setupcolors[state=start] + +\setuppagenumbering[alternative=doublesided]\page[left] + +\startlinetable +\NC aaa\crlf aaa \NC bb \NC c \NC ddddd \NC eeee \NC ff \NC \NR +\dorecurse{100} + {\NC aaa \NC bb \NC c \NC ddddd \NC eeee \NC ff \NC \NR} +\stoplinetable + +\startlinetable +\NC[style=slanted,color=green,background=color,backgroundcolor=darkred,nx=2,uitlijnen=middle] xxx + \NC yy \NC ddddd \NC eeee \NC ff \NC \NR +\dorecurse{100} + {\NC aaa \NC bb \NC c \NC ddddd \NC eeee \NC ff \NC \NR} +\stoplinetable + +\stoptext diff --git a/tex/context/base/core-mak.tex b/tex/context/base/core-mak.tex index 3f081f466..efc09452d 100644 --- a/tex/context/base/core-mak.tex +++ b/tex/context/base/core-mak.tex @@ -34,10 +34,10 @@ #2]% \setvalue{\e!plaats#1}{\doplaats[\??pl#1]}} -\def\definieerplaats% +\def\definieerplaats {\dodoubleempty\dodefinieerplaats} -\def\doplaats% +\def\doplaats {\dodoubleempty\dodoplaats} \def\dodoplaats[#1][#2]% correctie moet mooier @@ -46,14 +46,14 @@ {\setlocalhsize \getparameters[#1][#2]% \getvalue{#1\c!voor}% - \doifvalue{#1\c!regelcorrectie} {\v!aan} {\startbaselinecorrection}% - \doifinset{\getvalue{#1\c!marge}}{\v!standaard,\v!ja}{\noindent}% + \doifvalue{#1\c!regelcorrectie}\v!aan \startbaselinecorrection + \doifinset{\getvalue{#1\c!marge}}{\v!standaard,\v!ja}\noindent \hbox to \localhsize {\getvalue{#1\c!links}% \box\nextbox \getvalue{#1\c!rechts}}% - \doifvalue{#1\c!dieptecorrectie} {\v!aan} {\baselinecorrection}% - \doifvalue{#1\c!regelcorrectie} {\v!aan} {\stopbaselinecorrection}% + \doifvalue{#1\c!dieptecorrectie}\v!aan\baselinecorrection + \doifvalue{#1\c!regelcorrectie }\v!aan\stopbaselinecorrection \getvalue{#1\c!na}% \egroup} \vbox} diff --git a/tex/context/base/core-mar.tex b/tex/context/base/core-mar.tex index 4768caefe..84841cfae 100644 --- a/tex/context/base/core-mar.tex +++ b/tex/context/base/core-mar.tex @@ -15,8 +15,8 @@ \unprotect -\prependtoks \getallmarks \to \everybeforepagebody % TEX -\prependtoks \setallmarks \to \everyafterpagebody % ETEX +\prependtoks \getallmarks \to \everybeforepagebody +\prependtoks \setallmarks \to \everyafterpagebody % currently \relax % voor 'interne' doeleinden zijn beschikbaar: % @@ -67,14 +67,14 @@ \def\doresetmarkering[#1]% {\processcommalist[#1]\fastresetmarker} -\def\resetmarkering% +\def\resetmarkering {\dosingleargument\doresetmarkering} \def\dostelmarkeringin[#1][#2]% {\def\docommando##1{\getparameters[\??mk##1][#2]}% \processcommalist[#1]\docommando} -\def\stelmarkeringin% +\def\stelmarkeringin {\dodoubleargument\dostelmarkeringin} % betere protectie @@ -92,14 +92,14 @@ \ontkoppelmarkering[#1]% % no coupling with sections \setevalue{\??mk#1\c!koppeling}{#2}% \expandafter\newmark\csname\??mk#2\endcsname - \showmessage{\m!systems}{13}{#1,[#2]}} + \showmessage\m!systems{13}{#1,[#2]}} \def\dodefinieermarkering[#1][#2]% {\doifelsenothing{#2} {\dododefinieermarkering[#1][#1]} {\dododefinieermarkering[#1][#2]}} -\def\definieermarkering% +\def\definieermarkering {\dodoubleempty\dodefinieermarkering} \let\geenmarkering=\relax @@ -143,7 +143,7 @@ \fetchtwomarks[#1]} \def\dohaalmarkering[#1][#2]% - {\doifvalue{\??mk#1\c!status}{\v!start} + {\doifvalue{\??mk#1\c!status}\v!start {\bgroup \def\geenmarkering##1{\unknown\ }% \setfullsectionnumber{\??mk#1}% @@ -189,7 +189,7 @@ \endETEX -\def\marking% +\def\marking {\dosingleargument\domarking} %D Used in placing text lines. @@ -218,3 +218,34 @@ {\unhbox\collectedmarks\setmark{#1}{#2}}} \protect \endinput + +% Pseudo marks: (for Hraban) +% +% \def\RegisterPageMark#1#2% +% {\iftrialtypesetting \else +% \doglobal\increment\NameCounter +% \textreference[#1:t:\NameCounter]{#2}% +% \doifreferencefoundelse{#1:t:\NameCounter} +% {\doifundefined{#1:f:\currentrealreference}% +% {\setxvalue{#1:f:\currentrealreference}% +% {\noexpand\in[#1:t:\NameCounter]}}% +% \setxvalue{#1:l:\currentrealreference}% +% {\noexpand\in[#1:t:\NameCounter]}}% +% {}% +% \fi} +% +% \def\GetFirstOnPage#1{\getvalue{#1:f:\realfolio}} +% \def\GetLastOnPage #1{\getvalue{#1:l:\realfolio}} +% +% \setupheadertexts[\GetFirstOnPage{Name}][\GetLastOnPage{Name}] +% +% \starttext +% +% \def\Name#1{\RegisterPageMark{Name}{#1}#1} +% \def\TestLine#1{\NC test \NC \Name {test: #1} \NC \NR} +% +% \starttabulate +% \dorecurse{100}{\expanded{\TestLine{\recurselevel}}} +% \stoptabulate +% +% \stoptext diff --git a/tex/context/base/core-mat.tex b/tex/context/base/core-mat.tex index 4c85f1511..549218563 100644 --- a/tex/context/base/core-mat.tex +++ b/tex/context/base/core-mat.tex @@ -17,6 +17,17 @@ \unprotect +\def\mathortext + {\ifmmode + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +% force text mode, will be overloaded later + +\ifx\text\undefined \let\text\hbox \fi + % will move to page-ini \newevery \everybeginofpar \EveryBeginOfPar @@ -84,10 +95,10 @@ \def\setdisplayskip#1#2#3% obsolete {#1=#2\relax - \advance#1 by -\parskip - \advance#1 by -#3\relax} + \advance#1 -\parskip + \advance#1 -#3\relax} -\def\setdisplayskips% obsolete +\def\setdisplayskips % obsolete {\setdisplayskip\abovedisplayskip \abovedisplayskipsize \!!zeropoint \setdisplayskip\belowdisplayskip \belowdisplayskipsize \!!zeropoint \setdisplayskip\abovedisplayshortskip\abovedisplayshortskipsize\baselineskip @@ -95,11 +106,11 @@ % so far for unused stuff -\def\forgetdisplayskips% to do - {\abovedisplayskip \!!zeropoint - \belowdisplayskip \!!zeropoint - \abovedisplayshortskip\!!zeropoint - \belowdisplayshortskip\!!zeropoint} +\def\forgetdisplayskips % to do + {\abovedisplayskip \zeropoint + \belowdisplayskip \zeropoint + \abovedisplayshortskip\zeropoint + \belowdisplayshortskip\zeropoint} \definieernummer % \doorlabelen [\v!formule] @@ -108,7 +119,7 @@ \c!blokwijze=\@@fmblokwijze, \c!plaats=\v!intekst] -\def\setupformulas% +\def\setupformulas {\dodoubleargument\getparameters[\??fm]} \newconditional\handleformulanumber @@ -121,18 +132,18 @@ \verhoognummer[\v!formule]% \fi \maakhetnummer[\v!formule]% - \setbox0=\hbox{\ignorespaces#2\unskip}% + \setbox0\hbox{\ignorespaces#2\unskip}% \ifdim\wd0>\zeropoint \edef\hetsubnummer{#2}% \else \let\hetsubnummer\empty \fi \doifsomething{#1}{\rawreference{\s!for}{#1}{\hetnummer\hetsubnummer}}% - \setbox0=\hbox{\ignorespaces#4\unskip}% + \setbox0\hbox{\ignorespaces#4\unskip}% \ifdim\wd0>\zeropoint \edef\hetsubnummer{#4}% \fi - \doifsomething{#3}{\rawreference{\s!for}{#3}{\hetnummer\hetsubnummer}}% + \doifsomething{#3}{\rawreference\s!for{#3}{\hetnummer\hetsubnummer}}% \rm % nodig ? \@@fmnummercommando {\dostartattributes\??fm\c!nummerletter\c!nummerkleur @@ -149,7 +160,7 @@ \def\dodoformulenummer[#1][#2][#3]% {\doquadruplegroupempty\dododoformulenummer{#1}{#2}{#3}} -\def\doformulenummer% +\def\doformulenummer {\dotripleempty\dodoformulenummer} \setvalue{\e!start\e!formule}{\dostartformula{}} @@ -167,12 +178,10 @@ \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}}} + \setvalue{\e!start#1\e!formule}{\dostartformula{#1}}% + \setvalue{\e!stop #1\e!formule}{\dostopformula}}} -\def\setupformulas% +\def\setupformulas {\dodoubleempty\dosetupformulas} \def\dosetupformulas[#1][#2]% @@ -211,16 +220,16 @@ \def\displaygridsnapping{\getvalue{\??fm\currentformula\c!grid}} \def\beforedisplayspace - {\doifnotvalue{\??fm\currentformula\c!voorwit}{\v!geen} + {\doifnotvalue{\??fm\currentformula\c!voorwit}\v!geen {\blanko[\getvalue{\??fm\currentformula\c!voorwit}]}} \def\afterdisplayspace - {\doifnotvalue{\??fm\currentformula\c!nawit}{\v!geen} + {\doifnotvalue{\??fm\currentformula\c!nawit}\v!geen {\blanko[\getvalue{\??fm\currentformula\c!nawit}]}} \def\setpredisplaysize#1% - {\predisplaysize=#1\relax - \ifdim\predisplaysize>\!!zeropoint + {\predisplaysize#1\relax + \ifdim\predisplaysize>\zeropoint \advance\predisplaysize \predisplaysizethreshhold \fi \advance\predisplaysize \displayindent % needed ? @@ -228,11 +237,11 @@ \predisplaysize\hsize \fi} -\def\setdisplaydimensions% - {\displayindent=\leftdisplayskip +\def\setdisplaydimensions + {\displayindent\leftdisplayskip \advance\displayindent\leftdisplaymargin - \displaywidth=\hsize - \ifdim\hangindent>\!!zeropoint + \displaywidth\hsize + \ifdim\hangindent>\zeropoint \advance\displayindent\hangindent \else \advance\displaywidth\hangindent @@ -243,8 +252,12 @@ \newif\ifoptimizedisplayspacing -\def\dostartformula#1% setting leftskip adaption is slow ! +\def\dostartformula#1% + {\dodoubleempty\dodostartformula[#1]} + +\def\dodostartformula[#1][#2]% setting leftskip adaption is slow ! {\bgroup + \switchtoformulabodyfont[#2]% \def\currentformula{#1}% \doifvaluesomething{\??fm\currentformula\c!marge}% so we test first {\dosetleftskipadaption{\getvalue{\??fm\currentformula\c!marge}}% @@ -258,7 +271,7 @@ \forgetdisplayskips \let\setdisplayskips\relax \ifoptimizedisplayspacing - \ifdim\lastlinewidth>\!!zeropoint\relax + \ifdim\lastlinewidth>\zeropoint \abovedisplayshortskip-\ht\strutbox\relax \fi \else @@ -266,57 +279,36 @@ \fi \getvalue{\e!start\getvalue{\??fm\currentformula\c!variant}\e!formule}} +\def\switchtoformulabodyfont{\switchtobodyfont} + +\setvalue{\e!formule}{\dosingleempty\doformula} + +\def\doformula[#1]#2% + {\begingroup + \switchtoformulabodyfont[#1]% + % not : \def\doformula[##1]##2{\mathematics{##2}}% + \mathematics{#2}% + \endgroup} + \let\doplaceformulanumber\empty -\def\dostopformula% +\def\dostopformula {\doplaceformulanumber \getvalue{\e!stop\getvalue{\??fm\currentformula\c!variant}\e!formule}% - \egroup - \resetlastlinewidth - \nonoindentation - \doifvalue{\??fm\currentformula\c!springvolgendein}{\v!nee} - {\noindentation}} + \resetlastlinewidth + \nonoindentation + \doifvalue{\??fm\currentformula\c!springvolgendein}\v!nee\noindentation + \egroup} \newif\ifinformula -% \def\startdisplaymath% -% {\ifgridsnapping -% \beforedisplayspace -% \snaptogrid[\displaygridsnapping]\vbox -% \bgroup -% \informulatrue -% \forgetall -% \else -% \bgroup -% \informulatrue -% %\forgetall % otherwise backgrounds fail -% \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 -% $$% -% \ifgridsnapping -% \else -% \par\ifvmode\ifdim\parskip>\zeropoint\vskip-\parskip\fi\fi -% \fi -% \afterdisplayspace -% \egroup} - -\def\startdisplaymath% +\def\startdisplaymath {\ifgridsnapping \beforedisplayspace \snapmathtogrid\vbox \bgroup \informulatrue - \forgetall + %\forgetall % breaks side floats \else \bgroup \informulatrue @@ -331,7 +323,7 @@ \setpredisplaysize\lastlinewidth \startinnermath} -\def\stopdisplaymath% +\def\stopdisplaymath {\stopinnermath $$% \ifgridsnapping @@ -372,7 +364,7 @@ \def\moveformula {\dosingleempty\domoveformula} -\def\domoveformula[#1]% +\def\domoveformula[#1]% brr gaat mogelijk fout {\ifgridsnapping \iffirstargument \xdef\displaygridcorrection{#1}% @@ -380,13 +372,13 @@ \gdef\displaygridcorrection{-\v!boven}% handy with short preline \fi \else - \gdef\displaygridcorrection{\displaygridsnapping} + \gdef\displaygridcorrection{\displaygridsnapping}% \fi} \let\startinnermath\empty \let\stopinnermath \empty -\def\defineformulaalternative% +\def\defineformulaalternative {\dotripleargument\dodefineformulaalternative} \def\dodefineformulaalternative[#1][#2][#3]% @@ -415,14 +407,12 @@ \definieerformule [mp] - [%\c!voorwit=,\c!nawit=, - \c!springvolgendein=\v!nee, + [\c!springvolgendein=\v!nee, \c!variant=multi] \definieerformule [md] - [%\c!voorwit=,\c!nawit=, - \c!springvolgendein=\v!ja, + [\c!springvolgendein=\v!ja, \c!variant=multi] % in m-math @@ -448,30 +438,61 @@ % \plaatsformule {f} \startspformule \fakespacingformula \stopspformule % \fakewords{20}{40} -\def\plaatsformule% +% \convertcommand\next\to\ascii \getfirstcharacter\ascii +% \ifx\firstcharacter\letterbackslash % a \cs + +\def\plaatsformule {\settrue\incrementformulanumber \dodoubleempty\doplaatsformule} -\def\plaatssubformule% +\def\plaatssubformule {\setfalse\incrementformulanumber \dodoubleempty\doplaatsformule} +% \def\doplaatsformule[#1][#2]% #2 = dummy, gobbles spaces +% {\def\redoplaatsformule +% {\bgroup\def\dostartformula####1{\relax}% +% \ifx\next\bgroup +% \@EA\moreplaatsformule % [ref]{} +% \else\if\next\relax % a \cs +% \egroup \@EA\@EA\@EA\dodoplaatsformule % [ref]\start +% \else +% \egroup \@EA\@EA\@EA\dispplaatsformule % [ref]$$ +% \fi\fi +% [#1]{}}% +% \futurelet\next\redoplaatsformule} +% +% \long\def\moreplaatsformule[#1]#2#3#4% #2 dummy #4 gobbles spaces +% {\def\redoplaatsformule% +% {\if\next\relax % a \cs +% \egroup \expandafter\dodoplaatsformule % [ref]{}\start +% \else +% \egroup \expandafter\dispplaatsformule % [ref]{}$$ +% \fi +% [#1]{#3}}% +% \futurelet\next\redoplaatsformule#4} + \def\doplaatsformule[#1][#2]% #2 = dummy, gobbles spaces - {\def\redoplaatsformule% + {\def\redoplaatsformule {\bgroup\def\dostartformula####1{\relax}% \ifx\next\bgroup \@EA\moreplaatsformule % [ref]{} - \else\if\next\relax % a \cs - \egroup \@EA\@EA\@EA\dodoplaatsformule % [ref]\start \else - \egroup \@EA\@EA\@EA\dispplaatsformule % [ref]$$ - \fi\fi + \convertcommand\next\to\ascii + \getfirstcharacter\ascii + \ifx\firstcharacter\letterbackslash % a \cs + \egroup \@EAEAEA\dodoplaatsformule % [ref]\start + \else + \egroup \@EAEAEA\dispplaatsformule % [ref]$$ + \fi + \fi [#1]{}}% \futurelet\next\redoplaatsformule} \long\def\moreplaatsformule[#1]#2#3#4% #2 dummy #4 gobbles spaces - {\def\redoplaatsformule% - {\if\next\relax % a \cs + {\def\redoplaatsformule + {\convertcommand\next\to\ascii \getfirstcharacter\ascii + \ifx\firstcharacter\letterbackslash % a \cs \egroup \expandafter\dodoplaatsformule % [ref]{}\start \else \egroup \expandafter\dispplaatsformule % [ref]{}$$ @@ -492,15 +513,15 @@ {\setfalse\handleformulanumber} {\settrue\handleformulanumber}}% \ifconditional\handleformulanumber - \def\formulenummer% + \def\formulenummer {%\global\let\subformulenummer\doformulenummer % no, bug \doformulenummer[#1][#2]}% - \def\subformulenummer% + \def\subformulenummer {\setfalse\incrementformulanumber \formulenummer}% - \gdef\doplaceformulanumber% + \gdef\doplaceformulanumber {\global\let\doplaceformulanumber\empty - \doifelse{\@@fmplaats}{\v!links} + \doifelse\@@fmplaats\v!links {\normalleqno{\doformulenummer[#1][#2][]{}}} {\normalreqno{\doformulenummer[#1][#2][]{}}}}% \else @@ -533,13 +554,13 @@ %D \type {\stopinnermath} can be overloaded in specialized %D modules. -\def\startinnermath% +\def\startinnermath {\getvalue{\e!start\??fm\getvalue{\??fm\currentformula\c!uitlijnen}}} -\def\stopinnermath% +\def\stopinnermath {\getvalue{\e!stop \??fm\getvalue{\??fm\currentformula\c!uitlijnen}}} -\def\mathinnerstrut% +\def\mathinnerstrut {\doifvalue{\??fm\currentformula\c!strut}{\v!ja}{\strut}} \long\def\defineinnermathhandler#1#2#3% @@ -548,7 +569,7 @@ \newif\iftracemath -\def\mathhbox% +\def\mathhbox {\iftracemath\ruledhbox\else\hbox\fi} \def\startmathbox#1#2% @@ -725,6 +746,21 @@ %D We already redefined \type {\bordermatrix} in \type %D {font-ini}. +%D \macros +%D {setuptextformulas} +%D +%D This command sets up in||line math. Most features deals +%D with grid snapping and are experimental. + +\newevery \everysetuptextformulas \relax + +\def\setuptextformulas + {\dosingleempty\dosetuptextformulas} + +\def\dosetuptextformulas[#1]% + {\getparameters[\??mt][#1]% + \the\everysetuptextformulas} + %D \macros %D {super, sub} %D @@ -740,7 +776,7 @@ \newevery\everysupersub \EverySuperSub -\appendtoks \advance\supersubmode by 1 \to \everysupersub +\appendtoks \advance\supersubmode \plusone \to \everysupersub % \def\dodosuper#1{\normalsuper{\the\everysupersub#1}} % \def\dodosuber#1{\normalsuber{\the\everysupersub#1}} @@ -750,9 +786,101 @@ % % \def\super{\futurelet\next\dosuper} % \def\suber{\futurelet\next\dosuber} +% +% \def\super#1{\normalsuper{\the\everysupersub#1}} +% \def\suber#1{\normalsuber{\the\everysupersub#1}} + +\appendtoks + \gridsupsubstyle +\to \everysupersub + +\appendtoks + \doifelse\@@mtformaat\v!klein + {\let\gridsupsubstyle \scriptscriptstyle + \let\gridsupsubbodyfont \setsmallbodyfont}% + {\let\gridsupsubstyle \scriptstyle + \let\gridsupsubbodyfont \relax}% +\to \everysetuptextformulas + +\setuptextformulas + [\c!formaat=\v!normaal] + +\def\dogridsupsub#1#2% + {\begingroup + \setbox\nextbox\iftracegridsnapping\ruledhbox\else\hbox\fi + {\gridsupsubbodyfont + $\strut^{\the\everysupersub#1}_{\the\everysupersub#2}$}% + \nextboxht\strutheight + \nextboxdp\strutdepth + \box\nextbox + \endgroup} + +\def\gridsupsub + {\ifconditional\crazymathsnapping + \ifgridsnapping + \@EAEAEA\dogridsupsub + \else + \@EAEAEA\normalsupsub + \fi + \else + \@EA\normalsupsub + \fi} + +\def\normalsupsub#1#2% + {^{\the\everysupersub#1}_{\the\everysupersub#2}} -\def\super#1{\normalsuper{\the\everysupersub#1}} -\def\suber#1{\normalsuber{\the\everysupersub#1}} +\appendtoks + \let\gridsupsubstyle \relax + \let\gridsupsubbodyfont\relax + \let\gridsupsub \normalsupsub +\to \everydisplay + +\def\super#1{^{\the\everysupersub#1}} +\def\suber#1{_{\the\everysupersub#1}} +\def\supsub#1#2{\super{#1}\suber{#2}} +\def\subsup#1#2{\suber{#1}\super{#2}} + +%\def\super#1{\gridsupsub{#1}{}} % +%\def\suber#1{\gridsupsub{}{#1}} % +% +%\def\supsub#1#2{\gridsupsub{#1}{#2}} +%\def\subsup#1#2{\gridsupsub{#2}{#1}} + +\def\gridsuper#1{\gridsupsub{#1}{}} +\def\gridsuber#1{\gridsupsub{}{#1}} + +% \let\sup\super % math char +% \let\sub\suber + +% test set: +% +% \startbuffer +% \sform{x\frac{1}{2}} +% \sform{x\sup{\frac{1}{2}} + x\sup{2} + 2} +% \sform{x\supsub{\frac{1}{2}}{\frac{1}{2}} + x\sup{2} + 2} +% \stopbuffer +% +% \typebuffer +% +% \startlines +% \getbuffer +% \stoplines +% +% \startbuffer +% $x\frac{1}{2}$ +% $x\sup{\frac{1}{2}} + x^2 + 2$ +% $x\supsub{\frac{1}{2}}{\frac{1}{2}} + x^2 + 2$ +% \stopbuffer +% +% \typebuffer +% +% \start +% \enablesupersub +% \enableautomath +% \startlines +% \getbuffer +% \stoplines +% \stop %D \macros %D {enablesupersub} @@ -763,20 +891,267 @@ \bgroup \catcode`\^=\@@active \catcode`\_=\@@active -\gdef\enablesupersub% +\gdef\enablesupersub {\catcode`\^=\@@active \def^{\ifmmode\expandafter\super\else\expandafter\normalsuper\fi}% \catcode`\_=\@@active \def_{\ifmmode\expandafter\suber\else\expandafter\normalsuber\fi}} \egroup +%D \macros +%D {enableautomath} +%D +%D The next one can be dangerous, but handy in controlled +%D situations. + +\bgroup \catcode`\$=\active + +\gdef\enableautomath + {\catcode`\$=\active + \def$##1${\snappedinlineformula{##1}}} + +% \gdef\enableautomath +% {\catcode`\$=\active +% \def${\doifnextcharelse$\doautodmath\doautoimath}% +% \def\doautoimath##1${\snappedinlineformula{##1}}% +% \def\doautodmath$##1$${\startformula##1\stopformula}} + +\egroup + +%D \macros +%D {...} +%D +%D New and experimental: snapping big inline math! + +\newconditional\halfcrazymathlines % \settrue\halfcrazymathlines +\newconditional\crazymathsnapping % \settrue\crazymathsnapping + +\appendtoks + \doifelse\@@mtgrid\v!ja + {\settrue \crazymathsnapping }{\setfalse\crazymathsnapping}% + \doifelse\@@mtstap\v!halveregel + {\settrue \halfcrazymathlines}{\setfalse\halfcrazymathlines}% +\to \everysetuptextformulas + +\setuptextformulas + [\c!grid=\v!ja, + \c!stap=\v!regel] + +\newcount\crazymathhack + +\let\lastcrazymathline \!!zeropoint +\let\lastcrazymathpage \!!zerocount +\let\lastcrazymathprelines \!!zerocount +\let\lastcrazymathpostlines\!!zerocount + +\def\crazymathtag{amh:\the\crazymathhack} +\def\crazytexttag{\v!tekst:\lastcrazymathpage} + +\def\crazymathindent{\hskip\MPx\crazymathtag\hskip-\MPx\crazytexttag} + +\def\flushcrazymathbox + {\nextboxht\strutheight + \nextboxdp\strutdepth + \hbox{\iftracegridsnapping\ruledhbox\fi{\flushnextbox}}} + +% possible pdftex bug: +% +% \dorecurse{100}{gest \vadjust {\strut} \par} \page +% \dorecurse{100}{gest \vadjust pre {\strut} \par} \page +% +% duplicate depth compensation with pre + +\def\snappedinlineformula + {\dosingleempty\dosnappedinlineformula} + +\def\dosnappedinlineformula[#1]#2% + {\ifvmode\dontleavehmode\fi % tricky + \strut % prevents funny space at line break + \begingroup % interesting: \bgroup can make \vadjust disappear + \ifconditional\crazymathsnapping + \ifgridsnapping + \ifx\pdftexversion\undefined + \donefalse + \else + \checktextbackgrounds % we need pos tracking, to be made less redundant + \donetrue + \fi + \else + \donefalse + \fi + \else + \donefalse + \fi + \ifdone + \setbox\nextbox\hbox{$#2$}% + \ifdim\nextboxht>\strutheight\relax + \donetrue + \else\ifdim\nextboxdp>\strutdepth\relax + \donetrue + \else + \donefalse + \fi\fi + \fi + \ifdone + \ifdim\nextboxht<\lineheight\relax + \ifdim\nextboxdp<\strutheight\relax + \donetrue + \else + \donefalse + \fi + \else + \donefalse + \fi + \ifdone + \flushcrazymathbox + \else + \doif{#1}-{\settrue \halfcrazymathlines}% + \doif{#1}+{\setfalse\halfcrazymathlines}% + \global\advance\crazymathhack\plusone + \donefalse + \ifnum\MPp\crazymathtag=\lastcrazymathpage\relax + \ifdim\MPy\crazymathtag=\lastcrazymathline\relax + \donetrue + \fi + \fi + \ifnum\MPp\crazymathtag=\zerocount \donefalse \fi + \ifdim\MPy\crazymathtag=\zeropoint \donefalse \fi + \ifdone + % same page and same line + \else + \global\let\lastcrazymathprelines \!!zerocount + \global\let\lastcrazymathpostlines\!!zerocount + \xdef\lastcrazymathpage{\MPp\crazymathtag}% + \xdef\lastcrazymathline{\MPy\crazymathtag}% + \fi + \getrawnoflines\nextboxht + \scratchcounter\noflines + \advance\noflines-\lastcrazymathprelines\relax + \ifnum\noflines>\zerocount + \xdef\lastcrazymathprelines{\the\scratchcounter}% + \scratchdimen\noflines\lineheight + \ifconditional\halfcrazymathlines + \advance\scratchdimen-.5\lineheight + \fi + \advance\scratchdimen-\strutdepth + \setbox\scratchbox\null + \wd\scratchbox2\bodyfontsize + \ht\scratchbox\scratchdimen + \dp\scratchbox\strutdepth + % % correct for fuzzy top of page situations + % \scratchdimen\lastcrazymathprelines\lineheight + % \advance\scratchdimen\MPy\crazymathtag + % \advance\scratchdimen\lineheight + % \advance\scratchdimen\topskip + % \advance\scratchdimen-\strutheight + % \dimen0=\MPy\crazytexttag + % \advance\dimen0 \MPh\crazytexttag + % \advance\scratchdimen-\dimen0\relax + % % do we need correction at all + % \ifdim\scratchdimen>\strutdepth\relax + % \donefalse + % \else\ifdim\scratchdimen<\zeropoint + % \donefalse + % \else + % \donetrue + % \fi\fi + % % analysis done + % \donefalse + % \ifdone + % \edef\crazymathcorrection{\the\scratchdimen}% + % \advance\scratchdimen-\dp\scratchbox + % \dp\scratchbox-\scratchdimen + % \else + % \let\crazymathcorrection\zeropoint + % \fi + \normalvadjust pre + {%\allowbreak % sometimes breaks spacing + \forgetall + \crazymathindent + \iftracegridsnapping\ruledhbox\fi{\box\scratchbox}% + \endgraf + \nobreak}% + \else\ifnum\scratchcounter>\zerocount + \normalvadjust pre + {\nobreak}% + \fi\fi + \getrawnoflines\nextboxdp + \scratchcounter\noflines + \advance\noflines-\lastcrazymathpostlines\relax + \ifnum\noflines>\zerocount + \donetrue + \else\ifnum\lastcrazymathpostlines=\zerocount + \donetrue + \else + \donefalse + \fi\fi + \ifdone + \xdef\lastcrazymathpostlines{\the\scratchcounter}% + \ifnum\lastcrazymathpostlines=\zerocount + \global\let\lastcrazymathpostlines\!!plusone + \fi + \hbox{\setposition\crazymathtag\flushcrazymathbox}% + \scratchdimen\noflines\lineheight + \ifconditional\halfcrazymathlines + \advance\scratchdimen-.5\lineheight + \fi + \advance\scratchdimen+\strutheight + \setbox\scratchbox\null + \wd\scratchbox\bodyfontsize + \ht\scratchbox\scratchdimen + \dp\scratchbox\strutdepth + \normalvadjust + {\forgetall + \crazymathindent + \iftracegridsnapping\ruledhbox\fi{\box\scratchbox}% + \endgraf + \allowbreak}% else we stick below the text bottom + \else + \hbox{\setposition\crazymathtag\flushcrazymathbox}% + \fi + \fi + \else + \mathematics{#2}% + \fi + \endgroup} + +\let\tform\mathematics +\let\gform\snappedinlineformula + +% test set: +% +% \startbuffer +% Crazy math \sform {1+x} or \sform {\dorecurse {100} {1+} 1 = +% 101} and even gore crazy \sform {2^{2^2}_{1_1}} +% again\dorecurse {20} { and again} \sform {\sqrt {\frac +% {x^{5^5}} {\frac {1} {2}}}} even gore\dorecurse {50} { and +% gore} \iform {\dorecurse {12} {\sform {\sqrt {\frac +% {x^{5^5}} {3}}}+\sform {\sqrt {\frac {x^{5^5}} {\frac {1} +% {2}}}}+}x=10}\dorecurse{20} { super crazy math}: \iform +% {\dorecurse {30} {\sform {\sqrt {\frac {x^{5^5}} {3}}}+ +% \sform {\sqrt {\frac {x^{5^5}} {\frac {1} {2}}}}+ }x = 10}, +% and we're\dorecurse {20} { done}! +% \stopbuffer +% +% \setupcolors[state=start] \setuppapersize[S6][S6] +% +% \showgrid \tracegridsnappingtrue \showstruts +% +% \starttext +% \setuplayout[grid=yes,lines=15]\getbuffer \page +% \setuplayout[grid=yes,lines=16]\getbuffer \page +% \setuplayout[grid=yes,lines=17]\getbuffer \page +% \setuplayout[grid=yes,lines=18]\getbuffer \page +% \setuplayout[grid=yes,lines=19]\getbuffer \page +% \stoptext + %D \macro %D {restoremathstyle} %D %D We can pick up the current math style by calling \type %D {\restoremathstyle}. -\def\restoremathstyle% +\def\restoremathstyle {\ifmmode \ifcase\supersubmode \textstyle @@ -804,6 +1179,30 @@ {\scriptstyle #1}% {\scriptscriptstyle#1}} +%D Something similar can be used in the (re|)|definition +%D of \type {\text}. This version is a variation on the one +%D in the math module (see \type{m-math} and|/|or \type +%D {m-newmat}). + +\unexpanded\def\mathtext + {\mathortext\domathtext\hbox} + +\def\domathtext#1% + {\mathchoice + {\dodomathtext\displaystyle\textface {#1}}% + {\dodomathtext\textstyle \textface {#1}}% + {\dodomathtext\textstyle \scriptface {#1}}% + {\dodomathtext\textstyle \scriptscriptface{#1}}} + +\def\dodomathtext#1#2#3% no \everymath ! + %{\hbox{\everymath{#1}\switchtobodyfont [#2]#3}} % 15 sec + {\hbox{\everymath{#1}\setcurrentfontbody{#2}#3}} % 3 sec (no math) + +%D Because we may overload \type {\text} in other (structuring) +%D macros, we say: + +\appendtoks \let\text\mathtext \to \everymath + %D \macros %D {frac, xfrac, xxfrac} %D @@ -830,7 +1229,7 @@ %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 {\over} primitive. Say that we have the following formulas: %D %D \startbuffer[sample] %D test $\frac {1}{2}$ test $$1 + \frac {1}{2} = 1.5$$ @@ -875,9 +1274,27 @@ \def\dofrac#1#2#3{\relax\mathematics{{{#1{#2}}\over{#1{#3}}}}} -\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}$}} +\def\frac {\dofrac\mathstyle} +\def\xfrac #1#2{\begingroup + \let\xfrac\xxfrac + \dofrac\scriptstyle{#1}{#2}% + \endgroup} +\def\xxfrac#1#2{\begingroup + \dofrac\scriptscriptstyle{#1}{#2}% + \endgroup} + +%D The \type {xx} variant looks still ugly, so maybe it's +%D best to say: + +\def\xxfrac#1#2{\begingroup + \dofrac\scriptscriptstyle + {#1}{\raise.25ex\hbox{$\scriptscriptstyle#2$}}% + \endgroup} + +%D Something low level for scientific calculator notation: + +\def\scinot#1#2% + {#1\times10^{#2}} %D The next macro, \type {\ch}, is \PPCHTEX\ aware. In %D formulas one can therefore best use \type {\ch} instead of diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex index b623961ea..b20f61b63 100644 --- a/tex/context/base/core-mis.tex +++ b/tex/context/base/core-mis.tex @@ -76,47 +76,47 @@ %D wouldn't you? It's there to warn \LATEX\ users that %D something is wrong. -\def\documentstyle% - {\showmessage{\m!systems}{3}{}\stoptekst} +\def\documentstyle + {\showmessage\m!systems3\empty\stoptekst} \let\documentclass=\documentstyle % THIS WAS MAIN-002.TEX -%\def\checkinterlineskip% +%\def\checkinterlineskip % {\ifvmode -% \ifdim\lastskip>\!!zeropoint\relax +% \ifdim\lastskip>\zeropoint % \nointerlineskip -% \else\ifdim\lastkern>\!!zeropoint\relax +% \else\ifdim\lastkern>\zeropoint % \nointerlineskip % \fi\fi % \fi} \def\horitems#1#2% #1=breedte #2=commandos - {\dimen0=#1\relax - \divide\dimen0 by \nofitems - \!!counta=0\relax + {\scratchdimen#1% + \divide\scratchdimen \nofitems + \!!counta\zerocount \def\docommando##1% - {\advance\!!counta by 1\relax + {\advance\!!counta \plusone \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 + [ \v!links=>\hbox to \scratchdimen{\strut##1\hss}, + \v!rechts=>\hbox to \scratchdimen{\hss\strut##1}, + \v!midden=>\hbox to \scratchdimen{\hss\strut##1\hss}, + \v!marge=>\ifnum\!!counta=\plusone\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 + \s!default=>\hbox to \scratchdimen{\hss\strut##1\hss}, % midden + \s!unknown=>\hbox to \scratchdimen{\strut##1\hss}]}% % links \hbox to #1{\hss#2\hss}} \def\veritems#1#2% #1=breedte #2=commandos - {\dimen0=#1\relax + {\scratchdimen#1% \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}% + {\ifdim\scratchdimen<\zeropoint % the - was a signal + \hbox to -\scratchdimen{\hss\strut##1}% + \else\ifdim\scratchdimen>\zeropoint + \hbox to \scratchdimen{\strut##1\hss}% \else \hbox{\strut##1}% \fi\fi}% @@ -124,35 +124,33 @@ \def\dostelitemsin[#1]% {\getparameters[\??is][#1]% - \doif{\@@isbreedte}{\v!onbekend} + \doif\@@isbreedte\v!onbekend {\def\@@isbreedte{\hsize}}% - \doifconversiondefinedelse{\@@issymbool} + \doifconversiondefinedelse\@@issymbool {\def\doitembullet##1{\convertnumber{\@@issymbool}{##1}}} - {\doifsymboldefinedelse{\@@issymbool} + {\doifsymboldefinedelse\@@issymbool {\def\doitembullet##1{\symbol[\@@issymbool]}}{}}} \def\makeitemsandbullets#1% - {\doifelse{\@@isn}{\v!onbekend} + {\doifelse\@@isn\v!onbekend {\getcommalistsize[#1]% \edef\nofitems{\commalistsize}} {\edef\nofitems{\@@isn}}% - \setbox0=\hbox - {\doitems - {\@@isbreedte} + \setbox0\hbox + {\doitems \@@isbreedte {\processcommalist[#1]\docommando}}% - \setbox2=\hbox - {\doitems - {\@@isbulletbreedte} - {\dorecurse{\nofitems} - {\docommando{\strut\doitembullet{\herhaler}}}}}} + \setbox2\hbox + {\doitems \@@isbulletbreedte + {\dorecurse\nofitems + {\docommando{\strut\doitembullet\recurselevel}}}}} \def\dostartitems#1#2#3% - {\let\doitems=#2 + {\let\doitems#2% \def\@@isbulletbreedte{#3}% \makeitemsandbullets{#1}% \@@isvoor} -\def\dostopitems% +\def\dostopitems {\@@isna \egroup} @@ -160,8 +158,8 @@ {\dostartitems{#1}\horitems\@@isbreedte \noindent\vbox {\forgetall - \doifsomething{\@@issymbool} - {\doifnot{\@@issymbool}{\v!geen} + \doifsomething\@@issymbool + {\doifnot\@@issymbool\v!geen {\box2 \@@istussen \nointerlineskip}}% @@ -173,41 +171,42 @@ \noindent\vbox {\forgetall \box0 - \doifsomething{\@@issymbool} + \doifsomething\@@issymbool {\@@istussen \nointerlineskip \box2}}% \dostopitems} \setvalue{doitems\v!inmarge}#1% - {\dostartitems{#1}{\veritems}{-1.5em}% - is a signal + {\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}% + {\advance\hsize -1.5em% + \dostartitems{#1}\veritems{1.5em}% \noindent\hbox{\box2\box0}% \dostopitems} \setvalue{doitems\v!rechts}#1% - {\dostartitems{#1}{\veritems}{0em}% + {\dostartitems{#1}\veritems{0em}% \noindent\hbox{\box0\hskip-\wd2\box2}% \dostopitems} -\def\stelitemsin% +\def\stelitemsin {\dosingleargument\dostelitemsin} \def\complexitems[#1]% {\bgroup \stelitemsin[#1]% - \parindent=\!!zeropoint + \parindent\zeropoint \setlocalhsize - \hsize=\localhsize + \hsize\localhsize \mindermeldingen - \doifundefined{doitems\@@isplaats}% - {\let\@@isplaats\v!links}% - \getvalue{doitems\@@isplaats}} + %\doifundefined{doitems\@@isplaats}% + % {\let\@@isplaats\v!links}% + %\getvalue{doitems\@@isplaats}} + \executeifdefined{doitems\@@isplaats}{\let\@@isplaats\v!links}} \definecomplexorsimpleempty\items @@ -236,7 +235,7 @@ {\getvalue{#1}}% \setvalue{\e!start#1}% {\bgroup - \setvalue{\s!do\s!next#1}{}% + \letvalue{\s!do\s!next#1}\empty \setvalue{\e!stop#1}% {\getvalue{#1}% \egroup}% @@ -290,17 +289,17 @@ {\dodoubleargument\dodefinieeralineas} \def\dostelalineasin[#1][#2][#3]% - {\doifelse{#2}{\v!elk} + {\doifelse{#2}\v!elk {\dorecurse {\getvalue{\??al#1\c!n}} - {\getparameters[\??al#1\herhaler][#3]}} + {\getparameters[\??al#1\recurselevel][#3]}} {\ConvertToConstant\doifelse{#3}{} {\getparameters[\??al#1][#2]} {\def\docommando##1% {\getparameters[\??al#1##1][#3]}% \processcommalist[#2]\docommando}}} -\def\stelalineasin% +\def\stelalineasin {\dotripleempty\dostelalineasin} \newcount\alteller @@ -308,8 +307,8 @@ \newdimen\alhsize \def\doalinealijn#1#2% - {\doifelsevalue{\??al#2\the\alteller\c!lijn}{\v!aan} - {\expandafter\dimen2=#1\relax + {\doifelsevalue{\??al#2\the\alteller\c!lijn}\v!aan + {\dimen2=#1\relax \hskip.5\dimen2 \hskip-\linewidth \vrule\!!width\linewidth @@ -318,21 +317,21 @@ \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}% + {\!!widtha\alhsize + \divide\!!widtha \alnsize} + {\!!widtha\getvalue{\??al#1\the\alteller\c!breedte}}% \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}}% + \empty + \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 + \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]% @@ -348,7 +347,7 @@ % % Hier is \Everypar niet nodig. % - \everypar{\begstrut\everypar{}}% + \everypar{\begstrut\everypar\emptytoks}% % \ignorespaces\geenspatie % dubbel: \ignorespaces \getvalue{\??al#1\the\alteller\c!commando}} @@ -361,20 +360,25 @@ \fi \getvalue{\??al#1\the\alteller\c!onder}% \egroup - \ifdim\wd0=\!!zeropoint % no data - \wd0=\!!widtha + \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} \ifnum\alteller<\getvalue{\??al#1\c!n}\relax - \def\next{\doalinea{#1}}% + \@EA\doalinea \else - \def\next{\dostopalineas{#1}}% - \fi - \next} + \@EA\dostopalineas + \fi{#1}} \def\doalinea#1% - {\global\advance\alteller by 1\relax + {\global\advance\alteller \plusone \doifelsevaluenothing{\??al#1\the\alteller\c!afstand} {\doifnot{\the\alteller}{1} {\hskip\getvalue{\??al#1\c!afstand}}} @@ -385,25 +389,24 @@ \dostartalinea{#1}} \def\dostartalineas#1% - {\global\alteller=0\relax - \parindent=\!!zeropoint + {\global\alteller\zerocount + \parindent\zeropoint \setlocalhsize - \alhsize=\localhsize - \alnsize=\getvalue{\??al#1\c!n}\relax + \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}% + {\global\advance\alhsize -\getvalue{\??al#1\c!afstand}\relax}} + {\global\advance\alhsize -\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}}% + {\global\advance\alnsize \minusone + \global\advance\alhsize -\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}} + \vbox\bgroup\hbox\bgroup\doalinea{#1}} \def\dostopalineas#1% {\egroup @@ -431,7 +434,7 @@ \c!voor=\@@tavoor, \c!na=\@@tana]} -\def\steltabin% +\def\steltabin {\dosingleargument\dosteltabin} \steltabin @@ -448,14 +451,14 @@ \doifundefined{@@chemieletter}{\def\@@chemieletter{\rm}} -\def\beginlatexmathmodehack% +\def\beginlatexmathmodehack {\ifmmode - \let\endlatexmathmodehack=\relax + \let\endlatexmathmodehack\relax \else \def\endlatexmathmodehack{$}$\@@chemieletter \fi} -\def\setsubscripts% +\def\setsubscripts {\beginlatexmathmodehack \def\dosetsubscript##1##2##3% {\dimen0=##3\fontdimen5##2% @@ -465,13 +468,13 @@ {\dosetsubscript{##1}{\textfont2}{##2}% \dosetsubscript{##1}{\scriptfont2}{##2}% \dosetsubscript{##1}{\scriptscriptfont2}{##2}}% - %\dodosetsubscript{\fontdimen14}{?}% + %\dodosetsubscript{\fontdimen14}{?}% \dodosetsubscript{\fontdimen16}{.7}% \dodosetsubscript{\fontdimen17}{.7}% \global\loweredsubscriptstrue \endlatexmathmodehack} -\def\resetsubscripts% +\def\resetsubscripts {\ifloweredsubscripts \beginlatexmathmodehack \def\doresetsubscript##1##2% @@ -481,7 +484,7 @@ {\doresetsubscript{##1}{\textfont2}% \doresetsubscript{##1}{\scriptfont2}% \doresetsubscript{##1}{\scriptscriptfont2}}% - %\dodoresetsubscript{\fontdimen14}% + %\dodoresetsubscript{\fontdimen14}% \dodoresetsubscript{\fontdimen16}% \dodoresetsubscript{\fontdimen17}% \global\loweredsubscriptsfalse @@ -498,22 +501,10 @@ \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\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\bedragprefix {\euro\normalfixedspace} \def\bedragsuffix {} @@ -545,26 +536,23 @@ % \test hans \\ ton \\ \subtot{nihil,--} \\ % \stopopelkaar -\def\doorsnede% +\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]} +\def\punten + {\dosingleempty\dopunten} -\definecomplexorsimple\punten +\def\dopunten[#1]% + {\scratchdimen.5em% + \hbox to \iffirstargument#1\else5\fi \scratchdimen + {\leaders\hbox to \scratchdimen{\hss.\hss}\hss}} -\def\ongeveer% - {\mathematics{\pm}} +\def\ongeveer + {\mathematics\pm} % for compatibility -\def\unknown% +\def\unknown {\dontleavehmode\punten[3]} \def\leftboundarycharacter#1#2% @@ -609,30 +597,30 @@ \newsignal \subsentencesignal \newcounter\subsentencelevel -\def\beginofsubsentence% +\def\beginofsubsentence {\ifdim\lastkern=\subsentencesignal \unskip \kern\hspaceamount\currentlanguage{intersentence}% \fi \doglobal\increment\subsentencelevel - \ifnum\subsentencelevel=1 + \ifnum\subsentencelevel=\plusone \leaveoutervmode \fi \symbol[\ifodd\subsentencelevel\c!leftsentence \else \c!leftsubsentence\fi]% \ignorespaces} -\def\beginofsubsentencespacing% +\def\beginofsubsentencespacing {\kern\subsentencesignal\ignorespaces} -\def\endofsubsentence% +\def\endofsubsentence {\symbol[\ifodd\subsentencelevel\c!rightsentence \else \c!rightsubsentence\fi]% \doglobal\decrement\subsentencelevel \unskip \kern\subsentencesignal} -\def\endofsubsentencespacing% +\def\endofsubsentencespacing {\ifdim\lastkern=\subsentencesignal \unskip \hskip\hspaceamount\currentlanguage{intersentence}% @@ -684,6 +672,16 @@ [\c!middlespeech] [\leftboundarycharacter\c!middlespeech{speech}] +%%%%% will be replaced by delimitedtext %%%%% + +\def\leftquotationmark + {\setbox\scratchbox\hbox{\symbol[\c!leftquotation]}% + \doif\@@ciplaats\v!marge{\hskip-\wd\scratchbox}% + \box\scratchbox} + +\def\rightquotationmark + {\hsmash{\symbol[\c!rightquotation]}} + \newsignal\quotationsignal \def\stelciterenin @@ -695,25 +693,17 @@ \def\startcitaat {\bgroup\dosingleempty\dostartcitaat} -\def\leftquotationmark - {\setbox\scratchbox\hbox{\symbol[\c!leftquotation]}% - \doif\@@ciplaats\v!marge{\hskip-\wd\scratchbox}% - \box\scratchbox} - -\def\rightquotationmark - {\hsmash{\symbol[\c!rightquotation]}} - \def\dostartcitaat[#1]% {\@@civoor \doifelsenothing{#1} {\let\dostopcitaat\relax} {\startsmaller[#1]% \let\dostopcitaat\stopsmaller}% - \dostartattributes\??ci\c!letter\c!kleur{}% + \dostartattributes\??ci\c!letter\c!kleur\empty \leftquotationmark \ignorespaces} -\def\stopcitaat% +\def\stopcitaat {\removeunwantedspaces \removelastskip \rightquotationmark @@ -743,12 +733,6 @@ {\dohandlequotation\c!leftquotation \relax} {\dohandlequotation\c!rightquotation\removelastskip}} -%\unexpanded\def\citeer -% {\doifelse\@@ciletter\v!normaal -% {\let\next\doquotedcite} -% {\let\next\doattributedcite}% -% \next} - \unexpanded\def\citeer {\doifelse\@@ciletter\v!normaal\doquotedcite\doattributedcite} @@ -766,13 +750,15 @@ %D we use the next alternative, where the first one is handled %D outside group. Watch the strut. -\unexpanded\def\citaat% +\unexpanded\def\citaat {\dohandlequotation\c!leftquotation\relax - \groupedcommand{}{\dohandlequotation\c!rightquotation\removelastskip}} + \groupedcommand \donothing + {\dohandlequotation\c!rightquotation\removelastskip}} -\def\doquotedcite% +\def\doquotedcite {\dohandlequotation\c!leftquote\relax - \groupedcommand{}{\dohandlequotation\c!rightquote\removelastskip}} + \groupedcommand \donothing + {\dohandlequotation\c!rightquote\removelastskip}} \stelciterenin [\c!plaats=\v!marge, @@ -789,6 +775,8 @@ %D closing symbols are defined per language. Italian is an %D example of a language that has them set. +%%%%% will be replaced by delimitedtext %%%%% + \newcounter\speechlevel \newconditional\insidespeech \def\startspeech @@ -816,13 +804,229 @@ \unexpanded\def\speech {\doglobal\increment\speechlevel\relax \dohandlequotation\c!leftspeech\relax - \groupedcommand - {\ignorespaces} + \groupedcommand \ignorespaces {\dohandlequotation\c!rightspeech\removelastskip \doglobal\decrement\speechlevel\relax}} \appendtoks \dohandlespeech \to \everypar +% this will replace the quotation and speed definitions + +\newsignal\delimitedtextignal + +\def\delimitedtextparameter#1% + {\csname\??ci + \ifundefined{\??ci\currentdelimitedtext#1}\else\currentdelimitedtext\fi + #1\endcsname} + +\def\definedelimitedtext + {\dodoubleempty\dodefinedelimitedtext} + +\def\dodefinedelimitedtext[#1][#2]% + {\doifassignmentelse{#2} + {\getparameters + [\??ci#1] + [\c!plaats=\v!marge, % \v!tekst \v!alinea + \c!voorwit=, + \c!nawit=\delimitedtextparameter\c!voorwit, + \c!letter=\v!normaal, + \c!kleur=, + \c!linkermarge=\zeropoint, + \c!rechtermarge=\delimitedtextparameter\c!linkermarge, + \c!springvolgendein=\v!ja, + \c!voor=, + \c!na=, + \c!links=, + \c!rechts=, + \c!niveau=0, + \c!herhaal=\v!nee, + #2]}% + {\doifdefined{#2} + {\copyparameters[\??ci#1][\??ci#2] + [\c!plaats,\c!voorwit,\c!nawit,\c!letter,\c!kleur, + \c!linkermarge,\c!rechtermarge,\c!springvolgendein, + \c!voor,\c!na,\c!links,\c!rechts]}}% + \doifsomething{#1} + {\unexpanded\setvalue{#1}{\delimitedtext[#1]}% + \setvalue{\e!start#1}{\startdelimitedtext[#1]}% + \setvalue{\e!stop#1}{\stopdelimitedtext}}} + +\def\setupdelimitedtext + {\dodoubleargument\dosetupdelimitedtext} + +\def\dosetupdelimitedtext[#1][#2]% + {\ifsecondargument + \getparameters[\??ci#1][#2]% + \else + \getparameters[\??ci][#1]% + \fi} + +\def\dorepeatdelimitedtext + {\relax\ifcase\delimitedtextparameter\c!niveau\else + \dohandledelimitedtext\c!midden + \fi} + +\def\startdelimitedtext[#1]% + {\bgroup + \def\currentdelimitedtext{#1}% + \doif{\delimitedtextparameter\c!herhaal}\v!ja + {\appendtoks \dorepeatdelimitedtext \to \everypar}% + \doifinsetelse{\delimitedtextparameter\c!plaats}{\v!alinea,\v!marge}% + {\dosingleempty\dostartdelimitedtextpar}\dostartdelimitedtexttxt} + +\def\dostartdelimitedtextpar[#1]% + {\let\dostopdelimitedtext\dostopdelimitedtextpar + \doifsomething{\delimitedtextparameter\c!voorwit} + {\blanko[\delimitedtextparameter\c!voorwit]}% + \delimitedtextparameter\c!voor + % nicer: + % \doadaptleftskip {\delimitedtextparameter\c!linkermarge}% + % \doadaptrightskip{\delimitedtextparameter\c!rechtermarge}% + % backward compatible: + \doifelsenothing{#1} + {\doadaptleftskip {\delimitedtextparameter\c!linkermarge}% + \doadaptrightskip{\delimitedtextparameter\c!rechtermarge}% + \let\dodostopdelimitedtextpar\endgraf} + {\startsmaller[#1]\let\dodostopdelimitedtextpar\stopsmaller}% + % so far + \doif{\delimitedtextparameter\c!springvolgendein}\v!nee\noindentation + \dostartattributes{\??ci\currentdelimitedtext}\c!letter\c!kleur\empty + \leftdelimitedtextmark + \doglobal\incrementvalue{\??ci\currentdelimitedtext\c!niveau}% + \ignorespaces} + +\def\dostopdelimitedtextpar + {\removeunwantedspaces + \removelastskip + \rightdelimitedtextmark + \dostopattributes + \dodostopdelimitedtextpar + \delimitedtextparameter\c!na + \doifsomething{\delimitedtextparameter\c!nawit} + {\blanko[\delimitedtextparameter\c!nawit]}} + +\def\dostartdelimitedtexttxt + {\let\dostopdelimitedtext\dostopdelimitedtexttxt + \dostartattributes{\??ci\currentdelimitedtext}\c!letter\c!kleur\empty + \dohandledelimitedtext\c!links + \ignorespaces} + +\def\dostopdelimitedtexttxt + {\removeunwantedspaces + \dohandledelimitedtext\c!rechts + \dostopattributes} + +\def\stopdelimitedtext + {\dostopdelimitedtext + \doglobal\decrementvalue{\??ci\currentdelimitedtext\c!niveau}% + \egroup} + +\def\delimitedtext[#1]% + {\pushmacro\currentdelimitedtext + \def\currentdelimitedtext{#1}% + \doifinsetelse{\delimitedtextparameter\c!plaats}{\v!alinea,\v!marge}% + \dodelimitedtextpar\dodelimitedtexttxt} + +% shortcuts + +\def\startdelimited{\startdelimitedtext} +\def\stopdelimited {\stopdelimitedtext} % no let, dynamically assigned +\def\delimited {\delimitedtext} + +\def\leftdelimitedtextmark + {\dontleavehmode + \setbox\scratchbox\hbox{\delimitedtextparameter\c!links}% + \doif{\delimitedtextparameter\c!plaats}\v!marge{\hskip-\wd\scratchbox}% + \box\scratchbox} + +\def\rightdelimitedtextmark + {\hsmash{\delimitedtextparameter\c!rechts}} + +\def\dohandledelimitedtext#1#2% + {\bgroup + \setbox\scratchbox\hbox{#1}% + \ifdim\wd\scratchbox>\zeropoint + \ifdim\lastskip=\delimitedtextignal + \unskip\hskip\hspaceamount\currentlanguage{interquotation}% + \else + #2% + \fi + \ifhmode % else funny pagebeaks + \penalty\!!tenthousand\hskip\zeropoint % == \prewordbreak + \fi + \strut % new, needed below + \delimitedtextparameter#1% + \penalty\!!tenthousand\hskip\delimitedtextignal % +- \prewordbreak + \fi + \egroup} + +\def\handledelimitedtext#1% + {\dohandledelimitedtext{#1}\relax} + +\unexpanded\def\dodelimitedtextpar + {\dohandledelimitedtext\c!links\relax + \groupedcommand + \donothing + {\dohandledelimitedtext\c!rechts\removelastskip}} + +\unexpanded\def\dodelimitedtexttxt + {\doifelse{\delimitedtextparameter\c!letter}\v!normaal + \doquoteddelimited\doattributeddelimited} + +\def\doquoteddelimited + {\dohandledelimitedtext\c!links\relax + \groupedcommand + \donothing + {\dohandledelimitedtext\c!rechts + \removelastskip + \popmacro\currentdelimitedtext}} + +\def\doattributeddelimited + {\groupedcommand + {\dostartattributes{\??ci\currentdelimitedtext}\c!letter\c!kleur} + {\dostopattributes + \popmacro\currentdelimitedtext}} + +% \definedelimitedtext +% [\v!citaat] +% [\c!links={\symbol[\c!leftquotation]}, +% \c!rechts={\symbol[\c!rightquotation]}, +% \c!linkermarge=\v!standaard] +% +% \definedelimitedtext +% [\v!citeer][\v!citaat] +% +% \setupdelimitedtext +% [\v!citeer] +% [\c!plaats=\v!tekst, +% \c!links={\symbol[\c!leftquote]}, +% \c!rechts={\symbol[\c!rightquote]}] +% +% \definedelimitedtext +% [\v!spraak][\v!citaat] +% +% \setupdelimitedtext +% [\v!spraak] +% [\c!herhaal=\v!ja, +% \c!links={\symbol[\c!leftspeech]}, +% \c!midden={\symbol[\c!middlespeech]}, +% \c!rechts={\symbol[\c!rightspeech]}] +% +% % how do we call an tight quote +% % +% % \definedelimitedtext +% % [x\v!citaat][\v!citaat] +% % +% % \setupdelimitedtext +% % [x\v!citaat] +% % [\c!springvolgendein=\v!nee, +% % \c!voorwit=\v!geenwit] +% +% \def\stelciterenin{\setupdelimitedtext[\v!citaat]} +% \def\stelcitatenin{\setupdelimitedtext[\v!citeer]} + +% seldom used, move from kernel to run time module + % 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 @@ -843,23 +1047,30 @@ \def\activiteit#1#2% {\sym{\tijdspan{#1}{#2}}} +% seldom used, move from kernel to run time module + \def\dotoevoegen#1% {\def\next{#1}% - \dorecurse{#1}{\inlinker{\next~+}\def\next{}\crlf}} + \dorecurse{#1}{\inlinker{\next~+}\let\next\empty\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}] + [ \v!klein=>\dotoevoegen{3}, + \v!middel=>\dotoevoegen{6}, + \v!groot=>\dotoevoegen{9}, + \s!default=>\dotoevoegen{6}, + \s!unknown=>\dotoevoegen{#1}] \blanko} \definecomplexorsimpleempty\toevoegen +% seldom used, move from kernel to run time module + +\def\rooster + {\dosingleempty\dorooster} + \def\dorooster[#1]% {\begingroup \getparameters[\??rt] @@ -877,11 +1088,11 @@ \dimen0=\@@rtdx\@@rteenheid\relax \dimen0=\@@rtschaal\dimen0\relax \dimen0=\@@rtfactor\dimen0\relax - \multiply\dimen0 by \@@rtnx\relax + \multiply\dimen0 \@@rtnx\relax \dimen2=\@@rtdy\@@rteenheid\relax \dimen2=\@@rtschaal\dimen2\relax \dimen2=\@@rtfactor\dimen2\relax - \multiply\dimen2 by \@@rtny\relax + \multiply\dimen2 \@@rtny\relax \def\horline {\vbox {\hrule @@ -902,7 +1113,7 @@ \dimen2=##2\@@rteenheid\relax \dimen2=\@@rtschaal\dimen2\relax \dimen2=\@@rtfactor\dimen2\relax - \divide\dimen0 by \dimen2\relax + \divide\dimen0 \dimen2\relax \xdef\@@roostere{\number\dimen0}% \ifnum\@@roostere>50 \gdef\@@roostere{100}% @@ -916,8 +1127,8 @@ \gdef\@@roostere{1}% \fi\fi\fi\fi \gdef\@@roosterd{0}% - \def\legend% - {\ifnum\@@roosterd=0\relax + \def\legend + {\ifnum\@@roosterd=\zerocount \vbox {\increment(\@@roosterc,##1)% \hbox to 2em{\hss\@@roosterc\hss}}% @@ -936,12 +1147,12 @@ \c!offset=\@@rtoffset, \c!xoffset=##6, \c!yoffset=##7]% - \doifelse{##9}{\v!midden} - {\scratchdimen=##3pt\scratchdimen=.5\scratchdimen + \doifelse{##9}\v!midden + {\scratchdimen##3pt\scratchdimen.5\scratchdimen \edef\@@psxx{\withoutpt\the\scratchdimen}% - \scratchdimen=##4pt\scratchdimen=.5\scratchdimen + \scratchdimen##4pt\scratchdimen.5\scratchdimen \edef\@@psyy{\withoutpt\the\scratchdimen}% - \scratchcounter=##2\advance\scratchcounter by -1 + \scratchcounter##2\advance\scratchcounter -1 \edef\@@pszz{\the\scratchcounter}} {\edef\@@psxx{0}\edef\@@psyy{0}\edef\@@pszz{##2}}% \position(\@@psxx,\@@psyy){##1}% @@ -953,23 +1164,20 @@ \c!factor=\@@rtfactor, \c!offset=\@@rtoffset, \c!eenheid=\@@rteenheid]% - \dorecurse{\@@pszz}{\position(##3,##4){##5}}}% + \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} + \doifnot\@@rtxstap{0} {\setlegend\@@rtxstap\@@rtdx\@@rtx \draw\legend\@@rtnx\@@rtdx0\legend{-1em}{-1.5em}\v!overlay\@@rtplaats}% - \doifnot{\@@rtystap}{0} + \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: % @@ -1005,29 +1213,29 @@ \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\apa@publicatie + {\doifsomething\@@pb@naam {\@@pb@naam,\space}% + \doifsomething\@@pb@titel {{\sl\@@pb@titel}.\space}% + \doifsomething\@@pb@jaar {(\@@pb@jaar).\space}% + \doifsomething\@@pb@plaats {\@@pb@plaats\doifelsenothing\@@pb@uitgever{.}{:\space}}% + \doifsomething\@@pb@uitgever{\@@pb@uitgever.}} -\def\normaal@publicatie% +\def\normaal@publicatie {\@@pb@naam, \@@pb@titel, \@@pb@jaar, \@@pb@pagina, \@@pb@plaats, \@@pb@uitgever.} -\def\complexstartpublicatie[#1]#2\stoppublicatie% - {\bgroup% - \def\dosetpublicatie% +\def\complexstartpublicatie[#1]#2\stoppublicatie + {\bgroup + \def\dosetpublicatie {\processcommalist [naam,titel,jaar,plaats,pagina,uitgever] \setpublicatie \ignorespaces}% \def\setpublicatie##1% - {\setvalue{\??pb @##1}{}% + {\letvalue{\??pb @##1}\empty \setvalue{##1}####1{\setvalue{\??pb @##1}{####1}\ignorespaces}}% \def\getpublicatie% - {\doifsomething{\@@pbvariant}{\getvalue{\@@pbvariant @publicatie}}}% - \doifelse{\@@pbnummeren}{\v!ja}% + {\doifsomething\@@pbvariant{\getvalue{\@@pbvariant @publicatie}}}% + \doifelse\@@pbnummeren\v!ja {\@publicatie[#1]\dosetpublicatie#2\getpublicatie\par}% {\@@pbvoor \dosetpublicatie\ignorespaces#2\getpublicatie @@ -1058,7 +1266,9 @@ \c!links={[}, \c!rechts={]}] -\def\kenmerkdatum% +% only used at pragma, move from kernel to run time module + +\def\kenmerkdatum {\currentdate[\v!kenmerk]} \def\dokenmerk[#1]% @@ -1067,14 +1277,14 @@ \getparameters [\??km] [\c!bet=\unknown,\c!dat=\unknown,\c!ken=\unknown, - \c!van=, \c!aan=, \c!ref=, #1]% + \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 + \assigntranslation[\s!nl=referentie,\s!en=reference,\s!de=Referenz,\s!sp=referencia]\to\@@@kmref + \assigntranslation[\s!nl=van,\s!en=from,\s!de=Von,\s!sp=de]\to\@@@kmvan + \assigntranslation[\s!nl=aan,\s!en=to,\s!de=An,\s!sp=a]\to\@@@kmaan + \assigntranslation[\s!nl=betreft,\s!en=concerns,\s!de=Betreff,\s!sp=]\to\@@@kmbet + \assigntranslation[\s!nl=datum,\s!en=date,\s!de=Datum,\s!sp=fecha]\to\@@@kmdat + \assigntranslation[\s!nl=kenmerk,\s!en=mark,\s!de=Kennzeichen,\s!sp=]\to\@@@kmken % \definetabulate[\s!dummy][|l|p|] \startdummy @@ -1082,13 +1292,13 @@ \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}% + \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% +\def\kenmerk {\dosingleargument\dokenmerk} % NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW NIEUW @@ -1096,30 +1306,30 @@ \def\??ri{@@ri} -\def\stelrijenin% +\def\stelrijenin {\dodoubleargument\getparameters[\??ri]} \def\complexstartrijen[#1]% {\bgroup \stelrijenin[#1]% - \let\do@@rionder=\relax - \def\rij% + \let\do@@rionder\relax + \def\rij {\do@@rionder \egroup - \dimen0=\vsize - \divide\dimen0 by \@@rin - \advance\dimen0 by -\lineskip + \dimen0\vsize + \divide\dimen0 \@@rin + \advance\dimen0 -\lineskip \vbox to \dimen0 \bgroup \@@riboven - \let\do@@rionder=\@@rionder + \let\do@@rionder\@@rionder \ignorespaces}% \bgroup \rij} \definecomplexorsimpleempty\startrijen -\def\stoprijen% +\def\stoprijen {\do@@rionder \egroup \egroup} @@ -1179,10 +1389,10 @@ [\e!gegeven] [\c!eenheid=.75em,\c!binnen=\setquicktabulate\geg,EQ={=}] -\unexpanded\def\xbox% +\unexpanded\def\xbox {\bgroup\aftergroup\egroup\hbox\bgroup\tx\let\next=} -\unexpanded\def\xxbox% +\unexpanded\def\xxbox {\bgroup\aftergroup\egroup\hbox\bgroup\txx\let\next=} % \def\mrm#1% @@ -1338,71 +1548,10 @@ %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% +\def\definepairedbox {\dodoubleempty\dodefinepairedbox} \def\dodefinepairedbox[#1][#2]% @@ -1424,13 +1573,13 @@ \setvalue{\e!stel#1\e!in}{\setuppairedbox[#1]}% \setvalue{\e!plaats#1}{\placepairedbox[#1]}} -\def\setuppairedbox% +\def\setuppairedbox {\dodoubleempty\dosetuppairedbox} \def\dosetuppairedbox[#1]% {\getparameters[\??ld#1]} -\def\placepairedbox% +\def\placepairedbox {\bgroup\dodoubleempty\doplacepairedbox} \def\doplacepairedbox[#1][#2]% watch the hsize/vsize tricks @@ -1453,85 +1602,85 @@ \let\next=} \hbox} -\def\beforefirstpairedbox% - {\chardef\pairedlocationa=1 % left - \chardef\pairedlocationb=4 % middle +\def\beforefirstpairedbox + {\chardef\pairedlocationa1 % left + \chardef\pairedlocationb4 % 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]% + [ \v!links=>\chardef\pairedlocationa0, + \v!rechts=>\chardef\pairedlocationa1, + \v!boven=>\chardef\pairedlocationa2, + \v!onder=>\chardef\pairedlocationa3]% \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% + [ \v!links=>\chardef\pairedlocationb0, + \v!rechts=>\chardef\pairedlocationb1, + \v!hoog=>\chardef\pairedlocationb2, + \v!boven=>\chardef\pairedlocationb2, + \v!laag=>\chardef\pairedlocationb3, + \v!onder=>\chardef\pairedlocationb3, + \v!midden=>\chardef\pairedlocationb4]} + +\def\betweenbothpairedboxes {\switchtobodyfont[\@@ldkorps]% split under same regime - \setbox\firstpairedbox=\box\nextbox + \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 + \hsize\@@ldbreedte + \scratchdimen\wd\firstpairedbox + \advance\scratchdimen \@@ldafstand + \bgroup\advance\scratchdimen \hsize \ifdim\scratchdimen>\@@ldmaxbreedte\relax \egroup - \hsize=\@@ldmaxbreedte - \advance\hsize by -\scratchdimen + \hsize\@@ldmaxbreedte + \advance\hsize -\scratchdimen \else \egroup \fi \else \hsize\wd\firstpairedbox \hsize\@@ldbreedte % can be \hsize - \ifdim\hsize>\@@ldmaxbreedte\relax \hsize=\@@ldmaxbreedte \fi % can be \hsize + \ifdim\hsize>\@@ldmaxbreedte\relax \hsize\@@ldmaxbreedte \fi % can be \hsize \fi - \ifnum\@@ldn>1 + \ifnum\@@ldn>\plusone \setrigidcolumnhsize\hsize\@@ldafstand\@@ldn \fi} -\def\afterbothpairedboxes% - {\setbox\secondpairedbox=\vbox +\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 + \scratchdimen\maxoftwoboxdimens\ht\firstpairedbox\secondpairedbox + \vsize\scratchdimen \ifdim\scratchdimen<\@@ldhoogte\relax % can be \vsize - \scratchdimen=\@@ldhoogte + \scratchdimen\@@ldhoogte \fi \ifdim\scratchdimen>\@@ldmaxhoogte\relax - \scratchdimen=\@@ldmaxhoogte + \scratchdimen\@@ldmaxhoogte \fi \valignpairedbox\firstpairedbox \scratchdimen \valignpairedbox\secondpairedbox\scratchdimen \else - \scratchdimen=\maxoftwoboxdimens\wd\firstpairedbox\secondpairedbox + \scratchdimen\maxoftwoboxdimens\wd\firstpairedbox\secondpairedbox \halignpairedbox\firstpairedbox \scratchdimen \halignpairedbox\secondpairedbox\scratchdimen - \scratchdimen=\ht\secondpairedbox - \vsize=\scratchdimen + \scratchdimen\ht\secondpairedbox + \vsize\scratchdimen \ifdim\ht\secondpairedbox<\@@ldhoogte\relax % can be \vsize - \scratchdimen=\@@ldhoogte\relax % \relax needed + \scratchdimen\@@ldhoogte\relax % \relax needed \fi \ifdim\scratchdimen>\@@ldmaxhoogte\relax % todo: totale hoogte - \scratchdimen=\@@ldmaxhoogte\relax % \relax needed + \scratchdimen\@@ldmaxhoogte\relax % \relax needed \fi \ifdim\scratchdimen>\ht\secondpairedbox \setbox\secondpairedbox\vbox to \scratchdimen - {\ifnum\pairedlocationa=3 \vss\fi + {\ifnum\pairedlocationa=3 \vss\fi % \box\secondpairedbox - \ifnum\pairedlocationa=2 \vss\fi}% + \ifnum\pairedlocationa=2 \vss\fi}% \kern\zeropoint \fi \fi \ifcase\pairedlocationa @@ -1542,7 +1691,7 @@ \fi \egroup} -\def\insidesecondpairedbox% +\def\insidesecondpairedbox {\forgetall \steluitlijnenin[\@@lduitlijnen]% \tolerantTABLEbreaktrue % hm. @@ -1553,131 +1702,225 @@ {#1\ifdim#1#2>#1#3 #2\else#3\fi} \def\valignpairedbox#1#2% - {\setbox#1=\vbox to #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 + {\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 +\newcount\horcombination % counter +\newcount\totcombination + +\def\definecombination + {\dodoubleempty\dodefinecombination} + +\def\definecombination[#1][#2]% + {\copyparameters + [\??co#1][\??co] + [\c!breedte,\c!hoogte,\c!afstand,\c!plaats,% + \c!voor,\c!tussen,\c!na,\c!uitlijnen]% + \getparameters + [\??co#1][#2]} -\def\stelcombinatiesin% +\def\setupcombinations {\dodoubleargument\getparameters[\??co]} -\long\def\dodostartcombinatie[#1*#2*#3]% +\def\startcombination + {\dodoubleempty\dostartcombination} + +\def\dostartcombination[#1][#2]% + {\bgroup + \ifsecondargument + \def\combinationparameter##1{\csname\??co#1##1\endcsname}% + \else + \def\combinationparameter##1{\csname\??co ##1\endcsname}% + \fi + \forgetall + \doifelse{\combinationparameter\c!hoogte}\v!passend + {\vbox}{\vbox to \combinationparameter\c!hoogte}% + \bgroup + %\doifelsenothing{#1} + % {\dodostartcombination[2*1*]} + % {\doifelsenothing{#2} + % {\dodostartcombination[#1*1*]} + % {\dodostartcombination[#2*1*]}}} + \expanded{\dodostartcombination + [\ifsecondargument#2\else\iffirstargument#1\else2\fi\fi*1*]}} + +\long\def\dodostartcombination[#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 + [\c!n=\v!passend,\c!afstand=\combinationparameter\c!afstand]% + \global\horcombination#1% + \global\totcombination#2% + \global\setbox\combinationstack\emptybox + \xdef\maxhorcombination{\the\horcombination}% + \multiply\totcombination\horcombination \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 + \doifelse{\combinationparameter\c!breedte}\v!passend + {\halign}{\halign to \combinationparameter\c!breedte}% + \bgroup&% + %\hfil##\hfil% now : location={left,top} + \ExpandBothAfter\doifnotinset\v!links{\combinationparameter\c!plaats}\hfil + ##% + \ExpandBothAfter\doifnotinset\v!rechts{\combinationparameter\c!plaats}\hfil + &\tabskip\zeropoint \!!plus 1fill##\cr + \docombination} + +\def\docombination % we want to add struts but still ignore an empty box + {\dowithnextbox + {\setbox0\box\nextbox \dowithnextbox - {\setbox2=\box\nextbox - \dodocombinatie} + {\setbox2\box\nextbox + \dodocombination}% \vtop\bgroup - \def\next% - {\futurelet\nexttoken\nextnext} - \def\nextnext% + \def\next + {\futurelet\nexttoken\nextnext}% + \def\nextnext {\ifx\nexttoken\egroup \else % the next box is empty \hsize\wd0 - \steluitlijnenin[\@@couitlijnen] + \steluitlijnenin[\combinationparameter\c!uitlijnen]% \bgroup \aftergroup\endstrut \aftergroup\egroup \begstrut - \fi} + \fi}% \afterassignment\next\let\nexttoken=} \hbox} -\def\dodocombinatie% +% stupid version, does not align top stuff when captions, +% keep as example +% +% \def\dodocombination +% {\vbox +% {\forgetall % \stelwitruimtein[\v!geen]% +% \let\next\vbox +% \ExpandFirstAfter\processallactionsinset +% [\combinationparameter\c!plaats] +% [ \v!boven=>\let\next\tbox, +% \v!midden=>\let\next\halfwaybox]% +% \next{\copy0}% +% \ifdim\ht2>\zeropoint % beter dan \wd2, nu \strut mogelijk +% \@@cotussen +% %\vtop % wrong code +% % {\nointerlineskip % recently added +% % \hsize\wd0 +% % \steluitlijnenin[\combinationparameter\c!uitlijnen]% % \raggedcenter +% % \begstrut\unhbox2\endstrut}% +% \box2 +% \fi}% +% \ifnum\totcombination>\plusone +% \global\advance\totcombination\minusone +% \global\advance\horcombination\minusone +% \ifnum\horcombination=\zerocount +% \def\next +% {\cr\noalign +% {\forgetall % \stelwitruimtein[\v!geen]% no +% \nointerlineskip +% \combinationparameter\c!na +% \combinationparameter\c!voor +% \vss +% \nointerlineskip}% +% \global\horcombination\maxhorcombination\relax +% \docombination}% +% \else +% \def\next +% {&&&\hskip\combinationparameter\c!afstand&\docombination}% +% \fi +% \else +% \def\next +% {\cr\egroup}% +% \fi +% \next} + +\def\dodocombination {\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]% + \let\next\vbox + \ExpandFirstAfter\processallactionsinset + [\combinationparameter\c!plaats] + [ \v!boven=>\let\next\tbox, + \v!midden=>\let\next\halfwaybox]% + \next{\copy0}% + % we need to save the caption for a next alignment line + \saveoncombinationstack2}% + \ifnum\totcombination>\plusone + \global\advance\totcombination\minusone + \global\advance\horcombination\minusone + \ifnum\horcombination=\zerocount + \def\next + {\cr + \flushcombinationstack + \noalign + {\forgetall % \stelwitruimtein[\v!geen]% no + \global\setbox\combinationstack\emptybox \nointerlineskip - \@@cona - \@@covoor + \combinationparameter\c!na + \combinationparameter\c!voor \vss \nointerlineskip}% - \global\horcombinatie=\maxhorcombinatie\relax - \docombinatie}% + \global\horcombination\maxhorcombination\relax + \docombination}% \else - \def\next% - {&&&\hskip\@@coafstand&\docombinatie}% + \def\next + {&&&\hskip\combinationparameter\c!afstand&\docombination}% \fi \else - \def\next% - {\cr\egroup}% + \def\next + {\cr + \flushcombinationstack + \egroup}% \fi \next} -\def\complexdostartcombinatie[#1]% - {\dodostartcombinatie[#1*1*]} +\def\stopcombination + {\egroup + \egroup} -\def\simpledostartcombinatie% - {\complexdostartcombinatie[2]} +\newbox\combinationstack -\def\startcombinatie% - {\bgroup - \forgetall - \doifelse{\@@cohoogte}{\v!passend} - {\vbox} - {\vbox to \@@cohoogte}% - \bgroup - \complexorsimple\dostartcombinatie} +\def\saveoncombinationstack#1% + {\global\setbox\combinationstack\hbox + {\hbox{\box#1}\unhbox\combinationstack}} -\def\stopcombinatie% - {\egroup - \egroup} +\def\flushcombinationstack + {\noalign + {\ifdim\ht\combinationstack>\zeropoint + \@@cotussen + \global\horcombination\maxhorcombination + \globallet\doflushcombinationstack\dodoflushcombinationstack + \else + \global\setbox\combinationstack\emptybox + \globallet\doflushcombinationstack\donothing + \fi}% + \doflushcombinationstack\crcr} + +\gdef\dodoflushcombinationstack + {\global\setbox\combinationstack\hbox + {\unhbox\combinationstack + \global\setbox1\lastbox}% + \box1% \ruledhbox{\box1}% + \global\advance\horcombination\minusone\relax + \ifnum\horcombination>\zerocount + \def\next{&&&&\doflushcombinationstack}% + \else + \global\setbox\combinationstack\emptybox + %\let\next\relax + \@EA\gobbleoneargument + \fi + \next} -\stelcombinatiesin +\setupcombinations [\c!breedte=\v!passend, \c!hoogte=\v!passend, \c!afstand=1em, + \c!plaats=\v!onder, % can be something {top,left} \c!voor=\blanko, \c!tussen={\blanko[\v!middel]}, \c!na=, @@ -1697,10 +1940,10 @@ \aftergroup\doplaatsondernaastelkaar \let\next=} -\def\plaatsonderelkaar% +\def\plaatsonderelkaar {\plaatsondernaastelkaar\halign\hss} -\def\plaatsnaastelkaar% +\def\plaatsnaastelkaar {\plaatsondernaastelkaar\valign\vss} \def\dogebruikexternefiles[#1][#2]% @@ -1711,7 +1954,7 @@ \c!optie=, #2]} -\def\gebruikexternefiles% +\def\gebruikexternefiles {\dodoubleargument\dogebruikexternefiles} \def\dostelexternefilesin[#1][#2]% @@ -1719,7 +1962,7 @@ {\gebruikexternefiles[#1][#2]} {\getparameters[\??fi#1][#2]}} -\def\stelexternefilesin% +\def\stelexternefilesin {\dodoubleargument\dostelexternefilesin} \def\verwerkexternefile#1#2#3% @@ -1728,8 +1971,8 @@ \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}}% + \donothing + {\showmessage\m!systems{41}{#2,#1}}% \egroup} \def\dogebruikexternefile[#1][#2][#3][#4]% @@ -1739,7 +1982,7 @@ {\setvalue{#3}{\verwerkexternefile{#1}{#3}{#4}}} {\setvalue{#2}{\verwerkexternefile{#1}{#3}{#4}}}} -\def\gebruikexternefile% +\def\gebruikexternefile {\doquadrupleargument\dogebruikexternefile} \gebruikexternefiles @@ -1814,15 +2057,15 @@ \def\dodostoprotate#1#2#3#4#5#6% {\dontshowcomposition -\scratchdimen\nextboxht\advance\scratchdimen\nextboxdp -\doif\@@roplaats\v!hoog - {\setbox\nextbox\vbox{\hbox{\raise\nextboxdp\box\nextbox}}}% -\setbox\nextbox=\vbox to #1 + \scratchdimen\nextboxht\advance\scratchdimen\nextboxdp + \doif\@@roplaats\v!hoog + {\setbox\nextbox\vbox{\hbox{\raise\nextboxdp\box\nextbox}}}% + \setbox\nextbox\vbox to #1 {#2\relax \hbox to #4 {#5\relax % \number removes leading spaces too \edef\@@rorotatie{\number\@@rorotatie}% - \doifelsenothing{\@@rorotatie} + \doifelsenothing\@@rorotatie {\dostartrotation{90}} {\dostartrotation{\@@rorotatie}}% \nextboxwd\zeropoint @@ -1836,8 +2079,8 @@ \box\nextbox \egroup} -\def\dostoprotate% - {\!!counta=\@@rorotatie +\def\dostoprotate + {\!!counta\@@rorotatie \divide\!!counta 90 \ifcase\!!counta \dodostoprotate\nextboxht\relax\vfill\nextboxwd\relax\hfill @@ -1888,25 +2131,28 @@ % schaal \def\doscalelikeafigure - {\doifsomething{\@@xyfactor\@@xyschaal\@@xyhfactor\@@xybreedte\@@xyhoogte} + {\doifsomething{\@@xyfactor\@@xyhfactor\@@xybfactor\@@xyschaal + \@@xybreedte\@@xyhoogte\@@xyregels} {\let \@@efschaal \@@xyschaal \let \@@effactor \@@xyfactor \let \@@efbfactor\@@xybfactor \let \@@efhfactor\@@xyhfactor \let \@@efbreedte\@@xybreedte \let \@@efhoogte \@@xyhoogte + \let \@@efregels \@@xyregels \let \@@epx \!!zeropoint \let \@@epy \!!zeropoint \edef\@@epw {\the\wd\nextbox}% \edef\@@eph {\the\ht\nextbox}% + \checkfiguresettings \setfactorfiguresize \setscalefiguresize \setdimensionfiguresize \convertfigureinsertscale\@@epx\figx\figxsca\scax \convertfigureinsertscale\@@epy\figy\figysca\scay - \scratchdimen=\scax pt \divide\scratchdimen by 100 + \scratchdimen\scax\s!pt \divide\scratchdimen 100 \edef\@@xysx{\withoutpt\the\scratchdimen}% - \scratchdimen=\scay pt \divide\scratchdimen by 100 + \scratchdimen\scay\s!pt \divide\scratchdimen 100 \edef\@@xysy{\withoutpt\the\scratchdimen}}} \def\doschaal[#1]% @@ -1914,26 +2160,26 @@ \forgetall \getparameters [\??xy] - [\c!schaal=,\c!breedte=,\c!hoogte=, + [\c!schaal=,\c!breedte=,\c!hoogte=,\c!regels=, \c!factor=,\c!hfactor=,\c!bfactor=, \c!sx=1,\c!sy=1,#1]% \dowithnextbox {\dontshowcomposition -\ifdim\ht\nextbox>\zeropoint \ifdim\wd\nextbox>\zeropoint - \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 -\fi \fi + \ifdim\ht\nextbox>\zeropoint \ifdim\wd\nextbox>\zeropoint + \doscalelikeafigure + \dimen0=\@@xysy\ht\nextbox + \dimen2=\@@xysy\dp\nextbox + \dimen4=\@@xysx\wd\nextbox + \dimen6=\dimen0\advance\dimen6 \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 + \fi \fi \box\nextbox \egroup} \hbox} @@ -1943,18 +2189,18 @@ % mirror -\def\domirrorbox% \hbox/\vbox/\vtop +\def\domirrorbox % \hbox/\vbox/\vtop {\bgroup \dowithnextbox {\dontshowcomposition - \dimen0=\wd\nextbox - \setbox\nextbox=\vbox + \scratchdimen\wd\nextbox + \setbox\nextbox\vbox {\dostartmirroring\hskip-\wd\nextbox\box\nextbox\dostopmirroring}% - \wd\nextbox=\dimen0 + \wd\nextbox\scratchdimen \box\nextbox \egroup}} -\def\spiegel% +\def\spiegel {\domirrorbox\hbox} %\setbox0=\hbox{gans} @@ -1978,7 +2224,7 @@ \def\??fr{@@fr} -\def\stelfractiesin% +\def\stelfractiesin {\dodoubleargument\getparameters[\??fr]} \def\dodofractie[#1/#2,#3,#4,#5]% @@ -1992,7 +2238,7 @@ {\!!widtha\zeropoint} {\!!widtha\@@frafstand}} {\!!widtha#4}% - \advance\!!counta -1\relax + \advance\!!counta \minusone \multiply\!!widtha \!!counta \advance\hsize -\!!widtha \divide\hsize #2\relax @@ -2001,7 +2247,7 @@ \def\dofractie[#1]% {\dodofractie[#1,,,,,,]} -\def\fractie% +\def\fractie {\dosingleargument\dofractie} \stelfractiesin @@ -2100,8 +2346,8 @@ \let\serializedcommalist\empty \scratchcounter\zerocount \def\docommando##1% - {\advance\scratchcounter 1 - \ifnum\scratchcounter=1 + {\advance\scratchcounter \plusone + \ifnum\scratchcounter=\plusone \scratchtoks{\handlecommalistsentence{##1}}% \else \ifnum\scratchcounter=\commalistsize diff --git a/tex/context/base/core-nav.tex b/tex/context/base/core-nav.tex index c15635fed..5f43da39b 100644 --- a/tex/context/base/core-nav.tex +++ b/tex/context/base/core-nav.tex @@ -136,13 +136,13 @@ \newif\iflocationstrut \newif\iflocationsplit -\def\resetgoto% +\def\resetgoto {\global\let\@@ia@@hoogte\!!zeropoint \global\let\@@ia@@diepte\!!zeropoint} \resetgoto -\def\presetgoto% +\def\presetgoto {\iflocationstrut \setstrut \xdef\@@ia@@hoogte{\the\ht\strutbox}% @@ -185,7 +185,7 @@ \hskip\dimen0#2#3}}% when visualizing things \naturalhbox % needed for omega / moved from plus-omg {\ifreversegoto - \dimen0=\wd0\box0\kern-\dimen0\smashbox2\box2\kern\dimen0 + \dimen0\wd0\box0\kern-\dimen0\smashbox2\box2\kern\dimen0 \else \smashbox2\box2\box0 \fi}% @@ -228,7 +228,7 @@ %D situations where the typeface is handled by the calling %D macro. -\def\interactioncolor% +\def\interactioncolor {\iflocation \ifrealreferencepage \@@iacontrastkleur @@ -300,9 +300,9 @@ %D such, are visible on screen, but invisible on paper. Don't %D trust this mechanism yet! -\def\dostartinteractie% +\def\dostartinteractie {\bgroup - \let\stopinteractie=\egroup + \let\stopinteractie\egroup \dowithnextbox{\dostarthide\box\nextbox\dostophide\egroup}\hbox} \let\startinteractie = \relax @@ -315,7 +315,7 @@ % \getvalue{#1\c!print}=={\v!ja} enz. Consequent menubutton % gebruiken! -\def\@@iatimestamp% +\def\@@iatimestamp {\the\normalyear \ifnum\normalmonth<10 0\fi\the\normalmonth \ifnum\normalday <10 0\fi\the\normalday} @@ -349,12 +349,10 @@ \c!breedte=1em, \c!hoogte=\!!zeropoint, \c!diepte=\!!zeropoint, - \c!titel=, + \c!titel=\jobname, % needed for fdf/x \c!subtitel=, \c!auteur=, \c!trefwoord=, \c!datum=\@@iatimestamp] -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/core-new.tex b/tex/context/base/core-new.tex index 05ffb0c11..0a3eb82e7 100644 --- a/tex/context/base/core-new.tex +++ b/tex/context/base/core-new.tex @@ -231,17 +231,17 @@ \newbox\nointerferencebox -\def\startnointerference% +\def\startnointerference {\setbox\nointerferencebox\vbox \bgroup} -\def\stopnointerference% +\def\stopnointerference {\egroup \setbox\nointerferencebox\box\voidb@x} % will go to ... -\def\alignedbox% +\def\alignedbox {\dodoubleempty\doalignedbox[]} % \def\doalignedbox[#1][#2]% @@ -299,7 +299,7 @@ \setvalue{\??ab\??ab tr}{\toprightbox} \setvalue{\??ab\??ab br}{\bottomrightbox} -\def\offsetbox% +\def\offsetbox {\dodoubleempty\dooffsetbox[]} \def\dooffsetbox[#1][#2]% @@ -318,7 +318,7 @@ \freezedimenmacro\@@oxdiepte \setbox\nextbox\hbox {\hskip\@@oxx\lower\@@oxy\hbox - {\doifelsenothing{\@@oxplaats} + {\doifelsenothing\@@oxplaats {\box\nextbox} {\alignedbox[\@@oxplaats]\hbox{\box\nextbox}}}}% \wd\nextbox\@@oxbreedte @@ -376,7 +376,7 @@ % {\getvalue{#1\c!commandos}% % \doattributes{#1}\c!letter\c!kleur{\getvalue{#1\c!commando}{#2}}} -\def\defineshortcut% +\def\defineshortcut {\dotripleargument\dodefineshortcut} \def\dodefineshortcut[#1][#2][#3]% @@ -463,6 +463,8 @@ \def\setupenv{\dodoubleargument\rawgetparameters[\??en]} \def\doifenvelse#1{\doifdefinedelse{\??en#1}} % speed up +\def\doifenv #1{\doifdefined {\??en#1}} % speed up +\def\doifnotenv #1{\doifundefined {\??en#1}} % speed up \def\env#1{\csname\??en#1\endcsname} diff --git a/tex/context/base/core-not.tex b/tex/context/base/core-not.tex index cc5a055d0..28716b8ee 100644 --- a/tex/context/base/core-not.tex +++ b/tex/context/base/core-not.tex @@ -97,10 +97,10 @@ \newif\ifcleverfootnotes % being [plaats=kolommen] -\def\setupfootnotes% +\def\setupfootnotes {\dosingleempty\dosetupfootnotes} -\def\dodofootnoterule% +\def\dodofootnoterule {\ifvmode \color [\@@vnlijnkleur] @@ -129,32 +129,32 @@ \v!streng=>\footnotepenalty9999, \v!zeerstreng=>\footnotepenalty\maxdimen, \s!default=>\footnotepenalty\zeropoint, - \v!unknown=>\footnotepenalty\commalistelement]% + \s!unknown=>\footnotepenalty\commalistelement]% \fi \setfootnotedistance - \count\footins=1000 - \ExpandBothAfter\doifinsetelse{\v!kolommen}{\@@vnplaats} + \count\footins1000 + \ExpandBothAfter\doifinsetelse\v!kolommen\@@vnplaats {\cleverfootnotestrue % global ? - \ifnum\@@kln=0 - \scratchcounter=1 + \ifnum\@@kln=\zerocount + \scratchcounter\plusone \else - \scratchcounter=\@@vnn\relax + \scratchcounter\@@vnn \fi \global\endnotesfalse \global\bottomnotestrue \setcleverfootnotes} {\cleverfootnotesfalse - \ifnum\@@vnn=0 + \ifnum\@@vnn=\zerocount \settextfootnotes - \scratchcounter=1 + \scratchcounter\plusone \else \setcolumnfootnotes - \scratchcounter=\@@vnn\relax + \scratchcounter\@@vnn \divide\count\footins \scratchcounter \fi - \ExpandBothAfter\doifinsetelse{\v!pagina}{\@@vnplaats} + \ExpandBothAfter\doifinsetelse\v!pagina\@@vnplaats {\global\endnotesfalse - \ExpandBothAfter\doifinsetelse{\v!hoog}{\@@vnplaats} + \ExpandBothAfter\doifinsetelse\v!hoog\@@vnplaats {\global\bottomnotesfalse} {\global\bottomnotestrue}} {\global\endnotestrue @@ -182,16 +182,16 @@ \fi -\def\setcleverfootnotes% +\def\setcleverfootnotes {\def\startpushfootnote {\bgroup % wellicht ooit kopuitlijnen \stelinmargein[\c!uitlijnen=\v!links]% \getvalue{\e!start\??vn\??vn}}% \def\stoppushfootnote {\getvalue{\e!stop\??vn\??vn}% \egroup}% - \def\startpopfootnotes {}% - \def\stoppopfootnotes {}} + \let\startpopfootnotes \donothing + \let\stoppopfootnotes \donothing} -\def\setcolumnfootnotes% +\def\setcolumnfootnotes {\def\startpushfootnote {\setfootnotehsize % possibly overloaded \setrigidcolumnhsize\hsize\@@vnkolomafstand\@@vnn \bgroup @@ -202,32 +202,21 @@ \def\startpopfootnotes {\bgroup \setfootnotehsize \setrigidcolumnhsize\hsize\@@vnkolomafstand\@@vnn - \setbox0=\vbox\bgroup}% + \setbox0\vbox\bgroup}% \def\stoppopfootnotes {\egroup - \setbox0=\vbox + \setbox0\vbox {\unvbox0\setbox0\lastbox \ifvbox0\unvbox\else\box\fi0}% \rigidcolumnbalance0\egroup}} -% \def\settextfootnotes% -% {\def\startpushfootnote {\startvboxtohbox -% \dostartattributes\??vn\c!letter\c!kleur{}}% -% \def\stoppushfootnote {\hskip\@@vnkolomafstand % plus.5em minus.5em -% \dostopattributes -% \stopvboxtohbox}% -% \def\startpopfootnotes {\vbox\bgroup % \doifdimenelse -% \doifnotinset{\@@vnbreedte}{\v!passend,\v!ruim} -% {\setfootnotehsize}}% -% \def\stoppopfootnotes {\convertvboxtohbox\egroup}} - -\def\settextfootnotes% +\def\settextfootnotes {\def\startpushfootnote {\startvboxtohbox \dostartattributes\??vn\c!letter\c!kleur{}}% \def\stoppushfootnote {\hskip\@@vnkolomafstand % plus.5em minus.5em \dostopattributes \stopvboxtohbox}% \def\startpopfootnotes {\vbox\bgroup - \doifnotinset{\@@vnbreedte}{\v!passend,\v!ruim} + \doifnotinset\@@vnbreedte{\v!passend,\v!ruim} {\setfootnotehsize}% \beginofshapebox}% \def\stoppopfootnotes {\endofshapebox @@ -319,24 +308,6 @@ \unexpanded\def\footnote {\dodoubleempty\dofootnote[1]} \unexpanded\def\footnotetext{\dodoubleempty\dofootnote[0]} -%\def\dofootnote[#1][#2]% -% {\unskip -% \ifcase#1\relax -% \global\footnotesymbolfalse -% \else -% \global\footnotesymboltrue -% \fi -% \ifvisible -% \ifreshapingbox -% \let\next\gobbletwoarguments -% \else -% \let\next\dodofootnote -% \fi -% \else -% \let\next\gobbletwoarguments -% \fi -% \next{#2}} - \def\dofootnote[#1][#2]% {\unskip \ifcase#1\relax @@ -387,32 +358,7 @@ {} \fi} -% \def\dodofootnote#1% -% {\iffootnotesenabled -% \doglobal\increment\internalfootreference -% \doifelse{\@@vnwijze}{\v!per\v!pagina} -% {\settrue\pagewisefootnotes} -% {\setfalse\pagewisefootnotes}% -% \doifelse{#1}{-} -% {\let\footnotenumber\empty} -% {\ifconditional\pagewisefootnotes -% \doifreferencefoundelse{\s!fnt:t:\internalfootreference} -% {\ifnum\currentrealreference>\lastfootnotepage\relax -% \global\let\lastfootnotepage\currentrealreference -% \resetnummer[\v!voetnoot]% -% \fi} -% {}% -% \fi -% \verhoognummer[\v!voetnoot]% -% \maakhetnummer[\v!voetnoot]% -% \rawreference{\s!fnt}{#1}{\hetnummer}% -% \let\footnotenumber\hetnummer}% -% \expandafter\dostartfootnote -% \else -% \expandafter\gobbleoneargument -% \fi} - -\def\dodofootnote% +\def\dodofootnote {\iffootnotesenabled \iftrialtypesetting \@EAEAEA\nododofootnote @@ -429,8 +375,8 @@ \def\dododofootnote#1% {\doglobal\increment\internalfootreference - \doifelse{\@@vnwijze}{\v!per\v!pagina} - {\settrue\pagewisefootnotes} + \doifelse\@@vnwijze{\v!per\v!pagina} + {\settrue \pagewisefootnotes} {\setfalse\pagewisefootnotes}% \doifelse{#1}{-} {\let\footnotenumber\empty} @@ -444,7 +390,7 @@ \fi \verhoognummer[\v!voetnoot]% \maakhetnummer[\v!voetnoot]% - \rawreference{\s!fnt}{#1}{\hetnummer}% + \rawreference\s!fnt{#1}{\hetnummer}% \let\footnotenumber\hetnummer}% \dostartfootnote} @@ -503,7 +449,7 @@ \let\rechtermargeafstand\linkermargeafstand \fi \ifcase\@@vnn\relax % new 31-07-99 ; always ? - \doifnotinset{\@@vnbreedte}{\v!passend,\v!ruim} + \doifnotinset\@@vnbreedte{\v!passend,\v!ruim} {\setfootnotehsize}% \fi \startpushfootnote @@ -521,9 +467,9 @@ \fi \fi \iflocation - \rawreference{\s!fnt}{\s!fnt:t:\internalfootreference}{}% + \rawreference\s!fnt{\s!fnt:t:\internalfootreference}{}% \else\ifconditional\pagewisefootnotes - \rawreference{\s!fnt}{\s!fnt:t:\internalfootreference}{}% + \rawreference\s!fnt{\s!fnt:t:\internalfootreference}{}% \fi\fi}% \bgroup \postponefootnotes @@ -531,7 +477,7 @@ \begstrut \let\next} -\def\dostopfootnote% +\def\dostopfootnote {\endstrut \stoppushfootnote \egroup @@ -550,11 +496,11 @@ \naarbox {\high{\tx\footnotenumber\domovednote\v!vorigepagina\v!volgendepagina}}% [\s!fnt:t:\internalfootreference]% - \rawreference{\s!fnt}{\s!fnt:f:\internalfootreference}{}% + \rawreference\s!fnt{\s!fnt:f:\internalfootreference}{}% \else \high{\tx\footnotenumber\domovednote\v!vorigepagina\v!volgendepagina}% \ifconditional\pagewisefootnotes - \rawreference{\s!fnt}{\s!fnt:f:\internalfootreference}{}% + \rawreference\s!fnt{\s!fnt:f:\internalfootreference}{}% \fi \fi \global\let\lastnotesymbol\relax} @@ -596,15 +542,15 @@ \let\startpopfootnotes = \relax \let\stoppopfootnotes = \relax -\def\placefootnoteinserts% +\def\placefootnoteinserts {%\ifvoid\footins \else % unsafe, strange - \ifdim\ht\footins>\!!zeropoint\relax + \ifdim\ht\footins>\zeropoint \ifendnotes \else \@@vnvoor \dofootnoterule % alleen in ..mode \bgroup \setfootnotebodyfont - \setbox0=\hbox + \setbox0\hbox {\startpopfootnotes \setfootnotebodyfont % % this should be checked, smells like a mix-up @@ -662,49 +608,44 @@ \newbox\postponedfootnotes -\def\autopostponefootnotes% -% {\gdef\localfootinsert% - {\def\localfootinsert% +\def\autopostponefootnotes + {\def\localfootinsert % not global {\ifinner %\message{[postponed footnote]}% - \global\setbox\postponedfootnotes=\vbox\bgroup + \global\setbox\postponedfootnotes\vbox\bgroup \ifvoid\postponedfootnotes\else \unvbox\postponedfootnotes \fi - \let\next=\gobbletwoarguments + \expandafter\gobbletwoarguments \else %\message{[inserted footnote]}% - \let\next=\insert - \fi - \next}} + \expandafter\insert + \fi}} -\def\postponefootnotes% - {\let\autopostponefootnotes=\postponefootnotes +\def\postponefootnotes + {\let\autopostponefootnotes\postponefootnotes \let\postponefootnotes\relax % prevent loops -% \gdef\localfootinsert% - \def\localfootinsert% + \def\localfootinsert % not global {%\message{[postponed footnote]}% \global\setbox\postponedfootnotes=\vbox\bgroup \unvbox\postponedfootnotes \gobbletwoarguments}} -\def\doflushnotes% also called directly, \ifvoid is needed ! +\def\doflushnotes % also called directly, \ifvoid is needed ! {\ifendnotes \else \ifvoid\postponedfootnotes -% \global\let\localfootinsert=\insert - \let\localfootinsert=\insert + \let\localfootinsert\insert % not global \else \bgroup - \ifdim\ht\postponedfootnotes>\!!zeropoint - \scratchdimen=\pagegoal - \advance\scratchdimen by -\pagetotal + \ifdim\ht\postponedfootnotes>\zeropoint + \scratchdimen\pagegoal + \advance\scratchdimen -\pagetotal \ifdim\scratchdimen<\ht\postponedfootnotes \message{[moved footnote]}% \fi \fi \egroup -% \global\let\localfootinsert=\insert - \let\localfootinsert=\insert + \let\localfootinsert\insert % not global \insert\footins\bgroup\unvbox\postponedfootnotes\egroup \fi \fi} @@ -744,12 +685,12 @@ \fi \snaptogrid\hbox {\setfootnotebodyfont - \setbox0=\hbox + \setbox0\hbox {\startpopfootnotes \unvbox#1\endgraf\relax \stoppopfootnotes}% - \doif{\@@vnbreedte}{\v!passend} % new, auto width - {\setbox0=\hbox % uggly but ok. + \doif\@@vnbreedte\v!passend % new, auto width + {\setbox0\hbox % uggly but ok. {\beginofshapebox \unhbox0\setbox0=\lastbox\unvbox0 \endofshapebox @@ -761,7 +702,7 @@ \c!hoogte=\v!passend, \c!strut=\v!nee, \c!offset=\v!overlay] - {\ifdim\dp0=\!!zeropoint % this hack is needed because \vadjust + {\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 @@ -804,7 +745,7 @@ \def\collectlocalfootnotes% {\def\localfootinsert##1% was \gdef, but never reset! {%\message{[local footnote]}% - \global\setbox\localpostponedfootnotes=\vbox\bgroup + \global\setbox\localpostponedfootnotes\vbox\bgroup \ifvoid\localpostponedfootnotes \else \unvbox\localpostponedfootnotes \fi @@ -813,18 +754,18 @@ \def\dostartlocalfootnotes[#1]% {\let\autopostponefootnotes\postponefootnotes \let\postponefootnotes\collectlocalfootnotes - \def\defaultfootnotewidth% + \def\defaultfootnotewidth {\ifdim\hsize<\zetbreedte\hsize\else\zetbreedte\fi}% \setupfootnotes[#1]% \savenumber[\v!voetnoot]% \resetnummer[\v!voetnoot]% \collectlocalfootnotes} -\def\startlocalfootnotes% +\def\startlocalfootnotes {\bgroup % here because we support \vbox\startlocalfootnotes \dosingleempty\dostartlocalfootnotes} -\def\stoplocalfootnotes% +\def\stoplocalfootnotes {\restorenumber[\v!voetnoot]% \egroup \checknotes} % really needed, else wrong main settings @@ -832,13 +773,13 @@ \def\doplacelocalfootnotes[#1]% {\bgroup \setupfootnotes[#1]% - \ExpandBothAfter\doifinsetelse{\v!geen}{\@@vnplaats} + \ExpandBothAfter\doifinsetelse\v!geen\@@vnplaats {\placefootnotesasnone\localpostponedfootnotes}% {\placefootnotesintext\localpostponedfootnotes}% \egroup \checknotes} -\def\placelocalfootnotes% +\def\placelocalfootnotes {\dosingleempty\doplacelocalfootnotes} %D These commands can be used like: @@ -876,7 +817,7 @@ %D %D \showsetup{\y!placefootnotes} -\def\placefootnotes% +\def\placefootnotes {\dosingleempty\doplacefootnotes} \def\doplacefootnotes[#1]% @@ -884,9 +825,8 @@ \ifendnotes \ifinpagebody \else \ifdim\ht\postponedfootnotes>\zeropoint \iffirstargument\setupfootnotes[#1,\c!hoogte=\teksthoogte]\fi - \ExpandBothAfter\doifinsetelse{\v!geen}{\@@vnplaats} - {\placefootnotesasnone\postponedfootnotes}% - {\placefootnotesintext\postponedfootnotes}% + \ExpandBothAfter\doifinsetelse\v!geen\@@vnplaats + \placefootnotesasnone\placefootnotesintext\postponedfootnotes \fi \fi \else \ifdim\ht\footins>\zeropoint \iffirstargument\setupfootnotes[#1,\c!hoogte=\teksthoogte]\fi @@ -949,12 +889,7 @@ %D from the global document bodyfont size. In the previous macros %D we already used a footnote specific font setting macro. -%\def\setfootnotebodyfont% -% {\let\setfootnotebodyfont\relax -% \restoreglobalbodyfont -% \switchtobodyfont[\@@vnkorps]} - -\def\setfootnotebodyfont% +\def\setfootnotebodyfont {\let\setfootnotebodyfont\relax \restoreglobalbodyfont \switchtobodyfont[\@@vnkorps]% diff --git a/tex/context/base/core-ntb.tex b/tex/context/base/core-ntb.tex index 0af157422..83085644d 100644 --- a/tex/context/base/core-ntb.tex +++ b/tex/context/base/core-ntb.tex @@ -38,7 +38,11 @@ %D %D \bTH \eTH %D \stoptypen - + +% the section setup does not work yet, data needs to be stored, +% i.e.each row should know if it's a head/body/foot, and there +% should be \setupTABLE[head]... and alike + \unprotect %D A simple way to force equal line spacing is to say: @@ -51,10 +55,10 @@ %D However, the next alternative also takes care of preceding %D and following white space. -\def\bTBLCELL% +\def\bTBLCELL {\inhibitblank\doconvertfont\tbltblletter\empty\everypar{\begstrut}} -\def\eTBLCELL% +\def\eTBLCELL {\ifhmode \endstrut \else @@ -68,7 +72,6 @@ \newcounter\currenttbl -%\def\@@tbl{tbl} \def\tblcell{m} \def\tblnone{n} \def\@@tbl{tbl} \def\tblcell{1} \def\tblnone{2} \def\@@tblprefix{tbl:} \let\@@rawtblprefix\@@tblprefix @@ -82,12 +85,12 @@ \def\settblwd #1#2#3{\setxvalue{\@@tblprefix#1:#2:wd}{#3}} % global ! \def\settblht #1#2#3{\setxvalue{\@@tblprefix#1:#2:ht}{#3}} % global ! -\def\gettbltag#1#2{\getvalue{\@@tblprefix#1:#2:s}} -\def\gettblcol#1#2{\getvalue{\@@tblprefix#1:#2:c}} -\def\gettblrow#1#2{\getvalue{\@@tblprefix#1:#2:r}} +\def\gettbltag#1#2{\csname\@@tblprefix#1:#2:s\endcsname} +\def\gettblcol#1#2{\csname\@@tblprefix#1:#2:c\endcsname} +\def\gettblrow#1#2{\csname\@@tblprefix#1:#2:r\endcsname} -\def\gettblwd #1#2{\getvalue{\@@tblprefix#1:#2:wd}} -\def\gettblht #1#2{\getvalue{\@@tblprefix#1:#2:ht}} +\def\gettblwd #1#2{\csname\@@tblprefix#1:#2:wd\endcsname} +\def\gettblht #1#2{\csname\@@tblprefix#1:#2:ht\endcsname} \def\settblwid#1#2{\setxvalue{\@@tblprefix#1:w}{#2}} % global ! \def\settblhei#1#2{\setxvalue{\@@tblprefix#1:h}{#2}} % global ! @@ -95,7 +98,7 @@ \def\gettblwid#1{\ifundefined{\@@tblprefix#1:w}\!!zeropoint\else\getvalue{\@@tblprefix#1:w}\fi} \def\gettblhei#1{\ifundefined{\@@tblprefix#1:h}\!!zeropoint\else\getvalue{\@@tblprefix#1:h}\fi} -\def\gettblaut#1{\getvalue{\@@tblprefix#1:a}} +\def\gettblaut#1{\csname\@@tblprefix#1:a\endcsname} \def\doiftbltag #1#2{\doifdefined {\@@tblprefix#1:#2:s}} \def\doifnottbltag #1#2{\doifundefined {\@@tblprefix#1:#2:s}} @@ -105,7 +108,7 @@ \def\doifnottblcol #1#2{\doifundefined {\@@tblprefix#1:#2:c}} \def\settbltxt#1#2{\long\setvalue{\@@tblprefix:#1:#2:t}} -\def\gettbltxt#1#2{\getvalue {\@@tblprefix:#1:#2:t}} +\def\gettbltxt#1#2{\csname\@@tblprefix:#1:#2:t\endcsname} %\def\doiftbl #1#2#3{\ifcase0\getvalue{\@@tblprefix#1:#2:s}\relax \else#3\fi} %\def\doifnottbl #1#2#3{\ifcase0\getvalue{\@@tblprefix#1:#2:s}\relax #3\fi} @@ -126,9 +129,13 @@ \newif\ifautoTBLemptycell \autoTBLemptycelltrue \newif\ifautoTBLcheckwidth \autoTBLcheckwidthtrue \newif\ifappendTBLsetups \appendTBLsetupstrue +\newif\ifenableTBLbreak \enableTBLbreakfalse +\newif\ifmultipleTBLheads \multipleTBLheadsfalse \newif\iftraceTABLE \traceTABLEfalse +\def\noftblheadlines{0} + \presetlocalframed[\@@tbl\@@tbl] \long\def\handleTBLcell#1#2[#3]{} @@ -139,31 +146,31 @@ \let\getTABLEparameters\getparameters -\unexpanded\def\setupTABLE% +\unexpanded\def\setupTABLE {\dotripleempty\dosetupTABLE} \def\dosetupTABLE[#1][#2][#3]% {\ifthirdargument \processaction [#1] - [ \v!rij=>{\dosetupTABLExy[\c!y][#2][#3]}, - \v!kolom=>{\dosetupTABLExy[\c!x][#2][#3]}, - r=>{\dosetupTABLExy[\c!y][#2][#3]}, - c=>{\dosetupTABLExy[\c!x][#2][#3]}, - y=>{\dosetupTABLExy[\c!y][#2][#3]}, - x=>{\dosetupTABLExy[\c!x][#2][#3]}, - \v!start=>{\dosetupTABLExy[#1][#2][#3]}, + [ \v!rij=>{\dosetupTABLExy[\c!y][#2][#3]},% + \v!kolom=>{\dosetupTABLExy[\c!x][#2][#3]},% + r=>{\dosetupTABLExy[\c!y][#2][#3]},% + c=>{\dosetupTABLExy[\c!x][#2][#3]},% + y=>{\dosetupTABLExy[\c!y][#2][#3]},% + x=>{\dosetupTABLExy[\c!x][#2][#3]},% + \v!start=>{\dosetupTABLExy[#1][#2][#3]},% \s!unknown=>{\dosetupTABLEzz[#1][#2][#3]}]% \else\ifsecondargument \processaction [#1] - [ \v!rij=>{\dosetupTABLExy[\c!y][\v!elk][#2]}, - \v!kolom=>{\dosetupTABLExy[\c!x][\v!elk][#2]}, - r=>{\dosetupTABLExy[\c!y][\v!elk][#2]}, - c=>{\dosetupTABLExy[\c!x][\v!elk][#2]}, - y=>{\dosetupTABLExy[\c!y][\v!elk][#2]}, - x=>{\dosetupTABLExy[\c!x][\v!elk][#2]}, - \v!start=>{\dosetupTABLExy[#1][\v!elk][#2]}, + [ \v!rij=>{\dosetupTABLExy[\c!y][\v!elk][#2]},% + \v!kolom=>{\dosetupTABLExy[\c!x][\v!elk][#2]},% + r=>{\dosetupTABLExy[\c!y][\v!elk][#2]},% + c=>{\dosetupTABLExy[\c!x][\v!elk][#2]},% + y=>{\dosetupTABLExy[\c!y][\v!elk][#2]},% + x=>{\dosetupTABLExy[\c!x][\v!elk][#2]},% + \v!start=>{\dosetupTABLExy[#1][\v!elk][#2]},% \s!unknown=>{\dosetupTABLEzz[\c!x][#1][#2]}]% \else \getparameters[\@@tbl\@@tbl][#1]% @@ -182,7 +189,7 @@ \processcommalist[#1]\dodosetupTABLE} \def\nopTABLEparameters[#1][#2]% - {\setvalue{\@@tblprefix#1}{}} + {\letvalue{\@@tblprefix#1}\empty} \def\setTABLEparameters[#1][#2]% {\pushTBLparameters @@ -198,25 +205,66 @@ \fi \popTBLparameters} -\def\v!oddeven#1{\ifodd#1\v!oneven\else\v!even\fi} - \let\setupTBLsection\relax -\def\setupTBLcell#1#2% cell over col over row - {\setupTBLsection % here ? +% \def\setupTBLcell#1#2% cell over col over row +% {\setupTBLsection % already forgotten +% \getvalue{\@@tblprefix\c!y\v!elk}% +% \getvalue{\@@tblprefix\c!x\v!elk}% +% \getvalue{\@@tblprefix\c!y\v!oddeven{#1}}% +% \getvalue{\@@tblprefix\c!x\v!oddeven{#2}}% +% \getvalue{\@@tblprefix\c!x\v!oddeven{#2}\c!y\v!oddeven{#1}}% +% \ifnum#1=\plusone \getvalue{\@@tblprefix\c!y\v!eerste }\fi +% \ifnum#2=\plusone \getvalue{\@@tblprefix\c!x\v!eerste }\fi +% \ifnum#1=\maximumrow\relax\getvalue{\@@tblprefix\c!y\v!laatste}\fi +% \ifnum#2=\maximumcol\relax\getvalue{\@@tblprefix\c!x\v!laatste}\fi +% \ifnum#1=\maximumrow\relax\ifnum#2=\maximumcol\relax +% \getvalue{\@@tblprefix\c!x\v!laatste\c!y\v!laatste}% +% \fi\fi +% \ifnum#1=\plusone \ifnum#2=\plusone +% \getvalue{\@@tblprefix\c!x\v!eerste\c!y\v!eerste}% +% \fi\fi +% \getvalue{\@@tblprefix\c!y#1}% +% \getvalue{\@@tblprefix\c!x#2}% +% \getvalue{\@@tblprefix\c!x#2\c!y#1}\relax} + +\def\setupTBLcell#1#2% cell over col over row + {\setupTBLsection % already forgotten \getvalue{\@@tblprefix\c!y\v!elk}% \getvalue{\@@tblprefix\c!x\v!elk}% \getvalue{\@@tblprefix\c!y\v!oddeven{#1}}% \getvalue{\@@tblprefix\c!x\v!oddeven{#2}}% \getvalue{\@@tblprefix\c!x\v!oddeven{#2}\c!y\v!oddeven{#1}}% - \ifnum#1=1 \getvalue{\@@tblprefix\c!y\v!eerste }\fi - \ifnum#2=1 \getvalue{\@@tblprefix\c!x\v!eerste }\fi - \ifnum#1=\maximumrow\relax\getvalue{\@@tblprefix\c!y\v!laatste}\fi - \ifnum#2=\maximumcol\relax\getvalue{\@@tblprefix\c!x\v!laatste}\fi - \getvalue{\@@tblprefix\c!y#1}% - \getvalue{\@@tblprefix\c!x#2}% - \getvalue{\@@tblprefix\c!x#2\c!y#1}\relax} - + \ifnum#1=\plusone + \getvalue{\@@tblprefix\c!y\v!eerste}% + \executeifdefined{\@@tblprefix\c!x#2\c!y\v!eerste}\donothing + \fi + \ifnum#2=\plusone + \getvalue{\@@tblprefix\c!x\v!eerste}% + \executeifdefined{\@@tblprefix\c!x\v!eerste\c!y#1}\donothing + \fi + \ifnum#1=\maximumrow\relax + \getvalue{\@@tblprefix\c!y\v!laatste}% + \executeifdefined{\@@tblprefix\c!x#2\c!y\v!laatste}\donothing + \fi + \ifnum#2=\maximumcol\relax + \getvalue{\@@tblprefix\c!x\v!laatste}% + \executeifdefined{\@@tblprefix\c!x\v!laatste\c!y#1}\donothing + \fi + \ifnum#1=\maximumrow\relax\ifnum#2=\maximumcol\relax + \getvalue{\@@tblprefix\c!x\v!laatste\c!y\v!laatste}% + \fi\fi + \ifnum#1=\plusone \ifnum#2=\plusone + \getvalue{\@@tblprefix\c!x\v!eerste\c!y\v!eerste}% + \fi\fi + %\getvalue{\@@tblprefix\c!y#1}% + %\getvalue{\@@tblprefix\c!x#2}% + %\getvalue{\@@tblprefix\c!x#2\c!y#1}\relax} + \executeifdefined{\@@tblprefix\c!y#1}\donothing + \executeifdefined{\@@tblprefix\c!x#2}\donothing + \executeifdefined{\@@tblprefix\c!x#2\c!y#1}\donothing + \relax} + %\long\def\parseTR[#1][#2]#3\eTR% [#2] is dummy that kills spaces % {\def\currentcol{0}\increment\maximumrow#3} @@ -224,40 +272,7 @@ {\def\currentcol{0}\increment\maximumrow \setupTABLE[\v!rij][\maximumrow][#1]#3} -% \long\def\parseTD[#1][#2]#3\eTD% [#2] is dummy that kills spaces -% {\getparameters[\@@tbl][\c!ny=\tblnr,\c!nx=\tblnc,nc=1,nr=1,#1]% -% \let\row\maximumrow -% \let\col\currentcol -% % goto first cell -% \doloop{\increment\col \doifnottbltag\row\col\exitloop}% -% % fill r*c cells and set span -% \let\currentcol\col -% \let\currentrow\row -% \dorecurse{\tblny} -% {\let\col\currentcol -% \settblcol\row\col\tblnx -% \ifnum\tblnx>\maximumrowspan\relax -% \let\maximumrowspan\tblnx -% \fi -% \dorecurse{\tblnx} -% {\settbltag\row\col\tblnone -% \increment\col}% -% \increment\row}% -% \decrement\row -% % set values -% \settbltag\maximumrow\currentcol\tblcell -% \settblcol\maximumrow\currentcol\tblnx -% \settblrow\maximumrow\currentcol\tblny -% % save text -% \edef\celltag{{\maximumrow}{\currentcol}}% -% \@EA\settbltxt\@EA\maximumrow\@EA\currentcol\@EA -% {\@EA\handleTBLcell\celltag[#1]{#3}}% -% % check max column -% \let\currentcol\col -% \decrement\currentcol -% \ifnum\currentcol>\maximumcol\let\maximumcol\currentcol\fi} - -\long\def\parseTD[#1][#2]#3\eTD% [#2] is dummy that kills spaces +\long\def\parseTD[#1][#2]#3\eTD % [#2] is dummy that kills spaces {\getparameters[\@@tbl][\c!ny=\tblnr,\c!nx=\tblnc,nc=1,nr=1,#1]% % goto first cell \doloop @@ -266,13 +281,13 @@ % fill r*c cells and set span \let\row\maximumrow \let\col\currentcol - \dorecurse{\tblny} + \dorecurse\tblny {\let\col\currentcol \settblcol\row\col\tblnx \ifnum\tblnx>\maximumrowspan\relax \let\maximumrowspan\tblnx \fi - \dorecurse{\tblnx} + \dorecurse\tblnx {\settbltag\row\col\tblnone \increment\col}% \increment\row}% @@ -290,9 +305,9 @@ \@EA\settbltxt\@EA\maximumrow\@EA\currentcol\@EA {\@EA\handleTBLcell\celltag[#1]{#3}}} -\long\def\parseTH[#1]#2\eTH% -% {\parseTD[#1,\c!letter=\v!vet,\c!karakteruitlijnen=\v!nee]#2\eTD} - {\parseTD[#1,\c!kleur=\tbltblkopkleur,\c!letter=\tbltblkopletter,% +\long\def\parseTH[#1]#2\eTH + {\parseTD + [#1,\c!kleur=\tbltblkopkleur,\c!letter=\tbltblkopletter,% \c!karakteruitlijnen=\v!nee]#2\eTD} \newtoks\TBLhead @@ -305,16 +320,16 @@ \long\def\bTABLEbody{\dosingleempty\doTABLEbody} \long\def\bTABLEfoot{\dosingleempty\doTABLEfoot} -\long\def\doTABLEhead[#1]#2\eTABLEhead% +\long\def\doTABLEhead[#1]#2\eTABLEhead {\appendtoks\doTABLEsection[#1]{#2}\to\TBLhead} -\long\def\doTABLEbody[#1]#2\eTABLEbody% +\long\def\doTABLEbody[#1]#2\eTABLEbody {\appendtoks\doTABLEsection[#1]{#2}\to\TBLbody} -\long\def\doTABLEfoot[#1]#2\eTABLEfoot% +\long\def\doTABLEfoot[#1]#2\eTABLEfoot {\appendtoks\doTABLEsection[#1]{#2}\to\TBLfoot} -\long\def\doTABLEsection[#1]#2% +\long\def\doTABLEsection[#1]#2% {\def\setupTBLsection{\getparameters[\@@tbl\@@tbl][#1]}% #2% \let\setupTBLsection\relax} @@ -329,24 +344,37 @@ \executeifdefined{\@@rawtblprefix\v!start\v!oddeven\TBLlevel}\relax \executeifdefined{\@@rawtblprefix\v!start\number\TBLlevel}\relax} -\def\bTABLE% +\def\bTABLE {\dosingleempty\dobTABLE} \def\dobTABLE[#1]% {\pushTBL - \vbox\bgroup - \localcolortrue + % box not here + \bgroup \getparameters [\@@tbl\@@tbl] [\c!uitlijnen={\v!rechts,\v!ruim,\v!hoog},#1]% + \processaction + [\tbltblsplitsen] + [ \v!ja=>\enableTBLbreaktrue, + \v!herhaal=>\enableTBLbreaktrue\multipleTBLheadstrue]% + \ifnum\TBLlevel>\plusone + \vbox + \else\ifenableTBLbreak + % no \vbox + \else + \vbox + \fi\fi + \bgroup + \localcolortrue \presetallTABLEparameters \ExpandFirstAfter\processallactionsinset [\tbltbloptie] [\v!rek=>\autoTBLspreadtrue]% - \linewidth=\tbltbllijndikte % needs to be frozen + \linewidth\tbltbllijndikte % needs to be frozen \dontcomplain - \def\currentcol{0}% - \def\maximumrowspan{1}% + \let\currentcol\!!zerocount + \let\maximumrowspan\!!plusone \let\maximumcol\currentcol \let\maximumrow\currentcol \def\bTR{\dodoubleempty\parseTR}% @@ -354,12 +382,23 @@ \def\bTH{\dodoubleempty\parseTH}% \endgraf} +% permits \expanded{\bTD ... \eTD} + +\unexpanded\def\eTR{} +\unexpanded\def\eTD{} +\unexpanded\def\eTH{} + \def\eTABLE% - {\the\TBLhead\the\TBLbody\the\TBLfoot\endgraf % tricky and dirty order -) + {% tricky and dirty order -) + \the\TBLhead + \edef\noftblheadlines{\number\maximumrow}% + \the\TBLbody + \the\TBLfoot + \endgraf % finish cells - \dorecurse{\maximumrow} + \dorecurse\maximumrow {\let\row\recurselevel - \dorecurse{\maximumcol} + \dorecurse\maximumcol {\let\col\recurselevel \let\xxcol\col \let\xxrow\row \doifnottbltag\row\col {\let\xrow\row @@ -380,9 +419,9 @@ \decrement(\xxcol,\col)\increment\xxcol \doifnottbltag\row\col {\let\xrow\row - \dorecurse{\xxrow} + \dorecurse\xxrow {\let\xcol\col \settblcol\xrow\xcol\xxcol - \dorecurse{\xxcol} + \dorecurse\xxcol {\settbltag\xrow\xcol\tblnone \increment\xcol}% \increment\xrow}% \settbltag\row\col\tblcell @@ -394,45 +433,46 @@ {\@EA\handleTBLcell\celltag[]{\strut}}% \fi}}}% % to be sure - \dorecurse{\maximumrow} + \dorecurse\maximumrow {\let\row\recurselevel - \dorecurse{\maximumcol} + \dorecurse\maximumcol {\let\col\recurselevel \doiftblrow\row\col - {\scratchcounter=\maximumrow - \advance\scratchcounter by -\row - \advance\scratchcounter by 1 + {\scratchcounter\maximumrow + \advance\scratchcounter -\row + \advance\scratchcounter \plusone \ifnum\gettblrow\row\col>\scratchcounter \settblrow\row\col{\the\scratchcounter}% \fi}% \settblht\row\col\!!zeropoint \settblwd\row\col\!!zeropoint - \doifnottblcol\row\col{\settblcol\row\col0}% + \doifnottblcol\row\col{\settblcol\row\col\!!zerocount}% \doifnottbltag\row\col{\settbltag\row\col\tblnone}}}% % check and do \begTBL - \dorecurse{\maximumrow} + \dorecurse\maximumrow {\bTBL \let\row\recurselevel - \dorecurse{\maximumcol} + \dorecurse\maximumcol {\let\col\recurselevel \expanded{\doTBL{\row}{\col}}}% \eTBL}% \endTBL -% wrong ! ! ! better to have an auto-offset-overlay -% \ifnum\TBLlevel>1 -% \vskip-\dp\strutbox -% \fi + % wrong ! ! ! better to have an auto-offset-overlay + % \ifnum\TBLlevel>1 + % \vskip-\dp\strutbox + % \fi + \egroup \egroup \popTBL} \def\spanTBL#1#2% - {\scratchcounter=\gettblcol{#1}{#2}\relax - \ifnum\scratchcounter>0 - \advance\scratchcounter -1 - \dorecurse{\scratchcounter}{\appendtoks\spantblcol\to\tbltoks}% - \dorecurse{\scratchcounter}{\appendtoks\skiptblcol\to\tbltoks}% - \appendtoks\nexttblcol\to\tbltoks + {\scratchcounter\gettblcol{#1}{#2}\relax + \ifnum\scratchcounter>\zerocount + \advance\scratchcounter \minusone + \dorecurse\scratchcounter{\appendtoks\spantblcol\to\tbltoks}% + \dorecurse\scratchcounter{\appendtoks\skiptblcol\to\tbltoks}% + \appendtoks\nexttblcol\to\tbltoks \fi} \def\bTBL{\appendtoks\begintblrow\to\tbltoks} @@ -441,32 +481,43 @@ % We use aligments to handle the empty (skipped) columns, so % that we don't have to (re|)|calculate these. -\def\skiptblcol% +\def\skiptblcol {\doglobal\increment\colTBL} -\def\nexttblcol% +\def\nexttblcol {\doglobal\increment\colTBL&} -\def\spantblcol% +\def\spantblcol {\span} -\def\begintblrow% +\def\begintblrow {\noalign {\doglobal\increment\rowTBL \doglobal\newcounter\colTBL}% \nexttblcol} -\def\endtblrow% - {\crcr\noalign{\nointerlineskip}} +\def\endtblrow + {\crcr + \noalign + {\nointerlineskip + \allowbreak + \bgroup + \increment\rowTBL\relax + \ifnum\rowTBL>\noftblheadlines\relax + \ifnum\rowTBL<\maximumrow\relax + \doifsomething\tbltbltussenwit{\blank[\tbltbltussenwit]}% + \fi + \fi + \egroup}} -\def\begintbl% +\def\begintbl {\doglobal\newcounter\colTBL \doglobal\newcounter\rowTBL \doglobal\decrement\rowTBL \tabskip\zeropoint \halign\bgroup\ignorespaces##\unskip&&\ignorespaces##\unskip\cr} -\def\endtbl% +\def\endtbl {\egroup} \setvalue{\tblnone TBL}#1#2% @@ -481,195 +532,188 @@ \def\doTBL#1#2% {\getvalue{\gettbltag{#1}{#2}TBL}{#1}{#2}} -\def\begTBL% +\def\begTBL {\doglobal\newcounter\rowTBL \doglobal\newcounter\colTBL - \chardef\TBLpass=0 + \chardef\TBLpass\zerocount \tbltoks\emptytoks \appendtoks \begintbl \to\tbltoks} -\def\endTBL% +\def\endTBL {\appendtoks \endtbl \to\tbltoks - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\localframed [\@@tbl\@@tbl] [\c!kader=\v!uit,\c!achtergrond=,\c!uitlijnen=\v!nee] {\strut}}% \edef\minimalcellheight{\the\ht\scratchbox}% - \dorecurse{\maximumcol} - {\settblaut\recurselevel\!!zeropoint + \dorecurse\maximumcol + {\settblaut\recurselevel\!!zeropoint % \zeropoint etc % new - \let\xcol\recurselevel - \dorecurse{\maximumrow} - {\settblwd \recurselevel\xcol\!!zeropoint - \settblht \recurselevel\xcol\!!zeropoint}% - % till here - \settblwid\recurselevel\!!zeropoint}% - \dorecurse{\maximumrow} + \let\xcol\recurselevel + \dorecurse\maximumrow + {\settblwd \recurselevel\xcol\!!zeropoint + \settblht \recurselevel\xcol\!!zeropoint}% + % till here + \settblwid\recurselevel\!!zeropoint}% + \dorecurse\maximumrow {\settblhei\recurselevel\maxdimen}% - \chardef\TBLpass=1 + \chardef\TBLpass\plusone \let\handleTBLcell\dohandleTBLcellA \def\makeTBL##1##2% - {\gettbltxt{##1}{##2}}% + {\gettbltxt{##1}{##2}}% \def\inTBLcell##1##2% - {\ExpandBothAfter\doifinsetelse{\localwidth}{\v!passend,\v!ruim} % user set + {\ExpandBothAfter\doifinsetelse\localwidth{\v!passend,\v!ruim} % user set {} - {\scratchdimen=\gettblaut\colTBL\relax + {\scratchdimen\gettblaut\colTBL\relax \ifdim\localwidth>\scratchdimen \settblaut\colTBL\localwidth \fi}}% - \setbox0=\vbox{\the\tbltoks}% -\ifautoTBLspread - % experimental, stretch non fixed cells to \hsize - \checktblwidthsone % trial run - \checktblwidthstwo % real run - \let\handleTBLcell\dohandleTBLcellB - \setbox\scratchbox=\vbox{\the\tbltoks}% -\else - \ifdim\wd0>\hsize + \setbox0\vbox{\trialtypesettingtrue \the\tbltoks}% + \ifautoTBLspread + % experimental, stretch non fixed cells to \hsize + \checktblwidthsone % trial run + \checktblwidthstwo % real run + \let\handleTBLcell\dohandleTBLcellB + \setbox\scratchbox\vbox{\trialtypesettingtrue \the\tbltoks}% + \else\ifdim\wd0>\hsize \ifautoTBLhsize \checktblwidthsone % trial run \checktblwidthstwo % real run \let\handleTBLcell\dohandleTBLcellB - \setbox\scratchbox=\vbox{\the\tbltoks}% + \setbox\scratchbox\vbox{\trialtypesettingtrue \the\tbltoks}% \fi \else\ifautoTBLrowspan\ifnum\maximumrowspan>1 % max ? -% added jan 2002 because nx=* did no longer work - \checktblwidthsone % trial run - \checktblwidthstwo % real run -% + % added jan 2002 because nx=* did no longer work + \checktblwidthsone % trial run + \checktblwidthstwo % real run + % \let\handleTBLcell\dohandleTBLcellC - \setbox\scratchbox=\vbox{\the\tbltoks}% - \fi\fi\fi -\fi + \setbox\scratchbox\vbox{\trialtypesettingtrue \the\tbltoks}% + \fi\fi\fi\fi \let\handleTBLcell\dohandleTBLcellD - \chardef\TBLpass=2 + \chardef\TBLpass2 \def\makeTBL##1##2% meer in cellD - {\dimen2=\zeropoint + {\dimen2\zeropoint \pushmacro\colTBL \dorecurse{\gettblcol{##1}{##2}} - {\advance\dimen2 by \gettblwid\colTBL + {\advance\dimen2 \gettblwid\colTBL \increment\colTBL}% \edef\widthTBL{\the\dimen2}% \popmacro\colTBL - \setbox\scratchbox=\hbox{\gettbltxt{##1}{##2}}% + \setbox\scratchbox\hbox{\gettbltxt{##1}{##2}}% \settblht{##1}{##2}{\the\ht\scratchbox}% \settblwd{##1}{##2}{\the\wd\scratchbox}% \ifdim\ht\scratchbox>\gettblhei{##1}\relax \settblhei{##1}{\the\ht\scratchbox}% \fi}% - \setbox\scratchbox=\vbox{\the\tbltoks}% + \setbox\scratchbox\vbox{\trialtypesettingtrue \the\tbltoks}% \checktblheightsone \checktblheightstwo \let\handleTBLcell\dohandleTBLcellE - \chardef\TBLpass=3 + \chardef\TBLpass3 \def\makeTBL##1##2% {% height \pushmacro\rowTBL - \scratchdimen=\zeropoint + \scratchdimen\zeropoint \def\rowTBL{##1}% \ifnum\gettblcol{##1}{##2}=\maximumcol\relax % case: nc=maxcolumns \else \dorecurse{\gettblrow{##1}{##2}} - {\advance\scratchdimen by \gettblhei\rowTBL + {\advance\scratchdimen \gettblhei\rowTBL \increment\rowTBL}% \ifdim\scratchdimen<\gettblht{##1}{##2}\relax - \scratchdimen=\gettblht{##1}{##2}\relax + \scratchdimen\gettblht{##1}{##2}\relax \fi \fi \edef\heightTBL{\the\scratchdimen}% \popmacro\rowTBL % width \pushmacro\colTBL - \scratchdimen=\zeropoint + \scratchdimen\zeropoint \dorecurse{\gettblcol{##1}{##2}} - {\advance\scratchdimen by \gettblwid\colTBL + {\advance\scratchdimen \gettblwid\colTBL \increment\colTBL}% \edef\widthTBL{\the\scratchdimen}% \popmacro\colTBL % cell - \setbox\scratchbox=\hbox{\gettbltxt{##1}{##2}}% + \setbox\scratchbox\hbox{\gettbltxt{##1}{##2}}% \ifnum\gettblcol{##1}{##2}=\maximumcol\relax % case: nc=maxcolumns \else - \scratchdimen=\gettblhei{##1}% - \setbox\scratchbox=\hbox + \scratchdimen\gettblhei{##1}% + \setbox\scratchbox\hbox {\lower\ht\scratchbox\hbox{\raise\scratchdimen\box\scratchbox}}% - \ht\scratchbox=\scratchdimen + \ht\scratchbox\scratchdimen \fi - \dp\scratchbox=\zeropoint + \dp\scratchbox\zeropoint \box\scratchbox}% \iftraceTABLE\showtbltoks\fi - \vbox{\the\tbltoks}} + \ifnum\TBLlevel>\plusone + \vbox{\the\tbltoks}% + \else\ifenableTBLbreak + \ifmultipleTBLheads + \setbox\scratchbox\vbox{\the\tbltoks}% + \splittblbox\scratchbox + \else + \the\tbltoks + \fi + \else + \vbox{\the\tbltoks}% + \fi\fi} + +\def\splittblbox#1% #1 <> 0/2 + {\unvbox#1} \def\checktblwidthsone{\dochecktblwidths0} % 0 = trial run \def\checktblwidthstwo{\dochecktblwidths1} % 1 = real run \def\dochecktblwidths#1% {\iftraceTABLE\showtblwids{B#1}\fi - \!!dimena=\hsize - \!!counta=0 - \dorecurse{\maximumcol} - {\scratchdimen=\gettblaut\recurselevel\relax + \!!dimena\hsize + \!!counta\zerocount + \dorecurse\maximumcol + {\scratchdimen\gettblaut\recurselevel\relax \ifdim\scratchdimen>\zeropoint\relax - \advance\!!dimena by -\scratchdimen + \advance\!!dimena -\scratchdimen \else - \scratchdimen=\gettblwid\recurselevel\relax + \scratchdimen\gettblwid\recurselevel\relax \ifdim\scratchdimen>\tbltblmaxbreedte\relax \ifcase#1\else\settblwid\recurselevel\!!zeropoint\fi - \advance\!!counta by 1 + \advance\!!counta \plusone \else \ifdim\scratchdimen>\zeropoint\relax - \advance\!!dimena by -\scratchdimen + \advance\!!dimena -\scratchdimen \else % eigenlijk moet dit alleen als de kolom wordt overspannen door een % vorige, maw extra dubbele loop en status var - \advance\!!counta by 1 + \advance\!!counta \plusone \fi \fi \fi}% - \ifcase\!!counta \else \divide\!!dimena by \!!counta \fi - \dorecurse{\maximumcol} - {\scratchdimen=\gettblwid\recurselevel\relax + \ifcase\!!counta \else \divide\!!dimena \!!counta \fi + \dorecurse\maximumcol + {\scratchdimen\gettblwid\recurselevel\relax \ifcase#1\relax - \ifdim\scratchdimen<\!!dimena % take natural width + \ifdim\scratchdimen<\!!dimena % take natural width \settblaut\recurselevel{\the\scratchdimen}% \fi \else - \ifdim\scratchdimen=\zeropoint\relax % auto set width + \ifdim\scratchdimen=\zeropoint % auto set width \settblwid\recurselevel{\the\!!dimena}% \fi \fi}% \iftraceTABLE\showtblwids{E#1}\fi} - -% \def\checktblwidthsXXX% -% {\!!dimena=\hsize -% \!!counta=0 -% \dorecurse{\maximumcol} -% {\scratchdimen=\gettblaut\recurselevel\relax -% \ifdim\scratchdimen>\zeropoint\relax -% \advance\!!dimena by -\scratchdimen -% \else -% \advance\!!counta by 1 -% \fi}% -% \ifcase\!!counta \else \divide\!!dimena by \!!counta \fi -% \dorecurse{\maximumcol} -% {\scratchdimen=\gettblaut\recurselevel\relax -% \ifdim\scratchdimen=\zeropoint\relax -% \settblaut\recurselevel{\the\!!dimena}% -% \fi -% \settblwid\recurselevel{\the\!!dimena}% -% }} - -\def\checktblheightsone% - {\dorecurse{\maximumrow} + +\def\checktblheightsone + {\dorecurse\maximumrow {\let\xrowTBL\recurselevel - \dorecurse{\maximumcol} + \dorecurse\maximumcol {\let\xcolTBL\recurselevel \count0=0\gettblrow\xrowTBL\xcolTBL\relax % check row span @@ -677,11 +721,11 @@ % current height in row \dimen0=\gettblht\xrowTBL\xcolTBL % find nearest height in row - \dimen2=\!!zeropoint - \dorecurse{\maximumcol} + \dimen2=\zeropoint + \dorecurse\maximumcol {\ifnum\recurselevel=\xcolTBL\else \count2=0\gettblrow\xrowTBL\recurselevel\relax - \ifnum\count2=1 + \ifnum\count2=\plusone \dimen4=\gettblht\xrowTBL\recurselevel\relax \ifdim\dimen2<\dimen4 \dimen2=\dimen4 @@ -693,20 +737,20 @@ \dimen4=\dimen2 \dorecurse{\count0} {\ifnum\xxrowTBL=\xrowTBL\else - \advance\dimen4 by \gettblhei\xxrowTBL + \advance\dimen4 \gettblhei\xxrowTBL \fi \increment\xxrowTBL}% % distribute overshoot equally \ifdim\dimen4<\dimen0 - \advance\dimen0 by -\dimen4 - \divide\dimen0 by \count0 + \advance\dimen0 -\dimen4 + \divide\dimen0 \count0 \let\xxrowTBL\xrowTBL \settblhei\xrowTBL{\the\dimen2}% \dorecurse{\count0} - {\dorecurse{\maximumcol} + {\dorecurse\maximumcol {\ifnum\recurselevel=\xcolTBL\else - \scratchdimen=\gettblht\xxrowTBL\recurselevel - \advance\scratchdimen by \dimen0 + \scratchdimen\gettblht\xxrowTBL\recurselevel + \advance\scratchdimen \dimen0 \settblht\xxrowTBL\recurselevel{\the\scratchdimen}% \ifdim\gettblhei\xxrowTBL<\scratchdimen \settblhei\xxrowTBL{\the\scratchdimen}% @@ -723,10 +767,11 @@ \def\showtblwids#1% {\vbox - {\forgetall\tttf - [#1]\dorecurse{\maximumcol}{[\recurselevel:\gettblwid\recurselevel]}}} + {\forgetall\tttf[#1]\dorecurse\maximumcol + {\scratchdimen\gettblwid\recurselevel + [\recurselevel:\the\scratchdimen]}}} -\def\showtbltoks% +\def\showtbltoks {\vbox {\forgetall\tttf \let\begintbl \relax \let\endtbl \relax @@ -735,11 +780,9 @@ \def\makeTBL##1##2{[##1,##2]} \the\tbltoks}} -\def\TBLcharalign% - {\doifelse{\tbltblkarakteruitlijnen}{\v!ja} - {\let\next\doTBLcharalign} - {\let\next\gobbleoneargument}% - \next} +\def\TBLcharalign + {\doifelse\tbltblkarakteruitlijnen\v!ja + \doTBLcharalign\gobbleoneargument} \long\def\doTBLcharalign#1#2% column data {\edef\alignmentclass{#1}% @@ -747,54 +790,22 @@ \ifcase\TBLpass\or \setfirstpasscharacteralign\checkalignment{\strut#2\unskip}% \fi % force hsize, so always a second - \setsecondpasscharacteralign\checkalignment{\strut#2\unskip}% + \setsecondpasscharacteralign \checkalignment{\strut#2\unskip}% \ignorespaces} -% \long\def\dohandleTBLcellA#1#2[#3]#4% -% {\setbox\scratchbox=\hbox -% {\setupTBLcell{#1}{#2}% -% \localframed -% [\@@tbl\@@tbl] -% [#3,\c!achtergrond=,\c!kader=\v!uit]% 25% faster -% {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL\inTBLcell{#1}{#2}}}% -% \scratchdimen=\gettblwid\colTBL\relax -% \ifdim\wd\scratchbox>\scratchdimen -% \settblwid\colTBL{\the\wd\scratchbox}% auto set -% \fi -% \let\rowTBLx\rowTBL\increment\rowTBLx -% \scratchdimen=\gettblhei\rowTBLx\relax -% \ifdim\ht\scratchbox<\scratchdimen -% \settblhei\rowTBLx{\the\ht\scratchbox}% auto set -% \fi -% \settblht{#1}{#2}{\the\ht\scratchbox}% -% \settblwd{#1}{#2}{\the\wd\scratchbox}% -% \ifdim\wd\scratchbox<.75\hsize -% \ifdim\ht\scratchbox>2\openlineheight % honor width since this can be a -% \scratchdimen=\gettblaut\colTBL\relax % figure or so -% \ifdim\wd\scratchbox>\scratchdimen -% \settblaut\colTBL{\the\wd\scratchbox}% -% %\message{[forcing width of \colTBL\space(\the\wd\scratchbox/\the\hsize)]}% -% \fi -% \fi -% \fi -% \setbox2=\null -% \wd2=\wd\scratchbox \ht2=\ht\scratchbox \dp2=\dp\scratchbox -% \box2} - \long\def\dohandleTBLcellA#1#2[#3]#4% - {\setbox\scratchbox=\hbox + {\setbox\scratchbox\hbox {\setupTBLcell{#1}{#2}% \localframed [\@@tbl\@@tbl] [#3,\c!achtergrond=,\c!kader=\v!uit]% 25% faster - {\trialtypesettingtrue - \bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL\inTBLcell{#1}{#2}}}% - \scratchdimen=\gettblwid\colTBL\relax + {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL\inTBLcell{#1}{#2}}}% + \scratchdimen\gettblwid\colTBL\relax \ifdim\wd\scratchbox>\scratchdimen \settblwid\colTBL{\the\wd\scratchbox}% auto set \fi \let\rowTBLx\rowTBL\increment\rowTBLx - \scratchdimen=\gettblhei\rowTBLx\relax + \scratchdimen\gettblhei\rowTBLx\relax \ifdim\ht\scratchbox<\scratchdimen \settblhei\rowTBLx{\the\ht\scratchbox}% auto set \fi @@ -803,48 +814,52 @@ \ifautoTBLcheckwidth \ifdim\wd\scratchbox<.75\hsize \ifdim\ht\scratchbox>2\openlineheight % honor width since this can be a - \scratchdimen=\gettblaut\colTBL\relax % figure or so - \ifdim\wd\scratchbox>\scratchdimen + \scratchdimen\gettblaut\colTBL\relax % figure or so + \ifdim\scratchdimen=\zeropoint + % side effect: when width is set to 0pt, + % we can force a span that fits the sum of spans widths + \settblaut\colTBL{\the\scratchdimen}% + \else\ifdim\wd\scratchbox>\scratchdimen +% unless span \settblaut\colTBL{\the\wd\scratchbox}% % to be translated - \writestatus{TABLE}{no auto width in (\number#1,\number#2)\space\the\wd\scratchbox/\the\hsize}% - \fi + \writestatus\m!TABLE{no auto width in (\number#1,\number#2)\space\the\wd\scratchbox/\the\hsize}% + \fi\fi \fi \fi \fi - \setbox2=\null - \wd2=\wd\scratchbox \ht2=\ht\scratchbox \dp2=\dp\scratchbox + \setbox2\null + \wd2\wd\scratchbox \ht2\ht\scratchbox \dp2\dp\scratchbox \box2} \long\def\dohandleTBLcellBC#1#2#3[#4]#5% - {\setbox\scratchbox=\hbox + {\setbox\scratchbox\hbox {\setupTBLcell{#2}{#3}% \localframed [\@@tbl\@@tbl] [#4,#1,\c!kader=\v!uit,\c!achtergrond=] - {\trialtypesettingtrue - \bTBLCELL#5\eTBLCELL}}% - \setbox2=\null - \wd2=\wd\scratchbox \ht2=\ht\scratchbox \dp2=\dp\scratchbox + {\bTBLCELL#5\eTBLCELL}}% + \setbox2\null + \wd2\wd\scratchbox \ht2\ht\scratchbox \dp2\dp\scratchbox \ifautoTBLrowspan \let\rowTBLx\rowTBL\increment\rowTBLx - \scratchdimen=\gettblhei\rowTBLx\relax + \scratchdimen\gettblhei\rowTBLx\relax \ifnum\gettblrow\rowTBLx\colTBL>1 \ifdim\ht\scratchbox>\scratchdimen - \scratchdimen=-\scratchdimen \advance\scratchdimen by -\ht\scratchbox - \ht2=\scratchdimen + \scratchdimen-\scratchdimen \advance\scratchdimen -\ht\scratchbox + \ht2\scratchdimen \fi \fi \fi \box2 } \long\def\dohandleTBLcellB#1#2[#3]#4% - {\scratchdimen=\gettblaut\colTBL\relax + {\scratchdimen\gettblaut\colTBL\relax \ifdim\scratchdimen>\zeropoint\relax \let\tblwidthkey\c!breedte \edef\tblwidth{\the\scratchdimen}% \else - \scratchdimen=\gettblwid\colTBL\relax + \scratchdimen\gettblwid\colTBL\relax \ifdim\scratchdimen>\zeropoint\relax \ifnum\gettblcol{#1}{#2}=\maximumcol\relax - \scratchdimen=\hsize + \scratchdimen\hsize \fi \let\tblwidthkey\c!breedte \edef\tblwidth{\the\scratchdimen}% \else @@ -853,17 +868,18 @@ \fi \dohandleTBLcellBC{\tblwidthkey=\tblwidth}{#1}{#2}[#3]{\TBLcharalign{#2}{#4}}} -\long\def\dohandleTBLcellC% +\long\def\dohandleTBLcellC {\dohandleTBLcellBC{}} \long\def\dohandleTBLcellD#1#2[#3]#4% {\setupTBLcell{#1}{#2}% + \bgroup \localframed [\@@tbl\@@tbl] [#3,\c!breedte=\widthTBL, \c!achtergrond=,\c!kader=\v!uit]% 25% faster - {\trialtypesettingtrue - \bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL}} + {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL}% + \egroup} \long\def\dohandleTBLcellE#1#2[#3]#4% {\setupTBLcell{#1}{#2}% @@ -888,12 +904,14 @@ \c!kaderkleur=black, \c!kleur=, \c!letter=, -\c!kopletter=\v!vet, -\c!kopkleur=, + \c!kopletter=\v!vet, + \c!kopkleur=, \c!strut=\v!nee, \c!karakteruitlijnen=\v!nee, \c!uitlijnkarakter={,}, -\c!optie=, % \v!rek + \c!optie=, % \v!rek + \c!splitsen=\v!nee, + \c!tussenwit=, \c!maxbreedte=8em] %D We have already prepared the previous macros for nesting, @@ -917,23 +935,23 @@ %D New: -\def\pushTBLparameters% +\def\pushTBLparameters {\pushmacro\TBLlevel \ifcase\TBLpass % we're just after \bTABLE - \else\ifnum\TBLlevel>0 + \else\ifnum\TBLlevel>\zerocount \doglobal\increment\TBLlevel\relax \fi\fi} -\def\popTBLparameters% +\def\popTBLparameters {\popmacro\TBLlevel} -\def\pushTBL% - {\ifnum\TBLlevel=0 +\def\pushTBL + {\ifnum\TBLlevel=\zerocount \doglobal\increment\currenttbl\relax \fi \doglobal\increment\TBLlevel\relax - \ifnum\TBLlevel>1 + \ifnum\TBLlevel>\plusone \resetallTABLEparameters \pushmacro\colTBL \pushmacro\rowTBL @@ -941,8 +959,8 @@ \global\intabletrue \fi} -\def\popTBL% - {\ifnum\TBLlevel>1 +\def\popTBL + {\ifnum\TBLlevel>\plusone \popmacro\rowTBL \popmacro\colTBL \else @@ -953,7 +971,7 @@ \newconditional\resetTABLEmode \settrue\resetTABLEmode \def\resetallTABLEparameters% moet genest wel werken - {\ifnum\TBLlevel>1 % in ieder geval + {\ifnum\TBLlevel>\plusone % in ieder geval \ifconditional\resetTABLEmode \presetlocalframed % breedte hoogte diepte offset [\@@tbl\@@tbl]% % achtergrond, achtergrondraster, achtergrondkleur diff --git a/tex/context/base/core-num.tex b/tex/context/base/core-num.tex index bcab02ef6..d9618c720 100644 --- a/tex/context/base/core-num.tex +++ b/tex/context/base/core-num.tex @@ -37,7 +37,7 @@ {\@EA\let\@EA\savedstartnumber\csname\@@thenumber{#1}\c!start\endcsname \getparameters[\@@thenumber{#1}][\c!start=,#2]% \doifelsevaluenothing{\@@thenumber{#1}\c!start} - {\letvalue{\@@thenumber{#1}\c!start}=\savedstartnumber} + {\letvalue{\@@thenumber{#1}\c!start}\savedstartnumber} {\setcounter{\@@thenumber{#1}}{\getvalue{\@@thenumber{#1}\c!start}}}} \def\stelnummerin @@ -66,7 +66,7 @@ \makecounter{\@@thenumber{#1}}% \setcounter{\@@thenumber{#1}}{\getvalue{\@@thenumber{#1}\c!start}}} -\def\definieernummer% +\def\definieernummer {\dodoubleempty\dodefinieernummer} \def\setnummer[#1]#2% @@ -81,7 +81,7 @@ \def\doreset[#1]% {\processcommalist[#1]\dodoreset} -\def\reset% +\def\reset {\dosingleargument\doreset} %\def\verhoognummer[#1]% @@ -140,11 +140,11 @@ \def\dostelnummerenin[#1]% globaal {\getparameters[\??nr][#1]% - \doifelse{\@@nrstatus}{\v!start} + \doifelse\@@nrstatus\v!start {\global\nummerentrue} {\global\nummerenfalse}}% -\def\stelnummerenin% +\def\stelnummerenin {\dosingleargument\dostelnummerenin} \stelnummerenin diff --git a/tex/context/base/core-obj.tex b/tex/context/base/core-obj.tex index 5e88eefc5..346a292cb 100644 --- a/tex/context/base/core-obj.tex +++ b/tex/context/base/core-obj.tex @@ -210,10 +210,10 @@ \newif\ifobjectreferencing \objectreferencingtrue -\def\checkobjectreferences% +\def\checkobjectreferences {\startnointerference \protectlabels - \doutilities{objectreferences}\jobname\empty\empty\empty + \doutilities{objectreferences}\jobname\empty\relax\relax \global\let\checkobjectreferences\relax \stopnointerference} @@ -222,7 +222,7 @@ {\ifundefined{\r!driver##1::##2}% \setxvalue{\r!driver##1::##2}{##3}% \else - \showmessage{\m!references}{31}{[##1 ##2=>##3]}% + \showmessage\m!references{31}{[##1 ##2=>##3]}% \fi}} \def\resetobjectreferences @@ -234,7 +234,7 @@ {\checkobjectreferences \blabelgroup \ifobjectreferencing - \edef\dowritereference% why not immediate ? + \edef\dowritereference % why not immediate ? {\writeutilitycommand{\objectreference{#1}{#2}{#3}}}% \dowritereference \else @@ -249,7 +249,7 @@ {\checkobjectreferences \blabelgroup \ifundefined{\r!driver#1::#2}% - \showmessage{\m!references}{30}{[#1 #2=>\defaultobjectreference{#1}{#2}]}% + \showmessage\m!references{30}{[#1 #2=>\defaultobjectreference{#1}{#2}]}% \xdef#3{\defaultobjectreference{#1}{#2}}% \else \global\@EA\let\@EA#3\csname\r!driver#1::#2\endcsname diff --git a/tex/context/base/core-par.tex b/tex/context/base/core-par.tex index b67c1e4e1..0c68a1427 100644 --- a/tex/context/base/core-par.tex +++ b/tex/context/base/core-par.tex @@ -66,35 +66,35 @@ % voorlopig, wordt nog class -\def\resetparagraphlines% - {\global\linenumber=1\relax} +\def\resetparagraphlines + {\global\linenumber\plusone} -\def\numberparagraphs% instelbaar maken en slimmer ivm breedte regelnummer !!!!! +\def\numberparagraphs % instelbaar maken en slimmer ivm breedte regelnummer !!!!! {\processpreviousparagraphstrue - \def\dosetparagraph% + \def\dosetparagraph {\bgroup \resetparagraphlines \EveryPar {\strut\inleftmargin{\tf{\tx\paragraphnumber}\kern2em}% \ignorespaces}}% - \def\doresetparagraph% + \def\doresetparagraph {\resetparagraphlines \egroup}} -\def\numberparagraphlines% +\def\numberparagraphlines {\processpreviousparagraphstrue - \def\dosetparagraph% + \def\dosetparagraph {\resetparagraphlines}% - \def\doresetparagraph% + \def\doresetparagraph {\resetparagraphlines}% - \def\dobeforeparagraph% + \def\dobeforeparagraph {\startregelnummeren[\v!verder]}% - \def\doafterparagraph% + \def\doafterparagraph {\stopregelnummeren}% - \def\dobeforeskipparagraph% + \def\dobeforeskipparagraph {\stopregelnummeren - \let\paragraphnumber=\relax}% - \def\doafterskipparagraph% + \let\paragraphnumber\relax}% + \def\doafterskipparagraph {\startregelnummeren[\v!verder]}} \long\def\directpushparagraph#1% @@ -110,41 +110,40 @@ \setgvalue{\paragraphprefix\totalnofparagraphs}{\skipparagraph#1\par}} \def\dopushparagraphs#1% - {\global\let\mostrecentparagraphtotal=\totalnofparagraphs + {\global\let\mostrecentparagraphtotal\totalnofparagraphs \ifx#1\undefined - \let#1=\relax + \let#1\relax \fi \convertargument#1\to\asciiA - \convertargument{ }\to\asciiB % lege regel - \def\dopushparagraph##1\par% + \convertargument{ }\to\asciiB % lege regel + \def\dopushparagraph##1\par {\convertargument##1\to\asciiC - \doifelse{\asciiC}{\asciiA} - {\let\next=#1} - {\doifnot{\asciiC}{} % lege paragraaf - {\doifnot{\asciiC}{\asciiB} + \doifelse\asciiC\asciiA + {#1} + {\doifsomething\asciiC % lege paragraaf + {\doifnot\asciiC\asciiB {\directpushparagraph{#1}}}% - \let\next=\dopushparagraph}% - \next}% + \dopushparagraph}}% \dopushparagraph} -\def\pushparagraphs% +\def\pushparagraphs {\doglobal\newcounter\totalnofparagraphs \dopushparagraphs} -\def\pushmoreparagraphs% +\def\pushmoreparagraphs {\dopushparagraphs} \def\dododopopparagraph#1% no grouping, i.v.m. sidefloats {\ifnum#1>\totalnofparagraphs\relax \else - \let\paragraphnumber=\globalparagraphnumber + \let\paragraphnumber\globalparagraphnumber \decrement(\paragraphnumber,\discardedparagraphs)% \dobeforeparagraph \ifhmode\indentation\fi\getvalue{\paragraphprefix#1}\par \doafterparagraph \fi} -\long\def\skipparagraph#1\par% +\long\def\skipparagraph#1\par {\doglobal\increment\discardedparagraphs \ifprocessallparagraphs \dobeforeskipparagraph @@ -152,13 +151,13 @@ \doafterskipparagraph \fi} -\def\dodopopparagraph% +\def\dodopopparagraph {\dododopopparagraph} \def\dodoprocessparagraph#1% {\ifprocesspreviousparagraphs \bgroup - \setbox0=\vbox{\dododopopparagraph{#1}}% + \setbox0\vbox{\dododopopparagraph{#1}}% \egroup \fi} @@ -166,9 +165,9 @@ {\ifprocesspreviousparagraphs \bgroup \getfromcommacommand[#1][1]% tzt snelle \..command.. testen - \let\totalnofparagraphs=\commalistelement + \let\totalnofparagraphs\commalistelement \decrement\totalnofparagraphs - \let\dodopopparagraph=\dodoprocessparagraph + \let\dodopopparagraph\dodoprocessparagraph \popparagraphs \egroup \fi} @@ -181,10 +180,10 @@ \doifelse{#1}{} {\processallparagraphstrue} {\processallparagraphsfalse}% - \def\dopopparagraph% + \def\dopopparagraph {\doglobal\increment\globalparagraphnumber \ifnum\globalparagraphnumber>\totalnofparagraphs\relax - \let\dopopparagraph=\relax + \let\dopopparagraph\relax \else\ifprocessallparagraphs \ifnum\globalparagraphnumber>\mostrecentparagraphtotal\relax \dodopopparagraph\globalparagraphnumber @@ -192,7 +191,7 @@ \dodoprocessparagraph\globalparagraphnumber \fi \else - \let\paragraphnumber=\globalparagraphnumber + \let\paragraphnumber\globalparagraphnumber \decrement(\paragraphnumber,\discardedparagraphs)% \ExpandBothAfter\doifinsetelse{\paragraphnumber}{#1} {\dodopopparagraph\globalparagraphnumber} @@ -202,12 +201,12 @@ \dopopparagraph \doresetparagraph}} -\def\popparagraphs% +\def\popparagraphs {\dosingleempty\dopopparagraphs} -\def\countparagraphs% +\def\countparagraphs {\popparagraphs[\!!maxcard]% - \global\let\nofparagraphs=\totalnofparagraphs + \global\let\nofparagraphs\totalnofparagraphs \doglobal\decrement(\nofparagraphs,\discardedparagraphs)} % \showframe diff --git a/tex/context/base/core-pos.tex b/tex/context/base/core-pos.tex index 2351fe77d..9565febdc 100644 --- a/tex/context/base/core-pos.tex +++ b/tex/context/base/core-pos.tex @@ -11,11 +11,21 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% shorter tags, ..:achtergrond:.. etc in pos actions + +% class pos -> als gelijk aan vorige, dan niet niet definieren +% en erven, maw: +% +% 1 -> opslaan +% 2 -> undef, dus == prev +% 3 -> undef, dus == prev +% 4 -> opslaan + \writestatus{loading}{Context Positioning Support} % todo: topskip als optie voor eerste regel achtergrond - % todo: build pos layers on top of layers +% todo: positionlayer pos van text-1 etc delen %D Although \TEX\ has a rather powerful channel to the outside %D world, called \type {\special}, real communication with @@ -96,7 +106,7 @@ \let\pospxywhd \gobblesevenarguments \let\pospxyplus\gobbleeightarguments} -\def\setpositions% +\def\setpositions {\let\pospxy \setpospxy \let\pospxywhd \setpospxywhd \let\pospxyplus\setpospxyplus} @@ -142,21 +152,39 @@ \savecurrentvalue\totalnofpositions\currentpositions \to \everybye +%D The next switch can be used to communicate a special +%D situation. Positioning and associated actions can be +%D executed any time. However, in for instance backgrounds +%D they can be collected in a layer, for instance the text +%D layer (especially the hidden text layer). In the case of +%D floats, we run into problems, since the page information is +%D not applicable when the content floats indeed. In such +%D situations one can treat positions and graphics local. + +\newif\iflocalpositioning + +%D Watch out: sometimes a pagebreak occurs inside a float +%D placement, so there we need to disable local mode. + +\appendtoks \localpositioningtrue \to \everyinsidefloat +\appendtoks \localpositioningfalse \to \everypagebody + %D We save positionional information without dimensions, which %D saves some bytes. The conversion too saves some bytes, but %D is primarily needed because we want to pass those values to %D \METAPOST\ too. \def\dosetpositionpt#1#2% - {\scratchdimen=#2sp\xdef#1{\@EA\withoutpt\the\scratchdimen}} + {\scratchdimen#2\s!sp + \xdef#1{\@EA\withoutpt\the\scratchdimen}} \def\dosetpositionnm#1#2% {\xdef#1{\number#2}} -\def\checkpositions% +\def\checkpositions {\startnointerference \protectlabels - \doutilities{positions}{\jobname}{}{}{}% + \doutilities{positions}\jobname\empty\relax\relax \global\let\checkpositions\relax \stopnointerference} @@ -339,41 +367,99 @@ \fi \doglobal\increment\currentpositions} +% \def\setposition#1% +% {\initializenextposition +% \dosetposition{#1}% +% \dopositionaction{#1}} +% +% \def\setpositionbox#1% +% {\dowithnextbox +% {\hbox to \wd\nextbox +% {\initializenextposition +% \def\currentposition{#1}% +% \dosetpositionwhd \currentposition +% {\number\wd\nextbox}% +% {\number\ht\nextbox}% +% {\number\dp\nextbox}% +% \traceposstring\llap\green{\currentposition>}% +% \setbox\positionbox\box\nextbox +% \dopositionaction\currentposition +% \box\positionbox +% \hss}}} +% +% \def\setpositionplus#1#2% +% {\dowithnextbox +% {\hbox to \wd\nextbox +% {\initializenextposition +% \def\currentposition{#1}% +% \dosetpositionplus \currentposition +% {\number\wd\nextbox}% +% {\number\ht\nextbox}% +% {\number\dp\nextbox}% +% {#2}% +% \traceposstring\rlap\magenta{<\currentposition}% +% \setbox\positionbox\box\nextbox +% \dopositionaction\currentposition +% \box\positionbox +% \hss}}} + +\def\setpositiononly#1% + {\iftrialtypesetting + % nothing + \else + \initializenextposition + \def\currentposition{#1}% + \dosetposition\currentposition + \fi} + \def\setposition#1% - {\initializenextposition - \dosetposition{#1}% - \dopositionaction{#1}} + {\iftrialtypesetting + % nothing + \else + \initializenextposition + \def\currentposition{#1}% + \dosetposition\currentposition + \dopositionaction\currentposition + \fi} \def\setpositionbox#1% {\dowithnextbox - {\hbox to \wd\nextbox - {\initializenextposition - \def\currentposition{#1}% - \dosetpositionwhd - {\currentposition}% {#1}% - {\number\wd\nextbox}% - {\number\ht\nextbox}% - {\number\dp\nextbox}% - \setbox\positionbox=\box\nextbox - \dopositionaction\currentposition % {#1}% - \box\positionbox - \hss}}} + {\iftrialtypesetting + \box\nextbox + \else + \initializenextposition + \hbox to \wd\nextbox + {\def\currentposition{#1}% + \dosetpositionwhd\currentposition + {\number\wd\nextbox}% + {\number\ht\nextbox}% + {\number\dp\nextbox}% + \traceposstring\llap\green{\currentposition>}% + \setbox\positionbox\box\nextbox + \dopositionaction\currentposition + \box\positionbox + \hss}% + \fi}} \def\setpositionplus#1#2% {\dowithnextbox - {\hbox to \wd\nextbox - {\initializenextposition - \def\currentposition{#1}% - \dosetpositionplus - {\currentposition}% {#1}% - {\number\wd\nextbox}% - {\number\ht\nextbox}% - {\number\dp\nextbox}% - {#2}% - \setbox\positionbox=\box\nextbox - \dopositionaction\currentposition % {#1}% - \box\positionbox - \hss}}} + {\iftrialtypesetting + \box\nextbox + \else + \initializenextposition + \hbox to \wd\nextbox + {\def\currentposition{#1}% + \dosetpositionplus\currentposition + {\number\wd\nextbox}% + {\number\ht\nextbox}% + {\number\dp\nextbox}% + {#2}% + \traceposstring\rlap\magenta{<\currentposition}% + \setbox\positionbox\box\nextbox + \dopositionaction\currentposition + \box\positionbox + \hss}% + \fi}} \let\currentposition\s!unknown @@ -396,17 +482,30 @@ \let\cleanuppositionaction\gobbleoneargument +%D The next one will be overloaded later. + \def\dopositionaction#1% test saves hash entry in etex - {\doifdefined{\POSactionprefix#1::}% - {\bgroup - \the\everyinsertpositionaction - \the\everypositionaction - \getvalue{\POSactionprefix#1::}% - \cleanuppositionaction{#1}% - \egroup}} + {\ifundefined{\POSactionprefix#1::}\else + \ifnum\MPp{#1}>\zerocount % new + \bgroup + \traceposstring\clap\red{<#1>}% + \the\everyinsertpositionaction + \the\everypositionaction + \getvalue{\POSactionprefix#1::}% + \cleanuppositionaction{#1}% + \egroup + \else + % shouldn't happen too often + \traceposstring\clap\cyan{<#1>}% + \fi + \fi} \def\doifpositionaction#1% - {\doifdefined{\POSactionprefix#1::}} + {\ifundefined{\POSactionprefix#1::}% + \@EA\gobblefirstargument + \else + \@EA\firstofoneargument + \fi} %D We can copy a position with: %D @@ -420,8 +519,11 @@ {\bgroup \edef\to {\POSprefix#1}% \edef\from{\POSprefix#2}% - \doifdefined\from - {\global\@EA\@EA\@EA\let\@EA\csname\@EA\to\@EA\endcsname\csname\from\endcsname}% + %\doifdefined\from + % {\global\@EA\@EA\@EA\let\@EA\csname\@EA\to\@EA\endcsname\csname\from\endcsname}% + \ifundefined\from\else + \global\@EA\@EA\@EA\let\@EA\csname\@EA\to\@EA\endcsname\csname\from\endcsname + \fi \egroup} %D The fact that handling positions is a two pass operation, is @@ -464,68 +566,41 @@ %D Each macro takes an identifier as argument, and the \type %D {\hpos} and \type {\vpos} also expect box content. -\def\xypos{\initializenextposition\dosetposition} +% \def\xypos{\initializenextposition\dosetposition} + +\let\xypos\setpositiononly \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\lrpos#1#2% -% {\dontleavehmode\vadjust % may disappear if buried -% {\setbox0=\hbox{\raise\dp\strutbox\hbox{\hpos{#1}{\strut}}}% -% \smashbox0 -% \rlap{#2\box0}}} - \def\bpos#1{\hpos{b:#1}{\strut}\ignorespaces} \def\epos#1{\removelastspace\hpos{e:#1}{\strut}} \def\fpos#1% - {\setpositionplus{b:#1}{\parposcounter}\hbox{\strut}% + {\setpositionplus{b:#1}\parposcounter\hbox{\strut}% \ignorespaces} \def\tpos#1% {\removelastspace - \setpositionplus{e:#1}{\parposcounter}\hbox{\strut}} - -%\def\ffpos#1% -% {\setpositionbox{b:#1}\hbox{\strut}\wpos{#1}% -% \ignorespaces} -% -%\def\ttpos#1% -% {\removelastspace -% \setpositionbox{e:#1}\hbox{\strut}} + \setpositionplus{e:#1}\parposcounter\hbox{\strut}} \def\ffpos#1% - {\setpositionplus{b:#1}{\parposcounter}\hbox{\strut}\wpos{#1}% + {\setpositionplus{b:#1}\parposcounter\hbox{\strut}\wpos{#1}% \ignorespaces} \def\ttpos#1% {\removelastspace - \setpositionplus{e:#1}{\parposcounter}\hbox{\strut}} - -%\def\wpos#1% -% {\dontleavehmode\vadjust % may disappear if buried -% {\setbox0=\hbox{\raise\dp\strutbox\hbox{\hpos{w:#1} -% {\strut -% \hskip-\leftskip -% \hskip\hsize -% \hskip-\rightskip}}}% -% \smashbox0 -% \rlap{\box0}}} + \setpositionplus{e:#1}\parposcounter\hbox{\strut}} \def\wpos#1% {\dontleavehmode\vadjust % may disappear if buried {\setbox0\hbox{\raise\dp\strutbox\hbox{\rawwpos{#1}}}% - \smashbox0 - \rlap{\box0}}} + \rlap{\smashedbox0}}} -\def\wwpos#1% +\def\wwpos#1% \hsmashed{\llap{\rawwpos{#1}}} {\rlap {\setbox0\hbox{\rawwpos{#1}}% - \smashbox0 - \box0}} + \smashedbox0}} \def\rawwpos#1% {\hpos{w:#1} @@ -563,24 +638,22 @@ % we can check for used entries, and if not, then not add one -\def\registerparoptions% - {\ifpositioningpar - \ifpositioning - \ifinpagebody \else - \ifmmode \else - \ifinformula \else - \doregisterparoptions - \fi - \fi +\def\registerparoptions + {\ifpositioningpar \ifpositioning \iftrialtypesetting \else + \ifinpagebody \else \ifmmode \else \ifinformula \else + \ifprocessingverbatim + \iflinepar \doregisterparoptions \fi + \else + \doregisterparoptions \fi - \fi - \fi} + \fi \fi \fi + \fi \fi \fi} -\def\doregisterparoptions% +\def\doregisterparoptions {\doglobal\increment\parposcounter \bgroup - \leftskip =1\leftskip - \rightskip=1\rightskip + \leftskip 1\leftskip + \rightskip1\rightskip \setpositionplus {p:\parposcounter}% % identifier {\efficientdimen\hsize ,% 1 @@ -589,14 +662,27 @@ \efficientdimen\hangindent,% 4 \the\hangafter ,% 5 \efficientdimen\parindent }% 6 - \hbox{\strut\registerparsymbol}% - \egroup} - + % no strut here ! (see stepcharts and pascal) + \normalhbox{\registerparsymbol}% + \egroup} + \newif\iftracepositions +\def\traceposstring#1#2#3% + {\iftracepositions\smashedhbox{#1{\infofont#2#3}}\fi} + \def\registerparsymbol {\iftracepositions - \hbox to \zeropoint{\hss\blue\vrule\!!width4pt\!!height2pt\!!depth2pt\hss}% + \smashedhbox to \zeropoint + {\hss + \blue + \llap{\infofont\number\parposcounter}% + \scratchdimen\!!onepoint + \vrule + \!!width 4\scratchdimen + \!!height2\scratchdimen + \!!depth 2\scratchdimen + \hss}% \fi} \appendtoks \registerparoptions \to \everypar @@ -658,10 +744,10 @@ \def\dodoifpositionsonsamepageelse#1#2#3#4% {\bgroup - \scratchcounter=#1\donefalse + \scratchcounter#1\donefalse \def\docommando##1% {\ifcase\scratchcounter - \scratchcounter=\MPp{##1}\donetrue + \scratchcounter\MPp{##1}\donetrue \else \ifnum\scratchcounter=\MPp{##1}\relax\else\donefalse\fi \fi}% @@ -682,7 +768,7 @@ \def\textanchor{text:\realfolio} -\def\placepositionanchors% todo : depth pagebox +\def\placepositionanchors % todo : depth pagebox {\ifpositioning \setbox\scratchbox\vbox to \teksthoogte {\topskipcorrection @@ -690,6 +776,7 @@ \vfill \hbox{\strut\dopositionaction\tailanchor}}% \dp\scratchbox\zeropoint + \wd\scratchbox\zetbreedte % not \zeropoint, else wrong text backgrounds \hpos\textanchor{\box\scratchbox}% \else \vskip\teksthoogte @@ -825,10 +912,17 @@ \vfill}% \fi} +% \def\startpositionoverlay#1% +% {\def\currentpositionoverlay{#1}} + \def\startpositionoverlay#1% - {\def\currentpositionoverlay{#1}} + {\iftrialtypesetting % we don't want redundant entries in the list + \@EA\gobbleuntil\@EA\stoppositionoverlay + \else + \def\currentpositionoverlay{#1}% + \fi} -\def\stoppositionoverlay% +\def\stoppositionoverlay {\let\currentpositionoverlay\empty} \def\resetpositionoverlay#1% @@ -844,10 +938,26 @@ \newtoks\everycleanpositionaction \newtoks\everyinsertpositionaction -\def\cleanuppositionaction#1% - {\doifdefined{\POSactionprefix#1++} - {\the\everycleanpositionaction - \setxvalue{\POSactionprefix#1++}{\getvalue{\POSactionprefix#1++}}}} +%\def\cleanuppositionaction#1% +% {\doifdefined{\POSactionprefix#1++} +% {\the\everycleanpositionaction +% \setxvalue{\POSactionprefix#1++}{\getvalue{\POSactionprefix#1++}}}} + +%\def\cleanuppositionaction#1% +% {\ifundefined{\POSactionprefix#1++}\else +% \the\everycleanpositionaction +% \setxvalue{\POSactionprefix#1++}{\getvalue{\POSactionprefix#1++}}% +% \fi} + +\def\cleanuppositionaction#1% not in trialtypesetting + {\ifundefined{\POSactionprefix#1++}\else + \the\everycleanpositionaction + \iflocalpositioning + \letgvalue{\POSactionprefix#1++}\empty + \else + \setxvalue{\POSactionprefix#1++}{\getvalue{\POSactionprefix#1++}}% + \fi + \fi} \def\handlepositionaction#1\with#2\on#3% {\bgroup @@ -859,9 +969,15 @@ \edef\!!stringc{\POSactionprefix\!!stringa++}% \expanded{\dosetpositionaction{\!!stringa}{\noexpand\getvalue{\!!stringc}}}% \global\let#1\relax - \doifundefinedelse\!!stringc - {\let\!!stringb\empty} - {\edef\!!stringb{\getvalue\!!stringc}}% +% \doifundefinedelse\!!stringc +% {\let\!!stringb\empty} +% {\edef\!!stringb{\getvalue\!!stringc}}% +% \ifundefined\!!stringc +% \let\!!stringb\empty +% \else +% \edef\!!stringb{\getvalue\!!stringc}% +% \fi + \edef\!!stringb{\executeifdefined\!!stringc\empty}% \setxvalue\!!stringc{\!!stringb#1#2}% \egroup} @@ -898,31 +1014,84 @@ \newbox\positiongraphicbox -\def\startMPpositiongraphic% id setups +\def\startMPpositiongraphic % id setups {\dodoublegroupempty\dostartMPpositiongraphic} -\long\def\dostartMPpositiongraphic#1#2#3\stopMPpositiongraphic% +\long\def\dostartMPpositiongraphic#1#2#3\stopMPpositiongraphic {\long\setgvalue{MPG:#1}% tag list mpcode {\useMPpositiongraphic{#1}{#2}{#3}}} -\def\prepareMPpositionvariables% - {\doifundefined{\@@meta self}{\setvalue{\@@meta self}{\currentposition}}% - \doifundefined{\@@meta from}{\setvalue{\@@meta from}{\currentposition}}} +%\def\prepareMPpositionvariables +% {\doifundefined{\@@meta self}{\setvalue{\@@meta self}{\currentposition}}% +% \doifundefined{\@@meta from}{\setvalue{\@@meta from}{\currentposition}}} + +\def\prepareMPpositionvariables + {\ifundefined{\@@meta self}\setvalue{\@@meta self}{\currentposition}\fi + \ifundefined{\@@meta from}\setvalue{\@@meta from}{\currentposition}\fi} + +% \long\def\useMPpositiongraphic#1#2#3% +% {\bgroup +% \prepareMPvariables{#2}% +% \prepareMPpositionvariables +% \enableincludeMPgraphics +% \startMPgraphic#3\stopMPgraphic +% \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}% +% \deallocateMPslot\currentMPgraphic +% \placeMPgraphic +% \egroup} + +\newif\ifcollectMPpositiongraphics \long\def\useMPpositiongraphic#1#2#3% {\bgroup \prepareMPvariables{#2}% \prepareMPpositionvariables \enableincludeMPgraphics - \startMPgraphic#3\stopMPgraphic - \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}% - \deallocateMPslot\currentMPgraphic - \placeMPgraphic + \ifcollectMPpositiongraphics + \expanded{\startMPdrawing#3\noexpand\stopMPdrawing}% + \global\MPdrawingdonetrue + \else + \startMPgraphic#3\stopMPgraphic + \loadMPgraphic{\MPgraphicfile.\the\currentMPgraphic}{}% + \deallocateMPslot\currentMPgraphic + \placeMPgraphic + \fi \egroup} -\def\MPpositiongraphic% - {\dodoublegroupempty\doMPpositiongraphic} +% Now we need a adapted action handler: + +\def\dopositionaction#1% test saves hash entry in etex + {\ifundefined{\POSactionprefix#1::}\else + \ifnum\MPp{#1}>\zerocount % new + \bgroup + \traceposstring\clap\red{<#1>}% + \the\everyinsertpositionaction + \the\everypositionaction + \ifcollectMPpositiongraphics + % can save a lot of run time + \pushMPdrawing + \MPshiftdrawingtrue + \resetMPdrawing + \getvalue{\POSactionprefix#1::}% + \ifMPdrawingdone + \getMPdrawing + \fi + \resetMPdrawing + \popMPdrawing + \else + \getvalue{\POSactionprefix#1::}% + \fi + \cleanuppositionaction{#1}% + \egroup + \else + % shouldn't happen too often + \traceposstring\clap\cyan{<#1>}% + \fi + \fi} +\def\MPpositiongraphic + {\dodoublegroupempty\doMPpositiongraphic} + \def\doMPpositiongraphic#1#2% tag setups {\bgroup \def\@@meta{#1:}% @@ -930,10 +1099,10 @@ \prepareMPpositionvariables \MPshiftdrawingtrue \def\doMPpositiongraphic##1##2{\getvalue{MPG:##1}}% temp hack - \setbox\positiongraphicbox=\hbox - {\doifdefinedelse{MPM:#1} % method - {\ignorespaces\getvalue{MPM:#1}\removelastspace} - {\getvalue{MPG:#1}}}% + \setbox\positiongraphicbox\hbox + {\ignorespaces + \executeifdefined{MPM:#1}{\executeifdefined{MPG:#1}\donothing}% + \removelastspace}% \smashbox\positiongraphicbox \box\positiongraphicbox \egroup} @@ -943,7 +1112,7 @@ %D Simple one position graphics. -\def\setMPpositiongraphic% +\def\setMPpositiongraphic {\dotriplegroupempty\dosetMPpositiongraphic} \def\dosetMPpositiongraphic#1#2#3% pos tag vars @@ -989,13 +1158,32 @@ \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\relax \donetrue +% \else\ifnum\MPp{#2}=\realpageno\relax \donetrue +% \else\ifnum\MPp{#1}<\realpageno\relax\ifnum\MPp{#2}>\realpageno\donetrue +% \fi\fi\fi\fi \ifdone +% \def\currentposition{#1}\MPpositiongraphic{#3}{#4}% +% \fi} + \def\doinsertMPpositiongraphicrange#1#2#3#4% pos tag setups - {\donefalse - \ifnum\MPp{#1}=\realpageno\relax \donetrue - \else\ifnum\MPp{#2}=\realpageno\relax \donetrue - \else\ifnum\MPp{#1}<\realpageno\relax\ifnum\MPp{#2}>\realpageno\donetrue - \fi\fi\fi\fi \ifdone - \def\currentposition{#1}\MPpositiongraphic{#3}{#4}% + {\ifnum\MPp{#1}\MPp{#2}>\zerocount + \iflocalpositioning + \donetrue + \else + \donefalse + \ifnum\MPp{#1}=\realpageno + \donetrue + \else\ifnum\MPp{#2}=\realpageno + \donetrue + \else\ifnum\MPp{#1}<\realpageno\relax\ifnum\MPp{#2}>\realpageno + \donetrue + \fi\fi\fi\fi + \fi + \ifdone + \def\currentposition{#1}\MPpositiongraphic{#3}{#4}% + \fi \fi} \appendtoks @@ -1076,6 +1264,7 @@ gridtype=0, linetype=1, filltype=1, + %snaptops=true, % not that nice: true/false gridcolor=red, linecolor=blue, fillcolor=lightgray, @@ -1085,7 +1274,7 @@ lineradius=.5\bodyfontsize] \startuseMPgraphic{mpos:par:shape} - draw_par ; \iftracepositions show_par ; \fi + \iftracepositions show_par \else draw_par \fi ; \stopuseMPgraphic \startuseMPgraphic{mpos:par:setup} @@ -1099,6 +1288,12 @@ boxlinewidth := \MPvar{linewidth} ; boxgridwidth := \MPvar{gridwidth} ; boxlineradius := \MPvar{lineradius} ; + %snap_multi_par_tops := \MPvar{snaptops} ; +\stopuseMPgraphic + +\startuseMPgraphic{mpos:par:extra} + % user stuff, like: + % snap_multi_par_tops := false ; \stopuseMPgraphic % \startMPpositionmethod{mpos:par} @@ -1109,6 +1304,7 @@ % \MPpos{e:\MPvar{self}}, % \MPpos{w:\MPvar{self}}) ; % \includeMPgraphic{mpos:par:setup} ; +% \includeMPgraphic{mpos:par:extra} ; % \includeMPgraphic{\MPvar{mp}} ; % \includeMPgraphic{mpos:par:shape} ; % anchor_par(\MPanchor{b:\MPvar{self}}) ; % \stopMPpositiongraphic} @@ -1120,6 +1316,7 @@ % \MPpos{p:\MPparcounter}, % \MPvv {p:\MPparcounter}{0,0,0,0,0,0}) ; % \includeMPgraphic{mpos:par:setup} ; +% \includeMPgraphic{mpos:par:extra} ; % \includeMPgraphic{\MPvar{mp}} ; % \includeMPgraphic{mpos:par:shape} ; % anchor_par(\MPanchor{b:\MPvar{self}}) ; % \stopMPpositiongraphic}% @@ -1148,6 +1345,7 @@ \MPpos\MPeself, \MPpos\MPwself) ; \includeMPgraphic{mpos:par:setup} ; + \includeMPgraphic{mpos:par:extra} ; \includeMPgraphic{\MPvar{mp}} ; anchor_par(\MPanchor\MPbself) ; \stopMPpositiongraphic} @@ -1159,6 +1357,7 @@ \MPpos\MPparanchor, \MPvv \MPparanchor{0,0,0,0,0,0}) ; \includeMPgraphic{mpos:par:setup} ; + \includeMPgraphic{mpos:par:extra} ; \includeMPgraphic{\MPvar{mp}} ; anchor_par(\MPanchor\MPbself) ; \stopMPpositiongraphic}% @@ -1168,8 +1367,7 @@ %D The next alternative works in columnsets : \startuseMPgraphic{mpos:par:columnset} - draw_multi_pars ; - \iftracepositions show_multi_pars ; \fi + \iftracepositions show_multi_pars \else draw_multi_pars \fi ; \stopuseMPgraphic \startMPpositionmethod{mpos:par:columnset} @@ -1177,6 +1375,7 @@ \startMPpositiongraphic{mpos:par}% {fillcolor,filloffset,linecolor,gridcolor,linewidth,gridwidth,lineradius} \includeMPgraphic{mpos:par:setup} ; + \includeMPgraphic{mpos:par:extra} ; prepare_multi_pars(\MPpos\MPbself,\MPpos\MPeself,\MPpos\MPwself, \MPpos\MPparanchor,\MPvv\MPparanchor{0,0,0,0,0,0}) ; relocate_multipars(-\MPxy\MPanchorid) ; % inside layerpos @@ -1192,6 +1391,17 @@ %D methode=mpos:par:columnset] %D \stoptypen +%D We need to treat floats in a special way. + +\appendtoks + local_multi_par_area:=\iflocalpositioning true\else false\fi; +\to \MPinitializations + +\def\textbackgroundoverlay#1% + {\iflocalpositioning\v!lokaal\else\v!tekst\fi#1} + +%D So far for the trickery. + \newcounter\textbackgrounddepth \appendtoks @@ -1242,7 +1452,7 @@ \setuptextbackground[#1][#2]% \let\dodostarttextbackground\relax \let\dodostoptextbackground \relax - \doifvalue{\??td#1\c!status}{\v!start} + \doifvalue{\??td#1\c!status}\v!start {\dopresettextbackground{#1}}% \dodostarttextbackground} @@ -1253,24 +1463,24 @@ \let\dodostoptextbackground \dostoptextbackgroundtxt, \v!alinea=>\let\dodostarttextbackground\dostarttextbackgroundpar \let\dodostoptextbackground \dostoptextbackgroundpar]% - \ifnum\textbackgrounddepth>1 % new + \ifnum\textbackgrounddepth>\plusone % new \let\dodostarttextbackground\dostarttextbackgroundtxt \let\dodostoptextbackground \dostoptextbackgroundtxt \fi - \doifelsevalue{\??td#1\c!kader}{\v!aan} - {\doifelsevalue{\??td#1\c!hoek}{\v!rond} + \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} + \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}}% + %\startpositionoverlay{\v!tekst\getvalue{\??td#1\c!niveau}}% + \startpositionoverlay{\textbackgroundoverlay{\getvalue{\??td#1\c!niveau}}}% \expanded {\setMPpositiongraphicrange % moet veel efficienter {b:\currentparbackground}% {e:\currentparbackground}% -% {mpos:par}% {\getvalue{\??td#1\c!methode}}% {self=\currentparbackground, mp=\getvalue{\??td#1\c!mp}, @@ -1292,40 +1502,106 @@ \def\dostarttextbackgroundtxt {\ifvmode \leavevmode \fi - \dostartattributes{\??td\currenttextbackground}\c!letter\c!kleur{}% + \dostartattributes{\??td\currenttextbackground}\c!letter\c!kleur\empty \fpos\currentparbackground\ignorespaces} \def\dostoptextbackgroundtxt {\tpos\currentparbackground \dostopattributes} +% keep this simple one, it's used in prikkels and alike +% +% \def\dostarttextbackgroundpar +% {\endgraf % new +% \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 +% \seteffectivehsize +% \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 +% \endgraf % new +% \getvalue{\??td\currenttextbackground\c!na}} + \def\dostarttextbackgroundpar - {\getvalue{\??td\currenttextbackground\c!voor}% -% {\forgetall\noindent\fpos\currentparbackground}\ignorespaces - \noindent\fpos\currentparbackground\ignorespaces + {\endgraf % new + \getvalue{\??td\currenttextbackground\c!voor}% + \doassignsomeskip\getvalue{\??td\currenttextbackground\c!bovenoffset}\to\scratchskip + \xdef\textbackgroundskip{\the\scratchskip}% + \noindent + \ifgridsnapping + \ifdim\textbackgroundskip>\zeropoint + \struttedbox{\hbox{\raise\textbackgroundskip\hbox{\fpos\currentparbackground}}}% + \else + \fpos\currentparbackground + \fi + \else + \fpos\currentparbackground + \fi \bgroup \nobreak \vskip-\lineheight \nobreak \doassignsomeskip\getvalue{\??td\currenttextbackground\c!bovenoffset}\to\scratchskip - \kern\scratchskip\nobreak + \ifgridsnapping \else \ifdim\textbackgroundskip>\zeropoint + \kern\textbackgroundskip\nobreak + \fi \fi \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{}% + \dostartattributes{\??td\currenttextbackground}\c!letter\c!kleur\empty \geenwitruimte + \seteffectivehsize + \blanko[\v!blokkeer]% new \par} \def\dostoptextbackgroundpar {\par + \removelastskip % new \dostopattributes \doassignsomeskip\getvalue{\??td\currenttextbackground\c!onderoffset}\to\scratchskip - \kern\scratchskip\nobreak + \ifdim\lastskip>\zeropoint + \advance\scratchskip-\lastskip + \fi + \xdef\textbackgroundskip{\the\scratchskip}% + \ifgridsnapping \else \ifdim\textbackgroundskip>\zeropoint + \kern\scratchskip\nobreak + \fi \fi \nobreak \vskip-\lineheight \nobreak \geenwitruimte \egroup - \nobreak \noindent \strut \hfill \kern\zeropoint \tpos\currentparbackground +\bgroup \forgeteverypar % NOT REALLY NEEDED, SAVES HASH/MEM + \nobreak \noindent \strut \hfill \kern\zeropoint + \ifgridsnapping % experimental, pascal (todo: topoffset in same way) + \ifdim\textbackgroundskip>\zeropoint + \struttedbox{\hbox{\lower\textbackgroundskip\hbox{\tpos\currentparbackground}}}% + \else + \tpos\currentparbackground + \fi + \else + \tpos\currentparbackground + \fi +\egroup + \endgraf % new \getvalue{\??td\currenttextbackground\c!na}} + \let\textparpages \!!zeropoint \let\textparheight\!!zeropoint \let\textparwidth \!!zeropoint @@ -1354,11 +1630,11 @@ \ifcase\scratchcounter>2 \ifnum\scratchcounter<5 % more pages \scratchdimen\teksthoogte - \advance\scratchcounter -1 + \advance\scratchcounter \minusone \multiply\scratchdimen \scratchcounter \else % keep'm small - \scratchdimen=5\teksthoogte + \scratchdimen5\teksthoogte \fi \fi \fi \edef\textparheight{\the\scratchdimen}% @@ -1398,7 +1674,7 @@ \fi \fi} -\def\definetextbackground% +\def\definetextbackground {\dodoubleempty\dodefinetextbackground} \def\dodefinetextbackground[#1][#2]% @@ -1406,18 +1682,18 @@ \copyparameters[\??td#1][\??td] [\c!status,\c!plaats,\c!variant,\c!mp,\c!methode, \c!achtergrond,\c!achtergrondkleur,\c!hoek,\c!niveau, - \c!achtergrondoffset, + \c!achtergrondoffset,\c!voor,\c!na, \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}% + \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% +\def\setuptextbackground {\dodoubleargument\dosetuptextbackground} %\def\dosetuptextbackground[#1][#2]% @@ -1441,12 +1717,15 @@ \def\dodosetuptextbackground#1#2% {\getparameters[\??td#2][#1]% \def\currenttextbackground{#2}% - \doifvalue{\??td#2\c!status}{\v!start}{\checktextbackgrounds}} + \doifvalue{\??td#2\c!status}\v!start\checktextbackgrounds} \let\currenttextbackground\empty \def\checktextbackgrounds - {\ifproductionrun \enablehiddenbackground \fi} + {\ifproductionrun + \enabletextarearegistration + \enablehiddenbackground + \fi} \setuptextbackground [\c!mp=mpos:par:shape, @@ -1467,6 +1746,17 @@ \c!kader=\v!aan, \c!kaderkleur=blue, \c!lijndikte=\linewidth] + +%D As an example we define a grid background: + +\definetextbackground + [\v!grid] + [\c!status=\v!stop, + \c!plaats=\v!alinea, + \c!kader=\v!uit, + \c!kaderkleur=red, + \c!achtergrond=, + \c!variant=1] % lelijk, aanpassen, opties @@ -1517,7 +1807,6 @@ anchor_box(\MPanchor{\MPvar{self}}) ; \stopMPpositiongraphic - %D \macros %D {stackposdown, stackposup, stackposleft,stackposright} %D @@ -1588,20 +1877,21 @@ \ifrepositionmarginbox \doglobal\increment\currentmarginpos \setposition{\s!margin:\currentmarginpos}% - \scratchdimen=\MPy{\s!margin:\currentmarginpos}% + \scratchdimen\MPy{\s!margin:\currentmarginpos}% \doglobal\increment\currentmarginpos - \advance\scratchdimen by -\MPy{\s!margin:\currentmarginpos}% - \advance\scratchdimen by -\dp\strutbox + \advance\scratchdimen -\MPy{\s!margin:\currentmarginpos}% + \advance\scratchdimen -\dp\strutbox % new - \setbox#1=\hbox + \setbox#1\hbox {\hskip-\MPx{\s!margin:\currentmarginpos}% \hskip\MPx{head:\realfolio}% \box#1}% % so far - \setbox#1=\hbox - {\setposition{\s!margin:\currentmarginpos}\raise\scratchdimen\box#1}% - \dp#1=\zeropoint - \ht#1=\zeropoint + \setbox#1\hbox + {\setposition{\s!margin:\currentmarginpos}% + \raise\scratchdimen\box#1}% + \dp#1\zeropoint + \ht#1\zeropoint \fi \graphicvadjust{\box#1}% \egroup} @@ -1630,14 +1920,14 @@ % 0=notfound 1=found 2=currentpage \def\do@@amposition#1#2#3% - {\doifelsevalue{\??am#1\c!positie}{\v!ja} + {\doifelsevalue{\??am#1\c!positie}\v!ja {\doglobal\increment\currentamposition \doifnumberelse{#2} {\docheckrealreferencepage{#2}% - \global\chardef\currentamrealpage=\ifrealreferencepage2\else1\fi} + \global\chardef\currentamrealpage\ifrealreferencepage2\else1\fi} {\doifreferencefoundelse{#2} - {\global\chardef\currentamrealpage=\ifrealreferencepage2\else1\fi} - {\global\chardef\currentamrealpage=0}}% % not found + {\global\chardef\currentamrealpage\ifrealreferencepage2\else1\fi} + {\global\chardef\currentamrealpage0}}% % not found \expanded {\doglobal\noexpand\appendtoks #1_menu_button(\currentamposition,\the\currentamrealpage,\noexpand\MPpos{#1:\currentamposition}) ; @@ -1736,22 +2026,22 @@ \let\tabulatepos\tablepos -\def\tabulatenormalpos% +\def\tabulatenormalpos {\hss\tabulatepos\hss} -\def\tabulateequalpos% - {\setbox\scratchbox=\hbox{\tabulateEQ}% - \hbox to \wd\scratchbox{\hss\kern\!!zeropoint\tabulatepos\hss}% +\def\tabulateequalpos + {\setbox\scratchbox\hbox{\tabulateEQ}% + \hbox to \wd\scratchbox{\hss\kern\zeropoint\tabulatepos\hss}% \hskip-\wd\scratchbox \box\scratchbox} \def\tabulatenormalcolumn#1% overloaded {&\iftabulateequal\tabulateequalpos\else\tabulatenormalpos\fi - &\global\chardef\tabulatetype=#1&} + &\global\chardef\tabulatetype#1&} \def\tabulateequalcolumn#1% overloaded {&\tabulateequalpos - &\global\chardef\tabulatetype=#1&} + &\global\chardef\tabulatetype#1&} \appendtoks \doglobal\increment\noftabpositions @@ -1894,41 +2184,40 @@ \copyposition{e:#1}{e:#2}% \dosetpositionaction{b:#2}{\dopositionaction{b:#1}}} -\def\definepositionframed% +\def\definepositionframed {\dodoubleargument\dodefinepositionframed} \def\dodefinepositionframed[#1][#2]% {\dosetpositionaction{b:#1}{\dopositionframed[#1][#2]}} -\def\positionframed% +\def\positionframed {\dodoubleempty\dopositionframed} \def\dopositionframed[#1][#2]% {\bgroup - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\dimen0=\MPx{e:#1}% - \advance\dimen0 by -\MPx{b:#1}% + \advance\dimen0 -\MPx{b:#1}% \dimen2=\MPy{b:#1}% - \advance\dimen2 by -\MPy{e:#1}% - \advance\dimen2 by \MPd{e:#1}% + \advance\dimen2 -\MPy{e:#1}% + \advance\dimen2 \MPd{e:#1}% \lower\dimen2\hbox - {\advance\dimen2 by \MPh{b:#1}% + {\advance\dimen2 \MPh{b:#1}% \framed [\c!breedte=\dimen0,\c!hoogte=\dimen2, \c!offset=\v!overlay,#2]{}}}% - \smashbox\scratchbox - \box\scratchbox + \smashedbox\scratchbox \egroup} % \def\sethdistances#1% % {\hbox{\lpos{ml:#1}\hpos{mh:#1}{\strut}\rpos{mr:#1}}} % % \def\gethdistances#1% -% {\scratchdimen=\MPx{mh:#1}% -% \advance\scratchdimen by -\MPx{ml#1}% +% {\scratchdimen\MPx{mh:#1}% +% \advance\scratchdimen -\MPx{ml#1}% % \edef\lefthdistance{\the\scratchdimen}% -% \scratchdimen=\MPx{mr:#1}% -% \advance\scratchdimen by -\MPx{mh:#1}% +% \scratchdimen\MPx{mr:#1}% +% \advance\scratchdimen -\MPx{mh:#1}% % \edef\righthdistance{\the\scratchdimen}} \protect \endinput diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex index 5cd9b00d7..4546a927b 100644 --- a/tex/context/base/core-ref.tex +++ b/tex/context/base/core-ref.tex @@ -261,7 +261,7 @@ \def\dodowritereference#1#2#3\end#4#5#6% {\bgroup - \global\advance\crossreferencenumber 1 + \global\advance\crossreferencenumber \plusone\relax \if#1-\if#2:% \let\referenceprefix\empty \xdef\lastreference{#3}% @@ -404,23 +404,16 @@ \egroup \the\everycheckreferences} -% \def\usereferences[#1]% -% {\bgroup -% \checkreferences % Load job ones first! -% \setbox0=\hbox -% {\doonlyonce{references:#1}{\doutilities{references}{#1}{}{}{}}}% -% \egroup} - \def\usereferences[#1]% {\startnointerference \checkreferences \doifparentfileelse{#1} {\ifconditional\jobreferencesloaded\else - \doutilities{references}{#1}{}{}{}% + \doutilities{references}{#1}\empty\relax\relax \global\settrue\jobreferencesloaded \fi} {\ExpandBothAfter\doifnotinset{#1}{\loadedreferences} - {\doutilities{references}{#1}{}{}{}% + {\doutilities{references}{#1}\empty\relax\relax \ifx\fileprefix\empty\else \doglobal\addtocommalist{#1}\loadedreferences \fi}} @@ -2239,7 +2232,7 @@ \ifx\@@rfprefix\empty \let\referenceprefix\empty \else\ifx\@@rfprefix\incrementreferenceprefix - \advance\prefixcounter 1 % should be global + \advance\prefixcounter \plusone % should be global \edef\referenceprefix{\the\prefixcounter:}% \let\@@rfprefix\s!unknown \else\ifx\@@rfprefix\decrementreferenceprefix @@ -2589,6 +2582,7 @@ \def\dododododoinatreference#1#2[#3]% {\bgroup \forgetall +\postponefootnotes \leaveoutervmode \doifreferencefoundelse{#3} {\bgroup @@ -2649,11 +2643,14 @@ \def\donaar#1[#2]% {\dontleavehmode %\leaveoutervmode +\bgroup +\postponefootnotes \doifreferencefoundelse{#2} {\doifelsenothing{#1} {\dosymbolreference{}{}[#2]} {\donaarspace{#1}[#2]}} {\unknownreference{#2}#1\relax}% \relax catches lookahead +\egroup \referentieinfo{<}{#2}} \unexpanded\def\naar#1#2% @@ -3291,7 +3288,10 @@ {\global\utilitydonetrue %{Watch the braces here below!} \setglobalcrossreference{{##1::\@@filterblocknumberpart[##5]}}{}{##6}{##2}}% \def\usereferences[##1]% - {\setbox0=\vbox{\doutilities{#3}{##1}{#3}{}{}}}% + %{\setbox0\vbox{\doutilities{#3}{##1}{#3}\relax\relax}}% + {\startnointerference + \doutilities{#3}{##1}{#3}\relax\relax + \stopnointerference}% \dogebruikexterndocument[#1][#2][#4]% \doglobal\addtocommalist{#1}\crossdocumentreferences \def\docommando##1% @@ -3424,7 +3424,7 @@ %D The symbols are derived from the symbols linked to the %D entries. -\def\interactiebuttons% +\def\interactiebuttons {\dodoubleempty\dointeractiebuttons} \def\dointeractiebuttons[#1][#2]% er is een verdeel macro \fractie diff --git a/tex/context/base/core-reg.tex b/tex/context/base/core-reg.tex index 4f835faca..d90fc59d1 100644 --- a/tex/context/base/core-reg.tex +++ b/tex/context/base/core-reg.tex @@ -16,6 +16,7 @@ \newif \ifautoregisterhack % for the moment a private hack % new: eigennummer=ja => eerste {} ipv pag nummer + \unprotect %D Isolated but still indocumented. @@ -64,7 +65,7 @@ \fi \processcommalist[#1]\dodostelregisterin} -\def\stelregisterin% +\def\stelregisterin {\dotripleempty\dostelregisterin} \def\getlastregisterentry#1% @@ -75,11 +76,12 @@ \def\doprocesspageregister[#1]#2#3% key altnum entry {\begingroup - \thisisnextinternal{\s!ind}% + \thisisnextinternal\s!ind \ifduplicate\getlastregisterentry{#3}\fi \convertexpanded{\??id\currentregister}{#3}\asciiregisterentry \makesectionformat - \doifelsevalue{\??id\currentregister\c!eigennummer}{\v!ja}{\donetrue}{\donefalse}% + \doifelsevalue{\??id\currentregister\c!eigennummer}\v!ja + \donetrue\donefalse % the spaces between } { are essential for texutil's split \edef\schrijfwegnaarregister% {\writeutility% @@ -97,9 +99,9 @@ \endgroup} \def\doregister#1% - {\chardef\registerpagestatus=1 + {\chardef\registerpagestatus\plusone \def\currentregister{#1}% - \doifelsevalue{\??id\currentregister\c!eigennummer}{\v!ja} + \doifelsevalue{\??id\currentregister\c!eigennummer}\v!ja {\dosingleempty\dodoregister} {\dosingleempty\donoregister}} @@ -114,7 +116,7 @@ \def\writetoregister[#1]% to be documented {\doregister{#1}} -\def\startregister% +\def\startregister {\dodoubleargument\dostartregister} %\def\dostartregister[#1][#2]#3% @@ -124,12 +126,12 @@ % \complexdoregister[#2]{#3}} \def\dostartregister[#1][#2]#3% - {\chardef\registerpagestatus=2 + {\chardef\registerpagestatus2 \def\currentregister{#1}% \setgvalue{\??id#1\??id#2}{\dodostopregister[#1][#2]{#3}}% \donoregister[#2]{#3}} -\def\stopregister% +\def\stopregister {\dodoubleargument\dostopregister} \def\dostopregister[#1][#2]% @@ -141,13 +143,13 @@ % \complexdoregister[#2]} \def\dodostopregister[#1][#2]% - {\chardef\registerpagestatus=3 + {\chardef\registerpagestatus3 \def\currentregister{#1}% \donoregister[#2]} \def\complexdozieregister[#1]#2#3% {\begingroup - \thisisnextinternal{\s!ind}% + \thisisnextinternal\s!ind \ifduplicate\getlastregisterentry{#2}\fi \convertexpanded{\??id\currentregister}{#2}\asciiregisterentry \makesectionformat @@ -177,18 +179,19 @@ {\edef\currentregister{#1}% % om gebruik van \ExpandBothAfter \doprocesspageregister{}} % mogelijk te maken -\def\schrijfnaarregister% +\def\schrijfnaarregister {\dodoubleempty\doschrijfnaarregister} \def\ifregistergeplaatst{\ifutilitydone} \newif\iffirstregisterpage +\newif\iffirstregisterentry -\def\c!entrya{} -\def\c!entryb{} -\def\c!entryc{} +\let\c!entrya\empty +\let\c!entryb\empty +\let\c!entryc\empty -\def\nextregisterpage% +\def\nextregisterpage {\iffirstregisterpage \doglobal\newcounter\registerpagenumber \fi @@ -199,7 +202,7 @@ \hbox to 1em{\hss\doregisterpagehowto{#1}{#2}\hss}} \def\setregisterpage#1% - {\let\registerpageseparator=\empty + {\let\registerpageseparator\empty \processaction [\getvalue{\??id#1\c!symbool}] [ \c!n=>{\def\doregisterpage##1[##2]% @@ -239,24 +242,24 @@ \getvalue{\??id#1\c!paginacommando}{#2}% \dostopattributes} -\def\registerentry #1{\executeifdefined{#1\s!entry}\gobbleoneargument} -\def\registerentrya#1{\executeifdefined{#1\s!entrya}\gobbleoneargument} -\def\registerentryb#1{\executeifdefined{#1\s!entryb}\gobbleoneargument} -\def\registerentryc#1{\executeifdefined{#1\s!entryc}\gobbleoneargument} -\def\registersee #1{\executeifdefined{#1\s!see}\gobblethrearguments} -\def\registerpage #1{\executeifdefined{#1\s!page}\gobblefourarguments} -\def\registerfrom #1{\executeifdefined{#1\s!from}\gobblefourarguments} -\def\registerto #1{\executeifdefined{#1\s!to}\gobblefourarguments} +\def\registerentry #1{\executeifdefined{#1\s!entry }\gobbleoneargument } +\def\registerentrya#1{\executeifdefined{#1\s!entrya}\gobbleoneargument } +\def\registerentryb#1{\executeifdefined{#1\s!entryb}\gobbleoneargument } +\def\registerentryc#1{\executeifdefined{#1\s!entryc}\gobbleoneargument } +\def\registersee #1{\executeifdefined{#1\s!see }\gobblethrearguments} +\def\registerpage #1{\executeifdefined{#1\s!page }\gobblefourarguments} +\def\registerfrom #1{\executeifdefined{#1\s!from }\gobblefourarguments} +\def\registerto #1{\executeifdefined{#1\s!to }\gobblefourarguments} \def\doresetregister#1% - {\letvalue{#1\s!entrya}=\gobbleoneargument - \letvalue{#1\s!entryb}=\gobbleoneargument - \letvalue{#1\s!entryc}=\gobbleoneargument - \letvalue {#1\s!see}=\gobblethreearguments - \letvalue {#1\s!page}=\gobblefourarguments - \letvalue {#1\s!from}=\gobblefourarguments - \letvalue {#1\s!to}=\gobblefourarguments - \letvalue {#1\s!entry}=\gobbleoneargument} + {\letvalue{#1\s!entrya}\gobbleoneargument + \letvalue{#1\s!entryb}\gobbleoneargument + \letvalue{#1\s!entryc}\gobbleoneargument + \letvalue{#1\s!see }\gobblethreearguments + \letvalue{#1\s!page }\gobblefourarguments + \letvalue{#1\s!from }\gobblefourarguments + \letvalue{#1\s!to }\gobblefourarguments + \letvalue{#1\s!entry }\gobbleoneargument} \newif\iffirstsubentry \newif\iffirstsubsubentry @@ -287,7 +290,7 @@ \def\dohandleregisterentry##1% {\bgroup \if!!donea % \strut nieuw - \setbox0=\hbox{\showlocation{\doregistertexthowto{#2} + \setbox0\hbox{\showlocation{\doregistertexthowto{#2} {\strut\limitedregisterentry{#2}{##1}}}}% \gotonextinternal{\s!ind}{#4}{#6}{\box0}% \else @@ -296,19 +299,20 @@ \egroup \!!doneafalse}% \!!doneafalse - \doifelsevalue{\??id#2\c!interactie}{\v!tekst} + \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 + \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 + % \global\firstregisterentrytrue \iffirstregisterpage - \global\chardef\lastregisterpagestatus=0 + \global\chardef\lastregisterpagestatus\zerocount \expandafter\hskip\getvalue{\??id#2\c!afstand}\relax \donetrue \else\ifnum#1=3 @@ -322,15 +326,15 @@ \donetrue \fi\fi\fi \ifdone - \doifelsevalue{\??id#2\c!interactie}{\v!paginanummer} + \doifelsevalue{\??id#2\c!interactie}\v!paginanummer {\bgroup - \setbox0=\hbox + \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 + \global\chardef\lastregisterpagestatus#1\relax \fi \global\firstregisterpagefalse} @@ -344,85 +348,126 @@ {#1\ifcase\currententrylevel\s!entrya\or\s!entryb\else\s!entryc\fi}% {\doregisterpagehowto{#1}{\labeltexts{\v!zie}{#3}}}% \c!entryletter\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 - \global\chardef\lastregisterpagestatus=0 + \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 + \global\chardef\lastregisterpagestatus\zerocount + % \global\firstregisterentrytrue \global\firstregisterpagefalse}} {}} +%D Extended with variant: + +\def\doregistercharacter[#1]#2% + {\global\firstregisterentrytrue + \doifelsevalue{\??id#1\c!aanduiding}\v!ja + {\executeifdefined + {\strippedcsname\doregistercharacter\getvalue{\??id#1\c!variant}}% + \doregistercharactera + [#1]{#2}} + {\noregistercharacter[#1]{#2}}} + +\def\noregistercharacter[#1]#2% + {\getvalue{\??id#1\c!voor}% + \goodbreak} + +% a = <before> <goodbreak> <character> <par> <after> <nobreak> + +\def\doregistercharactera[#1]#2% + {\getvalue{\??id#1\c!voor}% + \vskip\lineheight\goodbreak\vskip-\lineheight + \ifhmode\unskip\else\noindent\fi % brrr + \getvalue{\??id#1\c!commando}% + {\doattributes{\??id#1}\c!letter\c!kleur{\strut\ignorespaces#2}}% + \getvalue{\??id#1\c!na}% + \par\nobreak} + +% b = <goodbreak> <before> <character> <after> <nobreak> + +\def\doregistercharacterb[#1]#2% here no lineheight hackery ! ! ! + {\getvalue{\??id#1\c!voor}% + \ifhmode\unskip\else\noindent\fi % brrr + \getvalue{\??id#1\c!commando}% + {\doattributes{\??id#1}\c!letter\c!kleur{\strut\ignorespaces#2}}% + \getvalue{\??id#1\c!na}% + \nobreak} + +%D Don't use \type{\string#2}; another hack isneeded, since +%D \type {#2} can be \type {\string} itself. + +\def\doregisterreference[#1]#2% + {\doifvalue{\??id#1\c!refereren}\v!aan + {\pagereference[#1:#2]}} + \def\dosetpageregisterletter#1#2% - {\gdef\c!entryreference% - {\global\let\c!entryreference=\relax - \doifvalue{\??id#1\c!refereren}{\v!aan} - {\pagereference[#1:#2]}}% - \gdef\c!entryletter% - {\global\let\c!entryletter=\relax - \global\utilitydonetrue - \getvalue{\??id#1\c!voor}% - \vskip\lineheight\goodbreak\vskip-\lineheight - \doifelsevalue{\??id#1\c!aanduiding}{\v!ja} - {\ifhmode\unskip\else\noindent\fi - \getvalue{\??id#1\c!commando}% % needed - {\doattributes{\??id#1}\c!letter\c!kleur{\strut\ignorespaces#2}}% - \getvalue{\??id#1\c!na}% - \par\nobreak} % don't use \string#2, other hack - {\goodbreak}}} % needed #2 can be \string... + {\gdef\c!entryreference + {\global\let\c!entryreference\relax + \doregisterreference[#1]{#2}}% + \gdef\c!entryletter + {\global\utilitydonetrue + \global\let\c!entryletter\relax + \doregistercharacter[#1]{#2}}} \def\dosetpageregisterentrya#1#2% {\edef\currententrylevel{1}% - \global\let\c!entryb=\relax - \global\let\c!entryc=\relax - \gdef\c!entrya% - {\global\firstregisterpagetrue - \endgraf + \global\let\c!entryb\relax + \global\let\c!entryc\relax + \gdef\c!entrya + {\iffirstregisterentry\else\endgraf\fi % new + \global\firstregisterpagetrue \hangindent1em\noindent\c!entryreference \dohandleregisterentry{#2}% + \global\firstregisterentryfalse \global\firstsubentrytrue \global\firstsubsubentrytrue}} \def\dosetpageregisterentryb#1#2% {\edef\currententrylevel{2}% - \global\let\c!entryc=\relax - \global\def\c!entryb% - {\global\firstregisterpagetrue - \global\let\c!entrya=\relax - \endgraf + \global\let\c!entryc\relax + \global\def\c!entryb + {\iffirstregisterentry\else\endgraf\fi % new + \global\firstregisterpagetrue + \global\let\c!entrya\relax \iffirstsubentry\nobreak\fi \hangindent2em\noindent\c!entryreference\hskip1em\relax \dohandleregisterentry{#2}% + \global\firstregisterentryfalse \global\firstsubentryfalse \global\firstsubsubentrytrue}} \def\dosetpageregisterentryc#1#2% {\edef\currententrylevel{3}% - \gdef\c!entryc% - {\global\firstregisterpagetrue - \global\let\c!entrya=\relax - \global\let\c!entryb=\relax - \endgraf + \gdef\c!entryc + {\iffirstregisterentry\else\endgraf\fi % new + \global\firstregisterpagetrue + \global\let\c!entrya\relax + \global\let\c!entryb\relax \iffirstsubsubentry\nobreak\fi \hangindent3em\noindent\c!entryreference\hskip2em\relax \dohandleregisterentry{#2}% + \global\firstregisterentryfalse \global\firstsubsubentryfalse}} \def\dosetpageregister#1% \currentregister gebruiken - {\dosetreglevel{\getvalue{\??id#1\c!criterium}}% + {\dosetreglevel{#1}% \global\let\currentregisterentry\empty \global\firstsubentrytrue \global\firstsubsubentrytrue \setregisterpage{#1}% - \chardef\lastregisterpagestatus=0 + \chardef\lastregisterpagestatus\zerocount \setvalue{#1\s!entrya}{\dosetpageregisterentrya {#1}}% \setvalue{#1\s!entryb}{\dosetpageregisterentryb {#1}}% \setvalue{#1\s!entryc}{\dosetpageregisterentryc {#1}}% - \setvalue {#1\s!page}{\dosetpageregisterpage{1}{#1}}% - \setvalue {#1\s!from}{\dosetpageregisterpage{2}{#1}}% - \setvalue {#1\s!to}{\dosetpageregisterpage{3}{#1}}% - \setvalue {#1\s!see}{\dosetpageregistersee {#1}}% - \setvalue {#1\s!entry}{\dosetpageregisterletter {#1}}} + \setvalue{#1\s!page }{\dosetpageregisterpage{1}{#1}}% + \setvalue{#1\s!from }{\dosetpageregisterpage{2}{#1}}% + \setvalue{#1\s!to }{\dosetpageregisterpage{3}{#1}}% + \setvalue{#1\s!see }{\dosetpageregistersee {#1}}% + \setvalue{#1\s!entry }{\dosetpageregisterletter {#1}}} + +\def\dosetreglevel#1% + {\dosetfilterlevel{\getvalue{\??id#1\c!criterium}}\empty} \def\getalllistreferences#1#2% {\doglobal\convertexpanded{\??id#1}{#2}\currentregisterentry @@ -435,7 +480,7 @@ \def\internallistreference{0}}} \def\dosetlinkregister#1% is die page reference echt nodig? - {\dosetreglevel{\getvalue{\??id#1\c!criterium}}% + {\dosetreglevel{#1}% \setregisterpage{#1}% \global\let\currentregisterentry\empty \global\firstsubentrytrue % not needed @@ -476,9 +521,9 @@ % aangepast \def\dodocommando[##1-##2]% {\gotonextinternal{\s!ind}{##1}{##2}{\box0}}% - \doifelsevalue{\??id#1\c!interactie}{\v!paginanummer} + \doifelsevalue{\??id#1\c!interactie}\v!paginanummer {\limitedregisterentry{#1}{#2}} % paginanummer - {{\setbox0=\hbox{\limitedregisterentry{#1}{\begstrut#2}}% + {{\setbox0\hbox{\limitedregisterentry{#1}{\begstrut#2}}% \ifx\firstlistreference\empty % tekst,alles \ifx\midlistreference\empty \box0 @@ -488,11 +533,11 @@ \else \expandafter\dodocommando\expandafter[\firstlistreference]% \fi}}% - \doifvalue{\??id#1\c!nummer}{\v!ja} + \doifvalue{\??id#1\c!nummer}\v!ja {\hskip\getvalue{\??id#1\c!afstand}(\commalistsize)}% \doifnotvalue{\??id#1\c!interactie}{\v!tekst} % paginanummer,alles {\def\docommando##1##2% - {{\setbox0=\hbox{\showlocation{\hbox to 1em{\hss\symbol[##2]\hss}}}% + {{\setbox0\hbox{\showlocation{\hbox to 1em{\hss\symbol[##2]\hss}}}% \ifx##1\empty % \hskip\wd0 % (optioneel maken) \else @@ -508,13 +553,8 @@ \limitedregisterentry{#1}{#2}% \fi} -%\def\dosetregister#1% -% {\doifelsevalue{\??id#1\c!koppeling}{\v!ja} -% {\dosetlinkregister{#1}} -% {\dosetpageregister{#1}}} - \def\dosetregister#1% - {\doifelsevalue{\??id#1\c!koppeling}{\v!ja} + {\doifelsevalue{\??id#1\c!koppeling}\v!ja {\ifautoregisterhack \dosetautoregister{#1}% \else @@ -525,7 +565,7 @@ \newcounter\internallistreference \def\doloadregisterlinks#1% - {\dosetreglevel{\getvalue{\??id#1\c!criterium}}% + {\dosetreglevel{#1}% \setregisterpage{#1}% \global\let\currentregisterentry\empty \global\firstregisterpagetrue @@ -570,9 +610,9 @@ {\iflocation \ifcase0\countervalue{autolink:#1}\relax % only once \begingroup - \let\dosetregister=\doloadregisterlinks + \let\dosetregister\doloadregisterlinks \stelregisterin[#1][#2]% - \doutilities{#1}{\jobname}{#1}{}{}% + \doutilities{#1}\jobname{#1}\relax\relax \endgroup \ifautoregisterhack \doinitializeautoregister{#1}% @@ -582,158 +622,9 @@ \fi \fi} -\def\koppelregister% +\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}% -% \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]}} -% -% better: - -% \def\dodocommandoprolinrefA[#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\dodocommandoprolinrefA[##1-##2]% -% {\def\lastlistreference{##1-##2}}% -% \else -% \def\selflistreference{#1-#2}% -% \fi\fi} -% -% more efficient : - \def\dodocommandoprolinrefAA[#1-#2]% {\def\lastlistreference{#1-#2}} @@ -762,51 +653,11 @@ \ifx#2\empty \doifvalue{\??id#1\c!onbekendeverwijzing}\v!leeg{\hskip1em}% \else - \setbox0=\hbox to 1em{\hss\showlocation{\symbol[#3]}\hss}% + \setbox0\hbox to 1em{\hss\showlocation{\symbol[#3]}\hss}% \expandafter\dodocommandoprolinrefB\expandafter[#2]% \fi \egroup} -%\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}% -% \ifx\alllistreferences\empty \else -% \expanded{\rawprocesscommalist[\alllistreferences]}\docommandoprolinrefA -% \fi -% \ifx\prevlistreference\empty -% \let\prevlistreference\lastlistreference -% \fi -% \ifx\nextlistreference\empty -% \let\nextlistreference\firstlistreference -% \fi -% \ifx\prevlistreference\selflistreference -% \let\prevlistreference\empty -% \let\nextlistreference\empty -% \fi -% % can be a bit faster is one proces only -% % can even be resolved at definition time -% \processaction -% [\getvalue{\??id#1\c!plaats}] -% [\v!midden=>\docommandoprolinrefB{#1}\prevlistreference\v!vorige, -% \v!links=>\docommandoprolinrefB{#1}\prevlistreference\v!vorige -% \docommandoprolinrefB{#1}\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=>\docommandoprolinrefB{#1}\nextlistreference\v!volgende, -% \v!rechts=>\docommandoprolinrefB{#1}\prevlistreference\v!vorige -% \docommandoprolinrefB{#1}\nextlistreference\v!volgende]}} - \def\doprocesslinkregister[#1][#2]#3% {\hbox {\doprocesspageregister[#2]{}{#3}% @@ -856,27 +707,9 @@ \docommandoprolinrefB{#1}\nextlistreference\v!volgende \fi}} -% \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 + \chardef\registerpagestatus\plusone \def\currentregister{#1}% \iflocation \ifautoregisterhack @@ -897,7 +730,7 @@ \def\dosetautoregister#1% {\makecounter{autolink:#1}% - \dosetreglevel{\getvalue{\??id#1\c!criterium}}% + \dosetreglevel{#1}% \setregisterpage{#1}% \global\let\currentregisterentry\empty \global\firstsubentrytrue % not needed @@ -919,7 +752,7 @@ %\setupinteraction[\c!kleur=,\c!contrastkleur=,\c!letter=]% kan sneller \resetinteractionparameter\c!kleur \resetinteractionparameter\c!contrastkleur - \resetinteractionparameter\c!letterkleur + \resetinteractionparameter\c!letter \naarbox {\limitedregisterentry{#1}{\begstrut#2}}% [JS(SetRegisterEntry{\v!register,\countervalue{autolink:#1},#2,{\alllistreferences}})]% @@ -929,21 +762,12 @@ \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}% \doifreferencefoundelse{\s!lin:\internallistreference} - {\gotosomeinternal - {\s!lin}{\internallistreference}{\currentrealreference} + {\gotosomeinternal \s!lin + {\internallistreference}{\currentrealreference} {\showlocation{\limitedregisterentry{#1}{#3}}}} {\hbox{\limitedregisterentry{#1}{#3}}}}} @@ -959,7 +783,7 @@ {\definefield[#1:\realfolio][line][\v!register]% \field[#1:\realfolio]} -\def\simpleregisterfield% +\def\simpleregisterfield {\complexregisterfield[\v!register]} \definecomplexorsimple\registerfield @@ -985,6 +809,15 @@ \def\doinitializelinkregister#1% {} +% todo ruwe register + +\def\plaatsregister + {\dosingleargument\doplaatsregister} + +\def\doplaatsregister[#1]% + {\def\currentregister{#1}% + \complexorsimpleempty\doplaatsregister} + \def\complexdoplaatsregister[#1]% {\begingroup \stelregisterin[\currentregister][#1]% @@ -995,18 +828,11 @@ \c!uitlijnen=\getvalue{\??id\currentregister\c!uitlijnen}]% \mindermeldingen \startopelkaar[\v!blanko]% - \doutilities{\currentregister}{\jobname}{\currentregister}{}{\par}% + \doutilities\currentregister\jobname\currentregister\relax\par \stopopelkaar \stopkolommen \endgroup} -\def\doplaatsregister[#1]% - {\def\currentregister{#1}% - \complexorsimpleempty\doplaatsregister} - -\def\plaatsregister% - {\dosingleargument\doplaatsregister} - \def\complexdovolledigregister[#1]% \@EA's kunnen weg {\@EA\plaatsvolledig\@EA{\@EA\systemsuppliedchapter\@EA}% \@EA{\@EA\currentregister\@EA}% @@ -1017,7 +843,7 @@ {\def\currentregister{#1}% \complexorsimpleempty\dovolledigregister} -\def\volledigregister% +\def\volledigregister {\dosingleargument\doplaatsregister} \def\dodefinieerregister[#1][#2]% @@ -1029,6 +855,7 @@ \c!na=, \c!symbool=, \c!interactie=\v!paginanummer, + \c!variant=\v!a, \c!afstand=1em, \c!letter=\v!vet, \c!paginaletter=\v!schuin, @@ -1065,14 +892,14 @@ \def\definieerregister% {\dodoubleargument\dodefinieerregister} -\def\registerlengte {\utilityregisterlength} +\def\registerlengte{\utilityregisterlength} -\def\utilityregisterlength {0} +\def\utilityregisterlength{0} \def\dobepaalregisterkenmerken[#1][#2]% {\begingroup \stelregisterin[#1][#2]% - \dosetreglevel{\getvalue{\??id#1\c!criterium}}% + \dosetreglevel{#1}% \setvalue{#1\s!from}% {\getvalue{#1\s!page}}% \setvalue{#1\s!page}##1##2##3##4% @@ -1081,8 +908,8 @@ \global\utilitydonetrue} {}}% \doglobal\newcounter\utilityregisterlength - \setbox0=\vbox - {\doutilities{#1}{\jobname}{#1}{}{}}% + \setbox0\vbox + {\doutilities{#1}\jobname{#1}\relax\relax}% \endgroup \ifregistergeplaatst \setsystemmode \v!register @@ -1126,6 +953,4 @@ % % \volledigeindex -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex index 81f6c822f..07a7b1f51 100644 --- a/tex/context/base/core-rul.tex +++ b/tex/context/base/core-rul.tex @@ -28,27 +28,27 @@ %D preset value of .4pt equals the default hard coded \TEX\ %D rule width. -\newdimen\linewidth +\newdimen\linewidth \def\dosetuplinewidth[#1]% {\assigndimension{#1}{\linewidth}{0.2pt}{0.4pt}{0.6pt}} -\def\setuplinewidth% +\def\setuplinewidth {\dosingleargument\dosetuplinewidth} % \def\dosetuprules[#1]% % {\getparameters[\??ln][#1]% % \setuplinewidth[\@@lndikte]} % -% \def\setuprules% +% \def\setuprules % {\dosingleargument\dosetuprules} %D \macros %D {ruledlinewidth, inheritruledlinewidth} %D -%D Inside framed boxed we will use a private dimensions. As -%D an option one can let the linewidth inherit its value from -%D this one. +%D Inside framed boxed we will use a private dimensions. As +%D an option one can let the linewidth inherit its value from +%D this one. \newdimen\ruledlinewidth \newif\ifinheritruledlinewidth @@ -120,13 +120,13 @@ \dimen10=\!!onepoint \dimen10=\@@rsfactor\dimen10 \dimen10=#5\dimen10 - \setbox2=\hbox to #2 + \setbox2\hbox to #2 {\cleaders\hbox to 2\dimen10{#1\hss}\hss}% \dimen12=#3% - \advance\dimen12 by #4% - \setbox0=\vbox to \dimen12 + \advance\dimen12 #4% + \setbox0\vbox to \dimen12 {\cleaders\vbox to 2\dimen10{\box2\vss}\vss}% - \setbox0=\hbox + \setbox0\hbox {\hskip-.5\dimen10\lower0.5\dimen10\copy0 \hskip-\wd0\hskip\dimen10\lower1.5\dimen10\box0}% \box0 @@ -202,19 +202,19 @@ \def\dofilledroundbox\width#1\height#2\depth#3\radius#4\\% {\ovalbox{#1}{#2}{#3}{\ruledlinewidth}{#4}\v!uit\v!aan} -\def\ovalbox#1#2#3#4#5#6#7% direct #1 etc passeren +\def\ovalbox#1#2#3#4#5#6#7% direct #1 etc passeren {\bgroup \scratchdimen#1\edef\ovalwid{\the\scratchdimen}% \scratchdimen#2\edef\ovalhei{\the\scratchdimen}% \scratchdimen#3\edef\ovaldep{\the\scratchdimen}% \scratchdimen#4\edef\ovallin{\the\scratchdimen}% \scratchdimen#5\edef\ovalrad{\the\scratchdimen}% - \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{#6}\v!aan % will be a macro that handles + {\let\ovalstr\!!plusone} % start, stop, ja, nee, aan, uit + {\let\ovalstr\!!zerocount}% % and something \doif \doifelse{#7}\v!aan - {\def\ovalfil{1}} - {\def\ovalfil{0}}% + {\let\ovalfil\!!plusone} + {\let\ovalfil\!!zerocount}% \doovalbox\ovalwid\ovalhei\ovaldep\ovallin\ovalrad\ovalstr\ovalfil \egroup} @@ -303,25 +303,25 @@ %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 +\def\overlaywidth {\the\hsize\space} % We preset the variables +\def\overlayheight {\the\vsize\space} % to some reasonable default \let\overlaydepth \!!zeropoint % values. The attributes \let\overlayoffset \!!zeropoint % of the frame can be (are) \let\overlaycolor \empty % set somewhere else. -\let\overlaylinewidth \!!zeropoint % +\let\overlaylinewidth \!!zeropoint % \let\overlaylinecolor \empty % -%D The next register is used to initialize overlays. +%D The next register is used to initialize overlays. \newtoks\everyoverlay %D An example of an initialization is the following (overlays %D can contain text and be executed under an regime where -%D interlineskip is off). +%D interlineskip is off). \appendtoks \oninterlineskip \to \everyoverlay -\def\defineoverlay% +\def\defineoverlay {\dodoubleargument\dodefineoverlay} \def\dodefineoverlay[#1][#2]% @@ -329,37 +329,6 @@ {\setvalue{\??ov##1}{\executedefinedoverlay##1\\#2\\}}% \processcommalist[#1]\docommando} -% \long\def\executedefinedoverlay#1\\#2\\#3#4#5#6#7#8#9% -% {\bgroup -% \scratchdimen=#3% -% \edef\overlaywidth{\the\scratchdimen\space}% -% \scratchdimen=#4% -% \advance\scratchdimen by #5% -% \edef\overlayheight{\the\scratchdimen\space}% -% \scratchdimen=#5% -% \edef\overlaydepth{\the\scratchdimen\space}% -% \edef\overlaycolor{#6}% -% \edef\overlayoffset{\backgroundoffset\space}% we steal this one -% \prependtoks -% \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}}% -% \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}% -% \wd0=\overlaywidth -% \ht0=\overlayheight -% \dp0=\overlaydepth -% \box0 -% \egroup} - \prependtoks \hsize\overlaywidth \vsize\overlayheight @@ -435,18 +404,13 @@ {\bgroup \def\currentbackground{#1}% \the\everybackgroundbox -% \setbox\extraframebox=\hbox -% {\executeifdefined{\??ov\currentbackground}\gobblesevenarguments -% {\dimen2}{\dimen4}{\dimen6}{#3}{#4}{#5}{#6}}% -% \setbox\extraframebox=\hbox -% {\vbox{\moveleft\dimen0\box\extraframebox}}% - \setbox\extraframebox=\hbox + \setbox\extraframebox\hbox {\vbox{\moveleft\dimen0\hbox {\executeifdefined{\??ov\currentbackground}\gobblesevenarguments {\dimen2}{\dimen4}{\dimen6}{#3}{#4}{#5}{#6}}}}% - \wd\extraframebox=\zeropoint % \backgroundwidth - \ht\extraframebox=\backgroundheight - \dp\extraframebox=\backgrounddepth + \wd\extraframebox\zeropoint % \backgroundwidth + \ht\extraframebox\backgroundheight + \dp\extraframebox\backgrounddepth \box\extraframebox % \hskip-\backgroundwidth \egroup} @@ -459,10 +423,10 @@ #6\radius#7\depth#8\\% {\vbox {\forgetall\boxmaxdepth\maxdimen - \dimen0=#5\relax - \dimen2=\wd#1\advance\dimen2 2\dimen0 - \dimen4=\ht#1\advance\dimen4 \dimen0 - \dimen6=\dp#1\advance\dimen6 \dimen0 + \dimen0 #5\relax % space needed + \dimen2\wd#1\advance\dimen2 2\dimen0 + \dimen4\ht#1\advance\dimen4 \dimen0 + \dimen6\dp#1\advance\dimen6 \dimen0 \advance\dimen6 #8\relax \edef\backgroundoffset{\the\dimen0}% \edef\backgroundwidth {\the\wd#1}% @@ -493,16 +457,16 @@ \def\dooutlinebox#1\color#2\offset#3\corner#4\radius#5\depth#6\toggle#7\\% {\vbox % rules on top of box - {\dimen0=#3\relax - \dimen2=\wd#1\advance\dimen2 2\dimen0 - \dimen4=\ht#1\advance\dimen4 \dimen0 - \dimen6=\dp#1\advance\dimen6 \dimen0\advance\dimen6 by #6\relax + {\dimen0 #3\relax % space needed + \dimen2\wd#1\advance\dimen2 2\dimen0 + \dimen4\ht#1\advance\dimen4 \dimen0 + \dimen6\dp#1\advance\dimen6 \dimen0\advance\dimen6 #6\relax \ifdim\dimen6<\zeropoint - \advance\dimen4 \dimen6 - \dimen8=-\dimen6 - \dimen6=\zeropoint + \advance\dimen4 \dimen6 + \dimen8-\dimen6 + \dimen6\zeropoint \else - \dimen8=\zeropoint + \dimen8\zeropoint \fi \setbox\extraframebox\hbox {\dostrokedbox\width\dimen2\height\dimen4\depth\dimen6% @@ -539,8 +503,9 @@ \def\dostrokedlinedbox\width#1\height#2\depth#3\toggle #4\left#5\right#6\top#7\bottom#8\\% {\bgroup - \setbox0=\null\wd0=#1\ht0=#2\dp0=#3% - \setbox2=\vbox + \setbox0\null + \wd0=#1\ht0=#2\dp0=#3% + \setbox2\vbox {\getvalue{t\@@frame@@#4#7}% \hbox {\getvalue{l\@@frame@@#4#5}% @@ -590,6 +555,7 @@ \newif\ifboxhasformat \newif\ifboxhasstrut \newif\ifboxisoverlaid +\newif\ifboxhasframe %D We also need a few \DIMENSIONS: @@ -636,7 +602,7 @@ {\copyparameters[#1][#3]% [\c!breedte,\c!hoogte,\c!offset,\c!leeg,\c!lijndikte,% \c!straal,\c!hoek,\c!diepte,\c!kader,\c!kaderkleur,% - \c!voorgrondletter,\c!voorgrondkleur,% + \c!voorgrondletter,\c!voorgrondkleur,\c!regels,% \c!bovenkader,\c!onderkader,\c!linkerkader,\c!rechterkader,% \c!lijndikte,\c!kaderoffset,\c!achtergrond,% \c!achtergrondoffset,\c!achtergrondraster,\c!achtergrondkleur,% @@ -646,7 +612,7 @@ \copyparameters[#1\c!kader][#1]% [\c!straal,\c!hoek,\c!diepte]} -\def\setupframed% +\def\setupframed {\dodoubleargument\getparameters[\??oi]} %D \macros @@ -679,61 +645,71 @@ %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 -%D Because it is used so often the he next macro is (and +%D +%D Because it is used so often the he next macro is (and %D looks) rather optimized. +\let\@@framed\s!unknown + +\def\framedparameter#1% + {\csname\@@framed#1\endcsname} + \def\startlocalframed[#1][#2]% {\bgroup \inframedtrue \edef\@@framed{#1}% % this piece of pre expansion is needed (sometimes used in frameoffset) - % \doifvaluesomething{\@@framed\c!lijndikte} % obsolete - % {\ruledlinewidth\getvalue{\@@framed\c!lijndikte}}% obsolete + % \doifvaluesomething{\@@framed\c!lijndikte} % obsolete + % {\ruledlinewidth\getvalue{\@@framed\c!lijndikte}}% obsolete % this piece of pre expansion is needed (sometimes used circular) - \scratchdimen\getvalue{\@@framed\c!kaderoffset}% + \scratchdimen\framedparameter\c!kaderoffset \setevalue{\@@framed\c!kaderoffset}{\the\scratchdimen}% \doifnotvalue{\@@framed\c!achtergrondoffset}\v!kader - {\scratchdimen\getvalue{\@@framed\c!achtergrondoffset}% + {\scratchdimen\framedparameter\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 ! \fi + % we need to register the (outer) color + \startregistercolor[\framedparameter\c!voorgrondkleur]% % to get the right spacing \doifvaluesomething{\@@framed\c!voorgrondletter} {\@EA\doconvertfont\csname\@@framed\c!voorgrondletter\endcsname\empty}% % beware, both the frame and background offset can be overruled % - % the next macros are visible - \edef\localoffset{\getvalue{\@@framed\c!offset }}% - \edef\localwidth {\getvalue{\@@framed\c!breedte }}% - \edef\localheight{\getvalue{\@@framed\c!hoogte }}% - \edef\localformat{\getvalue{\@@framed\c!uitlijnen}}% - \edef\localstrut {\getvalue{\@@framed\c!strut }}% - % these are not - \edef\@@localframing {\getvalue{\@@framed\c!kader }}% - \edef\@@locallocation{\getvalue{\@@framed\c!plaats}}% + % the next macros are visible + \edef\localoffset{\framedparameter\c!offset}% + \edef\localwidth {\framedparameter\c!breedte}% + \edef\localheight{\framedparameter\c!hoogte}% + \edef\localformat{\framedparameter\c!uitlijnen}% + \edef\localstrut {\framedparameter\c!strut}% + % these are not + \edef\@@localframing {\framedparameter\c!kader}% + \edef\@@locallocation{\framedparameter\c!plaats}% % - \ifx\@@localframing\v!overlay % no frame, no offset, no framewidth - \linewidth\zeropoint + \ifx\@@localframing\v!overlay % no frame, no offset, no framewidth + \boxhasframefalse \let\localoffset\v!overlay \else\ifx\@@localframing\v!geen % no frame, no framewidth - \linewidth\zeropoint - \else % \v!ja or \v!nee % if no frame then still framewidth + \boxhasframefalse + \else + \boxhasframetrue + \fi\fi + \ifboxhasframe \doifvaluesomething{\@@framed\c!lijndikte} - {\ruledlinewidth\getvalue{\@@framed\c!lijndikte}\relax + {\ruledlinewidth\framedparameter\c!lijndikte\relax \ifinheritruledlinewidth\linewidth\ruledlinewidth\fi}% - \fi\fi + \else + \ruledlinewidth\zeropoint + \fi \ifx\localformat\empty \boxhasformatfalse \else \boxhasformattrue \dosetraggedcommand\localformat - \edef\dobeforeframedbox{\raggedtopcommand\getvalue{\@@framed\c!boven}}% - \edef\doafterframedbox {\getvalue{\@@framed\c!onder}\raggedbottomcommand}% + \edef\dobeforeframedbox{\raggedtopcommand\framedparameter\c!boven}% + \edef\doafterframedbox {\framedparameter\c!onder\raggedbottomcommand}% \fi \ifx\localoffset\v!geen \boxhasoffsetfalse @@ -741,6 +717,7 @@ \boxisoverlaidfalse \@@localoffset\ruledlinewidth \else\ifx\localoffset\v!overlay + % \ifx\@@localframing\v!nee \boxhasframefalse \fi % test first \boxhasoffsetfalse \boxhasstrutfalse \boxisoverlaidtrue @@ -765,13 +742,20 @@ \else \boxhaswidthfalse \fi + \else\ifx\localwidth\v!vast % equals \v!ruim + \ifboxhasformat + \boxhaswidthtrue + \!!widtha\hsize + \else + \boxhaswidthfalse + \fi \else\ifx\localwidth\v!ruim \boxhaswidthtrue \!!widtha\hsize \else \boxhaswidthtrue \!!widtha\localwidth - \fi\fi + \fi\fi\fi \ifx\localheight\v!passend \boxhasheightfalse % no longer: \boxhasstrutfalse \else\ifx\localheight\v!ruim @@ -780,11 +764,21 @@ \boxhasheighttrue \!!heighta\localheight \fi\fi + \ifboxhasheight + % obey user set height, also downward compatible + \else + \doifvaluesomething{\@@framed\c!regels} + {\!!heighta\framedparameter\c!regels\lineheight + \edef\localheight{\the\!!heighta}% + \boxhasheighttrue}% + \fi + % this should be an option ! ! ! ! \ifdim\!!widtha=\hsize \parindent\zeropoint \setlocalhsize \!!widtha\localhsize \fi + % i.e. disable (colsetbackgroundproblemintechniek) \advance\!!widtha -2\@@localoffset \advance\!!heighta -2\@@localoffset \ifx\localstrut\v!nee @@ -800,8 +794,8 @@ \let\localendstrut\pseudoendstrut % was: \relax \let\localstrut \pseudostrut % was: \relax %\ifboxhasheight\ifdim\!!heighta<\ht\strutbox % saveguard - % \let\localbegstrut\relax % but not that - % \let\localstrut \relax % save afterall + % \let\localbegstrut\relax % but not that + % \let\localstrut \relax % save afterall %\fi\fi \fi \ifboxhasheight @@ -838,28 +832,28 @@ \let\next\doformatboxNoSize \fi \fi - \edef\framedwidth % a new feature, visible fo ruser + \edef\framedwidth % a new feature, visible for user {\ifdim\!!widtha >\zeropoint\the\!!widtha \else\zeropoint\fi}% - \edef\framedheight% a new feature, visible fo ruser + \edef\framedheight% a new feature, visible for user {\ifdim\!!heighta>\zeropoint\the\!!heighta\else\zeropoint\fi}% - % first alternative + % first alternative %\def\dowithframedbox% % {\let\postprocessframebox\undefined %new % \aftergroup\stoplocalframed}% % \afterassignment\dowithframedbox % \setbox\framebox=\next} - % second alternative - %\dowithnextbox + % second alternative + %\dowithnextbox % {\setbox\framebox=\box\nextbox % \let\postprocessframebox\undefined %new % \stoplocalframed} % \next} - % third alternative + % third alternative \afterassignment\dodowithframebox \setbox\framebox\next} \def\dowithframebox - {\let\postprocessframebox\undefined + {\let\postprocessframebox\undefined \stoplocalframed} \def\dodowithframebox @@ -885,15 +879,17 @@ \newif\ifreshapeframebox \reshapeframeboxtrue -\def\stoplocalframed% +\def\stoplocalframed {\dontshowcomposition \ifboxhasformat \ifx\localwidth\v!passend \ifreshapeframebox\doreshapeframedbox\fi \boxhaswidthfalse + \else\ifx\localwidth\v!vast + \boxhaswidthfalse \else \resetshapeframebox - \fi + \fi\fi \else \resetshapeframebox \fi @@ -905,8 +901,8 @@ \fi \doifvalue{\@@framed\c!leeg}\v!ja {\setbox\scratchbox\null - \wd\scratchbox\wd\framebox - \ht\scratchbox\ht\framebox + \wd\scratchbox\wd\framebox + \ht\scratchbox\ht\framebox \dp\scratchbox\dp\framebox \setbox\framebox\box\scratchbox}% \stopregistercolor @@ -920,22 +916,19 @@ \ifx\postprocessframebox\undefined \else \postprocessframebox\framebox \fi - \edef\overlaylinecolor{\getvalue{\@@framed\c!kaderkleur}}% + \edef\overlaylinecolor{\framedparameter\c!kaderkleur}% \edef\overlaylinewidth{\the\ruledlinewidth}% \@@... - \ifx\@@localframing\v!overlay - % rather tight, not even linewidth as offset, can be - % used with offset=0pt and auto strut - \else\ifx\@@localframing\v!geen - % idem - \else + \ifboxhasframe % real or invisible frame \doframedbox - \fi\fi + \fi \doifvaluesomething{\@@framed\c!achtergrond}\dobackedbox \ifx\@@locallocation\v!laag \doinlineframedbox \else\ifx\@@locallocation\v!diepte \doloweredframedbox - \fi\fi + \else\ifx\@@locallocation\v!hangend + \dohangingframedbox + \fi\fi\fi \box\framebox \egroup \egroup} @@ -947,7 +940,7 @@ \def\doinframed[#1]% we could omit #1] but readibility ... {\framed[\c!plaats=\v!laag,#1]} -\unexpanded\def\inframed% +\unexpanded\def\inframed {\dosingleempty\doinframed} %D When we set \type{\c!leeg} to \type{\v!ja}, we get @@ -957,12 +950,12 @@ %D Because color marks and specials can interfere with %D spacing, we provide a way to specify a foregroundcolor. -\def\docolorframebox% +\def\docolorframebox {\doifvaluesomething{\@@framed\c!voorgrondkleur} - {\doifcolorelse{\getvalue{\@@framed\c!voorgrondkleur}} - {\setbox\framebox=\hbox + {\doifcolorelse{\framedparameter\c!voorgrondkleur} + {\setbox\framebox\hbox {\localcolortrue - \color[\getvalue{\@@framed\c!voorgrondkleur}]{\box\framebox}}} + \color[\framedparameter\c!voorgrondkleur]{\box\framebox}}} {}}} %D \macros @@ -1054,10 +1047,10 @@ \fi \endgroup} -\def\mframed% +\def\mframed {\dodoubleempty\domframed[\donetrue]} -\def\inmframed% +\def\inmframed {\dodoubleempty\domframed[\donefalse]} %D So instead of the rather versatile \type {\framed}, we ue @@ -1126,7 +1119,7 @@ %D text. Each step is handled by separate macros. \def\dowidenframebox#1% - {\setbox\framebox=\vbox + {\setbox\framebox\vbox {\kern#1\hbox{\kern#1\box\framebox\kern#1}\kern#1}} \def\dooffsetframebox{\dowidenframebox\localoffset} @@ -1199,48 +1192,48 @@ %D additional offset capabilities. The lot of calls to other %D macros makes this mechanism not that easy to comprehend. -\def\doframedbox% - {\setbox\framebox=\vbox +\def\doframedbox + {\setbox\framebox\vbox {\dooutlinebox\framebox - \color \getvalue{\@@framed\c!kaderkleur}% - \offset \getvalue{\@@framed\c!kaderoffset}% - \corner \getvalue{\@@framed\c!kaderhoek}% - \radius \getvalue{\@@framed\c!kaderstraal}% - \depth \getvalue{\@@framed\c!kaderdiepte}% - \toggle \getvalue{\@@framed\c!kader}% - \left \getvalue{\@@framed\c!linkerkader}% - \right \getvalue{\@@framed\c!rechterkader}% - \top \getvalue{\@@framed\c!bovenkader}% - \bottom \getvalue{\@@framed\c!onderkader}\\}} + \color \framedparameter\c!kaderkleur + \offset \framedparameter\c!kaderoffset + \corner \framedparameter\c!kaderhoek + \radius \framedparameter\c!kaderstraal + \depth \framedparameter\c!kaderdiepte + \toggle \framedparameter\c!kader + \left \framedparameter\c!linkerkader + \right \framedparameter\c!rechterkader + \top \framedparameter\c!bovenkader + \bottom \framedparameter\c!onderkader\\}} %D Getting the backgrounds right takes less code. Again we %D have to take care of additional offsets. -\def\dobackedbox% - {\doifelsevalue{\@@framed\c!achtergrondoffset}{\v!kader} % new +\def\dobackedbox + {\doifelsevalue{\@@framed\c!achtergrondoffset}\v!kader % new {\dodobackedbox\c!kaderoffset} {\dodobackedbox\c!achtergrondoffset}} \def\dodobackedbox#1% - {\setbox\framebox=\vbox + {\setbox\framebox\vbox {\dobackgroundbox\framebox - \background \getvalue{\@@framed\c!achtergrond}% - \color \getvalue{\@@framed\c!achtergrondkleur}% - \raster \getvalue{\@@framed\c!achtergrondraster}% - \offset \getvalue{\@@framed#1}% - \corner \getvalue{\@@framed\c!achtergrondhoek}% - \radius \getvalue{\@@framed\c!achtergrondstraal}% - \depth \getvalue{\@@framed\c!achtergronddiepte}\\}} + \background \framedparameter\c!achtergrond + \color \framedparameter\c!achtergrondkleur + \raster \framedparameter\c!achtergrondraster + \offset \framedparameter{#1}% + \corner \framedparameter\c!achtergrondhoek + \radius \framedparameter\c!achtergrondstraal + \depth \framedparameter\c!achtergronddiepte\\}} %D We handle left, right or middle alignment as well as fixed %D or free widths and heights. Each combination gets its own %D macro. -\def\dopresetformatbox% +\def\dopresetformatbox {\forgetall \oninterlineskip} -\def\doformatboxSomeFormat% +\def\doformatboxSomeFormat {\vbox to \!!heighta \bgroup \dopresetformatbox @@ -1255,7 +1248,7 @@ \aftergroup\egroup \let\next=} -\def\doformatboxNoFormat% +\def\doformatboxNoFormat {\vbox to \!!heighta \bgroup \dopresetformatbox @@ -1270,7 +1263,7 @@ \aftergroup\egroup \let\next=} -\def\doformatboxHeight% +\def\doformatboxHeight {\vbox to \!!heighta \bgroup \dopresetformatbox @@ -1283,7 +1276,7 @@ \localbegstrut \let\next=} -% \def\doformatboxWidth% +% \def\doformatboxWidth % {\vbox % \bgroup % \dopresetformatbox @@ -1295,7 +1288,7 @@ % \aftergroup\egroup % \let\next=} -\def\doformatboxWidth% +\def\doformatboxWidth {\vbox \bgroup \dopresetformatbox @@ -1309,7 +1302,7 @@ \aftergroup\egroup \let\next=} -\def\doformatboxVSize% +\def\doformatboxVSize {\vbox to \!!heighta \bgroup \forgetall @@ -1324,7 +1317,7 @@ \localstrut \let\next=} -\def\doformatboxHSize% +\def\doformatboxHSize {\hbox to \!!widtha \bgroup \forgetall @@ -1335,7 +1328,7 @@ \aftergroup\egroup \let\next=} -\def\doformatboxNoSize% +\def\doformatboxNoSize {\hbox \bgroup \localstrut @@ -1348,7 +1341,7 @@ %D used \type {\showstruts}.} %D %D \startuitstellen -%D \bgroup +%D \bgroup %D \showstruts %D \mindermeldingen %D \startregelcorrectie @@ -1402,9 +1395,9 @@ \newcount\framednoflines \newdimen\framedlastlength -\def\resetshapeframebox% - {\framednoflines=0 - \framedlastlength=\zeropoint} +\def\resetshapeframebox + {\framednoflines\zerocount + \framedlastlength\zeropoint} % \def\doreshapeframedbox% % {\beginofshapebox @@ -1444,41 +1437,41 @@ % better depth preserving, else problems with framed display % math and auto width -\def\doreshapeframedbox% +\def\doreshapeframedbox {\beginofshapebox \unvcopy\framebox \endofshapebox - \global\@@globalwidth=\zeropoint + \global\@@globalwidth\zeropoint \resetshapeframebox \reshapebox - {\setbox0=\hbox + {\setbox0\hbox {\strut\ifhbox\shapebox\unhbox\else\box\fi\shapebox}% - \global\advance\framednoflines by 1 + \global\advance\framednoflines \plusone \ifdim\framedlastlength>\zeropoint\else - \global\framedlastlength=\wd0 + \global\framedlastlength\wd0 \fi \ifdim\wd0>\@@globalwidth - \global\@@globalwidth=\wd0 + \global\@@globalwidth\wd0 \fi}% - \dosetraggedcommand{\localformat}% + \dosetraggedcommand\localformat \raggedcommand \ifboxhasheight - \setbox\framebox=\vbox to \localheight + \setbox\framebox\vbox to \localheight {\hsize\@@globalwidth \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}% \dobeforeframedbox \innerflushshapebox \doafterframedbox}% \else - \scratchdimen=\dp\framebox - \setbox\framebox=\vbox to \ht\framebox + \scratchdimen\dp\framebox + \setbox\framebox\vbox to \ht\framebox {\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 - \ifcase\framednoflines\global\framednoflines=1\fi} + \ifdim\framedlastlength=\zeropoint\global\framednoflines\wd\framebox\fi + \ifcase\framednoflines\global\framednoflines\plusone\fi} %D The two variables \type {\framednoflines} and \type %D {\framedlastlength} can be used in a second pass to @@ -1532,9 +1525,9 @@ %D \egroup %D \stopbuffer %D -%D \haalbuffer \pagina +%D \haalbuffer \pagina %D -%D {\setupframed[diepte=4pt]\haalbuffer} \pagina +%D {\setupframed[diepte=4pt]\haalbuffer} \pagina %D %D \protect %D \egroup @@ -1543,24 +1536,11 @@ %D When typesetting the framed box inline, we have to keep the %D baseline intact outside as well as inside the framed box. -%\def\doinlineframedbox% -% {\getboxheight\dimen2\of\box\framebox -% \advance\dimen2 by -\ht\strutbox -% \dimen0=.5\dimen2 -% \ifboxhasoffset -% \advance\dimen0 by \getvalue{\@@framed\c!offset}% -% \fi -% \advance\dimen0 by 2\ruledlinewidth -% \setbox\framebox=\hbox{\lower\dimen0\box\framebox}% -% \ht\framebox\ht\strutbox -% \dp\framebox\dp\strutbox -% \box\framebox} - -\def\doinlineframedbox% +\def\doinlineframedbox {\scratchdimen\dp\strutbox \advance\scratchdimen \ruledlinewidth \ifboxhasoffset - \advance\scratchdimen \getvalue{\@@framed\c!offset}% + \advance\scratchdimen \framedparameter\c!offset \fi \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}% \ht\framebox\ht\strutbox @@ -1570,13 +1550,27 @@ %D We can also lower the box over the natural depth of the %D line. -\def\doloweredframedbox% +\def\doloweredframedbox {\getboxheight\scratchdimen\of\box\framebox \advance\scratchdimen -\dp\strutbox \ht\framebox\scratchdimen \dp\framebox\dp\strutbox \box\framebox} +%D Hanging the content is mainly meant for cases like the +%D following: +%D +%D \starttypen +%D \framed[strut=no] +%D {\framed[height=2cm,location=hanging]{test}% +%D \framed[height=1cm,location=hanging]{test}} +%D \stoptypen + +\def\dohangingframedbox % best with strut=no + {\getboxheight\scratchdimen\of\box\framebox + \ht\framebox\zeropoint + \dp\framebox\scratchdimen} + %D We can draw lines from left to right and top to bottom by %D using the normal \type{\hairline} command. Both directions %D need a different treatment. @@ -1597,12 +1591,12 @@ %D possible to the circumstances and act as natural as %D possible. -\def\vboxedhairline% +\def\vboxedhairline {\bgroup \dimen2=\ifboxhasoffset \localoffset \else \zeropoint \fi \dimen4=\dimen2 \advance\dimen4 \ruledlinewidth - \setbox0=\vbox + \setbox0\vbox {\advance\hsize 2\dimen4 \vskip\dimen2 \hrule @@ -1616,32 +1610,32 @@ \localbegstrut \egroup} -\def\hboxedhairline% +\def\hboxedhairline {\bgroup \dimen2=\ifboxhasoffset \localoffset \else \zeropoint \fi \ifboxhasheight - \dimen4=\localheight \divide\dimen4 by 2 + \dimen4=\localheight \divide\dimen4 2 \dimen6=\dimen4 - \advance\dimen4 \dp\strutbox - \advance\dimen6 -\dp\strutbox + \advance\dimen4 \dp\strutbox + \advance\dimen6 -\dp\strutbox \advance\dimen4 -2\ruledlinewidth - \advance\dimen6 2\ruledlinewidth + \advance\dimen6 2\ruledlinewidth \else - \dimen4=\ht\strutbox + \dimen4\ht\strutbox \advance\dimen4 \dimen2 - \dimen6=\dp\strutbox + \dimen6\dp\strutbox \advance\dimen6 \dimen2 \fi \unskip - \setbox0=\hbox + \setbox0\hbox {\hskip\dimen2 \vrule \!!height\dimen4 \!!depth\dimen6 \!!width\ruledlinewidth \hskip\dimen2}% - \ht0=\ht\strutbox - \dp0=\dp\strutbox + \ht0\ht\strutbox + \dp0\dp\strutbox \box0 \ignorespaces \egroup} @@ -1650,10 +1644,10 @@ %D sort of newline signal. In horizontal boxes it expands to a %D space. -\def\vboxednewline% +\def\vboxednewline {\endgraf\ignorespaces} -\def\hboxednewline% +\def\hboxednewline {\unskip\normalspace\ignorespaces} %D We can set each rule on or off. The default setting is @@ -1708,7 +1702,7 @@ %D %D \showsetup{\y!setupblackrules} -\def\setupblackrules% +\def\setupblackrules {\dodoubleargument\getparameters[\??bj]} %D \macros @@ -1736,7 +1730,7 @@ \localstopcolor \egroup} -\unexpanded\def\blackrule% +\unexpanded\def\blackrule {\dosingleempty\doblackrule} %D \macros @@ -1775,10 +1769,10 @@ \!!widthb\@@bjafstand \doif\@@bjvariant\c!b {\scratchcounter\@@bjn - \ifnum\scratchcounter=1 + \ifnum\scratchcounter=\plusone \!!widthb\zeropoint \else - \advance\scratchcounter -1 + \advance\scratchcounter \minusone \advance\!!widtha -\scratchcounter\!!widthb \divide \!!widtha \@@bjn \fi}% @@ -1802,13 +1796,13 @@ %D rather straightforward because we can use the commands that %D put text in the margin. -\def\dodrawmarginrule% - {\setbox0=\hbox +\def\dodrawmarginrule + {\setbox0\hbox {\vrule\!!depth\strutdepth\!!height\strutheight\!!width\@@kadikte}% - \smashbox0 % no \vsmash !!! - \box0} + \smashbox0 % no \vsmash !!! + \box0} -\def\drawmarginrule% +\def\drawmarginrule {\strut\inlinker{\dodrawmarginrule}} %D \macros @@ -1821,8 +1815,8 @@ \definecomplexorsimple\marginrule -\def\simplemarginrule% - {\let\processword=\drawmarginrule +\def\simplemarginrule + {\let\processword\drawmarginrule \processwords} \def\complexmarginrule[#1]% @@ -1859,22 +1853,22 @@ \def\simplestartmarginrule% {\bgroup - \let\drawmarginrule=\relax - \let\stopmarginrule=\dostopmarginrule + \let\drawmarginrule\relax + \let\stopmarginrule\dostopmarginrule \beginofshapebox} \def\complexstartmarginrule[#1]% {\bgroup - \let\drawmarginrule=\relax + \let\drawmarginrule\relax \ifnum#1<\@@kaniveau\relax - \let\stopmarginrule=\egroup + \let\stopmarginrule\egroup \else \def\@@kadefaultwidth{#1}% - \let\stopmarginrule=\dostopmarginrule + \let\stopmarginrule\dostopmarginrule \expandafter\beginofshapebox \fi} -\def\dostopmarginrule% +\def\dostopmarginrule {\endofshapebox \reshapebox {\hbox{\inleftmargin{\dodrawmarginrule}\box\shapebox}}% @@ -1930,13 +1924,13 @@ {\bgroup \dimen0=#1\ht\strutbox \dimen2=#1\dp\strutbox - \setbox0=\hbox + \setbox0\hbox {\vrule - \!!width\linewidth + \!!width \linewidth \!!height\dimen0 - \!!depth\dimen2}% - \dp0=\dp\strutbox - \ht0=\ht\strutbox + \!!depth \dimen2}% + \dp0\dp\strutbox + \ht0\ht\strutbox \box0 \egroup} @@ -1947,14 +1941,8 @@ \!!height\linewidth \!!depth\zeropoint}} -\def\simplevl% - {\complexvl[1]} - -\def\simplehl% - {\complexhl[1]} - -\definecomplexorsimple\vl -\definecomplexorsimple\hl +\definecomplexorsimple\vl \def\simplevl{\complexvl[1]} +\definecomplexorsimple\hl \def\simplehl{\complexhl[1]} %D \macros %D {hairline, thinrule, thinrules, setupthinrules} @@ -2037,43 +2025,43 @@ % \egroup % \strut} -\def\thinrule% +\def\thinrule {\strut \bgroup - \chardef\ruletype=1 + \chardef\ruletype\plusone \processaction [\@@dlvariant] - [ \v!a=>\chardef\ruletype=0,% no line - %\v!b=>\chardef\ruletype=1,% height/depth - \v!c=>\chardef\ruletype=2,% topheight/botdepth - % 11=>\chardef\ruletype=1,% fallback for backgrounds - 0=>\chardef\ruletype=0,% compatible with backgrounds - % 1=>\chardef\ruletype=1,% compatible with backgrounds - 2=>\chardef\ruletype=2]% compatible with backgrounds - \doifsomething{\@@dllijndikte} - {\linewidth=\@@dllijndikte}% + [ \v!a=>\chardef\ruletype0,% no line + %\v!b=>\chardef\ruletype1,% height/depth + \v!c=>\chardef\ruletype2,% topheight/botdepth + % 11=>\chardef\ruletype1,% fallback for backgrounds + 0=>\chardef\ruletype0,% compatible with backgrounds + % 1=>\chardef\ruletype1,% compatible with backgrounds + 2=>\chardef\ruletype2]% compatible with backgrounds + \doifsomething\@@dllijndikte + {\linewidth\@@dllijndikte}% \ifdim\linewidth=\zeropoint - \chardef\ruletype=0 + \chardef\ruletype\zerocount \else - \doifnot{\@@dlkader}{\v!aan}{\chardef\ruletype=0\relax}% + \doifnot\@@dlkader\v!aan{\chardef\ruletype=0\relax}% \fi - \ifnum\ruletype=1 - \doif{\@@dlhoogte}{\v!max}{\def\@@dlhoogte{1}}% - \doif{\@@dldiepte}{\v!max}{\def\@@dldiepte{1}}% + \ifnum\ruletype=\plusone + \doif\@@dlhoogte\v!max{\let\@@dlhoogte\!!plusone}% + \doif\@@dldiepte\v!max{\let\@@dldiepte\!!plusone}% \else - \def\@@dlhoogte{1}% - \def\@@dldiepte{1}% + \let\@@dlhoogte\!!plusone + \let\@@dldiepte\!!plusone \fi \freezedimensionwithunit\@@dlhoogte{\ht\strutbox}% \freezedimensionwithunit\@@dldiepte{\dp\strutbox}% \divide\linewidth 2 - \doifelse{\@@dlachtergrond}{\v!kleur} + \doifelse\@@dlachtergrond\v!kleur {\startcolor[\@@dlachtergrondkleur]% \dimen0=\@@dlhoogte \dimen2=\@@dldiepte \ifnum\ruletype=2 % prevent overshoot due to rounding - \advance\dimen0 by -.5\linewidth - \advance\dimen2 by -.5\linewidth + \advance\dimen0 -.5\linewidth + \advance\dimen2 -.5\linewidth \fi \leaders\hrule\!!height\dimen0\!!depth\dimen2\hfill \stopcolor @@ -2100,7 +2088,7 @@ \strut \carryoverpar\egroup} -\def\hairline% +\def\hairline {\endgraf \thinrule \endgraf} @@ -2108,7 +2096,7 @@ \def\dosetupthinrules[#1]% {\getparameters[\??dl][#1]} -\def\setupthinrules% +\def\setupthinrules {\dosingleargument\dosetupthinrules} % \def\dothinrules[#1]% @@ -2146,18 +2134,23 @@ {\bgroup \dosetupthinrules[#1]% \@@dlvoor - \assignvalue{\@@dlinterlinie}{\@@dlinterlinie}{1.0}{1.5}{2.0}% + \assignvalue\@@dlinterlinie\@@dlinterlinie{1.0}{1.5}{2.0}% \spacing\@@dlinterlinie - \dorecurse - {\@@dln} + \dorecurse\@@dln {\ifnum\recurselevel=\@@dln \dothinrulesnobreak \else \ifnum\recurselevel=2 \dothinrulesnobreak \fi\fi \thinrule - %\ifnum\recurselevel<\@@dln \endgraf \fi}% - \ifnum\recurselevel<\@@dln \endgraf \geenwitruimte \@@dltussen \fi}% -% \@@dlna -% \egroup} - \doifelsenothing{\@@dlna} + \ifnum\recurselevel<\@@dln\relax + % test needed, else messed up whitespace + \ifx\@@dltussen\empty + \softbreak + \else + \endgraf + \geenwitruimte + \@@dltussen + \fi + \fi}% + \doifelsenothing\@@dlna {\carryoverpar\egroup} {\@@dlna\egroup}} @@ -2182,47 +2175,47 @@ %D \stopbuffer %D %D \typebuffer {\haalbuffer} -%D +%D %D There are a couple of alternative ways to visualize rules %D using backgrounds. At first sight these may look strange, %D but they make sense in educational settings. The %D alternatives are more or less compatible with the more -%D advanced \METAPOST\ based implementation. -%D +%D advanced \METAPOST\ based implementation. +%D %D \startbuffer[a] %D \steldunnelijnenin %D [n=2, %D achtergrondkleur=grijs, %D lijndikte=1pt, -%D kleur=donkerblauw, +%D kleur=donkerblauw, %D na=\blanko, -%D voor=\blanko] +%D voor=\blanko] %D \stopbuffer -%D +%D %D \typebuffer[a] -%D +%D %D \startbuffer[b] -%D \dunnelijnen[variant=a] -%D \dunnelijnen[variant=b] -%D \dunnelijnen[variant=c] +%D \dunnelijnen[variant=a] +%D \dunnelijnen[variant=b] +%D \dunnelijnen[variant=c] %D \stopbuffer -%D +%D %D \typebuffer[b] \haalbuffer[a,b] -%D +%D %D \startbuffer[b] %D \dunnelijnen[variant=a,achtergrond=kleur] %D \dunnelijnen[variant=b,achtergrond=kleur] %D \dunnelijnen[variant=c,achtergrond=kleur] %D \stopbuffer -%D +%D %D \typebuffer[b] \haalbuffer[a,b] -%D +%D %D \startbuffer[b] -%D \dunnelijnen[variant=a,hoogte=.8,diepte=.8,achtergrond=kleur] -%D \dunnelijnen[variant=b,hoogte=.8,diepte=.8,achtergrond=kleur] -%D \dunnelijnen[variant=c,hoogte=.8,diepte=.8,achtergrond=kleur] +%D \dunnelijnen[variant=a,hoogte=.8,diepte=.8,achtergrond=kleur] +%D \dunnelijnen[variant=b,hoogte=.8,diepte=.8,achtergrond=kleur] +%D \dunnelijnen[variant=c,hoogte=.8,diepte=.8,achtergrond=kleur] %D \stopbuffer -%D +%D %D \typebuffer[b] \haalbuffer[a,b] %D \macros @@ -2233,7 +2226,7 @@ \newif\ifoptimizethinrules \optimizethinrulestrue -\def\dothinrulesnobreak% +\def\dothinrulesnobreak {\ifoptimizethinrules\penalty500\fi} %D \macros @@ -2379,106 +2372,30 @@ \getparameters[\??kd\v!framedtext][#1]% \fi} -\def\setupframedtexts% +\def\setupframedtexts {\dodoubleempty\dosetupframedtexts} -\def\dostartframedtext% +\def\dostartframedtext {\bgroup\dotripleempty\dodostartframedtext} \def\dodostartframedtext[#1][#2][#3]% -% {\doifinstringelse{=}{#2} {\doifassignmentelse{#2} {\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] -% [ \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 -% % % 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{}% -% \def\dostopframedtext{\dodostopframedtext{#1}{#2}}} - -% \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 -% % removed 06/2001 -% % \forgetparindent -% % added 06/2001 [see demo-bbv] -% \localhsize\hsize \checkframedtext -% % so far -% \setbox\framebox=\vbox -% \startboxedcontent -% \hsize\localhsize -% % \insidefloattrue % ? better -% \expanded{\switchtobodyfont[\getvalue{\??kd#1\c!korps}]}% -% \startcolor[\getvalue{\??kd#1\c!kleur}]% -% \localframed[\??kd#1][\c!strut=\v!nee,#3]% -% \bgroup -% \let\\=\endgraf -% \getvalue{\??kd#1\c!binnen}% -% \doifvalue{\??kd#1\c!dieptecorrectie}{\v!aan} % new, inside box -% {\bgroup -% \vbox{\strut} -% \vskip-\lineheight}% -% \blanko[\v!blokkeer]% plaatst signal -% \doconvertfont{\getvalue{\??kd#1\c!letter}}{}% -% \def\dostopframedtext{\dodostopframedtext{#1}{#2}}} +\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} \def\dododostartframedtext[#1][#2][#3]% {\doifsomething{#2}{\setvalue{\??kd#1\c!plaats}{#2}}% @@ -2498,7 +2415,7 @@ % added 06/2001 [see demo-bbv] \localhsize\hsize \checkframedtext % so far - \setbox\framebox=\vbox + \setbox\framebox\vbox \startboxedcontent \hsize\localhsize % \insidefloattrue % ? better @@ -2508,52 +2425,36 @@ \bgroup \let\\=\endgraf \getvalue{\??kd#1\c!binnen}% - \doifvalue{\??kd#1\c!dieptecorrectie}{\v!aan} % new, inside box + \doifvalue{\??kd#1\c!dieptecorrectie}\v!aan % new, inside box {\bgroup - \vbox{\strut} + \verticalstrut \vskip-\lineheight}% \blanko[\v!blokkeer]% plaatst signal - \doconvertfont{\getvalue{\??kd#1\c!letter}}{}% + \doconvertfont{\getvalue{\??kd#1\c!letter}}\empty \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\dodostopframedtext#1#2% -% {\endgraf -% \removelastskip -% \dostopattributes -% \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][]{\box\framebox}% -% \fi -% \egroup} - \def\dodostopframedtext#1#2% % no \baselinecorrection, see faq docs {\endgraf \removelastskip - \doifvalue{\??kd#1\c!dieptecorrectie}{\v!aan} % local and global + \doifvalue{\??kd#1\c!dieptecorrectie}\v!aan % local and global {\forgetall \vskip-\lineheight - \vbox{\strut} + \verticalstrut \egroup \forgetall \vskip-\lineheight -% will be an option -\setbaselinecorrections -\donegbotbaselinecorrection - \vbox{\strut}} + % will be an option + \setbaselinecorrections + \donegbotbaselinecorrection + \verticalstrut} \stopboxedcontent \stopcolor \egroup - \doif{#2}{\v!geen}{\insidefloattrue}% new + \doif{#2}\v!geen\insidefloattrue % new \ifinsidefloat \box\framebox \else @@ -2564,7 +2465,7 @@ %D The simple brace (or group) delimited case is typeset %D slightly different and is not aligned. -\def\doframedtext% +\def\doframedtext {\bgroup\dodoubleempty\dodoframedtext} \def\dodoframedtext[#1][#2]% @@ -2573,13 +2474,13 @@ \bgroup \blanko[\v!blokkeer]% \let\\=\endgraf - \getvalue{\??kd#1\c!binnen}% - \dostartattributes{\??kd#1}\c!letter\c!kleur{}% + \getvalue{\??kd#1\c!binnen}% % kleur naar outer level + \dostartattributes{\??kd#1}\c!letter\c!kleur\empty \bgroup \aftergroup\docloseframedtext \let\next=} -\def\docloseframedtext% +\def\docloseframedtext {\removelastskip \dostopattributes \egroup @@ -2592,7 +2493,7 @@ %D %D \showsetup{\y!defineframed} -\def\defineframed% +\def\defineframed {\dodoubleempty\dodefineframed} \def\dodefineframed[#1][#2]% @@ -2651,36 +2552,36 @@ %D The implementation looks a bit complicated due to the %D optional arguments. -\def\setuptextrules% +\def\setuptextrules {\dodoubleargument\getparameters[\??tl]} \def\complextextrule[#1]% {\processaction [#1] - [ \v!boven=>\let\next=\dotoptextrule, - \v!onder=>\let\next=\dobottomtextrule, - \s!default=>\let\next=\dobottomtextrule, - \s!unknown=>\let\next=\dobottomtextrule]% + [ \v!boven=>\let\next\dotoptextrule, + \v!onder=>\let\next\dobottomtextrule, + \s!default=>\let\next\dobottomtextrule, + \s!unknown=>\let\next\dobottomtextrule]% \dosinglegroupempty\next} \definecomplexorsimple\textrule -\def\simpletextrule% +\def\simpletextrule {\dosinglegroupempty\dounknowntextrule} \def\docomplextextrule#1% {\bgroup - \advance\hsize by -\rightskip - \advance\hsize by -\leftskip - \setbox\scratchbox=\hbox to \hsize + \advance\hsize -\rightskip + \advance\hsize -\leftskip + \setbox\scratchbox\hbox to \hsize {\dimen4=.5ex \dimen6=-.5ex - \advance\dimen4 by .5\linewidth - \advance\dimen6 by .5\linewidth + \advance\dimen4 .5\linewidth + \advance\dimen6 .5\linewidth \dimen8=\@@tlafstand - \doifnothing{#1}{\firstargumentfalse}% + \doifnothing{#1}\firstargumentfalse \iffirstargument - \doifelse{\@@tlplaats}{\v!inmarge}% + \doifelse\@@tlplaats\v!inmarge {\llap{\doattributes\??tl\c!letter\c!kleur{#1}\hskip\linkermargeafstand}} {\color[\@@tllijnkleur] {\vrule\!!height\dimen4\!!depth\dimen6\!!width\@@tlbreedte}% @@ -2689,16 +2590,16 @@ \fi \color[\@@tllijnkleur] {\leaders\hrule\!!height\dimen4\!!depth\dimen6\hfill}}% - \ht\scratchbox=\ht\strutbox - \dp\scratchbox=\dp\strutbox + \ht\scratchbox\ht\strutbox + \dp\scratchbox\dp\strutbox \noindent\box\scratchbox -%\nobreak\vbox{\strut}\kern-\lineheight +%\nobreak\verticalstrut\kern-\lineheight % evt \witruimte \egroup} \def\dotoptextrule#1% - {\pagina[\v!voorkeur] % interferes - %\witruimte % no + {\pagina[\v!voorkeur] % interferes + %\witruimte % no \@@tlvoor \docomplextextrule{#1}% \geenwitruimte @@ -2709,19 +2610,19 @@ {\ifhmode \endgraf \fi - \dimen0=\dp\strutbox + \dimen0\dp\strutbox \ifdim\prevdepth<\dp\strutbox \ifdim\prevdepth>\zeropoint - \advance\dimen0 by -\prevdepth + \advance\dimen0 -\prevdepth \fi \fi - \advance\dimen0 by .5ex + \advance\dimen0 .5ex \vskip\dimen0 \@@tltussen \doifelsenothing{#2} {\bgroup - \advance\hsize by -\rightskip - \advance\hsize by -\leftskip + \advance\hsize -\rightskip + \advance\hsize -\leftskip \nointerlineskip \moveleft-\leftskip\vbox {\color[\@@tllijnkleur] @@ -2732,15 +2633,15 @@ #1% \pagina[\v!voorkeur]} -\def\dobottomtextrule% +\def\dobottomtextrule {\dodobottomtextrule\@@tlna} -\def\domiddletextrule% +\def\domiddletextrule {\dodobottomtextrule\@@tltussen} -\def\dounknowntextrule% +\def\dounknowntextrule {\iffirstargument - \let\next=\dotoptextrule + \let\next\dotoptextrule \else \def\next{\dobottomtextrule{}}% \fi @@ -2753,9 +2654,9 @@ \def\dounknowntextrule{\domiddletextrule} \dotoptextrule{#1} \bgroup - \doifsomething{\@@tlkorps}{\switchtobodyfont[\@@tlkorps]}} + \doifsomething\@@tlkorps{\switchtobodyfont[\@@tlkorps]}} -\def\stoptextrule% +\def\stoptextrule {\par \egroup \dobottomtextrule{}% @@ -2784,7 +2685,7 @@ %D \showsetup{\y!fillinrules} %D \showsetup{\y!setupfillinrules} -\def\setupfillinrules% +\def\setupfillinrules {\dodoubleargument\getparameters[\??il]} \definecomplexorsimpleempty\fillinrules @@ -2801,10 +2702,10 @@ \begingroup \setupfillinrules[#1]% \noindent - \doifelse{\@@ilbreedte}{\v!passend} - {\let\@@ilafstand=\!!zeropoint + \doifelse\@@ilbreedte\v!passend + {\let\@@ilafstand\!!zeropoint \hbox} - {\doifelse{\@@ilbreedte}{\v!ruim} + {\doifelse\@@ilbreedte\v!ruim {\hbox} {\hbox to \@@ilbreedte}} \bgroup @@ -2866,7 +2767,7 @@ %D \showsetup{\y!fillinline} %D \showsetup{\y!setupfillinlines} -\def\setupfillinlines% +\def\setupfillinlines {\dodoubleargument\getparameters[\??iv]} \definecomplexorsimpleempty\fillinline @@ -2876,19 +2777,19 @@ \@@ivvoor \begingroup \setupfillinlines[#1]% - \advance\rightskip by \@@ivmarge + \advance\rightskip \@@ivmarge \parfillskip\zeropoint - \def\par % very dangerous - {\let\par\endgraf % -) + \def\par % very dangerous + {\let\par\endgraf % -) \unskip\hfill \dimen0=\@@ivbreedte - \advance\dimen0 by -\@@ivafstand + \advance\dimen0 -\@@ivafstand \ifdim\dimen0>\@@ivmarge\else\expandafter\rlap\fi {\kern\@@ivafstand \vrule - \!!width\dimen0 + \!!width \dimen0 \!!height.5\linewidth - \!!depth.5\linewidth}% + \!!depth .5\linewidth}% \endgraf % ! \endgroup \endgraf % ! @@ -2939,15 +2840,15 @@ \def\dosetupbackground[#1]% {\getparameters[\??ag][#1]% - \doifelse{\@@agstatus}{\v!start} - {\let\startbackground=\dostartbackground - \let\stopbackground =\dostopbackground - \let\background =\dobackground} - {\let\startbackground=\relax - \let\stopbackground =\relax - \let\background =\relax}} - -\def\setupbackground% + \doifelse\@@agstatus\v!start + {\let\startbackground\dostartbackground + \let\stopbackground \dostopbackground + \let\background \dobackground} + {\let\startbackground\relax + \let\stopbackground \relax + \let\background \relax}} + +\def\setupbackground {\dosingleargument\dosetupbackground} %D Actually typesetting the background is implemented rather @@ -2965,14 +2866,14 @@ %D construction gives the first real line a decent height by %D adding a dummy line. -\def\dostartbackground% +\def\dostartbackground {\endgraf \bgroup - \setbox0=\vbox\bgroup - \vbox to \lineheight{}\vskip\zeropoint - \blanko[\v!blokkeer] - \advance\hsize by -\@@aglinkeroffset - \advance\hsize by -\@@agrechteroffset} + \setbox0\vbox\bgroup + \vbox to \lineheight{}\vskip\zeropoint + \blanko[\v!blokkeer] + \advance\hsize -\@@aglinkeroffset + \advance\hsize -\@@agrechteroffset} %D This dummy line is removed by \type{\setbox2=\vsplit0 to %D \lineheight}. That way \type{\topskip} takes care of the @@ -2984,30 +2885,30 @@ \removelastskip \egroup \forgetall - \splitmaxdepth=\boxmaxdepth - \splittopskip=\topskip - \setbox2=\vsplit0 to \lineheight % get rid of fake line + \splitmaxdepth\boxmaxdepth + \splittopskip\topskip + \setbox2\vsplit0 to \lineheight % get rid of fake line \loop \ifdim\pagetotal=\zeropoint % empty page - \scratchdimen=\teksthoogte - \chardef\backgroundsplit=1 % split to max height + \scratchdimen\teksthoogte + \chardef\backgroundsplit1 % split to max height \else - \scratchdimen=\pagegoal - \setbox\scratchbox=\vbox{\@@agvoor}% + \scratchdimen\pagegoal + \setbox\scratchbox\vbox{\@@agvoor}% \advance\scratchdimen -\ht\scratchbox \advance\scratchdimen -\pagetotal - \chardef\backgroundsplit=2 % split to partial height + \chardef\backgroundsplit2 % 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 - \setbox2=\vsplit0 to \scratchdimen + \setbox2\vsplit0 to \scratchdimen \else - \setbox2=\box0 - \chardef\backgroundsplit=0 % no split + \setbox2\box0 + \chardef\backgroundsplit0 % 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 @@ -3043,19 +2944,146 @@ %D %D \showsetup{\y!background} -\def\dobackground% +\def\dobackground {\bgroup \dowithnextbox - {\localframed - [\??ag][\c!offset=\v!overlay] - {\box\nextbox}% - \egroup} + {\localframed[\??ag][\c!offset=\v!overlay]{\box\nextbox}\egroup} \vbox} %D \stopdocumentation %D \stopachtergrond %D \egroup +%D New, for the moment private; let's see when GB finds out +%D about this one and its obscure usage. It's used in: +%D +%D \startbuffer +%D \defineframedtext +%D [tabulateframe] +%D [offset=overlay, +%D backgroundoffset=3pt, +%D background=color, +%D backgroundcolor=green] +%D +%D \setuptabulate +%D [tabulate] +%D [frame=tabulateframe] +%D +%D \setuptables +%D [frame=tabulateframe] +%D +%D \input tufte +%D +%D \starttabulate[|l|l|] +%D \NC test \NC test \NC \NR \NC test \NC test \NC \NR +%D \NC test \NC test \NC \NR \NC test \NC test \NC \NR +%D \stoptabulate +%D +%D \input tufte +%D +%D \starttable[|l|l|] +%D \NC test \NC test \NC \AR \NC test \NC test \NC \AR +%D \NC test \NC test \NC \AR \NC test \NC test \NC \AR +%D \stoptable +%D \stopbuffer +%D +%D \typebuffer + +% test this on demo-bbv/demo-bbi ! +% +% \def\startframedcontent[#1]% +% {\bgroup +% \doifelse{#1}\v!uit +% {\let\stopframedcontent\egroup} +% {\doifdefinedelse{\??kd#1\c!kader} +% {\doifelsevalue{\??kd#1\c!regelcorrectie}\v!ja +% {\ifinsidefloat % binnen \stopframedcontent +% \def\stopframedcontent +% {\framedtextparameter{#1}\c!rechts +% \egroup +% \egroup}% +% \else +% \def\stopframedcontent +% {\framedtextparameter{#1}\c!rechts +% \egroup +% \stopbaselinecorrection +% \egroup}% +% \startbaselinecorrection +% \fi} +% {\def\stopframedcontent +% {\framedtextparameter{#1}\c!rechts +% \egroup +% \egroup}}% +% \doifvalue{\??kd#1\c!breedte}\v!passend +% {\letvalue{\??kd#1\c!breedte}\v!vast}% +% \doframedtext[#1][]\insidefloattrue +% \framedtextparameter{#1}\c!links} +% {\let\stopframedcontent\egroup}}} + +\def\defineframedcontent + {\dodoubleempty\dodefineframedcontent} + +\def\dodefineframedcontent[#1][#2]% + {\presetlocalframed[\??fc#1]% + \getparameters[\??fc#1] + [\c!linkeroffset=\zeropoint, + \c!rechteroffset=\getvalue{\??fc#1\c!linkeroffset}, + \c!bovenoffset=\zeropoint, + \c!onderoffset=\getvalue{\??fc#1\c!bovenoffset}, + \c!strut=\v!nee, + \c!offset=\v!overlay, + \c!regelcorrectie=\v!nee, + #2]} + +\def\setupframedcontent + {\dodoubleempty\dosetupframedcontent} + +\def\dosetupframedcontent[#1][#2]% + {\def\docommando##1{\getparameters[\??fc##1][#2]}% + \processcommacommand[#1]\docommando} + +\def\startframedcontent[#1]% + {\bgroup + \let\stopframedcontent\egroup + \doifnot{#1}\v!uit + {\doifdefined{\??fc#1\c!kader} + {\def\stopframedcontent{\dostopframedcontent{#1}}% + \dostartframedcontent{#1}}}} + +\def\dostartframedcontent#1% + {\setbox\framebox\hbox\bgroup + \setlocalhsize + \hsize\localhsize + \advance\hsize-\getvalue{\??fc#1\c!linkeroffset}% + \advance\hsize-\getvalue{\??fc#1\c!rechteroffset}% + \advance\vsize-\getvalue{\??fc#1\c!bovenoffset}% + \advance\vsize-\getvalue{\??fc#1\c!onderoffset}% + \hskip\getvalue{\??fc#1\c!linkeroffset}% + \vbox\bgroup + \vskip\getvalue{\??fc#1\c!bovenoffset}% + \vbox\bgroup + \forgetall + \blanko[\v!blokkeer]} + +\def\dostopframedcontent#1% + {\removelastskip + \egroup + \vskip\getvalue{\??fc#1\c!onderoffset}% + \egroup + \hskip\getvalue{\??fc#1\c!rechteroffset}% + \egroup + \doifvalue{\??fc#1\c!breedte}\v!passend + {\letvalue{\??fc#1\c!breedte}\v!vast}% + \ifinsidefloat + \donefalse + \else + \doifelsevalue{\??fc#1\c!regelcorrectie}\v!ja\donetrue\donefalse + \fi + \ifdone\startregelcorrectie\fi + \localframed[\??fc#1]{\box\framebox}% + \ifdone\stopregelcorrectie\fi + \egroup} + %D \macros %D {encircled} %D @@ -3079,6 +3107,7 @@ \setupframed [\c!breedte=\v!passend, \c!hoogte=\v!ruim, + \c!regels=, \c!offset=0.25ex, % \defaultframeoffset \c!leeg=\v!nee, \c!kader=\v!aan, @@ -3184,6 +3213,4 @@ \c!voor=, \c!na=] -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex index 288d01748..152ebe338 100644 --- a/tex/context/base/core-sec.tex +++ b/tex/context/base/core-sec.tex @@ -158,7 +158,7 @@ \def\domaakvoorafgaandenummer[#1]% will become ugly after speed up {\bgroup % added - \global\let\voorafgaandenummer\empty + \globallet\voorafgaandenummer\empty \ifsectienummer \doifvalue{\??sb\@@sectieblok\c!nummer}\v!ja % added {\doifelsevalue{\@@thenumber{#1}\c!sectienummer}\v!ja @@ -237,14 +237,14 @@ \makecounter{\??se\v!tekst} -\letvalue{\??se\v!tekst\c!voor}\empty -\letvalue{\??se\v!tekst\c!na }\empty +\letvalueempty{\??se\v!tekst\c!voor} +\letvalueempty{\??se\v!tekst\c!na } -\setvalue{\v!tekst\c!nummer}{0} -\letvalue{\v!tekst\s!format}\empty +\setvalue {\v!tekst\c!nummer}{0} +\letvalueempty{\v!tekst\s!format} -\letvalue{\??sk\v!tekst}\empty -\letvalue{\??sk }\empty +\letvalueempty{\??sk\v!tekst} +\letvalueempty{\??sk } \letvalue{\??by }\v!tekst \letvalue{\??by\v!tekst }\v!tekst @@ -258,7 +258,7 @@ \def\dostelsectiein[#1][#2]% {\getparameters[\??se#1][#2]% - \doifelsevalue{\??se#1\c!vorigenummer}{\v!ja} + \doifelsevalue{\??se#1\c!vorigenummer}\v!ja {\setvalue{#1\c!nummer}{\@@longsectionnumber{#1}}} {\setvalue{#1\c!nummer}{\@@shortsectionnumber{#1}}}} @@ -273,7 +273,7 @@ \else \getparameters[\??se#1][#2]% \fi - \doifelsevalue{\??se#1\c!vorigenummer}{\v!ja} + \doifelsevalue{\??se#1\c!vorigenummer}\v!ja {\setvalue{#1\c!nummer}{\@@longsectionnumber {#1}}} {\setvalue{#1\c!nummer}{\@@shortsectionnumber{#1}}}} @@ -294,7 +294,7 @@ \donexttracklevel{##1}}% \donexttracklevel{\zerosection}}} % \firstsection -\def\koppelmarkering% +\def\koppelmarkering {\dodoubleargument\dokoppelmarkering} \def\ontkoppelmarkering[#1]% @@ -302,46 +302,38 @@ \def\definieersectie[#1]% {\doifundefined{\??se#1} - {\doifelsenothing{\firstsection} + {\doifelsenothing\firstsection {\def\firstsection{#1}% \setevalue{\??se#1\c!voor}{\v!tekst}% \setevalue{\??se\v!tekst\c!na}{#1}} {\setevalue{\??se\commalistelement\c!na}{#1}% \setevalue{\??se#1\c!voor}{\lastsection}% \setevalue{\??se\lastsection\c!na}{#1}}% - \advance\nofsections by 1 - \setevalue{\??se#1\c!niveau}% - {\the\nofsections}% - \setevalue{\??se#1\c!na}% - {}% - \setvalue{\e!volgende#1}% - {\@@nextsectionnumber{#1}}% - \setvalue{#1\c!nummer}% - {\@@longsectionnumber{#1}}% - \setvalue{#1\s!format}% - {\@@longformatnumber{#1}}% + \advance\nofsections \plusone + \setevalue{\??se#1\c!niveau}{\the\nofsections}% + \letvalue{\??se#1\c!na}\empty + \setvalue{\e!volgende#1}{\@@nextsectionnumber{#1}}% + \setvalue{#1\c!nummer}{\@@longsectionnumber{#1}}% + \setvalue{#1\s!format}{\@@longformatnumber{#1}}% \setevalue{\??by#1}{#1}% \setevalue{\??by\v!per#1}{#1}% \makecounter{\??se#1}% \edef\lastsection{#1}% - \setvalue{\??sk#1}% - {#1}% - \setvalue{\??se#1\c!markering}% - {}% - \stelsectiein[#1] - [\c!vorigenummer=\v!ja]}}% + \setvalue{\??sk#1}{#1}% + \letvalue{\??se#1\c!markering}\empty + \stelsectiein[#1][\c!vorigenummer=\v!ja]}}% \def\previoussection#1{\csname\??se#1\c!voor\endcsname} \def\nextsection #1{\csname\??se#1\c!na \endcsname} \def\@@setsectionnumber#1#2% - {\setgvalue{\??se#1\s!start}{}% % signal i.p.v. boolean + {\letgvalueempty{\??se#1\s!start}% signal i.p.v. boolean \setcounter{\??se#1}{#2}% \resetsectioncounters{#1}% \checkpagecounter} \def\@@nextsectionnumber#1% - {\setgvalue{\??se#1\s!start}{}% % signal i.p.v. boolean + {\letgvalueempty{\??se#1\s!start}% signal i.p.v. boolean \pluscounter{\??se#1}% \resetsectioncounters{#1}% \checkpagecounter} @@ -406,7 +398,7 @@ % not sure if the next one is better: \def\doresetsectionmarks#1% - {\ifundefined{\??se#1\c!markering} % skip zero level + {\ifundefined{\??se#1\c!markering}% skip zero level \donexttracklevel{#1}% \else \fastresetmarkerlist[\csname\??se#1\c!markering\endcsname]% @@ -429,7 +421,7 @@ % \donexttracklevel{#1}} % % nicer - + \def\doresetsectioncounters#1% {\resetcounter{\??se#1}% \donexttracklevel{#1}} @@ -453,103 +445,22 @@ {\dobacktrackcommando{\previoussection{#1}}}} \def\donexttracklevel#1% - {\doifnot{#1}{\lastsection} + {\doifnot{#1}\lastsection {\donexttrackcommando{\nextsection{#1}}}} \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 -% {\let\dosetlevel\dontsetlevel % local lists will be real local -% \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} - \def\dosetcurrentlevel#1% {\global\alllevelsfalse \xdef\currentlevel{\getvalue{\lastsection\s!format}}} \def\dosetpreviouslevel#1% {\global\alllevelstrue - \global\let\currentlevel\empty + \globallet\currentlevel\empty \def\dobacktrackcommando##1% - {\ifnum\countervalue{\??se##1}>0 + {\ifnum\countervalue{\??se##1}>\zerocount \global\alllevelsfalse \xdef\currentlevel{\getvalue{\previoussection{##1}\s!format}}% \else @@ -559,7 +470,7 @@ \def\dosettextlevel#1% {\global\alllevelstrue - \global\let\currentlevel\empty} + \globallet\currentlevel\empty} \def\dosetotherlevel#1% {\doifdefinedelse{\??ko#1\c!sectie} % beter alteratief: ook @@ -569,12 +480,12 @@ {\global\alllevelsfalse \xdef\currentlevel{\getvalue{\@@sectie\s!format}}} {\global\alllevelstrue - \global\let\currentlevel\empty + \globallet\currentlevel\empty \def\dobacktrackcommando##1% {\@EA\ifx\csname\??se##1\c!start\endcsname\relax \dobacktracklevel{##1}% \else - \ifnum\countervalue{\??se##1}>0 + \ifnum\countervalue{\??se##1}>\zerocount \global\alllevelsfalse \xdef\currentlevel{\getvalue{##1\s!format}}% \else @@ -583,26 +494,18 @@ \fi}% \dobacktrackcommando\lastsection}} -% \def\dosetlevel#1% opvoeren met \ifcsname -% {\let\dosetlevel\dontsetlevel % local lists will be real local -% \bgroup -% \doifelse{#1}{\v!huidige} -% {\dosetcurrentlevel{#1}} -% {\doifelse{#1}{\v!vorige} -% {\dosetpreviouslevel{#1}} -% {\doifelsevalue{\??by#1}{\v!tekst} -% {\dosettextlevel{#1}} -% {\dosetotherlevel{#1}}}}% -% \egroup} - -\def\dosetlevel#1% beware: this one is \let - {\let\dosetlevel\dontsetlevel % local lists will be real local - \bgroup +\def\dosetfilterlevel#1#2% beware: this one is \let + {\bgroup \edef\askedlevel{#1}% + \edef\askedfilter{#2}% \ifx\askedlevel\v!huidige \dosetcurrentlevel\askedlevel \else\ifx\askedlevel\v!vorige \dosetpreviouslevel\askedlevel + \else\ifx\askedlevel\v!alles + \global\alllevelstrue + \else\ifx\askedlevel\v!tekst + \global\alllevelstrue \else \edef\byaskedlevel{\csname\??by\askedlevel\endcsname}% \ifx\byaskedlevel\v!tekst @@ -610,16 +513,19 @@ \else \dosetotherlevel\askedlevel \fi - \fi\fi + \fi\fi\fi\fi + % experiment + \ifx\askedfilter\empty \else + \xdef\currentlevel{\currentlevel\sectionseparator\askedfilter}% + \fi \egroup} -% \def\dosettoclevel{\dosetlevel} -% \def\dosetreglevel{\dosetlevel} -% \def\dosetblklevel{\dosetlevel} +\def\dontsetfilterlevel#1% + {\let\currentlevel\somesavedlevel + \alllevelsfalse} -\let\dosettoclevel\dosetlevel -\let\dosetreglevel\dosetlevel -\let\dosetblklevel\dosetlevel +\def\honorlocalfilterlevel % local lists will be real local + {\let\dosetfilterlevel\dontsetfilterlevel} % cleaner % @@ -759,6 +665,12 @@ % % we want to be able to overload them globally +% This will be reimplmented +% +% {nn}{xx}{yy} +% +% -> \scan{..}{..}{0} met 0 als sentinel + \def\doifnextlevelelse[#1]% !! this one is \let / uti seperator -- {\edef\somesavedlevel{\sectionseparator\@@filterlevelpart[#1]}% \ifalllevels @@ -807,7 +719,7 @@ \@@shortsectionnumber{#1}} \def\@@longsectionnumber#1% - {\ifnum\countervalue{\??se\previoussection{#1}}>0 + {\ifnum\countervalue{\??se\previoussection{#1}}>\zerocount \csname\previoussection{#1}\c!nummer\endcsname.% \fi \@@shortsectionnumber{#1}} @@ -837,6 +749,10 @@ \edef\@@sectieblok {#2}% \edef\@@sectieblokken{#3}} +% beware, the \resetsectionmarks generates some nodes that +% will result in an additional last page, which needs to be +% captured at the end + \def\doaroundsectieblok#1% {\doifvaluesomething{\??sb#1\c!pagina} {\ExpandFirstAfter\pagina[\getvalue{\??sb#1\c!pagina}]}% @@ -911,7 +827,7 @@ %\c!voor=, %\c!na=, #3]% - \expandafter\newif\csname if#2\endcsname + \expandafter\newif\csname if#2\endcsname % better a mode \doglobal\increment\currentsectionblock \setsectieblokomgeving{#1}{}% \setevalue{\??sb#1}% @@ -921,7 +837,7 @@ \setvalue{\e!stop#2}% {\dostopsectieblok}} -\def\definieersectieblok% +\def\definieersectieblok {\dotripleargument\dodefinieersectieblok} \def\sectiebloklabel#1#2% @@ -959,11 +875,11 @@ \ifpaginageblokkeerd \global\paginageblokkeerdfalse \else - \!!countb=\getvalue{\??se\@@sectie\c!niveau}\relax + \!!countb\getvalue{\??se\@@sectie\c!niveau}\relax \ifnum\!!countb>\@@koniveau\relax - \!!counta=20000 - \multiply\!!countb by 500 - \advance\!!counta by \!!countb + \!!counta20000 + \multiply\!!countb 500 + \advance\!!counta \!!countb \dosomebreak{\penalty\!!counta}% \else \dosomebreak{\allowbreak}% @@ -988,21 +904,21 @@ \def\dohandelpaginaafX#1% zie doordefinieren / boven {\bgroup - \!!countb=\@@koniveau - \advance\!!countb by #1 - \multiply\!!countb by 500 - \!!counta=20000 - \advance\!!counta by \!!countb + \!!countb\@@koniveau + \advance\!!countb #1 + \multiply\!!countb 500 + \!!counta20000 + \advance\!!counta \!!countb \dosomebreak{\penalty\!!counta}% \egroup} \def\handelpaginaaf#1% {\dohandelpaginaafAA{#1}% - \ifnum\countervalue{\??se\previoussection\@@sectie}>0 - \ifnum\countervalue{\??se\@@sectie}>0 + \ifnum\countervalue{\??se\previoussection\@@sectie}>\zerocount\relax + \ifnum\countervalue{\??se\@@sectie}>\zerocount \dohandelpaginaafB{#1}% \else - \doifnotvalue{\??ko#1\c!doorgaan}{\v!ja} + \doifnotvalue{\??ko#1\c!doorgaan}\v!ja {\dohandelpaginaafB{#1}}% \fi \else @@ -1014,7 +930,7 @@ {\xdef\@@koniveau{\getvalue{\??se\@@sectie\c!niveau}}% \nobreak} -%\def\dolocalkopsetup#1% koppeling met standaard kopcommando / engels +%\def\dolocalheadsetup#1% koppeling met standaard kopcommando / engels % {\forgetall % \doifvaluesomething{\??ko#1\c!uitlijnen} % {\ExpandFirstAfter\steluitlijnenin[\getvalue{\??ko#1\c!uitlijnen}]}% @@ -1022,7 +938,7 @@ % {\ExpandFirstAfter\steltolerantiein[\getvalue{\??ko#1\c!tolerantie}]}% % \def\\{\crlf\strut\ignorespaces}} -\def\dolocalkopsetup#1% koppeling met standaard kopcommando / engels +\def\dolocalheadsetup#1% koppeling met standaard kopcommando / engels {\forgetall % traag dus ... \doifvaluesomething{\??ko#1\c!uitlijnen} % wordt al expanded in spa {\expanded{\steluitlijnenin[\getvalue{\??ko#1\c!uitlijnen}]}}% @@ -1030,17 +946,20 @@ {\expanded{\steltolerantiein[\getvalue{\??ko#1\c!tolerantie}]}}% \def\\{\crlf\strut\ignorespaces}} +\def\localkopsetup{\localheadsetup} % kan tzt weg + \newif\ifplaatskop \newif\iflegekop +\newif\ifnaarlijst \newif\ifverhoognummer \newif\ifkopnummer \def\setsectieenkoppeling#1% {\edef\@@koppeling{\getvalue{\??ko#1\c!koppeling}}% \edef\@@sectie{\getvalue{\??ko#1\c!sectie}}% - \doifnothing{\@@koppeling} + \doifnothing\@@koppeling {\edef\@@koppeling{#1}}% - \doifnothing{\@@sectie} + \doifnothing\@@sectie {\edef\@@sectie{\getvalue{\??ko\@@koppeling\c!sectie}}}} \newif\ifkopprefix @@ -1055,10 +974,10 @@ % \hoofdstuk tekst % \hoofdstuk <niets> -\def\finalsectionnumber% +\def\dofinalsectionnumber {\ifundefined{\@@sectie\c!nummer}\else \ifsomeheadconversion - \@@shortsectionnumber{\@@sectie}% + \@@shortsectionnumber\@@sectie \else \getvalue{\@@sectie\c!nummer}% \fi @@ -1071,8 +990,7 @@ \def\dolijstelement##1##2##3##4##5##6% {\doif{##1}{#1} {\ConvertConstantAfter\doif{##4}{#3} - {\wait - \global\utilitydonetrue + {\global\utilitydonetrue \scratchcounter=0\getvalue{\??se\@@sectie\c!niveau}% % %\advance\scratchcounter 2 @@ -1086,15 +1004,15 @@ %\do##5]}}}% % \def\do####1\relax % :/- clean - {\advance\scratchcounter -1 + {\advance\scratchcounter \minusone \ifcase\scratchcounter \xdef\foundsectionnumber{\@@filterheadpart[####1]}% \else \@EAEAEA\do\@@filtertailpart[####1]\relax \fi}% \@EA\do\@@filternumberpart[##5]\relax}}}% - \setbox0=\vbox - {\doutilities{#1}{#2}{#1}{}{}}% + \setbox0\vbox + {\doutilities{#1}{#2}{#1}\relax\relax}% \endgroup \doifnumberelse{\foundsectionnumber} {\doif{\foundsectionnumber}{0}{\xdef\foundsectionnumber{1}}} @@ -1106,7 +1024,7 @@ \def\setsomeheadconversion#1#2% {\someheadconversionfalse - \doifelsevalue{\??ko#1\c!eigennummer}{\v!ja} + \doifelsevalue{\??ko#1\c!eigennummer}\v!ja {\def\someheadconversion{#2}} {\bepaalkopnummer[#1]% \@EA\ifx\csname\??se\@@sectie\@@sectieblok\c!kopconversie\endcsname\relax @@ -1152,8 +1070,8 @@ {\convertnumber{#2}{#3}} \def\setfullsectionnumber#1% - {\doifelsevalue{#1\c!kopconversie}{\v!ja} - {\doifelsevalue{#1\c!koplabel}{\v!ja} + {\doifelsevalue{#1\c!kopconversie}\v!ja + {\doifelsevalue{#1\c!koplabel}\v!ja {\let\fullsectionnumber\naturalfullsectionnumber} {\let\fullsectionnumber\limitedfullsectionnumber}} {\let\fullsectionnumber\ignoredfullsectionnumber}} @@ -1168,7 +1086,7 @@ \let\currentheadtext \empty \def\dodosomekop#1[#2]#3% [ref] {title} - {\doifelsevalue{\??ko#1\c!eigennummer}{\v!ja} + {\doifelsevalue{\??ko#1\c!eigennummer}\v!ja {\doquadruplegroupempty\dododosomekop{#1}{#2}{#3}} {\fourthargumentfalse \dododosomekop{#1}{#2}{#3}{}}} @@ -1196,9 +1114,12 @@ \prevdepth\strutdepth \fi} +\let\localkopprefix\empty + \def\dodododosomekop#1[#2]#3#4% [ref] {number} {title} {\def\currenthead{#1}% - \unexpanded\def\\{\space}% +\let\finalsectionnumber\dofinalsectionnumber % overloaded ungrouped -) + \unexpanded\def\\{\space}% \def\numberseparator{\getvalue{\??ko\currenthead\c!scheider}}% \flushingcolumnfloatsfalse % {number} can be \finalsectionnumber \someheadconversionfalse @@ -1213,19 +1134,23 @@ {\def\localkopprefix{+}} {\def\localkopprefix{#2}}} % eigenlijk alleen eerste {\edef\localkoprefix{\getvalue{\??ko#1\c!prefix}}}% + \else + \let\localkoprefix\empty \fi - \doifelsevalue{\??ko#1\c!plaatskop}{\v!ja} - {\plaatskoptrue} - {\plaatskopfalse}% -\processaction - [\getvalue{\??ko#1\c!plaatskop}] - [ \v!ja=>\plaatskoptrue \legekopfalse, - \v!leeg=>\plaatskoptrue \legekoptrue, - \v!nee=>\plaatskopfalse\legekoptrue]% + \doifelsevalue{\??ko#1\c!plaatskop}\v!ja + \plaatskoptrue\plaatskopfalse + \processaction + [\getvalue{\??ko#1\c!plaatskop}] + [ \v!ja=>\plaatskoptrue \legekopfalse, + \v!leeg=>\plaatskoptrue \legekoptrue, + \v!nee=>\plaatskopfalse\legekoptrue]% + \naarlijstfalse \processaction [\getvalue{\??ko#1\c!verhoognummer}] [ \v!ja=>\verhoognummertrue, \v!nee=>\verhoognummerfalse, + \v!lijst=>\verhoognummerfalse + \naarlijsttrue, \s!unknown=>{\ifx\currentproduct\empty \findsectionnumber{#1}\commalistelement{#4}% \fi @@ -1234,9 +1159,10 @@ \edef\numberheadalternative{\getvalue{\??ko#1\c!variant}}% \dostelkopvariantin[\numberheadalternative]% \ifsectienummer - \doifelsevalue{\??sb\@@sectieblok\c!nummer}{\v!ja} - {\doifelsevalue{\??ko#1\c!nummer}{\v!ja} - {\kopnummertrue}{\kopnummerfalse}} + \doifelsevalue{\??sb\@@sectieblok\c!nummer}\v!ja + {\doifelsevalue{\??ko#1\c!nummer}\v!ja + \kopnummertrue + \kopnummerfalse} {\kopnummerfalse}% \else \kopnummerfalse @@ -1244,7 +1170,7 @@ \convertexpanded{\??ko#1}{#4}\asciititle % \gdef\currentheadtext{#4}% scheelt args - \global\let\currentheadnumber\empty + \globallet\currentheadnumber\empty % \ifverhoognummer \ifplaatskop @@ -1267,7 +1193,7 @@ {\setsectionlistreference{\@@sectie}{#1}% \soortpagina[\@@koppeling]% \let\fullsectionnumber\writtenfullsectionnumber - \rawreference{\s!sec}{#2}{{\someheadconversion}{\asciititle}}% + \rawreference\s!sec{#2}{{\someheadconversion}{\asciititle}}% \resetsectionmarks\@@sectie \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}% \let\fullsectionnumber\writtenfullsectionnumber @@ -1284,14 +1210,14 @@ {#1} {\setsectionlistreference{\@@sectie}{#1}% \soortpagina[\@@koppeling]% - \rawreference{\s!sec}{#2}{{#3}{\asciititle}}% + \rawreference\s!sec{#2}{{#3}{\asciititle}}% \resetsectionmarks\@@sectie \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}% \doschrijfnaarlijst{\@@koppeling}{#3}{#4}{\v!kop}} {\sectiebloklabel{#1}{\dohandleheadnumber{#3}}}% handle is new {#4} {\marking[#1]{#4}% - \doifelsevalue{\??ko#1\c!eigennummer}{\v!ja} % rommelig omdat + \doifelsevalue{\??ko#1\c!eigennummer}\v!ja % rommelig omdat {\edef\finalsectionnumber{#3}} % #3 al is toegekend {\bepaalkopnummer[#1]}% migreert naar 3e argument \expanded{\marking[#1\v!nummer]{\finalsectionnumber}}}% @@ -1303,13 +1229,13 @@ {#1} {\setsectionlistreference{\@@sectie}{#1}% \soortpagina[\@@koppeling]% - \rawreference{\s!sec}{#2}{{#3}{\asciititle}}% + \rawreference\s!sec{#2}{{#3}{\asciititle}}% \resetsectionmarks\@@sectie \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}% \doschrijfnaarlijst{\@@koppeling}{}{#4}{\v!kop}} {#4} {\marking[#1]{#4}% - \doifelsevalue{\??ko#1\c!eigennummer}{\v!ja} % brrr + \doifelsevalue{\??ko#1\c!eigennummer}\v!ja % brrr {\edef\finalsectionnumber{#3}} {\bepaalkopnummer[#1]}% % todo : geen markering (leeg maken) @@ -1345,22 +1271,23 @@ \xdef\currentheadnumber{\someheadconversion}% \fi \getvalue{\??ko#1\c!tussen}% documenteren, is enige hook + \bgroup \setsectionlistreference{\@@sectie}{#1}% \resetsectionmarks\@@sectie \marking[#1]{#4}% - \doifelsevalue{\??ko#1\c!eigennummer}{\v!ja} + \doifelsevalue{\??ko#1\c!eigennummer}\v!ja {\edef\finalsectionnumber{#3}} {\bepaalkopnummer[#1]}% \expanded{\marking[#1\v!nummer]{\finalsectionnumber}}% \soortpagina[\@@koppeling]% - \bgroup +% \bgroup \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}% \ifkopnummer - \rawreference{\s!sec}{#2}{{#3}{\asciititle}}% + \rawreference\s!sec{#2}{{#3}{\asciititle}}% \doschrijfnaarlijst{\@@koppeling}{#3}{#4}{\v!kop}% \writesection{#1}{#3}{#4}% \else - \rawreference{\s!sec}{#2}{{#3}{\asciititle}}% + \rawreference\s!sec{#2}{{#3}{\asciititle}}% \doschrijfnaarlijst{\@@koppeling}{}{#4}{\v!kop}% \writesection{#1}{-}{#4}% \fi @@ -1370,13 +1297,15 @@ \fi \fi \else + % todo : ref prefix \ifplaatskop \checknexthead\handelpaginaaf{#1}% \setsectieenkoppeling{#1}% can be changed when [voor=\somehead{..}...] \getvalue{\??ko#1\c!tussen}% \doplaatskoptekst {#1} - {\rawreference{\s!sec}{#2}{{#3}{\asciititle}}} + {\forcesectiontolist{#1}{#4}% + \rawreference\s!sec{#2}{{#3}{\asciititle}}} % #3 ? {#4} %{}% new: {\marking[#1]{#4}% @@ -1392,7 +1321,8 @@ \checknexthead\handelpaginaaf{#1}% \setsectieenkoppeling{#1}% can be changed when [voor=\somehead{..}...] \getvalue{\??ko#1\c!tussen}% - \rawreference{\s!sec}{#2}{{#3}{\asciititle}}% + \forcesectiontolist{#1}{#4}% + \rawreference\s!sec{#2}{{#3}{\asciititle}}% #3 ? \marking[#1]{#4}% \marking[#1\v!nummer]{}% \writesection{#1}{-}{#4}% @@ -1403,6 +1333,19 @@ \let\fullsectionnumber\limitedfullsectionnumber \ifdisplaysectionhead\else\expandafter\GotoPar\fi} +\def\forcesectiontolist#1#2% + {\ifnaarlijst + % we need to make sure that there is a number set (non + % zero) else the list mechanism cannot determine the + % level + \bgroup + \stelkopnummerin[#1][+1]% traag, wordt \getvalue{\c!volgende...} + \setlistparameter\@@koppeling\c!expansie{\getvalue{\??ko#1\c!expansie}}% + \doschrijfnaarlijst{\@@koppeling}{}{#2}{\v!kop}% + \stelkopnummerin[#1][-1]% traag, wordt \getvalue{\c!vorige...} + \egroup + \fi} + \let\previoussectionformat\empty \let\currentsectionformat \empty @@ -1413,7 +1356,7 @@ {\ifnum\countervalue{\??se\previoussection{#1}}>0\relax \xdef\previoussectionformat{\@@longformatnumber{\previoussection{#1}}}% \else - \global\let\previoussectionformat\empty + \globallet\previoussectionformat\empty \fi \xdef\currentsectionformat{\@@longformatnumber{#1}}} @@ -1437,7 +1380,7 @@ \def\dostoplistreferences#1% {\iflijstgeplaatst \addtocommalist{#1}\updatedlistreferences % nog global (\doglobal) - \global\let\updatedlistreferences\updatedlistreferences % een noodverbandje + \globallet\updatedlistreferences\updatedlistreferences % een noodverbandje \gdef\updatelistreferences% {\def\docommando####1% % @@ -1447,8 +1390,8 @@ % {\definereference[\e!vorige####1][\getvalue{\e!huidigelokale####1}]% % \processcommacommand[\updatedlistreferences]\docommando - \global\let\updatelistreferences\relax - \global\let\updatedlistreferences\empty}% + \globallet\updatelistreferences\relax + \globallet\updatedlistreferences\empty}% \fi} \def\stoplistreferences% @@ -1562,9 +1505,9 @@ \edef\@@sectie{\??ko\iffifthargument#5\else#4\fi}% \dostartattributes\@@sectie\c!letter\c!kleur\empty \dontconvertfont - \dostartattributes\@@sectie#1#2\empty + \dostartattributes\@@sectie{#1}{#2}\empty \stelinterliniein % \setupinterlinespace - \begstrut\getmarking[\hoofdmarkering{#4#3}]\endstrut + \begstrut\haalmarkering[\hoofdmarkering{#4#3}]\endstrut \endgraf \dostopattributes \dostopattributes @@ -1607,7 +1550,7 @@ \getvalue{\??ko#1\c!nacommando}% \ifdisplaysectionhead\endgraf\fi \dostopattributes - \dostopattributes}}% + \dostopattributes}}% \fi \endheadplacement{#1}{#4}} @@ -1658,7 +1601,7 @@ \fi \getvalue{\??ko#1\c!nacommando}% \ifdisplaysectionhead\endgraf\fi - \dostopattributes + \dostopattributes \dostopattributes}}% \fi \endheadplacement{#1}{#5}} @@ -1686,25 +1629,56 @@ % \resetinteractionparameter\c!kleur % \resetinteractionparameter\c!contrastkleur % \strictouterreferencestrue % tzt instelling -% \def\localkopsetup% -% {\dolocalkopsetup{#1}}% +% \def\localheadsetup% +% {\dolocalheadsetup{#1}}% +% \startsynchronisatie} + +% \def\beginheadplacement#1% +% {\bgroup +% \setsystemmode{#1}% to be documented +% \ifgridsnapping\iftracegridsnapping\showstruts\fi\fi +% \gdef\localheaddepth{\dp\strutbox}% +% \everypar\emptytoks % needed indeed +% \noindent % ipv \witruimte elders, na \forgetall ! +% \bgroup +% \doifelsevalue{\??ko#1\c!titeluitlijnen}\v!ja % new +% {\leftskip 1\leftskip +% \rightskip1\rightskip +% \edef\next{\leftskip\the\leftskip\rightskip\the\rightskip}% +% \xdef\localheadskip{\the\leftskip}% +% \expandafter\forgetall\next % now we may forget everything +% \setlocalhsize\hsize\localhsize} +% {\globallet\localheadskip\!!zeropoint +% \forgetall}% +% \mindermeldingen +% \postponefootnotes +% \iflocation\ifdisplaysectionhead\else\noninterferingmarks\fi\fi +% \resetinteractionparameter\c!letter +% \resetinteractionparameter\c!kleur +% \resetinteractionparameter\c!contrastkleur +% \strictouterreferencestrue % tzt instelling +% \def\localheadsetup% +% {\dolocalheadsetup{#1}}% % \startsynchronisatie} \def\beginheadplacement#1% {\bgroup -\ifgridsnapping\iftracegridsnapping\showstruts\fi\fi + \setsystemmode{#1}% to be documented + \ifgridsnapping\iftracegridsnapping\showstruts\fi\fi \gdef\localheaddepth{\dp\strutbox}% \everypar\emptytoks % needed indeed \noindent % ipv \witruimte elders, na \forgetall ! \bgroup - \doifelsevalue{\??ko#1\c!titeluitlijnen}{\v!ja} % new - {\leftskip 1\leftskip - \rightskip1\rightskip - \edef\next{\leftskip\the\leftskip\rightskip\the\rightskip}% - \xdef\localheadskip{\the\leftskip}% - \expandafter\forgetall\next % now we may forget everything - \setlocalhsize\hsize\localhsize} - {\global\let\localheadskip\!!zeropoint + \doifelsevalue{\??ko#1\c!titeluitlijnen}\v!ja % new + {\skip0 1\leftskip + \skip2 1\rightskip + \xdef\localheadskip{\the\skip0}% + \forgetall + \leftskip\skip0 + \rightskip\skip2 + \setlocalhsize\hsize\localhsize + \forgetbothskips} + {\globallet\localheadskip\!!zeropoint \forgetall}% \mindermeldingen \postponefootnotes @@ -1713,12 +1687,13 @@ \resetinteractionparameter\c!kleur \resetinteractionparameter\c!contrastkleur \strictouterreferencestrue % tzt instelling - \def\localkopsetup% - {\dolocalkopsetup{#1}}% + \def\localheadsetup% + {\dolocalheadsetup{#1}}% \startsynchronisatie} + \def\endheadplacement#1#2% - {\doifelsevalue{\??rf#1\c!status}{\v!start} + {\doifelsevalue{\??rf#1\c!status}\v!start {\doifvaluenothing{\??ko#1\c!file}{\autocrossdocumentfalse}} {\autocrossdocumentfalse}% % no message needed here, should be a proper switch @@ -1755,11 +1730,11 @@ \xdef\headlastlinewidth{\the\lasthhboxwidth}% \else \unhbox0 - \global\let\headlastlinewidth\!!zeropoint + \globallet\headlastlinewidth\!!zeropoint \fi \else \unhbox0 - \global\let\headlastlinewidth\!!zeropoint + \globallet\headlastlinewidth\!!zeropoint \fi #2% \dimen0=\numberheaddistance @@ -1777,7 +1752,7 @@ \egroup \egroup \ifdisplaysectionhead - \doifvalue{\??ko#1\c!springvolgendein}{\v!nee}{\noindentation}% + \doifvalue{\??ko#1\c!springvolgendein}\v!nee\noindentation \else \nonoindentation % recently added, was a bug \fi} @@ -1802,15 +1777,15 @@ {\bgroup \setsectieenkoppeling{#1}% \doifinstringelse{#2}{+-} - {\doifelse{#3}{} - {\@@nextsectionnumber{\@@sectie}} + {\doifelsenothing{#3} + {\@@nextsectionnumber\@@sectie} {\!!counta=#2#3\relax - \advance\!!counta by \@@sectionvalue{\@@sectie}% - \@@setsectionnumber{\@@sectie}{\!!counta}}} - {\@@setsectionnumber{\@@sectie}{#2#3}}% + \advance\!!counta \@@sectionvalue\@@sectie + \@@setsectionnumber\@@sectie\!!counta}} + {\@@setsectionnumber\@@sectie{#2#3}}% \egroup} -\def\stelkopnummerin% +\def\stelkopnummerin {\dodoubleargument\dostelkopnummerin} \def\huidigekopnummer{0} @@ -1841,16 +1816,30 @@ \def\alinea% {\par} +% nice testcase +% +% \setupheads[aligntitle=yes] +% +% \startnarrower +% \subject{\dorecurse{100}{x }} +% \section{\dorecurse{100}{x }} +% \input tufte \par +% \setupheads[alternative=inmargin] +% \subject{\dorecurse{100}{x }} +% \section{\dorecurse{100}{x }} +% \input tufte \par +% \stopnarrower + \def\plaatskopalinea#1#2% {\vbox - {\localkopsetup + {\localheadsetup \begstrut\ifheadnumbercontent#1\hskip\numberheaddistance\fi#2}} \def\plaatskopnormaal#1#2% {\ifheadnumbercontent \setbox0=\hbox{{#1}\hskip\numberheaddistance}% \vbox - {\localkopsetup + {\localheadsetup \hangindent 1\wd0 \hangafter 1 \noindent @@ -1858,33 +1847,43 @@ #2}% \else \vbox - {\localkopsetup\noindent#2}% + {\localheadsetup\noindent#2}% \fi} % \def\plaatskopinmarge#1#2% % {\vbox -% {\localkopsetup +% {\localheadsetup % \begstrut % but use one \strut here! % \ifheadnumbercontent % \llap{\hbox to 5em{\hfill{#1}\hskip\linkermargeafstand}}% % \fi % {#2}}} +%\def\plaatskopinmarge#1#2% +% {\vbox +% {\scratchdimen\linkermargeafstand +% \advance\scratchdimen\leftskip +% \edef\plaatskopinmarge{\the\scratchdimen}% re-use saves hash entry +% \localheadsetup +% \begstrut % but use one \strut here! +% \ifheadnumbercontent +% \llap{\hbox to 5em{\hfill{#1}\hskip\plaatskopinmarge}}% +% \fi +% {#2}}} + \def\plaatskopinmarge#1#2% {\vbox - {\scratchdimen\linkermargeafstand - \advance\scratchdimen\leftskip - \edef\plaatskopinmarge{\the\scratchdimen}% re-use saves hash entry - \localkopsetup - \begstrut % but use one \strut here! + {\localheadsetup + \begstrut % use one \strut here! \ifheadnumbercontent - \llap{\hbox to 5em{\hfill{#1}\hskip\plaatskopinmarge}}% + \llap{\hbox to 5em{\hfill{#1}% + \hskip\localheadskip\hskip\linkermargeafstand}}% \fi {#2}}} \def\plaatskopmidden#1#2% {\vbox - {\localkopsetup + {\localheadsetup \veryraggedcenter \let\\\endgraf \let\crlf\endgraf @@ -1892,7 +1891,7 @@ \def\plaatskopintekst#1#2% {\bgroup - \localkopsetup % no stretch in distance + \localheadsetup % no stretch in distance \ifheadnumbercontent{#1}\kern\numberheaddistance\fi{\begstrut#2}% \egroup} @@ -1931,16 +1930,16 @@ \c!eigennummer=\v!nee, \c!nummer=\v!ja, \c!kleur=, - \c!springvolgendein=\v!nee, \c!doorgaan=\v!ja, \c!plaatskop=\v!ja, \c!verhoognummer=\v!ja, \c!variant=\@@kovariant, \c!commando=\@@plaatskop, \c!scheider=\@@koscheider, - \c!uitlijnen=, - \c!titeluitlijnen=, - \c!tolerantie=, + \c!uitlijnen=\@@kouitlijnen, + \c!titeluitlijnen=\@@kotiteluitlijnen, + \c!tolerantie=\@@kotolerantie, + \c!springvolgendein=\@@kospringvolgendein, \c!file=, \c!expansie=, \c!grid=, @@ -1950,8 +1949,7 @@ {\copyparameters [\??ko#1][\??ko\getvalue{\??ko#1\c!default}] [\c!voor,\c!na,\c!commando,\c!file,\c!pagina,\c!doorgaan, - \c!hoofd,\c!tekst,\c!voet, -\c!scheider, + \c!hoofd,\c!tekst,\c!voet,\c!scheider, \c!nummer,\c!eigennummer,\c!plaatskop,\c!verhoognummer, \c!letter,\c!kleur,\c!afstand,\c!variant,\c!springvolgendein, %\c!nummerletter,\c!tekstletter, @@ -1975,7 +1973,7 @@ [\??ko#1][\??ko#2] [\c!niveau,\c!sectie,\c!koppeling,\c!prefix, \c!voor,\c!na,\c!commando,\c!file,\c!pagina,\c!doorgaan, -\c!scheider, + \c!scheider, \c!hoofd,\c!tekst,\c!voet, \c!nummer,\c!eigennummer,\c!plaatskop,\c!verhoognummer, \c!letter,\c!kleur,\c!afstand,\c!variant,\c!springvolgendein, @@ -2047,11 +2045,11 @@ \def\complexbijlage[#1]#2% {\pagina[\v!rechts] - \stelnummeringin[\c!status=\v!stop] + \setuppagenumbering[\c!status=\v!stop] \systemsuppliedchapter[#1]{#2} \pagina[\v!rechts] - \stelnummeringin[\c!status=\v!start] - \stelpaginanummerin[\c!nummer=1]} + \setuppagenumbering[\c!status=\v!start] + \setuppagenumbering[\c!nummer=1]} \setvalue{\v!bijlage}% {\complexorsimpleempty\bijlage} @@ -2060,6 +2058,10 @@ [\c!variant=\v!normaal, \c!sectienummer=\v!ja, \c!scheider=., + \c!uitlijnen=, + \c!titeluitlijnen=, + \c!tolerantie=, + \c!springvolgendein=\v!nee, \c!commando=] \definieersectieblok [\v!hoofdtekst] [\v!hoofdteksten] [\c!nummer=\v!ja] @@ -2179,9 +2181,9 @@ \stelkopin [\v!deel,\v!hoofdstuk] - [\c!uitlijnen=, + [%\c!uitlijnen=, + %\c!springvolgendein=\v!nee, \c!doorgaan=\v!nee, - \c!springvolgendein=\v!nee, \c!pagina=\v!rechts, \c!hoofd=, \c!letter=\tfc, @@ -2191,10 +2193,10 @@ \stelkopin [\v!paragraaf] - [\c!uitlijnen=, + [%\c!uitlijnen=, + %\c!springvolgendein=\v!nee, \c!letter=\tfa, \c!afstand=.75em, - \c!springvolgendein=\v!nee, \c!voor={\blanko[2*\v!groot]}, \c!na=\blanko] @@ -2237,10 +2239,11 @@ % hm -\stelnummeringin % na instellen hoofdteksten ! +\setuppagenumbering % na instellen hoofdteksten ! [\c!variant=\v!enkelzijdig, \c!plaats={\v!hoofd,\v!midden}, \c!conversie=\v!cijfers, + \c!breedte=, % in geval van \v!kantlijn \c!links=, \c!rechts=, \c!wijze=\v!per\v!deel, diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex index 9f2750b4d..042093968 100644 --- a/tex/context/base/core-spa.tex +++ b/tex/context/base/core-spa.tex @@ -13,7 +13,7 @@ \writestatus{loading}{Context Spacing Macros} -\unprotect +\unprotect \newevery \everybodyfont \Everybodyfont % just to be sure \newevery \everyfontswitch \EveryFontSwitch % just to be sure @@ -32,27 +32,30 @@ \appendtoks \simplestelspatieringin \to \everybodyfont % nieuw \appendtoks \setdisplayskips \to \everybodyfont % nieuw -\appendtoks \updateraggedskips \to \everyfontswitch % under test +\appendtoks \updateraggedskips \to \everyfontswitch % under test \prependtoks \let\par\endgraf \to \everypagebody % see \fillinline \appendtoks \simplestelspatieringin \to \everydefinedfont -\def\stelfactorenin% +\def\stelfactorenin {\simplestelwitruimtein \simplestelblankoin \settopskip \setmaxdepth} +\def\softbreak + {\relax\ifhmode\hskip\parfillskip\break\fi} + %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. (I must +%D inside the group are forgotten afterwards. (I must %D not forget its existence). -\global\let\carriedoverpar\relax +\global\let\carriedoverpar\relax \def\carryoverpar#1% {\expanded @@ -63,7 +66,7 @@ \leftskip \the\leftskip \rightskip \the\rightskip}} -%D A quick way to determine left|/|middle|/|right states +%D A quick way to determine left|/|middle|/|right states %D (experimental). \setvalue{\??as\v!links }{0} @@ -71,7 +74,7 @@ \setvalue{\??as\v!rechts}{2} \def\setalignmentswitch#1% - {\chardef\alignmentswitch=0\csname\??as#1\endcsname\relax} + {\chardef\alignmentswitch0\csname\??as#1\endcsname\relax} %D There are two ways to influence the interline spacing. The %D most general and often most consistent way is using @@ -116,40 +119,50 @@ \def\presetnormallineheight% {\edef\normallineheight{\@@itregel}% \iflocalinterlinespace \else - \doifdefined{\bodyfontinterlinespecs} - {\doifsomething{\bodyfontinterlinespace} + \doifdefined\bodyfontinterlinespecs + {\doifsomething\bodyfontinterlinespace {\edef\normallineheight{\bodyfontinterlinespace}}}% \fi} +\def\setupspecifiedinterlinespace[#1]% + {\getparameters[\??it][#1]% + \scratchdimen0\@@ithoogte\s!pt + \advance\scratchdimen 0\@@itdiepte\s!pt + \ifdim\scratchdimen>1\s!pt + \showmessage\m!layouts{10}{\@@ithoogte,\@@itdiepte}% + \let\@@ithoogte\strutheightfactor + \let\@@itdiepte\strutdepthfactor + \else + \let\strutheightfactor\@@ithoogte + \let\strutdepthfactor \@@itdiepte + \fi + \let\minimallinedistance\@@itafstand + \let\normallineheight\@@itregel % let ! ! ! ! ! ivm ex + \let\topskipfactor\@@itboven + \let\maxdepthfactor\@@itonder + \let\baselinegluefactor\@@itrek + \setfontparameters % redundant, can be \setstrut, test first + \updateraggedskips} % yes indeed + +\def\setuprelativeinterlinespace[#1]% + {\processallactionsinset % \regelwit = dummy ! + [#1] + [ \v!aan=>\oninterlineskip, + \v!uit=>\offinterlineskip, + \v!reset=>\setfontparameters,% just \setstrut, test first + \s!unknown=>\assignvalue{#1}\regelwit{1.00}{1.25}{1.50}% + \spacing\regelwit]} + \def\complexstelinterliniein[#1]% \commalistelement ipv #1 {\doifassignmentelse{#1} - {\getparameters[\??it][#1]% - \scratchdimen=0\@@ithoogte pt - \advance\scratchdimen by 0\@@itdiepte pt - \ifdim\scratchdimen>1pt - \showmessage{\m!layouts}{10}{\@@ithoogte,\@@itdiepte}% - \let\@@ithoogte\strutheightfactor - \let\@@itdiepte\strutdepthfactor - \else - \let\strutheightfactor\@@ithoogte - \let\strutdepthfactor \@@itdiepte - \fi - \let\minimallinedistance\@@itafstand - \let\normallineheight\@@itregel % let ! ! ! ! ! ivm ex - \let\topskipfactor\@@itboven - \let\maxdepthfactor\@@itonder - \let\baselinegluefactor\@@itrek - \setfontparameters % redundant, can be \setstrut, test first - \updateraggedskips} % yes indeed - {\processallactionsinset % \regelwit = dummy ! - [#1] - [ \v!aan=>\oninterlineskip, - \v!uit=>\offinterlineskip, - \v!reset=>\setfontparameters,% just \setstrut, test first - \s!unknown=>\assignvalue{#1}{\regelwit}{1.00}{1.25}{1.50}% - \spacing{\regelwit}]}} + \setupspecifiedinterlinespace\setuprelativeinterlinespace[#1]} + +\def\setuplocalinterlinespace[#1]% + {\localinterlinespacetrue + \stelinterliniein[#1]% + \localinterlinespacefalse} -\def\simplestelinterliniein% +\def\simplestelinterliniein {\localinterlinespacetrue \setfontparameters \updateraggedskips % funny one here @@ -179,7 +192,7 @@ \def\skipfactor {.75} \def\skipgluefactor{.25} -\def\normalskipamount% +\def\normalskipamount {\openlineheight \ifgridsnapping \else \ifblankoflexibel \!!plus\skipgluefactor\openlineheight @@ -191,44 +204,44 @@ \def\deblankoskip{\skipfactor\regelafstand} -\def\laatsteblankoskip% +\def\laatsteblankoskip {\blankoskip} -\def\geenblanko% +\def\geenblanko {\removelastskip} -\def\currentblanko% +\def\currentblanko {\v!groot} - -\def\oldprevdepth {\prevdepth}% + +\def\oldprevdepth {\prevdepth} \def\newprevdepth {-1001pt} \def\mindimen {1sp} % was: 0.00002pt - + \newif\iflokaalblankovast \newif\iflokaalblankoflexibel \newif\iffuzzyvskip -%%%% pas op, wordt ook in core-pos gebruikt +%%%% pas op, wordt ook in core-pos gebruikt \def\doassignsomeskip#1\to#2% ook nog \v!halveregel+fuzzysnap - {\doifelse{#1}{\v!regel} + {\doifelse{#1}\v!regel {#2\openlineheight} {\ifgridsnapping \assigndimension{#1}{#2}% - {.25\openlineheight}{.5\openlineheight}{\openlineheight}% + {.25\openlineheight}{.5\openlineheight}\openlineheight \else \assigndimension{#1}{#2}% - {\smallskipamount}{\medskipamount}{\bigskipamount}% + \smallskipamount\medskipamount\bigskipamount \fi}} -%%%% dus niet weg +%%%% dus niet weg % replaced % -% \def\dosingleblanko#1% -% {\doassignsomeskip#1\to\blankoskipamount +% \def\dosingleblanko#1% +% {\doassignsomeskip#1\to\blankoskipamount % \global\advance\blankoskip \blankoskipamount} -% +% % \def\doblanko#1% % {\processallactionsinset % is maar een actie % [#1] @@ -248,7 +261,7 @@ % \v!halveregel=>\ifgridsnapping\global\fuzzyvskiptrue\fi % \global\advance\blankoskip by .5\lineheight, % \s!unknown=>\doindirectblanko{#1}]} -% +% % \def\docomplexdoblanko[#1]% pas op \relax's zijn nodig ivm volgende \if % {\global\blankoresetfalse % \global\blankoblokkeerfalse @@ -266,7 +279,7 @@ % \ifblankobuiten % \else % \par -% \ifvmode %in pos fonts gaat dit mis +% \ifvmode %in pos fonts gaat dit mis % \ifblankoforceer%\ifdim\prevdepth>\zeropoint\else % % -1000pt signals top of page or column (\ejectcolumn) % \vbox{\strut}\kern-\lineheight @@ -307,13 +320,13 @@ % \fi % \fi % \ifblankoflexibel \else -% \blankoskip=1\blankoskip +% \blankoskip=1\blankoskip % \fi -% \iflokaalblankovast -% \blankoskip=1\blankoskip +% \iflokaalblankovast +% \blankoskip=1\blankoskip % \fi -% \iflokaalblankoflexibel -% \blankoskip=1\blankoskip +% \iflokaalblankoflexibel +% \blankoskip=1\blankoskip % \!!plus\skipgluefactor\blankoskip % \!!minus\skipgluefactor\blankoskip % \fi @@ -338,7 +351,7 @@ % \fi % \global\fuzzyvskipfalse % \presetindentation} -% +% % \def\complexdodoblanko[#1]% % {\flushnotes % \ifopelkaar @@ -350,7 +363,7 @@ % \else % \expanded{\docomplexdoblanko[#1]}% \expanded = nieuw % \fi} -% +% % % old % % % % \def\doindirectblanko#1% @@ -367,7 +380,7 @@ % % {\expanded{\complexdodoblanko[#1]}} % % {\doindirectblanko{#1}}}} % % -% % new, more robust +% % new, more robust % % % % \def\doindirectblanko#1% % % {\edef\ascii{#1}\convertcommand\ascii\to\ascii @@ -376,9 +389,9 @@ % % \else % % \expandafter\complexdoblanko\expandafter[\csname\??bo\ascii\endcsname]% % % \fi} -% % +% % % % even more robust -% +% % \def\doindirectblanko#1% % {\edef\ascii{#1}\convertcommand\ascii\to\ascii % \ifundefined{\??bo\ascii}% <-etex \expandafter\ifx\csname\??bo#1\endcsname @@ -389,15 +402,15 @@ % \def\TestBlank[#1]% % {blank : {\convertargument#1\to\ascii\tttf\ascii}\blanko[#1]} -% +% % \defineblank[whatever][2*big,2*big] % \TestBlank[] % \TestBlank[big] % \TestBlank[2*big] % \TestBlank[big,big,2*big] % \TestBlank[big] -% \TestBlank[whatever] -% \TestBlank[2*big,whatever] +% \TestBlank[whatever] +% \TestBlank[2*big,whatever] % \TestBlank[3\lineheight] \def\addblankskip#1#2#3% @@ -427,7 +440,7 @@ \defineblankmethod [\v!back ]{\geenblanko} \defineblankmethod [\v!halveregel]{\ifgridsnapping\global\fuzzyvskiptrue\fi \global\advance\blankoskip .5\lineheight} -% happens often +% happens often \defineblankmethod [2*\v!groot]{\addblankskip+{2\bigskipamount}{2\openlineheight}} @@ -438,9 +451,9 @@ \def\doblanko#1% {\edef\ascii{#1}\convertcommand\ascii\to\ascii \ifx\ascii\empty\else - \ifcsname\??bo\??bo\ascii\endcsname % internal def - \csname\??bo\??bo\ascii\endcsname - \else\ifcsname\??bo\ascii\endcsname % user def / slow + \ifcsname\??bo\??bo\ascii\endcsname % internal def + \csname\??bo\??bo\ascii\endcsname + \else\ifcsname\??bo\ascii\endcsname % user def / slow \@EA\rawprocesscommalist\@EA[\csname\??bo\ascii\endcsname]\doblanko\relax \else \dorepeatwithcommand[#1]\redoblanko @@ -450,9 +463,9 @@ \def\redoblanko#1% {\edef\ascii{#1}\convertcommand\ascii\to\ascii \ifx\ascii\empty\else - \ifcsname\??bo\??bo\ascii\endcsname % internal def - \csname\??bo\??bo\ascii\endcsname - \else\ifcsname\??bo\ascii\endcsname % user def / slow + \ifcsname\??bo\??bo\ascii\endcsname % internal def + \csname\??bo\??bo\ascii\endcsname + \else\ifcsname\??bo\ascii\endcsname % user def / slow \@EA\rawprocesscommalist\@EA[\csname\??bo\ascii\endcsname]\doblanko\relax \else \global\advance\blankoskip#1\relax @@ -461,7 +474,7 @@ \endETEX -\beginTEX +\beginTEX \def\doblanko#1% {\edef\ascii{#1}\convertcommand\ascii\to\ascii @@ -472,8 +485,8 @@ \else \@EA\rawprocesscommalist\@EA[\csname\??bo\ascii\endcsname]\doblanko\relax \fi - \else - \csname\??bo\??bo\ascii\endcsname + \else + \csname\??bo\??bo\ascii\endcsname \fi \fi} @@ -487,7 +500,7 @@ \@EA\rawprocesscommalist\@EA[\csname\??bo\ascii\endcsname]\doblanko\relax \fi \else - \csname\??bo\??bo\ascii\endcsname + \csname\??bo\??bo\ascii\endcsname \fi \fi} @@ -513,10 +526,12 @@ \fi \next} -\def\nocomplexdoblanko[#1]% - {% evt blokkeerfalse +\def\nocomplexdoblanko[#1]% + {% evt blokkeerfalse \ifmmode\else\par\fi} +% Overloaded in cont-new! + \def\docomplexdoblanko[#1]% pas op \relax's zijn nodig ivm volgende \if {\global\blankoresetfalse \global\blankoblokkeerfalse @@ -528,19 +543,20 @@ \blankobuitenfalse \expanded{\rawprocesscommalist[#1]}\doblanko \ifdim\blankoskip=\zeropoint\relax - \iflokaalblankoflexibel - \doglobal\advance\blankoskip \currentblanko - \else\iflokaalblankovast - \doglobal\advance\blankoskip \currentblanko + \iflokaalblankoflexibel + \doglobal\advance\blankoskip \currentblanko + \else\iflokaalblankovast + \doglobal\advance\blankoskip \currentblanko \fi\fi \fi \ifblankobuiten \else \par - \ifvmode %in pos fonts gaat dit mis + \ifvmode %in pos fonts gaat dit mis \ifblankoforceer%\ifdim\prevdepth>\zeropoint\else % -1000pt signals top of page or column (\ejectcolumn) - \vbox{\strut}\kern-\lineheight + \verticalstrut + \kern-\lineheight \fi \ifblankoblokkeer \global\doeblankofalse @@ -578,17 +594,18 @@ \fi \fi \ifblankoflexibel \else - \blankoskip1\blankoskip + \blankoskip1\blankoskip \fi - \iflokaalblankovast - \blankoskip1\blankoskip + \iflokaalblankovast + \blankoskip1\blankoskip \fi - \iflokaalblankoflexibel - \blankoskip1\blankoskip + \iflokaalblankoflexibel + \blankoskip1\blankoskip \!!plus\skipgluefactor\blankoskip \!!minus\skipgluefactor\blankoskip \fi \ifdim\prevdepth=\newprevdepth + % blokkeer \else \iffuzzyvskip \removelastfuzzyvskip @@ -610,39 +627,39 @@ \global\fuzzyvskipfalse \presetindentation} -%D For a long time we had: +%D For a long time we had: %D -%D \starttypen +%D \starttypen %D \def\simpledoblanko% %D {\doifelse{\currentwitruimte}{\v!geen} %D {\blanko[\currentblanko]} %D {\blanko[\currentwitruimte]}} %D \stoptypen %D -%D But Berend de Boer wanted more control, so now we have: +%D But Berend de Boer wanted more control, so now we have: -\def\simpledoblanko % ... +\def\simpledoblanko % ... {\doifelse\currentwitruimte\v!geen {\blanko[\currentblanko]} {\blanko[\s!default]}} %D Another useful definition would be: %D -%D \starttypen +%D \starttypen %D \definieerblanko %D [\s!default] %D [\v!groot] %D \stoptypen \def\dostelblankoin#1% amount are an plain inheritance - {\bigskipamount=#1\relax - \ifblankoflexibel \else - \bigskipamount=1\bigskipamount + {\bigskipamount#1\relax + \ifblankoflexibel \else + \bigskipamount1\bigskipamount \fi \medskipamount \bigskipamount \divide\medskipamount 2 \smallskipamount\bigskipamount \divide\smallskipamount 4 }% -\def\complexstelblankoin[#1]% more \let's +\def\complexstelblankoin[#1]% more \let's {\ifgridsnapping \blankoflexibelfalse \else @@ -666,11 +683,11 @@ \edef\deblankoskip{\regelafstand}% \dostelblankoin\deblankoskip \fi - \def\currentblanko{\v!groot}% + \let\currentblanko\v!groot % was \def, why ? \let\deblanko\v!groot, - \v!middel=>\def\currentblanko{\v!middel}% + \v!middel=>\let\currentblanko\v!middel % was \def, why ? \let\deblanko\v!middel, - \v!klein=>\def\currentblanko{\v!klein}% + \v!klein=>\let\currentblanko\v!klein % was \def, why ? \let\deblanko\v!klein, \v!normaal=>\dostelblankoin\deblankoskip \let\deblanko\v!groot, @@ -694,7 +711,7 @@ {\ifgridsnapping \blankoflexibelfalse \fi - \dostelblankoin{\deblankoskip}% + \dostelblankoin\deblankoskip \let\deblanko\v!groot \simplestelwitruimtein} @@ -712,9 +729,9 @@ \def\savecurrentblanko% {\edef\restorecurrentblanko% - {\bigskipamount=\the\bigskipamount - \medskipamount=\the\medskipamount - \smallskipamount=\the\smallskipamount + {\bigskipamount\the\bigskipamount + \medskipamount\the\medskipamount + \smallskipamount\the\smallskipamount \noexpand\def\noexpand\currentblanko{\currentblanko}% \ifblankoflexibel \noexpand\blankoflexibeltrue @@ -725,7 +742,7 @@ \def\inhibitblank% the fast, local way {\endgraf\ifvmode\prevdepth\newprevdepth\fi} -%D Now. +%D Now. \definieerblanko [\s!default] [\v!wit] \definieerblanko [\v!hoogte] [\strutheight] @@ -752,7 +769,7 @@ \simplestelinspringenin]} \def\simplestelinspringenin - {\assigndimension{\currentvoorwit}{\voorwit}{1em}{1.5em}{2em}% + {\assigndimension\currentvoorwit\voorwit{1em}{1.5em}{2em}% \parindent\voorwit\relax} \def\doinspringen[#1]% too many relaxes @@ -780,11 +797,11 @@ \sfcode`\?#1 \sfcode`\!#1\relax \sfcode`\:#1 \sfcode`\;#1\relax} -\def\frenchspacing {\dofrenchspacing{1000}} -\def\newfrenchspacing{\dofrenchspacing{1050}} +\def\frenchspacing {\dofrenchspacing{1000}} +\def\newfrenchspacing{\dofrenchspacing{1050}} \def\nonfrenchspacing - {\sfcode`\.3000 \sfcode`\,1250 + {\sfcode`\.3000 \sfcode`\,1250 \sfcode`\?3000 \sfcode`\!3000 \sfcode`\:2000 \sfcode`\;1500 } @@ -813,16 +830,16 @@ \def\fixedspace {\hskip.5em\relax} \def\removelastspace {\ifhmode\unskip\fi} \def\nospace {\removelastspace\ignorespaces} -\def\removeunwantedspaces{\ifhmode\unskip\unskip\unskip\unskip\fi} +\def\removeunwantedspaces{\ifhmode\unskip\unskip\unskip\unskip\unskip\fi} -% better, but not done: -% +% better, but not done: +% % \def\removelastspace % {\ifhmode \ifdim\lastskip=\spaceamount\relax % \unskip % \fi \fi} % -% due to backward compability +% due to backward compability \let\spatie \space \let\hardespatie\fixedspace @@ -835,7 +852,7 @@ {\nointerlineskip \vskip#1 } -%D A couple of plain macros: +%D A couple of plain macros: \ifx\thinspace\undefined @@ -843,7 +860,7 @@ \def\negthinspace{\kern-.16667em } \def\enspace {\kern .5em } -\fi +\fi \ifx\quad\undefined @@ -851,7 +868,9 @@ \def\quad {\hskip 1em\relax} \def\qquad {\hskip 2em\relax} -\fi +\fi + +\let\emspace\quad \ifx\smallskip\undefined @@ -859,7 +878,7 @@ \def\medskip {\vskip\medskipamount} \def\bigskip {\vskip\bigskipamount} -\fi +\fi \ifx\allowbreak\undefined @@ -869,7 +888,7 @@ \def\filbreak {\par\vfil\penalty-200\vfilneg} \def\goodbreak {\par\penalty-500 } -\fi +\fi %D Made slightly more readable: @@ -877,35 +896,35 @@ \def\vglue {\afterassignment\dovglue\scratchskip=} \def\hglue {\afterassignment\dohglue\scratchskip=} - \def\topglue{\nointerlineskip\vglue-\topskip\vglue} + \def\topglue{\nointerlineskip\vglue-\topskip\vglue} \def\dovglue - {\par - \scratchdimen\prevdepth + {\par + \scratchdimen\prevdepth \hrule\!!height\zeropoint - \nobreak\vskip\scratchskip + \nobreak\vskip\scratchskip \prevdepth\scratchdimen} \def\dohglue - {\leavevmode - \scratchcounter\spacefactor + {\leavevmode + \scratchcounter\spacefactor \vrule\!!width\zeropoint - \nobreak\hskip\scratchskip + \nobreak\hskip\scratchskip \spacefactor\scratchcounter} -\fi +\fi -\ifx\eject\undefined +\ifx\eject\undefined \def\eject{\par\break} -\fi +\fi \ifx\supereject\undefined \def\supereject{\par\penalty-\@MM} -\fi +\fi \ifx\dosupereject\undefined @@ -917,9 +936,9 @@ \vfill\supereject \fi} -\fi +\fi -%D We adapt plain's \type {\removelastskip} a bit: +%D We adapt plain's \type {\removelastskip} a bit: \ifx\removelastskip\undefined @@ -928,7 +947,7 @@ \vskip-\lastskip \fi \fi} -\fi +\fi \ifx\smallbreak\undefined @@ -956,7 +975,7 @@ \bigskip \fi} -\fi +\fi \newskip\tussenwit \tussenwit\zeropoint @@ -997,14 +1016,14 @@ \fi}% \ifgridsnapping \witruimteflexibelfalse - \tussenwit=1\tussenwit + \tussenwit1\tussenwit \ifdim\tussenwit>\zeropoint - \tussenwit=\baselineskip + \tussenwit\baselineskip \fi \else - \ifwitruimteflexibel \else \tussenwit=1\tussenwit \fi + \ifwitruimteflexibel \else \tussenwit1\tussenwit \fi \fi - \parskip=\tussenwit} + \parskip\tussenwit} \def\simplestelwitruimtein% == snelle \stelwitruimtein[\s!default] {\doifnot\currentwitruimte\v!geen\stelwitruimteopnieuwin @@ -1020,8 +1039,8 @@ \def\savecurrentwitruimte% {\edef\restorecurrentwitruimte% - {\tussenwit=\the\tussenwit - \parskip=\the\parskip + {\tussenwit\the\tussenwit + \parskip\the\parskip \noexpand\def\noexpand\currentwitruimte{\currentwitruimte}% \ifwitruimteflexibel \noexpand\witruimteflexibeltrue @@ -1064,47 +1083,47 @@ \def\noparskipsignal {0.00001pt} \def\lastdoneparskip {0pt} -\def\startopelkaar% +\def\startopelkaar {\dosingleempty\dostartopelkaar} \def\dostartopelkaar[#1]% nesting afvangen {\par \ifvmode - \edef\lastdoneparskip{\the\lastskip}% -\edef\lastdoneprevdepth{\the\prevdepth}% zeer recent toegevoegd - \ifdim\prevdepth=-1000pt % toegevoegd omdat binnen - \else % een vbox een extra skip - \witruimte % ongewenst is; dit kan -\baselinecorrection %% zie in \plaatsregister[n=1] + \edef\lastdoneparskip {\the\lastskip}% + \edef\lastdoneprevdepth{\the\prevdepth}% zeer recent toegevoegd + \ifdim\prevdepth=-\thousandpoint % toegevoegd omdat binnen + \else % een vbox een extra skip + \witruimte % ongewenst is; dit kan + \baselinecorrection %% zie in \plaatsregister[n=1] \vskip\noparskipsignal % waarschijnlijk ook in \fi % blanko blokkeer \bgroup \doifelse{#1}\v!blanko \opelkaarfalse \opelkaartrue - \blanko[\v!blokkeer] - \stelwitruimtein[\v!geen] + \blanko[\v!blokkeer] % dit is nog niet ok, gaat fout + \stelwitruimtein[\v!geen] % bovenin vtop (dwz, baseline) \fi} -\def\stopopelkaar% +\def\stopopelkaar {\par -\ifvmode - \egroup - \ifdim\lastskip=\noparskipsignal\relax - \removelastskip - \geenwitruimte - \vskip-\lastdoneparskip - \vskip+\lastdoneparskip -\prevdepth-\lastdoneprevdepth % zeer recent toegevoegd - \fi -\fi} + \ifvmode + \egroup + \ifdim\lastskip=\noparskipsignal\relax + \removelastskip + \geenwitruimte + \vskip-\lastdoneparskip + \vskip+\lastdoneparskip + \prevdepth-\lastdoneprevdepth % zeer recent toegevoegd + \fi + \fi} -\def\startvanelkaar% +\def\startvanelkaar {\blanko \leavevmode \bgroup} -\def\stopvanelkaar% +\def\stopvanelkaar {\egroup \blanko} @@ -1125,25 +1144,27 @@ {\bgroup \processaction [#1] - [ \v!blanko=>\let\dorondomregelcorrectie=\blanko, - \s!default=>\let\dorondomregelcorrectie=\relax, + [ \v!blanko=>\let\dorondomregelcorrectie\blanko, + \s!default=>\let\dorondomregelcorrectie\relax, \s!unknown=>{\def\dorondomregelcorrectie{\blanko[#1]}}]% \dorondomregelcorrectie \startbaselinecorrection \offbaselinecorrection} -\def\stopregelcorrectie% +\def\stopregelcorrectie {\stopbaselinecorrection \dorondomregelcorrectie \egroup} -\def\corrigeerwitruimte% +\def\corrigeerwitruimte {\dowithnextbox {\startbaselinecorrection \box\nextbox \stopbaselinecorrection}% \vbox} +\def\verticalstrut{\vbox{\hsize\zeropoint\strut}} + \def\showstruts% {\setteststrut} @@ -1199,7 +1220,7 @@ \def\baselinegluefactor {0} \def\normallineheight {\baselinefactor ex} -\def\minimallinedistance {\lineskip} +\def\minimallinedistance {\lineskip} \def\strutheight {0pt} \def\strutdepth {0pt} @@ -1219,6 +1240,7 @@ \newdimen\globalbodyfontsize \globalbodyfontsize=12pt \fi + \ifx\normalizedbodyfontsize\undefined \def\normalizedbodyfontsize{12pt} \fi @@ -1227,16 +1249,16 @@ % korpsgrootte 12pt is en (2) de fonts nog niet geladen zijn % en de instellingen bij het laden nogmaals plaatsvinden. -\def\topskipcorrection% +\def\topskipcorrection {\ifdim\topskip>\openstrutheight - % == \vskip\topskipgap + % == \vskip\topskipgap \vskip\topskip \vskip-\openstrutheight \fi - \vbox{\strut} + \verticalstrut \vskip-\openlineheight} -\def\settopskip% the extra test is needed for the lbr family +\def\settopskip % the extra test is needed for the lbr family {\topskip\systemtopskipfactor\globalbodyfontsize \ifgridsnapping \else \ifr@ggedbottom\!!plus5\globalbodyfontsize\fi @@ -1248,16 +1270,18 @@ \topskip\strutheightfactor\openlineheight\relax \fi} -\def\setmaxdepth% +\def\setmaxdepth {\maxdepth\systemmaxdepthfactor\globalbodyfontsize} -\def\normalbaselines% +\def\normalbaselines {\baselineskip\normalbaselineskip \lineskip\normallineskip \lineskiplimit\normallineskiplimit} -\def\setnormalbaselines% - {\lineheight\normallineheight +\def\setnormalbaselines + {\ifdim\normallineheight>\zeropoint + \lineheight\normallineheight + \fi \openlineheight\spacingfactor\lineheight \openstrutheight\strutheightfactor\openlineheight \openstrutdepth \strutdepthfactor \openlineheight @@ -1275,8 +1299,8 @@ \def\spacing#1% {\ifgridsnapping - %\doifnot{#1}{1}{\showmessage{\m!layouts}{11}{#1}}% - \ifdim#1pt=1pt\else\showmessage{\m!layouts}{11}{#1}\fi + %\doifnot{#1}{1}{\showmessage\m!layouts{11}{#1}}% + \ifdim#1\s!pt=1\s!pt\else\showmessage\m!layouts{11}{#1}\fi \edef\spacingfactor{1}% \else \edef\spacingfactor{#1}% @@ -1296,12 +1320,12 @@ % % \def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi} % -% could be: +% could be: % % \def\strut{\relax\ifmmode\copy\else\unhcopy\fi\strutbox} -\ifx\strutbox\undefined - +\ifx\strutbox\undefined + \newbox\strutbox \setbox\strutbox=\hbox{\vrule height8.5pt depth3.5pt width\z@} @@ -1309,9 +1333,9 @@ %\def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi} \def\strut{\relax\ifmmode\copy\else\unhcopy\fi\strutbox} -\fi +\fi -\let\normalstrut=\strut +\let\normalstrut=\strut % The double \hbox construction enables us to \backtrack % boxes. @@ -1328,27 +1352,30 @@ % \!!depth \strutdepth % \normalkern-\strutwidth}}} -\def\setstrut% +\def\setstrut {\setstrutdimen\strutheight\strutheightfactor\spacingfactor \setstrutdimen\strutdepth \strutdepthfactor \spacingfactor \dosetstrut} \def\setcharstrut#1% - {\setbox\strutbox\hbox{#1}% + {\setbox\strutbox\hbox{#1}% \edef\strutheight{\the\ht\strutbox}% \edef\strutdepth {\the\dp\strutbox}% \dosetstrut} +\def\setfontstrut + {\setcharstrut{(}} + \def\setcapstrut% could be M, but Q has descender - {\setcharstrut{Q}} + {\setcharstrut{Q}} -%D Centered looks nicer: +%D Centered looks nicer: \def\dosetstrut% {\let\strut\normalstrut \setbox\strutbox\normalhbox {\normalhbox to \zeropoint - {% \hss % new, will be option + {% \hss % new, will be option \vrule \!!width \strutwidth \!!height\strutheight @@ -1358,24 +1385,26 @@ %D Sometimes a capstrut comes in handy %D %D \starttabulatie[|Tl|l|l|] -%D \NC yes \NC normal strut \NC {\showstruts\setupstrut[ja]\strut} \NC \NR -%D \NC no \NC no strut \NC {\showstruts\setupstrut[nee]\strut} \NC \NR -%D \NC kap \NC a capital strut (i.e. Q) \NC {\showstruts\setupstrut[kap]\strut} \NC \NR -%D \NC A B \unknown \NC a character strut (e.g. A) \NC {\showstruts\setupstrut[A]\strut} \NC \NR -%D \NC \NC a normal strut \NC {\showstruts\setupstrut\strut} \NC \NR +%D \NC yes \NC normal strut \NC {\showstruts\setupstrut[ja]\strut} \NC \NR +%D \NC no \NC no strut \NC {\showstruts\setupstrut[nee]\strut} \NC \NR +%D \NC kap \NC a capital strut (i.e. Q) \NC {\showstruts\setupstrut[kap]\strut} \NC \NR +%D \NC A B \unknown \NC a character strut (e.g. A) \NC {\showstruts\setupstrut[A]\strut} \NC \NR +%D \NC \NC a normal strut \NC {\showstruts\setupstrut\strut} \NC \NR %D \stoptabulatie \def\setupstrut% {\dosingleempty\dosetupstrut} -\def\dosetupstrut[#1]% yet undocumented +\def\dosetupstrut[#1]% yet undocumented, todo: fontstrut {\processaction [#1] [ \v!ja=>\setstrut, \v!nee=>\setnostrut, \v!kap=>\setcapstrut, + \v!passend=>\setfontstrut, + \v!regel=>\setstrut, \s!default=>\setstrut, - \s!unknown=>\setcharstrut{\commalistelement}]} + \s!unknown=>\setcharstrut\commalistelement]} \def\setteststrut% {\def\strutwidth{.8pt}% @@ -1383,16 +1412,16 @@ \def\begstrut% {%relax\ifdim\ht\strutbox=\zeropoint\else - \relax\ifcase\ht\strutbox\else + \relax\ifcase\ht\strutbox\else \strut \normalpenalty\@M % \!!tenthousand \normalhskip\zeropoint \ignorespaces \fi} -\def\endstrut% +\def\endstrut {%relax\ifhmode\ifdim\ht\strutbox=\zeropoint\else - \relax\ifhmode\ifcase\ht\strutbox\else + \relax\ifhmode\ifcase\ht\strutbox\else \removeunwantedspaces \normalpenalty\@M % \!!tenthousand \normalhskip\zeropoint @@ -1401,8 +1430,8 @@ \newbox\nostrutbox \setbox\nostrutbox\normalhbox{\normalhbox{}} -\def\setnostrut% - {\setbox\strutbox\copy\nostrutbox +\def\setnostrut + {\setbox\strutbox\copy\nostrutbox \let\strut\empty \let\endstrut\empty \let\begstrut\empty} @@ -1430,7 +1459,7 @@ \let\pseudoendstrut\removeunwantedspaces -\def\resetteststrut% +\def\resetteststrut {\let\strutwidth\!!zeropoint \setstrut} @@ -1438,7 +1467,7 @@ \def\setfontparameters{\the\everybodyfont} \fi -%D Handy: +%D Handy: \def\baselinedistance{\the\lineheight} @@ -1447,7 +1476,7 @@ %D why|>| this assignment gives troubles in for instance the %D visual debugger. -%D The plain ones: +%D The plain ones: \def\offinterlineskip {\baselineskip-1000\p@ @@ -1459,11 +1488,11 @@ \let\normaloffinterlineskip=\offinterlineskip % knuth's original -%D My own one: +%D My own one: -\def\offinterlineskip% +\def\offinterlineskip {\ifdim\baselineskip>\zeropoint - \edef\oninterlineskip% + \edef\oninterlineskip {\baselineskip\the\baselineskip \lineskip\the\lineskip \lineskiplimit\the\lineskiplimit @@ -1475,7 +1504,7 @@ \let\oninterlineskip=\relax -\def\leaveoutervmode% +\def\leaveoutervmode {\ifvmode\ifinner\else \leavevmode \fi\fi} @@ -1516,6 +1545,7 @@ [ \v!links=>\global\advance\linkssmaller \@@sllinks, \v!midden=>\global\advance\middensmaller \@@slmidden, \v!rechts=>\global\advance\rechtssmaller \@@slrechts, + \v!geen=>, \s!unknown=>\global\advance\middensmaller \commalistelement]} \def\dosmaller[#1]% @@ -1524,6 +1554,7 @@ [ \v!links=>\global\advance\linkssmaller \@@sllinks, \v!midden=>\global\advance\middensmaller \@@slmidden, \v!rechts=>\global\advance\rechtssmaller \@@slrechts, + \v!geen=>,% handy for delimitedtexts \s!unknown=>{\herhaalmetcommando[#1]\dosinglesmaller}]} \def\complexstartsmaller[#1]% @@ -1536,20 +1567,34 @@ \advance\leftskip \linkssmaller \advance\rightskip \rechtssmaller \advance\leftskip \middensmaller - \advance\rightskip \middensmaller} + \advance\rightskip \middensmaller + \seteffectivehsize} -\def\simplestartsmaller% +\def\simplestartsmaller {\startsmaller[\v!midden]} \definecomplexorsimple\startsmaller -\def\stopsmaller% +\def\stopsmaller {\par % else skips forgotten \egroup} -\def\stelsmallerin% +\def\stelsmallerin {\dodoubleargument\getparameters[\??sl]} +\newdimen\@@effectivehsize \def\effectivehsize {\hsize} +\newdimen\@@effectiveleftskip \def\effectiveleftskip {\leftskip} +\newdimen\@@effectiverightskip \def\effectiverightskip{\rightskip} + +\def\seteffectivehsize + {\setlocalhsize + \@@effectivehsize \localhsize + \@@effectiveleftskip \leftskip + \@@effectiverightskip \rightskip + \let\effectivehsize \@@effectivehsize + \let\effectiveleftskip \@@effectiveleftskip + \let\effectiverightskip\@@effectiverightskip} + \def\dodefinieerhbox[#1][#2]% {\setvalue{hbox#1}##1% {\hbox to #2{\begstrut##1\endstrut\hss}}} @@ -1562,14 +1607,9 @@ \let\\=\endgraf \forgetall#1\let\next=} -\def\lbox% - {\lrcbox\raggedleft} - -\def\rbox% - {\lrcbox\raggedright} - -\def\cbox% - {\lrcbox\raggedcenter} +\def\lbox{\lrcbox\raggedleft} +\def\rbox{\lrcbox\raggedright} +\def\cbox{\lrcbox\raggedcenter} \def\dosetraggedvbox#1% {\processaction @@ -1602,10 +1642,10 @@ % \s!default=>\def\raggedcommand{\raggedcenter}, % \s!unknown=>\let\raggedcommand\relax]} -\def\dosetraggedcommand#1% +\def\dosetraggedcommand#1% {\expanded{\dodosetraggedcommand{#1}}} - -% \def\dodosetraggedcommand#1% + +% \def\dodosetraggedcommand#1% % {\doifinsetelse{\v!ruim} {#1}{\!!doneatrue}{\!!doneafalse}% % \doifinsetelse{\v!breed}{#1}{\!!donebtrue}{\!!donebfalse}% % \let\raggedcommand\relax @@ -1629,17 +1669,17 @@ % \fi\fi % \!!donecfalse % {\v!midden,\v!midden} % \else -% \let\raggedbottomcommand\vfilll % bonus, pretty strong -% \let\raggedtopcommand \vfilll % used with \framed for +% \let\raggedbottomcommand\vfilll % bonus, pretty strong +% \let\raggedtopcommand \vfilll % used with \framed for % \fi, % instance in tables -% \v!hoog=>\let\raggedbottomcommand\vfilll, % and since we lack a +% \v!hoog=>\let\raggedbottomcommand\vfilll, % and since we lack a % \v!laag=>\let\raggedtopcommand \vfilll, % proper keyword, but -% \v!laho=>\let\raggedbottomcommand\vfilll % we do support the +% \v!laho=>\let\raggedbottomcommand\vfilll % we do support the % \let\raggedtopcommand \vfilll, % ugly laho (lohi) % \v!nee=>\def\raggedcommand{\raggedright}, % \v!ja=>\let\raggedcommand\notragged, % was \relax % \v!normaal=>\let\raggedcommand\notragged]} % was \relax -% +% % much faster and important since TABLE uses them a lot: \def\dodosetraggedcommand#1% beware: #1=empty is ignored, keep that! @@ -1722,7 +1762,7 @@ % Om ongewenste witruimte te voorkomen kan met \dosomebreak{\break} % een \penalty v¢¢r witruimte worden geplaatst. -\def\removelastskip% a redefinition of plain +\def\removelastskip% a redefinition of plain {\ifvmode\ifdim\lastskip=\zeropoint\else\vskip-\lastskip\fi\fi} \def\dosomebreak#1% @@ -1789,10 +1829,10 @@ \def\indentation% {\ifvmode \ifdim\parindent=\zeropoint \else - % was : \hskip\parindent - % can be: \indent - % but we test: - \noindent\hskip\parindent + % was : \hskip\parindent + % can be: \indent + % but we test: + \noindent\hskip\parindent \fi \fi} % vergeten @@ -1818,26 +1858,29 @@ \voorwit\zeropoint \parindent\zeropoint\relax} -\def\forgetparskip% +\def\forgetparskip {\let\currentwitruimte\v!geen \tussenwit\zeropoint \parskip\zeropoint\relax} -\def\forgetbothskips% - {\tolerance=1500 +\def\forgetbothskips + {\tolerance1500 \leftskip\zeropoint \rightskip\zeropoint\relax} -\def\forgetspacing% +\def\forgetspacing {\emergencystretch\zeropoint} -\def\forgetall% +\def\forgetall {\the\everyforgetall} -\appendtoks \forgetragged \to \everyforgetall -\appendtoks \forgetparskip \to \everyforgetall -\appendtoks \forgetparindent \to \everyforgetall -\appendtoks \forgetbothskips \to \everyforgetall +\newif\ifforgotten % rather good signal for inner + +\appendtoks \forgottentrue \to \everyforgetall +\appendtoks \forgetragged \to \everyforgetall +\appendtoks \forgetparskip \to \everyforgetall +\appendtoks \forgetparindent \to \everyforgetall +\appendtoks \forgetbothskips \to \everyforgetall \appendtoks \forgetspacing \to \everyforgetall % i.v.m. funny spacing in pagebody \appendtoks \everypar\emptytoks \to \everyforgetall % indeed! @@ -1845,7 +1888,7 @@ {\vbox#1\bgroup \forgetparskip \setlocalhsize - \hsize=\localhsize + \hsize\localhsize \forgetparindent \forgetbothskips \forgeteverypar @@ -1863,25 +1906,27 @@ % {\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). +%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). -\beginTEX +\let\dostopattributes\relax % in case these commands end up in an edef + +\beginTEX \unexpanded\def\dostartattributes#1#2#3% {\begingroup % geen \bgroup, anders in mathmode lege \hbox \@EA\ifx\csname#1#3\endcsname\relax - \let\dostopattributes\endgroup + \let\dostopattributes\@@nostopattributes \else \let\dostopattributes\@@dostopattributes \startcolor[\csname#1#3\endcsname]% @@ -1901,8 +1946,8 @@ \ifcsname#1#3\endcsname \let\dostopattributes\@@dostopattributes \startcolor[\csname#1#3\endcsname]% - \else - \let\dostopattributes\endgroup + \else + \let\dostopattributes\@@nostopattributes \fi \ifcsname#1#2\endcsname \expandafter\doconvertfont @@ -1912,14 +1957,17 @@ \endETEX -\unexpanded\def\@@dostopattributes% +\unexpanded\def\@@dostopattributes {\stopcolor \endgroup} +\unexpanded\def\@@nostopattributes + {\endgroup} + \unexpanded\def\doattributes#1#2#3#4% {\dostartattributes{#1}{#2}{#3}{#4}\dostopattributes} -% An even faster \ETEX\ version: +% An even faster \ETEX\ version: \beginETEX @@ -1929,15 +1977,18 @@ % \let\dostopattributes\@@dostopattributes % \startcolor[\csname#1#3\endcsname]% % \else -% \let\dostopattributes\endgroup +% \let\dostopattributes\@@nostopattributes % \fi % \ifcsname#1#2\endcsname % \@EAEAEA\doconvertfont\@EA\@EA\csname#1#2\endcsname % \fi} -% +% % \unexpanded\def\@@dostopattributes% % {\stopcolor % \endgroup} +% +% \unexpanded\def\@@nostopattributes% +% {\endgroup} \unexpanded\def\dostartattributes#1#2#3% {\begingroup % geen \bgroup, anders in mathmode lege \hbox @@ -1946,22 +1997,25 @@ \let\dostopattributes\@@dostopattributes \doglobalstartcolor[\csname#1#3\endcsname]% \else - \let\dostopattributes\endgroup + \let\dostopattributes\@@nostopattributes \fi \else - \let\dostopattributes\endgroup + \let\dostopattributes\@@nostopattributes \fi \ifcsname#1#2\endcsname \@EAEAEA\doconvertfont\@EA\@EA\csname#1#2\endcsname \fi} -\unexpanded\def\@@dostopattributes% +\unexpanded\def\@@dostopattributes {\doglobalstopcolor \endgroup} +\unexpanded\def\@@nostopattributes + {\endgroup} + \endETEX -%D Bonus macro, see core-sec.tex +%D Bonus macro, see core-sec.tex \beginTEX @@ -1981,7 +2035,7 @@ \endETEX -%D Since this happens a lot, and sometimes large arguments +%D Since this happens a lot, and sometimes large arguments %D are passed in \type {#4}, we just copy some code: \beginETEX \ifcsname @@ -2009,28 +2063,41 @@ % Kan vaker worden toegepast en moet bovendien sneller! \newskip\leftskipadaption +\newskip\rightskipadaption \def\doadaptleftskip#1% {\dosetleftskipadaption{#1}% - \advance\leftskip by \leftskipadaption} + \advance\leftskip \leftskipadaption} + +\def\doadaptrightskip#1% + {\dosetrightskipadaption{#1}% + \advance\rightskip \rightskipadaption} \beginTEX \def\dosetleftskipadaption#1% {\leftskipadaption\zeropoint - \processaction[#1] % \ExpandFirstAfter - [\v!standaard=>\leftskipadaption= + \processaction[#1] + [\v!standaard=>\leftskipadaption \ifdim\voorwit=\zeropoint\@@sllinks\else\voorwit\fi, - \v!ja=>\leftskipadaption= + \v!ja=>\leftskipadaption \ifdim\voorwit=\zeropoint\@@sllinks\else\voorwit\fi, \v!nee=>, - \s!unknown=>\leftskipadaption=#1]} + \s!unknown=>\leftskipadaption#1]} + +\def\dosetrightskipadaption#1% + {\rightskipadaption\zeropoint + \processaction[#1] + [\v!standaard=>\rightskipadaption\@@slrechts, + \v!ja=>\rightskipadaption\@@slrechts, + \v!nee=>, + \s!unknown=>\rightskipadaption#1]} \endTEX \beginETEX -% installation +% installation \setvalue{@lsa@\v!standaard}% {\ifdim\voorwit=\zeropoint\@@sllinks\else\voorwit\fi} @@ -2038,11 +2105,13 @@ \setvalue{@lsa@\v!ja}% {\ifdim\voorwit=\zeropoint\@@sllinks\else\voorwit\fi} -\setvalue{@lsa@\v!nee}% - {\zeropoint} +\letvalue{@lsa@\v!nee }\zeropoint +\letvalue{@lsa@\empty }\zeropoint -\setvalue{@lsa@\empty}% - {\zeropoint} +\setvalue{@rsa@\v!standaard}{\@@slrechts} +\setvalue{@rsa@\v!ja }{\@@slrechts} +\letvalue{@rsa@\v!nee }\zeropoint +\letvalue{@rsa@\empty }\zeropoint % not safe for 2\parindent % @@ -2050,7 +2119,7 @@ % {\leftskipadaption % \ifcsname @lsa@#1\endcsname % \csname @lsa@#1\endcsname -% \else +% \else % #1% % \fi % \relax} @@ -2061,11 +2130,21 @@ \leftskipadaption \ifcsname\ascii\endcsname \csname\ascii\endcsname - \else + \else #1% \fi \relax} +\def\dosetrightskipadaption#1% + {\edef\ascii{@rsa@#1}% + \convertcommand\ascii\to\ascii + \rightskipadaption + \ifcsname\ascii\endcsname + \csname\ascii\endcsname + \else + #1% + \fi + \relax} \endETEX @@ -2143,28 +2222,28 @@ % \else % #1% was #2 % \fi} -% +% % better : \def\doifrightpageelse % watch out: other default ! ! ! {\ifinpagebody \ifdubbelzijdig - \ifodd\twopassdata\relax - \twopassdatafoundtrue \else \twopassdatafoundfalse + \ifodd\twopassdata\relax + \twopassdatafoundtrue \else \twopassdatafoundfalse \fi \else \twopassdatafoundtrue \fi - \else + \else \ifdubbelzijdig \gettwopassdata\s!paragraph \iftwopassdatafound - \ifodd\twopassdata\relax - \twopassdatafoundtrue \else \twopassdatafoundfalse + \ifodd\twopassdata\relax + \twopassdatafoundtrue \else \twopassdatafoundfalse \fi \else \ifodd\realpageno\relax - \twopassdatafoundtrue \else \twopassdatafoundfalse + \twopassdatafoundtrue \else \twopassdatafoundfalse \fi \fi \else @@ -2172,9 +2251,9 @@ \fi \fi \iftwopassdatafound - \@EA\firstoftwoarguments + \@EA\firstoftwoarguments \else - \@EA\secondoftwoarguments + \@EA\secondoftwoarguments \fi} \def\signalrightpage @@ -2200,7 +2279,7 @@ % % en worden hieronder wat aangepast. -% the three boolean will become obsolete some day in favour +% the three boolean will become obsolete some day in favour % of \bottomraggedness \chardef\bottomraggedness=0 % 0=ragged 1=normal/align 2=baseline @@ -2213,24 +2292,24 @@ \def\normalbottom% {% \topskip 10pt - \r@ggedbottomfalse} + \r@ggedbottomfalse} -\def\raggedbottom% - {\chardef\bottomraggedness=0 +\def\raggedbottom + {\chardef\bottomraggedness0 \n@rmalbottomfalse \r@ggedbottomtrue \b@selinebottomfalse \settopskip} -\def\alignbottom% - {\chardef\bottomraggedness=1 +\def\alignbottom + {\chardef\bottomraggedness1 \n@rmalbottomtrue \r@ggedbottomfalse \b@selinebottomfalse \settopskip} -\def\baselinebottom% - {\chardef\bottomraggedness=2 +\def\baselinebottom + {\chardef\bottomraggedness2 \n@rmalbottomfalse \r@ggedbottomfalse \b@selinebottomtrue @@ -2239,11 +2318,11 @@ \let\normalbottom=\alignbottom % downward compatible % so, the new one will be -% +% % \chardef\bottomraggedness=0 % 0=ragged 1=normal/align 2=baseline -% -% \def\bottomalignlimit{3\lineheight} % will be settable -% +% +% \def\bottomalignlimit{3\lineheight} % will be settable +% % \def\raggedbottom {\chardef\bottomraggedness=0 \settopskip} % \def\alignbottom {\chardef\bottomraggedness=1 \settopskip} % \def\baselinebottom{\chardef\bottomraggedness=2 \settopskip} @@ -2254,18 +2333,18 @@ % \tolerance >= 1500 % was 200 % \raggedness = 2 .. 6\korpsgrootte -\chardef\raggedstatus=0 % normal left center right +\chardef\raggedstatus=0 % normal left center right \def\leftraggedness {2\bodyfontsize} \def\rightraggedness {2\bodyfontsize} \def\middleraggedness {6\bodyfontsize} -%D More hyphenation control, will be combined with align -%D setup. +%D More hyphenation control, will be combined with align +%D setup. -\def\nohyphens% +\def\nohyphens {\ifx\dohyphens\relax - \edef\dohyphens% + \edef\dohyphens {\hyphenpenalty\the\hyphenpenalty \exhyphenpenalty\the\exhyphenpenalty\relax}% \fi @@ -2274,19 +2353,19 @@ \let\dohyphens\relax -%D To prevent unwanted side effects, we also have to check -%D for hyphens here: +%D To prevent unwanted side effects, we also have to check +%D for hyphens here: \def\setraggedness#1% - {\ifnum\tolerance<1500\relax % small values have - \tolerance=1500\relax % unwanted side effects - \fi - \spaceskip=2.5\hsize % we misuse these registers - \xspaceskip=#1\relax % for temporary storage; - \divide\spaceskip by \xspaceskip % they are changed anyway - \ifx\dohyphens\relax - \hyphenpenalty=\spaceskip % \else no hyphens is active - \fi} + {\ifnum\tolerance<1500\relax % small values have + \tolerance1500\relax % unwanted side effects + \fi + \spaceskip2.5\hsize % we misuse these registers + \xspaceskip#1\relax % for temporary storage; + \divide\spaceskip \xspaceskip % they are changed anyway + \ifx\dohyphens\relax + \hyphenpenalty\spaceskip % \else no hyphens is active + \fi} \let\updateraggedskips\relax @@ -2296,9 +2375,9 @@ \updateraggedskips} \def\dosetraggedskips#1#2#3#4#5#6#7% - {\chardef\raggedstatus=#1\relax - \leftskip=1\leftskip\!!plus#2\relax % zie: Tex By Topic 8.1.3 - \rightskip=1\rightskip\!!plus#3\relax % zie: Tex By Topic 8.1.3 + {\chardef\raggedstatus#1\relax + \leftskip1\leftskip\!!plus#2\relax % zie: Tex By Topic 8.1.3 + \rightskip1\rightskip\!!plus#3\relax % zie: Tex By Topic 8.1.3 \spaceskip#4\relax \xspaceskip#5\relax \parfillskip\zeropoint\!!plus#6\relax @@ -2307,41 +2386,52 @@ % \def\notragged% % {\setraggedskips{0}{0em}{0em}{0em}{0em}{1fil}{\parindent}} +% todo + +\def\raggedfillamount {1fil} +\def\raggedhalffillamount{.5fil} +\def\raggedspaceamount {.3333em} +\def\raggedxspaceamount {.5em} + \def\notragged - {\chardef\raggedstatus=0 + {\chardef\raggedstatus\zerocount \leftskip1\leftskip \rightskip1\rightskip \spaceskip\zeropoint \xspaceskip\zeropoint - \parfillskip\zeropoint\!!plus1fil\relax - \let\updateraggedskips\relax} % new + \parfillskip\zeropoint\!!plus\raggedfillamount\relax + \let\updateraggedskips\relax} % new \let\forgetragged\notragged -\def\raggedleft% +\def\raggedleft {\setraggedness\leftraggedness - \setraggedskips{1}{\leftraggedness}{0em}{.3333em}{.5em}{0em}{0em}} + \setraggedskips1\leftraggedness\zeropoint\raggedspaceamount + \raggedxspaceamount\zeropoint\zeropoint} -\def\raggedcenter% +\def\raggedcenter {\setraggedness\middleraggedness - \setraggedskips{2}{\middleraggedness}{\middleraggedness}{.3333em}{.5em}{0em}{0em}} + \setraggedskips2\middleraggedness\middleraggedness\raggedspaceamount + \raggedxspaceamount\zeropoint\zeropoint} %D We used to have: %D %D \starttypen -%D \def\raggedright% +%D \def\raggedright %D {\setraggedness\rightraggedness %D \setraggedskips{3}{0em}{\rightraggedness}{.3333em}{.5em}{0em}{\parindent}} %D \stoptypen %D %D However, the next alternative, suggested by Taco, is better. -\def\raggedright% +\def\raggedright {\setraggedness\rightraggedness - \setraggedskips{3}{0em}{\rightraggedness}{.3333em}{.5em}{1fil}{\parindent}} + \setraggedskips3\zeropoint\rightraggedness\raggedspaceamount + \raggedxspaceamount\raggedfillamount\parindent} -\def\veryraggedleft% - {\setraggedskips{1}{1fil}{0em}{.3333em}{.5em}{0em}{0em}} +\def\veryraggedleft + {\setraggedskips1\raggedfillamount\zeropoint\raggedspaceamount + \raggedxspaceamount\zeropoint\zeropoint} %D When we want the last line to have a natural width: %D @@ -2352,27 +2442,31 @@ %D %D but this one is not accepted by the macros. -\def\veryraggedcenter% - {\setraggedskips{2}{1fil}{1fil}{.3333em}{.5em}{0em}{0em}} +\def\veryraggedcenter + {\setraggedskips2\raggedfillamount\raggedfillamount\raggedspaceamount + \raggedxspaceamount\zeropoint\zeropoint} -\def\veryraggedright% - {\setraggedskips{3}{0em}{1fil}{.3333em}{.5em}{0em}{\parindent}} +\def\veryraggedright + {\setraggedskips3\zeropoint\raggedfillamount\raggedspaceamount + \raggedxspaceamount\zeropoint\parindent} -\def\ttraggedright% +\def\ttraggedright {\tttf - \setraggedskips{3}{0em}{\rightraggedness}{0em}{0em}{0em}{\parindent}} % {\voorwit}} + \setraggedskips3\zeropoint\rightraggedness + \zeropoint\zeropoint\zeropoint\parindent} % \voorwit %D A bonus one: -\def\raggedwidecenter% +\def\raggedwidecenter {\setraggedness\middleraggedness - \setraggedskips{2}{.5fil}{.5fil}{.3333em}{.5em}{0em}{0em}} + \setraggedskips2\raggedhalffillamount\raggedhalffillamount + \raggedspaceamount\raggedxspaceamount\zeropoint\zeropoint} -\newif\if@@asragged \@@asraggedtrue % old method +\newif\if@@asragged \@@asraggedtrue % old method \def\dodosteluitlijnenin[#1]% - {\doifinsetelse{\v!ruim} {#1}{\!!doneatrue}{\!!doneafalse}% - \doifinsetelse{\v!breed}{#1}{\!!donebtrue}{\!!donebfalse}% + {\doifinsetelse\v!ruim {#1}\!!doneatrue\!!doneafalse + \doifinsetelse\v!breed{#1}\!!donebtrue\!!donebfalse \ExpandFirstAfter\processallactionsinset [#1] [ \v!regel=>\baselinebottom, @@ -2402,10 +2496,10 @@ \def\dosteluitlijnenin[#1]% {\expanded{\dodosteluitlijnenin[#1]}} -\def\steluitlijnenin% +\def\steluitlijnenin {\dosingleargument\dosteluitlijnenin} -\def\startuitlijnen% +\def\startuitlijnen {\bgroup \steluitlijnenin} @@ -2413,18 +2507,19 @@ {\par \egroup} -\def\doalignline#1#2% \\ == newline +\def\doalignline#1#2% \\ == newline {\bgroup + \setlocalhsize % new \def\\{\egroup\par\doalignline{#1}{#2}\bgroup}% \dowithnextbox - {\noindent\hbox to \hsize{\strut#1\unhbox\nextbox#2}\egroup} + {\noindent\hbox to \localhsize{\strut#1\unhbox\nextbox#2}\egroup} \hbox} % directe commando's \def\regellinks {\doalignline \relax \hss } -\def\regelrechts{\doalignline \hss \relax} \def\regelmidden{\doalignline \hss \hss } +\def\regelrechts{\doalignline \hss \relax} \def\regelbegrensd#1{\limitatetext{#1}{\hsize}{\unknown}} @@ -2437,13 +2532,14 @@ \def\doregelplaats#1% {\getvalue{\s!do\v!regel#1}} -%D Experimental: +%D Experimental: \def\doxalignline#1#2% {\bgroup + \setlocalhsize \def\\{\egroup\par\doxalignline{#1}{#2}\bgroup}% inefficient \dowithnextbox - {\noindent\hbox to \hsize + {\noindent\hbox to \localhsize {\strut\signalrightpage \doifrightpageelse{#1\unhbox\nextbox#2}{#2\unhbox\nextbox#1}}% \egroup} @@ -2452,12 +2548,12 @@ \setvalue{\s!do\v!regel\v!binnen}{\doxalignline\relax\hss} \setvalue{\s!do\v!regel\v!buiten}{\doxalignline\hss\relax} -%D Better: +%D Better: \def\doregelplaats#1% {\getvalue{\s!do\v!regel#1}} -\def\alignedline#1#2% setting default +\def\alignedline#1#2% setting default {\csname \s!do\v!regel \ifundefined{\s!do\v!regel#1}#2\else#1\fi @@ -2466,10 +2562,10 @@ % \def\doregelplaats#1% % {\alignedline{#1}\v!links} -%D ... +%D ... \def\dosteltolerantiein[#1]% - {\doifinsetelse{\v!vertikaal}{#1}% + {\doifinsetelse\v!vertikaal{#1}% {\ExpandFirstAfter\processallactionsinset [#1] [\v!zeerstreng=>\def\bottomtolerance{}, @@ -2478,12 +2574,12 @@ \v!zeersoepel=>\def\bottomtolerance{.100}]}% {\ExpandFirstAfter\processallactionsinset [#1] - [ \v!rek=>\emergencystretch=\bodyfontsize, + [ \v!rek=>\emergencystretch\bodyfontsize, \v!spatie=>\spaceskip.5em\!!plus.25em\!!minus.25em\relax, - \v!zeerstreng=>\tolerance=200, - \v!streng=>\tolerance=1500, - \v!soepel=>\tolerance=3000, - \v!zeersoepel=>\tolerance=4500]}} + \v!zeerstreng=>\tolerance 200, + \v!streng=>\tolerance1500, + \v!soepel=>\tolerance3000, + \v!zeersoepel=>\tolerance4500]}} \def\steltolerantiein {\dosingleargument\dosteltolerantiein} @@ -2503,15 +2599,15 @@ {\bgroup \ifhmode \unskip - \setbox\indentationboxA=\lastbox % get \strut if present + \setbox\indentationboxA\lastbox % get \strut if present \unskip - \setbox\indentationboxB=\lastbox % get \indent generated box + \setbox\indentationboxB\lastbox % get \indent generated box \unskip \else - \hskip\zeropoint % switch to horizontal mode + \hskip\zeropoint % switch to horizontal mode \unskip - \setbox\indentationboxA=\lastbox % get \indent generated box - \setbox\indentationboxB=\box\voidb@x + \setbox\indentationboxA\lastbox % get \indent generated box + \setbox\indentationboxB\box\voidb@x \fi} \def\popindentation% @@ -2559,7 +2655,7 @@ \def\definehspace {\dotripleempty\dodefinehspace} -\def\dodefinehspace[#1][#2][#3]% #1 = optional namespace +\def\dodefinehspace[#1][#2][#3]% #1 = optional namespace {\ifthirdargument \setvalue{\??hs#1:#2}{#3}% \else @@ -2579,7 +2675,7 @@ % \hspaceamount\empty{\iffirstargument#1\else\s!default\fi}% % \fi % \expandafter\ignorespaces -% \fi} +% \fi} \def\dohspace[#1][#2]% {\ifsecondargument @@ -2588,7 +2684,7 @@ \hspace[][#1]% \else \hspace[][\s!default]% - \fi\fi} + \fi\fi} \def\dodohspace[#1][#2#3]% {\ifhmode @@ -2608,16 +2704,16 @@ \definehspace [\v!klein] [.25\emspaceamount] \definehspace [\v!middel] [.5\emspaceamount] \definehspace [\v!groot] [1\emspaceamount] -\definehspace [\v!normaal] [1\spaceamount] +\definehspace [\v!normaal] [1\spaceamount] \definehspace [\v!default] [\spaceamount] -%D Taken from Taco's math module (cq. \AMS\ macros), but -%D adapted to \type {\hspace}: +%D Taken from Taco's math module (cq. \AMS\ macros), but +%D adapted to \type {\hspace}: \unexpanded\def\textormathspace#1#2#3% {\ifmmode\mskip#1#2\else\kern#1\hspaceamount\empty{#3}\fi\relax} -\def\thinspace {\textormathspace+\thinmuskip 1} +\def\thinspace {\textormathspace+\thinmuskip 1} \def\medspace {\textormathspace+\medmuskip 2} \def\thickspace {\textormathspace+\thickmuskip3} \def\negthinspace {\textormathspace-\thinmuskip 1} @@ -2633,23 +2729,18 @@ \definehspace[2][.2222em] \definehspace[3][.2777em] -% Very nasty but needed for margin stuff inside colored -% paragraphs. +% Very nasty but needed for margin stuff inside colored +% paragraphs. \let\normalvadjust\vadjust -\def\graphicvadjust % bad, those low level color calls here +\def\graphicvadjust % bad, those low level color calls here {\dowithnextbox {\normalvadjust {\dostartgraphicgroup - \ifx\maintextcolor\empty - \stopcolormode - \unvbox\nextbox - \else - \startcolormode\maintextcolor - \unvbox\nextbox - \stopcolormode - \fi + \localstarttextcolor + \unvbox\nextbox + \localstoptextcolor \dostopgraphicgroup}}% \vbox} @@ -2712,4 +2803,4 @@ \stelspatieringin [\v!opelkaar] -\protect \endinput +\protect \endinput diff --git a/tex/context/base/core-syn.tex b/tex/context/base/core-syn.tex index a9153089a..1791899fb 100644 --- a/tex/context/base/core-syn.tex +++ b/tex/context/base/core-syn.tex @@ -31,11 +31,11 @@ \def\dostelsynoniemenin[#1][#2]% {\getparameters[\??sm#1][#2]} -\def\stelsynoniemenin% +\def\stelsynoniemenin {\dodoubleargument\dostelsynoniemenin} \def\doresetsynonym#1% - {\letvalue{#1\s!entry}=\gobblethreearguments} + {\letvalue{#1\s!entry}\gobblethreearguments} \def\dohandlesynonymentry#1#2#3#4% {\bgroup @@ -77,7 +77,7 @@ \c!letter=]% % \stelwitruimtein[\v!geen]% - \doutilities{#1}{\jobname}{#2}{}{\par}% + \doutilities{#1}\jobname{#2}\relax\par \endgroup \ifutilitydone\else\geenwitruimte\fi} @@ -100,13 +100,13 @@ %\def\getsynonymmeaning#1#2#3% % {\doifdefinedelse{#2#3} % {{\synonymmeaningtrue\getvalue{#2#3}}} -% {{\showmessage{\m!systems}{18}{#1,#3}}}} +% {{\showmessage\m!systems{18}{#1,#3}}}} \def\getsynonymmeaning#1#2#3% {\bgroup \doifundefined{#2#3} {\setgvalue{#2#3}{{\tt[#3]}}% - \showmessage{\m!systems}{18}{#1,#3}}% + \showmessage\m!systems{18}{#1,#3}}% \synonymmeaningtrue \getvalue{#2#3}% \egroup} @@ -144,19 +144,19 @@ \def\dolaadsynoniemen#1#2% {\bgroup - \let\dosetsynonym=\doloadsynonym - \showmessage{\m!systems}{19}{#2}% - \doutilities{#1}{\jobname}{}{}{}% + \let\dosetsynonym\doloadsynonym + \showmessage\m!systems{19}{#2}% + \doutilities{#1}\jobname\empty\relax\relax \egroup \setvalue{\s!check#1}##1{}} \def\dodocomplexsynonym[#1][#2]#3#4% {\doifsomething{#2} {\getvalue{\s!check#1}{#2}% - \doifelsevalue{\??sm#1\c!conversie}{\v!ja} + \doifelsevalue{\??sm#1\c!conversie}\v!ja {\unexpanded\setgvalue{#2}{\expandsynonym{#1}{#2}{#3}{#4}}} - {\doifelsevalue{\??sm#1\c!status}{\v!start} - {\doifelsevalue{\??sm#1\c!criterium}{\v!alles} + {\doifelsevalue{\??sm#1\c!status}\v!start + {\doifelsevalue{\??sm#1\c!criterium}\v!alles {\preexecutesynonym{#1}{#2}{#3}{#4}} {\unexpanded\setgvalue{#2}{\executesynonym{#1}{#2}{#3}{#4}}}} {\unexpanded\setgvalue{#2}{\processsynonym{#1}{#3}{#4}}}}}} @@ -221,7 +221,7 @@ \setvalue{\e!volledige\e!lijstmet#2}% {\dovolledigelijstmetsynoniemen{#1}{#2}}} -\def\definieersynoniemen% +\def\definieersynoniemen {\doquadrupleempty\dodefinieersynoniemen} % Formaat tex-utility-input-file <jobname.tui>: @@ -236,11 +236,11 @@ \def\dostelsorterenin[#1][#2]% {\getparameters[\??so#1][#2]} -\def\stelsorterenin% +\def\stelsorterenin {\dodoubleargument\dostelsorterenin} \def\doresetsorteren#1% - {\letvalue{#1\s!entry}=\gobblethreearguments} + {\letvalue{#1\s!entry}\gobblethreearguments} \def\dosetsorteren#1% {\setvalue{#1\s!entry}##1##2##3% @@ -258,7 +258,7 @@ {\witruimte % ZONDER WITRUIMTE ETC ETC \begingroup \stelwitruimtein[\v!geen]% - \doutilities{#1}{\jobname}{#1}{}{\par}% + \doutilities{#1}\jobname{#1}\relax\par \endgroup \ifutilitydone\else\geenwitruimte\fi} @@ -308,17 +308,17 @@ \def\dolaadsorteren#1#2% {\bgroup - \let\dosetsorteren=\doloadsort - \showmessage{\m!systems}{20}{#2}% - \doutilities{#1}{\jobname}{}{}{}% + \let\dosetsorteren\doloadsort + \showmessage\m!systems{20}{#2}% + \doutilities{#1}\jobname\empty\relax\relax \egroup \setvalue{\s!check#1}##1{}} \def\dodocomplexsort[#1][#2]#3% {\doifsomething{#2} {\getvalue{\s!check#1}{#2}% - \doifelsevalue{\??so#1\c!status}{\v!start} - {\doifelsevalue{\??so#1\c!criterium}{\v!alles} + \doifelsevalue{\??so#1\c!status}\v!start + {\doifelsevalue{\??so#1\c!criterium}\v!alles {\preexecutesort{#1}{#2}{#3}} {\unexpanded\setgvalue{#2}{\executesort{#1}{#2}{#3}}}} {\unexpanded\setgvalue{#2}{\processsort{#1}{#3}{#2}}}}} @@ -345,7 +345,7 @@ \setvalue{\e!stel#2\e!in}[##1]% vervalt tzt, soort oo-mode {\getparameters[\??so#1][##1]}% \ifthirdargument - \ConvertConstantAfter\doifnot{#3}{\v!geen} + \ConvertConstantAfter\doifnot{#3}\v!geen {\ifx#3\relax \else \def#3##1{\getvalue{\??so:#1:##1}} \fi}% diff --git a/tex/context/base/core-sys.tex b/tex/context/base/core-sys.tex index 942f0c310..d233225fa 100644 --- a/tex/context/base/core-sys.tex +++ b/tex/context/base/core-sys.tex @@ -23,8 +23,10 @@ %\beforesplitstring\ascii\at.\to\jobfilename %\aftersplitstring \ascii\at.\to\jobfilesuffix \splitstring\ascii\at.\to\jobfilename\and\jobfilesuffix + \lowercasestring\jobfilesuffix\to\jobfilesuffix \doifnothing\jobfilename {\let\jobfilename \jobname}% - \doifnothing\jobfilesuffix{\let\jobfilesuffix\c!tex}} + \doifnothing\jobfilesuffix{\let\jobfilesuffix\c!tex}% + \setsystemmode{suffix-\jobfilesuffix}} \appendtoks \splitjobfilename \to \everyjob @@ -35,7 +37,7 @@ \let\outputresolution\@@svresolutie \splitjobfilename} -\def\setupsystem% +\def\setupsystem {\dosingleargument\dosetupsystem} \def\setuprandomize[#1]% @@ -66,15 +68,15 @@ \def\dostartglobaldefs#1#2% {\edef\!!stringa{\the\globaldefs}% \ifnum\globaldefs#10 - \globaldefs=-\globaldefs + \globaldefs-\globaldefs \fi - \advance\globaldefs by #21 + \advance\globaldefs #21 \setevalue{@gd@\the\globaldefs}{\!!stringa}} -\def\dostopglobaldefs% +\def\dostopglobaldefs {\doifdefinedelse{@gd@\the\globaldefs} - {\globaldefs=\getvalue{@gd@\the\globaldefs}\relax} - {\globaldefs=0\relax}} + {\globaldefs\getvalue{@gd@\the\globaldefs}\relax} + {\globaldefs\zerocount}} \def\startlocal {\dostartglobaldefs>-} \def\stoplocal {\dostopglobaldefs} @@ -84,8 +86,8 @@ \def\complexstart[#1]{\bgroup\getvalue{\e!start#1}} \def\complexstop [#1]{\getvalue{\e!stop #1}\egroup} -\def\simplestart{\bgroup} -\def\simplestop {\egroup} +\let\simplestart\bgroup +\let\simplestop \egroup \definecomplexorsimple\start \definecomplexorsimple\stop @@ -107,7 +109,7 @@ {\getvalue{\??be#1\c!voor}% \bgroup \getvalue{\??be#1\c!commandos}% - \dostartattributes{\??be#1}\c!letter\c!kleur{}}% + \dostartattributes{\??be#1}\c!letter\c!kleur\empty}% \setvalue{\e!stop#1}% {\dostopattributes \egroup @@ -161,7 +163,7 @@ \def\complexdefinieer[#1]#2#3% {\ifx#2\undefined \else - \showmessage{\m!systems}{4}{\string#2}% + \showmessage\m!systems4{\string#2}% \fi \ifcase0#1\def#2{#3}% \or\def#2##1{#3}% @@ -183,7 +185,7 @@ \def\gebruikcommandos#1% {\bgroup - \def\docommando##1{\setbox0=\hbox{\getvalue{\string##1}##1}}% + \def\docommando##1{\setbox0\hbox{\getvalue{\string##1}##1}}% \processcommalist[#1]\docommando \egroup} diff --git a/tex/context/base/core-tab.tex b/tex/context/base/core-tab.tex index 978d2fc68..ab7a0df58 100644 --- a/tex/context/base/core-tab.tex +++ b/tex/context/base/core-tab.tex @@ -18,7 +18,7 @@ % \xhrule : calls for 'special' with width % BUG: % -% \starttabel[|l|l|] +% \starttable[|l|l|] % \HL % \RL\FR \VL Head 1 \VL Head 2 \VL\FR % \RL\LR \VL Head A \VL Head B \VL\LR % niet grijs ?? @@ -26,7 +26,7 @@ % \VL 1 \VL 2 \VL\FR % \VL a \VL b \VL\LR % \HL -% \stoptabel +% \stoptable % melden als in kleur conflict, uitgestelde test op \SR\SR @@ -102,7 +102,7 @@ %D the basic table typesetting commands. %D %D \startbuffer -%D \starttabel[|||] +%D \starttable[|||] %D \HL %D \VL first \VL second \VL\AR %D \HL @@ -110,10 +110,10 @@ %D \VL beta \VL 2 \VL\AR %D \VL gamma \VL 3 \VL\AR %D \HL -%D \stoptabel +%D \stoptable %D \stopbuffer %D -%D \startcombinatie[2] +%D \startcombinatie %D {\tracetablesfalse\haalbuffer} {\type{\tracetablesfalse}} %D {\tracetablestrue\haalbuffer} {\type{\tracetablestrue}} %D \stopcombinatie @@ -129,7 +129,7 @@ %D \type {\LR} commands. %D %D \startbuffer -%D \starttabellen[|||] +%D \starttables[|||] %D \HL %D \VL first \VL second \VL\AR %D \HL @@ -137,7 +137,7 @@ %D \VL beta \VL 2 \VL\AR %D \VL gamma \VL 3 \VL\AR %D \HL -%D \stoptabellen +%D \stoptable %D \stopbuffer %D %D When we use the split table feature, we get a bit more @@ -150,7 +150,7 @@ %D table definition is wrong. %D %D \startbuffer -%D \starttabel[||||] +%D \starttable[||||] %D \HL %D \VL first second \VL third \VL\AR %D \HL @@ -158,7 +158,7 @@ %D \VL beta \VL 2 \VL b \VL %D \VL gamma \VL \THREE{3} c \VL\AR %D \HL -%D \stoptabel +%D \stoptable %D \stopbuffer %D %D \typebuffer @@ -194,7 +194,7 @@ %D \stopfiguurtekst} %D %D \startbuffer -%D \starttabel[|c|c|] +%D \starttable[|c|c|] %D \HL %D \BL[2] \SR %D \VL test \VL test \VL\SR @@ -203,7 +203,7 @@ %D \VL test \VL test \VL\MR %D \VL test \VL test \VL\LR %D \HL -%D \stoptabel +%D \stoptable %D \stopbuffer %D %D \ShowExample @@ -213,56 +213,56 @@ %D the commands used. %D %D \startbuffer -%D \starttabel[|c|c|c|] +%D \starttable[|c|c|c|] %D \HL %D \BL[3] \SR %D \VL test \VL test \VL test \VL\SR %D \HL -%D \stoptabel +%D \stoptable %D \stopbuffer %D %D \ShowExample %D %D \startbuffer -%D \starttabel[|c|c|c|] +%D \starttable[|c|c|c|] %D \HL %D \BC \BL[2] \SR %D \VL test \VL test \VL test \VL\SR %D \HL -%D \stoptabel +%D \stoptable %D \stopbuffer %D %D \ShowExample %D %D \startbuffer -%D \starttabel[|c|c|c|] +%D \starttable[|c|c|c|] %D \HL %D \BC \BC \BL \SR %D \VL test \VL test \VL test \VL\SR %D \HL -%D \stoptabel +%D \stoptable %D \stopbuffer %D %D \ShowExample %D %D \startbuffer -%D \starttabel[|c|c|c|] +%D \starttable[|c|c|c|] %D \HL %D \BC \BL \SR %D \VL test \VL test \VL test \VL\SR %D \HL -%D \stoptabel +%D \stoptable %D \stopbuffer %D %D \ShowExample %D %D \startbuffer -%D \starttabel[|c|c|c|] +%D \starttable[|c|c|c|] %D \BL \BL \SR %D \HL %D \VL test \VL test \VL test \VL\SR %D \HL -%D \stoptabel +%D \stoptable %D \stopbuffer %D %D \ShowExample @@ -273,7 +273,7 @@ %D specification later on: %D %D \startbuffer -%D \starttabel[|c|c|c|] +%D \starttable[|c|c|c|] %D \BC \BL \SR %D \HL %D \VL test \VL test \VL test \VL\SR @@ -285,7 +285,7 @@ %D \BR\LR %D \VL test \VL test \VL test \VL\LR %D \HL -%D \stoptabel +%D \stoptable %D \stopbuffer %D %D \ShowExample @@ -313,7 +313,8 @@ %D Nog vervangen: -\def\c!Table {Table} +\def\c!Table{Table} +\def\m!TABLE{TABLE} %D We already saw that the table macros report errors and %D provide automatic spacing. These features can only be @@ -369,7 +370,7 @@ \catcode`\|=\@@active \catcode`\"=\@@active -\gdef\pushouterbarandquote% +\gdef\pushouterbarandquote {\ifForgetTableBarAndQuote \ifnum\catcode`\|=\@@active \else \catcode`\|=\@@active @@ -383,15 +384,15 @@ \let\outertablequote="% \fi} -\gdef\popouterbarandquote% +\gdef\popouterbarandquote {\ifForgetTableBarAndQuote - \let|=\outertablebar - \let"=\outertablequote + \let|\outertablebar + \let"\outertablequote \else \redefinetablebarandquote \fi} -\gdef\ObeyTableBarAndQuote% +\gdef\ObeyTableBarAndQuote {\ForgetTableBarAndQuotefalse \ifintable \redefinetablebarandquote @@ -430,7 +431,7 @@ %D The next hack is dedicated to Tobias, who found out that %D paragraph entries don't break well. -\def\TABLEhack{\hskip\!!zeropoint} +\def\TABLEhack{\hskip\zeropoint} %D The first attemp to solve this problem was: %D @@ -463,45 +464,32 @@ \newdimen\TABLEparheight \def\BeginTableParBox#1% - {\setbox\scratchbox=\vtop\bgroup % \setbox added - \hsize=#1\relax + {\setbox\scratchbox\vtop\bgroup % \setbox added + \hsize#1\relax \normalbaselines - \let~=\!ttTie - \let\-=\!ttDH + \let~\!ttTie + \let\-\!ttDH \blanko[\v!blokkeer]% % added \the\EveryTableParBox} -% \def\EndTableParBox% -% {\removelastskip % added -% %\MakeStrut{0pt}{\StrutDepthFactor\StrutUnit} % removed -% \par -% \ifnum\prevgraf>0 -% \strut \geenwitruimte \vskip-\lineheight % added -% \fi -% \egroup % finishes the \vtop begun by \BeginTableParbox -% \getboxheight\scratchdimen\of\box\scratchbox\relax % added -% \ifdim\scratchdimen>\TABLEparheight % added -% \global\TABLEparheight=\scratchdimen % added -% \fi % added -% \box\scratchbox} - \def\EndTableParBox {\removelastskip % itemize or so \par - \ifnum\prevgraf>0 % we want at least + \ifnum\prevgraf>\zerocount % we want at least \strut \geenwitruimte \vskip-\lineheight % one line of text \egroup \ifdim\dp\scratchbox>\lineheight % see (*) for an \getnoflines{\dp\scratchbox}% % example of where - \dp\scratchbox=\zeropoint % saving can go - \vtop to \noflines\lineheight{\box\scratchbox}% terrible wrong + \dp\scratchbox\zeropoint % saving can go + \setbox\scratchbox % terrible wrong + \vtop to \noflines\lineheight{\box\scratchbox}% \fi % esp between rows \else % of paragraphs \egroup \fi \getboxheight\scratchdimen\of\box\scratchbox\relax% compensate for \ifdim\scratchdimen>\TABLEparheight % funny depth of - \global\TABLEparheight=\scratchdimen % multi-line box + \global\TABLEparheight\scratchdimen % multi-line box \fi % i.e. vtop \box\scratchbox} @@ -553,12 +541,12 @@ %D format. %D %D \startbuffer -%D \starttabel{|q[00,000]|Q[00,00]|} +%D \starttable{|q[00,000]|Q[00,00]|} %D \HL %D \VL -1,2 \VL 12,35 \VL\FR %D \VL 11,203 \VL 2,4 \VL\LR %D \HL -%D \stoptabel +%D \stoptable %D \stopbuffer %D %D \ShowExample @@ -576,7 +564,7 @@ %D \em Key \type{q}: quantity item, non||math mode. \NewFormatKey q% - {\def\!tqStyle{}% + {\letempty\!tqStyle \futurelet\!tnext\!tqTestForBracket} %D \em Key \type{Q}: quantity item, math mode. @@ -617,9 +605,9 @@ \aftergroup[% \!taCountA #1 \!thLoop - \ifnum \!taCountA>0 - \advance\!taCountA -1 - \aftergroup0 + \ifnum \!taCountA>\zerocount + \advance\!taCountA \minusone + \aftergroup0 \repeat \def\!ttemp{#3}% \ifx\!ttemp\empty @@ -627,9 +615,9 @@ \aftergroup, \!taCountA #2 \!thLoop - \ifnum\!taCountA>0 - \advance\!taCountA -1 - \aftergroup0 + \ifnum\!taCountA>\zerocount + \advance\!taCountA \minusone + \aftergroup0 \repeat \fi \aftergroup]\aftergroup}% @@ -650,15 +638,15 @@ \def\!tqMakeQuantityTemplate#1#2,#3,#4!% #1=<empty> or $ {\def\!ttemp{#4}% \ifx\!ttemp\empty - \!taDimenC=0pt + \!taDimenC\zeropoint \else - \setbox0=\hbox{\m@th #1,#3#1}% - \!taDimenC=\wd0 + \setbox0\hbox{\m@th #1,#3#1}% + \!taDimenC\wd0 \fi - \setbox0=\hbox{\m@th #1#2#1}% - \!thToksEdef\!taDataColumnTemplate= - {\noexpand\!tqSetQuantityItem{\the\wd0 }{\the\!taDimenC}{#1}% - \the\!taDataColumnTemplate}% + \setbox0\hbox{\m@th #1#2#1}% + \!thToksEdef\!taDataColumnTemplate + ={\noexpand\!tqSetQuantityItem{\the\wd0 }{\the\!taDimenC}{#1}% + \the\!taDataColumnTemplate}% \ReadFormatKeys} %D \em Set numeric item. @@ -667,16 +655,9 @@ {\!tqSetQuantityItemA{#1}{#2}{#3}#4,,!} \def\!tqSetQuantityItemA #1#2#3#4,#5,#6!% - {\def\!ttemp% - {#6}% - \hbox to #1 - {\hss\m@th#3#4#3}% - \hbox to #2 - {\ifx\!ttemp\empty - \else - \m@th#3,#5#3% - \fi - \hss}} + {\def\!ttemp{#6}% + \hbox to #1{\hss\m@th#3#4#3}% + \hbox to #2{\ifx\!ttemp\empty\else\m@th#3,#5#3\fi\hss}} %D Here ends the Q||extension. Did you watch the clever use %D of aftergroup in \type{\!tqConvertCode}. @@ -696,9 +677,9 @@ %D centering}. %D %D \startbuffer -%D \starttabel[|C{red}|C{green}|C{blue}|] +%D \starttable[|C{red}|C{green}|C{blue}|] %D \VL R(ed) \VL G(reen) \VL B(lue) \VL\SR -%D \stoptabel +%D \stoptable %D \stopbuffer %D %D \ShowExample @@ -710,7 +691,7 @@ %D So now we have three new keys: %D -%D \starttabel[|||] +%D \starttable[|||] %D \HL %D \NC \bf key \NC \bf meaning \NC\AR %D \HL @@ -718,7 +699,7 @@ %D \NC q[x,y] \NC text mode formatted numbers \NC\AR %D \NC C{identifier} \NC column entry color \NC\AR %D \HL -%D \stoptabel +%D \stoptable %D To be compatible with the tabulate environment, we also %D support the \type {l}, \type {c} and \type {r} keys for @@ -752,7 +733,7 @@ %D slightly adapted, i.c. the penalty is removed. We also %D add basic color support. -\def\!ttFullHruleA% +\def\!ttFullHruleA {\!ttGetHalfRuleThickness \startglobalTABLEcolor % added \hrule\!thHeight\dimen0\!thDepth\dimen0 @@ -766,15 +747,15 @@ %D hooks. One thing to keep in mind is that \type{&} keeps %D assignments local. Again, we add basic color support. -\let\TABLEbeforebar=\empty -\let\TABLEafterbar =\empty +\let\TABLEbeforebar\empty +\let\TABLEafterbar \empty -\def\!ttInsertVrule% +\def\!ttInsertVrule {\hfil \TABLEbeforebar % added \startglobalTABLEcolor % added \vrule \!thWidth - \ifnum\!tgCode=1 + \ifnum\!tgCode=\plusone \ifx\!tgValue\empty \LineThicknessFactor \else @@ -792,13 +773,13 @@ %D The next two macros are only adapted to basis rule %D color support. -\def\!tfSetVrule% +\def\!tfSetVrule {\!thToksEdef\!taRuleColumnTemplate= {\noexpand\hfil \noexpand\startglobalTABLEcolor % added \noexpand\vrule \noexpand\!thWidth - \ifnum\!tgCode=1 + \ifnum\!tgCode=\plusone \ifx\!tgValue\empty \the\LineThicknessFactor \else @@ -814,7 +795,7 @@ \the\!taRuleColumnTemplate}% \!tfAdjoinPriorColumn} -\def\!ttShortHruleA% +\def\!ttShortHruleA {\!ttGetHalfRuleThickness \startglobalTABLEcolor % added \leaders\hrule\!thHeight\dimen0\!thDepth\dimen0\hfill @@ -834,23 +815,25 @@ %D extensions concern the second level check, the first %D subbranch and advancing the column. +\ifx\mscount\undefined \newcount\mscount \fi + \def\!ttuse#1% - {\ifnum#1>\@ne + {\ifnum#1>\plusone \omit - \scratchcounter=\currentTABLEcolumn % added - \advance\scratchcounter by #1% % added - \advance\scratchcounter by -1 % added - \ifnum\scratchcounter>\maxTABLEcolumn % added - \def\next% % added - {\setTABLEerror\TABLEspanoverflow % added - \handleTABLEerror}% % added - \else % added - \def\next% % added - {\global\advance\currentTABLEcolumn by #1% % added - \global\advance\currentTABLEcolumn by -1 % added - \mscount=#1% \mscount is in Plain - \advance\mscount by \m@ne - \advance\mscount by \mscount + \scratchcounter\currentTABLEcolumn % added + \advance\scratchcounter #1% % added + \advance\scratchcounter \minusone % added + \ifnum\scratchcounter>\maxTABLEcolumn % added + \def\next % added + {\setTABLEerror\TABLEspanoverflow % added + \handleTABLEerror}% % added + \else % added + \def\next % added + {\global\advance\currentTABLEcolumn #1% % added + \global\advance\currentTABLEcolumn \minusone % added + \mscount#1% \mscount is in Plain + \advance\mscount \m@ne + \advance\mscount \mscount \!thLoop \ifnum\mscount>\@ne \sp@n % from Plain (\span\omit \advance\mscount\m@ne) @@ -858,8 +841,8 @@ \span}% \fi % added \else % added - \def\next% conflicts with possible next \omit % added - {\global\advance\currentTABLEcolumn by 1 }% % added + \def\next % conflicts with possible next \omit % added + {\global\advance\currentTABLEcolumn \plusone}% % added \fi \next} % added @@ -871,8 +854,8 @@ %D such hacks become a second nature. However, redefining \type %D {\omit} and \type{\span} is not that easy.} -\def\TABLEnoalign% - {\noalign\bgroup\let\noalign=\relax\let\next=} +\def\TABLEnoalign + {\noalign\bgroup\let\noalign\relax\let\next=} %D \macros %D {starttable} @@ -896,29 +879,31 @@ %D %D \showsetup{starttable} -\def\starttabel% +\def\starttable {\bgroup - \ifinsidefloat\else - \startbaselinecorrection % \outer.. - \fi + \doifelsenothing\@@tikader + {\ifinsidefloat\else\startbaselinecorrection\fi} + {\startframedcontent[\@@tikader]}% \postponefootnotes \firststagestartTABLE} -\def\stoptabel% +\def\stoptable {\TABLEtail - \global\let\@@TABLEhead\empty - \global\let\@@TABLEtail\empty + \globalletempty\@@TABLEhead + \globalletempty\@@TABLEtail \finishTABLE - \ifinsidefloat\else - \stopbaselinecorrection % \outer.. - \goodbreak % compensates all the nobreaks - \fi + \doifelsenothing\@@tikader + {\ifinsidefloat\else + \stopbaselinecorrection + \goodbreak % compensates all the nobreaks + \fi} + {\stopframedcontent}% \egroup} %D Before we can grab the argument, we have to make sure that %D the \CATCODES\ are set. The first stage takes care of that. -\def\firststagestartTABLE% +\def\firststagestartTABLE {\bgroup % kan-ie weg? \global\intabletrue \pushouterbarandquote @@ -937,11 +922,11 @@ %D \starttypen %D \definetabletemplate[test][|||] %D -%D \starttabel[test] +%D \starttable[test] %D \VL test \VL test \VL\AR %D \VL test \VL test \VL\AR %D \VL test \VL test \VL\AR -%D \stoptabel +%D \stoptable %D \stoptypen %D %D The implementation of the definition macro is not that @@ -967,7 +952,7 @@ \fi \egroup} -\def\definetabletemplate% +\def\definetabletemplate {\bgroup \catcode`\|=\@@other \doquadrupleempty\dodefinetabletemplate} @@ -1011,16 +996,16 @@ \def\complexsecondstagestartTABLE#1[#2]% {\convertargument|\to\asciiA \convertargument#2\to\asciiB - \doifinstringelse{\asciiA}{\asciiB} - {\gdef\restartTABLE% + \doifinstringelse\asciiA\asciiB + {\gdef\restartTABLE {\gdef\restartTABLE{\thirdstagestartTABLE{#2}}% \prepareTABLEsplitting \restartTABLE \TABLEhead}} {\doifdefinedelse{\c!Table#2} - {\gdef\restartTABLE% + {\gdef\restartTABLE {\getvalue{\c!Table#2}}} - {\gdef\restartTABLE% + {\gdef\restartTABLE {\gdef\restartTABLE{\getvalue{#2}}% \prepareTABLEsplitting \restartTABLE @@ -1037,12 +1022,12 @@ \setTABLEaction\TABLEunknown \setTABLEforce\TABLEunknown \setTABLEerror\TABLEunknown - \global\let\TABLEgrayline=\empty - \global\let\nextTABLEgrayline=\empty \global\TABLEgraylinefalse \global\TABLEgraydonefalse - \global\let\TABLEgraylineerror =\empty - \global\let\TABLEgraylinestatus=\empty + \globalletempty\TABLEgrayline + \globalletempty\nextTABLEgrayline + \globalletempty\TABLEgraylineerror + \globalletempty\TABLEgraylinestatus \resetVLvalues \appendtoks\popouterbarandquote\to\EveryTable \appendtoks\localTABLEsetup\to\EveryTable @@ -1057,10 +1042,10 @@ \forgetall % added \doifsomething{#1} {\def\TABLEformat{#1}% - \expandafter\getTABLEnofcolumns\expandafter{\TABLEformat}% + %\expandafter\getTABLEnofcolumns\expandafter{\TABLEformat}% \expandafter\BeginFormat\TABLEformat\EndFormat}} -\def\finishTABLE% +\def\finishTABLE {\chuckTABLEautorow \unskip\crcr \EndTable @@ -1076,34 +1061,34 @@ %D support captions too, we will also reserve some space for %D those later on. -\def\prepareTABLEsplitting% - {\global\TABLEheight=\!!zeropoint +\def\prepareTABLEsplitting + {\global\TABLEheight\zeropoint \ifsplittables \ifx\TABLEhead\empty - \global\TABLEheadheight=\!!zeropoint + \global\TABLEheadheight\zeropoint \else - \setbox0=\vbox + \setbox0\vbox \bgroup \def\doEndOfTableLine##1##2##3{\normalTABLElineformat##2##3}% \restartTABLE\TABLEhead \finishTABLE - \global\TABLEheadheight=\ht0 + \global\TABLEheadheight\ht0 \fi \ifx\TABLEtail\empty - \global\TABLEtailheight=\!!zeropoint + \global\TABLEtailheight\zeropoint \else - \setbox0=\vbox + \setbox0\vbox \bgroup \def\doEndOfTableLine##1##2##3{\normalTABLElineformat##2##3}% \restartTABLE\TABLEtail \finishTABLE - \global\TABLEtailheight=\ht0 + \global\TABLEtailheight\ht0 \fi \else - \global\TABLEheadheight=\!!zeropoint - \global\TABLEtailheight=\!!zeropoint + \global\TABLEheadheight\zeropoint + \global\TABLEtailheight\zeropoint \fi - \global\TABLEheight=\!!zeropoint + \global\TABLEheight\zeropoint \calculatemaxTABLEheight\docalculatemaxTABLEheight} %D \macros @@ -1117,17 +1102,17 @@ %D For example: %D %D \starttypen -%D \starttabellen[|||] +%D \starttables[|||] %D \HL %D \VL element \VL atom weight \VL\AR %D \HL %D \VL ....... \VL ........... \VL\AR %D \VL ....... \VL ........... \VL\AR %D \HL -%D \stoptabellen +%D \stoptables %D \stoptypen -\def\starttabellen% +\def\starttables {\bgroup \ifinsidefloat\else \baselinecorrection @@ -1135,12 +1120,12 @@ \topbaselinecorrection \fi \forgetall - \global\let\absmaxTABLEheight=\!!zeropoint + \globallet\absmaxTABLEheight\zeropoint \splittablestrue \global\TABLEinbreakfalse \firststagestartTABLE} -\def\stoptabellen% +\def\stoptables {\TABLEtail \finishTABLE \ifinsidefloat\else @@ -1154,20 +1139,20 @@ %D something like: %D %D \starttypen -%D \starttabelkop +%D \starttablekop %D \HL %D \VL element \VL atom weight \VL\AR %D \HL -%D \stoptabelkop +%D \stoptablekop %D -%D \starttabelstaart +%D \starttablestaart %D \HL -%D \stoptabelstaart +%D \stoptablestaart %D -%D \starttabellen[|||] +%D \starttables[|||] %D \VL ....... \VL ........... \VL\AR %D \VL ....... \VL ........... \VL\AR -%D \stoptabellen +%D \stoptables %D \stoptypen %D %D This time each split table gets a head line and ends with @@ -1180,17 +1165,17 @@ \let\@@TABLEhead\empty \def\TABLEhead{\@@TABLEhead} \let\@@TABLEtail\empty \def\TABLEtail{\@@TABLEtail} -\letvalue{\e!start \e!tabelkop}=\undefined -\letvalue{\e!stop \e!tabelkop}=\undefined -\letvalue{\e!start\e!tabelstaart}=\undefined -\letvalue{\e!stop \e!tabelstaart}=\undefined +\letvalue{\e!start\e!tablehead}=\undefined +\letvalue{\e!stop \e!tablehead}=\undefined +\letvalue{\e!start\e!tabletail}=\undefined +\letvalue{\e!stop \e!tabletail}=\undefined \expanded - {\def\csname\e!start\e!tabelkop\endcsname##1\csname\e!stop\e!tabelkop\endcsname% + {\def\csname\e!start\e!tablehead\endcsname##1\csname\e!stop\e!tablehead\endcsname% {\noexpand\setTABLEhead##1\noexpand\end}} \expanded - {\def\csname\e!start\e!tabelstaart\endcsname##1\csname\e!stop\e!tabelstaart\endcsname% + {\def\csname\e!start\e!tabletail\endcsname##1\csname\e!stop\e!tabletail\endcsname% {\noexpand\setTABLEtail##1\noexpand\end}} %D The second argument is a dummy one, by scanning for it, we @@ -1210,36 +1195,36 @@ %D algoritm evolved during the development of the split option %D and will probably be improved bit by bit. -\def\docalculatemaxTABLEheight% +\def\docalculatemaxTABLEheight {\ifbinnenkolommen \getcolumnstatus\column\scratchcounter\total\dimen0\goal\dimen2\\% \else \ifdim\pagegoal<\maxdimen - \dimen0=\pagetotal - \dimen2=\pagegoal + \dimen0\pagetotal + \dimen2\pagegoal \else - \dimen0=\!!zeropoint - \dimen2=\teksthoogte + \dimen0\zeropoint + \dimen2\teksthoogte \fi \fi - \advance\dimen2 by -\dimen0 - \global\TABLEmaxheight=\dimen2 - \global\advance\TABLEmaxheight by -\dp\strutbox - \ifdim\prevdepth<\maxdimen\ifdim\prevdepth>\!!zeropoint - \global\advance\TABLEmaxheight by -\dp\strutbox - \global\advance\TABLEmaxheight by -\parskip + \advance\dimen2 -\dimen0 + \global\TABLEmaxheight\dimen2 + \global\advance\TABLEmaxheight -\dp\strutbox + \ifdim\prevdepth<\maxdimen\ifdim\prevdepth>\zeropoint + \global\advance\TABLEmaxheight -\dp\strutbox + \global\advance\TABLEmaxheight -\parskip \fi\fi} -\def\nocalculatemaxTABLEheight% +\def\nocalculatemaxTABLEheight {\ifbinnenkolommen \getcolumnstatus\column\scratchcounter\total\dimen0\goal\dimen2\\% \else - \dimen0=\!!zeropoint - \dimen2=\teksthoogte + \dimen0\zeropoint + \dimen2\teksthoogte \fi - \advance\dimen2 by -\dimen0 - \global\TABLEmaxheight=\dimen2 - \global\advance\TABLEmaxheight by -\dp\strutbox} + \advance\dimen2 -\dimen0 + \global\TABLEmaxheight\dimen2 + \global\advance\TABLEmaxheight -\dp\strutbox} \def\calculatemaxTABLEheight#1% {\ifsplittables @@ -1256,20 +1241,20 @@ \nocalculatemaxTABLEheight \fi \ifdim\TABLEmaxheight<\absmaxTABLEheight % forces equal columns - \global\TABLEmaxheight=\absmaxTABLEheight + \global\TABLEmaxheight\absmaxTABLEheight \else \xdef\absmaxTABLEheight{\the\TABLEmaxheight}% \fi - \global\TABLEheight=\!!zeropoint + \global\TABLEheight\zeropoint \else - \global\TABLEmaxheight=\maxdimen + \global\TABLEmaxheight\maxdimen \fi} %D When splitting tables, we have to remove the top skip when %D we're in the main vertical list, else we remove whatever %D skip \TEX\ adds. -\def\removeTABLEtopskip% +\def\removeTABLEtopskip {\ifinsidefloat \hbox{\strut}\kern-\lineheight \else @@ -1299,37 +1284,37 @@ %D screen and log file as well as visualized in the table in %D teletype. -\def\handleTABLEerror% +\def\handleTABLEerror {\ifTABLEgrayline \else \ifnum\TABLEerror=\TABLEunknown \else \setTABLEaction\TABLEunknown - \global\let\checkTABLEautorow=\empty - \global\let\chuckTABLEautorow=\empty + \globalletempty\checkTABLEautorow + \globalletempty\chuckTABLEautorow \fi \ifcase\TABLEerror % no error \or % \TABLEmissingrow \tttf [missing row]% - \writestatus{TABLE}{missing row}% + \writestatus\m!TABLE{missing row}% \SR \or % \TABLEmissingcolumn \fillTABLEcolumns \tttf [missing column]% - \writestatus{TABLE}{missing column}% + \writestatus\m!TABLE{missing column}% \SR \or % \TABLEspanoverflow \fillTABLEcolumns \tttf [columnspan too large]% - \writestatus{TABLE}{columnspan too large}% + \writestatus\m!TABLE{columnspan too large}% \SR \or % \TABLEdivisionoverflow \fillTABLEcolumns \tttf [division line too long]% - \writestatus{TABLE}{division line too long}% + \writestatus\m!TABLE{division line too long}% \SR \fi \fi @@ -1337,19 +1322,19 @@ \finishTABLErow \fi} -\def\finishTABLErow% +\def\finishTABLErow {\crcr \TABLEnoalign {\nobreak \setTABLEaction\TABLEunknown \setTABLEerror\TABLEunknown - \global\let\checkTABLEautorow=\empty - \global\let\chuckTABLEautorow=\empty - \global\currentTABLEcolumn=0 }} + \globalletempty\checkTABLEautorow + \globalletempty\chuckTABLEautorow + \global\currentTABLEcolumn\zerocount}} -\def\fillTABLEcolumns% +\def\fillTABLEcolumns {\ifnum\currentTABLEcolumn>\maxTABLEcolumn \else - \global\advance\currentTABLEcolumn by 1 + \global\advance\currentTABLEcolumn \plusone \normalTABLEquote \expandafter\fillTABLEcolumns \fi} @@ -1376,7 +1361,7 @@ %D itself into one of the other types. %D %D \starttypen -%D \starttabel[||] +%D \starttable[||] %D \HL %D \VL a separate row \VL\SR %D \HL @@ -1384,7 +1369,7 @@ %D \VL a mid row \VL\MR %D \VL a last row \VL\LR %D \HL -%D \stoptabel +%D \stoptable %D \stoptypen %D %D In this example we could have used \type{\AR} without @@ -1405,60 +1390,60 @@ \convertargument #1\to\asciiA \convertcommand\TABLEendBCL\to\asciiB \ifx\asciiA\asciiB \else - \writestatus{TABLE}{confusing \asciiA\space and \asciiB}% + \writestatus\m!TABLE{confusing \asciiA\space and \asciiB}% \gdef\TABLEgraylineerror% - {\global\let\TABLEgraylineerror=\empty + {\globalletempty\TABLEgraylineerror [\asciiA\unskip<->\asciiB\unskip]}% \fi \global\TABLEgraydonefalse \fi} -\def\defineTABLEendings% - {\let\SR=\TableSR - \let\FR=\TableFR - \let\MR=\TableMR - \let\LR=\TableLR - \let\AR=\TableAR} +\def\defineTABLEendings + {\let\SR\TableSR + \let\FR\TableFR + \let\MR\TableMR + \let\LR\TableLR + \let\AR\TableAR} -\def\TableSR% +\def\TableSR {\ifTABLEgrayline \else \ifnum\TABLEaction=\TABLEfirstrow - \writestatus{TABLE}{change \string\SR\space into \string\MR/\string\LR}% + \writestatus\m!TABLE{change \string\SR\space into \string\MR/\string\LR}% \else\ifnum\TABLEaction=\TABLEmidrow - \writestatus{TABLE}{change \string\SR\space into \string\MR/\string\LR}% + \writestatus\m!TABLE{change \string\SR\space into \string\MR/\string\LR}% \else\ifnum\TABLEaction=\TABLEmidrow - \writestatus{TABLE}{change \string\SR\space into \string\MR/\string\LR}% + \writestatus\m!TABLE{change \string\SR\space into \string\MR/\string\LR}% \fi\fi\fi \fi \checkTABLErow\SR \endTABLErow\TABLEseparaterow\TABLErowfactor\TABLErowfactor} -\def\TableFR% +\def\TableFR {\ifTABLEgrayline \else \ifnum\TABLEaction=\TABLEmidrow - \writestatus{TABLE}{change \string\FR\space into \string\MR/\string\LR}% + \writestatus\m!TABLE{change \string\FR\space into \string\MR/\string\LR}% \else\ifnum\TABLEaction=\TABLElastrow - \writestatus{TABLE}{change \string\FR\space into \string\MR/\string\LR}% + \writestatus\m!TABLE{change \string\FR\space into \string\MR/\string\LR}% \fi\fi \fi \checkTABLErow\FR \endTABLErow\TABLEfirstrow\TABLErowfactor\TABLErowzero} -\def\TableMR% +\def\TableMR {\ifTABLEgrayline \else \ifnum\TABLEaction=\TABLErule - \writestatus{TABLE}{change \string\MR\space into \string\FR/\string\SR}% + \writestatus\m!TABLE{change \string\MR\space into \string\FR/\string\SR}% \else\ifnum\TABLEaction=\TABLElastrow - \writestatus{TABLE}{change \string\MR\space into \string\FR}% + \writestatus\m!TABLE{change \string\MR\space into \string\FR}% \fi\fi \fi \checkTABLErow\MR \endTABLErow\TABLEmidrow00} -\def\TableLR% +\def\TableLR {\ifTABLEgrayline \else \ifnum\TABLEaction=\TABLErule - \writestatus{TABLE}{change \string\LR\space into \string\FR/\string\SR}% + \writestatus\m!TABLE{change \string\LR\space into \string\FR/\string\SR}% \fi \fi \checkTABLErow\LR @@ -1477,8 +1462,8 @@ \newif\ifcheckTABLEcolumns -\let\beforeTABLEline=\empty -\let\afterTABLEline =\empty +\let\beforeTABLEline\empty +\let\afterTABLEline \empty \def\doendTABLErow#1#2#3% {\handleTABLEbreak#2#3% @@ -1502,7 +1487,7 @@ \fi \TABLEnoalign {\setTABLEforce\TABLEunknown - \global\currentTABLEcolumn=0 }% + \global\currentTABLEcolumn\zerocount}% \afterTABLEline} \def\endTABLErow#1#2#3% @@ -1524,30 +1509,30 @@ %D check takes care of the first and mid rows, the chuck macro %D |<|how about that name|>| handles the last row. -\def\TableAR% +\def\TableAR {\ifTABLEgraydone - \global\let\checkTABLEautorow=\empty - \global\let\chuckTABLEautorow=\empty + \globalletempty\checkTABLEautorow + \globalletempty\chuckTABLEautorow \global\TABLEgraydonefalse \TABLEendBCL \else - \global\let\checkTABLEautorow=\docheckTABLEautorow - \global\let\chuckTABLEautorow=\dochuckTABLEautorow + \globallet\checkTABLEautorow\docheckTABLEautorow + \globallet\chuckTABLEautorow\dochuckTABLEautorow \fi} -\let\checkTABLEautorow=\empty -\let\chuckTABLEautorow=\empty +\let\checkTABLEautorow\empty +\let\chuckTABLEautorow\empty -\def\docheckTABLEautorow% - {\global\let\checkTABLEautorow=\empty +\def\docheckTABLEautorow + {\globallet\checkTABLEautorow\empty \ifnum\TABLEaction=\TABLErule \FR \else\ifnum\TABLEaction=\TABLEunknown \FR \else \MR \fi\fi} -\def\dochuckTABLEautorow% - {\global\let\checkTABLEautorow=\empty - \global\let\chuckTABLEautorow=\empty +\def\dochuckTABLEautorow + {\globalletempty\checkTABLEautorow + \globalletempty\chuckTABLEautorow \ifnum\TABLEaction=\TABLErule \SR \else\ifnum\TABLEaction=\TABLEunknown \SR \else \LR @@ -1558,28 +1543,32 @@ \def\handleTABLEbreak#1#2% {\ifsplittables - \setbox0=\hbox{\AugmentedTableStrut{#1}{#2}}% - \getboxheight\dimen0\of\box0\relax + \setbox0\hbox{\AugmentedTableStrut{#1}{#2}}% + \getboxheight\dimen0\of\box0\relax \ifdim\TABLEparheight>\dimen0 % new - \dimen0=\TABLEparheight % new - \global\TABLEparheight=\!!zeropoint % new + \advance\dimen0-\lineheight % newer + \ifdim\dimen0<\zeropoint % newer + \dimen2\zeropoint % newer + \fi % newer + \advance\dimen0 \TABLEparheight % new + \global\TABLEparheight\zeropoint % new \fi % new \ifTABLEgrayline \else - \global\advance\TABLEheight by \dimen0 + \global\advance\TABLEheight\dimen0 \fi \ifTABLEinbreak - \global\let\beforeTABLEline=\empty + \globalletempty\beforeTABLEline \gdef\afterTABLEline{\TABLEnoalign{\nobreak}}% \else \dimen2=\TABLEheight - \advance\dimen2 by \dp\strutbox - \advance\dimen2 by \TABLEtailheight - \advance\dimen2 by \TABLEcaptionheight - \advance\dimen2 by \lineheight % we're ahead + \advance\dimen2 \dp\strutbox + \advance\dimen2 \TABLEtailheight + \advance\dimen2 \TABLEcaptionheight + \advance\dimen2 \lineheight % we're ahead \ifdim\dimen2>\TABLEmaxheight - \gdef\beforeTABLEline% + \gdef\beforeTABLEline {\setTABLEforce\TABLEforcelastrow}% - \gdef\afterTABLEline% + \gdef\afterTABLEline {\TABLEnoalign {\nobreak \global\TABLEinbreaktrue}% @@ -1596,12 +1585,12 @@ \global\TABLEinbreakfalse \setTABLEforce\TABLEforcefirstrow}}% \else - \global\let\beforeTABLEline=\empty + \globalletempty\beforeTABLEline \gdef\afterTABLEline{\TABLEnoalign{\nobreak}}% \fi \fi \else - \global\let\beforeTABLEline=\empty + \globalletempty\beforeTABLEline \gdef\afterTABLEline{\TABLEnoalign{\nobreak}}% \fi} @@ -1610,7 +1599,7 @@ \def\endofTABLEline[#1][#2->#3]#4#5% {\ifx#2#3\else - \writestatus{TABLE}{\string#2\space changed into \string#3}% + \writestatus\m!TABLE{\string#2\space changed into \string#3}% \fi \iftracetables \bgroup @@ -1633,8 +1622,8 @@ % \tttf\space\TABLEgraylineerror % \egroup \fi\fi - \global\let\TABLEgraylinestatus=\empty - \global\let\TABLEgraylineerror =\empty + \globalletempty\TABLEgraylinestatus + \globalletempty\TABLEgraylineerror \expandafter\normalTABLElineformat#4#5\crcr % \crcr nodig ? \TABLEnoalign{\nobreak\global\setTABLEactiontrue}} @@ -1655,15 +1644,26 @@ %D \TABLE\ changes the catcode when needed.} \bgroup -\catcode`\|=\@@other +\catcode`\&=\@@other \gdef\getTABLEnofcolumns#1% {\bgroup \convertargument#1\to\ascii - \@EA\doglobal\@EA\counttoken\@EA|\@EA\in\ascii\to\maxTABLEcolumn - \global\advance\maxTABLEcolumn by -1 + \@EA\doglobal\@EA\counttoken\@EA&\@EA\in\ascii\to\maxTABLEcolumn + \global\advance\maxTABLEcolumn \minusone + \global\divide\maxTABLEcolumn 2 \egroup} \egroup +\def\!ttDoHalign + {\baselineskip \zeropoint + \lineskiplimit\zeropoint + \lineskip \zeropoint + \tabskip \zeropoint + \expanded{\getTABLEnofcolumns{\the\!taPreamble}}% added + \halign \the\!taTableSpread \bgroup + \span\the\!taPreamble + \ifx \!tfRowOfWidths \empty \else \!tfRowOfWidths \cr \fi} + %D \startopsomming[3*ruim] %D \sym{\type{\VL}} a vertical line %D \sym{\type{\VC}} a vertical colored line @@ -1671,76 +1671,69 @@ %D \sym{\type{\HC}} a horizontal colored line %D \stopopsomming -\def\defineTABLErules% - {\let\VL=\TableVL - \let\VC=\TableVC - \let\HL=\TableHL - \let\HC=\TableHC} +\def\defineTABLErules + {\let\VL\TableVL + \let\VC\TableVC + \let\HL\TableHL + \let\HC\TableHC} -\def\TableVL% +\def\TableVL {\checkTABLEautorow \nextTABLEgrayline \ifnum\currentTABLEcolumn>\maxTABLEcolumn \setTABLEerror\TABLEmissingrow \handleTABLEerror \else - \global\advance\currentTABLEcolumn by 1 + \global\advance\currentTABLEcolumn \plusone \expandafter\doTableVL \fi} -%\def\doTableVL% -% {\complexorsimpleTable{VL}} - -\def\doTableVL% +\def\doTableVL {\futurelet\next\dodoTableVL} -\def\dodoTableVL% +\def\dodoTableVL {\docomplexorsimpleTable\complexTableVL\simpleTableVL} \def\complexTableVL[#1]% {\scratchcounter=0#1% - \multiply\scratchcounter by \@@tiVLwidth + \multiply\scratchcounter \@@tiVLwidth \setxvalue{wVL\the\currentTABLEcolumn}{\the\scratchcounter}% \simpleTableVL} -\def\simpleTableVL% +\def\simpleTableVL {\doifundefined{wVL\the\currentTABLEcolumn}% {\setgvalue{wVL\the\currentTABLEcolumn}{\@@tiVLwidth}}% - \gdef\TABLEbeforebar% + \gdef\TABLEbeforebar {\getvalue{bVL\the\currentTABLEcolumn}% - \global\letvalue{bVL\the\currentTABLEcolumn}=\empty}% - \gdef\TABLEafterbar% + \letgvalueempty{bVL\the\currentTABLEcolumn}}% + \gdef\TABLEafterbar {\getvalue{eVL\the\currentTABLEcolumn}% - \global\letvalue{eVL\the\currentTABLEcolumn}=\empty}% + \letgvalueempty{eVL\the\currentTABLEcolumn}}% \edef\@@tiVLwidth{\getvalue{wVL\the\currentTABLEcolumn}}% \expanded{\normalTABLEcomplexbar\@@tiVLwidth\space}}% \relax breaks \use - -\def\resetVLvalues% - {\dostepwiserecurse{0}{\maxTABLEcolumn}{1} - {\global\setvalue{wVL\recurselevel}{\@@tiVLwidth}% - \global\letvalue{bVL\recurselevel}=\empty - \global\letvalue{eVL\recurselevel}=\empty}% - \global\currentTABLEcolumn=0 } - -\def\TableVC% +\def\resetVLvalues + {\dostepwiserecurse\zerocount\maxTABLEcolumn\plusone + {\setgvalue{wVL\recurselevel}{\@@tiVLwidth}% + \letgvalueempty{bVL\recurselevel}% + \letgvalueempty{eVL\recurselevel}}% + \global\currentTABLEcolumn\zerocount} + +\def\TableVC {\checkTABLEautorow \nextTABLEgrayline \ifnum\currentTABLEcolumn>\maxTABLEcolumn \setTABLEerror\TABLEmissingrow \handleTABLEerror \else - \global\advance\currentTABLEcolumn by 1 + \global\advance\currentTABLEcolumn \plusone \expandafter\doTableVC \fi} -%\def\doTableVC% -% {\complexorsimpleTable{VC}} - -\def\doTableVC% +\def\doTableVC {\futurelet\next\dodoTableVC} -\def\dodoTableVC% +\def\dodoTableVC {\docomplexorsimpleTable\complexTableVC\simpleTableVC} \def\complexTableVC[#1]% @@ -1750,21 +1743,21 @@ {\localstopcolor}% \simpleTableVC} -\def\simpleTableVC% +\def\simpleTableVC {\global\setvalue{bVL\the\currentTABLEcolumn}% {\getvalue{bVC\the\currentTABLEcolumn}}% \global\setvalue{eVL\the\currentTABLEcolumn}% {\getvalue{eVC\the\currentTABLEcolumn}}% \doTableVL} -\def\TableHL% +\def\TableHL {\ifnum\currentTABLEcolumn>\maxTABLEcolumn \chuckTABLEautorow - \else\ifnum\currentTABLEcolumn=0 + \else\ifnum\currentTABLEcolumn=\zerocount %\chuckTABLEautorow \TABLEnoalign - {\global\let\checkTABLEautorow=\empty - \global\let\chuckTABLEautorow=\empty}% + {\globalletempty\checkTABLEautorow + \globalletempty\chuckTABLEautorow}% \else \setTABLEerror\TABLEmissingcolumn \handleTABLEerror @@ -1774,35 +1767,35 @@ \def\complexTableHL[#1]% {\TABLEnoalign {\scratchcounter=0#1% - \multiply\scratchcounter by \@@tiHLheight + \multiply\scratchcounter \@@tiHLheight \edef\@@tiHLheight{\the\scratchcounter}% \simpleTableHL}} -\def\simpleTableHL% +\def\simpleTableHL {\TABLEnoalign {\nobreak \ifnum\TABLEaction=\TABLErule - \writestatus{TABLE}{skipping \string\HL}% \statusmessage + \writestatus\m!TABLE{skipping \string\HL}% \statusmessage \else \ifnum\TABLEaction=\TABLEmidrow - \writestatus{TABLE}{change \string\MR\space into \string\LR/\string\SR}% + \writestatus\m!TABLE{change \string\MR\space into \string\LR/\string\SR}% \else\ifnum\TABLEaction=\TABLEfirstrow - \writestatus{TABLE}{change \string\MR\space into \string\SR}% + \writestatus\m!TABLE{change \string\MR\space into \string\SR}% \fi\fi \startHLcommand \expandafter\normalTABLEfullrule\@@tiHLheight \stopHLcommand - \global\let\startHLcommand=\empty - \global\let\stopHLcommand =\empty + \globalletempty\startHLcommand + \globalletempty\stopHLcommand \accountTABLElinewidth \fi \setTABLEaction\TABLErule \nobreak}} -\let\startHLcommand=\empty -\let\stopHLcommand =\empty +\let\startHLcommand\empty +\let\stopHLcommand \empty -\def\TableHC% +\def\TableHC {\complexorsimpleTable{HC}} \def\complexTableHC[#1]% @@ -1811,10 +1804,10 @@ \gdef\stopHCcommand {\localstopcolor}}% \simpleTableHC} -\def\simpleTableHC% +\def\simpleTableHC {\TABLEnoalign - {\global\let\startHLcommand=\startHCcommand - \global\let\stopHLcommand =\stopHCcommand}% + {\globallet\startHLcommand\startHCcommand + \globallet\stopHLcommand \stopHCcommand}% \HL} %D \startopsomming[3*ruim] @@ -1828,15 +1821,15 @@ % n+1 uitleggen -\def\defineTABLEsteps% - {\let\NL=\TableNL - \let\NR=\TableNR - \let\NC=\TableNC - \let\FC=\TableNC - \let\MC=\TableNC - \let\LC=\TableNC} +\def\defineTABLEsteps + {\let\NL\TableNL + \let\NR\TableNR + \let\NC\TableNC + \let\FC\TableNC + \let\MC\TableNC + \let\LC\TableNC} -\def\TableNL% +\def\TableNL {\complexorsimpleTable{NL}} \def\complexTableNL[#1]% @@ -1844,17 +1837,17 @@ {\edef\@@tiNL{#1}% \simpleTableNL}}% -\def\simpleTableNL% +\def\simpleTableNL {\TABLEnoalign {\nobreak - \setbox0=\vbox{\blanko[\@@tiNL]}% - \global\advance\TABLEheight by \ht0 + \setbox0\vbox{\blanko[\@@tiNL]}% + \global\advance\TABLEheight \ht0 \vskip\ht0 \nobreak}} -\def\TableNR% +\def\TableNR {\ifnum\currentTABLEcolumn>\maxTABLEcolumn - \global\currentTABLEcolumn=0 + \global\currentTABLEcolumn\zerocount \normalTABLElineending \else \setTABLEerror\TABLEmissingcolumn @@ -1864,14 +1857,14 @@ {\nobreak \setTABLEaction\TABLEunknown}} -\def\TableNC% +\def\TableNC {\checkTABLEautorow \nextTABLEgrayline \ifnum\currentTABLEcolumn>\maxTABLEcolumn \setTABLEerror\TABLEmissingrow \handleTABLEerror \else - \global\advance\currentTABLEcolumn by 1 + \global\advance\currentTABLEcolumn \plusone \normalTABLEquote \fi} @@ -1893,36 +1886,36 @@ \newif\ifTABLEdivision -\def\defineTABLEdivisions% +\def\defineTABLEdivisions {\global\TABLEdivisionfalse % in start - \let\DL=\TableDL - \let\DC=\TableDC - \let\DV=\TableDV - \let\VD=\TableDV - \let\DR=\TableDR} + \let\DL\TableDL + \let\DC\TableDC + \let\DV\TableDV + \let\VD\TableDV + \let\DR\TableDR} -\def\checkTABLEdivision% +\def\checkTABLEdivision {\ifTABLEdivision \else \chuckTABLEautorow - \global\currentTABLEcolumn=0 + \global\currentTABLEcolumn\zerocount \global\TABLEdivisiontrue \fi} -\def\TableDL% +\def\TableDL {\checkTABLEdivision \complexorsimpleTable{DL}} -\def\simpleTableDL% +\def\simpleTableDL {\complexTableDL[1]} \def\complexTableDL[#1]% {\ifnum\TABLEaction=\TABLErule - \writestatus{TABLE}{skipping \string\DL}% + \writestatus\m!TABLE{skipping \string\DL}% \else \ifnum\TABLEaction=\TABLEmidrow - \writestatus{TABLE}{change \string\MR\space into \string\LR/\string\SR}% + \writestatus\m!TABLE{change \string\MR\space into \string\LR/\string\SR}% \else\ifnum\TABLEaction=\TABLEfirstrow - \writestatus{TABLE}{change \string\MR\space into \string\SR}% + \writestatus\m!TABLE{change \string\MR\space into \string\SR}% \fi\fi \setTABLEaction=\TABLEunknown \ifnum\currentTABLEcolumn>\maxTABLEcolumn @@ -1930,28 +1923,28 @@ \handleTABLEerror \fi %\startHLcommand - \ifnum#1=1 - \global\advance\currentTABLEcolumn by 2 - \let\next=\normalTABLEsinglerule + \ifnum#1=\plusone + \global\advance\currentTABLEcolumn 2 + \let\next\normalTABLEsinglerule \else \ifnum#1<\maxTABLEcolumn - \global\advance\currentTABLEcolumn by 1 % was 2 + \global\advance\currentTABLEcolumn \plusone \def\next{\normalTABLEmultirule{#1}}% \else \setTABLEerror\TABLEdivisionoverflow - \let\next=\handleTABLEerror + \let\next\handleTABLEerror \fi \fi \next %\stopHLcommand - %\global\let\startHLcommand=\empty - %\global\let\stopHLcommand =\empty + %\globalletempty\startHLcommand + %\globalletempty\stopHLcommand \fi} -\def\TableDV% +\def\TableDV {\TableDCV\normalTABLEsimplebar} -\def\TableDC% +\def\TableDC {\TableDCV\normalTABLEquote} \def\TableDCV#1% @@ -1961,31 +1954,17 @@ \setTABLEerror\TABLEmissingrow \handleTABLEerror \else - \global\advance\currentTABLEcolumn by 1 + \global\advance\currentTABLEcolumn \plusone #1% \fi} -%\def\TableDR% -% {\ifnum\currentTABLEcolumn<\maxTABLEcolumn % silent recovery -% \setTABLEerror\TABLEmissingcolumn % some day warning -% \handleTABLEerror -% \else -% \global\currentTABLEcolumn=0 % nog check -% \normalTABLElineending -% \fi -% \TABLEnoalign -% {\nobreak -% \global\TABLEdivisionfalse -% \accountTABLElinewidth % temporary solution -% \setTABLEaction\TABLErule}} - -\def\TableDR% +\def\TableDR {\ifnum\currentTABLEcolumn<\maxTABLEcolumn % silent recovery %\setTABLEerror\TABLEmissingcolumn % some day warning %\handleTABLEerror \finishTABLErow \else - \global\currentTABLEcolumn=0 % nog check + \global\currentTABLEcolumn\zerocount % nog check \normalTABLElineending \fi \TABLEnoalign @@ -1994,9 +1973,9 @@ \accountTABLElinewidth % temporary solution \setTABLEaction\TABLErule}} -\def\accountTABLElinewidth% - {\scratchdimen=\LineThicknessUnit - \global\advance\TABLEheight by \@@tiHLheight\scratchdimen} +\def\accountTABLElinewidth + {\scratchdimen\LineThicknessUnit + \global\advance\TABLEheight \@@tiHLheight\scratchdimen} %D \startopsomming[3*ruim] %D \sym{\type{\BC}} @@ -2014,51 +1993,51 @@ % definieer: \CL \RL (eerste \CL[green] = hele row! / \CL[1,green]) % dus: \CL en \RL mix tussen \HL en \BL -\def\defineTABLEbackgrounds% - {\let\BC =\TableBC - \let\BL =\TableBL - \let\BR =\TableBR - \let\BACKGROUND=\TableBR - \let\CL =\TableCL - \let\RL =\TableRL - \let\COLOR =\TableCOLOR - \let\RASTER =\TableRASTER - \global\let\lastTABLEc=\@@tiachtergrondkleur - \global\let\lastTABLEr=\@@tiachtergrondraster - \doifinsetelse{\@@tiachtergrond}{c,color} - {\global\chardef\TABLEcr=1} - {\global\chardef\TABLEcr=2}} - -\def\TableBC% +\def\defineTABLEbackgrounds + {\let\BC \TableBC + \let\BL \TableBL + \let\BR \TableBR + \let\BACKGROUND\TableBR + \let\CL \TableCL + \let\RL \TableRL + \let\COLOR \TableCOLOR + \let\RASTER \TableRASTER + \globallet\lastTABLEc\@@tiachtergrondkleur + \globallet\lastTABLEr\@@tiachtergrondraster + \doifinsetelse\@@tiachtergrond{c,color} + {\global\chardef\TABLEcr1 } + {\global\chardef\TABLEcr2 }} + +\def\TableBC {\ifTABLEgrayline \normalTABLEquote \else \TABLEnoalign\bgroup - \global\let\nextTABLEgrayline=\executeTABLEgrayline - \global\let\TABLEgrayline\empty % new - \let\BL=\doTableBL - \let\BC=\doTableBC + \globallet\nextTABLEgrayline\executeTABLEgrayline + \globalletempty\TABLEgrayline % new + \let\BL\doTableBL + \let\BC\doTableBC \expandafter\doTableBC \fi} -\def\doTableBC% +\def\doTableBC {\addtoTABLEgrayline{\BC}% \gobbleTableBCL} -\def\TableBL% +\def\TableBL {\TABLEnoalign\bgroup - \global\let\nextTABLEgrayline=\executeTABLEgrayline - \global\let\TABLEgrayline\empty % new - \let\BL=\doTableBL - \let\CL=\doTableCL - \let\RL=\doTableRL - \let\BC=\doTableBC + \globallet\nextTABLEgrayline\executeTABLEgrayline + \globalletempty\TABLEgrayline % new + \let\BL\doTableBL + \let\CL\doTableCL + \let\RL\doTableRL + \let\BC\doTableBC \doTableBL} -\def\doTableBL% +\def\doTableBL {\complexorsimpleTable{BL}} -\def\simpleTableBL% +\def\simpleTableBL {\complexTableBL[,]} \def\complexTableBL[#1]% @@ -2067,7 +2046,7 @@ \def\TableBR#1% {\TABLEnoalign - {\global\let\nextTABLEgrayline=\executeTABLEgrayline + {\globallet\nextTABLEgrayline\executeTABLEgrayline \checkTABLEgrayline#1\BR \global\TABLEgraylinetrue}} @@ -2080,20 +2059,20 @@ {\dodoanalyzeTABLEcr[1,#1,#2]}} \def\dodoanalyzeTABLEcr[#1,#2,#3]% - {\global\chardef\TABLEn=#1\relax + {\global\chardef\TABLEn#1\relax \processaction [#2] - [ c=>\global\chardef\TABLEcr=1, - color=>\global\chardef\TABLEcr=1, - r=>\global\chardef\TABLEcr=2, - raster=>\global\chardef\TABLEcr=2]% + [ c=>\global\chardef\TABLEcr1,% + color=>\global\chardef\TABLEcr1,% + r=>\global\chardef\TABLEcr2,% + raster=>\global\chardef\TABLEcr2]% \ifcase\TABLEcr \or - \doifnot{#3}{}{\xdef\lastTABLEc{#3}}% + \doifsomething{#3}{\xdef\lastTABLEc{#3}}% \or - \doifnot{#3}{}{\xdef\lastTABLEr{#3}}% + \doifsomething{#3}{\xdef\lastTABLEr{#3}}% \fi} -\def\handleTABLEcr% +\def\handleTABLEcr {\relax % else funny side effect \ifcase\TABLEcr % Can't happen! @@ -2112,17 +2091,17 @@ {\dodoanalyzeTABLEcr[#2,#1,#3]} {\dodoanalyzeTABLEcr[\ifTABLEgrayline1\else\maxTABLEcolumn\fi,#1,#2]}} -\def\TableCL% +\def\TableCL {\TABLEnoalign\bgroup - \global\let\nextTABLEgrayline=\executeTABLEgrayline - \global\let\TABLEgrayline\empty % new - \let\BL=\doTableBL - \let\CL=\doTableCL - \let\RL=\doTableRL - \let\BC=\doTableBC + \globallet\nextTABLEgrayline\executeTABLEgrayline + \globalletempty\TABLEgrayline % new + \let\BL\doTableBL + \let\CL\doTableCL + \let\RL\doTableRL + \let\BC\doTableBC \doTableCL} -\def\doTableCL% +\def\doTableCL {\complexorsimpleTable{CL}} \def\simpleTableCL% nog eens \'e\'en lijn van maken @@ -2132,20 +2111,20 @@ {\analyzeTABLEcrl{c}[#1]% \handleTABLEcr} -\def\TableRL% +\def\TableRL {\TABLEnoalign\bgroup - \global\let\nextTABLEgrayline=\executeTABLEgrayline - \global\let\TABLEgrayline\empty % new - \let\BL=\doTableBL - \let\CL=\doTableCL - \let\RL=\doTableRL - \let\BC=\doTableBC + \globallet\nextTABLEgrayline\executeTABLEgrayline + \globalletempty\TABLEgrayline % new + \let\BL\doTableBL + \let\CL\doTableCL + \let\RL\doTableRL + \let\BC\doTableBC \doTableRL} -\def\doTableRL% +\def\doTableRL {\complexorsimpleTable{RL}} -\def\simpleTableRL% +\def\simpleTableRL {\BL[\the\maxTABLEcolumn,r,\lastTABLEr]} \def\complexTableRL[#1]% @@ -2160,14 +2139,14 @@ \!!doneafalse \fi\fi\fi\fi\fi \if!!donea - \gdef\TABLEgraylinestatus% + \gdef\TABLEgraylinestatus {[\string#1]}% - \gdef\TABLEendBCL% + \gdef\TABLEendBCL {#1}% \else - \gdef\TABLEgraylineerror% + \gdef\TABLEgraylineerror {[\string#2\string#1->\string#2\string\SR]}% - \gdef\TABLEendBCL% + \gdef\TABLEendBCL {\SR}% \fi} @@ -2193,15 +2172,15 @@ \def\doPreTableGL#1#2% betere namen {\xdef\OldLineThicknessFactor{\the\LineThicknessFactor}% \xdef\OldLineThicknessUnit{\the\LineThicknessUnit}% - \global\LineThicknessFactor=1 - \setbox0=\hbox{\AugmentedTableStrut{#1}{#2}}% + \global\LineThicknessFactor\plusone + \setbox0\hbox{\AugmentedTableStrut{#1}{#2}}% \getboxheight\dimen0\of\box0\relax \xdef\TABLEgraylineHeight{\the\dimen0}% - \global\LineThicknessUnit=\TABLEgraylineHeight} + \global\LineThicknessUnit\TABLEgraylineHeight} -\def\doPostTableGL% - {\global\LineThicknessFactor=\OldLineThicknessFactor - \global\LineThicknessUnit =\OldLineThicknessUnit} +\def\doPostTableGL + {\global\LineThicknessFactor\OldLineThicknessFactor + \global\LineThicknessUnit \OldLineThicknessUnit} % kan simpeler @@ -2216,8 +2195,8 @@ \def\dodocomplexTableGL#1#2[#3,#4,#5,#6]% {\doifelsenothing{#4}{#1[#5]}{#1[#4]}% \doPreTableGL\TABLEendofrowheight\TABLEendofrowdepth - \ifnum#3=1 % else conflict with \omit in \= - \let\next=\normalTABLEsinglerule + \ifnum#3=\plusone % else conflict with \omit in \= + \let\next\normalTABLEsinglerule \else \def\next{\normalTABLEmultirule{#3}}% \fi @@ -2225,7 +2204,7 @@ \doPostTableGL #2} -\def\TableBACKGROUND% +\def\TableBACKGROUND {\TableBR} \def\simpleTableRASTER#1% @@ -2234,20 +2213,20 @@ \def\complexTableRASTER[#1]% {\docomplexTableRASTER[#1]} -\def\simpleTableCOLOR% +\def\simpleTableCOLOR {\docomplexTableCOLOR[1]} \def\complexTableCOLOR[#1]% {\docomplexTableCOLOR[#1]} -\def\TableRASTER% +\def\TableRASTER {\complexorsimpleTable{RASTER}} -\def\TableCOLOR% +\def\TableCOLOR {\complexorsimpleTable{COLOR}} \def\addtoTABLEgrayline#1% - {\TABLEgraytoks=\expandafter{\TABLEgrayline}% + {\TABLEgraytoks\expandafter{\TABLEgrayline}% \xdef\TABLEgrayline{\the\TABLEgraytoks\noexpand#1}} \def\setTableBCL#1#2% @@ -2262,69 +2241,69 @@ \fi} \def\gobbleTableBCL#1% - {\ifx#1\BC \let\next=\doTableBC \else - \ifx#1\BL \let\next=\doTableBL \else - \ifx#1\SR \setTableBCL\SR\SR \let\next=\egroup \else - \ifx#1\FR \setTableBCL\FR\FR \let\next=\egroup \else - \ifx#1\MR \setTableBCL\MR\MR \let\next=\egroup \else - \ifx#1\LR \setTableBCL\LR\LR \let\next=\egroup \else - \setTableBCL #1\SR \let\next=\egroup + {\ifx#1\BC \let\next\doTableBC \else + \ifx#1\BL \let\next\doTableBL \else + \ifx#1\SR \setTableBCL\SR\SR \let\next\egroup \else + \ifx#1\FR \setTableBCL\FR\FR \let\next\egroup \else + \ifx#1\MR \setTableBCL\MR\MR \let\next\egroup \else + \ifx#1\LR \setTableBCL\LR\LR \let\next\egroup \else + \setTableBCL #1\SR \let\next\egroup \fi\fi\fi\fi\fi\fi \next} -\def\executeTABLEgrayline% +\def\executeTABLEgrayline {\TABLEnoalign - {\def\BC% - {\advance\currentTABLEcolumn by 1 }% + {\def\BC + {\advance\currentTABLEcolumn \plusone}% \def\dodocomplexTableGL##1##2[##3,##4,##5,##6]% - {\BC\advance\currentTABLEcolumn by ##3 }% - \let\endTABLErow=\endTABLEgrayrow - \currentTABLEcolumn=0 + {\BC\advance\currentTABLEcolumn ##3 }% + \let\endTABLErow\endTABLEgrayrow + \currentTABLEcolumn\zerocount \TABLEgrayline\TABLEendBCL % determine n of columns and height - \advance\currentTABLEcolumn by -1 + \advance\currentTABLEcolumn \minusone \ifnum\currentTABLEcolumn>\maxTABLEcolumn % error message too long line - \global\let\TABLEgrayline=\empty + \globalletempty\TABLEgrayline \else % \message{n of color columns: \the\currentTABLEcolumn}\wait \global\TABLEgraylinetrue % vanaf hier nog checken \fi - \global\currentTABLEcolumn=0}% + \global\currentTABLEcolumn\zerocount}% \unskip\TABLEgrayline\TABLEendBCL \TABLEnoalign {\nobreak \vskip-\TABLEgraylineHeight \nobreak \global\setTABLEactiontrue - \global\currentTABLEcolumn=0 - \global\let\nextTABLEgrayline=\empty + \global\currentTABLEcolumn\zerocount + \globalletempty\nextTABLEgrayline \global\TABLEgraydonetrue \global\TABLEgraylinefalse}} \def\endTABLEgrayrow#1#2#3% {\ifcase#1\relax - \global\chardef\TABLEendofrowheight=\TABLErowfactor - \global\chardef\TABLEendofrowdepth =\TABLErowfactor + \global\chardef\TABLEendofrowheight\TABLErowfactor + \global\chardef\TABLEendofrowdepth \TABLErowfactor \or - \global\chardef\TABLEendofrowheight=\TABLErowfactor - \global\chardef\TABLEendofrowdepth =\TABLErowfactor + \global\chardef\TABLEendofrowheight\TABLErowfactor + \global\chardef\TABLEendofrowdepth \TABLErowfactor \or - \global\chardef\TABLEendofrowheight=\TABLErowfactor - \global\chardef\TABLEendofrowdepth =\TABLErowzero + \global\chardef\TABLEendofrowheight\TABLErowfactor + \global\chardef\TABLEendofrowdepth \TABLErowzero \or \ifnum\TABLEforce=\TABLEforcelastrow - \global\chardef\TABLEendofrowheight=\TABLErowzero - \global\chardef\TABLEendofrowdepth =\TABLErowfactor + \global\chardef\TABLEendofrowheight\TABLErowzero + \global\chardef\TABLEendofrowdepth \TABLErowfactor \else\ifnum\TABLEforce=\TABLEforcefirstrow - \global\chardef\TABLEendofrowheight=\TABLErowfactor - \global\chardef\TABLEendofrowdepth =\TABLErowzero + \global\chardef\TABLEendofrowheight\TABLErowfactor + \global\chardef\TABLEendofrowdepth \TABLErowzero \else - \global\chardef\TABLEendofrowheight=\TABLErowzero - \global\chardef\TABLEendofrowdepth =\TABLErowzero + \global\chardef\TABLEendofrowheight\TABLErowzero + \global\chardef\TABLEendofrowdepth \TABLErowzero \fi\fi \or - \global\chardef\TABLEendofrowheight=\TABLErowzero - \global\chardef\TABLEendofrowdepth =\TABLErowfactor + \global\chardef\TABLEendofrowheight\TABLErowzero + \global\chardef\TABLEendofrowdepth \TABLErowfactor \fi} \def\defineTABLEshorthands% @@ -2336,33 +2315,32 @@ \def\SIX {\use{6}}% \def\REF {\ReFormat}} -\def\defineTABLEunits% +\def\defineTABLEunits {\processaction [\@@tiafstand] - [ \v!geen=>\OpenUp{0}{0}\def\LOW{\Lower6 }, - \v!klein=>\OpenUp{0}{0}\def\LOW{\Lower6 }, % == baseline - \v!middel=>\OpenUp{1}{1}\def\LOW{\Lower7 }, - \v!groot=>\OpenUp{2}{2}\def\LOW{\Lower8 }]% - \doifelse{\@@tiafstand}{\v!geen} - {\chardef\TABLErowfactor=0 } - {\chardef\TABLErowfactor=2 }} + [ \v!geen=>\OpenUp{0}{0}\def\LOW{\Lower6 }, + \v!klein=>\OpenUp{0}{0}\def\LOW{\Lower6 }, % == baseline + \v!middel=>\OpenUp{1}{1}\def\LOW{\Lower7 }, + \v!groot=>\OpenUp{2}{2}\def\LOW{\Lower8 }]% + \doifelse\@@tiafstand\v!geen + {\chardef\TABLErowfactor0 } + {\chardef\TABLErowfactor2 }} -\def\dohandlebar% +\def\dohandlebar {\ifmmode - \let\next=\domathmodebar + \@EA\domathmodebar \else\ifintable - \let\next=\domathmodebar + \@EAEAEA\domathmodebar \else - \let\next=\dotextmodebar - \fi\fi - \next} + \@EAEAEA\dotextmodebar + \fi\fi} % De macro's t.b.v. instellingen. -\def\steltabellenin% - {\dosingleargument\dosteltabellenin} +\def\setuptables + {\dosingleargument\dosetuptables} -\def\dosteltabellenin[#1]% +\def\dosetuptables[#1]% {\getparameters[\??ti][#1]% \processaction [\@@tiuitlijnen] @@ -2371,17 +2349,17 @@ \v!midden=>\def\TABLEparalignment{\raggedcenter}, \s!default=>\def\TABLEparalignment{\notragged}, \s!unknown=>\def\TABLEparalignment{\notragged}]% - \assignalfadimension{\@@tiVL}{\@@tiVLwidth} {2}{4}{6}% - \assignalfadimension{\@@tiHL}{\@@tiHLheight}{2}{4}{6}} + \assignalfadimension\@@tiVL\@@tiVLwidth 246% + \assignalfadimension\@@tiHL\@@tiHLheight246} -\def\localTABLEsetup% +\def\localTABLEsetup {\@@ticommandos\relax \expanded{\switchtobodyfont[\@@tikorps]}% - \StrutHeightFactor =8 - \StrutDepthFactor =4 - \LineThicknessFactor=4 - \NormalTLTU ={.1pt}% - \NormalTSU ={\normalbaselineskip\divide\StrutUnit by 12 }% + \StrutHeightFactor 8 + \StrutDepthFactor 4 + \LineThicknessFactor4 + \NormalTLTU {.1pt}% + \NormalTSU {\normalbaselineskip\divide\StrutUnit 12 }% \NormalTableUnits} %D And then I wrote the tabulate environment. That @@ -2391,52 +2369,52 @@ \let\startglobalTABLEcolor\empty \let\stopglobalTABLEcolor \empty -\def\localTABLEsetup% +\def\localTABLEsetup {\@@ticommandos\relax % bodyfont \expanded{\switchtobodyfont[\@@tikorps]}% % linecolor - \doifsomething{\@@tilijnkleur} + \doifsomething\@@tilijnkleur {\def\startglobalTABLEcolor{\localstartcolor[\@@tilijnkleur]}% \def\stopglobalTABLEcolor {\localstopcolor}}% % linethickness - \LineThicknessFactor=4 - \scratchdimen=\@@tilijndikte - \divide\scratchdimen by \LineThicknessFactor - \expanded{\NormalTLTU={\the\scratchdimen}}% + \LineThicknessFactor4 + \scratchdimen\@@tilijndikte + \divide\scratchdimen \LineThicknessFactor + \expanded{\NormalTLTU{\the\scratchdimen}}% % spacing, was depth=4 height=8 (counters, sigh, now macros) - \doifelse{\@@tihoogte}{\v!strut} + \doifelse\@@tihoogte\v!strut {\let\StrutHeightFactor\@@ithoogte} {\let\StrutHeightFactor\@@tihoogte}% - \doifelse{\@@tidiepte}{\v!strut} + \doifelse\@@tidiepte\v!strut {\let\StrutDepthFactor\@@itdiepte} {\let\StrutDepthFactor\@@tidiepte}% - \scratchdimen=\StrutHeightFactor pt \multiply\scratchdimen by 10 + \scratchdimen\StrutHeightFactor \s!pt \multiply\scratchdimen 10% \edef\StrutHeightFactor{\@EA\withoutpt\the\scratchdimen}% - \scratchdimen=\StrutDepthFactor pt \multiply\scratchdimen by 10 + \scratchdimen\StrutDepthFactor \s!pt \multiply\scratchdimen 10% \edef\StrutDepthFactor{\@EA\withoutpt\the\scratchdimen}% % units - \NormalTSU={\normalbaselineskip\divide\StrutUnit by 12 }% + \NormalTSU{\normalbaselineskip\divide\StrutUnit 12 }% \NormalTableUnits} \def\OpenUp#1#2% - {\scratchdimen=\StrutHeightFactor pt \advance\scratchdimen by #1pt + {\scratchdimen\StrutHeightFactor \s!pt \advance\scratchdimen #1\s!pt \edef\StrutHeightFactor{\@EA\withoutpt\the\scratchdimen}% - \scratchdimen=\StrutDepthFactor pt \advance\scratchdimen by #2pt + \scratchdimen\StrutDepthFactor \s!pt \advance\scratchdimen #2\s!pt \edef\StrutDepthFactor{\@EA\withoutpt\the\scratchdimen}} %D As one can see, we didn't only add color, but also more %D control over spacing. %D %D \startbuffer[a] -%D \starttabel[|c|] +%D \starttable[|c|] %D \HL %D \VL \strut test \VL \FR %D \VL \strut test \VL \MR %D \VL \strut test \VL \MR %D \VL \strut test \VL \LR %D \HL -%D \stoptabel +%D \stoptable %D \stopbuffer %D %D \startbuffer[b] @@ -2464,21 +2442,22 @@ %D happens when we set the values to zero. The rightmost table %D is typeset using the tabulate environment. %D -%D \startcombinatie +%D \startcombinatie[4*1] %D {$\vcenter{\haalbuffer[a]}$} -%D {h=.8 d=.4} -%D {\steltabellenin[hoogte=strut,diepte=strut]$\vcenter{\haalbuffer[a]}$} -%D {h=d=\type{strut}} -%D {\steltabellenin[hoogte=0,diepte=0]$\vcenter{\haalbuffer[a]}$} -%D {h=d=0} +%D {\hbox{h=.8 d=.4}} +%D {\setuptables[hoogte=strut,diepte=strut]$\vcenter{\haalbuffer[a]}$} +%D {\hbox{h=d=\type{strut}}} +%D {\setuptables[hoogte=0,diepte=0]$\vcenter{\haalbuffer[a]}$} +%D {\hbox{h=d=0}} %D {$\vcenter{\haalbuffer[b]}$} -%D {tabulate} +%D {\hbox{tabulate}} %D \stopcombinatie -\steltabellenin +\setuptables [HL=\v!middel, VL=\v!middel, NL=\v!klein, + \c!kader=, \c!uitlijnen=\v!rechts, \c!diepte=.40, % \v!strut \c!hoogte=.80, % \v!strut diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex index eb2b19e30..2bf47a88d 100644 --- a/tex/context/base/core-tbl.tex +++ b/tex/context/base/core-tbl.tex @@ -22,6 +22,16 @@ % |p2|p3| 2:3 % spanning +% Be careful with changing the hsize calculation in p mode; +% the following code works quite well: +% +% \setupfield [line][location=low,height=1.2\lineheight,width=\hsize] +% \definefield [test] [line] [line] [] +% +% \starttabulate[|l|p|] +% \NC test \NC \field [test] \NC \NR +% \stoptabulate + % In-text tabbing environment % % \starttabulate[| separated template] % eg [|l|p|] or [|l|p|p|] @@ -70,7 +80,7 @@ % 10 evt auto stack; dan wel andere signal dan void nodig -% present but not yet 100% ok +% present but not yet 100% ok % % \FL top hrule % \ML mid hrule (with auto split) @@ -85,6 +95,8 @@ % % \NR +% \HR : rule with lineheight + % tricky: align scans ahead, over # and expands ones before % while doing @@ -129,8 +141,8 @@ \newtoks \tabulatesettings \newtoks \tabulatedummy -\newcount \nofautotabulate % \newcounter \nofautotabulate -\newcount \tabulatecolumns % \newcounter \tabulatecolumns +\newcount \nofautotabulate % \newcounter \nofautotabulate +\newcount \tabulatecolumns % \newcounter \tabulatecolumns \newcounter \tabulateminplines \newcounter \tabulatemaxplines @@ -140,6 +152,7 @@ \newif \ifhandletabulatepbreak \handletabulatepbreaktrue \newif \iftabulateequal \newif \iftracetabulate +\newif \ifframedtabulate \newdimen \tabulatepwidth \newdimen \tabulatewidth @@ -164,10 +177,30 @@ \def\@@tabhook@@ {@@tabhook@} \def\@@tabalign@@{@@tabalign@} -\dorecurse\noftabcolumns % quick and dirty stack - {\@EA\newbox\csname\@@tabbox@@\recurselevel\endcsname} +% \dorecurse\noftabcolumns % quick and dirty stack +% {\@EA\newbox\csname\@@tabbox@@\recurselevel\endcsname} + +\def\tablebox#1% + {\csname\@@tabbox@@\number#1\endcsname} -\def\dotabulatenobreak% +\def\checktablebox#1% + {\ifundefinedelse{\@@tabbox@@\number#1}% + \expandafter\newbox\csname\@@tabbox@@\number#1\endcsname + \fi} + +\def\initializetablebox#1% + {\ifundefined{\@@tabbox@@\number#1} + \expandafter\newbox\csname\@@tabbox@@\number#1\endcsname + \else + \global\setbox\csname\@@tabbox@@\number#1\endcsname\box\voidb@x + \fi} + +\def\initializetableboxes#1% + {\dorecurse#1{\initializetablebox\recurselevel}} + +\initializetableboxes\noftabcolumns + +\def\dotabulatenobreak {\noalign {\nobreak \iftracetabulate @@ -179,11 +212,11 @@ \let\notabulatehook\empty -\def\checktabulatehook% +\def\checktabulatehook {\ifnum\tabulatetype<2 %\global\let\tabulatehook\relax \global\let\tabulatehook\notabulatehook -\else + \else \global\let\tabulatehook\dotabulatehook \fi} @@ -215,12 +248,13 @@ % 1 = RC column raw RQ equal column raw % 2 = HC column hook HQ equal column hook \@EA\appendtoks \@EA&\@EA\hskip\pretabskip##&\to\!!toksa +\appendtoks\ignorespaces\to\!!toksa %\@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\tabulatecolumns}\to\!!toksa \@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\the\tabulatecolumns}\to\!!toksa \appendtoks \checktabulatehook\to\!!toksa \@EA\appendtoks \preamblebox\to\!!toksa \appendtoks \bgroup\bbskip\bgroup#1\to\!!toksa - \appendtoks\ifnum\tabulatetype=1 \else \to\!!toksa + \appendtoks\ifnum\tabulatetype=\plusone \else \to\!!toksa \@EA\appendtoks \the\tabulatebmath\to\!!toksa \@EA\appendtoks \the\tabulatefont\to\!!toksa \@EA\appendtoks \the\tabulatesettings\to\!!toksa @@ -251,15 +285,15 @@ \let\gettabulateexit\dogettabulateexit \tabulatewidth\zeropoint} -\def\dosettabulatepreamble% +\def\dosettabulatepreamble {\ifx\next\relax \let\nextnext\relax \else \let\nextnext\settabulatepreamble - \ifx x\next \chardef\tabulatealign=0 - \else\ifx l\next \chardef\tabulatealign=1 - \else\ifx r\next \chardef\tabulatealign=2 - \else\ifx c\next \chardef\tabulatealign=3 + \ifx x\next \chardef\tabulatealign\zerocount + \else\ifx l\next \chardef\tabulatealign\plusone + \else\ifx r\next \chardef\tabulatealign\plustwo + \else\ifx c\next \chardef\tabulatealign\plusthree \else\ifx p\next \let\nextnext\gettabulateparagraph \else\ifx w\next \let\nextnext\gettabulatewidth \else\ifx f\next \let\nextnext\gettabulatefont @@ -288,7 +322,7 @@ \fi \nextnext} -\def\dogettabulateexit% +\def\dogettabulateexit {\let\postabskip\!!zeropoint \settabulatepreamble} @@ -316,15 +350,13 @@ \edef\pretabskip{\the\scratchdimen}% \let\postabskip\pretabskip \let\gettabulateexit\settabulatepreamble - \@EA\settabulatepreamble\next} + \@EA\settabulatepreamble\next} \def\gettabulatehook#1% - %{\setvalue{\@@tabhook@@\tabulatecolumns}{#1}% {\setvalue{\@@tabhook@@\the\tabulatecolumns}{#1}% \settabulatepreamble} \def\gettabulatealign#1% - %{\setvalue{\@@tabalign@@\tabulatecolumns}{#1}% {\setvalue{\@@tabalign@@\the\tabulatecolumns}{#1}% \settabulatepreamble} @@ -340,40 +372,40 @@ {\tabulatefont{#1}% \settabulatepreamble} -\def\gettabulatewidth% - {\chardef\tabulatemodus0 - \chardef\tabulatedimen0 +\def\gettabulatewidth + {\chardef\tabulatemodus\zerocount + \chardef\tabulatedimen\zerocount \doifnextcharelse(\dogettabulatewidth\settabulatepreamble} -\def\gettabulateparagraph% +\def\gettabulateparagraph {\doifnextcharelse{(} - {\chardef\tabulatemodus1 - \chardef\tabulatedimen1 + {\chardef\tabulatemodus\plusone + \chardef\tabulatedimen\plusone \dogettabulatewidth} - {\chardef\tabulatemodus2 - \chardef\tabulatedimen0 + {\chardef\tabulatemodus\plustwo + \chardef\tabulatedimen\zerocount \settabulatepreamble}} \def\dogettabulatewidth(#1)% {\tabulatewidth#1\relax - \ifnum\tabulatedimen=1 + \ifnum\tabulatedimen=\plusone \global\advance\tabulatepwidth\tabulatewidth \fi \settabulatepreamble} -\def\settabulatepreamble% +\def\settabulatepreamble {\afterassignment\dosettabulatepreamble\let\next=} -\def\tabulateraggedright {\ifnum\tabulatetype=1 \else\raggedright \fi} -\def\tabulateraggedcenter{\ifnum\tabulatetype=1 \else\raggedcenter\fi} -\def\tabulateraggedleft {\ifnum\tabulatetype=1 \else\raggedleft \fi} -\def\tabulatenotragged {\ifnum\tabulatetype=1 \else\notragged \fi} -\def\tabulatehss {\ifnum\tabulatetype=1 \else\hss \fi} +\def\tabulateraggedright {\ifnum\tabulatetype=\plusone \else\raggedright \fi} +\def\tabulateraggedcenter{\ifnum\tabulatetype=\plusone \else\raggedcenter\fi} +\def\tabulateraggedleft {\ifnum\tabulatetype=\plusone \else\raggedleft \fi} +\def\tabulatenotragged {\ifnum\tabulatetype=\plusone \else\notragged \fi} +\def\tabulatehss {\ifnum\tabulatetype=\plusone \else\hss \fi} \def\nexttabulate#1|% {\chardef\tabulatealign\@@tabulatealign - \chardef\tabulatemodus0 - \chardef\tabulatedimen0 + \chardef\tabulatemodus\zerocount + \chardef\tabulatedimen\zerocount \tabulatebefore \emptytoks \tabulateafter \emptytoks \tabulatebmath \emptytoks @@ -396,8 +428,8 @@ \dodosettabulatepreamble{\bskip\tabulateraggedleft }\eskip \or \dodosettabulatepreamble{\bskip\tabulateraggedcenter}\eskip \fi \or % auto width - %\doglobal\increment\nofautotabulate\relax - \global\advance\nofautotabulate\plusone\relax + %\doglobal\increment\nofautotabulate + \global\advance\nofautotabulate\plusone \ifcase\tabulatealign\relax \dodosettabulatepreamble \bskip \eskip \or \dodosettabulatepreamble{\bskip\tabulateraggedright }\eskip \or @@ -406,47 +438,45 @@ \fi \futurelet\next\donexttabulate} -\def\donexttabulate% +\def\donexttabulate {\ifx\next\relax\else \expandafter\nexttabulate \fi} -\def\splitofftabulatebox% +\def\splitofftabulatebox {\dontcomplain -% \global\@EA\setbox\@EA\tabulatebox\@EA -% \vsplit\csname\@@tabbox@@\tabulatecolumn\endcsname to \lineheight \global\setbox\tabulatebox - \vsplit\csname\@@tabbox@@\tabulatecolumn\endcsname to \lineheight - \setbox\tabulatebox=\vbox + \vsplit\tablebox\tabulatecolumn to \lineheight + \setbox\tabulatebox\vbox {\unvbox\tabulatebox}% - \setbox\tabulatebox=\hbox to \wd\tabulatebox + \setbox\tabulatebox\hbox to \wd\tabulatebox {\hss\dotabulatehook{\box\tabulatebox}\hss}% \ht\tabulatebox\ht\strutbox \dp\tabulatebox\dp\strutbox \box\tabulatebox} -\def\dotabulatehook% +\def\dotabulatehook {\getvalue{\@@tabhook@@\tabulatecolumn}} -\def\dotabulatealign% +\def\dotabulatealign {\getvalue{\@@tabalign@@\tabulatecolumn}} -\def\resettabulatepheight% - {\xdef\tabulateminplines{1}% +\def\resettabulatepheight + {\globallet\tabulateminplines\!!plusone \getnoflines\tabulatemaxpheight \xdef\tabulatemaxplines{\the\noflines}% \global\tabulatemaxpheight\zeropoint} -\def\settabulatepheight% - {\scratchdimen\ht\csname\@@tabbox@@\tabulatecolumn\endcsname\relax +\def\settabulatepheight + {\scratchdimen\ht\tablebox\tabulatecolumn\relax \ifdim\scratchdimen>\tabulatemaxpheight \global\tabulatemaxpheight\scratchdimen \fi} -\def\handletabulatepbreak% +\def\handletabulatepbreak {\TABLEnoalign - {\ifhandletabulatepbreak \ifnum\tabulatemaxplines>1 - \ifnum\tabulateminplines=1 + {\ifhandletabulatepbreak \ifnum\tabulatemaxplines>\plusone + \ifnum\tabulateminplines=\plusone \dotabulatenobreak \fi \doglobal\increment\tabulateminplines @@ -486,7 +516,7 @@ % \starttabulate[preamble] % \starttabulate -> \starttabulate[|l|p|] -\def\definetabulate% +\def\definetabulate {\dotripleempty\dodefinetabulate} \def\dodefinetabulate[#1][#2][#3]% @@ -494,11 +524,13 @@ \doifundefined{\??tt#1::\c!eenheid} {\copyparameters [\??tt#1::][\??tt\e!tabulate::]% - [\c!afstand,\c!eenheid,\c!voor,\c!korps,\c!na,\c!binnen,\c!inspringen, - \c!marge,\c!uitlijnen,\c!lijnkleur,\c!lijndikte,EQ]}% + [\c!kader,\c!afstand,\c!eenheid,\c!voor,\c!korps,\c!na, + \c!binnen,\c!inspringen,\c!marge,\c!uitlijnen, + \c!lijnkleur,\c!lijndikte,EQ]}% \copyparameters [\??tt#1::#2][\??tt#1::]% - [\c!eenheid,\c!afstand,\c!voor,\c!korps,\c!na,\c!binnen,\c!inspringen, + [\c!eenheid,\c!afstand,\c!voor,\c!korps,\c!na, + \c!binnen,\c!inspringen,\c!kader, \c!marge,\c!uitlijnen,\c!lijnkleur,\c!lijndikte,EQ]% \setvalue{\e!start#1::#2}{\dofinalstarttabulate[#1][#2][#3]}% \setvalue{\e!start#1}{\bgroup\dosubstarttabulate[#1]}% @@ -513,24 +545,6 @@ \let\tabulateheadcontent\empty \let\tabulatetailcontent\empty -% \def\checkfulltabulatecontent -% {\doifdefinedelse{\??tt\currenttabulate\v!hoofd} -% {\@EA\let\@EA\tabulateheadcontent\csname\??tt\currenttabulate\v!hoofd\endcsname} -% {\let\tabulateheadcontent\empty}% -% \doifdefinedelse{\??tt\currenttabulate\v!voet} -% {\@EA\let\@EA\tabulatetailcontent\csname\??tt\currenttabulate\v!voet\endcsname} -% {\let\tabulatetailcontent\empty}} - -% \def\checkfulltabulatecontent -% {\doifdefinedelse{\??tt\currenttabulate\v!hoofd} -% {\@EA\let\@EA\tabulateheadcontent -% \csname\??tt\currenttabulate\v!hoofd\endcsname} -% {\let\tabulateheadcontent\empty}% -% \doifdefinedelse{\??tt\currenttabulate\v!voet} -% {\@EA\let\@EA\tabulatetailcontent -% \csname\??tt\currenttabulate\v!voet\endcsname} -% {\let\tabulatetailcontent\empty}} - \def\checkfulltabulatecontent {\ifundefined{\??tt\currenttabulate\v!hoofd}% \let\tabulateheadcontent\empty @@ -556,7 +570,7 @@ \tabulateheadcontent \TABLEnoalign{\global\setfalse\tabulatesomeamble}% \fi - \tabulatecontent + \ignorespaces\tabulatecontent \ifx\tabulatetailcontent\empty\else \TABLEnoalign{\global\settrue\tabulatesomeamble}% \tabulatetailcontent @@ -576,7 +590,7 @@ {\processcontent{\e!stop\e!tabulatetail}\next {\letvalue{\??tt\iffirstargument#1\else\e!tabulate\fi::\v!voet}\next}} -\def\dosubstarttabulate% +\def\dosubstarttabulate {\dodoubleempty\dodosubstarttabulate} \def\dodosubstarttabulate[#1][#2]% @@ -612,22 +626,22 @@ {\expanded{\switchtobodyfont [\getvalue{\??tt\currenttabulate\c!korps}]}}% \postponefootnotes % new, to be tested - \chardef\tabulatepass=1 - \widowpenalty=0 % otherwise lines are not broken - \clubpenalty =0 % but overlap in funny ways + \chardef\tabulatepass\plusone + \widowpenalty\zerocount % otherwise lines are not broken + \clubpenalty \zerocount % but overlap in funny ways \the\everytabulate \getvalue{\??tt\currenttabulate\c!binnen}% - \scratchdimen=\leftskip - \advance\scratchdimen by \hangindent - \doifvalue{\??tt\currenttabulate\c!inspringen}{\v!ja} - {\advance\scratchdimen by \parindent}% \voorwit + \scratchdimen\leftskip + \advance\scratchdimen \hangindent + \doifvalue{\??tt\currenttabulate\c!inspringen}\v!ja + {\advance\scratchdimen \parindent}% \voorwit \edef\tabulateindent{\the\scratchdimen}% \!!toksb\emptytoks \def\dorepeat*##1##2% {\dorecurse{##1}{\appendtoks##2\to\!!toksb}\do}% - \def\do% + \def\do {\futurelet\next\dodo}% - \def\dodo% + \def\dodo % \@EAEAEA gebruiken {\ifx\next\relax % exit \else\ifx*\next @@ -642,7 +656,7 @@ {\appendtoks{##1}\to\!!toksb\do}% \def\dodododo##1% {\appendtoks##1\to\!!toksb\do}% - \xdef\tabulatecolumn{0}% + \globallet\tabulatecolumn\!!zerocount \do#3\relax \processcontent {\e!stop#1}% \currenttabulate} @@ -657,7 +671,7 @@ \newif\iftabulatefirstflushed -\def\tabulateEQ% +\def\tabulateEQ {\iftabulatefirstflushed\else\getvalue{\??tt\currenttabulate EQ}\fi \global\tabulateequalfalse} @@ -667,8 +681,8 @@ \def\tabulateequalcolumn#1% {&\tabulateEQ&\global\chardef\tabulatetype#1&} -\def\tabulateautocolumn% - {\tabulatenormalcolumn0\relax +\def\tabulateautocolumn + {\tabulatenormalcolumn\zerocount \ifnum\tabulatecolumn>\tabulatecolumns\relax \expandafter\NR \else @@ -684,30 +698,54 @@ \def\tabulateruleseperator% {\bgroup - \def\factor{1}% + \let\factor\!!plusone \scratchskip\dp\strutbox \ExpandFirstAfter\processallactionsinset [\getvalue{\??tt\currenttabulate\c!afstand}] - [ \v!blanko=>\scratchskip=\bigskipamount, - \v!diepte=>\scratchskip=\dp\strutbox, + [ \v!blanko=>\scratchskip\bigskipamount, + \v!diepte=>\scratchskip\dp\strutbox, \v!klein=>\def\factor{.25}, \v!middel=>\def\factor{.5}, \v!groot=>, - \v!geen=>\scratchskip=\zeropoint\def\factor{0}, - \v!grid=>\scratchskip=\zeropoint\def\factor{0}, - \s!unknown=>\scratchskip=\commalistelement]% - \scratchdimen=\factor\scratchskip + \v!geen=>\scratchskip\zeropoint\def\factor{0}, + \v!grid=>\scratchskip\zeropoint\def\factor{0}, + \s!unknown=>\scratchskip\commalistelement]% + \scratchdimen\factor\scratchskip \ifconditional\tabulatesomeamble\kern\else\vskip\fi\scratchdimen % new \egroup} -\def\tabulaterule% +% \def\tabulaterule +% {\color +% [\getvalue{\??tt\currenttabulate\c!lijnkleur}] +% {\scratchdimen\getvalue{\??tt\currenttabulate\c!lijndikte}% +% \hrule\!!height.5\scratchdimen\!!depth.5\scratchdimen\relax +% \doifvalue{\??tt\currenttabulate\c!afstand}\v!grid +% {\kern-\scratchdimen}}} % experimental tm-prikkels + +\def\dotabulaterule#1% {\color [\getvalue{\??tt\currenttabulate\c!lijnkleur}] - {\scratchdimen=\getvalue{\??tt\currenttabulate\c!lijndikte}% - \hrule\!!height.5\scratchdimen\!!depth.5\scratchdimen\relax - \doifvalue{\??tt\currenttabulate\c!afstand}{\v!grid} + {\scratchdimen\getvalue{\??tt\currenttabulate\c!lijndikte}#1}} + +\def\tabulaterule + {\dotabulaterule + {\hrule\!!height.5\scratchdimen\!!depth.5\scratchdimen\relax + \doifvalue{\??tt\currenttabulate\c!afstand}\v!grid {\kern-\scratchdimen}}} % experimental tm-prikkels +\def\tabulateline + {\multispan\totaltabulatecolumns % \multispan is a plain macro + % for the moment this one + \strut\hskip\getvalue{\??tt\currenttabulate\c!marge}% + % neg values are ok ! + \dotabulaterule + {\!!heighta.5\lineheight + \advance\!!heighta-\strutdepth + \!!deptha-\!!heighta + \advance\!!deptha\scratchdimen + \leaders\hrule\!!height\!!heighta\!!depth\!!deptha\hfill}% + \cr} + %D When set to true, no (less) break optimization is done. \newif\iftolerantTABLEbreak @@ -718,7 +756,8 @@ \def\doregistertabulateparoptions {\ifinsidefloat \else \iftrialtypesetting \else \registerparoptions - \global\let\registertabulateparoptions\empty +% unsafe in crossing pages, at each b... +% \global\let\registertabulateparoptions\empty \fi \fi} \appendtoks @@ -731,239 +770,33 @@ \registertabulateparoptions \to \everytabulaterow -% keep for a while ! ! ! -% -% \def\processtabulate[|#1|]% in the process of optimizing -% {\tabulateunit=\getvalue{\??tt\currenttabulate\c!eenheid}% -% \checkfulltabulatecontent -% \ExpandFirstAfter\processaction % use \setalignmentswitch instead -% [\getvalue{\??tt\currenttabulate\c!uitlijnen}] -% [\v!normaal=>\def\@@tabulatealign{0}, % = default value -% \v!rechts=>\def\@@tabulatealign{1}, -% \v!links=>\def\@@tabulatealign{2}, -% \v!midden=>\def\@@tabulatealign{3}, -% \s!default=>\def\@@tabulatealign{0}, -% \s!unknown=>\def\@@tabulatealign{0}]% -% \let\pretabskip\!!zeropoint -% \def\postabskip{.5\tabulateunit}% -% %\doglobal\newcounter\tabulatecolumns -% %\doglobal\newcounter\nofautotabulate -% \global\tabulatecolumns\zerocount -% \global\nofautotabulate\zerocount -% \doglobal\newcounter\noftabulatelines -% \let\totalnoftabulatelines\noftabulatelines -% \let\minusnoftabulatelines\noftabulatelines -% \global\tabulatepwidth\zeropoint -% \global\tabulateequalfalse -% \resettabulatepheight -% \def\NC{\tabulatenormalcolumn0}% -% \def\RC{\tabulatenormalcolumn1}% -% \def\HC{\tabulatenormalcolumn2}% -% \def\EQ{\tabulateequalcolumn 0}% -% \def\RQ{\tabulateequalcolumn 1}% -% \def\HQ{\tabulateequalcolumn 2}% -% \def\NG{\NC\handletabulatecharalign}% -% \def\NR% next row -% {\doglobal\increment\noftabulatelines -% \global\tabulatefirstflushedfalse -% \global\tabulateequalfalse -% \xdef\tabulatecolumn{0}% -% \resettabulatepheight -% \unskip\unskip\crcr\flushtabulated -% \TABLEnoalign -% {\iftolerantTABLEbreak\else -% \ifnum\noftabulatelines=1 -% \dotabulatenobreak -% \else\ifnum\noftabulatelines=\minusnoftabulatelines -% \ifnum\tabulatemaxplines<2 -% \dotabulatenobreak -% \fi -% \fi\fi -% \fi -% \global\tabulatefirstflushedfalse}}% -% \let\HL\empty \let\SR\NR \let\AR\NR -% \let\FL\empty \let\FR\NR -% \let\ML\empty \let\MR\NR -% \let\LL\empty \let\LR\NR -% \global\let\flushtabulated\empty -% \let\savedbar=|\let|=\nexttabulate -% \tabskip\zeropoint -% \ifdim\getvalue{\??tt\currenttabulate\c!marge}>\zeropoint -% \!!toksa{&\hbox to \tabulateindent{\the\everytabulaterow\hss}##% -% \tabskip\getvalue{\??tt\currenttabulate\c!marge}\strut -% &##\tabskip\zeropoint}% -% \else -% \!!toksa{&\hbox to \tabulateindent{\the\everytabulaterow\hss}##\strut&##}% -% \fi -% \tabulatewidth\zeropoint -% |#1X|\relax -% \tabulatewidth\zeropoint -% \dorecurse\tabulatecolumns % can be made faster -% {\doifundefinedelse{\@@tabbox@@\recurselevel} -% {\expandafter\newbox\csname\@@tabbox@@\recurselevel\endcsname}% -% {\global\setbox\csname\@@tabbox@@\recurselevel\endcsname\box\voidb@x}}% -% \appendtoks&##\to\!!toksa -% \appendtoks\doglobal\increment\tabulatecolumn\to\!!toksa -% \appendtoks\NC\unskip\unskip\crcr\flushtabulated\to\tabulatedummy % no count -% \xdef\tabulatecolumn{0}% -% \resettabulatepheight -% \def\bskip% -% {\setbox\tabulatebox=\vbox\bgroup -% \global\let\tabulatehook\notabulatehook}% -% \def\eskip -% {\par\egroup -% \global\let\tabulatehook\dotabulatehook}% -% \let|\savedbar -% \global\let\tabulatehook\dotabulatehook -% \doifvalue{\??tt\currenttabulate\c!inspringen}{\v!nee} -% {\forgetparindent}% -% \ifinsidefloat -% \let\tabulateindent\!!zeropoint -% \else -% \setlocalhsize \hsize\localhsize -% \fi -% \dontcomplain -% \forgetall -% \setbox0=\vbox % outside if because of line counting -% {\footnotesenabledfalse -% \let\tabulateindent\!!zeropoint -% \trialtypesettingtrue % very important -% \@EA\halign\@EA{\the\!!toksa\cr\fulltabulatecontent\crcr}}% -% \ifnum\nofautotabulate>0 -% \tabulatewidth\hsize -% \advance\tabulatewidth -\wd0 -% \advance\tabulatewidth -\tabulatepwidth -% \ifnum\nofautotabulate>0 -% \divide\tabulatewidth \nofautotabulate\relax -% \fi -% \fi -% \ifsplittabulate -% \splittopskip\ht\strutbox -% \global\let\flushtabulatedindeed\empty -% \long\def\bbskip% -% {\ifvoid\csname\@@tabbox@@\tabulatecolumn\endcsname -% \ifx\flushtabulatedindeed\empty\else -% \setbox0\hbox -% \fi -% \fi}% -% \def\bskip% -% {\ifvoid\csname\@@tabbox@@\tabulatecolumn\endcsname -% \global\setbox\csname\@@tabbox@@\tabulatecolumn\endcsname=\vbox -% \bgroup -% \global\let\tabulatehook\notabulatehook -% \ifautotabulate\hsize\tabulatewidth\fi -% %\begstrut % interferes with pre-\pars -% \ignorespaces -% \def\eskip% -% {\par\egroup -% \settabulatepheight -% \global\let\tabulatehook\dotabulatehook -% \splitofftabulatebox}% -% \else -% \let\eskip\empty -% \dontcomplain -% \global\let\tabulatehook\dotabulatehook -% \expandafter\splitofftabulatebox -% \fi}% -% \gdef\flushtabulated% -% {\TABLEnoalign % noalign % no interference ! -% {\global\let\flushtabulatedindeed\empty -% \handletabulatepbreak -% \dorecurse\tabulatecolumns % was: \noftabcolumns -% {\ifvoid\csname\@@tabbox@@\recurselevel\endcsname\else -% \gdef\flushtabulatedindeed{\the\tabulatedummy}% -% \fi}% -% \global\tabulatefirstflushedtrue}% -% \flushtabulatedindeed}% -% \else -% % tabhook op alles ? -% \def\bskip% -% {\vtop\bgroup -% \ifautotabulate\hsize\tabulatewidth\fi -% %\begstrut % interferes with pre-\pars -% \ignorespaces}% -% \def\eskip% -% {\par\egroup}% -% \fi -% \let\totalnoftabulatelines\noftabulatelines -% \let\minusnoftabulatelines\noftabulatelines -% \decrement\minusnoftabulatelines -% \doglobal\newcounter\noftabulatelines -% \def\HL{\TABLEnoalign -% {\ifnum\noftabulatelines=0 \FL -% \else\ifnum\noftabulatelines<\totalnoftabulatelines\relax \ML -% \else \LL -% \fi\fi}}% -% \def\tablebaselinecorrection -% {\def\dobaselinecorrection -% {\vskip-\prevdepth -% \vskip\dp\strutbox -% \vskip\dp\strutbox}% -% \baselinecorrection}% -% \def\FL{\TABLEnoalign -% {\ifinsidefloat\else -% \doifemptyvalue{\??tt\currenttabulate\c!voor} % no expansion -% {\tablebaselinecorrection}% -% \fi -% \tabulaterule -% \dotabulatenobreak -% \tabulateruleseperator -% \prevdepth\dp\strutbox -% \dotabulatenobreak}}% -% \def\ML{\TABLEnoalign -% {\tabulateruleseperator -% \tabulaterule -% \ifnum\noftabulatelines>1 \ifnum\noftabulatelines<\minusnoftabulatelines -% \vskip\topskip\allowbreak\vskip-\topskip -% \vskip-\getvalue{\??tt\currenttabulate\c!lijndikte}% -% \tabulaterule -% \fi\fi -% \tabulateruleseperator}}% -% \def\LL{\TABLEnoalign -% {\dotabulatenobreak -% \tabulateruleseperator -% \dotabulatenobreak -% \tabulaterule -% \ifinsidefloat\else -% \doifemptyvalue{\??tt\currenttabulate\c!na} % no expansion -% {\vskip\dp\strutbox -% \vbox{\strut}% -% \vskip-\lineheight}% -% \fi}}% -% \chardef\tabulatepass=2 -% \@EA\halign\@EA{\the\!!toksa\cr\fulltabulatecontent\crcr}% -% \prevdepth\dp\strutbox % nog eens beter, temporary hack -% \doifvalue{\??tt\currenttabulate\c!afstand}{\v!grid} -% {\vskip-\dp\strutbox}% experimental tm-prikkels -% \egroup -% \ifinsidefloat \else -% \getvalue{\??tt\currenttabulate\c!na}% -% \fi -% \egroup} - \def\flushtabulateindent - {\ifnum\tabulatecolumn=0 + {\ifnum\tabulatecolumn=\zerocount \hbox to \tabulateindent {% we now have a local hsize, and since we want to % register positional info (i.e. real hsizes) we % need to reconstitute the original hsize \advance\hsize\tabulateindent - % this is indeed rtaher messy and took a few hours + % this is indeed rather messy and took a few hours % to dis/uncover \the\everytabulaterow \hss}% \fi} +\def\totaltabulatecolumns{0} + +\def\handletabulatedigits{\digits} + \def\processtabulate[|#1|]% in the process of optimizing - {\tabulateunit=\getvalue{\??tt\currenttabulate\c!eenheid}% + {\tabulateunit\getvalue{\??tt\currenttabulate\c!eenheid}% \checkfulltabulatecontent \ExpandFirstAfter\processaction % use \setalignmentswitch instead [\getvalue{\??tt\currenttabulate\c!uitlijnen}] - [\v!normaal=>\def\@@tabulatealign{0}, % = default value - \v!rechts=>\def\@@tabulatealign{1}, - \v!links=>\def\@@tabulatealign{2}, - \v!midden=>\def\@@tabulatealign{3}, - \s!default=>\def\@@tabulatealign{0}, + [\v!normaal=>\def\@@tabulatealign{0},% = default value + \v!rechts=>\def\@@tabulatealign{1},% chardefs gebruiken + \v!links=>\def\@@tabulatealign{2},% + \v!midden=>\def\@@tabulatealign{3},% + \s!default=>\def\@@tabulatealign{0},% \s!unknown=>\def\@@tabulatealign{0}]% \let\pretabskip\!!zeropoint \def\postabskip{.5\tabulateunit}% @@ -984,16 +817,31 @@ \def\RQ{\tabulateequalcolumn 1}% \def\HQ{\tabulateequalcolumn 2}% \def\NG{\NC\handletabulatecharalign}% - \def\NR% next row + \def\ND{\NC\handletabulatedigits}% new, undocumented, test first + \def\HR % horizontal rule line (break untested) + {\TABLEnoalign + {\ifnum\noftabulatelines=\totalnoftabulatelines + \@EA\dotabulatenobreak + \else + \@EA\allowbreak + \fi}% + \tabulateline + \TABLEnoalign + {\ifnum\noftabulatelines=\zerocount + \@EA\dotabulatenobreak + \else + \@EA\allowbreak + \fi}}% + \def\NR % next row {\doglobal\increment\noftabulatelines \global\tabulatefirstflushedfalse \global\tabulateequalfalse - \xdef\tabulatecolumn{0}% + \globallet\tabulatecolumn\!!zerocount \resettabulatepheight \unskip\unskip\crcr\flushtabulated \TABLEnoalign {\iftolerantTABLEbreak\else - \ifnum\noftabulatelines=1 + \ifnum\noftabulatelines=\plusone \dotabulatenobreak \else\ifnum\noftabulatelines=\minusnoftabulatelines \ifnum\tabulatemaxplines<2 @@ -1003,42 +851,46 @@ \fi \global\tabulatefirstflushedfalse}}% \let\HL\empty \let\SR\NR \let\AR\NR - \let\FL\empty \let\FR\NR + \let\FL\empty \let\FR\NR \let\ML\empty \let\MR\NR \let\LL\empty \let\LR\NR \global\let\flushtabulated\empty - \let\savedbar=|\let|=\nexttabulate + \let\savedbar|\let|\nexttabulate \tabskip\zeropoint -\ifdim\getvalue{\??tt\currenttabulate\c!marge}>\zeropoint - \!!toksa{&\flushtabulateindent\strut##% - \tabskip\getvalue{\??tt\currenttabulate\c!marge}\strut - &##\tabskip\zeropoint}% -\else - \!!toksa{&\flushtabulateindent\strut##% - &##\tabskip\zeropoint}% -\fi + \ifdim\getvalue{\??tt\currenttabulate\c!marge}>\zeropoint + \!!toksa{&\flushtabulateindent\strut##% + \tabskip\getvalue{\??tt\currenttabulate\c!marge}\strut + &##\tabskip\zeropoint}% + \else + \!!toksa{&\flushtabulateindent\strut##% + &##\tabskip\zeropoint}% + \fi \tabulatewidth\zeropoint |#1X|\relax + \scratchcounter\tabulatecolumns + \multiply\scratchcounter3% + \advance\scratchcounter4% + \edef\totaltabulatecolumns{\the\scratchcounter}% \tabulatewidth\zeropoint - \dorecurse\tabulatecolumns % can be made faster - {\doifundefinedelse{\@@tabbox@@\recurselevel} - {\expandafter\newbox\csname\@@tabbox@@\recurselevel\endcsname}% - {\global\setbox\csname\@@tabbox@@\recurselevel\endcsname\box\voidb@x}}% + % \dorecurse\tabulatecolumns % can be made faster + % {\doifundefinedelse{\@@tabbox@@\recurselevel} + % {\expandafter\newbox\csname\@@tabbox@@\recurselevel\endcsname}% + % {\global\setbox\csname\@@tabbox@@\recurselevel\endcsname\box\voidb@x}}% + \initializetableboxes\tabulatecolumns \appendtoks&##\to\!!toksa \appendtoks\doglobal\increment\tabulatecolumn\to\!!toksa \appendtoks\NC\unskip\unskip\crcr\flushtabulated\to\tabulatedummy % no count - \xdef\tabulatecolumn{0}% + \globallet\tabulatecolumn\!!zerocount \resettabulatepheight - \def\bskip% - {\setbox\tabulatebox=\vbox\bgroup + \def\bskip + {\setbox\tabulatebox\vbox\bgroup \global\let\tabulatehook\notabulatehook}% \def\eskip {\par\egroup \global\let\tabulatehook\dotabulatehook}% \let|\savedbar \global\let\tabulatehook\dotabulatehook - \doifvalue{\??tt\currenttabulate\c!inspringen}{\v!nee} - {\forgetparindent}% + \doifvalue{\??tt\currenttabulate\c!inspringen}\v!nee\forgetparindent \ifinsidefloat \let\tabulateindent\!!zeropoint \else @@ -1046,37 +898,39 @@ \fi \dontcomplain \forgetall - \setbox0=\vbox % outside if because of line counting + \setbox0\vbox % outside if because of line counting {\footnotesenabledfalse \let\tabulateindent\!!zeropoint \trialtypesettingtrue % very important \@EA\halign\@EA{\the\!!toksa\crcr\fulltabulatecontent\crcr}}% - \ifnum\nofautotabulate>0 + \ifnum\nofautotabulate>\zerocount + % so, even if the natural size is larger, in the final + % run, we force the calculated width \tabulatewidth\hsize \advance\tabulatewidth -\wd0 \advance\tabulatewidth -\tabulatepwidth - \ifnum\nofautotabulate>0 + \ifnum\nofautotabulate>\zerocount \divide\tabulatewidth \nofautotabulate\relax \fi \fi \ifsplittabulate \splittopskip\ht\strutbox \global\let\flushtabulatedindeed\empty - \long\def\bbskip% - {\ifvoid\csname\@@tabbox@@\tabulatecolumn\endcsname + \long\def\bbskip + {\ifvoid\tablebox\tabulatecolumn \ifx\flushtabulatedindeed\empty\else \setbox0\hbox \fi \fi}% - \def\bskip% - {\ifvoid\csname\@@tabbox@@\tabulatecolumn\endcsname - \global\setbox\csname\@@tabbox@@\tabulatecolumn\endcsname=\vbox + \def\bskip + {\ifvoid\tablebox\tabulatecolumn + \global\setbox\tablebox\tabulatecolumn\vbox \bgroup \global\let\tabulatehook\notabulatehook \ifautotabulate\hsize\tabulatewidth\fi - %\begstrut % interferes with pre-\pars + % \begstrut % interferes with pre-\pars \ignorespaces - \def\eskip% + \def\eskip {\par\egroup \settabulatepheight \global\let\tabulatehook\dotabulatehook @@ -1087,25 +941,25 @@ \global\let\tabulatehook\dotabulatehook \expandafter\splitofftabulatebox \fi}% - \gdef\flushtabulated% + \gdef\flushtabulated {\TABLEnoalign % noalign % no interference ! {\global\let\flushtabulatedindeed\empty -\xdef\tabulatecolumn{0}% + \globallet\tabulatecolumn\!!zerocount \handletabulatepbreak \dorecurse\tabulatecolumns % was: \noftabcolumns - {\ifvoid\csname\@@tabbox@@\recurselevel\endcsname\else + {\ifvoid\tablebox\recurselevel\else \gdef\flushtabulatedindeed{\the\tabulatedummy}% \fi}% \global\tabulatefirstflushedtrue}% \flushtabulatedindeed}% \else % tabhook op alles ? - \def\bskip% + \def\bskip {\vtop\bgroup \ifautotabulate\hsize\tabulatewidth\fi - %\begstrut % interferes with pre-\pars + % \begstrut % interferes with pre-\pars \ignorespaces}% - \def\eskip% + \def\eskip {\par\egroup}% \fi \let\totalnoftabulatelines\noftabulatelines @@ -1113,10 +967,11 @@ \decrement\minusnoftabulatelines \doglobal\newcounter\noftabulatelines \def\HL{\TABLEnoalign - {\ifnum\noftabulatelines=0 \FL - \else\ifnum\noftabulatelines<\totalnoftabulatelines\relax \ML - \else \LL - \fi\fi}}% + {\ifnum\noftabulatelines=\zerocount \@EA \FL\else + \ifnum\noftabulatelines<\totalnoftabulatelines\relax\@EAEAEA\ML\else + \@EAEAEA\LL\fi\fi}}% + \doifvalue{\??tt\currenttabulate\c!lijn}\v!regel + {\let\HL\HR}% \def\tablebaselinecorrection {\def\dobaselinecorrection {\vskip-\prevdepth @@ -1136,11 +991,13 @@ \def\ML{\TABLEnoalign {\tabulateruleseperator \tabulaterule - \ifnum\noftabulatelines>1 \ifnum\noftabulatelines<\minusnoftabulatelines - \vskip\topskip\allowbreak\vskip-\topskip - \vskip-\getvalue{\??tt\currenttabulate\c!lijndikte}% - \tabulaterule - \fi\fi + \ifnum\noftabulatelines>\plusone + \ifnum\noftabulatelines<\minusnoftabulatelines + \vskip\topskip\allowbreak\vskip-\topskip + \vskip-\getvalue{\??tt\currenttabulate\c!lijndikte}% + \tabulaterule + \fi + \fi \tabulateruleseperator}}% \def\LL{\TABLEnoalign {\dotabulatenobreak @@ -1153,18 +1010,63 @@ \vbox{\strut}% \vskip-\lineheight}% \fi}}% - \chardef\tabulatepass=2 + \startframedcontent[\getvalue{\??tt\currenttabulate\c!kader}]% + % + \chardef\tabulatepass2 \@EA\halign\@EA{\the\!!toksa\crcr\fulltabulatecontent\crcr}% \prevdepth\dp\strutbox % nog eens beter, temporary hack - \doifvalue{\??tt\currenttabulate\c!afstand}{\v!grid} + \doifvalue{\??tt\currenttabulate\c!afstand}\v!grid {\vskip-\dp\strutbox}% experimental tm-prikkels + % + \stopframedcontent + % \egroup \ifinsidefloat \else \getvalue{\??tt\currenttabulate\c!na}% \fi \egroup} - -\def\setuptabulate% + +% \starttabulatie[|mc|] +% \NC \digits{100.000,00} \NC\NR +% \NC \digits{@10.000,00} \NC\NR +% \NC \digits{@@@.100,00} \NC\NR +% \NC \digits{@@@.@10,@@} \NC\NR +% \NC \digits{@@@.@@1,@@} \NC\NR +% \stoptabulatie +% +% \starttabulatie[|mc|] +% \ND 100.000,00 \NC\NR +% \ND @10.000,00 \NC\NR +% \ND @@@.100,00 \NC\NR +% \ND @@@.@10,@@ \NC\NR +% \ND @@@.@@1,@@ \NC\NR +% \stoptabulatie +% +% \starttabulatie[|c|] +% \ND $100.000,00$ \NC\NR +% \ND $@10.000,00$ \NC\NR +% \ND $@@@.100,00$ \NC\NR +% \ND $@@@.@10,@@$ \NC\NR +% \ND $@@@.@@1,@@$ \NC\NR +% \stoptabulatie +% +% \starttabulatie[|c|] +% \NC $\digits 100.000,00 $ \NC\NR +% \NC $\digits @10.000,00 $ \NC\NR +% \NC $\digits @@@.100,00 $ \NC\NR +% \NC $\digits @@@.@10,@@ $ \NC\NR +% \NC $\digits @@@.@@1,@@ $ \NC\NR +% \stoptabulatie +% +% \starttabulatie[|c|] +% \NC \digits $100.000,00$ \NC\NR +% \NC \digits $@10.000,00$ \NC\NR +% \NC \digits $@@@.100,00$ \NC\NR +% \NC \digits $@@@.@10,@@$ \NC\NR +% \NC \digits $@@@.@@1,@@$ \NC\NR +% \stoptabulatie + +\def\setuptabulate {\dotripleempty\dosetuptabulate} \def\dosetuptabulate[#1][#2][#3]% @@ -1179,7 +1081,9 @@ \setuptabulate [\c!eenheid=1em, EQ={:}, +\c!kader=\v!uit, \c!korps=, + \c!lijn=\v!normaal, \c!lijnkleur=, \c!lijndikte=\linewidth, \c!binnen=, diff --git a/tex/context/base/core-uti.tex b/tex/context/base/core-uti.tex index 25e05b560..54830c523 100644 --- a/tex/context/base/core-uti.tex +++ b/tex/context/base/core-uti.tex @@ -45,23 +45,21 @@ \newwrite\uti \newif\ifutilitydone -\def\@@utilityerrormessage% - {\showmessage\m!systems{8}{}% - \global\let\@@utilityerrormessage\relax} +\def\@@utilityerrormessage + {\showmessage\m!systems8\empty + \globallet\@@utilityerrormessage\relax} \def\thisisutilityversion#1% {\doifelse\utilityversion{#1}% {\checksectionseparator} - {\@@utilityerrormessage - \resetutilities - \endinput}} + {\@@utilityerrormessage\resetutilities\endinput}} \def\checksectionseparator % catches backward compatibility conflict {\doifnot\sectionseparator:\endinput} \def\thisissectionseparator#1% {\bgroup - \global\let\checksectionseparator\relax + \globallet\checksectionseparator\relax \convertcommand \sectionseparator\to\asciiA \convertargument #1\to\asciiB \ifx\asciiA\asciiB @@ -73,17 +71,11 @@ \endinput \fi} -\def\writeutility% - {\write\uti} +\def\writeutility {\write\uti} +\def\writeutilitycommand#1{\write\uti{c \string#1}} -\def\immediatewriteutility% - {\immediate\write\uti} - -\def\writeutilitycommand#1% - {\write\uti{c \string#1}} - -\def\immediatewriteutilitycommand#1% - {\immediate\write\uti{c \string#1}} +\def\immediatewriteutility {\immediate\writeutility} +\def\immediatewriteutilitycommand{\immediate\writeutilitycommand} %\def\openutilities% % {\immediate\openout\uti=\jobname.\f!inputextension @@ -94,27 +86,29 @@ \immediatewriteutilitycommand{\thisissectionseparator{\sectionseparator}}% \immediatewriteutilitycommand{\thisisutilityversion {\utilityversion}}} -\def\closeutilities% +\def\closeutilities {%\savenofsubpages %\savenofpages - \immediate\closeout\uti + \immediate\closeout\uti % niet echt nodig \reportutilityproblems % should be a message : + \let\writeutilitycommand \gobbleoneargument + \let\writeutility \gobbleoneargument \let\immediatewriteutilitycommand\gobbleoneargument - \let\immediatewriteutility\gobbleoneargument} + \let\immediatewriteutility \gobbleoneargument} \def\reopenutilities {\immediate\closeout\uti \openutilities} -\def\abortutilitygeneration% - {\immediatewriteutilitycommand{\utilitygenerationaborted}% +\def\abortutilitygeneration + {\immediatewriteutilitycommand\utilitygenerationaborted \immediatewriteutility{q {quit}}} -\def\utilitygenerationaborted% - {\showmessage{\m!systems}{21}{}% - \global\let\utilitygenerationaborted=\endinput - \gdef\reportutilityproblems{\showmessage{\m!systems}{22}{}}% +\def\utilitygenerationaborted + {\showmessage\m!systems{21}\empty + \globallet\utilitygenerationaborted\endinput + \gdef\reportutilityproblems{\showmessage\m!systems{22}\empty}% \endinput} \def\savecurrentvalue#1#2% @@ -122,8 +116,8 @@ \let\initializevariable\gdef -\def\disableinitializevariables% - {\global\let\initializevariable\gobbletwoarguments} +\def\disableinitializevariables + {\globallet\initializevariable\gobbletwoarguments} \let\reportutilityproblems=\relax @@ -156,7 +150,7 @@ \def\addutilityreset#1% {\@EA\appendtoks\csname\s!reset#1\endcsname\to\utilityresetlist} -\def\resetutilities% +\def\resetutilities {\the\utilityresetlist} % #1=type @@ -178,7 +172,7 @@ % % \def\utilitycheckmessage% % {\showmessage{\m!systems}{12}{}% -% \global\let\utilitycheckmessage=\relax} +% \globallet\utilitycheckmessage=\relax} % % \def\saveutilityline#1 #2\txen% tricky maar ok, want achter \command % {\if #1c% commands % in \ascii staat een spatie; #1 kan @@ -241,7 +235,7 @@ \fi #4% \the\everybeforeutilityread - \readjobfile{#2.\f!outputextension}{}{}% + \readjobfile{#2.\f!outputextension}\donothing\donothing \the\everyafterutilityread #5% \relax @@ -251,7 +245,7 @@ \popendofline \ifutilitydone\else \doifsomething{#3} - {\showmessage{\m!systems}{9}{{#3}}% + {\showmessage\m!systems9{{#3}}% \ifvoorlopig \blanko \type{[\currentmessagetext]}% @@ -264,15 +258,14 @@ % Saving the sort vector: \def\savesortkeys% - {\setbox\scratchbox=\hbox - \bgroup - \def\flushsortkey##1##2##3##4% - {\convertargument{##1}{##2}{##3}{##4}\to\ascii - \immediatewriteutility{k {\currentlanguage}{\currentencoding}\ascii}}% - \let\definesortkey\flushsortkey - \flushsortkeys - \egroup - \global\let\savesortkeys\relax} + {\startnointerference + \def\flushsortkey##1##2##3##4% + {\convertargument{##1}{##2}{##3}{##4}\to\ascii + \immediatewriteutility{k {\currentlanguage}{\currentencoding}\ascii}}% + \let\definesortkey\flushsortkey + \flushsortkeys + \globallet\savesortkeys\relax + \stopnointerference} \prependtoks \savesortkeys \to \everystarttext @@ -319,31 +312,20 @@ {\@EA\ifx\csname#1:\s!list\endcsname\empty \else \csname#1:\s!list\endcsname,\fi#3}} -%\def\dodefinetwopasslist#1% -% {\doifundefined{#1:\s!list} -% {%\debuggerinfo{\m!systems}{defining twopass class #1}% -% \doglobal\addutilityreset{#1\s!pass}% -% \setgvalue{\s!set#1\s!pass}% -% {\global\letvalue{\s!set#1\s!pass}\gobbletwoarguments -% \setgvalue{@@#1\s!pass}{\appendtwopasselement{#1}}}% -% \setgvalue{\s!reset#1\s!pass}% -% {\global\letvalue{@@#1\s!pass}\gobbletwoarguments}% -% \getvalue{\s!reset#1\s!pass}}} - \def\dodefinetwopasslist#1% {\doifundefined{#1:\s!list} - {%\debuggerinfo{\m!systems}{defining twopass class #1}% + {%\debuggerinfo\m!systems{defining twopass class #1}% \doglobal\addutilityreset{#1\s!pass}% \setgvalue{\s!set #1\s!pass}{\dosettwopasslist {#1}}% \setgvalue{\s!reset#1\s!pass}{\doresettwopasslist{#1}}% \getvalue {\s!reset#1\s!pass}}} \def\dosettwopasslist#1% - {\global\letvalue{\s!set#1\s!pass}\gobbletwoarguments + {\letgvalue{\s!set#1\s!pass}\gobbletwoarguments \setgvalue{@@#1\s!pass}{\appendtwopasselement{#1}}} \def\doresettwopasslist#1% - {\global\letvalue{@@#1\s!pass}\gobbletwoarguments} + {\letgvalue{@@#1\s!pass}\gobbletwoarguments} \def\definetwopasslist#1% {\expanded{\dodefinetwopasslist{#1}}% @@ -356,9 +338,9 @@ \def\doloadtwopassdata#1% {\doifundefined{#1:\s!list} {\startnointerference - \global\letvalue{#1:\s!list}\empty + \letgvalueempty{#1:\s!list}% \protectlabels - \doutilities{#1\s!pass}{\jobname}{}{}{}% + \doutilities{#1\s!pass}\jobname\empty\relax\relax \ifx\twopassdata\empty\else \appendtwopasselement{#1}{0}\twopassdata \fi @@ -368,12 +350,12 @@ {\ifx\alltwopasslists\empty\else \def\twopassdata{0,0}% end condition \processcommacommand[\alltwopasslists]\doloadtwopassdata - \global\let\alltwopassdata\empty + \globallet\alltwopassdata\empty \fi \ifx\allrawpasslists\empty\else \let\twopassdata\empty \processcommacommand[\allrawpasslists]\doloadtwopassdata - \global\let\allrawpassdata\empty + \globallet\allrawpassdata\empty \fi} \def\moverawpasslist#1#2% erases the old one, like the others do @@ -503,13 +485,13 @@ {\edef\nexttwopassdata{#1}% \ifx\nexttwopassdata\notwopassdata \else \let\twopassdata\nexttwopassdata - \advance\scratchcounter 1 + \advance\scratchcounter \plusone \twopassdatafoundtrue \fi} \def\getlasttwopassdata#1% {\loadtwopassdata - \scratchcounter0 + \scratchcounter\zerocount \@EAEAEA\rawprocesscommalist\@EA\@EA\@EA[\csname#1:\s!list\endcsname]\dogetlasttwopassdata \edef\noftwopassitems{\the\scratchcounter}% \iftwopassdatafound\else @@ -557,7 +539,7 @@ {\writeutility{p u {#1} #2}} \def\loadplugindata#1% - {\doutilities{#1}{\jobname}{}{}{}{}} + {\doutilities{#1}\jobname\empty\relax\relax} % \plugincommand{\command{}{}{}} % diff --git a/tex/context/base/core-var.tex b/tex/context/base/core-var.tex index d8105611f..1be0ad723 100644 --- a/tex/context/base/core-var.tex +++ b/tex/context/base/core-var.tex @@ -42,6 +42,31 @@ \def\cleanupfeatures{\the\everycleanupfeatures} +\newevery \everyinsidefloat \relax + +%D \macros +%D {trialtypesetting} +%D +%D We disable trial typesetting in the output routine, +%D just to be sure. + +\prependtoks + \trialtypesettingfalse +\to \everybeforepagebody + +%D \macros +%D {starttextdata} + +\newtoks \collectedtextdata + +\long\def\starttextdata#1\stoptextdata + {\doglobal\appendtoks#1\to\collectedtextdata} + +\def\flushtextdata + {\vsmash{\the\collectedtextdata}% + \global\collectedtextdata\emptytoks + \globallet\flushtextdata\donothing} + %D \macros %D {ifprocessingXML} %D @@ -84,11 +109,11 @@ \newif\iffastmode -\def\fastmode% +\def\fastmode {\fastmodetrue \the\everyfastmode} -\def\silentmode% ook hier \everysilentmode net als \fastmode +\def\silentmode % ook hier \everysilentmode net als \fastmode {\showmessagesfalse \showwarningsfalse \let\writestatus\gobbletwoarguments} diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex index d82dc3bf2..ee3c057fd 100644 --- a/tex/context/base/core-ver.tex +++ b/tex/context/base/core-ver.tex @@ -76,11 +76,11 @@ \else\getvalue{\??ty\??ty\ascii}\fi}% \doifundefined{setuppretty\prettyidentifier type}% {\bgroup - \setbox0=\hbox % get rid of spaces when in-line \newpretty loading + \setbox0\hbox % get rid of spaces when in-line \newpretty loading {\restorecatcodes % also needed when loading during \newpretty \startreadingfile % restore < and > if needed \lowercasestring verb-\prettyidentifier.tex\to\filename - \readsysfile{\filename}{}{}% + \readsysfile\filename\donothing\donothing \stopreadingfile}% \egroup}% \doifdefinedelse{setuppretty\prettyidentifier type}% @@ -128,20 +128,23 @@ \installnewpretty I {\setupprettiesintype{EIF}\setupprettytype} % E taken \installnewpretty X {\setupprettiesintype{XML}\setupprettytype} -\def\setupcommonverbatim#1% + \def\setupcommonverbatim#1% {\eightbitcharactersfalse % obey regime / encoding % \def\prettyidentifier{TEX}% % - \doifelsevalue{#1\c!tekst}{\v!ja} - {\naturaltextexttrue}{\naturaltextextfalse}% + \doifelsevalue{#1\c!tekst}\v!ja + \naturaltextexttrue + \naturaltextextfalse \def\prettyidentifierfont{\getvalue{#1\c!icommando}}% \def\prettyvariablefont {\getvalue{#1\c!vcommando}}% \def\prettynaturalfont {\getvalue{#1\c!ccommando}}% % - \doifvalue{#1\c!spatie}{\v!aan}{\def\obeyspaces{\setcontrolspaces}}% - \doifvalue{#1\c!tab} {\v!aan}{\def\obeytabs {\settabskips}}% - \doifvalue{#1\c!pagina}{\v!nee}{\def\obeypages {\ignorepages}}% + \doifvalue{#1\c!spatie}\v!aan{\def\obeyspaces{\setcontrolspaces}}% + %doifvalue{#1\c!tab} \v!aan{\def\obeytabs {\settabskips}}% + \doifnotvalue{#1\c!tab}\v!uit{\def\obeytabs {\settabskips}}% + \doifvalue{#1\c!tab} \s!ascii{\chardef\tabskipmode2}% quit on >127 + \doifvalue{#1\c!pagina}\v!nee{\def\obeypages {\ignorepages}}% % \ExpandFirstAfter\processaction [\getvalue{#1\c!regels}] @@ -150,18 +153,18 @@ % \ExpandFirstAfter\processaction [\getvalue{#1\c!optie}] - [ \v!geen=>\let\obeycharacters=\relax, + [ \v!geen=>\let\obeycharacters\relax, \v!kleur=>\setupprettiesintype{TEX}% - \let\obeycharacters=\setupprettytype - \let\obeytabs=\ignoretabs, - \v!normaal=>\let\obeycharacters=\setupgroupedtype, + \let\obeycharacters\setupprettytype + \let\obeytabs\ignoretabs, + \v!normaal=>\let\obeycharacters\setupgroupedtype, \v!commandos=>\def\obeycharacters{\setupcommandsintype{#1}}% - \let\obeytabs=\ignoretabs, - \v!schuin=>\let\obeycharacters=\setupslantedtype - \let\obeytabs=\ignoretabs, + \let\obeytabs\ignoretabs, + \v!schuin=>\let\obeycharacters\setupslantedtype + \let\obeytabs\ignoretabs, \s!unknown=>\setupprettiesintype{\getvalue{#1\c!optie}}% - \let\obeycharacters=\setupprettytype - \let\obeytabs=\ignoretabs]% + \let\obeycharacters\setupprettytype + \let\obeytabs\ignoretabs]% \def\verbatimfont{\getvalue{#1\c!letter}}% \setupverbatimcolor{#1}} @@ -292,7 +295,7 @@ \verbatimcolor \afterassignment\protectfirsttype\let\next=} -\def\dodotypeB% +\def\dodotypeB {\initializetype \setupnotypegrouping \verbatimcolor @@ -314,7 +317,7 @@ {\ifx\next\bgroup \@EA\dodotypeA \else\if\next<% - \doifelsevalue{\??ty\@@currenttype\c!optie}{\v!geen} + \doifelsevalue{\??ty\@@currenttype\c!optie}\v!geen {\@EAEAEA\dodotypeB}{\@EAEAEA\dodotypeC}% \else \@EAEAEA\dodotypeD @@ -342,17 +345,14 @@ \bgroup \catcode`\<=\@@active \catcode`\>=\@@active -\gdef\setupalternativetypegrouping% +\gdef\setupalternativetypegrouping {\catcode`\<=\@@active \catcode`\>=\@@active - \def<% - {\bgroup - \switchslantedtype}% - \def>% - {\egroup}} + \def<{\bgroup\switchslantedtype}% + \def>{\egroup}} \egroup -\def\setupnotypegrouping% +\def\setupnotypegrouping {\catcode`\<=\@@begingroup \catcode`\>=\@@endgroup} @@ -396,16 +396,16 @@ %D {\hbox{}} prevents ligatures, which unfortunately turn up %D in Lucida fonts. -\def\doenterdoublelesstype% +\def\doenterdoublelesstype {\ifx\next\egroup \lesscharacter\hbox{}\lesscharacter \else \bgroup\switchslantedtype - \let\doenterdoublemoretype=\egroup + \let\doenterdoublemoretype\egroup \fi} -\def\doenterdoublemoretype% - {\def\doenterdoubletype% +\def\doenterdoublemoretype + {\def\doenterdoubletype {\ifx\next\egroup \morecharacter\hbox{}\morecharacter \fi}} @@ -413,13 +413,13 @@ \bgroup \catcode`\<=\@@active \catcode`\>=\@@active -\gdef\setupgroupedtype% +\gdef\setupgroupedtype {\catcode`\<=\@@active \catcode`\>=\@@active - \def\doless% + \def\doless {\ifx<\next - \def\next% - {\def\enterdoubletype% + \def\next + {\def\enterdoubletype {\futurelet\next\doenterdoublelesstype}% \afterassignment\enterdoubletype \let\next=}% @@ -427,15 +427,15 @@ \let\next=\lesscharacter \fi \next}% - \def\domore% + \def\domore {\ifx>\next - \def\next% - {\def\enterdoubletype% + \def\next + {\def\enterdoubletype {\futurelet\next\doenterdoublemoretype}% \afterassignment\enterdoubletype \let\next=}% \else - \let\next=\morecharacter + \let\next\morecharacter \fi \next}% \def<{\futurelet\next\doless}% @@ -445,7 +445,7 @@ \newif\ifslantedtypeactivated \newif\ifslantedtypepermitted -\def\switchslantedtype% +\def\switchslantedtype {\ifslantedtypepermitted \ifslantedtypeactivated \slantedtypeactivatedfalse\tttf @@ -485,24 +485,24 @@ %D %D \typebuffer -\def\setupslantedtype% +\def\setupslantedtype {\setupgroupedtype \slantedtypepermittedtrue} \bgroup \catcode`\<=\active \catcode`\>=\active -\gdef\doprotectfirsttype% +\gdef\doprotectfirsttype {\ifx\next<% - \let\next=\relax + \let\next\relax \else\ifx\next\bgroup - \let\next=\relax + \let\next\relax \else\ifx\next\egroup % takes care of \type{} - \let\next=\relax + \let\next\relax \else\ifx\next\activeleftargument - \let\next=\relax + \let\next\relax \else - \let\next=\string + \let\next\string \fi\fi\fi\fi \next} \egroup @@ -521,8 +521,8 @@ \let\@@currenttype\empty -\def\initializetype% - {\let\obeylines=\ignorelines +\def\initializetype + {\let\obeylines\ignorelines \setupcommonverbatim{\??ty\@@currenttype}% \setupinlineverbatim} @@ -534,7 +534,7 @@ %\def\setuptype% % {\dodoubleargument\getparameters[\??ty]} -\def\setuptype% +\def\setuptype {\dodoubleempty\dosetuptype} \def\dosetuptype[#1][#2]% @@ -564,7 +564,7 @@ %D implementation works all right, but a decent hyphenation %D support of \type{\tt} text will be implemented soon. -\def\obeyhyphens% +\def\obeyhyphens {\def\obeyedspace{\hskip\spaceskip}% \edef\savedfont{\the\font}% \ttsl\hyphenchar\font=45 @@ -572,17 +572,17 @@ \savedfont \spaceskip.5em\!!plus.25em\!!minus.25em\relax} -\def\obeybreakpoints% +\def\obeybreakpoints {\def\obeyedspace{\hskip\spaceskip}% \spaceskip.5em \veryraggedright} -%\unexpanded\def\typ% +%\unexpanded\def\typ % {\bgroup % \obeyhyphens % \futurelet\next\dotype} -\unexpanded\def\typ% +\unexpanded\def\typ {\bgroup \obeyhyphens \futurelet\next\dodotype} @@ -651,7 +651,7 @@ %D But since \type{\groupedcommand} became available, we use %D however -\def\setgroupedtype% +\def\setgroupedtype {\initializetype \catcode`\{=\@@begingroup \catcode`\}=\@@endgroup} @@ -672,19 +672,19 @@ \def\initializetyping#1% {%\donefalse -\switchtobodyfont[\getvalue{\??tp#1\c!korps}]% + \switchtobodyfont[\getvalue{\??tp#1\c!korps}]% \donefalse - \scratchskip=\getvalue{\??tp#1\c!onevenmarge}\relax + \scratchskip\getvalue{\??tp#1\c!onevenmarge}\relax \ifzeropt\scratchskip\else\donetrue\fi - \scratchskip=\getvalue{\??tp#1\c!evenmarge}\relax + \scratchskip\getvalue{\??tp#1\c!evenmarge}\relax \ifzeropt\scratchskip\else\donetrue\fi \ifdone \def\doopenupverbatimline% {\getpagestatus \ifrightpage - \hskip \getvalue{\??tp#1\c!onevenmarge}\relax + \hskip\getvalue{\??tp#1\c!onevenmarge}\relax \else - \hskip \getvalue{\??tp#1\c!evenmarge}\relax + \hskip\getvalue{\??tp#1\c!evenmarge}\relax \fi}% \else \doadaptleftskip{\getvalue{\??tp#1\c!marge}}% @@ -694,14 +694,14 @@ {\edef\!!stringa{\csname\??tp#1\c!blanko\endcsname}}% \processaction [\!!stringa] - [\v!standaard=>\scratchskip=\tussenwit, - \v!klein=>\scratchskip=\blankokleinmaat, - \v!middel=>\scratchskip=\blankomiddelmaat, - \v!groot=>\scratchskip=\blankogrootmaat, - \v!halveregel=>\scratchskip=.5\baselineskip, - \v!regel=>\scratchskip=\baselineskip, - \v!geen=>\scratchskip=\zeropoint, - \s!unknown=>\scratchskip=\commalistelement]% + [\v!standaard=>\scratchskip\tussenwit, + \v!klein=>\scratchskip\blankokleinmaat, + \v!middel=>\scratchskip\blankomiddelmaat, + \v!groot=>\scratchskip\blankogrootmaat, + \v!halveregel=>\scratchskip.5\baselineskip, + \v!regel=>\scratchskip\baselineskip, + \v!geen=>\scratchskip\zeropoint, + \s!unknown=>\scratchskip\commalistelement]% \ifgridsnapping \ifdim\scratchskip=.5\baselineskip\relax \edef\verbatimbaselineskip{\the\scratchskip}% new @@ -728,7 +728,7 @@ {\stopverbatimcolor \stopopelkaar % includes \egroup \getvalue{\??tp#1\c!na}% - \doifvalue{\??tp#1\c!springvolgendein}{\v!nee}{\noindentation}} + \doifvalue{\??tp#1\c!springvolgendein}\v!nee\noindentation} %D \macros %D {setuptyping} @@ -759,7 +759,7 @@ \getparameters[\??tp][#1]% \fi} -\def\setuptyping% +\def\setuptyping {\dodoubleempty\dosetuptyping} %D The setups for display verbatim and file verbatim are @@ -788,6 +788,7 @@ \c!onevenmarge=\!!zeropoint, \c!blanko=\v!regel, \c!escape=/, % beware \string\ , should also be accepted + \c!nummeren=\v!nee, \c!regels=] %D \macros @@ -829,17 +830,17 @@ [\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!regels]% + \c!springvolgendein,\c!blanko,\c!escape,\c!regels,\c!nummeren]% \getparameters [\??tp#1] [#2]} \def\dodefinetyping[#1][#2]% {\setvalue{\e!start#1}{\dostarttyping{#1}}% - \setvalue{\e!stop#1}{\dostoptyping{#1}}% + \setvalue{\e!stop #1}{\dostoptyping {#1}}% \presettyping[#1][#2]} -\def\definetyping% +\def\definetyping {\dodoubleempty\dodefinetyping} \definetyping[\v!typen] @@ -929,7 +930,7 @@ \def\setupverbatimcolor#1% fast and local versus slow and global {\doifelsevaluenothing{#1\c!kleur} {\def\beginofpretty[##1]{\startcolormode{\prettypalet:##1}}% - \let\endofpretty \stopcolormode + \let\endofpretty \restorecolormode % \stopcolormode \let\startverbatimcolor \relax \let\stopverbatimcolor \relax \let\verbatimcolor \relax} @@ -1087,9 +1088,9 @@ {\startopelkaar % includes \bgroup \doifinset{\getvalue{\??tp#1\c!optie}}{\v!commandos,\v!schuin,\v!normaal} {\setuptyping[#1][\c!optie=\v!geen]}% - \doifvalue{\??tp#1\c!optie}{\v!kleur} + \doifvalue{\??tp#1\c!optie}\v!kleur {\expandafter\aftersplitstring#2\at.\to\prettyidentifier - \letvalue{\??tp#1\c!optie}=\prettyidentifier}% + \letvalue{\??tp#1\c!optie}\prettyidentifier}% \initializetyping{#1}% \startverbatimcolor \makelocreadfilename{#2}% @@ -1099,8 +1100,8 @@ \stopopelkaar} % includes \egroup {\bgroup \expanded{\convertargument#2}\to\ascii - \tttf[\makemessage{\m!verbatims}{1}\ascii]% - \showmessage{\m!verbatims}{1}\ascii + \tttf[\makemessage\m!verbatims1\ascii]% + \showmessage\m!verbatims1\ascii \egroup}% \getvalue{\??tp#1\c!na}} @@ -1115,7 +1116,7 @@ %D %D The definition is not that spectacular. -\def\filename#1{{\tttf\hyphenatedfile{#1}}} +\unexpanded\def\filename#1{{\tttf\hyphenatedfile{#1}}} %D This leaves some settings: @@ -1124,9 +1125,6 @@ %D And a bonus macro: -\def\verbatim#1% - {\convertargument#1\to\ascii\ascii} - -\protect +\def\verbatim#1{\convertargument#1\to\ascii\ascii} -\endinput +\protect \endinput diff --git a/tex/context/base/core-vis.tex b/tex/context/base/core-vis.tex index c23d1044c..a61b00eaf 100644 --- a/tex/context/base/core-vis.tex +++ b/tex/context/base/core-vis.tex @@ -59,81 +59,79 @@ \scratchdimen#1\relax \dontinterfere \dontcomplain - \boxrulewidth=5\testrulewidth + \boxrulewidth5\testrulewidth #3#4\relax - \setbox0=\normalhbox to \scratchdimen + \setbox0\normalhbox to \scratchdimen {#2{\ruledhbox to \scratchdimen - {\vrule - #5 20\testrulewidth - \!!width \!!zeropoint + {\vrule #5 20\testrulewidth \!!width \zeropoint \normalhss}}}% \smashbox0 \normalpenalty\!!tenthousand \box0 \egroup} -\def\ruledhanging% - {\ifdim\hangindent>\!!zeropoint\relax - \ifnum\hangafter<0 +\def\ruledhanging + {\ifdim\hangindent>\zeropoint + \ifnum\hangafter<\zerocount \normalhbox - {\boxrulewidth=5\testrulewidth - \setbox0=\ruledhbox to \hangindent - {\scratchdimen=\ht\strutbox - \advance\scratchdimen by \dp\strutbox + {\boxrulewidth5\testrulewidth + \setbox0\ruledhbox to \hangindent + {\scratchdimen\ht\strutbox + \advance\scratchdimen \dp\strutbox \vrule - \!!width\!!zeropoint - \!!height\!!zeropoint - \!!depth-\hangafter\scratchdimen}% + \!!width \zeropoint + \!!height \zeropoint + \!!depth -\hangafter\scratchdimen}% \normalhskip-\hangindent \smashbox0 \raise\ht\strutbox\box0}% \fi \fi} -\def\ruledparagraphcues% +\def\ruledparagraphcues {\bgroup \dontcomplain - \normalhbox to \!!zeropoint - {\ifdim\leftskip>\!!zeropoint\relax + \normalhbox to \zeropoint + {\ifdim\leftskip>\zeropoint\relax \showparagraphcue\leftskip\llap\relax\relax\!!depth \normalhskip-\leftskip \fi \ruledhanging \normalhskip\hsize - \ifdim\rightskip>\!!zeropoint\relax + \ifdim\rightskip>\zeropoint\relax \normalhskip-\rightskip \showparagraphcue\rightskip\relax\relax\relax\!!depth \fi}% \egroup} -\def\ruledpar% +\def\ruledpar {\relax \ifhmode \showparagraphcue{40\testrulewidth}\relax\rightrulefalse\relax\!!height \fi \normalpar} -\def\rulednoindent% +\def\rulednoindent {\relax \normalnoindent \ruledparagraphcues \showparagraphcue{40\testrulewidth}\llap\leftrulefalse\relax\!!height} -\def\ruledindent% +\def\ruledindent {\relax \normalnoindent \ruledparagraphcues - \ifdim\parindent>\!!zeropoint\relax + \ifdim\parindent>\zeropoint \showparagraphcue\parindent\relax\relax\relax\!!height \else \showparagraphcue{40\testrulewidth}\llap\relax\relax\!!height \fi \normalhskip\parindent} -\def\ruledleavevmode% +\def\ruledleavevmode {\relax \normalleavevmode - \ifdim\parindent>\!!zeropoint\relax + \ifdim\parindent>\zeropoint \normalhskip-\parindent \ruledparagraphcues \showparagraphcue\parindent\relax\leftrulefalse\rightrulefalse\!!height @@ -143,18 +141,18 @@ \showparagraphcue{40\testrulewidth}\llap\leftrulefalse\rightrulefalse\!!height \fi} -\def\dontshowimplicits% - {\let\noindent = \normalnoindent - \let\indent = \normalindent - \let\leavevmode = \normalleavevmode - \let\par = \normalpar} +\def\dontshowimplicits + {\let\noindent \normalnoindent + \let\indent \normalindent + \let\leavevmode \normalleavevmode + \let\par \normalpar} -\def\showimplicits% - {\testrulewidth = \defaulttestrulewidth - \let\noindent = \rulednoindent - \let\indent = \ruledindent - \let\leavevmode = \ruledleavevmode - \let\par = \ruledpar} +\def\showimplicits + {\testrulewidth \defaulttestrulewidth + \let\noindent \rulednoindent + \let\indent \ruledindent + \let\leavevmode \ruledleavevmode + \let\par \ruledpar} %D The next few||line examples show the four cues. Keep in %D mind that we only see them when we explicitly open or close @@ -203,13 +201,13 @@ {\ttxx#1}% \fi} -\def\ruledbaseline% - {\vrule \!!width \!!zeropoint +\def\ruledbaseline + {\vrule \!!width \zeropoint \bgroup \dontinterfere \doglobal\increment\ruledbaselines - \scratchdimen=\nofruledbaselines\baselineskip - \setbox\scratchbox=\normalvbox to 2\scratchdimen + \scratchdimen\nofruledbaselines\baselineskip + \setbox\scratchbox\normalvbox to 2\scratchdimen {\leaders \normalhbox {\strut @@ -219,8 +217,8 @@ \!!width 120pt} \normalvfill}% \smashbox\scratchbox - \advance\scratchdimen by \strutheightfactor\baselineskip - \setbox\scratchbox=\normalhbox + \advance\scratchdimen \strutheightfactor\baselineskip + \setbox\scratchbox\normalhbox {\normalhskip -48pt \normalhbox to 24pt {\normalhss\debuggertext\ruledbaselines\normalhskip6pt}% @@ -229,8 +227,8 @@ \box\scratchbox \egroup} -\def\showbaselines% - {\testrulewidth=\defaulttestrulewidth +\def\showbaselines + {\testrulewidth\defaulttestrulewidth \EveryPar{\ruledbaseline}} %D \macros @@ -239,14 +237,14 @@ %D The next tracing option probaly is only of use to me and a %D few \CONTEXT\ hackers. -\def\showpagebuilder% +\def\showpagebuilder {\EveryPar{\doshowpagebuilder}} -\def\doshowpagebuilder% - {\strut\llap{\tt\blue \vl - \high{\txx v:\the\vsize }\vl - \high{\txx g:\the\pagegoal }\vl - \high{\txx t:\the\pagetotal}\vl}} +\def\doshowpagebuilder + {\strut\llap{\blue \vl + \high{\infofont v:\the\vsize }\vl + \high{\infofont g:\the\pagegoal }\vl + \high{\infofont t:\the\pagetotal}\vl}} %D \macros %D {makecutbox, cuthbox, cutvbox, cutvtop} @@ -289,42 +287,42 @@ \chardef\cutmarkoffset = 1 \let\cutmarksymbol = \relax -\def\horizontalcuts% +\def\horizontalcuts {\normalhbox to \ruledwidth - {\dorecurse{\horizontalcutmarks} + {\dorecurse\horizontalcutmarks {\vrule\!!width\boxrulewidth\!!height\cutmarklength\normalhfill}% \unskip}} -\def\verticalcuts% - {\scratchdimen=\ruledheight - \advance\scratchdimen by \ruleddepth +\def\verticalcuts + {\scratchdimen\ruledheight + \advance\scratchdimen \ruleddepth \normalvbox to \scratchdimen {\hsize\cutmarklength - \dorecurse{\verticalcutmarks} + \dorecurse\verticalcutmarks {\vrule\!!height\boxrulewidth\!!width\hsize\normalvfill}% \unskip}} -\def\baselinecuts% - {\ifdim\ruleddepth>\!!zeropoint - \scratchdimen=\ruledheight - \advance\scratchdimen by \ruleddepth +\def\baselinecuts + {\ifdim\ruleddepth>\zeropoint + \scratchdimen\ruledheight + \advance\scratchdimen \ruleddepth \normalvbox to \scratchdimen - {\scratchdimen=\cutmarklength - \divide\scratchdimen by 2 + {\scratchdimen\cutmarklength + \divide\scratchdimen 2 \hsize\scratchdimen - \normalvskip\!!zeropoint\!!plus\ruledheight + \normalvskip\zeropoint\!!plus\ruledheight \vrule\!!height\boxrulewidth\!!width\hsize - \normalvskip\!!zeropoint\!!plus\ruleddepth}% + \normalvskip\zeropoint\!!plus\ruleddepth}% \fi} -\def\cutmarksymbols% - {\setbox\scratchbox=\normalvbox to \cutmarklength +\def\cutmarksymbols + {\setbox\scratchbox\normalvbox to \cutmarklength {\normalvfill \normalhbox to \cutmarklength {\normalhfill\ssxx\cutmarksymbol\normalhfill}% \normalvfill}% \normalhbox to \ruledwidth - {\scratchdimen=\cutmarklength + {\scratchdimen\cutmarklength \divide\scratchdimen 2 \llap{\copy\scratchbox\normalhskip\cutmarkoffset\scratchdimen}% \normalhfill @@ -334,25 +332,25 @@ {\edef\ruledheight{\the\ht#1}% \edef\ruleddepth {\the\dp#1}% \edef\ruledwidth {\the\wd#1}% - \setbox#1=\normalhbox + \setbox#1\normalhbox {\dontcomplain \forgetall \boxmaxdepth\maxdimen \offinterlineskip - \scratchdimen=\cutmarklength - \divide\scratchdimen by 2 + \scratchdimen\cutmarklength + \divide\scratchdimen 2 \hsize\ruledwidth - \setbox\scratchbox=\normalvbox - {\setbox\scratchbox=\normalhbox{\horizontalcuts}% + \setbox\scratchbox\normalvbox + {\setbox\scratchbox\normalhbox{\horizontalcuts}% \normalvskip-\cutmarkoffset\scratchdimen \normalvskip-2\scratchdimen \copy\scratchbox \normalvskip\cutmarkoffset\scratchdimen \hbox to \ruledwidth - {\setbox\scratchbox=\normalhbox{\verticalcuts}% + {\setbox\scratchbox\normalhbox{\verticalcuts}% \llap{\copy\scratchbox\normalhskip\cutmarkoffset\scratchdimen}% \bgroup - \setbox\scratchbox=\normalhbox{\baselinecuts}% + \setbox\scratchbox\normalhbox{\baselinecuts}% \llap{\copy\scratchbox\normalhskip\cutmarkoffset\scratchdimen}% \normalhfill \rlap{\normalhskip\cutmarkoffset\scratchdimen\copy\scratchbox}% @@ -360,13 +358,15 @@ \rlap{\normalhskip\cutmarkoffset\scratchdimen\copy\scratchbox}}% \normalvskip\cutmarkoffset\scratchdimen \copy\scratchbox}% - \ht\scratchbox=\ruledheight - \dp\scratchbox=\ruleddepth - \wd\scratchbox=\!!zeropoint + \ht\scratchbox\ruledheight + \dp\scratchbox\ruleddepth + \wd\scratchbox\zeropoint + \resetcolorseparation + \localstartcolor[\defaulttextcolor]% \box\scratchbox \ifx\cutmarksymbol\relax \else - \setbox\scratchbox=\normalvbox - {\setbox\scratchbox=\normalhbox{\cutmarksymbols}% + \setbox\scratchbox\normalvbox + {\setbox\scratchbox\normalhbox{\cutmarksymbols}% \vskip-\cutmarkoffset\scratchdimen \vskip-\cutmarklength \copy\scratchbox @@ -375,33 +375,31 @@ \vskip\ruleddepth \vskip\cutmarkoffset\scratchdimen \copy\scratchbox}% - \ht\scratchbox=\ruledheight - \dp\scratchbox=\ruleddepth - \wd\scratchbox=\!!zeropoint + \ht\scratchbox\ruledheight + \dp\scratchbox\ruleddepth + \wd\scratchbox\zeropoint \box\scratchbox \fi + \localstopcolor \box#1}% \wd#1=\ruledwidth \ht#1=\ruledheight \dp#1=\ruleddepth} -\def\cuthbox% +\def\cuthbox {\normalhbox\bgroup - \dowithnextbox{\makecutbox\nextbox\box\nextbox\egroup}% - \normalhbox} + \dowithnextbox{\makecutbox\nextbox\box\nextbox\egroup}\normalhbox} -\def\cutvbox% +\def\cutvbox {\normalvbox\bgroup - \dowithnextbox{\makecutbox\nextbox\box\nextbox\egroup}% - \normalvbox} + \dowithnextbox{\makecutbox\nextbox\box\nextbox\egroup}\normalvbox} -\def\cutvtop% +\def\cutvtop {\normalvtop\bgroup - \dowithnextbox{\makecutbox\nextbox\box\nextbox\egroup}% - \normalvtop} + \dowithnextbox{\makecutbox\nextbox\box\nextbox\egroup}\normalvtop} %D \macros -%D {colormarkbox} +%D {colormarkbox,rastermarkbox} %D %D This macro is used in the pagebody routine. No other use %D is advocated here. @@ -415,7 +413,7 @@ \def\colorrangeA#1#2#3#4% {\vbox - {\scratchdimen=-\colormarklength + {\scratchdimen-\colormarklength \multiply\scratchdimen 4 \advance\scratchdimen \ruledheight \advance\scratchdimen \ruleddepth @@ -440,7 +438,11 @@ \vbox to \scratchdimen {\vss \hbox to 3em - {\hss\ifdim##1pt=0pt#1\else##1\fi\hss}% + {\hss + \localstartcolor[white]% + \ifdim##1\s!pt=\zeropoint#1\else##1\fi + \localstopcolor + \hss}% \vss}% \fi}}% \offinterlineskip @@ -448,7 +450,7 @@ \def\colorrangeB {\hbox - {\scratchdimen=-\colormarklength + {\scratchdimen-\colormarklength \multiply\scratchdimen 2 \advance\scratchdimen \ruledwidth \divide\scratchdimen 11 @@ -470,7 +472,11 @@ \vbox to \colormarklength {\vss \hbox to \scratchdimen - {\hss\ifdim##2pt=.5pt##2~\fi##1\hss} + {\hss + \localstartcolor[white]% + \ifdim##2\s!pt=.5\s!pt##2~\fi##1% + \localstopcolor + \hss} \vss}% \fi}% \docommando C .5 \iftrue \iffalse\iffalse\iffalse @@ -487,76 +493,87 @@ \def\colorrangeC {\hbox - {\scratchdimen=-\colormarklength - \multiply\scratchdimen by 2 - \advance\scratchdimen by \ruledwidth - \divide\scratchdimen by 14 + {\resetcolorseparation + \scratchdimen-\colormarklength + \multiply\scratchdimen 2 + \advance\scratchdimen \ruledwidth + \divide\scratchdimen 14 \def\docommando##1% {\definecolor[\s!dummy][\c!s=##1]% \localstartcolor[\s!dummy]% \vrule \!!width \scratchdimen \!!height \colormarklength - \!!depth \!!zeropoint + \!!depth \zeropoint \localstopcolor \ifdim\scratchdimen>2em \hskip-\scratchdimen \vbox to \colormarklength - {\vss\hbox to \scratchdimen{\hss##1\hss}\vss}% + {\vss + \localstartcolor[white]% + \hbox to \scratchdimen{\hss##1\hss} + \localstopcolor + \vss}% \fi}% \processcommalist - [1.00,0.95,0.90,0.85,0.80,0.75, - 0.70,0.60,0.50,0.40,0.30,0.20,0.10,0.00]\docommando}} - -\def\docolormarkbox#1% - {\edef\ruledheight{\the\ht#1}% - \edef\ruleddepth {\the\dp#1}% - \edef\ruledwidth {\the\wd#1}% - \setbox#1=\hbox - {\scratchdimen=\colormarklength - \divide\scratchdimen by 2 + [1.00,0.95,0.90,0.85,0.80,0.75,0.70,% + 0.60,0.50,0.40,0.30,0.20,0.10,0.00]\docommando}} + +\def\docolormarkbox#1#2% + {\edef\ruledheight{\the\ht#2}% + \edef\ruleddepth {\the\dp#2}% + \edef\ruledwidth {\the\wd#2}% + \setbox#2\hbox + {\scratchdimen\colormarklength + \divide\scratchdimen 2 \forgetall \ssxx - \setbox\scratchbox=\vbox + \setbox\scratchbox\vbox {\offinterlineskip \vskip-\colormarkoffset\scratchdimen - \vskip-2\scratchdimen - \hbox to \ruledwidth - {\hss\hbox{\colorrangeB}\hss}% - \vskip\colormarkoffset\scratchdimen - \vbox to \ruledheight - {\vss - \hbox to \ruledwidth - {\llap{\colorrangeA C\iftrue\iffalse\iffalse\hskip\colormarkoffset\scratchdimen}% - \hfill - \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA R\iffalse\iftrue\iftrue}}% - \vss - \hbox to \ruledwidth - {\llap{\colorrangeA M\iffalse\iftrue\iffalse\hskip\colormarkoffset\scratchdimen}% - \hfill - \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA G\iftrue\iffalse\iftrue}}% - \vss - \hbox to \ruledwidth - {\llap{\colorrangeA Y\iffalse\iffalse\iftrue\hskip\colormarkoffset\scratchdimen}% - \hfill - \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA B\iftrue\iftrue\iffalse}}% - \vss} + \vskip-2\scratchdimen\relax % relax needed + % beware: no \ifcase, due to nested \iftrue/\iffalse + % and lacking \fi's + \doifelse{#1}{0}% + {\vskip\colormarklength + \vskip\colormarkoffset\scratchdimen + \vskip\ruledheight} + {\hbox to \ruledwidth{\hss\hbox{\colorrangeB}\hss}% + \vskip\colormarkoffset\scratchdimen + \vbox to \ruledheight + {\vss + \hbox to \ruledwidth + {\llap{\colorrangeA C\iftrue\iffalse\iffalse\hskip\colormarkoffset\scratchdimen}% + \hfill + \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA R\iffalse\iftrue\iftrue}}% + \vss + \hbox to \ruledwidth + {\llap{\colorrangeA M\iffalse\iftrue\iffalse\hskip\colormarkoffset\scratchdimen}% + \hfill + \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA G\iftrue\iffalse\iftrue}}% + \vss + \hbox to \ruledwidth + {\llap{\colorrangeA Y\iffalse\iffalse\iftrue\hskip\colormarkoffset\scratchdimen}% + \hfill + \rlap{\hskip\colormarkoffset\scratchdimen\colorrangeA B\iftrue\iftrue\iffalse}}% + \vss}}% \vskip\colormarkoffset\scratchdimen \hbox to \ruledwidth {\hss\lower\ruleddepth\hbox{\colorrangeC}\hss}}% - \ht\scratchbox=\ruledheight - \dp\scratchbox=\ruleddepth - \wd\scratchbox=\!!zeropoint + \ht\scratchbox\ruledheight + \dp\scratchbox\ruleddepth + \wd\scratchbox\zeropoint \box\scratchbox - \box#1}% - \wd#1=\ruledwidth - \ht#1=\ruledheight - \dp#1=\ruleddepth} + \box#2}% + \wd#2=\ruledwidth + \ht#2=\ruledheight + \dp#2=\ruleddepth} -\def\colormarkbox#1% - {\ifincolor - \docolormarkbox{#1}% - \fi} +\def\colormarkbox % #1 + {\ifincolor\@EA\docolormarkbox\else\@EA\gobbletwoarguments\fi1} + +\def\rastermarkbox % #1 + {\ifincolor\@EA\docolormarkbox\else\@EA\gobbletwoarguments\fi0} %D \macros %D {showwhatsits, dontshowwhatsits} @@ -589,25 +606,25 @@ \let\supernormalmark \normalmark % mark may already superseded \let\supernormalmarks \normalmarks % mark may already superseded - \def\showwhatsits% + \def\showwhatsits {\protected\def\normalmark {\visualwhatsit100+m\supernormalmark }% \protected\def\normalmarks{\visualwhatsit100+m\supernormalmarks}% \protected\def\special {\visualwhatsit0100s\normalspecial }% \protected\def\write {\visualwhatsit001-w\normalwrite }% - \let\immediate=\immediatewhatsit + \let\immediate\immediatewhatsit \appendtoks\dontshowwhatsits\to\everystoptext} - \def\immediatewhatsit% - {\bgroup\futurelet\next\doimmediatewhatsit}% + \def\immediatewhatsit + {\bgroup\futurelet\next\doimmediatewhatsit} - \def\doimmediatewhatsit% + \def\doimmediatewhatsit {\ifx\next\write \egroup\immediatewritetrue \else \egroup\expandafter\normalimmediate \fi} - \def\dontshowwhatsits% + \def\dontshowwhatsits {\let\immediate \normalimmediate \let\normalmark\supernormalmark \let\special \normalspecial @@ -622,19 +639,19 @@ \dontshowwhatsits \ttx \ifvmode\donetrue\else\donefalse\fi - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\ifdone\dostartgraycolormode0\else\dostartrgbcolormode#1#2#3\fi #5\dostopcolormode}% - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\ifdone\dostartrgbcolormode#1#2#3\else\dostartgraycolormode0\fi \vrule\!!width\wd\scratchbox\dostopcolormode \hskip-\wd\scratchbox\box\scratchbox}% - \scratchdimen=1ex + \scratchdimen1ex \ifdone - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\hskip#4\scratchdimen\box\scratchbox}% \else - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\raise#4\scratchdimen\box\scratchbox}% \fi \smashbox\scratchbox @@ -648,7 +665,7 @@ \expandafter\normalimmediate \fi} - \def\pushwhatsit% + \def\pushwhatsit {\ifzeropt\lastskip \ifcase\lastpenalty \ifzeropt\lastkern @@ -688,7 +705,7 @@ %D The next macro can be used to keep track of classes of %D boxes (handy for development cq.\ tracing). -\def\dodotagbox#1#2#3% +\def\dodotagbox#1#2#3% can be reimplemented {\def\next##1##2##3##4% {\vbox to \ht#2{##3\hbox to \wd#2{##1#3##2}##4}}% \processaction diff --git a/tex/context/base/enco-ini.tex b/tex/context/base/enco-ini.tex index 117e20ee4..d0e027419 100644 --- a/tex/context/base/enco-ini.tex +++ b/tex/context/base/enco-ini.tex @@ -133,10 +133,11 @@ \def\setregimecode#1#2% {\ifprotectregime\ifnum\catcode#1=\active\else - \catcode#1=#2\relax + \catcode#1=#2%\relax \fi\else - \catcode#1=#2\relax - \fi} + \catcode#1=#2%\relax + \fi + \relax} %D \macros %D {startregime, enableregime} @@ -161,16 +162,20 @@ \def\startregime[#1]% {\localpushmacro\characterregime \edef\characterregime{@#1@}% - \doifundefined{\@reg@\characterregime} + \checkregimetoks} + +\def\checkregimetoks + {\doifundefined{\@reg@\characterregime} {\@EA\newtoks\csname\@reg@\characterregime\endcsname}} -\def\stopregime% +\def\stopregime {\localpopmacro\characterregime} %\long\def\startregime[#1]#2\stopregime{} -\def\setregimetoks% - {\@EA\let\@EA\regimetoks\csname\@reg@\characterregime\endcsname} +\def\setregimetoks + {\checkregimetoks + \@EA\let\@EA\regimetoks\csname\@reg@\characterregime\endcsname} \let\enabledregime\empty @@ -221,13 +226,17 @@ \long\def\defineactivedecimals#1 to #2 as #3 % {\setregimetoks - \dostepwiserecurse{#1}{#2}{1} + \dostepwiserecurse{#1}{#2}\plusone {\@EA\appendtoks\@EA\dodefineactivedecimal\@EA{\recurselevel}{#3}\to\regimetoks}} \long\def\defineactivetoken #1 #2% watch the {} {\setregimetoks \appendtoks\defineactivecharacter#1 {#2{}}\to\regimetoks} +\long\def\defineactiveinspector #1 #2% watch the missing {} + {\setregimetoks + \appendtoks\defineactivecharacter#1 {#2}\to\regimetoks} + %D .... \edef\nocharacterregime{@\s!default @} @@ -261,8 +270,9 @@ \def\doautosetregime#1#2% {\ifnum#2>127 - \def\!!stringa{#2 }% - \@EA\@EA\@EA\defineactivetoken\@EA\!!stringa\@EA{\csname#1\endcsname}% +% \def\!!stringa{#2 }% +% \@EA\@EA\@EA\defineactivetoken\@EA\!!stringa\@EA{\csname#1\endcsname}% +\expanded{\defineactivetoken #2 \@EA\noexpand\csname#1\endcsname}% \fi} %D \macros @@ -271,7 +281,7 @@ %D The following setup command is used to tune encoding %D handling. -\def\setupencoding% +\def\setupencoding {\dosingleargument\dosetupencoding} \def\dosetupencoding[#1]% @@ -292,9 +302,9 @@ {\setvalue{\c!file\f!encodingprefix#1}{}% \makeshortfilename[\f!encodingprefix#1]% \startreadingfile - \readsysfile{\shortfilename} - {\showmessage{\m!encodings}{2}{#1}} - {\showmessage{\m!encodings}{3}{#1}}% + \readsysfile\shortfilename + {\showmessage\m!encodings2{#1}} + {\showmessage\m!encodings3{#1}}% \stopreadingfile}} \def\useencoding[#1]% @@ -332,7 +342,7 @@ \def\stopmapping {\popmacro\charactermapping} -\def\setmappingtoks% +\def\setmappingtoks {\@EA\let\@EA\mappingtoks\csname\@map@\charactermapping\endcsname} \def\definecasemap #1 #2 #3 % code lower upper @@ -364,7 +374,7 @@ %D and saves a lot of typing (copying). \def\presetcaserange#1#2% - {\dostepwiserecurse{#1}{#2}{1} + {\dostepwiserecurse{#1}{#2}\plusone {\setregimecode\recurselevel\@@letter \lccode \recurselevel=\recurselevel \uccode \recurselevel=\recurselevel}} @@ -436,8 +446,8 @@ %D and~\type{^}, so let us define ourselve some handy macros %D first. -\def\protectfontcharacters% - {\edef\unprotectfontcharacters% +\def\protectfontcharacters + {\edef\unprotectfontcharacters {\catcode`\noexpand ~=\the\catcode`~\relax \catcode`\noexpand _=\the\catcode`_\relax \catcode`\noexpand ^=\the\catcode`^\relax}% @@ -553,7 +563,7 @@ \csname\characterencoding#1\endcsname \fi} -\def\enableencoding% +\def\enableencoding {\dodoubleempty\doenableencoding} \def\doenableencoding[#1][#2]% main fallback @@ -573,30 +583,29 @@ {\edef\characterencoding{@#1@}% \let\nocharacterencoding\xnocharacterencoding} -\def\startencoding% +\def\startencoding {\dodoubleempty\dostartencoding} \def\dostartencoding[#1][#2]% encoding regime {\doifelsenothing{#1} {\let\stopencoding\relax} {%\protectfontcharacters % problematic in language loading - \showmessage{\m!encodings}{1}{#1}% + \showmessage\m!encodings1{#1}% \pushmacro\dohandleaccent \pushmacro\dohandlecommand \pushmacro\definesortkey - \pushmacro\currentcharacterregime - \pushmacro\dosetautoregime + \pushmacro\characterregime + \pushmacro\doautosetregime \let\dohandleaccent\donthandleaccent \let\dohandlecommand\donthandlecommand \let\definesortkey\savesortkey \doifelsenothing{#2}% - {% message - \let\doautosetregime\gobbletwoarguments} - {\def\currentcharacterregime{@#2@}}% + {\let\doautosetregime\gobbletwoarguments} + {\def\characterregime{@#2@}}% \enableencoding[#1]% \def\stopencoding% - {\popmacro\dosetautoregime - \popmacro\currentcharacterregime + {\popmacro\doautosetregime + \popmacro\characterregime \popmacro\definesortkey \popmacro\dohandlecommand \popmacro\dohandleaccent @@ -635,7 +644,7 @@ %D argument determines the sort order given the replacement. %D The last argument is used as entry in the index (a, b, etc). %D -%D The keys can be flished using \type {\flushsortkeys} +%D The keys can be flushed using \type {\flushsortkeys} %D which in turn results in a sequence of calls to \type %D {\flushsortkey}, a macro taking 4~arguments. %D @@ -657,7 +666,7 @@ \def\definesortkey#1#2#3#4% {} -\def\flushsortkeys% +\def\flushsortkeys {\enablelanguagespecifics[\currentlanguage]% \getvalue{sort:\characterencoding}} @@ -669,7 +678,7 @@ %D The actual definition of accents, special characters and %D commands is done with the next three commands. -\def\defineaccent% +\def\defineaccent {\protectfontcharacters \dodefineaccent} @@ -677,21 +686,11 @@ {\unprotectfontcharacters \dododefineaccent#1 #2 } -% obsolete -% -% \def\dododefineaccent#1 #2 #3 % -% {\redefineaccent #1 % just to be sure -% \doifnumberelse{\string#3} -% {\setvalue{\characterencoding#1\string#2}{\char#3 }} % space added -% {\setvalue{\characterencoding#1\string#2}{#3}}% -% \unprotectfontcharacters} - \def\dododefineaccent#1 #2 #3 % {\setvalue{#1}{\dohandleaccent{#1}}% \doifnumberelse{\string#3} {\setvalue{\characterencoding#1\string#2}{\char#3 }} % space added - {\setvalue{\characterencoding#1\string#2}{#3}}% - \unprotectfontcharacters} + {\setvalue{\characterencoding#1\string#2}{#3}}} \beginTEX @@ -740,12 +739,12 @@ \def\patternchar#1 {\rawcharacter{#1}} -\def\startpatternaccents% +\def\startpatternaccents {\let\savedpatternchar\char \let\char\patternchar \let\dohandleaccent\normaldohandleaccent} -\def\stoppatternaccents% +\def\stoppatternaccents {\let\char\savedpatternchar} \def\definecharacter#1 #2 % @@ -863,7 +862,7 @@ %D \defineaccentcommand " 127 % "7F %D \stoptypen -\def\defineaccentcommand% +\def\defineaccentcommand {\protectfontcharacters \dodefineaccentcommand} @@ -1278,7 +1277,7 @@ \let\normalmathaccent\mathaccent \let\normalchar \char -\def\buildtextaccent% +\def\buildtextaccent {\ifignoreaccent \expandafter\nobuildtextaccent \else @@ -1327,7 +1326,7 @@ % some fake ones, name will change into build -\def\bottomaccent#1#2#3#4#5% down right slantcorrection accent char +\unexpanded\def\bottomaccent#1#2#3#4#5% down right slantcorrection accent char {\leavevmode \vtop {\forgetall @@ -1336,7 +1335,7 @@ \everycr\emptytoks \tabskip\zeropoint \lineskiplimit\zeropoint - \setbox0=\hbox{#4}% + \setbox0\hbox{#4}% \halign {##\crcr#5\crcr \hidewidth @@ -1423,6 +1422,28 @@ \def\donthandlecommand #1{\expandafter\string\csname#1\endcsname\space} \def\donthandlecharacter#1{\expandafter\string\csname#1\endcsname\space} +\def\keepencodedtokens + {\let\dohandleaccent \keephandleaccent + \let\dohandlecommand \keephandlecommand + \let\dohandlecharacter\keephandlecharacter} + +\def\keephandleaccent #1{\expandafter\noexpand\csname#1\endcsname} +\def\keephandlecommand #1{\expandafter\noexpand\csname#1\endcsname} +\def\keephandlecharacter#1{\expandafter\noexpand\csname#1\endcsname} + +\def\handleaccent #1{\csname#1\endcsname} +\def\handlecommand #1{\csname#1\endcsname} +\def\handlecharacter#1{\csname#1\endcsname} + +\unexpanded\def\uhandleaccent #1{\csname#1\endcsname} +\unexpanded\def\uhandlecommand #1{\csname#1\endcsname} +\unexpanded\def\uhandlecharacter#1{\csname#1\endcsname} + +\def\dontexpandencodedtokens + {\def\dohandleaccent {\uhandleaccent}% + \def\dohandlecommand {\uhandlecommand}% + \def\dohandlecharacter{\uhandlecharacter}} + %D Still valid? To be checked: \def\ignoreencoding @@ -1440,7 +1461,7 @@ %D We preload several encodings: -\useencoding[def,acc,raw,com,cas,mis] +\useencoding[def,acc,raw,com,cas,mis] \useencoding[ans,il2,ec,tbo,pdf,uc,pol,x5] diff --git a/tex/context/base/enco-mis.tex b/tex/context/base/enco-mis.tex index 20aae235a..3ab1ad432 100644 --- a/tex/context/base/enco-mis.tex +++ b/tex/context/base/enco-mis.tex @@ -33,26 +33,26 @@ \unprotect -\def\pseudoencodeddj% like in babel +\def\pseudoencodeddj % like in babel {\leavevmode\hbox\bgroup - \setbox0=\hbox{d}% + \setbox0\hbox{d}% \dimen0=\ht0 - \advance\dimen0 by 1ex + \advance\dimen0 1ex \dimen0=.45\dimen0 \dimen2\expandafter\withoutpt\the\fontdimen1\font\dimen0 - \advance\dimen2 by .5ex + \advance\dimen2 .5ex \rlap{\raise\dimen0\hbox{\kern\dimen2\vbox{\hrule\!!height0.1ex\!!width0.3em}}}% \box0 \egroup} -\def\pseudoencodedDJ% like in babel +\def\pseudoencodedDJ % like in babel {\leavevmode \hbox\bgroup - \setbox0=\hbox{D}% + \setbox0\hbox{D}% \dimen0=.55\ht0 \dimen2\expandafter\withoutpt\the\fontdimen1\font\dimen0 - \advance\dimen2 by .15ex - \advance\dimen2 by -.15\fontdimen7\font + \advance\dimen2 .15ex + \advance\dimen2 -.15\fontdimen7\font \dimen4\expandafter\withoutpt\the\fontdimen7\font\dimen0 \rlap{\raise\dimen0\hbox{\kern\dimen2\vbox{\hrule\!!height0.1ex\!!width0.33em}}}% \box0 @@ -109,7 +109,7 @@ \def\fakepermine {\dontleavehmode \bgroup - \setbox0=\hbox + \setbox0\hbox {\mathematics{+}}% \hbox to \wd0 {\hss @@ -173,7 +173,6 @@ \def\_{\ifmmode\mathunderscore\else\textunderscore\fi} - %D Handy: \def\missingglyph{\ruledhbox{?}} diff --git a/tex/context/base/enco-pol.tex b/tex/context/base/enco-pol.tex index ecc9ee8b1..36336c03a 100644 --- a/tex/context/base/enco-pol.tex +++ b/tex/context/base/enco-pol.tex @@ -11,7 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D Polish native encoding. +%D Polish native encoding; normally polish users will use +%D translate=cp1250pl in combination with ec encoding. \startmapping[pl0] diff --git a/tex/context/base/font-chi.tex b/tex/context/base/font-chi.tex index 267e75563..fa9e940f7 100644 --- a/tex/context/base/font-chi.tex +++ b/tex/context/base/font-chi.tex @@ -125,7 +125,7 @@ \sfcode`(=2000 % a temporary hack -\def\chinesenobreak% +\def\chinesenobreak {\relax \iftracechinese \nobreak @@ -137,15 +137,15 @@ \newif\ifcorrectchineseboundarychars -\def\chineseunskip% +\def\chineseunskip {\unskip\unskip\unskip\unskip} -\def\insertchineseglyph% +\def\insertchineseglyph {\iftracechinese\tracedchineseglyph\else\insertunicodeglyph\fi} \newif\ifverticalchinese -\def\handlechineseunicodeglyph% +\def\handlechineseunicodeglyph {\ifinpagebody \horizontalchineseunicodeglyph \else\ifverticalchinese @@ -259,7 +259,7 @@ \fi\fi\fi \fi\fi\fi} -\def\horizontalchineseunicodeglyph% +\def\horizontalchineseunicodeglyph {\relax \ifhmode\else\dontleavehmode\fi % added \setunicodescale\chineseunicodescale @@ -340,7 +340,7 @@ \aftergroup\ignorespaces % watch this \fi} -\def\verticalchineseunicodeglyph% +\def\verticalchineseunicodeglyph {\relax \ifprocessingverbatim % to do \horizontalchineseunicodeglyph @@ -348,17 +348,17 @@ \setunicodescale\chineseunicodescale \setunicodestrut\chineseunicodeheight\chineseunicodedepth \analyzechineseunicodeglyph - \setbox\scratchbox=\hbox to \hsize + \setbox\scratchbox\hbox to \hsize {\hss \ifcase\chineseSstatus\relax \insertchineseglyph \else % left / right - \setbox\scratchbox=\hbox{\insertchineseglyph}% + \setbox\scratchbox\hbox{\insertchineseglyph}% \rotate[\c!rotatie=270]{\box\scratchbox}% \fi \hss}% - \ht\scratchbox=\unicodeheight\ht\strutbox - \dp\scratchbox=\unicodedepth \dp\strutbox + \ht\scratchbox\unicodeheight\ht\strutbox + \dp\scratchbox\unicodedepth \dp\strutbox \ifvmode % catches \hbox{...}, actually \hbox should be \vbox -) \nointerlineskip \fi @@ -369,7 +369,7 @@ \or % right \ifnum\chineseSstatus=2 \par\nobreak\else\allowbreak\fi \fi - \global\chardef\prevchineseSstatus=\chineseSstatus % pagebody ... + \global\chardef\prevchineseSstatus\chineseSstatus % pagebody ... \box\scratchbox\par \aftergroup\ignorespaces % watch this \fi} @@ -381,10 +381,10 @@ %D vertical typesetting. Vertical typesetting is implemented %D on top of the multi||column routines. -\def\setupchinese% +\def\setupchinese {\dodoubleargument\getparameters[\??vt]} -\def\startvertical% +\def\startvertical {\dosingleempty\dostartvertical} \def\dostartvertical[#1]% @@ -392,13 +392,13 @@ \def\maxnofcolumns{25}% \verticalchinesetrue \global\chardef\prevchineseSstatus=0 - \let\nochinese=\nochineseinvertical - \doif{\@@vtn}{\v!passend} + \let\nochinese\nochineseinvertical + \doif\@@vtn\v!passend {\dimen0=\textwidth - \advance\dimen0 by \@@vtafstand + \advance\dimen0 \@@vtafstand \dimen2=\bodyfontsize - \advance\dimen2 by \@@vtafstand - \divide\dimen0 by \number\dimen2 + \advance\dimen2 \@@vtafstand + \divide\dimen0 \number\dimen2 \edef\@@vtn{\number\dimen0}}% \startkolommen [\c!richting=\@@vtrichting, @@ -407,7 +407,7 @@ \c!n=\@@vtn, #1]} -\def\stopvertical% +\def\stopvertical {\stopkolommen \egroup} @@ -427,9 +427,9 @@ \def\nochineseinvertical#1% {\par - \setbox\scratchbox=\hbox{\strut#1} + \setbox\scratchbox\hbox{\strut#1} \getnoflines{\wd\scratchbox} - \setbox\scratchbox=\hbox to \noflines\openlineheight + \setbox\scratchbox\hbox to \noflines\openlineheight {\hss\box\scratchbox\hss} \hbox to \hsize {\hss @@ -978,20 +978,20 @@ \definefontsynonym [SimplifiedChineseKaiTiBold] [gbkai] [encoding=gbk] \definefontsynonym [SimplifiedChineseKaiTiBoldSlanted] [gbkaisl] [encoding=gbk] -\definefontsynonym [TraditionalChineseKaiTiRegular] [b5kai] [encoding=big5] -\definefontsynonym [TraditionalChineseKaiTiSlanted] [b5kaisl] [encoding=big5] -\definefontsynonym [TraditionalChineseKaiTiBold] [b5kai] [encoding=big5] -\definefontsynonym [TraditionalChineseKaiTiBoldSlanted][b5kaisl] [encoding=big5] +\definefontsynonym [TraditionalChineseKaiTiRegular] [b5kai] [encoding=big5] +\definefontsynonym [TraditionalChineseKaiTiSlanted] [b5kaisl] [encoding=big5] +\definefontsynonym [TraditionalChineseKaiTiBold] [b5kai] [encoding=big5] +\definefontsynonym [TraditionalChineseKaiTiBoldSlanted] [b5kaisl] [encoding=big5] -\definefontsynonym [SimplifiedChineseFangSongRegular] [gbfs] [encoding=gbk] -\definefontsynonym [SimplifiedChineseFangSongSlanted] [gbfssl] [encoding=gbk] -\definefontsynonym [SimplifiedChineseFangSongBold] [gbfs] [encoding=gbk] -\definefontsynonym [SimplifiedChineseFangSongBoldSlanted][gbfssl] [encoding=gbk] +\definefontsynonym [SimplifiedChineseFangSongRegular] [gbfs] [encoding=gbk] +\definefontsynonym [SimplifiedChineseFangSongSlanted] [gbfssl] [encoding=gbk] +\definefontsynonym [SimplifiedChineseFangSongBold] [gbfs] [encoding=gbk] +\definefontsynonym [SimplifiedChineseFangSongBoldSlanted] [gbfssl] [encoding=gbk] -\definefontsynonym [TraditionalChineseFangSongRegular] [b5fs] [encoding=big5] -\definefontsynonym [TraditionalChineseFangSongSlanted] [b5fssl] [encoding=big5] -\definefontsynonym [TraditionalChineseFangSongBold] [b5fs] [encoding=big5] -\definefontsynonym [TraditionalChineseFangSongBoldSlanted][b5fssl] [encoding=big5] +\definefontsynonym [TraditionalChineseFangSongRegular] [b5fs] [encoding=big5] +\definefontsynonym [TraditionalChineseFangSongSlanted] [b5fssl] [encoding=big5] +\definefontsynonym [TraditionalChineseFangSongBold] [b5fs] [encoding=big5] +\definefontsynonym [TraditionalChineseFangSongBoldSlanted] [b5fssl] [encoding=big5] \definefontsynonym [SimplifiedChineseLiShuRegular] [gbli] [encoding=gbk] \definefontsynonym [SimplifiedChineseLiShuSlanted] [gblisl] [encoding=gbk] diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex index 4af5532ee..3e7534bdc 100644 --- a/tex/context/base/font-ini.tex +++ b/tex/context/base/font-ini.tex @@ -18,7 +18,7 @@ % adapted, else wrong interlinespace -\def\setfontparameters% +\def\setfontparameters {\synchronizefontsfalse \the\everybodyfont \synchronizefontstrue} @@ -57,15 +57,21 @@ % new -\newevery \everydefinedfont \relax +\newevery \everydefinedfont \relax \def\dodefinedfont[#1]% {\iffirstargument\definefont[\string\definedfont][#1]\fi \csname\string\definedfont\endcsname \the\everydefinedfont} -\unexpanded\def\definedfont% +\unexpanded\def\definedfont {\dosingleempty\dodefinedfont} + +\unexpanded\def\startfont + {\bgroup\definedfont} + +\def\stopfont + {\egroup} %%% message 14 added @@ -489,7 +495,7 @@ %D \type{\bf}, \type{\sl} etc. but by default it equals %D \type{\tf}: -\unexpanded\def\mf% +\unexpanded\def\mf {\dodosetmathfont\fontalternative \csname\fontalternative\endcsname} @@ -539,7 +545,7 @@ \let\normalmathop=\mathop -\def\mathop% +\def\mathop {\normalmathop \bgroup \let\rm\mf @@ -589,19 +595,19 @@ %D although for instance unboxing goes ok. Therefore we %D introduce: -\def\normalmbox% +\def\normalmbox {\normalhbox\bgroup\mf \dowithnextbox{\box\nextbox\egroup}\normalhbox} % to test: % -% \def\normalmbox% -% {\dowithnextboxcontent{\mf}{\box\nextbox}\normalhbox} +% \def\normalmbox +% {\dowithnextboxcontent\mf\flushnextbox\normalhbox} -\def\mbox% +\def\mbox {\ifmmode\normalmbox\else\normalhbox\fi} -\def\enablembox% +\def\enablembox {\appendtoks \ifx\normalhbox\undefined\let\normalhbox\hbox\fi \let\hbox\mbox @@ -767,7 +773,7 @@ \dosettextfamily\c!sc \to \textstrategies -\def\dosettextfamily#1% +\def\dosettextfamily#1% better pass fontbody to dodoset {\let\savedfontbody\fontbody \let\fontfamily#1% \let\fontbody\scriptscriptface\dodosettextfamily\scriptscriptfont @@ -1059,13 +1065,13 @@ \def\magstep#1% \relax removed, otherwise space after it sticks, else added {\ifcase#1 \@m\or1200\or1440\or1728\or2074\or2488\or\@m\fi} -\def\magstephalf% +\def\magstephalf {1095} \def\magfactor#1% {\ifcase#1 1.000\or1.200\or1.440\or1.728\or2.074\or2.488\or1\fi} -\def\magfactorhalf% +\def\magfactorhalf {1.095} %D These macros enable the use of definitions like \type{sa @@ -1080,50 +1086,53 @@ %D We could instead have used dirty grouping tricks, but this %D one works too. -\def\norelativefontsize{1} -\def\dorelativefontsize{1} -\def\relativefontsize {1} +\def\defaultrelativefontsize{1} +\def\localrelativefontsize {1} +\def\localabsolutefontsize {\fontbody} -\def\s!rscale{rscale} +\let\relativefontsize \defaultrelativefontsize -\def\dostorerelativefontsize#1% - {\ifx\fontclass\empty\else\global\fi - \letvalue{#1\s!rscale}\relativefontsize} +\def\saverelativefontsize#1#2% #1=rm|ss|.. #2=waarde + {\setxvalue{\fontclass#1\s!rscale}{#2}} -\beginTEX +\beginTEX -\def\dosetrelativefontsize#1% - {\expandafter\ifx\csname#1\s!rscale\endcsname\relax - \let\dorelativefontsize\norelativefontsize - \else - %\edef\dorelativefontsize{\csname#1\s!rscale\endcsname}% - \@EA\let\@EA\dorelativefontsize\csname#1\s!rscale\endcsname - \fi} +\def\checkrelativefontsize#1% + {\edef\relativefontsize + {\@EA\ifx\csname\fontclass#1\s!rscale\endcsname\relax + \defaultrelativefontsize + \else + \csname\fontclass#1\s!rscale\endcsname + \fi}} \endTEX \beginETEX \ifcsname -\def\dosetrelativefontsize#1% - {\ifcsname#1\s!rscale\endcsname - %\edef\dorelativefontsize{\csname#1\s!rscale\endcsname}% - \@EA\let\@EA\dorelativefontsize\csname#1\s!rscale\endcsname - \else - \let\dorelativefontsize\norelativefontsize - \fi} +\def\checkrelativefontsize#1% + {\edef\relativefontsize + {\ifcsname\fontclass#1\s!rscale\endcsname + \csname\fontclass#1\s!rscale\endcsname + \else + \defaultrelativefontsize + \fi}} \endETEX -\def\doresetrelativefontsize% - {\let\dorelativefontsize\norelativefontsize} - \newdimen\scaledfont \def\@fs@{@fs@} +% \def\parsefontspec#1% +% {\edef\somefontspec{#1\space\relax}% +% \@EA\doparsefontspec\somefontspec]% =>#1 \relax] +% \donoparsefontspec} +% +% but, better: + \def\parsefontspec#1% - {\edef\somefontspec{#1\space\relax}% - \@EA\doparsefontspec\somefontspec]% + {\edef\somefontspec{#1\space}% + \@EA\doparsefontspec\somefontspec\relax]% =>#1 \relax] \donoparsefontspec} \def\doparsefontspec#1 #2% @@ -1138,44 +1147,49 @@ #2} \def\setnaturalfontspec#1]% - {\@fs@scaled\!!thousand} + {\@fs@scaled\!!thousand\relax} \def\setforcedfontspec#1 #2\relax]% - {\csname\@fs@#1\endcsname{#2}} + {\csname\@fs@#1\endcsname#2\relax} + +\def\@fs@scaled + {\afterassignment\do@fs@scaled\scratchcounter} -\def\@fs@scaled#1% - {\scaledfont#1pt% - \scaledfont\dorelativefontsize\scaledfont +\def\do@fs@scaled#1\relax + {\scaledfont\number\scratchcounter\s!pt + \scaledfont\localrelativefontsize\scaledfont \ifautofontsize\scaledfont\currentfontbodyscale\scaledfont\fi \scratchcounter\scaledfont % \scaledfont is now pretty large \advance\scratchcounter \medcard \divide\scratchcounter \maxcard \edef\somefontspec{ scaled \the\scratchcounter}} -\def\@fs@at#1% - {\scaledfont#1% - \scaledfont\dorelativefontsize\scaledfont +\def\@fs@at + {\afterassignment\do@fs@at\scaledfont} + +\def\do@fs@at#1\relax + {\scaledfont\localrelativefontsize\scaledfont \ifautofontsize\scaledfont\currentfontbodyscale\scaledfont\fi - \def\somefontspec{ at \scaledfont}} + \edef\somefontspec{ at \the\scaledfont}} -\def\@fs@sa% - {\scaledfont\fontbody +\def\@fs@sa + {\scaledfont\localabsolutefontsize \setsamofontspec} -\def\@fs@mo% - {\scaledfont\setmappedfontsize\fontbody +\def\@fs@mo + {\scaledfont\setmappedfontsize\localabsolutefontsize \setsamofontspec} -\def\setsamofontspec#1% +\def\setsamofontspec#1\relax {\checkfontscale#1\end\scaledfont - \scaledfont\dorelativefontsize\scaledfont - \edef\somefontspec - { at \ifautofontsize\currentfontbodyscale\fi\scaledfont}} + \scaledfont\localrelativefontsize\scaledfont + \ifautofontsize\scaledfont\currentfontbodyscale\scaledfont\fi + \edef\somefontspec{ at \the\scaledfont}} -\def\getfontparameters% +\def\getfontparameters {\expandafter\setfontparameter\@@fontdata,]=,} -\def\getglobalfontparameters% +\def\getglobalfontparameters {\expandafter\setglobalfontparameter\@@fontdata,]=,} \def\setfontparameter#1=#2,% @@ -1201,14 +1215,52 @@ \newif\ifskipfontcharacteristics \skipfontcharacteristicstrue -\def\donoparsefontspec#1% +%D When fontclasses are used, we define the font global, +%D since namespaces are used. Otherwise we parse the specs +%D each time. + +% wrong: this way we cannot set encoding etc +% +% \def\donoparsefontspec#1% +% {\edef\fontfile{\truefontname\somefontname}% +% \ifx\fontfile\s!unknown \let\fontfile\defaultfontfile \fi +% \edef\lastfontname{\fontfile\somefontspec}% +% \ifx\fontclass\empty\else\global\fi +% \expandafter\font\csname#1\endcsname\lastfontname\relax +% \relax} + +\def\donoparsefontspec % #1 == \cs {\edef\fontfile{\truefontname\somefontname}% \ifx\fontfile\s!unknown \let\fontfile\defaultfontfile \fi \edef\lastfontname{\fontfile\somefontspec}% - \ifx\fontclass\empty\else\global\fi - \expandafter\font\csname#1\endcsname\lastfontname\relax - %\the\everyfont - \relax} + \ifx\fontclass\empty + \expandafter\definefontlocal + \else + \expandafter\definefontglobal + \fi} % #1 == \cs + +\def\definefontlocal#1% + {\expandafter\font\csname#1\endcsname\lastfontname\relax} + +\def\definefontglobal#1% stores \somefontname=Mono and \fontfile=cmtt10 + {\expandafter\xdef\csname#1\endcsname + {\noexpand\csname#1:\endcsname + \noexpand\reactivatefont{\somefontname}{\fontfile}}% + \global\expandafter\font\csname#1:\endcsname\lastfontname} + +\def\reactivatefont#1%#2% + {\def\somefontname{#1}\def\fontfile}%{#2}} + +% can be handy for tracing purposes +% +% \def\reportfontdefinition +% {\bgroup +% \expanded{\infofont +% [\lastfontidentifier +% ->\newfontidentifier +% ->\fontname\csname\newfontidentifier\endcsname]}% +% \endgraf +% \egroup} %D An additional the second \type {\font} definition can %D prevent fuzzy font refs @@ -1291,7 +1343,7 @@ %D data: \type {\truefontdata{\truefontname{Lucida-Bright}}} %D \stopregels -\def\definefontsynonym% +\def\definefontsynonym {\dotripleempty\dodefinefontsynonym} \def\dodefinefontsynonym[#1][#2][#3]% @@ -1308,9 +1360,9 @@ \fi \fi} -\let\definefontfile\definefontsynonym % dedicated to Taco Hoekwater +\let\definefontfile\definefontsynonym % dedicated to Taco Hoekwater -\def\setupfontsynonym% +\def\setupfontsynonym {\dodoubleempty\dosetupfontsynonym} \def\dosetupfontsynonym[#1][#2]% @@ -1326,11 +1378,11 @@ \beginTEX -\def\truefontdata#1#2% +\def\truefontdata#1#2% {\expandafter\ifx\csname\??ff#1#2\endcsname\relax \expandafter\ifx\csname\??ff\fontclass#1\endcsname\relax \expandafter\ifx\csname\??ff#1\endcsname\relax - \expandafter\ifx\csname\??ff#2\endcsname\relax + \expandafter\ifx\csname\??ff#2\endcsname\relax \else % raw(key) \csname\??ff#2\endcsname @@ -1340,11 +1392,11 @@ \expandafter\truefontdata\csname\??ff#1\endcsname#2% \fi \else - % exp(palatino Regular) raw(key) + % exp(palatino Regular) raw(key) \expandafter\truefontdata\csname\??ff\fontclass#1\endcsname#2% \fi \else - % raw(Regular) raw(key) + % raw(Regular) raw(key) \csname\??ff#1#2\endcsname \fi} @@ -1365,10 +1417,10 @@ \def\truefontdata#1#2% {\ifcsname\??ff#1#2\endcsname - % raw(Regular) raw(key) + % raw(Regular) raw(key) \csname\??ff#1#2\endcsname \else\ifcsname\??ff\fontclass#1\endcsname - % exp(palatino Regular) raw(key) + % exp(palatino Regular) raw(key) \expandafter\truefontdata\csname\??ff\fontclass#1\endcsname#2% \else\ifcsname\??ff#1\endcsname % exp(Regular) raw(key) @@ -1479,13 +1531,55 @@ %D %D The implementation one looks familiar: -\def\definefont% - {\dodoubleargument\dodefinefont} - -\def\dodefinefont[#1][#2]% +% The simple implementation is: +% +% \def\definefont +% {\dodoubleargument\dodefinefont} +% +% \def\dodefinefont[#1][#2]% +% {\doifinstringelse{ }{#2} +% {\unexpanded\setvalue{#1}{\dododefinefont{#1}{#2}}} +% {\dodefinefont[#1][#2 sa 1]}} + +\def\definefont + {\dotripleempty\dodefinefont} + +\def\dodefinefont[#1][#2][#3]% [name][spec][1.6 | line=10pt | setup_id] {\doifinstringelse{ }{#2} - {\unexpanded\setvalue{#1}{\dododefinefont{#1}{#2}}} - {\dodefinefont[#1][#2 sa 1]}} + {\ifthirdargument + \unexpanded\setvalue{#1}{\redodefinefont{#1}{#2}{#3}}% + \else + \unexpanded\setvalue{#1}{\dododefinefont{#1}{#2}}% + \fi} +% {\definefont[#1][#2 sa 1][#3]}} + {\definefont[#1][#2 sa *][#3]}} + +%\def\redodefinefont#1#2#3% +% {\dododefinefont{#1}{#2}% +% \doifnumberelse{#3} +% {\stelinterliniein[#3]\stelspatieringin} +% {\doifassignmentelse{#3} +% {\stelinterliniein[#3]\stelspatieringin} +% {\setups[#3]}}} % so, we can have setups associated to fonts ! + +\def\redodefinefont#1#2#3% + {\dododefinefont{#1}{#2}% + \doifsetupselse{#3} + {\setups[#3]} % don't forget to document this ! + {\setuplocalinterlinespace[#3]% + \stelspatieringin}} % needed ? + +% \def\defineclassfont +% {\doquadrupleempty\dodefineclassfont} +% +% \def\dodefineclassfont[#1][#2][#3][#4]% #2 = class +% {\iffourthargument +% \definefont[#1][#2#3][#4]% +% %\else\ifthirdargument +% % \definefont[#1][#2#3]% +% \else +% \definefont[#1][#2]% +% \fi} %D The \type {*} makes the switch local, so that we can redefine a %D logical name and/or change the size in between. @@ -1499,9 +1593,10 @@ \def\dododefinefont#1#2% {\edef\lastfontidentifier{#1}% - \dosetrelativefontsize\lastfontidentifier + \let\localrelativefontsize\defaultrelativefontsize + \let\localabsolutefontsize\fontbody \parsefontspec{#2}\rawfontidentifier - \doresetrelativefontsize + \let\localrelativefontsize\defaultrelativefontsize % not needed \csname\rawfontidentifier\endcsname \autofontsizefalse \setfontcharacteristics @@ -1509,34 +1604,37 @@ \beginTEX -\def\xxdododefinefont#1#2% \autofontsizetrue is set by calling routine - {\edef\lastfontidentifier{#1}% +\def\xxdododefinefont#1#2#3#4% \autofontsizetrue is set by calling routine + {\edef\lastfontidentifier{#3}% \@EA\ifx\csname\newfontidentifier\endcsname\relax - \dosetrelativefontsize{\fontclass\lastfontidentifier}% dangerous with fallback - \parsefontspec{#2}\newfontidentifier - \doresetrelativefontsize + \def\localrelativefontsize{#1}% + \def\localabsolutefontsize{#2}% + \parsefontspec{#4}\newfontidentifier + \let\localrelativefontsize\defaultrelativefontsize % not needed \fi \csname\newfontidentifier\endcsname \autofontsizefalse - %\edef\lastfontidentifier{#1}% + %\edef\lastfontidentifier{#3}% \ifskipfontcharacteristics \else \setfontcharacteristics \the\everyfontswitch \fi} + \endTEX \beginETEX \ifcsname -\def\xxdododefinefont#1#2% \autofontsizetrue is set by calling routine - {\edef\lastfontidentifier{#1}% +\def\xxdododefinefont#1#2#3#4% \autofontsizetrue is set by calling routine + {\edef\lastfontidentifier{#3}% \ifcsname\newfontidentifier\endcsname\else - \dosetrelativefontsize{\fontclass\lastfontidentifier}% dangerous with fallback - \parsefontspec{#2}\newfontidentifier - \doresetrelativefontsize + \def\localrelativefontsize{#1}% + \def\localabsolutefontsize{#2}% + \parsefontspec{#4}\newfontidentifier + \let\localrelativefontsize\defaultrelativefontsize % not needed \fi \csname\newfontidentifier\endcsname \autofontsizefalse - %\edef\lastfontidentifier{#1}% + %\edef\lastfontidentifier{#3}% \ifskipfontcharacteristics \else \setfontcharacteristics \the\everyfontswitch @@ -1577,7 +1675,7 @@ %D \haalbuffer %D \stopopelkaar -\def\mapfontsize% +\def\mapfontsize {\dodoubleargument\domapfontsize} \def\domapfontsize[#1][#2]% @@ -1620,7 +1718,7 @@ \let\sizelist\empty -\def\definefontsize[#1]% +\def\definefontsize[#1]% sneller met toks {\addtocommalist{#1}\sizelist \def\docommando##1% {\def\dodocommando####1% @@ -1764,17 +1862,17 @@ \newcount\@@fontdefhack -\def\@@beginfontdef% +\def\@@beginfontdef {\ifcase\@@fontdefhack \let\k!savedtext \k!text \let\k!text \s!text - \let\k!k!savedtext \k!k!text \def\k!k!text {1}% + \let\k!k!savedtext \k!k!text \let\k!k!text \!!plusone \let\k!saveddefault \k!default \let\k!default \s!default - \let\k!k!saveddefault\k!k!default \def\k!k!default {1}% + \let\k!k!saveddefault\k!k!default \let\k!k!default \!!plusone \fi - \advance\@@fontdefhack 1 } + \advance\@@fontdefhack \plusone } -\def\@@endfontdef% - {\advance\@@fontdefhack -1 +\def\@@endfontdef + {\advance\@@fontdefhack \minusone \ifcase\@@fontdefhack \let\k!k!default\k!k!saveddefault \let\k!default \k!saveddefault @@ -1782,13 +1880,13 @@ \let\k!text \k!savedtext \fi} -\def\definebodyfontenvironment% +\def\definebodyfontenvironment {\dotripleempty\dodefinebodyfontenvironment} \def\dodefinebodyfontenvironment[#1][#2][#3]% class size settings {\ifthirdargument \@@beginfontdef - \doifelse{#2}{\s!default} + \doifelse{#2}\s!default {\getparameters[\??ft\s!default][#3]} {\normalizebodyfontsize#2\to\tempbodyfontsize \addtocommalist\tempbodyfontsize\bodyfontenvironmentlist @@ -1802,8 +1900,8 @@ {\@@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=\csname\??ft\s!default##1\endcsname\scratchdimen + {\scratchdimen#1\relax % typesetting the test (or so) + \scratchdimen\csname\??ft\s!default##1\endcsname\scratchdimen \normalizebodyfontsize\scratchdimen\to\tempbodyfontsize \setevalue{\??ft#2#1##1}{\tempbodyfontsize}}% \processcommalist @@ -1962,7 +2060,7 @@ %D user definitions like \type{\tfw} or \type{\bfq} for real %D large alternatives. -\def\definebodyfont% +\def\definebodyfont {\doquadrupleempty\redefinebodyfont} \def\redefinebodyfont[#1][#2][#3][#4]% @@ -1974,7 +2072,7 @@ \def\reredefinebodyfont[#1][#2][#3]#4% {\pushmacro\fontclass - \doifelse{#4}{\s!default} + \doifelse{#4}\s!default {\let\fontclass\empty} {\def\fontclass{#4}}% \definebodyfont[#1][#2][#3]% @@ -2000,26 +2098,12 @@ {\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]}% + \checkrelativefontsize{#2}% rather new, inherit from other defs \ifundefined{#2}\expanded{\definefontstyle[#2][#2]}\fi % new - \processcommalist[#1]{\dododefinebodyfont{#2}{#3}}} + \processcommalist[#1]{\dododefinebodyfont{#2}{#3}}% + \let\relativefontsize\defaultrelativefontsize} \def\dododefinebodyfont#1#2#3% style defs body {\checkbodyfontenvironment[#3]% just to be sure. @@ -2034,29 +2118,28 @@ \def\iflocalclassfonts{\ifx\fontclass\empty} -% \let\iflocalclassfonts\iffalse - \def\dododododefinebodyfont#1#2[#3#4#5=#6]% style body def {\ifundefined{#1#3#4#5}% \checkbodyfont{#2}{#1}{#3#4}{#5}% not \definefontsize[#5] \fi - \dostorerelativefontsize{\fontclass#2#1#3#4#5}% \iflocalclassfonts \letbeundefined{*\fontclass#2#1#3#4#5*}% - \unexpanded - \setvalue{#2#1#3#4#5}{\xxdododefinefont - {#2#1#3#4#5}{#6}}% + \scratchtoks{#6}% + \expanded{\unexpanded\noexpand\setvalue{#2#1#3#4#5}% + {\noexpand\xxdododefinefont{\relativefontsize}{#2}% + {#2#1#3#4#5}{\the\scratchtoks}}}% \else %\expanded{\writestatus{defining}{[\fontclass][#2#1#3#4#5] \resolvefontname#6 }}% \global\letbeundefined{*\fontclass#2#1#3#4#5*}% \ifresolvefontfile - \unexpanded - \setxvalue{\fontclass#2#1#3#4#5}{\noexpand\xxdododefinefont - {#2#1#3#4#5}{\resolvefontname#6 }}% + \unexpanded\setxvalue{\fontclass#2#1#3#4#5}% + {\noexpand\xxdododefinefont{\relativefontsize}{#2}% + {#2#1#3#4#5}{\resolvefontname#6 }}% \else - \unexpanded - \setgvalue{\fontclass#2#1#3#4#5}{\xxdododefinefont - {#2#1#3#4#5}{#6}}% + \scratchtoks{#6}% + \expanded{\unexpanded\noexpand\setgvalue{\fontclass#2#1#3#4#5}% + {\noexpand\xxdododefinefont{\relativefontsize}{#2}% + {#2#1#3#4#5}{\the\scratchtoks}}}% \fi \fi} @@ -2103,8 +2186,8 @@ \def\docommando##1% {\doifdefined{\??ft\s!default##1} {\donetrue - \scratchdimen=#1\relax - \scratchdimen=\csname\??ft\s!default##1\endcsname\scratchdimen + \scratchdimen#1\relax + \scratchdimen\csname\??ft\s!default##1\endcsname\scratchdimen \normalizebodyfontsize\scratchdimen\to\!!stringa \letvalue{\??ft#1##1}\!!stringa}}% \processcommalist @@ -2135,7 +2218,7 @@ \fi \fi \ifdone - \showmessage{\m!fonts}{14}{#1}% + \showmessage\m!fonts{14}{#1}% \fi \fi} @@ -2237,22 +2320,38 @@ \chardef\fontdigits=1 +% \def\donormalizedbodyfontsize#1.#2#3#4\to#5% +% {\edef#5% +% {#1% +% \ifcase\fontdigits\space +% \or +% \ifcase#2 \else.#2\fi % and not: \ifcase#2\else ... +% \else +% \ifcase#2#3 \else.#2\ifcase#3 \else#3\fi\fi % not: \ifcase#2#3\else ... +% \fi +% pt}} +% +% \def\normalizebodyfontsize#1\to#2% +% {\scratchdimen#1\relax +% \@EA\@EA\@EA\donormalizedbodyfontsize +% \@EA\WITHOUTPT\the\scratchdimen00\to#2} + +\def\normalizebodyfontsize#1\to#2% + {\scratchdimen#1\relax + \ifcase\fontdigits\advance\scratchdimen.5\s!pt\fi + \@EA\@EA\@EA\donormalizedbodyfontsize + \@EA\WITHOUTPT\the\scratchdimen00\to#2} + \def\donormalizedbodyfontsize#1.#2#3#4\to#5% {\edef#5% {#1% - \ifcase\fontdigits\space - \or + \ifcase\fontdigits\or \ifcase#2 \else.#2\fi % and not: \ifcase#2\else ... \else \ifcase#2#3 \else.#2\ifcase#3 \else#3\fi\fi % not: \ifcase#2#3\else ... \fi - pt}} - -\def\normalizebodyfontsize#1\to#2% - {\scratchdimen=#1\relax - \@EA\@EA\@EA\donormalizedbodyfontsize - \@EA\WITHOUTPT\the\scratchdimen00\to#2} - + \s!pt}} + \normalizebodyfontsize\bodyfontsize\to\normalizedglobalbodyfontsize \normalizebodyfontsize\bodyfontsize\to\normalizedlocalbodyfontsize \normalizebodyfontsize\bodyfontsize\to\normalizedbodyfontsize @@ -2277,9 +2376,13 @@ %D etc. is also available in a macro in \type{rm}, \type{ss} %D etc. form: -\let\fontalternative = \c!tf -\let\fontstyle = \empty -\let\fontsize = \empty +\let\defaultfontalternative = \c!tf +\let\defaultfontstyle = \empty +\let\defaultfontsize = \empty + +\let\fontalternative = \defaultfontalternative +\let\fontstyle = \defaultfontstyle +\let\fontsize = \defaultfontsize %D All things related to fonts are grouped into files with %D names like \type{font-cmr}. These files are loaded by: @@ -2296,11 +2399,11 @@ \fi \startreadingfile \readsysfile{\truefilename{\f!fontprefix#2}} - {\showmessage{\m!fonts}{2}{#2}} + {\showmessage\m!fonts2{#2}} {\makeshortfilename[\truefilename{\f!fontprefix#2}]% \readsysfile{\shortfilename} - {\showmessage{\m!fonts}{2}{#2}} - {\showmessage{\m!fonts}{3}{#2}}}% + {\showmessage\m!fonts2{#2}} + {\showmessage\m!fonts3{#2}}}% \stopreadingfile}} %D When \type {\loadfontfileoncetrue}, such files are @@ -2315,15 +2418,15 @@ {\expanded{\dodoswitchpoints{#1}}} \def\dodoswitchpoints#1% - {\doifundefined{\@size@#1} - {\defineunknownfont{#1}}% + {\doifundefined{\@size@#1} + {\defineunknownfont{#1}}% %\defineunknownfontstyles{#1}% \doifdefinedelse{\@size@#1} {\getvalue{\@size@#1}% \localbodyfontsize#1\relax \normalizebodyfontsize\localbodyfontsize\to\normalizedbodyfontsize \checkbodyfontenvironment[\normalizedbodyfontsize]} - {\showmessage{\m!fonts}{4}{#1}}} + {\showmessage\m!fonts4{#1}}} \unprotected \def\doswitchstyle[#1]% {\doifdefinedelse{\@style@#1} @@ -2331,7 +2434,7 @@ \edef\fontstyle{#1}% \ifmmode\mr\fi % in order to be compatible with \rm in math mode }% \the\everybodyfont} % cleaner, in setting size as well as style - {\showmessage{\m!fonts}{5}{#1}}} + {\showmessage\m!fonts5{#1}}} %D \TEX\ loads font metric files like \type{cmr10.tfm} and %D \type{tir.tfm} only once. In \PLAIN\ \TEX\ some font files @@ -2385,45 +2488,51 @@ %D macro relaxes itself and reset the signal. \def\preloadfonts% - {\showmessage{\m!fonts}{6}{\normalizedbodyfontsize\normalspace\fontstyle}% + {\showmessage\m!fonts6{\normalizedbodyfontsize\normalspace\fontstyle}% \global\loadingfontsfalse \doswitchpoints[\normalizedbodyfontsize]% \doswitchstyle[\fontstyle]% -\the\everybodyfont - \global\let\preloadfonts=\relax} + \the\everybodyfont + \global\let\preloadfonts\relax} %D Here comes the main font switching macros. These macros %D handle changes in size as well as returning to the global %D bodyfont size. \def\dosetfont#1#2% #1 = set/switch state - {\doifelse{#2}{\v!globaal} + {\doifelse{#2}\v!globaal {\restoreglobalbodyfont} {\processcommacommand[#2]{\dodosetfont{#1}}% ##1 get also passed \ifloadingfonts\else \doswitchpoints[\normalizedbodyfontsize]% \doswitchstyle[\fontstyle]% \fi}% - \chardef\currentxfontsize0\relax} + \chardef\currentxfontsize\zerocount} \def\dodosetfont#1#2% #1 = set/switch state - {\dododosetfont{#1}{#2}{\showmessage{\m!fonts}{4}{#2}}} + {\dododosetfont{#1}{#2}{\showmessage\m!fonts4{#2}}} \def\dododosetfont#1#2#3% #1 = set/switch state {\doifnumberelse{#2} - {\scratchdimen=#2\relax - \normalizebodyfontsize\scratchdimen\to\normalizedsetfont - \doifundefined{\@size@\normalizedsetfont} - {\defineunknownfont{#2}}% - \doifdefinedelse{\@size@\normalizedsetfont} - {\localbodyfontsize\normalizedsetfont - \let\normalizedbodyfontsize\normalizedsetfont} - {#3\dosetsubstitutefont{#1}{#2}}} - {\doifelse{#2}{\v!reset} - {\let\fontsize\empty} - {\doifdefinedelse{\@style@#2} - {\edef\fontstyle{#2}} - {\doreadfontdefinitionfile{#1}{#2}}}}} + {\dodododosetfont{#1}{#2}{#3}} + {\doifdefinedelse{\??ft\normalizedbodyfontsize\interfaced{#2}} + {\edef\fontstep{\bodyfontcsname\normalizedbodyfontsize\interfaced{#2}\endcsname}% + \expanded{\dodododosetfont{#1}{\fontstep}}{#3}} + {\doifelse{#2}\v!reset + {\let\fontsize\empty} + {\doifdefinedelse{\@style@#2} + {\edef\fontstyle{#2}} + {\doreadfontdefinitionfile{#1}{#2}}}}}} + +\def\dodododosetfont#1#2#3% #1 = set/switch state + {\scratchdimen#2\relax + \normalizebodyfontsize\scratchdimen\to\normalizedsetfont + \doifundefined{\@size@\normalizedsetfont} + {\defineunknownfont{#2}}% + \doifdefinedelse{\@size@\normalizedsetfont} + {\localbodyfontsize\normalizedsetfont + \let\normalizedbodyfontsize\normalizedsetfont} + {#3\dosetsubstitutefont{#1}{#2}}} %D In the previous macros we use \type{\currentxfontsize} to %D hold the current x||size of the font. This enables us to @@ -2440,10 +2549,10 @@ %D smaller than half a point, we can use the next method. \def\dosetsubstitutefont#1#2% #1 = set/switch state - {\scratchdimen=#2\relax - \advance\scratchdimen by .499pt + {\scratchdimen#2\relax + \advance\scratchdimen .499pt \dimensiontocount\scratchdimen\scratchcounter - \advance\scratchcounter by -1 + \advance\scratchcounter -1 \ifnum\scratchcounter>3 \dododosetfont{#1}{\the\scratchcounter pt}{}% \fi} @@ -2457,14 +2566,15 @@ % \let\fontalternative\empty % tf bf sl it bs bi sc ... % \let\fontsize \empty % xy-abcd ... -\def\fontbody{\normalizedbodyfontsize} +\def\defaultfontbody{\normalizedbodyfontsize} + +\let\fontbody\defaultfontbody \let\fontclass\empty \let\globalfontclass\fontclass \def\setcurrentfontclass#1% {\edef\fontclass{#1}} -\let\defaultfontbody \!!twelvepoint \let\defaultfontstyle \c!rm \let\defaultfontalternative \c!tf \let\defaultfontsize \empty @@ -2490,8 +2600,8 @@ \fi \to \everymath -\def\nobigmath{\chardef\synchronizebigmathflag =0 } -\def\bigmath {\chardef\synchronizebigmathflag =2 \synchronizebigmath} +\def\nobigmath{\chardef\synchronizebigmathflag 0 } +\def\bigmath {\chardef\synchronizebigmathflag 2 \synchronizebigmath} \let\bigmathfontsize\empty @@ -2677,7 +2787,7 @@ \beginTEX \def\dosetcurrentfontxxxalternative#1#2#3#4% - {\chardef\currentxfontsize#2 + {\chardef\currentxfontsize#2\relax \ifmmode #4% \else\expandafter\ifx\csname\bodyfontvariable{\normalizedbodyfontsize#3}\endcsname\relax\else @@ -2689,7 +2799,7 @@ \beginETEX \ifcsname \def\dosetcurrentfontxxxalternative#1#2#3#4% - {\chardef\currentxfontsize#2 + {\chardef\currentxfontsize#2\relax \ifmmode #4% \else\ifcsname\bodyfontvariable{\normalizedbodyfontsize#3}\endcsname @@ -2756,29 +2866,29 @@ \def\dodefinefontstyle[#1][#2]% {\rawdoifinsetelse{#2}{\stylelist} - {}%\debuggerinfo{\m!fonts}{unknown style #2}} + {}%\debuggerinfo\m!fonts{unknown style #2}} {\addtocommalist{#2}\stylelist - \showmessage{\m!fonts}{8}{#2 (#1)}}% + \showmessage\m!fonts8{#2 (#1)}}% % check kan hier \def\docommando##1% {\setvalue{\@shortstyle@##1}{#2}% \setvalue{\@style@##1}{\csname#2\endcsname}}% \processcommalist[#1]\docommando} -\def\definefontstyle% +\def\definefontstyle {\dodoubleargument\dodefinefontstyle} \def\setfontstyle#1#2% #1:name (roman, romaan) #2:style (rm) {\edef\fontstyle{#1}% - \setcurrentfontstyle{\normalizedbodyfontsize}} + \setcurrentfontstyle\normalizedbodyfontsize} \chardef\defaultskewcharmi='177 \chardef\defaultskewcharsy='60 \def\dosetskewchar#1% - %{\skewchar\font=\ifundefined{\purefontname\font\s!skewchar}% + %{\skewchar\font\ifundefined{\purefontname\font\s!skewchar}% % #1\else\csname\purefontname\font\s!skewchar\endcsname\fi} - {\skewchar\font=\ifx\@@fontskewchar\empty#1\else\@@fontskewchar\fi} + {\skewchar\font\ifx\@@fontskewchar\empty#1\else\@@fontskewchar\fi} %D The previous macros show that it's is not always %D neccessary to define the whole bunch of fonts, take for @@ -2871,8 +2981,7 @@ \unexpanded\def\switchtobodyfont[#1]% {\doifsomething{#1} {\doifdefinedelse{\??ft\normalizedbodyfontsize\interfaced{#1}} - {\doswitchpoints[\getvalue{\??ft\normalizedbodyfontsize\interfaced{#1}}]% - \doswitchstyle[\fontstyle]} + {\setbodyfontstep{#1}} % so we have a fast [small] switch {\dosetfont0{#1}}% \the\everybodyfont}} % indeed needed in case nothing is executed @@ -2882,10 +2991,10 @@ \beginTEX \def\fastswitchtobodyfont#1% - {\ifcsname\??ft\normalizedbodyfontsize#1\endcsname + {\@EA\ifx\csname\??ft\normalizedbodyfontsize#1\endcsname\else \edef\futurebodyfontsize {\csname\??ft\normalizedbodyfontsize#1\endcsname}% - \ifcsname\@size@\futurebodyfontsize\endcsname + \@EA\ifx\csname\@size@\futurebodyfontsize\endcsname\else \csname\@size@\futurebodyfontsize\endcsname \localbodyfontsize\futurebodyfontsize\relax \fi @@ -2926,21 +3035,21 @@ \def\domffam#1% {\csname\ifundefined{#1\s!fam}\c!nn\else#1\fi\s!fam\endcsname} -\def\mffam% +\def\mffam {\domffam\fontalternative} -\def\dosetmathfont% +\def\dosetmathfont {\def\rm{\fam\mrfam}\dodosetmathfont} %D The font specific features are bound to the filename. -\def\updatefontparameters% +\def\updatefontparameters {\edef\@@fontencoding{\truefontdata\fontfile \s!encoding}% \edef\@@fontmapping {\truefontdata\fontfile \s!mapping }% \edef\@@fonthandling{\truefontdata\somefontname\s!handling}% \edef\@@fontskewchar{\truefontdata\fontfile \s!skewchar}} -\def\setfontcharacteristics% +\def\setfontcharacteristics {\updatefontparameters \fastenableencoding {\ifx\@@fontencoding\empty @@ -3006,26 +3115,35 @@ %D {frak, goth, cal} %D %D On behalf of {\frac Tobias Burnus}, we define some more of -%D these: +%D these. Later we will link these names to real file names. -\definefont [frak] [Fraktur sa *] % \currentfontscale] -\definefont [goth] [Gothic sa *] % \currentfontscale] -\definefont [cal] [Calligraphic sa *] % \currentfontscale] +\definefont [frak] [Fraktur sa *] +\definefont [goth] [Gothic sa *] +\definefont [cal] [Calligraphic sa *] +\definefont [bbd] [Blackboard sa *] \definefontsynonym [Fraktur] [Serif] \definefontsynonym [Gothic] [Serif] \definefontsynonym [Calligraphic] [Serif] +\definefontsynonym [Blackboard] [Serif] %D \macros -%D {fraktur, gothic, calligraphic} +%D {fraktur, gothic, calligraphic, blackboard} %D -%D For Tobias and friends: +%D These macros assume that we use text fonts, and not math +%D families. + +% \def\fraktur #1{\mathematics{\frak#1}} +% \def\gothic #1{\mathematics{\goth#1}} +% \def\calligraphic#1{\mathematics{\cal #1}} +% \def\blackboard #1{\mathematics{\bbd #1}} -\def\fraktur #1{\ifmmode\hbox\fi{\frak#1}} -\def\gothic #1{\ifmmode\hbox\fi{\goth#1}} -\def\calligraphic#1{\ifmmode\hbox\fi{\cal #1}} +\ifx\mathtext\undefined \let\mathtext\hbox \fi -%D In \type {font-cmr} we will link these to real file names. +\def\fraktur #1{\mathortext\mathtext\donothing{\frak#1}} +\def\gothic #1{\mathortext\mathtext\donothing{\goth#1}} +\def\caligraphic#1{\mathortext\mathtext\donothing{\cal #1}} +\def\blackboard #1{\mathortext\mathtext\donothing{\bbd #1}} %D \macros %D {definebodyfontswitch} @@ -3058,16 +3176,15 @@ %D The three alternatives can be activated by the next three %D system calls and are defined by the bodyfontenvironment. -\let\fontstep\empty +\let\fontstep\empty % we can use \fontstep for tracing purposes \def\setbodyfontstep#1% - {\edef\fontstep{\bodyfontcsname\normalizedbodyfontsize\interfaced#1\endcsname}% + {\edef\fontstep{\bodyfontcsname\normalizedbodyfontsize\interfaced{#1}\endcsname}% \doswitchpoints[\fontstep]% - \doswitchstyle[\fontstyle]% - \the\everybodyfont} + \doswitchstyle[\fontstyle]} -\unexpanded\def\setsmallbodyfont{\setbodyfontstep\v!klein} -\unexpanded\def\setbigbodyfont {\setbodyfontstep\v!groot} +\unexpanded\def\setsmallbodyfont{\setbodyfontstep\v!klein\the\everybodyfont} +\unexpanded\def\setbigbodyfont {\setbodyfontstep\v!groot\the\everybodyfont} \unexpanded\def\setmainbodyfont% {\doswitchpoints[\normalizedbodyfontsize]% @@ -3085,7 +3202,9 @@ \let\mainfontclass\empty \def\fullrestoreglobalbodyfont - {\let\fontsize\empty + {\let\fontsize\defaultfontsize + \let\fontbody\defaultfontbody + \chardef\currentxfontsize\zerocount \let\fontclass\globalfontclass \doswitchpoints[\normalizedglobalbodyfontsize]% \doswitchstyle[\globalfontstyle]% @@ -3093,7 +3212,9 @@ \tf \the\everybodyfont} \def\partialrestoreglobalbodyfont - {\let\fontsize\empty + {\let\fontsize\defaultfontsize + \let\fontbody\defaultfontbody + \chardef\currentxfontsize\zerocount \redoconvertfont \tf} @@ -3255,10 +3376,10 @@ %D Extras: -\unexpanded\def\dontconvertfont% +\unexpanded\def\dontconvertfont {\let\doconvertfont\noconvertfont} -\unexpanded\def\redoconvertfont% +\unexpanded\def\redoconvertfont {\let\doconvertfont\dodoconvertfont} %D These commands are not grouped! Grouping is most probably @@ -3302,7 +3423,7 @@ \newconditional\emneeded -\unexpanded\def\em% +\unexpanded\def\em {\relax \ifdim\fontdimen1\font>\zeropoint \settrue\emneeded @@ -3332,10 +3453,10 @@ %D The next feature was not present in previous versions. It %D takes care of \type {\em \bf ...} sitiations. -\def\setemphasisboldface% +\def\setemphasisboldface {\let\normalbf\bf \let\setemphasisboldface\relax - \unexpanded\def\bf% + \unexpanded\def\bf {%\relax \let\bf\relax % new \ifx\fontalternative\c!it % \ifnum\fam=\itfam @@ -3352,36 +3473,36 @@ %D look for something that looks like a dash, in which case we %D don't correct. -\def\emphasiscorrection% +\def\emphasiscorrection {\ifhmode \expandafter\emphasislook \fi} -\def\emphasislook% +\def\emphasislook {\begingroup \beginrobusttest \futurelet\next\emphasistest} -\def\emphasistest% +\def\emphasistest {\normalifcat\noexpand\next,% \endrobusttest\expandafter\doemphasiscorrection \normalelse \endrobusttest\expandafter\dododoemphasiscorrection \normalfi} -\def\doemphasiscorrection% +\def\doemphasiscorrection {\futurelet\next\dodoemphasiscorrection} -\def\dodoemphasiscorrection% - {\setbox\scratchbox=\hbox{\next}% +\def\dodoemphasiscorrection + {\setbox\scratchbox\hbox{\next}% \ifdim\ht\scratchbox<.3ex \expandafter\endgroup \else \expandafter\dododoemphasiscorrection \fi} -\def\dododoemphasiscorrection% - {\scratchskip=\lastskip +\def\dododoemphasiscorrection + {\scratchskip\lastskip \ifdim\scratchskip=\zeropoint\relax \/\relax \else @@ -3481,7 +3602,20 @@ %D The implementation is rather straightforward in using %D \type{\halign}. -\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run} +\fetchruntimecommand \showbodyfont {\f!fontprefix\s!run} + +%D \macros +%D {showfontstrip, testminimalbaseline, showminimalbaseline} +%D +%D The next command can come in handy when combining +%D different fonts into a collection (typeface) and +%D determining optimal baseline distances. +%D +%D \showfontstrip \blank \showminimalbaseline + +\fetchruntimecommand \showfontstrip {\f!fontprefix\s!run} +\fetchruntimecommand \testminimalbaseline {\f!fontprefix\s!run} +\fetchruntimecommand \showminimalbaseline {\f!fontprefix\s!run} %D \macros %D {showbodyfontenvironment} @@ -3607,12 +3741,12 @@ \currentfontbodyscale\scaledfont \definedfont} -\def\getglyph#1#2% slow, faster, much faster +\unexpanded\def\getglyph#1#2% slow, faster, much faster %{{\definefont[\s!dummy][\glyphfontfile{#1} sa \currentfontscale]\dummy#2}} %{{\definefont[\s!dummy][\glyphfontfile{#1} sa *]\dummy#2}} {{\symbolicfont{#1}#2}} -\def\getrawglyph#1#2% for simple symbols +\unexpanded\def\getrawglyph#1#2% for simple symbols {{\scaledfont\fontbody \font\definedfont=#1 at \currentfontbodyscale\scaledfont \definedfont#2}} @@ -3660,8 +3794,8 @@ \def\bordermatrix% {\bgroup - \setbox0=\hbox{\getvalue{\textface\c!mm\c!ex}B}% - \global\p@renwd=\wd0\relax + \setbox0\hbox{\getvalue{\textface\c!mm\c!ex}B}% + \global\p@renwd\wd0\relax \egroup \normalbordermatrix} @@ -3722,8 +3856,8 @@ {\dontleavehmode \bgroup \setbox\scratchbox\hbox{#1}% - \ifdim\ht\scratchbox>\strutheight \ht\scratchbox\strutheight \fi - \ifdim\dp\scratchbox>\strutdepth \dp\scratchbox\strutdepth \fi + \ifdim\ht\scratchbox>\strutheight\relax\ht\scratchbox\strutheight\fi + \ifdim\dp\scratchbox>\strutdepth \relax\dp\scratchbox\strutdepth \fi \box\scratchbox \egroup} @@ -3760,8 +3894,8 @@ \def\moveaccent#1#2% {\smashaccent - {\dimen0=\fontdimen5\font - \dimen2=\dimen0 + {\dimen0\fontdimen5\font + \dimen2\dimen0 \advance\dimen2 -#1% \fontdimen5\font\dimen2 #2\relax diff --git a/tex/context/base/font-run.tex b/tex/context/base/font-run.tex index 0770b5d98..dd13fea2b 100644 --- a/tex/context/base/font-run.tex +++ b/tex/context/base/font-run.tex @@ -66,7 +66,7 @@ \noalign{\hrule}}} \ifinsidefloat\else\stopbaselinecorrection\fi} -\gdef\showbodyfontenvironment% +\gdef\showbodyfontenvironment {\dosingleempty\doshowbodyfontenvironment} \gdef\doshowbodyfontenvironment[#1]% @@ -235,4 +235,66 @@ \stoptabulate \egroup} +\gdef\showfontstrip + {\dosingleempty\doshowfontstrip} + +\gdef\doshowfontstrip[#1]% + {\bgroup + \def\dofontstripa##1##2% + {\tttf\string##1} + \def\dofontstripb##1##2% + {\ruledhbox{\switchtobodyfont[#1]##1{##2}}} + \def\dofontstripc##1##2% + {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}% + \tt\tfx\the\ht\scratchbox}% + \def\dofontstripd##1##2% + {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}% + \tt\tfx\the\wd\scratchbox}% + \def\fontstrip##1##2##3% + {\NC##2\rm{##3}\NC + ##2\ss{##3}\NC + ##2\tt{##3}\NC + ##2\mathematics{##3}\NC + \tttf##1\NR} + \starttabulate[|c|c|c|c|c|] + \fontstrip\relax\dofontstripa\empty + \TB + \fontstrip\relax\dofontstripb{xxxx} + \fontstrip\relax\dofontstripb{12345} + \fontstrip\relax\dofontstripb{(Agw)} + \TB + \fontstrip{(x height)}\dofontstripc{x} + \fontstrip{(m width)}\dofontstripd{m} + \stoptabulate + \egroup} + +\ifx\databox\undefined \newbox\databox \fi + +\gdef\testminimalbaseline#1% + {\setbox\databox\ruledhbox{#1}% + \scratchdimen\ht\databox + \advance\scratchdimen\dp\databox + \scratchtoks{#1}% + \expanded + {\NC \ruledhbox{\the\scratchtoks} + \noexpand \NC -> + \noexpand \NC \the\scratchdimen + \noexpand \NC = + \noexpand \NC \the\ht\databox + \noexpand \NC + + \noexpand \NC \the\dp\databox + \noexpand \NC \ifdim\scratchdimen<\baselineskip < + \else\ifdim\scratchdimen=\baselineskip = + \else > \fi\fi + \noexpand \NC \the\baselineskip + \noexpand \NC (\ifdim\scratchdimen>\baselineskip not \fi ok) + \noexpand \NC \noexpand \NR }} + +\gdef\showminimalbaseline + {\starttabulate[||T|T|T|T|T|T|T|T|T|] + \testminimalbaseline{\hbox to 1em{\hss\showstruts\strut\hss}}% + \testminimalbaseline{(/)}% + \testminimalbaseline{$\frac{1}{2}x^2_3$} + \stoptabulate} + \protect \endinput diff --git a/tex/context/base/font-uni.tex b/tex/context/base/font-uni.tex index 633383544..a114c0882 100644 --- a/tex/context/base/font-uni.tex +++ b/tex/context/base/font-uni.tex @@ -92,7 +92,7 @@ %D finally does some finishing: %D %D \starttyping -%D \def\handleunicodeglyph% +%D \def\handleunicodeglyph %D {take actions based on \unicodeone-two-position cq. \nextglyph %D redefine \unicodecharcommand if needed %D expand \insertunicodeglyph @@ -137,18 +137,36 @@ %D token, since this token can have any value and any %D catcode. -\def\handleunicodeflowglyph#1% +%\def\handleunicodeflowglyph#1% +% {\bgroup +% \edef\unicodeone{#1}% +% \@EA\afterassignment\@EA\dohandleunicodeflowglyph +% \@EA\chardef\@EA\nexttoken\@EA`\string} +% +%\def\dohandleunicodeflowglyph +% {\futurelet\nextglyph\dodohandleunicodeflowglyph} +% +%\def\dodohandleunicodeflowglyph% +% {\edef\unicodetwo{\the\nexttoken}% +% \unicodeposition\unicodeone\unicodetwo\relax +% \handleunicodeglyph +% \egroup} + +% the \relax trick prevents eating up the space (needed for +% korean + +\def\handleunicodeflowglyph#1#2% {\bgroup \edef\unicodeone{#1}% \@EA\afterassignment\@EA\dohandleunicodeflowglyph - \@EA\chardef\@EA\nexttoken\@EA=\@EA`\string} + \@EA\chardef\@EA\nexttoken\@EA`\string#2\relax} -\def\dohandleunicodeflowglyph% +\def\dohandleunicodeflowglyph\relax {\futurelet\nextglyph\dodohandleunicodeflowglyph} -\def\dodohandleunicodeflowglyph% - {\edef\unicodetwo{\the\nexttoken}% - \unicodeposition=\unicodeone\unicodetwo\relax +\def\dodohandleunicodeflowglyph + {\edef\unicodetwo{\the\nexttoken}% + \unicodeposition\unicodeone\unicodetwo\relax \handleunicodeglyph \egroup} @@ -157,12 +175,14 @@ \let\nextglyph\relax \edef\unicodeone{#1}% \edef\unicodetwo{#2}% - \unicodeposition=\unicodeone\unicodetwo\relax +% \unicodeposition=\unicodeone\unicodetwo\relax + \unicodeposition\unicodeone\unicodetwo\relax \handleunicodeglyph \egroup} -\def\dohandleucflowglyph% - {\unicodeposition=\unicodeone\unicodetwo\relax +\def\dohandleucflowglyph +% {\unicodeposition=\unicodeone\unicodetwo\relax + {\unicodeposition\unicodeone\unicodetwo\relax \handleunicodeglyph \egroup} @@ -214,7 +234,7 @@ % else % { return "$a$b" } } -\def\insertunicodeglyph% +\def\insertunicodeglyph {\unicodeglyph\unicodeone\unicodetwo} \let\handleunicodeglyph=\insertunicodeglyph @@ -265,7 +285,7 @@ %D The command \type {\unicodecharcommand} can be used to %D handle special cases. At that moment \type {1em} is known. -\def\unicodestyle% +\def\unicodestyle {\truefontname\s!Unicode\fontstylesuffix} \let\unicodecharcommand\firstofoneargument @@ -281,7 +301,7 @@ \unexpanded\def\unicodeglyph#1#2% watch the double mapping {\bgroup \getvalue{@@\currentucharmapping\strippedcsname\uchar}{#1}{#2}% - \bodyfontsize=\unicodescale\bodyfontsize + \bodyfontsize\unicodescale\bodyfontsize \font\unicodefont=\truefontname{\truefontname\unicodestyle\unicodeone} at \currentfontscale\bodyfontsize \unicodestrut\unicodefont\unicodecharcommand{\char\unicodetwo\relax}% @@ -318,7 +338,7 @@ %D This maps the GBK vector onto a compact GBK one. The %D auxiliary macro is defined here as a goody. -\def\dorepositionunicode% +\def\dorepositionunicode {\DoDiv\unicodeposition by256to\scratchcounter \advance\scratchcounter 1 \edef\unicodeone{\ifnum\scratchcounter<10 0\fi\the\scratchcounter}% @@ -350,17 +370,17 @@ {\def\unicodescale{#1}} \def\dosetunicodestrut#1#2% height depth - {\def\unicodestrut% + {\def\unicodestrut {\vrule - \!!width\!!zeropoint + \!!width\zeropoint \!!height#1\ht\strutbox \!!depth#2\dp\strutbox \relax}} \def\setunicodestrut#1#2% height depth - {\ifdim#1\ht\strutbox>\!!zeropoint + {\ifdim#1\ht\strutbox>\zeropoint \dosetunicodestrut{#1}{#2}% - \else\ifdim#1\dp\strutbox>\!!zeropoint + \else\ifdim#1\dp\strutbox>\zeropoint \dosetunicodestrut{#1}{#2}% \else \let\unicodestrut\empty @@ -413,8 +433,8 @@ \beginTEX - \def\unicodeTEXwarning% - {\writeline\showmessage{\m!fonts}{21}{}\writeline + \def\unicodeTEXwarning + {\writeline\showmessage\m!fonts{21}\empty\writeline \global\let\unicodeTEXwarning\relax} \endTEX @@ -426,17 +446,19 @@ \endETEX -\def\defineunicodefont% +\def\defineunicodefont {\dotripleempty\dodefineunicodefont} \def\dodefineunicodefont[#1][#2][#3]% {\unicodeTEXwarning - \doifinstringelse{=}{#3} + \doifassignmentelse{#3} {\setupunicodefont[#1][#3]} - {\copyparameters - [\??uc#1][\??uc#3] - [\c!hoogte,\c!diepte,\c!schaal,\c!commandos, - \c!interlinie,\c!commando,\c!conversie]}% + {\doifelsenothing{#3} + {\setupunicodefont[#1][#3]} + {\copyparameters + [\??uc#1][\??uc#3] + [\c!hoogte,\c!diepte,\c!schaal,\c!commandos, + \c!interlinie,\c!commando,\c!conversie]}}% \doifelsenothing{#2} {\setvalue{#1}{[uc font #1 undefined]}} {\setvalue{\??uc#1\c!file}{#2}% @@ -448,10 +470,10 @@ \definefontsynonym[#2\s!BoldItalic] [#2\s!Italic]}% \unexpanded\setvalue{#1}{\enableunicodefont{#1}}}} -\def\setupunicodefont% +\def\setupunicodefont {\dodoubleempty\dosetupunicodefont} -\def\dosetupunicodefont[#1][#2]% +\def\dosetupunicodefont[#1][#2]% also predefines {\doifundefined{\??uc#1\c!commando} {\copyparameters [\??uc#1][\??uc\s!default] @@ -467,8 +489,7 @@ \def\unicodedigits {\getvalue{\??uc#1\c!conversie}}% \def\handleunicodeglyph {\getvalue{\??uc#1\c!commando}}% \enableregime[unicode]% - \doifvalue{\??uc#1\c!interlinie}{\v!ja} - {\stelinterliniein\relax}% + \doifvalue{\??uc#1\c!interlinie}\v!ja{\stelinterliniein\relax}% \getvalue{\??uc#1\c!commandos}\relax} %D \macros diff --git a/tex/context/base/font-unk.tex b/tex/context/base/font-unk.tex index 2f2cf1695..993fd5c92 100644 --- a/tex/context/base/font-unk.tex +++ b/tex/context/base/font-unk.tex @@ -140,8 +140,7 @@ mc=MathGamma mo 1, md=MathDelta mo 1] -\definebodyfont - [boldmath] [mm] +\definebodyfont [bfmath] [mm] [mrbf=MathRomanBold mo 1, exbf=MathExtensionBold mo 1, mibf=MathItalicBold mo 1, diff --git a/tex/context/base/java-fld.tex b/tex/context/base/java-fld.tex index 4074cb2b5..37175f84e 100644 --- a/tex/context/base/java-fld.tex +++ b/tex/context/base/java-fld.tex @@ -144,7 +144,7 @@ function Hide_Field ( Name ) v.readonly = true ; this.dirty = false } } -function Do_Vide_Field ( Name,Closable ) +function Do_Vide_Field ( Name, Closable ) { var v = this.getField(Name) ; if (v) { ++visible_fields ; diff --git a/tex/context/base/java-ini.tex b/tex/context/base/java-ini.tex index 666a1c89e..85f4a8876 100644 --- a/tex/context/base/java-ini.tex +++ b/tex/context/base/java-ini.tex @@ -200,16 +200,15 @@ %D \stopJScode %D \stoptypen -\long\gdef\startJScode#1 #2 +\long\def\startJScode#1 #2 {\doifelse{#2}{uses} - {\def\next{\dostartJScodeA{#1}}} - {\def\next{\dostartJScodeB{#1} #2 }}% - \next} + {\dostartJScodeA{#1}} + {\dostartJScodeB{#1} #2 }} -\long\gdef\dostartJScodeA#1#2 #3\stopJScode% +\long\def\dostartJScodeA#1#2 #3\stopJScode {\long\setgvalue{\r!java#1}{\do{#2}{#3}}} -\long\gdef\dostartJScodeB#1#2\stopJScode% +\long\def\dostartJScodeB#1#2\stopJScode {\long\setgvalue{\r!java#1}{\do{}{#2}}} \let\stopJScode\relax @@ -232,7 +231,7 @@ \def\setverbosecscharacter#1% {\edef#1{\string#1}} -\def\setverbosecscharacters% temporary hack +\def\setverbosecscharacters % temporary hack {\setverbosecscharacter |\setverbosecscharacter ~% \setverbosecscharacter\:\setverbosecscharacter\;% \setverbosecscharacter\+\setverbosecscharacter\-% @@ -251,10 +250,10 @@ \def\presetJScode#1#2% #1=operation #2=arguments {\setverbosecscharacters \def\par{\delcharacter}% was: { } - \scratchcounter=0 - \global\let\JScode=\empty + \scratchcounter\zerocount + \globallet\JScode\empty \def\do##1##2% - {\doifelse{##2}{!}{\directJScodetrue}{\directJScodefalse}}% + {\doifelse{##2}{!}\directJScodetrue\directJScodefalse}% \getvalue{\r!java#1}% \edef\!!stringa{#2}% \ifx\!!stringa\empty \else @@ -262,7 +261,7 @@ \fi \def\docommando##1% {\doifundefinedelse{\r!java\r!java##1} - {\showmessage{\m!javascript}{2}{##1}} + {\showmessage\m!javascript2{##1}} {\useJSpreamblenow{##1}}}% % {\doglobal\increment\currentJSpreamble % \doglobal\addtocommalist{##1}\allJSpreambles}}% @@ -273,20 +272,17 @@ \getvalue{\r!java#1}} \def\dopresetJSvariables#1% - {\advance\scratchcounter 1 + {\advance\scratchcounter \plusone \donefalse \dodopresetJSvariables#1\end}% -\def\dodopresetJSvariables% - {\doifnextcharelse{R} - {\dodopresetJSrefvariables} - {\doifnextcharelse{V} - {\dodopresetJSvervariables} - {\doifnextcharelse{S} - {\dodopresetJSstrvariables} - {\dodopresetJSrawvariables}}}} +\def\dodopresetJSvariables + {\doifnextcharelse{R}\dodopresetJSrefvariables + {\doifnextcharelse{V}\dodopresetJSvervariables + {\doifnextcharelse{S}\dodopresetJSstrvariables + \dodopresetJSrawvariables}}} -\def\dodopresetJSrefvariables R#1\end% +\def\dodopresetJSrefvariables R#1\end {\doifreferencefoundelse{#1} {\donetrue \dododopresetJSvariables R{\referenceprefix#1}% \donefalse\dododopresetJSvariables P{\currentrealreference}} @@ -295,16 +291,16 @@ \donetrue\dododopresetJSvariables S{#1}% \fi} -\def\dodopresetJSvervariables V#1\end% +\def\dodopresetJSvervariables V#1\end {\donefalse\dododopresetJSvariables V{#1}% \ifminimalizeJScode \else \donetrue\dododopresetJSvariables S{#1}% \fi} -\def\dodopresetJSstrvariables S#1\end% +\def\dodopresetJSstrvariables S#1\end {\donetrue\dododopresetJSvariables S{#1}} -\def\dodopresetJSrawvariables #1\end% +\def\dodopresetJSrawvariables #1\end {\donetrue\dododopresetJSvariables S{#1}} \def\JSprefix#1% @@ -363,17 +359,16 @@ {\bgroup % we need to restore the catcodes \popendofline % just in case it happens while reading lists \doifelse{#2}{used} - {\def\next{\dostartJSpreamble#1 }} - {\def\next{\dostartJSpreamble#1 now #2 }}% - \next} + {\dostartJSpreamble#1 } + {\dostartJSpreamble#1 now #2 }} \long\def\dostartJSpreamble#1 #2 #3\stopJSpreamble% {\processaction [#2] - [ later=>\chardef\JSstatus=0, - now=>\chardef\JSstatus=1, - \s!default=>\chardef\JSstatus=2, - \s!unknown=>\chardef\JSstatus=2]% + [ later=>\chardef\JSstatus0,% + now=>\chardef\JSstatus1,% + \s!default=>\chardef\JSstatus2,% + \s!unknown=>\chardef\JSstatus2]% \presetJSfunctions #3function ()\end \long\setgvalue{\r!java\r!java#1}{#3}% \ifcase\JSstatus \else @@ -425,12 +420,12 @@ \def\getJSpreamble#1% {\getvalue{\r!java\r!java#1}} -\def\presetJSpreamble% +\def\presetJSpreamble {\ifx\allJSpreambles\empty\else \bgroup \setverbosecscharacters \def\par{\delcharacter}% was: { } - \global\let\JSpreamble=\empty + \globallet\JSpreamble\empty \def\@@collectedJSpreamble{\r!java\r!java collected}% \letvalue{\@@collectedJSpreamble}=\empty \def\docommando##1% @@ -446,18 +441,18 @@ \ifoneJSpreamble \gdef\allJSpreambles{collected}% \fi - \global\let\presetJSpreamble\relax + \globallet\presetJSpreamble\relax \egroup \fi} -\def\flushJSpreamble% +\def\flushJSpreamble {\iflocation\ifx\allJSpreambles\empty\else \ifcase\nofJSpreambles\else\ifnum\nofJSpreambles=\currentJSpreamble \bgroup \presetJSpreamble \expanded{\doflushJSpreamble{\allJSpreambles}}% - \global\let\flushJSpreamble\relax - \global\let\allJSpreambles\empty + \globallet\flushJSpreamble\relax + \globallet\allJSpreambles\empty \egroup \fi\fi \fi\fi} @@ -467,7 +462,7 @@ \flushJSpreamble \ifcase\currentJSpreamble\relax\else \savecurrentvalue\nofJSpreambles\currentJSpreamble - \global\let\currentJSpreamble\nofJSpreambles + \globallet\currentJSpreamble\nofJSpreambles \fi \fi} @@ -484,7 +479,7 @@ \def\doPSsanitizeJScode#1\to#2% {\begingroup - \scratchcounter=0 % \aftergroup counter + \scratchcounter\zerocount % \aftergroup counter \aftergroup\xdef \aftergroup#2% \aftergroup{% @@ -526,15 +521,15 @@ \newif\ifaddJSlinebreaks -\def\flushJSisTEX% +\def\flushJSisTEX {\ifcase\JSisTEX \or \aftergroup T% \or \aftergroup T\aftergroup E% \or \aftergroup T\aftergroup E\aftergroup X% \fi - \chardef\JSisTEX=0 } + \chardef\JSisTEX0 } -\def\doJSlinebreak% +\def\doJSlinebreak {\ifaddJSlinebreaks \aftergroup\string\aftergroup\n% \fi} @@ -542,18 +537,18 @@ \def\dodoPSsanitizeJScode#1% % input stack>500 & TEX check {\if#1/% \ifnum\JScomment=0 - \chardef\JScomment=1 + \chardef\JScomment1 \else\ifnum\JScomment=1 - \chardef\JScomment=2 + \chardef\JScomment2 \fi\fi \else \ifnum\JScomment=1 \aftergroup/% - \chardef\JScomment=0 + \chardef\JScomment0 \fi \ifnum\JScomment=2 \if#1\delcharacter - \chardef\JScomment=0 + \chardef\JScomment0 \fi \else \if#1\delcharacter @@ -565,13 +560,13 @@ \else\if#1;% \flushJSisTEX\aftergroup;\doJSlinebreak \else\if#1T% - \ifnum\JSisTEX=0 \chardef\JSisTEX=1 \else\flushJSisTEX\aftergroup T\fi + \ifnum\JSisTEX=0 \chardef\JSisTEX1 \else\flushJSisTEX\aftergroup T\fi \else\if#1E% - \ifnum\JSisTEX=1 \chardef\JSisTEX=2 \else\flushJSisTEX\aftergroup E\fi + \ifnum\JSisTEX=1 \chardef\JSisTEX2 \else\flushJSisTEX\aftergroup E\fi \else\if#1X% - \ifnum\JSisTEX=2 \chardef\JSisTEX=3 \else\flushJSisTEX\aftergroup X\fi + \ifnum\JSisTEX=2 \chardef\JSisTEX3 \else\flushJSisTEX\aftergroup X\fi \else\if#1\normalspace - \ifnum\JSisTEX=3 \chardef\JSisTEX=0 \else\flushJSisTEX\aftergroup#1\fi + \ifnum\JSisTEX=3 \chardef\JSisTEX0 \else\flushJSisTEX\aftergroup#1\fi \else \flushJSisTEX\aftergroup\string\expandafter\aftergroup#1% \fi\fi\fi\fi\fi\fi\fi\fi @@ -589,15 +584,15 @@ %\beginTEX -\def\dododoPSsanitizeJScode% +\def\dododoPSsanitizeJScode {\ifcase\JSisTEX\ifcase\JScomment - \advance\scratchcounter by 1 + \advance\scratchcounter \plusone \fi\fi \ifnum\scratchcounter=500 \expandafter\dodododoPSsanitizeJScode \fi} -\def\dodododoPSsanitizeJScode% +\def\dodododoPSsanitizeJScode {\let\next={% \aftergroup}% \endgroup @@ -631,19 +626,19 @@ \definespeciallocation{JS}#1#2% {\iflocation \bgroup -\bgroup - \presetJScode - \currentreferenceoperation - \currentreferencearguments -\egroup - \dostartgoto - \data - {#2}% - \start - \dostartgotoJS\buttonwidth\buttonheight\JScode - \stop - \dostopgotoJS - \dostopgoto + \bgroup + \presetJScode + \currentreferenceoperation + \currentreferencearguments + \egroup + \dostartgoto + \data + {#2}% + \start + \dostartgotoJS\buttonwidth\buttonheight\JScode + \stop + \dostopgotoJS + \dostopgoto \egroup \else {#2}% @@ -665,26 +660,23 @@ %D The not so complicated implementation of this macro is: \def\dodouseJSscripts#1% - {\doifelse{#1}{\v!reset} - {\let\allJSpreambles=\empty} + {\doifelse{#1}\v!reset + {\let\allJSpreambles\empty} {\doifundefined{\c!file\f!javascriptprefix#1} - {\bgroup - \setbox0=\hbox % forget spaces and worse - {\setgvalue{\c!file\f!javascriptprefix#1}{}% - \makeshortfilename[\f!javascriptprefix#1]% - \showmessage{\m!javascript}{1}{#1}% - \startreadingfile - \readsysfile{\shortfilename}{}{}% - \stopreadingfile}% - \egroup}}} + {\startnointerference + \letgvalueempty{\c!file\f!javascriptprefix#1}% + \makeshortfilename[\f!javascriptprefix#1]% + \showmessage\m!javascript1{#1}% + \startreadingfile + \readsysfile\shortfilename\donothing\donothing + \stopreadingfile + \stopnointerference}}} \def\douseJSscripts[#1][#2]% {\processcommalist[#1]\dodouseJSscripts \processcommalist[#2]\useJSpreamblenow} -\def\useJSscripts% +\def\useJSscripts {\dodoubleempty\douseJSscripts} -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/lang-chi.tex b/tex/context/base/lang-chi.tex index 9367e2fd4..51a018e9b 100644 --- a/tex/context/base/lang-chi.tex +++ b/tex/context/base/lang-chi.tex @@ -1,11 +1,10 @@ %D \module %D [ file=lang-chi, -%D version=1998.10.10, +%D version=2002.06.25, % 1998.10.10, %D title=\CONTEXT\ Language Macros, %D subtitle=Chinese, -%D author=Hans Hagen, +%D author={Hans Hagen \& Wang Lei}, %D date=\currentdate, -%D suggestions=Wang Lei, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is @@ -22,20 +21,31 @@ \definesystemconstant {chinese} \definesystemconstant {cn} -\installlanguage[\s!cn][\c!status=\v!start] - -\setupheadtext [\s!cn] [\v!inhoud={\cnencodecontents}] -\setupheadtext [\s!cn] [\v!tabellen={\cnencodetables}] -\setupheadtext [\s!cn] [\v!figuren={\cnencodefigures}] +\installlanguage + [\s!cn] + [\c!leftsentence=\cnencoding\cnleftsentence, + \c!rightsentence=\cnencoding\cnrightsentence, + \c!leftsubsentence=\cnencoding\cnleftsubsentence, + \c!rightsubsentence=\cnencoding\cnrightsubsentence, + \c!leftquote=\cnencoding\cnupperleftsinglequote, + \c!rightquote=\cnencoding\cnupperrightsinglequote, + \c!leftquotation=\cnencoding\cnupperleftdoublequote, + \c!rightquotation=\cnencoding\cnupperrightdoublequote, + \c!datum={\v!maand,\ ,\v!dag,{,\ },\v!jaar}, + \c!status=\v!start] + +\setupheadtext [\s!cn] [\v!inhoud={\cnencoding\cnencodedcontents}] +\setupheadtext [\s!cn] [\v!tabellen={\cnencoding\cnencodedtables}] +\setupheadtext [\s!cn] [\v!figuren={\cnencoding\cnencodedfigures}] \setupheadtext [\s!cn] [\v!grafieken=Graphics] \setupheadtext [\s!cn] [\v!intermezzos=Intermezzos] -\setupheadtext [\s!cn] [\v!index={\cnencodeindex}] -\setupheadtext [\s!cn] [\v!afkortingen={\cnencodeabbreviations}] -\setupheadtext [\s!cn] [\v!logos={\cnencodelogos}] -\setupheadtext [\s!cn] [\v!eenheden={\cnencodeunits}] +\setupheadtext [\s!cn] [\v!index={\cnencoding\cnencodedindex}] +\setupheadtext [\s!cn] [\v!afkortingen={\cnencoding\cnencodedabbreviations}] +\setupheadtext [\s!cn] [\v!logos={\cnencoding\cnencodedlogos}] +\setupheadtext [\s!cn] [\v!eenheden={\cnencoding\cnencodedunits}] -\setuplabeltext [\s!cn] [\v!tabel={\cnencodetable}] -\setuplabeltext [\s!cn] [\v!figuur={\cnencodefigure}] +\setuplabeltext [\s!cn] [\v!tabel={\cnencoding\cnencodedtable}] +\setuplabeltext [\s!cn] [\v!figuur={\cnencoding\cnencodedfigure}] \setuplabeltext [\s!cn] [\v!intermezzo=Intermezzo ] \setuplabeltext [\s!cn] [\v!grafiek=Illustration ] \setuplabeltext [\s!cn] [\v!bijlage=] @@ -49,6 +59,35 @@ \setuplabeltext [\s!cn] [\v!sub\v!sub\v!paragraaf=] \setuplabeltext [\s!cn] [\v!sub\v!sub\v!sub\v!paragraaf=] +%D From this definition one can deduce that language, input +%D encoding, font encoding, and glyph meaning form a pretty +%D complex four dimensional space. + +\startlanguagespecifics[\s!cn] + +\setuplabeltext [\s!cn] [\v!january=\cnencoding\cnencodedjanuary ] +\setuplabeltext [\s!cn] [\v!february=\cnencoding\cnencodedfebrary ] +\setuplabeltext [\s!cn] [\v!march=\cnencoding\cnencodedmarch ] +\setuplabeltext [\s!cn] [\v!april=\cnencoding\cnencodedapril ] +\setuplabeltext [\s!cn] [\v!may=\cnencoding\cnencodedmay ] +\setuplabeltext [\s!cn] [\v!june=\cnencoding\cnencodedjune ] +\setuplabeltext [\s!cn] [\v!july=\cnencoding\cnencodedjuly ] +\setuplabeltext [\s!cn] [\v!august=\cnencoding\cnencodedaugust ] +\setuplabeltext [\s!cn] [\v!september=\cnencoding\cnencodedseptember] +\setuplabeltext [\s!cn] [\v!october=\cnencoding\cnencodedoctober ] +\setuplabeltext [\s!cn] [\v!november=\cnencoding\cnencodednovember ] +\setuplabeltext [\s!cn] [\v!december=\cnencoding\cnencodeddecember ] + +\setuplabeltext [\s!cn] [\v!sunday=\cnencoding\cnencodedsunday ] +\setuplabeltext [\s!cn] [\v!monday=\cnencoding\cnencodedmonday ] +\setuplabeltext [\s!cn] [\v!tuesday=\cnencoding\cnencodedtuesday ] +\setuplabeltext [\s!cn] [\v!wednesday=\cnencoding\cnencodedwednesday] +\setuplabeltext [\s!cn] [\v!thursday=\cnencoding\cnencodedthursday ] +\setuplabeltext [\s!cn] [\v!friday=\cnencoding\cnencodedfriday ] +\setuplabeltext [\s!cn] [\v!saturday=\cnencoding\cnencodedsaturday ] + +\stoplanguagespecifics + %D One can specify a split labeltext, as demonstrated in %D the definition of the \type {part} label. Unfortunately %D the glyphs of both part depend on the encoding. Therefore, @@ -57,93 +96,97 @@ \def\cnencoding{\enableencoding[\chineseencoding]} % ugly and temporary \startencoding[gbk] - \definecommand cnencodecontents {\uchar{196}{191}\uchar{194}{188}} - \definecommand cnencodetables {\uchar{177}{237}\uchar{184}{241}} - \definecommand cnencodefigures {\uchar{205}{188}\uchar{208}{206}} - \definecommand cnencodeindex {\uchar{203}{247}\uchar{210}{253}} - \definecommand cnencodeabbreviations {\uchar{203}{245}\uchar{194}{212}\uchar{211}{239}} - \definecommand cnencodelogos {\uchar{187}{213}\uchar{177}{225}} - \definecommand cnencodeunits {\uchar{188}{198}\uchar{193}{191}\uchar{181}{165}\uchar{206}{187}} - \definecommand cnencodetable {\uchar{177}{237}} - \definecommand cnencodefigure {\uchar{205}{188}} - \definecommand cnencodedintro {\uchar{181}{218}} - \definecommand cnencodedpart {\uchar{178}{191}\uchar{183}{214}} - \definecommand cnencodedchapter {\uchar{213}{194}} - \definecommand cnencodedsection {\uchar{189}{218}} -\stopencoding - -\startencoding[big5] - \definecommand cnencodecontents {\uchar{165}{216}\uchar{191}{253}} - \definecommand cnencodetables {\uchar{170}{237}\uchar{174}{230}} - \definecommand cnencodefigures {\uchar{185}{207}\uchar{167}{206}} - \definecommand cnencodeindex {\uchar{175}{193}\uchar{174}{222}} - \definecommand cnencodeabbreviations {\uchar{191}{89}\uchar{178}{164}\uchar{187}{121}} - \definecommand cnencodelogos {\uchar{192}{178}\uchar{188}{208}} - \definecommand cnencodeunits {\uchar{173}{112}\uchar{182}{113}\uchar{179}{230}\uchar{166}{236}} - \definecommand cnencodetable {\uchar{170}{237}} - \definecommand cnencodefigure {\uchar{185}{207}} - \definecommand cnencodedintro {\uchar{178}{196}} - \definecommand cnencodedpart {\uchar{179}{161}\uchar{164}{192}} - \definecommand cnencodedchapter {\uchar{179}{185}} - \definecommand cnencodedsection {\uchar{184} {96}} -\stopencoding - -%D From this definition one can deduce that language, input -%D encoding, font encoding, and glyph meaning form a pretty -%D complex four dimensional space. - -\startlanguagespecifics[\s!cn] - -\startencoding[gbk] - -\setuplabeltext [\s!cn] [\v!january=\uchar{210}{187}\uchar{212}{194}] -\setuplabeltext [\s!cn] [\v!february=\uchar{182}{254}\uchar{212}{194}] -\setuplabeltext [\s!cn] [\v!march=\uchar{200}{253}\uchar{212}{194}] -\setuplabeltext [\s!cn] [\v!april=\uchar{203}{196}\uchar{212}{194}] -\setuplabeltext [\s!cn] [\v!may=\uchar{206}{229}\uchar{212}{194}] -\setuplabeltext [\s!cn] [\v!june=\uchar{193}{249}\uchar{212}{194}] -\setuplabeltext [\s!cn] [\v!july=\uchar{198}{223}\uchar{212}{194}] -\setuplabeltext [\s!cn] [\v!august=\uchar{176}{203}\uchar{212}{194}] -\setuplabeltext [\s!cn] [\v!september=\uchar{190}{197}\uchar{212}{194}] -\setuplabeltext [\s!cn] [\v!october=\uchar{202}{174}\uchar{212}{194}] -\setuplabeltext [\s!cn] [\v!november=\uchar{202}{174}\uchar{210}{187}\uchar{212}{194}] -\setuplabeltext [\s!cn] [\v!december=\uchar{202}{174}\uchar{182}{254}\uchar{212}{194}] - -\setuplabeltext [\s!cn] [\v!sunday=\uchar{208}{199}\uchar{198}{218}\uchar{200}{213}] -\setuplabeltext [\s!cn] [\v!monday=\uchar{208}{199}\uchar{198}{218}\uchar{210}{187}] -\setuplabeltext [\s!cn] [\v!tuesday=\uchar{208}{199}\uchar{198}{218}\uchar{182}{254}] -\setuplabeltext [\s!cn] [\v!wednesday=\uchar{208}{199}\uchar{198}{218}\uchar{200}{253}] -\setuplabeltext [\s!cn] [\v!thursday=\uchar{208}{199}\uchar{198}{218}\uchar{203}{196}] -\setuplabeltext [\s!cn] [\v!friday=\uchar{208}{199}\uchar{198}{218}\uchar{206}{229}] -\setuplabeltext [\s!cn] [\v!saturday=\uchar{208}{199}\uchar{198}{218}\uchar{193}{249}] - + \definecommand cnleftsentence {\uchar{161}{170}\uchar{161}{170}} + \definecommand cnrightsentence {\uchar{161}{170}\uchar{161}{170}} + \definecommand cnleftsubsentence {\uchar{161}{170}\uchar{161}{170}} + \definecommand cnrightsubsentence {\uchar{161}{170}\uchar{161}{170}} + \definecommand cnupperleftsinglequote {\uchar{161}{174}} + \definecommand cnupperrightsinglequote {\uchar{161}{175}} + \definecommand cnupperleftdoublequote {\uchar{161}{176}} + \definecommand cnupperrightdoublequote {\uchar{161}{177}} + \definecommand cnupperleftsinglequote-v {\uchar{161}{184}} + \definecommand cnupperrightsinglequote-v {\uchar{161}{185}} + \definecommand cnupperleftdoublequote-v {\uchar{161}{186}} + \definecommand cnupperrightdoublequote-v {\uchar{161}{187}} + \definecommand cnencodedcontents {\uchar{196}{191}\uchar{194}{188}} + \definecommand cnencodedtables {\uchar{177}{237}\uchar{184}{241}} + \definecommand cnencodedfigures {\uchar{205}{188}\uchar{208}{206}} + \definecommand cnencodedindex {\uchar{203}{247}\uchar{210}{253}} + \definecommand cnencodedabbreviations {\uchar{203}{245}\uchar{194}{212}\uchar{211}{239}} + \definecommand cnencodedlogos {\uchar{187}{213}\uchar{177}{225}} + \definecommand cnencodedunits {\uchar{188}{198}\uchar{193}{191}\uchar{181}{165}\uchar{206}{187}} + \definecommand cnencodedtable {\uchar{177}{237}} + \definecommand cnencodedfigure {\uchar{205}{188}} + \definecommand cnencodedintro {\uchar{181}{218}} + \definecommand cnencodedpart {\uchar{178}{191}\uchar{183}{214}} + \definecommand cnencodedchapter {\uchar{213}{194}} + \definecommand cnencodedsection {\uchar{189}{218}} + \definecommand cnencodedjanuary {\uchar{210}{187}\uchar{212}{194}} + \definecommand cnencodedfebrary {\uchar{182}{254}\uchar{212}{194}} + \definecommand cnencodedmarch {\uchar{200}{253}\uchar{212}{194}} + \definecommand cnencodedapril {\uchar{203}{196}\uchar{212}{194}} + \definecommand cnencodedmay {\uchar{206}{229}\uchar{212}{194}} + \definecommand cnencodedjune {\uchar{193}{249}\uchar{212}{194}} + \definecommand cnencodedjuly {\uchar{198}{223}\uchar{212}{194}} + \definecommand cnencodedaugust {\uchar{176}{203}\uchar{212}{194}} + \definecommand cnencodedseptember {\uchar{190}{197}\uchar{212}{194}} + \definecommand cnencodedoctober {\uchar{202}{174}\uchar{212}{194}} + \definecommand cnencodednovember {\uchar{202}{174}\uchar{210}{187}\uchar{212}{194}} + \definecommand cnencodeddecember {\uchar{202}{174}\uchar{182}{254}\uchar{212}{194}} + \definecommand cnencodedsunday {\uchar{208}{199}\uchar{198}{218}\uchar{200}{213}} + \definecommand cnencodedmonday {\uchar{208}{199}\uchar{198}{218}\uchar{210}{187}} + \definecommand cnencodedtuesday {\uchar{208}{199}\uchar{198}{218}\uchar{182}{254}} + \definecommand cnencodedwednesday {\uchar{208}{199}\uchar{198}{218}\uchar{200}{253}} + \definecommand cnencodedthursday {\uchar{208}{199}\uchar{198}{218}\uchar{203}{196}} + \definecommand cnencodedfriday {\uchar{208}{199}\uchar{198}{218}\uchar{206}{229}} + \definecommand cnencodedsaturday {\uchar{208}{199}\uchar{198}{218}\uchar{193}{249}} \stopencoding \startencoding[big5] - -\setuplabeltext [\s!cn] [\v!january=\uchar{164} {64}\uchar{164}{235}] -\setuplabeltext [\s!cn] [\v!february=\uchar{164} {71}\uchar{164}{235}] -\setuplabeltext [\s!cn] [\v!march=\uchar{164} {84}\uchar{164}{235}] -\setuplabeltext [\s!cn] [\v!april=\uchar{165}{124}\uchar{164}{235}] -\setuplabeltext [\s!cn] [\v!may=\uchar{164}{173}\uchar{164}{235}] -\setuplabeltext [\s!cn] [\v!june=\uchar{164}{187}\uchar{164}{235}] -\setuplabeltext [\s!cn] [\v!july=\uchar{164} {67}\uchar{164}{235}] -\setuplabeltext [\s!cn] [\v!august=\uchar{164} {75}\uchar{164}{235}] -\setuplabeltext [\s!cn] [\v!september=\uchar{164} {69}\uchar{164}{235}] -\setuplabeltext [\s!cn] [\v!october=\uchar{164} {81}\uchar{164}{235}] -\setuplabeltext [\s!cn] [\v!november=\uchar{164} {81}\uchar{164} {64}\uchar{164}{235}] -\setuplabeltext [\s!cn] [\v!december=\uchar{164} {81}\uchar{164} {71}\uchar{164}{235}] - -\setuplabeltext [\s!cn] [\v!sunday=\uchar{172} {80}\uchar{180}{193}\uchar{164}{233}] -\setuplabeltext [\s!cn] [\v!monday=\uchar{172} {80}\uchar{180}{193}\uchar{164}{64}] -\setuplabeltext [\s!cn] [\v!tuesday=\uchar{172} {80}\uchar{180}{193}\uchar{164}{71}] -\setuplabeltext [\s!cn] [\v!wednesday=\uchar{172} {80}\uchar{180}{193}\uchar{164}{84}] -\setuplabeltext [\s!cn] [\v!thursday=\uchar{172} {80}\uchar{180}{193}\uchar{165}{124}] -\setuplabeltext [\s!cn] [\v!friday=\uchar{172} {80}\uchar{180}{193}\uchar{164}{173}] -\setuplabeltext [\s!cn] [\v!saturday=\uchar{172} {80}\uchar{180}{193}\uchar{164}{187}] - + \definecommand cnleftsentence {\uchar{162}{119}\uchar{162}{119}} + \definecommand cnrightsentence {\uchar{162}{119}\uchar{162}{119}} + \definecommand cnleftsubsentence {\uchar{162}{119}\uchar{162}{119}} + \definecommand cnrightsubsentence {\uchar{162}{119}\uchar{162}{119}} + \definecommand cnupperleftsinglequote {\uchar{161}{165}} + \definecommand cnupperrightsinglequote {\uchar{161}{166}} + \definecommand cnupperleftdoublequote {\uchar{161}{167}} + \definecommand cnupperrightdoublequote {\uchar{161}{168}} + \definecommand cnupperleftsinglequote-v {\uchar{161}{117}} + \definecommand cnupperrightsinglequote-v {\uchar{161}{118}} + \definecommand cnupperleftdoublequote-v {\uchar{161}{121}} + \definecommand cnupperrightdoublequote-v {\uchar{161}{122}} + \definecommand cnencodecontents {\uchar{165}{216}\uchar{191}{253}} + \definecommand cnencodetables {\uchar{170}{237}\uchar{174}{230}} + \definecommand cnencodefigures {\uchar{185}{207}\uchar{167}{206}} + \definecommand cnencodeindex {\uchar{175}{193}\uchar{174}{222}} + \definecommand cnencodeabbreviations {\uchar{191}{89}\uchar{178}{164}\uchar{187}{121}} + \definecommand cnencodelogos {\uchar{192}{178}\uchar{188}{208}} + \definecommand cnencodeunits {\uchar{173}{112}\uchar{182}{113}\uchar{179}{230}\uchar{166}{236}} + \definecommand cnencodetable {\uchar{170}{237}} + \definecommand cnencodefigure {\uchar{185}{207}} + \definecommand cnencodedintro {\uchar{178}{196}} + \definecommand cnencodedpart {\uchar{179}{161}\uchar{164}{192}} + \definecommand cnencodedchapter {\uchar{179}{185}} + \definecommand cnencodedsection {\uchar{184} {96}} + \definecommand cnencodedjanuary {\uchar{164} {64}\uchar{164}{235}} + \definecommand cnencodedfebrary {\uchar{164} {71}\uchar{164}{235}} + \definecommand cnencodedmarch {\uchar{164} {84}\uchar{164}{235}} + \definecommand cnencodedapril {\uchar{165}{124}\uchar{164}{235}} + \definecommand cnencodedmay {\uchar{164}{173}\uchar{164}{235}} + \definecommand cnencodedjune {\uchar{164}{187}\uchar{164}{235}} + \definecommand cnencodedjuly {\uchar{164} {67}\uchar{164}{235}} + \definecommand cnencodedaugust {\uchar{164} {75}\uchar{164}{235}} + \definecommand cnencodedseptember {\uchar{164} {69}\uchar{164}{235}} + \definecommand cnencodedoctober {\uchar{164} {81}\uchar{164}{235}} + \definecommand cnencodednovember {\uchar{164} {81}\uchar{164} {64}\uchar{164}{235}} + \definecommand cnencodeddecember {\uchar{164} {81}\uchar{164} {71}\uchar{164}{235}} + \definecommand cnencodedsunday {\uchar{172} {80}\uchar{180}{193}\uchar{164}{233}} + \definecommand cnencodedmonday {\uchar{172} {80}\uchar{180}{193}\uchar{164} {64}} + \definecommand cnencodedtuesday {\uchar{172} {80}\uchar{180}{193}\uchar{164} {71}} + \definecommand cnencodedwednesday {\uchar{172} {80}\uchar{180}{193}\uchar{164} {84}} + \definecommand cnencodedthursday {\uchar{172} {80}\uchar{180}{193}\uchar{165}{124}} + \definecommand cnencodedfriday {\uchar{172} {80}\uchar{180}{193}\uchar{164}{173}} + \definecommand cnencodedsaturday {\uchar{172} {80}\uchar{180}{193}\uchar{164}{187}} \stopencoding -\stoplanguagespecifics - \protect \endinput diff --git a/tex/context/base/lang-ger.tex b/tex/context/base/lang-ger.tex index 82b5132fa..995986e26 100644 --- a/tex/context/base/lang-ger.tex +++ b/tex/context/base/lang-ger.tex @@ -88,15 +88,15 @@ \installlanguage [\s!sv] [\c!spatiering=\v!opelkaar, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, - \c!leftquote=\upperleftsinglesixquote, + \c!leftsentence={\hbox{--~}}, + \c!rightsentence={\hbox{~--}}, + \c!leftsubsentence={--}, + \c!rightsubsentence={--}, + \c!leftquote=\upperrightsingleninequote, \c!rightquote=\upperrightsingleninequote, - \c!leftquotation=\upperleftdoublesixquote, + \c!leftquotation=\upperrightdoubleninequote, \c!rightquotation=\upperrightdoubleninequote, - \c!datum={\v!jaar,\ ,\v!maand,\ ,\v!dag}, + \c!datum={\v!dag,\ ,\v!maand,\ ,\v!jaar}, \c!status=\v!stop] \installlanguage diff --git a/tex/context/base/lang-ini.tex b/tex/context/base/lang-ini.tex index ed5126a76..1cda3ce7c 100644 --- a/tex/context/base/lang-ini.tex +++ b/tex/context/base/lang-ini.tex @@ -194,7 +194,7 @@ \def\dodoinstalllanguage#1#2% #2 added {\doifundefined{#1}{\setvalue{#1}{\complexlanguage[#2]}}% \expanded{\noexpand\uppercase{\noexpand\edef\noexpand\ascii{#1}}}% - \doifundefined{\ascii}{\setvalue{\ascii}{\complexlanguage[#2]}}} + \doifundefined\ascii{\setvalue{\ascii}{\complexlanguage[#2]}}} %D \macros %D {preloadlanguages} @@ -212,9 +212,11 @@ -#1-% \getvalue{\??la#1\s!righthyphenmin} } -\def\preloadlanguages% - {\doifsomething{\preloadedpatterns} - {\showmessage{\m!linguals}{10}{\preloadedpatterns}}} +\def\preloadlanguages + {\doifsomething\preloadedpatterns + {\showmessage\m!linguals{10}\preloadedpatterns}} + +\let\installedlanguages\empty \def\doinstalllanguage[#1][#2]% {%\ConvertConstantAfter\doifinstringelse{=}{#2} @@ -222,6 +224,7 @@ {\doifdefinedelse{\??la#1\c!status} {\getparameters[\??la#1][#2]} {\setvalue{\l!prefix!#1}{#1}% + \addtocommalist{#1}\installedlanguages \dodoinstalllanguage{#1}{#1}% \getparameters [\??la#1] @@ -274,28 +277,34 @@ % loop in deo % \doifvalue{\??la#1\s!patterns}{#1}{\letvalue{\??la#1\c!default}\empty}% % - \doifelsevalue{\??la#1\c!status}{\v!start} + \doifelsevalue{\??la#1\c!status}\v!start {\doifelsevaluenothing{\??la#1\s!patterns} {\edef\languagesuffix{#1}} {\edef\languagesuffix{\getvalue{\??la#1\s!patterns}}}% - %\doifundefinedelse{\??la\??la\languagesuffix} \doifundefinedelse{\??la\??la:\currentencoding:\currentmapping:\languagesuffix} {\doloadpatterns{#1}{\languagesuffix}} {\bgroup - %\edef\loadedlanguage{\getvalue{\??la\??la\languagesuffix}}% \edef\loadedlanguage{\getvalue{\??la\??la:\currentencoding:\currentmapping:\languagesuffix}}% - \showmessage{\m!linguals}{1}{\languagesuffix,#1,\loadedlanguage}% - \showmessage{\m!linguals}{3}{\languagesuffix,#1,\loadedlanguage}% + \showmessage\m!linguals1{\languagesuffix,#1,\loadedlanguage}% + \showmessage\m!linguals3{\languagesuffix,#1,\loadedlanguage}% \egroup}} - {\showmessage{\m!linguals}{5}{#1}}} + {\showmessage\m!linguals5{#1}}} {\setvalue{\l!prefix!#1}{#2}% \dodoinstalllanguage{#1}{#2}}} % ^^ \language[#1] gave unwanted side effect of loading language specifics -\def\installlanguage% +\def\installlanguage {\dodoubleargument\doinstalllanguage} +%D Handy + +\def\preloadallpatterns + {\gdef\preloadallpatterns##1% + {\installlanguage[##1][\c!status=\v!start]}% + \processcommacommand[\installedlanguages]\preloadallpatterns + \global\let\preloadallpatterns\relax} + %D When the second argument is a language identifier, a %D synonym is created. This feature is present because we %D used dutch mnemonics in the dutch version, but nowadays @@ -307,7 +316,7 @@ \def\doloadpatterns#1#2% {\expanded{\getcommacommandsize[\getvalue{\??la#2\s!encoding}]}% \ifnum\commalistsize>0 - %\message{[nofpatterns #2: \commalistsize/\getvalue{\??la#2\s!encoding}]}% + %\message{[nofpatterns #2: \commalistsize/\getvalue{\??la#2\s!encoding}]}% \dorecurse\commalistsize {\expanded{\getfromcommacommand[\getvalue{\??la#2\s!encoding}][\recurselevel]}% \let\patternencoding\commalistelement @@ -324,38 +333,38 @@ \def\dodoloadpatterns#1#2#3#4% beware, loaded language also incr {\normallanguage\loadedlanguage % when not really needed -% \letvalue{\??la\??la#2}\loadedlanguage + %\letvalue{\??la\??la#2}\loadedlanguage \bgroup \scratchtoks\everyjob % we don't want additional junk put there \let\showpatterns\relax \startencoding[#3]% \enablemapping[#4]% - \doifnothing{\currentencoding}{\let\currentencoding\s!default}% - \doifnothing{\currentmapping }{\let\currentmapping \s!default}% - \global\letvalue{\??la\??la:\currentencoding:\currentmapping:#2}=\loadedlanguage + \doifnothing\currentencoding{\let\currentencoding\s!default}% + \doifnothing\currentmapping {\let\currentmapping \s!default}% + \letgvalue{\??la\??la:\currentencoding:\currentmapping:#2}\loadedlanguage \startreadingfile \startpatternaccents -%\def\patterns##1{\message{#1/#2/#3/#4/##1}\normalpatterns{##1}}% + %\def\patterns##1{\message{#1/#2/#3/#4/##1}\normalpatterns{##1}}% \readsysfile{\truefilename{\f!languageprefix#2.\f!patternsextension}} {\setxvalue{\??la#1\s!patterns}{#2}% \xdef\preloadedpatterns {\preloadedpatterns \number\normallanguage:\showpatterns{#2}}% - \showmessage{\m!linguals}{1}{#2,#1,\loadedlanguage}} + \showmessage\m!linguals1{#2,#1,\loadedlanguage}} {\readsysfile{\f!languageprefix#2.\f!patternsextension} {\setxvalue{\??la#1\s!patterns}{#2}% \xdef\preloadedpatterns{\preloadedpatterns\showpatterns{#2}}% - \showmessage{\m!linguals}{1}{#2,#1,\loadedlanguage}} - {\showmessage{\m!linguals}{2}{#2,#1,\loadedlanguage}}}% + \showmessage\m!linguals1{#2,#1,\loadedlanguage}} + {\showmessage\m!linguals2{#2,#1,\loadedlanguage}}}% \readsysfile{\truefilename{\f!languageprefix#2.\f!hyphensextension}} - {\showmessage{\m!linguals}{3}{#2,#1,\loadedlanguage}} + {\showmessage\m!linguals3{#2,#1,\loadedlanguage}} {\readsysfile{\f!languageprefix#2.\f!hyphensextension} - {\showmessage{\m!linguals}{3}{#2,#1,\loadedlanguage}} - {\showmessage{\m!linguals}{4}{#2,#1,\loadedlanguage}}}% + {\showmessage\m!linguals3{#2,#1,\loadedlanguage}} + {\showmessage\m!linguals4{#2,#1,\loadedlanguage}}}% \stoppatternaccents \stopreadingfile \stopencoding - \global\everyjob=\scratchtoks + \global\everyjob\scratchtoks \egroup \increment\loadedlanguage} @@ -366,12 +375,12 @@ %D %D \showsetup{\y!setuplanguage} -\def\setuplanguage% +\def\setuplanguage {\dodoubleargument\dosetuplanguage} \def\dosetuplanguage[#1][#2]% {\getparameters[\??la#1][#2]% - \doif{#1}{\currentlanguage}{\docomplexlanguage}} + \doif{#1}\currentlanguage\docomplexlanguage} %D The values \type {\c!leftsentence} and \type %D {\c!rightsentence} can be (and are) used to implement @@ -387,8 +396,8 @@ %D Just to make things easy we can ask for the current date %D specification by saying: -\def\currentdatespecification% - {\getvalue{\??la\currentlanguage\c!datum}} +\def\currentdatespecification + {\csname\??la\currentlanguage\c!datum\endcsname} %D This command is not meant for users. @@ -811,6 +820,6 @@ \appendtoks\mainlanguage[\currentlanguage]\to\everyjob -\appendtoks\showmessage{\m!linguals}{9}{\currentlanguage}\to\everyjob +\appendtoks\showmessage\m!linguals9\currentlanguage\to\everyjob \protect \endinput diff --git a/tex/context/base/lang-ita.tex b/tex/context/base/lang-ita.tex index 365c77cbe..5094d27b5 100644 --- a/tex/context/base/lang-ita.tex +++ b/tex/context/base/lang-ita.tex @@ -444,7 +444,7 @@ %D Ordinal converters: \def\frordinaldaynumber#1% date is masculine - {#1\ifcase#1\or + {\number#1\ifcase#1\or \highordinalstr{er}% \fi} diff --git a/tex/context/base/lang-lab.tex b/tex/context/base/lang-lab.tex index 167b0a956..6711490f8 100644 --- a/tex/context/base/lang-lab.tex +++ b/tex/context/base/lang-lab.tex @@ -101,14 +101,20 @@ \unexpanded\def\headtext {\let\handletextprefix\firstoftwoarguments + \let\reporttextprefixerror\doreporttextprefixerror + \global\labeltextdonetrue \dogetupsometextprefix\headlanguage\c!titel} \unexpanded\def\leftlabeltext {\let\handletextprefix\firstoftwoarguments + \let\reporttextprefixerror\doreporttextprefixerror + \global\labeltextdonetrue \dogetupsometextprefix\labellanguage\c!label} \unexpanded\def\rightlabeltext {\let\handletextprefix\secondoftwoarguments + \let\reporttextprefixerror\doreporttextprefixerror + \global\labeltextdonetrue \dogetupsometextprefix\labellanguage\c!label} \unexpanded\def\LEFTLABELTEXT @@ -120,6 +126,8 @@ \def\DOLABELTEXT#1% {\bgroup \the\everyuppercase + \let\reporttextprefixerror\doreporttextprefixerror + \global\labeltextdonetrue \dogetupsometextprefix\labellanguage\c!label{#1}% not \labeltext (see \MONTH) \egroup} @@ -132,80 +140,26 @@ \newif\iflabeltextdone % needs to be reset elsewhere \newif\iftracinglabels % shows missing labels -% \def\dodogetupsometextprefix#1#2#3#4% -% {\doifdefinedelse{#2#1#3} -% {\getvalue{#2#1#3}} -% {\doifdefinedelse{#2#3} % was bug: #1#3 -% {\getvalue{#2#3}} -% {#4}}} -% -% \unexpanded\def\dogetupsometextprefix#1#2#3% -% {\global\labeltextdonetrue -% \dodogetupsometextprefix{#1}{#2}{#3} -% {\dodogetupsometextprefix{\defaultlanguage{#1}}{#2}{#3} -% {\dodogetupsometextprefix{\s!en}{#2}{#3} -% {\dodogetupsometextprefix{\s!nl}{#2}{#3} -% {\iftracinglabels{\tttf[#2:~#3/#1]~}\fi}}}}} -% -% \beginETEX -% -% \def\dodogetupsometextprefix#1#2#3#4% -% {\ifcsname#2#1#3\endcsname -% \csname#2#1#3\endcsname -% \else\ifcsname#2#3\endcsname -% \csname#2#3\endcsname -% \else -% #4% -% \fi\fi} -% -% this can be reduced to: -% -% \def\dodogetupsometextprefix#1#2#3% -% {\ifcsname#2#1#3\endcsname -% \csname#2#1#3\endcsname -% \@EA\gobbleoneargument -% \else\ifcsname#2#3\endcsname -% \csname#2#3\endcsname -% \@EAEAEA\gobbleoneargument -% \else -% \@EAEAEA\firstofoneargument -% \fi\fi} -% -% \endETEX -% -% \beginTEX -% -% \def\dodogetupsometextprefix#1#2#3% -% {\@EA\ifx\csname#2#1#3\endcsname\relax -% \@EA\ifx\csname#2#3\endcsname\relax -% \@EAEAEA\firstofoneargument -% \else -% \csname#2#3\endcsname -% \@EAEAEA\gobbleoneargument -% \fi -% \else -% \csname#2#1#3\endcsname -% \@EA\gobbleoneargument -% \fi} -% -% \endTEX -% -% \unexpanded\def\dogetupsometextprefix#1#2#3% -% {\global\labeltextdonetrue -% \dodogetupsometextprefix{#1}{#2}{#3} -% {\dodogetupsometextprefix{\defaultlanguage{#1}}{#2}{#3} -% {\dodogetupsometextprefix\s!en{#2}{#3} -% {\dodogetupsometextprefix\s!nl{#2}{#3} -% {\reporttextprefixerror{#1}{#2}{#3}}}}}} - -\def\reporttextprefixerror#1#2#3% +\def\doreporttextprefixerror#1#2#3% {\iftracinglabels{\tttf[#2:~#3/#1]~}\fi} +\def\dosetexpandedheadlabeltext#1#2#3% + {\bgroup + \let\handletextprefix\firstoftwoarguments + \let\reporttextprefixerror\gobblethreearguments + \keepencodedtokens % test on multilingual pascal, ok in stretched + %\dontexpandencodedtokens % not usable in token handler + \expanded + {\egroup\noexpand\def\noexpand#2% watch out, no \edef + {\dogetupsometextprefix{\headlanguage}{#1}{#3}}}} + +\def\setexpandedheadtext {\dosetexpandedheadlabeltext\c!titel} +\def\setexpandedlabeltext{\dosetexpandedheadlabeltext\c!label} + \beginETEX \ifcsname -\unexpanded\def\dogetupsometextprefix#1#2#3% - {\global\labeltextdonetrue - \ifcsname#2#1#3\endcsname +\def\dogetupsometextprefix#1#2#3% + {\ifcsname#2#1#3\endcsname \csname#2#1#3\endcsname \else \ifcsname#2#3\endcsname \csname#2#3\endcsname \else @@ -222,9 +176,8 @@ \beginTEX -\unexpanded\def\dogetupsometextprefix#1#2#3% - {\global\labeltextdonetrue - \@EA\ifx\csname#2#1#3\endcsname\relax +\def\dogetupsometextprefix#1#2#3% + {\@EA\ifx\csname#2#1#3\endcsname\relax \@EA\ifx\csname#2#3\endcsname\relax \@EA\ifx\csname#2\defaultlanguage{#1}#3\endcsname\relax \@EA\ifx\csname#2\s!en#3\endcsname\relax diff --git a/tex/context/base/lang-spe.tex b/tex/context/base/lang-spe.tex index bd34674b2..30180e671 100644 --- a/tex/context/base/lang-spe.tex +++ b/tex/context/base/lang-spe.tex @@ -29,7 +29,7 @@ {\ifcase\protectionlevel \the\everyresetlanguagespecifics \else % to be translated - \writestatus{system}{don't change language in unprotected mode!}% + \writestatus\m!systems{don't change language in unprotected mode!}% \fi} \appendtoks @@ -159,7 +159,7 @@ \def\deactivatelanguagespecific#1% {\ifundefined{l g s \string#1}% - \global\letvalue{l g s \string#1}\empty % signal to prevent dup def + \letgvalueempty{l g s \string#1}% signal to prevent dup def \bgroup \catcode`#1=\@@active \uccode`~=`#1 diff --git a/tex/context/base/m-chart.tex b/tex/context/base/m-chart.tex index 0a30652da..1e3f23d13 100644 --- a/tex/context/base/m-chart.tex +++ b/tex/context/base/m-chart.tex @@ -13,6 +13,8 @@ % to do: \localpushmacro/\localpopmacro (dohandleflowchart etc) +% will be redone with layers + %D This is an experimental module. Pieces of code will be moved %D to other modules. More features are possible but will be %D interfaces later. @@ -174,7 +176,10 @@ \def\doFLOWhelp#1% {\gdef\FLOWhelp{#1}\ignorespaces} -\def\doFLOWconnection[#1]#2% +\def\doFLOWconnection + {\dodoubleempty\dodoFLOWconnection} + +\def\dodoFLOWconnection[#1][#2]#3% {\ignorespaces} \def\doFLOWconnect% @@ -404,20 +409,20 @@ \dimen0=\@@FLOWmaxbreedte \dimen2=\@@FLOWbreedte \dimen4=\@@FLOWdx - \advance\dimen2 by 2\dimen4 + \advance\dimen2 2\dimen4 \dimen2=\@@FLOWnx\dimen2 - \advance\dimen2 by 2\dimen4 + \advance\dimen2 2\dimen4 \ifdim\dimen2>\dimen0 - \advance\scratchcounter by -1 + \advance\scratchcounter \minusone \else \dimen0=\@@FLOWmaxhoogte \dimen2=\@@FLOWhoogte \dimen4=\@@FLOWdy - \advance\dimen2 by 2\dimen4 + \advance\dimen2 2\dimen4 \dimen2=\@@FLOWny\dimen2 - \advance\dimen2 by 2\dimen4 + \advance\dimen2 2\dimen4 \ifdim\dimen2>\dimen0 - \advance\scratchcounter by -1 + \advance\scratchcounter \minusone \else \exitloop \fi @@ -506,14 +511,14 @@ reverse_y := true ; chart_offset := \@@FLOW@@offset ; \stopMPdrawing - \doifelsenothing{\@@FLOWachtergrondkleur} + \doifelsenothing\@@FLOWachtergrondkleur {\startMPdrawing chart_background_color := white ; \stopMPdrawing} {\startMPdrawing chart_background_color := \MPcolor{\@@FLOWachtergrondkleur} ; \stopMPdrawing}% - \doif{\@@FLOWoptie}{\v!test} + \doif\@@FLOWoptie\v!test {\startMPdrawing show_con_points := true ; show_mid_points := true ; @@ -572,7 +577,7 @@ \setbox4=\hbox {\hskip\@@FLOW@@offset\lower\@@FLOW@@offset\box4}% \wd4=\wd0\ht4=\ht0\dp4=\dp0 - \doifelse{\@@FLOWoptie}{\v!test} + \doifelse\@@FLOWoptie\v!test {\setbox6=\vbox {\forgetall \vskip\@@FLOW@@offset @@ -586,12 +591,12 @@ \setbox8=\vbox {\forgetall\offinterlineskip \vskip\@@FLOW@@offset - \dostepwiserecurse{\@@FLOWy}{\@@FLOWny}{1} + \dostepwiserecurse\@@FLOWy\@@FLOWny\plusone {\vbox to \FLOWgridheight {\vfill \hskip\@@FLOW@@offset \hbox - {\dostepwiserecurse{\@@FLOWx}{\@@FLOWnx}{1} + {\dostepwiserecurse\@@FLOWx\@@FLOWnx\plusone {\hbox to \FLOWgridwidth {\hfill \framed @@ -640,19 +645,19 @@ \ifx\FLOWshape\empty \global\let\FLOWshape\@@FLOSdefault \fi - \doifnot{\FLOWshape}{none} % {\v!geen} + \doifnot\FLOWshape{none} % {\v!geen} {\ExpandBothAfter\doifinsetelse{\FLOWshape}{\FLOWshapes} {\edef\FLOWshapetag{shape_\FLOWshape}% beter \expanded \@EA\setFLOWname\@EA\FLOWshapetag\@EA{\FLOWshapetag}} - {\doifnumberelse{\FLOWshape} + {\doifnumberelse\FLOWshape {\let\FLOWshapetag\FLOWshape} {\let\FLOWshapetag\empty}}% \ifx\FLOWshapetag\empty \else \ExpandBothAfter\doifinsetelse{\FLOWshape}{\FLOWlines} - {\chardef\FLOWstate=0 } + {\chardef\FLOWstate0 } {\ExpandBothAfter\doifcommonelse{\FLOWcell,\FLOWfocus}{\@@FLOWfocus} - {\chardef\FLOWstate=1 } - {\chardef\FLOWstate=2 }}% + {\chardef\FLOWstate1 } + {\chardef\FLOWstate2 }}% \startMPdrawing begin_sub_chart ; \ifcase\FLOWstate @@ -694,9 +699,15 @@ \def\FLOWorigin{0,0} -\def\doFLOWconnectionC[#1]#2% +\def\doFLOWdisplace[#1,#2,#3]% experiment + {dsp_x := #1 ; dsp_y := #2 ;} + +\def\doFLOWconnectionC + {\dodoubleempty\dodoFLOWconnectionC} + +\def\dodoFLOWconnectionC[#1][#2]#3% {\doglobal\increment\FLOWcomment - \setFLOWname\otherFLOWname{name_#2}% + \setFLOWname\otherFLOWname{name_#3}% \doifdefinedelse{\@FLOC@-\FLOWname} {\edef\FLOWfrom{\getvalue{\@FLOC@-\FLOWname}}} {\let \FLOWfrom \FLOWorigin}% @@ -707,22 +718,28 @@ \ifx\FLOWto\FLOWorigin \else \FLOWsetconnect{#1}% \ifx\cFLOWfrom\empty \else - \doifelse{\@@FLOLhoek}{\v!rond} + \doifelse\@@FLOLhoek\v!rond {\startMPdrawing smooth := true ; \stopMPdrawing} {\startMPdrawing smooth := false ; \stopMPdrawing}% - \doifelse{\@@FLOLstreep}{\v!ja} + \doifelse\@@FLOLstreep\v!ja {\startMPdrawing dashline := true ; \stopMPdrawing} {\startMPdrawing dashline := false ; \stopMPdrawing}% - \doifelse{\@@FLOLpijl}{\v!ja} + \doifelse\@@FLOLpijl\v!ja {\startMPdrawing arrowtip := true ; \stopMPdrawing} {\startMPdrawing arrowtip := false ; \stopMPdrawing}% - \doifelse{\@@FLOLoffset}{\v!geen} + \doifelse\@@FLOLoffset\v!geen {\startMPdrawing touchshape := true ; \stopMPdrawing} {\startMPdrawing touchshape := false ; \stopMPdrawing}% +%\doifsomething{#2} +% {\startMPdrawing +% \doFLOWdisplace[0#2,0,0]% +% \stopMPdrawing}% \startMPdrawing +\doFLOWdisplace[0#2,0,0]% connection_line_color := \MPcolor{\@@FLOLkleur} ; connection_line_width := \@@FLOLlijndikte ; connect_\cFLOWfrom_\cFLOWto (\FLOWfrom,\zFLOWfrom) (\FLOWto,\zFLOWto) ; +\doFLOWdisplace[0,0,0]% \stopMPdrawing \fi \fi @@ -744,7 +761,10 @@ \let\comment\doFLOWcommentD \ignorespaces#1\unskip\ignorespaces} -\def\doFLOWconnectionD[#1]#2% +\def\doFLOWconnectionD + {\dodoubleempty\dodoFLOWconnectionD} + +\def\dodoFLOWconnectionD[#1][#2]#3% {\doglobal\increment\FLOWcomment \ignorespaces} @@ -767,16 +787,16 @@ %\ifdefined{FLOW#1}% \ifcase0\getvalue{\@@MPx\FLOWcomment}\getvalue{\@@MPy\FLOWcomment}\relax \else - \ifdim\getvalue{\@@MPx\FLOWcomment}bp<\areaMPllx\relax\else - \ifdim\getvalue{\@@MPx\FLOWcomment}bp>\areaMPurx\relax\else - \ifdim\getvalue{\@@MPy\FLOWcomment}bp<\areaMPlly\relax\else - \ifdim\getvalue{\@@MPy\FLOWcomment}bp>\areaMPury\relax\else - \dimen0=\getvalue{\@@MPx\FLOWcomment}bp + \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp<\areaMPllx\relax\else + \ifdim\getvalue{\@@MPx\FLOWcomment}\s!bp>\areaMPurx\relax\else + \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp<\areaMPlly\relax\else + \ifdim\getvalue{\@@MPy\FLOWcomment}\s!bp>\areaMPury\relax\else + \dimen0=\getvalue{\@@MPx\FLOWcomment}\s!bp \advance\dimen0 -\@@FLOW@@offset \advance\dimen0 -\clipMPllx \dimen2=\clipMPury \advance\dimen2 -\@@FLOW@@offset - \advance\dimen2 -\getvalue{\@@MPy\FLOWcomment}bp + \advance\dimen2 -\getvalue{\@@MPy\FLOWcomment}\s!bp \setbox0=\hbox{\strut#2}% \boxoffset=.5\bodyfontsize \setbox0=\hbox @@ -807,15 +827,15 @@ \else\ifnum\!!countb>\!!countd \donefalse \else \donetrue \doglobal\addtocommalist\FLOWcell\FLOWcells - \advance\!!counta by -\@@FLOWx\advance\!!counta by 1 - \advance\!!countb by -\@@FLOWy\advance\!!countb by 1 + \advance\!!counta -\@@FLOWx\advance\!!counta \plusone + \advance\!!countb -\@@FLOWy\advance\!!countb \plusone \dimen0=\FLOWgridwidth\dimen0=\!!counta\dimen0 - \advance\dimen0 by -\FLOWgridwidth - \dimen4=\FLOWgridwidth\advance\dimen4 by -\FLOWshapewidth - \advance\dimen0 by .5\dimen4 + \advance\dimen0 -\FLOWgridwidth + \dimen4=\FLOWgridwidth\advance\dimen4 -\FLOWshapewidth + \advance\dimen0 .5\dimen4 \dimen2=\FLOWgridheight\dimen2=\!!countb\dimen2 - \dimen4=\FLOWgridheight\advance\dimen4 by -\FLOWshapeheight - \advance\dimen2 by -.5\dimen4 + \dimen4=\FLOWgridheight\advance\dimen4 -\FLOWshapeheight + \advance\dimen2 -.5\dimen4 \setbox0=\hbox {\ifx\FLOWalign\empty\else \setupframed @@ -829,11 +849,13 @@ m=>{\setupframed[\c!uitlijnen=\v!midden]}, c=>{\setupframed[\c!uitlijnen=\v!midden]}]% \fi - \doifelse{\FLOWshape}{none} % {\v!geen} + \doifelse\FLOWshape{none} % {\v!geen} {\setupframed[\c!offset=\v!overlay]} - {\setupframed[\c!offset=.5\bodyfontsize]}% + %{\setupframed[\c!offset=.5\bodyfontsize]}% + {\setupframed[\c!offset=\@@FLOSoffset]}% \framed - [\c!kader=\v!uit,\c!breedte=\FLOWshapewidth,\c!hoogte=\FLOWshapeheight] + [\c!kader=\v!uit, + \c!breedte=\FLOWshapewidth,\c!hoogte=\FLOWshapeheight] {\FLOWtext}}% \showFLOWhelp0 \ifx\FLOWdestination\empty\else @@ -852,17 +874,17 @@ \hbox{\raise\dimen4\hbox{##1{\strut##3}}}}% \positionFLOWzero}% \def\doFLOWblabel##1##2##3% - {\scratchdimen=\ifcase##2 \!!zeropoint\else\@@FLOWdy\fi + {\scratchdimen=\ifcase##2 \zeropoint\else\@@FLOWdy\fi \setbox0=\hbox{\hskip\dimen2\raise-\scratchdimen \hbox{##1{\strut##3}}}% \positionFLOWzero}% \def\doFLOWllabel##1##2##3% - {\scratchdimen=\ifcase##2 \!!zeropoint\else\@@FLOWdx\fi + {\scratchdimen=\ifcase##2 \zeropoint\else\@@FLOWdx\fi \setbox0=\hbox{\hskip-\scratchdimen\raise\dimen6 \hbox{##1{\strut##3}}}% \positionFLOWzero}% \def\doFLOWrlabel##1##2##3% - {\scratchdimen=\ifcase##2 \!!zeropoint\else\@@FLOWdx\fi + {\scratchdimen=\ifcase##2 \zeropoint\else\@@FLOWdx\fi \setbox0=\hbox{\hskip\dimen0\hskip\scratchdimen \hbox{\raise\dimen6\hbox{##1{\strut##3}}}}% \positionFLOWzero}% @@ -900,8 +922,8 @@ \!!countd=\@@FLOWy \advance\!!countc \@@FLOWnx \advance\!!countd \@@FLOWny - \advance\!!countc -1 - \advance\!!countd -1 + \advance\!!countc \minusone + \advance\!!countd \minusone \ifnum\!!counta<\@@FLOWx\relax \donefalse \else\ifnum\!!counta>\!!countc @@ -914,15 +936,15 @@ \donetrue \fi\fi\fi\fi \ifdone - \advance\!!counta by -\@@FLOWx\advance\!!counta by 1 - \advance\!!countb by -\@@FLOWy\advance\!!countb by 1 + \advance\!!counta -\@@FLOWx\advance\!!counta \plusone + \advance\!!countb -\@@FLOWy\advance\!!countb \plusone \dimen0=\FLOWgridwidth\dimen0=\!!counta\dimen0 - \advance\dimen0 by -\FLOWgridwidth - \dimen4=\FLOWgridwidth\advance\dimen4 by -\FLOWshapewidth - \advance\dimen0 by .5\dimen4 + \advance\dimen0 -\FLOWgridwidth + \dimen4=\FLOWgridwidth\advance\dimen4 -\FLOWshapewidth + \advance\dimen0 .5\dimen4 \dimen2=\FLOWgridheight\dimen2=\!!countb\dimen2 - \dimen4=\FLOWgridheight\advance\dimen4 by -\FLOWshapeheight - \advance\dimen2 by -.5\dimen4 + \dimen4=\FLOWgridheight\advance\dimen4 -\FLOWshapeheight + \advance\dimen2 -.5\dimen4 \edef\FLOWdx{\the\dimen0}% \edef\FLOWdy{\the\dimen2}% \setbox0=\hbox @@ -975,7 +997,7 @@ \def\dodoFLOWlocationF#1#2#3#4% {\ifnum#1#2#4\relax - \!!counta=#1\advance\!!counta by #31\relax + \!!counta=#1\advance\!!counta #31\relax \edef#4{\ifnum\!!counta<1 1\else\the\!!counta\fi}% \fi} @@ -983,7 +1005,7 @@ {\ifdone \let#1=#2% \!!counta=#3% - \advance\!!counta 1\advance\!!counta -#2\relax + \advance\!!counta \plusone\advance\!!counta -#2\relax \ifnum\!!counta<1 \!!counta=1 \fi \edef#4{\the\!!counta}% \else @@ -1029,7 +1051,7 @@ %D A hook into the help system. \def\showFLOWhelp#1% - {\doifhelpinfo{\FLOWhelp} + {\doifhelpinfo\FLOWhelp {\setbox#1=\hbox {\setbox\scratchbox=\hbox{\lower\@@FLOWdy\hbox {\helpbutton @@ -1101,13 +1123,13 @@ \global\let\FLOWsplity\@@FLOTy \doloop {\bgroup - \scratchcounter=\FLOWmaxwidth - \advance\scratchcounter by -\@@FLOTx - \advance\scratchcounter by 1 + \scratchcounter\FLOWmaxwidth + \advance\scratchcounter -\@@FLOTx + \advance\scratchcounter \plusone \ifnum\scratchcounter<\@@FLOTnx\edef\@@FLOTnx{\the\scratchcounter}\fi - \scratchcounter=\FLOWmaxheight - \advance\scratchcounter by -\@@FLOTy - \advance\scratchcounter by 1 + \scratchcounter\FLOWmaxheight + \advance\scratchcounter -\@@FLOTy + \advance\scratchcounter \plusone \ifnum\scratchcounter<\@@FLOTny\edef\@@FLOTny{\the\scratchcounter}\fi #1% does something with the float, or not \egroup @@ -1129,7 +1151,7 @@ \def\dododoFLOWcharts[#1][#2]% {\bgroup \@@FLOTvoor - \doifnot{\@@FLOTmarkering}{\v!aan}{\let\cuthbox\hbox}% + \doifnot\@@FLOTmarkering\v!aan{\let\cuthbox\hbox}% \cuthbox {\@@FLOTcommando {\FLOWchart[#1][#2, @@ -1188,7 +1210,7 @@ %D \def\Whow#1% %D {\ifnum\currentFLOWset=1 \framed{Some Chart}\fi} %D -%D \handleFLOWset[convert-en] % [tag] +%D \FLOWset[convert-en] % [tag] %D %D \def\Whow#1% %D {\setuphead[status=hoog] @@ -1196,13 +1218,13 @@ %D \centerbox{#1} %D \stopstandardmakeup} %D -%D \handleFLOWset[convert-en] % [tag] +%D \FLOWset[convert-en] % [tag] %D \stoptypen -\def\startFLOWset% +\def\startFLOWset {\dodoubleempty\dostartFLOWset} -\def\dostartFLOWset[#1][#2]#3\stopFLOWset% tag name data +\def\dostartFLOWset[#1][#2]#3\stopFLOWset % tag name data {\ifsecondargument \long\setvalue{\@FLOX@#1}{\dohandleFLOWset{#1}{#2}{#3}}% \else @@ -1211,7 +1233,7 @@ \long\def\dohandleFLOWset#1#2#3% tag name data {\bgroup - \def\subFLOWchart% + \def\subFLOWchart {\dodoubleempty\dosubFLOWchart}% \def\dosubFLOWchart[##1][##2]% subtag settings {\ifsecondargument diff --git a/tex/context/base/m-graph.tex b/tex/context/base/m-graph.tex new file mode 100644 index 000000000..9b22ac078 --- /dev/null +++ b/tex/context/base/m-graph.tex @@ -0,0 +1,232 @@ +%D \module +%D [ file=m-graph, +%D version=2000.08.06, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=\METAPOST\ graph module support, +%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 I finally finished graph support, if only because I could +%D not stand the idea that Karel Wesseling would revert to +%D \PiCTeX. + +% pre 2000.08.06 version +% +% \forceMPTEXgraphictrue +% +% \appendtoks +% initialize_numbers ; % make sure that pseudo typesetting is set up +% input graph ; % load the graph package +% Autoform := "@g" ; % change the % template char into @ +% \to \MPinitializations + +%D The latest version does things more automatically (and +%D efficiently when no text processing is needed). For +%D definitions embedded in your document, you need to +%D use \type {@} as template character, in external files, +%D \type {%} is also supported. + +\appendtoks input graph ; \to \MPinitializations + +%D Graphics that have \type {begingraph} in them are +%D recognized as such and force handling of embedded \TEX\ +%D code. + +\forceMPTEXcheck{begingraph} + +%D If you run into troubles, try: +%D +%D \starttypen +%D \forceMPTEXgraphictrue +%D \stoptypen +%D +%D A demo can be run with: +%D +%D \starttypen +%D texexec --mode=demo --pdf m-graph +%D \stoptypen + +% No longer needed, since John will fix it. +% +% %D For the moment we need the following patch. Adam T. Lindsay +% %D found out that the following code produced an error: +% %D +% %D \starttypen +% %D \startMPcode +% %D draw begingraph(130mm,35mm); +% %D setrange(0,0,10,22000); +% %D glabel.lft(btex {correct 0--22000} etex rotated 90, OUT); +% %D autogrid(itick.bot,grid.lft) withcolor .75white ; +% %D endgraph; +% %D \stopMPcode +% %D +% %D \startMPcode +% %D draw begingraph(130mm,35mm); +% %D setrange(0,50,10,22000); +% %D glabel.lft(btex {wrong 50--22000} etex rotated 90, OUT); +% %D autogrid(itick.bot,grid.lft) withcolor .75white ; +% %D endgraph; +% %D \stopMPcode +% %D +% %D \startMPcode +% %D draw begingraph(130mm,35mm); +% %D setrange(0,110,10,30000); +% %D glabel.lft(btex {failed 110--22000} etex rotated 90, OUT); +% %D autogrid(itick.bot,grid.lft) withcolor .75white ; +% %D endgraph; +% %D \stopMPcode +% %D \stoptypen +% %D +% %D The bug is a rather nasty one and needs some tweaking in +% %D the low level graph code. John Hobby suggested for the +% %D moment to initialize \type {setrange} as follows: +% %D +% %D \starttypen +% %D setrange(0,0,"22000","22000") +% %D \stoptypen +% %D +% %D Folowing this suggesion, I provide the following +% %D extension: +% +% % \appendtoks +% def begingraph(expr w, h) = +% begingroup +% save X_, Y_, Gfin_, Gcur_, Gcbb_, Gneedgr_, Gneedfr_, Gdidsc_; +% save Gdpic_, Gppic_, Ggl_, Garw_; +% picture Gfin_, Gcur_, Gcbb_, Gdpic_, Gppic_, Ggl_[]; +% boolean Gneedgr_, Gneedfr_, Gdidsc_; +% Gfin_ = nullpicture; +% Gcur_ = nullpicture; +% Gcbb_ = nullpicture; +% X_.ctyp = Y_.ctyp = linear; +% Z_.gdim = (w,h); +% X_.sc = Y_.sc = 0; +% Gneedgr_ = true; +% Gneedfr_ = true; +% Gdidsc_ = false; +% Gdpic_ = nullpicture; +% Garw_ = 0; +% scantokens everybegingraph ; +% enddef; +% +% boolean fixsetrange ; fixsetrange := true ; +% +% vardef dosetrange(text t) = +% interim warningcheck:=0; +% save r_; r_=0; +% string r_[]s; +% for x_= +% for p_=t: if pair p_: xpart p_, ypart fi p_, endfor: +% r_[incr r_] if string x_: s fi = x_; +% if r_>2: +% Gsetr_ if r_=3: X_(Gxcvlin_) else: Y_(Gycvlin_) fi( +% r_[r_-2] if unknown r_[r_-2]: s fi, x_); +% fi +% exitif r_=4; +% endfor +% enddef; +% +% vardef setrange(text t) = +% if fixsetrange : dosetrange(0,0,20000,20000) ; fi ; +% dosetrange(t) ; +% enddef ; +% +% if unknown everybegingraph : +% string everybegingraph ; +% % everybegingraph := "setrange(0,0,20000,20000)" ; +% fi ; +% \to \MPinitializations + +\appendtoks + % @# is X_ or Y_; $ is Gxcvlin_ or Gycvlin_; l and h are numeric or string + % It would not be OK to set (@#low,@#high) to a pair expression because $ might + % try to rescale @#low when evaluating the right-hand side for @#high. + vardef Gsetr_@#(suffix $)(expr l, h) = + Gclbnds_@# ; + if @#ctyp>0 : + @#low = if abs @#ctyp<>log: $ fi Mlog_Str l ; + @#high = if abs @#ctyp<>log: $ fi Mlog_Str h ; + else : + -@#high = if abs @#ctyp<>log: $ fi Mlog_Str l ; + -@#low = if abs @#ctyp<>log: $ fi Mlog_Str h ; + fi + enddef ; +\to \MPinitializations + +\doifnotmode {demo} {\endinput} + +%D You need to have the data files in your path, +%D otherwise the run is aborted. + +\doiffileelse {agepop91.d} + {} {\writestatus{graph}{no data files found}\wait\end} + +%D The test: + +\starttext + +\startMPpage +draw begingraph(3in,2in); + gdraw "agepop91.d"; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + gdraw "agepop91.d" plot btex$\bullet$etex; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); + glabel.bot(btex Age in years etex, OUT); + gdraw "agepopm.d"; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); + glabel.bot(btex Age in years etex, OUT); + setrange(origin, whatever,whatever); + gdraw "agepopm.d"; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(2.3in,2in); + setcoords(log,log); + glabel.lft(btex Seconds etex,OUT); + glabel.bot(btex Matrix size etex, + OUT); + gdraw "matmul.d" dashed evenly; + glabel.ulft(btex Standard etex,8); + gdraw "matmul.d"; + glabel.lrt(btex Strassen etex,7); + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(6.5cm,4.5cm); + setrange(80,0, 90,whatever); + glabel.bot(btex Year etex, OUT); + glabel.lft(btex \vbox{\hbox{Emissions in} \hbox{thousands of} + \hbox{metric tons} \hbox{(heavy line)}}etex, OUT); + gdraw "lead.d" withpen pencircle scaled 1.5pt; + autogrid(,otick.lft); + setcoords(linear,linear); + setrange(80,0, 90,whatever); + glabel.rt(btex \vbox{\hbox{Micrograms} \hbox{per cubic} + \hbox{meter of air} \hbox{(thin line)}}etex, OUT); + gdraw "lead.d"; + autogrid(otick.bot,otick.rt); + endgraph; +\stopMPpage + +\stoptext diff --git a/tex/context/base/m-newmat.tex b/tex/context/base/m-newmat.tex index 0dd3095e2..8179af432 100644 --- a/tex/context/base/m-newmat.tex +++ b/tex/context/base/m-newmat.tex @@ -69,7 +69,7 @@ %D be a control sequence like \type {\over}. \unexpanded\def\genfrac#1#2#3#4% - {\def\!!stringa + {\edef\!!stringa {#1#2}% \expanded {\dogenfrac{#4}% @@ -98,6 +98,10 @@ %D %D [TH] No need to make these \type {\unexpanded} as well. +%\def\dfrac {\genfrac\empty\empty\empty\displaystyle} +%\def\tfrac {\genfrac\empty\empty\empty\textstyle} +%\def\frac {\genfrac\empty\empty\empty\donothing} + \def\dfrac {\genfrac{}{}{}\displaystyle} \def\tfrac {\genfrac{}{}{}\textstyle} \def\frac {\genfrac{}{}{}\donothing} @@ -106,6 +110,13 @@ \def\tbinom{\genfrac()\zeropoint\textstyle} \def\binom {\genfrac()\zeropoint\donothing} +\def\xfrac {\genfrac{}{}{}\scriptstyle} +\def\xxfrac{\genfrac{}{}{}\scriptscriptstyle} + +%D Better: + +\def\frac#1#2{\mathematics{\genfrac{}{}{}\donothing{#1}{#2}}} + %D [HH] This shows up as: %D %D \startbuffer @@ -118,7 +129,7 @@ %D \getbuffer %D \macros -%D {text} +%D {text} %D %D [TH] \type {\text} is a command to typeset more or less %D ordinary text inside of super- and sub|-|scripts. It has to @@ -126,23 +137,35 @@ %D quite slow. \type {\text} kind of replaces \CONTEXT's \type %D {\mathstyle} command. -\unexpanded\def\text - {\ifmmode\@EA\dotext\else\@EA\hbox\fi} - -\def\dotext#1% - {\mathchoice - {\dodotext\displaystyle\textface {#1}}% - {\dodotext\textstyle \textface {#1}}% - {\dodotext\textstyle \scriptface {#1}}% - {\dodotext\textstyle \scriptscriptface{#1}}} - -\def\dodotext#1#2#3% no \everymath ! - %{\hbox{\everymath{#1}\switchtobodyfont [#2]#3}} % 15 sec - %{\hbox{\everymath{#1}\setcurrentfontbody {#2}#3}} % 3 sec (no math) - {\hbox{\everymath{#1}\fastswitchtobodyfont{#2}#3}} % 10 sec +%D [HH] This macro is now also moved to the core, but we +%D keep it here as well for completeness. +%D +%D \startypen +%D \unexpanded\def\mathtext +%D {\mathortext\domathtext\hbox} % {\ifmmode\@EA\dotext\else\@EA\hbox\fi} +%D +%D \def\domathtext#1% +%D {\mathchoice +%D {\dodomathtext\displaystyle\textface {#1}}% +%D {\dodomathtext\textstyle \textface {#1}}% +%D {\dodomathtext\textstyle \scriptface {#1}}% +%D {\dodomathtext\textstyle \scriptscriptface{#1}}} +%D +%D \def\dodomathtext#1#2#3% no \everymath ! +%D %{\hbox{\everymath{#1}\switchtobodyfont [#2]#3}} % 15 sec +%D {\hbox{\everymath{#1}\setcurrentfontbody{#2}#3}} % 3 sec (no math) +%D \stoptypen + +%D [HH] We use the following indirectness because \type {\text} +%D is a natural candidate for user macros (actually, it is +%D used in some modules). +%D +%D \starttypen +%D \let\text\mathtext +%D \stoptypen -%D [HH] Actually, this switch is not that slow when typefaces -%D are used. If needed this macro can be sped up. +%D [HH] Actually, the font switch is not that slow when +%D typefaces are used. If needed this macro can be sped up. %D %D \startbuffer %D ordinary text $x^{\text{extra ordinary text}}$ @@ -159,7 +182,7 @@ %D defined in Plain \TEX). It allows to get a math character %D inserted as if it was a text character. -\gdef\mathhexbox#1#2#3{\text{$\m@th\mathchar"#1#2#3$}} +\gdef\mathhexbox#1#2#3{\mathtext{$\m@th\mathchar"#1#2#3$}} %D \macros %D {boxed} @@ -221,16 +244,6 @@ %D %D \getbuffer -%D \macros -%D {fraktur, gothic, caligraphic} -%D -%D [TH] A redefinition that uses \type {\text} instead of -%D \type {\hbox}, adding auto||scaling in super- and subscripts - -\def\fraktur #1{\ifmmode\@EA\text\fi{{\frak#1}}} -\def\gothic #1{\ifmmode\@EA\text\fi{{\goth#1}}} -\def\caligraphic#1{\ifmmode\@EA\text\fi{{\cal #1}}} - \protect \endinput %D \macros @@ -241,7 +254,7 @@ %D support an optional argument between either \type {{}} or %D \type {[]}. -\def\startsubarray% +\def\startsubarray {\doifnextcharelse\bgroup \simplestartsubarray{\dosingleempty\complexstartsubarray}} @@ -256,11 +269,11 @@ \lineskiplimit\lineskip \ialign\bgroup\ifx c#1\hfil\fi$\m@th\scriptstyle##$\hfil\crcr} -\def\stopsubarray% +\def\stopsubarray {\crcr\egroup \egroup} -\def\startsubstack% +\def\startsubstack {\doifnextcharelse\bgroup \simplestartsubstack{\dosingleempty\complexstartsubstack}} diff --git a/tex/context/base/m-pictex.tex b/tex/context/base/m-pictex.tex index db06ffd5c..85ae90118 100644 --- a/tex/context/base/m-pictex.tex +++ b/tex/context/base/m-pictex.tex @@ -102,11 +102,11 @@ %D \DIMENSIONS ! %D %D \starttypen -%D \def\newdimen% +%D \def\newdimen %D {\ifnum\count11>\count12 -%D \let\next=\temporarynewskip +%D \let\next\temporarynewskip %D \else -%D \let\next=\temporarynewdimen +%D \let\next\temporarynewdimen %D \fi %D \next} %D \stoptypen diff --git a/tex/context/base/m-steps.tex b/tex/context/base/m-steps.tex index 00a8c1ae3..b69aa7ecc 100644 --- a/tex/context/base/m-steps.tex +++ b/tex/context/base/m-steps.tex @@ -391,11 +391,12 @@ \newcounter\cellcounter \newcounter\textcounter -\def\startSTEPchart% +\def\startSTEPchart {\dosingleempty\dostartSTEPchart} \long\def\dostartSTEPchart[#1]#2\stopSTEPchart - {\ifinsidefloat \else + {\ifinsidefloat + \else \witruimte \@@STPCvoor \startbaselinecorrection @@ -414,14 +415,10 @@ \stopMPdrawing \initializeSTEP \initializeSTPC -\global - \chardef\somestepboxone=1 -\global - \chardef\sometextboxone=1 -\global - \chardef\somestepboxtwo\somestepboxone -\global - \chardef\sometextboxtwo\sometextboxone + \global\chardef\somestepboxone\plusone + \global\chardef\sometextboxone\plusone + \global\chardef\somestepboxtwo\somestepboxone + \global\chardef\sometextboxtwo\sometextboxone \def\startlines{\bgroup\setupSTEPlines}% \def\stoplines {\egroup}% \def\cells{\dosingleempty\dostepchartcells} @@ -430,10 +427,8 @@ \def\text {\dosingleempty\dotext}% \def\docell[##1]{\dostepchartcells[##1]{}}% \def\dotext[##1]{\dostepcharttexts[##1]{}} -\doglobal - \newcounter\cellcounter -\doglobal - \newcounter\textcounter + \doglobal\newcounter\cellcounter + \doglobal\newcounter\textcounter \let\dostepchartcells\doSTEPchartcellsA \let\dostepcharttexts\doSTEPcharttextsA {#2} % pass one: cells and texts {} keeps setting local @@ -441,10 +436,8 @@ nofcells := \cellcounter ; analyze_step_chart ; \stopMPdrawing -\doglobal - \newcounter\cellcounter -\doglobal - \newcounter\textcounter + \doglobal\newcounter\cellcounter + \doglobal\newcounter\textcounter \let\dostepchartcells\doSTEPchartcellsB \let\dostepcharttexts\doSTEPcharttextsB {#2} % pass two: lines @@ -457,11 +450,13 @@ anchor_box(\MPpos{\stepchartprefix origin}) ; \stopMPdrawing \MPdrawingdonetrue - \setbox0=\vbox{\MPstaticgraphictrue\getMPdrawing}% + \doifelse\@@STPCmethode{0} + {\setbox0\null} + {\setbox0\vbox{\MPstaticgraphictrue\getMPdrawing}}% \resetMPdrawing - \setbox2=\vbox + \setbox2\vbox {\offinterlineskip - \scratchdimen=\@@STPChoogte + \scratchdimen\@@STPChoogte \advance\scratchdimen\@@STPCoffset \advance\scratchdimen\@@STPCoffset \ifcase\sometextboxone \box\textboxone \vskip\scratchdimen \fi @@ -470,7 +465,7 @@ \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}% + %\kern-\scratchdimen % no, instead: \vskip-\lastskip} \hbox {\scratchdimen\wd0 @@ -491,24 +486,23 @@ {% synchronize texts \doSTEPchartcellsAB[#1]{#2}{#3}% % package steps - \setbox0=\hbox{\doifsomething{#2}{\@@stepcell{#2}}}% - \setbox2=\hbox{\doifsomething{#3}{\@@stepcell{#3}}}% + \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}% + \setbox2\hbox to \wd0{\hss\box2\hss}% \else - \setbox0=\hbox to \wd2{\hss\box0\hss}% + \setbox0\hbox to \wd2{\hss\box0\hss}% \fi \if!!donea \startMPdrawing cells[t][\cellcounter] := nullpicture ; \stopMPdrawing \else -\global - \chardef\somestepboxone=0 + \global\chardef\somestepboxone\zerocount \edef\stepidentifier{\stepchartprefix\cellcounter-t-c}% - \setbox0=\hbox{\hpos{\stepidentifier}{\box0}}% + \setbox0\hbox{\hpos{\stepidentifier}{\box0}}% \bgroup \iffirstargument\setupSTEPcells[#1]\fi\initializeSTEC \startMPdrawing @@ -522,10 +516,9 @@ cells[b][\cellcounter] := nullpicture ; \stopMPdrawing \else -\global - \chardef\somestepboxtwo=0 + \global\chardef\somestepboxtwo\zerocount \edef\stepidentifier{\stepchartprefix\cellcounter-b-c}% - \setbox2=\hbox{\hpos{\stepidentifier}{\box2}}% + \setbox2\hbox{\hpos{\stepidentifier}{\box2}}% \bgroup \iffirstargument\setupSTEPcells[#1]\fi\initializeSTEC \startMPdrawing @@ -534,13 +527,11 @@ \stopMPdrawing \egroup \fi -\global - \setbox\stepboxone=\hbox + \global\setbox\stepboxone\hbox {\ifdim\wd\stepboxone>\zeropoint \box\stepboxone\hskip\@@STPChoffset\else \fi\box0}% -\global - \setbox\stepboxtwo=\hbox + \global\setbox\stepboxtwo\hbox {\ifdim\wd\stepboxtwo>\zeropoint \box\stepboxtwo\hskip\@@STPChoffset\else \fi\box2}% @@ -556,10 +547,9 @@ {\ifnum\cellcounter>\textcounter \texts{}{}\else\exitloop \fi}% -\doglobal - \increment\cellcounter} + \doglobal\increment\cellcounter} -\def\doSTEPchartcellsBA% +\def\doSTEPchartcellsBA {\scratchtoks\stepchartbuffer \stepchartbuffer\emptytoks \the\scratchtoks} @@ -584,23 +574,21 @@ \def\dodoSTEPcharttextsA#1#2#3#4% #1=number #2=setup {\dodoSTEPcharttextsAB{#1}{#2}{#3}{#4}\dodoSTEPcharttextsA \ifnum\textcounter>\cellcounter\relax -\doglobal - \decrement\textcounter\relax + \doglobal\decrement\textcounter\relax \else - \setbox0=\hbox{\doifsomething{#3}{\@@steptext{#3}}}% - \setbox2=\hbox{\doifsomething{#4}{\@@steptext{#4}}}% + \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}% + \setbox0\hbox to \@@STPChoffset{\hss}% \startMPdrawing texts[t][#1][\textcounter] := nullpicture ; \stopMPdrawing - \else -\global - \chardef\sometextboxone=0 + \else + \global\chardef\sometextboxone\zerocount \edef\stepidentifier{\stepchartprefix#1-\textcounter-t-t}% - \setbox0=\hbox to \@@STPChoffset + \setbox0\hbox to \@@STPChoffset {\hss\hpos{\stepidentifier}{\box0}\hss}% \bgroup \setupSTEPtexts[#2]\initializeSTET @@ -611,15 +599,14 @@ \egroup \fi \if!!doneb - \setbox2=\hbox to \@@STPChoffset{\hss}% + \setbox2\hbox to \@@STPChoffset{\hss}% \startMPdrawing texts[b][#1][\textcounter] := nullpicture ; \stopMPdrawing \else -\global - \chardef\sometextboxtwo=0 + \global\chardef\sometextboxtwo\zerocount \edef\stepidentifier{\stepchartprefix#1-\textcounter-b-t}% - \setbox2=\hbox to \@@STPChoffset + \setbox2\hbox to \@@STPChoffset {\hss\hpos{\stepidentifier}{\box2}\hss}% \bgroup \setupSTEPtexts[#2]\initializeSTET @@ -629,11 +616,9 @@ \stopMPdrawing \egroup \fi -\global - \setbox\textboxone=\hbox + \global\setbox\textboxone\hbox {\hbox to \wd\stepboxone{\box\textboxone\hss}\box0} -\global - \setbox\textboxtwo=\hbox + \global\setbox\textboxtwo\hbox {\hbox to \wd\stepboxtwo{\box\textboxtwo\hss}\box2} \fi} @@ -643,8 +628,7 @@ \def\dodoSTEPcharttextsB#1#2#3#4% #1=number #2=setup {\dodoSTEPcharttextsAB{#1}{#2}{#3}{#4}\dodoSTEPcharttextsB \ifnum\textcounter>\cellcounter\relax -\doglobal - \decrement\textcounter\relax + \doglobal\decrement\textcounter\relax \else \bgroup \initializeSTEL @@ -656,46 +640,43 @@ \fi} \def\dodoSTEPcharttextsAB#1#2#3#4#5% #1=number #2=setup - {% -\doglobal - \increment\textcounter\relax + {\doglobal\increment\textcounter\relax \ifnum\textcounter>\cellcounter\relax \@EA\appendtoks\@EA#5\@EA{#1}{#2}{#3}{#4}\to\stepchartbuffer \fi} \def\MPtextsgraphic - {image ( drawshape ( + {image(drawshape( \@@STETvariant, pxy enlarged (-.5*\@@STEToffset), \@@STETlijndikte, \MPcolor{\@@STETkaderkleur}, \MPcolor{\@@STETachtergrondkleur} ) )} \def\MPcharttoplinesgraphic#1#2% - {image ( drawline ( + {image(drawline( \@@STELvariant, get_step_chart_top_line(#1,#2), \@@STELlijndikte, \MPcolor{\@@STELkleur} ) )} \def\MPchartbotlinesgraphic#1#2% - {image ( drawline ( + {image(drawline( \@@STELvariant, get_step_chart_bot_line(#1,#2), \@@STELlijndikte, \MPcolor{\@@STELkleur} ) )} %D \XML\ coupling. -\defineXMLpickup - [stepchart] [@@STPC] +\defineXMLpickup[stepchart][@@STPC] {\bgroup \defineXMLpush[top]% \defineXMLpush[bot]% - \defineXMLenvironment [lines] [@@STEL] + \defineXMLenvironment[lines][@@STEL] {\expanded{\startlines[\theXMLarguments{@@STEL}]}} {\stoplines}% - \defineXMLenvironment [cells] [@@STEC] + \defineXMLenvironment[cells][@@STEC] {\XMLerase{top}\XMLerase{bot}} {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{top}}{\XMLpop{bot}}}}% - \defineXMLenvironment [texts] [@@STET] + \defineXMLenvironment[texts][@@STET] {\XMLerase{top}\XMLerase{bot}} {\expanded{\texts[\theXMLarguments{@@STET}]{\XMLpop{top}}{\XMLpop{bot}}}}% - \defineXMLenvironmentpush [cell] [@@STEC] + \defineXMLenvironmentpush[cell][@@STEC] {\XMLerase{cell}} {\expanded{\cell [\theXMLarguments{@@STEC}]{\XMLpop{cell}}}}% \defineXMLenvironmentpush [text] [@@STET] @@ -721,7 +702,14 @@ {\dodoubleempty\dostartSTEPaligntable[1]} \def\dostartSTEPaligntable[#1][#2]#3\stopSTEPaligntable % flag settings data - {\ifinsidefloat \else \witruimte \@@STPTvoor \startbaselinecorrection \fi + {\ifinsidefloat + \else + \witruimte + \@@STPTvoor + \startbaselinecorrection + \setlocalhsize + \noindent + \fi \vbox\bgroup \setupSTEPtables[#2]% \forgetall @@ -740,9 +728,9 @@ \def\cells {\dosingleempty\docells}% \def\text {\dosingleempty\dotext}% % first graphic pass, also trial pass - \global\dimen1=\zeropoint - \global\dimen3=\zeropoint - \global\dimen5=\zeropoint + \global\dimen1\zeropoint + \global\dimen3\zeropoint + \global\dimen5\zeropoint \def\docell[##1]% {\docells[##1]{}{}}% \def\docells[##1]##2##3##4% @@ -758,7 +746,7 @@ \stopMPdrawing \egroup \def\do####1####2% - {\setbox\scratchbox=\hbox{\@@stepfake{####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% @@ -791,7 +779,9 @@ anchor_box(\MPpos{\steptableprefix origin}) ; \stopMPdrawing \MPdrawingdonetrue - \setbox0=\vbox{\MPstaticgraphictrue\getMPdrawing}% + \doifelse\@@STPTmethode{0} + {\setbox0\null} + {\setbox0\vbox{\MPstaticgraphictrue\getMPdrawing}}% \resetMPdrawing % typesetting pass \dimen6=\@@STPTafstand \dimen6=2\dimen6 @@ -809,7 +799,7 @@ {\doglobal\increment\cellcounter \def\do####1####2####3####4% % strut really needed there ! {\hbox to \dimen####1{####2\@@stepfake{####3}\strut####4}}% - \setbox8=\hbox + \setbox8\hbox {\ifcase#1\else \do1\hss{##2}\relax \hskip\@@STPTafstand \do3\hss{##3}\hss \hskip\@@STPTafstand @@ -824,7 +814,7 @@ \hskip\dimen8 \advance\hsize-\dimen8 \advance\hsize-\dimen6 % twice the offset - \setbox0=\hbox{\@@steptext{##2}}% + \setbox0\hbox{\@@steptext{##2}}% % to do % \ifdim\wd0>\hsize % \setbox0=\vbox{\@@steptext{##2}}% @@ -835,7 +825,7 @@ \egroup \nointerlineskip \kern\@@STPTvoffset} - \setbox2=\vbox + \setbox2\vbox {\doglobal\newcounter\cellcounter #3\kern-\@@STPTvoffset} \hbox @@ -853,35 +843,33 @@ \@@STELvariant, get_step_table_line(\cellcounter), \@@STELlijndikte, \MPcolor{\@@STELkleur} ) )} -\defineXMLpickup - [steptable] [@@STPT] +\defineXMLpickup[steptable][@@STPT] {\bgroup - \defineXMLenvironment [lines] [@@STEL] + \defineXMLenvironment[lines][@@STEL] {\expanded{\startlines[\theXMLarguments{@@STEL}]}} {\stoplines}% - \defineXMLargument [cell] [@@STEC] + \defineXMLargument[cell][@@STEC] {\expanded{\cell[\theXMLarguments{@@STEC}]}}% - \defineXMLargument [text] [@@STET] + \defineXMLargument[text][@@STET] {\expanded{\text[\theXMLarguments{@@STET}]}}% - \defineXMLargument [prep] + \defineXMLargument[prep] {\prep}% \expanded{\startSTEPtable[\theXMLarguments{@@STPT}]}} {\stopSTEPtable \egroup} -\defineXMLpickup - [stepaligntable] [@@STPT] +\defineXMLpickup[stepaligntable][@@STPT] {\bgroup - \defineXMLenvironment [lines] [@@STEL] + \defineXMLenvironment[lines][@@STEL] {\expanded{\setupSTEPlines[\theXMLarguments{@@STEL}]}} {}% \defineXMLpush[c1]\defineXMLpush[c2]\defineXMLpush[c3]% - \defineXMLenvironment [cells] [@@STEC] + \defineXMLenvironment[cells][@@STEC] {\XMLerase{c1}\XMLerase{c1}\XMLerase{c3}} {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{c1}}{\XMLpop{c2}}{\XMLpop{c3}}}}% - \defineXMLargument [text] [@@STET] + \defineXMLargument[text][@@STET] {\expanded{\text[\theXMLarguments{@@STET}]}}% - \defineXMLargument [prep] + \defineXMLargument[prep] {\prep}% \expanded{\startSTEPaligntable[\theXMLarguments{@@STPT}]}} {\stopSTEPaligntable diff --git a/tex/context/base/math-ams.tex b/tex/context/base/math-ams.tex index 55e5596d9..6bdea52a5 100644 --- a/tex/context/base/math-ams.tex +++ b/tex/context/base/math-ams.tex @@ -15,7 +15,7 @@ % maybe we should just include these into the default tex one -\definefamilysynonym [ams] [blackboard] [mb] +%definefamilysynonym [ams] [blackboard] [mb] \startmathcollection [default] % [ams] @@ -33,7 +33,7 @@ \stopmathcollection -\startmathcollection[default] +\startmathcollection[default] % [ams] \definemathsymbol [internalAnd] [rel] [operators] ["26] @@ -181,6 +181,17 @@ \startmathcollection [default] % [ams] +\definemathcommand [integers] {\blackboard{Z}} +\definemathcommand [reals] {\blackboard{R}} +\definemathcommand [rationals] {\blackboard{Q}} +\definemathcommand [naturalnumbers] {\blackboard{N}} +\definemathcommand [complexes] {\blackboard{C}} +\definemathcommand [primes] {\blackboard{P}} + +\stopmathcollection + +\startmathcollection [default] % [ams] + \definemathsymbol [lvertneqq] [rel] [mb] ["00] \definemathsymbol [gvertneqq] [rel] [mb] ["01] \definemathsymbol [nleq] [rel] [mb] ["02] diff --git a/tex/context/base/math-ini.tex b/tex/context/base/math-ini.tex index eae2b41ef..009c33df0 100644 --- a/tex/context/base/math-ini.tex +++ b/tex/context/base/math-ini.tex @@ -25,12 +25,11 @@ \unprotect -\def\@mt@{@mt@} % math token -\def\@mt@{@mc@} % math character -\def\@mh@{@mh@} % math handler +\def\@ml@{@ml@} % math list (used for collection) \def\@mf@{@mf@} % math family -\def\@mc@{@mc@} % math class -\def\@ml@{@mc@} % math list +%def\@mh@{@mh@} % math handler (not used) +\def\@mt@{@mt@} % math token +\def\@mc@{@mc@} % math collection \def\@@mathlimopcomm#1{\mathop{#1}\limits} \def\@@mathnolopcomm#1{\mathop{#1}\nolimits} @@ -158,7 +157,7 @@ \let\dohandlecommand\dohandlemathtoken -\def\definefamilysynonym% +\def\definefamilysynonym {\dotripleempty\dodefinefamilysynonym} \def\dodefinefamilysynonym[#1][#2][#3]% [mathcollection] [] [] @@ -251,8 +250,8 @@ {\setmathtoks \ifdynamicmathfamilies \let\purefamilyhex\relax \fi \doifnumberelse{#1} - {\scratchcounter=#1} - {\scratchcounter=\@EA`\string#1}% + {\scratchcounter#1} + {\scratchcounter\@EA`\string#1}% \expanded {\appendtoks \ifsixthargument @@ -311,29 +310,26 @@ \doifundefined{\@ml@\mathcollection} {\expandafter\newtoks\csname\@ml@\mathcollection\endcsname}} -\def\stopmathcollection% +\def\stopmathcollection {\popmacro\mathcollection} \def\startrawmathcollection% - {%\pushmacro\iftracemathcollection % does not work in new push - %\tracemathcollectionfalse - \startmathcollection} + {\startmathcollection} \def\stoprawmathcollection% - {%\popmacro\iftracemathcollection - \stopmathcollection} + {\stopmathcollection} \newtoks\mathtoks -\def\setmathtoks% +\def\setmathtoks {\@EA\let\@EA\mathtoks\csname\@ml@\mathcollection\endcsname} \def\currentmathcollection{\mathcollection} -\def\nomathcollection{\s!default} +\let\nomathcollection\s!default \def\enablemathcollection[#1]% - {\doifnot{#1}{\s!default} + {\doifnot{#1}\s!default {\setmathcollection\s!default \the\csname\@ml@\mathcollection\endcsname}% \setmathcollection{#1}% @@ -355,6 +351,7 @@ \appendtoks\autoenablemathcollection\to\mathstrategies \fetchruntimecommand \showmathcharacters {\f!mathprefix\s!run} +\fetchruntimecommand \showmathtoken {\f!mathprefix\s!run} %D \macros %D {ifmathpunctuation, enablemathpunctuation, @@ -381,7 +378,6 @@ \fi} \unexpanded\def\dohandlemathpunctuation#1#2% \if fails in mathml interval -% {\def\next{\csname\if\space\nexttoken#2\else#1\fi\endcsname}% {\def\next{\csname\ifx\space\nexttoken#2\else#1\fi\endcsname}% \futurelet\nexttoken\next} @@ -393,6 +389,10 @@ %D %D \blanko{\getbuffer}\blanko +%D needed for sin, cos etc + +\def\mfunction#1{{\mr#1}} + \edef\hexmrfam {0} \edef\hexbsfam {8} \edef\hexmifam {1} \edef\hexbifam {9} \edef\hexsyfam {2} \edef\hexscfam {A} @@ -423,6 +423,29 @@ \def\Angstrom{\nomathematics{\Aring}} +%D Bold math: +%D +%D \starttypen +%D \usetypescript [lucida] [texnansi] +%D +%D \definetypeface [boldmath] [rm] [serif] +%D [lucida] [default] [encoding=texnansi] +%D \definetypeface [boldmath] [tt] [mono] +%D [lucida] [default] [encoding=texnansi] +%D \definetypeface [boldmath] [ss] [sans] +%D [lucida] [default] [encoding=texnansi] +%D \definetypeface [boldmath] [mm] [boldmath] +%D [lucida] [default] [encoding=texnansi] +%D +%D \switchtobodyfont[lucida,10pt] +%D +%D \showmathtoken{Gamma} $\Gamma \Delta \alpha \delta \zeta$ +%D +%D \switchtobodyfont[boldmath,10pt] +%D +%D \showmathtoken{Gamma} $\Gamma \Delta \alpha \delta \zeta$ +%D \stoptypen + \protect \endinput \tracemathcollectiontrue diff --git a/tex/context/base/math-lbr.tex b/tex/context/base/math-lbr.tex index c93f81cc2..45bfcba0a 100644 --- a/tex/context/base/math-lbr.tex +++ b/tex/context/base/math-lbr.tex @@ -39,6 +39,13 @@ \stopmathcollection +% \startmathcollection[lbr] +% +% \definemathcharacter [:] [punct] [tf] ["3A] % unbelievable +% \definemathcharacter [;] [punct] [tf] ["3B] % unbelievable +% +% \stopmathcollection + \startmathcollection[lbr] \definemathsymbol [ldbrack] [open] [mi] ["82] [ex] ["82] @@ -84,22 +91,34 @@ \stopmathcollection -\definefamilysynonym [lbr] [ucgreek] [ex] +\definefamilysynonym [lbr] [ucgreek] [mb] \definefamilysynonym [lbr] [vargreek] [mi] \startmathcollection[lbr] -\definemathsymbol [Gamma] [alpha] [ucgreek] ["D0] -\definemathsymbol [Delta] [alpha] [ucgreek] ["D1] -\definemathsymbol [Theta] [alpha] [ucgreek] ["D2] -\definemathsymbol [Lambda] [alpha] [ucgreek] ["D3] -\definemathsymbol [Xi] [alpha] [ucgreek] ["D4] -\definemathsymbol [Pi] [alpha] [ucgreek] ["D5] -\definemathsymbol [Sigma] [alpha] [ucgreek] ["D6] -\definemathsymbol [Upsilon] [alpha] [ucgreek] ["D7] -\definemathsymbol [Phi] [alpha] [ucgreek] ["D8] -\definemathsymbol [Psi] [alpha] [ucgreek] ["D9] -\definemathsymbol [Omega] [alpha] [ucgreek] ["DA] +%\definemathsymbol [Gamma] [alpha] [ucgreek] ["D0] +%\definemathsymbol [Delta] [alpha] [ucgreek] ["D1] +%\definemathsymbol [Theta] [alpha] [ucgreek] ["D2] +%\definemathsymbol [Lambda] [alpha] [ucgreek] ["D3] +%\definemathsymbol [Xi] [alpha] [ucgreek] ["D4] +%\definemathsymbol [Pi] [alpha] [ucgreek] ["D5] +%\definemathsymbol [Sigma] [alpha] [ucgreek] ["D6] +%\definemathsymbol [Upsilon] [alpha] [ucgreek] ["D7] +%\definemathsymbol [Phi] [alpha] [ucgreek] ["D8] +%\definemathsymbol [Psi] [alpha] [ucgreek] ["D9] +%\definemathsymbol [Omega] [alpha] [ucgreek] ["DA] + +\definemathsymbol [Gamma] [alpha] [ucgreek] ["00] +\definemathsymbol [Delta] [alpha] [ucgreek] ["01] +\definemathsymbol [Theta] [alpha] [ucgreek] ["02] +\definemathsymbol [Lambda] [alpha] [ucgreek] ["03] +\definemathsymbol [Xi] [alpha] [ucgreek] ["04] +\definemathsymbol [Pi] [alpha] [ucgreek] ["05] +\definemathsymbol [Sigma] [alpha] [ucgreek] ["06] +\definemathsymbol [Upsilon] [alpha] [ucgreek] ["07] +\definemathsymbol [Phi] [alpha] [ucgreek] ["08] +\definemathsymbol [Psi] [alpha] [ucgreek] ["09] +\definemathsymbol [Omega] [alpha] [ucgreek] ["0A] \definemathsymbol [varGamma] [ord] [vargreek] ["00] \definemathsymbol [varDelta] [ord] [vargreek] ["01] @@ -115,6 +134,25 @@ \stopmathcollection +% we define the whole lot, although only a few differ (esp dot) + +\startmathcollection[lbr] + +\definemathsymbol [acute] [accent] [tf] ["13] % mr -> tf +\definemathsymbol [grave] [accent] [tf] ["12] % mr -> tf +\definemathsymbol [ddot] [accent] [tf] ["7F] % mr -> tf +\definemathsymbol [tilde] [accent] [tf] ["7E] % mr -> tf +\definemathsymbol [bar] [accent] [tf] ["16] % mr -> tf +\definemathsymbol [breve] [accent] [tf] ["15] % mr -> tf +\definemathsymbol [check] [accent] [tf] ["14] % mr -> tf +\definemathsymbol [hat] [accent] [tf] ["5E] % mr -> tf +\definemathsymbol [vec] [accent] [mi] ["7E] % [ord] +\definemathsymbol [dot] [accent] [tf] ["05] % mr -> tf, 5F -> 05 +\definemathsymbol [widetilde] [accent] [ex] ["65] % [ord] +\definemathsymbol [widehat] [accent] [ex] ["62] % [ord] + +\stopmathcollection + \def\LBRroot#1#2% {\setbox\z@\hbox{$\m@th#1\sqrt{#2}$} \dimen@\ht\z@ \advance\dimen@-\dp\z@ diff --git a/tex/context/base/math-pln.tex b/tex/context/base/math-pln.tex index af0d42bdb..7c8d902f2 100644 --- a/tex/context/base/math-pln.tex +++ b/tex/context/base/math-pln.tex @@ -204,10 +204,10 @@ \def\buildrel#1\over#2% {\mathrel{\mathop{\kern\z@#2}\limits^{#1}}} -\def\doteq% +\def\doteq {\buildrel\textstyle.\over=} -\def\bmod% +\def\bmod {\nonscript \mskip-\medmuskip \mkern5mu @@ -289,7 +289,7 @@ \newif\ifdt@p -\def\displ@y% +\def\displ@y {\global\dt@ptrue \openup\jot\m@th \everycr diff --git a/tex/context/base/math-run.tex b/tex/context/base/math-run.tex index 4f0f61f4e..3e1cdbf6a 100644 --- a/tex/context/base/math-run.tex +++ b/tex/context/base/math-run.tex @@ -72,4 +72,20 @@ % \definecolor[math \purefamilyhex{mc}] [lightblue] % \definecolor[math \purefamilyhex{md}] [lightmagenta] +\gdef\showmathtoken#1% + {\starttabulate[|lT|lT|lT|l|] + \NC token \NC #1 \NC \NR + \NC collection \NC \ifcsname\@mt@\mathcollection#1\endcsname + \mathcollection + \else\ifcsname\@mt@\nomathcollection#1\endcsname + \nomathcollection + \else + ?% + \fi\fi \NC \NR + \NC visualization \NC \mathematics{\getvalue{#1}} \NC \NR + \NC definition \NC \tttf \@EA\convertcommand + \csname\@mt@\mathcollection#1\endcsname + \to \ascii \ascii \NC \NR + \stoptabulate} + \protect \endinput diff --git a/tex/context/base/math-tex.tex b/tex/context/base/math-tex.tex index 98680895f..602b7ec41 100644 --- a/tex/context/base/math-tex.tex +++ b/tex/context/base/math-tex.tex @@ -18,7 +18,7 @@ \definefamilysynonym [default] [lcgreek] [mi] \definefamilysynonym [default] [ucgreek] [mr] \definefamilysynonym [default] [vargreek] [mi] -\definefamilysynonym [default] [blackboard] [mr] +%definefamilysynonym [default] [blackboard] [mb] % extra font \startmathcollection [default] @@ -89,45 +89,57 @@ \stopmathcollection -% The \mbox macro is an alternative for \hbox with a +% The \mfunction macro is an alternative for \hbox with a % controlable font switch. \startmathcollection[default] -\definemathcommand [arccos] [nolop] {\mbox{arccos}} -\definemathcommand [arcsin] [nolop] {\mbox{arcsin}} -\definemathcommand [arctan] [nolop] {\mbox{arctan}} -\definemathcommand [arg] [nolop] {\mbox{arg}} -\definemathcommand [cosh] [nolop] {\mbox{cosh}} -\definemathcommand [cos] [nolop] {\mbox{cos}} -\definemathcommand [coth] [nolop] {\mbox{coth}} -\definemathcommand [cot] [nolop] {\mbox{cot}} -\definemathcommand [csc] [nolop] {\mbox{csc}} -\definemathcommand [deg] [nolop] {\mbox{deg}} -\definemathcommand [det] [limop] {\mbox{det}} -\definemathcommand [dim] [nolop] {\mbox{dim}} -\definemathcommand [exp] [nolop] {\mbox{exp}} -\definemathcommand [gcd] [limop] {\mbox{gcd}} -\definemathcommand [hom] [nolop] {\mbox{hom}} -\definemathcommand [inf] [limop] {\mbox{inf}} -\definemathcommand [injlim] [limop] {\mbox{inj\,lim}} -\definemathcommand [ker] [nolop] {\mbox{ker}} -\definemathcommand [lg] [nolop] {\mbox{lg}} -\definemathcommand [liminf] [limop] {\mbox{lim\,inf}} -\definemathcommand [limsup] [limop] {\mbox{lim\,sup}} -\definemathcommand [lim] [limop] {\mbox{lim}} -\definemathcommand [ln] [nolop] {\mbox{ln}} -\definemathcommand [log] [nolop] {\mbox{log}} -\definemathcommand [max] [limop] {\mbox{max}} -\definemathcommand [min] [limop] {\mbox{min}} -\definemathcommand [projlim] [limop] {\mbox{proj\,lim}} -\definemathcommand [Pr] [limop] {\mbox{Pr}} -\definemathcommand [sec] [nolop] {\mbox{sec}} -\definemathcommand [sinh] [nolop] {\mbox{sinh}} -\definemathcommand [sin] [nolop] {\mbox{sin}} -\definemathcommand [sup] [limop] {\mbox{sup}} -\definemathcommand [tanh] [nolop] {\mbox{tanh}} -\definemathcommand [tan] [nolop] {\mbox{tan}} +\definemathcommand [arccos] [nolop] {\mfunction{arccos}} +\definemathcommand [arcsin] [nolop] {\mfunction{arcsin}} +\definemathcommand [arctan] [nolop] {\mfunction{arctan}} +\definemathcommand [arg] [nolop] {\mfunction{arg}} +\definemathcommand [cosh] [nolop] {\mfunction{cosh}} +\definemathcommand [cos] [nolop] {\mfunction{cos}} +\definemathcommand [coth] [nolop] {\mfunction{coth}} +\definemathcommand [cot] [nolop] {\mfunction{cot}} +\definemathcommand [csc] [nolop] {\mfunction{csc}} +\definemathcommand [deg] [nolop] {\mfunction{deg}} +\definemathcommand [det] [limop] {\mfunction{det}} +\definemathcommand [dim] [nolop] {\mfunction{dim}} +\definemathcommand [exp] [nolop] {\mfunction{exp}} +\definemathcommand [gcd] [limop] {\mfunction{gcd}} +\definemathcommand [hom] [nolop] {\mfunction{hom}} +\definemathcommand [inf] [limop] {\mfunction{inf}} +\definemathcommand [injlim] [limop] {\mfunction{inj\,lim}} +\definemathcommand [ker] [nolop] {\mfunction{ker}} +\definemathcommand [lg] [nolop] {\mfunction{lg}} +\definemathcommand [liminf] [limop] {\mfunction{lim\,inf}} +\definemathcommand [limsup] [limop] {\mfunction{lim\,sup}} +\definemathcommand [lim] [limop] {\mfunction{lim}} +\definemathcommand [ln] [nolop] {\mfunction{ln}} +\definemathcommand [log] [nolop] {\mfunction{log}} +\definemathcommand [median] [limop] {\mfunction{median}} +\definemathcommand [max] [limop] {\mfunction{max}} +\definemathcommand [min] [limop] {\mfunction{min}} +\definemathcommand [projlim] [limop] {\mfunction{proj\,lim}} +\definemathcommand [Pr] [limop] {\mfunction{Pr}} +\definemathcommand [sec] [nolop] {\mfunction{sec}} +\definemathcommand [sinh] [nolop] {\mfunction{sinh}} +\definemathcommand [sin] [nolop] {\mfunction{sin}} +\definemathcommand [sup] [limop] {\mfunction{sup}} +\definemathcommand [tanh] [nolop] {\mfunction{tanh}} +\definemathcommand [tan] [nolop] {\mfunction{tan}} + +\stopmathcollection + +\startmathcollection[default] + +\definemathcommand [integers] {\mfunction{Z}} +\definemathcommand [reals] {\mfunction{R}} +\definemathcommand [rationals] {\mfunction{Q}} +\definemathcommand [naturalnumbers] {\mfunction{N}} +\definemathcommand [complexes] {\mfunction{C}} +\definemathcommand [primes] {\mfunction{P}} \stopmathcollection @@ -309,6 +321,9 @@ \definemathcommand [ne] {\neq} \definemathcommand [le] {\leq} \definemathcommand [ge] {\geq} +\definemathcommand [eq] {=} +\definemathcommand [gt] {>} +\definemathcommand [lt] {<} \definemathcommand [gets] {\leftarrow} \definemathcommand [owns] {\ni} \definemathcommand [to] {\rightarrow} @@ -497,9 +512,12 @@ \def\{{\lbrace} \def\}{\rbrace} -\def\Bbb#1{{\fam\purefamily{blackboard}\relax#1}} -\def\mit {\fam\purefamily{mitfamily}} -\def\cal {\fam\purefamily{calfamily}} +%def\bbd{\fam\purefamily{blackboard}} +%def\cal{\fam\purefamily{calfamily}} + +\def\mit{\fam\purefamily{mitfamily}} + +\def\Bbb{\blackboard} % conforming amstex \startmathcollection[default] diff --git a/tex/context/base/meta-ini.tex b/tex/context/base/meta-ini.tex index 30d10054c..fef55e603 100644 --- a/tex/context/base/meta-ini.tex +++ b/tex/context/base/meta-ini.tex @@ -97,12 +97,12 @@ %D We save the number of graphics for the sake of \TEXEXEC. -\newcounter\totalnumberofMPgraphics +\newcounter\totalnofMPgraphics \def\thenofMPgraphics{\the\nofMPgraphics} % from supp-mps \appendtoks - \savecurrentvalue\totalnumberofMPgraphics\thenofMPgraphics + \savecurrentvalue\totalnofMPgraphics\thenofMPgraphics \to \everybye %D \macros @@ -121,7 +121,7 @@ \def\@@meta{meta:} -\def\setupMPvariables% +\def\setupMPvariables {\dodoubleempty\dosetupMPvariables} \def\dosetupMPvariables[#1][#2]% @@ -341,15 +341,15 @@ {\setevalue{#1}{\MPcolor{black}}} {\edef\!!stringa{\getvalue{#1}}% \convertcommand\!!stringa\to\ascii % otherwise problems - \doifcolorelse{\ascii} % with 2\bodyfontsize + \doifcolorelse \ascii % with 2\bodyfontsize {\setevalue{#1}{\MPcolor{\getvalue{#1}}}} {% can be aux macro - \setbox\scratchbox=\hbox{\scratchdimen=\getvalue{#1}sp}% + \setbox\scratchbox\hbox{\scratchdimen\getvalue{#1}sp}% \ifdim\wd\scratchbox=\zeropoint - \scratchcounter=\getvalue{#1}\relax + \scratchcounter\getvalue{#1}\relax \setevalue{#1}{\the\scratchcounter}% \else - \scratchdimen=\getvalue{#1}\relax + \scratchdimen\getvalue{#1}\relax \setevalue{#1}{\the\scratchdimen}% \fi}}} @@ -463,14 +463,14 @@ {\dodoubleempty\dostartMPenvironment} % that reset gives \emptytoks \long\def\dostartMPenvironment[#1][#2]#3\stopMPenvironment% - {\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 + {\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} -\def\resetMPenvironment% - {\everyMPTEXgraphic=\emptytoks % = is really needed ! +\def\resetMPenvironment + {\everyMPTEXgraphic\emptytoks % = is really needed ! \startMPenvironment \global\loadfontfileoncetrue \stopMPenvironment} @@ -516,7 +516,7 @@ \immediate\write\scratchwrite{end.}% \immediate\closeout\scratchwrite} -\def\initializeMPgraphics% +\def\initializeMPgraphics {\bgroup \initializeMPgraphicfile \ifx\bufferprefix\empty\else @@ -530,11 +530,11 @@ \def\douseMPlibrary#1% {\doifundefined{\c!file\f!javascriptprefix#1} - {\setvalue{\c!file\f!javascriptprefix#1}{} + {\letvalueempty{\c!file\f!javascriptprefix#1}% \makeshortfilename[\f!metapostprefix#1] - \showmessage{\m!metapost}{1}{#1} + \showmessage\m!metapost1{#1} \startreadingfile - \readsysfile{\shortfilename}{}{} + \readsysfile\shortfilename\donothing\donothing \stopreadingfile}} \def\useMPlibrary[#1]% @@ -561,20 +561,22 @@ \def\setMPtext#1#2% todo : #1 must be made : safe {%\forceMPTEXgraphic \convertargument#2\to\ascii - \setevalue{\@@MPT#1}{\ascii}} + \dodoglobal\letvalue{\@@MPT#1}\ascii} -\def\MPtext #1{\getvalue{\@@MPT#1}} -\def\MPstring#1{"\getvalue{\@@MPT#1}"} +\def\MPtext #1{\getvalue{\@@MPT#1}} +\def\MPstring #1{"\getvalue{\@@MPT#1}"} \def\MPbetex #1{btex \getvalue{\@@MPT#1} etex} %D Unfortunately \METAPOST\ does not have \CMYK\ support %D built in, but by means of specials we can supply the %D information needed to handle them naturaly. -\newif\ifMPcmyk \MPcmyktrue +\newif\ifMPcmykcolors \MPcmykcolorstrue +\newif\ifMPspotcolors \MPspotcolorstrue \appendtoks - cmykcolors := \ifMPcmyk true \else false \fi ; + cmykcolors := \ifMPcmykcolors true \else false \fi ; + spotcolors := \ifMPspotcolors true \else false \fi ; \to \MPinitializations %D In order to communicate conveniently with the \TEX\ @@ -618,6 +620,7 @@ \appendtoks \baselineskip1\baselineskip \lineheight 1\lineheight + \topskip 1\topskip \to \everyMPgraphic % this will become (more efficient) diff --git a/tex/context/base/meta-pag.tex b/tex/context/base/meta-pag.tex index afc08750e..711111812 100644 --- a/tex/context/base/meta-pag.tex +++ b/tex/context/base/meta-pag.tex @@ -63,6 +63,14 @@ RightMarginWidth := \the\rechtermargebreedte ; RightEdgeDistance := \@the\rechterrandafstand ; RightEdgeWidth := \the\rechterrandbreedte ; + InnerMarginDistance := \@the\innermargindistance ; + InnerMarginWidth := \the\innermarginwidth ; + OuterMarginDistance := \@the\outermargindistance ; + OuterMarginWidth := \the\outermarginwidth ; + InnerEdgeDistance := \@the\inneredgedistance ; + InnerEdgeWidth := \the\inneredgewidth ; + OuterEdgeDistance := \@the\outeredgedistance ; + OuterEdgeWidth := \the\outeredgewidth ; PageOffset := \the\pageoffset ; PageDepth := \the\pagedepth ; enddef ; @@ -143,19 +151,45 @@ \newtoks\MPsavedtextareadata \newtoks\MPtextareadata +\newtoks\MPlocaltextareadata + +% optimaliseren voor herhaling \def\registerMPtextarea#1% - {\bgroup - \doglobal\increment\currentMPtextareadata - \hpos{gbd:\currentMPtextareadata}{#1}% - \edef\!!stringa{gbd:\currentMPtextareadata}% - \edef\!!stringa{RegisterTextArea(% - \MPx\!!stringa,\MPy\!!stringa,\MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}% - \@EA \doglobal \@EA \appendtoks \!!stringa \to \MPtextareadata - \egroup} + {\ifpositioning + \bgroup + \doglobal\increment\currentMPtextareadata + \hpos{gbd:\currentMPtextareadata}{#1}% + \edef\!!stringa{gbd:\currentMPtextareadata}% + \edef\!!stringa{RegisterTextArea(% + \MPx\!!stringa,\MPy\!!stringa,% + \MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}% + \@EA \doglobal \@EA \appendtoks \!!stringa \to \MPtextareadata + \egroup + \else + \hbox{#1}% + \fi} + +\def\registerMPlocaltextarea#1% + {\ifpositioning + \bgroup + \doglobal\increment\currentMPtextareadata + \hpos{gbd:\currentMPtextareadata}{#1}% + \edef\!!stringa{gbd:\currentMPtextareadata}% + \edef\!!stringa{RegisterLocalTextArea(% + \MPx\!!stringa,\MPy\!!stringa,% + \MPw\!!stringa,\MPh\!!stringa,\MPd\!!stringa);}% + \global\MPlocaltextareadata\@EA{\!!stringa}% + \egroup + \else + \hbox{#1}% + \fi} + +\def\resetMPlocaltextarea + {\global\MPlocaltextareadata\emptytoks} \appendtoks - \includeMPgraphic{area data} + \includeMPgraphic{area data}% \to \MPinitializations \startuseMPgraphic{area data} @@ -164,11 +198,13 @@ SaveTextAreas ; ResetTextAreas ; \the\MPtextareadata + \the\MPlocaltextareadata \stopuseMPgraphic \appendtoks \global\MPsavedtextareadata\MPtextareadata - \global\MPtextareadata \emptytoks + \global\MPtextareadata\emptytoks + \global\MPlocaltextareadata\emptytoks \to \everyshipout \protect \endinput diff --git a/tex/context/base/meta-xml.tex b/tex/context/base/meta-xml.tex new file mode 100644 index 000000000..5024165d7 --- /dev/null +++ b/tex/context/base/meta-xml.tex @@ -0,0 +1,30 @@ +%D \module +%D [ file=meta-xml, +%D version=2002.11.27, +%D title=\METAPOST\ Graphics, +%D subtitle=XML Hacks, +%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}{MetaPost Graphics / XML Hacks} + +%D When we are dealing with XML, we need to make sure that +%D \METAPOST\ knows about it. The next macro expands its +%D argument (think of widget XFDF) into \type {\getXMLentity} +%D calls. + +\unprotect + +\def\setMPtextXML#1#2% + {\bgroup + \enableXML + \expanded{\convertcommand#2}\to\ascii + \expanded{\egroup + \noexpand\dodoglobal\noexpand\setvalue{\@@MPT#1}{\ascii}}} + +\protect \endinput diff --git a/tex/context/base/mult-com.tex b/tex/context/base/mult-com.tex index 1b7daad8e..bd9fedb34 100644 --- a/tex/context/base/mult-com.tex +++ b/tex/context/base/mult-com.tex @@ -502,6 +502,13 @@ inrightside: inrechterrand inrightside imrechtenrand napravo inlatodestro inparteadreapta + atleftmargin: oplinkermarge atleftmargin + atleftmargin atleftmargin + atleftmargin atleftmargin +atrightmargin: oprechtermarge atrightmargin + atrightmargin atrightmargin + atrightmargin atrightmargin + woordrechts: woordrechts wordright wortrechts slovovpravo paroladestra cuvantdreapta @@ -607,6 +614,9 @@ crlf: crlf crlf crlf crlf crlf crlf +emptylines: legeregels emptylines + emptylines emptylines + emptylines emptylines stelregelsin: stelregelsin setuplines stellezeilenein nastavradky impostarighe seteazalinii @@ -625,25 +635,25 @@ setuptabulate: steltabulatiein setuptabulate stelletabulatorein nastavtabelaci impostatabulato seteazatabulatori - starttabel: starttabel starttable + starttable: starttabel starttable starttabelle starttabulka iniziatabella starttabel - stoptabel: stoptabel stoptable + stoptable: stoptabel stoptable stoptabelle stoptabulka terminatabella stoptabel - starttabellen: starttabellen starttables + starttables: starttabellen starttables starttabellen starttabulky iniziatabelle starttabele - stoptabellen: stoptabellen stoptables + stoptables: stoptabellen stoptables stoptabellen stoptabulky terminatabelle stoptabele - steltabellenin: steltabellenin setuptables + setuptables: steltabellenin setuptables stelletabellenein nastavtabulky impostatabelle seteazatabele definetabletemplate: definieertabelvorm definetabletemplate definieretabellenvorlage definujsablonutabulky definiscimodellotabella definestesablontabel - pagina: pagina page + page: pagina page seite strana pagina pagina koppelpagina: koppelpagina couplepage @@ -694,7 +704,7 @@ setupheadertexts: stelhoofdtekstenin setupheadertexts stellekopfzeilentextein nastavtextyzahlavi impostatestiintestazioni seteazatexteantet - stelnummeringin: stelnummeringin setuppagenumbering + setuppagenumbering: stelpaginanummeringin setuppagenumbering stelleseitennummeriernungein nastavcislovanistran impostanumerazionepagina seteazanumerotarepagina stelnummerin: stelnummerin setupnumber @@ -760,7 +770,7 @@ stelnummerin: stelnummerin setupnumber stelkolommenin: stelkolommenin setupcolumns stellespaltenein nastavsloupce impostacolonne seteazacoloane - kolom: kolom column + column: kolom column spalte sloupec colonna coloana head: kop head @@ -896,6 +906,9 @@ stelnummerin: stelnummerin setupnumber setuppapersize: stelpapierformaatin setuppapersize stellepapierformatein nastavvelikostpapiru impostadimensionicarta seteazadimensiunihartie +setuppaper: stelpapierin setuppaper + setuppaper setuppaper + setuppaper setuppaper setuparranging: stelarrangerenin setuparranging stelleanordnenein nastavusporadani impostaparranging seteazaaranjareapag @@ -923,6 +936,9 @@ stelnummerin: stelnummerin setupnumber blokkeerinteractiemenu: blokkeerinteractiemenu disableinteractionmenu inaktiviereinteraktionsmenue zablokujinterakcnimenu disabilitamenuinterazione dezactiveazameniuinteractiune + interactiemenu: interactiemenu interactionmenu + interaktionsmenue interaktivnimenu + menuinterattivo meniuinteractiune interactiebuttons: interactiebuttons interactionbuttons interaktionsknopfe interakcnitlacitka pulsantinterazione butoaneinteractiune @@ -950,6 +966,9 @@ stelnummerin: stelnummerin setupnumber definecolor: definieerkleur definecolor definierefarbe definujbarvu definiscicolore definesteculoare +%definespotcolor: definespotcolor definespotcolor +% definespotcolor definespotcolor +% definespotcolor definespotcolor definecolorgroup: definieerkleurgroep definecolorgroup definierefarbengruppe definujskupinubarev definiscigruppocolori definestegrupculori @@ -1040,9 +1059,15 @@ stelnummerin: stelnummerin setupnumber definieersamengesteldelijst: definieersamengesteldelijst definecombinedlist definierezusammengestellteliste definujkombinovanyseznam definiscielencocombinato definestelistacombinata +listsymbol: lijstsymbool listsymbol + listsymbol listsymbol + listsymbol listsymbol plaatslijst: plaatslijst placelist platziereliste umistiseznam mettielenco punelista + plaatsruwelijst: plaatslruweijst placerawlist + placerawlist placerawlist + placerawlist placerawlist plaatssamengesteldelijst: plaatssamengesteldelijst placecombinedlist platzierezusammengestellteliste umistikombinovanyseznam mettielencocombinato punelistacombinata @@ -1103,10 +1128,16 @@ stelnummerin: stelnummerin setupnumber placefloat: plaatsplaatsblok placefloat placefloat placefloat placefloat placefloat %%% - startcombinatie: startcombinatie startcombination +movesidefloat: verplaatszijblok movesidefloat + movesidefloat movesidefloat + movesidefloat movesidefloat + definecombination: definieercombinatie definecombination + definecombination definecombination + definecombination definecombination + startcombination: startcombinatie startcombination startkombination startspojeni iniziacombinazione startcombinare - stopcombinatie: stopcombinatie stopcombination + stopcombination: stopcombinatie stopcombination stopkombination stopspojeni terminacombinazione stopcombinare plaatsnaastelkaar: plaatsnaastelkaar placesidebyside @@ -1121,7 +1152,7 @@ stelnummerin: stelnummerin setupnumber stelblokkopjesin: stelblokkopjesin setupcaptions stellebilderunterschriftein nastavpopisky impostacaptions seteazalegendele % GB - stelcombinatiesin: stelcombinatiesin setupcombinations + setupcombinations: stelcombinatiesin setupcombinations stellekombinationein nastavspojeni impostacombinazioni seteazacombinari startoverlay: startoverlay startoverlay @@ -1746,13 +1777,20 @@ moveformula: verplaatsformule moveformula switchtorawfont switchtorawfont passaafontgrezzo trecilafontraw - placeheadtext: plaatskoptekst placeheadtext - placeheadtext placeheadtext - posizionatestotesta placeheadtext + placeheadtext: plaatskoptekst placeheadtext + placeheadtext placeheadtext + posizionatestotesta placeheadtext + +placeheadnumber: plaatskopnummer placeheadnumber + placeheadnumber placeheadnumber + posizionanumerotesta placeheadnumber -placeheadnumber: plaatskopnummer placeheadnumber - placeheadnumber placeheadnumber - posizionanumerotesta placeheadnumber + definepagebreak: definieerpaginaovergang definepagebreak + definepagebreak definepagebreak + definepagebreak definepagebreak +definecolumnbreak: definieerkolomovergang definecolumnbreak + definecolumnbreak definecolumnbreak + definecolumnbreak definecolumnbreak \stopcommands @@ -1833,6 +1871,30 @@ placeheadnumber: plaatskopnummer placeheadnumber rechterrandafstand: rechterrandafstand rightedgedistance abstandrechterrand vzdalenostpravehookraje distanzabordodestro distantacoltdreapta + innermarginwidth: binnenmargebreedte innermarginwidth + innermarginwidth innermarginwidth + innermarginwidth innermarginwidth + outermarginwidth: buitenmargebreedte outermarginwidth + outermarginwidth outermarginwidth + outermarginwidth outermarginwidth +innermargindistance: binnenmargeafstand innermargindistance + innermargindistance innermargindistance + innermargindistance innermargindistance +outermargindistance: buitenmargeafstand outermargindistance + outermargindistance outermargindistance + outermargindistance outermargindistance + inneredgewidth: binnenrandbreedte inneredgewidth + inneredgewidth inneredgewidth + inneredgewidth inneredgewidth + outeredgewidth: buitenrandbreedte outeredgewidth + outeredgewidth outeredgewidth + outeredgewidth outeredgewidth + inneredgedistance: binnenrandafstand inneredgedistance + inneredgedistance inneredgedistance + inneredgedistance inneredgedistance + outeredgedistance: buitenrandafstand outeredgedistance + outeredgedistance outeredgedistance + outeredgedistance outeredgedistance tekstbreedte: tekstbreedte textwidth textbreite sirkatextu ampiezzatesto latimetext @@ -1886,19 +1948,23 @@ placeheadnumber: plaatskopnummer placeheadnumber useXMLfilter useXMLfilter useXMLfilter useXMLfilter -definecolumnset: definieerkolomgroep definecolumnset - definecolumnset definecolumnset +definecolumnset: definieerkolomgroep definecolumnset + definecolumnset definecolumnset definiscigruppocolonne definecolumnset - setupcolumnset: stelkolomgroepin setupcolumnset - setupcolumnset setupcolumnset - impostagruppocolonne setupcolumnset - startcolumnset: startkolomgroep startcolumnset - startcolumnset startcolumnset - iniziagruppocolonne startcolumnset - stopcolumnset: stopkolomgroep stopcolumnset - stopcolumnset stopcolumnset + setupcolumnset: stelkolomgroepin setupcolumnset + setupcolumnset setupcolumnset + impostagruppocolonne setupcolumnset + startcolumnset: startkolomgroep startcolumnset + startcolumnset startcolumnset + iniziagruppocolonne startcolumnset + stopcolumnset: stopkolomgroep stopcolumnset + stopcolumnset stopcolumnset terminagruppocolonne stopcolumnset + usetypescript: gebruiktypescript usetypescript + usetypescript usetypescript + usetypescript usetypescript + \stopcommands %D \stopcompressdefinitions diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex index fab93c462..08bb3daed 100644 --- a/tex/context/base/mult-con.tex +++ b/tex/context/base/mult-con.tex @@ -304,6 +304,18 @@ umrahmtertext oramovanytext testoincorniciato textinconjurat + citaat: citaat quotation + zitat citace + citazione citat + + citeer: citeer quote + zitieren citovat + menzione minicitat + + spraak: spraak speech + speech speech + speech speech + \stopvariables %D \stopcompressdefinitions @@ -360,6 +372,9 @@ voorwit: voorwit spacebefore vorspatium mezerapred spazioprima spatiuinainte + tussenwit: tussenwit spaceinbetween + spaceinbetween spaceinbetween + spaceinbetween spaceinbetween nawit: nawit spaceafter nachspatium mezeraza spaziodopo spatiudupa @@ -384,6 +399,9 @@ achtergrondhoek: achtergrondhoek backgroundcorner hintergrundwinkel rohpozadi angolosfondo coltfundal +splitskleur: splitskleur splitcolor + splitcolor splitcolor + splitcolor splitcolor achtergrondkleur: achtergrondkleur backgroundcolor hintergrundfarbe barvapozadi coloresfondo culoarefundal @@ -393,6 +411,9 @@ voorgrondletter: voorgrondletter foregroundstyle foregroundstyle foregroundstyle foregroundstyle foregroundstyle +clipoffset: clipoffset clipoffset + clipoffset clipoffset + clipoffset clipoffset achtergrondoffset: achtergrondoffset backgroundoffset hintergrundoffset offsetpozadi offsetsfondo offsetfundal @@ -651,6 +672,9 @@ kolom: kolom column spalte sloupec colonna coloana + kolommen: kolommen columns + spalten sloupce + colonne coloane kolomafstand: kolomafstand columndistance spaltenabstand vzdalenostsloupcu distanzacolonne distantacoloane @@ -909,6 +933,12 @@ preview: preview preview vorschau nahled anteprima previzualizare +proces: proces process + process process + process process + spot: spot spot + spot spot + spot spot punt: punt dot punkt tecka punto punct @@ -1288,11 +1318,16 @@ tekstafstand: tekstafstand textdistance textdistance textdistance distanzatesto textdistance % TB TH + tekstmarge: tekstmarge textmargin + textmargin textmargin + textmargin textmargin % TB TH trefwoord: trefwoord keyword keyword keyword parolachiave keyword + + \stopconstants %D \stopcompressdefinitions @@ -1760,6 +1795,12 @@ trefwoord: trefwoord keyword programma: programma program programm program programma program +proces: proces process + process process + process process + spot: spot spot + spot spot + spot spot punt: punt dot punkt tecka punto punct @@ -1991,6 +2032,9 @@ trefwoord: trefwoord keyword laatstepagina: laatstepagina lastpage letzteseite poslednistrana ultimapagina ultimapagina + laatpagenumber: laatstepaginanummer lastpagenumber + lastpagenumber lastpagenumber + lastpagenumber lastpagenumber eerstesubpagina: eerstesubpagina firstsubpage ersteunterseite prvnipodstranka primasottopagina primasubpagina @@ -2124,6 +2168,7 @@ geencontrole: geencontrole nocheck nx: nx ny: ny nr: nr + nl: nl nc: nc sx: sx sy: sy @@ -2337,10 +2382,10 @@ geencontrole: geencontrole nocheck stop: stop stop stop stop termina stop - tabelkop: tabelkop tablehead + tablehead: tabelkop tablehead tabellenueberschrift zahlavitabulky testatabella antettabel - tabelstaart: tabelstaart tabletail + tabletail: tabelstaart tabletail tabellenende konectabulky codatabella subsoltabel tabulate: tabulatie tabulate diff --git a/tex/context/base/mult-ini.tex b/tex/context/base/mult-ini.tex index 98af68127..6928f13d2 100644 --- a/tex/context/base/mult-ini.tex +++ b/tex/context/base/mult-ini.tex @@ -172,9 +172,9 @@ %D \definesystemvariable {name} %D \stoptypen -\def\definesystemvariable #1{\setevalue{\??prefix#1}{\@@prefix#1}} +\def\definesystemvariable#1{\setevalue{\??prefix#1}{\@@prefix#1}} -\definesystemvariable {ms} +\definesystemvariable{ms} %D \macros %D {selectinterface, @@ -209,10 +209,10 @@ \def\selectinterface% {\def\docommando##1##2% {\bgroup - \endlinechar=-1 + \endlinechar\minusone \global\read16 to ##1 \egroup - \doif{\currentinterface}{}{\let##1=##2}% + \doifnothing\currentinterface{\let##1=##2}% \doifundefined{\s!prefix!##1}{\let##1=##2}}% \docommando\currentinterface\defaultinterface \writestatus{interface}{defining \currentinterface\space interface}% @@ -251,11 +251,14 @@ %D \stopinterface %D \stoptypen +%\def\startinterface #1 +% {\doifinsetelse{\currentinterface}{#1} +% {\let\next\relax} +% {\long\def\next##1\stopinterface{}}% +% \next} + \def\startinterface #1 - {\doifinsetelse{\currentinterface}{#1} - {\let\next\relax} - {\long\def\next##1\stopinterface{}}% - \next} + {\doifnotinset\currentinterface{#1}{\gobbleuntil\stopinterface}} \let\stopinterface=\relax @@ -384,7 +387,7 @@ \def\doaddinterfacemessage#1#2% {\findinterfacemessage{#1}\currentmessagetext - \doifelse{\currentmessagetext}{} + \doifelsenothing\currentmessagetext {\setxvalue{\??ms\currentmessagelibrary}% {\getvalue{\??ms\currentmessagelibrary} #1: #2\relax}} {\debuggerinfotrue % we consider this an important error @@ -401,7 +404,7 @@ {\doaddinterfacemessage{#1}{#2}}% \egroup -\def\getinterfacemessage% +\def\getinterfacemessage {\ifx\next\stopmessages \egroup\expandafter\gobbleoneargument \else @@ -413,10 +416,10 @@ \bgroup \obeylines \doifinsetelse{#1}{\currentresponses,all} - {\def\next% + {\def\next {\def\currentmessagelibrary{#2}% \doifundefined{\??ms\currentmessagelibrary} - {\setgvalue{\??ms\currentmessagelibrary}{}}% + {\letgvalueempty{\??ms\currentmessagelibrary}}% \futurelet\next\getinterfacemessage}} {\long\def\next##1\stopmessages{\egroup}}% \next} @@ -435,7 +438,7 @@ \bgroup \obeylines \doifinsetelse{#1}{\currentresponses,all} - {\def\next% + {\def\next {\def\currentmessagelibrary{#2}% \futurelet\next\getinterfacemessage}} {\long\def\next##1\stopmessages{\egroup}}% @@ -475,14 +478,14 @@ \let\normalshowmessage=\showmessage -\def\showwarning% +\def\showwarning {\ifshowwarnings \expandafter\showmessage \else \expandafter\gobblethreearguments \fi} -\def\showmessage% +\def\showmessage {\ifshowmessages \expandafter\normalshowmessage \else @@ -791,9 +794,9 @@ %D We can now redefine some messages that will be %D introduced in the multi||lingual system module. -\def\showassignerror #1#2{\showmessage{\m!check}{1}{#1,#2}} -\def\showargumenterror#1#2{\showmessage{\m!check}{2}{#1,#2}} -\def\showdefinederror #1#2{\showmessage{\m!check}{3}{#1,#2}} +\def\showassignerror #1#2{\showmessage\m!check1{#1,#2}\waitonfatalerror} +\def\showargumenterror#1#2{\showmessage\m!check2{#1,#2}\waitonfatalerror} +\def\showdefinederror #1#2{\showmessage\m!check3{#1,#2}\waitonfatalerror} %D \CONTEXT\ is a parameter driven package. This means that %D users instruct the system by means of variables, values and @@ -1084,7 +1087,7 @@ \newif\iflogginginterface -\def\flushinterfaceelementline% +\def\flushinterfaceelementline {\iflogginginterface \immediate\write\scratchwrite{\interfaceelementline}% \let\interfaceelementline\empty @@ -1100,7 +1103,7 @@ \let\interfaceelementline\empty \immediate\openout\scratchwrite=./#1\relax} -\def\stoplogginginterface% +\def\stoplogginginterface {\flushinterfaceelementline \immediate\closeout\scratchwrite \logginginterfacefalse} @@ -1115,10 +1118,10 @@ \def\nointerfaceobject{-} \def\startinterfaceobjects#1#2% - {\!!counta=1 + {\!!counta\plusone \let\dogetinterfaceobject\dogetinterfacetemplate \let\dowithinterfaceelement#1% - \def\dodogetinterfaceobjects% + \def\dodogetinterfaceobjects {\ifx\next#2% \flushinterfaceelementline \flushinterfaceelementline @@ -1135,7 +1138,7 @@ \dogetinterfaceobjects}% \fi\fi\fi \next}% - \def\dogetinterfaceobjects% + \def\dogetinterfaceobjects {\futurelet\next\dodogetinterfaceobjects}% \dogetinterfaceobjects} @@ -1143,7 +1146,7 @@ {\saveinterfaceelementline{#1}% \doifinsetelse{#1}{\currentinterface,all} {\let\dogetinterfaceobject\doskipinterfaceobject} - {\advance\!!counta by 1\relax}} + {\advance\!!counta\plusone}} \def\doskipinterfaceobject[#1:#2#3]% {\if#2:% @@ -1157,11 +1160,11 @@ \def\dogetinterfaceelement[#1:#2#3]% {\ifx#2:% - \!!countb=0 + \!!countb\zerocount \def\!!stringa{#1}% \flushinterfaceelementline \else - \advance\!!countb by 1 + \advance\!!countb\plusone \saveinterfaceelementline{#1}% \ifnum\!!countb=\!!counta \@EA\dowithinterfaceelement\@EA{\!!stringa}{#1}% @@ -1185,7 +1188,7 @@ \def\setinterfaceconstant#1#2% {\setvalue{\c!prefix!#1}{\c!internal!#1}% - \doifelse{#2}{\nointerfaceobject} + \doifelse{#2}\nointerfaceobject {\debuggerinfo{constant}{#1 defined as #1 by default}% \setvalue{\k!prefix!#2}{#1}} {\debuggerinfo{constant}{#1 defined as #2}% @@ -1196,7 +1199,7 @@ \setvalue{\k!prefix!#2}{#1}}} \def\setinterfacevariable#1#2% - {\doifelse{#2}{\nointerfaceobject} + {\doifelse{#2}\nointerfaceobject {\debuggerinfo{variable}{#1 defined as #1 by default}% \checksetvalue{\v!prefix!#1}{#1}% \setvalue{\v!prefix!#1}{#1}} @@ -1208,10 +1211,10 @@ {\doifdefined{#1}{\doifvaluesomething{#1}{\doifnotvalue{#1}{#2} {\writestatus{problems}{set #1 to #2 overloads \getvalue{#1}}}}}} -\def\startvariables% +\def\startvariables {\startinterfaceobjects\setinterfacevariable\stopvariables} -\def\startconstants% +\def\startconstants {\startinterfaceobjects\setinterfaceconstant\stopconstants} %D \macros @@ -1248,12 +1251,12 @@ \def\setinterfacesetupvariable#1#2% {\ifinterfacetranslation - \doifelse{#2}{\nointerfaceobject} + \doifelse{#2}\nointerfaceobject {\setvalue{\y!prefix!#1}{#1}} {\setvalue{\y!prefix!#1}{#2}}% \fi} -\def\startsetupvariables% +\def\startsetupvariables {\startinterfaceobjects\setinterfacesetupvariable\stopsetupvariables} %D \macros @@ -1293,22 +1296,21 @@ %D Element translation is realized by means of: \def\setinterfaceelement#1#2% - {\doifelse{#2}{\nointerfaceobject} + {\doifelse{#2}\nointerfaceobject {\debuggerinfo{element}{#1 defined as <empty>}% \resetvalue{\e!prefix!#1}} {\doifdefinedelse{\e!prefix!#1} - {\doifnot{\getvalue{\e!prefix!#1}}{#2} + {\doifnotvalue{\e!prefix!#1}{#2} {\debuggerinfo{element}{#1 redefined as #2}% \setvalue{\e!prefix!#1}{#2}}} {\debuggerinfo{element}{#1 defined as #2}% \setvalue{\e!prefix!#1}{#2}}}} -\def\startelements% +\def\startelements {\startinterfaceobjects\setinterfaceelement\stopelements} %D \macros %D {startcommands} -%D {} %D %D The last setup has to do with the commands themselve. %D Commands are defined as: @@ -1328,7 +1330,7 @@ %D needed for reference cards. \def\setinterfacecommand#1#2% - {\doifelse{#2}{\nointerfaceobject} + {\doifelse{#2}\nointerfaceobject {\debuggerinfo{command}{no link to #1}% \setinterfacesetupvariable{#1}{#1}} {\doifelse{#1}{#2} @@ -1340,12 +1342,11 @@ \@EA{\csname#1\endcsname}}% \setinterfacesetupvariable{#1}{#2}}} -\def\startcommands% +\def\startcommands {\startinterfaceobjects\setinterfacecommand\stopcommands} %D \macros %D {getinterfaceconstant, getinterfacevariable} -%D {} %D %D Generating the interface translation macro's that are used %D in the reference lists, is enabled by setting the boolean: @@ -1430,17 +1431,17 @@ %D Out of convenience we define the banners here. -\edef\contextbanner% +\edef\contextbanner {ConTeXt \space ver: \noexpand \contextversion \space \space fmt: \noexpand \formatversion \space \space int: \noexpand \currentinterface \space \space mes: \noexpand \currentresponses} -\def\showcontextbanner% +\def\showcontextbanner {\writeline\writestring{\contextbanner}\writeline} -\edef\formatversion% +\edef\formatversion {\ifx\normalyear \undefined\the\year \else\the\normalyear \fi.% \ifx\normalmonth\undefined\the\month\else\the\normalmonth\fi.% \ifx\normalday \undefined\the\day \else\the\normalday \fi} diff --git a/tex/context/base/mult-sys.tex b/tex/context/base/mult-sys.tex index bc33cb955..9cb6ffcf6 100644 --- a/tex/context/base/mult-sys.tex +++ b/tex/context/base/mult-sys.tex @@ -132,6 +132,7 @@ \definesystemconstant {next} \definesystemconstant {pickup} +\definesystemconstant {ascii} \definesystemconstant {default} \definesystemconstant {unknown} @@ -175,6 +176,7 @@ \definesystemconstant {encoding} \definesystemconstant {mapping} \definesystemconstant {patterns} +\definesystemconstant {rscale} \definesystemconstant {handling} \definesystemconstant {ucmap} @@ -186,6 +188,7 @@ \definesystemconstant {mm} \definesystemconstant {pt} \definesystemconstant {sp} +\definesystemconstant {bp} \definesystemconstant {in} %D These constants are used for internal and utility @@ -226,6 +229,8 @@ \definesystemconstant {figurepreset} +\definesystemconstant {empty} + %D Some \CONTEXT\ commands take a two||pass aproach to %D optimize the typesetting. Each two||pass object has its %D own tag. @@ -326,6 +331,10 @@ \newcount\medcard \medcard\!!medcard % used in font module \newcount\maxcard \maxcard\!!maxcard % used in font module +\ifx\thousandpoint\undefined \newdimen\thousandpoint \fi + +\thousandpoint=1000pt + %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 @@ -355,9 +364,11 @@ \definesystemvariable {cc} % Comment \definesystemvariable {ci} % CItaat \definesystemvariable {cl} % kleur (CoLor setup) +\definesystemvariable {cn} % CollumN \definesystemvariable {co} % COmbinaties \definesystemvariable {cp} % CliP \definesystemvariable {cr} % kleur (ColoR) +\definesystemvariable {cs} % kleur (ColorSeparation \definesystemvariable {cv} % ConVersie \definesystemvariable {da} % DAte \definesystemvariable {dc} % DroppedCaps @@ -375,6 +386,7 @@ \definesystemvariable {er} % external resources \definesystemvariable {ex} % ExterneFiguren \definesystemvariable {ht} % HiddenText +\definesystemvariable {fc} % FramedContent \definesystemvariable {fd} % FielD \definesystemvariable {ff} % FontFile \definesystemvariable {fg} % FiGuurmaten @@ -414,9 +426,11 @@ \definesystemvariable {la} % LAnguage \definesystemvariable {lb} % LaBels \definesystemvariable {ld} % LegenDa +\definesystemvariable {le} % LinetablE \definesystemvariable {lg} % taal (LanGuage) \definesystemvariable {li} % LIjst \definesystemvariable {ll} % Layers +\definesystemvariable {lx} % LayerteXt \definesystemvariable {ln} % LijNen \definesystemvariable {lo} % LOgos \definesystemvariable {lt} % LiTeratuur @@ -425,6 +439,7 @@ \definesystemvariable {mb} % MargeBlokken \definesystemvariable {mg} % Metapost paGe \definesystemvariable {mk} % MarKering +\definesystemvariable {mt} % inline MaTh \definesystemvariable {mo} % Math Options \definesystemvariable {nm} % Nummering \definesystemvariable {np} % NaastPlaatsen @@ -443,6 +458,7 @@ \definesystemvariable {pa} % PAlet \definesystemvariable {pb} % PuBlicatie \definesystemvariable {pc} % PageComment +\definesystemvariable {pe} % PagEhandler \definesystemvariable {pf} % ProFiel \definesystemvariable {pg} % KoppelPagina \definesystemvariable {ph} % ParagrapH @@ -451,6 +467,7 @@ \definesystemvariable {pp} % PaPier \definesystemvariable {pr} % PRogrammas \definesystemvariable {ps} % PoSitioneren +\definesystemvariable {pt} % PageshifT \definesystemvariable {rf} % ReFereren \definesystemvariable {rg} % ReGel \definesystemvariable {rl} % ReferentieLijst @@ -465,6 +482,7 @@ \definesystemvariable {sc} % SCherm \definesystemvariable {sd} % SounD \definesystemvariable {se} % SEctie +\definesystemvariable {sf} % SpeciFics \definesystemvariable {sg} % SpacinG \definesystemvariable {sh} % ShapeText \definesystemvariable {si} % SplIt @@ -524,6 +542,7 @@ \defineinterfaceconstant {d} {d} % kunnen weg \defineinterfaceconstant {e} {e} % kunnen weg +\defineinterfaceconstant {s} {s} \defineinterfaceconstant {r} {r} \defineinterfaceconstant {g} {g} \defineinterfaceconstant {b} {b} @@ -531,15 +550,14 @@ \defineinterfaceconstant {m} {m} \defineinterfaceconstant {y} {y} \defineinterfaceconstant {k} {k} -\defineinterfaceconstant {s} {s} - +\defineinterfaceconstant {a} {a} % alternative +\defineinterfaceconstant {t} {t} % transparency +\defineinterfaceconstant {p} {p} % percentage + \defineinterfaceconstant {t} {t} \defineinterfaceconstant {h} {h} \defineinterfaceconstant {b} {b} -\defineinterfaceconstant {t} {t} % transparency -\defineinterfaceconstant {a} {a} % alternative - \defineinterfaceconstant {rgb} {rgb} \defineinterfacevariable {rgb} {rgb} @@ -582,6 +600,7 @@ \definefileconstant {oldfilename} {cont-old} \definefileconstant {newfilename} {cont-new} \definefileconstant {filfilename} {cont-fil} +\definefileconstant {modfilename} {cont-mod} %D The next two files specify user settings as well as %D \TEXEXEC\ settings when generating a format. @@ -685,18 +704,20 @@ \startmessages dutch library: check title: controle - 1: '=' ontbreekt na '--' in regel -- + 1: '=' ontbreekt of zonder {} na '--' in regel -- 2: -- argument(en) verwacht in regel -- 3: -- -- vervangt een macro, gebruik HOOFDLETTERS! \stopmessages \startmessages english library: check title: check - 1: missing '=' after '--' in line -- + 1: missing or ungrouped '=' after '--' in line -- 2: -- argument(s) expected in line -- 3: -- -- replaces a macro, use CAPITALS! \stopmessages +% 1: to be adapted + \startmessages german library: check title: check 1: Fehlendes '=' nach '--' in Zeile -- @@ -713,7 +734,7 @@ \startmessages italian library: check title: controllo - 1: '=' mancante dopo '--' alla riga -- + 1: '=' mancante o non raggruppato dopo '--' alla riga -- 2: -- argomento/i attesi alla riga -- 3: -- -- sostituisce una macro, usare le MAIUSCOLE! \stopmessages diff --git a/tex/context/base/page-app.tex b/tex/context/base/page-app.tex index 8f93858a9..04df66168 100644 --- a/tex/context/base/page-app.tex +++ b/tex/context/base/page-app.tex @@ -19,48 +19,59 @@ \def\dostartfittingpage[#1][#2]% {\pagina \bgroup - \setbox\scratchbox=\hbox + \dontcomplain + \setbox\scratchbox\hbox \bgroup \getparameters[#1][#2]% \schaal[\c!schaal=\getvalue{#1\c!schaal}]\bgroup\localframed[#1]\bgroup} -\def\dostopfittingpage% +\definepapersize + [\??fp\s!dummy] + [\c!breedte=\fittingwd, + \c!hoogte=\fittinght] + +\definelayout + [\??fp\s!dummy] + [\c!breedte=\fittingwd,\c!hoogte=\fittinght,\c!plaats=\v!midden, + \c!kopwit=\!!zeropoint,\c!rugwit=\!!zeropoint, + \c!snijwit=\!!zeropoint,\c!bodemwit=\!!zeropoint, + \c!tekstafstand=\!!zeropoint,\c!regels=0,\c!grid=\v!nee, + \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint] + +\def\dostopfittingpage {\egroup\egroup\egroup \edef\fittingwd{\the\wd\scratchbox}% \edef\fittinght{\the\ht\scratchbox}% - \definepapersize - [\s!dummy] - [\c!breedte=\fittingwd, - \c!hoogte=\fittinght]% - \startlocal % keep settings as local as can be - \setuppapersize - [\s!dummy][\s!dummy]% - \stellayoutin - [\c!breedte=\fittingwd,\c!hoogte=\fittinght,\c!plaats=\v!midden, - \c!kopwit=\!!zeropoint,\c!rugwit=\!!zeropoint, - \c!snijwit=\!!zeropoint,\c!bodemwit=\!!zeropoint, - \c!tekstafstand=\!!zeropoint, - \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint]% - \stoplocal % which saves us the trouble of push/pop + \startlocallayout + \ifdim\fittinght<\lineheight + % write status : too small + \setbox\scratchbox\vbox to \lineheight{\vss\box\scratchbox\vss}% + \edef\fittinght{\the\lineheight}% + \fi + \setuppapersize + [\??fp\s!dummy][\??fp\s!dummy]% + \stellayoutin + [\??fp\s!dummy]% \startmakeup[\v!standaard][\c!tekststatus=\v!leeg,\c!dubbelzijdig=\v!nee,\c!pagina=]% \centerbox{\box\scratchbox}% \stopmakeup + \stoplocallayout \egroup} %D \TEX\ pages (for \METAPOST\ pages, see \type {meta-fig}): \presetlocalframed[\??tg] -\def\setupTEXpage% +\def\setupTEXpage {\dodoubleargument\getparameters[\??tg]} -\def\startTEXpage% +\def\startTEXpage {\dosingleempty\dostartTEXpage} \def\dostartTEXpage[#1]% {\dostartfittingpage[\??tg][#1]\gobblespacetokens} -\def\stopTEXpage% +\def\stopTEXpage {\removelastspace \dostopfittingpage} @@ -98,7 +109,7 @@ \starttext #2% preamble \startTEXpage[#1]% - \setbox\scratchbox=\hbox{#3}% + \setbox\scratchbox\hbox{#3}% \saveTEXapplication02% dimensions \box\scratchbox \stopTEXpage @@ -114,11 +125,11 @@ \executesystemcommand{ps2pdf \bufferprefix\@@texapp.ps \bufferprefix\@@texapp.pdf}% \fi \restoreTEXapplication % dimensions - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\expanded{\externalfigure [\bufferprefix\@@texapp.\ifdone eps\else pdf\fi] [\c!object=\v!nee]}}% - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\lower\ht\scratchbox\hbox{\raise\dimen2\box\scratchbox}}% \wd\scratchbox\dimen0 \ht\scratchbox\dimen2 diff --git a/tex/context/base/page-bck.tex b/tex/context/base/page-bck.tex index 5c4772b05..e0cba9eb6 100644 --- a/tex/context/base/page-bck.tex +++ b/tex/context/base/page-bck.tex @@ -131,11 +131,11 @@ \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 + \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}% + {\dp#2\zeropoint\box#2}% \fi\fi\fi} %D There are quite some backgrounds. At the bottom layer, @@ -172,7 +172,7 @@ \def\addmainbackground#1% todo: dimension spec {\ifsomebackground \ifnewbackground \setbackgroundboxes \fi - \setbox#1=\vbox + \setbox#1\vbox {\offinterlineskip \doifmarginswapelse {\copy\leftbackground} @@ -188,7 +188,7 @@ \def\addtextbackground#1% {\ifconditional\hiddenbackgroundenabled - \addsomebackground\v!verborgen#1\zetbreedte\teksthoogte % mine ! + \addsomebackground\v!verborgen#1\zetbreedte\teksthoogte % mine ! \fi \addsomebackground\v!tekst#1\zetbreedte\teksthoogte} @@ -217,12 +217,12 @@ \let\pagebackgrounddepth = \!!zeropoint % \def\setbackgroundboxes -% {\showmessage{\m!layouts}{8}\empty +% {\showmessage\m!layouts8\empty % \setbackgroundbox\leftbackground\relax % \ifdubbelzijdig % \setbackgroundbox\rightbackground\doswapmargins % \fi -% \doifnot{\@@mastatus}{\v!herhaal}{\global\newbackgroundfalse}} +% \doifnot\@@mastatus\v!herhaal{\global\newbackgroundfalse}} %D We need a bit more clever mechanism in order to handle %D layers well. This means that we cannot calculate both @@ -237,8 +237,8 @@ \def\setbackgroundboxes {\ifnewbackground - \global\chardef\newrightbackground1 - \global\chardef\newleftbackground1 + \global\chardef\newrightbackground\plusone + \global\chardef\newleftbackground\plusone \global\setbox\leftbackground\emptybox \global\setbox\rightbackground\emptybox \fi @@ -246,21 +246,21 @@ \ifcase\newleftbackground \else \showmessage\m!layouts8\empty \setbackgroundbox\leftbackground\relax - \global\chardef\newleftbackground0 - \global\chardef\newrightbackground0 + \global\chardef\newleftbackground\zerocount + \global\chardef\newrightbackground\zerocount \fi \orsideone \ifcase\newleftbackground \else \showmessage\m!layouts8\empty \setbackgroundbox\leftbackground\relax - \global\chardef\newleftbackground0 - %\global\chardef\newrightbackground0 + \global\chardef\newleftbackground\zerocount + %\global\chardef\newrightbackground\zerocount \fi \orsidetwo \ifcase\newrightbackground \else \showmessage\m!layouts8\empty \setbackgroundbox\rightbackground\doswapmargins - \global\chardef\newrightbackground0 + \global\chardef\newrightbackground\zerocount \fi \od \ifx\@@mastatus\v!herhaal\else\global\newbackgroundfalse\fi} @@ -268,7 +268,7 @@ \def\addmainbackground#1% todo: dimension spec {\ifsomebackground \setbackgroundboxes - \setbox#1=\vbox + \setbox#1\vbox {\offinterlineskip \doifmarginswapelse {\copy\leftbackground} @@ -301,7 +301,7 @@ \appendtoks \setbackgroundoffsets \to \everybeforepagebody \def\setbackgroundbox#1#2% - {\global\setbox#1=\vbox + {\global\setbox#1\vbox {\dontcomplain \calculatereducedvsizes \offinterlineskip @@ -322,7 +322,7 @@ \def\dodopagebodybackground#1#2% {\ifdim#2>\zeropoint % added, faster - \setbox\scratchbox=\vbox to #2 + \setbox\scratchbox\vbox to #2 \bgroup\hbox\bgroup \swapmargins \goleftonpage @@ -336,7 +336,7 @@ \hskip\rechterrandafstand \dododopagebodybackground\rechterrandbreedte #2#1\v!rechterrand \egroup\egroup - \wd\scratchbox=\zeropoint + \wd\scratchbox\zeropoint \box\scratchbox\relax \fi} @@ -355,7 +355,7 @@ \hskip#1% \fi \else - \hskip#1% + \hskip#1% \fi} %D The background mechanism is quite demanding in terms or @@ -374,7 +374,7 @@ %D Because the number of arguments runs from one to three, %D we need to check for it. -\def\setupbackgrounds% +\def\setupbackgrounds {\dotripleempty\dosetupbackgrounds} \def\dosetupbackgrounds[#1][#2][#3]% @@ -551,6 +551,56 @@ [\v!verborgen] [\c!achtergrond=\hiddenbackground] +% The next series is used in local (for instance floating) +% backgrounds. + +\presetlocalframed + [\??ma\v!lokaal] + +\def\localbackground + {\v!lokaal-2,\v!lokaal-1,\v!voorgrond,\v!lokaal+1,\v!lokaal+2} + +\defineoverlay[\v!lokaal-2][\positionoverlay{\v!lokaal-2}] +\defineoverlay[\v!lokaal-1][\positionoverlay{\v!lokaal-1}] +\defineoverlay[\v!lokaal+1][\positionoverlay{\v!lokaal+1}] +\defineoverlay[\v!lokaal+2][\positionoverlay{\v!lokaal+2}] + +\def\addlocalbackgroundtobox + {\ifconditional\hiddenbackgroundenabled + \expandafter\doaddlocalbackground + \else + \expandafter\gobbleoneargument + \fi} + +\def\doaddlocalbackground#1% + {\scratchdimen\dp#1% + \edef\next + {\noexpand\redoglobal\wd#1\the\wd#1% + \noexpand\redoglobal\ht#1\the\ht#1% + \noexpand\dodoglobal\dp#1\the\dp#1}% + \dp#1\zeropoint + \setbox#1\hbox + {\localframed + [\??ma\v!lokaal] + [\c!kader=\v!uit, + \c!offset=\v!overlay, + \c!achtergrond=\localbackground]% + {\registerMPlocaltextarea{\box#1}}}% + \ifdim\naturalfloatdepth>\zeropoint % maybe take difference + \redoglobal\setbox#1\hbox{\lower\scratchdimen\box#1}% + \fi + \next} + +% Test how previous macro behaves with depth: +% +% \startcolumnset +% \input tufte +% \placefigure{none}{\framed[lines=5]{xxx}} +% \input tufte +% \placefigure{none}{\starttabulate\NC test\nc test\NC\NR\stoptabulate} +% \input tufte +% \stopcolumnset + %D Because we haven't really set up backgrounds yet, we set %D the main efficiency switch to false. diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex index 2f7b98ac2..376c98eb7 100644 --- a/tex/context/base/page-flt.tex +++ b/tex/context/base/page-flt.tex @@ -25,15 +25,15 @@ \def\spreadhbox#1% rebuilds \hbox{<box><hss><box><hss><box>} {\bgroup \ifhbox#1\relax - \setbox2=\voidbox + \setbox2\voidbox \unhbox#1% \doloop {\unpenalty\unskip\unpenalty\unskip\unpenalty\unskip - \setbox0=\lastbox + \setbox0\lastbox \ifvoid0 \exitloop \else - \setbox2=\hbox + \setbox2\hbox {\ifhbox0 \spreadhbox0\else\box0\fi \ifvoid2 \else\hss\unhbox2\fi}% \fi}% @@ -161,7 +161,7 @@ {\dodoubleargument\getparameters[\??bk]} \def\stelblokkopjesin - {\dodoubleargument\getparameters[\??kj]}% + {\dodoubleargument\getparameters[\??kj]} \def\dostelplaatsblokin[#1][#2]% {\def\docommando##1{\getparameters[\??fl##1][#2]}% @@ -180,7 +180,7 @@ \def\doleegblok#1% {\localframed [\??fl#1][\c!kader=\v!aan]% - {\getmessage{\m!floatblocks}{12}}} + {\getmessage\m!floatblocks{12}}} \def\docomplexplaatsblok[#1][#2]% [#3]#4% {\doifelsenothing{#1} @@ -191,33 +191,6 @@ {\edef\floatlocation{#2}}% \expanded{\dodocomplexplaatsblok[\floattype][\floatlocation]}} -% \def\dodocomplexplaatsblok[#1][#2][#3]#4% -% {\flushnotes -% \ifsomefloatwaiting -% % this was \checkwaitingfloats spread all over -% \doifinsetelse{\v!altijd}{#2} -% {\showmessage{\m!floatblocks}{5}{}} -% {\doifcommonelse -% {#2} -% {\v!tekst,\v!naast,% \v!pagina, -% \v!links,\v!rechts,\v!inlinker,\v!inrechter,% -% \v!inmarge} -% {\doflushfloats} -% {}}% -% % but which should be done before using box \floatbox -% \fi -% \ifmargeblokken -% \doifinset{\v!marge}{#2} -% {\bgroup\everypar{\egroup\the\everypar}% -% \hsize\@@mbbreedte}% -% \fi -% \global\insidefloattrue -% \let\@@extrafloat\empty -% \dowithnextboxcontent % better a \the\everyfloattoks -% {\postponefootnotes} % new -% {\xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}}% -% \vbox} - \def\presetfloatvariables#1#2#3#4% {\doifcommonelse {#2} @@ -230,32 +203,59 @@ \fi \calculatefloatskips{#1}% \ifparfloat - \doifinset{\v!hoog}{#2} - {\global\sidefloattopskip \zeropoint}% - \doifinset{\v!laag}{#2} - {\global\sidefloatbottomskip\zeropoint}% - \doifinset{\v!passend}{#2} + \doifinset\v!hoog{#2}{\global\sidefloattopskip \zeropoint}% + \doifinset\v!laag{#2}{\global\sidefloatbottomskip\zeropoint}% + \doifinset\v!passend{#2} {\global\sidefloattopskip \zeropoint \global\sidefloatbottomskip\zeropoint \global\floatsideskip \zeropoint}% \fi - \doifinsetelse{\v!geennummer}{#2} - {\doifelsevalue{\??kj#1\c!nummer}{\v!ja} - {\global\nofloatnumbertrue} - {\global\nofloatnumberfalse}} - {\global\nofloatnumberfalse}% - \doifinsetelse{\v!geen}{#2} + \doifinsetelse\v!geennummer{#2} + {\global\nofloatnumbertrue} + {\doifelsevalue{\??kj#1\c!nummer}\v!ja + {\global\nofloatnumberfalse} + {\global\nofloatnumbertrue}}% + \ConvertToConstant\doifelse{#4}{} + {\global\emptyfloatcaptiontrue} + {\global\emptyfloatcaptionfalse}% + \doifinsetelse\v!geen{#2} {\global\nofloatcaptiontrue} - {\ConvertToConstant\doifelse{#4}{\v!geen} + {\ConvertToConstant\doifelse{#4}\v!geen {\global\nofloatcaptiontrue} - {\global\nofloatcaptionfalse}}} + {\global\nofloatcaptionfalse}}% + \ifemptyfloatcaption \ifnofloatnumber + \global\nofloatcaptiontrue + \fi \fi} + +\def\presetmorefloatvariables#1% + {\doifelse\@@bklokaal\v!ja % fout keyword + \globalcenterfloatboxtrue + \globalcenterfloatboxfalse + \ifglobalcenterfloatbox + \localcenterfloatboxtrue + \else + \doifinsetelse\v!lokaal{#1} + \localcenterfloatboxtrue + \localcenterfloatboxfalse + \fi + \doifnotinset\v!altijd{#1} + {\globalcenterfloatboxfalse + \localcenterfloatboxfalse}} + +\def\setlocalfloathsize + {\iflocalcenterfloatbox + \seteffectivehsize + \hsize\localhsize + \fi} + +\newevery \everyinsidefloat \relax \def\dodocomplexplaatsblok[#1][#2][#3]#4% {\flushnotes \ifsomefloatwaiting % this was \checkwaitingfloats spread all over - \doifinsetelse{\v!altijd}{#2} - {\showmessage{\m!floatblocks}{5}{}} + \doifinsetelse\v!altijd{#2} + {\showmessage\m!floatblocks5\empty} {\doifcommonelse {#2} {\v!tekst,\v!naast,% \v!pagina, @@ -266,26 +266,67 @@ % but which should be done before using box \floatbox \fi \ifmargeblokken - \doifinset{\v!marge}{#2} + \doifinset\v!marge{#2} {\bgroup\everypar{\egroup\the\everypar}% \hsize\@@mbbreedte}% \fi \global\insidefloattrue +\begingroup +\the\everyinsidefloat \let\@@extrafloat\empty + \presetmorefloatvariables{#2}% \dowithnextboxcontent % better a \the\everyfloattoks - {\postponefootnotes} % new - {\xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}} - \vbox} - + {\setlocalfloathsize + \postponefootnotes} % new + {\xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}% +\endgroup} + \vbox} + \def\xxdocompletefloat#1#2% {\setbox\nextbox\hbox{\signalrightpage\box\nextbox}% \doifrightpageelse{\let\@@extrafloat#1}{\let\@@extrafloat#2}} \newif\ifextrafloatactions \extrafloatactionstrue +% \let\movesidefloat\gobbleoneargument + +% new : \placefloat[leftmargin,-2*line] + +\def\movesidefloat[#1]% + {\bgroup + \donefalse + \def\movesidefloat##1% + {\ifdone \else + \global\sidefloatdownshift\zeropoint + \donetrue + \fi + \global\advance\sidefloatdownshift##1\lineheight}% + \expanded{\dorepeatwithcommand[#1]}\domovesidefloat + \egroup} + +% or cleaner be longer: +% +% \def\movesidefloat[#1]% +% {\bgroup +% \def\movesidefloat##1% +% {\global\sidefloatdownshift\zeropoint +% \def\movesidefloat####1% +% {\global\advance\sidefloatdownshift####1\lineheight}% +% \movesidefloat##1}% +% \expanded{\dorepeatwithcommand[#1]}\domovesidefloat +% \egroup} + +\def\domovesidefloat#1% + {\processaction + [#1]% + [ \v!regel=>\movesidefloat+,% + -\v!regel=>\movesidefloat-]} + \def\xdocompletefloat#1#2#3#4#5#6% {\ifextrafloatactions \let\@@extrafloat\empty + % \sidefloatdownshift will be reset afterwards, and can + % already be set at this point \processallactionsinset [#4] [\v!binnen=>\xxdocompletefloat\v!links \v!rechts, @@ -296,7 +337,8 @@ \v!buitenrand=>\xxdocompletefloat\v!rechterrand \v!linkerrand, % for old times sake ininner=>\xxdocompletefloat\v!inlinker \v!inrechter, - inouter=>\xxdocompletefloat\v!inrechter \v!inlinker]% + inouter=>\xxdocompletefloat\v!inrechter \v!inlinker, + \s!unknown=>{\movesidefloat[\commalistelement]}]% \ifx\@@extrafloat\empty \setlocalfloatdimensions{#1}{#4}% \docompletefloat{#1}{#2}{#3}{#4}{#5}{#6}{\box\nextbox}% @@ -312,14 +354,16 @@ \def\setlocalfloatdimensions#1#2% experimental ! ! ! ! {\doifvaluesomething{\??fl#1\c!maxbreedte} - {\scratchdimen=\getvalue{\??fl#1\c!maxbreedte}\relax + {\scratchdimen\getvalue{\??fl#1\c!maxbreedte}\relax \ifdim\wd\nextbox>\scratchdimen - \setbox\nextbox=\hbox to \scratchdimen - {\doifnotcommon - {\v!rechts,\v!inrechter,\v!rechtermarge,\v!rechterrand}{#2}\hss - \box\nextbox - \doifnotcommon - {\v!links,\v!inlinker,\v!linkermarge,\v!linkerrand}{#2}\hss}% + \setbox\nextbox\hbox to \scratchdimen + {\doifcommonelse{\v!rechts,\v!inrechter,\v!links,\v!inlinker}{#2} + {\doifnotcommon{\v!rechts,\v!inrechter}{#2}\hss + \box\nextbox + \doifnotcommon{\v!links ,\v!inlinker }{#2}\hss}% + {\doifvalue{\??fl#1\c!plaats}\v!rechts\hss + \box\nextbox + \doifvalue{\??fl#1\c!plaats}\v!links \hss}}% \fi}} \def\docomplexstarttekstblok[#1][#2][#3]% @@ -357,6 +401,8 @@ \c!zijvoorwit=\@@bkzijvoorwit, \c!zijnawit=\@@bkzijnawit, \c!marge=\@@bkmarge, + \c!linkermargeafstand=\@@bklinkermargeafstand, + \c!rechtermargeafstand=\@@bkrechtermargeafstand, \c!kader=\@@bkkader, \c!straal=\@@bkstraal, \c!hoek=\@@bkhoek, @@ -370,6 +416,7 @@ \c!linkerkader=\@@bklinkerkader, \c!rechterkader=\@@bkrechterkader, \c!kaderoffset=\@@bkkaderoffset, + %\c!lokaal=\@@bklokaal, \c!paginaovergangen=, \c!default=]% \stelblokkopjein @@ -427,13 +474,16 @@ \setvalue{\e!leeg#1}% {\doleegblok{#1}}} +% \setupfloat[...][leftmargindistance=1cm,default={left,none}] + \def\redodefinieerplaatsblok[#1][#2][#3]% same label/number {\presetlocalframed[\??fl#1]% \copylocalframed[\??fl#1][\??fl#3]% \copyparameters[\??fl#1][\??fl#3] - [\c!breedte,\c!hoogte, + [\c!breedte,\c!hoogte,%\c!lokaal, \c!maxbreedte,\c!maxhoogte,\c!marge,\c!zijvoorwit,\c!zijnawit, - \c!kader,\c!straal,\c!hoek,\c!plaats,\c!achtergrond, + \c!linkermargeafstand,\c!rechtermargeafstand, + \c!kader,\c!straal,\c!hoek,\c!plaats,\c!achtergrond,\c!kaderkleur, \c!achtergrondraster,\c!achtergrondkleur,\c!achtergrondoffset, \c!bovenkader,\c!onderkader,\c!linkerkader,\c!rechterkader, \c!kaderoffset,\c!paginaovergangen,\c!default]% @@ -483,13 +533,13 @@ % Daarbij wordt gebruik gemaakt van de opgeslagen nummers en % volgorde. -\definetwopasslist{\s!float} +\definetwopasslist\s!float -\def\dofloatreference% +\def\dofloatreference {\doglobal\increment\numberedfloat - \edef\dodofloatreference% - {\writeutilitycommand% - {\twopassentry% + \edef\dodofloatreference + {\writeutilitycommand + {\twopassentry {\s!float}% {\numberedfloat}% {\hetnummer}}}% @@ -497,14 +547,12 @@ \def\redofloatorder#1% {\doglobal\increment\nofplacedfloats\relax - \gettwopassdata{\s!float}% + \gettwopassdata\s!float \iftwopassdatafound - \doifnot{\hetnummer}{\twopassdata} + \doifnot\hetnummer\twopassdata {\edef\oldhetnummer{\hetnummer}% \xdef\hetnummer{\twopassdata}% - \showmessage - {\m!floatblocks}{1} - {\nofplacedfloats,#1 \oldhetnummer,\hetnummer}}% + \showmessage\m!floatblocks1{\nofplacedfloats,#1 \oldhetnummer,\hetnummer}}% \fi} % In \dofloatinfomessage wordt {{ }} gebruikt omdat anders @@ -513,115 +561,55 @@ \def\dofloatinfomessage#1#2#3% {\bgroup - \showmessage{\m!floatblocks}{#2}{#3}% + \showmessage\m!floatblocks{#2}{#3}% \@EA\floatinfo\@EA#1\@EA{\currentmessagetext}% \egroup} -\def\dosavefloatinfo% +\def\dosavefloatinfo {\dofloatinfomessage{>}{2}{\the\totalnoffloats}} -\def\dofloatflushedinfo% +\def\dofloatflushedinfo {\bgroup - \!!counta=\totalnoffloats - \advance\!!counta by -\savednoffloats + \!!counta\totalnoffloats + \advance\!!counta -\savednoffloats \dofloatinfomessage{<}{3}{\the\!!counta}% \egroup} -\def\doinsertfloatinfo% +\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% +\def\dogetfloat {\ifsomefloatwaiting - \global\setbox\floatlist=\vbox + \global\setbox\floatlist\vbox {\unvbox\floatlist - \global\setbox\globalscratchbox=\lastbox}% + \global\setbox\globalscratchbox\lastbox}% \ifcenterfloatbox \ifdim\wd\globalscratchbox<\hsize - \setbox\floatbox=\hbox to \hsize{\hss\box\globalscratchbox\hss}% + \setbox\floatbox\hbox to \hsize{\hss\box\globalscratchbox\hss}% \else - \setbox\floatbox=\box\globalscratchbox % local ! + \setbox\floatbox\box\globalscratchbox % local ! \fi \else - \setbox\floatbox=\box\globalscratchbox % local ! + \setbox\floatbox\box\globalscratchbox % local ! \fi - \global\advance\savednoffloats by -1\relax - \ifnum\savednoffloats=0 + \global\advance\savednoffloats \minusone + \ifcase\savednoffloats \global\somefloatwaitingfalse \fi \else - \global\savednoffloats=0 - \global\setbox\floatbox=\box\voidb@x + \global\savednoffloats\zerocount + \global\setbox\floatbox\box\voidb@x \fi} -\def\uncenteredfloatbox% +\def\uncenteredfloatbox {\ifcenterfloatbox \ifhbox\floatbox\relax % remove centering \ifdim\wd\floatbox=\hsize \ifhbox\floatbox - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\unhbox\floatbox \unskip\unskip - \global\setbox\globalscratchbox=\lastbox}% + \global\setbox\globalscratchbox\lastbox}% \box\globalscratchbox \else \box\floatbox @@ -636,40 +624,40 @@ \box\floatbox \fi} -\def\dosavefloat% - {\global\setbox\floatlist=\vbox +\def\dosavefloat + {\global\setbox\floatlist\vbox {\nointerlineskip \uncenteredfloatbox \unvbox\floatlist}% - \global\advance\savednoffloats 1 + \global\advance\savednoffloats \plusone \global\somefloatwaitingtrue \dosavefloatinfo \nonoindentation} -\def\doresavefloat% - {\global\setbox\floatlist=\vbox +\def\doresavefloat + {\global\setbox\floatlist\vbox {\nointerlineskip \unvbox\floatlist \uncenteredfloatbox}% - \global\advance\savednoffloats 1 + \global\advance\savednoffloats \plusone \global\somefloatwaitingtrue} -\def\doreversesavefloat% - {\global\setbox\floatlist=\vbox +\def\doreversesavefloat + {\global\setbox\floatlist\vbox {\nointerlineskip \unvbox\floatlist \uncenteredfloatbox}% - \global\advance\savednoffloats 1 + \global\advance\savednoffloats \plusone \global\somefloatwaitingtrue \dosavefloatinfo} -\def\dosavefloatstatus% +\def\dosavefloatstatus {\global\setbox\savedfloatlist\copy\floatlist \global\setbox\savedfloatbox \copy\floatbox - \xdef\dorestorefloatstatus% + \xdef\dorestorefloatstatus {\global\setbox\floatlist\box\savedfloatlist \global\setbox\floatbox \box\savedfloatbox - \savednoffloats\the\savednoffloats}} + \global\savednoffloats\the\savednoffloats}} \let\dorestorefloatstatus\relax @@ -685,15 +673,17 @@ \newif\iftopofinsert \newif\iftestfloatbox -\newif\ifcenterfloatbox \centerfloatboxtrue +\newif\ifcenterfloatbox \centerfloatboxtrue +\newif\iflocalcenterfloatbox \localcenterfloatboxfalse +\newif\ifglobalcenterfloatbox \globalcenterfloatboxfalse % 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}% + \setbox0\vbox{\strut\blanko[\@@bkvoorwit]\strut}% + \setbox2\vbox{\strut\blanko[\@@bknawit ]\strut}% \ifdim\ht0>\ht2 \blanko[-\@@bknawit,\@@bkvoorwit] \fi @@ -718,36 +708,36 @@ \def\somepagefloat[#1]% links, rechts, midden, hoog, midden, laag {%\checkwaitingfloats{#1}% - \global\setbox\collectedpagefloats=\vbox + \global\setbox\collectedpagefloats\vbox {\unvbox\collectedpagefloats \vbox to \teksthoogte - {\doifnotinset{\v!hoog}{#1}{\vfill} + {\doifnotinset\v!hoog{#1}\vfill \box\floatbox - \doifnotinset{\v!laag}{#1}{\vfill}} + \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\floattextwidth\hsize + \global\floatwidth\wd\floatbox + \global\floatheight\ht\floatbox % forget about the depth \global\advance\floattextwidth -\floatwidth \global\advance\floattextwidth -\@@bkmarge\relax % was \tfskipsize - \doifinsetelse{\v!lang}{#1} - {\floattextheight=\pagegoal - \advance\floattextheight by -\pagetotal - \advance\floattextheight by -\bigskipamount % lelijk + \doifinsetelse\v!lang{#1} + {\floattextheight\pagegoal + \advance\floattextheight -\pagetotal + \advance\floattextheight -\bigskipamount % lelijk \ifdim\floattextheight>\teksthoogte - \floattextheight=\teksthoogte + \floattextheight\teksthoogte \fi - \boxmaxdepth=\zeropoint \relax % toegevoegd + \boxmaxdepth\zeropoint \relax % toegevoegd \ifdim\floattextheight<\floatheight - \floattextheight=\floatheight + \floattextheight\floatheight \fi - \setbox\floattext=\vbox to \floattextheight} - {\setbox\floattext=\vbox}% + \setbox\floattext\vbox to \floattextheight} + {\setbox\floattext\vbox}% \bgroup \forgetall\stelblankoin\stelwitruimtein % new, also needed for footnotes \blanko[\v!blokkeer] @@ -756,48 +746,48 @@ \def\dodostoptextfloat[#1]% % de tekst kan beter in een soort {\egroup % kadertekst zonder kader, is flexibeler - \doifnotinset{\v!lang}{#1}% en beter + \doifnotinset\v!lang{#1}% en beter {\ifdim\ht\floattext<\floatheight - \floattextheight=\floatheight + \floattextheight\floatheight \else - \floattextheight=\ht\floattext + \floattextheight\ht\floattext \fi}% - \setbox\floatbox=\vbox to \floattextheight + \setbox\floatbox\vbox to \floattextheight {\hsize\floatwidth - \doifinsetelse{\v!beide}{#1}% - {\doifinsetelse{\v!laag}{#1} + \doifinsetelse\v!beide{#1}% + {\doifinsetelse\v!laag{#1} {\vfill\box\floatbox} - {\doifinsetelse{\v!midden}{#1} + {\doifinsetelse\v!midden{#1} {\vfill\box\floatbox\vfill} {\box\floatbox\vfill}}} {\box\floatbox\vfill}}% - \setbox\floattext=\vbox to \floattextheight + \setbox\floattext\vbox to \floattextheight {\hsize\floattextwidth - \doifinsetelse{\v!laag}{#1} + \doifinsetelse\v!laag{#1} {\vfill \box\floattext - \doifinset{\c!offset}{#1}{\witruimte\blanko}} - {\doifinsetelse{\v!midden}{#1} + \doifinset\c!offset{#1}{\witruimte\blanko}} + {\doifinsetelse\v!midden{#1} {\vfill \box\floattext \vfill} - {\doifinset{\v!offset}{#1}{\witruimte\blanko}% + {\doifinset\v!offset{#1}{\witruimte\blanko}% \box\floattext \vfill}}}% - \doifinsetelse{\v!rechts}{#1}% - {\setbox\floatbox=\hbox to \hsize + \doifinsetelse\v!rechts{#1}% + {\setbox\floatbox\hbox to \hsize {\box\floattext \hfill \box\floatbox}} - {\setbox\floatbox=\hbox to \hsize + {\setbox\floatbox\hbox to \hsize {\box\floatbox \hfill \box\floattext}}% \baselinecorrection \witruimte \blanko[\@@bkvoorwit]% - \doifnotinset{\v!lang}{#1}% - {\dp\floatbox=\openstrutdepth}% dp\strutbox}% % toegevoegd + \doifnotinset\v!lang{#1}% + {\dp\floatbox\openstrutdepth}% dp\strutbox}% % toegevoegd \box\floatbox \blanko[\@@bknawit]% \doinsertfloatinfo} @@ -808,14 +798,14 @@ \doinsertfloatinfo} \def\someelsefloat[#1]% - {\doifinsetelse{\v!hier}{#1} - {\doifinsetelse{\v!altijd}{#1} + {\doifinsetelse\v!hier{#1} + {\doifinsetelse\v!altijd{#1} {\pagina[\v!voorkeur]% \docheckiffloatfits \ifroomforfloat \placesomeherefloat[#1]% \else - \showmessage{\m!floatblocks}{9}{}% + \showmessage\m!floatblocks9\empty \doreversesavefloat \fi} {\ifsomefloatwaiting @@ -829,7 +819,7 @@ \dosavefloat \fi \fi}} - {\doifinsetelse{\v!altijd}{#1} + {\doifinsetelse\v!altijd{#1} {\docheckiffloatfits \ifroomforfloat \processallactionsinset @@ -839,7 +829,7 @@ \s!unknown=>{\placesomeherefloat[#1]}, \s!default=>{\placesomeherefloat[#1]}]% \else - \showmessage{\m!floatblocks}{9}{}% + \showmessage\m!floatblocks9\empty \doreversesavefloat \fi} {\docheckiffloatfits @@ -871,12 +861,17 @@ % 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\floatsideskip \floatsideskip =12pt +\newdimen\floattopskip \floattopskip =\floattopskip +\newdimen\floatbottomskip \floatbottomskip=\floattopskip -\newdimen\sidefloattopskip \sidefloattopskip=\floattopskip +\newdimen\sidefloattopskip \sidefloattopskip =\floattopskip \newdimen\sidefloatbottomskip \sidefloatbottomskip=\floatbottomskip + +\newskip\sidefloatdownshift +\newskip\sidefloatleftshift +\newskip\sidefloatrightshift + \def\sidefloattopoffset {\openstrutdepth} % {\dp\strutbox} \newcount\noftopfloats \noftopfloats=2 @@ -884,11 +879,12 @@ \newif\ifnofloatcaption \newif\ifnofloatnumber +\newif\ifemptyfloatcaption \def\docalculatefloatskip#1#2% {\doifelsenothing{#2} {\global#1\zeropoint} - {\doifelse{#2}{\v!geen} + {\doifelse{#2}\v!geen {\global#1\zeropoint} {\setbox0\vbox{\witruimte\@EA\blanko\@EA[#2]}% \global#1\ht0}}} @@ -899,7 +895,9 @@ \docalculatefloatskip\sidefloattopskip {\getvalue{\??fl#1\c!zijvoorwit}}% \@@bkzijvoorwit \docalculatefloatskip\sidefloatbottomskip{\getvalue{\??fl#1\c!zijnawit}}% \@@bkzijnawit \gdef\sidefloattopoffset{\openstrutdepth}% was \def - \global\floatsideskip\getvalue{\??fl#1\c!marge}% \@@bkmarge\relax + \global\floatsideskip\getvalue{\??fl#1\c!marge}% + \global\sidefloatleftshift \getvalue{\??fl#1\c!linkermargeafstand}% + \global\sidefloatrightshift\getvalue{\??fl#1\c!rechtermargeafstand}% \global\noftopfloats \@@bknboven\relax \global\nofbotfloats \@@bknonder\relax}} @@ -942,43 +940,21 @@ \def\setfloatcaption % \dosetfloatcaption already in use {\dodoubleempty\dodosetfloatcaption} % beware, name clash -% \def\dodosetfloatcaption[#1][#2]#3% to do namespace for number/ascii -% {\doifelsevalue{\??kj#1\c!nummer}{\v!ja} % also handle trialtypesetting -% {\verhoognummer[#1]% -% \maakhetnummer[#1]% -% \global\let\flhetnummer\hetnummer -% \setgvalue{@fl@r@#1}% -% {\dofloatreference -% \redofloatorder{#1}% -% \doschrijfnaarlijst{#1}{\flhetnummer}{#3}{#1}% -% \doglobal\convertargument#3\to\flasciititle % \asciititle is global -% \doifsomething{#2}{\rawreference{\s!flt}{#2}{{\flhetnummer}{\flasciititle}}}% -% \global\letvalue{@fl@r@#1}\relax}% nills -% \setgvalue{@fl@t@#1}% -% {\preparethenumber{\??kj#1}\flhetnummer\preparednumber -% \doattributes{\??kj#1}\c!letter\c!kleur -% {\doattributes{\??kj#1}\c!kopletter\c!kopkleur -% {\labeltexts{#1}{\preparednumber}}% -% \doattributes{\??kj#1}\c!tekstletter\c!tekstkleur -% {\tfskip#3}}}} -% {\global\letvalue{@fl@r@#1}\relax -% \global\letvalue{@fl@t@#1}\relax}} - \def\dodosetfloatcaption[#1][#2]#3% to do namespace for number/ascii {\ifnofloatnumber % also handle trialtypesetting - \global\letvalue{@fl@r@#1}\relax - \global\letvalue{@fl@t@#1}\relax + \letgvalue{@fl@r@#1}\relax + \letgvalue{@fl@t@#1}\relax \else \verhoognummer[#1]% \maakhetnummer[#1]% - \global\let\flhetnummer\hetnummer + \globallet\flhetnummer\hetnummer \setgvalue{@fl@r@#1}% {\dofloatreference \redofloatorder{#1}% \doschrijfnaarlijst{#1}{\flhetnummer}{#3}{#1}% \doglobal\convertargument#3\to\flasciititle % \asciititle is global - \doifsomething{#2}{\rawreference{\s!flt}{#2}{{\flhetnummer}{\flasciititle}}}% - \global\letvalue{@fl@r@#1}\relax}% nills + \doifsomething{#2}{\rawreference\s!flt{#2}{{\flhetnummer}{\flasciititle}}}% + \letgvalue{@fl@r@#1}\relax}% nills \setgvalue{@fl@t@#1}% {\preparethenumber{\??kj#1}\flhetnummer\preparednumber \doattributes{\??kj#1}\c!letter\c!kleur @@ -997,49 +973,37 @@ \let\placefloatlabeltext \placefloatcaptiontext \let\placefloatlabelreference \placefloatcaptionreference -\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}}} +\def\borderedfloatbox#1% + {\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}}% -% \doattributes{\??kj#1}\c!tekstletter\c!tekstkleur -% {\begstrut#3\endstrut\endgraf}}} - \def\putcompletecaption#1#2#3#4% {\noindent \xdef\floatcaptionnumber{#1}% - \doattributes{\??kj#1}\c!letter\c!kleur - {\ifnofloatnumber - \else - \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}% - \fi - \doattributes{\??kj#1}\c!tekstletter\c!tekstkleur - {\begstrut#3\endstrut\endgraf}}} + \dostartattributes{\??kj#1}\c!letter\c!kleur\empty + \ifnofloatnumber + \else + \hbox{\doattributes{\??kj#1}\c!kopletter\c!kopkleur{\strut#2\floatcaptionsuffix}}% + \ifnofloatcaption \else \ifemptyfloatcaption \else + \ifcase#4\relax + \tfskip\emergencystretch.5em + \else + \ifx\@@kjkjtussen\empty\else\unskip\@@kjkjtussen\fi + \fi + \fi \fi + \fi + \ifnofloatcaption \else + \doattributes{\??kj#1}\c!tekstletter\c!tekstkleur + {\begstrut#3\endstrut\endgraf}% + \fi + \dostopattributes} % new @@ -1050,76 +1014,52 @@ %\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\dosetpagfloat#1#2#3#4% \copy wegwerken {\bgroup +\setlocalfloathsize \forgetall \postponefootnotes \mindermeldingen - \putborderedfloat#4\in\tempfloatbox\\% - \def\locatefloat% - {\doregelplaats\@@flflplaats}% + \setbox\tempfloatbox\vbox{\borderedfloatbox{#4}}% + \def\locatefloat{\doregelplaats\@@flflplaats}% \ifnofloatcaption \dopreparenocaption{#1}{#2}{#3}{#4} \edef\width{\the\wd\floatbox}% \else - \setbox\tempcaptionbox=\hbox + \setbox\tempcaptionbox\hbox {\footnotesenabledfalse\putcompletecaption{#4}{#2}{#3}{0}}% - \doifinsetelse{\@@kjkjplaats}{\v!hoog,\v!midden,\v!laag} + \doifinsetelse\@@kjkjplaats{\v!hoog,\v!midden,\v!laag} {\dopreparesidecaption{#1}{#2}{#3}{#4}} - {\doifelse{\@@kjkjbreedte}{\v!max} + {\doifelse\@@kjkjbreedte\v!max {\dopreparestackcaptionmax{#1}{#2}{#3}{#4}} {\ifdim\wd\tempcaptionbox>\wd\tempfloatbox % wider caption - \doifelse{\@@kjkjbreedte}{\v!passend} + \doifelse\@@kjkjbreedte\v!passend {\dopreparestackcaptionaut{#1}{#2}{#3}{#4}} {\dopreparestackcaptionwid{#1}{#2}{#3}{#4}}% \else \dopreparestackcaptionmin{#1}{#2}{#3}{#4}% - \fi}} + \fi}}% \edef\width{\the\wd\tempfloatbox}% \buildfloatbox \fi + \doglobal\addlocalbackgroundtobox\floatbox \postcenterfloatbox\width \egroup} +\ifx\addlocalbackgroundtobox\undefined + \let\addlocalbackgroundtobox\gobbleoneargument +\fi + \def\dopreparenocaption#1#2#3#4% - {\global\setbox\floatbox=\vbox % pas op als wd groter dan hsize + {\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 + {\dosetraggedvbox\@@kjkjuitlijnen + \setbox\tempcaptionbox\raggedbox {\hsize\wd\tempfloatbox \putcompletecaption{#4}{#2}{#3}{0}}} @@ -1127,28 +1067,28 @@ \def\captionovershoot {2em} \def\dopreparestackcaptionaut#1#2#3#4% - {\doifsomething{\@@kjkjuitlijnen} - {\ExpandBothAfter\doifnotinset{\v!midden}{\@@kjkjuitlijnen} + {\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 + \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 + \setbox\tempcaptionbox\raggedbox + {\hsize\wd\tempfloatbox \advance\hsize -\captionovershoot\relax \ifdim\hsize<\captionminwidth\relax - \hsize=\wd\tempfloatbox + \hsize\wd\tempfloatbox \fi \putcompletecaption{#4}{#2}{#3}{0}}% \else - \setbox\tempcaptionbox=\raggedbox - {\hsize=\wd\tempfloatbox + \setbox\tempcaptionbox\raggedbox + {\hsize\wd\tempfloatbox \putcompletecaption{#4}{#2}{#3}{0}}% \fi \else @@ -1158,10 +1098,10 @@ \else \scratchdimen\wd\tempfloatbox % float width \fi - \setbox\scratchbox=\vbox % test with overshoot + \setbox\scratchbox\vbox % test with overshoot {\advance\scratchdimen \captionovershoot \advance\scratchdimen 3em % an average word length - \ifdim\scratchdimen<\hsize \hsize=\scratchdimen \fi + \ifdim\scratchdimen<\hsize \hsize\scratchdimen \fi \footnotesenabledfalse \putcompletecaption{#4}{#2}{#3}{0}}% \ifdim\ht\scratchbox>\lineheight @@ -1169,11 +1109,11 @@ \dosetraggedvbox\@@kjkjuitlijnen \setbox\tempcaptionbox\raggedbox {\advance\scratchdimen \captionovershoot - \ifdim\scratchdimen<\hsize \hsize=\scratchdimen \fi + \ifdim\scratchdimen<\hsize \hsize\scratchdimen \fi \putcompletecaption{#4}{#2}{#3}{0}}% \else % just over a line, don't use an overshoot - \doifinsetelse{\@@kjkjuitlijnen}{\v!links,\v!rechts} + \doifinsetelse\@@kjkjuitlijnen{\v!links,\v!rechts} {\dosetraggedvbox\@@kjkjuitlijnen \setbox\tempcaptionbox\raggedbox {\hsize\scratchdimen @@ -1188,35 +1128,36 @@ \def\dopreparestackcaptionwid#1#2#3#4% {\dosetraggedvbox\@@kjkjuitlijnen - \setbox\tempcaptionbox=\raggedbox + \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 + \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 + {\dimen0\hsize + \advance\dimen0 -\wd\tempfloatbox + \advance\dimen0 -\@@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 + \setbox\tempcaptionbox\vbox + {\hsize\dimen0 \raggedright \putcompletecaption{#4}{#2}{#3}{1}}} -\def\buildfloatbox% - {\global\setbox\floatbox=\vbox - {\forgetall +\def\buildfloatbox + {\global\setbox\floatbox\vbox + {\setlocalfloathsize + \forgetall \processaction [\@@kjkjplaats] [ \v!boven=>\locatefloat{\box\tempcaptionbox}% @@ -1226,7 +1167,7 @@ \endgraf\@@kjkjtussen \locatefloat{\box\tempcaptionbox}, \v!hoog=>\locatefloat - {\doifelse{\@@flflplaats}{\v!links} + {\doifelse\@@flflplaats\v!links {\box\tempfloatbox \tfskip \vbox to\ht\tempfloatbox{\@@kjkjtussen\box\tempcaptionbox\vfill}} @@ -1234,7 +1175,7 @@ \tfskip \box\tempfloatbox}}, \v!laag=>\locatefloat - {\doifelse{\@@flflplaats}{\v!links} + {\doifelse\@@flflplaats\v!links {\box\tempfloatbox \tfskip \vbox to\ht\tempfloatbox @@ -1244,7 +1185,7 @@ \tfskip \box\tempfloatbox}}, \v!midden=>\locatefloat - {\doifelse{\@@flflplaats}{\v!links} + {\doifelse\@@flflplaats\v!links {\box\tempfloatbox \tfskip \vbox to\ht\tempfloatbox{\vfill\box\tempcaptionbox\vfill}} @@ -1293,56 +1234,50 @@ % \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\postcenterfloatbox#1% {\ifbinnenkolommen \ifpostponecolumnfloats - \scratchdimen=\zetbreedte + \scratchdimen\zetbreedte \else - \scratchdimen=#1\relax + \scratchdimen#1\relax \fi \else\ifdim#1>\hsize - \scratchdimen=\hsize + \scratchdimen\hsize \else - \scratchdimen=\wd\floatbox + \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} + \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 + {\ifglobalcenterfloatbox + \donetrue + \else\iflocalcenterfloatbox + \donetrue + \else + \donefalse + \fi\fi + \ifdim\scratchdimen>\effectivehsize + \donefalse + \fi + \hss\ifdone\hskip\effectiveleftskip\fi + \box\floatbox + \ifdone\hskip\effectiverightskip\fi\hss}} \def\dosetparfloat#1#2#3#4% {\bgroup @@ -1350,28 +1285,28 @@ \postponefootnotes \mindermeldingen %\showcomposition - \putborderedfloat#4\in4\\ + \setbox4\vbox{\borderedfloatbox{#4}}% \ifnofloatcaption - \global\setbox\floatbox=\vbox{\box4}% + \global\setbox\floatbox\vbox{\box4}% \else - \setbox2=\hbox + \setbox2\hbox {\forgetall\putcompletecaption{#4}{#2}{#3}{0}}% - \doifelse{\@@kjkjbreedte}{\v!max} - {\dosetraggedvbox{\@@kjkjuitlijnen}% - \setbox2=\raggedbox + \doifelse\@@kjkjbreedte\v!max + {\dosetraggedvbox\@@kjkjuitlijnen + \setbox2\raggedbox {\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}}% - {\doifelse{\@@kjkjbreedte}{\v!passend} + {\doifelse\@@kjkjbreedte\v!passend {\ifdim\wd2>\wd4\relax - \setbox2=\vbox + \setbox2\vbox {\forgetall\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}% \else - \setbox2=\hbox to \wd4 + \setbox2\hbox to \wd4 {\hss\box2\hss}% \fi} - {\dosetraggedvbox{\@@kjkjuitlijnen}% - \setbox2=\raggedbox + {\dosetraggedvbox\@@kjkjuitlijnen + \setbox2\raggedbox {\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}}}% - \global\setbox\floatbox=\vbox + \global\setbox\floatbox\vbox {\processaction [\@@kjkjplaats] [ \v!boven=>\box2\endgraf\@@kjkjtussen\box4, @@ -1383,53 +1318,6 @@ \newif\ifparfloat -% \long\def\dosetfloatbox#1#2#3#4% todo : \global\setbox -% {\ifvisible -% \par -% \doifcommonelse -% {#1} -% {\v!links,\v!rechts,\v!inlinker,\v!inrechter,\v!inmarge,% -% \v!linkermarge,\v!linkerrand,\v!rechtermarge,\v!rechterrand} -% {\global\parfloattrue} -% {\global\parfloatfalse}% -% \ifbinnenkolommen -% \global\parfloatfalse -% \fi -% \edef\@@kjkjbreedte {\getvalue{\??kj#4\c!breedte }}% -% \def\@@kjkjtussen {\getvalue{\??kj#4\c!tussen }}% no \edef -% \edef\@@kjkjplaats {\getvalue{\??kj#4\c!plaats }}% -% \edef\@@kjkjuitlijnen{\getvalue{\??kj#4\c!uitlijnen}}% -% \edef\@@flflplaats {\getvalue{\??fl#4\c!plaats }}% -% \ifparfloat -% \@EA\dosetparfloat % {#1}{#2}{#3}{#4}% -% \else -% \@EA\dosetpagfloat % {#1}{#2}{#3}{#4}% -% \fi{#1}{#2}{#3}{#4}% -% \setbox\floatbox=\hbox{\restoretextcolor{\box\floatbox}}% -% \global\floatheight\ht\floatbox -% \global\advance\floatheight \dp\floatbox -% \global\floatwidth\wd\floatbox -% \global\advance\totalnoffloats 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 \lineheight -% \ifdim\dimen0<\teksthoogte -% \else -% \global\floatheight\teksthoogte -% \global\advance\floatheight -\lineheight -% \ht\floatbox\floatheight -% \dp\floatbox\zeropoint -% \showmessage{\m!floatblocks}{10}{\the\totalnoffloats}% -% \fi -% \fi} - \long\def\dosetfloatbox#1#2#3#4% todo : \global\setbox {\ifvisible \par @@ -1443,13 +1331,13 @@ \else \@EA\dosetpagfloat % {#1}{#2}{#3}{#4}% \fi{#1}{#2}{#3}{#4}% - \setbox\floatbox=\hbox{\restoretextcolor{\box\floatbox}}% + \setbox\floatbox\hbox{\restoretextcolor{\box\floatbox}}% \global\floatheight\ht\floatbox \global\advance\floatheight \dp\floatbox \global\floatwidth\wd\floatbox - \global\advance\totalnoffloats 1 - \doifnotinset{\v!marge}{#1} % gaat namelijk nog fout - {\setbox\floatbox=\vbox + \global\advance\totalnoffloats \plusone + \doifnotinset\v!marge{#1} % gaat namelijk nog fout + {\setbox\floatbox\vbox {\parindent\zeropoint \ifvoorlopig \inleftmargin{\framed{\infofont\the\totalnoffloats}}% @@ -1464,7 +1352,7 @@ \global\advance\floatheight -\lineheight \ht\floatbox\floatheight \dp\floatbox\zeropoint - \showmessage{\m!floatblocks}{10}{\the\totalnoffloats}% + \showmessage\m!floatblocks{10}{\the\totalnoffloats}% \fi \fi} @@ -1501,78 +1389,49 @@ {\dosetfloatbox{#1}{#2}{#3}{#4}% \dogetfloatbox{#1}}% -% \long\def\docompletefloat#1#2#3#4#5#6#7% -% {\flushsidefloats -% \calculatefloatskips{#1}% -% \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 -% \preparethenumber{\??kj#1}\hetnummer\preparednumber -% \dofloat{#4}{\labeltexts{#5}{\preparednumber}}{#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} +\let\naturalfloatheight\!!zeropoint +\let\naturalfloatwidth \!!zeropoint +\let\naturalfloatdepth \!!zeropoint \long\def\docompletefloat#1#2#3#4#5#6#7% {\flushsidefloats -\presetfloatvariables{#1}{#4}{#2}{#6}% + \presetfloatvariables{#1}{#4}{#2}{#6}% \bgroup - \global\setbox\floatbox=\vbox{#7}% - \dimen0=\ht\floatbox - \advance\dimen0 by \dp\floatbox + \global\setbox\floatbox\vbox{#7}% +\xdef\naturalfloatheight{\the\ht\floatbox}% +\xdef\naturalfloatwidth {\the\wd\floatbox}% +\xdef\naturalfloatdepth {\the\dp\floatbox}% + \dimen0 \ht\floatbox + \advance\dimen0 \dp\floatbox \ifdim\dimen0=\zeropoint - \showmessage{\m!floatblocks}{11}{}% - \global\setbox\floatbox=\vbox{\getvalue{\e!lege#3}}% + \showmessage\m!floatblocks{11}\empty + \global\setbox\floatbox\vbox{\getvalue{\e!lege#3}}% \fi \ifnofloatcaption - \global\setbox\floatbox=\vbox + \global\setbox\floatbox\vbox {\unvbox\floatbox - \vss % gets rid of the depth - \rawpagereference{\s!flt}{#2}}% + \vss % gets rid of the depth (unless tabulate) + \rawpagereference\s!flt{#2}}% \egroup \dofloat{#4}{}{#6}{#1}% \else \doglobal\convertargument#6\to\asciititle % \asciititle is global -% \doifelsevalue{\??kj#1\c!nummer}{\v!ja} +% \doifelsevalue{\??kj#1\c!nummer}\v!ja \ifnofloatnumber - \global\setbox\floatbox=\vbox + \global\setbox\floatbox\vbox {\unvbox\floatbox % no \vss, keep the depth - \rawreference{\s!flt}{#2}{{}{\asciititle}}}% + \rawreference\s!flt{#2}{{}{\asciititle}}}% \egroup \dofloat{#4}{}{#6}{#1}% \else \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}}% + \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 \preparethenumber{\??kj#1}\hetnummer\preparednumber \dofloat{#4}{\labeltexts{#5}{\preparednumber}}{#6}{#1}% @@ -1584,26 +1443,26 @@ \def\dostelmargeblokkenin[#1]% {\getparameters[\??mb][#1]% - \doifelse{\@@mbstatus}{\v!start}% - {\showmessage{\m!layouts}{4}{}% + \doifelse\@@mbstatus\v!start + {\showmessage\m!layouts4\empty \margeblokkentrue - \let\somenextfloat=\dosomenextfloat - \let\startmargeblok=\dostartmargeblok - \let\stopmargeblok=\dostopmargeblok}% - {\showmessage{\m!layouts}{5}{}% + \let\somenextfloat\dosomenextfloat + \let\startmargeblok\dostartmargeblok + \let\stopmargeblok\dostopmargeblok}% + {\showmessage\m!layouts5\empty \margeblokkenfalse \def\somenextfloat[##1]% {\someelsefloat[##1,\v!hier]}% - \let\startmargeblok=\dontstartmargeblok - \let\stopmargeblok=\dontstopmargeblok}} + \let\startmargeblok\dontstartmargeblok + \let\stopmargeblok\dontstopmargeblok}} -\def\stelmargeblokkenin% +\def\stelmargeblokkenin {\dosingleargument\dostelmargeblokkenin} \newbox\marginbox \def\dosomenextfloat[#1]% - {\global\setbox\marginbox=\vbox + {\global\setbox\marginbox\vbox {\hsize\@@mbbreedte \unvcopy\marginbox \ifvoid\marginbox\else\expandafter\@@mbtussen\fi @@ -1616,30 +1475,30 @@ \newbox\preparedmarginbox -\def\reshapemargin% +\def\reshapemargin {\ifdim\ht\preparedmarginbox>\zeropoint \beginofshapebox \unvbox\preparedmarginbox \endofshapebox \reshapebox {\box\shapebox}% - \setbox\preparedmarginbox=\vbox to \teksthoogte + \setbox\preparedmarginbox\vbox to \teksthoogte {\@@mbboven \flushshapebox \@@mbonder}% \fi} -\def\plaatsrechtermargeblok% +\def\plaatsrechtermargeblok {\hskip\rechtermargebreedte} -\def\plaatslinkermargeblok% +\def\plaatslinkermargeblok {\hskip\linkermargebreedte} -\def\checkmargeblokken% +\def\checkmargeblokken {\ifvoid\marginbox\else\docheckmargeblokken\fi} -\def\docheckmargeblokken% erg inefficient - {\setbox\preparedmarginbox=\vbox +\def\docheckmargeblokken % erg inefficient + {\setbox\preparedmarginbox\vbox {\forgetall \splittopskip\topskip \ifvoid\marginbox\else @@ -1650,17 +1509,17 @@ \fi \fi}% \reshapemargin - \setbox\preparedmarginbox=\vbox + \setbox\preparedmarginbox\vbox {\@@mbvoor\box\preparedmarginbox\@@mbna}% - \def\rightmarginbox% - {\def\plaatsrechtermargeblok% - {\setbox\preparedmarginbox=\hbox to \rechtermargebreedte + \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 + \def\leftmarginbox + {\def\plaatslinkermargeblok + {\setbox\preparedmarginbox\hbox to \linkermargebreedte {\@@mbrechts\box\preparedmarginbox\@@mblinks}% \vsmashbox\preparedmarginbox \box\preparedmarginbox}}% @@ -1682,10 +1541,10 @@ \od, \v!links=>\leftmarginbox, \v!rechts=>\rightmarginbox, - \s!unknown=>\setbox\preparedmarginbox=\hbox{}]} + \s!unknown=>\setbox\preparedmarginbox\hbox{}]} -\def\dostartmargeblok% % 2 maal \vbox ivm \unvbox elders - {\global\setbox\marginbox=\vtop\bgroup\vbox\bgroup +\def\dostartmargeblok % 2 maal \vbox ivm \unvbox elders + {\global\setbox\marginbox\vtop\bgroup\vbox\bgroup \hsize\@@mbbreedte \ifvoid\marginbox\else \unvbox\marginbox @@ -1695,18 +1554,18 @@ \dostartattributes\??mb\c!letter\c!kleur{}% \begstrut\ignorespaces} -\def\dostopmargeblok% +\def\dostopmargeblok {\unskip\endstrut \dostopattributes \egroup \egroup} -\def\dontstartmargeblok% +\def\dontstartmargeblok {\@@mbvoor \bgroup - \dostartattributes\??mb\c!letter\c!kleur{}} + \dostartattributes\??mb\c!letter\c!kleur\empty} -\def\dontstopmargeblok% +\def\dontstopmargeblok {\dostopattributes \egroup \@@mbna} @@ -1720,7 +1579,7 @@ \appendtoks\the\everytopofpage \to\everystarttext \appendtoks\global\everytopofpage{}\to\everystoptext -\def\douitstellen% +\def\douitstellen {\the\everytopofpage \ifvoid\collectedpagefloats\else % message @@ -1730,11 +1589,11 @@ \bgroup % we need the color/font switch, else problems inside split verbatim \setnormalcatcodes % uitstellen in verbatim \edef\savedtopofpagecolor{\topofpagecolor}% - \doifsomething\savedtopofpagecolor\stopcolormode + \doifsomething\savedtopofpagecolor\restorecolormode % \stopcolormode \restoreglobalbodyfont \global\pagetotal\zeropoint % recently added and \global\inuitstellentrue % definitely needed else - \dorecurse{\nofpostponedblocks} % we can loose or disorder + \dorecurse\nofpostponedblocks % we can loose or disorder {\haalbuffer[buf-\recurselevel]} % floats; anyhow, this \doflushfloats % new but potential dangerous % mechanism is still \doglobal\newcounter\nofpostponedblocks % suboptimal and needs a @@ -1745,7 +1604,7 @@ \setvalue{\e!start\e!uitstellen}% {\doglobal\increment\nofpostponedblocks - \showmessage{\m!layouts}{3}{\nofpostponedblocks}% + \showmessage\m!layouts3\nofpostponedblocks \dostartbuffer[buf-\nofpostponedblocks] [\e!start\e!uitstellen][\e!stop\e!uitstellen]} @@ -1754,7 +1613,7 @@ [\c!wijze=\v!per\v!tekst, \c!conversie=\@@siconversie] -\def\stelplaatsbloksplitsenin% +\def\stelplaatsbloksplitsenin {\dodoubleargument\getparameters[\??si]} % ook (continued) @@ -1769,18 +1628,18 @@ \resetnummer[\??si]% \def\floatcaptionsuffix{\nummer[\??si]}% \TABLEcaptionheight=\@@siregels\lineheight % brrr -\def\docomplexpagina[##1]{\goodbreak}% + \simplifypagebreak % \page becomes \goodbreak \dowithnextbox {\forgetall \mindermeldingen \doloop {\setbox2\vsplit\nextbox to \lineheight - \setbox2=\vbox{\unvbox2} + \setbox2\vbox{\unvbox2} \ifdim\ht2>\lineheight \verhoognummer[\??si]% \ifnum\ruwenummer[\??si]=1 \ifdim\ht\nextbox=\zeropoint - \let\floatcaptionsuffix=\empty - \fi\fi + \let\floatcaptionsuffix\empty + \fi \fi \bgroup #2{\unvbox2} \egroup @@ -1881,9 +1740,12 @@ \c!zijnawit=\@@bknawit, \c!springvolgendein=\v!nee, \c!marge=1em, + \c!linkermargeafstand=\zeropoint, + \c!rechtermargeafstand=\@@bklinkermargeafstand, \c!nboven=2, \c!nonder=0, \c!nregels=4, + \c!lokaal=, \c!default=\v!figuur] \stelplaatsbloksplitsenin @@ -1903,11 +1765,11 @@ \@EA\aftersplitstring \commalistelement\at:\to\floatcolumn \@EA\aftersplitstring \floatcolumn\at*\to\floatrow \@EA\beforesplitstring\floatcolumn\at*\to\floatcolumn -% nog algemeen otr -\ifx\OTRSETsetpreferedcolumnslot\undefined\else - \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow -\fi -% commando van maken + % todo: nog algemeen otr + \ifx\OTRSETsetpreferedcolumnslot\undefined\else + \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow + \fi + % commando van maken \doifundefined{\string\floatmethod\floatmethod} {\let\floatmethod\v!hier}% \getvalue{\string\floatmethod\floatmethod}[#1]% diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex index 535d68717..8e426caf9 100644 --- a/tex/context/base/page-imp.tex +++ b/tex/context/base/page-imp.tex @@ -17,12 +17,19 @@ \unprotect -% to be moved code: +% sizing bug: +% +% \setuppapersize[A4][A4,landscape] \setuparranging[2UP] \showframe +% +% \starttext \dorecurse{10}{\input tufte \par} \stoptext -\newif\ifclippagebox \clippageboxtrue +% to be moved code: -\def\clippedpagebox#1#2% - {\ifclippagebox +\newif\ifclipprintbox \clipprintboxtrue +%newif\ifclippagebox \clippageboxtrue + +\def\clippedprintbox#1#2% can be made more efficient, see other clipper + {\ifclipprintbox \!!widthc\pagebackgroundoffset \!!widtha \papierbreedte \advance\!!widtha \!!widthc @@ -38,48 +45,88 @@ {\box#2}}% \setbox#2\hbox to \papierbreedte {\ifcase#1\relax + \!!widthb\zeropoint \hskip-\!!widthc - \lower\!!widthc\hbox - {\clip - [\c!breedte=\!!widtha,\c!hoogte=\!!heighta, - \c!hoffset=\zeropoint,\c!voffset=\zeropoint] - {\box#2}}% - \or - \lower\!!widthc\hbox - {\clip - [\c!breedte=\!!widtha,\c!hoogte=\!!heighta, - \c!hoffset=\!!widthc,\c!voffset=\zeropoint] - {\box#2}}% - \fi}% + \else + \!!widthb\!!widthc + \fi + \lower\!!widthc\hbox + {\clip + [\c!breedte=\!!widtha,\c!hoogte=\!!heighta, + \c!hoffset=\!!widthb,\c!voffset=\zeropoint] + {\box#2}}}% \wd#2\papierbreedte \ht#2\papierhoogte \fi \box#2\relax} +\let\clippagebox \gobbleoneargument +\let\clipprintbox\gobbleoneargument + +% \setuppagenumbering[alternative=doublesided] +% \setupcolors[state=start] +% \setuppapersize[A4][A4,oversized] +% \setuplayout[location=middle,clipoffset=5mm] +% \setupbackgrounds +% [page] +% [frame=on,rulethickness=1mm, +% backgroundoffset=10mm,background=color,backgroundcolor=red] +% \starttext \dorecurse{10}{\input tufte \par} \stoptext + +\def\clippagebox#1% + {\ifdim\@@lyclipoffset>\zeropoint + \!!widtha \wd#1% + \!!heighta\ht#1% + \!!deptha \dp#1% + \setbox#1\hbox + {\!!widthb \@@lyclipoffset + \advance\!!heighta\!!deptha + \advance\!!heighta2\!!widthb + \advance\!!widtha \!!widthb + \doifbothsides + \advance\!!widtha\!!widthb + \!!widthc-\!!widthb + \hskip\!!widthc + \orsideone + \!!widthc\zeropoint + \orsidetwo + \!!widthc-\!!widthb + \hskip\!!widthc + \od + \lower\!!widthb\hbox + {\clip + [\c!hoffset=\!!widthc, + \c!voffset=-\!!widthb, + \c!breedte=\!!widtha, + \c!hoogte=\!!heighta]% + {\box#1}}}% + \wd#1\!!widtha + \ht#1\!!heighta + \dp#1\!!deptha + \fi} + % moved code: \def\myshipout#1% {\voorpagina % voor de pagebody dus ! \dontshowcomposition - \ifarrangingpages - \actualarrange{\thisisrealpage{\realfolio}#1}% - \else - \actualshipout{\thisisrealpage{\realfolio}#1}% - \fi + \ifarrangingpages\@EA\actualarrange\else\@EA\actualshipout\fi + {\thisisrealpage\realfolio#1}% \gotonextrealpage \napagina} \newbox\postponedcontent -\def\flushatshipout% +\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}% + {\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 @@ -90,7 +137,7 @@ \chardef\whichpagetoshipout=0 % 0=all 1=odd 2=even \def\actualshipout#1% - {\global\advance\shippedoutpages\plusone + {\global\advance\shippedoutpages\plusone \ifx\pagestoshipout\empty \ifcase\whichpagetoshipout\relax \donetrue @@ -101,7 +148,7 @@ \else \donetrue \fi - \else % testen, aangepast / expanded nodig ? + \else % testen, aangepast / expanded nodig ? \expanded{\doifinsetelse{\the\shippedoutpages}{\pagestoshipout}}% \donetrue\donefalse \fi @@ -112,11 +159,12 @@ \mindermeldingen \vskip-1in \hskip-1in - \hbox % \setbox0=\box.. is nicer - {\setbox0=\hbox{#1}% just in case there are objects there - \setbox\scratchbox=\hbox + \hbox % \setbox0=\box.. is nicer + {\setbox0\hbox{#1}% just in case there are objects there + \setbox\scratchbox\hbox {\the\everyshipout \ifnum\realpageno=\lastpage\relax + \flushtextdata \the\everylastshipout \global\everylastshipout\emptytoks \fi}% @@ -129,16 +177,16 @@ {[\ifarrangingpages arranged \fi page \ifarrangingpages\the\arrangeno\else\the\realpageno\fi\normalspace not flushed]}% - \setbox0=\hbox{#1}% - \deadcycles=0 + \setbox0\hbox{#1}% + \deadcycles\zerocount \fi} \def\actualarrange#1% - {\setbox0=\hbox{\thisisrealpage{\realfolio}#1}% - \pusharrangedpage0 - \deadcycles=0 } + {\setbox0\hbox{\thisisrealpage{\realfolio}#1}% + \pusharrangedpage0% + \deadcycles\zerocount} -%D We need a couple of boxes for duplex printing \unknown +%D We need a couple of boxes for duplex printing \unknown \newbox\arrangedpageA \newbox\arrangedpageB @@ -159,6 +207,7 @@ \def\arrangedrotationE{0} \newcounter\arrangedpageN +\newcounter\arrangedpageM \chardef\arrangedpageT=1 \chardef\arrangedpageX=1 @@ -174,7 +223,7 @@ \def\setuparranging[#1]% {\ifarrangingdisabled \else - \doifelse{#1}{\v!blokkeer} + \doifelse{#1}\v!blokkeer {\global\arrangingdisabledtrue} {\global\arrangingdisabledfalse}% \global\arrangingpagestrue @@ -193,8 +242,8 @@ 180=>\gdef\arrangedrotationO{180}\gdef\arrangedrotationE{0}, 270=>\gdef\arrangedrotationO{270}\gdef\arrangedrotationE{90}, \s!reset=>\global\arrangingpagesfalse, - \s!unknown=>\checkinstalledpagearrangement\commalistelement, - \s!default=>\checkinstalledpagearrangement\commalistelement]% + \s!unknown=>\checkinstalledpagearrangement\commalistelement]% + % no \s!default=> we can have aaa,,bbb \doifcommonelse{#1}{90,270,\v!geroteerd} {\swapmacros\horizontalcutmarks\verticalcutmarks}{}% ugly solution \setuppapersize @@ -206,8 +255,8 @@ \def\installpagearrangement #1 % {\setgvalue{\??pp\??pp#1}} -\def\checkinstalledpagearrangement#1% - {\executeifdefined{\??pp\??pp#1}{\global\arrangingpagesfalse}} +\def\checkinstalledpagearrangement#1% can be empty: aaa,,bbb + {\executeifdefined{\??pp\??pp#1}\donothing} \def\dosetuparrangement#1#2#3#4#5#6#7#8% {\global\chardef\arrangedpageX #1% @@ -219,63 +268,66 @@ \global\let \poparrangedpages #7% \global\let \handlearrangedpage#8} +\installpagearrangement {\v!normaal} + {\global\arrangingpagesfalse} + \installpagearrangement 2*16 - {\dosetuparrangement{4}{4}{16}{5}{5} + {\dosetuparrangement{4}{4}{16}{5}{5}% \pusharrangedpageTHIRTYTWO\poparrangedpagesAB\relax} \installpagearrangement 2*8 - {\dosetuparrangement{4}{2}{8}{5}{3} + {\dosetuparrangement{4}{2}{8}{5}{3}% \pusharrangedpageSIXTEEN\poparrangedpagesAB\relax} \installpagearrangement 2*4 - {\dosetuparrangement{2}{2}{4}{3}{3} + {\dosetuparrangement{2}{2}{4}{3}{3}% \pusharrangedpageEIGHT\poparrangedpagesAB\relax} \installpagearrangement 2*2 - {\dosetuparrangement{2}{1}{2}{3}{2} + {\dosetuparrangement{2}{1}{2}{3}{2}% \pusharrangedpageFOURA\poparrangedpagesAB\relax} \installpagearrangement 2**2 - {\dosetuparrangement{2}{1}{2}{3}{2} + {\dosetuparrangement{2}{1}{2}{3}{2}% \pusharrangedpageFOURB\poparrangedpagesAB\relax} \installpagearrangement 2SIDE - {\dosetuparrangement{2}{1}{2}{3}{2} + {\dosetuparrangement{2}{1}{2}{3}{2}% \pusharrangedpageSIDETOP\poparrangedpagesTWO\handlearrangedpageSIDE} \installpagearrangement 2TOP - {\dosetuparrangement{1}{2}{2}{2}{3} + {\dosetuparrangement{1}{2}{2}{2}{3}% \pusharrangedpageSIDETOP\poparrangedpagesTWO\handlearrangedpageTOP} \installpagearrangement 2UP - {\dosetuparrangement{2}{1}{4}{3}{2} + {\dosetuparrangement{2}{1}{4}{3}{2}% \pusharrangedpageTWO\poparrangedpagesTWO\handlearrangedpageTWOUP} \installpagearrangement 2DOWN - {\dosetuparrangement{1}{2}{4}{2}{3} + {\dosetuparrangement{1}{2}{4}{2}{3}% \pusharrangedpageTWO\poparrangedpagesTWO\handlearrangedpageTWODOWN} -\installpagearrangement 2*4*2 % one defined by Willy Egger: - {\dosetuparrangement{2}{2}{4}{3}{2} +\installpagearrangement 2*4*2 % one defined by Willy Egger: + {\dosetuparrangement{2}{2}{4}{3}{2}% \pusharrangedpageSIXTEENTWO\poparrangedpagesAtoD\relax} \installpagearrangement 2*2*4 % onother one of Willy Egger - {\dosetuparrangement{2}{1}{8}{3}{2} + {\dosetuparrangement{2}{1}{8}{3}{2}% \pusharrangedpageSIXTEENFOUR\poparrangedpagesAtoH\relax} -\def\filluparrangedpages% beware: \realpageno is 1 ahead +\def\filluparrangedpages % beware: \realpageno is 1 ahead {\ifarrangingpages \scratchcounter-\realpageno \divide\scratchcounter \arrangedpageT \multiply\scratchcounter \arrangedpageT \advance\scratchcounter \realpageno - \advance\scratchcounter -1 + \advance\scratchcounter \minusone \dorecurse\scratchcounter{\noheaderandfooterlines\ejectdummypage}% \fi} -\def\handlearrangedpageXY#1#2#3#4#5% - {\global\setbox#5=\hbox to \arrangedpageX\papierbreedte - {\setbox\scratchbox=\vbox to \arrangedpageY\papierhoogte +\def\handlearrangedpageXandY#1#2#3#4#5% + {\global\setbox#5\hbox to \arrangedpageX\papierbreedte + {\setbox\scratchbox\vbox to \arrangedpageY\papierhoogte {\forgetall \offinterlineskip \mindermeldingen @@ -287,25 +339,26 @@ \box\scratchbox\box#5\hss}} \def\gotonextarrangepage - {\global\advance\arrangeno 1 + {\global\advance\arrangeno \plusone \def\pagecutmarksymbol{\the\arrangeno}} \def\outputarrangedbox#1% {\bgroup \gotonextarrangepage - \ifnum\arrangedrotationO\arrangedrotationE>0 - \ifdoublearranged - \ifodd\arrangeno % if into 2d arg - \setbox#1=\vbox{\dorotatebox\arrangedrotationO\hbox{\box#1}}% - \else - \setbox#1=\vbox{\dorotatebox\arrangedrotationE\hbox{\box#1}}% - \fi - \else - \setbox#1=\vbox{\dorotatebox\arrangedrotationO\hbox{\box#1}}% - \fi + \ifnum\arrangedrotationO\arrangedrotationE>\zerocount + \setbox#1\vbox + {\ifdoublearranged + \ifodd\arrangeno + \dorotatebox\arrangedrotationO\hbox{\box#1}% + \else + \dorotatebox\arrangedrotationE\hbox{\box#1}% + \fi + \else + \dorotatebox\arrangedrotationO\hbox{\box#1}% + \fi}% \fi \ifmirrorarranged - \setbox#1=\vbox{\domirrorbox\vbox{\box#1}}% + \setbox#1\vbox{\domirrorbox\vbox{\box#1}}% \fi \ifnegatearranged \negatecolorbox{#1}% @@ -314,15 +367,15 @@ \actualshipout{\box#1}% \egroup} -%D The format file can be 16K smaller when we postpone the -%D real arrangments. Some day ... +%D The format file can be 16K smaller when we postpone the +%D real arrangments. Some day ... % TOP % 32/16/8/4/SIDE -\def\poparrangedpagesAB% - {\ifnum\arrangedpageN>0 +\def\poparrangedpagesAB + {\ifnum\arrangedpageN>\zerocount \mindermeldingen \papierbreedte\arrangedpageX\papierbreedte \papierhoogte\arrangedpageY\papierhoogte @@ -335,38 +388,38 @@ {\doglobal\increment\arrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN - \or \handlearrangedpageXY{#1}033\arrangedpageA % 1 - \or \handlearrangedpageXY{#1}003\arrangedpageB % 2 - \or \handlearrangedpageXY{#1}100\arrangedpageB % 3 - \or \handlearrangedpageXY{#1}130\arrangedpageA % 4 - \or \handlearrangedpageXY{#1}100\arrangedpageA % 5 - \or \handlearrangedpageXY{#1}130\arrangedpageB % 6 - \or \handlearrangedpageXY{#1}033\arrangedpageB % 7 - \or \handlearrangedpageXY{#1}003\arrangedpageA % 8 - \or \handlearrangedpageXY{#1}102\arrangedpageA % 9 - \or \handlearrangedpageXY{#1}132\arrangedpageB % 10 - \or \handlearrangedpageXY{#1}031\arrangedpageB % 11 - \or \handlearrangedpageXY{#1}001\arrangedpageA % 12 - \or \handlearrangedpageXY{#1}031\arrangedpageA % 13 - \or \handlearrangedpageXY{#1}001\arrangedpageB % 14 - \or \handlearrangedpageXY{#1}102\arrangedpageB % 15 - \or \handlearrangedpageXY{#1}132\arrangedpageA % 16 - \or \handlearrangedpageXY{#1}122\arrangedpageA % 17 - \or \handlearrangedpageXY{#1}112\arrangedpageB % 18 - \or \handlearrangedpageXY{#1}011\arrangedpageB % 19 - \or \handlearrangedpageXY{#1}021\arrangedpageA % 20 - \or \handlearrangedpageXY{#1}011\arrangedpageA % 21 - \or \handlearrangedpageXY{#1}021\arrangedpageB % 22 - \or \handlearrangedpageXY{#1}122\arrangedpageB % 23 - \or \handlearrangedpageXY{#1}112\arrangedpageA % 24 - \or \handlearrangedpageXY{#1}013\arrangedpageA % 25 - \or \handlearrangedpageXY{#1}023\arrangedpageB % 26 - \or \handlearrangedpageXY{#1}120\arrangedpageB % 27 - \or \handlearrangedpageXY{#1}110\arrangedpageA % 28 - \or \handlearrangedpageXY{#1}120\arrangedpageA % 29 - \or \handlearrangedpageXY{#1}110\arrangedpageB % 30 - \or \handlearrangedpageXY{#1}013\arrangedpageB % 31 - \or \handlearrangedpageXY{#1}023\arrangedpageA % 32 + \or \handlearrangedpageXandY{#1}033\arrangedpageA % 1 + \or \handlearrangedpageXandY{#1}003\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}100\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}130\arrangedpageA % 4 + \or \handlearrangedpageXandY{#1}100\arrangedpageA % 5 + \or \handlearrangedpageXandY{#1}130\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}033\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}003\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}102\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}132\arrangedpageB % 10 + \or \handlearrangedpageXandY{#1}031\arrangedpageB % 11 + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 12 + \or \handlearrangedpageXandY{#1}031\arrangedpageA % 13 + \or \handlearrangedpageXandY{#1}001\arrangedpageB % 14 + \or \handlearrangedpageXandY{#1}102\arrangedpageB % 15 + \or \handlearrangedpageXandY{#1}132\arrangedpageA % 16 + \or \handlearrangedpageXandY{#1}122\arrangedpageA % 17 + \or \handlearrangedpageXandY{#1}112\arrangedpageB % 18 + \or \handlearrangedpageXandY{#1}011\arrangedpageB % 19 + \or \handlearrangedpageXandY{#1}021\arrangedpageA % 20 + \or \handlearrangedpageXandY{#1}011\arrangedpageA % 21 + \or \handlearrangedpageXandY{#1}021\arrangedpageB % 22 + \or \handlearrangedpageXandY{#1}122\arrangedpageB % 23 + \or \handlearrangedpageXandY{#1}112\arrangedpageA % 24 + \or \handlearrangedpageXandY{#1}013\arrangedpageA % 25 + \or \handlearrangedpageXandY{#1}023\arrangedpageB % 26 + \or \handlearrangedpageXandY{#1}120\arrangedpageB % 27 + \or \handlearrangedpageXandY{#1}110\arrangedpageA % 28 + \or \handlearrangedpageXandY{#1}120\arrangedpageA % 29 + \or \handlearrangedpageXandY{#1}110\arrangedpageB % 30 + \or \handlearrangedpageXandY{#1}013\arrangedpageB % 31 + \or \handlearrangedpageXandY{#1}023\arrangedpageA % 32 \poparrangedpages \fi} @@ -374,22 +427,22 @@ {\doglobal\increment\arrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN - \or \handlearrangedpageXY{#1}031\arrangedpageA % 1 - \or \handlearrangedpageXY{#1}001\arrangedpageB % 2 - \or \handlearrangedpageXY{#1}031\arrangedpageB % 3 - \or \handlearrangedpageXY{#1}001\arrangedpageA % 4 - \or \handlearrangedpageXY{#1}100\arrangedpageA % 5 - \or \handlearrangedpageXY{#1}130\arrangedpageB % 6 - \or \handlearrangedpageXY{#1}100\arrangedpageB % 7 - \or \handlearrangedpageXY{#1}130\arrangedpageA % 8 - \or \handlearrangedpageXY{#1}120\arrangedpageA % 9 - \or \handlearrangedpageXY{#1}110\arrangedpageB % 10 - \or \handlearrangedpageXY{#1}120\arrangedpageB % 11 - \or \handlearrangedpageXY{#1}110\arrangedpageA % 12 - \or \handlearrangedpageXY{#1}011\arrangedpageA % 13 - \or \handlearrangedpageXY{#1}021\arrangedpageB % 14 - \or \handlearrangedpageXY{#1}011\arrangedpageB % 15 - \or \handlearrangedpageXY{#1}021\arrangedpageA % 16 + \or \handlearrangedpageXandY{#1}031\arrangedpageA % 1 + \or \handlearrangedpageXandY{#1}001\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}031\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 4 + \or \handlearrangedpageXandY{#1}100\arrangedpageA % 5 + \or \handlearrangedpageXandY{#1}130\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}100\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}130\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}120\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}110\arrangedpageB % 10 + \or \handlearrangedpageXandY{#1}120\arrangedpageB % 11 + \or \handlearrangedpageXandY{#1}110\arrangedpageA % 12 + \or \handlearrangedpageXandY{#1}011\arrangedpageA % 13 + \or \handlearrangedpageXandY{#1}021\arrangedpageB % 14 + \or \handlearrangedpageXandY{#1}011\arrangedpageB % 15 + \or \handlearrangedpageXandY{#1}021\arrangedpageA % 16 \poparrangedpages \fi} @@ -397,14 +450,14 @@ {\doglobal\increment\arrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN - \or \handlearrangedpageXY{#1}011\arrangedpageA % 1 - \or \handlearrangedpageXY{#1}001\arrangedpageB % 2 - \or \handlearrangedpageXY{#1}100\arrangedpageB % 3 - \or \handlearrangedpageXY{#1}110\arrangedpageA % 4 - \or \handlearrangedpageXY{#1}100\arrangedpageA % 5 - \or \handlearrangedpageXY{#1}110\arrangedpageB % 6 - \or \handlearrangedpageXY{#1}011\arrangedpageB % 7 - \or \handlearrangedpageXY{#1}001\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}011\arrangedpageA % 1 + \or \handlearrangedpageXandY{#1}001\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}100\arrangedpageB % 3 + \or \handlearrangedpageXandY{#1}110\arrangedpageA % 4 + \or \handlearrangedpageXandY{#1}100\arrangedpageA % 5 + \or \handlearrangedpageXandY{#1}110\arrangedpageB % 6 + \or \handlearrangedpageXandY{#1}011\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 8 \poparrangedpages \fi} @@ -415,10 +468,10 @@ {\doglobal\increment\arrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN - \or \handlearrangedpageXY{#3}010\arrangedpageA % 1 - \or \handlearrangedpageXY{#3}0{#1}0\arrangedpageB % 2/3 not {1} - \or \handlearrangedpageXY{#3}0{#2}0\arrangedpageB % 3/2 not {1} - \or \handlearrangedpageXY{#3}000\arrangedpageA % 4 + \or \handlearrangedpageXandY{#3}010\arrangedpageA % 1 + \or \handlearrangedpageXandY{#3}0{#1}0\arrangedpageB % 2/3 not {1} + \or \handlearrangedpageXandY{#3}0{#2}0\arrangedpageB % 3/2 not {1} + \or \handlearrangedpageXandY{#3}000\arrangedpageA % 4 \poparrangedpages \fi} @@ -426,8 +479,8 @@ {\doglobal\increment\arrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN - \or \handlearrangedpageXY{#1}000\arrangedpageA % 1 - \or \handlearrangedpageXY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 1 + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 \poparrangedpages \fi} @@ -449,7 +502,7 @@ % 2UP/2DOWN / 1pt prevents overflow -\def\splitoffarrangedpagesTWO% +\def\splitoffarrangedpagesTWO {\splittopskip\zeropoint \global\setbox\arrangedpageA\vsplit\arrangedpageB to \!!onepoint \scratchdimen\ht\arrangedpageB @@ -458,7 +511,7 @@ \setbox\scratchbox\vsplit\arrangedpageB to \scratchdimen \fi} -% \def\handlearrangedpageTWOUP% +% \def\handlearrangedpageTWOUP % {\splitoffarrangedpagesTWO % \ifswaparranged % \global\setbox\arrangedpageA\hbox @@ -472,24 +525,23 @@ % \global\ht\arrangedpageA\papierhoogte % \global\setbox\arrangedpageB\box\scratchbox} -\def\handlearrangedpageTWOUP% +\def\handlearrangedpageTWOUP {\splitoffarrangedpagesTWO \ifswaparranged - \global\setbox\arrangedpageA=\hbox - {\clippedpagebox0\arrangedpageA - \clippedpagebox1\arrangedpageB}% + \global\setbox\arrangedpageA\hbox + {\clippedprintbox0\arrangedpageA + \clippedprintbox1\arrangedpageB}% \swaparrangedfalse \else - \global\setbox\arrangedpageA=\hbox - {\clippedpagebox0\arrangedpageB - \clippedpagebox1\arrangedpageA}% + \global\setbox\arrangedpageA\hbox + {\clippedprintbox0\arrangedpageB + \clippedprintbox1\arrangedpageA}% \swaparrangedtrue \fi - \global\ht\arrangedpageA=\papierhoogte - \global\setbox\arrangedpageB=\box\scratchbox} - + \global\ht\arrangedpageA\papierhoogte + \global\setbox\arrangedpageB\box\scratchbox} -\def\handlearrangedpageTWODOWN% +\def\handlearrangedpageTWODOWN {\splitoffarrangedpagesTWO \global\ht\arrangedpageA\papierhoogte \global\ht\arrangedpageB\papierhoogte @@ -506,8 +558,8 @@ \fi \global\setbox\arrangedpageB\box\scratchbox} -\def\poparrangedpagesTWO% - {\ifnum\arrangedpageN>0 +\def\poparrangedpagesTWO + {\ifnum\arrangedpageN>\zerocount \mindermeldingen \swaparrangedfalse \doloop @@ -537,10 +589,10 @@ \dp#1=\zeropoint \vbox{\box#1}}} -%D Willy Egger's sheet simulations: +%D Willy Egger's sheet simulations: -\def\poparrangedpagesAtoH% - {\ifnum\arrangedpageN>0 +\def\poparrangedpagesAtoH + {\ifnum\arrangedpageN>\zerocount \mindermeldingen \papierbreedte\arrangedpageX\papierbreedte \papierhoogte\arrangedpageY\papierhoogte @@ -557,8 +609,8 @@ % to arrange 16 pages on 2 sheets to form one booklet -\def\poparrangedpagesAtoD% - {\ifnum\arrangedpageN>0 +\def\poparrangedpagesAtoD + {\ifnum\arrangedpageN>\zerocount \mindermeldingen \papierbreedte\arrangedpageX\papierbreedte \papierhoogte\arrangedpageY\papierhoogte @@ -575,22 +627,22 @@ {\doglobal\increment\arrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN - \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageA % 1 - \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageB % 2 - \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageC % 3 - \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageD % 4 - \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageE % 5 - \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageF % 6 - \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageG % 7 - \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageH % 8 - \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageH % 9 - \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageG % 10 - \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageF % 11 - \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageE % 12 - \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageD % 13 - \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageC % 14 - \or \handlearrangedpageXY{#1}{0}{1}{0}\arrangedpageB % 15 - \or \handlearrangedpageXY{#1}{0}{0}{0}\arrangedpageA % 16 + \or \handlearrangedpageXandY{#1}010\arrangedpageA % 1 + \or \handlearrangedpageXandY{#1}000\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}010\arrangedpageC % 3 + \or \handlearrangedpageXandY{#1}000\arrangedpageD % 4 + \or \handlearrangedpageXandY{#1}010\arrangedpageE % 5 + \or \handlearrangedpageXandY{#1}000\arrangedpageF % 6 + \or \handlearrangedpageXandY{#1}010\arrangedpageG % 7 + \or \handlearrangedpageXandY{#1}000\arrangedpageH % 8 + \or \handlearrangedpageXandY{#1}010\arrangedpageH % 9 + \or \handlearrangedpageXandY{#1}000\arrangedpageG % 10 + \or \handlearrangedpageXandY{#1}010\arrangedpageF % 11 + \or \handlearrangedpageXandY{#1}000\arrangedpageE % 12 + \or \handlearrangedpageXandY{#1}010\arrangedpageD % 13 + \or \handlearrangedpageXandY{#1}000\arrangedpageC % 14 + \or \handlearrangedpageXandY{#1}010\arrangedpageB % 15 + \or \handlearrangedpageXandY{#1}000\arrangedpageA % 16 \poparrangedpages \fi} @@ -600,25 +652,167 @@ {\doglobal\increment\arrangedpageN \reportarrangedpage\arrangedpageN \ifcase\arrangedpageN - \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageA % 1 - \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageB % 2 - \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageC % 3 - \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageD % 4 - \or \handlearrangedpageXY{#1}{1}{0}{0}\arrangedpageD % 5 - \or \handlearrangedpageXY{#1}{1}{1}{0}\arrangedpageC % 6 - \or \handlearrangedpageXY{#1}{1}{0}{0}\arrangedpageB % 7 - \or \handlearrangedpageXY{#1}{1}{1}{0}\arrangedpageA % 8 - \or \handlearrangedpageXY{#1}{1}{0}{0}\arrangedpageA % 9 - \or \handlearrangedpageXY{#1}{1}{1}{0}\arrangedpageB % 10 - \or \handlearrangedpageXY{#1}{1}{0}{0}\arrangedpageC % 11 - \or \handlearrangedpageXY{#1}{1}{1}{0}\arrangedpageD % 12 - \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageD % 13 - \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageC % 14 - \or \handlearrangedpageXY{#1} {0}{1}{1}\arrangedpageB % 15 - \or \handlearrangedpageXY{#1} {0}{0}{1}\arrangedpageA % 16 + \or \handlearrangedpageXandY{#1}011\arrangedpageA % 1 + \or \handlearrangedpageXandY{#1}001\arrangedpageB % 2 + \or \handlearrangedpageXandY{#1}011\arrangedpageC % 3 + \or \handlearrangedpageXandY{#1}001\arrangedpageD % 4 + \or \handlearrangedpageXandY{#1}100\arrangedpageD % 5 + \or \handlearrangedpageXandY{#1}110\arrangedpageC % 6 + \or \handlearrangedpageXandY{#1}100\arrangedpageB % 7 + \or \handlearrangedpageXandY{#1}110\arrangedpageA % 8 + \or \handlearrangedpageXandY{#1}100\arrangedpageA % 9 + \or \handlearrangedpageXandY{#1}110\arrangedpageB % 10 + \or \handlearrangedpageXandY{#1}100\arrangedpageC % 11 + \or \handlearrangedpageXandY{#1}110\arrangedpageD % 12 + \or \handlearrangedpageXandY{#1}011\arrangedpageD % 13 + \or \handlearrangedpageXandY{#1}001\arrangedpageC % 14 + \or \handlearrangedpageXandY{#1}011\arrangedpageB % 15 + \or \handlearrangedpageXandY{#1}001\arrangedpageA % 16 \poparrangedpages \fi} + +% % handy for stickers etc, this way we can treat them as page +% +% \setuppapersize [XY][A4] +% \setuppaper [topspace=5mm,backspace=5mm,dx=1mm,dy=1mm,nx=2,ny=6] +% \setuplayout [page] [topspace=5mm,backspace=5mm] +% \setuplayout [page] +% \setuplayout [location=middle] +% \setuparranging [XY] +% \showframe +% +% \starttext \dorecurse{30}{test \recurselevel \page} \stoptext + +\def\pusharrangedpageXY#1% + {\doglobal\increment\arrangedpageN + \reportarrangedpage\arrangedpageN + \doglobal\increment\arrangedpageM + \global\setbox\arrangedpageB\hbox + \ifdim\@@ppbreedte>\zeropoint to \@@ppbreedte \fi + {\ifvoid\arrangedpageB\else + \unhbox\arrangedpageB\hss\hskip\@@ppdx\hss + \fi + \box#1}% + \ifnum\arrangedpageM<\arrangedpageX\else + \global\setbox\arrangedpageA\vbox + \ifdim\@@pphoogte>\zeropoint to \@@pphoogte \fi + {\offinterlineskip + \ifvoid\arrangedpageA\else + \unvbox\arrangedpageA\vss\vskip\@@ppdy\vss + \fi + \box\arrangedpageB}% + \doglobal\newcounter\arrangedpageM + \fi + \ifnum\arrangedpageN<\arrangedpageT\else + \poparrangedpages + \fi} + +\def\poparrangedpagesXY + {\ifnum\arrangedpageN>\zerocount + \mindermeldingen + \papierbreedte\arrangedpageX\papierbreedte + \papierhoogte \arrangedpageY\papierhoogte + \outputarrangedbox\arrangedpageA + \doglobal\newcounter\arrangedpageN + \doglobal\newcounter\arrangedpageM + \fi} + +\installpagearrangement XY + {\dosetuparrangement\@@ppnx\@@ppny\@@ppxy\!!zerocount\!!zerocount + \pusharrangedpageXY\poparrangedpagesXY\relax} + +\beginETEX \dimexpr + +\definepapersize + [XY] + [\c!breedte=\dimexpr(\dimexpr(\@@ppbreedte-\numexpr(\@@ppnx-1)\dimexpr(\@@ppdx))/\@@ppnx), + \c!hoogte =\dimexpr(\dimexpr(\@@pphoogte -\numexpr(\@@ppny-1)\dimexpr(\@@ppdy))/\@@ppny)] + +\setuppaper + [\c!breedte=\dimexpr(\printpapierbreedte-2\dimexpr(\@@pprugwit)), + \c!hoogte =\dimexpr(\printpapierhoogte -2\dimexpr(\@@ppkopwit))] + +\endETEX + +% \definepageshift[test][horizontal][10pt,20pt,30pt,40pt,50pt] +% \definepageshift[test][vertical] [10pt,20pt,30pt,40pt,50pt] +% +% \setuppageshift[test] +% \setuppageshift[test][test] +% \setuppageshift[test][none] +% \setuppageshift[none][test] +% \setuppageshift[paper][test][test] % arrange only +% \setuppageshift[paper][test] % arrange only +% \setuppageshift[print][test][test] +% +% \showframe \dorecurse{100}{\input tufte \par} + +% #1=name #2=horizontal|vertical #3=shiftlist + +\def\definepageshift + {\dotripleargument\dodefinepageshift} +\def\dodefinepageshift[#1][#2][#3]% + {\setvalue{\??pt#2:#1}{#3}} + +\letempty \hpageshifts \newcounter\nofhpageshifts +\letempty \vpageshifts \newcounter\nofvpageshifts + +% \let\shiftprintpagebox\gobbleoneargument +% \let\shiftpaperpagebox\gobbleoneargument + +\def\dogetpageshift#1#2#3% #1=\dimenx #2=\xpageshifts #3=\nofxpageshifts + {\ifx#2\empty + #1\zeropoint + \else + \doglobal\increment#3% + \getfromcommacommand[#2][#3]% + \ifx\commalistelement\empty + \globallet#3\!!plusone + \getfromcommacommand[#2][#3]% + \fi + \ifx\commalistelement\empty + #1\zeropoint + \else + #1=\commalistelement + \donetrue + \fi + \fi} + +\def\shiftpagebox#1% + {\donefalse + \dogetpageshift{\dimen0}\hpageshifts\nofhpageshifts + \dogetpageshift{\dimen2}\vpageshifts\nofvpageshifts + \ifdone % see also layout offsets, maybe \movebox + \edef\next{\wd#1\the\wd#1\ht#1\the\ht#1\dp#1\the\dp#1}% + \setbox#1\vbox % \forgetall already done + {\offinterlineskip\vskip\dimen2\hskip\dimen0\box#1}% + \next + \fi} + +\def\setuppageshift + {\dotripleempty\dosetuppageshift} + +\def\dosetuppageshift[#1][#2][#3]% page|paper horizontal vertical + {\ifthirdargument % paper=arrange + \let\hpageshifts\empty + \let\vpageshifts\empty + \let\shiftprintpagebox\gobbleoneargument + \let\shiftpaperpagebox\gobbleoneargument + \doifdefined{\??pt\v!horizontaal:#2} + {\edef\hpageshifts{\getvalue{\??pt\v!horizontaal:#2}}}% + \doifdefined{\??pt\v!vertikaal :#3} + {\edef\vpageshifts{\getvalue{\??pt\v!vertikaal :#3}}}% + \doif{#1}\v!pagina{\let\shiftprintpagebox\shiftpagebox}% + \doif{#1}\v!papier{\let\shiftpaperpagebox\shiftpagebox}% + \else\ifsecondargument + \doifinsetelse{#1}{\v!pagina,\v!papier} + {\setuppageshift[#1][#2][#2]} + {\setuppageshift[\v!pagina][#1][#2]}% + \else\iffirstargument + \setuppageshift[\v!pagina][#1][#1]% + \fi\fi} + %D One can (mis)use this mechanism, in close cooperation %D with \PDFTEX\ to arrange pages of already produced files. %D @@ -646,7 +840,7 @@ %D This macros inserts the page, according to the settings %D provided. -\def\insertpages% +\def\insertpages {\dotripleempty\doinsertpages} \def\doinsertpages[#1][#2][#3]% @@ -659,13 +853,13 @@ \mindermeldingen \getfiguredimensions[#1]% \getparameters[\??ip][\c!n=\noffigurepages,\c!breedte=\!!zeropoint,#3]% - \doifinsetelse{0}{#2}{\null\pagina}{}% - \dorecurse{\@@ipn} - {\dofilterpage{#1}{\recurselevel}% - \doifinsetelse{\recurselevel}{#2}{\null\pagina}{}}% + \doifinset0{#2}{\null\pagina}% + \dorecurse\@@ipn + {\dofilterpage{#1}\recurselevel + \doifinset\recurselevel{#2}{\null\pagina}}% \egroup} -\def\filterpages% +\def\filterpages {\dotripleempty\dofilterpages} \def\dofilterpages[#1][#2][#3]% % \noffigurepages not yet supported @@ -673,12 +867,12 @@ \mindermeldingen \getfiguredimensions[#1]% \getparameters[\??ip][\c!n=\noffigurepages,\c!breedte=\!!zeropoint,#3]% - \doifelse{#2}{\v!even} - {\dorecurse{\@@ipn} - {\ifodd\recurselevel\relax\else\dofilterpage{#1}{\recurselevel}\fi}} - {\doifelse{#2}{\v!oneven} - {\dorecurse{\@@ipn} - {\ifodd\recurselevel\relax\dofilterpage{#1}{\recurselevel}\fi}} + \doifelse{#2}\v!even + {\dorecurse\@@ipn + {\ifodd\recurselevel\relax\else\dofilterpage{#1}\recurselevel\fi}} + {\doifelse{#2}\v!oneven + {\dorecurse\@@ipn + {\ifodd\recurselevel\relax\dofilterpage{#1}\recurselevel\fi}} {\def\dodocommando##1% {\ifnum##1>\@@ipn\else\dofilterpage{#1}{##1}\fi}% \def\docommando##1% @@ -687,11 +881,10 @@ \egroup} \def\dowithrange#1#2% #2 takes number - {\beforesplitstring#1\at :\to\fromrange - \aftersplitstring #1\at :\to\torange + {\beforesplitstring#1\at:\to\fromrange + \aftersplitstring #1\at:\to\torange \ifx\torange\empty\let\torange\fromrange\fi - \dostepwiserecurse{\fromrange}{\torange}{1} - {#2{\recurselevel}}} + \dostepwiserecurse\fromrange\torange1{#2{\recurselevel}}} \def\dofilterpage#1#2% {\hbox to \tekstbreedte @@ -699,13 +892,13 @@ \hfill \def\dowithfigure{\hskip-\@@ipbreedte}% \fi\fi\fi - \setbox0=\hbox + \setbox0\hbox {\externalfigure[#1][\c!pagina=#2,\c!hoogte=\teksthoogte]}% \wd0\zeropoint \box0} \pagina} -\def\copypages% +\def\copypages {\dodoubleempty\docopypages} \def\docopypages[#1][#2]% @@ -717,17 +910,15 @@ \c!schaal=\!!thousand, \c!offset=\!!zeropoint, #2]% - \dorecurse{\@@ipn} + \dorecurse\@@ipn {\vbox to \teksthoogte - {\hsize=\tekstbreedte - \scratchdimen=\@@ipoffset + {\hsize\tekstbreedte + \scratchdimen\@@ipoffset \centeredbox - {\doifelse{\@@ipmarkering}{\v!aan} - {\let\next\cuthbox}{\let\next\hbox}% - \next + {\doifelse\@@ipmarkering\v!aan\cuthbox\hbox {\ifdim\scratchdimen>\zeropoint\relax - \advance\vsize by -2\scratchdimen - \advance\hsize by -2\scratchdimen + \advance\vsize -2\scratchdimen + \advance\hsize -2\scratchdimen \externalfigure[#1][\c!pagina=\recurselevel,#2,\c!schaal=,\c!factor=\v!max,\c!offset=\v!overlay]% \else \externalfigure[#1][\c!pagina=\recurselevel,#2,\c!offset=\v!overlay]% @@ -762,7 +953,7 @@ %D One can influence the way the pages are combined. (This %D will be explained some time.) -\def\combinepages% +\def\combinepages {\dodoubleempty\docombinepages} \def\docombinepages[#1][#2]% a=perpag b=free @@ -772,68 +963,77 @@ \getparameters [\??ip] [\c!variant=\v!a, - \c!n=\noffigurepages,\c!nx=2,\c!ny=2, + \c!n=\noffigurepages,\c!nx=2,\c!ny=2,\c!start=1,\c!stop=\!!maxcard, \c!afstand=\bodyfontsize, \c!onder=\vfill,\c!boven=\vss, \c!links=\hss,\c!rechts=\hss, \c!voor=\pagina,\c!na=\pagina,\c!tussen=\blanko, - \c!kader=, + \c!kader=,\c!achtergrond=,\c!achtergrondkleur=, #2]% \@@ipvoor - \doglobal\newcounter\combinedpagescounter - \doifelse{\@@ipvariant}{\v!b}{\!!doneafalse}{\!!doneatrue}% + %\doglobal\newcounter\combinedpagescounter + \globallet\combinedpagescounter\@@ipstart + \doifelse\@@ipvariant\v!b\!!doneafalse\!!doneatrue \if!!donea \doloop {\vbox to \teksthoogte - {\hsize=\tekstbreedte % ? ? - \scratchdimen=\@@ipafstand - \!!widtha=\hsize - \advance\!!widtha by -\@@ipnx\scratchdimen - \advance\!!widtha by \scratchdimen - \divide \!!widtha by \@@ipnx - \!!heighta=\vsize - \advance\!!heighta by -\@@ipny\scratchdimen - \advance\!!heighta by \scratchdimen - \divide \!!heighta by \@@ipny - \dorecurse{\@@ipny} + {\hsize\tekstbreedte % ? ? + \scratchdimen\@@ipafstand + \!!widtha\hsize + \advance\!!widtha -\@@ipnx\scratchdimen + \advance\!!widtha \scratchdimen + \divide \!!widtha \@@ipnx + \!!heighta\vsize + \advance\!!heighta -\@@ipny\scratchdimen + \advance\!!heighta \scratchdimen + \divide \!!heighta \@@ipny + \dorecurse\@@ipny {\hbox to \hsize - {\dorecurse{\@@ipnx} - {\doglobal\increment\combinedpagescounter - \vbox to \!!heighta - {\hsize=\!!widtha - \vsize=\!!heighta + {\dorecurse\@@ipnx + {\vbox to \!!heighta + {\hsize\!!widtha + \vsize\!!heighta \@@ipboven \hbox to \hsize {\@@iplinks +\ifnum\combinedpagescounter>\@@ipstop\relax + \globallet\@@ipn\!!zerocount +\else \ifnum\combinedpagescounter>\@@ipn \else \externalfigure[#1] [\c!object=\v!nee, \c!pagina=\combinedpagescounter, \c!factor=\v!max, + \c!achtergrond=\@@ipachtergrond, + \c!achtergrondkleur=\@@ipachtergrondkleur, \c!kader=\@@ipkader]% \fi +\fi \@@iprechts} \@@iponder}% + \doglobal\increment\combinedpagescounter \hfil}% \hfilneg} \vfil}% \vfilneg}% - \ifnum\combinedpagescounter<\@@ipn \else\exitloop\fi} + \ifnum\combinedpagescounter>\@@ipn \exitloop\fi} \else \doloop {\startbaselinecorrection - \scratchdimen=\@@ipafstand - \!!widtha=\hsize - \advance\!!widtha by -\@@ipnx\scratchdimen - \advance\!!widtha by \scratchdimen - \divide \!!widtha by \@@ipnx + \scratchdimen\@@ipafstand + \!!widtha\hsize + \advance\!!widtha -\@@ipnx\scratchdimen + \advance\!!widtha \scratchdimen + \divide \!!widtha \@@ipnx \hbox to \hsize - {\dorecurse{\@@ipnx} + {\dorecurse\@@ipnx {\doglobal\increment\combinedpagescounter \ifnum\combinedpagescounter>\@@ipn \else \externalfigure[#1] [\c!pagina=\combinedpagescounter, \c!breedte=\!!widtha, + \c!achtergrond=\@@ipachtergrond, + \c!achtergrondkleur=\@@ipachtergrondkleur, \c!kader=\@@ipkader]% \fi}}% \stopbaselinecorrection @@ -859,13 +1059,13 @@ %D \stoppagecomment %D \stoptypen -\def\setuppagecomment% +\def\setuppagecomment {\dosingleempty\dosetuppagecomment} \def\dosetuppagecomment[#1]% {\getparameters[\??pc][#1]% - \doifelse{\@@pcstatus}{\v!start} - {\doifinsetelse{\@@pcplaats}{\v!onder,\v!boven} + \doifelse\@@pcstatus\v!start + {\doifinsetelse\@@pcplaats{\v!onder,\v!boven} {\setuppapersize[\c!links=\hskip\@@pcoffset]% \adddimenmacro\papierhoogte\@@pcoffset\@@pcoffset\@@pcafstand\@@pchoogte\to\@@pcpaperheight \adddimenmacro\papierbreedte\@@pcoffset\@@pcoffset\to\@@pcpaperwidth @@ -887,19 +1087,19 @@ \let\@@pcprintpapersize\printpapersize \setuppapersize[\papersize][commentedpage]% \setupbackgrounds[\v!papier][\c!achtergrond=pagecomment]} - {\doif{\@@pcstatus}{\v!stop} % else initialization invokes backgrounds + {\doif\@@pcstatus\v!stop % else initialization invokes backgrounds {% this should be tested first % \expanded{\setuppapersize[\papersize][\@@pcprintpapersize]}% \setupbackgrounds[\v!papier][\c!achtergrond=]}}} \def\@@pcprintpapersize{\printpapersize} -\def\placepagecommentTB% +\def\placepagecommentTB {\vbox to \printpapierhoogte {\forgetall \hsize\printpapierbreedte \vskip\@@pcoffset - \doifelse{\@@pcplaats}{\v!onder}{\vskip\papierhoogte\vskip\@@pcafstand}{\vss} + \doifelse\@@pcplaats\v!onder{\vskip\papierhoogte\vskip\@@pcafstand}\vss \hskip\@@pcoffset \vbox to \@@pchoogte {\forgetall @@ -909,13 +1109,13 @@ \global\pagecommentfalse \fi}% \hfill - \doifelse{\@@pcplaats}{\v!onder}{\vss}{\vskip\papierhoogte\vskip\@@pcafstand} + \doifelse\@@pcplaats\v!onder\vss{\vskip\papierhoogte\vskip\@@pcafstand} \vskip\@@pcoffset}} -\def\placepagecommentLR% +\def\placepagecommentLR {\hbox to \printpapierbreedte {\hskip\@@pcoffset - \doifelse{\@@pcplaats}{\v!rechts}{\hskip\papierbreedte\hskip\@@pcafstand}{\hss}% + \doifelse\@@pcplaats\v!rechts{\hskip\papierbreedte\hskip\@@pcafstand}\hss \vbox to \printpapierhoogte {\forgetall \vskip\@@pcoffset @@ -925,7 +1125,7 @@ \global\pagecommentfalse \fi \vss}% - \doifelse{\@@pcplaats}{\v!rechts}{\hss}{\hskip\papierbreedte\hskip\@@pcafstand}% + \doifelse\@@pcplaats\v!rechts\hss{\hskip\papierbreedte\hskip\@@pcafstand}% \hskip\@@pcoffset}} \newif\ifpagecomment @@ -945,7 +1145,7 @@ % This macro cuts a page into n parts that can be pasted % together. -\def\slicepages% +\def\slicepages {\dotripleempty\doslicepages} \def\doslicepages[#1][#2][#3]% @@ -960,7 +1160,7 @@ \def\dodoslicepages[#1][#2][#3]% {\bgroup \dontcomplain - \gdef\slicedpagenumber{0}% + \globallet\slicedpagenumber\!!zerocount \getfiguredimensions[#1] \getparameters [\??ip] @@ -968,20 +1168,20 @@ \c!offset=\!!zeropoint, \c!hoffset=\!!zeropoint,\c!voffset=\!!zeropoint, \c!breedte=\figurewidth,\c!hoogte=\figureheight,#2] -\ifnum\@@ipn>0 - \definepapersize - [\s!dummy][\c!hoogte=\@@iphoogte,\c!breedte=\@@ipbreedte] - \setuppapersize - [\s!dummy][\s!dummy] - \stellayoutin % \setuplayout - [\c!rugwit=\!!zeropoint,\c!kopwit=\!!zeropoint, - \c!hoogte=\v!midden,\c!breedte=\v!midden, - \c!tekstafstand=\!!zeropoint, - \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint] -\fi + \ifnum\@@ipn>\zerocount + \definepapersize + [\s!dummy][\c!hoogte=\@@iphoogte,\c!breedte=\@@ipbreedte] + \setuppapersize + [\s!dummy][\s!dummy] + \stellayoutin % \setuplayout + [\c!rugwit=\!!zeropoint,\c!kopwit=\!!zeropoint, + \c!hoogte=\v!midden,\c!breedte=\v!midden, + \c!tekstafstand=\!!zeropoint, + \c!hoofd=\!!zeropoint,\c!voet=\!!zeropoint] + \fi \dorecurse\noffigurepages {\global\let\slicedpagenumber\recurselevel - \ifnum\@@ipn>1 + \ifnum\@@ipn>\plusone \dorecurse\@@ipn {\let\xslice\recurselevel \dorecurse\@@ipn @@ -1007,10 +1207,6 @@ \fi} \egroup} -% \starttext -% -% \slicepages[slice1.pdf][n=3] -% -% \stoptext +% \starttext \slicepages[slice1.pdf][n=3] \stoptext \protect \endinput diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex index 9055997c2..a770420a3 100644 --- a/tex/context/base/page-ini.tex +++ b/tex/context/base/page-ini.tex @@ -370,6 +370,18 @@ \let \addstatusinfo \gobbleoneargument % <box> \fi + +\ifx\realpageno\undefined + + \countdef\realpageno\zerocount \realpageno\plusone + +\fi + +\ifx\realfolio\undefined + + \def\realfolio{\the\realpageno} + +\fi % principle: % @@ -549,7 +561,7 @@ \beginTEX \...discards - \chardef \savingvdiscards 1 + \chardef \savingvdiscards \zerocount \let \splitdiscards \relax \let \pagediscards \relax @@ -626,73 +638,65 @@ \def\somebotsfloat {\OTRcommand\somebotsfloat} \def\somesidefloat {\OTRcommand\somesidefloat} -\def\nextcolumn {\OTRcommand\nextcolumn} - \def\flushsavedfloats {\OTRcommand\flushsavedfloats} -% beter een \installotr#1 met #1 = macro en auto test +\def\gotonextpage {\OTRcommand\gotonextpage } +\def\gotonextpageX {\OTRcommand\gotonextpageX} % will become obsolete -\newif\iftraceotr +% beter een \installotr#1 met #1 = macro en auto test +\newif \iftraceotr +\newif \ifinotr +\newtoks \mainoutput \newcount\otrlevel -\def\outputcounter{-100010} +% When issuing two \par\penalty-\@M's, only the first +% triggers the otr; obscure feature or optimization? -\def\doinvokeoutput% +\def\outputcounter{-100010} % -10010 + +\def\doinvokeoutput {\iftraceotr \expandafter\dodotracedoutput \else \expandafter\dodoinvokeoutput \fi} -\def\dodoinvokeoutput#1% - {\bgroup\par\penalty#1\relax\egroup} +\def\outputmessage#1#2#3% + {\iftraceotr\writestatus\m!otr{#1 #2 \number#3}\fi} -%\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\dodoinvokeoutput#1% + {\outputmessage+{special}{#1}% + \bgroup\par\penalty#1\relax\egroup + \outputmessage-{special}{#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}% + {\outputmessage+{traced}{#1/\the\outputpenalty}% + \writestatus\m!otr{c:\number\mofcolumns,v:\the\vsize,g:\the\pagegoal,t:\the\pagetotal}% \dodoinvokeoutput{#1}% - \writestatus{\m!otr}{v:\the\vsize,g:\the\pagegoal,t:\the\pagetotal}% - \writestatus{\m!otr}{stop \the\outputpenalty\space in column \number\mofcolumns}} + \writestatus\m!otr{c:\number\mofcolumns,v:\the\vsize,g:\the\pagegoal,t:\the\pagetotal}% + \outputmessage-{traced}{#1/\the\outputpenalty}} \def\installoutput#1#2% \invoke \action {\decrement\outputcounter \edef#1{\noexpand\doinvokeoutput{\outputcounter}}% \setvalue{\@@OTR\outputcounter}{#2}} -% \installoutput\dosynchronizeoutput -% {\synchronizeinsertions -% \unvbox\normalpagebox} - -\installoutput\dosynchronizeoutput - {\unvbox\normalpagebox} - -% \installoutput\dosynchronizeoutput -% {\bgroup -% \setbox\scratchbox\vbox{\unvbox\normalpagebox}% -% \ifdim\ht\scratchbox=\zeropoint \else -% \topskip\zeropoint -% \unvbox\scratchbox -% \fi -% \egroup} - -\def\synchronizeoutput - {\dosynchronizeoutput} - -\newtoks\mainoutput -\newif\ifinotr - \def\invokeoutputroutine - {\executeifdefined{\@@OTR\the\outputpenalty}{\the\OTRcommand\output}} + {\outputmessage+{trying}\outputpenalty + \executeifdefined{\@@OTR\the\outputpenalty}\dodonormaloutput + \outputmessage-{trying}\outputpenalty} + +\def\dodonormaloutput + {\outputmessage+{normal}\outputpenalty + \the\OTRcommand\output + \outputmessage-{normal}\outputpenalty} \mainoutput{\invokeoutputroutine} \output{\inotrtrue\the\mainoutput} +\installoutput\synchronizeoutput + {\ifvoid\normalpagebox\else\unvbox\normalpagebox\fi} + %D In order to force consistent use of variables, we %D predefine a lot of them here. @@ -728,15 +732,15 @@ \def\initializecolumns#1% {\ifnum#1>\maxnofcolumns - \showmessage{\m!columns}{1}{\maxnofcolumns}% - \nofcolumns=\maxnofcolumns + \showmessage\m!columns1\maxnofcolumns + \nofcolumns\maxnofcolumns \else - \nofcolumns=#1\relax + \nofcolumns#1\relax \fi \ifnum\nofcolumns>\allocatednofcolumns \dorecurse\nofcolumns {\ifnum\recurselevel>\allocatednofcolumns\relax - % \newbox\next \global\letvalue{\@col@-\recurselevel-t}=\next + % \newbox\next \letgvalue{\@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 @@ -745,11 +749,11 @@ \global\chardef\allocatednofcolumns=\nofcolumns \fi} -\def\firstcolumnbox {\columntextbox1} +\def\firstcolumnbox {\columntextbox\plusone} \def\currentcolumnbox {\columntextbox\mofcolumns} \def\lastcolumnbox {\columntextbox\nofcolumns} -\def\firsttopcolumnbox {\columntopbox 1} +\def\firsttopcolumnbox {\columntopbox \plusone} \def\currenttopcolumnbox{\columntopbox \mofcolumns} \def\lasttopcolumnbox {\columntopbox \nofcolumns} @@ -781,21 +785,23 @@ %D outside these macro's. \def\dohandlecolumn#1% - {\mofcolumns=\recurselevel - \let\currentcolumn=\recurselevel + {\mofcolumns\recurselevel + \let\currentcolumn\recurselevel #1\relax} \def\dohandleallcolumns#1% - {\dorecurse{\nofcolumns}{\dohandlecolumn{#1}}} + {\dorecurse\nofcolumns{\dohandlecolumn{#1}}} \def\dohandlerevcolumns#1% - {\dostepwiserecurse{\nofcolumns}{1}{-1}{\dohandlecolumn{#1}}} + {\dostepwiserecurse\nofcolumns\plusone\minusone{\dohandlecolumn{#1}}} \def\dohandlemidcolumns#1% {\dohandleallcolumns - {\ifnum\recurselevel>1\relax\ifnum\recurselevel<\nofcolumns\relax - \dohandlecolumn{#1}% - \fi\fi}} + {\ifnum\recurselevel>\plusone + \ifnum\recurselevel<\nofcolumns + \dohandlecolumn{#1}% + \fi + \fi}} %D This register can be used as a temporary storage for page %D content. @@ -840,44 +846,44 @@ %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\eject {\par\penalty-\@M } % == {\par\break} % plain +\def\supereject {\par\penalty-\@MM} % also plain -\def\ejectpage% - {\doejectpage\eject} +\def\doejectpage {\par\ifdim\pagetotal>\pagegoal\else\normalvfil\fi} +\def\ejectpage {\doejectpage\eject} +\def\superejectpage{\doejectpage\supereject} -\def\superejectpage% - {\doejectpage\supereject} +% floats -\def\ejectinsert% +\def\ejectinsert {\flushnotes \bgroup - \noftopfloats=\!!thousand - \nofbotfloats=0 + \noftopfloats\!!thousand + \nofbotfloats\zerocount \doflushfloats \egroup} -\def\ejectdummypage% +\def\ejectdummypage {\ejectinsert \hardespatie % will be different \vfill - \ejectpage} + \gotonextpage} -\def\beforefinaloutput% +\def\beforefinaloutput {} -\def\afterfinaloutput% +\def\afterfinaloutput {\forgetall \vskip\zeropoint\relax - \ifvoid\normalpagebox - \else + \ifvoid\normalpagebox \else \unvbox\normalpagebox \penalty\outputpenalty \fi - \ifnum\outputpenalty>-\@MM\relax - \else - \dosupereject + % not really needed, replaced by \flushsavedfloats + \ifnum\outputpenalty>-\@MM \else % better use a proper otr signal + \dosupereject \fi + % but does not hurt either \inpagebodytrue % needed for enabling \blanko ! \flushsavedfloats % was \dosetbothinserts; only otr one ! \setvsize % this is needed for interacting components, like floats and multicolumns @@ -902,10 +908,10 @@ \the\everybeforeshipout \setpagecounters \message{[-\the\realpageno]}% - \setbox0=\hbox - {\the\everyshipout + \setbox\scratchbox\hbox + {%\the\everyshipout % still needed here ? \dopagebody#1#2}% - \deadcycles=0 + \deadcycles\zerocount \gotonextrealpage \the\everyaftershipout \afterfinaloutput @@ -929,13 +935,15 @@ \resetselectiepagina \verhoogpaginanummer \checkpagedimensions - \ifnum\outputpenalty>-\@MM\relax - \else + \ifnum\outputpenalty>-\@MM \else \dosupereject \fi + \doflushspread \douitstellen} -\def\dooutput% +\ifx\doflushspread\undefined \let\doflushspread\relax \fi + +\def\dooutput {\finaloutput\unvbox\normalpagebox} \maxdeadcycles=1000 @@ -976,13 +984,13 @@ \def\doversie[#1]% {\voorlopigfalse \conceptfalse - \overfullrule=\zeropoint + \overfullrule\zeropoint \processaction [#1] - [\v!voorlopig=>\voorlopigtrue\overfullrule=5pt, + [\v!voorlopig=>\voorlopigtrue\overfullrule5pt, \v!concept=>\concepttrue]} -\def\versie% +\def\versie {\dosingleargument\doversie} %\def\addstatusinfo#1% @@ -1011,7 +1019,7 @@ \fi\fi} \def\doaddstatusinfo#1% - {\setbox#1=\vbox to \papierhoogte + {\setbox#1\vbox to \papierhoogte {\vsmashbox#1\box#1 \offinterlineskip \vskip\kopwit @@ -1025,18 +1033,16 @@ {\ifvoorlopig\ifinpagebody\else \begingroup \@EA\convertargument#3\to\ascii - \xdef\extratestinfo% + \xdef\extratestinfo {#2 \ascii}% - \gdef\totaltestinfo% - {\global\setbox#1=\vbox - {\unvbox#1\relax %\insert#1{% + \gdef\totaltestinfo + {\global\setbox#1\vbox + {\unvbox#1\relax \infofont \stelinterliniein \hbox {\strut \expandafter\doboundtext\expandafter - {\extratestinfo} - {12em} - {..}% + {\extratestinfo}{12em}{..}% \quad}}}% \endgroup \ifinner @@ -1060,26 +1066,26 @@ \def\registerinfo {\dotestinfo\registerinfobox} \def\floatinfo {\dotestinfo\floatinfobox} -\def\plaatstestinfo% +\def\plaatstestinfo {\ifvoorlopig \vbox to \zethoogte {\forgetall \infofont \hsize10em \ifvoid\floatinfobox\else - \strut \getmessage\m!systems{24} + \strut \getmessage\m!systems{24}% \vskip\!!sixpoint \unvbox\floatinfobox \vskip\!!twelvepoint \fi \ifvoid\referentieinfobox\else - \strut \getmessage\m!systems{25} + \strut \getmessage\m!systems{25}% \vskip\!!sixpoint \unvbox\referentieinfobox \vskip\!!twelvepoint \fi \ifvoid\registerinfobox\else - \strut \getmessage\m!systems{26} + \strut \getmessage\m!systems{26}% \vskip\!!sixpoint \unvbox\registerinfobox \fi @@ -1135,14 +1141,21 @@ \newtoks\afterpage \newtoks\aftereverypage \newtoks\beforepage \newtoks\beforeeverypage -\newif\ifshowgrid \showgridfalse +\chardef\showgridstate=0 -\def\showgrid% - {\tracegridsnappingtrue - \showgridtrue} +\def\showgrid + {\dosingleempty\doshowgrid} + +\def\doshowgrid[#1]% + {\chardef\showgridstate\plusone % downward compatible default + \processaction + [#1]% + [\v!reset=>\chardef\showgridstate0, + %\v!onder=>\chardef\showgridstate1,% + \v!boven=>\chardef\showgridstate2]} \def\buildpagebox#1% - {\setbox#1=\vbox to \papierhoogte + {\setbox#1\vbox to \papierhoogte {\hsize\papierbreedte \vskip\kopwit \doifbothsides @@ -1155,18 +1168,24 @@ \hskip-\zetbreedte \od \box#1}% - \dp#1=\zeropoint} + \dp#1\zeropoint} \newif\ifpagebodyornaments \pagebodyornamentstrue \newif\ifarrangingpages \arrangingpagesfalse -\let\poparrangedpages=\relax -\let\pusharrangedpage=\relax +\appendtoks + \global\pagebodyornamentstrue +\to \everyaftershipout + +\let\poparrangedpages\relax +\let\pusharrangedpage\relax + +\let\shiftprintpagebox\gobbleoneargument +\let\shiftpaperpagebox\gobbleoneargument \def\reportarrangedpage#1% - {\showmessage - {\m!systems}{23} - {\the\realpageno.\the\pageno\ifnum\subpageno>0 .\the\subpageno\fi,#1}} + {\showmessage\m!systems + {23}{\the\realpageno.\the\pageno\ifnum\subpageno>0 .\the\subpageno\fi,#1}} \newif\ifsavepagebody \newbox\savedpagebody @@ -1177,7 +1196,7 @@ \forgetall % igv problemen, check: \boxmaxdepth\maxdimen \boxmaxdepth\maxdimen % new \mindermeldingen - \setbox\pagebox=\vbox + \setbox\pagebox\vbox {\offinterlineskip \ifpagebodyornaments % \getbackgroundbox @@ -1192,27 +1211,31 @@ \fi \getmainbox#1#2}% including footnotes \ifpagebodyornaments - \addmainbackground\pagebox - \addlogobackground\pagebox + \addmainbackground \pagebox + \addlogobackground \pagebox \fi - \buildpagebox\pagebox - \addstatusinfo\pagebox + \buildpagebox \pagebox + \addstatusinfo \pagebox \ifpagebodyornaments - \addpagebackground\pagebox + \addpagebackground \pagebox \fi - \ifarrangingpages \else - \addpagecutmarks\pagebox - \replicatepagebox\pagebox - \scalepagebox\pagebox - \mirrorpaperbox\pagebox - \rotatepaperbox\pagebox - \addpagecolormarks\pagebox - \centerpagebox\pagebox + \ifarrangingpages + \shiftpaperpagebox \pagebox % \v!papier + \else + \clippagebox \pagebox + \addpagecutmarks \pagebox + \replicatepagebox \pagebox + \scalepagebox \pagebox + \mirrorpaperbox \pagebox + \rotatepaperbox \pagebox + \addpagecolormarks \pagebox + \centerpagebox \pagebox \addprintbackground\pagebox - \mirrorprintbox\pagebox - \rotateprintbox\pagebox - \offsetprintbox\pagebox - \negateprintbox\pagebox + \mirrorprintbox \pagebox + \rotateprintbox \pagebox + \shiftprintpagebox \pagebox % \v!pagina + \offsetprintbox \pagebox + \negateprintbox \pagebox \fi \box\pagebox \endrestorecatcodes}% @@ -1220,13 +1243,13 @@ \def\finishpagebox#1% {\ifarrangingpages - \addpagecutmarks#1% + \addpagecutmarks #1% \addpagecolormarks#1% - \centerpagebox#1% - \mirrorprintbox#1% - \rotateprintbox#1% - \offsetprintbox#1% - \negateprintbox#1% + \centerpagebox #1% + \mirrorprintbox #1% + \rotateprintbox #1% + \offsetprintbox #1% + \negateprintbox #1% \fi} \appendtoks \restoreglobalbodyfont \to \everybeforepagebody @@ -1246,7 +1269,7 @@ \inpagebodytrue\buildpagebody#1#2% \flushtoks\afterpage \dotoks\aftereverypage - \resetpagina + \resetpagebreak \updatelistreferences \resetlayoutlines % will go to \aftereverypage \stopcolorpage @@ -1267,157 +1290,201 @@ {\relax % needed ! \ifpaginageblokkeerd \else \ifdim\pagegoal<\maxdimen - \ifdim\pagetotal<\pagegoal\relax - \dimen0=\lineheight - \multiply\dimen0 #1\relax - \advance\dimen0 \pagetotal + \ifdim\pagetotal<\pagegoal % \relax + \scratchdimen\lineheight + \multiply\scratchdimen#1\relax + \advance\scratchdimen \pagetotal \ifdim\lastskip<\parskip - \advance\dimen0 \parskip + \advance\scratchdimen \parskip \fi - \advance\dimen0 #2\relax - \ifdim\dimen0>.99\pagegoal + \advance\scratchdimen#2\relax + \ifdim\scratchdimen>.99\pagegoal \penalty-\!!tenthousand\relax \fi - \else - % do nothing \fi \else \goodbreak \fi \fi} -\let\resetcurrentsectionmarks=\relax +\let\resetcurrentsectionmarks\relax % was: \resetsectionmarks\firstsection, zie \handelpaginaaf -\def\complexpagina[#1]% - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty - % do nothing and avoid processing, see head's - \else - \@EA\docomplexpagina\@EA[\!!stringa] - \fi} +\def\page {\pagebreak} % the short form of \pagebreak (mult-com one) +\def\pagina{\pagebreak} % for the moment, keep this one -\def\docomplexpagina[#1]% % will be installable - {\flushnotes - \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} - \doifnotvalue{\??tk\v!hoofd\c!status}{\v!stop} - {\setupheader[\c!status=\v!leeg]}% -% \doifnotvalue{\??tk\v!voet\v!tekst\c!status}{\v!stop} - \doifnotvalue{\??tk\v!voet\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!default=>,% do nothing if empty - \s!unknown=>\let\@@pagespecification\commalistelement - \doifinstringelse{+}\@@pagespecification - {\ejectinsert\ejectpage - \dorecurse\@@pagespecification\ejectdummypage} - {\doifnumberelse\@@pagespecification - {\ejectinsert\ejectpage - \doloop - {\ifnum\userpageno<\@@pagespecification\relax - \ejectdummypage - \else - \exitloop - \fi}} - {}}]% - \egroup} +\def\resetpagebreak + {\global\paginageblokkeerdfalse} -\def\simplepagina +\def\simplifypagebreak + {\def\pagebreak{\goodbreak}} + +\def\executepagebreakhandler#1% + {\edef\@@pagespecification{#1}% + \doifdefinedelse{\??pe:\@@pagespecification} + {\getvalue{\??pe:\@@pagespecification}} + {\doifdefinedelse{\??pe::\@@pagespecification} + {\executepagebreakhandlers{\getvalue{\??pe::\@@pagespecification}}} + {\getvalue{\??pe:\s!unknown}}}} + +\long\def\installpagebreakhandler#1#2% + {\long\setvalue{\??pe:#1}{#2}} + +\definecomplexorsimple\pagebreak + +\def\simplepagebreak {\flushnotes - \ifpaginageblokkeerd\else + \executepagebreakhandler\v!ja} + +\def\complexpagebreak[#1]% if empty, do nothing and avoid processing, + {\flushnotes % see head's; watch how we group + \doifsomething{#1}{\bgroup\executepagebreakhandlers{#1}\egroup}} + +\def\executepagebreakhandlers#1% + {\processcommacommand[#1]\executepagebreakhandler} + +\installpagebreakhandler \s!unknown + {\doifinstringelse{+}\@@pagespecification + {\ejectinsert + \gotonextpage + \dorecurse\@@pagespecification\ejectdummypage} + {\doifnumberelse\@@pagespecification + {\ejectinsert + \gotonextpage + \doloop + {\ifnum\userpageno<\@@pagespecification\relax + \ejectdummypage + \else + \exitloop + \fi}} + {}}} + +\installpagebreakhandler \s!default + {} % do nothing if empty + +\installpagebreakhandler \v!reset + {\global\paginageblokkeerdfalse} + +\installpagebreakhandler \v!blokkeer + {\global\paginageblokkeerdtrue} + +\installpagebreakhandler \v!ja + {\ifpaginageblokkeerd\else \ejectinsert - \ejectpage - \ifbinnenkolommen + \gotonextpage + \ifbinnenkolommen % this will move to MUL \ejectpage % anders soms geen overgang \fi \fi} -\definecomplexorsimple\pagina +\installpagebreakhandler \v!opmaak % ?? + {\ifpaginageblokkeerd\else + \eject + \fi} -\def\resetpagina% - {\global\paginageblokkeerdfalse} +\installpagebreakhandler \v!blanko + {\global\pagebodyornamentsfalse} + +\installpagebreakhandler \v!nee + {\ifpaginageblokkeerd\else + \dosomebreak\nobreak + \fi} + +\installpagebreakhandler \v!voorkeur + {\ifpaginageblokkeerd\else + \ifbinnenkolommen % this will move to MUL + \dosomebreak\goodbreak + \else + \testpagina[3][\zeropoint]% + \fi + \fi} + +\installpagebreakhandler \v!grotevoorkeur + {\ifpaginageblokkeerd\else + \ifbinnenkolommen % this will move to MUL + \dosomebreak\goodbreak + \else + \testpagina[5][\zeropoint]% + \fi + \fi} + +\installpagebreakhandler \v!leeg + {\ejectinsert + \gotonextpage + \doifnotvalue{\??tk\v!hoofd\c!status}\v!stop + {\setupheader[\c!status=\v!leeg]}% + \doifnotvalue{\??tk\v!voet\c!status}\v!stop + {\setupfooter[\c!status=\v!leeg]}% + \ejectdummypage} + +\installpagebreakhandler \v!links + {\ejectinsert + \gotonextpageX % will become \gotonextpage + \doifbothsidesoverruled + \orsideone + \resetcurrentsectionmarks + \ejectdummypage + \orsidetwo + \od} + +\installpagebreakhandler \v!rechts + {\ejectinsert + \gotonextpageX % will become \gotonextpage + \doifbothsidesoverruled + \orsideone + \orsidetwo + \resetcurrentsectionmarks + \ejectdummypage + \od} + +\installpagebreakhandler \v!even + {\pagina + \doifoddpageelse + {\resetcurrentsectionmarks\ejectdummypage}\donothing} + +\installpagebreakhandler \v!oneven + {\pagina + \doifoddpageelse + \donothing{\resetcurrentsectionmarks\ejectdummypage}} + +\installpagebreakhandler \v!viertal % not yet ok inside columnsets + {\ifdubbelzijdig + \!!counta\realpageno + \!!countb\realpageno + \divide\!!counta 4 + \divide\!!countb 2 + \ifnum\!!counta=\!!countb + \else + \executepagebreakhandler\v!ja + \executepagebreakhandler\v!leeg + \executepagebreakhandler\v!leeg + \fi + \fi} + +\installpagebreakhandler \v!laatste + {\ejectinsert + \gotonextpageX % will become \gotonextpage + \relax + \doifbothsidesoverruled + \naastpagina + \orsideone + \orsidetwo + \noheaderandfooterlines + \ejectdummypage + \od + \filluparrangedpages} + +% public page handler, beware: definepage already in use (core-ref) +% +% \definepagebreak[instance][forsure] +% \definepagebreak[forsure][yes,+4] + +\def\definepagebreak + {\dodoubleargument\dodefinepagebreak} + +\def\dodefinepagebreak[#1][#2]% non recursive, meant for simple mappings + {\setvalue{\??pe::#1}{#2}} % hier nog uti blokkeren @@ -1429,6 +1496,44 @@ % \setuphead[chapter][before={\pagetype[chapter]}] % \chapter{First} \page test \chapter{second} \page test +\long\def\installcolumnbreakhandler#1#2#3% #1=otr-id #2=tag + {\long\setvalue{\??cn:#1:#2}{#3}} + +\def\definecolumnbreak + {\dodoubleargument\dodefinecolumnbreak} + +\def\dodefinecolumnbreak[#1][#2]% non recursive, meant for simple mappings + {\setvalue{\??cn::#1}{#2}} + +%\def\columnbreak +% {\dosingleempty\docolumnbreak} +% +%\def\docolumnbreak[#1]% +% {\expanded{\nextcolumn[\executeifdefined{\??cn::#1}{#1}]}} + +\definecomplexorsimple\columnbreak + +\def\simplecolumnbreak + {\executecolumnbreakhandler\v!ja} + +\def\complexcolumnbreak[#1]% if empty, do nothing and avoid processing + {\doifsomething{#1}{\bgroup\executecolumnbreakhandlers{#1}\egroup}} + +\def\executecolumnbreakhandlers#1% + {\processcommacommand[#1]\executecolumnbreakhandler} + +\def\executecolumnbreakhandler#1% here no commalist + {\edef\@@columnspecification{#1}% + \doifdefinedelse{\??cn:\OTRidentifier:\@@columnspecification} + {\getvalue{\??cn:\OTRidentifier:\@@columnspecification}} + {\doifdefinedelse{\??cn::\@@columnspecification} + {\executecolumnbreakhandlers{\getvalue{\??cn +::\@@columnspecification}}} + {\getvalue{\??cn:\OTRidentifier:\s!unknown}}}} + +%let\nextcolumn\columnbreak +\let\column \columnbreak + \newif\ifgeselecteerd \geselecteerdtrue \newif\ifselecteren \selecterenfalse \newif\ifverwerken \verwerkentrue @@ -1443,8 +1548,8 @@ {\global\let\voorpagina\relax \getvalue{\??pg#1\c!voor}} -\def\dovoorpagina% - {\doifsomething{\paginasoort} +\def\dovoorpagina + {\doifsomething\paginasoort {\processcommacommand[\paginasoort]\dodovoorpagina}} \def\dododonapagina#1% @@ -1453,7 +1558,7 @@ \getvalue{\??pg#1\c!na}} \def\dodonapagina#1% - {\doifelsevalue{\??pg#1\c!optie}{\v!dubbelzijdig} + {\doifelsevalue{\??pg#1\c!optie}\v!dubbelzijdig {\doifbothsidesoverruled \dododonapagina{#1}% \orsideone @@ -1462,8 +1567,8 @@ \od} {\dododonapagina{#1}}} -\def\donapagina% - {\doifsomething{\paginasoort} +\def\donapagina + {\doifsomething\paginasoort {\processcommacommand[\paginasoort]\dodonapagina}} % Dit wordt eigenlijk nooit en moet worden vervangen door @@ -1474,14 +1579,14 @@ \ifx\desoortpagina\empty \else \@EA\doglobal\@EA\addtocommalist\@EA{\desoortpagina}\paginasoort \ifselecteren - \fullexpandtwoargsafter\doifcommon{\desoortpagina}{\selectie} + \fullexpandtwoargsafter\doifcommon\desoortpagina\selectie {\global\geselecteerdtrue}% \fi \gdef\voorpagina{\dovoorpagina}% \gdef\napagina {\donapagina }% \fi} -\def\soortpagina% +\def\soortpagina {\dosingleargument\dosoortpagina} \def\dokoppelpagina[#1][#2]% @@ -1499,7 +1604,7 @@ \c!optie=\@@pgoptie]}% \processcommalist[#1]\docommando}% -\def\koppelpagina% +\def\koppelpagina {\dodoubleargument\dokoppelpagina} \def\doverwerkpagina[#1][#2]% @@ -1511,10 +1616,10 @@ \global\selecterentrue \global\geselecteerdfalse} -\def\verwerkpagina% +\def\verwerkpagina {\dodoubleargument\doverwerkpagina} -\def\resetselectiepagina% +\def\resetselectiepagina {\ifselecteren \doifbothsidesoverruled \global\geselecteerdfalse @@ -1523,5 +1628,39 @@ \global\geselecteerdfalse \od \fi} + +\newif\ifregistertextareas +\newif\iftracetextareas + +\newbox\registertextbox + +% \def\registeredtextarea#1#2#3% #1=lower-dp #2=correct-ht #3=box +% {\hbox{\box#3}} + +\def\enabletextarearegistration{\global\registertextareastrue} + +\def\registeredtextarea#1#2#3% #1=lower-dp #2=correct-ht #3=box + {\hbox\bgroup + \ifregistertextareas \ifx\registerMPtextarea\undefined \else + \setbox\registertextbox\null + \wd\registertextbox\wd#3% + \ht\registertextbox\ht#3% + \dp\registertextbox\dp#3% + \ifcase#1\or % 1 + \setbox\registertextbox\hbox{\lower\dp\strutbox\box\registertextbox}% + \fi + \ifcase#2\or % 1 + \setbox\registertextbox\hbox{\raise\topskip\hbox{\lower\ht\strutbox\box\registertextbox}}% + \dp\registertextbox\dp\strutbox + \fi + \dp\registertextbox\dp\strutbox % needed + \setbox\registertextbox\hbox + {\iftracetextareas\gray\boxrulewidth2pt\ruledhbox\fi + {\registerMPtextarea{\box\registertextbox}}}% + \smashbox\registertextbox + \box\registertextbox + \fi \fi + \box#3% + \egroup} \protect \endinput diff --git a/tex/context/base/page-lay.tex b/tex/context/base/page-lay.tex index 9700ee926..dfbc7d9d1 100644 --- a/tex/context/base/page-lay.tex +++ b/tex/context/base/page-lay.tex @@ -41,8 +41,8 @@ \newdimen\papierhoogte \papierhoogte = 297mm \newdimen\papierbreedte \papierbreedte = 210mm -\newdimen\printpapierhoogte \printpapierhoogte = 297mm -\newdimen\printpapierbreedte \printpapierbreedte = 210mm +\newdimen\printpapierhoogte \printpapierhoogte = \papierhoogte +\newdimen\printpapierbreedte \printpapierbreedte = \papierbreedte \newdimen\zethoogte % calculated \newdimen\zetbreedte % calculated @@ -70,17 +70,29 @@ \newdimen\bovenhoogte \bovenhoogte = 0cm \newdimen\onderhoogte \onderhoogte = \bovenhoogte +\newcount\layoutlines \layoutlines = 0 +\newcount\layoutcolumns \layoutcolumns = 0 +\newdimen\layoutcolumndistance\layoutcolumndistance= 0pt +\newdimen\layoutcolumnwidth \layoutcolumnwidth = 0pt + %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} +% +% faster + \def\layoutparameter#1% - {\ifundefined{\??ly\currentlayout#1}% - \getvalue{\??ly#1}% - \else - \getvalue{\??ly\currentlayout#1}% - \fi} + {\csname\??ly + \ifundefined{\??ly\currentlayout#1}\else\currentlayout\fi + #1\endcsname} \def\namedlayoutparameter#1#2% {\ifundefined{\??ly#1#2}% @@ -191,13 +203,13 @@ \def\linkerrandafstand {\layoutdistance\linkerrandbreedte\c!linkerrandafstand} - \def\rechterrandafstand% + \def\rechterrandafstand {\layoutdistance\rechterrandbreedte\c!rechterrandafstand} - \def\linkermargeafstand% + \def\linkermargeafstand {\layoutdistance\linkermargebreedte\c!linkermargeafstand} - \def\rechtermargeafstand% + \def\rechtermargeafstand {\layoutdistance\rechtermargebreedte\c!rechtermargeafstand} \fi @@ -225,21 +237,21 @@ \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\voetafstand \layoutdistance\voethoogte \c!voetafstand - \global\onderafstand\layoutdistance\onderhoogte\c!onderafstand} - - \def\setlayoutdistances% local in \setreducedvsize + \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\voetafstand \layoutdistance \voethoogte \c!voetafstand + \global\onderafstand \layoutdistance \onderhoogte \c!onderafstand} + + \def\setlayoutdistances % local in \setreducedvsize {\hoofdafstand\layoutdistance\hoofdhoogte\c!hoofdafstand \voetafstand \layoutdistance\voethoogte \c!voetafstand} @@ -260,7 +272,7 @@ %D %D \showsetup{\y!definepapersize} -\def\definepapersize% +\def\definepapersize {\dodoubleempty\dodefinepapersize} \def\dodefinepapersize[#1][#2]% @@ -289,7 +301,7 @@ [\c!breedte=210mm,\c!hoogte=297mm,\c!offset=\!!zeropoint] %D \macros -%D {setuppapersize} +%D {setuppaper,setuppapersize} %D %D When setting up the papersize on which to typeset and %D print, we can also determine some more characteristics. @@ -308,28 +320,49 @@ \def\paperscale{1} \newif\ifnegateprintbox -\def\setuppapersize% +% \def\dosetuppapersize[#1][#2]% +% {\doifassignmentelse{#1} +% {\getparameters[\??pp][#1]} +% {\doifassignmentelse{#2} +% {\getparameters[\??pp#1][#2]} +% {\dodosetuppapersize[#1][#2]}}} +% +% The next version is more extensive; here we can +% associate paper and page with key/value like settinsg, +% which is handy in 'example' when we use setups + +\def\setuppaper[#1]% + {\getparameters[\??pp][\c!papier=,\c!pagina=,#1]% + \scratchcounter\@@ppnx + \multiply\scratchcounter\@@ppny + \edef\@@ppxy{\the\scratchcounter}% + \doifelsenothing\@@pppagina + {\doifsomething\@@pppapier + {\dodosetuppapersize[\papersize][\@@pppapier]}} + {\doifelsenothing\@@pppapier + {\dodosetuppapersize[\@@pppagina][\printpapersize]} + {\dodosetuppapersize[\@@pppagina][\@@pppapier]}}} + +\def\setuppapersize {\dodoubleempty\dosetuppapersize} \def\dosetuppapersize[#1][#2]% -% {\doifinstringelse{=}{#1} {\doifassignmentelse{#1} - {\getparameters[\??pp][#1]} -% {\doifinstringelse{=}{#2} + {\setuppaper[#1]} {\doifassignmentelse{#2} {\getparameters[\??pp#1][#2]} {\dodosetuppapersize[#1][#2]}}} \def\dodosetuppapersize[#1][#2]% {\ifsecondargument - \xdef\restorepapersize% + \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}% + {\global\papierbreedte\getvalue{\??pp##1\c!breedte}% + \global\papierhoogte\getvalue{\??pp##1\c!hoogte}% \calculatepaperoffsets{##1}% \xdef\papersize{##1}}}}% \processcommacommand[#1]\docommando @@ -338,8 +371,8 @@ {\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}% + {\global\printpapierbreedte\getvalue{\??pp##1\c!breedte}% + \global\printpapierhoogte\getvalue{\??pp##1\c!hoogte}% \xdef\printpapersize{##1}}}}% \processcommacommand[#2]\docommando \global\setdimentoatleast\papierbreedte \!!onepoint @@ -353,10 +386,10 @@ \doglobal\swapdimens\printpapierbreedte\printpapierhoogte \fi \ifdim\papierhoogte>\printpapierhoogte - \global\printpapierhoogte=\papierhoogte + \global\printpapierhoogte\papierhoogte \fi \ifdim\papierbreedte>\printpapierbreedte - \global\printpapierbreedte=\papierbreedte + \global\printpapierbreedte\papierbreedte \fi \calculatehsizes \calculatevsizes @@ -370,15 +403,15 @@ \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\chardef#2\zerocount + \global\chardef#5\zerocount + \globallet#3\!!zerocount + \globallet#4\!!zerocount \global\negateprintboxfalse \processallactionsinset [#1] - [ \v!liggend=>\global\chardef#2=1, - \v!gespiegeld=>\global\chardef#5=1, + [ \v!liggend=>\global\chardef#2\plusone, + \v!gespiegeld=>\global\chardef#5\plusone, \v!geroteerd=>\gdef#3{90}\gdef#4{270}, \v!negatief=>\global\negateprintboxtrue, 90=>\gdef#3{90}\gdef#4{270}, @@ -388,9 +421,9 @@ \ifx\calculatepaperoffsets\undefined \def\calculatepaperoffsets#1% - {\scratchdimen=\getvalue{\??pp#1\c!offset}% - \global\advance\papierbreedte by -2\scratchdimen - \global\advance\papierhoogte by -2\scratchdimen} + {\scratchdimen\getvalue{\??pp#1\c!offset}% + \global\advance\papierbreedte -2\scratchdimen + \global\advance\papierhoogte -2\scratchdimen} \fi @@ -399,104 +432,13 @@ \def\checkforems[#1]% {\def\docommando##1% {\beforesplitstring##1\at em\to\asciia - \doifnot{\asciia}{##1} + \doifnot\asciia{##1} {\aftersplitstring\asciia\at=\to\asciia - \doifsomething{\asciia} - {\showmessage{\m!systems}{10}{##1}}}}% + \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\zerocount % is gewoon beter -% \clubpenalty \zerocount % zeker bij grids -% \else -% \widowpenalty\defaultwidowpenalty -% \clubpenalty \defaultclubpenalty -% \fi -% \simplestelwitruimtein -% \simplestelblankoin -% \global\snijwit\layoutparameter\c!snijwit\relax -% \doifelse{\layoutparameter\c!breedte}\v!midden -% {\ifdim\snijwit=\zeropoint -% \global\snijwit\rugwit -% \fi -% \global\zetbreedte\papierbreedte -% \global\advance\zetbreedte -\rugwit -% \global\advance\zetbreedte -\snijwit} -% {\doifelse{\layoutparameter\c!breedte}\v!passend -% {\ifdim\snijwit=\zeropoint -% \global\snijwit\rugwit -% \fi -% \global\zetbreedte\papierbreedte -% \global\advance\zetbreedte -\snijwit -% \scratchdimen\rugwit -% \advance\scratchdimen -\linkerrandbreedte -% \advance\scratchdimen -\linkerrandafstand -% \advance\scratchdimen -\linkermargebreedte -% \advance\scratchdimen -\linkermargeafstand -% \ifdim\scratchdimen<\zeropoint -% \scratchdimen\zeropoint -% \fi -% \global\advance\zetbreedte -\rechtermargeafstand -% \global\advance\zetbreedte -\rechtermargebreedte -% \global\advance\zetbreedte -\rechterrandafstand -% \global\advance\zetbreedte -\rechterrandbreedte -% \global\advance\zetbreedte -\scratchdimen} -% {\global\zetbreedte\layoutparameter\c!breedte -% \ifdim\snijwit=\zeropoint -% \global\snijwit\papierbreedte -% \global\advance\snijwit-\zetbreedte -% \global\advance\snijwit-\rugwit -% \else -% % inconsistent specification -% \fi}}% -% \scratchdimen\layoutparameter\c!bodemwit\relax -% \ifdim\scratchdimen=\zeropoint -% \scratchdimen\kopwit -% \fi -% \doifelse{\layoutparameter\c!regels}\empty -% {\doifelse{\layoutparameter\c!hoogte}\v!midden -% {\global\zethoogte\papierhoogte -% \global\advance\zethoogte -\kopwit -% \global\advance\zethoogte -\scratchdimen} -% {\doifelse{\layoutparameter\c!hoogte}\v!passend -% {\global\zethoogte\papierhoogte -% \global\advance\zethoogte -\scratchdimen -% \scratchdimen\kopwit -% \advance\scratchdimen -\bovenhoogte -% \advance\scratchdimen -\bovenafstand -% \ifdim\scratchdimen<\zeropoint -% \scratchdimen\zeropoint -% \fi -% \global\advance\zethoogte -\onderafstand -% \global\advance\zethoogte -\onderhoogte -% \global\advance\zethoogte -\scratchdimen} -% {\global\zethoogte\layoutparameter\c!hoogte}}} -% {\global\zethoogte\layoutparameter\c!regels\lineheight -% \global\advance\zethoogte \hoofdhoogte -% \global\advance\zethoogte \voethoogte}% -% \rugoffset\layoutparameter\c!rugoffset -% \kopoffset\layoutparameter\c!kopoffset -% \global\setdimentoatleast\zetbreedte\!!onepoint -% \global\setdimentoatleast\zethoogte\!!onepoint -% \calculatehsizes -% \calculatevsizes -% \recalculatelogos -% \recalculatebackgrounds} - -\def\recalculatelayout% +\def\recalculatelayout {\global\linkermargebreedte \layoutparameter\c!linkermarge \global\rechtermargebreedte\layoutparameter\c!rechtermarge \global\linkerrandbreedte \layoutparameter\c!linkerrand @@ -518,7 +460,8 @@ \fi \simplestelwitruimtein \simplestelblankoin - \global\snijwit\layoutparameter\c!snijwit\relax + \global\snijwit\layoutparameter\c!snijwit + \relax \doifelse{\layoutparameter\c!breedte}\v!midden {\ifdim\snijwit=\zeropoint \global\snijwit\rugwit @@ -536,7 +479,7 @@ \advance\scratchdimen -\linkerrandbreedte \advance\scratchdimen -\linkerrandafstand \advance\scratchdimen -\linkermargebreedte - \advance\scratchdimen -\linkermargeafstand + \advance\scratchdimen -\linkermargeafstand\relax \ifdim\scratchdimen<\zeropoint \scratchdimen\zeropoint \fi @@ -545,107 +488,130 @@ \global\advance\zetbreedte -\rechterrandafstand \global\advance\zetbreedte -\rechterrandbreedte \global\advance\zetbreedte -\scratchdimen} - {\global\zetbreedte\layoutparameter\c!breedte + {\global\zetbreedte\layoutparameter\c!breedte\relax \ifdim\snijwit=\zeropoint \global\snijwit\papierbreedte \global\advance\snijwit-\zetbreedte \global\advance\snijwit-\rugwit \else % inconsistent specification +\global\rugwit\papierbreedte +\global\advance\rugwit-\zetbreedte +\global\advance\rugwit-\snijwit \fi}}% \scratchdimen\layoutparameter\c!bodemwit\relax %\ifdim\scratchdimen=\zeropoint % \scratchdimen\kopwit %\fi \global\bodemwit\layoutparameter\c!bodemwit\relax - \doifelse{\layoutparameter\c!regels}\empty - {\doifelse{\layoutparameter\c!hoogte}\v!midden - {\ifdim\bodemwit=\zeropoint - \global\bodemwit\kopwit - \fi - \global\zethoogte\papierhoogte - \global\advance\zethoogte -\kopwit - \global\advance\zethoogte -\bodemwit} - {\doifelse{\layoutparameter\c!hoogte}\v!passend - {\ifdim\bodemwit=\zeropoint - \global\bodemwit\kopwit - \fi - \global\zethoogte\papierhoogte - \global\advance\zethoogte -\bodemwit - \scratchdimen\kopwit - \advance\scratchdimen -\bovenhoogte - \advance\scratchdimen -\bovenafstand - \ifdim\scratchdimen<\zeropoint - \scratchdimen\zeropoint - \fi - \global\advance\zethoogte -\onderafstand - \global\advance\zethoogte -\onderhoogte - \global\advance\zethoogte -\scratchdimen} - {\global\zethoogte\layoutparameter\c!hoogte - \ifdim\bodemwit=\zeropoint - \global\bodemwit\papierhoogte - \global\advance\bodemwit-\zethoogte - \global\advance\bodemwit-\kopwit - \else - % inconsistent specification - \fi}}}% - {\global\zethoogte\layoutparameter\c!regels\lineheight -% new, cleaner -\global\advance\zethoogte-\strutheight -\global\advance\zethoogte \topskip -% new, was a bug -\global\advance\zethoogte \hoofdafstand -\global\advance\zethoogte \voetafstand -% so far - \global\advance\zethoogte \hoofdhoogte - \global\advance\zethoogte \voethoogte}% + \global\layoutlines0\number\layoutparameter\c!regels\relax % may be empty + \ifcase\layoutlines + \doifelse{\layoutparameter\c!hoogte}\v!midden + {\ifdim\bodemwit=\zeropoint + \global\bodemwit\kopwit + \fi + \global\zethoogte\papierhoogte + \global\advance\zethoogte -\kopwit + \global\advance\zethoogte -\bodemwit} + {\doifelse{\layoutparameter\c!hoogte}\v!passend + {\ifdim\bodemwit=\zeropoint + \global\bodemwit\kopwit + \fi + \global\zethoogte\papierhoogte + \global\advance\zethoogte -\bodemwit + \scratchdimen\kopwit + \advance\scratchdimen -\bovenhoogte + \advance\scratchdimen -\bovenafstand\relax + \ifdim\scratchdimen<\zeropoint + \scratchdimen\zeropoint + \fi + \global\advance\zethoogte -\onderafstand + \global\advance\zethoogte -\onderhoogte + \global\advance\zethoogte -\scratchdimen} + {\global\zethoogte\layoutparameter\c!hoogte\relax + \ifdim\bodemwit=\zeropoint + \global\bodemwit\papierhoogte + \global\advance\bodemwit-\zethoogte + \global\advance\bodemwit-\kopwit + \else + % inconsistent specification + \fi}}% + \else + \global\zethoogte\layoutparameter\c!regels\lineheight + % new, cleaner + \global\advance\zethoogte-\strutheight + \global\advance\zethoogte \topskip + % new, was a bug + \global\advance\zethoogte \hoofdafstand + \global\advance\zethoogte \voetafstand + % so far + \global\advance\zethoogte \hoofdhoogte + \global\advance\zethoogte \voethoogte + \fi \rugoffset\layoutparameter\c!rugoffset \kopoffset\layoutparameter\c!kopoffset \global\setdimentoatleast\zetbreedte\!!onepoint - \global\setdimentoatleast\zethoogte\!!onepoint + \global\setdimentoatleast\zethoogte \!!onepoint + % \checkcurrentlayout % here ? \calculatehsizes \calculatevsizes + \calculatepseudocolumns + \checkgridsnapping \recalculatelogos \recalculatebackgrounds} -\def\checklayout% - {\doifsomething{\layoutparameter\c!regels} - {\ifdim\zethoogte=\layoutparameter\c!regels\lineheight \else \recalculatelayout \fi}} - +\def\calculatepseudocolumns + {\global\layoutcolumns\layoutparameter\c!kolommen + \global\layoutcolumndistance\layoutparameter\c!kolomafstand + \global\layoutcolumnwidth-\layoutcolumns\layoutcolumndistance + \global\advance\layoutcolumnwidth\layoutcolumndistance + \global\advance\layoutcolumnwidth\zetbreedte + \global\divide\layoutcolumnwidth\layoutcolumns + \dorecurse\layoutcolumns + {\scratchdimen\layoutcolumnwidth + \advance\scratchdimen\layoutcolumndistance + \scratchcounter\recurselevel + \advance\scratchcounter\minusone + \scratchdimen\scratchcounter\scratchdimen + \setxvalue{\??ly:c:\recurselevel}{\the\scratchdimen}}} + +%\dorecurse\layoutcolumns +% {\setxvalue{\??ly:c:\recurselevel}{\the\dimexpr +% (\numexpr(\recurselevel-1)\dimexpr(\layoutcolumnwidth+\layoutcolumndistance))}} + +\def\layoutcolumnoffset#1% + {\executeifdefined{\??ly:c:#1}\!!zeropoint} + +\def\checklayout + {\ifdim\zethoogte=\layoutlines\lineheight \else \recalculatelayout \fi} + \appendtoks \checklayout \to \everystarttext -\def\checkcurrentlayout% - {\ifundefined{\??ly\number\realfolio\c!status}% - \doifonevenpaginaelse\checkcurrentoddlayout\checkcurrentevenlayout +\def\checkcurrentlayout + {\ifundefined{\??ly\realfolio\c!status}% + \doifoddpageelse\checkcurrentoddlayout\checkcurrentevenlayout \else - \stellayoutin[\number\realfolio]% + \doifvalue{\??ly\realfolio\c!status}\v!start + {\edef\currentlayout{\realfolio}\recalculatelayout}% \fi} \def\checkcurrentoddlayout - {\ifundefined{\??ly\v!oneven\c!status}\else\stellayoutin[\v!oneven]\fi} + {\ifundefined{\??ly\v!oneven\c!status}\else + \doifvalue{\??ly\v!oneven\c!status}\v!start + {\let\currentlayout\v!oneven\recalculatelayout}% + \fi} \def\checkcurrentevenlayout - {\ifundefined{\??ly\v!even \c!status}\else\stellayoutin[\v!even ]\fi} - -% not much faster at all -% -% \beginETEX -% -% \def\checkcurrentlayout% -% {\ifcsname\??ly\number\realfolio\c!status\endcsname -% \stellayoutin[\number\realfolio]% -% \else\doifonevenpaginaelse -% {\ifcsname\??ly\v!oneven\c!status\endcsname\stellayoutin[\v!oneven]\fi} -% {\ifcsname\??ly\v!even \c!status\endcsname\stellayoutin[\v!even ]\fi}% -% \fi} -% -% \endETEX + {\ifundefined{\??ly\v!even\c!status}\else + \doifvalue{\??ly\v!even\c!status}\v!start + {\let\currentlayout\v!even\recalculatelayout}% + \fi} \appendtoks \checkcurrentlayout \to \everyaftershipout \newif\ifdoublesidedprint -\def\presetcenterpagebox% in \stellayoutin !!!!!!!!!!!!!!!! +\def\presetcenterpagebox % in \stellayoutin !!!!!!!!!!!!!!!! {\doublesidedprintfalse \ExpandFirstAfter\processallactionsinset [\@@lyplaats] @@ -657,7 +623,7 @@ \v!dubbelzijdig=>\doublesidedprinttrue, \v!enkelzijdig=>\doublesidedprintfalse]} -\def\definelayout% +\def\definelayout {\dodoubleargument\dodefinelayout} \def\dodefinelayout[#1][#2]% @@ -675,9 +641,10 @@ \else\iffirstargument \doifassignmentelse{#1} {\dodostellayoutin[][#1]} - {\doifnot{#1}{\v!reset}{\def\currentlayout{#1}}}% + {\doifnot{#1}\v!reset{\def\currentlayout{#1}}}% \fi\fi \recalculatelayout +\checkcurrentlayout % here ? \presetcenterpagebox} \def\stellayoutin @@ -685,12 +652,12 @@ \let\@@zahoogte=\!!zeropoint -\def\dopushpagedimensions% +\def\dopushpagedimensions {\xdef\oldteksthoogte{\the\teksthoogte}% - \xdef\oldvoethoogte{\the\voethoogte}% + \xdef\oldvoethoogte {\the\voethoogte}% \global\let\@@zahoogte\@@zahoogte} -\def\dopoppagedimensions% +\def\dopoppagedimensions {\global\teksthoogte\oldteksthoogte \global\voethoogte\oldvoethoogte \recalculatelayout @@ -715,26 +682,28 @@ \donothing \fi} -\def\checkpagedimensions% +\def\checkpagedimensions {\poppagedimensions \adaptpagedimensions} -\def\reportpagedimensions% +\def\reportpagedimensions {\ifx\poppagedimensions\relax \else \spatie\@@zahoogte\space-\space \fi \realfolio} \def\dodopaslayoutaan[#1]% - {\getparameters[\??za][\c!hoogte=,\c!regels=,#1]% + {\getparameters[\??za][\c!hoogte=,\c!regels=0,#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}}% + \ifcase\@@zaregels\relax + \showmessage\m!layouts1{\@@zahoogte,\realfolio}% + \else + \showmessage\m!layouts1{\@@zaregels\space\v!regels,\realfolio}% + \def\@@zahoogte{\@@zaregels\openlineheight}% + \fi + \doifelse\@@zahoogte\v!max + {\balancedimensions\teksthoogte\voethoogte\voethoogte} + {\balancedimensions\teksthoogte\voethoogte\@@zahoogte}% \ifdim\voethoogte<\zeropoint \global\advance\teksthoogte \voethoogte \global\voethoogte\zeropoint @@ -766,9 +735,9 @@ %D {right} parameters. \def\centerpagebox#1% - {\printpapierbreedte=\paperscale\printpapierbreedte - \printpapierhoogte =\paperscale\printpapierhoogte - \setbox#1=\vbox to \printpapierhoogte + {\printpapierbreedte\paperscale\printpapierbreedte + \printpapierhoogte \paperscale\printpapierhoogte + \setbox#1\vbox to \printpapierhoogte {\@@ppboven \hbox to \printpapierbreedte {\ifdoublesidedprint @@ -792,7 +761,7 @@ \fi \ifdone \edef\next{\wd#1\the\wd#1\ht#1\the\ht#1\dp#1\the\dp#1}% - \setbox#1=\vbox + \setbox#1\vbox {%\forgetall \offinterlineskip \vskip\kopoffset @@ -822,15 +791,15 @@ % \fi\fi} \def\replicatepagebox#1% - {\ifnum\@@lynx>1 + {\ifnum\@@lynx>\plusone \donetrue - \else\ifnum\@@lyny>1 + \else\ifnum\@@lyny>\plusone \donetrue \else \donefalse \fi\fi \ifdone - \setbox#1=\vbox + \setbox#1\vbox {%\forgetall \offinterlineskip \dorecurse\@@lyny @@ -840,9 +809,9 @@ \fi} \def\rotatepagebodybox#1#2#3% - {\ifnum#2#3>0 - \setbox#1=\vbox - {\edef\somerotation% + {\ifnum#2#3>\zerocount + \setbox#1\vbox + {\edef\somerotation {\ifdubbelzijdig\ifodd\realpageno#2\else#3\fi\else#2\fi}% \dorotatebox\somerotation\hbox{\box#1}}% \fi} @@ -855,7 +824,7 @@ \def\mirrorpagebodybox#1#2% {\ifcase#2\or - \setbox#1=\vbox + \setbox#1\vbox {\domirrorbox\vbox{\box#1}}% \fi} @@ -867,10 +836,10 @@ \def\scalepagebox#1% {\ifdim\@@lyschaal pt=1pt \else - \setbox#1=\vbox + \setbox#1\vbox {\schaal[\c!sx=\@@lyschaal,\c!sy=\@@lyschaal]{\box#1}}% - \papierbreedte=\@@lyschaal\papierbreedte - \papierhoogte =\@@lyschaal\papierhoogte + \papierbreedte\@@lyschaal\papierbreedte + \papierhoogte \@@lyschaal\papierhoogte \fi} \def\negateprintbox#1% @@ -878,27 +847,37 @@ \negatecolorbox{#1}% \fi} -\def\pagecutmarksymbol% - {\the\realpageno}% +\def\pagecutmarksymbol + {\the\realpageno} + +\def\pagecutmarklength + {.5cm} \def\addpagecutmarks#1% {\doif\@@lymarkering\v!aan {\let\cutmarksymbol\pagecutmarksymbol + \let\cutmarklength\pagecutmarklength \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}}} +\def\addpagecolormarks % #1 + {\doifelse\@@lymarkering\v!kleur + {\doaddpagecolormarks\colormarkbox} + {\doifelse\@@lymarkering\v!raster + {\doaddpagecolormarks\rastermarkbox} + {\gobbleoneargument}}} + +\def\doaddpagecolormarks#1#2% + {\let\cutmarksymbol\pagecutmarksymbol + \let\cutmarklength\pagecutmarklength + \makecutbox{#2}% + \ifnum\horizontalcutmarks>2 \chardef\colormarkoffset4 \fi + \ifnum\verticalcutmarks >2 \chardef\colormarkoffset4 \fi + #1{#2}} \newif\ifdubbelzijdig \dubbelzijdigfalse \newif\ifenkelzijdig \enkelzijdigtrue \def\doifsometextlineelse#1% -% {\edef\!!stringa{\csname\??tk#1\v!tekst\c!status\endcsname}% {\edef\!!stringa{\csname\??tk#1\c!status\endcsname}% \ifx\!!stringa\v!geen \@EA\secondoftwoarguments @@ -910,45 +889,58 @@ % NOG EENS NAGAAN WANNEER NU GLOBAL EN WANNEER NIET -\def\calculatevsizes% global needed in \recalculatelayoutregel +\def\calculatevsizes % global needed in \recalculatelayoutregel {\redoglobal\teksthoogte\zethoogte \doifsometextlineelse \v!hoofd {\redoglobal\advance\teksthoogte -\hoofdhoogte - \redoglobal\advance\teksthoogte -\hoofdafstand} + \redoglobal\advance\teksthoogte -\hoofdafstand}% \donothing \doifsometextlineelse \v!voet {\redoglobal\advance\teksthoogte -\voethoogte - \redoglobal\advance\teksthoogte -\voetafstand} + \redoglobal\advance\teksthoogte -\voetafstand}% \donothing + \ifzeropt\hoofdhoogte + \resetsystemmode\v!hoofd + \else + \setsystemmode\v!hoofd + \fi + \ifzeropt\voethoogte + \resetsystemmode\v!voet + \else + \setsystemmode\v!voet + \fi \resetglobal \setvsize} -\def\calculatereducedvsizes% +\def\calculatereducedvsizes {\teksthoogte\zethoogte \doifsometextlineelse \v!hoofd {\advance\teksthoogte -\hoofdhoogte - \advance\teksthoogte -\hoofdafstand} + \advance\teksthoogte -\hoofdafstand}% {\hoofdhoogte\zeropoint \setlayoutdistances}% \doifsometextlineelse \v!voet {\advance\teksthoogte -\voethoogte - \advance\teksthoogte -\voetafstand} + \advance\teksthoogte -\voetafstand}% {\voethoogte\zeropoint \setlayoutdistances}} -\def\freezetextwidth% % \zetbreedte may be set to \tekstbreedte +\def\freezetextwidth % \zetbreedte may be set to \tekstbreedte {\tekstbreedte\zetbreedte % which is a tricky but valid value - \doifsomething{\layoutparameter\c!tekstbreedte} - {\tekstbreedte\layoutparameter\c!tekstbreedte}} + \doifsomething{\layoutparameter\c!tekstbreedte}% + {\tekstbreedte\layoutparameter\c!tekstbreedte}% + \doifsomething{\layoutparameter\c!tekstmarge}% + {\advance\tekstbreedte-\layoutparameter\c!tekstmarge + \advance\tekstbreedte-\layoutparameter\c!tekstmarge}} -\def\calculatehsizes% +\def\calculatehsizes {\freezetextwidth \sethsize} % De onderstaande macro voert commando's uit, afhankelijk van % het karakter van het paginanummer. % -% \doifonevenpaginaelse{then-commando}{else-commando} +% \doifoddpageelse{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 @@ -957,14 +949,14 @@ \newif\ifshiftedrealpageno -% \def\doifonevenpaginaelse#1#2% +% \def\doifoddpageelse#1#2% % {\ifshiftedrealpageno % \ifodd\realpageno#2\else#1\fi % \else % \ifodd\realpageno#1\else#2\fi % \fi} -\def\doifonevenpaginaelse +\def\doifoddpageelse {\ifshiftedrealpageno \ifodd\realpageno \@EAEAEA\secondoftwoarguments @@ -979,9 +971,13 @@ \fi \fi} -\def\doifbothsidesoverruled#1\orsideone#2\orsidetwo#3\od% +\let\doifonevenpaginaelse\doifoddpageelse + +% what are those \relax'es doing there? + +\def\doifbothsidesoverruled#1\orsideone#2\orsidetwo#3\od {\ifdubbelzijdig - \doifonevenpaginaelse{#2}{#3}\relax + \doifoddpageelse{#2}{#3}\relax \else #1\relax \fi} @@ -991,7 +987,7 @@ \ifenkelzijdig #1\relax \else - \doifonevenpaginaelse{#2}{#3}\relax + \doifoddpageelse{#2}{#3}\relax \fi \else #1\relax @@ -999,7 +995,7 @@ \newdimen\texthoffset -\def\settexthoffset% +\def\settexthoffset {\doifbothsides \texthoffset\rugwit \orsideone @@ -1010,7 +1006,7 @@ \advance\texthoffset-\zetbreedte \od} -\def\goleftonpage% +\def\goleftonpage {\hskip-\linkermargeafstand \hskip-\linkermargebreedte \hskip-\linkerrandafstand @@ -1018,7 +1014,7 @@ \iffixedlayoutdimensions - \def\doswapmargins% + \def\doswapmargins {\let\doswapmargins\relax % to prevent local swapping \swapdimens\linkermargeafstand\rechtermargeafstand \swapdimens\linkerrandafstand \rechterrandafstand @@ -1033,7 +1029,7 @@ \letvalue{\??ly\currentlayout#1}\!!stringb \letvalue{\??ly\currentlayout#2}\!!stringa} - \def\doswapmargins% + \def\doswapmargins {\let\doswapmargins\relax % to prevent local swapping \dodoswapmargins\c!linkermargeafstand\c!rechtermargeafstand \dodoswapmargins\c!linkerrandafstand \c!rechterrandafstand @@ -1045,9 +1041,58 @@ \def\doifmarginswapelse#1#2% {\doifbothsides#1\orsideone#1\orsidetwo#2\od} -\def\swapmargins% +\def\swapmargins {\doifmarginswapelse\relax\doswapmargins} +\def\rightorleftpageaction + {\ifdubbelzijdig + \ifenkelzijdig + \@EAEAEA\firstoftwoarguments + \else + \@EAEAEA\doifoddpageelse + \fi + \else + \@EA\firstoftwoarguments + \fi} + +\def\outermarginwidth + {\rightorleftpageaction\rechtermargebreedte\linkermargebreedte} +\def\innermarginwidth + {\rightorleftpageaction\linkermargebreedte\rechtermargebreedte} +\def\outermargindistance + {\rightorleftpageaction\rechtermargeafstand\linkermargeafstand} +\def\innermargindistance + {\rightorleftpageaction\linkermargeafstand\rechtermargeafstand} + +\def\outeredgewidth + {\rightorleftpageaction\rechterrandbreedte\linkerrandbreedte} +\def\inneredgewidth + {\rightorleftpageaction\linkerrandbreedte\rechterrandbreedte} +\def\outeredgedistance + {\rightorleftpageaction\rechterrandafstand\linkerrandafstand} +\def\inneredgedistance + {\rightorleftpageaction\linkerrandafstand\rechterrandafstand} + +%D \macros +%D {startlocallayout} +%D +%D These macros should be used with care. They permit local +%D layouts (as used in fitting pages, see \type {page-app.tex}). + +%D This is kind of obsolete now that we have \type +%D {\definelayout}, so this hack will disappear in future +%D versions. + +\def\startlocallayout + {\pushmacro\restorepapersize + \pushmacro\currentlayout} + +\def\stoplocallayout + {\popmacro\currentlayout + \popmacro\restorepapersize + \restorepapersize + \stellayoutin} % \setuplayout} + %D \macros %D {showprint, showframe, showlayout, showsetups} %D @@ -1104,8 +1149,9 @@ \c!rechterrand=\layoutparameter\c!rand, \c!kopoffset=\!!zeropoint, \c!rugoffset=\!!zeropoint, - \c!tekstbreedte=, % dangerous option - \c!tekstafstand=\!!zeropoint, + \c!tekstbreedte=, % dangerous option -> centered + \c!tekstmarge=, % dangerous option -> both sides + \c!tekstafstand=\!!zeropoint, % shift down on grid \c!letter=, \c!kleur=, \c!markering=\v!uit, @@ -1116,7 +1162,10 @@ \c!dx=\!!zeropoint, \c!dy=\!!zeropoint, \c!grid=\v!nee, - \c!regels=, + \c!clipoffset=\!!zeropoint, + \c!regels=0, + \c!kolommen=1, + \c!kolomafstand=\!!zeropoint, \c!snijwit=\!!zeropoint, \c!bodemwit=\!!zeropoint] @@ -1215,10 +1264,57 @@ %D We also set some of the parameters that will be used when %D positioning the typeset paper onto the print paper. +\setuppaper % (size) % only used in XY imposition + [\c!breedte=\zeropoint, + \c!hoogte=\zeropoint, + \c!kopwit=\zeropoint, + \c!rugwit=\zeropoint, + \c!dx=\zeropoint, + \c!dy=\zeropoint, + \c!nx=1, + \c!ny=1] + \setuppapersize [\c!boven=, \c!onder=\vss, \c!links=, \c!rechts=\hss] +%D A few goodies: + +\beginETEX \dimexpr + +\definepapersize + [oversized] + [\c!breedte=\dimexpr(\papierbreedte+1.5cm), + \c!hoogte=\dimexpr(\papierhoogte+1.5cm)] + +\definepapersize + [doublesized] + [\c!breedte=\dimexpr(\papierbreedte), + \c!hoogte=\dimexpr(2\papierhoogte)] + +\definepapersize + [doubleoversized] + [\c!breedte=\dimexpr(\papierhoogte+1.5cm), + \c!hoogte=\dimexpr(2\papierbreedte+1.5cm)] + +\endETEX + +\definelayout + [\v!pagina] + [\c!rugwit=\zeropoint, + \c!kopwit=\zeropoint, + \c!marge=\zeropoint, + \c!rand=\zeropoint, + \c!hoofd=\zeropoint, + \c!voet=\zeropoint, + \c!breedte=\v!midden, + \c!hoogte=\v!midden] + +\definelayout + [\v!midden] + [\c!breedte=\v!midden, + \c!hoogte=\v!midden] + \protect \endinput diff --git a/tex/context/base/page-lin.tex b/tex/context/base/page-lin.tex index 466a34c43..f5b01b86e 100644 --- a/tex/context/base/page-lin.tex +++ b/tex/context/base/page-lin.tex @@ -15,50 +15,49 @@ \unprotect -\newif\ifinregels -%\newif\ifregelnummersinmarge +\newif\ifinregels % \newif\ifregelnummersinmarge \chardef\linenumberlocation=0 \newtoks\beforeeverylinenumbering \newtoks\aftereverylinenumbering -\def\stelregelsin% +\def\stelregelsin {\dodoubleargument\getparameters[\??rg]} -\def\startregels% +\def\startregels {\@@rgvoor \witruimte %\pagina[\v!voorkeur]} gaat mis na koppen, nieuw: later \nobreak \begingroup - \def\@@rgstepyes{\parindent\!!zeropoint}% - \def\@@rgstepno{\parindent\!!zeropoint}% + \def\@@rgstepyes{\parindent\zeropoint}% + \def\@@rgstepno {\parindent\zeropoint}% \edef\@@rgparindent{\the\parindent}% - \gdef\@@rglinesteptoggle{1}% + \globallet\@@rglinesteptoggle\!!plusone \processaction [\@@rginspringen] [ \v!ja=>\def\@@rgstepyes{\parindent\@@rgparindent}% \def\@@rgstepno {\parindent\@@rgparindent}, - \v!oneven=>\def\@@rgstepyes{\parindent\!!zeropoint }% + \v!oneven=>\def\@@rgstepyes{\parindent\zeropoint }% \def\@@rgstepno {\parindent\@@rgparindent}, - \v!even=>\def\@@rgstepno {\parindent\!!zeropoint }% + \v!even=>\def\@@rgstepno {\parindent\zeropoint }% \def\@@rgstepyes{\parindent\@@rgparindent}]% \inregelstrue \stelwitruimtein[\v!geen]% \obeylines - \let\checkindentation=\relax + \let\checkindentation\relax \@@rgstepno \ignorespaces - \gdef\afterfirstobeyedline% tzt two pass, net als opsomming - {\gdef\afterfirstobeyedline% + \gdef\afterfirstobeyedline % tzt two pass, net als opsomming + {\gdef\afterfirstobeyedline {\nobreak \global\let\afterfirstobeyedline\relax}}% - \def\obeyedline% + \def\obeyedline {\par -\let\checkindentation=\relax % else problems with odd/even + \let\checkindentation\relax % else problems with odd/even \afterfirstobeyedline \ifdim\lastskip>\zeropoint - \gdef\@@rglinesteptoggle{0}% + \globallet\@@rglinesteptoggle\!!zerocount \else \doglobal\increment\@@rglinesteptoggle \fi @@ -77,10 +76,10 @@ % \@@rgtussen % hopelessly in non % \fi} % etex -\def\dobetweenthelines% - {\doifmeaningelse{\next}{\obeyedline}{\@@rgtussen}{}} +\def\dobetweenthelines + {\doifmeaningelse\next\obeyedline\@@rgtussen\donothing} -\def\stopregels% +\def\stopregels {\endgroup \@@rgna} @@ -90,49 +89,67 @@ % het gebruik van \setlocalreference scheelt een hash entry -\def\dodoshowlinenumber% for use elsewhere, to be extended +\def\dodoshowlinenumber % for use elsewhere, to be extended {\doschrijfregelnummer - \global\advance\linenumber 1\relax}% + \global\advance\linenumber \plusone} -\def\regelweergave% - {\convertnumber\@@rnconversie\linenumber}% +\def\regelweergave + {\@@rnlinks\convertnumber\@@rnconversie\linenumber\@@rnrechts} \def\dostelregelnummerenin[#1]% - {\getparameters - [\??rn] - [\c!start=1, - \c!stap=1, - #1]% - \global\linenumber1\relax} + {\getparameters[\??rn][\c!start=1,\c!stap=1,#1]% + \global\linenumber\plusone} -\def\stelregelnummerenin% +\def\stelregelnummerenin {\dosingleargument\dostelregelnummerenin} -\def\dostartnummerenLINE% % !! \everypar !! +\def\dostartnummerenLINE {\EveryPar{\schrijfregelnummer}} -\def\dostopnummerenLINE% +\def\dostopnummerenLINE {\the\aftereverylinenumbering \egroup} -\def\dodoschrijfregelnummer% - {\setbox0=\hbox{\regelweergave}% - \vsmashbox0% - \ifcase\linenumberlocation - \rlap{\hbox to \@@rnbreedte{\box0\hss}}% was \llap, nog testen !! - \else - \llap{\hbox{\box0\hskip\linkermargeafstand}}% - \fi} +\def\dostartnummerenVERB + {\EveryLine{\schrijfregelnummer}} + +\def\dostopnummerenVERB + {\the\aftereverylinenumbering + \egroup} + +\newevery \everylinenumber \relax + +\def\dodoschrijfregelnummer + {% beware of em's, the font is already switched ! + \setbox\scratchbox\hbox + {\setbox0\hbox{\@@rncommando{\regelweergave}}\vsmashbox0% + \ifcase\linenumberlocation + \rlap{\hbox to \@@rnbreedte{\box0\hss}}% was \llap, nog testen !! + \or + \inleftmargin + {\forgetall + \doifelse\@@rnbreedte\v!marge + {\hsize\linkermargebreedte}{\hsize\@@rnbreedte}% + \alignedline\@@rnuitlijnen\v!rechts{\box0\hskip\@@rnafstand}}% + \else + \inrightmargin + {\forgetall + \doifelse\@@rnbreedte\v!marge + {\hsize\rechtermargebreedte}{\hsize\@@rnbreedte}% + \alignedline\@@rnuitlijnen\v!links{\hskip\@@rnafstand\box0}}% + \fi}% + \vsmashbox\scratchbox + \box\scratchbox + \the\everylinenumber} \def\complexstartregelnummeren[#1]% -% {\doifnotinset{\v!verder}{#1} -% {\global\linenumber=1\relax}% - {\doifnot{\v!verder}{#1} + {\doifnot{#1}\v!verder {\doifnumberelse{#1} - {\global\linenumber#1}% - {\global\linenumber 1}% - \relax}% - \chardef\linenumberlocation0 + {\global\linenumber#1\relax} + {\doifelsenothing\@@rnstart + {\global\linenumber\plusone} + {\global\linenumber\@@rnstart}}}% + \chardef\linenumberlocation\zerocount \processaction [\@@rnplaats] [ \v!inmarge=>\chardef\linenumberlocation1, @@ -140,40 +157,62 @@ \v!inrechter=>\chardef\linenumberlocation2, \v!marge=>\chardef\linenumberlocation1]% % \v!tekst=>\chardef\linenumberlocation0, - %\v!unknown=>\chardef\linenumberlocation0, - %\v!default=>\chardef\linenumberlocation0]% + %\s!unknown=>\chardef\linenumberlocation0, + %\s!default=>\chardef\linenumberlocation0]% \ifcase\linenumberlocation % text \advance\leftskip \@@rnbreedte\relax \fi - \ifinregels - \let\dostartnummeren=\dostartnummerenLINE - \let\stopregelnummeren=\dostopnummerenLINE - \def\schrijfregelnummer% + \chardef\@@rn@@rnmethod + \ifprocessingverbatim0\else\ifinregels1\else2\fi\fi + \processaction + [\@@rnmethode] + [ \v!type=>\chardef\@@rn@@rnmethod0, + \v!regel=>\chardef\@@rn@@rnmethod1, + \v!tekst=>\chardef\@@rn@@rnmethod2, + \v!file=>\chardef\@@rn@@rnmethod3]% + \ifcase\@@rn@@rnmethod % verbatim, line by line + \inregelstrue + \let\dostartnummeren\dostartnummerenVERB + \let\stopregelnummeren\dostopnummerenVERB + \def\schrijfregelnummer {\doschrijfregelnummer - \global\advance\linenumber 1\relax}% - \else - \let\dostartnummeren=\dostartnummerenPAR - \let\stopregelnummeren=\dostopnummerenPAR - \def\schrijfregelnummer% - {\global\advance\linenumber -1\relax + \global\advance\linenumber \plusone}% + \or % text, line by line + \let\dostartnummeren\dostartnummerenLINE + \let\stopregelnummeren\dostopnummerenLINE + \def\schrijfregelnummer + {\doschrijfregelnummer + \global\advance\linenumber \plusone}% + \or % text, whole lot + \let\dostartnummeren\dostartnummerenPAR + \let\stopregelnummeren\dostopnummerenPAR + \def\schrijfregelnummer + {\global\advance\linenumber \minusone + \doschrijfregelnummer}% + \or % verbatim, selective line by line + \inregelstrue + \let\dostartnummeren\dostartnummerenVERB + \let\stopregelnummeren\dostopnummerenVERB + \def\schrijfregelnummer + {\global\linenumber\verbatimlinenumber \doschrijfregelnummer}% \fi \dostartnummeren} -\def\startregelnummeren% +\def\startregelnummeren {\bgroup \the\beforeeverylinenumbering \inregelnummerentrue \complexorsimpleempty\startregelnummeren} -\def\doschrijfregelnummer% +\def\doschrijfregelnummer {\ifnum\linenumber<\@@rnstart\relax \else - \!!counta=\linenumber - \divide\!!counta by \@@rnstap\relax - \multiply\!!counta by \@@rnstap\relax + \!!counta\linenumber + \divide\!!counta \@@rnstap + \multiply\!!counta \@@rnstap\relax \ifnum\!!counta=\linenumber - \doattributes\??rn\c!letter\c!kleur{\dodoschrijfregelnummer}% + \doattributes\??rn\c!letter\c!kleur\dodoschrijfregelnummer \fi \fi} @@ -200,12 +239,12 @@ \def\inregel#1[#2]% {\doifelsenothing{#1} - {\doifinstringelse{--}{\currenttextreference} + {\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% +\def\dostartnummerenPAR {\beginofshapebox \doglobal\newcounter\linereference} @@ -247,51 +286,51 @@ \def\regelreferentie#1[#2]% {\bgroup \dimen0=\dp\strutbox - \doif{\@@rnrefereren}{\v!aan} + \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}% + \advance\dimen0 \linereference sp}% \prewordbreak \vrule \!!width \zeropoint \!!depth \dimen0 \!!height \zeropoint \prewordbreak \egroup} -\def\dostopnummerenPAR% dp's -> openstrutdepth +\def\dostopnummerenPAR % dp's -> openstrutdepth {\endofshapebox \checkreferences - \linestepper=0 - \reshapebox{\global\advance\linestepper 1\relax}% + \linestepper\zerocount + \reshapebox{\global\advance\linestepper \plusone}% \global\advance\linenumber \linestepper - \doifelse{\@@rnrefereren}{\v!aan} + \doifelse\@@rnrefereren\v!aan {\reshapebox % We are going back! - {\global\advance\linenumber by -1 + {\global\advance\linenumber \minusone \dimen0=\dp\shapebox \advance\dimen0 -\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} + \dostepwiserecurse\plusone{\number\dimen0}\plusone {\getlinereference\recurselevel \setlinereference\recurselevel {\linereferencename}{\the\linenumber}{\linereferenceplus}}% \fi}% \global\advance\linenumber \linestepper - \ifnum\linereference>0 % anders vreemde loop in paragraphs+recurse - \dorecurse{\linereference} + \ifnum\linereference>\zerocount % 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} + \dorecurse\linereference {\getlinereference\recurselevel \ifnum\linereferenceplus<2 % start / lone \ifnum\linereferenceplus=1 % start - \getreferenceelements{\linereferencename}% text = 4 + \getreferenceelements\linereferencename % text = 4 \ifnum\linereferenceline<0\currenttextreference\relax % 0 prevents error \edef\linereferenceline{\linereferenceline--\currenttextreference}% \fi @@ -299,30 +338,31 @@ \expanded{\setlocalcrossreference {\referenceprefix\linereferencename}{}{}{\linereferenceline}}% \fi}% - \global\let\scratchline=\linenumber % We are going back! + \global\let\scratchline\linenumber % We are going back! \reshapebox {\doglobal\decrement\scratchline \hbox - {\dorecurse{\linereference} + {\dorecurse\linereference {\getlinereference\recurselevel - \getreferenceelements{\linereferencename}% + \getreferenceelements\linereferencename \beforesplitstring\currenttextreference--\at--\to\firstline \ifnum\firstline=\scratchline\relax - % beter een rawtextreference - \textreference[\linereferencename]{\currenttextreference}% + % beter een rawtextreference, i.e. expanded + % \textreference[\linereferencename]{\currenttextreference}% + \rawtextreference\s!lin\linereferencename\currenttextreference \expanded{\setlocalcrossreference {\referenceprefix\linereferencename}{}{}{0}}% ==done \fi}% - \dimen0=\dp\shapebox + \dimen0\dp\shapebox \advance\dimen0 -\dp\strutbox\relax \ifdim\dimen0>\zeropoint - \dp\shapebox=\dp\strutbox + \dp\shapebox\dp\strutbox \fi \schrijfregelnummer\box\shapebox}}% no \strut ! \else \reshapebox{\hbox{\schrijfregelnummer\box\shapebox}}% no \strut ! \fi} - {\reshapebox{\global\advance\linenumber -1}% + {\reshapebox{\global\advance\linenumber \minusone}% \global\advance\linenumber \linestepper \reshapebox{\hbox{\schrijfregelnummer\box\shapebox}}}% no \strut ! \global\advance\linenumber \linestepper @@ -330,11 +370,17 @@ \the\aftereverylinenumbering \egroup} -\def\crlf +\unexpanded \def\crlf {\ifhmode\unskip\else\strut\fi\ifcase\raggedstatus\hfil\fi\break} \def\opeenregel {\def\crlf{\removelastspace\space}\let\\\crlf} + +\def\emptylines + {\dosingleempty\doemptylines} + +\def\doemptylines[#1]% + {\endgraf\dorecurse{\iffirstargument#1\else3\fi}\crlf} \newcount\internalparagraphnumber @@ -349,29 +395,186 @@ [\v!start=>\let\showparagraphnumber\doshowparagraphnumberA, \v!stop=>\let\showparagraphnumber\relax, \v!regel=>\let\showparagraphnumber\doshowparagraphnumberB, - \v!reset=>\global\internalparagraphnumber=0 + \v!reset=>\global\internalparagraphnumber\zerocount \let\showparagraphnumber\doshowparagraphnumberA]} -\def\dodoshowparagraphnumber% - {\global\advance\internalparagraphnumber 1 +\def\dodoshowparagraphnumber + {\global\advance\internalparagraphnumber \plusone \inleftmargin % \tf normalizes em {\tf{\doattributes\??ph\c!letter\c!kleur{\the\internalparagraphnumber}}% \kern\@@phafstand}} -\def\doshowparagraphnumberA% +\def\doshowparagraphnumberA {\ifprocessingverbatim \iflinepar\dodoshowparagraphnumber\fi \else \dodoshowparagraphnumber \fi} -\def\doshowparagraphnumberB% +\def\doshowparagraphnumberB {\ifinregelnummeren \doshowparagraphnumberA \fi} + +% new, to be documented + +\newcounter\linenotecounter +\newtoks \collectedlinenotes +\newif \iftracelinenotes + +\appendtoks + \the\collectedlinenotes +\to \everylinenumber + +\appendtoks + \global\collectedlinenotes\emptytoks +\to \beforeeverylinenumbering + +\def\handlelinenote#1#2% + {\bgroup + \expanded{\beforesplitstring#1}\at--\to\linenotelinenumber + \ifnum\linenotelinenumber=\linenumber\relax + % todo: \onlyfootnote{#1}{#2}% == configurable + \setupfootnotes[\c!nummercommando=\gobbleoneargument]% + \footnotetext{#1: #2}% + \fi + \egroup} + +\def\tracedlinenote#1% + {\iftracelinenotes + \hbox to \zeropoint + {\forgetall + \localcolortrue + \hsize\zeropoint + \hss + \vbox to \strutheight{\llap{\red\infofont\setstrut\linenotecounter}\vss}% + {\blue\vl}% + \vbox to \strutheight{\rlap{\red\infofont\setstrut#1}\vss}% + \hss}% + \prewordbreak + \fi} +\def\linenote#1% + {\doglobal\increment\linenotecounter + \doifreferencefoundelse{\??rr:\linenotecounter}% + {\doglobal\@EA\appendtoks\@EA\handlelinenote\@EA + {\currenttextreference}{#1}\to\collectedlinenotes} + \donothing + \tracedlinenote\empty + \expanded{\eenregel[\??rr:\linenotecounter]}} + +\def\startlinenote[#1]#2% + {\doifreferencefoundelse{\??rr:#1}% + {\doglobal\@EA\appendtoks\@EA\handlelinenote\@EA + {\currenttextreference}{#2}\to\collectedlinenotes} + \donothing + \tracedlinenote{#1}% + \startregel[\??rr:#1]} + +\def\stoplinenote[#1]% + {\stopregel[\??rr:#1]} + +% \startbuffer[test] +% \startlinenumbering[100] +% test \linenote {oeps} test test test test test test +% test \startlinenote [well] {oeps} test test test test test test +% test \linenote {oeps} test test test test test test +% test \linenote {oeps} test test test test test test +% test \linenote {oeps} test test test test test test +% test \linenote {oeps} test test test test test test +% test \stoplinenote [well] test test test test test test +% \stoplinenumbering +% \stopbuffer +% +% {\typebuffer[test] \getbuffer[test]} \page +% +% \startbuffer[setup] +% \setuplinenumbering +% [align=left] +% \stopbuffer +% +% {\typebuffer[setup] \getbuffer[setup,test]} \page +% +% \startbuffer[setup] +% \setuplinenumbering +% [width=1em, +% align=left] +% \stopbuffer +% +% {\typebuffer[setup] \getbuffer[setup,test]} \page +% +% \startbuffer[setup] +% \setuplinenumbering +% [width=2em, +% distance=.5em, +% align=left] +% \stopbuffer +% +% {\typebuffer[setup] \getbuffer[setup,test]} \page +% +% \startbuffer[setup] +% \setuplinenumbering +% [width=2em, +% align=middle] +% \stopbuffer +% +% {\typebuffer[setup] \getbuffer[setup,test]} \page +% +% \startbuffer[setup] +% \setuplinenumbering +% [conversion=romannumerals, +% start=1, +% step=1, +% location=text, +% style=slanted, +% color=blue, +% width=1.5em] +% \stopbuffer +% +% {\typebuffer[setup] \startnarrower\getbuffer[setup,test]\stopnarrower} \page +% +% \startbuffer[setup] +% \setuplinenumbering +% [width=4em, +% left=--, +% right=--, +% align=middle] +% \stopbuffer +% +% {\typebuffer[setup] \getbuffer[setup,test]} \page +% +% \startbuffer[setup-1] +% \setuplinenumbering +% [style=\bfxx, +% command=\WatchThis] +% \stopbuffer +% +% \startbuffer[setup-2] +% \def\WatchThis#1% +% {\ifodd\linenumber +% \definecolor[linecolor][red]% +% \else +% \definecolor[linecolor][green]% +% \fi +% \inframed +% [offset=1pt,frame=off,background=color,backgroundcolor=linecolor] +% {#1}} +% \stopbuffer +% +% {\typebuffer[setup-1,setup-2] \getbuffer[setup-1,setup-2,test]} \page +% +% \startbuffer[setup-1] +% \setuplinenumbering +% [location=inright, +% style=\bfxx, +% command=\WatchThis] +% \stopbuffer +% +% {\typebuffer[setup-1] \getbuffer[setup-1,setup-2,test]} \page + \stelregelnummerenin - [\c!conversie=\v!cijfers, + [\c!methode=, + \c!conversie=\v!cijfers, \c!start=1, \c!stap=1, \c!plaats=\v!marge, @@ -381,6 +584,16 @@ \c!prefix=, \c!refereren=\v!aan] +% new + +\stelregelnummerenin + [\c!breedte=\ifcase\linenumberlocation2em\else\v!marge\fi, + \c!links=, + \c!rechts=, + \c!commando=, + \c!afstand=\zeropoint, + \c!uitlijnen=\ifcase\linenumberlocation\v!rechts\or\v!rechts\or\v!links\fi] + \stelparagraafnummerenin [\c!status=\v!stop, \c!letter=, diff --git a/tex/context/base/page-log.tex b/tex/context/base/page-log.tex index 66feb39f5..39686727f 100644 --- a/tex/context/base/page-log.tex +++ b/tex/context/base/page-log.tex @@ -106,7 +106,7 @@ \setlogoboxes \global\chardef\logostatus2 \fi - \setbox#1=\vbox + \setbox#1\vbox {\offinterlineskip \doifmarginswapelse {\copy\leftlogos} @@ -128,15 +128,15 @@ \newbox\leftlogos \newbox\rightlogos -\def\setlogoboxes% - {\showmessage{\m!layouts}{7}\empty +\def\setlogoboxes + {\showmessage\m!layouts7\empty \dosetlogobox\leftlogos\relax \ifdubbelzijdig \dosetlogobox\rightlogos\doswapmargins \fi} \def\dosetlogobox#1#2% - {\global\setbox#1=\vbox to \papierhoogte + {\global\setbox#1\vbox to \papierhoogte {\dontcomplain % needed here ? \calculatereducedvsizes % needed here ? \offinterlineskip @@ -162,9 +162,9 @@ {\def\docommando##1% {\donefalse \ifnum\logostatus=3 \ExpandBothAfter - \doifinset{\getvalue{\??lo#1##1}}{\requestedlogos}\donetrue + \doifinset{\getvalue{\??lo#1##1}}\requestedlogos\donetrue \else - \doifvalue{\??lo#1##1\c!status}{\v!start}\donetrue + \doifvalue{\??lo#1##1\c!status}\v!start\donetrue \fi \ifdone #2{\hbox{\getvalue{\??lo#1##1\c!commando}}}% @@ -221,16 +221,16 @@ {\addtocommalist{#1}\definedlogos \long\setvalue{\??lo#2#3}{#1}% \getparameters[\??lo#2#3][#4]% - \global\chardef\logostatus=2 } + \global\chardef\logostatus2 } -\def\definelogo% +\def\definelogo {\doquadrupleargument\dodefinelogo} -\def\placelogos% +\def\placelogos {\dosingleempty\doplacelogos} \def\doplacelogos[#1]% {\xdef\requestedlogos{\iffirstargument#1\else\definedlogos\fi}% - \global\chardef\logostatus=3 } + \global\chardef\logostatus3 } \protect \endinput diff --git a/tex/context/base/page-lyr.tex b/tex/context/base/page-lyr.tex index ffad4d540..8a06c3c2f 100644 --- a/tex/context/base/page-lyr.tex +++ b/tex/context/base/page-lyr.tex @@ -30,7 +30,7 @@ \ifx\undefined\defineoverlay \message{loaded to early} \wait \fi -\def\defineoverlay% +\def\defineoverlay {\dotripleempty\dodefineoverlay} \def\dodefineoverlay[#1][#2][#3]% overlay [layer] content @@ -69,36 +69,20 @@ \def\definelayer {\dodoubleargument\dodefinelayer} -% \def\dodefinelayer[#1][#2]% -% {\ifundefined{\@@layerbox#1}% -% \expandafter\newbox\csname\@@layerbox#1\endcsname -% \else -% \resetlayer[#1]% -% \fi -% \defineoverlay -% [#1][\composedlayer{#1}]% -% \setuplayer -% [#1] -% [\c!status=\v!start,\c!richting=\v!normaal,\c!optie=, -% \c!x=\!!zeropoint,\c!y=\!!zeropoint,\c!positie=\v!nee, -% \c!breedte=\wd\nextbox,\c!hoogte=\ht\nextbox, -% \c!offset=\!!zeropoint,\c!rotatie=, % geen 0 ! -% \c!hoffset=\!!zeropoint,\c!voffset=\!!zeropoint, -% \c!plaats=rb,\c!positie=\v!nee,\c!pagina=, -% \c!sx=1,\c!sy=1,\c!hoek=,#2]} - \def\dodefinelayer[#1][#2]% {\setuplayer [#1] - [\c!dubbelzijdig=, + [\c!dubbelzijdig=,\c!preset=, \c!status=\v!start,\c!richting=\v!normaal,\c!optie=, \c!x=\!!zeropoint,\c!y=\!!zeropoint,\c!positie=\v!nee, - \c!breedte=\wd\nextbox,\c!hoogte=\ht\nextbox, + \c!regel=0,\c!kolom=0, + \c!breedte=\nextboxwd,\c!hoogte=\nextboxht, \c!offset=\!!zeropoint,\c!rotatie=, % geen 0 ! \c!hoffset=\!!zeropoint,\c!voffset=\!!zeropoint, \c!plaats=rb,\c!positie=\v!nee,\c!pagina=, + \c!methode=\v!overlay, \c!sx=1,\c!sy=1,\c!hoek=,#2]% - \doifvalue{\??ll#1\v!dubbelzijdig}\v!ja + \doifvalue{\??ll#1\c!dubbelzijdig}\v!ja {\dopresetlayerbox{\v!links #1}% \dopresetlayerbox{\v!rechts#1}}% \dopresetlayerbox{#1}% @@ -117,7 +101,7 @@ %D After a layer is defined, you can change its %D characteristics. -\def\setuplayer% +\def\setuplayer {\dodoubleargument\dosetuplayer} \def\dosetuplayer[#1][#2]% @@ -138,30 +122,6 @@ \def\currentlayerdata{0} -% \def\setlayer -% {\dodoubleargument\dosetlayer} -% -% \def\dosetlayer[#1][#2]% -% {\doifnotvalue{\??ll#1\c!status}{\v!stop}{\dodosetlayer[#1][#2]}} -% -% \def\dodosetlayer[#1][#2]% -% {\bgroup -% \recalculatebackgrounds -% \recalculatelogos -% \doglobal\increment\currentlayerdata -% \forgetall -% \dontcomplain -% \doifvalue{\??ll#1\c!optie}{\v!test} -% {\traceboxplacementtrue\tracelayerstrue}% -% \dowithnextbox % sneller als aparte macro -% {\ifundefined{\@@layerbox#1}% -% \writestatus{layer}{unknown layer #1}% -% \else -% \dododosetlayer[#1][#2]% -% \fi -% \egroup} -% \hbox} - \def\setlayer {\dotripleempty\dosetlayer} @@ -179,8 +139,8 @@ \doglobal\increment\currentlayerdata \forgetall \dontcomplain - \doifvalue{\??ll#1\c!optie}\v!test - {\traceboxplacementtrue\tracelayerstrue}% + \doifvalue{\??ll#1\c!optie}\v!test\tracelayerstrue + \iftracelayers\traceboxplacementtrue\fi \dowithnextbox % sneller als aparte macro {\ifundefined{\@@layerbox#1}% \writestatus{layer}{unknown layer #1}% @@ -210,175 +170,147 @@ \advance\scratchdimen-\MPy{lyr:\currentlayerdata}% \xdef\lastlayerypos{\the\scratchdimen}} -% \def\dododosetlayer[#1][#2]% will be sped up -% {\getparameters[\??ll#1][#2]% -% \doifvalue{\??ll#1\c!positie}\v!overlay % slow -% {\getparameters[\??ll#1] -% [\c!breedte=\!!zeropoint, -% \c!hoogte=\!!zeropoint, -% \c!positie=\v!ja]}% -% \doifvaluesomething{\??ll#1\c!rotatie} -% {\setbox\nextbox\hbox -% {\rotate -% [\c!plaats=\v!hoog, -% \c!rotatie=\getvalue{\??ll#1\c!rotatie}] -% {\box\nextbox}}}% -% \@@layerxsiz\getvalue{\??ll#1\c!breedte}% -% \@@layerysiz\getvalue{\??ll#1\c!hoogte }% -% \@@layerxpos\getvalue{\??ll#1\c!x}% -% \@@layerypos\getvalue{\??ll#1\c!y}% -% \doifelsevalue{\??ll#1\c!hoffset}\v!max -% {\@@layerxoff\@@layerxsiz} -% {\@@layerxoff\getvalue{\??ll#1\c!hoffset}}% -% \doifelsevalue{\??ll#1\c!voffset}\v!max -% {\@@layeryoff\@@layerysiz} -% {\@@layeryoff\getvalue{\??ll#1\c!voffset}}% -% \advance\@@layerxoff \getvalue{\??ll#1\c!offset}% -% \advance\@@layeryoff \getvalue{\??ll#1\c!offset}% -% \@@layerxpos\getvalue{\??ll#1\c!sx}\@@layerxpos -% \@@layerypos\getvalue{\??ll#1\c!sy}\@@layerypos -% \@@layerxoff\getvalue{\??ll#1\c!sx}\@@layerxoff -% \@@layeryoff\getvalue{\??ll#1\c!sy}\@@layeryoff -% \doifelsevalue{\??ll#1\c!positie}{\v!ja} % combine ^ -% {\setlastlayerpos{#1}% -% \@@layerxpos\lastlayerxpos -% \@@layerypos\lastlayerypos -% \setxvalue{\??ll#1\layerpage\c!positie}{\v!ja}% -% \setxvalue{\??ll#1\c!status}{\v!start}% needed ? -% \setbox\layerbox\vbox to \@@layerysiz -% {\hbox to \@@layerxsiz{\xypos{lyr:\currentlayerdata}\hss}\vss}} -% {\setbox\layerbox=\emptybox -% \global\let\lastlayerxpos\!!zeropoint -% \global\let\lastlayerypos\!!zeropoint -% \ExpandBothAfter\doifinset{\v!onder}{\getvalue{\??ll#1\c!hoek}} -% {\ifdim\@@layerysiz>\zeropoint -% \advance\@@layerypos-\@@layerysiz -% \@@layerypos-\@@layerypos -% \@@layeryoff-\@@layeryoff -% \fi}% -% \ExpandBothAfter\doifinset{\v!rechts}{\getvalue{\??ll#1\c!hoek}} -% {\ifdim\@@layerxsiz>\zeropoint -% \advance\@@layerxpos-\@@layerxsiz -% \@@layerxpos-\@@layerxpos -% \@@layerxoff-\@@layerxoff -% \fi}% -% \edef\layerpage{\getvalue{\??ll#1\c!pagina}}}% -% \doifsomething{\layerpage} -% {\edef\layerpage{:\layerpage}% -% \doifundefined{\@@layerbox#1\layerpage} -% {\global\expandafter\newbox\csname\@@layerbox#1\layerpage\endcsname}}% -% \global\setbox\csname\@@layerbox#1\layerpage\endcsname=\vbox -% {\offinterlineskip -% \hsize\getvalue{\??ll#1\c!breedte}% new, keep box small -% \ifvoid\csname\@@layerbox#1\layerpage\endcsname\else -% \ht\csname\@@layerbox#1\layerpage\endcsname\zeropoint -% \dp\csname\@@layerbox#1\layerpage\endcsname\zeropoint -% \wd\csname\@@layerbox#1\layerpage\endcsname\zeropoint -% \doifnotvalue{\??ll#1\c!richting}{\v!omgekeerd} -% {\box\csname\@@layerbox#1\layerpage\endcsname}% -% \fi -% \setbox\nextbox=\hbox -% {\alignedbox[\getvalue{\??ll#1\c!plaats}]\vbox{\box\nextbox}}% -% \smashbox\nextbox -% \vskip\@@layerypos -% \vskip\@@layeryoff -% \hskip\@@layerxpos -% \hskip\@@layerxoff -% \box\nextbox -% \ifvoid\csname\@@layerbox#1\layerpage\endcsname -% % already flushed -% \else -% % the reverse case % check ! -% \vskip-\@@layerypos -% \vskip-\@@layeryoff -% \box\csname\@@layerbox#1\layerpage\endcsname -% \fi}% -% \ifvoid\layerbox\else\box\layerbox\fi} +\def\definelayerpreset + {\dodoubleargument\dodefinelayerpreset} + +\def\dodefinelayerpreset[#1][#2]% + {\setvalue{\??ll\??ll#1}{\dopresetlayer{#2}}} + +\def\dopresetlayer#1#2#3% #1=list #2=tag #3=list + {\getparameters[\??ll#2][#1,#3]} + +\letempty\currentlayer + +\def\layerparameter#1{\csname\??ll\currentlayer#1\endcsname} \def\dododosetlayer[#1][#2][#3]% will be sped up - {\getparameters[\??ll#1][#3]% + {% we use the global width, never change this + \def\currentlayer{#1}% + \@@layerxsiz\layerparameter\c!breedte + \@@layerysiz\layerparameter\c!hoogte + % preroll + \getparameters[\??ll#1][#3]% + % presets and real roll + \doifdefined{\??ll\??ll\layerparameter\c!preset} + {\getvalue{\??ll\??ll\layerparameter\c!preset}{#1}{#3}}% + % that was real slow \doifvalue{\??ll#1\c!positie}\v!overlay % slow {\getparameters[\??ll#1] - [\c!breedte=\!!zeropoint, - \c!hoogte=\!!zeropoint, + [\c!breedte=\zeropoint, + \c!hoogte=\zeropoint, \c!positie=\v!ja]}% \doifvaluesomething{\??ll#1\c!rotatie} {\setbox\nextbox\hbox {\rotate [\c!plaats=\v!hoog, - \c!rotatie=\getvalue{\??ll#1\c!rotatie}] - {\box\nextbox}}}% - \@@layerxsiz\getvalue{\??ll#1\c!breedte}% - \@@layerysiz\getvalue{\??ll#1\c!hoogte }% - \@@layerxpos\getvalue{\??ll#1\c!x}% - \@@layerypos\getvalue{\??ll#1\c!y}% + \c!rotatie=\layerparameter\c!rotatie] + {\flushnextbox}}}% + % no, not local + % \@@layerxsiz\layerparameter\c!breedte + % \@@layerysiz\layerparameter\c!hoogte + % never change that + \@@layerxpos\layerparameter\c!x + \@@layerypos\layerparameter\c!y \doifelsevalue{\??ll#1\c!hoffset}\v!max {\@@layerxoff\@@layerxsiz} - {\@@layerxoff\getvalue{\??ll#1\c!hoffset}}% + {\@@layerxoff\layerparameter\c!hoffset}% \doifelsevalue{\??ll#1\c!voffset}\v!max {\@@layeryoff\@@layerysiz} - {\@@layeryoff\getvalue{\??ll#1\c!voffset}}% - \advance\@@layerxoff \getvalue{\??ll#1\c!offset}% - \advance\@@layeryoff \getvalue{\??ll#1\c!offset}% - \@@layerxpos\getvalue{\??ll#1\c!sx}\@@layerxpos - \@@layerypos\getvalue{\??ll#1\c!sy}\@@layerypos - \@@layerxoff\getvalue{\??ll#1\c!sx}\@@layerxoff - \@@layeryoff\getvalue{\??ll#1\c!sy}\@@layeryoff - \doifelsevalue{\??ll#1\c!positie}{\v!ja} % combine ^ + {\@@layeryoff\layerparameter\c!voffset}% + \advance\@@layerxoff\layerparameter\c!offset + \advance\@@layeryoff\layerparameter\c!offset + \@@layerxpos\layerparameter\c!sx\@@layerxpos + \@@layerypos\layerparameter\c!sy\@@layerypos + \@@layerxoff\layerparameter\c!sx\@@layerxoff + \@@layeryoff\layerparameter\c!sy\@@layeryoff + \doifelsevalue{\??ll#1\c!positie}\v!ja % combine ^ {\setlastlayerpos{#2#1}% todo l/r %%%%%%%%%%%% \@@layerxpos\lastlayerxpos \@@layerypos\lastlayerypos - \setxvalue{\??ll#1\layerpage\c!positie}{\v!ja}% - \setxvalue{\??ll#1\c!status}{\v!start}% needed ? + \letgvalue{\??ll#1\layerpage\c!positie}\v!ja + \letgvalue{\??ll#1\c!status}\v!start % needed ? \setbox\layerbox\vbox to \@@layerysiz {\hbox to \@@layerxsiz{\xypos{lyr:\currentlayerdata}\hss}\vss}} {\setbox\layerbox\emptybox - \global\let\lastlayerxpos\!!zeropoint - \global\let\lastlayerypos\!!zeropoint - \ExpandBothAfter\doifinset{\v!onder}{\getvalue{\??ll#1\c!hoek}} - {\ifdim\@@layerysiz>\zeropoint + \globallet\lastlayerxpos\!!zeropoint + \globallet\lastlayerypos\!!zeropoint + \ExpandBothAfter\doifinset\v!onder{\layerparameter\c!hoek} + {\ifnum\layerparameter\c!regel=\zerocount\else % can be < 0 + \scratchcounter\layerparameter\c!regel + \scratchcounter-\scratchcounter + \advance\scratchcounter\layoutlines + \advance\scratchcounter\plusone + \setevalue{\??ll#1\c!regel}{\the\scratchcounter}% + \fi + \ifdim\@@layerysiz>\zeropoint \advance\@@layerypos-\@@layerysiz \@@layerypos-\@@layerypos \@@layeryoff-\@@layeryoff \fi}% - \ExpandBothAfter\doifinset{\v!rechts}{\getvalue{\??ll#1\c!hoek}} - {\ifdim\@@layerxsiz>\zeropoint + \ExpandBothAfter\doifinset\v!rechts{\layerparameter\c!hoek} + {\ifnum\layerparameter\c!kolom=\zerocount\else % can be < 0 + \scratchcounter\layerparameter\c!kolom + \scratchcounter-\scratchcounter + \advance\scratchcounter \layoutcolumns + \advance\scratchcounter \plusone + \setevalue{\??ll#1\c!kolom}{\the\scratchcounter}% + \fi + \ifdim\@@layerxsiz>\zeropoint \advance\@@layerxpos-\@@layerxsiz \@@layerxpos-\@@layerxpos \@@layerxoff-\@@layerxoff \fi}% - \ExpandBothAfter\doif{\v!midden}{\getvalue{\??ll#1\c!hoek}} + \ExpandBothAfter\doif\v!midden{\layerparameter\c!hoek} {\ifdim\@@layerxsiz>\zeropoint \advance\@@layerxpos.5\@@layerxsiz \fi \ifdim\@@layerysiz>\zeropoint \advance\@@layerypos.5\@@layerysiz \fi}% - \edef\layerpage{\getvalue{\??ll#1\c!pagina}}}% - \doifsomething{\layerpage} + \edef\layerpage{\layerparameter\c!pagina}}% + \doifsomething\layerpage {\edef\layerpage{:\layerpage}% \doifundefined{\@@layerbox#2#1\layerpage} {\global\expandafter\newbox\csname\@@layerbox#2#1\layerpage\endcsname}}% -\dontcomplain + \dontcomplain % more comfortable \global\setbox\csname\@@layerbox#2#1\layerpage\endcsname\vbox -to \getvalue{\??ll#1\c!hoogte}% new, otherwise no negative y possible + to \layerparameter\c!hoogte % new, otherwise no negative y possible {\offinterlineskip - \hsize\getvalue{\??ll#1\c!breedte}% new, keep box small + \hsize\layerparameter\c!breedte % new, keep box small \ifvoid\csname\@@layerbox#1\layerpage\endcsname\else \ht\csname\@@layerbox#2#1\layerpage\endcsname\zeropoint \dp\csname\@@layerbox#2#1\layerpage\endcsname\zeropoint \wd\csname\@@layerbox#2#1\layerpage\endcsname\zeropoint - \doifnotvalue{\??ll#1\c!richting}{\v!omgekeerd} + \doifnotvalue{\layerparameter\c!richting}\v!omgekeerd {\box\csname\@@layerbox#2#1\layerpage\endcsname}% \fi - \setbox\nextbox=\hbox - {\alignedbox[\getvalue{\??ll#1\c!plaats}]\vbox{\box\nextbox}}% +\doifelsevalue{\??ll#1\c!plaats}\v!grid\donetrue\donefalse +\ifdone + \nextboxht\strutheight + \nextboxdp\strutdepth +\else + \setbox\nextbox\hbox + {\alignedbox[\layerparameter\c!plaats]\vbox{\flushnextbox}}% +\fi + \ifnum\layerparameter\c!regel=\zerocount\else % no \ifcase, can be negative + \advance\@@layerypos \layerparameter\c!regel\lineheight + \advance\@@layerypos \topskip + \advance\@@layerypos-\lineheight + \advance\@@layerypos-\nextboxht + \fi + \ifnum\layerparameter\c!kolom=\zerocount\else % no \ifcase, can be negative + \advance\@@layerxpos \layoutcolumnoffset{\layerparameter\c!kolom}% + \fi +\ifdone + \setbox\nextbox\hbox + {\alignedbox[rb]\vbox{\flushnextbox}}% +\fi \smashbox\nextbox \vskip\@@layerypos \vskip\@@layeryoff \hskip\@@layerxpos \hskip\@@layerxoff - \box\nextbox + \flushnextbox \ifvoid\csname\@@layerbox#2#1\layerpage\endcsname % already flushed \else @@ -433,7 +365,7 @@ to \getvalue{\??ll#1\c!hoogte}% new, otherwise no negative y possible % \fi} \unexpanded\def\flushlayer[#1]% - {\doifelsevalue{\??ll#1\v!dubbelzijdig}\v!ja + {\doifelsevalue{\??ll#1\c!dubbelzijdig}\v!ja {\doifundefinedelse{\@@layerbox#1}% {\dodoflushlayerA[#1]} {\doifbothsidesoverruled @@ -465,12 +397,14 @@ to \getvalue{\??ll#1\c!hoogte}% new, otherwise no negative y possible {\ifundefined{\@@layerbox#3}% \ifcase#1\else\writestatus{layer}{unknown layer #3}\fi \else - \doifvalue{\??ll#2\c!optie}\v!test - {\traceboxplacementtrue\tracelayerstrue}% - \iftracelayers \ruledvbox \else \vbox \fi to \overlayheight + \doifvalue{\??ll#2\c!optie}\v!test\tracelayerstrue + \iftracelayers\traceboxplacementtrue\fi + \doifelsevalue{\??ll#2\c!methode}\v!tekst\donetrue\donefalse + \iftracelayers \ruledvbox \else \vbox \fi \ifdone \else to \overlayheight \fi {\forgetall - \hbox to \overlaywidth - {\doifvalue{\??ll#3\realfolio\c!positie}\v!ja + \hbox \ifdone \else to \overlaywidth \fi + {% klopt dit? #3 en niet #2 ? + \doifvalue{\??ll#3\realfolio\c!positie}\v!ja {\xypos{lyr:#3:\realfolio}}% \let\next\box \ifcase#1\else @@ -492,6 +426,8 @@ to \getvalue{\??ll#1\c!hoogte}% new, otherwise no negative y possible \def\composedlayer#1{\flushlayer[#1]} +\let\placelayer\flushlayer + %D \macros %D {resetlayer} %D @@ -504,7 +440,11 @@ to \getvalue{\??ll#1\c!hoogte}% new, otherwise no negative y possible \fi} \def\resetlayer[#1]% - {\doresetlayer{#1}\doresetlayer{#1:\realfolio}} + {\doresetlayer{#1}% + \doifvalue{\??ll#1\c!dubbelzijdig}\v!ja % kind of redundant test + {\doresetlayer{\v!links #1}% + \doresetlayer{\v!rechts#1}}% + \doresetlayer{#1:\realfolio}} %D \macros %D {setMPlayer} @@ -537,7 +477,7 @@ to \getvalue{\??ll#1\c!hoogte}% new, otherwise no negative y possible %D {\useMPgraphic{oeps}} %D \stoptypen -\def\setMPlayer% +\def\setMPlayer {\dotripleempty\dosetMPlayer} \def\MPlayerwidth {\hsize} @@ -566,7 +506,7 @@ to \getvalue{\??ll#1\c!hoogte}% new, otherwise no negative y possible \newbox\positionbox -\def\startpositioning% +\def\startpositioning {\bgroup \xposition \zeropoint \yposition \zeropoint \xdimension\zeropoint \ydimension\zeropoint @@ -574,7 +514,7 @@ to \getvalue{\??ll#1\c!hoogte}% new, otherwise no negative y possible \hfuzz \papierbreedte \vfuzz \papierhoogte \setbox\positionbox\hbox\bgroup} -\def\stoppositioning% +\def\stoppositioning {\doifnot\@@psoffset\v!ja {\global\xoffset\zeropoint \global\yoffset\zeropoint}% @@ -611,20 +551,20 @@ to \getvalue{\??ll#1\c!hoogte}% new, otherwise no negative y possible \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% + \scratchskip#8\scratchskip + \scratchskip#9\scratchskip + \advance\scratchskip #4\relax + \doif{#2}\v!relatief + {\advance\scratchskip #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% + #3\scratchskip\relax + \doifnot\@@psstatus\v!overlay + {\scratchskip#5\relax + \advance\scratchskip #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)% @@ -633,22 +573,22 @@ to \getvalue{\??ll#1\c!hoogte}% new, otherwise no negative y possible \getparameters[\??ps][#1]% \dontcomplain \calculateposition{#3}\@@psxstap\xposition - \@@psxoffset{\wd\nextbox}\xdimension\xoffset + \@@psxoffset{\nextboxwd}\xdimension\xoffset \@@psxschaal\@@psxfactor - \scratchdimen=\ht\nextbox \advance\scratchdimen by \dp\nextbox + \scratchdimen\nextboxht \advance\scratchdimen \nextboxdp \calculateposition{#4}\@@psystap\yposition \@@psyoffset\scratchdimen\ydimension\yoffset \@@psyschaal\@@psyfactor - \vbox to \!!zeropoint % kan beter. + \vbox to \zeropoint % kan beter. {\vskip\yposition - \hbox to \!!zeropoint + \hbox to \zeropoint {\hskip\xposition - \box\nextbox + \flushnextbox \hss} \vss}% \xdef\dopoppositioning% - {\xposition=\the\xposition - \yposition=\the\yposition + {\xposition\the\xposition + \yposition\the\yposition \noexpand\def\noexpand\@@psxoffset{\@@psxoffset}% \noexpand\def\noexpand\@@psyoffset{\@@psyoffset}}% \egroup diff --git a/tex/context/base/page-mak.tex b/tex/context/base/page-mak.tex index b10562679..2643292fa 100644 --- a/tex/context/base/page-mak.tex +++ b/tex/context/base/page-mak.tex @@ -34,7 +34,7 @@ %D \showsetup{\y!setupmakeup} %D \showsetup{\y!startmakeup} -\def\definemakeup% +\def\definemakeup {\dodoubleargument\dodefinemakeup} \def\dodefinemakeup[#1][#2]% @@ -63,7 +63,7 @@ \setvalue{\e!start#1\e!opmaak}{\startmakeup[#1]}% \setvalue{\e!stop #1\e!opmaak}{\stopmakeup}} -\def\setupmakeup% +\def\setupmakeup {\dodoubleargument\dosetupmakeup} \def\dosetupmakeup[#1]% @@ -83,7 +83,7 @@ \let\currentmakeup\empty -\def\startmakeup% +\def\startmakeup {\dodoubleempty\dostartmakeup} \def\dostartmakeup[#1][#2]% @@ -101,13 +101,14 @@ %D The simple case: -\def\donostartmakeup% +\def\donostartmakeup {\pagina \setupheader[\c!status=\v!leeg]% \setupfooter[\c!status=\v!leeg]% + \setsystemmode\v!opmaak \vbox to \teksthoogte\bgroup\hsize\tekstbreedte} -\def\donostopmakeup% +\def\donostopmakeup {\egroup \flushmarks % new, here, else empty pages \pagina @@ -117,14 +118,15 @@ \newbox\makeupbox -\def\dodostartmakeup% +\def\dodostartmakeup {\doifvaluesomething{\??do\currentmakeup\c!pagina} {\ExpandFirstAfter\pagina[\makeupparameter\c!pagina]} \soortpagina[\currentmakeup] + \setsystemmode\v!opmaak \setupmakeuplayout \makeupparameter\c!commandos -\startregistercolor[\makeupparameter\c!kleur]% - \global\setbox\makeupbox=\vbox to \makeupparameter\c!hoogte + \startregistercolor[\makeupparameter\c!kleur]% + \global\setbox\makeupbox\vbox to \makeupparameter\c!hoogte \bgroup \forgetall \hsize\makeupparameter\c!breedte @@ -132,7 +134,7 @@ {\expanded{\steluitlijnenin[\makeupparameter\c!uitlijnen]}}% \makeupparameter\c!boven} -\def\dodostopmakeup% +\def\dodostopmakeup {\endgraf \makeupparameter\c!onder \egroup @@ -159,7 +161,7 @@ \global\geselecteerdfalse \fi} -\def\doshipoutmakeup% +\def\doshipoutmakeup {\pushmacro\@@pnstatus % new \makeupparameter\c!voor \vbox{\hbox{\color[\makeupparameter\c!kleur]{\box\makeupbox}}}% @@ -174,7 +176,7 @@ \pagina, % \verlaagpaginanummer, % new \v!leeg=>\setupmakeuplayout - \pagebodyornamentsfalse + \global\pagebodyornamentsfalse \null\pagina]% % \verlaagpaginanummer]% % new \fi \fi @@ -185,7 +187,7 @@ %D by setting their associated status variables. The %D connection between them is made by the following macro -\def\setupmakeuplayout% +\def\setupmakeuplayout {\setupfooter[\c!status=\makeupparameter\c!voetstatus ]% \setupheader[\c!status=\makeupparameter\c!hoofdstatus]% \setuptext [\c!status=\makeupparameter\c!tekststatus]% diff --git a/tex/context/base/page-mar.tex b/tex/context/base/page-mar.tex index 117548a56..442de4a35 100644 --- a/tex/context/base/page-mar.tex +++ b/tex/context/base/page-mar.tex @@ -69,12 +69,12 @@ {\ifcase\margetekstnummer\relax \def\margetekstnummer{#2}% \fi} - {}% + \donothing \doifnumberelse\margetekstnummer {\ifnum\margetekstnummer>25 % to be translated - \writestatus{\m!systems}{potential margin stack overflow (\margetekstnummer)}% + \writestatus\m!systems{potential margin stack overflow (\margetekstnummer)}% \fi} - {}% + \donothing \processaction [\getvalue{\??im\margetekstnummer\c!uitlijnen}] [ \v!ja=>\setvalue{\??im\margetekstnummer\c!uitlijnen}{#2}, @@ -85,64 +85,60 @@ \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 + \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}% + \dostartattributes{\??im\margetekstnummer}\c!letter\c!kleur\empty + \dorecurse\margetekstregels{\strut\\}% + \xdef\margestrutheight{\the\ht\strutbox}% + \begstrut#6\endstrut\endgraf + \dostopattributes \@@imna}% - \ht0=\ht\strutbox + \ht0\ht\strutbox \box0 \egroup #5\relax} -\def\plaatsmargetekstscheider% - {\ifnum\margincontent>0 +\def\plaatsmargetekstscheider + {\ifnum\margincontent>\zerocount \bgroup \dimen0=\margetekstregels\lineheight - \advance\dimen0 by -\lineheight + \advance\dimen0 -\lineheight \lower\dimen0\hbox{\margetekstscheider}% \egroup \fi} \def\linkermargetekstblok#1% - {\maakmargetekstblok - {\linkermargebreedte} - {\v!links}{\v!rechts} + {\maakmargetekstblok \leftmargintextwidth \v!links \v!rechts {\llap{\plaatsmargetekstscheider}}{\hskip\margetekstafstand} {#1}} \def\rechtermargetekstblok#1% - {\maakmargetekstblok - {\rechtermargebreedte} - {\v!rechts}{\v!links} + {\maakmargetekstblok \rightmargintextwidth \v!rechts \v!links {\hskip\margetekstafstand}{\rlap{\plaatsmargetekstscheider}} {#1}} \def\doplacemargintext#1#2#3% {\strut - \setbox0=\hbox{#1}% - \dimen0=\ht0 - \advance\dimen0 by \dp0 + \setbox0\hbox{#1}% + \dimen0\ht0 + \advance\dimen0 \dp0 \ifdim\dimen0>\marginheight - \global\marginheight=\dimen0 + \global\marginheight\dimen0 \fi - \setbox0=\hbox + \setbox0\hbox {#2{\hskip#3\strut \iflowinmargin\else - \dimen0=\dp\strutbox - \advance\dimen0 by \margestrutheight - \advance\dimen0 by -\ht\strutbox + \dimen0\dp\strutbox + \advance\dimen0 \margestrutheight + \advance\dimen0 -\ht\strutbox \raise\dimen0 \fi \box0}}% - \ht0=\!!zeropoint - \dp0=\!!zeropoint + \ht0\zeropoint + \dp0\zeropoint \gdef\margestrutheight{\the\ht\strutbox}% %\graphicvadjust{\box0}} % fails in high math lines, let it be %\hbox{\lower\dp\strutbox\box0}} % alas, wrong lapping, therefore useless @@ -164,14 +160,20 @@ \def\dopositionmarginbox#1{\graphicvadjust{\box#1}} \fi +\def\leftmargintextdistance {\getvalue{\??im\v!links \c!afstand}} +\def\rightmargintextdistance {\getvalue{\??im\v!rechts\c!afstand}} + +\def\leftmargintextwidth {\getvalue{\??im\v!links \c!breedte}} +\def\rightmargintextwidth {\getvalue{\??im\v!rechts\c!breedte}} + \def\doinlinker#1% {\doplacemargintext - {\linkermargetekstblok{#1}\hskip\linkermargeafstand} + {\linkermargetekstblok{#1}\hskip\leftmargintextdistance} \llap\!!zeropoint} \def\doinrechter#1% {\doplacemargintext - {\hskip\rechtermargeafstand\rechtermargetekstblok{#1}} + {\hskip\rightmargintextdistance\rechtermargetekstblok{#1}} \rlap\hsize} \newcounter \nofmarginnotes @@ -180,9 +182,9 @@ \definetwopasslist{\s!margin} -\def\domarginreference% +\def\domarginreference {\doglobal\increment\nofmarginnotes\relax - \edef\writemarref% + \edef\writemarref {\writeutilitycommand% {\twopassentry% {\s!margin}% @@ -203,7 +205,7 @@ \def\doinmargenormal#1#2#3% {\bgroup \iftrackingmarginnotes - \gettwopassdata{\s!margin}% + \gettwopassdata\s!margin \iftwopassdatafound \dodoinmargenormal\twopassdata#1#2{#3}% \else @@ -227,7 +229,7 @@ \def\dodoinmarge[#1][#2][#3][#4][#5]#6% {\ignorespaces \bgroup\postponefootnotes % group is (somehow) needed - \doifinsetelse{\v!laag}{#4} + \doifinsetelse\v!laag{#4} {\lowinmargintrue} {\lowinmarginfalse}% \processaction @@ -236,28 +238,27 @@ \v!rechts=>#3{#6}, \s!unknown=>\ifdubbelzijdig \doifcommonelse{+,-}{#4} - {\doinmargereverse#2#3{#6}} - {\doinmargenormal#2#3{#6}}% + \doinmargereverse\doinmargenormal#2#3{#6}% \else #2{#6}% \fi]% - \rawpagereference{\s!mar}{#5}% + \rawpagereference\s!mar{#5}% \flushnotes\egroup % don't forget the group \ignorespaces} -\def\inlinker% +\def\inlinker {\indentation\doquintupleempty\doinmarge [\v!links][\doinlinker][\doinrechter]} -\def\inrechter% +\def\inrechter {\indentation\doquintupleempty\doinmarge [\v!rechts][\doinlinker][\doinrechter]} -\def\inmarge% +\def\inmarge {\doquintupleempty\doinmarge [\@@implaats][\doinlinker][\doinrechter]} -\def\inanderemarge% +\def\inanderemarge {\doquintupleempty\doinmarge [\@@implaats][\doinrechter][\doinlinker]} @@ -270,7 +271,7 @@ \let\restoreinterlinepenalty=\relax -\def\flushmargincontents% +\def\flushmargincontents {\restoreinterlinepenalty % here? \ifcase\margincontent\else % called quite often, so we \expandafter\doflushmargincontents % speed up the \fi scan by @@ -311,14 +312,14 @@ % \doglobal\newcounter\margincontent % \egroup} -\def\doflushmargincontents% % links + rechts +\def\doflushmargincontents % links + rechts {\bgroup \forgetall \global\marginheight\zeropoint - \dorecurse{\margincontent} + \dorecurse\margincontent {\bgroup - \edef\margetekstafstand {\getvalue{\??im\recurselevel\c!afstand}}% - \edef\margetekstregels {\getvalue{\??im\recurselevel\c!regel}}% + \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}% @@ -335,10 +336,10 @@ \advance\marginheight \pagetotal \advance\marginheight \lineheight % a sort of bonus \ifdim\marginheight>\pagegoal - \xdef\restoreinterlinepenalty% + \xdef\restoreinterlinepenalty {\global\let\restoreinterlinepenalty\relax \global\interlinepenalty=\the\interlinepenalty}% keep = here - \global\interlinepenalty=10000 + \global\interlinepenalty10000 \fi \else % We need the above because interlinepenalties overrule vadjusted \nobreaks. %\vadjust @@ -364,7 +365,7 @@ {\doglobal\increment\margincontent \stelinmargein[\margincontent][]% see next macro \ifsecondargument - \doifnumberelse{#1} + \doifnumberelse{#1} % only one #3 (after test) {\docomplexmargewoord{#2}{#1}{#3}} {\docomplexmargewoord{#1}{#2}{#3}}% \else @@ -385,19 +386,16 @@ \def\margewoord% {\dodoubleempty\complexmargewoord} -\def\margetitel% - {\margewoord} - -\def\margetekst% - {\margewoord} +\def\margetitel{\margewoord} +\def\margetekst{\margewoord} \def\oplinker#1% {\strut \graphicvadjust {\mindermeldingen - \setbox0=\vtop{\forgetall\strut#1}% + \setbox0\vtop{\forgetall\strut#1}% \getboxheight\dimen0\of\box0 - \vskip-\dimen0\ + \vskip-\dimen0 % waarom stond hier een \ ? \box0}} \def\resetmargincontent % quick hack @@ -417,13 +415,13 @@ \def\inleftmargin#1% {\pushindentation - \llap{#1\hskip\leftskip\hskip\linkermargeafstand}% + \llap{#1\hskip\leftskip\hskip\leftmargintextdistance}% \popindentation \ignorespaces} \def\inrightmargin#1% {\pushindentation - \rlap{\hskip\hsize\hskip-\rightskip\hskip\rechtermargeafstand#1}% + \rlap{\hskip\hsize\hskip-\rightskip\hskip\rightmargintextdistance#1}% \popindentation \ignorespaces} @@ -459,12 +457,36 @@ %D \haalbuffer %D \egroup +%D New, yet undocumented: +%D +%D used for pascal: +%D +%D \starttypen +%D \index {test} test \index {west} west \index {rest} rest +%D +%D \startnarrower +%D \placeregister[index][alternative=b,command=\atleftmargin] +%D \stopnarrower +%D \stoptypen + +\def\atleftmargin#1% + {\pushindentation + \llap{\rlap{#1}\hskip\leftskip}% + \popindentation + \ignorespaces} + +\def\atrightmargin#1% + {\pushindentation + \rlap{\hskip\hsize\hskip-\rightskip\llap{#1}}% + \popindentation + \ignorespaces} + % dit zijn voorlopig lokale commando's \def\woordinlinker {\inleftmargin} % vervallen \def\woordinrechter{\inrechtermarge} % vervallen -\def\woordinmarge% +\def\woordinmarge {\doquintupleempty\doinmarge [\@@implaats][\woordinlinker][\woordinrechter]} @@ -480,24 +502,28 @@ \stelinmargein [\v!links] - [\c!plaats=\v!links] -% \c!uitlijnen=\v!links] % njet + [\c!afstand=\linkermargeafstand, + \c!breedte=\linkermargebreedte, + %\c!uitlijnen=\v!links, % njet + \c!plaats=\v!links] \stelinmargein [\v!rechts] - [\c!plaats=\v!rechts] -% \c!uitlijnen=\v!rechts] % njet + [\c!afstand=\rechtermargeafstand, + \c!breedte=\rechtermargebreedte, + %\c!uitlijnen=\v!rechts, % njet + \c!plaats=\v!rechts] \newbox\facingbox \newbox\facingpage \newif\iffacingpages \facingpagesfalse -\def\shipoutfacingpage% +\def\shipoutfacingpage {\iffacingpages - \ifnum\realpageno>1 + \ifnum\realpageno>\plusone \bgroup - \pagebodyornamentsfalse + \global\pagebodyornamentsfalse \setbox\facingpage\vbox to \zethoogte {\unvbox\facingpage\vfil}% \myshipout{\buildpagebody\box\facingpage}% @@ -507,13 +533,13 @@ \fi \fi} -\def\naastpagina% +\def\naastpagina {\shipoutfacingpage} -\def\facefloat% redefined +\def\facefloat % redefined {\startnaast\box\floatbox\stopnaast} -\def\startnaast% beter: \dowithnextbox +\def\startnaast % beter: \dowithnextbox {\iffacingpages \global\setbox\facingbox\vbox \bgroup @@ -522,7 +548,7 @@ \@EA\gobbleuntil\@EA\stopnaast \fi} -\def\stopnaast% +\def\stopnaast {\egroup \global\setbox\facingpage\vbox {\ifvoid\facingpage @@ -535,11 +561,11 @@ \def\dostelnaastplaatsenin[#1]% {\getparameters[\??np][#1]% - \doifelse{\@@npstatus}{\v!start} + \doifelse\@@npstatus\v!start {\global\facingpagestrue} {\global\facingpagesfalse}} -\def\stelnaastplaatsenin% +\def\stelnaastplaatsenin {\dosingleargument\dostelnaastplaatsenin} \stelnaastplaatsenin diff --git a/tex/context/base/page-mul.tex b/tex/context/base/page-mul.tex index c5efdb741..b29597af6 100644 --- a/tex/context/base/page-mul.tex +++ b/tex/context/base/page-mul.tex @@ -15,10 +15,10 @@ %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. +%D OTR macro's were isolated in modules and column sets were +%D introduced, this module became part of the OTR modules. As +%D a result this module is no longer generic. It also needs +%D an overhaul. \unprotect @@ -38,6 +38,12 @@ \let\OTRMULflushsavedfloats \relax \newtoks \OTRMULoutput + +\def\OTRMULgotonextpage + {\ejectpage} + +\def\OTRMULgotonextpageX % will become obsolete + {\superejectpage} % check \count<insert> multiplications @@ -189,10 +195,10 @@ % %D In fact, the column height and width are set by means of % %D two macro's. One can change their meaning if needed: % -% \def\setcolumntextheight% +% \def\setcolumntextheight % {\def\columntextheight{\teksthoogte}} % -% \def\setcolumntextwidth% +% \def\setcolumntextwidth % {\def\columntextwidth{\zetbreedte}} %D Both macros are redefined in \CONTEXT\ when backgrounds @@ -207,21 +213,20 @@ \newdimen\columnwidth \newdimen\gutterwidth -\def\determinecolumnwidth% +\def\determinecolumnwidth {\bgroup - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\setcolumnhsize - \global\columnwidth=\usercolumnwidth - \global\gutterwidth=\intercolumnwidth}% + \global\columnwidth\usercolumnwidth + \global\gutterwidth\intercolumnwidth}% \egroup} %D Going to a new columns is done by means of a %D \type{\ejectcolumn}. The following definition does not %D always work. -\def\ejectcolumn% - {\goodbreak - \showmessage{\m!columns}{2}{}} +\def\ejectcolumn + {\goodbreak\showmessage\m!columns2\empty} %D The next macro should never be called so let's deal with it. %D There were several solutions to these kind of errors. First @@ -246,58 +251,127 @@ %D routines, every (although seldom) warning gives me the %D creeps! -\def\balancingerror% - {\showmessage{\m!columns}{3}{}% +\def\balancingerror + {\showmessage\m!columns3\empty \finaloutput\unvbox\normalpagebox} -\def\OTRMULsometopsfloat{\showmessage{\m!columns}{4}{}\someherefloat} -\def\OTRMULsomebotsfloat{\showmessage{\m!columns}{5}{}\someherefloat} +\def\OTRMULsometopsfloat{\showmessage\m!columns4\empty \someherefloat} +\def\OTRMULsomebotsfloat{\showmessage\m!columns5\empty \someherefloat} \def\OTRMULsomeherefloat{\OTRONEsomeherefloat} %D The local column width is available in the dimension %D register \type{\localcolumnwidth}, which is calculated as: -\def\setcolumnhsize% beware, this one is available for use in macros - {\setbox0=\hbox - {\parindent\!!zeropoint\betweencolumns}% - \intercolumnwidth=\wd0 - \localcolumnwidth=\columntextwidth - \advance\localcolumnwidth by -\leftskip - \advance\localcolumnwidth by -\rightskip - \advance\localcolumnwidth by -\nofcolumns\intercolumnwidth - \advance\localcolumnwidth by \intercolumnwidth - \divide\localcolumnwidth by \nofcolumns +\def\setcolumnhsize % beware, this one is available for use in macros + {\setbox0\hbox + {\parindent\zeropoint\betweencolumns}% + \intercolumnwidth\wd0 + \localcolumnwidth\columntextwidth + \advance\localcolumnwidth -\leftskip + \advance\localcolumnwidth -\rightskip + % new + \advance\localcolumnwidth -\colleftskip + \advance\localcolumnwidth -\colrightskip + % + \advance\localcolumnwidth -\nofcolumns\intercolumnwidth + \advance\localcolumnwidth \intercolumnwidth + \divide\localcolumnwidth \nofcolumns \dimen0=\columntextoffset - \multiply\dimen0 by 2 - \advance\localcolumnwidth by -\dimen0 - \usercolumnwidth=\localcolumnwidth - \hsize=\localcolumnwidth} % we don't do it \global + \multiply\dimen0 2 + \advance\localcolumnwidth -\dimen0 + \usercolumnwidth\localcolumnwidth + \hsize\localcolumnwidth} % we don't do it \global + +%D Torture test: +%D +%D \startbuffer +%D \startbuffer[b] +%D \startkolommen +%D \input tufte +%D \stopkolommen +%D \stopbuffer +%D \typebuffer[b] \haalbuffer[b] +%D +%D \startbuffer[b] +%D \startsmaller +%D \input tufte +%D \stopsmaller +%D \stopbuffer +%D \typebuffer[b] \haalbuffer[b] +%D +%D \startbuffer[b] +%D \startkolommen \startsmaller +%D \input tufte +%D \stopsmaller \stopkolommen +%D \stopbuffer +%D \typebuffer[b] \haalbuffer[b] +%D +%D \startbuffer[b] +%D \startsmaller \startkolommen +%D \input tufte +%D \stopkolommen \stopsmaller +%D \stopbuffer +%D \typebuffer[b] \haalbuffer[b] +%D +%D \startbuffer[b] +%D \startkolommen \startsmaller[left] +%D \input tufte +%D \stopsmaller \stopkolommen +%D \stopbuffer +%D \typebuffer[b] \haalbuffer[b] +%D +%D \startbuffer[b] +%D \startsmaller[left] \startkolommen +%D \input tufte +%D \stopkolommen \stopsmaller +%D \stopbuffer +%D \typebuffer[b] \haalbuffer[b] +%D +%D \startbuffer[b] +%D \startsmaller \startkolommen \startsmaller +%D \input tufte +%D \stopsmaller\stopkolommen \stopsmaller +%D \stopbuffer +%D \typebuffer[b] \haalbuffer[b] +%D +%D \startbuffer[b] +%D \startsmaller[left] \startkolommen \startsmaller +%D \input tufte +%D \stopsmaller\stopkolommen \stopsmaller +%D \stopbuffer +%D \typebuffer[b] \haalbuffer[b] +%D \stopbuffer +%D +%D \start +%D \def\postprocesscolumnline#1{\ruledhbox{\strut\box#1}\hss} +%D \haalbuffer +%D \stop %D One should be aware that when font related dimensions are %D used in typesetting the in||between material, these %D dimensions are influenced by bodyfont switches inside %D multi||column mode. -\def\setcolumnvsize% - {%\global\vsize=\columntextheight - \global\vsize=-\columntextoffset - \global\multiply\vsize by 2 - \global\advance\vsize by \columntextheight +\def\setcolumnvsize + {%\global\vsize\columntextheight + \global\vsize-\columntextoffset + \global\multiply\vsize 2 + \global\advance\vsize \columntextheight \ifdim\precolumnboxheight>\zeropoint - \global\advance\vsize by -\precolumnboxheight + \global\advance\vsize -\precolumnboxheight \fi %\getinsertionheights\to\dimen0\\% - %\global\advance\vsize by -\dimen0 + %\global\advance\vsize -\dimen0 \settotalinsertionheight \global\advance\vsize -\totalinsertionheight %%%\ifgridsnapping % evt altijd, nog testen, testing now, see columned tocs \getnoflines\vsize - \vsize=\noflines\openlineheight - \advance\vsize by .5\openlineheight % collect enough data + \vsize\noflines\openlineheight + \advance\vsize .5\openlineheight % collect enough data %%%\fi - \global\vsize=\nofcolumns\vsize - \global\pagegoal=\vsize} % let's do it only here + \global\vsize\nofcolumns\vsize + \global\pagegoal\vsize} % let's do it only here %D It really starts here. After some checks and initializations %D we change the output routine to continous multi||column @@ -316,60 +390,68 @@ %D Watch the trick with the \type{\vbox}. This way we get the %D right interlining and white space. -\def\beginmulticolumns% +\def\beginmulticolumns {\par \flushnotes \xdef\precolumndepth{\the\prevdepth}% \begingroup + % new + \leftskip1\leftskip + \rightskip1\rightskip + \edef\colleftskip {\the\leftskip}% + \edef\colrightskip{\the\rightskip}% + \leftskip\zeropoint + \rightskip\zeropoint + % \dontshowcomposition %\setcolumntextwidth\relax %\setcolumntextheight\relax - \widowpenalty=0 % is gewoon beter - \clubpenalty=0 % zeker bij grids + \widowpenalty\zerocount % is gewoon beter + \clubpenalty \zerocount % zeker bij grids \ifsomefloatwaiting - \showmessage{\m!columns}{6}{\the\savednoffloats}% - \global\setbox\savedfloatlist=\box\floatlist + \showmessage\m!columns6{\the\savednoffloats}% + \global\setbox\savedfloatlist\box\floatlist \xdef\restoresavedfloats% - {\global\savednoffloats=\the\savednoffloats - \global\setbox\floatlist=\box\savedfloatlist + {\global\savednoffloats\the\savednoffloats + \global\setbox\floatlist\box\savedfloatlist \global\noexpand\somefloatwaitingtrue}% - \global\savednoffloats=0 + \global\savednoffloats\zerocount \global\somefloatwaitingfalse \else - \global\let\restoresavedfloats=\relax + \global\let\restoresavedfloats\relax \fi - \dimen0=\pagetotal - \advance\dimen0 by \parskip - \advance\dimen0 by \openlineheight + \dimen0\pagetotal + \advance\dimen0 \parskip + \advance\dimen0 \openlineheight \ifdim\dimen0<\pagegoal \allowbreak \else \break % Sometimes fails \fi - \appendtoks\topskip=1\topskip\to\everybodyfont + \appendtoks\topskip1\topskip\to\everybodyfont \the\everybodyfont \initializecolumns\nofcolumns - \hangafter=0 - \hangindent=\!!zeropoint - \everypar{}% + \hangafter\zerocount + \hangindent\zeropoint + \everypar\emptytoks \ifdim\pagetotal=\zeropoint \else \vbox{\forgetall\strut}% \vskip-\openlineheight \fi - \global\savedpagetotal=\pagetotal - \global\singlecolumnout=\output -% \global\output={\global\setbox\precolumnbox=\vbox{\unvbox\normalpagebox}}% -\global\output={\global\setbox\precolumnbox=\vbox{\dotopinsertions\unvbox\normalpagebox}}% + \global\savedpagetotal\pagetotal + \global\singlecolumnout\output + %\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\precolumnboxheight=\ht\precolumnbox - \global\output={\continuousmulticolumnsout}% + \global\precolumnboxheight\ht\precolumnbox + \global\output{\continuousmulticolumnsout}% \setcolumnfloats \dohandleallcolumns - {\global\setbox\currenttopcolumnbox=\box\voidb@x}% + {\global\setbox\currenttopcolumnbox\box\voidb@x}% \checkbegincolumnfootnotes -\activateotr{MUL}{ONE}% todo ! ! ! ! - \let\sethsize=\setcolumnhsize - \let\setvsize=\setcolumnvsize + \activateotr{MUL}{ONE}% todo ! ! ! ! + \let\sethsize\setcolumnhsize + \let\setvsize\setcolumnvsize \sethsize \setvsize \showcomposition} @@ -389,7 +471,7 @@ %D e.g. when there is no text given between \type{\begin..} %D and \type{\end..}. The \type{\par} is needed! -\def\endmulticolumns% +\def\endmulticolumns {%\par \vskip\lineheight\vskip-\lineheight % take footnotes into account \dontshowcomposition @@ -398,22 +480,22 @@ \flushnotes % before start of columns \par \ifbalancecolumns - \global\output={\continuousmulticolumnsout}% + \global\output{\continuousmulticolumnsout}% \goodbreak - \global\output={\balancedmulticolumnsout}% + \global\output{\balancedmulticolumnsout}% \else \goodbreak \fi \eject % the prevdepth is important, try e.g. toclist in - \prevdepth\!!zeropoint % columns before some noncolumned text text - \global\output=\singlecolumnout -\global\output={\the\mainoutput}% % % % % todo + \prevdepth\zeropoint % columns before some noncolumned text text + \global\output\singlecolumnout + \global\output{\the\mainoutput}% % % % % todo \ifvoid\precolumnbox\else \unvbox\precolumnbox \fi - \global\precolumnboxheight=\!!zeropoint + \global\precolumnboxheight\zeropoint \endgroup % here - \nofcolumns=1 + \nofcolumns\plusone \setvsize % the outer one! \checkendcolumnfootnotes \dosomebreak\allowbreak @@ -456,14 +538,14 @@ %D {\maxcolumndepth} when generating material between columns %D as well as postprocessing column lines. -\let\maxcolumnheight=\!!zeropoint -\let\maxcolumndepth =\!!zeropoint +\let\maxcolumnheight=\zeropoint +\let\maxcolumndepth =\zeropoint \newbox\columnpagebox -\def\setmaxcolumndimensions% - {\let\maxcolumnheight=\!!zeropoint - \let\maxcolumndepth =\!!zeropoint +\def\setmaxcolumndimensions + {\let\maxcolumnheight\!!zeropoint + \let\maxcolumndepth \!!zeropoint \dohandleallcolumns {\ifdim\ht\currentcolumnbox>\maxcolumnheight \edef\maxcolumnheight{\the\ht\currentcolumnbox}% @@ -472,7 +554,7 @@ \edef\maxcolumndepth{\the\dp\currentcolumnbox}% \fi}} -\def\flushcolumnedpage% +\def\flushcolumnedpage {\bgroup \forgetall \setmulticolumnsout @@ -480,17 +562,18 @@ \setmaxcolumndimensions \postprocesscolumns \dohandleallcolumns % \hbox i.v.m. \showcomposition - {\global\setbox\currentcolumnbox=\hbox to \localcolumnwidth + {\global\setbox\currentcolumnbox\hbox to \localcolumnwidth {\box\currentcolumnbox - \global\wd\currentcolumnbox=\localcolumnwidth + \global\wd\currentcolumnbox\localcolumnwidth \ifheightencolumns - \global\ht\currentcolumnbox=\fixedcolumnheight + \global\ht\currentcolumnbox\fixedcolumnheight \fi}}% \setmaxcolumndimensions \overlaycolumnfootnotes - \setbox\columnpagebox=\vbox + \setbox\columnpagebox\vbox {\hbox to \finalcolumntextwidth - {\ifreversecolumns + {\hskip\colleftskip\relax % new, \relax needed + \ifreversecolumns \@EA\dohandlerevcolumns \else \@EA\dohandleallcolumns @@ -499,53 +582,58 @@ {\ifx\finishcolumnbox\relax\else\strut\fi \box\currentcolumnbox}}% \hfil}% - \unskip}}% - \scratchdimen=\!!zeropoint + \unskip + \hskip\colrightskip}}% new + \scratchdimen\zeropoint \dohandleallcolumns {\ifdim-\ht\currenttopcolumnbox<\scratchdimen - \scratchdimen=-\ht\currenttopcolumnbox + \scratchdimen-\ht\currenttopcolumnbox \fi - \global\setbox\currenttopcolumnbox=\box\voidb@x}% - \advance\scratchdimen by \ht\columnpagebox - \setbox\scratchbox=\hbox to \columntextwidth + \global\setbox\currenttopcolumnbox\box\voidb@x}% + \advance\scratchdimen \ht\columnpagebox + \setbox\scratchbox\hbox to \columntextwidth {\vrule - \!!width\!!zeropoint + \!!width\zeropoint \!!height\scratchdimen \!!depth\dp\columnpagebox - \dostepwiserecurse{2}{\nofcolumns}{1}{\hfil\betweencolumns}\hfil}% - \setbox\columnpagebox=\hbox + \dostepwiserecurse2\nofcolumns1{\hfil\betweencolumns}\hfil}% + \setbox\columnpagebox\hbox {\box\columnpagebox \hskip-\columntextwidth \restoretextcolor{\box\scratchbox}}% \postprocesscolumnpagebox % new, acts upon \box\columnpagebox - \ifvoid\precolumnbox \else - \ifgridsnapping % do you believe this junk? - \scratchdimen=\savedpagetotal - \advance\scratchdimen by -\ht\precolumnbox - \advance\scratchdimen by -\dp\precolumnbox - \advance\scratchdimen by -\topskip - \box\precolumnbox - \kern\scratchdimen + \ifvoid\precolumnbox + \else + % next some incredible crappy code + \ifgridsnapping + % somehow this junk fails in pascal + \scratchdimen\savedpagetotal + \advance\scratchdimen -\ht\precolumnbox + \advance\scratchdimen -\dp\precolumnbox + \advance\scratchdimen -\topskip + \box\precolumnbox + \kern\scratchdimen \else \unvbox\precolumnbox \fi \fi - \global\precolumnboxheight=\!!zeropoint + \global\precolumnboxheight\zeropoint \setvsize \dosomebreak\nobreak -% wrong ! ! ! ! ! -% \ifgridsnapping \else -% \scratchdimen=\topskip -% \advance\scratchdimen by -\openstrutheight -% \nointerlineskip -% \vskip-\scratchdimen -% \fi + % wrong, but keep it as a reminder + % \ifgridsnapping \else + % \scratchdimen\topskip + % \advance\scratchdimen -\openstrutheight + % \nointerlineskip + % \vskip-\scratchdimen + % \fi + % so that we don't add it again \prevdepth\openstrutdepth \nointerlineskip - \dp\columnpagebox=\!!zeropoint - \global\finalcolumnheights=\ht\columnpagebox + \dp\columnpagebox\zeropoint + \global\finalcolumnheights\ht\columnpagebox \getnoflines\finalcolumnheights - \global\finalcolumnlines=\noflines + \global\finalcolumnlines\noflines \box\columnpagebox \egroup} @@ -596,31 +684,32 @@ %D This feature is implemented using the reshape macros %D presented in \type{supp-box}. -\def\postprocesscolumns% +\def\postprocesscolumns {\ifx\postprocesscolumnline\undefined \else \dohandleallcolumns - {\global\setbox\currentcolumnbox=\vtop + {\global\setbox\currentcolumnbox\vtop {\beginofshapebox \unvbox\currentcolumnbox \unskip\unskip \endofshapebox \reshapebox - {\dimen0=\ht\shapebox - \dimen2=\dp\shapebox - \setbox\shapebox=\hbox to \hsize + {\dimen0\ht\shapebox + \dimen2\dp\shapebox + \setbox\shapebox\hbox to \hsize {\postprocesscolumnline\shapebox}% - \ht\shapebox=\dimen0 - \dp\shapebox=\dimen2 + \ht\shapebox\dimen0 + \dp\shapebox\dimen2 \box\shapebox}% \flushshapebox - \everypar{}\parskip\!!zeropoint % = \forgetall + \everypar\emptytoks + \parskip\zeropoint % = \forgetall \strut\endgraf \vskip-\lineheight \vfil}}% \fi \ifx\postprocesscolumnbox\undefined \else \dohandleallcolumns - {\global\setbox\currentcolumnbox=\hbox + {\global\setbox\currentcolumnbox\hbox {\postprocesscolumnbox\currentcolumnbox}} \fi} @@ -652,14 +741,15 @@ \def\splitcolumn#1from \box#2to \dimen#3 top \box#4% {\bgroup \ifdim\ht#4>\zeropoint - \dimen0=\dimen#3\relax - \dimen2=\dimen0 - \advance\dimen0 by -\ht#4% + \dimen0\dimen#3\relax + \dimen2\dimen0 + \advance\dimen0 -\ht#4% \columnfootnotecorrection{#1}{\dimen0}% - \setbox0=\vsplit#2 to \dimen0 - \global\setbox#1=\vbox to \dimen2 + \setbox0\vsplit#2 to \dimen0 + \global\setbox#1\vbox to \dimen2 {\ifgridsnapping - \dimen0=-\openstrutheight\advance\dimen0 by \topskip + \dimen0-\openstrutheight + \advance\dimen0 \topskip \vskip\dimen0\copy#4\vskip-\dimen0 \else \unvcopy#4% @@ -669,13 +759,13 @@ \else \ifcleverfootnotes \columnfootnotecorrection{#1}{\dimen#3}% - \setbox0=\vsplit#2 to \dimen#3% - \global\setbox#1=\vbox to \dimen#3% + \setbox0\vsplit#2 to \dimen#3% + \global\setbox#1\vbox to \dimen#3% {\fuzzysnappedbox\unvbox0 \fakecolumnfootnotes{#1}}% \else - \global\setbox#1=\vsplit#2 to \dimen#3% - \global\setbox#1=\vbox + \global\setbox#1\vsplit#2 to \dimen#3% + \global\setbox#1\vbox {\fuzzysnappedbox\unvbox{#1}}% % or \box ? \fi \fi @@ -688,7 +778,7 @@ {\splitcolumn\firstcolumnbox from \box#1 to \dimen#2 top \box\firsttopcolumnbox} \def\splitlastcolumn from \box#1to \dimen#2% - {\global\setbox\lastcolumnbox=\vbox + {\global\setbox\lastcolumnbox\vbox {\unvcopy\lasttopcolumnbox \fuzzysnappedbox\unvbox{#1}% \fakecolumnfootnotes\lastcolumnbox}} @@ -712,24 +802,24 @@ \fi \fi} -\def\overlaycolumnfootnotes% VERVANGEN !!! +\def\overlaycolumnfootnotes % VERVANGEN !!! {\relax \ifcleverfootnotes \checknotepresence \ifnotespresent \bgroup - \scratchdimen=\ht\firstcolumnbox - \advance\scratchdimen by -\openstrutdepth % \dp\strutbox + \scratchdimen\ht\firstcolumnbox + \advance\scratchdimen -\openstrutdepth % \dp\strutbox \getnoflines\scratchdimen - \advance\noflines by -2 - \scratchdimen=\noflines\lineheight - \advance\scratchdimen by \topskip - \setbox0=\hbox + \advance\noflines -2 + \scratchdimen\noflines\lineheight + \advance\scratchdimen \topskip + \setbox0\hbox {\lower\scratchdimen\vbox{\placefootnoteinserts}}% \ht0=\openstrutheight % \ht\strutbox \dp0=\openstrutdepth % \dp\strutbox - \scratchdimen=\ht\lastcolumnbox - \global\setbox\lastcolumnbox=\vbox to \scratchdimen + \scratchdimen\ht\lastcolumnbox + \global\setbox\lastcolumnbox\vbox to \scratchdimen {\box\lastcolumnbox \vskip-\scratchdimen \restoretextcolor{\box0}}% @@ -743,40 +833,40 @@ %D mode was entered, or floats that migrate to next columns. %D Flushing floats is a delicate process. -\def\continuousmulticolumnsout% +\def\continuousmulticolumnsout {\bgroup \forgetall \setmulticolumnsout \dontshowcomposition \dimen0=\columntextheight - \advance\dimen0 by -\precolumnboxheight + \advance\dimen0 -\precolumnboxheight \settotalinsertionheight - \advance\dimen0 by -\totalinsertionheight + \advance\dimen0 -\totalinsertionheight \ifgridsnapping % evt altijd, nog testen \getnoflines{\dimen0} \dimen0=\noflines\openlineheight \fi \dohandleallcolumns {\splitcurrentcolumn from \box\normalpagebox to \dimen0} - \setbox\restofpage=\vbox{\unvbox\normalpagebox}% + \setbox\restofpage\vbox{\unvbox\normalpagebox}% \ifinheritcolumns \ifr@ggedbottom % vreemd \dohandleallcolumns - {\global\setbox\currentcolumnbox=\vbox to \ht\firstcolumnbox - {\dimen0=\dp\currentcolumnbox + {\global\setbox\currentcolumnbox\vbox to \ht\firstcolumnbox + {\dimen0\dp\currentcolumnbox \unvbox\currentcolumnbox \vskip-\dimen0 \vskip\openstrutdepth % \dp\strutbox \prevdepth\openstrutdepth % \dp\strutbox \vfill}}% \ifbottomnotes \else - \dimen0=\ht\firstcolumnbox + \dimen0\ht\firstcolumnbox \fi \fi \ifn@rmalbottom - \advance\dimen0 by \maxdepth + \advance\dimen0 \maxdepth \dohandleallcolumns - {\global\setbox\currentcolumnbox=\vbox to \dimen0 + {\global\setbox\currentcolumnbox\vbox to \dimen0 {\unvbox\currentcolumnbox}}% \fi \ifb@selinebottom @@ -784,7 +874,7 @@ \fi \else \dohandleallcolumns - {\global\setbox\currentcolumnbox=\vbox to \dimen0 + {\global\setbox\currentcolumnbox\vbox to \dimen0 {\ifstretchcolumns \unvbox\currentcolumnbox \else @@ -792,9 +882,9 @@ \vfill \fi}}% \dohandleallcolumns - {\global\ht\currentcolumnbox=\dimen0}% + {\global\ht\currentcolumnbox\dimen0}% \fi - \setbox\precolumnbox=\vbox{\flushcolumnedpage}% + \setbox\precolumnbox\vbox{\flushcolumnedpage}% \finaloutput\box\precolumnbox \sethsize \setvsize @@ -811,22 +901,22 @@ %D \type{\box4} garantees a more robust check when skips are %D used. -\def\balancedmulticolumnsout% +\def\balancedmulticolumnsout {\bgroup \setmulticolumnsout \dontshowcomposition - \widowpenalty=0 - \setbox0=\vbox{\unvbox\normalpagebox}% + \widowpenalty\zerocount + \setbox0\vbox{\unvbox\normalpagebox}% \ifdim\ht0>\openlineheight % at least one line \ifnum\minbalancetoplines<2 % balance anyway \donetrue \else % check criterium to available lines \getnoflines{\ht0}% - \divide\noflines by \nofcolumns \relax + \divide\noflines \nofcolumns \relax \ifnum\noflines<\minbalancetoplines \relax - \dimen0=\ht0 - \advance\dimen0 by \ht\firsttopcolumnbox - \advance\dimen0 by \openlineheight \relax % let's play safe + \dimen0\ht0 + \advance\dimen0 \ht\firsttopcolumnbox + \advance\dimen0 \openlineheight \relax % let's play safe \ifdim\dimen0>\columntextheight % column exceeding text height \donetrue \else % it seems to fit @@ -841,40 +931,40 @@ \fi \ifdone % start balancing %\ifdim\ht0>\openlineheight - \dimen0=\ht0 - \advance\dimen0 by \topskip - \advance\dimen0 by -\baselineskip + \dimen0\ht0 + \advance\dimen0 \topskip + \advance\dimen0 -\baselineskip \dohandleallcolumns - {\advance\dimen0 by \ht\currenttopcolumnbox}% - \divide\dimen0 by \nofcolumns - \vbadness=\!!tenthousand\relax - \count255=0 + {\advance\dimen0 \ht\currenttopcolumnbox}% + \divide\dimen0 \nofcolumns + \vbadness\!!tenthousand\relax + \count255=\zerocount \bgroup \ifgridsnapping - \dimen2=\lineheight + \dimen2\lineheight \else \dimen2=\!!onepoint % RUBISH \dimen2=\spacingfactor\dimen2 \fi \loop - \advance\count255 by 1 - \global\setbox\restofpage=\copy0\relax + \advance\count255 \plusone + \global\setbox\restofpage\copy0\relax \splitfirstcolumn from \box\restofpage to \dimen0 \dohandlemidcolumns {\splitcurrentcolumn from \box\restofpage to \dimen0}% \splitlastcolumn from \box\restofpage to \dimen0 - \setbox2=\vbox{\unvcopy\firstcolumnbox}% - \dimen4=\!!zeropoint + \setbox2\vbox{\unvcopy\firstcolumnbox}% + \dimen4\zeropoint \dohandleallcolumns - {\setbox4=\vbox + {\setbox4\vbox {\unvcopy\currentcolumnbox %rather new, test this on pdftex-z.tex \unpenalty\unskip\unpenalty\unskip}% maybe better in main splitter %\writestatus{balance}{\the\currentcolumnbox: \the\ht4}% - \dimen6=\ht4 + \dimen6\ht4 \ifdim\dimen6>\dimen4 \dimen4=\dimen6 \fi}% -\advance\dimen4 by -.0005pt % get rid of accurracy problem, pretty new - \ifnum\count255>100\relax + \advance\dimen4 -.0005pt % get rid of accurracy problem, pretty new + \ifnum\count255>100 \donefalse \else\ifdim\dimen4>\ht2 \donetrue @@ -882,35 +972,35 @@ \donefalse \fi\fi \ifdone - \advance\dimen0 by \dimen2\relax + \advance\dimen0 \dimen2\relax \repeat \dohandleallcolumns - {\global\setbox\currentcolumnbox=\vbox{\unvcopy\currentcolumnbox}}% NIEUW + {\global\setbox\currentcolumnbox\vbox{\unvcopy\currentcolumnbox}}% NIEUW \ifnum\count255>100\relax - \showmessage{\m!columns}{7}{}% + \showmessage\m!columns7\empty \else - \showmessage{\m!columns}{8}{\the\count255\space}% + \showmessage\m!columns8{\the\count255\space}% \fi \egroup \ifinheritcolumns - \dimen0=\ht\firstcolumnbox - \dimen2=\ht\firstcolumnbox - \advance\dimen2 by -\openlineheight + \dimen0\ht\firstcolumnbox + \dimen2\ht\firstcolumnbox + \advance\dimen2 -\openlineheight \dohandleallcolumns - {\dimen4=\ht\currentcolumnbox + {\dimen4\ht\currentcolumnbox \dimen6=10\openlineheight - \global\setbox\currentcolumnbox=\vbox to \dimen0 + \global\setbox\currentcolumnbox\vbox to \dimen0 {\unvbox\currentcolumnbox \ifdim\dimen4>\dimen6 \ifdim\dimen4<\dimen0 \ifdim\dimen4>\dimen2 - \vskip\!!zeropoint % !! + \vskip\zeropoint % !! \else \vskip\openlineheight \vfill \fi \else - \vskip\!!zeropoint + \vskip\zeropoint \fi \else \vskip\openlineheight @@ -919,20 +1009,20 @@ \else \bgroup \ifstretchcolumns - \dimen0=\ht\firstcolumnbox + \dimen0\ht\firstcolumnbox \dimen2=\bottomtolerance\ht\firstcolumnbox - \setbox0=\vbox{\unvcopy\lastcolumnbox}% - \advance\dimen0 by -\ht0\relax - \advance\dimen0 by -\dp0\relax + \setbox0\vbox{\unvcopy\lastcolumnbox}% + \advance\dimen0 -\ht0\relax + \advance\dimen0 -\dp0\relax \ifdim\dimen0>\openlineheight\relax \ifdim\dimen0>\dimen2\relax % \stretchcolumnsfalse % beter goed slecht dan slecht goed - \showmessage{\m!columns}{9}{}% + \showmessage\m!columns9\empty \fi \fi \fi \dohandleallcolumns - {\global\setbox\currentcolumnbox=\vbox to \ht\firstcolumnbox + {\global\setbox\currentcolumnbox\vbox to \ht\firstcolumnbox {\ifstretchcolumns \unvbox\currentcolumnbox \else @@ -942,10 +1032,10 @@ \egroup \fi \else - \showmessage{\m!columns}{10}{}% - \global\setbox\firstcolumnbox=\vbox{\unvbox0}% + \showmessage\m!columns{10}\empty + \global\setbox\firstcolumnbox\vbox{\unvbox0}% \fi - \global\output={\balancingerror}% + \global\output{\balancingerror}% \b@selinebottomtrue % forces depth in separation rule \flushcolumnedpage \allowbreak @@ -997,42 +1087,42 @@ %D When all those floats are flushed, we switch to the local %D flushing routine. -\def\setcolumnfloats% +\def\setcolumnfloats {\xdef\globalsavednoffloats{\the\savednoffloats}% - \ifnum\globalsavednoffloats>0 + \ifnum\globalsavednoffloats>\zerocount \setglobalcolumnfloats \else \setlocalcolumnfloats \fi} -\def\setglobalcolumnfloats% +\def\setglobalcolumnfloats {\everypar\emptytoks - \let\flushcolumnfloat=\relax - %\let\doroomfloat=\relax - \let\docheckiffloatfits=\relax - \let\flushcolumnfloats=\noflushcolumnfloats} + \let\flushcolumnfloat\relax + %\let\doroomfloat\relax + \let\docheckiffloatfits\relax + \let\flushcolumnfloats\noflushcolumnfloats} -\def\setlocalcolumnfloats% - {\everypar= +\def\setlocalcolumnfloats + {\everypar {\flushnotes\flushcolumnfloat\flushmargincontents\checkindentation}% - \let\flushcolumnfloat=\doflushcolumnfloat - %\let\doroomfloat=\docolumnroomfloat - \let\docheckiffloatfits=\docolumnroomfloat - \let\flushcolumnfloats=\doflushcolumnfloats + \let\flushcolumnfloat\doflushcolumnfloat + %\let\doroomfloat\docolumnroomfloat + \let\docheckiffloatfits\docolumnroomfloat + \let\flushcolumnfloats\doflushcolumnfloats \let\doflushfloats\doflushcolumnfloats % new - \let\dosetbothinserts=\relax - \let\dotopinsertions=\relax} + \let\dosetbothinserts\relax + \let\dotopinsertions\relax} -\def\noflushcolumnfloats% +\def\noflushcolumnfloats {\bgroup \xdef\localsavednoffloats{\the\savednoffloats}% - \global\savednoffloats=\globalsavednoffloats + \global\savednoffloats\globalsavednoffloats \dotopinsertions \xdef\globalsavenoffloats{\the\savednoffloats}% - \ifnum\globalsavednoffloats=0 + \ifnum\globalsavednoffloats=\zerocount \setlocalcolumnfloats \fi - \global\savednoffloats=\localsavednoffloats + \global\savednoffloats\localsavednoffloats \egroup} %D We need to calculate the amount of free space in a columns. @@ -1046,20 +1136,20 @@ \def\getcolumnstatus\column#1\total#2\goal#3\\% {\dimen0=\ifdim\pagegoal<\maxdimen \pagetotal \else \zeropoint \fi - \dimen2=\!!zeropoint - \count255=0 + \dimen2=\zeropoint + \count255=\zerocount \dimen8=\columntextheight - \advance\dimen8 by -\precolumnboxheight - \def\dogetcolumnstatus% - {\advance\count255 by 1 - \advance\dimen2 by \ht\currenttopcolumnbox - \advance\dimen2 by \dp\currenttopcolumnbox - \dimen4=\dimen2 - \advance\dimen4 by \dimen0 + \advance\dimen8 -\precolumnboxheight + \def\dogetcolumnstatus + {\advance\count255 \plusone + \advance\dimen2 \ht\currenttopcolumnbox + \advance\dimen2 \dp\currenttopcolumnbox + \dimen4\dimen2 + \advance\dimen4 \dimen0 \dimen6=\count255\dimen8 \ifdim\dimen4>\dimen6 \else - \let\dogetcolumnstatus=\relax + \let\dogetcolumnstatus\relax \fi}% \dohandleallcolumns{\dogetcolumnstatus}% \ifnum\count255=0 \count255=1 \fi @@ -1071,14 +1161,14 @@ {\ifdim\pagegoal<\maxdimen \bgroup \dimen0=\columntextheight - \advance\dimen0 by -\pagegoal + \advance\dimen0 -\pagegoal \xdef\insertionheight{\the\dimen0}% \egroup \else \global\let\insertionheight=\zeropoint \fi} -\def\docolumnroomfloat% +\def\docolumnroomfloat {\ifpostponecolumnfloats \global\roomforfloatfalse \else\ifnofloatpermitted @@ -1086,17 +1176,17 @@ \else \bgroup \getcolumnstatus\column\count255\total\dimen0\goal\dimen2\\% - \advance\dimen0 by 2\openlineheight % nog nodig ? + \advance\dimen0 2\openlineheight % nog nodig ? %\ifnum\count255=\nofcolumns % \getinsertionheight % %\message{\insertionheight}\wait - % \advance\dimen0 by \insertionheight + % \advance\dimen0 \insertionheight %\fi - \setbox\scratchbox=\vbox % tricky met objecten ? + \setbox\scratchbox\vbox % tricky met objecten ? {\blanko[\@@bkvoorwit] \snaptogrid\vbox{\copy\floatbox}}% - \advance\dimen0 by \ht\scratchbox - \advance\dimen0 by .5\lineheight % needed because goal a bit higher + \advance\dimen0 \ht\scratchbox + \advance\dimen0 .5\lineheight % needed because goal a bit higher %\message{column: \the\count255; total: \the\dimen0; goal: \the\dimen2}\wait \ifdim\dimen0>\dimen2 \global\roomforfloatfalse @@ -1104,7 +1194,7 @@ \global\roomforfloattrue \fi \ifdim\wd\floatbox>\hsize - \showmessage{\m!columns}{11}{}% + \showmessage\m!columns{11}\empty \global\roomforfloatfalse \fi \egroup @@ -1174,11 +1264,11 @@ % \egroup % \fi\fi\fi\fi} -\def\doflushcolumnfloat% +\def\doflushcolumnfloat {\ifpostponecolumnfloats\else\ifflushingcolumnfloats\ifprocessingverbatim\else\ifsomefloatwaiting \bgroup \forgetall - \let\doflushcolumnfloat=\relax + \let\doflushcolumnfloat\relax \getcolumnstatus\column\mofcolumns\total\dimen0\goal\dimen2\\% \ifdim\dimen0>\zeropoint \dogetfloat @@ -1192,32 +1282,32 @@ \setbox2=\vbox {\blanko[\@@bkvoorwit] \snaptogrid\vbox{\copy\floatbox}}% - \advance\dimen0 by \ht2 + \advance\dimen0 \ht2 \ifdim\dimen0>\dimen2 \ifnum\mofcolumns<\nofcolumns - \advance\mofcolumns by 1 + \advance\mofcolumns \plusone %% bug %% \edef\currenttopcolumnbox{\getvalue{\@@topcol\the\count255}}% \ifdim\ht\currenttopcolumnbox=\zeropoint - \global\setbox\currenttopcolumnbox=\vbox + \global\setbox\currenttopcolumnbox\vbox {\snaptogrid\vbox{\copy\floatbox} \witruimte % nodig ? \blanko[\@@bknawit]}% \dimen4=\ht\currenttopcolumnbox - \advance\dimen4 by \dp\currenttopcolumnbox - \global\advance\vsize by -\dimen4 - \advance\dimen4 by -\pagegoal - \global\pagegoal=-\dimen4 - \showmessage{\m!columns}{12}{a}% + \advance\dimen4 \dp\currenttopcolumnbox + \global\advance\vsize -\dimen4 + \advance\dimen4 -\pagegoal + \global\pagegoal-\dimen4 + \showmessage\m!columns{12}a% \else - \showmessage{\m!columns}{12}{b}% + \showmessage\m!columns{12}b% \doresavefloat \fi \else - \showmessage{\m!columns}{12}{c}% + \showmessage\m!columns{12}c% \doresavefloat \fi \else - \ifhmode{\setbox0=\lastbox}\fi% waar is die er in geslopen + \ifhmode{\setbox0\lastbox}\fi% waar is die er in geslopen \par \ifdim\prevdepth<\zeropoint \else % anders bovenaan kolom witruimte \nobreak @@ -1246,18 +1336,18 @@ %D When handling lots of (small) floats spacing can get worse %D because of lining out the columns. -\def\doflushcolumnfloats% +\def\doflushcolumnfloats {\ifpostponecolumnfloats\else \bgroup \forgetall \ifsomefloatwaiting - \dimen8=\!!zeropoint - \dimen4=\!!zeropoint - \count0=0 % count0 can be used local - \count2=\nofcolumns % count2 can be used local + \dimen8\zeropoint + \dimen4\zeropoint + \count0\zerocount % count0 can be used local + \count2\nofcolumns % count2 can be used local \dohandleallcolumns - {\ifnum\count0>0\relax % the wide one's reserved space - \global\setbox\currenttopcolumnbox=\vbox + {\ifnum\count0>\zerocount % the wide one's reserved space + \global\setbox\currenttopcolumnbox\vbox {\snaptogrid\vbox {\copy\currenttopcolumnbox \hbox{\vphantom{\copy\floatbox}}} @@ -1269,23 +1359,23 @@ \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 - \dimen2=\hsize - \advance\dimen2 by \intercolumnwidth - \advance\dimen0 by .5pt % hm, why 1 - \advance\dimen2 by .5pt % hm, why 2 - \divide\dimen0 by \dimen2 - \count0=\dimen0 - \advance\count0 by 1 + \dimen0\wd\floatbox + \advance\dimen0 \intercolumnwidth + \dimen2\hsize + \advance\dimen2 \intercolumnwidth + \advance\dimen0 .5pt % hm, why 1 + \advance\dimen2 .5pt % hm, why 2 + \divide\dimen0 \dimen2 + \count0\dimen0 + \advance\count0 \plusone \ifnum\count0>\count2 \doresavefloat - \count0=0 + \count0\zerocount \else \dimen0=\count0\hsize - \advance\dimen0 by \count0\intercolumnwidth - \advance\dimen0 by -\intercolumnwidth - \global\setbox\floatbox=\hbox to \dimen0 + \advance\dimen0 \count0\intercolumnwidth + \advance\dimen0 -\intercolumnwidth + \global\setbox\floatbox\hbox to \dimen0 %{\hss\hbox{\copy\floatbox}\hss}% {\processaction[\@@bkplaats] % how easy to forget [ \v!links=>\copy\floatbox\hss, @@ -1293,30 +1383,30 @@ \s!default=>\hss\copy\floatbox\hss, \s!unknown=>\hss\copy\floatbox\hss]}% \fi - \showmessage{\m!columns}{13}{}% + \showmessage\m!columns{13}\empty \else - % \showmessage{\m!columns}{13}{}% + % \showmessage\m!columns{13}\empty \fi \ifdim\ht\floatbox>\zeropoint\relax - \global\setbox\currenttopcolumnbox=\vbox + \global\setbox\currenttopcolumnbox\vbox {\snaptogrid\vbox {\copy\currenttopcolumnbox \copy\floatbox} \witruimte % nodig ? \blanko[\@@bknawit]}% \fi - \dimen6=\ht\currenttopcolumnbox - \advance\dimen6 by \dp\currenttopcolumnbox + \dimen6\ht\currenttopcolumnbox + \advance\dimen6 \dp\currenttopcolumnbox \fi \ifdim\dimen4<\ht\currenttopcolumnbox - \dimen4=\ht\currenttopcolumnbox + \dimen4\ht\currenttopcolumnbox \fi - \advance\dimen8 by \dimen6 - \advance\count2 by -1 - \advance\count0 by -1 }% + \advance\dimen8 \dimen6 + \advance\count2 \minusone + \advance\count0 \minusone }% \setvsize - \global\advance\vsize by -\dimen8 - \global\pagegoal=\vsize + \global\advance\vsize -\dimen8 + \global\pagegoal\vsize \else %\doflushfloats % does not snap! \fi @@ -1349,20 +1439,20 @@ \binnenkolommenfalse -\def\stelkolommenin% +\def\stelkolommenin {\dodoubleargument\dostelkolommenin} \def\stelkolommenin[#1]% {\getparameters[\??kl][#1]% - \nofcolumns=\@@kln\relax + \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]} + [ \v!aan=>\let\betweencolumns\linebetweencolumns, + \v!uit=>\let\betweencolumns\spacebetweencolumns, + \s!default=>\let\betweencolumns\spacebetweencolumns, + \s!unknown=>\let\betweencolumns\@@kllijn]} -\def\linebetweencolumns% +\def\linebetweencolumns {\bgroup \startcolorpage \ifdim\@@klafstand>\zeropoint @@ -1370,7 +1460,7 @@ \else \dimen0=\linewidth \fi - \advance\dimen0 by -\linewidth + \advance\dimen0 -\linewidth \hskip.5\dimen0 \vrule \!!width\linewidth @@ -1379,16 +1469,16 @@ \stopcolorpage \egroup} -\def\spacebetweencolumns% +\def\spacebetweencolumns {\hskip\@@klafstand} \presetlocalframed[\??kl] -\def\backgroundfinishcolumnbox% - {\doifinsetelse{\@@kloffset}{\v!geen,\v!overlay} +\def\backgroundfinishcolumnbox + {\doifinsetelse\@@kloffset{\v!geen,\v!overlay} {\let\@@kloffset\!!zeropoint} - {\scratchdimen=\@@kloffset - \advance\scratchdimen by -\@@kllijndikte + {\scratchdimen\@@kloffset + \advance\scratchdimen -\@@kllijndikte \edef\@@kloffset{\the\scratchdimen}}% \localframed [\??kl] @@ -1403,28 +1493,28 @@ \def\complexstartkolommen[#1]% %% \startkolommen {\bgroup - \let\stopkolommen=\egroup + \let\stopkolommen\egroup \ifbinnenkolommen \else \stelkolommenin[#1]% \ifnum\@@kln>1\relax \witruimte \begingroup - \doif{\@@kloptie}{\v!achtergrond} - {\let\finishcolumnbox=\backgroundfinishcolumnbox - \let\columntextoffset=\@@kloffset}% + \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}% + \doifelsenothing\@@klhoogte + \heightencolumnsfalse + \heightencolumnstrue + \doifelse\@@klrichting\v!rechts + \reversecolumnsfalse + \reversecolumnstrue + \doifelse\@@klbalanceren\v!ja + \balancecolumnstrue + \balancecolumnsfalse \processaction % ook nog: laatsteuitlijnen [\@@kluitlijnen] [ \v!ja=>\stretchcolumnstrue @@ -1439,7 +1529,7 @@ % \savecurrentblanko \savecurrentwitruimte - \def\restorecolumnsettings% + \def\restorecolumnsettings {\boxmaxdepth\maxdimen % done elsewhere \restorecurrentblanko \restorecurrentwitruimte}% @@ -1451,7 +1541,7 @@ \ifdim\tussenwit>\zeropoint\relax \stelwitruimtein[\@@klblanko]% \fi - \def\stopkolommen% + \def\stopkolommen {\endmulticolumns \global\binnenkolommenfalse \endgroup @@ -1460,43 +1550,17 @@ \beginmulticolumns \fi \fi} - -%\def\kolom% -% {\ifbinnenkolommen -% \ejectcolumn -% \fi} - -\def\preferredejectcolumn% + +\installcolumnbreakhandler {MUL} \v!voorkeur {\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 +\installcolumnbreakhandler {MUL} \v!ja + {\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} - + \prevdepth-\thousandpoint} % signals top of column to \blanko + \stelkolommenin [\c!n=2, \c!nboven=1, @@ -1515,17 +1579,17 @@ %D Undocumented and still under development. -\def\startsimplecolumns% +\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 + \setbox\scratchbox\vbox\bgroup \forgetall} % \blanko[\v!blokkeer] -\def\stopsimplecolumns% +\def\stopsimplecolumns {\removebottomthings \egroup \rigidcolumnbalance\scratchbox diff --git a/tex/context/base/page-not.tex b/tex/context/base/page-not.tex index 0e36ee314..b8bd84e90 100644 --- a/tex/context/base/page-not.tex +++ b/tex/context/base/page-not.tex @@ -63,12 +63,12 @@ % idem \def\enablenotes - {\global\count\footins=1000 - \global\skip\footins=1\baselineskip\relax} + {\global\count\footins1000 + \global\skip\footins1\baselineskip\relax} \def\disablenotes - {\global\count\footins=0 - \global\skip\footins=\zeropoint} + {\global\count\footins\zerocount + \global\skip\footins \zeropoint} % also @@ -76,7 +76,7 @@ % {\insert\footins{\unvbox\OTRSETsavedfootnotes}} % %\def\savecolumnfootnotes -% {\global\setbox\OTRSETsavedfootnotes=\vbox +% {\global\setbox\OTRSETsavedfootnotes\vbox % {\unvbox\OTRSETsavedfootnotes\box\footins}} \newbox\savednotes @@ -87,7 +87,7 @@ \fi} \def\savenotes - {\global\setbox\savednotes=\vbox + {\global\setbox\savednotes\vbox {\ifvoid\savednotes\else\unvbox\savednotes\fi \box\footins}} diff --git a/tex/context/base/page-num.tex b/tex/context/base/page-num.tex index 25fe38c0f..41ccc8cff 100644 --- a/tex/context/base/page-num.tex +++ b/tex/context/base/page-num.tex @@ -68,13 +68,13 @@ \v!geen=>\subpagingtrue \showingsubpagefalse]}} -\def\aantalsubpaginas% +\def\aantalsubpaginas {\ifshowingsubpage\nofsubpages\else0\fi} -\def\subpaginanummer% +\def\subpaginanummer {\ifshowingsubpage\the\subpageno\else0\fi} -\def\stelsubpaginanummerin% +\def\stelsubpaginanummerin {\dosingleargument\dostelsubpaginanummerin} \def\newnofsubpages{0} @@ -89,7 +89,7 @@ \definetwopasslist\s!subpage -\def\savenofsubpages% +\def\savenofsubpages {\ifsubpaging \showmessage\m!layouts6{\newnofsubpages,\the\subpageno}% \immediatewriteutilitycommand% @@ -99,20 +99,20 @@ {\the\subpageno}}% \fi} -\def\setsubpagenumbers% +\def\setsubpagenumbers {\iftwopassdatafound \bgroup - \xdef\nofsubpages{\twopassdata}% - \xdef\firstsubpage{\realfolio}% + \xdef\nofsubpages {\twopassdata}% + \xdef\firstsubpage {\realfolio}% \advance\realpageno \nofsubpages - \advance\realpageno -1 - \xdef\lastsubpage{\realfolio}% + \advance\realpageno \minusone + \xdef\lastsubpage {\realfolio}% \egroup \else \xdef\nofsubpages{0}% \fi} -\def\gotonextsubpage% overlapt behoorlijk met realpage macro +\def\gotonextsubpage % overlapt behoorlijk met realpage macro {\global\let\checksubpages\relax \ifresettingsubpagenumber \resetnummer[\s!subpage]% @@ -122,12 +122,12 @@ \edef\oldsubpage{\the\subpageno}% \verhoognummer[\s!subpage]% \global\subpageno\ruwenummer[\s!subpage]\relax - \ifnum\subpageno=1 + \ifnum\subpageno=\plusone \gettwopassdata\s!subpage \setsubpagenumbers - \ifnum\oldsubpage>0 + \ifnum\oldsubpage>\zerocount \showmessage\m!layouts6{\newnofsubpages,\oldsubpage}% - \edef\next% + \edef\next % \expanded {\writeutilitycommand% {\twopassentry% {\s!subpage}% @@ -161,7 +161,7 @@ \egroup \fi} -\def\checksubpages% +\def\checksubpages {\getfromtwopassdata\s!subpage1% \setsubpagenumbers \global\let\checksubpages\relax} @@ -185,25 +185,26 @@ \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 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\lastpagenumber{1} + +\def\gotonextrealpage + {\global\advance\realpageno \plusone\relax \ifnum\realpageno>\lastpage \xdef\lastpage{\realfolio}% \fi - \setglobalsystemreference\rt!page\v!eerstepagina\firstpage + \setglobalsystemreference\rt!page\v!eerstepagina \firstpage \setglobalsystemreference\rt!page\v!laatstepagina\lastpage \bgroup - \ifnum\realpageno>1 - \advance\realpageno -1 + \ifnum\realpageno>\plusone + \advance\realpageno \minusone \xdef\prevpage{\realfolio}% \setglobalsystemreference\rt!page\v!achteruit\prevpage \else @@ -214,7 +215,7 @@ \egroup \bgroup \ifnum\realpageno<\lastpage\relax - \advance\realpageno 1 + \advance\realpageno \plusone \xdef\nextpage{\realfolio}% \setglobalsystemreference\rt!page\v!pagina\nextpage \setglobalsystemreference\rt!page\v!vooruit\nextpage @@ -225,7 +226,7 @@ \else \setglobalsystemreference\rt!page\v!volgendeevenpagina\nextnextpage \fi - \advance\realpageno 1 + \advance\realpageno \plusone \xdef\nextnextpage{\realfolio}% \ifnum\realpageno>\lastpage\relax %\ifodd\realpageno @@ -252,13 +253,17 @@ \egroup} \def\checkrealpage - {\global\realpageno0 + {\global\realpageno\zerocount \gotonextrealpage \global\let\checkrealpage\relax} \def\savenofpages - {\advance\realpageno -1 - \savecurrentvalue\lastpage{\realfolio}}% + {\bgroup + \advance\realpageno \minusone + \savecurrentvalue\lastpage\realfolio + \advance\userpageno \minusone + \savecurrentvalue\lastpagenumber\folio + \egroup} \def\totaalaantalpaginas {\lastpage} @@ -295,17 +300,17 @@ \global\shiftedrealpagenotrue \fi \fi} -\def\stelpaginanummerin% +\def\stelpaginanummerin {\dosingleargument\dostelpaginanummerin} % long time used alternative % -% \def\verlaagpaginanummer% +% \def\verlaagpaginanummer % {\doifinset{\@@pnstatus}{\v!start,\v!leeg,\v!geen} % {\verlaagnummer[\s!page]% % \setuserpageno{\ruwenummer[\s!page]}}} % -% \def\verhoogpaginanummer% +% \def\verhoogpaginanummer % {\doifinset{\@@pnstatus}{\v!start,\v!leeg,\v!geen} % {\verhoognummer[\s!page]% % \setuserpageno{\ruwenummer[\s!page]}}% @@ -351,9 +356,9 @@ \definetwopasslist\s!page -\def\dopagesetreference% +\def\dopagesetreference {\doglobal\increment\nofpagesets\relax - \edef\writepagref% + \edef\writepagref {\writeutilitycommand {\twopassentry {\s!page}% @@ -361,7 +366,7 @@ {\noexpand\realfolio}}}% \writepagref} -\def\getpagestatus% hierboven gebruiken +\def\getpagestatus % hierboven gebruiken {\ifdubbelzijdig \gettwopassdata\s!page \iftwopassdatafound \else @@ -411,12 +416,12 @@ \fi \fi} -\def\dosetpagenumberlocation% - {\ExpandBothAfter\doifinsetelse{\v!hoofd}{\@@nmplaats,\@@nmin} +\def\dosetpagenumberlocation + {\ExpandBothAfter\doifinsetelse\v!hoofd{\@@nmplaats,\@@nmin} {\dodosetpagenumberlocation\v!hoofd} {\dodosetpagenumberlocation\v!voet}} -\def\dostelnummeringin[#1]% +\def\dosetuppagenumbering[#1]% {\getparameters[\??nm][#1]% \preparepaginaprefix\??nm \enkelzijdigfalse @@ -434,8 +439,10 @@ \recalculatebackgrounds \recalculatelogos} -\def\stelnummeringin% - {\dosingleempty\dostelnummeringin} +\def\setuppagenumbering + {\dosingleempty\dosetuppagenumbering} + +\let\stelnummeringin\setuppagenumbering % listig: hangt af van \@@kolijst @@ -512,9 +519,9 @@ %D oldstyle numbers are about as high as strutheight. Rather %D interesting that it went unnoticed for so long. -\unexpanded\def\@@plaatspaginanummer% called in empty tests +\unexpanded\def\@@plaatspaginanummer % called in empty tests {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start} - {{\doif{\@@nmstrut}{\v!ja}{\strut}% + {{\doif\@@nmstrut\v!ja\strut \@@nmcommando{\doattributes\??nm\c!letter\c!kleur {\completepagenumber}}}}} @@ -522,16 +529,16 @@ {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start} {\@@nmtekstscheider}} -\def\userfolio% naast realfolio +\def\userfolio % naast realfolio {\nummer[\s!page]} -\def\pagenumber% +\def\pagenumber {\userfolio} -\def\pageprefixes% +\def\pageprefixes {\def\donexttrackcommando##1% - {\doifvalue{\??nm##1\v!nummer}{\v!ja} % v - {\ifnum\countervalue{\??se##1}>0\relax + {\doifvalue{\??nm##1\v!nummer}\v!ja % v + {\ifnum\countervalue{\??se##1}>\zerocount \getvalue{##1\c!nummer}\@@nmnummerscheider \fi}% \doifsomething{\@@nmtekst} @@ -541,11 +548,16 @@ \unexpanded\def\completepagenumber {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start} - {\@@nmlinks\labeltexts{\v!paginanummer}{\pageprefixes\pagenumber}\@@nmrechts}} + {\@@nmlinks\labeltexts\v!paginanummer{\pageprefixes\pagenumber}\@@nmrechts}} \unexpanded\def\placepagenumber {\doif{\@@nmstatus\@@pnstatus}{\v!start\v!start} - {\labeltexts{\v!paginanummer}{\pagenumber}}} + {\labeltexts\v!paginanummer{\pagenumber}}} + +% Nog een variant; wat is een goeie naam? + +% \unexpanded\def\placexxpagenumber +% {\@@plaatspaginanummer} % \def\translatednumber[#1::#2::#3]{#3} diff --git a/tex/context/base/page-one.tex b/tex/context/base/page-one.tex index 58ca78858..aba915b97 100644 --- a/tex/context/base/page-one.tex +++ b/tex/context/base/page-one.tex @@ -24,16 +24,22 @@ \newtoks\OTRONEoutput -\def\OTRONEsethsize% +\def\OTRONEgotonextpage + {\ejectpage} + +\def\OTRONEgotonextpageX % will become obsolete + {\superejectpage} + +\def\OTRONEsethsize {\global\hsize\tekstbreedte} -\def\OTRONEsetvsize% +\def\OTRONEsetvsize {\ifdim\vsize=\teksthoogte \else \bgroup \scratchdimen-\vsize \advance\scratchdimen \teksthoogte \global\advance\vsize \scratchdimen -\relax + \relax \ifdim\pagegoal<\maxdimen \advance\scratchdimen \pagegoal \global\pagegoal\scratchdimen @@ -41,35 +47,119 @@ \egroup \fi} -\def\OTRONEdopagecontents#1#2% \box<n> \unvbox<n> - {\bgroup % niet breedte zetten, kan fractie zijn! - \setbox0=\vbox \ifbottomnotes to \teksthoogte \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 +% \fakefootnotes}% +% \ifbottomnotes +% \ifgridsnapping +% \getnoflines\teksthoogte +% \advance\noflines -1 +% \scratchdimen\noflines\lineheight +% \advance\scratchdimen \topskip +% \else +% \scratchdimen\ht0 +% \fi +% \else +% \scratchdimen\zeropoint +% \fi +% \setbox2\hbox +% {\checksinglecolumnfootnotes +% \lower\scratchdimen\vbox{\placebottomnotes}}% +% \smashbox2% % needed here +% \ifbottomnotes +% \ht0\zeropoint +% \fi +% \vbox to \teksthoogte +% {\box0\box2\ifbottomnotes\else\vfill\fi}% +% \egroup} + +%\def\OTRONEregisteredtextarea#1#2#3% +% {\ifregistertextareas +% % sub optimal, unvbox is nilled here +% \setbox#2\vbox{#1#2}% +% \wd#2\zetbreedte % somehow a space creeps in (in unvbox'd #2) +% \vbox{\registeredtextarea00#2}% +% #3% +% \else +% #1#2#3% +% \fi} + +\chardef\kindofpagetextareas=2 % whole page + +\def\OTRONEregisteredtextarea#1% + {\ifregistertextareas + \setbox0\vbox{#1}% + \wd0\zetbreedte % somehow a space creeps in + \vbox{\registeredtextarea000}% + \else + #1% + \fi} + +\let\OTRONEregisteredtextareaA\firstofoneargument +\let\OTRONEregisteredtextareaB\firstofoneargument + +\def\OTRONEdopagecontents#1#2% \box<n> \unvbox<n> + {\bgroup % niet breedte zetten, kan fractie zijn! + \ifcase\kindofpagetextareas + \or % partial page + \let\OTRONEregisteredtextareaA\OTRONEregisteredtextarea + \or % whole page + \let\OTRONEregisteredtextareaB\OTRONEregisteredtextarea + \fi + \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 + \OTRONEregisteredtextareaA{#1#2}% + \vskip-\currentpagedepth\vskip\openstrutdepth + \pushcolor % moved from just after #1#2 + \prevdepth\openstrutdepth \dobotinsertions \vfil \else\ifr@ggedbottom - \vskip-\currentpagedepth - \vskip\openstrutdepth % \dp\strutbox - \prevdepth\openstrutdepth % \dp\strutbox + \OTRONEregisteredtextareaA{#1#2}% + \vskip-\currentpagedepth\vskip\openstrutdepth + \pushcolor % moved from just after #1#2 + \prevdepth\openstrutdepth \dobotinsertions \vfil \else\ifb@selinebottom - \kern-\currentpagedepth - \kern\maxdepth + \OTRONEregisteredtextareaA{#1#2}% + \kern-\currentpagedepth\kern\maxdepth + \pushcolor % moved from just after #1#2 \dobotinsertions + \else + \OTRONEregisteredtextareaA{#1#2}% + \pushcolor % moved from just after #1#2 + \dobotinsertions % added \fi\fi\fi \fakefootnotes}% \ifbottomnotes \ifgridsnapping \getnoflines\teksthoogte - \advance\noflines -1 + \advance\noflines \minusone \scratchdimen\noflines\lineheight \advance\scratchdimen \topskip \else @@ -78,41 +168,42 @@ \else \scratchdimen\zeropoint \fi - \setbox2=\hbox + \setbox2\hbox {\checksinglecolumnfootnotes \lower\scratchdimen\vbox{\placebottomnotes}}% - \smashbox2% % needed here + \smashbox2% % needed here \ifbottomnotes \ht0\zeropoint \fi - \vbox to \teksthoogte - {\box0\box2\ifbottomnotes\else\vfill\fi}% + \OTRONEregisteredtextareaB + {\vbox to \teksthoogte + {\box0\box2\ifbottomnotes\else\vfill\fi}}% \egroup} -\def\OTRONEfinalsidefloatoutput% +\def\OTRONEfinalsidefloatoutput {\finaloutput\unvbox\normalpagebox} -\OTRONEoutput% +\OTRONEoutput {\sidefloatoutput} %D Insertions \newif\iftopofinsert -\def\OTRONEdosettopinserts% +\def\OTRONEdosettopinserts {\bgroup \ifsomefloatwaiting - \noffloatinserts0 + \noffloatinserts\zerocount \let\totaltopinserted\!!zeropoint \OTRONEdodosettopinserts - \ifnum\@@bknonder=0 - \ifnum\@@bknregels>0 + \ifnum\@@bknonder=\zerocount + \ifnum\@@bknregels>\zerocount \ifdim\totaltopinserted>\zeropoint\relax \dimen0=\lineheight \dimen0=\@@bknregels\dimen0 \advance\dimen0 \totaltopinserted\relax \ifdim\dimen0>\teksthoogte - \showmessage{\m!floatblocks}{8}{\@@bknregels}% + \showmessage\m!floatblocks8\@@bknregels \vfilll\eject \fi \fi @@ -121,7 +212,7 @@ \fi \egroup} -\def\OTRONEdodosettopinserts% +\def\OTRONEdodosettopinserts {\ifnum\noffloatinserts<\noftopfloats \dogetfloat \ifdim\topinserted=\zeropoint @@ -146,7 +237,7 @@ \flushfloatbox \blanko[\@@bknawit]}% \ifsomefloatwaiting - \advance\noffloatinserts 1 + \advance\noffloatinserts \plusone \else \noffloatinserts\noftopfloats\relax \fi @@ -163,15 +254,15 @@ \fi \OTRONEdodosettopinserts} -\def\OTRONEdosetbotinserts% +\def\OTRONEdosetbotinserts {\bgroup \ifsomefloatwaiting - \noffloatinserts0 + \noffloatinserts\zerocount \OTRONEdodosetbotinserts \fi \egroup} -\def\OTRONEdodosetbotinserts% +\def\OTRONEdodosetbotinserts {\ifnum\noffloatinserts<\nofbotfloats\relax \dogetfloat \global\advance\botinserted \ht\floatbox\relax @@ -183,7 +274,7 @@ \blanko[\@@bkvoorwit]% \flushfloatbox}% \ifsomefloatwaiting - \advance\noffloatinserts 1 + \advance\noffloatinserts \plusone \else \noffloatinserts\nofbotfloats \fi @@ -201,7 +292,7 @@ \fi \OTRONEdodosetbotinserts} -\def\OTRONEdosetbothinserts% +\def\OTRONEdosetbothinserts {\ifflushingfloats \global\topinserted\zeropoint \global\botinserted\zeropoint @@ -210,7 +301,7 @@ \global\botinserted\zeropoint \OTRONEdosetbotinserts \fi} -\def\OTRONEdotopinsertions% +\def\OTRONEdotopinsertions {\ifvoid\topins\else \ifgridsnapping %\topsnaptogrid{\box\topins} @@ -221,10 +312,10 @@ \fi \global\topinserted\zeropoint} -\def\OTRONEdobotinsertions% +\def\OTRONEdobotinsertions {\ifvoid\botins\else \ifgridsnapping - \snaptogrid\hbox{\box\botins} + \snaptogrid\hbox{\box\botins}% \else \unvbox\botins \fi @@ -232,24 +323,24 @@ \global\botinserted\zeropoint \global\nofloatpermittedfalse} -\def\OTRONEdoflushfloats% +\def\OTRONEdoflushfloats {\global\flushingfloatstrue \ifsomefloatwaiting \par - \ifvmode\prevdepth=\maxdimen\fi % prevents whitespace + \ifvmode \prevdepth\maxdimen \fi % prevents whitespace \OTRONEdodoflushfloats \fi - \global\savednoffloats0 + \global\savednoffloats\zerocount \global\somefloatwaitingfalse \global\flushingfloatsfalse} -\def\OTRONEflushfloatbox% nog verder doorvoeren en meer info in marge +\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 +% \def\OTRONEdodoflushfloats % moet nog beter: als precies passend, niet onder baseline % {\ifsomefloatwaiting % \bgroup % \box\floatbox can be in use! % \dogetfloat @@ -259,7 +350,7 @@ % \expandafter\OTRONEdodoflushfloats % \fi} -\def\OTRONEdodoflushfloats% much in common with OTRSET +\def\OTRONEdodoflushfloats % much in common with OTRSET {\ifsomefloatwaiting \ifpackflushedfloats \centerfloatboxfalse @@ -311,16 +402,16 @@ \expandafter\OTRONEdodoflushfloats \fi} -\def\OTRONEdocheckiffloatfits% vervangen ivm downward comp +\def\OTRONEdocheckiffloatfits % vervangen ivm downward comp {\ifnofloatpermitted \global\roomforfloatfalse \else - \dimen0=\pagetotal + \dimen0 \pagetotal \advance\dimen0 \ht\floatbox \advance\dimen0 \dp\floatbox \advance\dimen0 \floattopskip \advance\dimen0 -\pageshrink % toegevoegd -%\message{c:\the\mofcolumns,t:\the\pagetotal,g:\the\pagegoal}%\wait + %\message{c:\the\mofcolumns,t:\the\pagetotal,g:\the\pagegoal}%\wait \ifdim\dimen0>\pagegoal \global\roomforfloatfalse \else @@ -337,23 +428,23 @@ \doinsertfloatinfo \doif\@@bkspringvolgendein\v!nee\noindentation} % new -\def\OTRONEsomefixdfloat% [#1]% +\def\OTRONEsomefixdfloat % [#1] {\docheckiffloatfits \ifroomforfloat\else \goodbreak \fi \showmessage\m!floatblocks9\empty - \someherefloat} % [#1]}% + \someherefloat} % [#1] \def\OTRONEsomesidefloat[#1]% links, rechts NOG TESTEN EN AANPASSEN {\ifbinnenkolommen \someelsefloat[\v!hier]% \else %\checkwaitingfloats{#1}% - \def\logsidefloat% + \def\logsidefloat {\doinsertfloatinfo}% - \setbox\floatbox=\vbox{\box\floatbox}% - \wd\floatbox=\floatwidth + \setbox\floatbox\vbox{\box\floatbox}% + \wd\floatbox\floatwidth \processfirstactioninset [#1] [ \v!links=>\leftfloat{\box\floatbox}, @@ -366,34 +457,33 @@ \v!rechterrand=>\rightedgefloat{\box\floatbox}, \v!inmarge=>{\doinmargenormal\leftmarginfloat \rightmarginfloat{\box\floatbox}}]% - \doifinset{\v!lang}{#1} - {\flushsidefloatsafterpar}% + \doifinset\v!lang{#1}\flushsidefloatsafterpar \fi} \def\OTRONEsomepagefloat[#1]% {%\checkwaitingfloats{#1}% - \global\setbox\collectedpagefloats=\vbox + \global\setbox\collectedpagefloats\vbox {\unvbox\collectedpagefloats \vbox to \teksthoogte - {\doifnotinset{\v!hoog}{#1}{\vfill} + {\doifnotinset\v!hoog{#1}\vfill \box\floatbox - \doifnotinset{\v!laag}{#1}{\vfill}} + \doifnotinset\v!laag{#1}\vfill}% \goodbreak}% \doinsertfloatinfo} \def\OTRONEsometopsfloat[#1]% - {\ifdim\topinserted=\!!zeropoint\relax + {\ifdim\topinserted=\zeropoint \topofinserttrue \else \topofinsertfalse \fi - \global\advance\topinserted by \ht\floatbox - \global\advance\topinserted by \dp\floatbox - \global\advance\topinserted by \floatbottomskip + \global\advance\topinserted \ht\floatbox + \global\advance\topinserted \dp\floatbox + \global\advance\topinserted \floatbottomskip \insert\topins {\forgetall \iftopofinsert - \kern-\lineskip\par\prevdepth=\maxdimen + \kern-\lineskip\par\prevdepth\maxdimen \else %\blanko[-\@@bknawit,\@@bkvoorwit]% inserts can't look back \betweenfloatblanko @@ -403,9 +493,9 @@ \doinsertfloatinfo} \def\OTRONEsomebotsfloat[#1]% - {\global\advance\botinserted by \ht\floatbox - \global\advance\botinserted by \dp\floatbox - \global\advance\botinserted by \floattopskip + {\global\advance\botinserted \ht\floatbox + \global\advance\botinserted \dp\floatbox + \global\advance\botinserted \floattopskip \insert\botins {\forgetall \blanko[\@@bkvoorwit]% @@ -413,4 +503,7 @@ %\global\nofloatpermittedtrue \doinsertfloatinfo} +\def\OTRONEnextcolumn[#1]% + {} + \protect \endinput diff --git a/tex/context/base/page-run.tex b/tex/context/base/page-run.tex index b0d6dbf9e..07080f08c 100644 --- a/tex/context/base/page-run.tex +++ b/tex/context/base/page-run.tex @@ -21,13 +21,13 @@ \c!strut=\v!nee] {\forgetall \mindermeldingen - \globaldefs=-1 - \dimen0=\pagegoal + \globaldefs\minusone + \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 + \setbox0\vbox {\framed [\c!offset=\v!overlay,\c!strut=\v!nee, \c!breedte=\papierbreedte,\c!hoogte=\papierhoogte] @@ -43,10 +43,10 @@ \mirrorprintbox0% \rotateprintbox0% \offsetprintbox0% - \pagegoal=\dimen0 + \pagegoal\dimen0 \box0}} -\gdef\showprint% +\gdef\showprint {\dotripleempty\doshowprint} % \switchnaarkorps[8pt] @@ -135,20 +135,20 @@ \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} + {#1&\scratchdimen#2\PtToCm{\the\scratchdimen}&% + \scratchdimen#2\relax\the\scratchdimen&\tttf\string#2\cr} \fi % \startinterface english % english is fallback -\gdef\showsetups% +\gdef\showsetups {\noindent \vbox {\forgetall \mindermeldingen \switchtobodyfont[\v!klein] - \tabskip\!!zeropoint + \tabskip\zeropoint \halign {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr \showsetupA{paperheight} \paperheight @@ -188,13 +188,13 @@ \startinterface dutch -\gdef\showsetups% +\gdef\showsetups {\noindent \vbox {\forgetall \mindermeldingen \switchtobodyfont[\v!klein] - \tabskip\!!zeropoint + \tabskip\zeropoint \halign {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr \showsetupA{papierhoogte} \papierhoogte @@ -243,7 +243,7 @@ {\forgetall \mindermeldingen \switchtobodyfont[\v!klein] - \tabskip\!!zeropoint + \tabskip\zeropoint \halign {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr \showsetupA{papierhoehe} \papierhoehe @@ -289,7 +289,7 @@ {\forgetall \mindermeldingen \switchtobodyfont[\v!klein] - \tabskip\!!zeropoint + \tabskip\zeropoint \halign {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr \showsetupA{vyskapapiru} \vyskapapiru @@ -335,7 +335,7 @@ {\forgetall \mindermeldingen \switchtobodyfont[\v!klein] - \tabskip\!!zeropoint + \tabskip\zeropoint \halign {\strut##\quad\hss&##\quad\hss&##\quad\hss&##\hss\cr \showsetupA{paperheight} \paperheight @@ -373,7 +373,7 @@ \stopinterface -\gdef\showlayout% interfereert lelijk met een \typefile er na +\gdef\showlayout % interfereert lelijk met een \typefile er na {\bgroup \pagina \showframe diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex index 18c69b769..d7d4409c3 100644 --- a/tex/context/base/page-set.tex +++ b/tex/context/base/page-set.tex @@ -11,18 +11,18 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% getnoflines vs getrawnoflines +% getnoflines vs getrawnoflines \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 : 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 +% todo : test page areas per page -\unprotect +\unprotect \newcount\tofcolumns % total \newcount\lofcolumns % left @@ -64,16 +64,16 @@ \def\columnerasegridboxes {\bgroup \increment\columnmaxcells\relax - \ifodd\realpageno + \ifodd\realpageno \else % we are on the other page \columnspreadfalse \fi \ifcolumnspread \dorecurse\nofcolumns {\let\!!stringa\recurselevel - \scratchcounter=\recurselevel \advance\scratchcounter\lofcolumns + \scratchcounter\recurselevel \advance\scratchcounter\lofcolumns \edef\!!stringb{\the\scratchcounter}% - \dostepwiserecurse{0}{\columnmaxcells}{1} + \dostepwiserecurse \zerocount \columnmaxcells \plusone {\ifcsname\@otr@:\!!stringa:\recurselevel\endcsname \global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box \ifcsname\@otr@:\!!stringb:\recurselevel\endcsname @@ -93,9 +93,9 @@ \fi \fi}}% \else - \dorecurse\tofcolumns + \dorecurse \tofcolumns {\let\!!stringa\recurselevel - \dostepwiserecurse{0}{\columnmaxcells}{1} + \dostepwiserecurse \zerocount \columnmaxcells \plusone {\ifcsname\@otr@:\!!stringa:\recurselevel\endcsname \global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\voidb@x \else @@ -104,9 +104,9 @@ \fi \dorecurse\tofcolumns {\global\setbox\csname\@otr@:\recurselevel:\columnmaxcells\endcsname\copy\placeholderboxa}% - \global\columnfirstcell=0 - \global\columnlastcell=\columnfirstcell - \global\columnfreecells=\columnfirstcell + \global\columnfirstcell\zerocount + \global\columnlastcell\columnfirstcell + \global\columnfreecells\columnfirstcell \egroup} \endETEX @@ -122,9 +122,9 @@ \ifcolumnspread \dorecurse\nofcolumns {\let\!!stringa\recurselevel - \scratchcounter=\recurselevel \advance\scratchcounter\lofcolumns + \scratchcounter\recurselevel \advance\scratchcounter\lofcolumns \edef\!!stringb{\the\scratchcounter}% - \dostepwiserecurse{0}{\columnmaxcells}{1} + \dostepwiserecurse \zerocount \columnmaxcells \plusone {\expandafter\ifx\csname\@otr@:\!!stringa:\recurselevel\endcsname\relax \expandafter\newbox\csname\@otr@:\!!stringa:\recurselevel\endcsname \expandafter\ifx\csname\@otr@:\!!stringb:\recurselevel\endcsname\relax @@ -146,7 +146,7 @@ \else \dorecurse\tofcolumns {\let\!!stringa\recurselevel - \dostepwiserecurse{0}{\columnmaxcells}{1} + \dostepwiserecurse \zerocount \columnmaxcells \plusone {\expandafter\ifx\csname\@otr@:\!!stringa:\recurselevel\endcsname\relax \expandafter\newbox\csname\@otr@:\!!stringa:\recurselevel\endcsname \else @@ -155,7 +155,7 @@ \fi \dorecurse\tofcolumns {\global\setbox\csname\@otr@:\recurselevel:\columnmaxcells\endcsname\copy\placeholderboxa}% - \global\columnfirstcell=0 + \global\columnfirstcell\zerocount \global\columnlastcell\columnfirstcell \global\columnfreecells\columnfirstcell \egroup} @@ -163,17 +163,17 @@ \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} + {\!!countd#2\advance\!!countd#4\advance\!!countd\minusone + \!!counte#3\advance\!!counte#5\advance\!!counte\minusone + \dostepwiserecurse{#2}\!!countd\plusone {\!!countf\recurselevel - \dostepwiserecurse{#3}{\!!counte}{1} + \dostepwiserecurse{#3}\!!counte\plusone {\OTRSETsetgridcell\!!countf\recurselevel#1}}% - \dostepwiserecurse{#3}{\!!counte}{1} - {\global\wd\OTRSETgridcell{#2}\recurselevel=\hsize}% + \dostepwiserecurse{#3}\!!counte\plusone + {\global\wd\OTRSETgridcell{#2}\recurselevel\hsize}% \OTRSETsetgridcell{#2}\!!counte#6} -\def\OTRSETsetgridcells% +\def\OTRSETsetgridcells {\doOTRSETsetgridcells{\copy\placeholderboxb}} \def\OTRSETerasegridcells#1#2#3#4% @@ -182,9 +182,9 @@ \def\OTRSETsetfreecells#1#2% col start {\global\columnfirstcell\ifnum#2=0 1\else#2\fi\relax \ifnum\columnfirstcell>\columnmaxcells - \global\columnfreecells0 - \global\columnfirstcell1 - \global\columnlastcell 0 + \global\columnfreecells\zerocount + \global\columnfirstcell\plusone + \global\columnlastcell \zerocount \global\somefreecolumncellsfalse %\message{no cells a}% \else @@ -193,7 +193,7 @@ \exitloop \else \OTRSETdoifcellelse{#1}\columnfirstcell - {\global\advance\columnfirstcell 1 } + {\global\advance\columnfirstcell\plusone} {\exitloop}% \fi}% \global\columnlastcell\columnfirstcell @@ -202,13 +202,13 @@ \exitloop \else \OTRSETdoifcellelse{#1}\columnlastcell - {\global\advance\columnlastcell -1 \exitloop} - {\global\advance\columnlastcell 1 }% + {\global\advance\columnlastcell \minusone \exitloop} + {\global\advance\columnlastcell \plusone }% \fi}% \ifnum\columnfirstcell>\columnmaxcells - \global\columnfreecells0 - \global\columnfirstcell1 - \global\columnlastcell 0 + \global\columnfreecells\zerocount + \global\columnfirstcell\plusone + \global\columnlastcell \zerocount \global\somefreecolumncellsfalse %\message{no cells b}% \else @@ -217,44 +217,44 @@ \fi \global\columnfreecells\columnlastcell \global\advance\columnfreecells -\columnfirstcell - \global\advance\columnfreecells 1 + \global\advance\columnfreecells \plusone \global\somefreecolumncellstrue %\message{\number\columnfirstcell-\number\columnlastcell=\number\columnfreecells}% \fi \fi} \def\OTRSETgetmaxfreecells#1#2% col start - {\scratchcounter0 - \edef\columnmaxfreecells{0}% - \edef\columnfrmfreecells{0}% - \dostepwiserecurse{#2}{\columnmaxcells}{1} - {\OTRSETdoifcellelse{#1}{\recurselevel} + {\scratchcounter\zerocount + \let\columnmaxfreecells\!!zerocount + \let\columnfrmfreecells\!!zerocount + \dostepwiserecurse{#2}\columnmaxcells\plusone + {\OTRSETdoifcellelse{#1}\recurselevel {\ifnum\columnmaxfreecells<\scratchcounter \edef\columnmaxfreecells{\the\scratchcounter}% \let\columnfrmfreecells\recurselevel \fi - \scratchcounter0 } - {\advance\scratchcounter 1 }}} + \scratchcounter\zerocount} + {\advance\scratchcounter\plusone}}} \long\def\OTRSETrecurseRL#1% - {\dostepwiserecurse{\nofcolumns}{1}{-1} + {\dostepwiserecurse\nofcolumns\plusone\minusone {#1\hskip\OTRSETgetparameter\c!afstand\recurselevel}} -\def\OTRSETmakegridbox% - {\ifcase\columndirection - \OTRSETdomakegridbox{1}{\nofcolumns}{+1}% +\def\OTRSETmakegridbox + {\ifcase\columndirection + \OTRSETdomakegridbox\plusone\nofcolumns\plusone \else - \OTRSETdomakegridbox{\nofcolumns}{1}{-1}% + \OTRSETdomakegridbox\nofcolumns\plusone\minusone \fi} - + \def\OTRSETdomakegridbox#1#2#3% {\hbox\bgroup - % -\forgetall % can go once in flush - \ifbalancecolumns + \dontcomplain + \forgetall % can go once in flush + \ifbalancecolumns \ifnum\realpageno=\balancingpageno\relax - \!!heighta \localcolumnmaxcells\lineheight - \xdef\localcolumnmaxcells{0}% + \!!heighta \localcolumnmaxcells\lineheight + \global\let\localcolumnmaxcells\!!zerocount \else \!!heighta \teksthoogte \fi @@ -262,17 +262,17 @@ \!!heighta \teksthoogte \fi % - % test first ! + % test first ! \hbox to \zetbreedte {\dostepwiserecurse{#1}{#2}{#3} - {\mofcolumns=\recurselevel - \localcolumnwidth=\OTRSETlocalwidth\mofcolumns - \setbox\scratchbox=\hbox\localframed + {\mofcolumns\recurselevel + \localcolumnwidth\OTRSETlocalwidth\mofcolumns + \setbox\scratchbox\hbox\localframed [\??mc\OTRSETidentifier\number\mofcolumns]% - [\c!breedte=\localcolumnwidth,\c!hoogte=\!!heighta]% \teksthoogte]% + [\c!breedte=\localcolumnwidth,\c!hoogte=\!!heighta,\c!regels=]% {}% -\wd\scratchbox\localcolumnwidth -\ht\scratchbox\!!heighta + \wd\scratchbox\localcolumnwidth + \ht\scratchbox\!!heighta \ifcase\columndirection \hskip\OTRSETgetparameter\c!afstand\recurselevel \box\scratchbox @@ -281,18 +281,18 @@ \hskip\OTRSETgetparameter\c!afstand\recurselevel \fi}}% \hskip-\zetbreedte - % main text + % main text \hbox to \zetbreedte {\dostepwiserecurse{#1}{#2}{#3} - {\mofcolumns=\recurselevel - \localcolumnwidth=\OTRSETlocalwidth\mofcolumns + {\mofcolumns\recurselevel + \localcolumnwidth\OTRSETlocalwidth\mofcolumns \offinterlineskip - \setbox\scratchbox=\vbox to \!!heighta % \teksthoogte + \setbox\scratchbox\vbox to \!!heighta % \teksthoogte {\topskipcorrection - \dorecurse{\columnmaxcells} - {\setbox\scratchbox=\hbox{\OTRSETgetgridcell\mofcolumns\recurselevel}% - \ht\scratchbox=\ht\strutbox - \dp\scratchbox=\dp\strutbox + \dorecurse\columnmaxcells + {\setbox\scratchbox\hbox{\OTRSETgetgridcell\mofcolumns\recurselevel}% + \ht\scratchbox\ht\strutbox + \dp\scratchbox\dp\strutbox \ifcase\columndirection \box\scratchbox \else @@ -300,7 +300,7 @@ {\hskip\localcolumnwidth\llap{\box\scratchbox}}% \fi \par}}% - \wd\scratchbox=\localcolumnwidth % \tekstbreedte + \wd\scratchbox\localcolumnwidth % \tekstbreedte \ifcase\columndirection \hskip\OTRSETgetparameter\c!afstand\recurselevel\box\scratchbox \else @@ -308,28 +308,8 @@ \fi}}% \egroup} -\ifx\registerMPtextarea\undefined - \let\registerMPtextarea\firstofoneargument -\fi - -\def\OTRSETregistergridbox#1#2% - {\bgroup - \setbox\nextbox\null - \wd\nextbox\wd#2% - \ht\nextbox\ht#2% - \dp\nextbox\dp#2% - \setbox\nextbox\hbox{\lower\dp\strutbox\box\nextbox}% - \ifnum#1=1 - \setbox\nextbox\hbox{\raise\topskip\hbox{\lower\ht\strutbox\box\nextbox}}% - \dp\nextbox\dp\strutbox - \fi - \setbox\nextbox\hbox{\registerMPtextarea{\box\nextbox}}% - \smashbox\nextbox - \box\nextbox\box#2% - \egroup} - -\def\OTRSETreducegridbox% - {\ifnum\localcolumnmaxcells>0 +\def\OTRSETreducegridbox + {\ifnum\localcolumnmaxcells>\zerocount \let\columnmaxcells\localcolumnmaxcells \fi} @@ -344,8 +324,8 @@ \ht\scratchbox\ht\strutbox \dp\scratchbox\dp\strutbox \OTRSETsetgridcell\nofcolumns\lastcolumnlastcell\box\scratchbox - \fi - \global\lastcolumnlastcell=0 + \fi + \global\lastcolumnlastcell\zerocount \fi} %\def\OTRSETdoflush @@ -354,25 +334,25 @@ % \else % \OTRSETdofinalflush % \OTRSETinitializecolumns -% \OTRSETmanualbalance % or after \gotonextpage +% \OTRSETmanualbalance % or after \startnextpage % %\OTRSETdoflushfloats -% \OTRSETgotonextpage +% \OTRSETstartnextpage % \fi} \def\OTRSETdoflush {\ifcollectingcontent - \global\mofcolumns1 + \global\mofcolumns\plusone \else - \OTRSETdofinalflush + \OTRSETdofinalflush \OTRSETdofinaloutput \OTRSETinitializecolumns - \OTRSETmanualbalance % or after \gotonextpage + \OTRSETmanualbalance % or after \startnextpage %\OTRSETdoflushfloats - \OTRSETgotonextpage + \OTRSETstartnextpage \initializecolumntextareas \fi} -%\def\OTRSETdofinalflush % see \OTRSETdoflush +%\def\OTRSETdofinalflush % see \OTRSETdoflush % {\OTRSETflushfinalfootnotes % \placecolumntextareas % \OTRSETcentergridcells @@ -382,15 +362,15 @@ \newbox\OTRfinalpagebox -\def\OTRSETdofinalflush % see \OTRSETdoflush +\def\OTRSETdofinalflush % see \OTRSETdoflush {\OTRSETflushfinalfootnotes \placecolumntextareas \OTRSETcentergridcells - \bgroup % we want to keep the reduction local + \bgroup % we want to keep the reduction local \OTRSETreducegridbox \global\setbox\OTRfinalpagebox\OTRSETmakegridbox - \egroup % otherwise we get the wrong number of free cells - %\gdef\localcolumnmaxcells{0}% here ? + \egroup % otherwise we get the wrong number of free cells + %\gdef\localcolumnmaxcells{0}% here ? \global\mofcolumns\nofcolumns} % otherwise problems in finaloutput \def\OTRSETdofinaloutput @@ -402,10 +382,10 @@ \appendtoks \OTRSETflushbalancinglist \to \everystoptext -\def\OTRSETflushbalancinglist% - {\scratchcounter0 +\def\OTRSETflushbalancinglist + {\scratchcounter\zerocount \def\docommando##1% - {\advance\scratchcounter 1 + {\advance\scratchcounter \plusone \immediatewriteutilitycommand {\twopassentry{\s!colset}{\the\scratchcounter}{##1}}}% \processcommacommand[\OTRSETbalancinglist]\docommando} @@ -425,38 +405,39 @@ \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?) +\def\OTRSETsetvsize % snap per sectie (gap here?) {\ifcollectingcontent \else % can be assigndimen - \OTRSETcheckinsert % added + \OTRSETcheckinsert % added \OTRSETsetfreecells\mofcolumns\columnfirstcell \ifsomefreecolumncells - \global\vsize=\columnfreecells\lineheight - %\global\pagegoal=\vsize % niet nodig, tenzij binnen otr - \dosynchronizeoutput - \allowbreak % hm + \global\vsize\columnfreecells\lineheight + \global\pagegoal\vsize % niet nodig, tenzij binnen otr + \synchronizeoutput % fails on example + % \allowbreak % hm \fi \synchronizenotes \fi} -\def\OTRSETsethsize% +\def\OTRSETsethsize {%\OTRSETassignwidth\OTRSETidentifier\to\localcolumnwidth - \localcolumnwidth=\OTRSETlocalwidth\mofcolumns + \localcolumnwidth\OTRSETlocalwidth\mofcolumns \tekstbreedte\localcolumnwidth \hsize\localcolumnwidth} -\def\OTRSETcheckfreelines% +\def\OTRSETcheckfreelines {\OTRSETsetvsize} -\def\doOTRSETcolumnseparator% +\def\doOTRSETcolumnseparator {\hbox to \zeropoint{\hss\red\vl\hss}} \let\OTRSETcolumnseparator\relax -\def\showbreaks% +\def\showbreaks {\let\OTRSETcolumnseparator\doOTRSETcolumnseparator} -\def\OTRSETnextcolumn% - {\ifhmode +\installcolumnbreakhandler {SET} \v!ja + {% hmmm: + \ifhmode \bgroup \removeunwantedspaces \parfillskip\zeropoint @@ -464,34 +445,114 @@ \par \egroup \fi - \page\relax % hack. \page should be page -}% \OTRSETsethsize} % no, can be mid smaller (like tabulate) + % brrr: + \ejectinsert + \ejectpage} % no \OTRSETsethsize, can be mid smaller (like tabulate) + +% \installcolumnbreakhandler {SET} \v!forceer +% {\OTRSETgotocolumn[\v!forceer]} +% \installcolumnbreakhandler {SET} \v!eerste +% {\OTRSETgotocolumn[\v!eerste]} +% \installcolumnbreakhandler {SET} \v!laatste +% {\OTRSETgotocolumn[\v!laatste]} + +\installcolumnbreakhandler {SET} \s!unknown + {\expanded{\OTRSETgotocolumn[\@@columnspecification]}} + +% \installcolumnbreakhandler {SET} \v!pagina +% {\simplepagebreak % \flushnotes \executepagebreakhandler\v!ja +% \ifnum\mofcolumns>\plusone +% \OTRSETgotocolumn[\v!laatste,\v!forceer]% +% \fi} + +\installcolumnbreakhandler {SET} \v!pagina + {\vfill\eject % \doejectpage\eject + \OTRSETgotonextpage} \newtoks\OTRSETeverystartofcolumn \newbox\OTRSETsavedfootnotes -% \installoutput\OTRSETflushtextsofar goes wrong +% \installoutput\OTRSETflushtextsofar % spacing goes wrong + +%\def\OTRSETflushtextsofar +% {\ifvoid\normalpagebox \else +% \setbox\scratchbox\vbox{\unvbox\normalpagebox}% +% \OTRSETsavenotes +% \OTRSEThandleflushedtext0 +% \fi} + +% The complication is in the fact that when the HERE float +% is placed, the otr is not invoked when there is not yet +% enough content; this can lead to a change in order (turning +% on the tracer with option 0 is very instructive, watch the +% small numbers in the margin) +% +% 0 = no flushing, so no interference but user should handle +% border cases of placement +% 1 = the normal otr, rather untested +% 2 = a solution that works ok, is experimental and above +% all messy + +\chardef\OTRSETflushtextmode=0 \def\OTRSETflushtextsofar - {\ifvoid\normalpagebox \else - \setbox\scratchbox=\vbox{\unvbox\normalpagebox}% + {\ifcase\OTRSETflushtextmode + % don't mess around + \or + % the normal one + \ifvoid\normalpagebox\else + \OTRSETnaturalflush + \OTRSETcheckfreelines + \fi + \or + % way to complicated, but kind of ok + \doOTRSETflushtextsofar + \fi} + +\newskip\lastskipinotr + +\installoutput\doOTRSETflushtextsofar % experimental + {\ifvoid\normalpagebox\else + \scratchdimen\dp\normalpagebox + \setbox\scratchbox\vbox + {\forgetall + \unvbox\normalpagebox + \global\lastskipinotr\lastskip\relax + \ifdim\lastskipinotr>\zeropoint\relax + \removelastskip + \else + \kern-\scratchdimen % handle depth + \fi}% + \ifdim\lastskipinotr>\zeropoint + \scratchskip\ht\scratchbox + \setbox\scratchbox\hbox + {\lower\strutdepth\box\scratchbox}% + \dp\scratchbox\scratchdimen + \ht\scratchbox\scratchskip + \fi \OTRSETsavenotes \OTRSEThandleflushedtext0 + \ifdim\lastskipinotr>\zeropoint + %\vskip \lastskipinotr % hm, gets lost anyway + \else + % we should not discard skips after here; tricky + \fi + \OTRSETsetvsize \fi} \def\OTRSETplacebottomnotes {\iflastcolumnfootnotes - \ifnum\nofcolumns=\mofcolumns + \ifnum\nofcolumns=\mofcolumns \ifintermediatefootnotes \placebottomnotes \fi \fi \else - \placebottomnotes + \placebottomnotes \fi} \def\OTRSETflushsavednotes {\iflastcolumnfootnotes - \ifnum\nofcolumns=\mofcolumns + \ifnum\nofcolumns=\mofcolumns \flushsavednotes \fi \else @@ -507,89 +568,92 @@ \appendtoks \OTRSETflushsavednotes \to \OTRSETeverystartofcolumn -\def\OTRSETnaturalflush% - {\setbox0=\vbox to \columnfreecells\lineheight +\def\OTRSETnaturalflush + {\bgroup + \forgetall % new, needed ! + \setbox0\vbox to \columnfreecells\lineheight {\vskip-\topskip \vskip\lineheight \prevdepth\dp\strutbox \unvbox\normalpagebox \vfill}% - \setbox2=\hbox + \setbox2\hbox {\OTRSETplacebottomnotes}% - \setbox\scratchbox=\hbox - {\wd0=\zeropoint\box0\box2}% - \dp\scratchbox=\dp\strutbox - \OTRSEThandleflushedtext1} + \setbox\scratchbox\hbox + {\wd0\zeropoint\box0\box2}% + \dp\scratchbox\dp\strutbox + \OTRSEThandleflushedtext1 + \egroup} \newcount\lastcolumnlastcell \def\OTRSEThandleflushedtext#1% {\getnoflines{\ht\scratchbox}% - \wd\scratchbox=\tekstbreedte % geen \hsize kan < zijn in bv split tabulate + %\wd\scratchbox\tekstbreedte % geen \hsize kan < zijn in bv split tabulate + \wd\scratchbox\OTRSETlocalwidth\mofcolumns \doOTRSETsetgridcells {\copy\placeholderboxf} - {\mofcolumns}{\columnfirstcell}{1}{\noflines} - %{\copy\scratchbox}% \box - {\hbox{\OTRSETregistergridbox\columnfirstcell\scratchbox}}% - \global\columnlastcell=\columnfirstcell + \mofcolumns\columnfirstcell\plusone\noflines + {\registeredtextarea1\columnfirstcell\scratchbox}% == \hbox + \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 + \global\lastcolumnlastcell\columnlastcell + \global\advance\lastcolumnlastcell \minusone + % find next (acceptable) gap, todo: deadcycle + \ifcase#1\else + \OTRSETfillgapsbetweencells\mofcolumns\columnlastcell + \fi \OTRSETfindnextgap - %\message{\the\mofcolumns,\the\columnfirstcell,\the\columnfreecells}\wait -% \OTRSETsethsize % no, can be mid smaller (like tabulate) + % \message{\the\mofcolumns,\the\columnfirstcell,\the\columnfreecells}\wait + % \OTRSETsethsize % no, can be mid smaller (like tabulate) \OTRSETsetvsize} -\def\OTRSETfindnextgap% +\def\OTRSETfindnextgap {\OTRSETsetfreecells\mofcolumns\columnlastcell \ifsomefreecolumncells - % okay + % okay \else - \global\advance\mofcolumns 1 \relax + \global\advance\mofcolumns \plusone \ifnum\mofcolumns>\nofcolumns \OTRSETdoflush - \global\columnlastcell=1 - \global\columnfirstcell=0 + \global\columnlastcell\plusone + \global\columnfirstcell\zerocount \OTRSETdoflushfloats \else \the\OTRSETeverystartofcolumn - \global\columnlastcell=1 - \global\columnfirstcell=0 + \global\columnlastcell\plusone + \global\columnfirstcell\zerocount \fi \fi} \def\OTRSETcheckfreelines{} \def\OTRSETfillgapsbetweencells#1#2% col - {\ifnum\columngaplimit>0 + {\ifnum\columngaplimit>\zerocount \donefalse - \dostepwiserecurse{#2}{\columnmaxcells}{1} - {\OTRSETdoifcellelse{#1}{\recurselevel} + \dostepwiserecurse{#2}\columnmaxcells\plusone + {\OTRSETdoifcellelse{#1}\recurselevel {\ifdone - \!!countb=\recurselevel \advance\!!countb -\!!counta\relax - \ifnum\!!countb>1 - \advance\!!countb -1 + \!!countb\recurselevel \advance\!!countb -\!!counta\relax + \ifnum\!!countb>\plusone + \advance\!!countb \minusone \ifnum\!!countb<\columngaplimit\relax - \!!countb=\recurselevel \advance\!!countb -1 - \dostepwiserecurse{\!!counta}{\!!countb}{1} + \!!countb\recurselevel \advance\!!countb \minusone + \dostepwiserecurse\!!counta\!!countb\plusone {\OTRSETsetgridcell{#1}\recurselevel\copy\placeholderboxc}% %\message{[gap]}% - \fi + \fi \fi \fi \donefalse} {\ifdone \else \donetrue - \!!counta=\recurselevel + \!!counta\recurselevel \fi}}% \fi} \appendtoks - \OTRSETfillgapsbetweencells\mofcolumns1 + \OTRSETfillgapsbetweencells\mofcolumns\plusone \to \OTRSETeverystartofcolumn %\def\OTRSETfreezeminimumgap#1% @@ -623,25 +687,44 @@ % {\OTRSETfillgaps{#1}{1}{#2}} \newif\ifspancolumnslots \spancolumnslotstrue +\newif\ifcheckcolumnspan \checkcolumnspantrue + +\def\OTRSETcheckwidthgap#1#2% box size + {\ifcheckcolumnspan + \bgroup + \scratchdimen#2% + \advance\scratchdimen-\wd#1\relax + \ifdim-10\s!sp>\scratchdimen + \egroup + \else\ifdim10\s!sp<\scratchdimen + \egroup + \else + \egroup + \wd#1=#2% + \fi\fi + \fi} \def\OTRSETcheckcolumnslot#1% {\enoughcolumncellstrue - \ifspancolumnslots \else \ifdim\wd#1>\hsize - \enoughcolumncellsfalse - \fi \fi + \ifspancolumnslots\else + \OTRSETcheckwidthgap#1\hsize + \ifdim\wd#1>\hsize + \enoughcolumncellsfalse + \fi + \fi \ifenoughcolumncells \getnoflines\pagetotal - \scratchcounter=\noflines + \scratchcounter\noflines \getnoflines{\ht#1}% - \columnvcells=\noflines - \columnhcells=1 + \columnvcells\noflines + \columnhcells\plusone \advance\scratchcounter \columnvcells \relax \ifnum\scratchcounter>\columnfreecells \enoughcolumncellsfalse \fi \fi} -\def\OTRSETstoreincolumnslotPAGE#1% +\def\OTRSETstoreincolumnslotPAGE#1% {\ifenoughcolumncells % to do \OTRSETsavebox{#1}% @@ -649,7 +732,7 @@ \OTRSETsavebox{#1}% \fi} -\def\OTRSETstoreincolumnslotTOPS#1% +\def\OTRSETstoreincolumnslotTOPS#1% {\OTRSETprepareforcolumnslot1{#1}% \OTRSETcheckcolumnslot{#1}% \ifenoughcolumncells @@ -663,22 +746,22 @@ \OTRSETsavebox{#1}% \fi} -\def\OTRSETstoreincolumnslotBOTS#1% +\def\OTRSETstoreincolumnslotBOTS#1% {\OTRSETprepareforcolumnslot3{#1}% \edef\savedcolumnlastcell{\the\columnlastcell}% \OTRSETcheckcolumnslot{#1}% \ifenoughcolumncells - \advance\columnlastcell -\columnvcells \advance\columnlastcell 1 + \advance\columnlastcell -\columnvcells \advance\columnlastcell \plusone % \OTRSETcheckcolumnspace\mofcolumns\columnfirstcell{#1}% \OTRSETcheckcolumnspace\mofcolumns\columnlastcell{#1}% \fi \ifenoughcolumncells \OTRSETsetgridcells\mofcolumns\columnlastcell\columnhcells\columnvcells {\copy#1} - \OTRSETfillgapsbetweencells\mofcolumns\savedcolumnlastcell % -) + \OTRSETfillgapsbetweencells\mofcolumns\savedcolumnlastcell % -) \OTRSETsetvsize \else - \columnlastcell=\savedcolumnlastcell + \columnlastcell\savedcolumnlastcell \OTRSETsavebox{#1}% \fi} @@ -688,20 +771,20 @@ \def\columnspacebotoffset{0} \def\OTRSETcheckcolumnspace#1#2#3% col row box - {\columnhcells=1 - \totalcolumnspace=\zeropoint - \scratchcounter=#1% + {\columnhcells\plusone + \totalcolumnspace\zeropoint + \scratchcounter#1% \enoughcolumncellstrue \doloop -% {\advance\totalcolumnspace \hsize {\advance\totalcolumnspace \OTRSETlocalwidth\scratchcounter\relax % needed +\OTRSETcheckwidthgap#3\totalcolumnspace \ifnum\wd#3>\totalcolumnspace\relax \ifnum\scratchcounter=\nofcolumns \enoughcolumncellsfalse \exitloop \else - \advance\columnhcells 1 - \advance\scratchcounter 1 + \advance\columnhcells \plusone + \advance\scratchcounter \plusone \advance\totalcolumnspace \OTRSETgetparameter\c!afstand\scratchcounter \fi \else @@ -709,50 +792,50 @@ \fi}% \ifenoughcolumncells \getnoflines{\ht#3}% - \columnvcells=\noflines + \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 + {\!!countd#1\advance\!!countd#3\advance\!!countd\minusone + \!!counte#2\advance\!!counte#4\advance\!!counte\minusone \ifnum\!!counte>\columnmaxcells\relax \enoughcolumncellsfalse \else \enoughcolumncellstrue -%\def\columnspacetopoffset{0}% -%\scratchcounter=#2\advance\scratchcounter-1\relax -%\ifnum\scratchcounter>0 -% \dostepwiserecurse{#1}{\!!countd}{1} +%\let\columnspacetopoffset\zerocount +%\scratchcounter#2\advance\scratchcounter\minusone +%\ifnum\scratchcounter>0 +% \dostepwiserecurse{#1}\!!countd\plusone % {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint -% \def\columnspacetopoffset{1}% +% \let\columnspacetopoffset\plusone % \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint -% \def\columnspacetopoffset{1}% -% \fi\fi}% +% \let\columnspacetopoffset\plusone +% \fi\fi}% % \advance\!!counte \columnspacetopoffset \relax % \advance\columnvcells \columnspacetopoffset \relax %\fi -%\def\columnspacebotoffset{0}% -%\scratchcounter=\!!counte +%\let\columnspacebotoffset\zerocount +%\scratchcounter\!!counte %\advance\scratchcounter \columnvcells \relax %\ifnum\scratchcounter>\columnmaxcells\else -% \dostepwiserecurse{#1}{\!!countd}{1} +% \dostepwiserecurse{#1}\!!countd\plusone % {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint -% \def\columnspacebotoffset{1}% +% \let\columnspacebotoffset\plusone % \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint -% \def\columnspacebotoffset{1}% -% \fi\fi}% +% \let\columnspacebotoffset\plusone +% \fi\fi}% % \advance\!!counte \columnspacebotoffset \relax % \advance\columnvcells \columnspacebotoffset \relax %\fi - \dostepwiserecurse{#1}{\!!countd}{1} % cols + \dostepwiserecurse{#1}\!!countd\plusone % cols {\ifenoughcolumncells - \!!countf=\recurselevel\relax - \dostepwiserecurse{#2}{\!!counte}{1} % rows + \!!countf\recurselevel\relax + \dostepwiserecurse{#2}\!!counte\plusone % rows {\ifenoughcolumncells \OTRSETdoifcellelse\!!countf\recurselevel {\enoughcolumncellsfalse}{}% - \fi}% + \fi}% \fi}% \fi} @@ -760,7 +843,7 @@ {\doifsomething{#1}{\edef\preferedcolumn{#1}}% \doifsomething{#2}{\edef\preferedrow {#2}}} -\OTRSETsetpreferedcolumnslot{\nofcolumns}{1} % default ? +\OTRSETsetpreferedcolumnslot{\nofcolumns}{1} % default ? \let\pofcolumns\mofcolumns \let\qofcolumns\mofcolumns @@ -769,77 +852,109 @@ \def\OTRSETstoreincolumnslotLRTB#1% {\OTRSETprepareforcolumnslot1{#1}% +\OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed \mofcolumns\nofcolumns+\currenthcell - 1\columnmaxcells+\currentvcell{#1}} + \plusone\columnmaxcells+\currentvcell{#1}} \def\OTRSETstoreincolumnslotLRBT#1% {\OTRSETprepareforcolumnslot3{#1}% +\OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed \mofcolumns\nofcolumns+\currenthcell - \columnmaxcells1-\currentvcell{#1}} + \columnmaxcells\plusone-\currentvcell{#1}} \def\OTRSETstoreincolumnslotRLTB#1% {\OTRSETprepareforcolumnslot1{#1}% +\OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed \nofcolumns\qofcolumns-\currenthcell - 1\columnmaxcells+\currentvcell{#1}} + \plusone\columnmaxcells+\currentvcell{#1}} \def\OTRSETstoreincolumnslotRLBT#1% {\OTRSETprepareforcolumnslot3{#1}% +\OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed \nofcolumns\qofcolumns-\currenthcell - \columnmaxcells1-\currentvcell{#1}} + \columnmaxcells\plusone-\currentvcell{#1}} \def\OTRSETstoreincolumnslotTBLR#1% {\OTRSETprepareforcolumnslot1{#1}% +\OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed - 1\columnmaxcells+\currentvcell + \plusone\columnmaxcells+\currentvcell \mofcolumns\nofcolumns+\currenthcell{#1}} \def\OTRSETstoreincolumnslotTBRL#1% {\OTRSETprepareforcolumnslot1{#1}% +\OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed - 1\columnmaxcells+\currentvcell + \plusone\columnmaxcells+\currentvcell \nofcolumns\qofcolumns-\currenthcell{#1}} \def\OTRSETstoreincolumnslotBTLR#1% {\OTRSETprepareforcolumnslot3{#1}% +\OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed - \columnmaxcells1-\currentvcell + \columnmaxcells\plusone-\currentvcell \mofcolumns\nofcolumns+\currenthcell{#1}} \def\OTRSETstoreincolumnslotBTRL#1% {\OTRSETprepareforcolumnslot3{#1}% +\OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed - \columnmaxcells1-\currentvcell + \columnmaxcells\plusone-\currentvcell \nofcolumns\qofcolumns-\currenthcell{#1}} \def\OTRSETstoreincolumnslotFXTB#1% fixed column - {\OTRSETprepareforcolumnslot2{#1}% % 1/2 dependent of place, todo + {\OTRSETprepareforcolumnslot2{#1}% % 1/2 dependent of place, todo +\OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed - \pofcolumns\pofcolumns - +\currenthcell\preferedrow - \columnmaxcells+\currentvcell{#1}} + \pofcolumns\pofcolumns+\currenthcell + \preferedrow\columnmaxcells+\currentvcell{#1}} \def\OTRSETstoreincolumnslotFXBT#1% fixed column - {\OTRSETprepareforcolumnslot2{#1}% % 3/2 dependent on place, todo + {\OTRSETprepareforcolumnslot2{#1}% % 3/2 dependent on place, todo +\OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed \pofcolumns\pofcolumns+\currenthcell \columnmaxcells\preferedrow-\currentvcell{#1}} +% \def\OTRSETstoreincolumnslotHERE#1% fixed column +% {\OTRSETprepareforcolumnslot2{#1}% +% \OTRSETflushtextsofar +% \getnoflines\pagetotal \advance\noflines\columnfirstcell +% \OTRSETstoreincolumnslotindeed +% \mofcolumns\mofcolumns+\currenthcell +% \noflines\columnmaxcells+\currentvcell{#1}% +% \OTRSETsetvsize} + +\chardef\OTRSETforcefixedfloats=0 + \def\OTRSETstoreincolumnslotHERE#1% fixed column + {\ifcase\OTRSETforcefixedfloats + \OTRSETstoreincolumnslotSOMEWHERE2{#1}% + \else + \OTRSETstoreincolumnslotFIXD{#1}% + \fi} + +\def\OTRSETstoreincolumnslotFIXD#1% fixed column {\OTRSETprepareforcolumnslot2{#1}% - \OTRSETflushtextsofar + % no flush text sofar here + \snaptogrid\vbox{\box#1}} + +\def\OTRSETstoreincolumnslotSOMEWHERE#1#2% + {\OTRSETprepareforcolumnslot{#1}{#2}% + \OTRSETflushtextsofar \getnoflines\pagetotal \advance\noflines\columnfirstcell \OTRSETstoreincolumnslotindeed \mofcolumns\mofcolumns+\currenthcell - \noflines\columnmaxcells+\currentvcell{#1}% + \noflines\columnmaxcells+\currentvcell{#2}% \OTRSETsetvsize} \def\OTRSETstoreincolumnslotindeed#1#2#3#4#5#6#7#8#9% - {\OTRSETflushtextsofar - \ifnum\preferedcolumn<\mofcolumns + {%\OTRSETflushtextsofar + \ifnum\preferedcolumn<\mofcolumns \let\pofcolumns\mofcolumns \else \let\pofcolumns\preferedcolumn @@ -848,8 +963,8 @@ \ifnum\mofcolumns=\nofcolumns \def\qofcolumns{\mofcolumns}% \else - \scratchcounter\mofcolumns - \advance\scratchcounter 1 + \scratchcounter\mofcolumns + \advance\scratchcounter \plusone \edef\qofcolumns{\the\scratchcounter}% \fi \else @@ -858,10 +973,14 @@ \enoughcolumncellsfalse \donefalse \dostepwiserecurse{#1}{#2}{#31} - {\ifdone\else + {\ifdone + \exitloop + \else #4=\recurselevel \dostepwiserecurse{#5}{#6}{#71} - {\ifdone\else + {\ifdone + \exitloop + \else #8=\recurselevel \OTRSETcheckcolumnspace\currenthcell\currentvcell{#9}% \ifenoughcolumncells \donetrue \fi @@ -886,8 +1005,7 @@ \ifdim\ht\OTRSETsavedfootnotes>\zeropoint \OTRSETsetfreecells\mofcolumns\columnfirstcell \ifsomefreecolumncells - \getnoflines{\ht\OTRSETsavedfootnotes}% -\relax + \getnoflines{\ht\OTRSETsavedfootnotes}\relax \ifnum\columnfreecells<\noflines \global\somefreecolumncellsfalse \else @@ -897,7 +1015,7 @@ \ifsomefreecolumncells % ok, enough room for notes %\message{[flt]}% float - \else % ? + \else % ? \OTRSETsavebox{#9}% \OTRSETerasegridcells\currenthcell\currentvcell\columnhcells\columnvcells %\message{[clr]}% save box @@ -915,33 +1033,24 @@ \OTRSETsavebox{#9}% \fi} -% \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\columnslotspacing{1} - -\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 - \doifdefinedelse{\strippedcsname\OTRSETstoreincolumnslot#1} - {\getvalue{\strippedcsname\OTRSETstoreincolumnslot#1}{#2}} - {\OTRSETstoreincolumnsloUNKNOWN{#1}}} - -\def\OTRSETstoreincolumnsloUNKNOWN#1% - {\OTRSETprepareforcolumnslot2{#1}\copy#1} +\chardef\columnslotspacing \plusone + +\def\OTRSETstoreincolumnslot#1% #2 % {method} {box} % alleen last + {% no messing around here + % \dp#2=\zeropoint + % \ifcase\columnslotspacing\else + % \setbox#2=\vbox spread \columnslotspacing\lineheight + % {\vss\box#2\vss}% + % \fi + % and don't change this any more +% \doifdefinedelse{\strippedcsname\OTRSETstoreincolumnslot#1} +% {\getvalue{\strippedcsname\OTRSETstoreincolumnslot#1}{#2}} +% {\OTRSETstoreincolumnslotUNKNOWN{#2}}} + \executeifdefined{\strippedcsname\OTRSETstoreincolumnslot#1} + \OTRSETstoreincolumnslotUNKNOWN} % {#2}} + +\def\OTRSETstoreincolumnslotUNKNOWN#1% + {\OTRSETprepareforcolumnslot2{#1}\copy#1} % {} ? \def\OTRSETprepareforcolumnslot#1#2% 1=hoog 2=midden 3=laag {\dp#2\zeropoint @@ -949,34 +1058,26 @@ \scratchdimen\columnslotspacing\lineheight \ifnum#1=2 \scratchdimen2\scratchdimen \fi \setbox#2\vbox spread \scratchdimen - {\ifnum#1>1\vss\fi\box#2\ifnum#1<3\vss\fi}% + {\ifnum#1>1\vss\fi\box#2\relax\ifnum#1<3\vss\fi}% \fi} \def\OTRSETdocheckiffloatfits % eigenlijk moet else float anders - {\ifnofloatpermitted - \global\roomforfloatfalse - \else - \global\roomforfloattrue - \fi} - -%\def\OTRSETsavebox#1% -% {\setbox\floatbox=\box#1\dosavefloat} + {\global\ifnofloatpermitted\roomforfloatfalse\else\roomforfloattrue\fi} -\def\OTRSETsavebox#1% clean up the skips - {\ifhbox#1% spans and so - \global\setbox\floatbox=\vbox{\box#1}% +\def\OTRSETsavebox#1% clean up the skips + {\ifhbox#1% spans and so + \global\setbox\floatbox\vbox{\box#1}% \else - \setbox\scratchbox=\vbox + \setbox\scratchbox\vbox {\unvbox#1\unskip\unskip\unskip - \global\setbox\floatbox\lastbox - }%\unskip\unskip\unskip\box\floatbox}% + \global\setbox\floatbox\lastbox}% \fi \dosavefloat} -\def\OTRSETflushfloatbox% nog verder doorvoeren en meer info in marge +\def\OTRSETflushfloatbox % nog verder doorvoeren en meer info in marge {\iftestfloatbox\ruledhbox\fi{\box\floatbox}} -\def\OTRSETdoflushfloats% +\def\OTRSETdoflushfloats {\bgroup \def\OTRSETsavebox##1{\!!doneafalse}% \doloop @@ -984,8 +1085,8 @@ \dogetfloat \ifdim\wd\floatbox>\zeropoint \!!doneatrue - \dp\floatbox=\zeropoint - \OTRSETstoreincolumnslot{TBLR}\floatbox + \dp\floatbox\zeropoint + \OTRSETstoreincolumnslot{TBLR}\floatbox \if!!donea %\message{[flu]}% \else @@ -1005,65 +1106,65 @@ \newif\ifcentergridcellonly \centergridcellonlyfalse \newif\ifautocentergridcellonly \autocentergridcellonlytrue -\def\OTRSETcentergridcells% +\def\OTRSETcentergridcells {\ifcentergridcells - \dorecurse{\nofcolumns} - {\currenthcell=\recurselevel -\ifautocentergridcellonly - % we prevent centering when the next column is empty - % to be checked ! ! ! ! - \advance\currenthcell 1 - \centergridcellonlytrue - \ifnum\currenthcell>\nofcolumns - % ok already - \else - % only span if there is a next column with content - \dorecurse{\columnmaxcells} - {\ifdim\ht\OTRSETgridcell\currenthcell\currentvcell>\zeropoint - \centergridcellonlyfalse - \else\ifdim\dp\OTRSETgridcell\currenthcell\currentvcell>\zeropoint - \centergridcellonlyfalse - \fi\fi}% - \fi -\fi - \currenthcell=\recurselevel - \dorecurse{\columnmaxcells} - {\currentvcell=\recurselevel\relax + \dorecurse\nofcolumns + {\currenthcell\recurselevel + \ifautocentergridcellonly + % we prevent centering when the next column is empty + % to be checked ! ! ! ! + \advance\currenthcell \plusone + \centergridcellonlytrue + \ifnum\currenthcell>\nofcolumns + % ok already + \else + % only span if there is a next column with content + \dorecurse\columnmaxcells + {\ifdim\ht\OTRSETgridcell\currenthcell\currentvcell>\zeropoint + \centergridcellonlyfalse + \else\ifdim\dp\OTRSETgridcell\currenthcell\currentvcell>\zeropoint + \centergridcellonlyfalse + \fi\fi}% + \fi + \fi + \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 + \setbox\scratchbox\OTRSETgetgridcell\currenthcell\currentvcell \getnoflines{\ht\scratchbox}% - \!!counta=\currentvcell + \!!counta\currentvcell \advance\!!counta -\noflines - \advance\!!counta 1 - % first col always ok - \!!countb=\currenthcell - \!!countc=\currenthcell \advance\!!countc 1 + \advance\!!counta \plusone + % first col always ok + \!!countb\currenthcell + \!!countc\currenthcell + \advance\!!countc \plusone \!!donebtrue -\ifcentergridcellonly \!!countc=\maxdimen \fi - \dostepwiserecurse{\!!countc}{\nofcolumns}{1} + \ifcentergridcellonly + \!!countc\maxdimen + \fi + \dostepwiserecurse\!!countc\nofcolumns\plusone {\if!!doneb \let\xrecurselevel\recurselevel - \dostepwiserecurse{\!!counta}{\currentvcell}{1} + \dostepwiserecurse\!!counta\currentvcell\plusone {\ifdim\ht\OTRSETgridcell\xrecurselevel\recurselevel>\zeropoint \!!donebfalse \else\ifdim\wd\OTRSETgridcell\xrecurselevel\recurselevel>\zeropoint \!!donebfalse \fi\fi}% \if!!doneb - \!!countb=\xrecurselevel + \!!countb\xrecurselevel \fi \fi}% -% \totalcolumnspace=\hsize -\totalcolumnspace=\OTRSETlocalwidth\currenthcell - \dostepwiserecurse{\!!countc}{\!!countb}{1} -% {\advance\totalcolumnspace \hsize\relax -{\advance\totalcolumnspace \OTRSETlocalwidth\recurselevel + \totalcolumnspace\OTRSETlocalwidth\currenthcell + \dostepwiserecurse\!!countc\!!countb\plusone + {\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 + \setbox\scratchbox\hbox to \totalcolumnspace{\hss\box\scratchbox\hss}% \fi \OTRSETsetgridcell\currenthcell\currentvcell\box\scratchbox \egroup @@ -1071,31 +1172,31 @@ \fi}}% \fi} -\def\OTRSETinitializecolumns% once per page +\def\OTRSETinitializecolumns% once per page {\columnspreadtrue % todo \ifcolumnspread - \global\rofcolumns=\getvalue{\??mc\OTRSETidentifier\c!nrechts}% - \global\lofcolumns=\getvalue{\??mc\OTRSETidentifier\c!nlinks}% - \global\tofcolumns=\rofcolumns \relax + \global\rofcolumns\getvalue{\??mc\OTRSETidentifier\c!nrechts}% + \global\lofcolumns\getvalue{\??mc\OTRSETidentifier\c!nlinks}% + \global\tofcolumns\rofcolumns \relax \ifodd\realpageno\relax - \global\nofcolumns=\rofcolumns + \global\nofcolumns\rofcolumns \else \global\advance\tofcolumns\lofcolumns - \global\nofcolumns=\lofcolumns + \global\nofcolumns\lofcolumns \fi \else - \global\nofcolumns=\getvalue{\??mc\OTRSETidentifier\c!n}% - \global\rofcolumns=\nofcolumns - \global\lofcolumns=\nofcolumns - \global\tofcolumns=\nofcolumns + \global\nofcolumns\getvalue{\??mc\OTRSETidentifier\c!n}% + \global\rofcolumns\nofcolumns + \global\lofcolumns\nofcolumns + \global\tofcolumns\nofcolumns \fi -\OTRSETassignwidths - \global\mofcolumns=1 + \OTRSETassignwidths + \global\mofcolumns\plusone \columnerasegridboxes} % vanaf hier: -\def\definecolumnset% +\def\definecolumnset {\dodoubleargument\dodefinecolumnset} \def\dodefinecolumnset[#1][#2]% @@ -1108,7 +1209,10 @@ \c!nlinks=\getvalue{\??mc#1\c!n}, \c!nrechts=\getvalue{\??mc#1\c!n}, #2]% - \dorecurse{\getvalue{\??mc#1\c!nlinks}} % todo + \redodefinecolumnset[#1]} + +\def\redodefinecolumnset[#1]% + {\dorecurse{\getvalue{\??mc#1\c!nlinks}} % todo {\dododefinecolumnset[#1][\recurselevel]}% \dorecurse{\getvalue{\??mc#1\c!nrechts}} % todo {\dododefinecolumnset[#1][\recurselevel]}% @@ -1124,43 +1228,111 @@ \c!uitlijnen=, \c!afstand=\getvalue{\??mc#1\c!afstand}]} -\def\setupcolumnset% +\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}}} + {\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} + +\definecolumnset[\s!default][\c!n=2] % fallback + +\def\OTRSETgotonextpage + {\vfill\eject + \relax\ifnum\mofcolumns>\plusone + \OTRSETgotocolumn[\v!laatste]% + \ifnum\mofcolumns>\plusone + \OTRSETgotocolumn[\v!forceer]% + \fi + \fi} -\def\OTRSETgotocolumn% +\let\OTRSETgotonextpageX\OTRSETgotonextpage % will become obsolete + +\def\OTRSETgotocolumn {\dosingleempty\doOTRSETgotocolumn} +% \def\doOTRSETgotocolumn[#1]% first|last|yes|<number> +% {\doifnumberelse{#1} +% {\OTRSETdummycolumn +% \doloop +% {\ifnum\mofcolumns<#1\relax +% \OTRSETdummycolumn +% \else +% \exitloop +% \fi}} +% {\processallactionsinset +% [#1] +% [ \v!ja=>\OTRSETdummycolumn, +% \v!forceer=>\OTRSETdummycolumn, +% \v!eerste=>{\doOTRSETgotocolumn[1]}, +% \v!laatste=>\expanded{\doOTRSETgotocolumn[\the\nofcolumns]}, +% \s!default=>\OTRSETdummycolumn]}} + \def\doOTRSETgotocolumn[#1]% first|last|yes|<number> {\doifnumberelse{#1} - {\OTRSETdummycolumn - \doloop - {\ifnum\mofcolumns<#1 - \OTRSETdummycolumn - \else - \exitloop - \fi}} - {\processaction + {\ifnum\mofcolumns<#1\relax + \vfill\eject % \doejectpage\eject + \doloop + {\ifnum\mofcolumns<#1\relax + \OTRSETdummycolumn \else \exitloop + \fi}% + \fi} + {\processallactionsinset [#1] - [ \v!ja=>\OTRSETdummycolumn, + [ \v!ja=>\OTRSETdummycolumn, + \v!forceer=>\OTRSETdummycolumn, \v!eerste=>{\doOTRSETgotocolumn[1]}, - \v!laatste=>{\doOTRSETgotocolumn[\nofcolumns]}, - \v!default=>\OTRSETdummycolumn]}} + \v!laatste=>\expanded{\doOTRSETgotocolumn[\the\nofcolumns]}, + \s!default=>\OTRSETdummycolumn]}} + +% to be documented and tested, not yet that robust +\def\OTRSETgotocell#1#2% + {\endgraf + \gdef\gotocellcounter{0}% + \doloop + {\ifnum\mofcolumns<#1\relax + \doglobal\increment\gotocellcounter\relax + \ifnum\gotocellcounter>#1\relax + \line{\strut}\crlf + \line{\strut}\crlf + \column + \writestatus{columnset}{quitting goto cell}% + \exitloop + \else + \column + \fi + \else + \exitloop + \fi}% + \ifnum\mofcolumns=#1\relax + \ifnum#2>1 + \scratchcounter\zerocount + \currenthcell\mofcolumns + \currentvcell#2\advance\currentvcell \minusone + \dorecurse\currentvcell + {\OTRSETdoifcellelse\mofcolumns\recurselevel\donothing + {\advance\scratchcounter\plusone}} + \getnoflines\pagetotal + \advance\scratchcounter-\noflines + \ifnum\scratchcounter>\zerocount + \dorecurse\scratchcounter{\line{\strut}}% + \fi + \fi + \fi + \OTRSETsetvsize} + \def\OTRSETdummycolumn {\vbox{\strut} - \vskip-\lineheight - \vfill + \vskip-\lineheight + \vfill \eject} \newcounter\columnsetlevel @@ -1172,8 +1344,8 @@ \def\dostartcolumnset[#1][#2]% {\increment\columnsetlevel\relax \doglobal\newcounter\balancingpageno - \gdef\localcolumnmaxcells{0}% - \ifnum\columnsetlevel=1 + \globallet\localcolumnmaxcells\!!zerocount + \ifnum\columnsetlevel=\plusone %\OTRSETgetmanualbalance \bgroup \def\currentcolumnset{#2}% @@ -1183,29 +1355,54 @@ %\global\let\OTRSETidentifier\currentcolumnset \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 - \OTRSETgetmanualbalance % here +\doifelsenothing{#1} + {\globallet\OTRSETlist\s!default} + {\xdef\OTRSETlist{#1}}% + \OTRSETstartnextpage + \OTRSETgetmanualbalance % here \OTRSETassignwidths \OTRSETsethsize \else \bgroup \fi} +% \def\stopcolumnset +% {\relax +% \ifnum\columnsetlevel=\plusone +% \par +% \OTRSETsetmanualbalance +% \dostopcolumnset +% \egroup +% \global\footnotelimittrue +% \setvsize +% \sethsize +% \ifvoid\OTRfinalpagebox\else +% % probably balanced +% \ifdim\ht\OTRfinalpagebox<\teksthoogte +% \snaptogrid[\v!pagina]\hbox{\box\OTRfinalpagebox} +% \else +% \box\OTRfinalpagebox +% \fi +% \fi +% \ifsomefloatwaiting \setvsize \pagina \setvsize \fi +% \else +% \egroup +% \fi +% \decrement\columnsetlevel\relax} + \def\stopcolumnset {\relax - \ifnum\columnsetlevel=1 - \par - \OTRSETsetmanualbalance + \ifnum\columnsetlevel=\plusone + \pagebreak + \OTRSETsetmanualbalance \dostopcolumnset \egroup \global\footnotelimittrue \setvsize \sethsize \ifvoid\OTRfinalpagebox\else - % probably balanced + % probably balanced \ifdim\ht\OTRfinalpagebox<\teksthoogte \snaptogrid[\v!pagina]\hbox{\box\OTRfinalpagebox} \else @@ -1218,7 +1415,7 @@ \fi \decrement\columnsetlevel\relax} -\def\dostopcolumnset% +\def\dostopcolumnset {%\OTRSETdofinalflushfloats % yes/no \ifbalancecolumns \OTRSETdobalance @@ -1231,91 +1428,93 @@ \def\localcolumnmaxcells{0} -\def\OTRSETmanualbalance - {\ifbalancecolumns +\def\OTRSETmanualbalance + {\ifbalancecolumns \let\savedcolumnmaxcells\columnmaxcells \ifnum\realpageno=\balancingpageno\relax - \ifnum\mofcolumns=1 + \ifnum\mofcolumns=\plusone \dorecurse\nofcolumns - {\!!counta=\recurselevel - \!!countb=\balancingcolumnmaxcells\!!counta\relax + {\!!counta\recurselevel + \!!countb\balancingcolumnmaxcells\!!counta\relax \ifnum\!!countb>\localcolumnmaxcells - \xdef\localcolumnmaxcells{\the\!!countb}% + \xdef\localcolumnmaxcells{\the\!!countb}% \fi - \advance\!!countb 1 - \dostepwiserecurse\!!countb\columnmaxcells1 + \advance\!!countb \plusone + \dostepwiserecurse\!!countb\columnmaxcells\plusone {\OTRSETsetgridcell\!!counta\recurselevel\copy\placeholderboxe}}% \fi \fi \fi} -\def\balancingcolumnmaxcells#1% pas op: etex - {\ifcsname\??mc\OTRSETidentifier\number#1\c!regels\endcsname - \csname\??mc\OTRSETidentifier\number#1\c!regels\endcsname - \else\ifcsname\??mc\OTRSETidentifier\c!regels\endcsname - \csname\??mc\OTRSETidentifier\c!regels\endcsname +\def\balancingcolumnmaxcells#1% pas op: etex + {\ifcsname\??mc\OTRSETidentifier\number#1\c!regels\endcsname + \csname\??mc\OTRSETidentifier\number#1\c!regels\endcsname + \else\ifcsname\??mc\OTRSETidentifier\c!regels\endcsname + \csname\??mc\OTRSETidentifier\c!regels\endcsname \else \savedcolumnmaxcells \fi\fi} -\def\OTRSETsetmanualbalance - {\doglobal\addtocommalist{\realfolio}\OTRSETbalancinglist} +\def\OTRSETsetmanualbalance + {\doglobal\addtocommalist\realfolio\OTRSETbalancinglist} -\def\OTRSETpresetmanualbalance +\def\OTRSETpresetmanualbalance {\doifdefined{\??mc\OTRSETidentifier\c!regels} {\getcommacommandsize[\csname\??mc\OTRSETidentifier\c!regels\endcsname]% - \ifnum\commalistsize>1 + \ifnum\commalistsize>\plusone \scratchcounter\zerocount \def\docommando##1% - {\advance\scratchcounter1 + {\advance\scratchcounter\plusone \setvalue{\??mc\OTRSETidentifier\the\scratchcounter\c!regels}{##1}}% \processcommacommand [\csname\??mc\OTRSETidentifier\c!regels\endcsname]\docommando \fi}} -\def\OTRSETgetmanualbalance +\def\OTRSETgetmanualbalance {\gettwopassdata\s!colset \iftwopassdatafound - \OTRSETpresetmanualbalance + \OTRSETpresetmanualbalance \global\let\balancingpageno\twopassdata \else \doglobal\newcounter\balancingpageno \fi - \global\balancingcolumnsfalse} + \global\balancingcolumnsfalse} %\def\OTRSETnobalance -% {\iflastcolumnfootnotes % testen ! optie +% {\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 +% \ifdim\pagetotal>\zeropoint +% \vfill \eject \OTRSETdofinalflush +% \fi % \fi} \def\OTRSETnobalance - {\iflastcolumnfootnotes % testen ! optie + {\iflastcolumnfootnotes % testen ! optie % inhibit flush of floats ! - \dostepwiserecurse{\mofcolumns}{\nofcolumns}{1} + \dostepwiserecurse\mofcolumns\nofcolumns\plusone {\vskip-\lineheight\vbox{\strut}\vfill\eject}% \else - \ifdim\pagetotal>\zeropoint -\ifnum\mofcolumns=\nofcolumns - \OTRSETflushfinalfootnotes - \vfill \eject -\else - \vfill \eject - \OTRSETdofinalflush - \OTRSETdofinaloutput -\fi - \fi + \ifdim\pagetotal>\zeropoint + \ifnum\mofcolumns=\nofcolumns + \OTRSETflushfinalfootnotes + \vfill \eject + \else + \vfill \eject + \OTRSETdofinalflush + \OTRSETdofinaloutput + \fi + \fi \fi} -\def\OTRSETgotonextpage% - {\doifsomething{\OTRSETlist} +\def\OTRSETstartnextpage + {\doifsomething\OTRSETlist {\getfromcommacommand[\OTRSETlist][1]% \global\let\OTRSETidentifier\commalistelement + \doifundefined{\??mc\OTRSETidentifier\c!n} + {\globallet\OTRSETidentifier\s!default}% \let\newcommalistelement\empty \doglobal\replaceincommalist\OTRSETlist1% \OTRSETrestart}} @@ -1330,82 +1529,110 @@ \OTRSETsethsize \OTRSETsetplaceholders \OTRSEThandlepreposttext -\initializecolumntextareas % name ! + \initializecolumntextareas % name ! \OTRSETsetvsize} \OTRSEToutput {\OTRSETnaturalflush -% \OTRSETgotonextpage -\OTRSETdoflushfloats % zou eigenlijk in \flushsavedfloats moeten (gaat fout) + %\OTRSETstartnextpage + \OTRSETdoflushfloats % zou eigenlijk in \flushsavedfloats moeten (gaat fout) \OTRSETcheckfreelines \OTRSETchecksidefloat} -\def\OTRSETinitializefeatures% +\def\OTRSETinitializefeatures {% number of lines -% new: raw + % new: raw \getrawnoflines\teksthoogte\xdef\columnmaxcells{\the\noflines}% % direction \doifelsevalue{\??mc\OTRSETidentifier\c!richting}\v!rechts - {\chardef\columndirection0} - {\chardef\columndirection1}% - % balancing + {\chardef\columndirection\zerocount} + {\chardef\columndirection\plusone}% + % balancing \doifelsevalue{\??mc\OTRSETidentifier\c!balanceren}\v!ja {\balancecolumnstrue} {\balancecolumnsfalse}} +% keep 'm for a while +% +% \installoutput\OTRSETflushpreposttext +% {\global\setbox\precolumnbox\vbox{\unvbox\normalpagebox}% +% \ifcarryoverfootnotes \else +% \global\setbox\postcolumnbox\vbox{\placebottomnotes}% +% \fi} +% +% to be tested on 'boekinhoud' in 'pascal/demo-bbi' +% +% junk ! ! ! ! ! +% +%\installoutput\OTRSETflushpreposttext +% {\global\setbox\precolumnbox\vbox +% {\unvbox\normalpagebox +% \strut\vskip-2\lineheight\strut}% we want a proper depth +% \ifcarryoverfootnotes \else +% \global\setbox\postcolumnbox\vbox{\placebottomnotes}% +% \fi} +% +% \starttext +% \definecolumnset[two][n=2] +% \startcolumnset[two] \dorecurse{4}{\input tufte } \stopcolumnset +% \input tufte +% \startcolumnset[two] \input tufte \stopcolumnset +% \stoptext + \installoutput\OTRSETflushpreposttext {\global\setbox\precolumnbox\vbox{\unvbox\normalpagebox}% + \global\dp\precolumnbox\strutdepth \ifcarryoverfootnotes \else \global\setbox\postcolumnbox\vbox{\placebottomnotes}% \fi} -\def\OTRSEThandlepreposttext% - {\ifdim\ht\precolumnbox>\zeropoint % new +\def\OTRSEThandlepreposttext + {\ifdim\ht\precolumnbox>\zeropoint % new \getnoflines{\ht\precolumnbox}% \doOTRSETsetgridcells {\copy\placeholderboxe} - 11\nofcolumns\noflines + \plusone\plusone\nofcolumns\noflines {\box\precolumnbox}% \fi \ifdim\ht\postcolumnbox>\zeropoint % new, otherwise empty bottom line \getnoflines{\ht\postcolumnbox}% \advance\columnfreecells -\noflines - \advance\columnfreecells 1 + \advance\columnfreecells \plusone \doOTRSETsetgridcells {\copy\placeholderboxe} - 1\columnfreecells\nofcolumns\noflines + \plusone\columnfreecells\nofcolumns\noflines {\box\postcolumnbox}% \fi} -\def\OTRSETchecksidefloat% +\def\OTRSETchecksidefloat {} % {\sidefloatoutput} -\def\OTRSETfinalsidefloatoutput% +\def\OTRSETfinalsidefloatoutput {} -\def\OTRSETcheckgrid% - {\topskip=1\topskip +\def\OTRSETcheckgrid + {\topskip1\topskip \ifforcecolumngrid - \widowpenalty=0 - \clubpenalty=0 - \brokenpenalty=0 + \widowpenalty\zerocount + \clubpenalty\zerocount + \brokenpenalty\zerocount \fi} \def\OTRSETcheckinsert% {\iflastcolumnfootnotes - \ifnum\nofcolumns=\mofcolumns - \OTRSETforceinserts - \else - \OTRSETinhibitinserts + \ifnum\nofcolumns=\mofcolumns + \OTRSETforceinserts + \else + \OTRSETinhibitinserts \fi \else - \OTRSETforceinserts + \OTRSETforceinserts \fi} -\def\OTRSETforceinserts% +\def\OTRSETforceinserts {\enablenotes} -\def\OTRSETinhibitinserts% +\def\OTRSETinhibitinserts {\disablenotes} % interface to footnotes @@ -1422,7 +1649,7 @@ % \divide#2 \scratchcounter} % {#2=\getvalue{\??mc#1\c!breedte}}} -%\def\OTRSETassignwidth#1\to#2% assumes mofcolumns +%\def\OTRSETassignwidth#1\to#2% assumes mofcolumns % {\doifelsevalue{\??mc#1\number\mofcolumns\c!breedte}{\v!passend} % {#2=\zetbreedte % \scratchcounter=0 @@ -1434,24 +1661,24 @@ % \divide#2 by \scratchcounter} % {#2=\getvalue{\??mc#1\number\mofcolumns\c!breedte}}} % -% replaced by +% replaced by % -%\def\OTRSETassignwidth#1\to#2% assumes mofcolumns +%\def\OTRSETassignwidth#1\to#2% assumes mofcolumns % {#2=\OTRSETlocalwidth\mofcolumns} -\def\OTRSETassignwidths% +\def\OTRSETassignwidths {%\scratchdimen\zetbreedte - \freezetextwidth \scratchdimen\tekstbreedte + \freezetextwidth \scratchdimen\tekstbreedte % - \scratchcounter0 + \scratchcounter\zerocount \dorecurse\nofcolumns - {\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}{\v!passend} - {\advance\scratchcounter 1 } + {\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}\v!passend + {\advance\scratchcounter \plusone } {\advance\scratchdimen -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}}% \advance\scratchdimen -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!afstand}}% \divide\scratchdimen \scratchcounter \dorecurse\nofcolumns - {\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}{\v!passend} + {\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}}} @@ -1468,24 +1695,24 @@ \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}} + {\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% +\def\OTRSETsetplaceholders {\global\setbox\placeholderboxa\columnplaceholder0\cyan \global\setbox\placeholderboxb\columnplaceholder0\green \global\setbox\placeholderboxc\columnplaceholder0\blue @@ -1494,24 +1721,26 @@ \global\setbox\placeholderboxf\columnplaceholder1\darkgray} \def\doOTRSETshowstatus - {\llap{\tt\tfxx\blue(\number\columnfirstcell\#\number\columnfreecells)}} + {\llap{\tt\tfxx\blue + (\the\vsize->\number\columnfirstcell\#\number\columnfreecells)% + \hskip\leftskip}} \def\OTRSETshowstatus {\iftracecolumnset \doOTRSETshowstatus \fi} -\appendtoks \OTRSETshowstatus \to \everypar +\appendtoks \OTRSETshowstatus \to \everypar % page contents \def\OTRSETdopagecontents#1#2% takes two args: \box<n> \unvbox<n> - {\vbox to \teksthoogte - {\forgetall#1#2\pushcolor}} + {\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\OTRSETsomepagefloat {\def\floatmethod{PAGE}\OTRSETsomeslotfloat} % check +\def\OTRSETsomeherefloat {\def\floatmethod{HERE}\OTRSETsomeslotfloat} % check +\def\OTRSETsomeelsefloat {\def\floatmethod{HERE}\OTRSETsomeslotfloat} % check +\def\OTRSETsomefixdfloat {\def\floatmethod{FIXD}\OTRSETsomeslotfloat} % check +\def\OTRSETsometopfloat {\def\floatmethod{TOPS}\OTRSETsomeslotfloat} % check +\def\OTRSETsomebottomfloat{\def\floatmethod{BOTS}\OTRSETsomeslotfloat} % check % \def\OTRSETsomeslotfloat {\let\floatmethod\v!hier\OTRONEsomeelsefloat} @@ -1519,36 +1748,169 @@ {\iftestfloatbox\ruledhbox\fi{\box\floatbox}} \def\OTRSETsomeslotfloat[#1]% - {\setbox\floatbox=\vbox{\flushfloatbox}% - \dp\floatbox=\dp\strutbox + {\setbox\floatbox\vbox{\flushfloatbox}% + \dp\floatbox\dp\strutbox \@EA\uppercasestring\floatmethod\to\floatmethod \OTRSETstoreincolumnslot\floatmethod\floatbox \doinsertfloatinfo} +% kind of new, looks much like OTRONE, but not entirely + +\def\OTRSETdosettopinserts + {\bgroup + \ifsomefloatwaiting + \noffloatinserts\zerocount + \let\totaltopinserted\!!zeropoint + \OTRSETdodosettopinserts + \ifnum\@@bknonder=\zerocount + \ifnum\@@bknregels>\zerocount + \ifdim\totaltopinserted>\zeropoint\relax + \dimen0\lineheight + \dimen0=\@@bknregels\dimen0 + \advance\dimen0 \totaltopinserted\relax + \ifdim\dimen0>\teksthoogte % \vsize %%%%%%%%% \teksthoogte + \showmessage\m!floatblocks8{\@@bknregels}% + \vfilll\eject + \fi + \fi + \fi + \fi + \fi + \egroup} + +\def\OTRSETdodosettopinserts + {\ifnum\noffloatinserts<\noftopfloats + \dogetfloat + \ifdim\topinserted=\zeropoint\relax + \topofinserttrue + \else + \topofinsertfalse + \fi + \setbox\scratchbox\vbox % kan beter ! + {\forgetall + \iftopofinsert + \ifdim\OTRSETtopoffset=\zeropoint + \verplaatsopgrid[\v!boven] + \fi + \else + \betweenfloatblanko % inserts can't look back + \fi + \flushfloatbox + \blanko[\@@bknawit]}% + \global\advance\topinserted \ht\scratchbox\relax + \ifdim\topinserted>\vsize % was \teksthoogte\relax + \doresavefloat + \noffloatinserts\noftopfloats\relax + \global\advance\topinserted -\ht\scratchbox + \let\OTRSETdodosettopinserts\relax % to be tested + \else + \xdef\totaltopinserted{\the\topinserted}% + \insert\topins{\forgetall\box\scratchbox}% interlineskip ? + \ifsomefloatwaiting + \advance\noffloatinserts \plusone + \else + \noffloatinserts\noftopfloats\relax + \fi + \dofloatflushedinfo + \fi + \else + \ifsomefloatwaiting + \showmessage\m!floatblocks6{\the\noftopfloats}% + \fi + \let\OTRSETdodosettopinserts\relax + \fi + \OTRSETdodosettopinserts} + +\def\OTRSETdosetbotinserts + {\bgroup + \ifsomefloatwaiting + \noffloatinserts\zerocount + \OTRSETdodosetbotinserts + \fi + \egroup} + +\def\OTRSETdodosetbotinserts + {\ifnum\noffloatinserts<\nofbotfloats\relax + \dogetfloat + \global\advance\botinserted \ht\floatbox\relax + \global\advance\botinserted \dp\floatbox\relax + \global\advance\botinserted \floattopskip\relax + \ifdim\botinserted<\pagegoal\relax + \insert\botins + {\forgetall + \blanko[\@@bkvoorwit]% + \flushfloatbox}% + \ifsomefloatwaiting + \advance\noffloatinserts \plusone + \else + \noffloatinserts\nofbotfloats + \fi + \dofloatflushedinfo + \else + \doresavefloat + \noffloatinserts\nofbotfloats\relax + \fi + \global\nofloatpermittedtrue % vgl topfloats s! + \else + \ifsomefloatwaiting + \showmessage\m!floatblocks7{\the\nofbotfloats}% + \fi + \let\OTRSETdodosetbotinserts\relax + \fi + \OTRSETdodosetbotinserts} + +\let\OTRSETdosetbothinserts\relax + +\def\OTRSETdotopinsertions + {\ifvoid\topins\else + \ifvoid\columntopbox\mofcolumns + \columnsettopbox\mofcolumns\box\topins + \else + \columnsettopbox\mofcolumns\vbox % temp, must be better + {\forgetall + \offinterlineskip + \box\columntopbox\mofcolumns + \box\topins} + \fi + \fi + \global\topinserted\zeropoint\relax} % goes away + +\def\OTRSETdobotinsertions + {\ifvoid\botins \else + \columnsetbotbox\mofcolumns\box\botins +% \else +% \columnsetbotbox\mofcolumns\vbox % temp, must be better +% {\forgetall +% \offinterlineskip +% \box\botins +% \box\columnbotbox\mofcolumns} + \fi + \global\botinserted\zeropoint\relax} % goes away + % set ipv text -% left right 1 2 3 +1 +2 +3 +% left right 1 2 3 +1 +2 +3 \let\columnleftareas \empty \let\columnrightareas\empty -% links rechts => odd, even, n, named +% links rechts => odd, even, n, named -\def\definecolumntextarea% +\def\definecolumntextarea {\dotripleempty\dodefinecolumntextarea} -\def\dodefinecolumntextarea[#1][#2][#3]% y=0 is mogelijke en handig ! +\def\dodefinecolumntextarea[#1][#2][#3]% y=0 is mogelijke en handig ! {\ifthirdargument \doifelse{#2}\v!beide {\definecolumntextarea[#1][\v!links ][#3]% \definecolumntextarea[#1][\v!rechts][#3]} {\doifelse{#2}\v!volgende - {\doifonevenpaginaelse + {\doifoddpageelse {\definecolumntextarea[#1][\v!rechts][#3]} {\definecolumntextarea[#1][\v!links][#3]}} {\presetlocalframed [\??mt#1#2]% - \processaction[#2] % \doglobal voorkomt stack build up + \processaction[#2] % \doglobal voorkomt stack build up [ \v!links=>\doglobal\addtocommalist{#1}\columnleftareas, \v!rechts=>\doglobal\addtocommalist{#1}\columnrightareas]% \getparameters[\??mt#1#2] @@ -1559,7 +1921,7 @@ \definecolumntextarea[#1][\v!volgende][#2]% \fi} -\def\setupcolumntextarea% +\def\setupcolumntextarea {\dotripleempty\dosetupcolumntextarea} \def\dosetupcolumntextarea[#1][#2][#3]% @@ -1568,7 +1930,7 @@ {\setupcolumntextarea[#1][\v!links ][#3]% \setupcolumntextarea[#1][\v!rechts][#3]} {\doifelse{#2}\v!volgende - {\doifonevenpaginaelse + {\doifoddpageelse {\setupcolumntextarea[#1][\v!rechts][#3]} {\setupcolumntextarea[#1][\v!links][#3]}} {\getparameters[\??mt#1#2][#3]}}% @@ -1576,7 +1938,7 @@ \setupcolumntextarea[#1][\v!volgende][#2]% \fi} -\def\initializecolumntextareas% +\def\initializecolumntextareas {\ifodd\realpageno \doinitializecolumntextareas\columnrightareas\v!rechts \else @@ -1598,14 +1960,14 @@ {\getvalue{\??mt#1#2\c!nx}}{\getvalue{\??mt#1#2\c!ny}} {\copy\placeholderboxd}} -\def\placecolumntextareas% +\def\placecolumntextareas {\ifodd\realpageno \doplacecolumntextareas\columnrightareas\v!rechts \else \doplacecolumntextareas\columnleftareas\v!links \fi} -\def\doplacecolumntextareas#1#2% global ? +\def\doplacecolumntextareas#1#2% global ? {\bgroup \forgetall \def\docommando##1% @@ -1619,61 +1981,26 @@ \def\columntextlastbackspace{\rugwit} -% \def\dodoplacecolumntextareas#1#2% -% {\!!counta\getvalue{\??mt#1#2\c!x}% -% \!!countb\getvalue{\??mt#1#2\c!nx}% -% \docalculatecolumnsetspan -% \!!heighta\getvalue{\??mt#1#2\c!ny}\lineheight -% % option -% \advance\!!heighta -\lineheight -% \setbox\scratchbox\vbox -% {\donetrue\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=\!!widthb,\c!hoogte=\!!heighta]% -% {\copy\scratchbox}}% -% \ifcase\!!countc\else -% \advance\!!counta \getvalue{\??mt#1#2\c!nx}% -% \advance\!!counta -\!!countc -% \advance\!!widtha -\!!widthb -% \OTRSETsetgridcell -% \!!counta\!!countb -% \hbox -% {\hskip-\namedlayoutparameter\v!oneven\c!rugwit -% \clip -% [\c!breedte=\!!widtha,\c!hoogte=\!!heighta, -% \c!hoffset=\!!widthb] -% {\copy\scratchbox}}% -% \fi} - \def\dodoplacecolumntextareas#1#2% {\!!counta\getvalue{\??mt#1#2\c!x}% - \!!countb\getvalue{\??mt#1#2\c!nx}% + \!!countb\getvalue{\??mt#1#2\c!nx}% \docalculatecolumnsetspan \!!heighta\getvalue{\??mt#1#2\c!ny}\lineheight -% to do: met/zonder ht/dp -\ifnum\getvalue{\??mt#1#2\c!y}=0 - \advance\!!heighta -\lineheight - \advance\!!heighta \topskip -\fi - \advance\!!heighta -\lineheight % option + % to do: met/zonder ht/dp + \ifnum\getvalue{\??mt#1#2\c!y}=\zerocount + \advance\!!heighta -\lineheight + \advance\!!heighta \topskip + \fi + \advance\!!heighta -\lineheight % option \setbox\scratchbox\vbox {\donetrue\localframed [\??mt#1#2] - [\c!breedte=\!!widtha,\c!hoogte=\!!heighta] + [\c!breedte=\!!widtha,\c!hoogte=\!!heighta,\c!regels=] {\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 + \advance\!!countb \minusone \OTRSETsetgridcell \!!counta\!!countb \hbox{\clip @@ -1693,19 +2020,16 @@ {\copy\scratchbox}}% \fi} -\def\setupcolumntextareatext% +\def\setupcolumntextareatext {\dotripleempty\dosetupcolumntextareatext} -%\def\dosetupcolumntextareatext[#1][#2][#3]% -% {\setvalue{\??mt#1#2}{#3}} - \long\def\dosetupcolumntextareatext[#1][#2][#3]% {\ifthirdargument \doifelse{#2}\v!beide {\setvalue{\??mt#1\v!links }{#3}% \setvalue{\??mt#1\v!rechts}{#3}} {\doifelse{#2}\v!volgende - {\doifonevenpaginaelse + {\doifoddpageelse {\setvalue{\??mt#1\v!rechts}{#3}}% {\setvalue{\??mt#1\v!links }{#3}}}% {\setvalue{\??mt#1#2}{#3}}}% @@ -1714,43 +2038,44 @@ \fi} \def\docalculatecolumnsetspan - {% \!!counta <= x - % \!!countb <= nx + {% \!!counta <= x + % \!!countb <= nx % \!!widtha => total width - % \!!widthb => left width - % \!!countc => left cols - \!!widtha\!!countb\hsize - \advance\!!countb \!!counta \advance\!!countb -1 \relax + % \!!widthb => left width + % \!!countc => left cols + \!!widtha\!!countb\tekstbreedte % we assume equal widths + \advance\!!countb \!!counta + \advance\!!countb \minusone \ifnum\!!countb>\nofcolumns \!!countc\!!countb \advance\!!countc -\nofcolumns \!!countb\nofcolumns \else - \!!countc0 + \!!countc\zerocount \fi - \advance\!!counta 1 - \dostepwiserecurse\!!counta\!!countb1 + \advance\!!counta \plusone + \dostepwiserecurse\!!counta\!!countb\plusone {\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}% \!!widthb\!!widtha - \advance\!!widthb -\!!countc\hsize - \ifodd\realpageno \else + \advance\!!widthb -\!!countc\tekstbreedte + \ifodd\realpageno \else % tricky, assumes that we keep there \ifcase\!!countc\else - % nog niet ok voor enkel/dubbelzijdig - \advance\!!widtha \namedlayoutparameter\v!even \c!rugwit + % nog niet ok voor enkel/dubbelzijdig + \advance\!!widtha \namedlayoutparameter\v!even \c!rugwit \advance\!!widtha \namedlayoutparameter\v!oneven\c!rugwit - \advance\!!widthb \namedlayoutparameter\v!even \c!rugwit + \advance\!!widthb \namedlayoutparameter\v!even \c!rugwit \dorecurse\!!countc {\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}% \fi \fi} -\def\columnsetspanhsize{\hsize} +\def\columnsetspanhsize{\tekstbreedte} \def\setcolumnsetspanhsize#1#2% x nx / uses counta/b - {\!!counta=#1\!!countb=#2\docalculatecolumnsetspan + {\!!counta#1\!!countb#2\docalculatecolumnsetspan \edef\columnsetspanhsize{\the\!!widtha}} -\def\definecolumnsetspan% +\def\definecolumnsetspan {\dodoubleempty\dodefinecolumnsetspan} \def\dodefinecolumnsetspan[#1][#2]% @@ -1761,55 +2086,129 @@ \c!voor=, \c!na=, \c!offset=\v!overlay, - \c!plaats=, + \c!plaats=\v!links, \c!regelcorrectie=\v!uit, \c!dieptecorrectie=\v!uit, \c!n=2, + \c!nregels=0, + \c!springvolgendein=\v!ja, + \c!default=HERE, + \c!variant=\v!a, #2]% %\else % \definecolumnspan[][#1]% }%\fi} -\def\setupcolumnsetspan% +\def\setupcolumnsetspan {\dodoubleempty\dosetupcolumnsetspan} \def\dosetupcolumnsetspan[#1][#2]% {%\ifsecondargument - \setupframedtext[cs:#1][#2]% + \setupframedtexts[cs:#1][#2]% %\else % \setupcolumnsetspan[][#1]% }%\fi} -\def\startcolumnsetspan% +\def\startcolumnsetspan {\dotripleempty\dostartcolumnsetspan} -%%%%%%%%%%%%%%%% TODO - -\def\dostartcolumnsetspan[#1][#2][#3]% [#3] gobbles space - {\bgroup - \!!countc\framedtextparameter{cs:#1}\c!n% - \!!countd\nofcolumns \advance\!!countd -\mofcolumns \advance\!!countd 1 - \ifnum\!!countc>\!!countd \!!countc\!!countd \fi +%%%%%%%%%%%%%%%% TODO + +\def\dostartcolumnsetspan[#1][#2][#3]% [#3] gobbles space + {\endgraf % else rubish output if forgotten + \vskip \zeropoint % make sure otr is done, otherwise last line problems + \bgroup +\forgetall + \setupframedtexts[cs:#1] + [\c!breedte=\columnsetspanhsize, + \c!regelcorrectie=\v!uit, + \c!dieptecorrectie=\v!uit, + #2]% + % determine widths + \!!countc\framedtextparameter{cs:#1}\c!n + % \!!countd\numexpr(\nofcolumns-\mofcolumns+\plusone)% + \!!countd\nofcolumns + % n <= n of columns + \ifnum\!!countc>\!!countd \!!countc\!!countd \fi + \advance\!!countd -\mofcolumns + \advance\!!countd \plusone + % n <= n of available columns (alternative a) + \doif{\framedtextparameter{cs:#1}\c!variant}\v!a + {\ifnum\!!countc>\!!countd \!!countc\!!countd \fi}% + % here it all starts \setcolumnsetspanhsize\mofcolumns\!!countc % a/b used \hsize\columnsetspanhsize - \setupframedtexts[cs:#1][\c!breedte=\columnsetspanhsize, -\c!regelcorrectie=\v!uit,\c!dieptecorrectie=\v!uit,#2] -\setbox\scratchbox\vbox\bgroup - \dostartframedtext[cs:#1][\v!geen] - \vskip-\lineheight\par\strut\par - \framedtextparameter{cs:#1}\c!voor - \def\stopcolumnsetspan{\dostopcolumnsetspan{#1}}} + \setbox\scratchbox\vbox\bgroup + \dostartframedtext[cs:#1][\v!geen]% geen nils placement + \vskip-\lineheight\par\strut\par + \framedtextparameter{cs:#1}\c!voor + \def\stopcolumnsetspan{\dostopcolumnsetspan{#1}}} + +% \chardef\columnslotlocation2 + +% \def\dostopcolumnsetspan#1% +% {\par +% \vbox{\strut} +% \kern-2\lineheight +% \vbox{\strut} +% \doifsomething{\framedtextparameter{cs:#1}\c!na} +% {\framedtextparameter{cs:#1}\c!na +% \kern\zeropoint}% otherwise blanks disappear, better be a switch +% \dostopframedtext +% \egroup +% \setbox\scratchbox\frozenhbox % keeps grid snapping okay +% {\lower\strutdepth\box\scratchbox}% +% %todo: nboven/onder\chardef\columnslotlocation2 +% %\OTRSETstoreincolumnslotSOMEWHERE\columnslotlocation\scratchbox +% \chardef\columnslotspacing\framedtextparameter{cs:#1}\c!nregels\relax +% \OTRSETstoreincolumnslotSOMEWHERE2\scratchbox +% \doif{\framedtextparameter{cs:#1}\c!springvolgendein}\v!nee +% \noindentation +% \egroup +% \endgraf} \def\dostopcolumnsetspan#1% {\par - \kern-\lineheight\prevdepth\dp\strutbox\strut - \framedtextparameter{cs:#1}\c!na - \kern\zeropoint % needed ? + \vbox{\strut} + \kern-2\lineheight + \vbox{\strut} + \doifsomething{\framedtextparameter{cs:#1}\c!na} + {\framedtextparameter{cs:#1}\c!na + \kern\zeropoint}% otherwise blanks disappear, better be a switch \dostopframedtext -\vskip-\strutdepth % awful hack \egroup - \chardef\columnslotspacing0 % ! ! ! - \OTRSETstoreincolumnslotHERE\scratchbox - \egroup} + % frozen keeps grid snapping okay + \setbox\scratchbox\frozenhbox to \hsize + {\dontcomplain + \doregelplaats{\framedtextparameter{cs:#1}\c!plaats}% + {\lower\strutdepth\box\scratchbox}}% + \dp\scratchbox\zeropoint % else wrong snap insidefloat + \ifinsidefloat + \box\scratchbox + \else + % we only set \columnsetspacing when asked for, else bottom problems + \scratchcounter\framedtextparameter{cs:#1}\c!nregels\relax + \ifcase\scratchcounter\else\chardef\columnslotspacing\scratchcounter\fi + % todo: nboven/onder & \chardef\columnslotlocation2 + %\OTRSETstoreincolumnslotHERE\scratchbox + \edef\floatmethod{\framedtextparameter{cs:#1}\c!default}% + \@EA\uppercasestring\floatmethod\to\floatmethod + % todo : \v!hier -> here enzovoorts + \OTRSETstoreincolumnslot\floatmethod\scratchbox + \doif{\framedtextparameter{cs:#1}\c!springvolgendein}\v!nee + \noindentation + \fi + \egroup + \endgraf} + +% \startcolumnset[two] +% \input tufte +% \startcolumnsetspan[two][width=20cm,location=middle] \input tufte \stopcolumnsetspan +% \startcolumnsetspan[two][default=btlr] \input tufte \stopcolumnsetspan +% \input tufte \par +% \input tufte \par +% \startcolumnsetspan[two] \emptylines[5] \stopcolumnsetspan +% \startcolumnsetspan[two] \input tufte \stopcolumnsetspan +% \stopcolumnset -\protect \endinput +\protect \endinput diff --git a/tex/context/base/page-sid.tex b/tex/context/base/page-sid.tex index 681ea29d4..e798d352b 100644 --- a/tex/context/base/page-sid.tex +++ b/tex/context/base/page-sid.tex @@ -98,8 +98,26 @@ % \dochecksidefloat % \scratchcounter=-\hangafter % \dorecurse{\scratchcounter}{\strut\hfill\strut\par}} - -\def\flushsidefloats% +% +%\def\flushsidefloats +% {\par +% \!!heighta\sidefloatvsize +% \advance\!!heighta -\pagetotal +% \ifdim\!!heighta>\zeropoint +% % to be checked for interference +% \witruimte +% % will be option +% \getnoflines\!!heighta +% \!!heighta\noflines\lineheight +% % so far for option +% \kern\!!heighta +% \fi +% % == \forgetsidefloats +% \global\sidefloatvsize\nofloatvsize +% \global\floatshortfalse +% \global\floatflagfalse} + +\def\flushsidefloats {\par \!!heighta\sidefloatvsize \advance\!!heighta -\pagetotal @@ -110,50 +128,60 @@ \getnoflines\!!heighta \!!heighta\noflines\lineheight % so far for option - \kern\!!heighta + \ifdim\sidefloatbottomskip>\zeropoint\relax + \ifdim\!!heighta>\sidefloatbottomskip + \advance\!!heighta-\sidefloatbottomskip + \kern\!!heighta + \vskip\sidefloatbottomskip + \else + \kern\!!heighta + \fi + \else + \kern\!!heighta + \fi \fi -% == \forgetsidefloats + % == \forgetsidefloats \global\sidefloatvsize\nofloatvsize \global\floatshortfalse \global\floatflagfalse} -\def\flushsidefloatsafterpar% +\def\flushsidefloatsafterpar {\xdef\oldpagetotal{\the\pagetotal}% - \gdef\checksidefloat% + \gdef\checksidefloat {\dochecksidefloat \ifdim\oldpagetotal=\pagetotal \else \global\let\checksidefloat\dochecksidefloat \flushsidefloats \fi}} -\def\forgetsidefloats% +\def\forgetsidefloats {\global\sidefloatvsize\nofloatvsize \global\floatshortfalse \global\floatflagfalse} \let\logsidefloat=\relax -\def\pushpenalties% - {\widowpenalty1 +\def\pushpenalties + {\widowpenalty\plusone \clubpenalty2 - \brokenpenalty1 + \brokenpenalty\plusone \let\pushpenalties\relax - \edef\poppenalties% - {\widowpenalty\the\widowpenalty - \clubpenalty\the\clubpenalty + \edef\poppenalties + {\widowpenalty \the\widowpenalty + \clubpenalty \the\clubpenalty \brokenpenalty\the\brokenpenalty}} \let\poppenalties=\relax -\def\restorepenalties% +\def\restorepenalties {\ifnum\outputpenalty=\!!tenthousand\else \penalty\outputpenalty \fi} -\def\sidefloatoutput% +\def\sidefloatoutput {\iffloatshort \unvbox\normalpagebox - \setbox\floatbottom=\lastbox + \setbox\floatbottom\lastbox \ifdim\wd\floatbottom>\sidefloathsize \penalty-201 \box\floatbottom @@ -162,17 +190,17 @@ \else \restoreleftindent \ifdim\wd\floatbottom<\sidefloathsize - \parskip=\zeropoint + \parskip\zeropoint %\noindent - \vadjust{\penalty-1}% + \vadjust{\penalty\minusone}% \iffloatlefteqo \global\floatlefteqofalse \else - \global\advance\sidefloathsize by -\wd\floatbottom + \global\advance\sidefloathsize -\wd\floatbottom \iffloatrighteqo \global\floatrighteqofalse \else - \global\divide\sidefloathsize by 2 + \global\divide\sidefloathsize 2 \fi \hskip\sidefloathsize \fi @@ -181,11 +209,11 @@ \restorepenalties \fi \fi - \global\holdinginserts=0 + \global\holdinginserts\zerocount \global\floatshortfalse \else \finalsidefloatoutput % new - \global\sidefloatvsize=\nofloatvsize + \global\sidefloatvsize\nofloatvsize \poppenalties \fi} @@ -197,7 +225,7 @@ \parskip\zeropoint % here ? \ifdim\sidefloatwidth>\zeropoint % new, see prikkels \noindent - \vadjust{\penalty-1}% + \vadjust{\penalty\minusone}% \hskip\sidefloatwidth %\else % we have a margin or edge float @@ -206,7 +234,7 @@ \ifx\normaleqno\undefined - \def\normaleqno% + \def\normaleqno {\iffloatshort \global\floatrighteqotrue \fi @@ -214,7 +242,7 @@ \else - \def\eqno% + \def\eqno {\iffloatshort \global\floatrighteqotrue \fi @@ -240,6 +268,36 @@ \def\rightfloat#1% {\global\rightfloattrue\marginfloatfalse\edgefloatfalse\putsidefloat{#1}} +% \def\putsidefloat#1% crap macro +% {\par +% \witruimte +% % moved here dec 2001 +% {\everypar\emptytoks\forgetall\vbox{\strut}\vskip-\lineheight}% moved +% % +% \previoussidefloat +% \stallsidefloat +% \setbox\floatbox\hbox{\vbox % pretty ugly, will be rewritten +% {\vskip +% \sidefloatdownshift +% \vskip +% \ifmarginfloat +% -\sidefloattopskip +% \else\ifedgefloat +% -\sidefloattopskip +% \else +% +\sidefloattopoffset +% \fi\fi +% #1}} +% \global\sidefloatdownshift\zeropoint +% \measuresidefloat +% \ifroomforfloat +% \else +% \tosssidefloat +% \measuresidefloat +% \stallsidefloat +% \fi +% \setsidefloat} + \def\putsidefloat#1% crap macro {\par \witruimte @@ -248,15 +306,22 @@ % \previoussidefloat \stallsidefloat - \setbox\floatbox=\hbox{\vbox % pretty ugly, will be rewritten - {\vskip - \ifmarginfloat - -\sidefloattopskip - \else\ifedgefloat - -\sidefloattopskip - \else - +\sidefloattopoffset - \fi\fi#1}} + \setbox\floatbox\hbox + {\ifmarginfloat\else\ifrightfloat\else\kern\sidefloatleftshift\fi\fi + \vbox % pretty ugly, will be rewritten + {\vskip + \sidefloatdownshift + \vskip + \ifmarginfloat + -\sidefloattopskip + \else\ifedgefloat + -\sidefloattopskip + \else + +\sidefloattopoffset + \fi\fi + #1}% no \hskip, but \kern here + \ifmarginfloat\else\ifrightfloat\kern\sidefloatrightshift\fi\fi}% + \global\sidefloatdownshift\zeropoint \measuresidefloat \ifroomforfloat \else @@ -267,7 +332,7 @@ \setsidefloat} \def\progresssidefloat% - {\sidefloatprogress=\sidefloatvsize + {\sidefloatprogress\sidefloatvsize \iffloatflag \advance\sidefloatprogress -\sidefloatpagetotal \global\floatflagfalse @@ -275,12 +340,12 @@ \advance\sidefloatprogress -\pagetotal \fi} -\def\tosssidefloat% +\def\tosssidefloat {\vfill\eject} \newdimen\sidefloatpagetotal -\def\measuresidefloat% +\def\measuresidefloat {\global\floatflagtrue \global\sidefloatpagetotal \pagetotal % global \ifmarginfloat @@ -303,14 +368,14 @@ \roomforfloatfalse \else \dimen0=\pagegoal - \advance\dimen0 by -\sidefloatvsize + \advance\dimen0 -\sidefloatvsize \ifdim\dimen0<\sidefloatbottomskip - \global\advance\sidefloatvsize by \dimen0 + \global\advance\sidefloatvsize \dimen0 \global\floatshorttrue \pushpenalties - \global\holdinginserts=1 + \global\holdinginserts\plusone \else - \global\advance\sidefloatvsize by \sidefloatbottomskip + \global\advance\sidefloatvsize \sidefloatbottomskip \global\floatshortfalse \fi \roomforfloattrue @@ -356,7 +421,7 @@ \kern-\sidefloatheight \penalty10001 % oeps, this will change \normalbaselines - \prevdepth=\presidefloatdepth + \prevdepth\presidefloatdepth %\noindent \resetsidefloatparagraph \ignorespaces} @@ -367,12 +432,12 @@ {\ifnum\sidefloatparagraph=1 } \def\setsidefloatparagraph% - {%\advance\sidefloatprogress by \sidefloatbottomskip - %\!!counta=\sidefloatprogress -\scratchdimen=\sidefloatprogress + {%\advance\sidefloatprogress \sidefloatbottomskip + %\!!counta\sidefloatprogress +\scratchdimen\sidefloatprogress \advance\scratchdimen \ht\strutbox -\!!counta=\scratchdimen - \divide\!!counta by \baselineskip +\!!counta\scratchdimen + \divide\!!counta \baselineskip \ifnum\!!counta>0 \ifrightfloat \hangindent=-\sidefloatwidth @@ -381,10 +446,10 @@ \fi \hangafter=-\!!counta \fi - \global\advance\sidefloatparagraph 1 } + \global\advance\sidefloatparagraph \plusone} \def\resetsidefloatparagraph% - {\global\sidefloatparagraph=0 } + {\global\sidefloatparagraph\zerocount } \def\dochecksidefloat% {\progresssidefloat @@ -419,12 +484,12 @@ \fi} \def\stallsidefloat% - {\!!counta=\pageshrink + {\!!counta\pageshrink \divide\!!counta \baselineskip - \advance\!!counta 1 - \parskip=\zeropoint - \dorecurse{\!!counta}{\line{}} + \advance\!!counta \plusone + \parskip\zeropoint + \dorecurse\!!counta{\line{}} \kern-\!!counta\baselineskip - \penalty0 } + \penalty\zerocount } \protect \endinput diff --git a/tex/context/base/page-spr.tex b/tex/context/base/page-spr.tex new file mode 100644 index 000000000..ed636607e --- /dev/null +++ b/tex/context/base/page-spr.tex @@ -0,0 +1,101 @@ +%D \module +%D [ file=page-spr, +%D version=2002.11.11, +%D title=\CONTEXT\ Page Macros, +%D subtitle=Spreading, +%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 / Spreading} + +% This module is experimental and not yet official! + +\unprotect + +\newbox\spreadbox +\newif\ifinspread + +\chardef\showspreadmode=1 + +\def\settextpagecontent#1#2#3% #2 and #3 will disappear + {\setbox#1\hbox + {\vbox to \teksthoogte + {\offinterlineskip + \freezetextwidth + \hsize\tekstbreedte % local variant of \sethsize + \boxmaxdepth\maxdepth + \noindent % content can be < \hsize + \dopagecontents#2#3}}% + \dp#1\zeropoint + \setbox#1\hbox to \zetbreedte + {\ifinspread + \ifvoid\spreadbox + \global\setbox\spreadbox\box#1% + \copy\spreadbox\hss % left page + \else + % prevent duplicate writes in normal run + \ifarrangingpages \else \ifcase\showspreadmode + \global\setbox\spreadbox\null + \wd\spreadbox\zetbreedte + \ht\spreadbox\teksthoogte + \fi \fi + \hss\box\spreadbox % right page + \fi + \else + \hss\box#1\hss % never change the \hss's + \fi}} + +\def\doflushspread + {\ifinspread \ifvoid\spreadbox\else + \null % \s!dummy % dummy text. will be discarded + \pagina + \fi \fi } + +\def\startspread + {\bgroup + \ifdubbelzijdig + \pagina[\v!links]% + \inspreadtrue + \scratchdimen2\tekstbreedte + \advance\scratchdimen2\rugwit + \expanded{\setuplayout[\c!tekstbreedte=\the\scratchdimen]}% + \def\startspread{\bgroup\let\stopspread\egroup}% + \let\stopspread\dostopspread + \else + \let\stopspread\egroup + \fi} + +\let\stopspread\relax + +\def\dostopspread + {\kern\zeropoint\pagina + \inspreadfalse + \setuplayout[\c!tekstbreedte=\tekstbreedte] + \pagina[\v!links] + \egroup} + +\protect \endinput + +% texexec --arr --pdf test +% +% \setuplayout[width=middle] +% \setuppapersize[A4][A3,landscape] +% \setuppagenumbering[alternative=doublesided] +% \setuparranging[2UP] +% +% \starttext +% +% \dorecurse{3}{\input tufte } +% +% \startspread +% \dorecurse{10}{\input tufte } +% \stopspread +% +% \dorecurse{3}{\input tufte } +% +% \stoptext diff --git a/tex/context/base/page-txt.tex b/tex/context/base/page-txt.tex index e47d44d61..91cb89b61 100644 --- a/tex/context/base/page-txt.tex +++ b/tex/context/base/page-txt.tex @@ -67,14 +67,6 @@ \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\dosetuplayouttext[#1][#2][#3]% {\ifthirdargument \getparameters[\??tk#1#2][#3]% @@ -82,7 +74,7 @@ %\getparameters[\??tk#1\v!tekst][#2]% \getparameters[\??tk#1][#2]% \fi -% \checkcurrentlayout + %\checkcurrentlayout % no \calculatevsizes} \def\setuptop {\dotripleempty\dosetuplayouttext[\v!boven]} @@ -100,11 +92,11 @@ %D \showsetup{\y!noheaderandfooterlines} %D \showsetup{\y!notopandbottomlines} -\def\noheaderandfooterlines% +\def\noheaderandfooterlines {\setupheader[\c!status=\v!leeg]% \setupfooter[\c!status=\v!leeg]} -\def\notopandbottomlines% +\def\notopandbottomlines {\setuptop [\c!status=\v!leeg]% \setupbottom[\c!status=\v!leeg]} @@ -136,39 +128,39 @@ \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} + {\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} + {\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!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!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}% {\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}% {\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}% {\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}% {\c!rechterletter\c!rechterkleur\c!rechterbreedte}{#3}}% \else\ifsecondargument % new \letvalue{\??tk#1\v!tekst\c!linkertekst }\empty @@ -185,23 +177,20 @@ %D only when double sided typesetting is enabled. \def\dodoubletexts#1#2#3#4#5#6% - {\doifonevenpaginaelse + {\doifoddpageelse {\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\placetextlinestrut#1% -% {\doifvalue{#1\v!tekst\c!strut}{\v!ja}{\setstrut\strut}} - \def\placetextlinestrut#1% - {\doifvalue{#1\c!strut}{\v!ja}{\setstrut\strut}} + {\doifvalue{#1\c!strut}\v!ja{\setstrut\strut}} \def\dosingletexts#1#2#3#4#5#6% {\bgroup \convertargument#6\to\ascii - \doifsomething{\ascii} + \doifsomething\ascii {\doattributes{#1#2}#3#4% {\placetextlinestrut{#1}% here ! %\doifdefinedelse{\??mk\ascii\c!koppeling} % brrr @@ -254,10 +243,10 @@ {\edef\textlinestatus{\csname\??tk#1\c!status\endcsname}} %\def\resettextlinestatus#1% -% {\global\letvalue{\??tk#1\v!tekst\c!status}\v!normaal} +% {\letgvalue{\??tk#1\v!tekst\c!status}\v!normaal} \def\resettextlinestatus#1% - {\global\letvalue{\??tk#1\c!status}\v!normaal} + {\letgvalue{\??tk#1\c!status}\v!normaal} %\def\placelayouttextline#1#2% % handelt o.b.v. tekst % {\settextlinestatus{#1}% @@ -308,7 +297,7 @@ \setvalue{\string\placelayouttextline\v!geenmarkering}#1#2% {\bgroup \resettextlinestatus{#1}% - \let\dohaalmarkering=\nohaalmarkering + \let\dohaalmarkering\nohaalmarkering \doplacelayouttextline{#1}{#2}% \egroup} @@ -342,7 +331,7 @@ {\resettextlinestatus{#1}% \donetrue}} -\def\resetlayoutlines% +\def\resetlayoutlines {\donefalse \resetlayoutline\v!boven \resetlayoutline\v!hoofd @@ -362,8 +351,8 @@ \newbox\scratchpagebox -\def\gettextboxes% - {\setbox\scratchpagebox=\vbox +\def\gettextboxes + {\setbox\scratchpagebox\vbox {\mindermeldingen \calculatereducedvsizes \swapmargins @@ -398,10 +387,8 @@ \smashbox\scratchpagebox \box\scratchpagebox} -\let\maintextcolor\empty - \def\getmainbox#1#2% - {\setbox\scratchpagebox=\vbox + {\setbox\scratchpagebox\vbox {\offinterlineskip % na \paginaletter ! \calculatereducedvsizes \calculatehsizes @@ -427,11 +414,9 @@ \settextpagecontent\scratchpagebox{#1}{#2}% \addtextbackground\scratchpagebox \addtextgridlayer\scratchpagebox - \ifx\maintextcolor\empty + \localstarttextcolor \box\scratchpagebox - \else - \color[\maintextcolor]{\box\scratchpagebox}% - \fi + \localstoptextcolor \bgroup \hskip\rechtermargeafstand \ifdim\rechtermargebreedte>\zeropoint @@ -452,24 +437,42 @@ %D (tracing) information. \def\settextpagecontent#1#2#3% #2 and #3 will disappear - {\setbox#1=\hbox to \zetbreedte + {\setbox#1\hbox to \zetbreedte {\hss % so don't change this \vbox to \teksthoogte {\offinterlineskip \freezetextwidth - \hsize=\tekstbreedte % local variant of \sethsize + \hsize\tekstbreedte % local variant of \sethsize \boxmaxdepth\maxdepth \noindent % content can be < \hsize \dopagecontents#2#3}% \hss}% - \dp#1=\zeropoint} + \dp#1\zeropoint} -\def\addtextgridlayer#1% - {\ifshowgrid +\def\addtextgridlayer#1% tzt run time + {\ifcase\showgridstate\else % 1=bottom 2=top \setgridbox\scratchbox\zetbreedte\teksthoogte - \setbox#1=\hbox - {\color[red]{\box\scratchbox}% - \hskip-\zetbreedte\box#1}% + \setbox#1\hbox + {\ifcase\showgridstate\or\box#1\hskip-\zetbreedte\fi + \bgroup % color + \incolortrue + \ifcase\layoutcolumns\else + \gray + \hbox to \zetbreedte + {\dorecurse\layoutcolumns + {\hskip\layoutcolumnwidth + \ifnum\recurselevel<\layoutcolumns + \vrule + \!!height\ht\scratchbox + \!!depth\dp\scratchbox + \!!width\layoutcolumndistance + \fi}}% + \hskip-\zetbreedte + \fi + \red + \box\scratchbox + \egroup + \ifcase\showgridstate\or\or\hskip-\zetbreedte\box#1\fi}% \fi} %D The placement of a whole line is handled by the next two @@ -478,88 +481,11 @@ \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}} - \def\doplacelayouttextline#1#2% {\ifdim#2>\zeropoint\relax % prevents pagenumbers when zero height \goleftonpage \hbox - {\setbox\scratchpagebox=\vbox to #2 + {\setbox\scratchpagebox\vbox to #2 {%\forgetall \vsize#2\relax \normalbaselines @@ -580,7 +506,7 @@ %\getvalue{\??tk#1\v!tekst\c!na}% \getvalue{\??tk#1\c!na}% \kern\zeropoint}% keep the \dp, beware of \vtops, never change this! - \dp\scratchpagebox=\zeropoint + \dp\scratchpagebox\zeropoint \box\scratchpagebox}% \vskip-#2\relax \fi} @@ -629,17 +555,12 @@ {\getvalue{\??tk#1\v!rand#4}\hss}% \fi}} -% \def\dododoplacelayouttextline#1#2#3#4% -% {\hbox to #1{\hsize#1\relax#4}} - \def\dododoplacelayouttextline#1#2#3#4% {\vbox % to \vsize {\hsize#1\relax - %\executeifdefined{\??tk#2#3\c!voor}\relax - \getvalue{\??tk#2#3\c!voor}\relax + \getvalue{\??tk#2#3\c!voor} \hbox to #1{#4}% - %\executeifdefined{\??tk#2#3\c!na}\relax}} - \getvalue{\??tk#2#3\c!na}\relax}} + \getvalue{\??tk#2#3\c!na}}} %D Although it is far better to use backgrounds for this %D purpose, one can add a rule in the following way. This @@ -661,8 +582,8 @@ %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} +\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}. diff --git a/tex/context/base/regi-il1.tex b/tex/context/base/regi-il1.tex index 8e283b55f..f02a6f397 100644 --- a/tex/context/base/regi-il1.tex +++ b/tex/context/base/regi-il1.tex @@ -59,7 +59,7 @@ \defineactivetoken 189 {\textonehalf} \defineactivetoken 190 {\textthreequarters} -\defineactivetoken 183 {\textperiodcentered} +%defineactivetoken 183 {\textperiodcentered} \defineactivetoken 166 {\textbrokenbar} \defineactivetoken 176 {\textdegree} diff --git a/tex/context/base/regi-ini.tex b/tex/context/base/regi-ini.tex index ce0fa3576..07e1f3fb9 100644 --- a/tex/context/base/regi-ini.tex +++ b/tex/context/base/regi-ini.tex @@ -10,9 +10,9 @@ {\setvalue{\c!file\f!regimeprefix#1}{}% \makeshortfilename[\f!regimeprefix#1]% \startreadingfile - \readsysfile{\shortfilename} - {\showmessage{\m!encodings}{2}{#1}} - {\showmessage{\m!encodings}{3}{#1}}% + \readsysfile\shortfilename + {\showmessage\m!encodings2{#1}} + {\showmessage\m!encodings3{#1}}% \stopreadingfile}} \def\useregime[#1]% @@ -20,6 +20,6 @@ \protect -\useregime[def,uni,ibm,win,il1] +\useregime[def,uni,ibm,win,il1,mac] \endinput diff --git a/tex/context/base/regi-mac.tex b/tex/context/base/regi-mac.tex new file mode 100644 index 000000000..6f5dd36fa --- /dev/null +++ b/tex/context/base/regi-mac.tex @@ -0,0 +1,119 @@ +%D \module +%D [ file=regi-mac, +%D version=2001.03.18, +%D title=\CONTEXT\ Encoding Macros, +%D subtitle=Mac Encoding, +%D author={Michel Bovani \& Hans Hagen}, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startregime [mac] + +\defineactivetoken Ë {\Agrave} +\defineactivetoken ç {\Aacute} +\defineactivetoken å {\Acircumflex} +\defineactivetoken Ì {\Atilde} +\defineactivetoken € {\Adiaeresis} +\defineactivetoken {\Aring} % ? +\defineactivetoken ® {\AEligature} + +\defineactivetoken Ë {\agrave} +\defineactivetoken ‡ {\aacute} +\defineactivetoken ‰ {\acircumflex} +\defineactivetoken ‹ {\atilde} +\defineactivetoken Š {\adiaeresis} +\defineactivetoken Œ {\aring} % ? +\defineactivetoken ¾ {\aeligature} + +\defineactivetoken ‚ {\Ccedilla} +\defineactivetoken {\ccedilla} + +\defineactivetoken é {\Egrave} +\defineactivetoken ƒ {\Eacute} +\defineactivetoken æ {\Ecircumflex} +\defineactivetoken è {\Ediaeresis} + +\defineactivetoken {\egrave} +\defineactivetoken Ž {\eacute} +\defineactivetoken {\ecircumflex} +\defineactivetoken ‘ {\ediaeresis} + +\defineactivetoken í {\Igrave} +\defineactivetoken ê {\Iacute} +\defineactivetoken ë {\Icircumflex} +\defineactivetoken ì {\Idiaeresis} + +\defineactivetoken “ {\igrave} +\defineactivetoken ’ {\iacute} +\defineactivetoken ” {\icircumflex} +\defineactivetoken • {\idiaeresis} + +\defineactivetoken „ {\Ntilde} +\defineactivetoken – {\ntilde} + +\defineactivetoken ñ {\Ograve} +\defineactivetoken î {\Oacute} +\defineactivetoken ï {\Ocircumflex} +\defineactivetoken Í {\Otilde} +\defineactivetoken … {\Odiaeresis} +\defineactivetoken Î {\OEligature} +\defineactivetoken ¯ {\Oslash} % ? + +\defineactivetoken ˜ {\ograve} +\defineactivetoken — {\oacute} +\defineactivetoken ™ {\ocircumflex} +\defineactivetoken › {\otilde} +\defineactivetoken š {\odiaeresis} +\defineactivetoken Ï {\oeligature} +\defineactivetoken ¿ {\oslash} % ? + +\defineactivetoken Š {\Scaron} +\defineactivetoken š {\scaron} +\defineactivetoken § {\ssharp} + +\defineactivetoken ô {\Ugrave} +\defineactivetoken ò {\Uacute} +\defineactivetoken ó {\Ucircumflex} +\defineactivetoken † {\Udiaeresis} + +\defineactivetoken {\ugrave} +\defineactivetoken œ {\uacute} +\defineactivetoken ž {\ucircumflex} +\defineactivetoken Ÿ {\udiaeresis} + +\defineactivetoken Ý {\Yacute} +\defineactivetoken ý {\yacute} +\defineactivetoken Ø {\ydiaeresis} +\defineactivetoken Ù {\Ydiaeresis} + +\defineactivetoken À {?`} % ? +\defineactivetoken Á {!`} % ? +\defineactivetoken {\textdag} +\defineactivetoken à {\textddag} +\defineactivetoken ¦ {\paragraphmark} +\defineactivetoken ¤ {\sectionmark} +\defineactivetoken Ð {\endash} +\defineactivetoken Ñ {\emdash} +\defineactivetoken É {\unknown} % ? +\defineactivetoken © {\copyright} +\defineactivetoken £ {\sterling} % ? + +\defineactivetoken ã {\char44\kern-.1em\char44 } % ? +\defineactivetoken Ò {\char96\kern-.1em\char96 } % ? +%defineactivetoken " {\char34 } % no +\defineactivetoken Ô {\quoteleft} % ? +\defineactivetoken Õ {\char39 } % ? +%defineactivetoken {\guilsingleright} % ? +%defineactivetoken {\guilsingleleft} % ? +\defineactivetoken Ç {\leftguillemot} +\defineactivetoken È {\rightguillemot} + +\stopregime + +% \enableregime[mac] + +\endinput diff --git a/tex/context/base/regi-utf.tex b/tex/context/base/regi-utf.tex new file mode 100644 index 000000000..0e33ebb58 --- /dev/null +++ b/tex/context/base/regi-utf.tex @@ -0,0 +1,45 @@ +%D \module +%D [ file=regi-utf, +%D version=2002.12.03, +%D title=\CONTEXT\ Encoding Macros, +%D subtitle=UTF-8, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This regime activates the characters $>192$ and let them +%D handle \UTF\ encoded content streams. This regime runs on +%D top of the \type {unic} modules. We use an active inspector +%D instead of a active token handler because here we don't want +%D the \type {{}}. We only support this in \ETEX. + +\beginTEX + \expandafter \endinput +\endTEX + +\unprotect + +\startregime[utf] + +\dostepwiserecurse{192}{223}{1} + {\expanded{\defineactiveinspector{\recurselevel} % space delimited + {\noexpand\utftwouniglph{\recurselevel}}}% + }%\letvalue{\@@univector\recurselevel}\gobbleoneargument} + +\dostepwiserecurse{224}{239}{1} + {\expanded{\defineactiveinspector{\recurselevel} % space delimited + {\noexpand\utfthreeuniglph{\recurselevel}}}% + }%\letvalue{\@@univector\recurselevel}\gobbetwoarguments} + +\dostepwiserecurse{240}{247}{1} + {\expanded{\defineactiveinspector{\recurselevel} % space delimited + {\noexpand\utffouruniglph{\recurselevel}}}% + }%\letvalue{\@@univector\recurselevel}\gobblethreearguments} + +\stopregime + +\protect \endinput diff --git a/tex/context/base/s-abr-01.tex b/tex/context/base/s-abr-01.tex index aec65a385..bc9414d50 100644 --- a/tex/context/base/s-abr-01.tex +++ b/tex/context/base/s-abr-01.tex @@ -33,14 +33,18 @@ \logo [CD] {cd} \logo [CMR] {cmr} \logo [CMYK] {cmyk} +\logo [CODHOST] {CodHost} \logo [CONTEXT] {\ConTeXt} \logo [CTAN] {ctan} \logo [CWEB] {cweb} \logo [DISTILLER] {distiller} +\logo [DSC] {dsc} \logo [DTD] {dtd} \logo [DTK] {dtk} \logo [DTP] {dtp} \logo [DVIPSONE] {dvipsone} +\logo [DVIPDFM] {dvipdfm} +\logo [DVIPDFMX] {dvipdfmx} \logo [DVIPS] {dvips} \logo [DVISCR] {dviscr} \logo [DVIWINDO] {dviwindo} @@ -51,13 +55,14 @@ \logo [EMTEX] {em\TeX} \logo [EPS] {eps} \logo [EXAMPLE] {eXaMpLe} +\logo [EXIMPLE] {eXiMpLe} \logo [ETEX] {\eTeX} \logo [EUROMATH] {EuroMath} \logo [EUROTEX] {Euro\TeX} \logo [FAQ] {faq} %logo [FGA] {fga} \logo [FDF] {fdf} -\logo [FGBBS] {fgbbs} +%logo [FGBBS] {fgbbs} \logo [FPTEX] {fp\TeX} \logo [FREEBSD] {FreeBSD} \logo [FTP] {ftp} @@ -67,6 +72,7 @@ \logo [GNU] {gnu} \logo [GS] {Ghost\-Script} \logo [GUST] {Gust} +\logo [HTTP] {http} \logo [HTML] {html} \logo [IBM] {ibm} \logo [INRSTEX] {inrs\TeX} @@ -98,6 +104,7 @@ \logo [NTG] {ntg} \logo [NTS] {nts} \logo [OMEGA] {Omega} +\logo [OPI] {opi} \logo [PASCAL] {Pascal} \logo [PDFETEX] {pdf-\eTeX} \logo [PDFTEX] {pdf\TeX} @@ -119,11 +126,15 @@ \logo [PSTRICKS] {pstricks} \logo [PSTOEDIT] {pstoedit} \logo [PS] {Post\-Script} +\logo [READER] {Acro\-bat Reader} +\logo [RELAXNG] {Relax\kern.125emNG} +\logo [RUBY] {Ruby} \logo [RGB] {rgb} \logo [SGML] {sgml} \logo [SI] {si} \logo [SQL] {sql} \logo [TABLE] {\TaBlE} +\logo [TCPIP] {tcp/ip} \logo [TDS] {tds} % no sc te \logo [TETEX] {te\TeX} % no sc te \logo [TEXADRES] {\TeX adress} @@ -155,6 +166,7 @@ \logo [URL] {url} \logo [USA] {usa} \logo [USENET] {usenet} +\logo [UTF] {utf} \logo [WDT] {wdt} \logo [WEBC] {web2c} \logo [WEB] {web} @@ -165,6 +177,7 @@ \logo [XDVI] {Xdvi} \logo [XINDY] {Xindy} \logo [XML] {xml} +\logo [XFDF] {xfdf} \logo [XSLT] {xslt} \logo [XSL] {xsl} \logo [YandY] {y\&y} diff --git a/tex/context/base/s-dtk-01.tex b/tex/context/base/s-dtk-01.tex index f1aa44238..dc0e4032a 100644 --- a/tex/context/base/s-dtk-01.tex +++ b/tex/context/base/s-dtk-01.tex @@ -67,14 +67,14 @@ %D driver to sort out the margins. Therefore we are not %D really typesetting in A5, but on something larger. -\definieerpapierformaat +\definepapersize [DanteA5] [breedte=486.54pt] -\stelpapierformaatin +\setuppapersize [DanteA5][A4] -\stellayoutin % w=342pt h=484pt +\setuplayout % w=342pt h=484pt [\c!rugwit=1in, \c!kopwit=1in, \c!plaats=\v!enkelzijdig, @@ -92,7 +92,7 @@ %D Numbering. -\stelnummeringin +\setuppagenumbering [\c!plaats=, \c!variant=\v!dubbelzijdig] @@ -254,4 +254,4 @@ %D Done. -\endinput +\protect \endinput diff --git a/tex/context/base/s-fnt-01.tex b/tex/context/base/s-fnt-01.tex index 8fb40de15..ad4c9f8cb 100644 --- a/tex/context/base/s-fnt-01.tex +++ b/tex/context/base/s-fnt-01.tex @@ -36,25 +36,26 @@ {\dotripleempty\doShowFont} \def\doShowFont[#1][#2][#3]% - {\bgroup - \ifthirdargument - \definefontsynonym[WhateverName][#2][encoding=#3] - \definefont[WhateverFont][WhateverName] - \setupheadertexts[\tttf#2\quad#1\quad#3] - \WhateverFont - \setupinterlinespace - \showfont[WhateverName] - \showligatures[WhateverName] - \doifnotmode{compact}{\showaccents\showcharacters} - \else - \definefontsynonym[WhateverName][#2] - \definefont[WhateverFont][WhateverName] - \setupheadertexts[\tttf#2\quad#1\quad(special font)] - \WhateverFont - \setupinterlinespace - \showfont[WhateverName] - \fi - \page - \egroup} + {\doifsomething{#1} + {\bgroup + \ifthirdargument + \definefontsynonym[WhateverName][#2][encoding=#3] + \definefont[WhateverFont][WhateverName] + \setupheadertexts[\tttf#2\quad#1\quad#3] + \WhateverFont + \setupinterlinespace + \showfont[WhateverName] + \showligatures[WhateverName] + \doifnotmode{compact}{\showaccents\showcharacters} + \else + \definefontsynonym[WhateverName][#2] + \definefont[WhateverFont][WhateverName] + \setupheadertexts[\tttf#2\quad#1\quad(special font)] + \WhateverFont + \setupinterlinespace + \showfont[WhateverName] + \fi + \page + \egroup}} \endinput diff --git a/tex/context/base/s-map-01.tex b/tex/context/base/s-map-01.tex index e137445d4..2bfea496d 100644 --- a/tex/context/base/s-map-01.tex +++ b/tex/context/base/s-map-01.tex @@ -97,7 +97,7 @@ %D gezet. Vooralsnog beperken we de definitie van de layout tot %D de een||koloms opmaak. -\stellayoutin +\setuplayout [\c!breedte=28pc, \c!hoogte=\v!midden, \c!marge=9pc, @@ -121,7 +121,7 @@ %D gaan het paginanummer expliciet plaatsen, vandaar dat we %D hier de plaats niet specificeren. -\stelnummeringin +\setuppagenumbering [\c!plaats=, \c!variant=\v!dubbelzijdig] @@ -129,7 +129,7 @@ %D Het instellen op layout niveau is efficienter dan op elk %D regel niveau. -\stellayoutin +\setuplayout [\c!letter=\ss] %D In principe hebben we 4 verschillende soorten witruimte, diff --git a/tex/context/base/s-mod-01.tex b/tex/context/base/s-mod-01.tex index bac50cc8e..c71c8806f 100644 --- a/tex/context/base/s-mod-01.tex +++ b/tex/context/base/s-mod-01.tex @@ -52,7 +52,7 @@ \startnotmode[single] - \stelnummeringin + \setuppagenumbering [\c!variant={\v!dubbelzijdig,\v!enkelzijdig}] \stopnotmode diff --git a/tex/context/base/s-mod-02.tex b/tex/context/base/s-mod-02.tex index 0280a2fd8..d7a70f705 100644 --- a/tex/context/base/s-mod-02.tex +++ b/tex/context/base/s-mod-02.tex @@ -200,7 +200,7 @@ [file] [optie=kleur] -\stelnummeringin +\stelpaginanummeringin [variant=enkelzijdig, wijze=perparagraaf, status=geen] diff --git a/tex/context/base/s-pre-02.tex b/tex/context/base/s-pre-02.tex index 6e735c91d..cbdd97ae9 100644 --- a/tex/context/base/s-pre-02.tex +++ b/tex/context/base/s-pre-02.tex @@ -86,7 +86,7 @@ \setupinteraction [state=start, color=OrnamentColor, - contrastcolor=Ornamentcolor] + contrastcolor=OrnamentColor] \setupinteractionscreen [option=max, diff --git a/tex/context/base/s-pre-10.tex b/tex/context/base/s-pre-10.tex index eca9e74d8..1320e3bc6 100644 --- a/tex/context/base/s-pre-10.tex +++ b/tex/context/base/s-pre-10.tex @@ -40,7 +40,7 @@ %D The topic goes to the top right corner of the screen which %D means that it is positioned left down to the reference %D point. Watch how we make data on this layer (here only -%D the topic but it van be more) persistent. +%D the topic but it can be more) persistent. \setuplayer [topic] @@ -112,16 +112,18 @@ \def\DoSampleText#1#2#3% {\setupframedtexts[SampleText][background={background,#3}] + \bgroup + \setups[#1]% + \setups[always]% \setbox\nextbox=\hbox {\startSampleText[none] - \setups[#1] - \setups[always] \getbuffer[#1]\par \doif{#1}{text} {\dorecurse{\TextN}{\getbuffer[text-\recurselevel]\par}} \stopSampleText} \xdef\SampleTextWidth{\the\wd\nextbox} - \setlayer[#2]{\box\nextbox}} + \setlayer[#2]{\box\nextbox}% + \egroup} %D Since we are no longer swapping windows, we end up with a %D much simplier \type {\Stopidea} macro. We don't reset diff --git a/tex/context/base/setupb.tex b/tex/context/base/setupb.tex index f7812facb..83215f61d 100644 --- a/tex/context/base/setupb.tex +++ b/tex/context/base/setupb.tex @@ -375,9 +375,21 @@ [\v!ja,\v!nee] [\v!ja] \variable + [\c!mp\c!spot] + [\v!ja,\v!nee] + [\v!ja] + \variable [\c!tekstkleur] [\c!identifier!] [] + \variable + [\c!splitsen] + [\c!c,\c!m,\c!y,\c!k,\c!p,\c!s,\v!nee,\c!identifier!] + [\v!nee] + \variable + [\c!criterium] + [\v!alles,\v!geen] + [\v!geen] \stopsetup \startsetup @@ -1308,7 +1320,7 @@ [\v!ruim] \variable [\c!breedte] - [\v!passend,\v!ruim,\c!dimension!] + [\v!passend,\v!ruim,\v!vast,\c!dimension!] [\v!ruim] \variable [\c!offset] @@ -1316,7 +1328,7 @@ [1em] \variable [\c!plaats] - [\v!laag,\v!diepte] + [\v!laag,\v!diepte,\v!hangend] [] \variable [\c!optie] @@ -2100,7 +2112,7 @@ %\stopsetup \startsetup - \command[\y!kolom] + \command[\y!column] \type[] \stopsetup @@ -2403,6 +2415,12 @@ \stopsetup \startsetup + \command[\y!emptylines] + \type[\c!val!] + \value[\c!number!][] +\stopsetup + +\startsetup \command[\y!nospace] \type[] \stopsetup @@ -3232,7 +3250,7 @@ [] \variable [\c!markering] - [\v!aan,\v!uit,\v!kleur] + [\v!aan,\v!uit,\v!kleur,\v!raster] [\v!uit] \variable [\c!plaats] @@ -3262,23 +3280,43 @@ \variable [\c!regels] [\c!number!] - [] + [0] + \variable + [\c!kolommen] + [\c!number!] + [0] + \variable + [\c!kolomafstand] + [\c!dimension!] + [0pt] \variable [\c!grid] [\v!ja,\v!nee] [\v!nee] \variable [\c!bodemwit] - [\c!number!] + [\c!dimension!] [] \variable [\c!snijwit] - [\c!number!] + [\c!dimension!] [] \variable [\c!tekstafstand] + [\c!dimension!] + [] + \variable + [\c!tekstbreedte] [\c!number!] [] + \variable + [\c!tekstmarge] + [\c!dimension!] + [] + \variable + [\c!clipoffset] + [\c!dimension!] + [\!!zeropoint] \stopsetup \startsetup @@ -3407,7 +3445,7 @@ \startsetup \command - [\y!stelnummeringin] + [\y!setuppagenumbering] \type [\c!vars!] \variable @@ -3469,6 +3507,10 @@ [\v!start,\v!stop] [\v!start] \variable + [\c!breedte] + [\c!dimension!] + [] + \variable [\c!commando] [\c!oneargument!] [] @@ -3554,6 +3596,22 @@ [\c!text!] [.] \variable + [\c!uitlijnen] + [\v!links,\v!rechts,\v!normaal,\v!ruim] + [\v!normaal] + \variable + [\c!titeluitlijnen] + [\v!ja,\v!nee] + [\v!nee] + \variable + [\c!tolerantie] + [\v!zeerstreng,\v!streng,\v!soepel,\v!zeersoepel,\v!rek] + [\v!soepel] + \variable + [\c!springvolgendein] + [\v!ja,\v!nee] + [\v!nee] + \variable [\c!commando] [\c!twoarguments!] [] @@ -3684,6 +3742,18 @@ [\c!nregels] [\c!number!] [4] + \variable + [\c!default] + [\c!identifier!] + [] + \variable + [\c!linkermargeafstand] + [\c!dimension!] + [\!!zeropoint] + \variable + [\c!rechtermargeafstand] + [\c!dimension!] + [\!!zeropoint] \inheritvariables [\y!setupframed] [] @@ -3847,7 +3917,7 @@ \startsetup \command - [\y!pagina] + [\y!page] \type [\c!vals!] \value @@ -4022,6 +4092,19 @@ \startsetup \command + [\y!listsymbol] + \type + [\c!val!\c!arg!] + \value + [\c!identifier!] + [] + \value + [\c!text!] + [] +\stopsetup + +\startsetup + \command [\y!plaatslijst] \type [\c!vals!\c!opt!\c!vars!] @@ -4554,6 +4637,14 @@ [\c!scheider] [\c!text!] [] + \variable + [\c!breedte] + [\c!dimension!] + [] + \variable + [\c!afstand] + [\c!dimension!] + [] \inheritvariables [\y!setupframed] [] @@ -4647,6 +4738,45 @@ \startsetup \command + [\y!setuppaper] + \type + [\c!vars!] + \variable + [\c!papier] + [\c!identifier!] + [] + \variable + [\c!pagina] + [\c!identifier!] + [] + \variable + [\c!nx] + [\c!number!] + [1] + \variable + [\c!ny] + [\c!number!] + [1] + \variable + [\c!breedte] + [\c!dimension!] + [0pt] + \variable + [\c!hoogte] + [\c!dimension!] + [0pt] + \variable + [\c!kopwit] + [\c!dimension!] + [0pt] + \variable + [\c!rugwit] + [\c!dimension!] + [0pt] +\stopsetup + +\startsetup + \command [\y!setuppapersize] \type [\c!vals!\c!opt!\c!vals!] @@ -4667,7 +4797,7 @@ [\c!vals!] \value [\v!blokkeer, - 2*16,2*8,2*4,2*2,2**2,2UP,2DOWN, + 2*16,2*8,2*4,2*2,2**2,2*2*4,2*4*2,2UP,2DOWN,2SIDE,2TOP, \v!gespiegeld,\v!geroteerd,\v!dubbelzijdig,\v!negatief,90,180,270] [] \stopsetup @@ -4892,37 +5022,37 @@ [\c!oneargument!] [] \variable - [\c!scheider] - [\c!text!] - [.] - \variable [\c!prefix] [+,-,\c!text!] [] \variable [\c!plaatskop] - [\v!ja,\v!nee] + [\v!ja,\v!nee,\v!leeg] % leeg: wel markering [\v!ja] \variable [\c!verhoognummer] - [\v!ja,\v!nee,\c!filename!] + [\v!ja,\v!nee,\v!lijst,\c!filename!] % lijst: wel lijstentry [\v!ja] - \variable - [\c!uitlijnen] - [\v!links,\v!rechts,\v!normaal,\v!ruim] - [\v!normaal] - \variable - [\c!titeluitlijnen] - [\v!ja,\v!nee] - [\v!nee] - \variable - [\c!tolerantie] - [\v!zeerstreng,\v!streng,\v!soepel,\v!zeersoepel,\v!rek] - [\v!soepel] - \variable - [\c!springvolgendein] - [\v!ja,\v!nee] - [\v!nee] +% \variable +% [\c!scheider] +% [\c!text!] +% [.] +% \variable +% [\c!uitlijnen] +% [\v!links,\v!rechts,\v!normaal,\v!ruim] +% [\v!normaal] +% \variable +% [\c!titeluitlijnen] +% [\v!ja,\v!nee] +% [\v!nee] +% \variable +% [\c!tolerantie] +% [\v!zeerstreng,\v!streng,\v!soepel,\v!zeersoepel,\v!rek] +% [\v!soepel] +% \variable +% [\c!springvolgendein] +% [\v!ja,\v!nee] +% [\v!nee] \variable [\c!file] [\c!identifier!] @@ -4931,6 +5061,9 @@ [\c!expansie] [\v!ja,\v!commando,\v!nee] [\v!nee] + \inheritvariables + [\y!stelkoppenin] + [] \stopsetup \startsetup @@ -6840,11 +6973,15 @@ [\c!korps] [5pt,...,12pt,\v!klein,\v!groot] [] + \variable + [\c!lijn] + [\v!normaal,\v!regel] + [\v!regel] \stopsetup \startsetup \command - [\y!steltabellenin] + [\y!setuptables] \type [\c!vars!] \variable @@ -6911,7 +7048,7 @@ \startsetup \command - [\y!starttabel] + [\y!starttable] \type [\c!val!\c!stp!] \value @@ -6921,7 +7058,7 @@ \startsetup \command - [\y!starttabellen] + [\y!starttables] \type [\c!val!\c!stp!] \value @@ -7258,7 +7395,7 @@ \startsetup \command - [\y!stelcombinatiesin] + [\y!setupcombinations] \type [\c!vars!] \variable @@ -7286,6 +7423,10 @@ [\c!dimension!,\v!passend] [\v!passend] \variable + [\c!plaats] + [\c!boven,\c!midden,\c!onder,\c!links,\c!rechts] + [\c!onder] + \variable [\c!uitlijnen] [\v!nee,\v!links,\v!rechts,\v!midden,\v!normaal] [\v!midden] @@ -7293,7 +7434,7 @@ \startsetup \command - [\y!startcombinatie] + [\y!startcombination] \type [\c!val!\c!stp!] \value @@ -8170,6 +8311,10 @@ \type [\c!vars!] \variable + [\c!status] + [\v!start,\v!stop] + [\v!start] + \variable [\c!breedte] [\c!dimension!] [] diff --git a/tex/context/base/spec-def.tex b/tex/context/base/spec-def.tex index de0bb9c2f..98b1fbd56 100644 --- a/tex/context/base/spec-def.tex +++ b/tex/context/base/spec-def.tex @@ -154,6 +154,14 @@ \installspecial [\dostartgraycolormode] [or] [1] \installspecial [\dostopcolormode] [or] [0] +%D New and experimental: + +\installspecial [\dostartspotcolormode] [or] [2] + +\installspecial [\doregistercmykspotcolor] [or] [5] +\installspecial [\doregisterrgbspotcolor] [or] [4] +\installspecial [\doregistergrayspotcolor] [or] [2] + %D For some drivers, the stop special is of no use and can %D simply call the start one with zero arguments. @@ -377,8 +385,7 @@ \installspecial [\dosetupprinter] [and] [5] %D \macros -%D {% dosetuppage, -%D dosetupopenaction, dosetupclosaction, +%D {dosetupopenaction, dosetupclosaction, %D dosetupopenpageaction, dosetupclospageaction, %D dosetupinteraction, %D dosetupscreen, @@ -405,10 +412,11 @@ %D These two setup the actions to be executed when the document %D is opened and closed. %D -%D The next command sets up the screen. It takes five -%D arguments: +%D The next commands sets up the page and screen. They are +%D kind of related. %D %D \starttypen +%D \dosetuppage {hoffset} {voffset} {width} {height} {options} %D \dosetupscreen {hoffset} {voffset} {width} {height} {options} %D \stoptypen %D @@ -429,6 +437,13 @@ \installspecial [\dosetupscreen] [and] [5] \installspecial [\dosetuppageview] [and] [1] +% new, yet undocumented, replaces \dosetupscreen + +\installspecial [\dosetupcropbox] [and] [4] +\installspecial [\dosetuptrimbox] [and] [4] +\installspecial [\dosetupartbox] [and] [4] +\installspecial [\dosetupbleedbox] [and] [4] + %D \macros %D {dostarthide, %D dostophide} @@ -879,9 +894,12 @@ \defineoutput [dviwindo] [dvi,ps,yy,win] \defineoutput [dvips] [dvi,ps,tr] \defineoutput [dviview] [dvi,ps,tr,dv] -\defineoutput [dvipdfm] [dpm] \defineoutput [pdftex] [tpd] -\defineoutput [pdf] [tpd] +\defineoutput [pdf] [tpd] +\defineoutput [dvipdfm] [dpm] +\defineoutput [dpm] [dpm] +\defineoutput [dvipdfmx] [dpx] +\defineoutput [dpx] [dpx] \defineoutput [acrobat] [pdf,ps,tr] %D Please let me know if we need more. From now on we default diff --git a/tex/context/base/spec-dpm.tex b/tex/context/base/spec-dpm.tex index 44e6e87a5..92b0f682b 100644 --- a/tex/context/base/spec-dpm.tex +++ b/tex/context/base/spec-dpm.tex @@ -175,7 +175,12 @@ %D \macros %D {dosetupscreen} -\definespecial\dosetupscreen{\doPDFsetupscreen\printpapierhoogte} +\definespecial\dosetupscreen {\doPDFsetupscreen \printpapierhoogte} + +\definespecial\dosetupartbox {\doPDFsetupartbox \printpapierhoogte} +\definespecial\dosetupcropbox {\doPDFsetupcropbox \printpapierhoogte} +\definespecial\dosetupbleedbox{\doPDFsetupbleedbox\printpapierhoogte} +\definespecial\dosetuptrimbox {\doPDFsetuptrimbox \printpapierhoogte} %D \macros %D {dostartexecutecommand} @@ -185,15 +190,7 @@ %D \macros %D {dosetupidentity} -\definespecial\dosetupidentity#1#2#3#4#5#6% - {\bgroup - \enablePDFdocencoding - \special - {pdf: docinfo - <</Title (#1) /Subject (#2) /Author (#3) - /Creator (#4) /ModificationDate (#5) - /Keywords (#6) /Producer (dvipdfm)>>}% - \egroup} +\definespecial\dosetupidentity{\doPDFsetupidentity} %D \macros %D {dostartrunprogam} @@ -351,11 +348,15 @@ \egroup} %D \macros -%D {doPDFaddtocatalog,doPDFpageattribute,doPDFpagesattribute} +%D {doPDFaddtocatalog,doPDFaddtoinfo, +%D doPDFpageattribute,doPDFpagesattribute} \def\doPDFaddtocatalog#1% {\special{pdf: put @catalog <<#1>>}} +\def\doPDFaddtoinfo#1% Is this auto appended? Not checked! + {\special{pdf: docinfo <<#1>>}} % put @docinfo <<#1>>}} + \def\doPDFpageattribute#1% {\special{pdf: put @thispage <<#1>>}} diff --git a/tex/context/base/spec-dpx.tex b/tex/context/base/spec-dpx.tex new file mode 100644 index 000000000..affcd5411 --- /dev/null +++ b/tex/context/base/spec-dpx.tex @@ -0,0 +1,579 @@ +%\unprotect +%D \module +%D [ file=spec-dpx, +%D version=2002.11.28, +%D title=\CONTEXT\ Special Macros, +%D subtitle=DVIPDFMx support, +%D author=Jin-Hwan Cho, +%D date=\currentdate, +%D copyright={Jin-Hwan Cho \& Hans Hagen}] +%C +%C DVIPDFMx is an eXtended version of the DVIPDFM, a DVI to PDF +%C translator, still under construction by Jin-Hwan Cho and +%C Shunsaku Hirata. +%C +%C It supports multi-byte character encodings and large character +%C sets for East Asian languages by CID-keyed font technology, +%C and many features including PDF encryption, PDF bookmarks and +%C annotations with Chinese, Japanese, Korean characters, etc. +%C +%C DVIPDFMx (and information) can be downloaded from: +%C +%C http://project.ktug.or.kr/dvipdfmx/ + +\unprotect + +%D This driver is build on top of the general \PDF\ macros, +%D as defined in \type{spec-fdf}, so we inherit that one. + +\startspecials[dpx][reset,fdf] + +%D 1. Modified codes from \type{spec-dpm} + +%D \macros +%D {jobsuffix} +%D +%D Because no intermediate output format is used, we set the +%D jobsuffix to \PDF. + +\def\jobsuffix{pdf} + +%D DVIPDFMx supports the special command \type{pdf: literal ...} +%D since the version \type{dvipdfmx-20021028}. +%D +%D 1. \type{pdf: linteral #1} puts the given PDF commands \#1 +%D after changing the text matrix with \type{"1 0 0 1 x y cm"} +%D to set the current DVI position $(x,y)$ to the origin. +%D +%D 2. \type{pdf: linteral reverse #1} puts the given PDF commands \#1 +%D after changing the text matrix with \type{"1 0 0 1 -x -y cm"}. +%D +%D 3. \type{pdf: linteral direct #1} puts directly the given PDF +%D commands \#1 without changing the text matrix. +%D +%D Literal \PDF\ inclusion is implemented as: + +\def\PDFcode#1{\special{pdf: literal direct #1}} + +%D \type{\dosetuppaper} in \type{spec-dpm} did not work properly +%D because DVIPDFM did not permit changing the page size. +%D +%D However, DVIPDFMx permits different page size in each page +%D since the version \type{dvipdfmx-20021028}. +%D +%D \macros +%D {dosetuppaper} +%D +%D A simple one. + +\definespecial\dosetuppaper#1#2#3% + {\bgroup + \scratchdimen#2\edef\width {\the\scratchdimen\space}% + \scratchdimen#3\edef\height{\the\scratchdimen\space}% + \special{pdf: pagesize width \width height \height}% + \egroup} + +%D \macros +%D {doinsertfile} +%D +%D Only \METAPOST, \JPG\ \PNG\ and \PDF\ inclusion are supported. + +\definespecial\doinsertfile#1#2#3#4#5#6#7#8#9% + {\dodoinsertfile{dpx}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}} + +%D Even though DVIPDFM supports \METAPOST directly, the funtionality +%D is not good. It conflicts much with \CONTEXT. +%D +%D So, \METAPOST will be treated as the same way as PDFTeX using +%D MPtoPDF in DVIPDFMx since the version \type{dvipdfmx-20021028}. + +\definefileinsertion{dpx}{mps}#1#2#3#4#5#6#7#8#9% + {\hbox + {%\convertMPcolors{#1}% plugged in supp-mpe + \scratchdimen#3pt \PointsToReal{.01\scratchdimen}\xscale + \scratchdimen#4pt \PointsToReal{.01\scratchdimen}\yscale + \special{pdf: literal direct q}\special{pdf: literal}% + \convertMPtoPDF{#1}\xscale\yscale + \special{pdf: literal direct Q} + \global\let\PDFimagereference\empty}} + +%D DVIPDFM (and DVIPDFMx too) supports the image files with +%D the extension, \PDF, \JPG, \PNG, and \EPS. + +\def\handlepdfimage#1#2#3#4#5#6#7#8#9% + {\bgroup + \scratchdimen#7\edef\width {\the\scratchdimen\space}% + \scratchdimen#8\edef\height{\the\scratchdimen\space}% + \special{pdf: image width \width height \height (#1)}% + \egroup} + +\definefileinsertion{dpx}{pdf}{\handlepdfimage} +\definefileinsertion{dpx}{jpg}{\handlepdfimage} +\definefileinsertion{dpx}{png}{\handlepdfimage} +\definefileinsertion{dpx}{eps}{\handlepdfimage} % unstable + +\definefileinsertion{dpx}{mov}{\doPDFinsertmov} +\definefileinsertion{dpx}{avi}{\doPDFinsertmov} + +%D \macros +%D {doinsertsoundtrack} +%D +%D Sounds are supported too. + +\definespecial\doinsertsoundtrack{\doPDFinsertsoundtrack} + +%D \type{\doPDFovalbox} in \type{spec-fdf} was modifed because +%D the definition of \type{\PDFcode} was changed in this module. +%D +%D \macros +%D {doPDFovalbox} +%D +%D For drawing ovals we use quite raw \PDF\ code. The next +%D implementation does not differ that much from the one +%D implemented in the \POSTSCRIPT\ driver. + +\def\doPDFovalbox#1#2#3#4#5#6#7% todo: \scratchdimen/\scatchbox + {\bgroup + \dimen0=#4\divide\dimen0 2 + \doPDFovalcalc{0pt}{+\dimen0}\xmin + \doPDFovalcalc{#1}{-\dimen0}\xmax + \doPDFovalcalc{#2}{-\dimen0}\ymax + \doPDFovalcalc{-#3}{+\dimen0}\ymin + \advance\dimen0 by #5% + \doPDFovalcalc{0pt}{+\dimen0}\xxmin + \doPDFovalcalc{#1}{-\dimen0}\xxmax + \doPDFovalcalc{#2}{-\dimen0}\yymax + \doPDFovalcalc{-#3}{+\dimen0}\yymin + \doPDFovalcalc{#4}{\zeropoint}\stroke + \doPDFovalcalc{#5}{\zeropoint}\radius + \edef\dostroke{#6}% + \edef\dofill{#7}% + \setbox0\hbox + {\ifnum\dostroke\dofill>0 + \ifPDFstrokecolor\else\ifnum\dostroke=1 + \writestatus\m!colors{pdf stroke color will fail}\wait + \fi\fi + \special{pdf: content + \stroke\space w + \xxmin\space \ymin\space m + \xxmax\space \ymin\space l + \xmax \space \ymin\space \xmax\space \yymin\space y + \xmax \space \yymax\space l + \xmax \space \ymax\space \xxmax\space \ymax\space y + \xxmin\space \ymax\space l + \xmin \space \ymax\space \xmin\space \yymax\space y + \xmin \space \yymin\space l + \xmin \space \ymin\space \xxmin\space \ymin\space y + \ifnum\dostroke=1 S \fi + \ifnum\dofill=1 f \fi}% + \fi}% + \wd0=#1\ht0=#2\dp0=#3\box0 + \egroup} + +%D \macros +%D {doovalbox} + +\definespecial\doovalbox{\doPDFovalbox} + +%D \macros +%D {dostartgraymode,dostopgraymode, +%D dostartrgbcolormode,dostartcmykcolormode,dostartgraycolormode, +%D dostopcolormode, +%D dostartrotation,dostoprotation, +%D dostartscaling,dostopscaling, +%D dostartmirroring,dostopmirroring, +%D dostartnegative,dostopnegative} +%D +%D Unfortunately the direct \PDF\ inclusion is not suited +%D for the next macros, which means that we cannot use the +%D \type {\doPDF..} alternatives. Since \CONTEXT\ maintains +%D its own colorstack, we use the \DVIPS\ alternatives. + +\definespecial\dostartgraymode #1{\special{color gray #1}} +\definespecial\dostopgraymode {\special{color gray 0}} +\definespecial\dostartrgbcolormode #1#2#3{\special{color rgb #1 #2 #3}} +\definespecial\dostartcmykcolormode#1#2#3#4{\special{color cmyk #1 #2 #3 #4}} +\definespecial\dostartgraycolormode #1{\special{color gray #1}} +\definespecial\dostopcolormode {\special{color gray 0}} +\definespecial\dostartrotation #1{\special{pdf: bt rotate #1}} +\definespecial\dostoprotation {\special{pdf: et}} +\definespecial\dostartscaling #1#2{\special{pdf: bt xscale #1 yscale #2}} +\definespecial\dostopscaling {\special{pdf: et}} +\definespecial\dostartmirroring {\special{pdf: bt xscale -1}} % ? +\definespecial\dostopmirroring {\special{pdf: et}} + +%D Negation is not (yet) supported: + +% \definespecial\dostartnegative {} +% \definespecial\dostopnegative {} +% \definespecial\dostarttransparency {} +% \definespecial\dostoptransparency {} + + +%D \macros +%D {dosetupinteraction, +%D dosetupopenaction,dosetupcloseaction} + +\definespecial\dosetupinteraction% + {\showmessage{\m!interactions}{21}{DVIPDFMx}} + +\definespecial\dosetupopenaction {\doPDFsetupopenaction} +\definespecial\dosetupcloseaction{\doPDFsetupcloseaction} + +%D \macros +%D {doresetgotowhereever, +%D dostartthisisrealpage,dostartthisislocation, +%D dostartgotorealpage,dostartgotolocation,dostartgotoJS} + +\definespecial\doresetgotowhereever {\doPDFresetgotowhereever} +\definespecial\dostartthisislocation{\doPDFstartthisislocation} + +\definespecial\dostartgotolocation{\doPDFstartgotolocation} +\definespecial\dostartgotorealpage{\doPDFstartgotorealpage} +\definespecial\dostartgotoJS {\doPDFstartgotoJS} + +%D \macros +%D {doflushJSpreamble} + +\definespecial\doflushJSpreamble#1% + {\bgroup + \let\compositeJScode\empty + \def\docommando##1% + {\edef\sanitizedJScode{\getJSpreamble{##1}}% + \@EA\doPSsanitizeJScode\sanitizedJScode\to\sanitizedJScode + \special{pdf: object @JS:#1 <</S /JavaScript /JS (\sanitizedJScode)>>}% + \edef\compositeJScode{\compositeJScode\space (##1) @JS:#1}}% + \processcommalist[#1]\docommando + \special{pdf: object @JS:JS <</Names [\compositeJScode]>>}% + \special{pdf: put @names <</JavaScript @JS:JS>>}% + \egroup} + +%D \macros +%D {dostarthide,dostophide} + +\definespecial\dostarthide{} +\definespecial\dostophide {} + +%D \macros +%D {dosetupscreen} + +\definespecial\dosetupscreen {\doPDFsetupscreen \printpapierhoogte} + +\definespecial\dosetupartbox {\doPDFsetupartbox \printpapierhoogte} +\definespecial\dosetupcropbox {\doPDFsetupcropbox \printpapierhoogte} +\definespecial\dosetupbleedbox{\doPDFsetupbleedbox\printpapierhoogte} +\definespecial\dosetuptrimbox {\doPDFsetuptrimbox \printpapierhoogte} + +%D \macros +%D {dostartexecutecommand} + +\definespecial\dostartexecutecommand{\doPDFstartexecutecommand} + +%D \macros +%D {dosetupidentity} + +\definespecial\dosetupidentity{\doPDFsetupidentity} + +%D \macros +%D {dostartrunprogam} + +\definespecial\dostartrunprogram{\doPDFstartrunprogram} + +%D \macros +%D {dostartgotoprofile, dostopgotoprofile, +%D dobeginofprofile, doendofprofile} + +\definespecial\dostartgotoprofile{\doPDFstartgotoprofile} + +\definespecial\dobeginofprofile#1#2#3#4% + {\bgroup + \setPDFdestination{#1}% + \scratchdimen#2\edef\width {\the\scratchdimen\space}% + \scratchdimen#3\edef\height{\the\scratchdimen\space}% + \doifsomething{\PDFdestination} + {\special + {pdf: thread @ART::\PDFdestination\space + width \width height \height + <</Title (\PDFdestination)>>}}% + \egroup} + +\definespecial\doendofprofile + {} + +%D \macros +%D {doinsertbookmark} + +\definespecial\doinsertbookmark{\doPDFinsertbookmark} + +%D \macros +%D {dostartobject,dostopobject,doinsertobject} + +\definespecial\dostartobject#1#2#3#4#5% + {\bgroup + \setbox\nextbox=\hbox\bgroup + \dosetobjectreference{#1}{#2}{#1::#2}% + \scratchdimen#3\edef\width {\the\scratchdimen\space}% + \scratchdimen#4\edef\height{\the\scratchdimen\space}% + \special{pdf: bxobj @#1::#2 width \width height \height}} + +%D Modified to support the color shading feature since version +%D \type{dvipdfmx-20021128}. + +\definespecial\dostopobject% + {\ifx\currentPDFresources\empty + \special{pdf: exobj}% + \else + \special{pdf: exobj <<\currentPDFresources>>}% + \global\let\currentPDFresources\empty + \fi + \egroup + \smashbox\nextbox + \flushatshipout{\box\nextbox}% + \egroup} + +\definespecial\doinsertobject#1#2% + {\hbox + {\dogetobjectreference{#1}{#2}\PDFobjectreference + \ifx\PDFobjectreference\empty \else + \special{pdf: usexobj @\PDFobjectreference}% + \fi}} + +%D \macros +%D {dosetpagetransition} + +\definespecial\dosetpagetransition{\doPDFsetpagetransition} + +%D \macros +%D {doinsertcomment, doflushcomments} + +\definespecial\doinsertcomment{\doPDFinsertcomment} +\definespecial\doflushcomments{\doPDFflushcomments} + +%D \macros +%D {dopresetlinefield,dopresettextfield, +%D dopresetchoicefield,dopresetpopupfield,dopresetcombofield, +%D dopresetpushfield,dopresetcheckfield, +%D dopresetradiofield,dopresetradiorecord} + +\definespecial\dopresetlinefield {\doFDFpresetlinefield} +\definespecial\dopresettextfield {\doFDFpresettextfield} +\definespecial\dopresetchoicefield{\doFDFpresetchoicefield} +\definespecial\dopresetpopupfield {\doFDFpresetpopupfield} +\definespecial\dopresetcombofield {\doFDFpresetcombofield} +\definespecial\dopresetpushfield {\doFDFpresetpushfield} +\definespecial\dopresetcheckfield {\doFDFpresetcheckfield} +\definespecial\dopresetradiofield {\doFDFpresetradiofield} +\definespecial\dopresetradiorecord{\doFDFpresetradiorecord} + +%D \macros +%D {dodefinefieldset,dogetfieldset,doiffieldset} + +\definespecial\dodefinefieldset{\doFDFdefinefieldset} +\definespecial\dogetfieldset {\doFDFgetfieldset} +\definespecial\doiffieldset {\doFDFiffieldset} + +%D \macros +%D {doregistercalculationset} + +\definespecial\doregistercalculationset{\doFDFregistercalculationset} + +%D \type{\doPDFdestination} in \type{spec-dpm} had a bug. +%D +%D \macros +%D {doPDFdestination} + +\def\doPDFdestination name #1% + {\special{pdf: dest (#1) [@thispage\PDFpageviewwrd]}} + +%D \macros +%D {doPDFaction,doPDFannotation,ifsharePDFactions} +%D +%D Sharing is not yet supported. + +\newif\ifsharePDFactions \sharePDFactionsfalse + +\def\doPDFaction width #1 height #2 action #3% + {\ifcollectreferenceactions + \xdef\lastPDFaction{#3}% + \else + \bgroup + % this is yet untested + %\ifsharePDFactions + % \ifcase\similarreference\relax + % \xdef\lastPDFaction{<<#3>>}% + % \or + % \global\advance\nofPDFsimilar by 1 + % \special{pdf: object @PDF::sim:\the\nofPDFsimilar\space<<#3>>}% + % \xdef\lastPDFaction{@PDF::sim:\the\nofPDFsimilar}% + % \else + % % leave \lastPDFaction untouched + % \fi + %\else + \xdef\lastPDFaction{<<#3>>}% + %\fi + \scratchdimen#1\edef\width {\the\scratchdimen\space}% + \scratchdimen#2\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\space>>}% + \egroup + \fi} + +%D \type{\doPDFannotation} in \type{spec-dpm} had a bug. + +\def\doPDFannotation width #1 height #2 data #3% + {\bgroup + \scratchdimen#1\edef\width {\the\scratchdimen\space}% + \scratchdimen#2\edef\height{\the\scratchdimen\space}% + \special{pdf: ann width \width height \height <<#3>>}% + \egroup} + +%D \macros +%D {doPDFannotationobject} + +\def\doPDFannotationobject class #1 name #2 width #3 height #4 data #5% + {\bgroup + \scratchdimen#3\edef\width {\the\scratchdimen\space}% + \scratchdimen#4\edef\height{\the\scratchdimen\space}% + \special{pdf: ann @#1::#2 width \width height \height <<#5>>}% + \dosetobjectreference{#1}{#2}{#1::#2}% + \egroup} + +%D \macros +%D {doPDFaddtocatalog,doPDFaddtoinfo, +%D doPDFpageattribute,doPDFpagesattribute} + +\def\doPDFaddtocatalog#1% + {\special{pdf: put @catalog <<#1>>}} + +\def\doPDFaddtoinfo#1% Is this auto appended? Not checked! + {\special{pdf: docinfo <<#1>>}} % put @docinfo <<#1>>}} + +\def\doPDFpageattribute#1% + {\special{pdf: put @thispage <<#1>>}} + +\def\doPDFpagesattribute#1% + {\special{pdf: put @pages <<#1>>}} + +\def\doPDFpageresource#1% + {\message{[skipping PDF resource]}} + +\let\doPDFresetpageresources =\relax +\let\doPDFresetpageattributes=\relax + +%D \type{\doPDFbookmark} in \type{spec-dpm} had a bug. +%D The openbookmark option \#5 is not supported yet. +%D +%D \macros +%D {doPDFbookmark} + +\def\doPDFbookmark level #1 n #2 text #3 page #4 open #5% + {\ifcase#1\else + \special{pdf: outline #1 %\ifcase\the#5-\fi#1 + <</Title (#3) /A <</S /GoTo /D (page:#4)>>>>}% + \fi} + +%D \macros +%D {doPDFdictionaryobject,doPDFarrayobject} + +\def\doPDFdictionaryobject class #1 name #2 data #3% + {\special{pdf: object @#1::#2 <<#3>>}} + +\def\doPDFarrayobject class #1 name #2 data #3% + {\special{pdf: object @#1::#2 [#3]}} + +%D \macros +%D {defaultobjectreference,doPDFgetobjectreference} + +\def\defaultobjectreference#1#2{#1::#2} + +%D \type{\doPDFgetobjectrefernce} in \type{spec-dpm} had a bug. + +\def\doPDFgetobjectreference#1#2#3% + {\dogetobjectreference{@#1}{#2}#3% + \ifx#3\empty\else\edef#3{#3}\fi} + +%D Done. + +% %D 2. Modified codes from \type{spec-fdf} +% +% \definespecial\dostartgraphicgroup{\special{pdf: literal direct q}} +% \definespecial\dostopgraphicgroup {\special{pdf: literal direct Q}} + +%D 3. Modified codes from \type{spec-tpd} + +%D \macros +%D {dostartclipping,dostopclipping} +%D +%D Clipping in \PDFTEX\ is rather trivial. We can even hook +%D in \METAPOST\ without problems. + +\definespecial\dostartclipping#1#2#3% + {\PointsToBigPoints{#2}\width + \PointsToBigPoints{#3}\height + \grabMPclippath{#1}{1}\width\height + {0 0 m \width\space 0 l \width \height l 0 \height l}% + \special{pdf: literal direct q}% + \special{pdf: literal 0 w \MPclippath\space W n}% + \special{pdf: literal reverse}} + +\definespecial\dostopclipping + {\special{pdf: literal direct Q n}} + +%D 4. Modified codes from \type{supp-mpe} + +\def\stopMPshading + {\global\advance\currentPDFshade \plusone + \setxvalue{obj:Sh:\currentMPspecial}% + {/Sh\the\currentPDFshade\space @obj:Sh:\currentMPspecial\space}% + \setxvalue{mps:Sh:\currentMPspecial}% + {\the\currentPDFshade}} + +\defineMPspecial{30} + {\startMPshading{14}% type 2 + \setMPshadingcolors{4}{5}{6}{9}{10}{11}% + \special{pdf: object @ftn:Sh:\currentMPspecial\space + <</FunctionType 2 + /Domain [\gMPs1 \gMPs2] + /C0 [\MPshadeA] + /C1 [\MPshadeB] + /N \gMPs3>>}% + \special{pdf: object @obj:Sh:\currentMPspecial\space + <</ShadingType 2 + /ColorSpace /\MPshadeC\space + /Function @ftn:Sh:\currentMPspecial\space + /Coords [\gMPs7 \gMPs8 \gMPs{12} \gMPs{13}] + /Extend [true true]>>}% + \stopMPshading} + +\defineMPspecial{31} + {\startMPshading{16}% type 3 + \setMPshadingcolors{4}{5}{6}{10}{11}{12}% + \special{pdf: object @ftn:Sh:\currentMPspecial\space + <</FunctionType 2 + /Domain [\gMPs1 \gMPs2] + /C0 [\MPshadeA] + /C1 [\MPshadeB] + /N \gMPs3>>}% + \special{pdf: object @obj:Sh:\currentMPspecial\space + <</ShadingType 3 + /ColorSpace /\MPshadeC\space + /Function @ftn:Sh:\currentMPspecial\space + /Coords [\gMPs7 \gMPs8 \gMPs9 \gMPs{13} \gMPs{14} \gMPs{15}] + /Extend [true true]>>}% + \stopMPshading} + +%D 5. Modified codes from \type{supp-pdf} + +\let\dohandleMPfshow\handleMPfshow + +\def\handleMPfshow + {\special{pdf: literal direct q}% + \special{pdf: literal reverse}% + \dohandleMPfshow + \special{pdf: literal direct Q}} + +\stopspecials + +\protect \endinput diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex index a60a17888..253e0b3cd 100644 --- a/tex/context/base/spec-fdf.tex +++ b/tex/context/base/spec-fdf.tex @@ -128,10 +128,11 @@ % by integrating the split in the loop below % \splitofftokens\maxPDFstringsize\from\ascii\to\ascii % we diminish the processing time considerably - \scratchcounter=\maxPDFstringsize + \scratchcounter\maxPDFstringsize \def\docommando##1% - {\ifnum\scratchcounter>0 - \advance\scratchcounter by -1 + %{\ifnum\scratchcounter>0 + {\ifcase\scratchcounter\else + \advance\scratchcounter \minusone \ifcase\lccode`##1\relax \xdef#2{#2.}% let's show that something is missing \or @@ -193,6 +194,7 @@ %D doPDFdictionaryobject, %D doPDFarrayobject, %D doPDFaddtocatalog, +%D doPDFaddtoinfo, %D doPDFpageattribute, %D doPDFpageresource, %D doPDFpagesattribute, @@ -214,6 +216,7 @@ %D \doPDFdictionaryobject class #1 name #2 data #3 %D \doPDFarrayobject class #1 name #2 data #3 %D \doPDFaddtocatalog #1 +%D \doPDFaddtoinfo #1 %D \doPDFpageattribute #1 %D \doPDFpageresource #1 %D \doPDFpagesattribute #1 @@ -271,51 +274,129 @@ \def\appendtoPDFdocumentextgstates#1% {\xdef\docuPDFextgstates{\docuPDFextgstates\space#1}} +%D Another special mechanism (needed for color separation): + +\let\docuPDFcolorspaces\empty + +\def\checkPDFcolorspaces + {\ifx\docuPDFcolorspaces\empty \else + \ifnum\realpageno=\lastpage\relax + \doPDFdictionaryobject class FDF name colorspaces data + {\docuPDFcolorspaces}% + \fi + \doPDFgetobjectreference{FDF}{colorspaces}\PDFobjectreference + \doPDFpageresource{/ColorSpace \PDFobjectreference}% + \fi} + +\appendtoksonce + \checkPDFcolorspaces +\to \everyshipout + +\def\appendtoPDFdocumentcolorspaces#1% + {\xdef\docuPDFcolorspaces{\docuPDFcolorspaces\space#1}} + %D \macros -%D {doPDFsetupscreen} +%D {doPDFsetupscreen,doPDFsetupidentity} %D %D Opposite to \DVI\ drivers, \PDF\ ones must know which what %D page dimensions they are dealing. We also use the %D opportunity to launch full screen (1) or show bookmarks (2). +\let\currentPDFpagemode \empty % document catalog +\let\currentPDFviewerprefs\empty % document catalog + +\let\currentPDFcropbox \empty % page attributes +\let\currentPDFbleedbox \empty % page attributes +\let\currentPDFartbox \empty % page attributes +\let\currentPDFtrimbox \empty % page attributes + \def\doPDFsetupscreen#1#2#3#4#5#6% watch the extra argument {\bgroup - \!!widtha#4% - \advance\!!widtha #2% - \!!heighta-#5% - \!!heightb#1% extra argument - \advance\!!heightb -#3% - \advance\!!heighta \!!heightb - \PointsToWholeBigPoints{#2}\left - \PointsToWholeBigPoints\!!heighta\bottom - \PointsToWholeBigPoints\!!widtha \width - \PointsToWholeBigPoints\!!heightb\height +% \!!widtha#4% +% \advance\!!widtha#2% +% \!!heighta-#5% +% \!!heightb#1% extra argument +% \advance\!!heightb -#3% +% \advance\!!heighta \!!heightb +% % sometimes whole values give better results +% % \PointsToWholeBigPoints{#2}\left +% % \PointsToWholeBigPoints\!!heighta\bottom +% % \PointsToWholeBigPoints\!!widtha \width +% % \PointsToWholeBigPoints\!!heightb\height +% % but since pdf/x does not round when checking if +% % the boxes fit inside the media box ... % \PointsToBigPoints{#2}\left % \PointsToBigPoints\!!heighta\bottom % \PointsToBigPoints\!!widtha \width % \PointsToBigPoints\!!heightb\height - \xdef\currentPDFcropbox - {/CropBox [\left\space\bottom\space\width\space\height]}% +% \xdef\currentPDFcropboxspec +% {[\left\space\bottom\space\width\space\height]}% +% \global\let\currentPDFtrimboxspec\currentPDFcropboxspec \xdef\currentPDFpagemode {/PageMode \ifcase#6 /UseNone\or/FullScreen\or/UseOutlines\else/UseNone\fi}% - \xdef\currentPDFviewerprefs - {\ifcase#6\or\or\or /ViewerPreferences << /FitWindow true >>\fi}% + \xdef\currentPDFviewerprefs % space after #6 needed, else \relax + {\ifcase#6 \or\or\or /ViewerPreferences << /FitWindow true >>\fi}% \egroup} -\global\let\currentPDFcropbox \empty % page attributes -\global\let\currentPDFpagemode \empty % document catalog -\global\let\currentPDFviewerprefs\empty % document catalog - \appendtoksonce % hack to prevent duplicates - \ifcase\realfolio\or + \ifcase\realfolio \or % only at page one \doPDFaddtocatalog{\currentPDFpagemode\currentPDFviewerprefs}% + \doPDFaddtoinfo{/Trapped /False}% \fi \to \everyshipout +\def\doPDFsetupwhateverbox#1#2#3#4#5#6% watch the extra arguments + {\bgroup + \!!widtha#5% + \advance\!!widtha#3% + \!!heighta-#6% + \!!heightb#2% extra argument + \advance\!!heightb -#4% + \advance\!!heighta \!!heightb + % sometimes whole values give better results + % \PointsToWholeBigPoints{#3}\left + % \PointsToWholeBigPoints\!!heighta\bottom + % \PointsToWholeBigPoints\!!widtha \width + % \PointsToWholeBigPoints\!!heightb\height + % but since pdf/x does not round when checking if + % the boxes fit inside the media box ... + \PointsToBigPoints{#3}\left + \PointsToBigPoints\!!heighta\bottom + \PointsToBigPoints\!!widtha \width + \PointsToBigPoints\!!heightb\height + \xdef#1{[\left\space\bottom\space\width\space\height]}% + \egroup} + +\def\doPDFsetupartbox {\doPDFsetupwhateverbox\currentPDFartbox } +\def\doPDFsetupcropbox {\doPDFsetupwhateverbox\currentPDFcropbox } +\def\doPDFsetupbleedbox{\doPDFsetupwhateverbox\currentPDFbleedbox} +\def\doPDFsetuptrimbox {\doPDFsetupwhateverbox\currentPDFtrimbox } + +\gdef\currentPDFtrimbox{\currentPDFcropbox} % default, needed for pdf/x + +\def\flushPDFwhateverbox#1#2% + {\doifsomething{#1}{\doPDFpageattribute{/#2Box #1}}} + \appendtoksonce - \doPDFpageattribute{\currentPDFcropbox}% + \flushPDFwhateverbox\currentPDFartbox {Art}% + \flushPDFwhateverbox\currentPDFcropbox {Crop}% + \flushPDFwhateverbox\currentPDFbleedbox{Bleed}% + \flushPDFwhateverbox\currentPDFtrimbox {Trim}% \to \everyshipout +\def\doPDFsetupidentity#1#2#3#4#5#6% + {\bgroup + \enablePDFdocencoding + \expanded{\doPDFaddtoinfo + {/Title (#1) + /Subject (#2) + /Author (#3) + /Creator (#4) + /ModDate (#5) + /ID (\jobname.#5) % needed for pdf/x + /Keywords (#6)}}% + \egroup} + %D \macros %D {doPDFsetupopenaction,doPDFsetupcloseaction, %D doPDFsetupopenpageaction,doPDFsetupclosepageaction} @@ -333,10 +414,10 @@ %D update of Acrobat Viewers, upward compatibility was %D just a dream. -\def\doPDFsetupopenaction% +\def\doPDFsetupopenaction {\doPDFaddtocatalog{/OpenAction <<\lastPDFaction>>}} -\def\doPDFsetupcloseaction% +\def\doPDFsetupcloseaction {\doPDFaddtocatalog{/CloseAction <<\lastPDFaction>>}} %D So, starting with version~5 viewers, when the open actions @@ -359,7 +440,7 @@ \def\doPDFsetupopenpageaction% {\global\let\PDFopenpageaction\lastPDFaction} -\def\doPDFsetupclosepageaction% +\def\doPDFsetupclosepageaction {\global\let\PDFclosepageaction\lastPDFaction} \def\checkPDFpageactions @@ -413,7 +494,7 @@ {\bgroup \doifelsenothing{#3} {\setPDFdestination{#5}% - \doifelsenothing{\PDFdestination} + \doifelsenothing\PDFdestination {\let\action\empty} {\doifelsenothing{#4} {\let\PDFfile\empty} @@ -429,7 +510,7 @@ \let\PDFdestination\empty} {\setreferencefilename/#4\to\PDFfile \setPDFdestination{#5}% - \doifsomething{\PDFdestination} + \doifsomething\PDFdestination {\edef\PDFdestination{\URLhash\PDFdestination}}}% \edef\action% {/S /URI /URI (#3\PDFfile\PDFdestination)}}% @@ -450,9 +531,9 @@ \def\doPDFstartgotorealpage#1#2#3#4#5% watch the R append trick {\bgroup \doifelsenothing{#3} - {\scratchcounter=0#5\relax + {\scratchcounter0#5\relax \ifnum\scratchcounter>0 - \advance\scratchcounter -1 % pdf starts numbering at zero + \advance\scratchcounter \minusone % pdf starts numbering at zero \doifelsenothing{#4} {\let\PDFfile\empty} {\doifparentfileelse{#4} @@ -491,7 +572,7 @@ \def\fakePDFpagedestination % as in pdf, we start numbering at zero {\iflocation \ifovercomePDFpage \ifarrangingpages \else \bgroup - \advance\realpageno -1 % is \expanded needed ? + \advance\realpageno \minusone % is \expanded needed ? \expanded{\doPDFdestination name {page:\realfolio}}% \egroup \fi \fi \fi} @@ -540,16 +621,24 @@ \def\PDFformcode#1% {\doFDFiffieldset{#1}{/Field [\doFDFgetfieldset{#1}]}} +% bit 3 = html +% bit 6 = xml +% bit 4 = get + +\chardef\PDFformmethod=1 % 0=GET 1=POST + +\def\PDFformflag#1#2{\ifcase\PDFformmethod#1\else#2\fi} + \def\PDFexecuteimportform {/Named /N /AcroForm:ImportFDF} \def\PDFexecuteexportform {/Named /N /AcroForm:ExportFDF} \def\PDFexecuteresetform {/ResetForm \PDFformcode\argumentA} \def\PDFexecutesubmitform {/SubmitForm \PDFformcode\argumentB /Flags \ifcase\submitoutputformat\space - 4 % 0=unknown - \or 4 % 1=HTML - \or 0 % 2=FDF % was 12 ? ? ? - \or 32 % 3=XML - \else 4 % ?=unknown + \PDFformflag{12} {4} % 0=unknown + \or \PDFformflag{12} {4} % 1=HTML + \or \PDFformflag {8} {0} % 2=FDF + \or \PDFformflag{40}{32} % 3=XML + \else \PDFformflag{12} {4} % ?=unknown \fi /F (\argumentA)} @@ -631,7 +720,7 @@ \def\doPDFstartgotoprofile#1#2#3% to be done: file {\bgroup \setPDFdestination{#3}% - \doifsomething{\PDFdestination} + \doifsomething\PDFdestination {\edef\action% {/S /Thread /D (\PDFdestination)}% \ifsecondaryreference @@ -755,9 +844,10 @@ \def\doPDFinsertbookmark#1#2#3#4#5% level sublevels text page open=1 {\bgroup + % todo, unicode \sanitizePDFdocencoding#3\to\bookmarktext % uses scratchcounter - \scratchcounter=#4% - \advance\scratchcounter -1 + \scratchcounter#4% + \advance\scratchcounter \minusone %\sanitizePDFstring#3\to\bookmarktext \doPDFbookmark level #1 n #2 text {\bookmarktext} page {\the\scratchcounter} open #5 @@ -798,6 +888,7 @@ \def\FDFflagNoExport {4} % 3 \def\FDFflagPassword {8192} % 14 \def\FDFflagSort {524288} % 20 +\def\FDFflagFileSelect {1048576} % 21 %D There is a second, again bitset oriented, \type{/F} flag: @@ -821,6 +912,7 @@ \letvalue {\@@FDFflag\v!nietbeschikbaar}=\FDFflagNoExport \letvalue {\@@FDFflag\v!geencontrole}=\FDFflagDoNotSpellCheck \letvalue {\@@FDFflag\v!vast}=\FDFflagDoNotScroll +\letvalue {\@@FDFflag\v!file}=\FDFflagFileSelect \letvalue {\@@FDFplus\v!verborgen}=\FDFplusHidden \letvalue {\@@FDFplus\v!printbaar}=\FDFplusPrintable @@ -853,17 +945,37 @@ %D Menu items are passed as an array of \type{(string)}'s and %D the content of this array is build with: -\let\FDFvalues\empty - -\def\setFDFvalues[#1]% - {\let\FDFvalues\empty +\let\FDFvalues \empty +\let\FDFfirstvalues \empty +\let\FDFsecondvalues\empty +\let\FDFkidlist \empty +\let\FDFdefaultindex\!!zerocount +\let\FDFdefaultvalue\empty + +\def\setFDFvalues[#1][#2]% #1 = list (item=>value) #2 = default + {\let\FDFvalues \empty + %when radio opt works ok + %\let\FDFfirstvalues \empty + %\let\FDFsecondvalues\empty + %\let\FDFkidlist \empty + %\let\FDFdefaultindex\!!zerocount + %\let\FDFdefaultvalue\empty + %\scratchcounter\zerocount \def\dodocommando##1=>##2=>##3\end - {\doifelsenothing{##2} - {\edef\FDFvalues{\FDFvalues [(##1)(##1)] }} - {\edef\FDFvalues{\FDFvalues [(##2)(##1)] }}}% ! ##1 is shown + {%\addtocommalist{##1}\FDFkidlist + %\edef\FDFfirstvalues{\FDFfirstvalues(##1)}% + %\doif{##1}{#2}{\edef\FDFdefaultindex{\the\scratchcounter}}% + %\advance\scratchcounter\plusone + \doifelsenothing{##2} + {%\doif{##1}{#2}{\edef\FDFdefaultvalue{##1}}% + %\edef\FDFsecondvalues{\FDFsecondvalues(##1)}% + \edef\FDFvalues{\FDFvalues [(##1)(##1)] }} + {%\doif{##1}{#2}{\edef\FDFdefaultvalue{##2}}% + %\edef\FDFsecondvalues{\FDFsecondvalues(##2)}% + \edef\FDFvalues{\FDFvalues [(##2)(##1)] }}}% ! ##1 is shown \def\docommando##1% {\dodocommando##1=>=>\end}% - \@EA\processcommalist\@EA[#1]\docommando} + \expanded{\processcommalist[#1]}\docommando} %D This macro accepts comma separated \type{visual=>result} %D pairs. @@ -1053,7 +1165,7 @@ %D well as what resources they use. The next mechanism does that %D job automatically when one registers the field. -\def\flushFDFnames% +\def\flushFDFnames {\ifbuildFDFdictionary \ifx\FDFcollection\empty\else \ifbuildFDFencodingvector @@ -1136,7 +1248,8 @@ \def\FDFnameCoOb {Courier-Oblique} \def\FDFnameCoBO {Courier-BoldOblique} -%D And a big one: +%D And a big one: (should be run time loaded (spec-run or +%D so)). \def\FDFencodingvector {/Type /Encoding @@ -1186,7 +1299,7 @@ %D And here comes the special that deals with them. \definespecial\dosetfieldstatus#1#2#3#4% - {\chardef\currentFDFmode=#1% + {\chardef\currentFDFmode #1% \edef\currentFDFparent {#2}% \edef\currentFDFkids {#3}% \edef\currentFDFroot {#4}} @@ -1226,7 +1339,7 @@ %D {setFDFkids} %D %D Clones as well as radiofields (which themselves can have -%D cloned components) need a list fo kids. The next macro +%D cloned components) need a list of kids. The next macro %D builds one. \def\setFDFkids[#1][#2]% tag commalist @@ -1252,13 +1365,13 @@ \setFDFattributes[#6]% \setFDFalignment[#8]% \setFDFactions[#9]% -\expanded{\escapePSstring#4}\to\FDFtext + \expanded{\escapePSstring#4}\to\FDFtext \ifcase\currentFDFmode \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 (#4) % value added -/DV (\FDFtext) /V (\FDFtext) % value added + %/DV (#4) /V (#4) % value added + /DV (\FDFtext) /V (\FDFtext) % value added /Ff \FDFflag\space /F \FDFplus\space /DA (\FDFattributes) @@ -1272,8 +1385,8 @@ {/T (#1) /FT /Tx /MaxLen \ifcase0#5 1000 \else#5 \fi /Kids [\FDFkids] -% /DV (#4) /V (#4) % value added -/DV (\FDFtext) /V (\FDFtext) % value added + %/DV (#4) /V (#4) % value added + /DV (\FDFtext) /V (\FDFtext) % value added /Ff \FDFflag\space /F \FDFplus\space /DA (\FDFattributes) @@ -1282,7 +1395,7 @@ \FDFactions}% \registerFDFobject{#1}% \or - \doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference + \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference \global\objectreferencingtrue \doPDFannotationobject class FDF name kids:#1 width #2 height #3 data {/Subtype /Widget @@ -1294,12 +1407,13 @@ /Q \FDFalign\space \FDFactions}% \or - \doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference + \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference \global\objectreferencingtrue \doPDFannotationobject class FDF name kids:#1 width #2 height #3 data {/Subtype /Widget /Parent \PDFobjectreference - /F \FDFplus}% + /F \FDFplus + \FDFactions}% \fi \egroup} @@ -1310,7 +1424,7 @@ {\bgroup \setFDFswitches[#6]% \setFDFattributes[#5]% - \setFDFvalues[#7]% + \setFDFvalues[#7][#4]% \setFDFactions[#8]% \ifcase\currentFDFmode \doPDFannotationobject class FDF name #1 width #2 height #3 data @@ -1338,7 +1452,7 @@ \FDFactions}% \registerFDFobject{#1}% \or - \doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference + \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference \global\objectreferencingtrue \doPDFannotationobject class FDF name kids:#1 width #2 height #3 data {/Subtype /Widget @@ -1349,12 +1463,13 @@ \FDFsurroundings\space \FDFactions}% \or - \doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference + \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference \global\objectreferencingtrue \doPDFannotationobject class FDF name kids:#1 width #2 height #3 data {/Subtype /Widget /Parent \PDFobjectreference - /F \FDFplus}% + /F \FDFplus + \FDFactions}% \fi \egroup} @@ -1404,7 +1519,7 @@ \registerFDFobject{#1}% \or \doFDFappearance{On}{#6}{#8}% - \doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference + \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference \global\objectreferencingtrue \doPDFannotationobject class FDF name kids:#1 width #2 height #3 data {/Subtype /Widget @@ -1420,7 +1535,7 @@ \FDFactions}% \or \doFDFappearance{On}{#6}{#8}% - \doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference + \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference \global\objectreferencingtrue \doPDFannotationobject class FDF name kids:#1 width #2 height #3 data {/Subtype /Widget @@ -1431,7 +1546,8 @@ /V /\FDFdefault\space /AS /\FDFdefault\space \fi - \FDFappearance}% + \FDFappearance + \FDFactions}% \fi \egroup} @@ -1449,6 +1565,8 @@ \doifelsenothing{#4} {\def\FDFdefault{Off}} {\def\FDFdefault{#4}}% +\@EA\aftersplitstring\FDFdefault\at=>\to\FDFdefaultvalue +\ifx\FDFdefaultvalue\empty\else\let\FDFdefault\FDFdefaultvalue\fi \ifcase\currentFDFmode \doFDFappearance{#1}{#7}{1}% \doPDFgetobjectreference{FDF}{#6}\PDFobjectreference @@ -1472,7 +1590,7 @@ \or %\doFDFappearance{#1}{#7}{1}% \doFDFappearance{\currentFDFparent}{#7}{1}% - \doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference + \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference \global\objectreferencingtrue % nb \doPDFannotationobject class FDF name kids:#1 width #2 height #3 data {/Subtype /Widget @@ -1484,27 +1602,55 @@ \or %\doFDFappearance{#1}{#7}{1}% \doFDFappearance{\currentFDFparent}{#7}{1}% - \doPDFgetobjectreference{FDF}{\currentFDFparent}\PDFobjectreference + \doPDFgetobjectreference{FDF}\currentFDFparent\PDFobjectreference \global\objectreferencingtrue \doPDFannotationobject class FDF name kids:#1 width #2 height #3 data {/Subtype /Widget /Parent \PDFobjectreference\space /AS /\FDFdefault\space /F \FDFplus\space - \FDFappearance\space} + \FDFappearance\space + \FDFactions}% \fi \egroup} +%D \macros +%D {setFDFstrings} +%D +%D This one creates a string array. + +%\def\setFDFstrings[#1]% +% {\let\FDFstrings\empty +% \def\docommando##1{\edef\FDFstrings{\FDFstrings(##1)}}% +% \processcommacommand[#1]\docommando} + \def\doFDFpresetradiorecord#1#2#3#4#5% {\bgroup \setFDFswitches[Radio,NoToggleToOff,#3]% - \setFDFkids[][#4]% + \setFDFkids[#4][]% +%\setFDFvalues[#4][#2]% +%\expanded{\setFDFkids[][\FDFkidlist]}% \setFDFactions[#5]% \doPDFdictionaryobject class FDF name #1 data {/Subtype /Widget /FT /Btn /T (#1) /Rect [0 0 0 0] - /DV (#2) % /V (#2) + % used to be this + % /V (#2) + % then this + % /DV (#2) + % since this bomded in 5 + % /V (#2) + % and now finally this works /H /N - /Ff \FDFflag\space /F \FDFplus\space /Kids [\FDFkids] +% /opt is buggy in 5.05, only works once, sigh +%\ifx\FDFfirstvalues\FDFsecondvalues + /V /#2 +%\else +% /V /\FDFdefaultindex\space +% /Opt [\FDFsecondvalues] +%\fi + /Ff \FDFflag\space + /F \FDFplus\space + /Kids [\FDFkids] \FDFactions}% \egroup} @@ -1722,14 +1868,14 @@ %D sure or the order in which the name and value are given %D (actually the reverse). -\def\PERLloadFDFfields#1% +\def\PERLloadFDFfields#1% will become obsolete soon {\bgroup \global\let\allFDFfields\empty \ifrunFDFconverter \executesystemcommand{fdf2tex #1}% - \let\beginFDFobject=\relax \let\endFDFobject=\relax - \let\beginFDFdata =\relax \let\endFDFdata =\relax - \let\beginFDFfields=\relax \let\endFDFfields=\relax + \let\beginFDFobject\relax \let\endFDFobject\relax + \let\beginFDFdata \relax \let\endFDFdata \relax + \let\beginFDFfields\relax \let\endFDFfields\relax \def\FDFfield[##1]% {\getparameters[FDF][##1]% \doglobal\addtocommalist\FDFname\allFDFfields @@ -1782,11 +1928,8 @@ %D Whatever mechanism is used, the next macros can be used to %D fetch the values. -\def\getFDFfield#1% - {\getvalue{FDFfield::#1}} - -\def\setFDFfield#1#2% - {\setevalue{FDFfield::#1}{#2}} +\def\getFDFfield #1{\getvalue {FDFfield::#1}} +\def\setFDFfield#1#2{\setevalue{FDFfield::#1}{#2}} %D Of course the fields are only present when the file is %D loaded. @@ -1805,7 +1948,7 @@ \egroup} %D \macros -%D {sanitizePDFdocencoding} +%D {sanitizePDFencoding,sanitizePDFdocencoding} %D %D We already dealt with the encoding vector. Conversion from %D \TEX\ \ASCII\ encoding to the other one, is accomplished by @@ -1813,6 +1956,9 @@ %D This will be reimplemented using the mapping mechanism. +\def\enablePDFdocencoding + {\reducetocoding[pdfdoc]\simplifycommands} + \long\def\sanitizePDFdocencoding#1\to#2% {\enablePDFcrlf \enablePDFdocencoding @@ -1828,8 +1974,7 @@ \let^^M=\\} \egroup -\def\enablePDFdocencoding% - {\reducetocoding[pdfdoc]\simplifycommands} +\let\sanitizePDFencoding\sanitizePDFdocencoding %D A bit out of place, but useful: @@ -1864,13 +2009,13 @@ \doifundefinedelse{PDFcomment#6} {\let\PDFcomment\empty} {\def\PDFcomment{/Name \getvalue{PDFcomment#6} }}% - \sanitizePDFdocencoding#8\to\PDFdata + \sanitizePDFencoding#8\to\PDFdata \setbox\scratchbox=\vbox to #3 {\vfill \doPDFannotation width #2 height #3 data {/Subtype /Text \ifcase#5 \else/Open true\fi - /Contents (\PDFdata) + /Contents \ifPDFunicode <\PDFdata> \else(\PDFdata) \fi \PDFcomment \PDFidentifier \PDFattributes}}% @@ -1909,7 +2054,7 @@ {\let\PDFcomment\empty} {\presetPDFcommentappearance{#6}}} {\def\PDFcomment{/Name \getvalue{PDFcomment#6} }}% - \sanitizePDFdocencoding#8\to\PDFdata + \sanitizePDFencoding#8\to\PDFdata \setbox\scratchbox=\vbox to #3 {\vfill \ifPDFpopupcomments @@ -1938,7 +2083,7 @@ {/Subtype /Text \ifcase#5 \else/Open true\fi \ifdone /Popup \the\pdflastannot\space 0 R\fi - /Contents (\PDFdata) + /Contents \ifPDFunicode <\PDFdata> \else(\PDFdata) \fi \PDFcomment \PDFidentifier \PDFattributes}% @@ -1948,7 +2093,7 @@ \doPDFannotation width #2 height #3 data {/Subtype /Text \ifcase#5 \else/Open true\fi - /Contents (\PDFdata) + /Contents \ifPDFunicode <\PDFdata> \else(\PDFdata) \fi \PDFcomment \PDFidentifier \PDFattributes}% @@ -1976,7 +2121,7 @@ \def\dopresetPDFcommentappearance#1#2% {\dopresetfieldsymbol{#1}% \dopresetfieldsymbol{#2}% - \setbox\scratchbox=\hbox{\symbol[#1]}% + \setbox\scratchbox\hbox{\symbol[#1]}% \edef\width {\the\wd\scratchbox}% \edef\height{\the\ht\scratchbox}% \doPDFgetobjectreference{SYM}{#1}\FDFcommentNappearance @@ -2022,7 +2167,7 @@ \def\doPDFovalbox#1#2#3#4#5#6#7% todo: \scratchdimen/\scatchbox {\bgroup - \dimen0=#4\divide\dimen0 by 2 + \dimen0=#4\divide\dimen0 2 \doPDFovalcalc{0pt}{+\dimen0}\xmin \doPDFovalcalc{#1}{-\dimen0}\xmax \doPDFovalcalc{#2}{-\dimen0}\ymax @@ -2036,10 +2181,10 @@ \doPDFovalcalc{#5}{\zeropoint}\radius \edef\dostroke{#6}% \edef\dofill{#7}% - \setbox0=\hbox + \setbox0\hbox {\ifnum\dostroke\dofill>0 \ifPDFstrokecolor\else\ifnum\dostroke=1 - \writestatus{\m!colors}{pdf stroke color will fail}\wait + \writestatus\m!colors{pdf stroke color will fail}\wait \fi\fi \PDFcode {q @@ -2077,7 +2222,7 @@ \def\doPDFstartgraymode#1% {\PDFcode{#1 g\ifPDFstrokecolor\space#1 G\fi}} -\def\doPDFstopgraymode% +\def\doPDFstopgraymode {\PDFcode{0 g\ifPDFstrokecolor\space0 G\fi}} \def\doPDFstartrgbcolormode#1#2#3% @@ -2089,9 +2234,37 @@ \def\doPDFstartgraycolormode#1% {\PDFcode{#1 g\ifPDFstrokecolor\space#1 G\fi}} -\def\doPDFstopcolormode% +\def\doPDFstartspotcolormode#1#2% + {\PDFcode{/#1 CS #2 SC /#1 cs #2 sc}} + +\def\doPDFstopcolormode {\PDFcode{0 g\ifPDFstrokecolor\space0 G\fi}} +%D We need to register the spot colors and their fallbacks. + +% we cannot use /DeviceN since GS <=7.21 breaks on it +% and Jaws does not handle it at all {[/DeviceN [/All|/None] +% /Device#2 \the\pdflastobj\space0 R]} so we use separation +% colors that work and print ok + +\def\doPDFregistersomespotcolor#1#2#3#4% + {\writestatus\m!systems{missing spot color definition}\wait} + +\def\doPDFregisterrgbspotcolor#1#2#3#4% + {\doPDFregistersomespotcolor + {#1}{RGB}{[0.0 1.0 0.0 1.0 0.0 1.0]}% + {{dup #2 mul exch dup #3 mul exch #4 mul}}} + +\def\doPDFregistercmykspotcolor#1#2#3#4#5% + {\doPDFregistersomespotcolor + {#1}{CMYK}{[0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0]}% + {{dup #2 mul exch dup #3 mul exch dup #4 mul exch #5 mul}}} + +\def\doPDFregistergrayspotcolor#1#2% + {\doPDFregistersomespotcolor + {#1}{Gray}{[0.0 1.0]}% + {{pop}}} + %D \macros %D {doPDFstartrotation,doPDFstoprotation} %D @@ -2139,13 +2312,13 @@ %D When producing output for an image setter, sometimes negative %D output is needed. -\def\doPDFstartnegative% +\def\doPDFstartnegative {\ifx\initializePDFnegative\undefined\else \initializePDFnegative \PDFcode{/GSnegative gs}% \fi} -\def\doPDFstopnegative% +\def\doPDFstopnegative {\ifx\initializePDFnegative\undefined\else \PDFcode{/GSpositive gs}% \fi} @@ -2165,10 +2338,10 @@ \def\dodoPDFstarttransparency#1#2% {\presetPDFtransparency{#1}{#2}% - \PDFcode{\PDFtransparencyidentifier\space gs}} + \PDFcode{\PDFtransparencyidentifier\space gs }} \def\dodoPDFstoptransparency - {\PDFcode{/Tr0 gs}} + {\PDFcode{/Tr0 gs }} \def\doPDFstarttransparency {\ifPDFtransparencysupported @@ -2195,8 +2368,8 @@ %D New trickery: -\definespecial\dostartgraphicgroup{\pdfliteral{q}} -\definespecial\dostopgraphicgroup {\pdfliteral{Q}} +\definespecial\dostartgraphicgroup{\PDFcode{q}} +\definespecial\dostopgraphicgroup {\PDFcode{Q}} %D And that was all. diff --git a/tex/context/base/spec-ini.tex b/tex/context/base/spec-ini.tex index 3b07bec4b..feaaf5b8b 100644 --- a/tex/context/base/spec-ini.tex +++ b/tex/context/base/spec-ini.tex @@ -285,9 +285,9 @@ %D The following command can be used to show the loaded list %D of specials. -\def\preloadspecials% - {\doifsomething{\preloadedspecials} - {\showmessage{\m!specials}{1}{\preloadedspecials}}} +\def\preloadspecials + {\doifsomething\preloadedspecials + {\showmessage\m!specials1\preloadedspecials}} %D \macros %D {startspecials} @@ -309,11 +309,11 @@ \unprotect \addtocommalist\currentspecial\preloadedspecials} -\def\startspecials% +\def\startspecials {\localpushmacro\currentspecial \dodoubleempty\dostartspecials} -\def\stopspecials% +\def\stopspecials {\localpopmacro\currentspecial \protect} @@ -339,22 +339,22 @@ \let\@@allspecials=\empty \def\doinstallspecial[#1][#2][#3]% - {\setvalue{\@@speclst@@\string#1}{}% + {\letvalue{\@@speclst@@\string#1}\empty \setvalue{\@@speccat@@\string#1}{#2}% \setvalue{\@@specarg@@\string#1}{#3}% \addtocommalist{\string#1}\@@allspecials \def#1{\executespecial#1}} -\def\installspecial% +\def\installspecial {\dotripleargument\doinstallspecial} -\def\resetspecials% +\def\resetspecials {\the\everyresetspecials \def\docommando##1% {\letvalue{\@@speclst@@##1}\empty}% \processcommacommand[\@@allspecials]\docommando \ifx\preloadedspecials\empty \else - \showmessage{\m!specials}{3}{\preloadedspecials}% + \showmessage\m!specials3\preloadedspecials \let\preloadedspecials\empty \fi} @@ -373,15 +373,15 @@ \def\definespecial#1% {\ifx#1\undefined - \showmessage{\m!specials}{4}{\string#1}% - \def\next% + \showmessage\m!specials4{\string#1}% + \def\next {\def\@@illegalspecial@@}% \else - \def\next% - {\doifelse{\getvalue{\@@speccat@@\string#1}}{or} + \def\next + {\doifelsevalue{\@@speccat@@\string#1}{or} {\edef\@@newspeclst@@{\currentspecial}} {\edef\@@newspeclst@@{\getvalue{\@@speclst@@\string#1}}% - \addtocommalist{\currentspecial}\@@newspeclst@@}% + \addtocommalist\currentspecial\@@newspeclst@@}% \setevalue{\@@speclst@@\string#1}{\@@newspeclst@@}% \setvalue{\currentspecial\string#1}}% \fi @@ -394,7 +394,7 @@ %D This command is only permitted outside the definition part. \def\dousespecials#1% - {\doifelse{#1}{\v!reset} + {\doifelse{#1}\v!reset {\resetspecials} {\doifdefinedelse{\@@specfil@@#1} {\edef\currentspecialfile{\getvalue{\@@specfil@@#1}}} @@ -408,7 +408,7 @@ \def\usespecials[#1]% {\ifnum\realpageno<2 - \doifelsenothing{\currentspecial} + \doifelsenothing\currentspecial {\processcommalist[#1]\dousespecials} {\showmessage\m!specials6\empty}% \fi} @@ -572,7 +572,7 @@ \def\doinstallspecial[#1][#2][#3]% {\appendtoks\forgetspecial#1{#3}\to\everyresetspecials - \@EA\chardef\csname\@@speclst@@\string#1\endcsname0 + \@EA\chardef\csname\@@speclst@@\string#1\endcsname\zerocount \forgetspecial#1{#3}} \def\forgetspecial#1#2% @@ -589,7 +589,7 @@ \let#1\gobbleninearguments \or \let#1\gobbletenarguments \fi} - \def\resetspecials% + \def\resetspecials {\the\everyresetspecials \let\preloadedspecials\empty} @@ -637,7 +637,7 @@ %D %D In a \type {spec-def} you can find some examples. -\def\defineoutput% +\def\defineoutput {\dodoubleargument\dodefineoutput} \def\dodefineoutput[#1][#2]% @@ -648,7 +648,7 @@ {\processcommacommand[\getvalue{\??ui#1}]\dousespecials} {\doifdefinedelse{\@@specfil@@#1} {\dousespecials{#1}} - {\showmessage{\m!specials}{7}{#1}}}} + {\showmessage\m!specials7{#1}}}} \def\setupoutput[#1]% {\ifnum\realpageno<2 % new diff --git a/tex/context/base/spec-mis.tex b/tex/context/base/spec-mis.tex index 65aa20116..72f76a810 100644 --- a/tex/context/base/spec-mis.tex +++ b/tex/context/base/spec-mis.tex @@ -127,10 +127,11 @@ \def\setsubmitoutputformat#1% {\doifinsetelse{#1}{FDF,fdf} - {\chardef\submitoutputformat=2} + {\chardef\submitoutputformat2} {\doifinsetelse{#1}{XML,xml} - {\chardef\submitoutputformat=3} - {\chardef\submitoutputformat=1}}} + {\chardef\submitoutputformat3} + {\chardef\submitoutputformat1}}% + \relax} %D \macros %D {escapePSstring} @@ -182,4 +183,12 @@ \def\par{\rawcharacter{12}}% \expanded{\egroup\noexpand\def\noexpand#2{#1}}} +%D \macros +%D {ifPDFunicode} +%D +%D We can use this switch to signal that content streams has +%D to be unicoded. + +\newif\ifPDFunicode + \protect \endinput diff --git a/tex/context/base/spec-pdf.tex b/tex/context/base/spec-pdf.tex index 49adc7d51..b59f5d25d 100644 --- a/tex/context/base/spec-pdf.tex +++ b/tex/context/base/spec-pdf.tex @@ -140,22 +140,14 @@ %D We can set up the page dimensions, full screen start up %D mode and identify the file with: -\definespecial\dosetupscreen{\doPDFsetupscreen\printpapierhoogte} +\definespecial\dosetupscreen {\doPDFsetupscreen \printpapierhoogte} -\definespecial\dosetupidentity#1#2#3#4#5#6% - {\bgroup - \enablePDFdocencoding - \special - {\@@insertpostscriptretain - [ /Title (#1) - /Subject (#2) - /Author (#3) - /Creator (#4) - /ModificationDate (#5) - /Keywords (#6) - /DOCINFO - pdfmark}% - \egroup} +\definespecial\dosetupartbox {\doPDFsetupartbox \printpapierhoogte} +\definespecial\dosetupcropbox {\doPDFsetupcropbox \printpapierhoogte} +\definespecial\dosetupbleedbox{\doPDFsetupbleedbox\printpapierhoogte} +\definespecial\dosetuptrimbox {\doPDFsetuptrimbox \printpapierhoogte} + +\definespecial\dosetupidentity{\doPDFsetupidentity} %D \macros %D {dobeginofprofile,doendofprofile} @@ -408,7 +400,8 @@ \dosetobjectreference{#1}{#2}{#1::#2}} %D \macros -%D {doPDFaddtocatalog,doPDFpageattribute,doPDFpagesattribute} +%D {doPDFaddtocatalog,doPDFaddtoinfo, +%D doPDFpageattribute,doPDFpagesattribute} %D %D Next come our housekeeping macros. @@ -418,6 +411,11 @@ {\@@insertpostscriptretain [ {Catalog} << #1 >> /PUT pdfmark}}} +\def\doPDFaddtoinfo#1% unchecked + {\special + {\@@insertpostscriptretain + [ #1 /DOCINFO pdfmark}} % [ {DocInfo} << #1 >> /PUT pdfmark}} + \def\doPDFpageattribute#1% {\doifsomething{#1} {\special diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex index 807c3c469..15d7638f9 100644 --- a/tex/context/base/spec-tpd.tex +++ b/tex/context/base/spec-tpd.tex @@ -241,12 +241,12 @@ \else \let\filesuffix\temp % a temporary hack - \doif{\filesuffix}{PDF}{\pdfimageresolution=72}% - \doif{\filesuffix}{pdf}{\pdfimageresolution=72}% + \doif\filesuffix{PDF}{\pdfimageresolution72}% + \doif\filesuffix{pdf}{\pdfimageresolution72}% % because pdfTeX scales back \fi}} {\let\filesuffix\s!unknown}% - \doiffileinsertionsupportedelse{\filesuffix}} + \doiffileinsertionsupportedelse\filesuffix} \ifx\pdflastximagepages\undefined \chardef\pdflastximagepages=1 \fi @@ -322,11 +322,11 @@ \ifnum\pdftexversion>13 -\def\checkpdfimageattributes% +\def\checkpdfimageattributes {\ifx\PDFfigurereference\empty \global\let\pdfimageattributes\empty \else - \immediate\pdfobj% + \immediate\pdfobj {[ << /Image \PDFfigurereference\space0 R /DefaultForPrinting true >> ]}% \xdef\pdfimageattributes% @@ -335,8 +335,8 @@ \def\dogetTPDfiguresize#1#2#3#4#5#6#7% {\ifmeasureTPDfiguresize - #4=\zeropoint - #5=\zeropoint + #4\zeropoint + #5\zeropoint \doifvalidpdfimagefileelse{#2} {\ifvoid\foundexternalfigure \donetrue @@ -349,7 +349,7 @@ \ifdone \checkpdfimagepagenumber{#3}% \checkpdfimageattributes - \global\setbox\foundexternalfigure=\vbox + \global\setbox\foundexternalfigure\vbox {\immediate\pdfximage \pdfimageattributes \pdfimagepagenumber{#2}% \xdef\PDFimagereference{\the\pdflastximage}% \xdef\nofinsertpages{\the\pdflastximagepages}% @@ -442,6 +442,7 @@ \definespecial\dostartrgbcolormode {\doPDFstartrgbcolormode} \definespecial\dostartcmykcolormode {\doPDFstartcmykcolormode} \definespecial\dostartgraycolormode {\doPDFstartgraycolormode} +\definespecial\dostartspotcolormode {\doPDFstartspotcolormode} \definespecial\dostopcolormode {\doPDFstopcolormode} \definespecial\dostartrotation {\doPDFstartrotation} \definespecial\dostoprotation {\doPDFstoprotation} @@ -452,6 +453,19 @@ \definespecial\dostartnegative {\doPDFstartnegative} \definespecial\dostopnegative {\doPDFstopnegative} +\definespecial\doregistercmykspotcolor {\doPDFregistercmykspotcolor} +\definespecial\doregisterrgbspotcolor {\doPDFregisterrgbspotcolor} +\definespecial\doregistergrayspotcolor {\doPDFregistergrayspotcolor} + +\def\doPDFregistersomespotcolor#1#2#3#4% + {\immediate \pdfobj stream attr + {/FunctionType 4 /Domain [0.0 1.0] /Range #3}{#4}% + \immediate \pdfobj + {[/Separation /#1 /Device#2 \the\pdflastobj\space0 R]}% + \dosetobjectreference{PDFCS}{#1}{\the\pdflastobj}% + \appendtoPDFdocumentcolorspaces + {/#1 \the\pdflastobj\space0 R}} + %D \macros %D {dostarttransparency,dostoptransparency} %D @@ -476,7 +490,7 @@ \executeifdefined{\@@PDT#1:#2}{\dopresetPDFtransparency{#1}{#2}}} \def\dopresetPDFtransparency#1#2% - {\global\advance\PDFcurrenttransparency 1 + {\global\advance\PDFcurrenttransparency \plusone \immediate\pdfobj{\PDFtransparancydictionary{#1}{#2}{}}% \edef\PDFtransparencyidentifier{/Tr\the\PDFcurrenttransparency}% \edef\PDFtransparencyreference {\the\pdflastobj\space 0 R}% @@ -594,7 +608,12 @@ %D \ACROBAT\ handle setting the page dimensions in a %D different way, we do not share this special. -\definespecial\dosetupscreen{\doPDFsetupscreen\pdfpageheight} +\definespecial\dosetupscreen {\doPDFsetupscreen \pdfpageheight} + +\definespecial\dosetupartbox {\doPDFsetupartbox \pdfpageheight} +\definespecial\dosetupcropbox {\doPDFsetupcropbox \pdfpageheight} +\definespecial\dosetupbleedbox{\doPDFsetupbleedbox\pdfpageheight} +\definespecial\dosetuptrimbox {\doPDFsetuptrimbox \pdfpageheight} %D \macros %D {dostartexecutecommand} @@ -613,18 +632,7 @@ %D etc. For the moment \PDFTEX\ only supports the first three %D of these. -\definespecial\dosetupidentity#1#2#3#4#5#6% - {\bgroup - \enablePDFdocencoding - \pdfinfo - {%Producer (pdfTeX) % already there - /Title (#1) - /Subject (#2) - /Author (#3) - /Creator (#4) - /ModificationDate (#5) - /Keywords (#6)}% - \egroup} +\definespecial\dosetupidentity{\doPDFsetupidentity} %D \macros %D {dostartrunprogam} @@ -710,8 +718,8 @@ \definespecial\dostartobject#1#2#3#4#5% {\bgroup - \setbox\nextbox=\vbox\bgroup - \def\dodostopobject% + \setbox\nextbox\vbox\bgroup + \def\dodostopobject {\egroup \ifx\PDFimagereference\empty % We also flush page resources, since shared @@ -728,7 +736,7 @@ \global\let\PDFimagereference\empty \fi}} - \definespecial\dostopobject% + \definespecial\dostopobject {\dodostopobject \egroup} @@ -751,7 +759,7 @@ \definespecial\dostartobject#1#2#3#4#5% {\bgroup - \setbox\nextbox=\vbox\bgroup + \setbox\nextbox\vbox\bgroup \def\dodostopobject% {\egroup \pdfform\nextbox @@ -1021,14 +1029,18 @@ \dosetobjectreference{#1}{#2}{\the\pdflastannot}} %D \macros -%D {doPDFaddtocatalog,doPDFpageattribute,doPDFpagesattribute} +%D {doPDFaddtocatalog,doPDFaddtoinfo, +%D doPDFpageattribute,doPDFpagesattribute} %D %D Next some simple ones. Watch the global directive and the %D expansion in the page attribute macro. -\def\doPDFaddtocatalog% +\def\doPDFaddtocatalog {\pdfcatalog} +\def\doPDFaddtoinfo + {\pdfinfo} + \def\doPDFpageattribute#1% {\expanded{\global\pdfpageattr{#1\the\pdfpageattr}}} @@ -1038,10 +1050,10 @@ \def\doPDFpagesattribute#1% {\expanded{\global\pdfpagesattr{#1\the\pdfpagesattr}}} -\def\doPDFresetpageattributes% +\def\doPDFresetpageattributes {\global\pdfpageattr\emptytoks} -\def\doPDFresetpageresources% +\def\doPDFresetpageresources {\global\pdfpageresources\emptytoks} %D \macros diff --git a/tex/context/base/supp-ali.tex b/tex/context/base/supp-ali.tex index 363c239bc..30f9d25fe 100644 --- a/tex/context/base/supp-ali.tex +++ b/tex/context/base/supp-ali.tex @@ -21,7 +21,19 @@ \unprotect +% \starttabulatie[|cg{.}|cg{,}|cg{,}|] +% \NC period \NC comma \NC comma \NC\NR +% \NG 100.000,00 \NG 100.000,00 \NG 100,00 \NC\NR +% \NG 10.000,00 \NG 10.000,00 \NG 1000,00 \NC\NR +% \NG 100,00 \NG 100,00 \NG 10,00 \NC\NR +% \NG 100,00 \NG 100,00 \NG 10,00 \NC\NR +% \NG 10\\ \NG 10\\ \NG 0,00 \NC\NR +% \NG 10 \NG 10 \NG 0,00 \NC\NR +% \NG 10 \NG 10 \NG 0,00 \NC\NR +% \stoptabulatie + \chardef\characteralignmentmode=4 +\chardef\characteralignmentslot=1 \let\afterassignwidth \!!zeropoint \let\beforeassignwidth\!!zeropoint @@ -30,30 +42,31 @@ \let\alignmentclass\s!default % can be used to handle multiple mixed ones -\def\setfirstpasscharacteralign% +\def\setfirstpasscharacteralign {\popcharacteralign \expanded{\dosetfirstpasscharacteralign{\alignmentcharacter}}} \def\dosetfirstpasscharacteralign#1% {\def\checkalignment##1% {\popcharacteralign - \setbox\scratchbox=\hbox{#1}% + \let\\\empty + \setbox\scratchbox\hbox{#1}% \edef\characterassignwidth{\the\wd\scratchbox}% - \setbox\scratchbox=\hbox{}% + \setbox\scratchbox\hbox{}% \docheckalignment#1##1#1\relax\relax - \scratchdimen=-\wd\scratchbox - \setbox\scratchbox=\hbox{##1}% - \advance\scratchdimen by \wd\scratchbox + \scratchdimen-\wd\scratchbox + \setbox\scratchbox\hbox{##1}% + \advance\scratchdimen \wd\scratchbox \ifdim\scratchdimen>\beforeassignwidth\relax \edef\beforeassignwidth{\the\scratchdimen}% \fi - \ifdim\scratchdimen=\!!zeropoint - \setbox\scratchbox=\hbox{##1}% - \scratchdimen=\wd\scratchbox - \ifnum\characteralignmentmode=0 + \ifdim\scratchdimen=\zeropoint + \setbox\scratchbox\hbox{##1}% + \scratchdimen\wd\scratchbox + \ifcase\characteralignmentmode % do nothing \else\ifnum\characteralignmentmode<3 - \advance\scratchdimen by \characterassignwidth + \advance\scratchdimen \characterassignwidth \ifdim\scratchdimen>\beforeassignwidth\relax \edef\beforeassignwidth{\the\scratchdimen}% \fi @@ -64,9 +77,9 @@ \fi\fi \fi \pushcharacteralign}% - \def\docheckalignment##1#1##2##3\relax% + \def\docheckalignment##1#1##2##3\relax {\ifx##2\relax - \setbox\scratchbox=\hbox{##1}% + \setbox\scratchbox\hbox{##1}% \ifdim\wd\scratchbox>\afterassignwidth \edef\afterassignwidth{\the\wd\scratchbox}% \fi @@ -74,19 +87,29 @@ \docheckalignment##2##3\relax \fi}} -\def\setsecondpasscharacteralign% +\def\setsecondpasscharacteralign {\popcharacteralign \expanded{\dosetsecondpasscharacteralign{\alignmentcharacter}}} \def\dosetsecondpasscharacteralign#1% {\def\checkalignment##1% {\popcharacteralign - \setbox\scratchbox=\hbox{#1}% + \let\\\empty % beware, no grouping + \setbox\scratchbox\hbox{#1}% \edef\characterassignwidth{\the\wd\scratchbox}% - \setbox\scratchbox=\hbox{}% - \docheckalignment#1##1#1\relax\relax - \scratchdimen=\wd\scratchbox - \setbox\scratchbox=\hbox{##1}% + \setbox\scratchbox\hbox{}% + % new 12,34 vs 10\\ where 10 aligns on 12 if #1 = , + \ifcase\characteralignmentslot + \docheckalignment#1##1#1\relax\relax + \scratchdimen\wd\scratchbox + \setbox\scratchbox\hbox{##1\unskip}% + \else + \def\\{#1}% + \expanded{\docheckalignment#1##1#1\relax\relax}% + \scratchdimen\wd\scratchbox + \setbox\scratchbox\hbox + {\def\\{\hphantom{#1}}##1}% + \fi \ifdim\scratchdimen=\wd\scratchbox \ifcase\characteralignmentmode \noindent\box\scratchbox @@ -111,27 +134,27 @@ {\hss\box\scratchbox\hskip-\scratchdimen}% \hskip\afterassignwidth}% \fi}% - \def\docheckalignment##1#1##2##3\relax% + \def\docheckalignment##1#1##2##3\relax {\ifx##2\relax - \setbox\scratchbox=\hbox{##1}% + \setbox\scratchbox\hbox{##1}% \else \docheckalignment##2##3\relax \fi}} % provide a means to use multiple alignments mixed -\def\pushcharacteralign% +\def\pushcharacteralign {\setxvalue{@cac@\alignmentclass}{\noexpand\do {\afterassignwidth}{\beforeassignwidth}{\alignmentcharacter}}} -\def\popcharacteralign% +\def\popcharacteralign {\def\do##1##2##3% {\def\afterassignwidth {##1}% \def\beforeassignwidth {##2}% \def\alignmentcharacter{##3}}% \getvalue{@cac@\alignmentclass}} -\long\def\startcharacteralign#1\stopcharacteralign% +\long\def\startcharacteralign#1\stopcharacteralign {\bgroup \setfirstpasscharacteralign #1% \setsecondpasscharacteralign#1% diff --git a/tex/context/base/supp-box.tex b/tex/context/base/supp-box.tex index e15833b60..adc160dcc 100644 --- a/tex/context/base/supp-box.tex +++ b/tex/context/base/supp-box.tex @@ -54,7 +54,7 @@ \newdimen\nextdepth %D \macros -%D {smashbox} +%D {smashbox, smashedbox} %D %D Smashing is introduced in \PLAIN\ \TEX, and stands for %D reducing the dimensions of a box to zero. The most resolute @@ -65,6 +65,10 @@ \ht#1\zeropoint \dp#1\zeropoint} +\def\smashboxed#1% + {\smashbox{#1}% + \box#1\relax} + %D \macros %D {hsmashbox,vsmashbox} %D @@ -83,26 +87,7 @@ \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}} - -\def\smashbox% +\def\smashbox {\afterassignment\dosmashbox\registercount} \def\dosmashbox @@ -110,13 +95,20 @@ \ht\registercount\zeropoint \dp\registercount\zeropoint} -\def\hsmashbox% +\def\smashedbox + {\afterassignment\thesmashedbox\registercount} + +\def\thesmashedbox + {\dosmashbox + \box\registercount} + +\def\hsmashbox {\afterassignment\dohsmashbox\registercount} \def\dohsmashbox {\wd\registercount\zeropoint} -\def\vsmashbox% +\def\vsmashbox {\afterassignment\dovsmashbox\registercount} \def\dovsmashbox @@ -157,6 +149,23 @@ \def\vsmashed{\dosomesmash\smashbox \normalvbox} %D \macros +%D {smashedhbox,smashedvbox} +%D +%D Also handy (all dimensions zeroed): +%D +%D \starttypen +%D \smashedhbox to ... {...} +%D \smashedvbox to ... {...} +%D \stoptypen + +\def\dosmashedbox#1% + %{#1\bgroup\dowithnextbox{\smashbox\nextbox\box\nextbox\egroup}#1} + {#1\bgroup\dowithnextbox{\smashedbox\nextbox\egroup}#1} + +\def\smashedhbox{\dosmashedbox\hbox} +\def\smashedvbox{\dosmashedbox\vbox} + +%D \macros %D {smash} %D %D This smash alternative takes an optional arg [whdtb] as @@ -176,7 +185,7 @@ \def\dodosmash[#1]% {\edef\@@smash{#1}\futurelet\nexttoken\dododosmash} -\def\dododosmash% +\def\dododosmash {\ifmmode \def\next##1{\mathpalette\mathsm@sh{##1}}% \else\ifx\nexttoken\bgroup @@ -190,13 +199,13 @@ {\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} + {\if#1w\nextboxwd\zeropoint\else + \if#1h\nextboxht\zeropoint\else + \if#1d\nextboxdp\zeropoint\else + \if#1t\nextboxht\zeropoint\else + \if#1b\nextboxdp\zeropoint\fi\fi\fi\fi\fi} -\def\finsm@sh% redefined plain macro +\def\finsm@sh % redefined plain macro {\dowithnextbox {\@EA\handletokens\@@smash\with\makesm@sh\box\nextbox}\normalhbox} @@ -277,9 +286,85 @@ %D \getboxheight \dimen0 \of \box0 %D \getboxheight \someheight \of \box \tempbox %D \stoptypen +%D +%D The implementation is rather stupid: +%D +%D \starttypen +%D \def\getboxheight#1\of#2\box#3% +%D {#1\ht#3\advance#1\dp#3\relax} +%D \stoptypen +%D +%D The next alternative is slightly more clever, since +%D it accepts \type {{12}} as well as \type {12} as box +%D number. -\def\getboxheight#1\of#2\box#3% - {#1\ht#3\advance#1\dp#3\relax} +\def\getboxheight#1\of#2\box#3% + {\def\next{#1\ht\registercount\advance#1\dp\registercount}% + \afterassignment\next\registercount=#3} + +%D For a long time the following three macros were part of +%D the grid snapping core module, but it makes more sense to +%D have them here so that users can see them. +%D +%D \macros +%D {getnoflines, getrawnoflines} +%D +%D Het commando \type{\getnoflines} converteert een hoogte +%D (dimensie) in een aantal regels en kent dit toe aan +%D \type{\noflines}. +%D +%D \starttypen +%D \getnoflines{dimensie} +%D \stoptypen +%D +%D Er wordt gedeeld door \type{\openlineheight} en een hoogte +%D van~0pt komt overeen met 0~regels. The raw alternative +%D does not round. + +\newcount\noflines +\newdimen\noflinesheight + +\def\dogetnoflines#1#2% + {\noflinesheight#2\relax + \ifdim\noflinesheight=\zeropoint + \noflines\zerocount + \else + \divide\noflinesheight \openlineheight + \noflines\noflinesheight + #1\ifdim\noflines\openlineheight=#2\relax \else + \advance\noflines \plusone + \fi\fi + \fi} + +\def\getnoflines {\dogetnoflines\iftrue } % compensated +\def\getrawnoflines{\dogetnoflines\iffalse} % no compensation + +%D \macros +%D {determinenoflines} +%D +%D The next macro determines the number of lines and +%D returns it it \type {\noflines}. The macro works +%D reasonable well as long as the content can be unboxed. +%D +%D \starttypen +%D \determinenoflines{test\\test} +%D \determinenoflines{\bfd test\\test} +%D \determinenoflines{\definedfont[Sans at 40pt]test\\test} +%D \stoptypen + +\def\determinenoflines + {\bgroup + \forgetall + \let\crlf\endgraf + \let\\\endgraf + \dowithnextbox + {\beginofshapebox + \unvbox\nextbox + \endofshapebox + \global\count1\zerocount + \reshapebox{\global\advance\count1\plusone}% + \egroup\noflines\count1 }% + \vbox} %D \macros %D {doiftextelse, doiftext} @@ -397,7 +482,7 @@ %D we don't really need this functionality now. %D \macros -%D {nextboxht,nextboxwd,nextboxdp} +%D {nextboxht,nextboxwd,nextboxdp,flushnextbox} %D %D The next couple of shortcuts saves us memory as well as %D \type {{}}'s in passing parameters. @@ -406,6 +491,8 @@ \def\nextboxwd{\wd\nextbox} \def\nextboxdp{\dp\nextbox} +\def\flushnextbox{\box\nextbox} + %D \macros %D {dowithnextboxcontent} %D @@ -427,11 +514,11 @@ %D Now we can redefine \type {\dowithnextbox} as follows: -\def\dowithnextbox% +\def\dowithnextbox {\dowithnextboxcontent\empty} %D \macros -%D {llap, rlap, tlap, blap} +%D {llap, rlap, tlap, blap, clap} %D %D Some well known friends, but we implement them our own %D way. @@ -442,6 +529,9 @@ \def\llap{\begingroup\dowithnextbox{\normalhbox to \zeropoint {\normalhss\box\nextbox}\endgroup}\normalhbox} +\def\clap{\begingroup\dowithnextbox{\normalhbox to \zeropoint + {\normalhss\box\nextbox\normalhss}\endgroup}\normalhbox} + \def\tlap{\begingroup\dowithnextbox{\normalvbox to \zeropoint {\normalvss\box\nextbox}\endgroup}\normalvbox} @@ -588,9 +678,9 @@ \def\reshapebox#1% {\doreshapebox - {#1} - {\penalty\shapepenalty} - {\kern \shapekern } + {#1}% + {\penalty\shapepenalty}% + {\kern \shapekern }% {\vskip \shapeskip }} \newbox\tmpshapebox @@ -645,7 +735,7 @@ \advance\shapecounter \plusone \fi} -\def\beginofshapebox% +\def\beginofshapebox {\setbox\oldshapebox\normalvbox \bgroup \reshapingboxtrue @@ -660,15 +750,15 @@ \let\beginshapebox=\beginofshapebox \let\endshapebox =\endofshapebox -\def\flushshapebox% +\def\flushshapebox {\bgroup - \ifdim\ht\newshapebox=\zeropoint\relax + \ifdim\ht\newshapebox=\zeropoint \else % make \prevdepth legal % \par before the next \vskip gives far worse results \ifdim\parskip>\zeropoint\vskip\parskip\else\par\fi % and take a look - \ifdim\prevdepth=-1000pt + \ifdim\prevdepth=-\thousandpoint \prevdepth\zeropoint \fi \ifdim\prevdepth<\zeropoint\relax @@ -711,7 +801,7 @@ % % \omlijnd[offset=0pt,hoogte=8mm,uitlijnen={rechts,laho}]{\bfa test} -\def\innerflushshapebox% +\def\innerflushshapebox {\ifdim\ht\newshapebox=\zeropoint\relax \else \unvcopy\newshapebox\relax % \kern-\dp\newshapebox\relax @@ -736,10 +826,10 @@ %D of \type {\normalhbox}, since it manages the height and depth of %D the line. -\def\shapedhbox% +\def\shapedhbox {\dowithnextbox - {\ht\nextbox\zeropoint - \dp\nextbox\zeropoint + {\nextboxht\zeropoint + \nextboxdp\zeropoint \box\nextbox} \normalhbox} @@ -911,7 +1001,7 @@ %D {\widowpenalty=0 %D \clubpenalty=0 %D \scratchdimen=#1\relax -%D \ifdim\wd\nextbox>\scratchdimen +%D \ifdim\nextboxwd>\scratchdimen %D \setbox\scratchbox=\normalhbox{ #2}% %D \advance\scratchdimen by -\wd\scratchbox %D \setbox\nextbox=\normalvbox @@ -919,7 +1009,7 @@ %D \hfuzz\maxdimen %D \veryraggedright %D \strut\unhcopy\nextbox}% -%D \ifdim\ht\nextbox>\ht\strutbox \else +%D \ifdim\nextboxht>\ht\strutbox \else %D \setbox\scratchbox\null % overfull and not split %D \fi %D \setbox\nextbox=\normalvbox % if omitted: missing brace reported @@ -960,7 +1050,7 @@ \else \donetrue \fi - \ifdim\wd\nextbox>\scratchdimen + \ifdim\nextboxwd>\scratchdimen \setbox\scratchbox\normalhbox{\ifdone\space#2\else#2\space\fi}% \advance\scratchdimen -\wd\scratchbox \setbox0\box\nextbox @@ -975,7 +1065,7 @@ \hskip\zeropoint \!!plus 1\!!fill % \hsize \fi \unhcopy0}% - \ifdim\ht\nextbox>\ht\strutbox + \ifdim\nextboxht>\ht\strutbox \setbox\nextbox\normalvbox % if omitted: missing brace reported {\splittopskip\openstrutheight \ifdone @@ -983,7 +1073,7 @@ \else \doloop {\setbox0\vsplit\nextbox to \ht\strutbox - \ifdim\ht\nextbox>\ht\strutbox \else \exitloop \fi}% + \ifdim\nextboxht>\ht\strutbox \else \exitloop \fi}% \fi \unvbox\nextbox \setbox\nextbox\lastbox @@ -1036,9 +1126,9 @@ {\beforesplitstring#2\at,\to\leftlimit \aftersplitstring #2\at,\to\rightlimit \ifx\rightlimit\empty - \normallimitatetext{#1}{\leftlimit}{#3}% + \normallimitatetext {#1}\leftlimit {#3}% \else - \speciallimitatetext{#1}{\leftlimit}{\rightlimit}{#3}% + \speciallimitatetext{#1}\leftlimit\rightlimit{#3}% \fi} %D \macros @@ -1130,7 +1220,7 @@ \newif\ifisolatedwords -\def\betweenisolatedwords% +\def\betweenisolatedwords {\hskip\currentspaceskip} %D In order to prevent problems with nested isolated words, we @@ -1230,21 +1320,25 @@ %D and footers and|/|or margin material. \def\sbox% in handleiding, voorbeeld \inlinker{xx} \extern.. - {\dowithnextbox + {\normalvbox\bgroup % new ! ! ! + \dowithnextbox {\setbox\scratchbox\normalhbox {\strut - \dp\nextbox\zeropoint + \nextboxdp\zeropoint \lower\strutdepth\box\nextbox}% \dp\scratchbox\strutdepth \ht\scratchbox\strutheight - \box\scratchbox}% + \box\scratchbox + \egroup}% \normalvbox} \def\struttedbox - {\dowithnextbox - {\dp\nextbox\strutdepth - \ht\nextbox\strutheight - \box\nextbox}% + {\normalhbox\bgroup % new ! ! ! + \dowithnextbox + {\nextboxdp\strutdepth + \nextboxht\strutheight + \box\nextbox + \egroup}% \normalhbox} %D \macros @@ -1337,8 +1431,8 @@ \def\centerednextbox#1#% {\bgroup \dowithnextbox - {\hsize\wd\nextbox - \vsize\ht\nextbox + {\hsize\nextboxwd + \vsize\nextboxht \centeredbox#1{\box\nextbox}% \egroup} \normalhbox} @@ -1419,14 +1513,14 @@ \scratchdimen\noflines\lineheight \setbox\scratchbox\normalhbox to \savedrigidhsize {\dorecurse\rigidcolumns - {\setbox\scratchbox=\vsplit\rigidcolumnbox to \scratchdimen - \dp\scratchbox=\openstrutdepth - \setbox\scratchbox=\normalvtop + {\setbox\scratchbox\vsplit\rigidcolumnbox to \scratchdimen + \dp\scratchbox\openstrutdepth + \setbox\scratchbox\normalvtop \ifalignrigidcolumns to \ifstretchrigidcolumns\vsize\else\scratchdimen\fi \fi {\unvbox\scratchbox}% - \wd\scratchbox=\hsize + \wd\scratchbox\hsize \box\scratchbox \hfill}% \hfillneg}% @@ -1461,26 +1555,26 @@ %D These macros are used in reformatting footnotes, so they do %D what they're meant for. -\def\setvboxtohbox% +\def\setvboxtohbox {\bgroup \ifdim\baselineskip<16pt \relax - \dimen0=\baselineskip - \multiply\dimen0 by 1024 + \dimen0\baselineskip + \multiply\dimen0 1024 \else \message{cropping \baselineskip to 16pt}% - \dimen0=\maxdimen + \dimen0\maxdimen \fi - \divide\dimen0 by \hsize - \multiply\dimen0 by 64 + \divide\dimen0 \hsize + \multiply\dimen0 64 \xdef\normalvboxtohboxfactor{\expandafter\withoutpt\the\dimen0}% \egroup} -\def\startvboxtohbox% +\def\startvboxtohbox {\bgroup \setvboxtohbox - \setbox0=\normalhbox\bgroup} + \setbox0\normalhbox\bgroup} -\def\stopvboxtohbox% +\def\stopvboxtohbox {\egroup \dp0=\zeropoint \ht0=\normalvboxtohboxfactor\wd0 @@ -1517,22 +1611,21 @@ \def\convertvboxtohbox% {\setvboxtohbox \makehboxofhboxes - \setbox0=\normalhbox{\unhbox0 \removehboxes}% + \setbox0\normalhbox{\unhbox0 \removehboxes}% \noindent\unhbox0\par} \def\makehboxofhboxes% - {\setbox0=\normalhbox{}% + {\setbox0\normalhbox{}% \loop % \doloop { .. \exitloop .. } - \setbox2=\lastbox + \setbox2\lastbox \ifhbox2 - \setbox0=\normalhbox{\box2\unhbox0}% + \setbox0\normalhbox{\box2\unhbox0}% \repeat} \def\removehboxes% - {\setbox0=\lastbox + {\setbox0\lastbox \ifhbox0 - {\removehboxes}% - \unhbox0 + {\removehboxes}\unhbox0 \fi} %D \macros @@ -1548,23 +1641,23 @@ \def\unhhbox#1\with#2% {\bgroup - \widowpenalty=0 - \clubpenalty=0 + \widowpenalty\zerocount + \clubpenalty\zerocount \mindermeldingen \forgetall - \setbox\unhhedbox=\normalvbox{\hskip\hhboxindent\strut\unhbox#1}% => \hsize + \setbox\unhhedbox\normalvbox{\hskip\hhboxindent\strut\unhbox#1}% => \hsize \doloop - {\setbox\hhbox=\vsplit\unhhedbox to \lineheight + {\setbox\hhbox\vsplit\unhhedbox to \lineheight \ifvoid\unhhedbox - \setbox\hhbox=\normalhbox{\strut\normalhboxofvbox\hhbox}% + \setbox\hhbox\normalhbox{\strut\normalhboxofvbox\hhbox}% \fi - \ht\hhbox=\ht\strutbox - \dp\hhbox=\dp\strutbox + \ht\hhbox\ht\strutbox + \dp\hhbox\dp\strutbox \ifdim\hhboxindent=\zeropoint\else - \setbox\hhbox=\normalhbox{\hskip-\hhboxindent\box\hhbox}% - \hhboxindent=\zeropoint + \setbox\hhbox\normalhbox{\hskip-\hhboxindent\box\hhbox}% + \hhboxindent\zeropoint \fi - \global\lasthhboxwidth=\wd\hhbox + \global\lasthhboxwidth\wd\hhbox #2\relax \ifvoid\unhhedbox \exitloop @@ -1573,12 +1666,12 @@ \fi}% \egroup} -\def\dohboxofvbox% - {\setbox0=\normalvbox{\unvbox\scratchcounter\global\setbox1=\lastbox}% +\def\dohboxofvbox + {\setbox0\normalvbox{\unvbox\scratchcounter\global\setbox1\lastbox}% \unhbox1 \egroup} -\def\normalhboxofvbox% +\def\normalhboxofvbox {\bgroup \afterassignment\dohboxofvbox \scratchcounter=} @@ -1626,13 +1719,13 @@ \unexpanded\def\doifcontent#1#2#3% {\dowithnextbox {\ifhbox\nextbox - \ifdim\wd\nextbox>\zeropoint + \ifdim\nextboxwd>\zeropoint #1\unhbox\nextbox#2\relax \else #3\relax \fi \else - \ifdim\ht\nextbox>\zeropoint + \ifdim\nextboxht>\zeropoint #1\unvbox\nextbox#2\relax \else #3\relax @@ -1672,20 +1765,20 @@ \resetbox\processbox \afterassignment\dogetprocessbox\let\next=} -\def\endprocessboxes% +\def\endprocessboxes {\ifhmode\unskip\fi \box\processbox \next \egroup} -\def\dogetprocessbox% +\def\dogetprocessbox {\ifx\next\bgroup \expandafter\dodogetprocessbox \else \expandafter\endprocessboxes \fi} -\def\dodogetprocessbox% +\def\dodogetprocessbox {\dowithnextbox {\ifhmode\unskip\fi\doprocessbox % takes \nextbox makes \processbox \afterassignment\dogetprocessbox\let\next=} @@ -1712,15 +1805,15 @@ % \def\dooverlaybox% % {\ifhmode\unskip\fi -% \ifdim\ht\nextbox>\ht\processbox -% \setbox\processbox=\normalvbox to \ht\nextbox +% \ifdim\nextboxht>\ht\processbox +% \setbox\processbox=\normalvbox to \nextboxht % {\vss\box\processbox\vss}% % \else % \setbox\nextbox=\normalvbox to \ht\processbox % {\vss\box\nextbox\vss}% % \fi % \scratchdimen=\wd -% \ifdim\wd\nextbox>\wd\processbox +% \ifdim\nextboxwd>\wd\processbox % \nextbox % \else % \processbox @@ -1735,30 +1828,30 @@ % \let\stopoverlay\egroup % \processboxes\dooverlaybox} -\def\dooverlaybox% +\def\dooverlaybox {\ifhmode\unskip\fi - \scratchdimen=\dp - \ifdim\dp\nextbox>\dp\processbox + \scratchdimen\dp + \ifdim\nextboxdp>\dp\processbox \nextbox \else \processbox \fi - \ifdim\ht\nextbox>\ht\processbox - \setbox\processbox=\normalvbox to \ht\nextbox - {\dp\processbox=\zeropoint\vss\box\processbox\vss}% + \ifdim\nextboxht>\ht\processbox + \setbox\processbox\normalvbox to \nextboxht + {\dp\processbox\zeropoint\vss\box\processbox\vss}% \else - \setbox\nextbox=\normalvbox to \ht\processbox - {\dp\nextbox=\zeropoint\vss\box\nextbox\vss}% + \setbox\nextbox\normalvbox to \ht\processbox + {\nextboxdp\zeropoint\vss\box\nextbox\vss}% \fi - \dp\nextbox=\scratchdimen - \dp\processbox=\scratchdimen - \scratchdimen=\wd - \ifdim\wd\nextbox>\wd\processbox + \nextboxdp\scratchdimen + \dp\processbox\scratchdimen + \scratchdimen\wd + \ifdim\nextboxwd>\wd\processbox \nextbox \else \processbox \fi - \setbox\processbox=\normalhbox to \scratchdimen + \setbox\processbox\normalhbox to \scratchdimen {\normalhbox to \scratchdimen{\hss\box\processbox\hss}% \hskip-\scratchdimen \normalhbox to \scratchdimen{\hss\box\nextbox\hss}}} @@ -1810,15 +1903,15 @@ %D returns an empty box with the dimensions of the box %D specified, here being zero. -\def\dofakebox% - {\setbox\scratchbox=\null - \wd\scratchbox=\wd\scratchcounter - \ht\scratchbox=\ht\scratchcounter - \dp\scratchbox=\dp\scratchcounter +\def\dofakebox + {\setbox\scratchbox\null + \wd\scratchbox\wd\scratchcounter + \ht\scratchbox\ht\scratchcounter + \dp\scratchbox\dp\scratchcounter \ifhbox\scratchcounter\normalhbox\else\normalvbox\fi{\box\scratchbox}% \egroup} -\def\fakebox% +\def\fakebox {\bgroup \afterassignment\dofakebox\scratchcounter} @@ -1848,7 +1941,7 @@ \forgetall#1\let\next=} %D The alternatives \type {\tbox} and \type {\bbox} can be used -%D to properly allign boxes, like in: +%D to properly align boxes, like in: %D %D \startbuffer %D \starttabel[|||] @@ -1872,15 +1965,15 @@ \def\tbbox#1#2% {\normalhbox\bgroup \dowithnextbox - {\scratchdimen=\ht\nextbox - \advance\scratchdimen\dp\nextbox + {\scratchdimen\nextboxht + \advance\scratchdimen\nextboxdp \advance\scratchdimen-#1\strutbox - #1\nextbox=#1\strutbox - #2\nextbox=\scratchdimen - \setbox\nextbox=\normalhbox - {\lower\dp\nextbox\box\nextbox}% - #1\nextbox=#1\strutbox - #2\nextbox=\scratchdimen + #1\nextbox#1\strutbox + #2\nextbox\scratchdimen + \setbox\nextbox\normalhbox + {\lower\nextboxdp\box\nextbox}% + #1\nextbox#1\strutbox + #2\nextbox\scratchdimen \box\nextbox \egroup} \normalhbox} @@ -1918,10 +2011,10 @@ {\bgroup \sizeofbox\zeropoint \scratchdimen\zeropoint - \def\docommando% + \def\docommando {\advance\sizeofbox\scratchdimen \futurelet\next\dodocommando}% - \def\dodocommando% + \def\dodocommando {\ifx\next\bgroup \expanded{\egroup#1 to \the\sizeofbox}% \else @@ -1939,25 +2032,25 @@ \def\limitatelines#1#2% size sentinel {\dowithnextbox {\dimen0=#1\hsize - \ifdim\wd\nextbox>\dimen0 - \setbox\nextbox=\normalhbox - {\advance\dimen0 by -.1\hsize + \ifdim\nextboxwd>\dimen0 + \setbox\nextbox\normalhbox + {\advance\dimen0 -.1\hsize \limitatetext{\unhbox\nextbox}{\dimen0}{\nobreak#2}}% \fi \unhbox\nextbox} \normalhbox} -\def\fittoptobaselinegrid% weg hier +\def\fittoptobaselinegrid % weg hier {\dowithnextbox {\bgroup \par - \dimen0=\ht\nextbox - \ht\nextbox=\ht\strutbox - \dp\nextbox=\dp\strutbox + \dimen0\nextboxht + \nextboxht\ht\strutbox + \nextboxdp\dp\strutbox \normalhbox{\box\nextbox} \prevdepth\dp\strutbox \doloop - {\advance\dimen0 by -\lineheight + {\advance\dimen0 -\lineheight \ifdim\dimen0<\zeropoint \exitloop \else @@ -1976,7 +2069,7 @@ \setbox\fakedboxcursor\normalhbox {\vrule\!!width\zeropoint\!!height\zeropoint\!!depth\zeropoint} -\def\boxcursor% overloaded in core-vis +\def\boxcursor % overloaded in core-vis {\iftraceboxplacement \bgroup \scratchdimen2pt @@ -1987,8 +2080,7 @@ \!!height\scratchdimen \!!depth \scratchdimen \hss}% - \smashbox\scratchbox - \box\scratchbox + \smashedbox\scratchbox \egroup \else \copy\fakedboxcursor @@ -2217,11 +2309,11 @@ {\@EA\doglobal\@EA\increment\csname\@@stackmax#1\endcsname \setxvalue{\@@stacktag#1:#2}{\csname\@@stackmax#1\endcsname}% \setxvalue{\@@stacklst#1}{\getvalue{\@@stacklst#1},#2}% - \global\setbox\csname\@@stackbox#1\endcsname=\normalvbox + \global\setbox\csname\@@stackbox#1\endcsname\normalvbox {\forgetall - \setbox\scratchbox=\normalvbox{\box\nextbox} - \ht\scratchbox=\!!onepoint - \dp\scratchbox=\zeropoint + \setbox\scratchbox\normalvbox{\box\nextbox} + \ht\scratchbox\!!onepoint + \dp\scratchbox\zeropoint \unvbox\csname\@@stackbox#1\endcsname \offinterlineskip \allowbreak @@ -2232,16 +2324,16 @@ {\normalvbox {\doifdefined{\@@stackbox#1} {\doifdefined{\@@stacktag#1:#2} - {\setbox\scratchbox=\normalvbox + {\setbox\scratchbox\normalvbox {\splittopskip\zeropoint - \setbox0=\copy\csname\@@stackbox#1\endcsname - \dimen0=\getvalue{\@@stacktag#1:#2}pt - \advance\dimen0 by -\!!onepoint - \setbox2=\vsplit0 to \dimen0 + \setbox0\copy\csname\@@stackbox#1\endcsname + \dimen0=\getvalue{\@@stacktag#1:#2}\s!pt + \advance\dimen0 -\!!onepoint + \setbox2\vsplit0 to \dimen0 \ifdim\ht0>\!!onepoint - \setbox0=\vsplit0 to \!!onepoint + \setbox0\vsplit0 to \!!onepoint \fi - \unvbox0\setbox0=\lastbox\unvbox0}% + \unvbox0\setbox0\lastbox\unvbox0}% \unvbox\scratchbox}}}} \def\doifboxelse#1#2% @@ -2293,10 +2385,10 @@ %D \type {\obeydepth} makes sure we have depth. Both macros %D leave the \type {\prevdepth} untouched. -\def\removedepth% +\def\removedepth {\ifvmode \ifdim\prevdepth>\zeropoint \kern-\prevdepth \fi \fi} -\def\obeydepth% +\def\obeydepth {\par \removedepth \ifvmode \kern\dp\strutbox \fi} %D \macros @@ -2304,10 +2396,10 @@ %D %D A funny (but rather stupid) one, plus a redefinition. -\def\removebottomthings% - {\dorecurse{5}{\unskip\unkern\unpenalty}} +\def\removebottomthings + {\dorecurse5{\unskip\unkern\unpenalty}} -\def\removelastskip% \ifvmode the plain tex one \fi +\def\removelastskip % \ifvmode the plain tex one \fi {\ifvmode\ifdim\lastskip=\z@\else\vskip-\lastskip\fi\fi} %D \macros @@ -2338,11 +2430,11 @@ %D \stoptypen \def\doraiselowerbox#1#2% a nice trick us used to accept - {\def\next% % both direct and {} dimensions + {\def\next % both direct and {} dimensions {\dowithnextbox - {\setbox\nextbox=\normalhbox{#1\scratchdimen\box\nextbox}% - \ht\nextbox=\ht\strutbox - \dp\nextbox=\dp\strutbox + {\setbox\nextbox\normalhbox{#1\scratchdimen\box\nextbox}% + \nextboxht\ht\strutbox + \nextboxdp\dp\strutbox \box\nextbox}}% \afterassignment\next\scratchdimen=#2} @@ -2411,15 +2503,15 @@ % \egroup}% % \next} % -% \def\normbox% +% \def\normbox % {\dodoubleempty\donormbox} % vcenter in text, we kunnen vcenter overloaden -\def\halfwaybox% +\def\halfwaybox {\dowithnextbox - {\dp\nextbox\zeropoint - \setbox\nextbox=\normalhbox{\lower.5\ht\nextbox\box\nextbox}% + {\nextboxdp\zeropoint + \setbox\nextbox\normalhbox{\lower.5\nextboxht\box\nextbox}% \box\nextbox} \normalhbox} @@ -2456,11 +2548,19 @@ \let\verynormalvcenter \vcenter % since \vcenter can be visualized -\def\vcenter% +\def\vcenter {\normalvbox\bgroup \dowithnextbox{\normalhbox{$\verynormalvcenter{\box\nextbox}$}\egroup} \normalvbox} \prependtoks \let\vcenter\normalvcenter \to \everymath +%D \macros +%D {frozenhbox} +%D +%D A not so well unhboxable bxo can be made with: + +\def\frozenhbox + {\hbox\bgroup\dowithnextbox{\hbox{\hbox{\box\nextbox}}\egroup}\hbox} + \protect \endinput diff --git a/tex/context/base/supp-fil.tex b/tex/context/base/supp-fil.tex index 3e471d651..da5afe5f4 100644 --- a/tex/context/base/supp-fil.tex +++ b/tex/context/base/supp-fil.tex @@ -93,6 +93,13 @@ \def\unlinkfile#1% {\immediate\openout\scratchwrite=#1\immediate\closeout\scratchwrite} +%D \macros +%D {writeln} +%D +%D This saves a few tokens: + +\def\writeln#1{\write#1{}} + %D \macros %D {doprocessfile,fileline,fileprocessedtrue,dofinishfile} %D @@ -114,14 +121,14 @@ \let\fileline\empty \def\doprocessfile#1#2#3% - {\openin#1=#2\relax + {\immediate\openin#1=#2\relax \ifeof#1% \fileprocessedfalse - \closein#1\relax + \immediate\closein#1\relax \else \fileprocessedtrue \gdef\dofinishfile% - {\closein#1\relax + {\immediate\closein#1\relax \global\let\doprocessline\relax}% \gdef\doprocessline% {\ifeof#1% @@ -301,7 +308,7 @@ \doreadfile{\pathplusfile{\f!currentpath}{#1}}} \def\readlocfile#1% current path, backtracking - {\let\readlevel=\maxreadlevel + {\let\readlevel\maxreadlevel \doreadfile{\pathplusfile{\f!currentpath}{#1}}} %D System files can be anywhere and therefore @@ -309,7 +316,7 @@ %D and obeys the \TEX\ implementation. \def\readsysfile#1% current path, obeys tex search - {\let\readlevel=\maxreadlevel + {\let\readlevel\maxreadlevel \doreadfile{#1}} %D Of the last two, \type{\readfixfile} searches on the @@ -317,7 +324,7 @@ %D \type{\readsetfile} does only search on the specified path. \def\readfixfile#1#2% specified path, backtracking - {\let\readlevel=\maxreadlevel + {\let\readlevel\maxreadlevel \doreadfile{\pathplusfile{#1}{#2}}} \def\readsetfile#1#2% specified path, no backtracking @@ -362,25 +369,25 @@ \ifnum\readlevel>\maxreadlevel\relax \else \immediate\closein#1\relax - \doopenin{#1}{\pathplusfile{\f!parentpath}{#2}}% + \doopenin{#1}{\pathplusfile\f!parentpath{#2}}% \fi \fi \fi} \def\openjobin#1#2% {\newcounter\readlevel - \doopenin{#1}{\pathplusfile{\f!currentpath}{#2}}} + \doopenin{#1}{\pathplusfile\f!currentpath{#2}}} \def\opensysin#1#2% - {\let\readlevel=\maxreadlevel + {\let\readlevel\maxreadlevel \doopenin{#1}{#2}} \def\openlocin#1#2% - {\let\readlevel=\maxreadlevel - \doopenin{#1}{\pathplusfile{\f!currentpath}{#2}}} + {\let\readlevel\maxreadlevel + \doopenin{#1}{\pathplusfile\f!currentpath{#2}}} \def\openfixin#1#2#3% - {\let\readlevel=\maxreadlevel + {\let\readlevel\maxreadlevel \doopenin{#1}{\pathplusfile{#2}{#3}}} %D \macros @@ -412,7 +419,7 @@ \next} % \def\doiflocfileelse#1% -% {\doiffileelse{\pathplusfile{\f!currentpath}{#1}}} +% {\doiffileelse{\pathplusfile\f!currentpath{#1}}} \def\doiflocfileelse#1% {\makelocreadfilename{#1}% @@ -422,7 +429,7 @@ {\sanitizefilename#1\to\readfilename \checkfilename\readfilename \ifcase\kindoffile - \edef\locreadfilename{\pathplusfile{\f!currentpath}{#1}}% + \edef\locreadfilename{\pathplusfile\f!currentpath{#1}}% \fi} %D \macros @@ -449,7 +456,7 @@ {\doonlyonce{#1}{\doiffileelse{#1}{\normalinput #1\relax}{}}} \def\doendinputonce#1% - {\doifdefined{@@@#1@@@}{\endinput}} + {\doifdefined{@@@#1@@@}\endinput} %D \macros %D {doifparentfileelse} @@ -469,43 +476,11 @@ \ifx\outputfilename\undefined \def\outputfilename{\jobname} \fi -% \def\doifparentfileelse#1#2#3% -% {\edef\!!stringa{#1}% -% \edef\!!stringb{\jobname}% -% \edef\!!stringc{\outputfilename}% -% \convertcommand\!!stringa\to\!!stringa -% \convertcommand\!!stringb\to\!!stringb -% \convertcommand\!!stringc\to\!!stringc -% \ifx\!!stringa\!!stringb#2\else -% \ifx\!!stringa\!!stringc#2\else -% #3\fi\fi} - \def\doifparentfileelse#1#2#3% {\doifsamestringelse{#1}{\jobname }{#2} {\doifsamestringelse{#1}{\jobname.\c!tex}{#2} {\doifsamestringelse{#1}{\outputfilename}{#2}{#3}}}} -% \newcounter\readingfilelevel -% -% \def\startreadingfile% -% {\ifnum\readingfilelevel=0 -% \edef\doreadingfilecharacters% -% {\catcode`"=\the\catcode`"\relax -% \catcode`<=\the\catcode`<\relax -% \catcode`>=\the\catcode`>\relax}% -% \catcode`"=\@@letter -% \catcode`<=\@@other -% \catcode`>=\@@other -% \let\stopreadingfile=\dostopreadingfile -% \fi -% \increment\readingfilelevel} -% -% \def\dostopreadingfile% -% {\ifnum\readingfilelevel=1 -% \doreadingfilecharacters -% \fi -% \decrement\readingfilelevel} - \def\normalless {<} % geen \let ! \def\normalmore {>} % geen \let ! \def\normalequal {=} % geen \let ! @@ -513,18 +488,6 @@ \newcounter\readingfilelevel -%\def\popfilecharacter#1#2% -% {\ifnum\catcode`#1=\@@other \ifnum#2=\@@other \else -% %\message{[popping catcode #1 to #2]}% -% \catcode`#1=#2\relax -% \fi \fi} -% -%\def\pushfilecharacter#1% -% {\ifnum\catcode`#1=\@@other \else -% %\message{[pushing catcode #1 from \the\catcode`#1]}% -% \catcode`#1=\@@other -% \fi} - \def\popfilecharacter#1#2% {\ifnum\catcode`#1=\@@other \ifnum#2=\@@other \else %\message{[popping catcode #1 to #2]}% @@ -538,13 +501,14 @@ %D regards to active characters (german ", polish /, %D french : and ;). -\def\startreadingfile% beter een every +\def\startreadingfile% beter een every en \setnormalcatcodes {\doglobal\increment\readingfilelevel \setxvalue{\string\readingfilelevel::\readingfilelevel}% {\catcode`/ =\the\catcode`/% + %\catcode`_ =\the\catcode`_% math ! ! ! \catcode`" =\the\catcode`"% -\catcode`: =\the\catcode`:% -\catcode`; =\the\catcode`;% + \catcode`: =\the\catcode`:% + \catcode`; =\the\catcode`;% \catcode`< =\the\catcode`<% \catcode`> =\the\catcode`>% \catcode`\noexpand\\=\the\catcode`\\% @@ -552,9 +516,10 @@ \catcode`\noexpand\}=\the\catcode`\}% \catcode`\noexpand\%=\the\catcode`\%}% \catcode`/ =\@@other + %\catcode`_ =\@@other \catcode`" =\@@other -\catcode`: =\@@other -\catcode`; =\@@other + \catcode`: =\@@other + \catcode`; =\@@other \catcode`< =\@@other \catcode`> =\@@other \catcode`\\=\@@escape diff --git a/tex/context/base/supp-fun.tex b/tex/context/base/supp-fun.tex index b8c21247c..bccbdf3ce 100644 --- a/tex/context/base/supp-fun.tex +++ b/tex/context/base/supp-fun.tex @@ -25,7 +25,7 @@ \writestatus{loading}{Context Support Macros / Fun Stuff} \ifx\definefont\undefined - \def\definefont[#1][#2]{\expandafter\font\csname#1\endcsname=#2\relax} + \def\definedfont[#1]{\font\temp#1\relax\temp} \fi %D \macros @@ -132,7 +132,7 @@ % \hskip-\parindent % \fi % \setbox0=\hbox -% {\definefont[temp][#2 at #3]\temp#1{#7}\hskip#4}% +% {\definedfont[#2 at #3]#1{#7}\hskip#4}% % \ifdim\dp0>\dp\strutbox % one of those Q's , will be option % \setbox2=\hbox{\raise\dp0\hbox{\lower\dp\strutbox\copy0}}% % \ht2=\ht0 \dp0=\dp\strutbox \setbox0=\box2 @@ -160,10 +160,51 @@ \chardef\DroppedStatus=0 % 0=done 1=starting 2=doing 3=error +% \def\DroppedCaps#1#2#3#4#5#6#7% does not yet handle accented chars +% {\convertargument #7\to\asciia +% \convertcommand \DroppedString\to\asciib +% \ExpandBothAfter\doifinstringelse{\asciia}{\asciib} +% {\ifvmode % this one is \EveryPar save, precede by \par if needed +% \vskip#6\baselineskip +% \penalty-200 +% \vskip-#6\baselineskip +% \fi +% \ifhmode +% \hskip-\parindent +% \fi +% \setbox0\hbox +% {\definedfont[#2 at #3]#1{#7}\hskip#4}% +% \ifdim\dp0>\dp\strutbox % one of those Q's , will be option +% \setbox2\hbox{\raise\dp0\hbox{\lower\dp\strutbox\copy0}}% +% \ht2\ht0 \dp0\dp\strutbox \setbox0\box2 +% \fi +% \setbox0\hbox +% {\lower#5\box0}% +% \ht0\ht\strutbox +% \dp0\dp\strutbox +% \globaldropcaps\edef\DroppedIndent{\the\wd0}% +% \globaldropcaps\edef\DroppedLines {\number#6}% +% \globaldropcaps\chardef\DroppedStatus2 +% \globaldropcaps\hangindent\DroppedIndent +% \globaldropcaps\hangafter-\DroppedLines +% \noindent +% \hskip-\DroppedIndent +% \vbox{\forgetall\box0}% +% \nobreak +% \let\next\ignorespaces} % Could be a one character word ! +% {\globaldropcaps\let\DroppedIndent\!!zeropoint +% \globaldropcaps\edef\DroppedLines{\number\maxdimen}% +% \globaldropcaps\chardef\DroppedStatus3 +% \def\next{#7}}% +% \let\globaldropcaps\global +% \next} + +\chardef\DropMode=0 % 1 == marginhang + \def\DroppedCaps#1#2#3#4#5#6#7% does not yet handle accented chars {\convertargument #7\to\asciia \convertcommand \DroppedString\to\asciib - \ExpandBothAfter\doifinstringelse{\asciia}{\asciib} + \ExpandBothAfter\doifinstringelse\asciia\asciib {\ifvmode % this one is \EveryPar save, precede by \par if needed \vskip#6\baselineskip \penalty-200 @@ -172,29 +213,40 @@ \ifhmode \hskip-\parindent \fi - \setbox0=\hbox - {\definefont[temp][#2 at #3]\temp#1{#7}\hskip#4}% + \setbox0\hbox + {\definedfont[#2 at #3]#1{#7}\hskip#4}% \ifdim\dp0>\dp\strutbox % one of those Q's , will be option - \setbox2=\hbox{\raise\dp0\hbox{\lower\dp\strutbox\copy0}}% - \ht2=\ht0 \dp0=\dp\strutbox \setbox0=\box2 + \setbox2\hbox{\raise\dp0\hbox{\lower\dp\strutbox\copy0}}% + \ht2\ht0 + \dp0\dp\strutbox + \setbox0\box2 + \fi + \setbox0\hbox + {\ifnum\DropMode=\plusone + \hskip-\wd0\wd0\zeropoint \fi - \setbox0=\hbox - {\lower#5\box0}% - \ht0=\ht\strutbox - \dp0=\dp\strutbox - \globaldropcaps\edef\DroppedIndent{\the\wd0}% - \globaldropcaps\edef\DroppedLines {\number#6}% - \globaldropcaps\chardef\DroppedStatus=2 - \globaldropcaps\hangindent\DroppedIndent - \globaldropcaps\hangafter-\DroppedLines - \noindent - \hskip-\DroppedIndent + \lower#5\box0}% + \ht0\ht\strutbox + \dp0\dp\strutbox + \ifnum\DropMode=\plusone + \globaldropcaps\let\DroppedIndent\!!zeropoint + \globaldropcaps\edef\DroppedLines{\number\maxdimen}% + \globaldropcaps\chardef\DroppedStatus3 + \else + \globaldropcaps\edef\DroppedIndent{\the\wd0}% + \globaldropcaps\edef\DroppedLines {\number#6}% + \globaldropcaps\chardef\DroppedStatus2 + \globaldropcaps\hangindent\DroppedIndent + \globaldropcaps\hangafter-\DroppedLines + \noindent + \hskip-\DroppedIndent + \fi \vbox{\forgetall\box0}% \nobreak - \let\next=\ignorespaces} % Could be a one character word ! - {\globaldropcaps\edef\DroppedIndent{0pt}% - \globaldropcaps\edef\DroppedLines {\number\maxdimen}% - \globaldropcaps\chardef\DroppedStatus=3 + \let\next\ignorespaces} % Could be a one character word ! + {\globaldropcaps\let\DroppedIndent\!!zeropoint + \globaldropcaps\edef\DroppedLines{\number\maxdimen}% + \globaldropcaps\chardef\DroppedStatus3 \def\next{#7}}% \let\globaldropcaps\global \next} @@ -210,10 +262,14 @@ %D Sometimes you need to make sure that the global settings are %D kept local, as in: %D +% %D \startbuffer +% %D \defineparagraphs[SomePar][n=2,rule=on] +% %D \setupparagraphs [SomePar][1][width=.5\textwidth] +% %D \setupparagraphs [SomePar][2][width=.5\textwidth] %D \startbuffer -%D \defineparagraphs[SomePar][n=2,rule=on] -%D \setupparagraphs [SomePar][1][width=.5\textwidth] -%D \setupparagraphs [SomePar][2][width=.5\textwidth] +%D \definieeralineas[SomePar][n=2,rule=on] +%D \stelalineasin [SomePar][1][width=.5\textwidth] +%D \stelalineasin [SomePar][2][width=.5\textwidth] %D %D \startSomePar %D \localdropcaps\NiceDroppedCaps{}{cmr12}{0pt}{2}Here we need @@ -241,18 +297,18 @@ \newcount\lastprevgraf \newcount\droppedlines -\def\CheckDroppedCaps% +\def\CheckDroppedCaps {\global\lastprevgraf\prevgraf} -\def\AutoDroppedCaps% will be proper core stuff since it - {\globaldropcaps\chardef\DroppedStatus=1 - \global\lastprevgraf=0 - \global\droppedlines=0 +\def\AutoDroppedCaps % will be proper core stuff since it + {\globaldropcaps\chardef\DroppedStatus\plusone + \global\lastprevgraf\zerocount + \global\droppedlines\zerocount \EveryPar{\doAutoDroppedCaps}} \let\AutoDroppedNext\relax -\def\doAutoDroppedCaps% +\def\doAutoDroppedCaps {\ifcase\DroppedStatus % done \let\next\relax \or % starting @@ -263,27 +319,27 @@ \def\next{\NiceDroppedCaps{}{\@@dcfont}{.125em}{\@@dcn}}% % \fi % and hope for the best \or % doing - \global\advance\droppedlines by \lastprevgraf - \ifnum\droppedlines=0 - \globaldropcaps\chardef\DroppedStatus=0 + \global\advance\droppedlines \lastprevgraf + \ifnum\droppedlines=\zerocount + \globaldropcaps\chardef\DroppedStatus\zerocount \let\next\relax - \else\ifnum\droppedlines>0 + \else\ifnum\droppedlines>\zerocount \ifnum\droppedlines<\DroppedLines\relax - \globaldropcaps\hangindent=\DroppedIndent - \globaldropcaps\hangafter=-\DroppedLines - \globaldropcaps\advance\hangafter by \droppedlines + \globaldropcaps\hangindent\DroppedIndent + \globaldropcaps\hangafter-\DroppedLines + \globaldropcaps\advance\hangafter \droppedlines \hskip-\parindent \let\next\AutoDroppedNext \else - \globaldropcaps\chardef\DroppedStatus=0 + \globaldropcaps\chardef\DroppedStatus\zerocount \let\next\relax \fi \else - \globaldropcaps\chardef\DroppedStatus=0 + \globaldropcaps\chardef\DroppedStatus\zerocount \let\next\relax \fi\fi \or % error - \globaldropcaps\chardef\DroppedStatus=0 + \globaldropcaps\chardef\DroppedStatus\zerocount \let\next\relax \fi \next} @@ -303,12 +359,12 @@ %D line height, a value that gives a pleasant grayness. \def\DoLineDroppedCaps#1#2#3#4#5% compensation command font offset lines - {\scratchcounter=#5% - \advance\scratchcounter by -1 - \scratchdimen=\scratchcounter\baselineskip - \advance\scratchdimen by #1% - \NormalizeFontHeight\DummyFont{W}{\scratchdimen}{#3}% - \DroppedCaps{#2}{#3}{\TheNormalizedFontSize}{#4} + {\scratchcounter#5% + \advance\scratchcounter \minusone + \scratchdimen\scratchcounter\baselineskip + \advance\scratchdimen #1% + \NormalizeFontHeight\DummyFont{W}\scratchdimen{#3}% + \DroppedCaps{#2}{#3}\TheNormalizedFontSize{#4} {\scratchcounter\baselineskip}{#5}} \def\LineDroppedCaps% command font offset lines @@ -358,29 +414,27 @@ \forgetall \bgroup #1% - \setbox0=\box\voidb@x - \setbox2=\box\voidb@x + \setbox0\box\voidb@x + \setbox2\box\voidb@x \def\grabfirstline##1 % - {\setbox2=\hbox + {\setbox2\hbox {\ifvoid0 {#3{\ignorespaces##1}}% \else \unhcopy0\ {#4{##1}}% \fi}% - \ifdim\wd2=\!!zeropoint - \setbox0=\box\voidb@x - \setbox2=\box\voidb@x - \let\next=\grabfirstline + \ifdim\wd2=\zeropoint + \setbox0\box\voidb@x + \setbox2\box\voidb@x + \@EA\grabfirstline \else\ifdim\wd2>\hsize \hbox to \hsize{\strut\unhbox0}#2\egroup \break##1\ \egroup - \let\next=\relax \else - \setbox0=\box2 - \let\next=\grabfirstline - \fi\fi - \next}% + \setbox0\box2 + \@EAEAES\grabfirstline + \fi\fi}% \grabfirstline} %D \startbuffer @@ -460,7 +514,7 @@ \def\StackCharacters#1#2#3#4% sequence vsize vskip command {\vbox #2 {\forgetall - \baselineskip0pt + \baselineskip\zeropoint \def\StackCharacter##1{#4{##1}\cr\noalign{#3}}% \halign {\hss##\hss&##\cr @@ -548,27 +602,27 @@ %D %D These are implemented using an auxilliary macro: -\def\NormalizeFontHeight% - {\NormalizeFontSize\ht} - -\def\NormalizeFontWidth% - {\NormalizeFontSize\wd} +\def\NormalizeFontHeight{\NormalizeFontSize\ht} +\def\NormalizeFontWidth {\NormalizeFontSize\wd} \def\NormalizeFontSize#1#2#3#4#5% {\bgroup \dimen0=#4% #4 can be \ht0 or so - \setbox0=\hbox{\definefont[temp][#5 at 10pt]\temp#3}% - \dimen2=#10 % #1 is \wd or \ht - \dimen4=10000pt - \divide\dimen4 by \dimen2 - \divide\dimen0 by 1000 - \dimen0=\number\dimen4\dimen0 - \xdef\TheNormalizedFontSize{\the\dimen0}% - \definefont[temp][#5 at \the\dimen0]% - \temp + \setbox0\hbox{\definedfont[#5 at 10pt]#3}% + \ifdim\wd0>\zeropoint + \dimen2=#10 % #1 is \wd or \ht + \dimen4=10000pt + \divide\dimen4 \dimen2 + \divide\dimen0 1000 + \dimen0=\number\dimen4\dimen0 + \xdef\TheNormalizedFontSize{\the\dimen0}% + \else + \dimen0\bodyfontsize + \fi + \definedfont[#5 at \the\dimen0]% \expandafter \egroup - \expandafter\font\expandafter#2\expandafter=\fontname\font\relax} + \expandafter\font\expandafter#2\fontname\font\relax} %D Afterwards, we have access to the calculated size by: @@ -616,7 +670,7 @@ %D \starttypen %D \NormalizeFontHeight {text} \DroppedFont {2\baselineskip} {cmbx12} %D -%D \def\NicelyDroppedCaps% +%D \def\NicelyDroppedCaps %D {\DroppedCaps %D {\kleur[groen]} %D {\DroppedFont} @@ -627,6 +681,79 @@ %D %D It's up to the reader to test this one. -\protect +%D For Hraban. + +\unexpanded\def\FirstNCharacters#1#2% \FirstNCharacters{3}{fr{\"o}beln} + {\bgroup + \scratchcounter\zerocount + \def\docommando##1% + {\ifnum\scratchcounter=#1\else + ##1\relax % catches ##1 = \"e and alike + \advance\scratchcounter\plusone + \fi} + \handletokens#2\with\docommando + \egroup} + +%D \macros +%D {FittingText} +%D +%D First used in Pascal (demo-bbv): +%D +%D \startbuffer +%D \ruledvbox{\FittingText{3cm}{1cm}{Serif}{24pt}{1pt}{1} +%D {\veryraggedright +%D \hangindent1em\hangafter1\relax +%D \begstrut \dorecurse{8}{Bram Marta }\unskip \endstrut}} +%D +%D \ruledvbox{\FittingText{3cm}{1cm}{Serif}{24pt}{1pt}{1} +%D {\raggedleft\begstrut Bram\\Marta \unskip\endstrut}} +%D \stopbuffer +%D +%D \typebuffer +%D +%D \startlinecorrection +%D \getbuffer +%D \stoplinecorrection + +% #1 width #2 height #3 font #4 size #5 step #6 interlinie #7 text + +\long\def\FittingText#1#2#3#4#5#6#7% + {\bgroup + \forgetall + \dontcomplain + \steltolerantiein[\v!zeersoepel]% == \tolerance4500 + \hsize#1% + \def\\{\softbreak}% + \!!heighta#4% + \!!heightb#2% + \doloop + {\ifdim\!!heighta>\!!onepoint + \expanded{\definefont[\s!dummy][#3 at \the\!!heighta][\c!interlinie=#6]}% + \getvalue\s!dummy + \setbox\scratchbox\vbox{#7\endgraf}% + \ifdim\ht\scratchbox>\!!heightb + \advance\!!heighta-#5% + \else + \beginshapebox + \unvcopy\scratchbox + \endshapebox + \global\dimen1\hsize + \reshapebox + {\setbox\shapebox\hbox{\unhbox\shapebox}% + \ifdim\wd\shapebox>\dimen1 + \global\dimen1\wd\shapebox + \fi}% + \ifdim\dimen1>\hsize + \advance\!!heighta-#5% + \else + \exitloop + \fi + \fi + \else + \exitloop + \fi}% + \writestatus{\strippedcsname\FittingText}{height: \the\!!heighta}% + \unvbox\scratchbox + \egroup} -\endinput +\protect \endinput diff --git a/tex/context/base/supp-lan.tex b/tex/context/base/supp-lan.tex index 4630bdbac..5f2c4cbcd 100644 --- a/tex/context/base/supp-lan.tex +++ b/tex/context/base/supp-lan.tex @@ -408,7 +408,8 @@ \def\defineactivecharacter #1 % {\scratchcounter\the\uccode\activehackcode - \uccode\activehackcode\expandafter\doifnumberelse\expandafter{\string#1}\empty`#1% + \uccode\activehackcode\expandafter\doifnumberelse + \expandafter{\string#1}\empty`#1% \catcode\uccode\activehackcode\@@active \uppercase{\def\next{~}}% \uccode\activehackcode\scratchcounter diff --git a/tex/context/base/supp-mat.tex b/tex/context/base/supp-mat.tex index fcd64b709..66357407c 100644 --- a/tex/context/base/supp-mat.tex +++ b/tex/context/base/supp-mat.tex @@ -19,7 +19,7 @@ \unprotect %D \macros -%D {mathematics, nomathematics, startmathmode} +%D {mathematics, math, nomathematics, startmathmode} %D %D The \type{$} can be both an begin and end math character. %D This can lead to confusing and errorprone situations when @@ -48,9 +48,9 @@ \def\mathematics#1% {\ifmmode#1\else$#1$\fi} -\def\startmathmode% +\def\startmathmode {\ifmmode - \let\stopmathmode=\relax + \let\stopmathmode\relax \else $\def\stopmathmode{$}% \let\stopmathmode=$ \fi} @@ -58,6 +58,8 @@ \def\nomathematics#1% {\ifmmode\hbox{#1}\else#1\fi} +\let\math\mathematics + %D \macros %D {dimension, nodimension} %D @@ -73,8 +75,8 @@ \unexpanded\def\dimension#1% {\def\dodimensionsignal{\kern\dimensionsignal}% - \ifdim\lastskip=\!!zeropoint\relax - \ifdim\lastkern=\!!zeropoint\relax + \ifdim\lastskip=\zeropoint\relax + \ifdim\lastkern=\zeropoint\relax \ifmmode \mathematics{\dimensionhalfspace\dimensionhalfspace\dimensiontypeface#1}% \else @@ -108,7 +110,7 @@ \newevery\everysupersub \EverySuperSub -\appendtoks \advance\supersubmode by 1\relax \to \everysupersub +\appendtoks \advance\supersubmode 1\relax \to \everysupersub % \def\dodosuper#1{\normalsuper{\the\everysupersub#1}} % \def\dodosuber#1{\normalsuber{\the\everysupersub#1}} @@ -131,7 +133,7 @@ \bgroup \catcode`\^=\@@active \catcode`\_=\@@active -\gdef\enablesupsub% +\gdef\enablesupsub {\catcode`\^=\@@active \def^{\ifmmode\expandafter\super\else\expandafter\normalsuper\fi}% \catcode`\_=\@@active @@ -144,7 +146,7 @@ %D We can pick up the current math style by calling \type %D {\restoremathstyle}. -\def\restoremathstyle% +\def\restoremathstyle {\ifmmode \ifcase\supsubmode \textstyle @@ -155,6 +157,4 @@ \fi \fi} -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/supp-mis.tex b/tex/context/base/supp-mis.tex index 631f8f557..ff4724072 100644 --- a/tex/context/base/supp-mis.tex +++ b/tex/context/base/supp-mis.tex @@ -64,12 +64,11 @@ \long\def\ifnocontextobject#1\do% {\ifx#1\undefined - \let\next=\definecontextobject + \expandafter\definecontextobject \else %\writestatus{system}{beware of conflicting \string#1}% - \let\next=\gobblecontextobject - \fi - \next} + \expandafter\gobblecontextobject + \fi} %D \macros %D {beginETEX,beginTEX} @@ -108,7 +107,7 @@ \ifnocontextobject \protect \do - \let\protect=\relax + \let\protect\relax \fi @@ -160,7 +159,18 @@ \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 \zerocount \do \chardef \zerocount=0 \fi +\ifnocontextobject \plusone \do \chardef \plusone =1 \fi +\ifnocontextobject \minusone \do \newcount \minusone \fi + +\ifnocontextobject \thousandpoint \do \newdimen \thousandpoint \fi + +\thousandpoint=1000pt +\minusone = -1 + +\ifnocontextobject \emptytoks \do \newtoks \emptytoks \fi \ifnocontextobject \nextbox \do \newbox \nextbox \fi \ifnocontextobject \nextdepth \do \newdimen \nextdepth \fi @@ -189,15 +199,19 @@ \ifnocontextobject \@@active \do \chardef\@@active = 13 \fi \ifnocontextobject \@@comment \do \chardef\@@comment = 14 \fi +\def\s!sp{sp} +\def\s!pt{pt} +\def\s!bp{bp} + %D \macros %D {@EA,expanded,expandoneargafter,expandtwoargsafter} %D %D Also needed: -\let\@EA=\expandafter +\let\@EA=\expandafter \let\@@expanded\empty \def\expanded#1% - {\edef\@@expanded{\noexpand#1}\@@expanded} + {\long\xdef\@@expanded{\noexpand#1}\@@expanded} \def\expandoneargafter#1#2% {\@EA#1\@EA{#2}} @@ -205,6 +219,8 @@ \def\expandtwoargsafter#1#2#3% {\@EA\@EA\@EA#1\@EA\@EA\@EA{\@EA#2\@EA}\@EA{#3}} +\def\@EAEAEA{\@EA\@EA\@EA} + %D \macros %D {everyline,EveryLine,EveryPar} %D @@ -217,6 +233,11 @@ \ifnocontextobject \EveryLine \do \let\EveryLine=\everyline \fi %D \macros +%D {globallet} + +\def\globallet{\global\let} + +%D \macros %D {!!...} %D %D We reserve ourselves some scratch strings (i.e. macros) @@ -237,6 +258,7 @@ %D Furthermore it saves memory. \ifnocontextobject \!!zeropoint \do \def\!!zeropoint {0pt} \fi +\ifnocontextobject \!!zerocount \do \def\!!zerocount {0} \fi \ifnocontextobject \!!tenthousand \do \def\!!tenthousand {10000} \fi \ifnocontextobject \!!width \do \def\!!width {width} \fi @@ -283,7 +305,9 @@ \fi %D \macros -%D {setvalue,setevalue,setxvalue,getvalue,letvalue,setgvalue} +%D {setvalue,setevalue,setxvalue,,setgvalue, +%D getvalue, +%D letvalue,letgvalue} %D %D The next two macros expand their argument to %D \type{\argument}. The first one is used to define macro's @@ -297,7 +321,7 @@ \def\setxvalue#1{\expandafter\xdef\csname#1\endcsname} \def\getvalue #1{\csname#1\endcsname} \def\letvalue #1{\expandafter\let\csname#1\endcsname} - + \def\letgvalue#1{\global\expandafter\let\csname#1\endcsname} \fi %D \macros @@ -309,7 +333,7 @@ \ifnocontextobject \unexpanded \do - \let\unexpanded=\relax + \let\unexpanded\relax \fi @@ -399,7 +423,7 @@ \fileprocessedtrue \gdef\dofinishfile% {\closein#1\relax - \global\let\doprocessline=\relax}% + \global\let\doprocessline\relax}% \gdef\doprocessline% {\ifeof#1% \dofinishfile @@ -464,7 +488,7 @@ %D Some \CONTEXT\ low level macros can have a \type{\doglobal} %D prefix. Let's just forget about that here: -\ifnocontextobject \doglobal \do \let\doglobal=\relax \fi +\ifnocontextobject \doglobal \do \let\doglobal\relax \fi %D The next obscure one is needed in the generic verbatim %D environment. When we end up with more of these, it's time @@ -629,6 +653,22 @@ \let\donothing\empty +%D Also new: + +\def\letempty #1{\let#1\empty} +\def\globalletempty#1{\global\let#1\empty} + +\def\letvalueempty #1{\expandafter\let\csname#1\endcsname\empty} +\def\letgvalueempty#1{\global\expandafter\let\csname#1\endcsname\empty} + +%D Sigh + +\def\settrue #1{\chardef#1\zerocount} +\def\setfalse#1{\chardef#1\plusone} + +\let\newconditional = \setfalse +\let\ifconditional = \ifcase + %D That's it. Please forget this junk and take a look at how %D it should be done. diff --git a/tex/context/base/supp-mpe.tex b/tex/context/base/supp-mpe.tex index 222a1947e..3068b94e0 100644 --- a/tex/context/base/supp-mpe.tex +++ b/tex/context/base/supp-mpe.tex @@ -11,6 +11,13 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% fuzzy and complicating is the fact that we need to support +% context as well as mptopdf, so we cannot fall back on the +% special drivers and color module (although there may be +% good reasons to use a smaller context instead); also, +% shading is handled here while it should move to the special +% driver - to do! + %D This module is still experimental and deals with some %D extensions to \METAPOST. When using \POSTSCRIPT\ output, %D these extensions can be supplied by means of proper @@ -95,8 +102,8 @@ \def\dohandleMPspecialcomment#1 {\setMPargument{#1}% - \advance\scratchcounter -1 - \ifcase\scratchcounter\relax + \advance\scratchcounter \minusone + \ifcase\scratchcounter \handleMPspecialcommand \donetrue \doresetMPstack @@ -108,13 +115,13 @@ \def\handleMPspecialcomment #1 % number of arguments {\doresetMPstack - \scratchcounter=#1\relax + \scratchcounter#1\relax \ifcase\scratchcounter % when zero, inline shading is used - \chardef\inlineMPspecials1 + \chardef\inlineMPspecials\plusone \let\handleMPsequence\dohandleMPsequence \expandafter\handleMPsequence \else - \chardef\inlineMPspecials0 + \chardef\inlineMPspecials\zerocount \expandafter\dohandleMPspecialcomment \fi} @@ -122,9 +129,9 @@ %D definitions. Actually, this macro is called by the %D previous ones. -\def\handleMPspecialcommand% +\def\handleMPspecialcommand {\ifcase\inlineMPspecials\or - \advance\nofMParguments -1 % pop the size + \advance\nofMParguments \minusone % pop the size \fi \ifundefined\MPspecial \message{[unknown \MPspecial]}% @@ -143,9 +150,9 @@ \def\handleMPspecialscomment #1.#2 #3 % version.revision signal {\doresetMPstack - \chardef\MPspecialversion #1 - \chardef\MPspecialrevision#2 - \chardef\MPspecialsignal #3 + \chardef\MPspecialversion #1% + \chardef\MPspecialrevision#2% + \chardef\MPspecialsignal #3% \let\handleMPsequence\dohandleMPsequence \handleMPsequence} @@ -154,14 +161,14 @@ \newtoks\MPstartresources \newtoks\MPstopresources -\def\startMPresources% +\def\startMPresources {\the\MPstartresources \ifx\currentPDFresources\empty\else \message{[unused resources]}% \fi \global\let\currentPDFresources\empty} -\def\stopMPresources% +\def\stopMPresources {\let\currentPDFresources\empty \the\MPstopresources} @@ -171,13 +178,15 @@ %D {0.001} is the first path and \type {0.010} the tenth. Since %D \METAPOST strips trailing zeros, we have to padd the string. -\newif\ifMPcmyk +\newif\ifMPcmykcolors +\newif\ifMPspotcolors \ifx\normalhandleMPrgbcolor\undefined % in case we reload this module \let\normalhandleMPrgbcolor \handleMPrgbcolor \let\normalhandleMPcmykcolor\handleMPcmykcolor \let\normalhandleMPgraycolor\handleMPgraycolor + \let\normalhandleMPspotcolor\handleMPspotcolor \fi @@ -194,7 +203,7 @@ \ifCONTEXT % we can use this for a better xgstate handling - \def\checkPDFMPstrokecolor% + \def\checkPDFMPstrokecolor {\ifPDFMPstrokecolor \PDFstrokecolortrue \fi} \def\normalhandleMPrgbcolor @@ -206,6 +215,9 @@ \def\normalhandleMPgraycolor {{\checkPDFMPstrokecolor\execcolorS\gMPa1:0:0\od}} + \def\normalhandleMPspotcolor + {{\checkPDFMPstrokecolor\execcolorP\gMPa1:\gMPa2:0:0\od}} + \fi % In the previous macros we use the special drivers. A more @@ -256,7 +268,7 @@ % % speed up: -\def\setMPcolor% +\def\setMPcolor {\edef\lastMPrvalue{\csname\@@MP01\endcsname}% \edef\lastMPgvalue{\csname\@@MP02\endcsname}% \edef\lastMPbvalue{\csname\@@MP03\endcsname}} @@ -270,41 +282,45 @@ \resetMPcolor -% \def\handleMPrgbcolor% -% {\ifcase\MPspecialversion -% \normalhandleMPrgbcolor -% \else -% \setMPcolor -% \ifnum\MPrgbnumber\lastMPrvalue=\MPspecialsignal\relax -% \ifMPcmyk \interceptMPcmykcolor \fi -% \else -% \resetMPcolor\normalhandleMPrgbcolor -% \fi -% \fi} - \def\@@MPSK{@MPSK@} +\def\@@MPSP{@MPSP@} -\def\interceptMPcmykcolor % todo : \ifMPcmyk +\def\interceptMPcmykcolor % todo : \ifMPcmykcolors {\ifcase\MPrgbnumber\lastMPgvalue % cannot happen \or % 1 == cmyk color spec - \ifMPcmyk \dointerceptMPcmykcolor \fi + \ifMPcmykcolors \dointerceptMPcmykcolor \fi + \or + % 2 == spot color + \ifMPspotcolors \dointerceptMPspotcolor \fi \or - % 2 == rgb transparency + % 3 == rgb transparency \invokeMPtransparencyspecial + \or + % 4 == cmyk transparency + \ifMPcmykcolors \invokeMPtransparencyspecial \fi + \or + % 5 == spot transparency + \ifMPspotcolors \invokeMPtransparencyspecial \fi \else - % 3 == cmyk transparency - \ifMPcmyk \invokeMPtransparencyspecial \fi + % \writestatus{MPtoPDF}{unknown direct special}% \fi} -\def\dointerceptMPcmykcolor % can be used often, so sped up +\def\dointerceptMPcmykcolor {\revokeMPtransparencyspecial \@EA\ifx\csname\@@MPSK\number\MPrgbnumber\lastMPbvalue\endcsname\relax\else \@EA\@EA\@EA\setMPcmyk\csname\@@MPSK\number\MPrgbnumber\lastMPbvalue\endcsname \normalhandleMPcmykcolor \fi} +\def\dointerceptMPspotcolor + {\revokeMPtransparencyspecial + \@EA\ifx\csname\@@MPSP\number\MPrgbnumber\lastMPbvalue\endcsname\relax\else + \@EA\@EA\@EA\setMPspot\csname\@@MPSP\number\MPrgbnumber\lastMPbvalue\endcsname + \normalhandleMPspotcolor + \fi} + \def\handleMPrgbcolor {\resetMPcolor \ifcase\MPspecialversion @@ -341,12 +357,12 @@ \newtoks \invokeMPspecials -\def\finishMPpath% +\def\finishMPpath {\PDFcode {\ifcase\finiMPpath W n\or S\or f\or B\else W n\fi \extraMPpathcode}} -\def\processMPpath% +\def\processMPpath {\checkMPpath % ! \ifcase\nofMPsegments\else \let\extraMPpathcode\empty @@ -510,8 +526,8 @@ \def\startMPshading#1% {\edef\currentMPspecial{\gMPs{#1}}} -\def\stopMPshading% - {\global\advance\currentPDFshade 1 +\def\stopMPshading + {\global\advance\currentPDFshade \plusone \setxvalue{obj:Sh:\currentMPspecial}% {/Sh\the\currentPDFshade\space\the\pdflastobj\space0 R }% \setxvalue{mps:Sh:\currentMPspecial}% @@ -522,19 +538,19 @@ \to \MPstartresources \appendtoks - \ifx\currentMPshades\empty \else - \xdef\currentPDFresources{\currentPDFresources - /Shading <<\currentMPshades>>}% - \fi + \ifx\currentMPshades\empty \else + \xdef\currentPDFresources{\currentPDFresources + /Shading <<\currentMPshades>>}% + \fi \to \MPstopresources -\def\invokeMPshadespecial% +\def\invokeMPshadespecial {\doifdefined{mps:Sh:\currentMPspecial} {\edef\currentMPshade{\getvalue{obj:Sh:\currentMPspecial}}% - \doifinstringelse{\currentMPshade}{\currentMPshades} - {}{\xdef\currentMPshades{\currentMPshades\currentMPshade}}% + \doifinstringelse\currentMPshade\currentMPshades \donothing + {\xdef\currentMPshades{\currentMPshades\currentMPshade}}% \def\extraMPpathcode{/Sh\getvalue{mps:Sh:\currentMPspecial} sh Q}% - \chardef\finiMPpath=0 + \chardef\finiMPpath\zerocount \PDFcode{q /Pattern cs}}} \appendtoks \invokeMPshadespecial \to \invokeMPspecials @@ -542,64 +558,130 @@ %D We need to convert the \CMYK\ specials into colors, because %D we have to do it twice, we define a macro. +% \def\checkMPshadingcolor#1#2#3#4#5% +% {\edef\tempMPrvalue{\csname\@@MP0#1\endcsname}% +% \edef\tempMPgvalue{\csname\@@MP0#2\endcsname}% +% \edef\tempMPbvalue{\csname\@@MP0#3\endcsname}% +% \edef#5% +% {\ifx\tempMPrvalue\tempMPgvalue +% \ifx\tempMPrvalue\tempMPbvalue +% \ifx\tempMPgvalue\tempMPbvalue +% \tempMPbvalue +% \fi +% \fi +% \fi}% +% \edef#4% todo : spotcolors +% {\ifnum\MPrgbnumber\tempMPrvalue=\MPspecialsignal\space +% \ifMPcmykcolors\getvalue{\@@MPSK\number\MPrgbnumber\tempMPbvalue}\fi +% \fi}} + \def\checkMPshadingcolor#1#2#3#4#5% {\edef\tempMPrvalue{\csname\@@MP0#1\endcsname}% \edef\tempMPgvalue{\csname\@@MP0#2\endcsname}% \edef\tempMPbvalue{\csname\@@MP0#3\endcsname}% - \edef#5% - {\ifx\tempMPrvalue\tempMPgvalue - \ifx\tempMPrvalue\tempMPbvalue - \ifx\tempMPgvalue\tempMPbvalue - \tempMPbvalue - \fi - \fi - \fi}% - \edef#4% - {\ifnum\MPrgbnumber\tempMPrvalue=\MPspecialsignal\space - \ifMPcmyk\getvalue{\@@MPSK\number\MPrgbnumber\tempMPbvalue}\fi - \fi}} + \global\let\MPresolvedspace\MPgrayspace + \global\let\MPresolvedcolor\!!zerocount + \ifnum\MPrgbnumber\tempMPrvalue=\MPspecialsignal\relax + \ifcase\MPrgbnumber\tempMPgvalue + \or % 1 = cmyk + \ifMPcmykcolors + \expanded{\resolveMPcmykcolor\getvalue{\@@MPSK\number\MPrgbnumber\tempMPbvalue}}\end + \fi + \or % 2 = spot + \ifMPspotcolors + \expanded{\resolveMPspotcolor\getvalue{\@@MPSP\number\MPrgbnumber\tempMPbvalue}}\end + \fi + \fi + \else + \ifx\tempMPrvalue\tempMPgvalue + \ifx\tempMPrvalue\tempMPbvalue + \expanded{\resolveMPgraycolor\tempMPbvalue}\end + \else + \expanded{\resolveMPrgbcolor\tempMPrvalue\space\tempMPgvalue\space\tempMPbvalue}\end + \fi + \else + \expanded{\resolveMPrgbcolor\tempMPrvalue\space\tempMPgvalue\space\tempMPbvalue}\end + \fi + \fi + \let#4\MPresolvedcolor + \let#5\MPresolvedspace} %D We also need to make sure that we have two \RGB\ or %D \CMYK colors, since we have to set the colorspace. -\def\setMPshadingcolors#1#2#3#4#5#6% - {\checkMPshadingcolor{#1}{#2}{#3}\MPshadeA\MPshadeAA - \checkMPshadingcolor{#4}{#5}{#6}\MPshadeB\MPshadeBB - \ifx\MPshadeA\empty - \ifx\MPshadeB\empty - \edef\MPshadeA{\gMPs{#1} \gMPs{#2} \gMPs{#3}}% - \edef\MPshadeB{\gMPs{#4} \gMPs{#5} \gMPs{#6}}% - \def \MPshadeC{RGB}% +% \def\setMPshadingcolors#1#2#3#4#5#6% +% {\checkMPshadingcolor{#1}{#2}{#3}\MPshadeA\MPshadeAA +% \checkMPshadingcolor{#4}{#5}{#6}\MPshadeB\MPshadeBB +% \ifx\MPshadeA\empty +% \ifx\MPshadeB\empty +% \edef\MPshadeA{\gMPs{#1} \gMPs{#2} \gMPs{#3}}% +% \edef\MPshadeB{\gMPs{#4} \gMPs{#5} \gMPs{#6}}% +% \def \MPshadeC{RGB}% +% \else +% \ifx\MPshadeAA\empty +% \let\MPshadeA\MPcmykWhite +% \let\MPshadeB\MPcmykBlack +% \else +% \scratchdimen\!!onepoint +% \advance\scratchdimen -\MPshadeAA\s!pt +% \edef\MPshadeA{0 0 0 \withoutpt\the\scratchdimen}% +% \fi +% \def\MPshadeC{CMYK}% +% \fi +% \else +% \ifx\MPshadeB\empty +% \ifx\MPshadeBB\empty +% \let\MPshadeA\MPcmykWhite +% \let\MPshadeB\MPcmykBlack +% \else +% \scratchdimen\!!onepoint +% \advance\scratchdimen -\MPshadeBB\s!pt +% \edef\MPshadeB{0 0 0 \withoutpt\the\scratchdimen}% +% \fi +% \fi +% \def\MPshadeC{CMYK}% +% \fi} + +\def\setMPshadingcolors#1#2#3#4#5#6% color space + {\checkMPshadingcolor{#1}{#2}{#3}\MPshadeAc\MPshadeAs + \checkMPshadingcolor{#4}{#5}{#6}\MPshadeBc\MPshadeBs + \ifx\MPshadeAs\MPshadeBs + \let\MPshadeA\MPshadeAc + \let\MPshadeB\MPshadeBc + \let\MPshadeC\MPshadeAs + \else\ifx\MPshadeAs\MPgrayspace + \ifx\MPshadeBs\MPrgbspace + \edef\MPshadeA{\MPshadeAc\space\MPshadeAc\space\MPshadeAc}% \else - \ifx\MPshadeAA\empty - \let\MPshadeA\MPcmykWhite - \let\MPshadeB\MPcmykBlack - \else - \scratchdimen=1pt\advance\scratchdimen -\MPshadeAA pt - \edef\MPshadeA{0 0 0 \withoutpt\the\scratchdimen}% - \fi - \def\MPshadeC{CMYK}% + \negatecolorcomponent\MPshadeAc + \edef\MPshadeA{0 0 0 \MPshadeAc}% \fi - \else - \ifx\MPshadeB\empty - \ifx\MPshadeBB\empty - \let\MPshadeA\MPcmykWhite - \let\MPshadeB\MPcmykBlack - \else - \scratchdimen=1pt\advance\scratchdimen -\MPshadeBB pt - \edef\MPshadeB{0 0 0 \withoutpt\the\scratchdimen}% - \fi + \let\MPshadeB\MPshadeBc + \let\MPshadeC\MPshadeBs + \else\ifx\MPshadeBs\MPgrayspace + \let\MPshadeA\MPshadeAc + \ifx\MPshadeAs\MPrgbspace + \edef\MPshadeB{\MPshadeBc\space\MPshadeBc\space\MPshadeBc}% + \else + \negatecolorcomponent\MPshadeBc + \edef\MPshadeB{0 0 0 \MPshadeBc}% \fi - \def\MPshadeC{CMYK}% - \fi} + \let\MPshadeC\MPshadeAs + \else + % different color spaces + \def\MPshadeA{1}% + \def\MPshadeB{1}% + \let\MPshadeC\MPgrayspace + \fi\fi\fi} + +\let\MPshadeA\MPcmykWhite +\let\MPshadeB\MPcmykBlack +\let\MPshadeC\MPgrayspace %D The reason why this macro is a bit complicates is that we %D handle black and white situations (otherwise we would have %D to use \CMYK\ b/w in case of a \CMYK\ shade). -\def\MPcmykBlack{0 0 0 0} -\def\MPcmykWhite{0 0 0 1} - %D Here are the special handlers: \defineMPspecial{30} @@ -613,7 +695,7 @@ /N \gMPs3>>}% \immediate\pdfobj {<</ShadingType 2 - /ColorSpace /Device\MPshadeC\space + /ColorSpace /\MPshadeC\space /Function \the\pdflastobj\space 0 R /Coords [\gMPs7 \gMPs8 \gMPs{12} \gMPs{13}] /Extend [true true]>>}% @@ -630,7 +712,7 @@ /N \gMPs3>>}% \immediate\pdfobj {<</ShadingType 3 - /ColorSpace /Device\MPshadeC\space + /ColorSpace /\MPshadeC\space /Function \the\pdflastobj\space 0 R /Coords [\gMPs7 \gMPs8 \gMPs9 \gMPs{13} \gMPs{14} \gMPs{15}] /Extend [true true]>>}% @@ -669,7 +751,7 @@ {\ifcase\pdfoutput\or % will be hooked into the special driver \doiffileelse{#7} {\doifundefinedelse{mps:x:#7} - {\immediate\pdfximage width 1bp height 1bp {#7}% + {\immediate\pdfximage\!!width1\s!bp\!!height1\s!bp{#7}% \setxvalue{mps:x:#7}{\pdfrefximage\the\pdflastximage}}% {\message{[reusing figure #7]}}% \pdfliteral{q #1 #2 #3 #4 #5 #6 cm}% @@ -708,20 +790,20 @@ \def\handleMPhyperlink#1#2#3#4#5% {%\ifcase\pdfoutput\or - \setbox\scratchbox=\hbox - {\setbox\scratchbox=\null - \scratchdimen=#1bp\scratchdimen=-\scratchdimen - \advance\scratchdimen#3bp - \wd\scratchbox=\scratchdimen - \scratchdimen=#2bp\scratchdimen=-\scratchdimen - \advance\scratchdimen#4bp - \ht\scratchbox=\scratchdimen + \setbox\scratchbox\hbox + {\setbox\scratchbox\null + \scratchdimen#1\s!bp\scratchdimen-\scratchdimen + \advance\scratchdimen#3\s!bp + \wd\scratchbox\scratchdimen + \scratchdimen#2bp\scratchdimen-\scratchdimen + \advance\scratchdimen#4\s!bp + \ht\scratchbox\scratchdimen \incolorfalse \gotobox{\box\scratchbox}[#5]}% - \setbox\scratchbox=\hbox - {\scratchdimen\MPxoffset bp \advance\scratchdimen#1bp + \setbox\scratchbox\hbox + {\scratchdimen\MPxoffset\s!bp\advance\scratchdimen#1\s!bp \hskip\scratchdimen - \scratchdimen=\MPyoffset bp \advance\scratchdimen#2bp + \scratchdimen\MPyoffset\s!bp\advance\scratchdimen#2\s!bp \raise\scratchdimen\box\scratchbox}% \smashbox\scratchbox \box\scratchbox @@ -765,7 +847,7 @@ %D {\setupcolors[cmyk=ja,status=start]\haalbuffer[cmyk]} \defineMPspecial{1} - {\ifMPcmyk + {\ifMPcmykcolors \setxvalue{\@@MPSK\gMPs1}{\gMPs2 \gMPs3 \gMPs4 \gMPs5 }% \fi} @@ -775,6 +857,30 @@ \setvalue{\@@MP03}{#3}% \setvalue{\@@MP04}{#4}} +%\defineMPspecial{2} +% {\ifMPspotcolors +% \setxvalue{\@@MPSP\gMPs1}{\gMPs2 \gMPs3 }% +% \fi} + + +\defineMPspecial{2} + {\ifMPspotcolors + \setxvalue{\@@MPSP\gMPs1}{\gMPs2 \gMPs3 }% + \checkMPspot{\gMPs2}{\gMPs3}% + \fi} + +\def\setMPspot#1 #2 % + {\setvalue{\@@MP01}{#1}% + \setvalue{\@@MP02}{#2}} + +\def\checkMPspot#1#2% + {\expanded{\resolveMPspotcolor#1 #2}\end + \ifx\MPspotspace\MPresolvedspace + \edef\MPspotspacespec{/\MPspotspace\space}% + \doifinstringelse\MPspotspacespec\currentMPcolorspaces + \donothing\registerMPcolorspace + \fi} + %D This special (number 50) passes positions to a tex file. %D This method uses a two||pass approach an (mis|)|used the %D context positioning macros. In \type {core-pos} we will @@ -825,17 +931,17 @@ \defineMPspecial{50} % x y width height label {\bgroup - \scratchdimen\MPllx bp \scratchdimen-\scratchdimen - \advance\scratchdimen\gMPs1bp + \scratchdimen\MPllx\s!bp \scratchdimen-\scratchdimen + \advance\scratchdimen\gMPs1\s!bp \edef\x{\number\scratchdimen}% - \scratchdimen\gMPs2bp \scratchdimen-\scratchdimen - \advance\scratchdimen\MPury bp + \scratchdimen\gMPs2\s!bp \scratchdimen-\scratchdimen + \advance\scratchdimen\MPury\s!bp \edef\y{\number\scratchdimen}% - \scratchdimen\gMPs3bp + \scratchdimen\gMPs3\s!bp \edef\w{\number\scratchdimen}% - \scratchdimen\gMPs4bp + \scratchdimen\gMPs4\s!bp \edef\h{\number\scratchdimen}% - \dosavepositionwhd{\gMPs5}{0}{\x}{\y}{\w}{\h}{0}% + \dosavepositionwhd{\gMPs5}0\x\y\w\h0% \egroup} %D Transparency support used specials 60 (rgb) and 61 @@ -884,23 +990,84 @@ \edef\PDFtransparencyreference {#2}% \edef\PDFtransparencycolorspecs{#3}} -\defineMPspecial{2} +\def\PDFtransparencyspec + {\ifx\MPresolvedspace\MPgrayspace + \MPresolvedcolor\space g \MPresolvedcolor\space G% + \else\ifx\MPresolvedspace\MPrgbspace + \MPresolvedcolor\space rg \MPresolvedcolor\space RG% + \else\ifx\MPresolvedspace\MPcmykspace + \MPresolvedcolor\space k \MPresolvedcolor\space K% + \else\ifx\MPresolvedspace\empty\else + /\MPresolvedspace\space cs \MPresolvedcolor\space sc + /\MPresolvedspace\space CS \MPresolvedcolor\space SC% + \fi\fi\fi\fi} + +\defineMPspecial{3} % rgb {\edef\currentMPspecial{\gMPs6}% \presetPDFtransparency{\gMPs1}{\gMPs2}% + \expanded{\resolveMPrgbcolor\gMPs3 \gMPs4 \gMPs5}\end \setevalue{\@@MPST\currentMPspecial}% was \setxvalue, bug ! {\noexpand\assignMPStransparency {\PDFtransparencyidentifier}% {\PDFtransparencyreference}% - {\gMPs3 \gMPs4 \gMPs5 rg \gMPs3 \gMPs4 \gMPs5 RG}}} + {\PDFtransparencyspec}}} -\defineMPspecial{3} +\defineMPspecial{4} % cmyk {\edef\currentMPspecial{\gMPs7}% \presetPDFtransparency{\gMPs1}{\gMPs2}% + \expanded{\resolveMPcmykcolor\gMPs3 \gMPs4 \gMPs5 \gMPs6}\end + \setevalue{\@@MPST\currentMPspecial}% was \setxvalue, bug ! + {\noexpand\assignMPStransparency + {\PDFtransparencyidentifier}% + {\PDFtransparencyreference}% + {\PDFtransparencyspec}}} + +%\defineMPspecial{5} % spot +% {\edef\currentMPspecial{\gMPs5}% +% \presetPDFtransparency{\gMPs1}{\gMPs2}% +% \expanded{\resolveMPspotcolor\gMPs3 \gMPs4}\end +% \ifx\MPspotspace\MPresolvedspace +% \edef\MPspotspacespec{/\MPspotspace\space}% +% \doifinstringelse\MPspotspacespec\currentMPcolorspaces +% \donothing\registerMPcolorspace +% \fi +% \setevalue{\@@MPST\currentMPspecial}% was \setxvalue, bug ! +% {\noexpand\assignMPStransparency +% {\PDFtransparencyidentifier}% +% {\PDFtransparencyreference}% +% {\PDFtransparencyspec}}} + +\defineMPspecial{5} % spot + {\edef\currentMPspecial{\gMPs5}% + \presetPDFtransparency{\gMPs1}{\gMPs2}% + \checkMPspot{\gMPs3}{\gMPs4}% \setevalue{\@@MPST\currentMPspecial}% was \setxvalue, bug ! {\noexpand\assignMPStransparency {\PDFtransparencyidentifier}% {\PDFtransparencyreference}% - {\gMPs3 \gMPs4 \gMPs5 \gMPs6 k \gMPs3 \gMPs4 \gMPs5 \gMPs6 K}}} + {\PDFtransparencyspec}}} + +% beware: for the moment only supported in pdftex; needs a cleanup! + +\def\registerMPcolorspace + {\doifobjectreferencefoundelse{PDFCS}\MPspotspace + {\doPDFgetobjectreference{PDFCS}\MPspotspace\PDFobjectreference + \xdef\currentMPcolorspaces + {\currentMPcolorspaces\MPspotspacespec\PDFobjectreference\space}} + \donothing} + +%D We need to add resource specifications! + +\appendtoks + \global\let\currentMPcolorspaces\empty +\to \MPstartresources + +\appendtoks + \ifx\currentMPcolorspaces\empty \else + \xdef\currentPDFresources{\currentPDFresources + /ColorSpace <<\currentMPcolorspaces>>}% + \fi +\to \MPstopresources %D For efficiency reasons, we fall back on the allocation %D mechanisms already present. For use within \MPTOPDF, we @@ -1014,7 +1181,7 @@ \def\presetPDFtransparency#1#2% {\initializePDFtransparency \@EA\ifx\csname\@@MPSTO#1:#2\endcsname\relax - \global\advance\PDFcurrenttransparency 1 + \global\advance\PDFcurrenttransparency \plusone \immediate\pdfobj{\PDFtransparencydictionary{#1}{#2}{}}% \setxvalue{\@@MPSTN#1:#2}{\the\PDFcurrenttransparency}% \setxvalue{\@@MPSTO#1:#2}{\the\pdflastobj}% @@ -1047,4 +1214,76 @@ %D In all cases, we need to keep track of the resources %D used. +%D A few auxiliary macros: + +\def\MPgrayspace{DeviceGray} +\def\MPrgbspace {DeviceRGB} +\def\MPcmykspace{DeviceCMYK} +\let\MPspotspace\MPgrayspace + +\def\MPcmykBlack{0 0 0 0} +\def\MPcmykWhite{0 0 0 1} + +\ifCONTEXT + + \def\startMPcolorresolve + {\bgroup + \def\dostartgraycolormode##1% + {\global\let\MPresolvedspace\MPgrayspace + \xdef\MPresolvedcolor{##1}}% + \def\dostartrgbcolormode ##1##2##3% + {\global\let\MPresolvedspace\MPrgbspace + \xdef\MPresolvedcolor{##1 ##2 ##3}}% + \def\dostartcmykcolormode##1##2##3##4% + {\global\let\MPresolvedspace\MPcmykspace + \xdef\MPresolvedcolor{##1 ##2 ##3 ##4}}% + \def\dostartspotcolormode##1##2% + {\global\let\MPspotspace\empty + \xdef\MPresolvedspace{##1}% + \xdef\MPresolvedcolor{##2}% + \global\let\MPspotspace\MPresolvedspace}% signal + \dostartgraycolormode\!!zerocount} % kind of hackery initialization + + \let\stopMPcolorresolve\egroup + + \def\resolveMPrgbcolor#1 #2 #3\end + {\startMPcolorresolve + \execcolorR#1:#2:#3:0:0\od + \stopMPcolorresolve} + + \def\resolveMPcmykcolor#1 #2 #3 #4\end + {\startMPcolorresolve + \execcolorC#1:#2:#3:#4:0:0\od + \stopMPcolorresolve} + + \def\resolveMPgraycolor#1\end + {\startMPcolorresolve + \execcolorS#1:0:0\od + \stopMPcolorresolve} + + \def\resolveMPspotcolor#1 #2\end + {\startMPcolorresolve + \execcolorP#1:#2:0:0\od + \stopMPcolorresolve} + +\else + + \def\resolveMPspotcolor#1 #2\end + {\global\let\MPresolvedspace\MPgrayspace + \xdef\MPresolvedcolor{0}} + + \def\resolveMPrgbcolor#1 #2 #3\end + {\global\let\MPresolvedspace\MPrgbspace + \xdef\MPresolvedcolor{#1 #2 #3}} + + \def\resolveMPcmykcolor#1 #2 #3 #4\end + {\global\let\MPresolvedspace\MPcmykspace + \xdef\MPresolvedcolor{#1 #2 #3 #4}} + + \def\resolveMPgraycolor#1\end + {\global\let\MPresolvedspace\MPgrayspace + \xdef\MPresolvedcolor{#1}} % should be inverted + +\fi + \protect \endinput diff --git a/tex/context/base/supp-mps.tex b/tex/context/base/supp-mps.tex index 7ba4c2223..c8559f1fd 100644 --- a/tex/context/base/supp-mps.tex +++ b/tex/context/base/supp-mps.tex @@ -60,7 +60,7 @@ %D This is implemented as: \long\def\startMPgraphic#1\stopMPgraphic - {\checkMPTEXgraphic{#1}% + {\checkMPTEXgraphic{#1}% % potential speedup: pass #1 as macro \startwritingMPgraphic \writeMPgraphic{#1}% \stopwritingMPgraphic} @@ -276,7 +276,7 @@ \newif\ifMPTEXgraphic -\def\dowriteMPgraphicline% +\def\dowriteMPgraphicline {\futurelet\next\dodowriteMPgraphicline} %D A first version: @@ -305,44 +305,79 @@ \newif\ifforceMPTEXgraphic -\convertargument etex\to\MPasciiB -\convertargument textext\to\MPasciiC % geen "text" -\convertargument graphictext\to\MPasciiD % geen "text" +%D Before we supported the graph module, we had: +%D +%D \starttypen +%D \convertargument etex\to\MPasciiB +%D \convertargument textext\to\MPasciiC % geen "text" +%D \convertargument graphictext\to\MPasciiD % geen "text" +%D +%D \long\def\checkMPTEXgraphic#1% +%D {\ifforceMPTEXgraphic +%D \global\MPTEXgraphictrue +%D \else +%D \expandafter\convertargument#1\to\MPasciiA +%D \doifstringinstringelse\MPasciiB\MPasciiA{\global\MPTEXgraphictrue} +%D {\doifstringinstringelse\MPasciiC\MPasciiA{\global\MPTEXgraphictrue} +%D {\doifstringinstringelse\MPasciiD\MPasciiA{\global\MPTEXgraphictrue} +%D {\global\MPTEXgraphicfalse}}}% +%D \fi} +%D \stoptypen +%D +%D The next alternative permits extensions in other modules +%D without the need to know the details of testing. + +\newtoks\MPTEXgrapicchecks \long\def\checkMPTEXgraphic#1% {\ifforceMPTEXgraphic \global\MPTEXgraphictrue \else - \expandafter\convertargument#1\to\MPasciiA - \doifstringinstringelse\MPasciiB\MPasciiA - {\global\MPTEXgraphictrue} - {\doifstringinstringelse\MPasciiC\MPasciiA - {\global\MPTEXgraphictrue} - {\doifstringinstringelse\MPasciiD\MPasciiA - {\global\MPTEXgraphictrue} - {\global\MPTEXgraphicfalse}}}% + \global\MPTEXgraphicfalse + \expandafter\convertargument#1\to\MPascii + \the\MPTEXgrapicchecks\relax \fi} +%D We could have used a kind of array approach using a +%D counter appended to \type {MPascii}, but this is an +%D as efficient alternative. (The uglyness comes from +%D expanding after the string \type {#1}). + +\def\forceMPTEXcheck#1% + {\expanded{\convertargument#1\noexpand\to + \@EA\noexpand\csname MPascii#1\endcsname}% + \@EA\appendtoks + \@EA\doifincsnameelse\csname MPascii#1\endcsname\MPascii + {\global\MPTEXgraphictrue\gobbleuntil\relax}\donothing + \to \MPTEXgrapicchecks} + +\forceMPTEXcheck{etex} +\forceMPTEXcheck{textext} +\forceMPTEXcheck{graphictext} + \def\flushMPTEXgraphic {\ifMPTEXgraphic \ifx\everyMPTEXgraphic\emptytoks \else \immediate\write\MPwrite{verbatimtex \the\everyMPTEXgraphic\space etex;}% \fi \fi} -% \long\def\dodowriteMPgraphicline#1tex #2#3etex#4\MPend% +\long\def\flushMPgraphicline#1#2;% + {\ifx#1\relax \else + \immediate\write\MPwrite{#1#2;}% + \expandafter\flushMPgraphicline + \fi} + +% the next one fails on btex \vbox {\hbox .. leading to \vbox \hbox +% +% \long\def\dodowriteMPgraphicline#1tex #2#3etex#4\MPend % {\ifx\next\empty\else\ifx\next\relax\else % \bgroup -% \let\par=\space +% \let\par\space % \ifx#2\relax % \iflongMPlines % \immediate\write\MPwrite{#1;}% % \else % \edef\ascii{#1}% -% \long\def\flush##1##2;% -% {\ifx##1\relax \else -% \immediate\write\MPwrite{##1##2;}% -% \expandafter\flush -% \fi}% -% \expandafter\flush\ascii\empty;\relax;% +% \expandafter\flushMPgraphicline\ascii\empty;\relax;% % \fi % \egroup % \else @@ -352,31 +387,35 @@ % \dowriteMPgraphicline#4tex \relax etex\MPend % \fi % \fi\fi} +% +% so we need a two step approach -\long\def\flushMPgraphicline#1#2;% - {\ifx#1\relax \else - \immediate\write\MPwrite{#1#2;}% - \expandafter\flushMPgraphicline - \fi} +\long\def\dodowriteMPgraphicline#1tex % + {\doifnextcharelse\relax + {\nododowriteMPgraphicline{#1}} + {\redodowriteMPgraphicline{#1}}} -\long\def\dodowriteMPgraphicline#1tex #2#3etex#4\MPend +\long\def\redodowriteMPgraphicline#1#2etex#3\MPend {\ifx\next\empty\else\ifx\next\relax\else \bgroup \let\par\space - \ifx#2\relax - \iflongMPlines - \immediate\write\MPwrite{#1;}% - \else - \edef\ascii{#1}% - \expandafter\flushMPgraphicline\ascii\empty;\relax;% - \fi - \egroup + \convertargument#2\to\ascii + \immediate\write\MPwrite{#1tex \ascii etex}% + \egroup + \dowriteMPgraphicline#3tex \relax etex\MPend + \fi\fi} + +\long\def\nododowriteMPgraphicline#1#2\MPend + {\ifx\next\empty\else\ifx\next\relax\else + \bgroup + \let\par\space + \iflongMPlines + \immediate\write\MPwrite{#1;}% \else - \convertargument#2#3\to\ascii - \immediate\write\MPwrite{#1tex \ascii etex}% - \egroup - \dowriteMPgraphicline#4tex \relax etex\MPend + \edef\ascii{#1}% + \expandafter\flushMPgraphicline\ascii\empty;\relax;% \fi + \egroup \fi\fi} %D This stripper is suboptimal in the sense that more @@ -431,21 +470,26 @@ \the\everyMPgraphic \ifrunMPgraphics \openMPgraphicfile{1}{runtime}% - \theMPinclusions % no reset here ! + % no reset here ! + \theMPinclusions \else - \openMPgraphicfile{0}{collected}% - \theMPinclusions \let\theMPinclusions\relax % reset here ! + \openMPgraphicfile{0}{collected}% + % reset here ! global added (due to adding \blabelgroup) + \theMPinclusions + \global\let\theMPinclusions\relax \fi \flushMPTEXgraphic \ifMPrun \else \immediate\write\MPwrite{let mprunend = end ;}% \immediate\write\MPwrite{beginfig(\the\currentMPgraphic);}% \fi - \global\let\flushMPgraphics\closeMPgraphicfiles % \dodostopwritingMPgraphic - \global\let\stopwritingMPgraphic=\dostopwritingMPgraphic} + \globallet\flushMPgraphics\closeMPgraphicfiles % \dodostopwritingMPgraphic + \globallet\stopwritingMPgraphic=\dostopwritingMPgraphic} \let\MPgraphicfiles\empty +\let\MPinputtranslation\empty + \def\openMPgraphicfile#1#2% #1=alwaysopen #2=message {%\doifundefinedelse{\@@MPG\@@MPG\MPgraphicfile} % {\donetrue @@ -460,12 +504,16 @@ \@EA\let\@EA\MPwrite\csname\@@MPG\@@MPG\MPgraphicfile\endcsname \ifdone \immediate\openout\MPwrite=\MPgraphicfile.mp + \ifx\MPinputtranslation\empty\else + \immediate\write\MPwrite{\MPinputtranslation}% + \immediate\write\MPwrite{verbatimtex \MPinputtranslation etex ;} + \fi \immediate\write\MPwrite{\letterpercent\space #2 graphics of job "\jobname"}% \writeMPgraph \setMPrandomseed \fi} -\def\dostopwritingMPgraphic% +\def\dostopwritingMPgraphic {\ifMPrun \else \immediate\write\MPwrite{endfig;}% \immediate\write\MPwrite{let end = mprunend ;}% @@ -475,7 +523,7 @@ \fi \elabelgroup} -\def\dodostopwritingMPgraphic% +\def\dodostopwritingMPgraphic {\ifnum\currentMPgraphic>0 \donetrue \else\ifMPrun @@ -487,7 +535,7 @@ \finishwritingMPgraphics \runMPgraphic\MPgraphicfile \fi - \global\let\flushMPgraphics\relax} + \globallet\flushMPgraphics\relax} \def\finishwritingMPgraphics {\immediate\write\MPwrite{end.}% @@ -511,6 +559,30 @@ \def \allocateMPslot#1{\global\advance#1 1 } \def\deallocateMPslot#1{} +%D \macros +%D {translateMPinput} +%D +%D For my polish friends: +%D +%D \starttypen +%D % translate=il2-pl +%D +%D \translateMPinput{il2-pl} +%D +%D \startMPenvironment[global] +%D \setupbodyfont[plr] +%D \stopMPenvironment +%D +%D \TeX: ± ¶ +%D +%D \startMPcode +%D draw btex MetaPost: ± ¶ etex scaled 5 ; +%D \stopMPcode +%D \stoptypen + +\def\translateMPinput#1% + {\xdef\MPinputtranslation{\letterpercent -translate-file=#1\space}} + %D \macros %D {setMPrandomseed} %D @@ -794,11 +866,6 @@ \ifx\undefined\interactionmode \chardef\interactionmode=255 \fi -% \def\executeMPOST#1% -% {mpost -% \ifcase\interactionmode -int=batchmode \fi -% \ifuseMETAFUNformat -progname=mpost -mem=metafun \fi #1} - \def\MPOSTbatchswitch {-int=batchmode} \def\MPOSTformatswitch{-progname=mpost -mem=} \def\MPOSTdriver {dvips} @@ -814,17 +881,6 @@ --output=\MPOSTdriver\space \ifuseMETAFUNformat --mpformat=metafun \fi --mptex --nomp --once #1} -% \def\executeMetaPost#1% @EA's -% {\ifrunMPTEXgraphics -% \ifMPTEXgraphic -% \executeMPTEX{#1}% -% \else -% \executeMPOST{#1}% -% \fi -% \else -% \executeMPOST{#1}% -% \fi} - \def\executeMetaPost {\ifrunMPTEXgraphics \ifMPTEXgraphic @@ -1092,11 +1148,11 @@ \def\includeMPcharacters(#1) #2 #3 #4#5#6#7#8#9\relax {\edef\temp{#4#5#6#7#8}% \ifx\temp\PSnfont % round font size (to pt) - \scratchdimen=#3pt + \scratchdimen#3pt \ifdim\scratchdimen<1pt \def\size{1pt}% \else - \advance\scratchdimen by .5pt + \advance\scratchdimen .5pt \def\size##1.##2\relax{\def\size{##1pt}}% \expandafter\size\the\scratchdimen\relax \fi @@ -1181,7 +1237,7 @@ \fi\fi \ifdone \message{[MP color conversion #1}% - \endlinechar=-1 + \endlinechar\minusone \uncatcodespecials \donefalse \immediate\openout\scratchwrite=\convertMPcolorpath\convertMPcolorfile @@ -1207,6 +1263,9 @@ %D copied back. We don't have to reduce to gray scales; %D \METAPOST\ already takes care of that. +%D BTW, this code is quite old, and not as complete as the +%D \PDF\ converter, which also handles spot colors and so. + \def\handleMPcolor {\expandafter\dohandleMPcolor\fileline setrgbcolor*\\} @@ -1228,18 +1287,18 @@ \immediate\write\scratchwrite {\@@cl@@s \space setgray #4}% \else - \dimen0=1pt \advance\dimen0 -#1pt - \dimen2=1pt \advance\dimen2 -#2pt - \dimen4=1pt \advance\dimen4 -#3pt + \dimen0=1\s!pt \advance\dimen0 -#1\s!pt + \dimen2=1\s!pt \advance\dimen2 -#2\s!pt + \dimen4=1\s!pt \advance\dimen4 -#3\s!pt \ifreduceMPcolors - \dimen6=\dimen0 - \ifdim\dimen2<\dimen6 \dimen6=\dimen2 \fi - \ifdim\dimen4<\dimen6 \dimen6=\dimen4 \fi + \dimen6\dimen0 + \ifdim\dimen2<\dimen6 \dimen6\dimen2 \fi + \ifdim\dimen4<\dimen6 \dimen6\dimen4 \fi \advance\dimen0 -\dimen6 \advance\dimen2 -\dimen6 \advance\dimen4 -\dimen6 \else - \dimen6=\zeropoint + \dimen6\zeropoint \fi \immediate\write\scratchwrite {\withoutpt{\the\dimen0} \space @@ -1251,7 +1310,7 @@ \egroup \donetrue} % needed for message -\def\handleMPcopy% +\def\handleMPcopy {\immediate\write\scratchwrite{\fileline}} %D The next macro is needed for forced conversion. This macro @@ -1261,17 +1320,17 @@ \ifx\convertRGBtoGRAY\undefined \def\convertRGBtoGRAY#1#2#3% - {\scratchdimen=#1\s!pt - \scratchdimen=300\scratchdimen - \scratchcounter=\scratchdimen - \scratchdimen=#2\s!pt - \scratchdimen=590\scratchdimen - \advance\scratchcounter by \scratchdimen - \scratchdimen=#3\s!pt - \scratchdimen=110\scratchdimen - \advance\scratchcounter by \scratchdimen - \advance\scratchcounter by \!!medcard - \divide\scratchcounter by \!!maxcard + {\scratchdimen#1\s!pt + \scratchdimen300\scratchdimen + \scratchcounter\scratchdimen + \scratchdimen#2\s!pt + \scratchdimen590\scratchdimen + \advance\scratchcounter \scratchdimen + \scratchdimen#3\s!pt + \scratchdimen110\scratchdimen + \advance\scratchcounter \scratchdimen + \advance\scratchcounter \!!medcard + \divide\scratchcounter \!!maxcard \edef\@@cl@@s{\realcolorvalue\scratchcounter}} \fi @@ -1400,12 +1459,12 @@ \newif\ifMPshiftdrawing \MPshiftdrawingfalse \def\resetMPdrawing - {\global\let\MPdrawingdata\empty + {\globallet\MPdrawingdata\empty \global\MPdrawingdonefalse} \def\pushMPdrawing {\pushmacro\MPdrawingdata - \global\let\MPdrawingdata\empty} + \globallet\MPdrawingdata\empty} \def\popMPdrawing {\popmacro\MPdrawingdata} @@ -1532,22 +1591,6 @@ \newif\ifrecycleMPslots \recycleMPslotstrue -% \def\allocateMPslot#1% -% {\ifrunMPgraphics -% \ifcase\pdfoutput \recycleMPslotsfalse \fi -% \else -% \recycleMPslotsfalse -% \fi -% \ifrecycleMPslots -% \doloop % slow but used seldom -% {\doifundefined{\recurselevel MP} -% {\global\letvalue{\recurselevel MP}=\empty -% \global#1=\recurselevel\exitloop}}% -% %\message{[MP slot + \number#1]% -% \else -% \global\advance#1 1 -% \fi} - %D When a graphic takes space in the text flow, we can run %D into deadlock typesetting. In the first pass, the graphic %D is not available, but in the second pass it is. The @@ -1580,16 +1623,16 @@ \ifrecycleMPslots \doloop % slow but used seldom {\doifundefined{\recurselevel MP} - {\global\letvalue{\recurselevel MP}\empty + {\letgvalueempty{\recurselevel MP}% \global#1=\recurselevel \exitloop}}% % \message{[MP slot + \number#1]% \else\ifMPstaticgraphic \global#1\maxnofMPgraphics - \global\advance\maxnofMPgraphics -1 + \global\advance\maxnofMPgraphics \minusone \else \global#1\minnofMPgraphics - \global\advance\minnofMPgraphics 1 + \global\advance\minnofMPgraphics \plusone \fi\fi \ifnum\minnofMPgraphics<\maxnofMPgraphics \else \writestatus{\m!systems}{increase \string\maxnofMPgraphics}% @@ -1609,10 +1652,10 @@ %D Experimental and overloaded later, since we need to be %D more clever due to \METAPOST's limit of 4~open files. -\def\MPdatafile% +\def\MPdatafile {mp-\the\currentMPgraphic.mpd} -\def\getMPdata% +\def\getMPdata {\input \MPdatafile\relax} %D \macros @@ -1634,7 +1677,7 @@ %D %D this automatically places the graphic -\long\def\startMPcode#1\stopMPcode% +\long\def\startMPcode#1\stopMPcode {\startuseMPgraphic{@@}#1\stopuseMPgraphic\useMPgraphic{@@}} \protect \endinput diff --git a/tex/context/base/supp-mrk.tex b/tex/context/base/supp-mrk.tex index 85c11f428..f869e408a 100644 --- a/tex/context/base/supp-mrk.tex +++ b/tex/context/base/supp-mrk.tex @@ -210,10 +210,10 @@ {\bgroup \makemarknames{#1}% #2% - \global\letvalue{\@@markcurrent@@\markname}\empty - \global\letvalue{\@@marktop@@ \markname}\empty - \global\letvalue{\@@markfirst@@ \markname}\empty - \global\letvalue{\@@markbot@@ \markname}\empty + \letgvalueempty{\@@markcurrent@@\markname}% + \letgvalueempty{\@@marktop@@ \markname}% + \letgvalueempty{\@@markfirst@@ \markname}% + \letgvalueempty{\@@markbot@@ \markname}% \setgvalue{\marklist}{\domark0{}}% beware of halfway definitions \long\gdef#1{\addmarker#1}% \egroup} @@ -257,17 +257,17 @@ {\bgroup \makemarknames{#1}% \setgvalue{\@@markcurrent@@\markname}{#2}% - \global\advance\currentmarker by 1 + \global\advance\currentmarker 1 \normalmark{\the\currentmarker}% \!!toksa\@EA\@EA\@EA{\csname\marklist\endcsname}% \ifexpandmarks - \setxvalue{\marklist}% + \setxvalue\marklist {\the\!!toksa \noexpand\domark \the\currentmarker{#2}}% \else \!!toksb\@EA{#2}% one level, why ? handy for cs - \setxvalue{\marklist}% + \setxvalue\marklist {\the\!!toksa \noexpand\domark \the\currentmarker{\the\!!toksb}}% @@ -337,7 +337,7 @@ \let\else\relax % \let\domark\doscanmarks - \getvalue{\marklist}\lastmark + \getvalue\marklist\lastmark % \global\@EA\let\csname\marklist\endcsname\savedmarklist \egroup} @@ -376,24 +376,34 @@ {\!!toksc\emptytoks} \endTEX - + %D The \ETEX\ way of doing things \unknown \beginETEX \marks cum suis \newtoks \listofmarks -\def\@@mrk{mrk:} \def\@@trk{trk:} \def\@@crk{crk:} +\def\@@prk{prk:} +\def\@@mrk{mrk:} +\def\@@trk{trk:} +\def\@@frk{frk:} +\def\@@brk{brk:} +\def\@@crk{crk:} %D We will use two state variables per mark, one to signal %D that a new mark value is set, and one to trigger (on the %D next page) the setting of the top mark. -\def\checkedtopmarks#1{\csname\@@trk\string#1\endcsname} -\def\thecurrentmarks#1{\csname\@@crk\string#1\endcsname} +\def\checkedtopmarks #1{\csname\@@trk\string#1\endcsname} +\def\checkedfirstmarks#1{\csname\@@frk\string#1\endcsname} +\def\checkedbotmarks #1{\csname\@@brk\string#1\endcsname} +\def\thecurrentmarks #1{\csname\@@crk\string#1\endcsname} \long\def\setmark#1% - {\global\@EA\mathchardef\csname\@@mrk\string#1\endcsname\zerocount + {%\writestatus{marks}{setting \string#1}\wait + \global\@EA\chardef\csname\@@mrk\string#1\endcsname\plusone + %\@EA\normalmarks\csname\@@prk\string#1\endcsname{1}% + \@EA\normalmarks\csname\@@prk\string#1\endcsname{\realfolio}% \ifexpandmarks\@EA\setexpandedmark\else\@EA\setnormalmark\fi#1} \def\setexpandedmark#1#2% % marks expand anyway @@ -405,33 +415,45 @@ \@EA\xdef\csname\@@crk\string#1\endcsname{\the\scratchtoks}% \normalmarks#1{\the\scratchtoks}} % one level expansion -\def\checktopmark#1% is called often, so its minimized - {\ifcase\csname\@@mrk\string#1\endcsname\else - \@EA\dochecktopmark\@EA#1% - \fi} +\def\checktopmark#1% + {%\writestatus{marks}{checking \string#1}\wait + \ifcase\csname\@@mrk\string#1\endcsname\else\dochecktopmark#1\fi} \def\dochecktopmark#1% - {\ifnum\realpageno>\csname\@@mrk\string#1\endcsname\relax - \@EA\gdef\csname\@@trk\string#1\endcsname{\normalbotmarks#1}% + {\ifcase0\@EA\normalfirstmarks\csname\@@prk\string#1\endcsname\else + \@EA\ifx\csname\@@frk\string#1\endcsname\empty + \@EA\gdef\csname\@@frk\string#1\endcsname{\normalfirstmarks#1}% + \@EA\gdef\csname\@@brk\string#1\endcsname{\normalbotmarks #1}% + \else + \@EA\gdef\csname\@@trk\string#1\endcsname{\normaltopmarks #1}% + \global\@EA\chardef\csname\@@mrk\string#1\endcsname\zerocount + \fi \fi} -\def\resetmark#1% we cannot use \normalmarks#1{}} - {\@EA\mathchardef\csname\@@mrk\string#1\endcsname\realfolio - \global\@EA\let\csname\@@trk\string#1\endcsname\empty} +\def\resetmark#1% we cannot use \normalmarks#1{} + {\global\@EA\chardef\csname\@@mrk\string#1\endcsname\zerocount + \@EA\normalmarks\csname\@@prk\string#1\endcsname{0}% + \global\@EA\let\csname\@@trk\string#1\endcsname\empty + \global\@EA\let\csname\@@frk\string#1\endcsname\empty + \global\@EA\let\csname\@@brk\string#1\endcsname\empty + \global\@EA\let\csname\@@crk\string#1\endcsname\empty} \def\definenewmark#1% - {\ifcsname\@@mrk\string#1\endcsname\else % this is etex -) - \newmarks#1\appendtoks\checktopmark#1\to\listofmarks + {\ifcsname\@@prk\string#1\endcsname\else % this is etex -) + \newmarks#1\doglobal\appendtoks\checktopmark#1\to\listofmarks + \@EA\newmarks\csname\@@prk\string#1\endcsname % status mark \fi - \global\@EA\let\csname\@@crk\string#1\endcsname\empty \global\@EA\mathchardef\csname\@@mrk\string#1\endcsname\zerocount - \@EA\gdef\csname\@@trk\string#1\endcsname{\normaltopmarks#1}} + \global\@EA\let\csname\@@crk\string#1\endcsname\empty + \@EA\gdef\csname\@@trk\string#1\endcsname{\normaltopmarks #1}% + \@EA\gdef\csname\@@frk\string#1\endcsname{\normalfirstmarks#1}% + \@EA\gdef\csname\@@brk\string#1\endcsname{\normalbotmarks #1}} \let \newmark \definenewmark -\let \newpersistentmark \definenewmark +\let \newpersistentmark \newmarks % \definenewmark \let \normalsetmark \setmark -\def\setallmarks{\the\listofmarks} +\def\getallmarks{\the\listofmarks} % \def\setallmarks{\the\listofmarks} %D In \type {page-ini} or \type {core-mar} we should say: %D @@ -442,12 +464,12 @@ \let\getcurrentmark \thecurrentmarks \let\gettopmark \checkedtopmarks -\let\getbottommark \normalbotmarks -\let\getfirstmark \normalfirstmarks +\let\getbottommark \checkedbotmarks % \normalbotmarks +\let\getfirstmark \checkedfirstmarks % \normalfirstmarks \let\getsplitbottommark \normalsplitbotmarks \let\getsplitfirstmark \normalsplitfirstmarks -\let\getbotmark \normalbotmarks +\let\getbotmark \getbottommark \let\getsplitbotmark \normalsplitbotmarks \let\getsplittopmark \normalsplitfirstmarks @@ -542,4 +564,30 @@ %D can slow down considerably. This drawback is removed in %D \ETEX\ mode. +\beginTEX + +\let\rawnewmark \newmark +\let\rawdefinemark \newmark +\let\rawsetmark \setmark +\let\rawgettopmark \gettopmark +\let\rawgetfirstmark \getfirstmark +\let\rawgetbotmark \getbotmark +\let\rawgetsplitbotmark \normalsplitbotmark +\let\rawgetsplitfirstmark\normalsplitfirstmark + +\endTEX + +\beginETEX + +\let\rawnewmark \newmarks +\let\rawdefinemark \newmarks +\let\rawsetmark \normalmarks +\let\rawgettopmark \normaltopmarks +\let\rawgetfirstmark \normalfirstmarks +\let\rawgetbotmark \normalbotmarks +\let\rawgetsplitbotmark \normalsplitbotmarks +\let\rawgetsplitfirstmark\normalsplitfirstmarks + +\endETEX + \protect \endinput diff --git a/tex/context/base/supp-num.tex b/tex/context/base/supp-num.tex index 13e61a94f..610c5b6b7 100644 --- a/tex/context/base/supp-num.tex +++ b/tex/context/base/supp-num.tex @@ -93,12 +93,22 @@ %D the grouped call, the other branch handles the fuzzy %D delimited calls. +% \unexpanded\def\digits +% {\bgroup\let~@\doifnextcharelse\bgroup\dodigits\grabdigit} + \unexpanded\def\digits - {\bgroup\let~@\doifnextcharelse\bgroup\dodigits\grabdigit} + {\bgroup + \let~@% + \doifnextcharelse\bgroup + \dodigits + {\doifnextcharelse\normalmathshift\domathdigits\grabdigit}} \def\dodigits#1% {\grabdigit#1\relax} +\def\domathdigits$#1$% + {\mbox{\grabdigit#1\relax}} % adding $ $ goes wrong in tabulate + \def\grabdigit {\futurelet\next\scandigit} @@ -114,7 +124,7 @@ \ifx\normalmathshift\undefined \let\normalmathshift=$ \fi -\def\scandigit% +\def\scandigit {\ifx\next\blankspace \let\next\handledigits \else\ifx\next\nextobeyedline % the indirect one @@ -147,11 +157,11 @@ \let\grabdigit\handledigits \else\ifcase\powerdigits \if#1E% - \chardef\powerdigits1 + \chardef\powerdigits\plusone \else\if#1e% - \chardef\powerdigits1 + \chardef\powerdigits\plusone \else\if#1^% - \chardef\powerdigits1 + \chardef\powerdigits\plusone \else \savedigit\collecteddigits#1% %\doifnumberelse{#1} @@ -169,7 +179,7 @@ \let\handlemathdigits\firstofoneargument \let\handletextdigits\mathematics -\def\handledigits% +\def\handledigits {%\ifcase\powerdigits % \edef\collecteddigits{\collecteddigits\saveddigits}% %\else @@ -185,50 +195,101 @@ %D Although we could do with one pass, a second pass for %D handling the stored sequence is more readable. -\def\dohandledigits% +\def\dohandledigits {\mathcode`\,="013B \mathcode`\.="013A % pretty hard coded \expandafter\handletokens\collecteddigits\with\scandigits \ifcase\powerdigits\else\digitpowerseparator^{\savedpowerdigits}\fi} \def\doscandigit#1% - {\ifcase\skipdigit\else\hphantom{\fi - \ifnum\digitinputmode=#1\relax - \ifcase\digitoutputmode - \or .% - \or ,% - \or \mskip\thinmuskip - \or \mskip\thinmuskip - \or \mskip\thickmuskip - \or \mskip\thickmuskip - \fi - \else - \ifodd\digitoutputmode,\else.\fi - \fi - \ifcase\skipdigit\else}\fi} + {\ifcase\skipdigit\hbox\else\hphantom\fi\bgroup + \mathematics % brr, needed because of stored punctuation + {\ifnum\digitinputmode=#1\relax + \ifcase\digitoutputmode + \or .% + \or ,% + \or \mskip\thinmuskip + \or \mskip\thinmuskip + \or \mskip\thickmuskip + \or \mskip\thickmuskip + \fi + \else + \ifodd\digitoutputmode,\else.\fi + \fi}% + \egroup} + %D The signs can be made smaller and sqeezed into the width %D of a digit. Watch the \type {\fontdimen22} trickery (this %D font related register stored the math axis). +% \def\scandigits#1% +% {\if#1.\doscandigit1\chardef\skipdigit0\else +% \if#1,\doscandigit2\chardef\skipdigit0\else +% \if#1@\hphantom{0}\chardef\skipdigit1\else +% \if#1_\hphantom{0}\chardef\skipdigit1\else +% \if#1/\digitsgn{\hphantom{+}}\chardef\skipdigit0\else +% \if#1-\digitsgn-\chardef\skipdigit0\else +% \if#1+\digitsgn+\chardef\skipdigit0\else +% \if#1=\digitsgn\zeroamount\chardef\skipdigit0\else +% \if#1s\digitsgn{\hphantom{\positive}}\chardef\skipdigit0\else +% \if#1p\digitsgn\positive\chardef\skipdigit0\else +% \if#1m\digitsgn\negative\chardef\skipdigit0\else +% \if#1n\digitsgn\negative\chardef\skipdigit0\else +% #1\chardef\skipdigit0\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% \def\digitsep#1% +% {\doscandigit#1\chardef\skipdigit0} +% +% \def\digitnop +% {\hphantom{0}\chardef\skipdigit1} + +% 0,= +% 0,== second = results in delta(00,=) +% 0,- is invalid, should be = but we try to catch this error +% 0,-- is invalid, but catched as == + +\def\digitzeroamount + {\digitsgn\zeroamount + \def\digitzeroamount + {\hphantom + {00\setbox\scratchbox\hbox{$\zeroamount$}% + \hskip-\wd\scratchbox}% + \let\digitzeroamount\empty}} + \def\scandigits#1% - {\if#1.\doscandigit1\chardef\skipdigit0\else - \if#1,\doscandigit2\chardef\skipdigit0\else - \if#1@\hphantom{0}\chardef\skipdigit1\else - \if#1_\hphantom{0}\chardef\skipdigit1\else + {\if#1.\digitsep1\else + \if#1,\digitsep2\else + \if#1@\digitnop \else + \if#1_\digitnop \else \if#1/\digitsgn{\hphantom{+}}\chardef\skipdigit0\else - \if#1-\digitsgn-\chardef\skipdigit0\else + \if#1-\ifcase\digitsepbox\digitsgn-\else + \box\digitsepbox\digitzeroamount \fi\chardef\skipdigit0\else \if#1+\digitsgn+\chardef\skipdigit0\else - \if#1=\digitsgn\zeroamount\chardef\skipdigit0\else + \if#1=\box\digitsepbox\digitzeroamount \chardef\skipdigit0\else \if#1s\digitsgn{\hphantom{\positive}}\chardef\skipdigit0\else \if#1p\digitsgn\positive\chardef\skipdigit0\else \if#1m\digitsgn\negative\chardef\skipdigit0\else \if#1n\digitsgn\negative\chardef\skipdigit0\else - #1\chardef\skipdigit0\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + \box\digitsepbox #1\chardef\skipdigit0\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +\newbox\digitsepbox \chardef\autodigitmode=1 + +\def\digitsep#1% + {\ifcase\autodigitmode + \doscandigit#1% + \else + \setbox\digitsepbox\hbox{\doscandigit#1} + \fi + \chardef\skipdigit0} + +\def\digitnop + {\hphantom{\box\digitsepbox}% + \hphantom{0}\chardef\skipdigit1} \def\digitsgn#1% {\ifcase\digitsignmode#1\else \hbox - {\setbox\scratchbox=\hbox{0}% + {\setbox\scratchbox\hbox{0}% \scratchdimen\fontdimen22\textfont2 \def\digitsgn##1##2% {\advance\scratchdimen-\fontdimen22##12 @@ -332,7 +393,7 @@ %D \macros %D {digittemplate} %D -%D Users can specify the way they enter those digits by sayon +%D Users can specify the way they enter those digits by saying %D something like: %D %D \starttypen @@ -340,14 +401,12 @@ %D \stoptypen \def\digittemplate #1 % - {\chardef\digitinputmode=0 + {\chardef\digitinputmode\zerocount \handletokens#1\with\scandigittemplate} \def\scandigittemplate#1% - {\if #1.\ifcase\digitinputmode\chardef\digitinputmode=1 \fi% period - \else\if#1,\ifcase\digitinputmode\chardef\digitinputmode=2 \fi% comma + {\if #1.\ifcase\digitinputmode\chardef\digitinputmode1 \fi% period + \else\if#1,\ifcase\digitinputmode\chardef\digitinputmode2 \fi% comma \fi\fi} -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/supp-pdf.tex b/tex/context/base/supp-pdf.tex index b4d5a00c5..95a27af66 100644 --- a/tex/context/base/supp-pdf.tex +++ b/tex/context/base/supp-pdf.tex @@ -109,15 +109,15 @@ \def\dopdfclippedimage#1#2#3#4#5#6% {\bgroup \pdfximage#1{#2}% - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\pdfrefximage\pdflastximage}% - \hsize=\wd\scratchbox + \hsize\wd\scratchbox \advance\hsize -#3 \advance\hsize -#4 - \vsize=\ht\scratchbox + \vsize\ht\scratchbox \advance\vsize -#5 \advance\vsize -#6 - \setbox\scratchbox=\vbox to \vsize + \setbox\scratchbox\vbox to \vsize {\vskip-#5\hbox to \hsize{\hskip-#3\box\scratchbox\hss}}% \pdfxform\scratchbox \pdfrefxform\pdflastxform @@ -197,6 +197,8 @@ %D dimensions. Beware: the user supplied values are not the %D bounding box ones! +% this will become obsolete + \newif\ifPDFmediaboxprefered \def\setPDFboundingbox#1#2#3#4#5#6% @@ -214,8 +216,8 @@ \def\setPDFmediabox#1[#2 #3 #4 #5]#6\done% {\dimen2=#2bp\dimen2=-\dimen2 \dimen4=#3bp\dimen4=-\dimen4 - \dimen6=#4bp\advance\dimen6 by \dimen2 - \dimen8=#5bp\advance\dimen8 by \dimen4 + \dimen6=#4bp\advance\dimen6 \dimen2 + \dimen8=#5bp\advance\dimen8 \dimen4 \setPDFboundingbox{\dimen2}{\dimen4}{\dimen6}{\dimen8}\PDFxscale\PDFyscale} \def\checkPDFmediabox#1/MediaBox#2#3\done% @@ -230,7 +232,7 @@ \def\handlePDFline% {\ifx\@@PDFstream@@\fileline - \let\doprocessPDFline=\copyPDFobject + \let\doprocessPDFline\copyPDFobject \startPDFtoPDF \else\ifPDFmediaboxprefered \expandafter\checkPDFmediabox\fileline/MediaBox\relax\done @@ -239,12 +241,12 @@ \def\copyPDFobject% {\ifx\@@PDFendstream@@\fileline \ifPDFmediaboxprefered - \let\doprocessPDFline=\findPDFmediabox + \let\doprocessPDFline\findPDFmediabox \else - \let\doprocessPDFline=\relax + \let\doprocessPDFline\relax \fi \else - \advance\scratchcounter by 1 + \advance\scratchcounter 1 \PDFcode{\fileline}% \fi} @@ -324,9 +326,9 @@ \def\checkPDFtypepage##1/Type /Page##2##3\done% {\ifx##2\relax \else\if##2s% accept /Page and /Pages - \let\doprocessPDFline=\findPDFmediabox + \let\doprocessPDFline\findPDFmediabox \else - \let\doprocessPDFline=\findPDFmediabox + \let\doprocessPDFline\findPDFmediabox \fi\fi}% \def\findPDFtypepage% {\expandafter\checkPDFtypepage\fileline/Type /Page\relax\done}% @@ -337,7 +339,7 @@ \fi}% \def\findPDFmediabox% {\expandafter\checkPDFmediabox\fileline/MediaBox\relax\done}% - \let\doprocessPDFline=\findPDFtypepage + \let\doprocessPDFline\findPDFtypepage \doprocessfile\scratchread{#1}\doprocessPDFline \egroup \ifx\PDFxoffset\undefined @@ -707,6 +709,10 @@ {\PDFcode{\!MPgMPa1 g \!MPgMPa1 G}} +\def\handleMPspotcolor + {\PDFcode{0 g + 0 G}} + %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. @@ -765,10 +771,10 @@ \xdef\MPyoffset{\withoutpt{\the\dimen2}}% \dimen0=#2bp\dimen0=-\dimen0 \dimen2=#3bp\dimen2=-\dimen2 - \advance\dimen0 by #4bp + \advance\dimen0 #4bp \dimen0=\MPxscale\dimen0 \xdef\MPwidth{\the\dimen0}% - \advance\dimen2 by #5bp + \advance\dimen2 #5bp \xdef\MPyshift{\the\dimen2}% unscaled \dimen2=\MPyscale\dimen2 \xdef\MPheight{\the\dimen2}% @@ -829,9 +835,9 @@ \let\MPfshowcommand\empty -\def\handleMPfshow% +\def\handleMPfshow {\bgroup - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\obeyMPspecials \edef\size{\gMPa\nofMParguments}% \ifx\size\PSnfont % round font size (to pt) @@ -861,7 +867,8 @@ % we need to catch ( a ) (a a a) (\123 \123 \123) etc \scratchcounter=1 \def\dodo##1% Andreas Fieger's bug: (\304...) - {\ifx##1\MPspacechar\MPspacechar\else\expandafter##1\fi}% + {\edef\!!stringa{##1\empty\empty}% and another one: ( 11) -> \ifx 11 + \ifx\!!stringa\MPspacechar\MPspacechar\else\expandafter##1\fi}% \def\do(##1{\dodo{##1}}% \dogMPa\scratchcounter\MPspacechar \let\do\relax @@ -888,7 +895,7 @@ % \PDFcode{Q}% % \egroup} % - \setbox\scratchbox=\hbox + \setbox\scratchbox\hbox {\hskip\lastMPmoveX bp\raise\lastMPmoveY bp\box\scratchbox}% \ht\scratchbox\!!zeropoint \dp\scratchbox\!!zeropoint @@ -911,7 +918,11 @@ %D safely assume that \METAPOST\ considers \type {\char32} to %D be the space. -\def\MPspacechar{\setbox\scratchbox=\hbox{\char32}\kern\wd\scratchbox} +\def\MPspacechar{\setbox\scratchbox\hbox{\char32}\kern\wd\scratchbox} + +%D Well, this does not work with math fonts, so: + +\def\MPspacechar{\char32\relax} %D Most operators are just converted and keep their %D arguments. Dashes however need a bit different treatment, @@ -925,7 +936,7 @@ \def\handleMPsetdash% {\bgroup \def\somestring{[}% - \scratchcounter=1 + \scratchcounter1 \loop \ifnum\scratchcounter<\nofMParguments \edef\somestring{\somestring\space\gMPa\scratchcounter}% @@ -1061,8 +1072,8 @@ \fi} \def\flushconcatMPpath% - {\scratchcounter=\nofMPsegments - \nofMPsegments=1 + {\scratchcounter\nofMPsegments + \nofMPsegments1 \loop \flushconcatMPsegment \advance\nofMPsegments 1 @@ -1616,7 +1627,7 @@ \fi \let\handleMPsequence\dohandleMPsequence \resetMPstack - \nofMPsegments=0 + \nofMPsegments0 \handleMPsequence} %D The following \METAPOST\ code is quite valid but, when @@ -1635,7 +1646,7 @@ {\ifcase\finiMPpath \ifnum\nofMPsegments<3 % n is one ahead \message{omitting zero clip path}% - \nofMPsegments=0 + \nofMPsegments0 \fi \fi} @@ -1752,7 +1763,7 @@ \def\convertMPtoPDF#1#2#3% {\bgroup \ifx\pdfdecimaldigits\undefined\else \pdfdecimaldigits=5 \fi % new - \setbox\scratchbox=\vbox\bgroup + \setbox\scratchbox\vbox\bgroup \forgetall \offinterlineskip \startMPresources @@ -1828,16 +1839,16 @@ \def\PDFMPformoffset {\ifx\objectoffset\undefined\!!zeropoint\else\objectoffset\fi} -\def\finishMPgraphic% +\def\finishMPgraphic {\stopMPresources \egroup \ifx\pdftexversion\undefined\else\ifnum\pdftexversion<14 % for the moment - \chardef\makeMPintoPDFobject=0 + \chardef\makeMPintoPDFobject0 \fi\fi \ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else - \chardef\makeMPintoPDFobject=1 + \chardef\makeMPintoPDFobject1 \fi\fi - \setbox\scratchbox=\vbox + \setbox\scratchbox\vbox {\forgetall \hbox {\PDFcode{q \MPxscale\space 0 0 \MPyscale\space \MPxoffset\space \MPyoffset\space cm}% @@ -1849,7 +1860,7 @@ \ifcase\makeMPintoPDFobject \box\scratchbox \or - \scratchdimen=\PDFMPformoffset\relax + \scratchdimen\PDFMPformoffset\relax \ifdim\scratchdimen>\!!zeropoint % compensate for error \setbox\scratchbox=\vbox spread 2\scratchdimen {\forgetall diff --git a/tex/context/base/supp-ran.tex b/tex/context/base/supp-ran.tex index 094d0f36b..43aff0ed7 100644 --- a/tex/context/base/supp-ran.tex +++ b/tex/context/base/supp-ran.tex @@ -86,8 +86,8 @@ \unprotect \def\setrandim#1#2#3% dimen register, minimum length, maximum length - {\scratchdimen=#2\edef\!!stringa{\number\scratchdimen}% - \scratchdimen=#3\edef\!!stringb{\number\scratchdimen}% + {\scratchdimen#2\edef\!!stringa{\number\scratchdimen}% + \scratchdimen#3\edef\!!stringb{\number\scratchdimen}% \setrannum\ranval\!!stringa\!!stringb #1\ranval sp\relax} @@ -95,14 +95,14 @@ \fi -\def\freezerandomseed% +\def\freezerandomseed {\ifcase\randomseedfrozen - \nextrandom \global\chardef\randomseedfrozen=1 + \nextrandom \global\chardef\randomseedfrozen\plusone \fi} -\def\defrostrandomseed% +\def\defrostrandomseed {\ifcase\randomseedfrozen\else - \global\chardef\randomseedfrozen=0 \nextrandom + \global\chardef\randomseedfrozen\zerocount \nextrandom \fi} \let\getrandomcount = \setrannum diff --git a/tex/context/base/supp-spe.tex b/tex/context/base/supp-spe.tex index 1e68478f2..a03eb4ba2 100644 --- a/tex/context/base/supp-spe.tex +++ b/tex/context/base/supp-spe.tex @@ -65,8 +65,7 @@ \def\@rds@{@rds@} -\def\redefinespecial #1 % - {\setvalue{\@rds@#1}} +\def\redefinespecial #1 {\setvalue{\@rds@#1}} %D \macros %D {mimmickspecials} @@ -80,8 +79,8 @@ %D This commands redefines the \PLAIN\ \TEX\ primitive %D \type{\special}. -\def\mimmickspecials% - {\let\special=\domimmickspecial} +\def\mimmickspecials + {\let\special\domimmickspecial} %D The special mimmicking macro first looks if it can find an %D colon terminated tag, next it searches for a tag that end @@ -91,21 +90,21 @@ \def\domimmickspecial#1% {\domimmickcolonspecial#1:\relax/:\relax/\end} -\def\domimmickcolonspecial#1:#2#3:\relax/#4\end% +\def\domimmickcolonspecial#1:#2#3:\relax/#4\end {\ifx#2\relax \domimmickspacespecial#1 \relax/ \relax/\end \else \dodomimmickspecial#1:\using#2#3\endspecial \fi} -\def\domimmickspacespecial#1 #2#3 \relax/#4\end% +\def\domimmickspacespecial#1 #2#3 \relax/#4\end {\ifx#2\relax \dodomimmickspecial#1\using\endspecial \else \dodomimmickspecial#1\using#2#3\endspecial \fi} -\def\dodomimmickspecial#1\using#2\endspecial% +\def\dodomimmickspecial#1\using#2\endspecial {\expandafter\ifx\csname\@rds@#1\endcsname\relax % \doifdefinedelse \defaultspecial{#1 #2}% \else @@ -144,8 +143,7 @@ %D %D This can be handy when specials have much in common. -\def\mimmickspecial #1 % - {\getvalue{\@rds@#1}} +\def\mimmickspecial #1 {\getvalue{\@rds@#1}} %D \macros %D {normalspecial,defaultspecial} @@ -163,6 +161,4 @@ \let\normalspecial =\special \let\defaultspecial=\special -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/supp-tpi.tex b/tex/context/base/supp-tpi.tex index 47bb4d5b5..c01d1fef5 100644 --- a/tex/context/base/supp-tpi.tex +++ b/tex/context/base/supp-tpi.tex @@ -108,13 +108,15 @@ % BETER: check for context and include mp-tool.mp -\def\startTPICspecials% +\def\startTPICspecials {\bgroup - \let\startTPICspecials=\relax + \let\startTPICspecials\relax \aftergroup\stopTPICspecials - \startwritingMPgraphic - \writeMPgraphic{input mp-tool.mp;}% - \writeMPgraphic{pair p[];}} + \resetMPdrawing + \startMPdrawing + input mp-tool.mp; + pair p[]; + \stopMPdrawing} %D As soon as we begin a picture, we inhibit nesting by %D relaxing the start macro. The first \METAPOST\ action we @@ -125,18 +127,19 @@ %D reflect the current \METAPOST\ picture, stored in the system %D variable {\it currentpicture}, around the $x$-axis. -\def\stopTPICspecials% needs to be adapted to direct run -> \useMPgraphic - {\writeMPgraphic % otherwise \flushMPgraphics interferes - {currentpicture:=currentpicture reflectedabout ((0,0),(4095,0));}% - \stopwritingMPgraphic - \flushMPgraphics - \loadcurrentMPgraphic{}% - \setbox\MPgraphicbox=\hbox to \!!zeropoint +\def\stopTPICspecials + {\startMPdrawing + currentpicture:=currentpicture reflectedabout ((0,0),(4095,0)); + \stopMPdrawing + \MPdrawingdonetrue + \setbox\MPgraphicbox\hbox + {\getMPdrawing}% + \setbox\MPgraphicbox\hbox to \zeropoint {\kern-\wd\MPgraphicbox - \vbox to \!!zeropoint{\box\MPgraphicbox\vss}\hss}% - \ht\MPgraphicbox=\!!zeropoint - \wd\MPgraphicbox=\!!zeropoint - \dp\MPgraphicbox=\!!zeropoint + \vbox to \zeropoint{\box\MPgraphicbox\vss}\hss}% + \ht\MPgraphicbox\zeropoint + \wd\MPgraphicbox\zeropoint + \dp\MPgraphicbox\zeropoint \box\MPgraphicbox \egroup} @@ -178,17 +181,21 @@ \redefinespecial pa \using#1 #2\endspecial {\startTPICspecials \bgroup - \global\advance\TPICcounter by 1 + \global\advance\TPICcounter 1 \dimen0=#1pt \dimen0=.07227\dimen0 \dimen2=#2pt \dimen2=.07227\dimen2 - \writeMPgraphic{p[\the\TPICcounter]:=(\the\dimen0,\the\dimen2);}% + \startMPdrawing + p[\the\TPICcounter]:=(\the\dimen0,\the\dimen2); + \stopMPdrawing \egroup} \redefinespecial pn \using#1\endspecial {\startTPICspecials \bgroup \dimen0=#1pt \dimen0=.07227\dimen0 - \writeMPgraphic{pickup pencircle scaled \the\dimen0;}% + \startMPdrawing + pickup pencircle scaled \the\dimen0; + \stopMPdrawing \egroup} \redefinespecial sh \using#1\endspecial @@ -264,14 +271,15 @@ \ifTPICdraw \def\TPICgrayscale{}% \fi - \writeMPgraphic - {\ifTPICfill fill\fi\ifTPICdraw draw\fi\space - for i:=1 upto \the\TPICcounter-1: - p[i]\ifTPICcurve..\else--\fi - endfor - p[\the\TPICcounter] - \ifTPICfill\ifTPICcurve..\else--\fi cycle \fi - \TPIClinetype\space\TPICgrayscale;}% + \startMPdrawing + \ifTPICfill fill\fi\ifTPICdraw draw\fi\space + for i:=1 upto \the\TPICcounter-1: + p[i]\ifTPICcurve..\else--\fi + endfor + p[\the\TPICcounter] + \ifTPICfill\ifTPICcurve..\else--\fi cycle \fi + \TPIClinetype\space\TPICgrayscale; + \stopMPdrawing \resetTPICvariables \egroup} @@ -291,12 +299,13 @@ \dimen12=#4pt\dimen12=.14454\dimen12 \dimen20=#5pt \dimen22=#6pt - \writeMPgraphic - {\ifTPICfill fill\fi\ifTPICdraw draw\fi \space - \ifTPICfill\else subpath 4/3.14159*(\the\dimen20,\the\dimen22) of \fi - fullcircle xscaled \the\dimen10 \space yscaled \the\dimen12 \space - shifted (\the\dimen0,\the\dimen2) - \TPIClinetype \space \TPICgrayscale;}% + \startMPdrawing + \ifTPICfill fill\fi\ifTPICdraw draw\fi \space + \ifTPICfill\else subpath 4/3.14159*(\the\dimen20,\the\dimen22) of \fi + fullcircle xscaled \the\dimen10 \space yscaled \the\dimen12 \space + shifted (\the\dimen0,\the\dimen2) + \TPIClinetype \space \TPICgrayscale; + \stopMPdrawing \resetTPICvariables \egroup} @@ -304,12 +313,12 @@ %D cannot be sure if any further grouping is used by the %D envelopping macros. -\def\resetTPICvariables% - {\global\TPICcounter=0 +\def\resetTPICvariables + {\global\TPICcounter\zerocount \global\TPICfillfalse \global\TPICdrawfalse - \global\let\TPIClinetype=\empty - \global\let\TPICgrayscale=\empty} + \global\let\TPIClinetype\empty + \global\let\TPICgrayscale\empty} %D I have to admit that by using the \METAPOST\ B‚zier cubics %D routines these implementation does produce better curves @@ -337,6 +346,4 @@ %D uses delinberately the not that accurate features of %D b-splines. Hereby the user is warned. -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/supp-vis.tex b/tex/context/base/supp-vis.tex index 9979e5179..bf982d82f 100644 --- a/tex/context/base/supp-vis.tex +++ b/tex/context/base/supp-vis.tex @@ -101,13 +101,13 @@ %D unwanted results. We can therefore turn all those things %D off with \type{\dontinterfere}. -\def\dontinterfere% - {\everypar = {}% - \let\par = \endgraf - \parindent = \!!zeropoint - \parskip = \!!zeropoint - \leftskip = \!!zeropoint - \rightskip = \!!zeropoint +\def\dontinterfere + {\everypar \emptytoks + \let\par \endgraf + \parindent\zeropoint + \parskip \zeropoint + \leftskip \zeropoint + \rightskip\zeropoint \relax} %D \macros @@ -117,9 +117,9 @@ %D don't want to be confronted with to many over- and underfull %D messages we introduce \type{\dontcomplain}. -\def\dontcomplain% - {\hbadness=\!!tenthousand \vbadness=\hbadness - \hfuzz =\maxdimen \vfuzz =\hfuzz} +\def\dontcomplain + {\hbadness\!!tenthousand \vbadness\hbadness + \hfuzz \maxdimen \vfuzz \hfuzz} %D \macros %D {normaloffinterlineskip} @@ -128,7 +128,7 @@ %D \type{\offinterlineskip}. \ifx\undefined\normaloffinterlineskip - \let\normaloffinterlineskip=\offinterlineskip + \let\normaloffinterlineskip\offinterlineskip \fi %D \macros @@ -200,11 +200,11 @@ %D offers \type{\hfilneg} and \type{\vfilneg}, we define our %D own alternative double \type{ll}'ed ones. -\def\hfillneg% - {\normalhskip\!!zeropoint \!!plus-1fill\relax} +\def\hfillneg + {\normalhskip\zeropoint \!!plus-1fill\relax} -\def\vfillneg% - {\normalvskip\!!zeropoint \!!plus-1fill\relax} +\def\vfillneg + {\normalvskip\zeropoint \!!plus-1fill\relax} %D \macros %D {normalhss,normalhfil,normalhfill, @@ -240,10 +240,10 @@ \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}} + \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 @@ -339,20 +339,20 @@ {\edef\ruledheight{\the\ht#1}% \edef\ruleddepth {\the\dp#1}% \edef\ruledwidth {\the\wd#1}% - \setbox\scratchbox=\normalvbox + \setbox\scratchbox\normalvbox {\dontcomplain \normaloffinterlineskip \visualhrule \!!height\boxrulewidth - \iftoprule\else\!!width\!!zeropoint\fi + \iftoprule\else\!!width\zeropoint\fi \normalvskip-\boxrulewidth \normalhbox to \ruledwidth {\visualvrule \!!height\ruledheight \!!depth\ruleddepth \!!width\ifleftrule\else0\fi\boxrulewidth - \ifdim\ruledheight>\!!zeropoint \else \baselinerulefalse \fi - \ifdim\ruleddepth>\!!zeropoint \else \baselinerulefalse \fi + \ifdim\ruledheight>\zeropoint \else \baselinerulefalse \fi + \ifdim\ruleddepth>\zeropoint \else \baselinerulefalse \fi \ifbaselinerule \ifdim\ruledwidth<20\boxrulewidth \baselinefilltrue @@ -376,8 +376,8 @@ \normalvskip-\boxrulewidth \visualhrule \!!height\boxrulewidth - \ifbottomrule\else\!!width\!!zeropoint\fi}% - \wd#1=\!!zeropoint + \ifbottomrule\else\!!width\zeropoint\fi}% + \wd#1\zeropoint \setbox#1=\ifhbox#1\normalhbox\else\normalvbox\fi {\normalhbox {\box#1% @@ -416,7 +416,7 @@ %D %D \ShowBufferedExampleBox -\unexpanded\def\ruledhbox% +\unexpanded\def\ruledhbox {\normalhbox\bgroup \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% \normalhbox} @@ -434,7 +434,7 @@ %D %D \ShowBufferedExampleBox -\unexpanded\def\ruledvbox% +\unexpanded\def\ruledvbox {\normalvbox\bgroup \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% \normalvbox} @@ -452,7 +452,7 @@ %D %D \ShowBufferedExampleBox -\unexpanded\def\ruledvtop% +\unexpanded\def\ruledvtop {\normalvtop\bgroup \dowithnextbox{\makeruledbox\nextbox\box\nextbox\egroup}% \normalvtop} @@ -469,14 +469,14 @@ %D %D \ShowBufferedExampleBox -\unexpanded\def\ruledvcenter% +\unexpanded\def\ruledvcenter {\normalvbox\bgroup \dontinterfere \dowithnextbox - {\scratchdimen=.5\ht\nextbox - \advance\scratchdimen by .5\dp\nextbox - \ht\nextbox=\scratchdimen - \dp\nextbox=\scratchdimen + {\scratchdimen.5\ht\nextbox + \advance\scratchdimen .5\dp\nextbox + \ht\nextbox\scratchdimen + \dp\nextbox\scratchdimen \ruledhbox{\box\nextbox}% \egroup}% \normalvbox} @@ -504,11 +504,11 @@ %D At the cost of some extra macros we can implement a %D variant that does not need the~\type{=}, but we stick to: -\unexpanded\def\ruledbox% +\unexpanded\def\ruledbox {\dowithnextbox{\makeruledbox\nextbox\box\nextbox}} \def\setruledbox#1=% - {\dowithnextbox{\makeruledbox\nextbox\setbox#1=\nextbox}} + {\dowithnextbox{\makeruledbox\nextbox\setbox#1\nextbox}} %D \macros %D {investigateskip, @@ -548,30 +548,30 @@ \def\investigateskip#1% {\relax - \scratchdimen=#1\relax + \scratchdimen#1\relax \edef\!!stringa{\the\scratchdimen}% \edef\!!stringb{\the#1}% \ifx\!!stringa\!!stringb \flexiblefalse \else \flexibletrue \fi - \ifdim#1=\!!zeropoint\relax + \ifdim#1=\zeropoint\relax \zerotrue \else \zerofalse \fi - \ifdim#1<\!!zeropoint\relax + \ifdim#1<\zeropoint\relax \positivefalse \else \positivetrue \fi - \ifdim#1>\!!zeropoint\relax + \ifdim#1>\zeropoint\relax \negativefalse \else \negativetrue \fi} \def\investigatecount#1% {\relax \flexiblefalse - \ifnum#1=0 + \ifnum#1=\zerocount \zerotrue \else \zerofalse \fi - \ifnum#1<0 + \ifnum#1<\zerocount \positivefalse \else \positivetrue \fi - \ifnum#1>0 + \ifnum#1>\zerocount \negativefalse \else \negativetrue \fi} @@ -707,7 +707,7 @@ %D \type{\hbox}. \def\setvisiblehfilbox#1\to#2#3#4% - {\setbox#1=\normalhbox + {\setbox#1\normalhbox {\visualvrule \!!width#2\testrulewidth \!!height#3\testrulewidth @@ -729,7 +729,7 @@ {\normalhss\copy0\normalhss}% #1% \egroup - \setbox0=\normalhbox + \setbox0\normalhbox {\normalhskip-4\testrulewidth\copy0\copy2}% \smashbox0% \box0 @@ -793,19 +793,19 @@ %D All five substitutions use the same auxiliary macro. Watch %D the positive first -- negative next approach. -\unexpanded\def\ruledhss% +\unexpanded\def\ruledhss {\doruledhfiller\normalhss\normalhfilneg{0}{0}} -\unexpanded\def\ruledhfil% +\unexpanded\def\ruledhfil {\doruledhfiller\normalhfil\normalhfilneg{10}{-6}} -\unexpanded\def\ruledhfill% +\unexpanded\def\ruledhfill {\doruledhfiller\normalhfill\normalhfillneg{18}{-14}} -\unexpanded\def\ruledhfilneg% +\unexpanded\def\ruledhfilneg {\doruledhfiller\normalhfilneg\normalhfil{-6}{10}} -\unexpanded\def\ruledhfillneg% +\unexpanded\def\ruledhfillneg {\doruledhfiller\normalhfillneg\normalhfill{-14}{18}} %D \macros @@ -817,7 +817,7 @@ %D scheme, but are implemented in a slightly different way. \def\setvisiblevfilbox#1\to#2#3#4% - {\setbox#1=\normalhbox + {\setbox#1\normalhbox {\visualvrule \!!width#2\testrulewidth \!!height#3\testrulewidth @@ -831,12 +831,12 @@ \dontcomplain \normaloffinterlineskip \setvisiblevfilbox0\to422% - \setbox2=\normalvcue + \setbox2\normalvcue {\normalhskip -#3\testrulewidth\copy0}% \smashbox2% \copy2 \bgroup - \setbox2=\normalvcue + \setbox2\normalvcue {\normalhskip -2\testrulewidth\copy0}% \smashbox2% \copy2 @@ -844,7 +844,7 @@ \normalvbox to 12\testrulewidth {\normalvss\copy2\normalvss}% #1% - \setbox2=\normalvbox + \setbox2\normalvbox {\normalvskip-2\testrulewidth\copy2}% \smashbox2% \box2 @@ -880,19 +880,19 @@ %D Keep in mind that \type{\vfillneg} is not part of \PLAIN\ %D \TEX, but are mimmicked by a macro. -\unexpanded\def\ruledvss% +\unexpanded\def\ruledvss {\doruledvfiller\normalvss\normalvfilneg{2}} -\unexpanded\def\ruledvfil% +\unexpanded\def\ruledvfil {\doruledvfiller\normalvfil\normalvfilneg{-4}} -\unexpanded\def\ruledvfill% +\unexpanded\def\ruledvfill {\doruledvfiller\normalvfill\normalvfillneg{-12}} -\unexpanded\def\ruledvfilneg% +\unexpanded\def\ruledvfilneg {\doruledvfiller\normalvfilneg\normalvfil{8}} -\unexpanded\def\ruledvfillneg% +\unexpanded\def\ruledvfillneg {\doruledvfiller\normalvfillneg\normalvfill{16}} %D \macros @@ -932,20 +932,20 @@ %D stretch could be drawing the mid line over a length of the %D stretch, in positive or negative direction. -\def\doruledhskip% +\def\doruledhskip {\relax \dontinterfere \dontcomplain \investigateskip\scratchskip \ifzero - \setbox0=\normalhbox + \setbox0\normalhbox {\normalhskip-\testrulewidth \visualvrule \!!width4\testrulewidth \!!height16\testrulewidth \!!depth16\testrulewidth}% \else - \setbox0=\normalhbox to \ifnegative-\fi\scratchskip + \setbox0\normalhbox to \ifnegative-\fi\scratchskip {\visualvrule \!!width2\testrulewidth \ifnegative\!!depth\else\!!height\fi16\testrulewidth @@ -953,10 +953,10 @@ \visualhrule \ifnegative \!!depth2\testrulewidth - \!!height\!!zeropoint + \!!height\zeropoint \else \!!height2\testrulewidth - \!!depth\!!zeropoint + \!!depth\zeropoint \fi \normalhfill \ifflexible @@ -975,7 +975,7 @@ \visualvrule \!!width2\testrulewidth \ifnegative\!!depth\else\!!height\fi16\testrulewidth}% - \setbox0=\normalhbox + \setbox0\normalhbox {\ifnegative\else\normalhskip-\scratchskip\fi \box0}% \fi @@ -985,10 +985,10 @@ \fi \ifflexible % breaks ok but small displacements can occur - \skip2=\scratchskip - \advance\skip2 by -1\scratchskip - \divide\skip2 by 2 - \advance\scratchskip by -\skip2 + \skip2\scratchskip + \advance\skip2 -1\scratchskip + \divide\skip2 2 + \advance\scratchskip -\skip2 \normalhskip\scratchskip \normalpenalty\!!tenthousand \box0 @@ -999,7 +999,7 @@ \fi \egroup} -\unexpanded\def\ruledhskip% +\unexpanded\def\ruledhskip {\bgroup \afterassignment\doruledhskip \scratchskip=} @@ -1068,20 +1068,20 @@ %D precaution probably is not completely waterproof, it works %D quite well. -\def\dodoruledvskip% - {\nextdepth=\prevdepth +\def\dodoruledvskip + {\nextdepth\prevdepth \dontinterfere \dontcomplain \normaloffinterlineskip \investigateskip\scratchskip \ifzero - \setbox0=\normalvcue + \setbox0\normalvcue {\visualvrule \!!width32\testrulewidth \!!height2\testrulewidth \!!depth2\testrulewidth}% \else - \setbox0=\normalvbox to \ifnegative-\fi\scratchskip + \setbox0\normalvbox to \ifnegative-\fi\scratchskip {\visualhrule \!!width16\testrulewidth \!!height2\testrulewidth @@ -1103,42 +1103,42 @@ \visualhrule \!!width16\testrulewidth \!!height2\testrulewidth}% - \setbox2=\normalvbox to \ht0 + \setbox2\normalvbox to \ht0 {\visualhrule \!!width2\testrulewidth \!!height\ht0}% \ifnegative - \ht0=\!!zeropoint - \setbox0=\normalhbox + \ht0\zeropoint + \setbox0\normalhbox {\normalhskip2\testrulewidth % will be improved \normalhskip-\wd0\box0}% \fi \smashbox0% \smashbox2% - \setbox0=\normalvcue + \setbox0\normalvcue {\box2\box0}% - \setbox0=\normalvbox + \setbox0\normalvbox {\ifnegative\normalvskip\scratchskip\fi\box0}% \smashbox0% \fi \ifvisiblestretch \ifflexible - \skip2=\scratchskip - \advance\skip2 by -1\scratchskip - \divide\skip2 by 2 - \advance\scratchskip by -\skip2 + \skip2\scratchskip + \advance\skip2 -1\scratchskip + \divide\skip2 2 + \advance\scratchskip -\skip2 \normalvskip\skip2 \fi \fi \normalpenalty\!!tenthousand \box0 - \prevdepth=\nextdepth % not \dp0=\nextdepth + \prevdepth\nextdepth % not \dp0=\nextdepth \normalvskip\scratchskip} %D We try to avoid interfering at the top of a page. Of course %D we only do so when we are in the main vertical list. -\def\doruledvskip% +\def\doruledvskip {\endgraf % \par \ifdim\pagegoal=\maxdimen \ifinner @@ -1149,7 +1149,7 @@ \fi \egroup} -\unexpanded\def\ruledvskip% +\unexpanded\def\ruledvskip {\bgroup \afterassignment\doruledvskip \scratchskip=} @@ -1184,24 +1184,24 @@ %D visualized a bit different, because we want to see them %D anyhow. -\def\doruledhkern% +\def\doruledhkern {\dontinterfere \dontcomplain \baselinerulefalse \investigateskip\scratchskip - \boxrulewidth=2\testrulewidth + \boxrulewidth2\testrulewidth \ifzero - \setbox0=\ruledhbox to 8\testrulewidth + \setbox0\ruledhbox to 8\testrulewidth {\visualvrule - \!!width\!!zeropoint + \!!width\zeropoint \!!height16\testrulewidth \!!depth16\testrulewidth}% - \setbox0=\normalhbox + \setbox0\normalhbox {\normalhskip-4\testrulewidth\box0}% \else - \setbox0=\ruledhbox to \ifnegative-\fi\scratchskip + \setbox0\ruledhbox to \ifnegative-\fi\scratchskip {\visualvrule - \!!width\!!zeropoint + \!!width\zeropoint \ifnegative\!!depth\else\!!height\fi16\testrulewidth \ifflexible \normalhskip2\testrulewidth @@ -1217,12 +1217,12 @@ \else \normalhfill \fi}% - \testrulewidth=2\testrulewidth - \setbox0=\ruledhbox{\box0}% \make... + \testrulewidth2\testrulewidth + \setbox0\ruledhbox{\box0}% \make... \fi \smashbox0% \normalpenalty\!!tenthousand - \normalhbox to \!!zeropoint + \normalhbox to \zeropoint {\ifnegative\normalhskip1\scratchskip\fi \box0}% \afterwards\scratchskip @@ -1230,7 +1230,7 @@ \unexpanded\def\ruledhkern#1% {\bgroup - \let\afterwards=#1\relax + \let\afterwards#1% \afterassignment\doruledhkern \scratchskip=} @@ -1258,22 +1258,22 @@ %D Like before, we have to postpone \type{\prevdepth}. If we %D leave out this trick, we got ourselves some wrong spacing. -\def\dodoruledvkern% - {\nextdepth=\prevdepth +\def\dodoruledvkern + {\nextdepth\prevdepth \dontinterfere \dontcomplain \baselinerulefalse \normaloffinterlineskip \investigateskip\scratchskip - \boxrulewidth=2\testrulewidth + \boxrulewidth2\testrulewidth \ifzero - \setbox0=\ruledhbox to 32\testrulewidth + \setbox0\ruledhbox to 32\testrulewidth {\visualvrule - \!!width\!!zeropoint + \!!width\zeropoint \!!height4\testrulewidth \!!depth4\testrulewidth}% \else - \setbox0=\ruledvbox to \ifnegative-\fi\scratchskip + \setbox0\ruledvbox to \ifnegative-\fi\scratchskip {\hsize16\testrulewidth \ifflexible \cleaders @@ -1289,24 +1289,24 @@ \normalvfill \else \visualvrule - \!!width\!!zeropoint + \!!width\zeropoint \!!height\ifnegative-\fi\scratchskip \normalhfill \fi} \fi - \testrulewidth=2\testrulewidth - \setbox0=\ruledvbox{\box0}% \make... + \testrulewidth2\testrulewidth + \setbox0\ruledvbox{\box0}% \make... \smashbox0% - \setbox0=\normalvbox + \setbox0\normalvbox {\ifnegative\normalvskip\scratchskip\fi \normalvcue {\ifnegative\normalhskip-16\testrulewidth\fi\box0}}% \smashbox0% \normalpenalty\!!tenthousand \box0 - \prevdepth=\nextdepth} % not \dp0=\nextdepth + \prevdepth\nextdepth} % not \dp0=\nextdepth -\def\doruledvkern% +\def\doruledvkern {\ifdim\pagegoal=\maxdimen \ifinner \dodoruledvkern @@ -1319,11 +1319,11 @@ \unexpanded\def\ruledvkern#1% {\bgroup - \let\afterwards=#1\relax + \let\afterwards#1\relax \afterassignment\doruledvkern \scratchskip=} -\unexpanded\def\ruledkern% +\unexpanded\def\ruledkern {\ifvmode \expandafter\ruledvkern \else @@ -1361,16 +1361,16 @@ %D %D \ShowBufferedExample -\def\doruledhglue% +\def\doruledhglue {\leavevmode - \scratchcounter=\spacefactor - \visualvrule\!!width\!!zeropoint + \scratchcounter\spacefactor + \visualvrule\!!width\zeropoint \normalpenalty\!!tenthousand \ruledhkern\normalhskip\scratchskip - \spacefactor=\scratchcounter + \spacefactor\scratchcounter \egroup} -\unexpanded\def\ruledhglue% +\unexpanded\def\ruledhglue {\bgroup \afterassignment\doruledhglue\scratchskip=} @@ -1391,16 +1391,16 @@ %D %D \ShowBufferedExample -\def\doruledvglue% +\def\doruledvglue {\endgraf % \par - \nextdepth=\prevdepth - \visualhrule\!!height\!!zeropoint + \nextdepth\prevdepth + \visualhrule\!!height\zeropoint \normalpenalty\!!tenthousand \ruledvkern\normalvskip\scratchskip - \prevdepth=\nextdepth + \prevdepth\nextdepth \egroup} -\unexpanded\def\ruledvglue% +\unexpanded\def\ruledvglue {\bgroup \afterassignment\doruledvglue\scratchskip=} @@ -1416,9 +1416,9 @@ \def\dodoruledmkern#1% {\dontinterfere \dontcomplain - \setbox0=\normalhbox + \setbox0\normalhbox {$\normalmkern\ifnegative-\fi\scratchmuskip$}% - \setbox0=\normalhbox to \wd0 + \setbox0\normalhbox to \wd0 {\visualvrule \!!height16\testrulewidth \!!depth16\testrulewidth @@ -1459,12 +1459,12 @@ %D %D \ShowBufferedExample -\def\doruledmkern% +\def\doruledmkern {\investigatemuskip\scratchmuskip \flexiblefalse \dodoruledmkern\normalmkern} -\unexpanded\def\ruledmkern% +\unexpanded\def\ruledmkern {\bgroup \afterassignment\doruledmkern\scratchmuskip=} @@ -1477,12 +1477,12 @@ %D %D \ShowBufferedExample -\def\doruledmskip% +\def\doruledmskip {\investigatemuskip\scratchmuskip \flexibletrue \dodoruledmkern\normalmskip} -\unexpanded\def\ruledmskip% +\unexpanded\def\ruledmskip {\bgroup \afterassignment\doruledmskip\scratchmuskip=} @@ -1555,7 +1555,7 @@ %D test \def\setruledpenaltybox#1#2#3#4#5#6% - {\setbox#1=\normalhbox + {\setbox#1\normalhbox {\ifnum#2=0 \else \ifnum#2>0 \def\sign{+}% @@ -1593,13 +1593,13 @@ \fi}% \smashbox#1} -\def\doruledhpenalty% +\def\doruledhpenalty {\dontinterfere \dontcomplain \investigatecount\scratchcounter - \testrulewidth=2\testrulewidth - \boxrulewidth=\testrulewidth - \setbox0=\ruledhbox to 8\testrulewidth + \testrulewidth2\testrulewidth + \boxrulewidth\testrulewidth + \setbox0\ruledhbox to 8\testrulewidth {\ifnegative\else\normalhss\fi \visualvrule \!!depth8\testrulewidth @@ -1607,7 +1607,7 @@ \ifpositive\else\normalhss\fi}% \setruledpenaltybox{2}{\scratchcounter}{0}{8}{-3.5}{4.5}% \normalpenalty\!!tenthousand - \setbox0=\normalhbox + \setbox0\normalhbox {\normalhskip-4\testrulewidth \ifnegative \box2\box0 @@ -1619,7 +1619,7 @@ \normalpenalty\scratchcounter \egroup} -\unexpanded\def\ruledhpenalty% +\unexpanded\def\ruledhpenalty {\bgroup \afterassignment\doruledhpenalty \scratchcounter=} @@ -1643,26 +1643,26 @@ %D %D \ShowBufferedExample -\def\doruledvpenalty% +\def\doruledvpenalty {\ifdim\pagegoal=\maxdimen \else - \nextdepth=\prevdepth + \nextdepth\prevdepth \dontinterfere \dontcomplain \investigatecount\scratchcounter - \testrulewidth=2\testrulewidth - \boxrulewidth=\testrulewidth - \setbox0=\ruledhbox + \testrulewidth2\testrulewidth + \boxrulewidth\testrulewidth + \setbox0\ruledhbox {\visualvrule \!!height4\testrulewidth \!!depth4\testrulewidth - \!!width\!!zeropoint + \!!width\zeropoint \visualvrule \!!height\ifnegative.5\else4\fi\testrulewidth \!!depth\ifpositive.5\else4\fi\testrulewidth \!!width8\testrulewidth}% \setruledpenaltybox{2}{\scratchcounter}{4}{4}{.5}{.5}% - \setbox0=\normalhbox + \setbox0\normalhbox {\normalhskip-4\testrulewidth \ifnegative \box2\box0 @@ -1673,19 +1673,19 @@ \smashbox0% \normalpenalty\!!tenthousand \nointerlineskip - \dp0=\nextdepth % not \prevdepth=\nextdepth + \dp0\nextdepth % not \prevdepth=\nextdepth \normalvbox {\normalvcue{\box0}}% \fi \normalpenalty\scratchcounter \egroup} -\unexpanded\def\ruledvpenalty% +\unexpanded\def\ruledvpenalty {\bgroup \afterassignment\doruledvpenalty \scratchcounter=} -\unexpanded\def\ruledpenalty% +\unexpanded\def\ruledpenalty {\ifvmode \expandafter\ruledvpenalty \else @@ -1794,7 +1794,7 @@ \newif\ifshowingcomposition -\def\showcomposition% +\def\showcomposition {\ifshowingcomposition \showfils \showboxes @@ -1802,7 +1802,7 @@ \showpenalties \fi} -\def\dontshowcomposition% +\def\dontshowcomposition {\ifshowingcomposition \dontshowfils \dontshowboxes @@ -1836,8 +1836,8 @@ \def\defaulttestrulewidth{.02\korpsgrootte} % still dutch \fi -\def\showmakeup% - {\testrulewidth=\defaulttestrulewidth +\def\showmakeup + {\testrulewidth\defaulttestrulewidth \showingcompositiontrue \showcomposition} diff --git a/tex/context/base/symb-eur.tex b/tex/context/base/symb-eur.tex index ab1d0a2c6..2adbd874d 100644 --- a/tex/context/base/symb-eur.tex +++ b/tex/context/base/symb-eur.tex @@ -42,7 +42,13 @@ \stopencoding -\unexpanded\def\euro{\doiftextelse{\texteuro}{\texteuro}{\symbol[euro]}} +\unexpanded\def\euro{\doiftextelse\texteuro\texteuro{\symbol[euro]}} + +% ok for one font series, but not for mixed sets +% +% \unexpanded\def\euro +% {\doiftextelse \texteuro \texteuro +% {\unexpanded\def\euro{\symbol[euro]}\euro} %D The next table shows the complete set of symbols: %D diff --git a/tex/context/base/symb-ini.tex b/tex/context/base/symb-ini.tex index 6dc5d561b..76a7fca24 100644 --- a/tex/context/base/symb-ini.tex +++ b/tex/context/base/symb-ini.tex @@ -197,7 +197,7 @@ \appendtoks \resetexternalfigures \to \everysymbol -\def\definefiguresymbol% +\def\definefiguresymbol {\dotripleempty\dodefinefiguresymbol} \def\dodefinefiguresymbol[#1][#2][#3]% @@ -324,9 +324,9 @@ \def\dousesymbols#1% {\makeshortfilename[\f!symbolprefix#1]% - \showmessage{\m!symbols}{1}{#1}% + \showmessage\m!symbols1{#1}% \startreadingfile - \readsysfile{\shortfilename}{}{}% + \readsysfile\shortfilename\donothing\donothing \stopreadingfile} \def\usesymbols[#1]% diff --git a/tex/context/base/symb-nav.tex b/tex/context/base/symb-nav.tex index 34c4bbd81..71c6a8068 100644 --- a/tex/context/base/symb-nav.tex +++ b/tex/context/base/symb-nav.tex @@ -92,6 +92,4 @@ %D \showsymbolset[navigation 2] %D \showsymbolset[navigation 3] -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/syst-con.tex b/tex/context/base/syst-con.tex index 2df621b64..b69adcf66 100644 --- a/tex/context/base/syst-con.tex +++ b/tex/context/base/syst-con.tex @@ -26,18 +26,46 @@ %D In addition to the uppercase hex conversion, as needed in %D math families, we occasionally need a lowercase one, for %D instance when we want to compose gbsong fontnames. - -\def\uchexnumber#1% - {\ifcase#1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or - 8\or 9\or A\or B\or C\or D\or E\or F\else 0\fi} +%D +%D The ugly indirectness is needed to get rid of \TEX\ +%D induced spaces and \type {\relax}'s. +%D +%D \starttypen +%D [\uchexnumber{0}] +%D [\uchexnumber\scratchcounter] +%D [\uchexnumber\zerocount] +%D [\uchexnumber{\number0}] +%D [\uchexnumber{\number\scratchcounter}] +%D [\uchexnumber{\number\zerocount}] +%D [\uchexnumber{\the\scratchcounter}] +%D [\uchexnumber{\the\zerocount}] +%D [\expandafter\uchexnumber\expandafter{\number0}] +%D [\expandafter\uchexnumber\expandafter{\number\scratchcounter}] +%D [\expandafter\uchexnumber\expandafter{\number\zerocount}] +%D [\expandafter\uchexnumber\expandafter{\the\scratchcounter}] +%D [\expandafter\uchexnumber\expandafter{\the\zerocount}] +%D \stoptypen \def\lchexnumber#1% + {\@EA\dolchexnumber\number#1\relax} + +\def\dolchexnumber#1\relax % \def\lchexnumber#1% {\ifcase#1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\or 9\or a\or b\or c\or d\or e\or f\else 0\fi} +\def\uchexnumber#1% + {\@EA\douchexnumber\number#1\relax} + +\def\douchexnumber#1\relax % \def\uchexnumber#1% + {\ifcase#1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or + 8\or 9\or A\or B\or C\or D\or E\or F\else 0\fi} + \let\hexnumber=\uchexnumber \def\lchexnumbers#1% + {\@EA\dolchexnumbers\number#1\relax} + +\def\dolchexnumbers#1\relax % \def\lchexnumbers#1% {\ifcase#1 00\or 01\or 02\or 03\or 04\or 05\or 06\or 07\or 08\or 09\or 0a\or 0b\or 0c\or 0d\or 0e\or 0f\or 10\or 11\or 12\or 13\or 14\or 15\or 16\or 17\or 18\or 19\or 1a\or 1b\or 1c\or 1d\or 1e\or 1f\or @@ -56,7 +84,10 @@ e0\or e1\or e2\or e3\or e4\or e5\or e6\or e7\or e8\or e9\or ea\or eb\or ec\or ed\or ee\or ef\or f0\or f1\or f2\or f3\or f4\or f5\or f6\or f7\or f8\or f9\or fa\or fb\or fc\or fd\or fe\or ff\fi} -\def\uchexnumbers#1% +\def\uchexnumbers#1% + {\@EA\douchexnumbers\number#1\relax} + +\def\douchexnumbers#1\relax % \def\uchexnumbers#1% {\ifcase#1 00\or 01\or 02\or 03\or 04\or 05\or 06\or 07\or 08\or 09\or 0A\or 0B\or 0C\or 0D\or 0E\or 0F\or 10\or 11\or 12\or 13\or 14\or 15\or 16\or 17\or 18\or 19\or 1A\or 1B\or 1C\or 1D\or 1E\or 1F\or @@ -81,6 +112,9 @@ %D For unicode remapping purposes, we need octal numbers. \def\octnumber#1% + {\@EA\dooctnumber\number#1\relax} + +\def\dooctnumber#1\relax % \def\octnumber#1% {\ifcase#1 000\or 001\or 002\or 003\or 004\or 005\or 006\or 007\or 010\or 011\or 012\or 013\or 014\or 015\or 016\or 017\or diff --git a/tex/context/base/syst-etx.tex b/tex/context/base/syst-etx.tex index 62ae3c54a..8c6f68559 100644 --- a/tex/context/base/syst-etx.tex +++ b/tex/context/base/syst-etx.tex @@ -234,4 +234,23 @@ \let\normalprotected = \protected \let\normalunexpanded = \unexpanded +%D \macros +%D {begcsname} +%D +%D Handy for \ETEX-only usage: + +\beginETEX \ifcsname + +\def\begcsname#1\endcsname + {\ifcsname#1\endcsname\csname#1\endcsname\fi} + +\endETEX + +\beginTEX + +\def\begcsname#1\endcsname + {\csname#1\endcsname} + +\endTEX + \protect \endinput diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex index 5a110fe70..d283aa056 100644 --- a/tex/context/base/syst-ext.tex +++ b/tex/context/base/syst-ext.tex @@ -46,11 +46,11 @@ %D \type {\redoglobal}. When using only alternatives, one can %D reset this mechanism with \type {\resetglobal}. -\def\doglobal% +\def\doglobal {\let\redoglobal\global \def\dodoglobal{\resetglobal\global}} -\def\resetglobal% +\def\resetglobal {\let\redoglobal\relax \let\dodoglobal\relax} @@ -58,7 +58,7 @@ %D New: -\def\doglobal% +\def\doglobal {\ifx\redoglobal\relax \let\redoglobal\global \let\dodoglobal\@@dodoglobal @@ -218,6 +218,10 @@ % % And this is the one optimized for speed: +\def\!!zerocount {0} % alongside \zerocount +\def\!!minusone {-1} % alongside \minusone +\def\!!plusone {1} % alongside \plusone + \beginTEX \def\dodoindecrement#1(#2,#3)% @@ -239,18 +243,22 @@ \def\doincrement#1% 10% faster alternative {\ifx#1\undefined - \dodoglobal\edef#1{1}% + %\dodoglobal\edef#1{1}% + \dodoglobal\let#1\!!plusone \else\ifx#1\relax % \csname...\endcsname - \dodoglobal\edef#1{1}% + %\dodoglobal\edef#1{1}% + \dodoglobal\let#1\!!plusone \else \fastincrement#1% \fi\fi} -\def\dodecrement#1% 10% faster alternative +\def\dodecrement#1% 10% faster alternative {\ifx#1\undefined - \dodoglobal\edef#1{\minusone}% + %\dodoglobal\edef#1{-1}% + \dodoglobal\let#1\!!minusone \else\ifx#1\relax % \csname...\endcsname - \dodoglobal\edef#1{\minusone}% + %\dodoglobal\edef#1{-1}% + \dodoglobal\let#1\!!minusone \else \fastdecrement#1% \fi\fi} @@ -313,7 +321,7 @@ \def\newsignal#1% {\ifx#1\undefined - \advance\maximumsignal by 2sp % to be save in rounding + \advance\maximumsignal 2sp % to be save in rounding \edef#1{\the\maximumsignal}% \fi} @@ -367,7 +375,7 @@ %D %D This expands to \type{\ifsomething}. -\def\strippedcsname% +\def\strippedcsname {\expandafter\gobbleoneargument\string} %D \macros @@ -530,10 +538,10 @@ %D \long\setvalue{\@@arecurse\recursedepth}{#5}% %D \dodorecurse} %D -%D \def\donorecurse% +%D \def\donorecurse %D {} %D -%D \def\dododorecurse% +%D \def\dododorecurse %D {\edef\recurselevel{\csname\@@irecurse\recursedepth\endcsname}% %D \getvalue{\@@arecurse\recursedepth}% %D \edef\recurselevel{\csname\@@irecurse\recursedepth\endcsname}% @@ -542,7 +550,7 @@ %D \setevalue{\@@irecurse\recursedepth}{\the\innerrecurse}% %D \dodorecurse} %D -%D \def\dodorecurse% +%D \def\dodorecurse %D {\ifnum\csname\@@irecurse\recursedepth\endcsname %D \csname\@@drecurse\recursedepth\endcsname %D \csname\@@nrecurse\recursedepth\endcsname\relax @@ -1060,7 +1068,7 @@ %D powerful. %D \macros -%D {convertargument,convertcommand} +%D {convertargument,convertcommand,convertvalue} %D %D Some persistent experimenting led us to the next macro. This %D macro converts a parameter or an expanded macro to it's @@ -1093,38 +1101,51 @@ \def\doconvertargument#1>{} -\def\convertedcommand% +\def\convertedcommand {\expandafter\doconvertargument\meaning} +%\long\def\convertargument#1\to#2% +% {\long\def\convertedargument{#1}% +% \dodoglobal\edef#2{\convertedcommand\convertedargument}} + \long\def\convertargument#1\to#2% - {\long\def\convertedargument{#1}% - \dodoglobal\edef#2{\convertedcommand\convertedargument}} + {\long\def#2{#1}% saves a restore + \dodoglobal\edef#2{\convertedcommand#2}} \long\def\convertcommand#1\to#2% {\dodoglobal\edef#2{\convertedcommand#1}} \endTEX +\def\convertvalue#1\to + {\expandafter\convertcommand\csname#1\endcsname\to} + %D In \ETEX\ we can use \type {\detokenize} and gain some %D speed, but in general far less that 1\% for \type %D {\convertargument} and nil for \type {\convertcommand}. %D This macro is more robust than the pure \TEX\ one, %D something I found out when primitives like \type -%D {\jobname}. +%D {\jobname} were fed (or something undefined). \beginETEX \detokenize \long\def\convertargument#1\to#2% {\dodoglobal\edef#2{\detokenize{#1}}} - + % \long\def\convertcommand#1\to#2% % {\@EA\dodoglobal\@EA\edef\@EA#2\@EA{\@EA\detokenize\@EA{#1}}} - + \long\def\convertcommand#1\to#2% {\dodoglobal\edef#2{\@EA\detokenize\@EA{#1}}} \endETEX +%D When you try to convert a primitive command, you'll find +%D out that the \ETEX\ method fails on for instance \type +%D {\jobname} in the sense that it returns the filename +%D instead of just \type {\jobname}. So far this does not +%D give real problems. + %D This is typically a macro that one comes to after reading %D the \TEX book carefully. Even then, the definite solution %D was found after rereading the \TEX book. The first @@ -1137,13 +1158,11 @@ %D The \type{-}, the delimiter \type{\\\\} and the the second %D argument are completely redundant. -% this does not work ok yet -% % %D As said, the \TEX\ alternative fails on expanding primitives, % %D like in: % %D % %D \starttypen -% %D \convertcommand\jobname\to\ascii +% %D \convertcommand\someprimitive\to\ascii % %D \stoptypen % %D % %D Because these primitives convert to themselves, we can use @@ -1152,24 +1171,26 @@ % %D more robust alternative. The catcode trickery is needed to % %D get the backslash into the test as character (and not as % %D escape, letter or whatever code else). -% -% \beginTEX -% -% \let\dodoconvertargument\doconvertargument -% -% \bgroup -% \catcode`\*=\@@escape -% \catcode`\\=\@@other -% *gdef*doconvertargument#1% -% {*ifx#1\*else*expandafter*dodoconvertargument*fi#1} -% *egroup -% -% \endTEX +% % +% % does not work: +% % +% % \beginTEX +% % +% % \let\dodoconvertargument\doconvertargument +% % +% % \bgroup +% % \catcode`\*=\@@escape +% % \catcode`\\=\@@other +% % *gdef*doconvertargument#1% +% % {*ifx#1\*else*expandafter*dodoconvertargument*fi#1} +% % *egroup +% % +% % \endTEX %D \macros %D {showvalue,showargument} %D -%D A handy macro for testing purposes only, is the following: +%D Two handy macros for testing purposes only: \def\showvalue#1% {\expandafter\show\csname#1\endcsname} @@ -1191,24 +1212,49 @@ %D %D Watch the one level expansion of the second argument. -\def\doifmeaningelse#1#2#3#4% +\def\doifmeaningelse#1#2% {\edef\!!stringa{\meaning#1}% \def\!!stringb{#2}\edef\!!stringb{\meaning\!!stringb}% - \ifx\!!stringa\!!stringb#3\else#4\fi} + \ifx\!!stringa\!!stringb + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} %D \macros -%D {doifsamestringselse} +%D {doifsamestringselse,doifsamestring,doifnotsamestring} %D %D The next comparison macro converts the arguments into %D expanded strings. This command can be used to compare for %D instance \type {\jobname} with a name stored in a macro. -\def\doifsamestringelse#1#2#3#4% +\def\@@doifsamestringelse#1#2% {\edef\!!stringa{#1}% \edef\!!stringb{#2}% \convertcommand\!!stringa\to\!!stringa \convertcommand\!!stringb\to\!!stringb - \ifx\!!stringa\!!stringb#3\else#4\fi} + \ifx\!!stringa\!!stringb} + +\def\doifsamestringelse#1#2% + {\@@doifsamestringelse{#1}{#2}% + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +\def\doifsamestring#1#2% + {\@@doifsamestringelse{#1}{#2}% + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + +\def\doifnotsamestring#1#2% + {\@@doifsamestringelse{#1}{#2}% + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} %D \macros %D {ExpandFirstAfter,ExpandSecondAfter,ExpandBothAfter} @@ -1237,10 +1283,10 @@ %D but the faster \type{\ExpandAfter} does not. \def\simpleExpandFirstAfter#1% - {\edef\@@expanded{\noexpand\ExpandCommand{#1}}\@@expanded} + {\long\xdef\@@expanded{\noexpand\ExpandCommand{#1}}\@@expanded} \def\complexExpandFirstAfter[#1]% - {\edef\@@expanded{\noexpand\ExpandCommand[#1]}\@@expanded} + {\long\xdef\@@expanded{\noexpand\ExpandCommand[#1]}\@@expanded} \def\ExpandFirstAfter#1% {\let\ExpandCommand#1% @@ -1248,13 +1294,13 @@ \def\ExpandSecondAfter#1#2#3% {\scratchtoks{#2}% - \edef\@@expanded{\noexpand#1{\the\scratchtoks}{#3}}\@@expanded} + \long\xdef\@@expanded{\noexpand#1{\the\scratchtoks}{#3}}\@@expanded} \def\ExpandBothAfter#1#2#3% - {\edef\@@expanded{\noexpand#1{#2}{#3}}\@@expanded} + {\long\xdef\@@expanded{\noexpand#1{#2}{#3}}\@@expanded} \def\ExpandAfter#1#2% - {\edef\@@expanded{\noexpand#1{#2}}\@@expanded} + {\long\xdef\@@expanded{\noexpand#1{#2}}\@@expanded} %D Now we can for instance define \type{\ifinstringelse} as: @@ -1335,7 +1381,7 @@ \def\CheckConstantAfter#1#2% {\@EA\convertargument\v!prefix!\to\ascii \convertargument#1\to#2\relax - \doifinstringelse{\ascii}{#2} + \doifinstringelse\ascii{#2} {\expandafter\convertargument#1\to#2} {}} @@ -1356,7 +1402,7 @@ %D We don't explicitly test if the macro is defined. \def\assignifempty#1#2% can be sped up - {\doifnot{#1}{}{\def#1{#2}}} + {\doifsomething{#1}{\def#1{#2}}} % {\doifnot{#1}{}{\def#1{#2}}} %D \macros %D {gobbleuntil,grabuntil,gobbleuntilrelax, @@ -1385,9 +1431,9 @@ %D \grabuntil{stop}\command %D \stoptypen %D -%D This commands executed, after having encountered -%D \type{\stop} the command \type{\command}. This command -%D receives as argument the text preceding the \type{\stop}. +%D This commands executes, after having encountered +%D \type {\stop} the command \type {\command}. This command +%D receives as argument the text preceding the \type {\stop}. %D This means that: %D %D \starttypen @@ -1428,8 +1474,7 @@ %D everything preceding \type{\command}. \long\def\processbetween#1#2% - {\setvalue{\s!start#1}% - {\grabuntil{\s!stop#1}{#2}}} + {\setvalue{\s!start#1}{\grabuntil{\s!stop#1}{#2}}} \def\gobbleuntil#1% {\long\def\next##1#1{}\next} @@ -1545,10 +1590,8 @@ \long\def\HandleGroup#1#2% {\bgroup - \long\def\BeforeGroup% - {\bgroup#1\bgroup\aftergroup\AfterGroup}% - \long\def\AfterGroup% - {#2\egroup\egroup}% + \long\def\BeforeGroup{\bgroup#1\bgroup\aftergroup\AfterGroup}% + \long\def\AfterGroup {#2\egroup\egroup}% \afterassignment\BeforeGroup \let\next=} @@ -1696,20 +1739,7 @@ \let\endoflinetoken=^^M -%\def\doGotoPar% -% {\ifx\nextchar\blankspace -% \let\donext\GotoPar -% \else\ifx\nextchar\endoflinetoken -% \let\donext\GotoPar -% \else -% \def\donext% -% {\the\BeforePar -% \BeforePar\emptytoks -% \nextchar}% -% \fi\fi -% \donext} - -\def\doGotoPar% +\def\doGotoPar {\ifx\nextchar\blankspace \@EA\GotoPar \else\ifx\nextchar\endoflinetoken @@ -1723,29 +1753,14 @@ \BeforePar\emptytoks \nextchar} -\def\GotoPar% +\def\GotoPar {\afterassignment\doGotoPar\let\nextchar=} %D Its big brother \type{\GetPar} redefines the \type{\par} %D primitive, which can lead to unexpected results, depending %D in the context. -% \def\GetPar% -% {\edef\next% -% {\BeforePar -% {\the\BeforePar -% \BeforePar\emptytoks -% \bgroup -% \def\par% -% {\egroup -% \par -% \the\AfterPar -% \BeforePar\emptytoks -% \AfterPar\emptytoks}}}% -% \next -% \GotoPar} - -\def\GetPar% +\def\GetPar {\expanded {\BeforePar {\the\BeforePar @@ -1759,6 +1774,29 @@ \AfterPar\emptytoks}}}% \GotoPar} +%D New and better alternatives: + +\def\dowithpar#1#2% + {\def\handlepar##1\par{#1##1#2}% + \def\gobblepar\par{\dowithpar{#1}{#2}}% + \doifnextcharelse\par\gobblepar\handlepar} + +% nicer + +\def\redowithpar\par + {\doifnextcharelse\par\redowithpar\dodowithpar}% + +\def\dowithpar#1#2% + {\def\dodowithpar##1\par{#1##1#2}% + \redowithpar\par} + +\def\redogotopar\par + {\doifnextcharelse\par\redogotopar\dodogotopar}% + +\def\dogotopar#1% + {\def\dodogotopar{#1}% + \redogotopar\par} + %D \macros %D {dowithpargument,dowithwargument} %D @@ -1916,6 +1954,8 @@ %D a row. In both commands, the \type{n*} is optional. When this %D specification is missing, the command executes once. +% ! ! ! obsolete ! ! ! + \def\dorepeat[#1]% {\dodorepeat#1*\empty*\relax} @@ -2169,28 +2209,30 @@ %D here: \def\makecounter#1% - {\global\letvalue{#1}\zerocountervalue} % see earlier + {\letgvalue{#1}\zerocountervalue} % see earlier + +% \def\countervalue#1% +% {\getvalue{#1}} + +\let\countervalue\getvalue \def\pluscounter#1% - {\scratchcounter=\getvalue{#1}\relax + {\scratchcounter\getvalue{#1}% \advance\scratchcounter \plusone \setxvalue{#1}{\the\scratchcounter}} \def\minuscounter#1% - {\scratchcounter=\getvalue{#1}\relax + {\scratchcounter\getvalue{#1}% \advance\scratchcounter \minusone \setxvalue{#1}{\the\scratchcounter}} \def\resetcounter#1% - {\global\letvalue{#1}\zerocountervalue} + {\letgvalue{#1}\zerocountervalue} \def\setcounter#1#2% - {\scratchcounter=#2\relax + {\scratchcounter#2% \setxvalue{#1}{\the\scratchcounter}} -\def\countervalue#1% - {\getvalue{#1}} - %D \macros %D {savecounter,restorecounter} %D @@ -2214,6 +2256,9 @@ \def\makecounter#1% {\global\@EA\let\csname#1\endcsname\zerocountervalue} % see earlier +\def\countervalue#1% + {\csname#1\endcsname} + \def\pluscounter#1% {\@EA\xdef\csname#1\endcsname{\the\numexpr(\csname#1\endcsname+1)}} @@ -2226,9 +2271,6 @@ \def\setcounter#1#2% {\@EA\xdef\csname#1\endcsname{\the\numexpr(#2)}} -\def\countervalue#1% - {\csname#1\endcsname} - \def\savecounter#1% {\@EA\xdef\csname !#1\endcsname{\the\numexpr(\csname#1\endcsname)}} @@ -2279,6 +2321,46 @@ {\def#3{##1}\def#4{##2}}% \@EA\dosplitstring#1#2#2\\} +%D \macros +%D {beforetestandsplitstring, +%D aftertestandsplitstring, +%D testandsplitstring} +%D +%D The next alternatives are for Simon Pepping. This time +%D the result is empty when no split is done. + +% \def\beforetestandsplitstring#1\at#2\to#3% +% {\def\dosplitstring##1#2##2#2##3\\{\doifelsenothing +% {##3}{\let#3\empty}{\def#3{##1}}}% +% \@EA\dosplitstring#1#2#2\\} +% +% \def\aftertestandsplitstring#1\at#2\to#3% +% {\def\dosplitstring ##1#2##2@@@##3\\{\doifelsenothing +% {##3}{\let#3\empty}{\def#3{##2}}}% +% \@EA\dosplitstring #1@@@#2@@@\\} +% +% \def\testandsplitstring#1\at#2\to#3\and#4% +% {\def\dosplitstring##1#2##2#2##3\\{\doifelsenothing +% {##3}{\let#3\empty\let#4\empty}{\def#3{##1}\def#4{##2}}}% +% \@EA\dosplitstring#1#2#2\\} +% +% faster: + +\def\beforetestandsplitstring#1\at#2\to#3% + {\def\dosplitstring##1#2##2#2##3##4\\% + {\ifx##3\empty\let#3\empty\else\def#3{##1}\fi}% + \@EA\dosplitstring#1#2#2\empty\\} + +\def\aftertestandsplitstring#1\at#2\to#3% + {\def\dosplitstring ##1#2##2@@@##3##4\\% + {\ifx##3\empty\let#3\empty\else\def#3{##2}\fi}% + \@EA\dosplitstring #1@@@#2@@@\empty\\} + +\def\testandsplitstring#1\at#2\to#3\and#4% + {\def\dosplitstring##1#2##2#2##3##4\\% + {\ifx##3\empty\let#3\empty\let#4\empty\else\def#3{##1}\def#4{##2}\fi}% + \@EA\dosplitstring#1#2#2\empty\\} + %D \macros %D {removesubstring} %D @@ -2516,7 +2598,7 @@ \advance\commalistcounter\plusone}% \let\commalistelement\empty \let\newcommalist\empty - \commalistcounter=1 + \commalistcounter\plusone \@EA\processcommalist\@EA[#1]\doreplaceincommalist \dodoglobal\let#1\newcommalist} @@ -2536,7 +2618,7 @@ \fi} \def\globalprocesscommalist[#1]#2% - {\global\let\globalcommacommand=#2% + {\global\let\globalcommacommand#2% \expandafter\globalprocesscommaitem#1,],} %D \macros @@ -2562,11 +2644,8 @@ \!!stringa \endgroup} -\def\withoutpt#1% - {\withoutunit{#1}{pt}} - -\def\withoutcm#1% - {\withoutunit{#1}{cm}} +\def\withoutpt#1{\withoutunit{#1}{pt}} +\def\withoutcm#1{\withoutunit{#1}{cm}} %D A bit faster and more robust alternative is one that %D manipulates the \CATCODES. @@ -2589,8 +2668,8 @@ \def\PtToCm#1% {\begingroup - \scratchdimen=#1\relax - \scratchdimen=0.0351459804\scratchdimen % 2.54/72.27 + \scratchdimen#1\relax + \scratchdimen0.0351459804\scratchdimen % 2.54/72.27 \withoutpt{\the\scratchdimen}cm% \endgroup} @@ -2604,15 +2683,15 @@ %D Both macros return a rounded number. \def\numberofpoints#1% - {\scratchdimen=#1\relax + {\scratchdimen#1% \advance\scratchdimen .5pt \withoutpt{\the\scratchdimen}} \def\dimensiontocount#1#2% - {\scratchdimen=#1\relax + {\scratchdimen#1% \advance\scratchdimen .5pt - #2=\scratchdimen - \divide#2 by \maxcard} + #2\scratchdimen + \divide#2 \maxcard} %D \macros %D {swapdimens,swapmacros} @@ -2721,7 +2800,7 @@ \newdimen\localhsize \def\complexsetlocalhsize[#1]% don't change ! - {\localhsize=\hsize + {\localhsize\hsize % \advance\localhsize -\parindent % changed anyway \advance\localhsize -\leftskip \advance\localhsize -\rightskip @@ -2800,9 +2879,9 @@ \def\dodoprocesstokens {\ifx\nextprocessedtoken\lastcharacter \after - \let\nextprocessedtoken=\relax + \let\nextprocessedtoken\relax \else\ifx\nextprocessedtoken\bgroup - \def\nextprocessedtoken% + \def\nextprocessedtoken {\dowithnextbox {\before{\copy\nextbox}% \before can use nextbox several times \let\before\between @@ -2816,7 +2895,7 @@ \before\nextprocessedtoken \let\before\between \fi - \let\nextprocessedtoken=\doprocesstokens + \let\nextprocessedtoken\doprocesstokens \fi\fi \nextprocessedtoken} @@ -2957,14 +3036,26 @@ %D %D Also handy: -\long\def\doifemptyelsevalue#1#2#3% - {\@EA\ifx\csname#1\endcsname\empty#2\else#3\fi} +\def\doifemptyelsevalue#1% + {\@EA\ifx\csname#1\endcsname\empty + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} -\long\def\doifemptyvalue#1#2% - {\@EA\ifx\csname#1\endcsname\empty#2\fi} +\def\doifemptyvalue#1% + {\@EA\ifx\csname#1\endcsname\empty + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} -\long\def\doifnotemptyvalue#1#2% - {\@EA\ifx\csname#1\endcsname\empty\else#2\fi} +\def\doifnotemptyvalue#1% + {\@EA\ifx\csname#1\endcsname\empty + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} %D \macros %D {doifallcommonelse} @@ -3015,29 +3106,32 @@ %D We have to use a two||step implementation, because the %D expansion has to take place outside \type{\uppercase}. -\def\p!DOIF#1#2#3% +\def\p!DOIF#1#2% {\uppercase{\ifinstringelse{$#1$}{$#2$}}% - #3% + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument \fi} -\def\p!DOIFNOT#1#2#3% +\def\p!DOIFNOT#1#2% {\uppercase{\ifinstringelse{$#1$}{$#2$}}% + \expandafter\gobbleoneargument \else - #3% + \expandafter\firstofoneargument \fi} -\def\p!DOIFELSE#1#2#3#4% +\def\p!DOIFELSE#1#2% {\uppercase{\ifinstringelse{$#1$}{$#2$}}% - #3% + \expandafter\firstoftwoarguments \else - #4% + \expandafter\secondoftwoarguments \fi} -\def\p!DOIFINSTRINGELSE#1#2#3#4% +\def\p!DOIFINSTRINGELSE#1#2% {\uppercase{\ifinstringelse{#1}{#2}}% - #3% + \expandafter\firstoftwoarguments \else - #4% + \expandafter\secondoftwoarguments \fi} \def\DOIF {\ExpandBothAfter\p!DOIF} @@ -3071,16 +3165,13 @@ %D to enclosed in \type{{}}. \def\stripcharacter#1\from#2\to#3% - {\def\dostripcharacter##1#1##2\end% + {\def\dostripcharacter##1#1##2\end {\edef\!!strippedstring{\!!strippedstring##1}% - \doifemptyelse{##2} - {\let\next=\relax} - {\def\next{\dostripcharacter##2\end}}% - \next}% - \let\!!strippedstring=\empty + \doifnotempty{##2}{\dostripcharacter##2\end}}% + \let\!!strippedstring\empty \edef\!!stringa{#2}% \@EA\dostripcharacter\!!stringa#1\end - \dodoglobal\let#3=\!!strippedstring} + \dodoglobal\let#3\!!strippedstring} \def\stripspaces\from#1\to#2% {\stripcharacter{ }\from#1\to#2} @@ -3138,11 +3229,24 @@ \endETEX - %D This one also has the advantage that it is fully %D expandable and that it can be used after an assignment. -%D We considered an alternative imlementation accepting +%D \macros +%D {executeifdefinedcs} +%D +%D An also fully expandable variant is the following: +%D +%D \starttypen +%D \executeifdefinedcs{a}{b} +%D \stoptypen +%D +%D In dit geval zijn beide argumenten csnames. + +\def\executeifdefinedcs#1#2% + {\csname\ifundefined{#1}#2\else#1\fi\endcsname} + +%D We considered an alternative implementation accepting %D commands directly, like: %D %D \starttypen @@ -3153,6 +3257,22 @@ %D faster one. %D \macros +%D {executeandforget} +%D +%D The following macros were requested by Simon. Watch the +%D global variant. +%D +%D \starttypen +%D \executeandforget\SomeCommand +%D \doglobal\executeandforget\AnotherCommand +%D \stoptypen + +\def\executeandforget#1% + {\global\let\@@expanded#1% + \dodoglobal\let#1\relax + \@@expanded} + +%D \macros %D {doifsomespaceelse} %D %D The next command checks a string on the presence of a space @@ -3199,9 +3319,9 @@ \def\doadaptdimension#1#2\\#3\\% {\if#1+% - \dodoglobal\advance#3 by #1#2\relax - \else\if##1-% - \dodoglobal\advance#3 by #1#2\relax + \dodoglobal\advance#3 #1#2\relax + \else\if#1-% + \dodoglobal\advance#3 #1#2\relax \else \dodoglobal#3=#1#2\relax \fi\fi} @@ -3223,9 +3343,9 @@ %D has the opposite result. \def\balancedimensions#1#2#3% - {\scratchdimen=#3\relax - \redoglobal\advance#1 by \scratchdimen\relax - \dodoglobal\advance#2 by -\scratchdimen\relax} + {\scratchdimen#3\relax + \redoglobal\advance#1 \scratchdimen + \dodoglobal\advance#2 -\scratchdimen} %D Both commands can be preceded by \type{\doglobal}. Here we %D use \type{\redo} first, because \type{\dodo} resets the @@ -3362,7 +3482,7 @@ \def\processassignlist#1[#2]#3% {\def\p!dodogetparameter[##1=##2=##3]% - {\doifnot{##3}{\relax}{#3{##1}}}% + {\doifnot{##3}\relax{#3{##1}}}% \def\p!dogetparameter##1% {\p!dodogetparameter[##1==\relax]}% \processcommalist[#2]\p!dogetparameter} @@ -3412,13 +3532,10 @@ \long\def\dountexsomething#1#2\to#3% {\doglobal#1#2\to\untexedargument \endgroup - \let#3=\untexedargument} - -\def\untexargument% - {\untexsomething\convertargument} + \let#3\untexedargument} -\def\untexcommand% - {\untexsomething\convertcommand} +\def\untexargument{\untexsomething\convertargument} +\def\untexcommand {\untexsomething\convertcommand} %D \macros %D {ScaledPointsToBigPoints,ScaledPointsToWholeBigPoints} @@ -3462,7 +3579,7 @@ %D \stoptypen \def\PointsToReal#1#2% - {\scratchdimen=#1% + {\scratchdimen#1% \edef#2{\withoutpt{\the\scratchdimen}}} %D \macros @@ -3481,9 +3598,9 @@ %\def\dontleavehmode{\ifhmode\else\ifmmode\else$ $\fi\fi} % -% The (thanks to Taco) better alternative: +% The (thanks to Taco) better alternative (mathsurround): -\def\dontleavehmode% +\def\dontleavehmode {\ifhmode\else \ifmmode\else {\mathsurround\z@\everymath\emptytoks$ $}% \fi \fi} @@ -3583,7 +3700,7 @@ %D {\doglobal}. \def\counttoken#1\in#2\to#3% - {\redoglobal#3=\zerocount + {\redoglobal#3\zerocount \def\!!stringa{#1}% \def\!!stringb{\end}% \def\docounttoken##1% obeys {} @@ -3605,14 +3722,14 @@ %D wrote this token handler. \long\def\splitofftokens#1\from#2\to#3% - {\ifnum#1>0 - \scratchcounter=#1\relax + {\ifnum#1>\zerocount + \scratchcounter#1\relax \def\dosplitofftokens##1% - {\ifnum\scratchcounter>0 + {\ifnum\scratchcounter>\zerocount \advance\scratchcounter \minusone \edef#3{#3##1}% \fi}% - % \let#3=\empty % #3 can be #2, so: + % \let#3\empty % #3 can be #2, so: \@EA\let\@EA#3\@EA\empty \@EA\handletokens#2\with\dosplitofftokens \else @@ -3651,11 +3768,11 @@ %D way we can handle the sentinal, a blank space and grouped %D tokens. -\def\dohandletokens% +\def\dohandletokens {\futurelet\nexthandledtoken\dodohandletokens} \long\def\handletokens#1\with#2% - {\global\let\dododohandletokens=#2% + {\global\let\dododohandletokens#2% \dohandletokens#1\end} %D A previous version said \type{\docommando=#2}, but to enable @@ -3692,7 +3809,7 @@ %D %D So, now we have: -\def\dodohandletokens% +\def\dodohandletokens % can be sped up {\ifx\nexthandledtoken\blankspace \def\next * {\dododohandletokens{ }\dohandletokens}% \else\ifx\nexthandledtoken\end @@ -3751,10 +3868,10 @@ \def\dostartglobaldefs#1#2% {\edef\!!stringa{\the\globaldefs}% \ifnum\globaldefs#10 - \globaldefs=-\globaldefs + \globaldefs-\globaldefs \fi - \advance\globaldefs #21 - \setevalue{@gd@\the\globaldefs}{\!!stringa}} + \advance\globaldefs#21 + \letvalue{@gd@\the\globaldefs}\!!stringa} \def\dostopglobaldefs% {\doifdefinedelse{@gd@\the\globaldefs} @@ -3893,7 +4010,7 @@ \else \def\!!tempa{#1}% \ifx\!!tempa\empty\else - \scratchcounter=1 + \scratchcounter\plusone \@EA\getcommalistsize\@EA[\sortedcommalist]% \@EA\processcommalist\@EA[\sortedcommalist]\docompareitems \fi @@ -3930,14 +4047,14 @@ {\doifnumberelse{#1} {\doifnumberelse{#2} {\ifnum#1>#2\relax - \comparedresult=1 % #1 is larger + \comparedresult1 % #1 is larger \else\ifnum#1<#2\relax - \comparedresult=2 % #2 is larger + \comparedresult2 % #2 is larger \else - \comparedresult=0 % both are equal + \comparedresult0 % both are equal \fi\fi} - {\comparedresult=2 }} - {\comparedresult=1 }} + {\comparedresult2 }} + {\comparedresult1 }} %D \macros %D {@saveprimitive} @@ -3955,15 +4072,15 @@ \edef\@tempb{\meaning#1}% \ifx\@tempa\@tempb \global\let#2#1% - \debuggerinfo{prim}{Saving \string#1 as \string#2}% + %\debuggerinfo{prim}{Saving \string#1 as \string#2}% \else \edef\@tempb{\meaning#2}% - \ifx\@tempa\@tempb - \debuggerinfo{prim}{Saving \string#1 as \string#2}% - \else - \debuggerinfo{prim}{Can't define \string#2 properly; - primitive \noexpand#1 is no longer primitive}% - \fi + %\ifx\@tempa\@tempb + % \debuggerinfo{prim}{Saving \string#1 as \string#2}% + %\else + % \debuggerinfo{prim}{Can't define \string#2 properly; + % primitive \noexpand#1 is no longer primitive}% + %\fi \fi \endgroup} diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex index f95bdcfa2..40f8701e2 100644 --- a/tex/context/base/syst-gen.tex +++ b/tex/context/base/syst-gen.tex @@ -353,9 +353,11 @@ \ifx \@ne\undefined \else \let\plusone \@ne \fi \ifx\m@ne\undefined \else \let\minusone \m@ne \fi -\ifx\zeropoint\undefined \newdimen\zeropoint \fi -\ifx\plusone \undefined \chardef\plusone=1 \fi -\ifx\minusone \undefined \count\minusone \minusone=-1 \fi +\ifx\zeropoint\undefined \csname newdimen\endcsname\zeropoint \fi % plain +\ifx\plusone \undefined \chardef\plusone =1 \fi +\ifx\plustwo \undefined \chardef\plustwo =2 \fi +\ifx\plusthree\undefined \chardef\plusthree=3 \fi +\ifx\minusone \undefined \count\minusone \minusone=-1 \fi \newcount\zerocount @@ -404,10 +406,10 @@ %D inside the argument. Later on we will meet some more clever %D alternatives to this command. -\let\@@expanded\empty +\long\def\@@expanded{} % always long; global (less restores) \long\def\expanded#1% - {\long\edef\@@expanded{\noexpand#1}\@@expanded} + {\long\xdef\@@expanded{\noexpand#1}\@@expanded} %D \macros %D {expandoneargafter,expandtwoargsafter} @@ -432,10 +434,10 @@ %D These two do a full expansion: \def\fullexpandoneargafter#1#2% - {\edef\@@expanded{\noexpand#1{#2}}\@@expanded} + {\long\xdef\@@expanded{\noexpand#1{#2}}\@@expanded} \def\fullexpandtwoargsafter#1#2#3% - {\edef\@@expanded{\noexpand#1{#2}{#3}}\@@expanded} + {\long\xdef\@@expanded{\noexpand#1{#2}{#3}}\@@expanded} %D \macros %D {gobbleoneargument,gobble...arguments} @@ -485,7 +487,7 @@ \def\!!stringb{#3}% \futurelet\nexttoken\inspectnextcharacter} -\def\inspectnextcharacter% +\def\inspectnextcharacter {\ifx\nexttoken\blankspace \@EA\reinspectnextcharacter \else\ifx\nexttoken\charactertoken @@ -546,13 +548,14 @@ %D or later wants macros like these. %D %D \starttypen -%D \setvalue {naam}{...} = \def\naam{...} -%D \setgvalue {naam}{...} = \gdef\naam{...} -%D \setevalue {naam}{...} = \edef\naam{...} -%D \setxvalue {naam}{...} = \xdef\naam{...} -%D \letvalue {naam}=\... = \let\naam=\... -%D \getvalue {naam} = \naam -%D \resetvalue {naam} = \def\naam{} +%D \setvalue {name}{...} = \def\name{...} +%D \setgvalue {name}{...} = \gdef\name{...} +%D \setevalue {name}{...} = \edef\name{...} +%D \setxvalue {name}{...} = \xdef\name{...} +%D \letvalue {name}=\... = \let\name=\... +%D \letgvalue {name}=\... = \global\let\name=\... +%D \getvalue {name} = \name +%D \resetvalue {name} = \def\name{} %D \stoptypen %D %D As we will see, \CONTEXT\ uses these commands many times, @@ -565,18 +568,19 @@ \def\setxvalue #1{\expandafter\xdef\csname#1\endcsname} \def\getvalue #1{\csname#1\endcsname} \def\letvalue #1{\expandafter\let\csname#1\endcsname} +\def\letgvalue #1{\global\expandafter\let\csname#1\endcsname} \def\resetvalue #1{\expandafter\let\csname#1\endcsname\empty} \def\ignorevalue#1#2{\expandafter\let\csname#1\endcsname\empty} %D \macros -%D {globallet} +%D {globallet,glet} %D %D In \CONTEXT\ of May 2000 using \type {\globallet} %D instead of the two tokens will save us some %D $300\times4=1200$ bytes of format file on a 32~bit %D system. So: -\def\globallet{\global\let} +\def\globallet{\global\let} \let\glet\globallet %D \macros %D {donottest,unexpanded} @@ -655,7 +659,7 @@ \@EA#1\csname\s!do\string#2\endcsname} \def\unexpanded#1% - {\def\dounexpanded% + {\def\dounexpanded {\ifx\next\bgroup \@EA\dosetunexpanded \else @@ -799,7 +803,13 @@ %D %D When this module was optimized, timing showed that the %D next alternative can be upto twice as fast, especially when -%D longer arguments are used. +%D longer arguments are used. Watch how we reach over the +%D \type {\else} and \type {\fi}: this way they cannot get +%D into the way (and we can avoid those \type {\next} +%D hacks); I started using this method after I did some +%D speed optimization tests in the xtag modules; the +%D efficiency of such hacks depends on the length of the +%D argument etc. etc.) \beginTEX @@ -810,32 +820,32 @@ {\let\donottest\dontprocesstest \expandafter\ifx\csname#1\endcsname\relax} -\def\doifundefinedelse#1#2#3% +\def\doifundefinedelse#1% {\p!doifundefined{#1}% - \let\donottest\doprocesstest#2% + \let\donottest\doprocesstest\@EA\firstoftwoarguments \else - \let\donottest\doprocesstest#3% + \let\donottest\doprocesstest\@EA\secondoftwoarguments \fi} -\def\doifdefinedelse#1#2#3% +\def\doifdefinedelse#1% {\p!doifundefined{#1}% - \let\donottest\doprocesstest#3% + \let\donottest\doprocesstest\@EA\secondoftwoarguments \else - \let\donottest\doprocesstest#2% + \let\donottest\doprocesstest\@EA\firstoftwoarguments \fi} -\def\doifundefined#1#2% +\def\doifundefined#1% {\p!doifundefined{#1}% - \let\donottest\doprocesstest#2% + \let\donottest\doprocesstest\@EA\firstofoneargument \else - \let\donottest\doprocesstest + \let\donottest\doprocesstest\@EA\gobbleoneargument \fi} -\def\doifdefined#1#2% +\def\doifdefined#1% {\p!doifundefined{#1}% - \let\donottest\doprocesstest + \let\donottest\doprocesstest\@EA\gobbleoneargument \else - \let\donottest\doprocesstest#2% + \let\donottest\doprocesstest\@EA\firstofoneargument \fi} \endTEX @@ -849,33 +859,33 @@ {\edef\p!defined{#1}% \unless\ifcsname\detokenize\@EA{\p!defined}\endcsname} -\def\doifundefinedelse#1% % #2#3% +\def\doifundefinedelse#1% {\edef\p!defined{#1}% - \ifcsname\detokenize\@EA{\p!defined}\endcsname % #3\else#2\fi} + \ifcsname\detokenize\@EA{\p!defined}\endcsname \expandafter\secondoftwoarguments \else \expandafter\firstoftwoarguments \fi} -\def\doifdefinedelse#1% % #2#3% +\def\doifdefinedelse#1% {\edef\p!defined{#1}% - \ifcsname\detokenize\@EA{\p!defined}\endcsname % #2\else#3\fi} + \ifcsname\detokenize\@EA{\p!defined}\endcsname \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\def\doifundefined#1% % #2% +\def\doifundefined#1% {\edef\p!defined{#1}% - \ifcsname\detokenize\@EA{\p!defined}\endcsname % \else#2\fi} + \ifcsname\detokenize\@EA{\p!defined}\endcsname \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} -\def\doifdefined#1% % #2% +\def\doifdefined#1% {\edef\p!defined{#1}% - \ifcsname\detokenize\@EA{\p!defined}\endcsname % #2\fi} + \ifcsname\detokenize\@EA{\p!defined}\endcsname \expandafter\firstofoneargument \else \expandafter\gobbleoneargument @@ -960,17 +970,17 @@ \donefalse \fi} -\def\doifalldefinedelse#1% % #2#3% +\def\doifalldefinedelse#1% {\begingroup \let\donottest\dontprocesstest \donetrue \processcommalist[#1]\docheckonedefined \ifdone \endgroup\let\donottest\doprocesstest - \expandafter\firstoftwoarguments % #2% + \expandafter\firstoftwoarguments \else \endgroup\let\donottest\doprocesstest - \expandafter\secondoftwoarguments % #3% + \expandafter\secondoftwoarguments \fi} \endTEX @@ -982,13 +992,13 @@ \donefalse \fi} -\def\doifalldefinedelse#1% % #2#3% +\def\doifalldefinedelse#1% {\begingroup \donetrue \processcommalist[#1]\docheckonedefined \ifdone - \endgroup\expandafter\firstoftwoarguments % #2% + \endgroup\expandafter\firstoftwoarguments \else - \endgroup\expandafter\secondoftwoarguments % #3% + \endgroup\expandafter\secondoftwoarguments \fi} \endETEX @@ -1035,53 +1045,91 @@ \beginTEX -\long\def\doif#1#2#3% +% \long\def\doif#1#2#3% +% {\let\donottest\dontprocesstest +% \edef\!!stringa{#1}% +% \edef\!!stringb{#2}% +% \let\donottest\doprocesstest +% \ifx\!!stringa\!!stringb +% #3% +% \fi} +% +% \long\def\doifnot#1#2#3% +% {\let\donottest\dontprocesstest +% \edef\!!stringa{#1}% +% \edef\!!stringb{#2}% +% \let\donottest\doprocesstest +% \ifx\!!stringa\!!stringb +% \else +% #3% +% \fi} +% +% \long\def\doifelse#1#2#3#4% +% {\let\donottest\dontprocesstest +% \edef\!!stringa{#1}% +% \edef\!!stringb{#2}% +% \let\donottest\doprocesstest +% \ifx\!!stringa\!!stringb +% #3% +% \else +% #4% +% \fi} + +%D Slightly faster on big arguments, as well as \type +%D {\next} avoiding: + +\long\def\doif#1#2% {\let\donottest\dontprocesstest \edef\!!stringa{#1}% \edef\!!stringb{#2}% \let\donottest\doprocesstest \ifx\!!stringa\!!stringb - #3% + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument \fi} -\long\def\doifnot#1#2#3% +\long\def\doifnot#1#2% {\let\donottest\dontprocesstest \edef\!!stringa{#1}% \edef\!!stringb{#2}% \let\donottest\doprocesstest \ifx\!!stringa\!!stringb + \expandafter\gobbleoneargument \else - #3% + \expandafter\firstofoneargument \fi} -\long\def\doifelse#1#2#3#4% + +\long\def\doifelse#1#2% {\let\donottest\dontprocesstest \edef\!!stringa{#1}% \edef\!!stringb{#2}% \let\donottest\doprocesstest \ifx\!!stringa\!!stringb - #3% + \expandafter\firstoftwoarguments \else - #4% + \expandafter\secondoftwoarguments \fi} \endTEX \beginETEX \protected -\long\def\doif#1#2#3% - {\edef\!!stringa{#1}\edef\!!stringb{#2}% - \ifx\!!stringa\!!stringb#3\fi} - -\long\def\doifnot#1#2#3% - {\edef\!!stringa{#1}\edef\!!stringb{#2}% - \unless\ifx\!!stringa\!!stringb#3\fi} - -\long\def\doifelse#1#2#3#4% - {\edef\!!stringa{#1}\edef\!!stringb{#2}% - \ifx\!!stringa\!!stringb#3\else#4\fi} +% \long\def\doif#1#2#3% +% {\edef\!!stringa{#1}\edef\!!stringb{#2}% +% \ifx\!!stringa\!!stringb#3\fi} +% +% \long\def\doifnot#1#2#3% +% {\edef\!!stringa{#1}\edef\!!stringb{#2}% +% \unless\ifx\!!stringa\!!stringb#3\fi} +% +% \long\def\doifelse#1#2#3#4% +% {\edef\!!stringa{#1}\edef\!!stringb{#2}% +% \ifx\!!stringa\!!stringb#3\else#4\fi} -% slightly faster on big arguments +%D Slightly faster on big arguments, as well as \type +%D {\next} avoiding: \long\def\doif#1#2% {\edef\!!stringa{#1}\edef\!!stringb{#2}% @@ -1154,25 +1202,25 @@ %D %D This time, the string is not expanded. -\long\def\doifemptyelse#1% % #2#3% +\long\def\doifemptyelse#1% {\def\!!stringa{#1}% - \ifx\!!stringa\empty % #2\else#3\fi} + \ifx\!!stringa\empty \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\long\def\doifempty#1% % #2% +\long\def\doifempty#1% {\def\!!stringa{#1}% - \ifx\!!stringa\empty % #2\fi} + \ifx\!!stringa\empty \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\long\def\doifnotempty#1% % #2% +\long\def\doifnotempty#1% {\def\!!stringa{#1}% - \ifx\!!stringa\empty % \else#2\fi} + \ifx\!!stringa\empty \expandafter\gobbleoneargument \else \expandafter\firstofoneargument @@ -1296,22 +1344,22 @@ \endETEX -\long\def\doifinsetelse#1#2% % #3#4% - {\p!doifinsetelse{#1}{#2}% % #3\else#4\fi} +\long\def\doifinsetelse#1#2% + {\p!doifinsetelse{#1}{#2}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} -\long\def\doifinset#1#2% % #3% - {\p!doifinsetelse{#1}{#2}% % #3\fi} +\long\def\doifinset#1#2% + {\p!doifinsetelse{#1}{#2}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\long\def\doifnotinset#1#2% % #3% - {\p!doifinsetelse{#1}{#2}% % \else#3\fi} +\long\def\doifnotinset#1#2% + {\p!doifinsetelse{#1}{#2}% \expandafter\gobbleoneargument \else \expandafter\firstofoneargument @@ -1446,15 +1494,15 @@ \expandafter\secondoftwoarguments \fi} -\long\def\doifcommon#1#2% % #3% - {\p!doifcommonelse{#1}{#2}% % #3\fi} +\long\def\doifcommon#1#2% + {\p!doifcommonelse{#1}{#2}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} -\long\def\doifnotcommon#1#2% % #3% - {\p!doifcommonelse{#1}{#2}% % \else#3\fi} +\long\def\doifnotcommon#1#2% + {\p!doifcommonelse{#1}{#2}% \expandafter\gobbleoneargument \else \expandafter\firstofoneargument @@ -2061,7 +2109,7 @@ {\let\expandedaction\noexpandedaction} %D \macros -%D {getfirstcharacter,firstcharacter} +%D {getfirstcharacter,firstcharacter, doiffirstcharacter} %D %D Sometimes the action to be undertaken depends on the %D next character. This macro get this character and puts it in @@ -2082,6 +2130,20 @@ {\edef\!!stringa{#1}% \expandafter\dogetfirstcharacter\!!stringa\\} +\def\doiffirstcharelse#1#2% char string +% kort (maar onleesbaar) +% {\expanded{\dogetfirstcharacter#2}\\\doifelse{#1}\firstcharacter} +% korter (en begrijpelijk)) + {\getfirstcharacter{#2}\doifelse{#1}\firstcharacter} +% snel (maar zelden gebruikt, dus niet zo belangrijk) +% {\getfirstcharacter{#2}% +% \edef\!!stringa{#1}% +% \ifx\!!stringa\firstcharacter +% \expandafter\firstoftwoarguments +% \else +% \expandafter\secondoftwoarguments +% \fi} + %D \macros %D {doifinstringelse, doifincsnameelse} %D @@ -2607,8 +2669,14 @@ %D complain of it's missed. We will redefine this macro later %D on, when a more advanced message mechanism is implemented. +\newif\iferrorisfatal + +\def\waitonfatalerror + {\iferrorisfatal\wait\fi} + \def\showassignerror#1#2% - {\writestatus{setup}{missing '=' after '#1' in line #2}} + {\writestatus{setup}{missing or ungrouped '=' after '#1' in line #2}% + \waitonfatalerror} %\def\p!doassign#1[#2][#3=#4=#5]% % {\let\donottest\dontprocesstest @@ -2778,8 +2846,18 @@ % \def\p!doassign#1#2\@relax@#3=#4=#5\@relax@ % {\ifx\@relax@#5\@EA\xshowassignerror\else\@EA#1\fi{#2}{#3}{#4}} -\def\p!doassign#1#2\@relax@#3=#4=#5\@relax@ - {\ifx#5\empty\@EA\xshowassignerror\else\@EA#1\fi{#2}{#3}{#4}} +% \def\p!doassign#1#2\@relax@#3=#4=#5\@relax@ +% {\ifx#5\empty\@EA\xshowassignerror\else\@EA#1\fi{#2}{#3}{#4}} + +\def\p!doassign#1#2\@relax@#3=#4=#5#6\@relax@ + {\ifx#5\empty + \@EA\xshowassignerror + \else\ifx#5=% + \@EAEAEA#1% + \else + \@EAEAEA\xshowassignerror + \fi\fi + {#2}{#3}{#4}} \def\xshowassignerror#1#2#3% {\showassignerror{#2}{\the\inputlineno\space(#1)}} @@ -2871,10 +2949,16 @@ % % \def\doifassignmentelse% % {\doifinstringelse{=}} +% +% readable +% +% \def\doifassignmentelse#1% +% {\convertargument#1\to\ascii +% \doifinstringelse{=}{\ascii}} \def\doifassignmentelse#1% {\convertargument#1\to\ascii - \doifinstringelse{=}{\ascii}} + \doifinstringelse=\ascii} %D \macros %D {ifparameters,checkparameters} @@ -2964,7 +3048,7 @@ \def\getfromcommalist[#1]#2[#3]% {\let\commalistelement\empty - \commalistcounter=#3\relax + \commalistcounter#3\relax \processcommalist[#1]\p!dogetfromcommalist} % \def\getfromcommacommand[#1]% why so complicated, still needed? @@ -3985,6 +4069,17 @@ \long\def\thirdoffourarguments #1#2#3#4{#3} \long\def\fourthoffourarguments #1#2#3#4{#4} +%D \macros +%D {globalletempty,letempty,letvalueempty,letgvalueempty} +%D +%D Trivial: + +\def\letempty #1{\let#1\empty} +\def\globalletempty#1{\global\let#1\empty} + +\def\letvalueempty #1{\expandafter\let\csname#1\endcsname\empty} +\def\letgvalueempty#1{\global\expandafter\let\csname#1\endcsname\empty} + %D \macros %D {wait} %D diff --git a/tex/context/base/syst-new.tex b/tex/context/base/syst-new.tex index 5fd8eaaa9..ba6e0bc46 100644 --- a/tex/context/base/syst-new.tex +++ b/tex/context/base/syst-new.tex @@ -16,15 +16,19 @@ \unprotect +% moved from core-ntb + +\def\v!oddeven#1{\ifodd#1\v!oneven\else\v!even\fi} + % For myself \newcount\nofprofiled \def\profilemacro#1% - {\nofprofiled=0 + {\nofprofiled\zerocount \letvalue{\string#1\string#1}#1% \appendtoks - \writestatus{\m!systems}{profile \string#1: \number\nofprofiled}% + \writestatus\m!systems{profile \string#1: \number\nofprofiled}% \to \everystoptext \unexpanded\def#1% {\global\advance\nofprofiled\plusone @@ -82,12 +86,12 @@ \the\withlowercharacters \ifeightbitcharacters\the\withuppercharacters\fi} -\def\makeallother% +\def\makeallother {\doassigncatcodes\@@other} \chardef\obeyedlccode=`. % so <32 and >127 chars become . -%\def\obeylccodes% +%\def\obeylccodes % {\def\withcharacter##1{\lccode##1##1}% % \the\withlowercharacters % \def\withcharacter##1{\lccode##1\obeyedlccode}% @@ -97,7 +101,7 @@ \def\setownlccode #1{\lccode#1#1} \def\setobeyedlccode#1{\lccode#1\obeyedlccode} -\def\obeylccodes% +\def\obeylccodes {\let\withcharacter\setownlccode \the\withlowercharacters \let\withcharacter\setobeyedlccode @@ -137,10 +141,10 @@ \def\@flg@{@flg@} \def\setflag#1% - {\@EA\dodoglobal\@EA\chardef\csname\@flg@#1\endcsname=0 } + {\@EA\dodoglobal\@EA\chardef\csname\@flg@#1\endcsname\zerocount} \def\resetflag#1% - {\@EA\dodoglobal\@EA\chardef\csname\@flg@#1\endcsname=1 } + {\@EA\dodoglobal\@EA\chardef\csname\@flg@#1\endcsname\plusone} \let\ifflagged\ifcase @@ -289,10 +293,10 @@ \def\DoMod#1by#2to#3{\dosetmodulo {#1}{#2}{#3}} \def\DoDiv#1by#2to#3{\dosetdivision{#1}{#2}{#3}} -\def\dounprotected#1\par% +\def\dounprotected#1\par {#1\protect} -\def\unprotected% +\def\unprotected {\unprotect\dounprotected} %D Standaard kan een spatie (zoals ~) uitrekken. Dit is in @@ -349,7 +353,7 @@ \def\testfeature#1#2% {\def\dotestfeature - {\advance\featuretest 1 + {\advance\featuretest \plusone \ifnum\featuretest<#1\relax#2\expandafter\dotestfeature\fi}% \retestfeature} @@ -378,12 +382,12 @@ \newdimen\dimentoaddto -\def\adddimenregister#1\to#2% +\def\adddimenregister#1\to#2% will be obsolete once full etex {\begingroup #2=\zeropoint \dimentoaddto\zeropoint \def\docommando% - {\advance#2 by \dimentoaddto + {\advance#2 \dimentoaddto \futurelet\next\dodocommando}% \def\dodocommando% {\ifx\next\relax @@ -420,14 +424,14 @@ % \def\rawrecurselevel{\the\rawrecursecounter}% % % \def\dorawrecurse#1#2% -% {\rawrecursecounter=1\relax +% {\rawrecursecounter\plusone % \let\oldrecurselevel\recurselevel % \let\recurselevel\rawrecurselevel -% \def\dodorawrecurse% +% \def\dodorawrecurse % {\ifnum\rawrecursecounter>#1\relax % \let\recurselevel\oldrecurselevel % \else -% #2\advance\rawrecursecounter by 1 +% #2\advance\rawrecursecounter \plusone % \expandafter\dodorawrecurse % \fi}% % \dodorawrecurse} @@ -439,21 +443,21 @@ \bgroup -\gdef\checkduplication% in line with Knuth +\gdef\checkduplication % in line with Knuth {\ifmmode\expandafter^\else\expandafter\startduplication\fi} -\gdef\insideduplication% +\gdef\insideduplication {\ifmmode\expandafter^\else\expandafter\egroup\fi} \catcode`\^=\@@active -\gdef\enableduplication% +\gdef\enableduplication {\catcode`\^=\@@active \let^\checkduplication} -\gdef\disableduplication% +\gdef\disableduplication {\catcode`\^=\@@superscript} -\gdef\startduplication% +\gdef\startduplication {\bgroup \duplicatetrue \let^\insideduplication} \egroup @@ -499,20 +503,57 @@ \def\dowithstringed#1#2#3#4% " ' space {\if#4"\@EA#1\else\if#4'\@EAEAEA#2\else\@EAEAEA#3\fi\fi#4} -\def\unstringed% +\def\unstringed {\dowithstringed\unstringdouble\unstringsingle\unstringnothing} \def\unstringdouble"#1"{#1} \def\unstringsingle'#1'{#1} \def\unstringspaced #1 {#1} -\def\grabstring% +\def\grabstring {\dowithstringed\grabstringdouble\grabstringsingle\grabstringspaced} +\def\dowithgrabbedstring#1% + {\def\@@dowithgrabbedstring{#1}% + \afterassignment\@@dowithgrabbedstring\grabstring} + \def\grabstringdouble"#1"{\scratchtoks{#1}} \def\grabstringsingle'#1'{\scratchtoks{#1}} \def\grabstringspaced #1 {\scratchtoks{#1}} +\def\expifequalelse#1#2% + {\@@ifequal#1\relax\relax\@@and#2\relax\relax\@@then} + +\def\@@ifequal#1#2\@@and#3% + {\ifx#1\relax + \ifx#3\relax + \@EAEAEA\@@if@@equal@@true + \else + \@EAEAEA\@@if@@equal@@false + \fi + \else + \ifx#3\relax + \@EAEAEAEAEAEA\@@if@@equal@@false + \else\ifx#1#3% + % go on + \else + \@EAEAEAEAEAEA\@@if@@equal@@false + \fi\fi + \fi + \@@ifequal#2\@@and} + +\long\def\@@if@@equal@@true #1\@@then#2#3{#2} +\long\def\@@if@@equal@@false#1\@@then#2#3{#3} + +%D new stuff : + +\def\partialexpanded#1% + {\let\notexpanded\noexpand + \long\xdef\@@expanded{\noexpand#1}% + \let\notexpanded\empty + \@@expanded} + + % \def\doifdimensionelse#1% % {\afterassignment\dodoifdimensionelse\scratchdimen=#1pt\relax\empty\empty\empty\empty} % @@ -523,4 +564,37 @@ % \expandafter\secondoftwoarguments % \fi} +% for Simon ; watch how we make them fully expandable (i.e. +% no \type {\relax}es) popping up + +\def\@@dothenumber#1\relax#2\end{#1} + +\def\@@thenumber#1{\@EA\@@dothenumber\number#1\relax\end} + +\def\doifnum#1#2% + {\ifnum#1=\@@thenumber{#2} % space needed + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + +\def\doifnotnum#1#2% + {\ifnum#1=\@@thenumber{#2} % space needed + \expandafter\gobbleoneargument + \else + \expandafter\firstofoneargument + \fi} + +\def\doifelsenum#1#2% + {\ifnum#1=\@@thenumber{#2} % space needed + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +% \edef\xxxx{\doifnum{1}{2}{no}} \show \xxxx +% \edef\xxxx{\doifnum{2}{2}{yes}} \show \xxxx +% \scratchcounter0 \edef\xxxx{\doifnum{1}{\scratchcounter}{no}} \show \xxxx +% \scratchcounter1 \edef\xxxx{\doifnum{1}{\scratchcounter}{yes}} \show \xxxx + \protect \endinput diff --git a/tex/context/base/type-buy.tex b/tex/context/base/type-buy.tex index 334601299..6fdbd47b0 100644 --- a/tex/context/base/type-buy.tex +++ b/tex/context/base/type-buy.tex @@ -94,17 +94,17 @@ % FontFont Meta \starttypescript [map] [ec,8r,texnansi] - \loadmapfile [\typefaceencoding-ff-meta] + \loadmapfile [\typefaceencoding-fontfont-meta] \stoptypescript \starttypescript [sans] [meta] [name] \definefontsynonym [Sans] [MetaNormal-Roman] \definefontsynonym [SansItalic] [MetaNormal-Italic] - \definefontsynonym [SansSlanted] [MetaNormal-Slanted] + \definefontsynonym [SansSlanted] [MetaNormal-Italic] \definefontsynonym [SansBold] [MetaBold-Roman] \definefontsynonym [SansBoldItalic] [MetaBold-Italic] - \definefontsynonym [SansBoldSlanted][MetaBold-Slanted] + \definefontsynonym [SansBoldSlanted][MetaBold-Italic] \definefontsynonym [SansCaps] [MetaNormal-Caps] \stoptypescript @@ -209,6 +209,12 @@ \stoptypescript +\starttypescript [expert] [meta] % incomplete + + \definefontsynonym [MetaNormal-Expert] [mtnx] + +\stoptypescript + %D Linotype Univers \starttypescript [map] [all] % [texnansi] diff --git a/tex/context/base/type-enc.tex b/tex/context/base/type-enc.tex index c3d06bd25..4dea6ecee 100644 --- a/tex/context/base/type-enc.tex +++ b/tex/context/base/type-enc.tex @@ -298,7 +298,8 @@ \stoptypescript \starttypescript [math] [computer-modern] [default] - \definefontsynonym [ComputerModernMath-Roman] [cmr10] + % watch the space, it prevents remapping + \definefontsynonym [ComputerModernMath-Roman] [cmr10 ] \definefontsynonym [ComputerModernMath-Extension] [cmex10] \definefontsynonym [ComputerModernMath-Italic] [cmmi10] \definefontsynonym [ComputerModernMath-Symbol] [cmsy10] @@ -549,7 +550,7 @@ \definefontsynonym [LucidaBlackletter] [lbl] \stoptypescript -\starttypescript [boldmath] [lucida] [texnansi,ec,8r] +\starttypescript [boldmath,bfmath] [lucida] [texnansi,ec,8r] \definefontsynonym [LucidaNewMath-AltDemiItalic] [lbmdo] \definefontsynonym [LucidaNewMath-Arrows-Demi] [lbmad] \definefontsynonym [LucidaNewMath-Extension] [lbme] @@ -594,7 +595,7 @@ \definefontsynonym [8r-utmb8a-slanted-167] [utmbo8r] [encoding=8r] \definefontsynonym [8r-uhvr8a] [uhvr8r] [encoding=8r] -\definefontsynonym [8r-uhvo8a] [uhvro8r] [encoding=8r] +\definefontsynonym [8r-uhvro8a] [uhvro8r] [encoding=8r] \definefontsynonym [8r-uhvb8a] [uhvb8r] [encoding=8r] \definefontsynonym [8r-uhvbo8a] [uhvbo8r] [encoding=8r] @@ -652,7 +653,7 @@ \definefontsynonym [ec-utmb8a-slanted-167] [utmbo8t] [encoding=ec] \definefontsynonym [ec-uhvr8a] [uhvr8t] [encoding=ec] -\definefontsynonym [ec-uhvo8a] [uhvro8t] [encoding=ec] +\definefontsynonym [ec-uhvro8a] [uhvro8t] [encoding=ec] \definefontsynonym [ec-uhvb8a] [uhvb8t] [encoding=ec] \definefontsynonym [ec-uhvbo8a] [uhvbo8t] [encoding=ec] @@ -712,7 +713,7 @@ \definefontsynonym [ec-utmb8a-slanted-167] [ptmbo8y] [encoding=texnansi] \definefontsynonym [ec-uhvr8a] [uhvr8y] [encoding=texnansi] -\definefontsynonym [ec-uhvo8a] [uhvro8y] [encoding=texnansi] +\definefontsynonym [ec-uhvro8a] [uhvro8y] [encoding=texnansi] \definefontsynonym [ec-uhvb8a] [uhvb8y] [encoding=texnansi] \definefontsynonym [ec-uhvbo8a] [uhvbo8y] [encoding=texnansi] diff --git a/tex/context/base/type-exa.tex b/tex/context/base/type-exa.tex index 0ca857c17..4283f412c 100644 --- a/tex/context/base/type-exa.tex +++ b/tex/context/base/type-exa.tex @@ -35,7 +35,7 @@ \definetypeface [times] [rm] [serif] [times] [default] [encoding=\typescripttwo] \definetypeface [times] [ss] [sans] [helvetica] [default] [rscale=.9,encoding=\typescripttwo] -\definetypeface [times] [tt] [mono] [computer-modern] [default] [rscale=1.1,encoding=\typescripttwo] +\definetypeface [times] [tt] [mono] [computer-modern] [default] [rscale=1.1] \definetypeface [times] [mm] [math] [times] [default] [encoding=\typescripttwo] \stoptypescript @@ -44,7 +44,7 @@ \definetypeface [palatino] [rm] [serif] [palatino] [default] [encoding=\typescripttwo] \definetypeface [palatino] [mm] [math] [palatino] [default] [encoding=\typescripttwo] -\definetypeface [palatino] [tt] [mono] [computer-modern] [default] [rscale=1.075,encoding=\typescripttwo] +\definetypeface [palatino] [tt] [mono] [computer-modern] [default] [rscale=1.075] % to do (rscaled): tt->computer-modern ss->?? diff --git a/tex/context/base/type-ini.tex b/tex/context/base/type-ini.tex index cb25a6036..b59299ff7 100644 --- a/tex/context/base/type-ini.tex +++ b/tex/context/base/type-ini.tex @@ -284,7 +284,7 @@ \def\doloadfontmapfile#1% will be special {\doifundefined{#1 \c!status} - {\ifnum\realpageno>1 + {\ifnum\realpageno>\plusone \writestatus{pdftex}{too late for map file: #1}% \else \writestatus{pdftex}{using map file: #1}% @@ -326,7 +326,7 @@ % \definetypeface [#1:joke] [#2:rm] [#3:...] % \definetypeface [#1:joke] [#2:rm] [#3:serif] [#4:lucida] [#5:size] [#6:...] -\def\definetypeface% +\def\definetypeface {\dosixtupleargument\dodefinetypeface} \def\tsvar#1#2% @@ -345,13 +345,15 @@ \iffifthargument % sixth is optional % \getparameters[\??ts][rscale=1,\s!encoding=\defaultencoding,#6] % we need to expand since iin #6 there can be a \typescripttwo - \expanded{\getparameters[\??ts][rscale=1,\s!encoding=\defaultencoding,#6]}% + %\expanded{\getparameters[\??ts][\s!rscale=1,\s!encoding=\defaultencoding,#6]}% +\expanded{\getparameters[\??ts][\s!rscale=1,\s!encoding=\s!default,#6]}% \pushmacro\relativefontsize \pushmacro\typefaceencoding \pushmacro\fontclass \let\relativefontsize\@@tsrscale \let\typefaceencoding\@@tsencoding \setcurrentfontclass{#1} + \saverelativefontsize{#2}{\relativefontsize}% fall back \writestatus{typeface}{[#1] [#2] [#3] [#4]} \usetypescript[map][\typefaceencoding] % \usetypescript[#3][#4][name] @@ -395,7 +397,7 @@ {#1[\getvalue{\??tf\fontclass\s!default}]} {#1[\c!rm]}% \fi \fi - \tf} + \ifmmode\mr\else\tf\fi} % needed ? \def\usetypefile[#1]% recurses on path ! {\readfile{\f!typeprefix#1}{}{}}% \relax\relax} diff --git a/tex/context/base/type-run.tex b/tex/context/base/type-run.tex index 6fdcab997..2e9f02a84 100644 --- a/tex/context/base/type-run.tex +++ b/tex/context/base/type-run.tex @@ -49,5 +49,5 @@ \next} \processcommacommand[\typescriptfiles]\dodousetypescript \egroup} - + \protect \endinput diff --git a/tex/context/base/type-siz.tex b/tex/context/base/type-siz.tex index aa30ce30f..8cb6e08d4 100644 --- a/tex/context/base/type-siz.tex +++ b/tex/context/base/type-siz.tex @@ -31,17 +31,17 @@ [tt] [default] \stoptypescript -\starttypescript [math] [default] [size] +\starttypescript [math,boldmath] [default] [size] \definebodyfont [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt] [mm] [default] \stoptypescript -\starttypescript [boldmath] [default] [size] +\starttypescript [bfmath] [default] [size] \definebodyfont [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt] - [mm] [boldmath] -\stoptypescript + [mm] [bfmath] +\stoptypescript \starttypescript [handwriting] [default] [size] \definebodyfont @@ -155,17 +155,13 @@ [tt] [default] \stoptypescript -\starttypescript [math] [dtp] [size] +\starttypescript [math,boldmath] [dtp] [size] \definebodyfont [5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,13pt,14pt,16pt,18pt,22pt,28pt] [mm] [default] \stoptypescript -\starttypescript [boldmath] [dtp] [size] - \definebodyfont - [5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,13pt,14pt,16pt,18pt,22pt,28pt] - [mm] [boldmath] -\stoptypescript +% cmr \starttypescript [serif] [computer-modern] [size] diff --git a/tex/context/base/type-spe.tex b/tex/context/base/type-spe.tex index 03c49f8c3..91fce0bf4 100644 --- a/tex/context/base/type-spe.tex +++ b/tex/context/base/type-spe.tex @@ -19,7 +19,7 @@ \usemathcollection[default] \stoptypescript -\starttypescript [math] [lucida] [special] +\starttypescript [math,boldmath] [lucida] [special] \usemathcollection[lbr] \stoptypescript @@ -28,11 +28,11 @@ \stoptypescript \starttypescript [math] [times] [special] - \usemathcollection[tim] + \usemathcollection[ams] \stoptypescript -\starttypescript [math] [euler] [special] - \usemathcollection[eul] +\starttypescript [math] [palatino] [special] + \usemathcollection[ams] \stoptypescript \endinput diff --git a/tex/context/base/type-syn.tex b/tex/context/base/type-syn.tex index 3cd761979..148d2fadb 100644 --- a/tex/context/base/type-syn.tex +++ b/tex/context/base/type-syn.tex @@ -67,6 +67,7 @@ \starttypescript [math] [computer-modern] [name] \definefontsynonym [OldStyle] [MathItalic] \definefontsynonym [Fraktur] [eufm10] + \definefontsynonym [Blackboard] [msbm10] \definefontsynonym [Gothic] [eufm10] \definefontsynonym [Calligraphic] [cmsy10] \stoptypescript @@ -139,10 +140,19 @@ \definefontsynonym [MathItalic] [LucidaNewMath-AltItalic] \definefontsynonym [MathSymbol] [LucidaNewMath-Symbol] \definefontsynonym [MathAlpha] [LucidaNewMath-Arrows] + \definefontsynonym [MathBeta] [LucidaNewMath-Roman] \stoptypescript \starttypescript [boldmath] [lucida] [name] - \definefontsynonym [MathRomanBold] [LucidaBright-Demi] + \definefontsynonym [MathRoman] [LucidaNewMath-Demibold] + \definefontsynonym [MathExtension] [LucidaNewMath-Extension] + \definefontsynonym [MathItalic] [LucidaNewMath-AltDemiItalic] + \definefontsynonym [MathSymbol] [LucidaNewMath-Symbol-Demi] + \definefontsynonym [MathAlpha] [LucidaNewMath-Arrows-Demi] +\stoptypescript + +\starttypescript [bfmath] [lucida] [name] + \definefontsynonym [MathRomanBold] [LucidaNewMath-Demibold] \definefontsynonym [MathExtensionBold] [LucidaNewMath-Extension] \definefontsynonym [MathItalicBold] [LucidaNewMath-AltDemiItalic] \definefontsynonym [MathSymbolBold] [LucidaNewMath-Symbol-Demi] diff --git a/tex/context/base/unic-000.tex b/tex/context/base/unic-000.tex new file mode 100644 index 000000000..eba4a33c1 --- /dev/null +++ b/tex/context/base/unic-000.tex @@ -0,0 +1,224 @@ +%D \module +%D [ file=unic-000, +%D version=2002.12.03, +%D title=\CONTEXT\ \UNICODE\ Macros, +%D subtitle=Vector 0, +%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. + +\unprotect + +\startunicodevector 0 + \ifcase\numexpr(#1-159) + \@@unknownchar\or + \@@unknownchar\or % NO-BREAK SPACE + exclamdown\or + textcent\or + textsterling\or + textcurrency\or + textyen\or + textbrokenbar\or + sectionmark\or + textdiaeresis\or + copyright\or + \@@unknownchar\or % FEMININE ORDINAL INDICATOR + \@@unknownchar\or % LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + textlognot\or + softhyphen\or + registered\or + textmacron\or + textdegree\or + textpm\or + \@@unknownchar\or % SUPERSCRIPT TWO + \@@unknownchar\or % SUPERSCRIPT THREE + textacute\or + \@@unknownchar\or % MICRO SIGN + \@@unknownchar\or % PILCROW SIGN + \@@unknownchar\or % MIDDLE DOT + textcedilla\or + \@@unknownchar\or % SUPERSCRIPT ONE + \@@unknownchar\or % MASCULINE ORDINAL INDICATOR + \@@unknownchar\or % RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + \@@unknownchar\or % VULGAR FRACTION ONE QUARTER + \@@unknownchar\or % VULGAR FRACTION ONE HALF + \@@unknownchar\or % VULGAR FRACTION THREE QUARTERS + questiondown\or + Agrave\or + Aacute\or + Acircumflex\or + Atilde\or + Adiaeresis\or + Aring\or + AEligature\or + Ccedilla\or + Egrave\or + Eacute\or + Ecircumflex\or + Ediaeresis\or + Igrave\or + Iacute\or + Icircumflex\or + Idiaeresis\or + \@@unknownchar\or % Eth\or + Ntilde\or + Ograve\or + Oacute\or + Ocircumflex\or + Otilde\or + Odiaeresis\or + \@@unknownchar\or + Ostroke\or + Ugrave\or + Uacute\or + Ucircumflex\or + Udiaeresis\or + Yacute\or + Thorn\or + ssharp\or + agrave\or + aacute\or + acircumflex\or + atilde\or + adiaeresis\or + aring\or + aeligature\or + ccedilla\or + egrave\or + eacute\or + ecircumflex\or + ediaeresis\or + igrave\or + iacute\or + icircumflex\or + idiaeresis\or + \@@unknownchar\or % eth\or + ntilde\or + ograve\or + oacute\or + ocircumflex\or + ohungarumlaut\or + odiaeresis\or + \@@unknownchar\or + ostroke\or + ugrave\or + uacute\or + ucircumflex\or + udiaeresis\or + yacute\or + thorn\or + ydiaeresis\else + \@@unknownchar + \fi +\stopunicodevector + +% 20\% faster: + +\startunicodevector 0 + \expandafter\strippedcsname + \ifcase\numexpr(#1-159)!\@@unknownchar\or + \unknownchar \or % NO-BREAK SPACE + \exclamdown \or + \textcent \or + \textsterling \or + \textcurrency \or + \textyen \or + \textbrokenbar \or + \sectionmark \or + \textdiaeresis \or + \copyright \or + \unknownchar \or % FEMININE ORDINAL INDICATOR + \unknownchar \or % LEFT-POINTING DOUBLE ANGLE QUOTATION MARK + \textlognot \or + \softhyphen \or + \registered \or + \textmacron \or + \textdegree \or + \textpm \or + \unknownchar \or % SUPERSCRIPT TWO + \unknownchar \or % SUPERSCRIPT THREE + \textacute \or + \unknownchar \or % MICRO SIGN + \unknownchar \or % PILCROW SIGN + \unknownchar \or % MIDDLE DOT + \textcedilla \or + \unknownchar \or % SUPERSCRIPT ONE + \unknownchar \or % MASCULINE ORDINAL INDICATOR + \unknownchar \or % RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK + \unknownchar \or % VULGAR FRACTION ONE QUARTER + \unknownchar \or % VULGAR FRACTION ONE HALF + \unknownchar \or % VULGAR FRACTION THREE QUARTERS + \questiondown \or + \Agrave \or + \Aacute \or + \Acircumflex \or + \Atilde \or + \Adiaeresis \or + \Aring \or + \AEligature \or + \Ccedilla \or + \Egrave \or + \Eacute \or + \Ecircumflex \or + \Ediaeresis \or + \Igrave \or + \Iacute \or + \Icircumflex \or + \Idiaeresis \or + \unknownchar \or % \Eth \or + \Ntilde \or + \Ograve \or + \Oacute \or + \Ocircumflex \or + \Otilde \or + \Odiaeresis \or + \unknownchar \or + \Ostroke \or + \Ugrave \or + \Uacute \or + \Ucircumflex \or + \Udiaeresis \or + \Yacute \or + \Thorn \or + \ssharp \or + \agrave \or + \aacute \or + \acircumflex \or + \atilde \or + \adiaeresis \or + \aring \or + \aeligature \or + \ccedilla \or + \egrave \or + \eacute \or + \ecircumflex \or + \ediaeresis \or + \igrave \or + \iacute \or + \icircumflex \or + \idiaeresis \or + \unknownchar \or % \eth \or + \ntilde \or + \ograve \or + \oacute \or + \ocircumflex \or + \ohungarumlaut \or + \odiaeresis \or + \unknownchar \or + \ostroke \or + \ugrave \or + \uacute \or + \ucircumflex \or + \udiaeresis \or + \yacute \or + \thorn \or + \ydiaeresis \else + \unknownchar + \fi +\stopunicodevector + +\protect \endinput diff --git a/tex/context/base/unic-001.tex b/tex/context/base/unic-001.tex new file mode 100644 index 000000000..189e57f21 --- /dev/null +++ b/tex/context/base/unic-001.tex @@ -0,0 +1,287 @@ +%D \module +%D [ file=unic-001, +%D version=2002.12.03, +%D title=\CONTEXT\ \UNICODE\ Macros, +%D subtitle=Vector 1, +%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. + +\unprotect + +\startunicodevector 1 + \ifcase#1\or + \@@unknownchar\or + Abreve\or + abreve\or + Aogonek\or + aogonek\or + Cacute\or + cacute\or + Ccircumflex\or + ccircumflex\or + Cdotaccent\or + cdotaccent\or + Ccaron\or + ccaron\or + Dcaron\or + dcaron\or + Dstroke\or + dstroke\or + Emacron\or + emacron\or + Ebreve\or + ebreve\or + Edotaccent\or + edotaccent\or + Eogonek\or + eogonek\or + Ecaron\or + ecaron\or + Gcircumflex\or + gcircumflex\or + Gbreve\or + gbreve\or + Gdotaccent\or + gdotaccent\or + \@@unknownchar\or % Gcedilla\or + \@@unknownchar\or % gcedilla\or + Hcircumflex\or + hcircumflex\or + Hstroke\or + hstroke\or + Itilde\or + itilde\or + Imacron\or + imacron\or + Ibreve\or + ibreve\or + Iogonek\or + iogonek\or + Idotaccent\or + dotlessi\or + IJligature\or + ijligature\or + Jcircumflex\or + jcircumflex\or + Kcedilla\or + kcedilla\or + \@@unknownchar\or % kra\or + Lacute\or + lacute\or + Lcedilla\or + lcedilla\or + Lcaron\or + lcaron\or + \@@unknownchar\or % Ldotmiddle\or + \@@unknownchar\or % ldotmiddle\or + Lstroke\or + lstroke\or + Nacute\or + nacute\or + Ncedilla\or + ncedilla\or + Ncaron\or + ncaron\or + napostrophe\or + Neng\or + neng\or + Omacron\or + omacron\or + Obreve\or + obreve\or + Ohungarumlaut\or + ohungarumlaut\or + OEligature\or + oeligature\or + Racute\or + racute\or + Rcedilla\or + rcedilla\or + Rcaron\or + rcaron\or + Sacute\or + sacute\or + Scircumflex\or + scircumflex\or + Scedilla\or + scedilla\or + Scaron\or + scaron\or + Tcedilla\or + tcedilla\or + Tcaron\or + tcaron\or + Tstroke\or + tstroke\or + Utilde\or + utilde\or + Umacron\or + umacron\or + Ubreve\or + ubreve\or + Uring\or + uring\or + Uhungarumlaut\or + uhungarumlaut\or + Uogonek\or + uogonek\or + Wcircumflex\or + wcircumflex\or + Ycircumflex\or + ycircumflex\or + Ydiaeresis\or + Zacute\or + zacute\or + Zdotaccent\or + zdotaccent\or + Zcaron\or + zcaron\or + \@@unknownchar\else % slong\else + \@@unknownchar + \fi +\stopunicodevector + +%D Faster, watch how we avoid zero and \TEX's +%D automatically added \type {\relax}. + +\startunicodevector 1 + \expandafter\strippedcsname + \ifcase\numexpr(#1+1)\or + \unknownchar \or + \unknownchar \or + \Abreve \or + \abreve \or + \Aogonek \or + \aogonek \or + \Cacute \or + \cacute \or + \Ccircumflex \or + \ccircumflex \or + \Cdotaccent \or + \cdotaccent \or + \Ccaron \or + \ccaron \or + \Dcaron \or + \dcaron \or + \Dstroke \or + \dstroke \or + \Emacron \or + \emacron \or + \Ebreve \or + \ebreve \or + \Edotaccent \or + \edotaccent \or + \Eogonek \or + \eogonek \or + \Ecaron \or + \ecaron \or + \Gcircumflex \or + \gcircumflex \or + \Gbreve \or + \gbreve \or + \Gdotaccent \or + \gdotaccent \or + \unknownchar \or % \Gcedilla \or + \unknownchar \or % \gcedilla \or + \Hcircumflex \or + \hcircumflex \or + \Hstroke \or + \hstroke \or + \Itilde \or + \itilde \or + \Imacron \or + \imacron \or + \Ibreve \or + \ibreve \or + \Iogonek \or + \iogonek \or + \Idotaccent \or + \dotlessi \or + \IJligature \or + \ijligature \or + \Jcircumflex \or + \jcircumflex \or + \Kcedilla \or + \kcedilla \or + \unknownchar \or % \kkra \or + \Lacute \or + \lacute \or + \Lcedilla \or + \lcedilla \or + \Lcaron \or + \lcaron \or + \unknownchar \or % \Ldotmiddle \or + \unknownchar \or % \ldotmiddle \or + \Lstroke \or + \lstroke \or + \Nacute \or + \nacute \or + \Ncedilla \or + \ncedilla \or + \Ncaron \or + \ncaron \or + \napostrophe \or + \Neng \or + \neng \or + \Omacron \or + \omacron \or + \Obreve \or + \obreve \or + \Ohungarumlaut \or + \ohungarumlaut \or + \OEligature \or + \oeligature \or + \Racute \or + \racute \or + \Rcedilla \or + \rcedilla \or + \Rcaron \or + \rcaron \or + \Sacute \or + \sacute \or + \Scircumflex \or + \scircumflex \or + \Scedilla \or + \scedilla \or + \Scaron \or + \scaron \or + \Tcedilla \or + \tcedilla \or + \Tcaron \or + \tcaron \or + \Tstroke \or + \tstroke \or + \Utilde \or + \utilde \or + \Umacron \or + \umacron \or + \Ubreve \or + \ubreve \or + \Uring \or + \uring \or + \Uhungarumlaut \or + \uhungarumlaut \or + \Uogonek \or + \uogonek \or + \Wcircumflex \or + \wcircumflex \or + \Ycircumflex \or + \ycircumflex \or + \Ydiaeresis \or + \Zacute \or + \zacute \or + \Zdotaccent \or + \zdotaccent \or + \Zcaron \or + \zcaron \or + \unknownchar \else % \slong \else + \unknownchar + \fi +\stopunicodevector + +\protect \endinput diff --git a/tex/context/base/unic-002.tex b/tex/context/base/unic-002.tex new file mode 100644 index 000000000..1f9065ec6 --- /dev/null +++ b/tex/context/base/unic-002.tex @@ -0,0 +1,48 @@ +%D \module +%D [ file=unic-002, +%D version=2002.12.03, +%D title=\CONTEXT\ \UNICODE\ Macros, +%D subtitle=Vector 2, +%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. + +\unprotect + +\startunicodevector 2 + \ifcase\numexpr(#1-198) + textcircumflex\or + textcaron\else + \ifcase\numexpr(#1-216) + textbreve\or + textdotaccent\or + \@@unknownchar\or + textogonek\or + texttilde\or + texthungarumlaut\else + \@@unknownchar + \fi\fi +\stopunicodevector + +% ugly but faster + +\startunicodevector 2 + \ifcase\numexpr(#1-198) + \strippedcsname \textcircumflex \or + \strippedcsname \textcaron \else + \ifcase\numexpr(#1-216) + \strippedcsname \textbreve \or + \strippedcsname \textdotaccent \or + \strippedcsname \unknownchar \or + \strippedcsname \textogonek \or + \strippedcsname \texttilde \or + \strippedcsname \texthungarumlaut \else + \strippedcsname \unknownchar + \fi\fi +\stopunicodevector + +\protect \endinput diff --git a/tex/context/base/unic-032.tex b/tex/context/base/unic-032.tex new file mode 100644 index 000000000..75009566e --- /dev/null +++ b/tex/context/base/unic-032.tex @@ -0,0 +1,84 @@ +%D \module +%D [ file=unic-032, +%D version=2002.12.03, +%D title=\CONTEXT\ \UNICODE\ Macros, +%D subtitle=Vector 32, +%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. + +\unprotect + +\startunicodevector 32 + \ifcase\numexpr(#1-19) + endash\or + emdash\or + \@@unknownchar\or + \@@unknownchar\or + \@@unknownchar\or + quoteleft\or + quoteright\or + quotesinglebase\or + \@@unknownchar\or + quotedblleft\or + quotedblright\or + quotedblbase\or + \@@unknownchar\or + textdag\or + textddag\or + textbullet\or + \@@unknownchar\or + \@@unknownchar\or + \@@unknownchar\or + textellipsis\else + \ifcase\numexpr(#1-48) + perthousand\else + \ifcase\numexpr(#1-57) + \@@unknownchar\or % SINGLE LEFT-POINTING ANGLE QUOTATION MARK + \@@unknownchar\else % SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + \ifcase\numexpr(#1-172) + texteuro\else + \@@unknownchar + \fi\fi\fi\fi +\stopunicodevector + +%D More efficient: + +\startunicodevector 32 + \ifcase\numexpr(#1-19) + \strippedcsname \endash \or + \strippedcsname \emdash \or + \strippedcsname \unknownchar \or + \strippedcsname \unknownchar \or + \strippedcsname \unknownchar \or + \strippedcsname \quoteleft \or + \strippedcsname \quoteright \or + \strippedcsname \quotesinglebase \or + \strippedcsname \unknownchar \or + \strippedcsname \quotedblleft \or + \strippedcsname \quotedblright \or + \strippedcsname \quotedblbase \or + \strippedcsname \unknownchar \or + \strippedcsname \textdag \or + \strippedcsname \textddag \or + \strippedcsname \textbullet \or + \strippedcsname \unknownchar \or + \strippedcsname \unknownchar \or + \strippedcsname \unknownchar \or + \strippedcsname \textellipsis \else + \ifcase\numexpr(#1-48) + \strippedcsname \perthousand \else + \ifcase\numexpr(#1-57) + \strippedcsname \unknownchar \or % SINGLE LEFT-POINTING ANGLE QUOTATION MARK + \strippedcsname \unknownchar \else % SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + \ifcase\numexpr(#1-172) + \strippedcsname \texteuro \else + \strippedcsname \unknownchar + \fi\fi\fi\fi +\stopunicodevector + +\protect \endinput diff --git a/tex/context/base/unic-033.tex b/tex/context/base/unic-033.tex new file mode 100644 index 000000000..5ff0d2e4d --- /dev/null +++ b/tex/context/base/unic-033.tex @@ -0,0 +1,29 @@ +%D \module +%D [ file=unic-033, +%D version=2002.12.03, +%D title=\CONTEXT\ \UNICODE\ Macros, +%D subtitle=Vector 33, +%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. + +\unprotect + +\startunicodevector 33 + \ifcase\numexpr(#1-34) + \@@unknownchar \else % TRADE MARK SIGN + \@@unknownchar + \fi +\stopunicodevector + +%D For the moment: + +\startunicodevector 33 + \@@unknownchar +\stopunicodevector + +\protect \endinput diff --git a/tex/context/base/unic-exp.tex b/tex/context/base/unic-exp.tex new file mode 100644 index 000000000..0c5451ca1 --- /dev/null +++ b/tex/context/base/unic-exp.tex @@ -0,0 +1,69 @@ +%D \module +%D [ file=unic-exp, +%D version=2002.12.05, +%D title=\CONTEXT\ \UNICODE\ Support, +%D subtitle=\UNICODE\ vector expansion, +%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 UNICODE Macros (expansion)} + +%D \macros +%D {expandunivector} +%D +%D The \type {\expandunivector} macro can be used to expand +%D vectors, which leads to a faster run in case of documents +%D with lots of \UTF-8 code. + +\unprotect + +\def\expandunivector[#1]% + {\processcommalist[#1]\doexpandunivector} + +\def\doexpandunivector#1% + {\ifcsname\@@univector#1\endcsname + \ifcsname\@@univector\@@univector#1\endcsname\else + \writestatus{unicode}{expanding vector #1}% + \setvalue{\@@univector\@@univector#1}{\expandedunivector{#1}}% + \dorecurse{255} + {\@EA\ifx\csname\csname\@@univector#1\endcsname\recurselevel\endcsname + \unknownchar + % skip + \else + \@EAEAEA\let\@EA\@EA\csname\@@univector\@@univector#1:\recurselevel\endcsname + \csname\csname\@@univector#1\endcsname\recurselevel\endcsname + \fi}% + \letbeundefined{\@@univector#1}% + \fi + \fi} + +\def\expandedunivector#1#2% + {\ifcsname\@@univector\@@univector#1:\number#2\endcsname + \@@univector\@@univector#1:\number#2% + \else + \@@unknownchar + \fi} + +%D For this purpose, we need to redefine the resolver. + +\def\doutfunihash#1#2% + {\ifcsname\@@univector\@@univector\number#1\endcsname + \csname\@@univector\@@univector\number#1\endcsname{\utfmod{#2}}% + \else\ifcsname\@@univector\number#1\endcsname + \csname\@@univector#1\endcsname{\utfmod{#2}}% + \else + \@@unknownchar + \fi\fi} + +\let\utfunihash\utfunihashglyph + +%D Let's use it: + +\expandunivector[0,1,2,32,33] + +\protect \endinput diff --git a/tex/context/base/unic-ini.tex b/tex/context/base/unic-ini.tex new file mode 100644 index 000000000..3860a7557 --- /dev/null +++ b/tex/context/base/unic-ini.tex @@ -0,0 +1,538 @@ +%D \module +%D [ file=unic-ini, +%D version=2002.12.03, +%D title=\CONTEXT\ \UNICODE\ Support, +%D subtitle=\UNICODE\ \& UTF-8 support, +%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 UNICODE Macros (ini)} + +%D Sorry, we only support his in \ETEX. + +\beginTEX + \def\useunicodevector[#1]{} + \expandafter \endinput +\endTEX + +\unprotect + +%D This module deals with unicode, and in particular with +%D \UTF-8 conversion. The prelude to this module was \type +%D {xtag-utf}, which is now replaced by a one||liner. The +%D macros below deal with conversions. Thanks to Taco for +%D providing the following conversion rules. +%D +%D \starttabulatie[|c|c|c|c|c|] +%D \NC $b_1$ \NC $b_2$ \NC $b_3$ \NC $b_4$ \NC unicode \NC \NR +%D \NC192---223\NC128---191\NC \NC \NC 0x80---0x7FF \NC \NR +%D \NC224---239\NC128---191\NC128---191\NC \NC 0x800---0xFFFF \NC \NR +%D \NC240---247\NC128---191\NC128---191\NC128---191\NC0x10000---0x1FFFF\NC \NR +%D \stoptabulatie +%D +%D In \UTF-8 the characters in the range 128---191 are illegal +%D as first characters. The characters 254 and 255 are +%D completely illegal and should not appear at all (they are +%D related to UTF16). +%D +%D The unicode number for an \UTF-8 sequence can be calculated +%D as follows: +%D +%D \starttabulatie[|mc|m|mc|m|mc|m|mc|m|] +%D \NC b_1 \NC \NC \NC \NC \NC \NC \NC if b_1<=127\NC \NR +%D \NC 64(b_1-192)\NC+\NC (b_2-128)\NC \NC \NC \NC \NC if 192<=b1<=223\NC \NR +%D \NC 4096(b_1-224)\NC+\NC 64(b_2-128)\NC+\NC (b_3-128)\NC \NC \NC if 224<=b1<=239\NC \NR +%D \NC262144(b_1-240)\NC+\NC4096(b_2-128)\NC+\NC64(b_3-128)\NC+\NC(b_4-128)\NC if 240<=b1<=247\NC \NR +%D \stoptabulatie +%D +%D A lot of information abou tunicode can be found on the +%D web (search for Markus Kuhn and unicode and you'll +%D probably end up at the right place). + +%D In \ETEX\ vocabulary such a conversion looks as follows. +%D We need the \type {`} in order to turn a character into a +%D number. +%D +%D \starttypen +%D \def\utftwounicode#1#2% +%D {\number\numexpr (64*(\numexpr (#1-192))+% +%D (\numexpr(`#2-128)))} +%D +%D \def\utfthreeunicode#1#2#3% +%D {\number\numexpr (4096*(\numexpr (#1-224))+ +%D 64*(\numexpr(`#2-128))+% +%D (\numexpr(`#3-128)))} +%D +%D \def\utffourunicode#1#2#3#4% +%D {\number\numexpr(262144*(\numexpr (#1-240))+ +%D 4096*(\numexpr(`#1-128))+ +%D 64*(\numexpr(`#2-128))+% +%D (\numexpr(`#3-128)))} +%D \stoptypen +%D +%D When we map the unicode number on one of the 256 char wide +%D unicode tables, we need to do a bit of div and mod. Watch +%D out: an \ETEX\ \type {/} is not the same as \TEX's \type +%D {\divide}. The former rounds, while the later truncates, so +%D we need to trucate ourselves. In case you wonder why we +%D use \type {\numexpr}: this is not only more convenient, but +%D also makes it possible to avoid scratch counters, so that we +%D get fast and fully expandable conversions. +%D +%D \starttypen +%D \def\utfdiv#1{\number\numexpr((#1-128)/256)} +%D \def\utfmod#1{\number\numexpr((#1)-(256*(\utfdiv{#1})))} +%D \stoptypen +%D +%D So far for the readable alternatives. When using \type +%D {\numexpr} you should be aware of rather unexpected look +%D ahead effects. The next implementation uses registers, +%D which saves tokens and is faster. In this case we gain +%D some 10\% time. + +\chardef \utf@a=64 +\mathchardef \utf@b=4096 +\newcount\utf@c\utf@c=262144 + +\chardef \utf@d=192 +\chardef \utf@e=224 +\chardef \utf@f=240 + +\chardef \utf@g=128 +\mathchardef \utf@h=256 +\chardef \utf@i=127 + +%D The definitions now become: +%D +%D \starttypen +%D \def\utftwounicode#1#2% +%D {\number\numexpr(\utf@a*(\numexpr (#1-\utf@d))+% +%D (\numexpr(`#2-\utf@g)))} +%D +%D \def\utfthreeunicode#1#2#3% +%D {\number\numexpr(\utf@b*(\numexpr (#1-\utf@e))+ +%D \utf@a*(\numexpr(`#2-\utf@g))+% +%D (\numexpr(`#3-\utf@g)))} +%D +%D \def\utffourunicode#1#2#3#4% +%D {\number\numexpr(\utf@c*(\numexpr (#1-\utf@f))+ +%D \utf@b*(\numexpr(`#2-\utf@g))+ +%D \utf@a*(\numexpr(`#3-\utf@g))+% +%D (\numexpr(`#4-\utf@g)))} +%D \stoptypen +%D +%D And: +%D +%D \starttypen +%D \def\utfdiv#1{\number\numexpr((#1-\utf@g)/\utf@h)} +%D \def\utfmod#1{\number\numexpr((#1)-(\utf@h*(\utfdiv{#1})))} +%D \stoptypen +%D +%D Depending on the usage, you can rely on parenthesis only: +%D +%D \starttypen +%D \def\utftwounicode#1#2% +%D {\numexpr(\utf@a*(#1-\utf@d)+% +%D `#2-\utf@g)} +%D +%D \def\utfthreeunicode#1#2#3% +%D {\numexpr(\utf@b*(#1-\utf@e)+% +%D \utf@a*(`#2-\utf@g)+% +%D `#3-\utf@g)} +%D +%D \def\utffourunicode#1#2#3#4% +%D {\numexpr(\utf@c*(#1-\utf@f)+% +%D \utf@b*(`#2-\utf@g)+% +%D \utf@a*(`#3-\utf@g)+% +%D `#4-\utf@g)} +%D \stoptypen + +\def\utfdiv#1{\number\numexpr((#1-\utf@g)/\utf@h)} +\def\utfmod#1{\number\numexpr(#1-\utf@h*((#1-\utf@g)/\utf@h))} + +%D When tracing we also need: + +\def\utfvid#1{\number\numexpr((#1-\medcard)/\maxcard)} + +%D Using the three conversion macros, we can now implement +%D a few handlers. They all call the general \type +%D {\unicodechar} conversion macro. +%D +%D \starttypen +%D \def\utftwouniglph#1#2% +%D {\unicodechar{\utftwounicode {#1}{#2}}} +%D +%D \def\utfthreeuniglph#1#2#3% +%D {\unicodechar{\utfthreeunicode{#1}{#2}{#3}}} +%D +%D \def\utffouruniglph#1#2#3#4% +%D {\unicodechar{\utffourunicode {#1}{#2}{#3}{#4}}} +%D \stoptypen +%D +%D Because the unicode number is used a few times per +%D conversion, we can expand it once (\type {\the} and \type +%D {\number} make sure of this). This saves us another 10\%. +%D +%D \starttypen +%D \def\utftwouniglph#1#2% +%D {\@EA\unicodechar\@EA{\the\utftwounicode{#1}{#2}}} +%D +%D \def\utfthreeuniglph#1#2#3% +%D {\@EA\unicodechar\@EA{\the\utfthreeunicode{#1}{#2}{#3}}} +%D +%D \def\utffouruniglph#1#2#3#4% +%D {\@EA\unicodechar\@EA{\the\utffourunicode{#1}{#2}{#3}{#4}}} +%D \stoptypen +%D +%D We can rewrite these macros to faster alternatives: the +%D less arguments we pass, the faster the conversion will be, +%D but at the price of readability. + +\def\utftwouniglph#1#2% + {\@EA\unicodechar\@EA{\the\numexpr(\utf@a*(#1-\utf@d)+% + `#2-\utf@g)}} + +\def\utfthreeuniglph#1#2#3% + {\@EA\unicodechar\@EA{\the\numexpr(\utf@b*(#1-\utf@e)+% + \utf@a*(`#2-\utf@g)+`#3-\utf@g)}} + +\def\utffouruniglph#1#2#3#4% + {\@EA\unicodechar\@EA{\the\numexpr(\utf@c*(#1-\utf@f)+% + \utf@b*(`#2-\utf@g)+\utf@a*(`#3-\utf@g)+`#4-\utf@g)}} + +%D Now we come to the unicode handler itself. We will use a few +%D constants, which saves us (at least at the time of writing +%D and testing these macros) another 10\%. + +\def\@@univector {univ} +\def\@@unknownchar{unknownchar} + +%D Now comes the nice part: turning codes into glyphs. The +%D actual conversion does not take place here, but is done by +%D macros in \type{unic-nnn} files. There we map a range onto +%D named glyphs, so that they fit well into the rest of +%D \CONTEXT. + +%D \macros +%D {utfunicodetracer} +%D +%D By default, the converter produces a character representation, +%D but for tracing purposes, you can set a trace option. + +\chardef\utfunicodetracer=0 + +%D \def\TraceUnic#1% +%D {\chardef\utfunicodetracer#1\relax\enableregime[utf]Å°} +%D +%D \starttabulatie[|c|c|c|c|c|c|] +%D \NC option \NC number\NC mapping\NC glyph\NC string\NC example \NC \NR +%D \NC 0 \NC \NC \NC \star\NC \NC \TraceUnic0\NC \NR +%D \NC 1 \NC \star \NC \NC \NC \NC \TraceUnic1\NC \NR +%D \NC 2 \NC \NC \star \NC \NC \NC \TraceUnic2\NC \NR +%D \NC 3 \NC \star \NC \star \NC \NC \NC \TraceUnic3\NC \NR +%D \NC 4 \NC \star \NC \NC \star\NC \NC \TraceUnic4\NC \NR +%D \NC 5 \NC \NC \star \NC \star\NC \NC \TraceUnic5\NC \NR +%D \NC 6 \NC \star \NC \star \NC \star\NC \NC \TraceUnic6\NC \NR +%D \NC 7 \NC \NC \NC \NC \star \NC \TraceUnic7\NC \NR +%D \NC otherwise\NC \NC \NC \star\NC \NC \TraceUnic8\NC \NR +%D \stoptabulatie + +%D \macros +%D {unicodechar} +%D +%D Next we implement the character handler: + +\def\unicodechar + {\ifcase\utfunicodetracer + \expandafter\utfunihash \or + \expandafter\utfunichar \or + \expandafter\utfunisplit \or + \expandafter\utfuniboth \or + \expandafter\utfunihashchar \or + \expandafter\utfunihashsplit \or + \expandafter\utfunihashboth \or + \@EA\string\@EA\unicodechar \else + \expandafter\utfunihash + \fi} + +%D \macros +%D {unicodehexnumber} +%D +%D A few auxiliary macros, producing the range||char pair: + +\def\unicodepair#1% + {\utfdiv{#1}:\utfmod{#1}} + +\let\unicodenumber\firstofoneargument + +%\def\unicodehexnumber#1% +% {\expanded{\uchexnumbers{\utfdiv{#1}}}% +% \expanded{\uchexnumbers{\utfmod{#1}}}} + +\def\unicodehexnumber#1% + {\ifnum#1>\maxcard + \expanded{\uchexnumbers{\utfvid{#1}}}% + \expanded{\uchexnumbers{\utfdiv{\utfdiv{#1}}}}% + \else + 00% + \expanded{\uchexnumbers{\utfdiv{#1}}}% + \fi + \expanded{\uchexnumbers{\utfmod{#1}}}} + +%D The following macros visualize the unicode character. The +%D \type {\relax} in front of the \type {-} prevents lookahead +%D problems; somehow \type {\numexpr} cannot look beyond this +%D sign, and expects a number. + +\def\utfunichar #1% + {{\tttf U\low{\unicodenumber{#1}}}} + +\def\utfunisplit#1% + {{\tttf U\low{\unicodepair{#1}}}} + +\def\utfuniboth #1% + {{\tttf U\low{\unicodenumber{#1\relax}->\unicodepair{#1}}}} + +%D The character itself is accessed and typeset by: +%D +%D \starttypen +%D \def\utfunihash#1% +%D {\executeifdefined{\@@univector\utfdiv{#1}}% +%D \gobbleoneargument{\utfmod{#1}}} +%D \stoptypen +%D +%D Again, we can provide a faster alternative, because inside +%D the conditional executer, the argument is expanded twice, +%D and therefore the calculation done once more than needed. +%D So, we make sure that the argument is expansion on +%D forehand. Just to remind you: \type {#1} is the \UNICODE\ +%D number. +%D +%D \starttypen +%D \def\utfunihash#1% +%D {\@EA\executeifdefined\@EA{\@EA\@@univector\number\utfdiv{#1}}% +%D {\unknownchar\gobbleoneargument}{\utfmod{#1}}} +%D \stoptypen +%D +%D In order to save calculation time, I decided to change +%D this definition into: + +%D \starttypen +%D \def\utfunihash#1% +%D {\@EA\doutfunihash\@EA{\number\utfdiv{#1}}{#1}} +%D +%D \def\doutfunihash#1#2% +%D {\ifcsname\@@univector\number#1\endcsname +%D \csname\csname\@@univector#1\endcsname{\utfmod{#2}}\endcsname +%D \else +%D \unknownchar +%D \fi} +%D \stoptypen +%D +%D Or leaner and meaner: +%D +%D \starttypen +%D \def\doutfunihash#1#2% +%D {\csname +%D \ifcsname\@@univector\number#1\endcsname +%D \csname\@@univector#1\endcsname{\utfmod{#2}}% +%D \else +%D \@@unknownchar +%D \fi +%D \endcsname} +%D \stoptypen +%D +%D And finaly it became: + +\def\doutfunihash#1#2% + {\ifcsname\@@univector\number#1\endcsname + \csname\@@univector#1\endcsname{\utfmod{#2}}% + \else + \@@unknownchar + \fi} + +\def\utfunihashglyph#1% + {\csname\@EA\doutfunihash\@EA{\number\utfdiv{#1}}{#1}\endcsname} + +\def\utfunihashcommand + {\@EAEAEA\string\utfunihashglyph} + +%D For practical purposes, we handle the normal \ASCII\ +%D characters here: + +\def\utfunihashglyph#1% + {\csname + \ifnum#1<\utf@i + \strippedcsname\unicodeasciicharacter\endcsname{#1}% + \else + \@EA\doutfunihash\@EA{\number\utfdiv{#1}}{#1}\endcsname + \fi} + +%D With: + +\let\unicodeasciicharacter\rawcharacter + +%D Now we can say: + +\let\utfunihash\utfunihashglyph + +%D The combined presentation is implemented by: + +\def\utfunihashchar #1% + {\utfunihash{#1}\low{\infofont\unicodenumber{#1}}} + +\def\utfunihashsplit#1% + {\utfunihash{#1}\low{\infofont\unicodepair{#1}}} + +\def\utfunihashboth #1% + {\utfunihash{#1}\low{\infofont\unicodenumber{#1\relax}->\unicodepair{#1}}} + +%D Unknown characters get a placeholder. + +\unexpanded\def\unknownchar % {} prevents problems with arguments + {{\hbox{\vrule\!!width.5em\!!height1ex\!!depth\zeropoint}}} + +%D So far for the conversion macros. The optimizations we +%D did, brought down the runtime some 50\%, which, given that +%D the majority of characters will be normal \ASCII\ +%D characters, the penalty of conversion is not that large. + +%D \macros +%D {useunicodevector} +%D +%D Since we end up with many encodings, it starts making +%D sense to postpone loading, so let's start doing this +%D with \UNICODE. + +\def\useunicodevector[#1]% + {\processcommalist[#1]\douseunicodevector} + +\def\douseunicodevector#1% + {\ifundefined{\@@univector#1}% + \readsysfile{unic-\ifnum#1<10 00\else\ifnum#1<100 0\fi\fi#1} + {\writestatus{unicode}{loading vector #1}} + {\writestatus{unicode}{unknown vector #1}}% + \fi} + +%D \macros +%D {startunicodevector} +%D +%D A vector roughly looks as follows. By putting the text +%D inside the name constructor, we prevent problems with +%D partial expansion in macros and special cases. +%D +%D \starttypen +%D \startunicodevector 0 +%D \ifcase\numexpr(#1-159)\or +%D \@@unknownchar\or % NO-BREAK SPACE +%D exclamdown\or +%D textcent\or +%D ....\else +%D \@@unknowncharacter +%D \fi +%D \stopunicodevector +%D \stoptypen +%D +%D In vector \type {unix-000} you will find another +%D optimizations. By using as less tokens as possible, we limit +%D the time skipping branches in the test, and save upto 20\% +%D runtime. + +\def\startunicodevector #1 #2\stopunicodevector + {\setgvalue{\@@univector#1}##1{#2}} + +%D Here we provide another auxiliary macro: +%D +%D \startbuffer +%D \unicodeinfoline{196}{Ä}{LATIN CAPITAL LETTER A WITH DIAERESIS} +%D \unicodeinfoline{197}{Ã…}{LATIN CAPITAL LETTER A WITH RING ABOVE} +%D \unicodeinfoline{198}{Æ}{LATIN CAPITAL LETTER AE} +%D \unicodeinfoline{199}{Ç}{LATIN CAPITAL LETTER C WITH CEDILLA} +%D \unicodeinfoline{200}{È}{LATIN CAPITAL LETTER E WITH GRAVE} +%D \unicodeinfoline{201}{É}{LATIN CAPITAL LETTER E WITH ACUTE} +%D \stopbuffer +%D +%D \typebuffer +%D +%D \start \enableregime[utf]\getbuffer \stop + +\def\unicodeinfoline#1#2#3% + {\ifnum#1>\utf@g % 128 + \noindent \hbox + {\hbox to 4em{\tttf\unicodehexnumber{#1}\hss}\quad + \hbox to 1em{#2\hss}\quad + \hbox to 9em{\tttf\unicodenumber{#1\relax}->\unicodepair{#1}\hss}\quad + \hbox to 9em{\tttf\let\utfunihash\utfunihashcommand#2\hss}\quad % tricky + \lowercase {\tttf#3}}\par + \fi} + +%D The next code permits utf code in hyperlinks: + +\def\cleanunicodechar#1{.#1.} + +\appendtoks \let\unicodechar\cleanunicodechar \to \everycleanupfeatures + +%D We will now hook this mechanism in the existing font +%D handler. More documentation will follow. Probably, some +%D features in \type {font-uni.tex} will be generalized +%D and moved here. + +\def\unidiv{0} \def\unimod{0} + +\chardef\utfunihashmode =0 % 1 = enabled + +\def\utfunifontglyph#1% + {\xdef\unidiv{\number\utfdiv{#1}}% + \xdef\unimod{\number\utfmod{#1}}% + \ifnum#1<\utf@i + \char\unimod % \unicodeascii\unimod + \else\ifcsname\@@univector\unidiv\endcsname + \csname\doutfunihash{\unidiv}{#1}\endcsname + \else % so, these can be different fonts ! + \unicodeglyph\unidiv\unimod % no \uchar (yet) + \fi\fi} + +\chardef\utfunicommandmode=0 % 1 = hex + +\def\unicodecommandchar#1#2% + {\string\char + \ifcase\utfunicommandmode + #1:#2\else\lchexnumbers#1:\lchexnumbers#2% + \fi} + +\def\utfunifontcommand#1% + {\xdef\unidiv{\number\utfdiv{#1}}% + \xdef\unimod{\number\utfmod{#1}}% + \ifnum#1<\utf@i + \unicodecommandchar\unidiv\unimod + \else\ifcsname\@@univector\unidiv\endcsname + \@EA\string\csname\doutfunihash{\unidiv}{#1}\endcsname + \else + \unicodecommandchar\unidiv\unimod + \fi\fi} + +\def\utfunihash + {\ifcase\utfunihashmode + \@EA\utfunihashglyph + \else + \@EA\utfunifontglyph + \fi} + +\def\utfunihashcommand + {\ifcase\utfunihashmode + \@EA\utfunihashcommand + \else + \@EA\utfunifontcommand + \fi} + +%D Well, let's at least preload a few familiar ones. Here we +%D also load the \UTF\ regime. + +\useunicodevector[0,1,2,32,33] \useregime[utf] + +\protect \endinput diff --git a/tex/context/base/verb-ini.tex b/tex/context/base/verb-ini.tex index 29ad0ecde..5cd56883c 100644 --- a/tex/context/base/verb-ini.tex +++ b/tex/context/base/verb-ini.tex @@ -13,7 +13,7 @@ %D Today I would implement the pretty handler slightly %D different, using stack and intermediate flushing. Maybe -%D even without active chars. +%D even without active chars. So, someday \unknown %D Because this module is quite independant of system macros, %D it can be used as a stand||alone verbatim environment. @@ -190,10 +190,10 @@ \catcode`\^^I=\@@active -\gdef\settabskips% - {\let\processverbatimline=\doprocesstabskipline - \catcode`\^^I=\@@active - \let^^I=\doprocesstabskip} +\gdef\settabskips + {\let\processverbatimline\doprocesstabskipline + \catcode`\^^I\@@active + \let^^I\doprocesstabskip} \egroup @@ -250,7 +250,7 @@ \spaceskip\wd\scratchbox \xspaceskip\spaceskip} -\def\setupinlineverbatim% +\def\setupinlineverbatim {\verbatimfont \setverbatimspaceskip \let\obeytabs\ignoretabs @@ -258,7 +258,7 @@ \let\obeypages\ignorepages \setupcopyverbatim} -\def\doprocessinlineverbatim% +\def\doprocessinlineverbatim {\ifx\next\bgroup \setupinlineverbatim \catcode`\{\@@begingroup @@ -339,13 +339,13 @@ %D The long ones are \type{\nobreaks} and the short ones %D \type{\goodbreaks}. And this is how it's done: -\def\doverbatimnobreak% +\def\doverbatimnobreak {\ifoptimizeverbatim\penalty500\fi} -\def\doverbatimgoodbreak% +\def\doverbatimgoodbreak {\ifoptimizeverbatim\penalty\linepenalty\fi} -\def\doflushverbatimline% +\def\doflushverbatimline {\expandafter\dodoverbatimline\expandafter{\savedverbatimline}} \let\handleverbatimline=\relax @@ -360,52 +360,54 @@ % % more efficient -\def\initializeverbatimline% +\global\chardef\verbatimstatus0 + +\def\initializeverbatimline {\global\let\savedverbatimline\empty \global\chardef\verbatimstatus\ifskipfirstverbatimline0 \else1 \fi} -\def\presetemptyverbatimline% +\def\presetemptyverbatimline {\ifcase\verbatimstatus - \global\chardef\verbatimstatus=1 + \global\chardef\verbatimstatus1 \or \or % \ifoptimizeverbatim\else\doemptyverbatimline\fi \or \doflushverbatimline - \global\let\savedverbatimline=\empty + \global\let\savedverbatimline\empty \doemptyverbatimline - \global\chardef\verbatimstatus=2 + \global\chardef\verbatimstatus2 \else \kern\zeropoint \doverbatimnobreak \doflushverbatimline - \global\let\savedverbatimline=\empty + \global\let\savedverbatimline\empty \doemptyverbatimline - \global\chardef\verbatimstatus=2 + \global\chardef\verbatimstatus2 \fi} -\def\presetnormalverbatimline% +\def\presetnormalverbatimline {\ifcase\verbatimstatus - \global\chardef\verbatimstatus=2 + \global\chardef\verbatimstatus2 \or - \global\chardef\verbatimstatus=3 + \global\chardef\verbatimstatus3 \or - \global\chardef\verbatimstatus=3 + \global\chardef\verbatimstatus3 \or \doflushverbatimline - \global\chardef\verbatimstatus=4 + \global\chardef\verbatimstatus4 \or \kern\zeropoint \doverbatimnobreak \doflushverbatimline - \global\chardef\verbatimstatus=5 + \global\chardef\verbatimstatus5 \or \doverbatimgoodbreak \doflushverbatimline \fi - \global\let\savedverbatimline=\verbatimline} + \global\let\savedverbatimline\verbatimline} -\def\presetlastverbatimline% +\def\presetlastverbatimline {\ifcase\verbatimstatus \or \or \or \doflushverbatimline \else @@ -470,7 +472,7 @@ \parskip\zeropoint \processingverbatimtrue \global\linepartrue - \expandafter\let\csname\verbatimname\endcsname=\relax + \expandafter\let\csname\verbatimname\endcsname\relax \edef\endofverbatimcommand{\csname\verbatimname\endcsname}% \edef\endofverbatimcommand{\meaning\endofverbatimcommand}% \verbatimfont @@ -492,6 +494,8 @@ %D it assigns all characters \CATCODE~11. Next we switch to %D french spacing and call for obeyance. +\newevery \everysetupverbatim \relax + \def\setupcopyverbatim {\uncatcodecharacters \frenchspacing @@ -499,7 +503,8 @@ \obeytabs \obeylines \obeypages - \obeycharacters} + \obeycharacters + \the\everysetupverbatim} %D \macros %D {eightbitcharacters, @@ -521,8 +526,8 @@ \loop \savecatcode #1\relax - \advance\scratchcounter -1 - \ifnum\scratchcounter>-1 + \advance\scratchcounter \minusone + \ifnum\scratchcounter>\minusone \repeat \let\savecatcode\relax \let\restorecatcodes\dorestorecatcodes} @@ -619,7 +624,7 @@ \newif\iflocalcatcodes -\def\savecatcode% +\def\savecatcode {\iflocalcatcodes \else \saverestoreactivecatcode {\@EA\let\csname\@@aa@@\the\scratchcounter\endcsname~}% @@ -629,7 +634,7 @@ %D It's counterpart is: -\def\restorecatcode% +\def\restorecatcode {\@EA\catcode\@EA\scratchcounter \csname\@@cc@@\the\scratchcounter\endcsname \saverestoreactivecatcode @@ -652,7 +657,7 @@ %D or when we've saved things calls for: -\def\dorestorecatcodes% +\def\dorestorecatcodes {\iflocalcatcodes \else \doprocesscatcodes\restorecatcode \fi} @@ -661,7 +666,7 @@ %D when needed. An application of this macros can be found in %D buffering data. -\def\beginrestorecatcodes% +\def\beginrestorecatcodes {\ifx\restorecatcodes\relax \let\endrestorecatcodes\relax \else @@ -757,7 +762,7 @@ {\bgroup % due to pretty status \iflinepar\else\EveryPar{}\fi \leavevmode - \xdef\dokeepverbatimlinedata% + \xdef\dokeepverbatimlinedata {\parindent \the\parindent \hangindent\the\hangindent \hangafter \the\hangafter @@ -810,12 +815,12 @@ \def\verbatimbaselineskip% We don't use \let here! {\baselineskip} -\def\doemptyverbatimline% +\def\doemptyverbatimline {\vskip\verbatimbaselineskip - {\setbox0=\hbox{\the\everyline}}% + {\setbox0\hbox{\the\everyline}}% \global\linepartrue} -\def\obeyemptylines% +\def\obeyemptylines {\def\doemptyverbatimline{\doverbatimline}} %D \TEX\ does not offer \type{\everyline}, which is a direct @@ -864,21 +869,21 @@ {\obeyedspace % \hskip.5em or \hbox to .5em{} \ifdone \donefalse - \advance\scratchcounter 1 + \advance\scratchcounter \plusone \@EA\doprocesstabskip \else\ifnum\scratchcounter>\spacespertab % nothing \else - \advance\scratchcounter 1 + \advance\scratchcounter \plusone \@EAEAEA\doprocesstabskip \fi\fi} \def\dodoprocesstabskipline#1#2\endoftabskipping {\ifnum\scratchcounter>\spacespertab - \scratchcounter=1 + \scratchcounter\plusone \donetrue \else - \advance\scratchcounter 1 + \advance\scratchcounter \plusone \donefalse \fi \ifx#1\relax @@ -888,14 +893,20 @@ \fi \next} -\let\endoftabskipping=\relax +\let\endoftabskipping=\relax % will become obsolete \def\doprocesstabskipline#1% {\bgroup - \scratchcounter=1 + \scratchcounter1 \dodoprocesstabskipline#1\relax\endoftabskipping \egroup} +% ^ will be replaced + +\chardef\tabskipmode=1 % 0=quit 1=no test 2=test on active>128 + +% + \def\processverbatimline#1{#1} % remove the fake grouping %D \macros @@ -914,17 +925,25 @@ \newread\verbatiminput +\newcount\verbatimlinenumber + +\let \beginofverbatimlines \relax +\let \endofverbatimlines \relax + \def\processfileverbatim#1% {\par \bgroup + \processingverbatimtrue + \global\verbatimlinenumber0 + \global\linepartrue + \beginofverbatimlines + \bgroup \parindent\zeropoint \ifdim\lastskip<\parskip \removelastskip \vskip\parskip \fi \parskip\zeropoint - \processingverbatimtrue - \global\linepartrue \uncatcodecharacters \verbatimfont \setverbatimspaceskip @@ -942,6 +961,7 @@ \def\readline% {\ifeof\verbatiminput \else \ifx\firstverbatimfileline\empty +\global\advance\verbatimlinenumber\plusone \read\verbatiminput to \verbatimline \else \let\verbatimline\firstverbatimfileline @@ -951,7 +971,7 @@ \ifeof\verbatiminput \ifx\lastverbatimfileline\empty \presetlastverbatimline - \let\readline=\relax + \let\readline\relax \else % we will re-enter the \ifeof branch twice \presetnormalverbatimline \def\readline% @@ -974,6 +994,8 @@ \fi \closein\verbatiminput \egroup + \endofverbatimlines + \egroup \ignorespaces} %D \macros @@ -1092,7 +1114,7 @@ \global\chardef\prettychar0 \bgroup \let\handleprettytoken\setprettydata - \setbox0=\hbox{#1}% expands #1 and ignores space + \setbox0\hbox{#1}% expands #1 and ignores space \egroup} %D If needed the current and next token can be handled alongside: @@ -1228,7 +1250,7 @@ \let\prettyend=\relax -\def\prettybegin% +\def\prettybegin {\bgroup\def\prettyend{\the\everyprettyend\egroup}} \installnewpretty B \prettybegin @@ -1346,12 +1368,12 @@ |let|oldprettytype=|prettytype |getprettydata{####1}% |ifnum|prettytype=|oldprettytype - |let|next=|newpretty + |let|next|newpretty |else |def|next{|newprettycommand{#1}##1####1}% |fi |next}% - |let|next=|dododohandlenewpretty + |let|next|dododohandlenewpretty |else |def|next{|newprettycommand{#1}##1}% |fi @@ -1376,7 +1398,7 @@ %\else\ifx\next\egroup % end of line / no signal % \let\next=#2% %\else\ifx\next\par % end of line / \par - \let\next=#2% + % \let\next=#2% \else \let\next=#1% \fi\fi%\fi\fi @@ -1548,12 +1570,12 @@ \def\_{\string_}% \def\^{\string^}% \presettyping - \processinlineverbatim{\egroup}} + \processinlineverbatim\egroup} \def\starttyping {\bgroup \presettyping - \processdisplayverbatim{\stoptyping}} + \processdisplayverbatim\stoptyping} \def\stoptyping {\egroup} @@ -1595,27 +1617,27 @@ \def\startTEX {\bgroup \everypar{}% - \let\obeycharacters=\setupprettyTEXtype + \let\obeycharacters\setupprettyTEXtype \processdisplayverbatim{\stopTEX}} \def\startMP {\bgroup \everypar{}% - \let\obeycharacters=\setupprettyMPtype + \let\obeycharacters\setupprettyMPtype \processdisplayverbatim{\stopMP}} \def\startPL {\bgroup \everypar{}% - \let\obeycharacters=\setupprettyPLtype + \let\obeycharacters\setupprettyPLtype \processdisplayverbatim{\stopPL}} \def\startJV {\bgroup \everypar{}% - \let\obeycharacters=\setupprettyJVtype + \let\obeycharacters\setupprettyJVtype \processdisplayverbatim{\stopJV}} \def\startSQL {\bgroup \everypar{}% - \let\obeycharacters=\setupprettySQLtype + \let\obeycharacters\setupprettySQLtype \processdisplayverbatim{\stopSQL}} \let\stopTEX=\egroup @@ -1823,8 +1845,8 @@ \let\doifendofverbatim=\doifelse - \def\permitshiftedendofverbatim% - {\let\doifendofverbatim=\doifinstringelse} + \def\permitshiftedendofverbatim + {\let\doifendofverbatim\doifinstringelse} % \def\processdisplayverbatim#1% % {\par @@ -1891,7 +1913,7 @@ \def\doprocessdisplayverbatim#1#2% {\par \bgroup - \escapechar=-1 + \escapechar-1 \xdef\verbatimname{\string#2}% \egroup \ifcase#1% @@ -1926,4 +1948,60 @@ \fi +%D \macros +%D {installprettyescape} +%D +%D The next feature is dedicated to Fabrice Popineau who +%D wanted math inside verbatim. + +\def\prettyescapecnt{255} + +\def\installprettyescape + {\dodoubleempty\doinstallprettyescape} + +\def\doinstallprettyescape[#1][#2]#3 #4% + {\bgroup + \doglobal\decrement\prettyescapecnt + \def\docommando##1% + {\def\next{\dodoinstallprettyescape{##1}{#3}{#4}}% + \catcode`#3=\@@active + \@EA\scantokens\@EA{\next}}% + \iffirstargument + \processcommalist[#1]\docommando + \else + \docommando\empty + \fi} + +\def\dodoinstallprettyescape#1#2#3% + {\unexpanded\setgvalue{PRETTY@#1@\prettyescapecnt}##1##2#2{#3{##2}}% + \expanded % we need to freeze the counter + {\doglobal\noexpand\appendtoks + \noexpand\doif{#1}\noexpand\prettyidentifier + {\noexpand\setpretty`\string#2=\prettyescapecnt + \noexpand\installprettyhandler \prettyescapecnt\space\getvalue{PRETTY@#1@\prettyescapecnt}}% + }\to \everysetupverbatim + \egroup} + +%D An example of its usage is: +%D +%D \startbuffer +%D \def\xverbatimmath#1#2{\naturaltextext\mathematics{#1}\relax} +%D \def\yverbatimmath#1#2{\naturaltextext\mathematics{[[#1]]}\relax} +%D \def\zverbatimmath#1#2{\naturaltextext\mathematics{(#1)}\relax} +%D +%D \installprettyescape [MP] $ \xverbatimmath +%D \installprettyescape [MP] ~ \yverbatimmath +%D \installprettyescape [MP] * \zverbatimmath +%D +%D \startMP +%D if $x>10$ : +%D $x := 20$ +%D ~x := 20~ +%D *x := 20* +%D end +%D \stopMP +%D \stopbuffer +%D +%D \typebuffer \getbuffer + \protect \endinput diff --git a/tex/context/base/verb-tex.tex b/tex/context/base/verb-tex.tex index a7366a9ca..0ccf1e218 100644 --- a/tex/context/base/verb-tex.tex +++ b/tex/context/base/verb-tex.tex @@ -78,27 +78,27 @@ %D mechanism. That way we can use different schemes i a quite %D natural way. -\gdef\setupprettyTEXtype% +\gdef\setupprettyTEXtype {\def\prettyidentifier{TEX}% \TEXsetcontrols \TEXsethandlers \TEXsetspecials} -\gdef\TEXsetcontrols% +\gdef\TEXsetcontrols {\saveprettycontrols \everyprettyend {\TEXendofcommand \TEXendofparameter}% - \def\obeyedspace% + \def\obeyedspace {\TEXendofcommand \TEXendofparameter \oldobeyedspace}% - \def\flushrestofverbatimline% + \def\flushrestofverbatimline {\TEXendofcommand \TEXendofparameter}% \let\obeytabs=\ignoretabs} -\gdef\TEXsetspecials% +\gdef\TEXsetspecials {\setpretty`\$=1 \setpretty`\{=1 \setpretty`\}=1 \setpretty`\[=2 \setpretty`\]=2 \setpretty`\(=2 \setpretty`\)=2 \setpretty`\==2 \setpretty`\<=2 \setpretty`\>=2 \setpretty`\"=2 @@ -126,7 +126,7 @@ \setpretty`\?=9 \setpretty`\!=9 \setpretty`\@=9 \setpretty`\%=0 } -\gdef\TEXsethandlers% +\gdef\TEXsethandlers {\installprettyhandler 1 \TEXtypeone \installprettyhandler 2 \TEXtypetwo \installprettyhandler 3 \TEXtypethree @@ -141,7 +141,7 @@ \doglobal\newif\ifinTEXcommand \doglobal\newif\ifinTEXparameter -\gdef\TEXbeginofcommand% +\gdef\TEXbeginofcommand {\TEXendofparameter \ifinTEXcommand \else @@ -150,14 +150,14 @@ \beginofpretty[\!!prettytwo]% \fi} -\gdef\TEXendofcommand% +\gdef\TEXendofcommand {\ifinTEXcommand \endofpretty \global\inTEXcommandfalse \global\firstinTEXcommandfalse \fi} -\gdef\TEXbeginofparameter% +\gdef\TEXbeginofparameter {\TEXendofcommand \ifinTEXparameter \else @@ -165,7 +165,7 @@ \beginofpretty[\!!prettythree]% \fi} -\gdef\TEXendofparameter% +\gdef\TEXendofparameter {\ifinTEXparameter \endofpretty \global\inTEXparameterfalse @@ -251,7 +251,7 @@ \fi \next} -\gdef\TEXtypeeightB% +\gdef\TEXtypeeightB {\TEXendofparameter \ifinTEXcommand \firstinTEXcommandfalse @@ -260,15 +260,15 @@ \expandafter\TEXtypethree \fi} -\gdef\TEXtypeeight% +\gdef\TEXtypeeight {\handlenextnextpretty\TEXtypeeightA\TEXtypeeightB} -\gdef\TEXtypenine% +\gdef\TEXtypenine {\TEXendofparameter \global\firstinTEXcommandfalse \getpretty} -%\gdef\TEXtypezero% +%\gdef\TEXtypezero % {\disableprettyafterwards % only when enabled of course % \ifnewpretty\expandafter\handlenewpretty\fi\TEXtypethree} @@ -289,7 +289,7 @@ \endETEX -\gdef\TEXtypezero% +\gdef\TEXtypezero {\ifnaturaltextext \expandafter\naturalTEXtext \else @@ -297,6 +297,4 @@ \expandafter\handlenewpretty\expandafter\TEXtypethree \fi} -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/x-contml.tex b/tex/context/base/x-contml.tex index 0758846cf..e9dd9418f 100644 --- a/tex/context/base/x-contml.tex +++ b/tex/context/base/x-contml.tex @@ -42,9 +42,9 @@ {\doifsomethingXMLop{name} {\processaction [\XMLop{type}] - [xml=>\readfile{\XMLop{name}}{}{}, - tex=>{{\disableXML\readfile{\XMLop{name}}{}{}}}, - txt=>{{\disableXML\typefile{\XMLop{name}}{}{}}}]}} + [xml=>\readfile{\XMLop{name}}\donothing, + tex=>{{\disableXML\readfile{\XMLop{name}}\donothing\donothing}}, + txt=>{{\disableXML\typefile{\XMLop{name}}\donothing\donothing}}]}} %D \elements {compound} %D @@ -61,12 +61,17 @@ % \defineXMLsingular [context:compound] [token=] % {\expanded{\normalcompound\XMLop{token}}|} +% \defineXMLsingular [context:compound] [token=] +% {\ifmmode +% \doifXMLop{token}{\XMLop{token}}{\compoundhyphen}% +% \else +% \expanded{\normalcompound\XMLop{token}}|% +% \fi} + \defineXMLsingular [context:compound] [token=] - {\ifmmode - \doifXMLop{token}{\XMLop{token}}{\compoundhyphen}% - \else - \expanded{\normalcompound\XMLop{token}}|% - \fi} + {\mathortext % disc comm looks ahead, so \relax + {\doifXMLop{token}{\XMLop{token}}\compoundhyphen}% + {\expanded{\discretionarycommand\noexpand|\XMLop{token}}|\relax}} %D \elements {p} %D @@ -339,7 +344,7 @@ %D %D \startbuffer %D The second mechanism that we support is tabulation. The advantage of this -%D mechanism is that it it well tuned for tables that hav emuch text in the +%D mechanism is that it it well tuned for tables that have much text in the %D cells and cross page boundaires. %D %D <tabulate> @@ -448,4 +453,9 @@ % \enableXMLfiledata +% Needed for example (stickers and so): + +\defineXMLenvironment [context:makeup] + \startstandardmakeup \stopstandardmakeup + \protect \endinput diff --git a/tex/context/base/x-fig-00.tex b/tex/context/base/x-fig-00.tex index e83584392..7665a0da3 100644 --- a/tex/context/base/x-fig-00.tex +++ b/tex/context/base/x-fig-00.tex @@ -102,13 +102,14 @@ \newcounter\figurefilepage -\def\figbase@StartFigure% +\def\figbase@StartFigure {\bgroup} -\def\figbase@StopFigure% +\def\figbase@StopFigure {\doglobal\increment\figurefilepage - \doif{\askedlabel}{\XMLpop{label}} - {\xdef\figurefilename{\XMLpop{file}}\endinput}% + \doif\askedlabel{\XMLpop{label}} + {\doglobal\settrue\figurefiledone + \xdef\figurefilename{\XMLpop{file}}\endinput}% \egroup} \def\getfigurefilename#1#2% @@ -122,14 +123,29 @@ \xdef\figurefilebase{#1}% \doglobal\newcounter\figurefilepage \def\askedlabel{#2} - \processXMLfilegrouped{#1.xml} % grouped ? + \processcommacommand[\figurepathlist]\dogetfigurefilename \stopXMLmapping \stopnointerference} -\def\resetfigurefilebase% - {\global\let\figurefilebase\empty - \global\let\figurefilename\empty - \global\let\figurefilepage\empty} +\globalletempty\figurebasepath + +\def\dogetfigurefilename#1% + {\ifx\figurefilename\empty + \bgroup + \xdef\figurefilebasepath{#1}% + \assignfullfilename{#1}\figurefilebase\to\filename + \expanded{\processXMLfilegrouped{\filename.xml}}% + \ifx\figurefilename\empty\else + \globallet\figurefilebase\figurefilebase + \fi + \egroup + \fi} + +\def\resetfigurefilebase + {\globalletempty\figurefilebase + \globalletempty\figurefilename + \globalletempty\figurefilebasepath + \globalletempty\figurefilepage} \let\normalcalculateexternalfigure\calculateexternalfigure @@ -148,13 +164,14 @@ \normalcalculateexternalfigure [#1][#2][\figurefilename][#4][#5][#6]% \else - \normalcalculateexternalfigure - [#1][#2][\figurefilebase.pdf][\c!pagina=\figurefilepage,#4][#5][#6]% + \let\figurepathlist\figurefilebasepath + \normalcalculateexternalfigure + [#1][#2][\figurefilebase.pdf][\c!pagina=\figurefilepage,#4][#5][#6]% \fi \fi} \def\usefigurebase[#1]% - {\doifelse{#1}{\v!reset} + {\doifelse{#1}\v!reset {\let\figurebaselist\empty} {\addtocommalist{#1}\figurebaselist}} diff --git a/tex/context/base/x-xml-02.tex b/tex/context/base/x-xml-02.tex index df56baa36..098bf874b 100644 --- a/tex/context/base/x-xml-02.tex +++ b/tex/context/base/x-xml-02.tex @@ -60,6 +60,21 @@ \setupXMLfile [level=2] +\startmode[*suffix-rng] + \showXMLlin[value] +\stopmode + +\startmode[*suffix-rlg] + \showXMLlin + [rl:type,rl:state,rl:name,rl:suffix,rl:label,rl:file,rl:original, + rl:width,rl:height,rl:base,rl:page] +\stopmode + +\startmode[*suffix-exa] + \showXMLlin + [exa:resolve,exa:include] +\stopmode + \starttext \showXMLfile{\inputfilename} diff --git a/tex/context/base/xtag-cml.tex b/tex/context/base/xtag-cml.tex index 01e137f8a..1c80ac1a7 100644 --- a/tex/context/base/xtag-cml.tex +++ b/tex/context/base/xtag-cml.tex @@ -80,7 +80,7 @@ \newcounter\nofCMLatoms \getXMLarguments{cml-i}{n="0" charge="0" #1}% \doifnotXMLzero{cml-i}{n}\firstofoneargument - \doifelse{\@@CMLionvariant}{\v!b} + \doifelse\@@CMLionvariant\v!b {[\ignorespaces\processXMLRchild{atom,bond/,% singlebond/,doublebond/,triplebond/}{#2}\unskip]% \high{\doifnotXMLzero{cml-i}{charge}\CMLscript}} diff --git a/tex/context/base/xtag-ent.tex b/tex/context/base/xtag-ent.tex new file mode 100644 index 000000000..4ca930894 --- /dev/null +++ b/tex/context/base/xtag-ent.tex @@ -0,0 +1,112 @@ +% Here we also define fallbacks + +\defineXMLentities [tex] {tex} {\TeX} +\defineXMLentities [latex] {latex} {\LaTeX} +\defineXMLentities [context] {context} {\ConTeXt} +\defineXMLentities [omega] {omega} {\Omega} + +\defineXMLentities [Omega] {Omega} {\Omega} + +% We need this for French and Hungarian. + +\defineXMLentity [colon] {\directdiscretionary{:}} +\defineXMLentity [semicolon] {\directdiscretionary{;}} +\defineXMLentity [questionmark] {\directdiscretionary{?}} +\defineXMLentity [exclamationmark] {\directdiscretionary{!}} + +% These will fall back to the raw encoding vector + +\defineXMLentity [Aacute] {\Aacute} +\defineXMLentity [aacute] {\aacute} +\defineXMLentity [Cacute] {\Cacute} % unofficial +\defineXMLentity [cacute] {\cacute} % unofficial +\defineXMLentity [Eacute] {\Eacute} +\defineXMLentity [eacute] {\eacute} +\defineXMLentity [Iacute] {\Iacute} +\defineXMLentity [iacute] {\iacute} +\defineXMLentity [Oacute] {\Oacute} +\defineXMLentity [oacute] {\oacute} +\defineXMLentity [Uacute] {\Uacute} +\defineXMLentity [uacute] {\uacute} +\defineXMLentity [Yacute] {\Yacute} +\defineXMLentity [yacute] {\yacute} +\defineXMLentity [Nacute] {\Nacute} +\defineXMLentity [nacute] {\nacute} + +\defineXMLentity [Ccedil] {\Ccedilla} +\defineXMLentity [ccedil] {\ccedilla} + +\defineXMLentity [AElig] {\AEligature} +\defineXMLentity [aelig] {\aeligature} + +\defineXMLentity [Agrave] {\Agrave} +\defineXMLentity [agrave] {\agrave} +\defineXMLentity [Egrave] {\Egrave} +\defineXMLentity [egrave] {\egrave} +\defineXMLentity [Igrave] {\Igrave} +\defineXMLentity [igrave] {\igrave} +\defineXMLentity [Ograve] {\Ograve} +\defineXMLentity [ograve] {\ograve} +\defineXMLentity [Ugrave] {\Ugrave} +\defineXMLentity [ugrave] {\ugrave} + +\defineXMLentity [THORN] {\THorn} +\defineXMLentity [thorn] {\thorn} + +\defineXMLentity [Aring] {\Aring} +\defineXMLentity [aring] {\aring} + +\defineXMLentity [Oslash] {\Oslash} % stroke +\defineXMLentity [oslash] {\oslash} +\defineXMLentity [Lslash] {\Lslash} % unofficial +\defineXMLentity [lslash] {\lslash} % unofficial + +\defineXMLentity [eth] {\eth} % ? +\defineXMLentity [ETH] {\Eth} % ? + +\defineXMLentity [Atilde] {\Atilde} +\defineXMLentity [atilde] {\atilde} +\defineXMLentity [Etilde] {\Etilde} +\defineXMLentity [etilde] {\etilde} +\defineXMLentity [Itilde] {\Itilde} +\defineXMLentity [itilde] {\itilde} +\defineXMLentity [Ntilde] {\Ntilde} +\defineXMLentity [ntilde] {\ntilde} +\defineXMLentity [Otilde] {\Otilde} +\defineXMLentity [otilde] {\otilde} +\defineXMLentity [Utilde] {\Utilde} +\defineXMLentity [utilde] {\utilde} + +\defineXMLentity [Auml] {\Adiaeresis} +\defineXMLentity [auml] {\adiaeresis} +\defineXMLentity [Euml] {\Ediaeresis} +\defineXMLentity [euml] {\ediaeresis} +\defineXMLentity [Iuml] {\Idiaeresis} +\defineXMLentity [iuml] {\idiaeresis} +\defineXMLentity [Ouml] {\Odiaeresis} +\defineXMLentity [ouml] {\odiaeresis} +\defineXMLentity [Uuml] {\Udiaeresis} +\defineXMLentity [uuml] {\udiaeresis} +\defineXMLentity [Yuml] {\Ydiaeresis} +\defineXMLentity [yuml] {\ydiaeresis} + +\defineXMLentity [szlig] {\Ssharp} + +\defineXMLentity [Acirc] {\Acircumflex} +\defineXMLentity [acirc] {\acircumflex} +\defineXMLentity [Ecirc] {\Ecircumflex} +\defineXMLentity [ecirc] {\ecircumflex} +\defineXMLentity [Icirc] {\Icircumflex} +\defineXMLentity [icirc] {\icircumflex} +\defineXMLentity [Ocirc] {\Ocircumflex} +\defineXMLentity [ocirc] {\ocircumflex} +\defineXMLentity [Ucirc] {\Ucircumflex} +\defineXMLentity [ucirc] {\ucircumflex} + +\defineXMLentity [ccaron] {\ccaron} % unofficial +\defineXMLentity [rcaron] {\rcaron} % unofficial +\defineXMLentity [scaron] {\scaron} % unofficial +\defineXMLentity [zcaron] {\zcaron} % unofficial + +\defineXMLentity [dots] {\unknown} +\defineXMLentity [amp] {\&} diff --git a/tex/context/base/xtag-exp.tex b/tex/context/base/xtag-exp.tex index fc51675cb..c3f0b8213 100644 --- a/tex/context/base/xtag-exp.tex +++ b/tex/context/base/xtag-exp.tex @@ -28,6 +28,7 @@ \def\startXMLreading {\increment \XMLfilenesting \relax \ifnum\XMLfilenesting=1 +%\ifcase\XMLfilenesting\or \ifprocessingXML \let\restoreXMLelements\relax \else @@ -38,6 +39,7 @@ \def\stopXMLreading {\ifnum\XMLfilenesting=1 +%\ifcase\XMLfilenesting\or \restoreXMLelements \let\restoreXMLelements\relax \fi @@ -52,7 +54,9 @@ \setupXMLprocessing[\c!status=\v!start] -\appendtoks \enableXMLfiledata \to \aftersetupXMLprocessing +\appendtoks + \ifproductionrun \enableXMLfiledata \fi +\to \aftersetupXMLprocessing %D Here we overload the mark handler. diff --git a/tex/context/base/xtag-ext.tex b/tex/context/base/xtag-ext.tex index 40ca335b8..539efa2ae 100644 --- a/tex/context/base/xtag-ext.tex +++ b/tex/context/base/xtag-ext.tex @@ -187,7 +187,7 @@ \@@XMLsave:\ifcsname\@@XMLsave:#1\endcsname#1\else\@@XMLsave\fi \endcsname} -\global\letvalue{\@@XMLsave:\@@XMLsave}\empty +\letgvalueempty{\@@XMLsave:\@@XMLsave} \gdef\showXMLelement#1% {\showvalue{\@@XMLsave:#1}} @@ -229,4 +229,9 @@ \def\potentialXMLentity#1% {\doifXMLentityelse{#1}{\getXMLentity{#1}}{#1}} +\def\writtenXMLelement#1#2{<#1>#2</#1>} +\def\writtenXMLstart #1{<#1>} +\def\writtenXMLend #1{</#1>} +\def\writtenXMLempty #1{<#1/>} + \protect \endinput diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex index b6d3c6bf6..e09c63924 100644 --- a/tex/context/base/xtag-ini.tex +++ b/tex/context/base/xtag-ini.tex @@ -13,6 +13,9 @@ \writestatus{loading}{Context XML Macros (initialization)} +%D Beware: don't rely on \longempty things, since this may +%D change! + %D To be sure: \newif\ifprocessingXML @@ -189,6 +192,10 @@ %D a way around this, but for convenience \TEXEXEC\ will take %D care of processing raw \XML\ files in a transparant way. +\newif\ifalwaysreduceXMLtokens + +\let\alwaysreduceXMLtokens\alwaysreduceXMLtokenstrue + \bgroup \catcode`\*=\@@comment \catcode`\.=\@@escape @@ -225,6 +232,32 @@ * there; this is needed because reading from file goes wrong * (eating up argument) +* .unexpanded.gdef.enableXML* +* B.catcode`.!=.@@other* +* .catcode`.?=.@@other* +* .catcode`.:=.@@other* active in french +* .catcode`.;=.@@other* active in french +* .catcode`.&=.@@active .let&=.doXMLentity* +* .catcode`.<=.@@active .unexpanded.def<B.doXMLelementE* +* .catcode`.>=.@@other +* .catcode`."=.@@other* +* .catcode`./=.@@other +* .catcode`.'=.@@other* +* *catcode`.#=.@@active .def#PP1B&tex-hash;E* gobbles its own dup +* .catcode`.#=.@@active .def#B&tex-hash;E* +* .catcode`.$=.@@active .def$B&tex-dollar;E* +* .catcode`.%=.@@active .def%B&tex-percent;E* +* .catcode`.\=.@@active .def\B&tex-backslash;E* +* .catcode`.^=.@@active .def^B&tex-hat;E* +* .catcode`._=.@@active .def_B&tex-underscore;E* +* .catcode`.{=.@@active .def{B&tex-leftbrace;E* +* .catcode`.}=.@@active .def}B&tex-rightbrace;E* +* .catcode`.|=.@@active .def|B&tex-bar;E* +* .catcode`.~=.@@other *def~B&tex-tilde;E* +* .processingXMLtrue +* .the.everyenableXML +* E + .unexpanded.gdef.enableXML* B.catcode`.!=.@@other* .catcode`.?=.@@other* @@ -233,24 +266,41 @@ .catcode`.&=.@@active .let&=.doXMLentity* .catcode`.<=.@@active .unexpanded.def<B.doXMLelementE* .catcode`.>=.@@other - .catcode`."=.@@other* + .catcode`."=.@@other .catcode`./=.@@other - .catcode`.'=.@@other* - *catcode`.#=.@@active .def#PP1B&tex-hash;E* gobbles its own dup - .catcode`.#=.@@active .def#B&tex-hash;E* - .catcode`.$=.@@active .def$B&tex-dollar;E* - .catcode`.%=.@@active .def%B&tex-percent;E* - .catcode`.\=.@@active .def\B&tex-backslash;E* - .catcode`.^=.@@active .def^B&tex-hat;E* - .catcode`._=.@@active .def_B&tex-underscore;E* - .catcode`.{=.@@active .def{B&tex-leftbrace;E* - .catcode`.}=.@@active .def}B&tex-rightbrace;E* - .catcode`.|=.@@active .def|B&tex-bar;E* - .catcode`.~=.@@other *def~B&tex-tilde;E* + .catcode`.'=.@@other + .catcode`.#=.@@active + .catcode`.$=.@@active + .catcode`.%=.@@active + .catcode`.\=.@@active + .catcode`.^=.@@active + .catcode`._=.@@active + .catcode`.{=.@@active + .catcode`.}=.@@active + .catcode`.|=.@@active + .catcode`.~=.@@other + .ifalwaysreduceXMLtokens + .reduceXMLescapetokens + .else + .entitleXMLescapetokens + .fi .processingXMLtrue .the.everyenableXML E +.gdef.entitleXMLescapetokens* + B.def#B&tex-hash;E* + .def$B&tex-dollar;E* + .def%B&tex-percent;E* + .def\B&tex-backslash;E* + .def^B&tex-hat;E* + .def_B&tex-underscore;E* + .def{B&tex-leftbrace;E* + .def}B&tex-rightbrace;E* + .def|B&tex-bar;E* + *def~B&tex-tilde;E* + E + .gdef.reduceXMLescapetokens* B.def#B.string#E* .def$B.string$E* @@ -542,7 +592,7 @@ {\def\currentXMLelement{#1}% watch out: \empty == begin or empty tag \chardef\kindofXMLelement\ifx#2\empty\beginXMLtag\else\emptyXMLtag\fi} -\def\@@traceXMLelement% +\def\@@traceXMLelement {\originalXMLfullidentifier \ifx\originalXMLfullidentifier\currentXMLfullidentifier\else \space=>\space\currentXMLfullidentifier @@ -551,7 +601,7 @@ \space\string|\space\currentXMLarguments \fi} -\long\def\traceXMLelement% +\long\def\traceXMLelement {\edef\originalXMLfullidentifier{\someXMLelement\currentXMLelement}% \cleanupXMLarguments\writestatus{xml-element}{\@@traceXMLelement}} @@ -631,12 +681,12 @@ \long\def\docleanupXMLarguments#1/ #2\relax % space added earlier {\edef\currentXMLarguments{#1}} -\def\executeXMLelementA% no fallback +\def\executeXMLelementA % no fallback {\ifcsname\@@XMLelement:\currentXMLfullidentifier\endcsname \csname\@@XMLelement:\currentXMLfullidentifier\endcsname \fi} -\def\executeXMLelementB% default fallback +\def\executeXMLelementB % default fallback {\csname \@@XMLelement:% \ifcsname\@@XMLelement:\currentXMLfullidentifier\endcsname \currentXMLfullidentifier @@ -645,7 +695,7 @@ \fi \endcsname} -\def\executeXMLelementC% no namespace of default fallback +\def\executeXMLelementC % no namespace of default fallback {\csname \@@XMLelement:% \ifcsname\@@XMLelement:\currentXMLfullidentifier\endcsname \currentXMLfullidentifier @@ -656,19 +706,85 @@ \fi\fi \endcsname} +\def\executeXMLelementD + {\csname + \ifcsname\@@XMLelement:\currentXMLfullidentifier\endcsname + \@@XMLelement:\currentXMLfullidentifier + \else\ifcsname\@@XMLelement:\currentXMLidentifier\endcsname + \@@XMLelement:\currentXMLidentifier + \else + \executeXMLelementDD % less skipping and thereby faster + \fi\fi + \endcsname} + +\def\executeXMLelementDD % now forget about tex mapping + {\ifcsname\normal@@XMLelement:\currentXMLfullidentifier\endcsname + \normal@@XMLelement:\currentXMLfullidentifier + \else\ifcsname\normal@@XMLelement:\currentXMLidentifier\endcsname + \normal@@XMLelement:\currentXMLidentifier + \else + \@@XMLelement:\defaultXMLelement + \fi\fi} + \def\setXMLfallbackmode#1% {\ifcase#1\relax - \let\executeXMLelement\executeXMLelementA - \or - \let\executeXMLelement\executeXMLelementB - \or - \let\executeXMLelement\executeXMLelementC + \let\executeXMLelement \executeXMLelementA + \let\automateXMLnamespace\automateXMLnamespaceA + \or % 1 + \let\executeXMLelement \executeXMLelementB + \let\automateXMLnamespace\automateXMLnamespaceB + \or % 2 + \let\executeXMLelement \executeXMLelementC + \let\automateXMLnamespace\automateXMLnamespaceC + \or % 3 + \let\executeXMLelement \executeXMLelementD + \let\automateXMLnamespace\automateXMLnamespaceD \fi} -\setXMLfallbackmode2 +\setXMLfallbackmode2 % will be 3 %D An example of fall back modes is given below. +%D The automated namespace stuff is new and yet undocumented +%D (see resource libraries for usage). + +\def\xautoXMLnamespace#1% fast internal one + {\ifcsname\@@XMLnamespace-#1\endcsname\else + \@EA\appendtoks\csname\@@XMLnamespace-#1\endcsname\to\autoXMLnamespaces + \fi + \@EA\edef\csname\@@XMLnamespace-#1\endcsname + {\noexpand\edef\noexpand\@axmlns@{#1}% quicker #1 -> \#1 + \noexpand\doautoXMLnamespace\noexpand\@axmlns@}} + +\def\doautoXMLnamespace#1% \done is set before list + {\ifdone\else\automateXMLnamespace#1\fi} + +\def\automateXMLnamespaceA#1% + {\ifcsname\@@XMLelement:#1:\checkedXMLnamespace\endcsname + \let\currentXMLnamespace#1% + \else\ifcsname\@@XMLelement:#1:\checkedXMLnamespace/\endcsname + \let\currentXMLnamespace#1% + \fi\fi} + +\let\automateXMLnamespaceB\automateXMLnamespaceA +\let\automateXMLnamespaceC\automateXMLnamespaceA + +\def\automateXMLnamespaceD#1% + {\ifcsname\@@XMLelement:#1:\checkedXMLnamespace\endcsname + \let\currentXMLnamespace#1% + \else\ifcsname\normal@@XMLelement:#1:\checkedXMLnamespace\endcsname + \let\currentXMLnamespace#1% + \else + \automateXMLnamespaceDD#1% + \fi\fi} + +\def\automateXMLnamespaceDD#1% + {\ifcsname\@@XMLelement:#1:\checkedXMLnamespace/\endcsname + \let\currentXMLnamespace#1% + \else\ifcsname\normal@@XMLelement:#1:\checkedXMLnamespace/\endcsname + \let\currentXMLnamespace#1% + \fi\fi} + %D Later we will implement the error handler, here we handle %D the default case. @@ -677,7 +793,7 @@ #1% \ifnum\kindofXMLelement=\emptyXMLtag/\fi} -\def\defaultXMLelement% +\def\defaultXMLelement {\someXMLelement\s!default} %D It is possible to keep track of nesting automatically, @@ -687,21 +803,57 @@ %D mode of operation combined with space grabbing. \def\beginXMLelement - {\global\advance\XMLdepth \plusone % 1 + {\global\advance\XMLdepth\plusone \global\@EA\let\csname\@@XMLdepth:\the\XMLdepth\endcsname\currentXMLelement} \def\endXMLelement - {\global\advance\XMLdepth \minusone } % -1 } + {\global\advance\XMLdepth\minusone} + +% 0 = nothing +% 1 = unknown +% 2 = current element + +\chardef\XMLancestormode=2 % never change this one globally \def\XMLancestor#1% {\ifnum\numexpr(\XMLdepth-#1)>0 \csname\@@XMLdepth:\the\numexpr(\XMLdepth-#1)\endcsname \else - \currentXMLelement + \ifcase\XMLancestormode\or\s!unknown\or\currentXMLelement\fi + \fi} + +\def\XMLparent + {\XMLancestor\plusone} + +\def\XMLpureancestor#1% + {\ifnum\numexpr(\XMLdepth-#1)>0 + \csname\@@XMLdepth:\the\numexpr(\XMLdepth-#1)\endcsname \fi} -\def\XMLparent% - {\XMLancestor1} +\def\XMLpureparent + {\XMLpureancestor\plusone} + +% \defineXMLenvironment[one] +% {\beginXMLelement} +% {\endXMLelement} +% +% \defineXMLenvironment[two] +% {\beginXMLelement +% \starttabulate +% \NC ancestor 1 \NC \XMLancestor{1} \NC \NR +% \NC ancestor 2 \NC \XMLancestor{2} \NC \NR +% \NC ancestor 3 \NC \XMLancestor{3} \NC \NR +% \NC ancestor 4 \NC \XMLancestor{4} \NC \NR +% \stoptabulate} +% {\endXMLelement} +% +% \startbuffer +% <x:one> <x:two> <one> <two> </two> </one> </x:two> </x:one> +% \stopbuffer +% +% {fallback A: \setXMLfallbackmode 0 \processXMLbuffer}\par +% {fallback B: \setXMLfallbackmode 1 \processXMLbuffer}\par +% {fallback C: \setXMLfallbackmode 2 \processXMLbuffer}\par % todo: split #1 into raws en reconstruct, set current etc, push and pop % @@ -982,11 +1134,13 @@ \@EAEAEA\unknownXMLcharacter \fi\fi{\number#1}} +\ifx\unicodechar\undefined\let\unicodechar\rawcharacter\fi + \unexpanded\def\getXMLcharacter#1% {\ifcsname\@@XMLentity:#1\endcsname \@EA\getXMLentity \else - \@EA\rawcharacter + \@EA\unicodechar % was: \rawcharacter \fi{#1}} \def\unknownXMLcharacter#1{[#1]} @@ -1042,8 +1196,21 @@ \unexpanded\def\getXMLentity{\expandedXMLentity} -\def\doifXMLentityelse#1#2#3% - {\ifcsname\@@XMLentity:#1\endcsname#2\else#3\fi} +%\def\doifXMLentityelse#1#2#3% +% {\ifcsname\@@XMLentity:#1\endcsname#2\else#3\fi} + +\def\doifXMLentityelse#1% + {\ifcsname\@@XMLentity:#1\endcsname + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +% \letvalue{1@2}\firstoftwoarguments +% \letvalue{2@2}\secondoftwoarguments +% +% \def\doifXMLentityelse#1% +% {\csname\ifcsname\@@XMLentity:#1\endcsname1\else2\fi @2\endcsname} % see \defineXML... commands: % @@ -1119,27 +1286,78 @@ \let\dodoparseXMLarguments\doparseXMLarguments \doparseXMLarguments} +% \long\def\doparseXMLarguments#1% space goes ok +% {\if#1>% +% \let\dodoparseXMLarguments\empty +% \else\if#1=% +% \edef\@@XMLname{\the\XMLtoks}% +% \XMLtoks\emptytoks +% \else\if#1"% +% \let\dodoparseXMLarguments\dodoparseXMLargumentsD +% \else\if#1'% +% \let\dodoparseXMLarguments\dodoparseXMLargumentsS +% \else\if#1:% +% \XMLnamespacetrue +% \edef\@@XMLspac{\the\XMLtoks}% +% \XMLtoks\emptytoks +% \else\if#1/% +% \chardef\kindofXMLelement\emptyXMLtag +% \else +% \XMLtoks\@EA{\the\XMLtoks#1}% +% \fi\fi\fi\fi\fi\fi +% \dodoparseXMLarguments} +% +% The next speed optimization is suggested by Taco. Since we +% are dealing with validated code, we can grab larger chunks. + \long\def\doparseXMLarguments#1% space goes ok {\if#1>% \let\dodoparseXMLarguments\empty - \else\if#1=% - \edef\@@XMLname{\the\XMLtoks}% - \XMLtoks\emptytoks - \else\if#1"% - \let\dodoparseXMLarguments\dodoparseXMLargumentsD - \else\if#1'% - \let\dodoparseXMLarguments\dodoparseXMLargumentsS - \else\if#1:% - \XMLnamespacetrue - \edef\@@XMLspac{\the\XMLtoks}% - \XMLtoks\emptytoks \else\if#1/% \chardef\kindofXMLelement\emptyXMLtag \else - \XMLtoks\@EA{\the\XMLtoks#1}% - \fi\fi\fi\fi\fi\fi + \XMLtoks{#1}% + \let\dodoparseXMLarguments\dodoparseXMLargumentsX + \fi\fi + \dodoparseXMLarguments} + +\def\dodoparseXMLargumentsX#1=#2% + {\edef\@@XMLname{\the\XMLtoks#1}% + \@EA\getXMLNSSSS\@@XMLname:\relax + \XMLtoks\emptytoks + \if#2"% + \let\dodoparseXMLarguments\dodoparseXMLargumentsD + \else + \let\dodoparseXMLarguments\dodoparseXMLargumentsS + \fi \dodoparseXMLarguments} +\def\gobbleuntilcolon#1:{#1} + +\def\getXMLNSSSS#1:#2\relax + {\def\!!stringa{#2}% + \ifx\!!stringa\empty \else + \XMLnamespacetrue + \edef\@@XMLname{\gobbleuntilcolon#2}% + \edef\@@XMLspac{#1}% + \fi} + +% ok ? +% +% \def\dodoparseXMLargumentsX#1=#2% +% {\edef\@@XMLname{\the\XMLtoks#1}% +% \@EA\getXMLNSSSS\@@XMLname:\relax +% \XMLtoks\emptytoks +% \if#2"% +% \@EA\dodoparseXMLargumentsD +% \else +% \@EA\dodoparseXMLargumentsS +% \fi} + +% Storing \type {#1} in a macro in order to minimize the +% amount of data passed as argument does not improve +% performance, so we keep the readable form. + \def\dodoparseXMLargumentsD#1"{\dosetXMLargument{#1}} \def\dodoparseXMLargumentsS#1'{\dosetXMLargument{#1}} @@ -1342,7 +1560,7 @@ \next} \long\gdef\dododefineXMLgsave#1% - {\letvalue{\@@XMLdata:#1}\longempty + {\letgvalue{\@@XMLdata:#1}\longempty \long\setvalue{\@@XMLelement:#1/}{\long\setgvalue{\@@XMLdata:#1}{}}% \long\setvalue{\@@XMLelement:#1}{\redoXMLgsave{#1}}} @@ -1366,6 +1584,16 @@ {#2\long\@EA\def\csname\@@XMLdata:#1\endcsname{##1}#3}% \next} +\long\gdef\dododefineXMLenvironmentgsave#1#2#3% + {\letgvalue{\@@XMLdata:#1}\longempty + \long\setvalue{\@@XMLelement:#1/}{#2\long\setgvalue{\@@XMLdata:#1}{}#3}% + \long\setvalue{\@@XMLelement:#1}{\redoXMLenvironmentgsave{#1}{#2}{#3}}} + +\gdef\redoXMLenvironmentgsave#1#2#3% + {\long\@EA\def\@EA\next\@EA##\@EA1\@EA<\@EA/\currentXMLelement>% + {#2\long\@EA\gdef\csname\@@XMLdata:#1\endcsname{##1}#3}% + \next} + \long\gdef\dododefineXMLprocess#1% {\long\setvalue{\@@XMLelement:#1/}{}% \long\setvalue{\@@XMLelement:#1}{}% @@ -1381,16 +1609,18 @@ %D The high level definition macros. -\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\defineXMLsave {\dotripleempty\dodefineXMLsave} -\def\defineXMLenvironmentsave{\dotripleempty\dodefineXMLenvironmentsave} -\def\defineXMLprocess {\dotripleempty\dodefineXMLprocess} +\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\defineXMLsave {\dotripleempty\dodefineXMLsave} +\def\defineXMLgsave {\dotripleempty\dodefineXMLgsave} +\def\defineXMLenvironmentsave {\dotripleempty\dodefineXMLenvironmentsave} +\def\defineXMLenvironmentgsave{\dotripleempty\dodefineXMLenvironmentgsave} +\def\defineXMLprocess {\dotripleempty\dodefineXMLprocess} % push is (not yet) a real push, so: @@ -1427,9 +1657,15 @@ \long\def\dodefineXMLsave[#1][#2][#3]% {\defineXMLmethod\dododefineXMLsave{#1}{#2}{#3}{}{}} +\long\def\dodefineXMLgsave[#1][#2][#3]% + {\defineXMLmethod\dododefineXMLgsave{#1}{#2}{#3}{}{}} + \long\def\dodefineXMLenvironmentsave[#1][#2][#3]#4#5% {\defineXMLmethod\dododefineXMLenvironmentsave{#1}{#2}{#3}{#4}{#5}} +\long\def\dodefineXMLenvironmentgsave[#1][#2][#3]#4#5% + {\defineXMLmethod\dododefineXMLenvironmentgsave{#1}{#2}{#3}{#4}{#5}} + \long\def\dodefineXMLprocess[#1][#2][#3]% {\defineXMLmethod\dododefineXMLprocess{#1}{#2}{#3}{}{}} @@ -1824,9 +2060,9 @@ \doXMLdata} \def\doXMLdata#1% - {\enableXML - \scantokens{#1<gobblespacetokens/>}% - \endgroup} + {\enableXML + \scantokens{#1<gobblespacetokens/>}% + \endgroup} %D @@ -1949,7 +2185,7 @@ \long\unexpanded\gdef\getXMLgrouped#1% #1 kan weg % klopt dit nu? {\groupedtoks\emptytoks - \scratchcounter=0 + \scratchcounter\zerocount \edef\theXMLnamespace {\ifx\originalXMLnamespace\empty\else\originalXMLnamespace:\fi \currentXMLidentifier}% @@ -1960,7 +2196,7 @@ \ifcase\scratchcounter \let\dogetgrouped\dodogetgrouped \else - \advance\scratchcounter \minusone + \advance\scratchcounter \minusone \ifcollectXMLgrouped\@EA\appendtoks\@EA<\@EA/\currentXMLelement>\to\groupedtoks\fi \fi \dogetgrouped}% @@ -2001,37 +2237,5 @@ %D \stoptypen \def\XMLyes#1{\XMLownifequalelse{#1}{yes}{#1}{}} - -\def\expifequalelse#1#2% - {\@@ifequal#1\relax\relax\@@and#2\relax\relax\@@then} - -\def\@@ifequal#1#2\@@and#3% - {\ifx#1\relax - \ifx#3\relax - \@EAEAEA\@@if@@equal@@true - \else - \@EAEAEA\@@if@@equal@@false - \fi - \else - \ifx#3\relax - \@EAEAEAEAEAEA\@@if@@equal@@false - \else\ifx#1#3% - % go on - \else - \@EAEAEAEAEAEA\@@if@@equal@@false - \fi\fi - \fi - \@@ifequal#2\@@and} - -\long\def\@@if@@equal@@true #1\@@then#2#3{#2} -\long\def\@@if@@equal@@false#1\@@then#2#3{#3} - -%D new stuff : - -\def\partialexpanded#1% - {\let\notexpanded\noexpand - \edef\@@expanded{\noexpand#1}% - \let\notexpanded\empty - \@@expanded} \protect \endinput diff --git a/tex/context/base/xtag-mmc.tex b/tex/context/base/xtag-mmc.tex index 0ca08f44d..49c81a804 100644 --- a/tex/context/base/xtag-mmc.tex +++ b/tex/context/base/xtag-mmc.tex @@ -69,7 +69,7 @@ \setupMMLappearance[float][\c!symbool=\v!nee] % \v!ja|dot \def\MMLcfloat#1% - {\doifelse{\@@MMLfloatsymbool}{\v!nee} + {\doifelse\@@MMLfloatsymbool\v!nee {{\rm#1}} % make sure that e shows up ok {% we should ignore \entities ! \beforesplitstring#1\at e\to\first @@ -77,7 +77,7 @@ \ifx\first\empty #1\else \ifx\last \empty #1\else \first - \doifelse{\@@MMLfloatsymbool}{dot}{\cdot}{\times}% + \doifelse\@@MMLfloatsymbool{dot}\cdot\times 10^{\last}% \fi\fi}} @@ -86,11 +86,11 @@ \setupMMLappearance[enotation][\c!symbool=\v!nee] % \v!ja|dot \def\MMLcenotation#1% - {\doifelse{\@@MMLenotationsymbool}{\v!nee} + {\doifelse\@@MMLenotationsymbool\v!nee {\def\MMLcsep% {\unskip{\rm e}\ignorespaces}} {\def\MMLcsep##1\empty - {\doifelse{\@@MMLenotationsymbool}{dot}{\cdot}{\times}10^{##1}}}% + {\doifelse\@@MMLenotationsymbool{dot}\cdot\times10^{##1}}}% #1\empty} \def\MMLcCI#1% #2% can be sped up with \doifundefined ... @@ -112,7 +112,7 @@ complex-cartesian=>\let\next\MMLccartesian, \next} \def\MMLcCIset#1% - {{\blackboard#1}} + {{\bbd#1}} \def\widevec#1% {\vbox{\m@th\ialign{##\crcr @@ -161,7 +161,7 @@ complex-cartesian=>\let\next\MMLccartesian, \def\MMLcCNinteger#1% {\doifXMLparelse{cn}{base} {\def\MMLcCNbase{\XMLpar{cn}{base}{}}% - \doifelse{\@@MMLbasesymbool}{\v!nee} + \doifelse\@@MMLbasesymbool\v!nee {\MMLcCNbasedata{#1}} {\MMLcCNbasedata{#1}_{\hbox{$\rm\scriptscriptstyle \processaction @@ -349,7 +349,7 @@ complex-cartesian=>\let\next\MMLccartesian, \setupMMLappearance[declare][\c!status=\v!start] \def\MMLcDECLARE#1#2% - {\doif{\@@MMLdeclarestatus}{\v!start} + {\doif\@@MMLdeclarestatus\v!start {\withnextXMLRelement {\getXMLentity{declare}\nextXMLRelement \countXMLRchildren{#2}% @@ -365,7 +365,7 @@ complex-cartesian=>\let\next\MMLccartesian, \setupMMLappearance[lambda][\c!variant=b] \def\MMLcLAMBDA#1#2% - {\doifelse{\@@MMLlambdavariant}{a} + {\doifelse\@@MMLlambdavariant\v!a {\encapsulateXMLR{\getXMLentity{lambda}(}{\MMLccomma}{)}{#2}} {\countXMLRchild{bvar}{#2}% \ifnum\nofXMLRchildren>1 @@ -481,12 +481,12 @@ complex-cartesian=>\let\next\MMLccartesian, \setupMMLappearance[sign][\c!reductie=\v!ja] -\def\MMLcMINUS - {\doifelse{\@@MMLsignreductie}{\v!ja} +\def\MMLcMINUS % expandafter needed ? + {\doifelse\@@MMLsignreductie\v!ja {\expandafter\MMLcMINUSyes}{\expandafter\MMLcMINUSno}} -\def\MMLcPLUS - {\doifelse{\@@MMLsignreductie}{\v!ja} +\def\MMLcPLUS % expandafter needed ? + {\doifelse\@@MMLsignreductie\v!ja {\expandafter\MMLcPLUSyes}{\expandafter\MMLcPLUSno}} \def\MMLcMINUSno#1#2#3\empty @@ -524,7 +524,7 @@ complex-cartesian=>\let\next\MMLccartesian, \def\MMLcPOWER#1#2% {\withnexttwoXMLRelements {\doifXMLRchildelse{apply}{\firstXMLRelement} - {\doifelse{\@@MMLpowerreductie}{\v!ja} + {\doifelse\@@MMLpowerreductie\v!ja {\collectXMLRchild{apply}{\firstXMLRelement}% \@EA\doifXMLRchildelse\@EA{\MMLcfunctionlist}{\the\XMLRtoks} {\let\MMLpowerelement\secondXMLRelement @@ -545,9 +545,9 @@ complex-cartesian=>\let\next\MMLccartesian, \def\MMLcTIMES#1#2#3\empty {\setMMLcreset{\MMLcfunctionlist,\MMLcconstructlist}% - \doifelse{\@@MMLtimessymbool}{\v!ja} + \doifelse\@@MMLtimessymbool\v!ja {\encapsulateXMLR{}{\times}{}{#3\empty}} - {\doifelse{\@@MMLtimessymbool}{dot} + {\doifelse\@@MMLtimessymbool{dot} {\encapsulateXMLR{}{\cdot}{}{#3\empty}} {#3\empty}}} @@ -740,7 +740,7 @@ complex-cartesian=>\let\next\MMLccartesian, \remapXMLsingular [int] [CPA] \MMLcINT \def\doMMLlimits#1% - {\doifelsevalue{@@MML#1\c!plaats}{\v!boven}{\limits}{\nolimits}} + {\doifelsevalue{@@MML#1\c!plaats}\v!boven\limits\nolimits} \def\MMLcINT#1#2#3\empty {\pushmacro\xmlr @@ -780,7 +780,7 @@ complex-cartesian=>\let\next\MMLccartesian, \collectXMLRchild{bvar}{#3}% \let\MMLcDEGREE\superMMLcelement \expanded{\processXMLRchild{degree}{\the\XMLRtoks}}% - \doif{\@@MMLdiffplaats}{\v!boven} + \doif\@@MMLdiffplaats\v!boven {\doifXMLRchildelse{ci}{#3} {\processXMLRchild{ci}{#3}} {\doifMMLfunctionelse{#3} @@ -789,7 +789,7 @@ complex-cartesian=>\let\next\MMLccartesian, {\let\MMLcDEGREE\superMMLcelement \begingroup\rm\getXMLentity{mathematicald}\endgroup \processXMLRchild{bvar}{#3}}% - \doifnot{\@@MMLdiffplaats}{\v!boven} + \doifnot\@@MMLdiffplaats\v!boven {\left(\MMLcreset\processXMLRchild{apply,ci}{#3}\right)}} {\processXMLRchildren{#3}^\prime}% \popmacro\xmlr} @@ -996,7 +996,7 @@ complex-cartesian=>\let\next\MMLccartesian, {\pushmacro\MMLcLOGBASE \let\MMLcLOGBASE\secondoftwoarguments \doifXMLRchildelse{logbase}{#3} - {\doifelse{\@@MMLlogplaats}{\v!links} + {\doifelse\@@MMLlogplaats\v!links {\mathop{{}^{\processXMLRchild{logbase}{#3}}\!\getXMLentity{log}}} {\getXMLentity{log}_{\processXMLRchild{logbase}{#3}}}} {\getXMLentity{log}}% @@ -1046,7 +1046,7 @@ complex-cartesian=>\let\next\MMLccartesian, {\ifx\MMLpowerelement\empty\else ^{\MMLcreset\MMLpowerelement\empty}\!\let\MMLpowerelement\empty \fi - \doifelse{\@@MMLfunctionreductie}{\v!ja} + \doifelse\@@MMLfunctionreductie\v!ja {\doifXMLRchildelse{apply}{#1} {\collectXMLRchild{apply}{#1}% \@EA\doifXMLRchildelse\@EA{\MMLcfunctionlist}{\the\XMLRtoks} @@ -1112,7 +1112,7 @@ complex-cartesian=>\let\next\MMLccartesian, \def\MMLcVECTOR#1#2% {\countXMLRchildren{#2}% \ifnum\nofXMLRchildren>1 - \doifelse{\@@MMLvectorrichting}{\v!horizontaal} + \doifelse\@@MMLvectorrichting\v!horizontaal {\encapsulateXMLR{\left(}{\MMLccomma}{\right)}{#2}} {\collectbetweenXMLR{\crcr}{#2}% \MMLcreset\left(\matrix{\the\XMLRtoks}\right)}% @@ -1243,14 +1243,12 @@ complex-cartesian=>\let\next\MMLccartesian, \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\MMLcINTEGERS #1#2{\getXMLentity{integers}} +\def\MMLcREALS #1#2{\getXMLentity{reals}} +\def\MMLcRATIONALS #1#2{\getXMLentity{rationals}} +\def\MMLcNATURALNUMBERS#1#2{\getXMLentity{naturalnumbers}} +\def\MMLcCOMPLEXES #1#2{\getXMLentity{complexes}} +\def\MMLcPRIMES #1#2{\getXMLentity{primes}} \def\MMLcEXPONENTIALE #1#2{\getXMLentity{ExponentialE}} \def\MMLcIMAGINARYI #1#2{\getXMLentity{ImaginaryI}} \def\MMLcNOTANUMBER #1#2{\mathop{\rm NaN}} diff --git a/tex/context/base/xtag-mml.tex b/tex/context/base/xtag-mml.tex index e7d8e2eda..cf3479073 100644 --- a/tex/context/base/xtag-mml.tex +++ b/tex/context/base/xtag-mml.tex @@ -71,9 +71,9 @@ {\convertargument#2\to\asciiafter \@EA#1\@EA{\asciiafter}} -\def\checkMMLoperator#1#2% temp hack +\def\checkMMLoperator#1% #2 {\unspaceargument#1\to\ascii - \doifXMLentityelse\ascii{\getXMLentity\ascii}{#2}} + \doifXMLentityelse\ascii{\getXMLentity\ascii}} % {#2} % this will be done in a more safe way @@ -81,8 +81,6 @@ % this goes to core-mat -\def\mathortext#1#2{\ifmmode#1\else#2\fi} - \def\normalorfiller #1#2{#1} \def\normalordelimiter#1#2{#2} @@ -98,15 +96,15 @@ \bgroup \obeylines -\gdef\defineMMLentity% +\gdef\defineMMLentity {\bgroup\obeylines\xdefineMMLentity} \gdef\xdefineMMLentity #1 #2 #3 #4 {\egroup\dodefineMMLentity{#1}{#2}{#3}{#4}} -\global\let\dodefineMMLsynonym\gobblefourarguments +\global\let\dodefineMMLentity\gobblefourarguments -\gdef\defineMMLsynonym% +\gdef\defineMMLsynonym {\bgroup\obeylines\xdefineMMLsynonym} \gdef\xdefineMMLsynonym #1 #2 @@ -349,12 +347,12 @@ \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 [integers] {\integers} +\defineXMLentity [reals] {\reals} +\defineXMLentity [rationals] {\rationals} +\defineXMLentity [naturalnumbers] {\naturalnumbers} +\defineXMLentity [complexes] {\complexes} +\defineXMLentity [primes] {\primes} \defineXMLentity [emptyset] {\emptyset} \defineXMLentity [pi] {\pi} @@ -450,7 +448,7 @@ \@EA \defineXMLentity \@EA [\mmlrbrace] {\getXMLentity{rbrace}} \defineXMLentity [{[}] {\getXMLentity{lbracket}} -\defineXMLentity [{]}] {\getXMLentity{lbracket}} +\defineXMLentity [{]}] {\getXMLentity{rbracket}} \defineXMLentity [{(}] {\getXMLentity{lparenthesis}} \defineXMLentity [{)}] {\getXMLentity{rparenthesis}} @@ -489,6 +487,7 @@ \defineXMLentity [oplus] {\mathematics\oplus} \defineXMLentity [cup] {\mathematics\cup} \defineXMLentity [cap] {\mathematics\cap} +\defineXMLentity [sdot] {\mathematics\cdot} \defineXMLentity [dot] {\mathematics\cdot} \defineXMLentity [sim] {\mathematics\sim} \defineXMLentity [circ] {\mathematics\circ} diff --git a/tex/context/base/xtag-mmp.tex b/tex/context/base/xtag-mmp.tex index 20cc1e677..8a9380f96 100644 --- a/tex/context/base/xtag-mmp.tex +++ b/tex/context/base/xtag-mmp.tex @@ -226,7 +226,7 @@ \def\MMLpSUBP#1#2% {\withnexttwoXMLRelements - {\doifelse{\@@MMLscriptsvariant}{\v!a} + {\doifelse\@@MMLscriptsvariant\v!a {{\firstXMLRelement}#1{\secondXMLRelement}} % both {} essential {\firstXMLRelement#1{\secondXMLRelement}}}% #2} @@ -359,8 +359,8 @@ \setupMMLappearance[mtable][\c!variant=\v!a] -\def\MMLpTABLE% - {\doifelse{\@@MMLmtablevariant}{\v!a} +\def\MMLpTABLE + {\doifelse\@@MMLmtablevariant\v!a {\expandafter\MMLpTABLEa} {\expandafter\MMLpTABLEb}} diff --git a/tex/context/base/xtag-pre.tex b/tex/context/base/xtag-pre.tex index 1128708b1..78b1505ed 100644 --- a/tex/context/base/xtag-pre.tex +++ b/tex/context/base/xtag-pre.tex @@ -11,9 +11,9 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\beginTEX - \endinput -\endTEX +\beginTEX + \endinput +\endTEX \writestatus{loading}{Context XML Macros (predefined)} @@ -111,7 +111,7 @@ %D strange syntax. %D %D \starttypen -%D <!CDATA[it starts here +%D <!CDATA[it starts here %D whatever you like to be shown verbatim %D and ends here]]> %D \stoptypen @@ -139,7 +139,7 @@ {\dohandleXMLentityescape#1 @ @ @ @ @ @>} \def\dohandleXMLentityescape#1 #2 #3 #4> - {\doifnot{#1}{\letterpercent} + {\doifnot{#1}\letterpercent {\doifelse{#2}{SYSTEM} {\dohandleXMLentitySYSTEM#1 #2 #3 #4>} {\dohandleXMLentityDEFINE#1 #2 #3 #4>}}} @@ -165,16 +165,53 @@ %D Such entities can be encapsulated in a \type {DOCTYPE} %D element. Therefore we remove the outer level of document %D type definitions. +%D +%D \starttyping +%D <!DOCTYPE Something> +%D <!DOCTYPE Something > +%D <!DOCTYPE Something [ ... ]> +%D <!DOCTYPE Something SYSTEM "... ..."> +%D <!DOCTYPE Something SYSTEM "... ..." > +%D <!DOCTYPE Something SYSTEM "... ..." [ ... ]> +%D <!DOCTYPE Something PUBLIC "... ..." "..."> +%D <!DOCTYPE Something PUBLIC "... ..." "..." > +%D <!DOCTYPE Something PUBLIC "... ..." "..." [ ... ]> +%D \stoptyping \defineXMLescape [DOCTYPE] \handleXMLdoctype -\def\handleXMLdoctype#1 #2% - {\doifelse{#2}{[} - {%\writestatus{xml-doctype}{expanding #1}% - \def\next{\processuntil{]>}}} - {%\writestatus{xml-doctype}{skipping #1}% - \def\next{\gobbleuntil {>}}}% - \next} +\def\handleXMLdoctype + {\let\XMLdoctype\empty + \dohandleXMLdoctype} + +\def\dohandleXMLdoctype + {\futurelet\nexttoken\dohandleXMLdoctok} + +\def\dohandleXMLdoctok + {\ifx\nexttoken>% + % [doctype: \XMLdoctype] + \@EA\gobbleuntil\@EA>\@EA + \else\ifx\nexttoken\blankspace + % [doctype: \XMLdoctype] + \@EAEAEA\dodohandleXMLdoctype + \else + \@EAEAEA\redoXMLdoctype + \fi\fi} + +\def\redoXMLdoctype#1% + {\edef\XMLdoctype{\XMLdoctype#1}\dohandleXMLdoctype} + +\def\dodohandleXMLdoctype#1% + {\executeifdefined{XMLdoctype#1}{\gobbleuntil>}} + +\setvalue{XMLdoctype>}{} +\setvalue{XMLdoctype[}{\processuntil{]>}} + +\def\XMLdoctypeS YSTEM % + {\dowithgrabbedstring\dodohandleXMLdoctype} + +\def\XMLdoctypeP UBLIC % + {\dowithgrabbedstring{\dowithgrabbedstring\dodohandleXMLdoctype}} %D Some day we may need to support entities within a %D document type namespace. @@ -196,30 +233,30 @@ % \def\scanXMLtokens#1% % {\saveendlinechar\scantokens{#1}\restoreendlinechar} -%D For security reasons, we provide a switch to turn this +%D For security reasons, we provide a switch to turn this %D mechanism on and off. When turned off, there is no way to -%D turn it on from within an \XML\ encoded document, simply -%D because the possibility to process \CONTEXT\ commands is -%D gone. +%D turn it on from within an \XML\ encoded document, simply +%D because the possibility to process \CONTEXT\ commands is +%D gone. \setupXMLprocessing[\c!commando=\v!ja] %\def\contextXMLcommand#1% -% {\doif{\@@xpcommando}{\v!ja} +% {\doif\@@xpcommando\v!ja % {\pushmacro\disableXML % \def\disableXML{\global\let\afterXMLprocessor\empty}% % \global\let\afterXMLprocessor\enableXML % \setnormalcatcodes\scantokens{#1}\afterXMLprocessor % \popmacro\disableXML}} -\def\contextXMLcommand#1% we don't use #1 here - {\doif{\@@xpcommando}{\v!ja} +\def\contextXMLcommand#1% we don't use #1 here + {\doif\@@xpcommando\v!ja {\disableXML\scantokens\@EA{\currentXMLprocess}\enableXML}} %D The indirect method (using the macro \type %D {\currentXMLprocess} instead of \type {#}) is needed -%D because of the \type {\scantokens}. Given the previous -%D definition, and given that \ETEX\ is used, we can now +%D because of the \type {\scantokens}. Given the previous +%D definition, and given that \ETEX\ is used, we can now %D say: %D %D \starttypen @@ -238,7 +275,7 @@ \def\contextXMLdirective#1% {\docontextXMLdirective#1 @ @ @\end} -\def\docontextXMLdirective#1 #2 #3 #4\end% class variable value +\def\docontextXMLdirective#1 #2 #3 #4\end % class variable value {\csname\@@XMLvariable:#1:#2\endcsname{#3}} %D A simple processing instruction is the following. It just diff --git a/tex/context/base/xtag-raw.tex b/tex/context/base/xtag-raw.tex new file mode 100644 index 000000000..9ab3ee946 --- /dev/null +++ b/tex/context/base/xtag-raw.tex @@ -0,0 +1,36 @@ +%D \module +%D [ file=xtag-raw, +%D version=2002.03.21, +%D title=\CONTEXT\ XML Support, +%D subtitle=reducing specials, +%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 (raw specials)} + +%D Some day this module will be obsolete. + +\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} +\defineXMLentity [tex-tilde] {\lettertilde} + +\endinput + +\defineXMLsingular[test][oeps=,whow=,hm=] + {\tttf \input \XMLop{oeps} [\XMLop{whow}] [\XMLop{hm}]} + +\startXMLdata +<test oeps="oeps_tst.tmp" whow="#FFEEGG" hm="^{}~"/> +\stopXMLdata diff --git a/tex/context/base/xtag-rng.tex b/tex/context/base/xtag-rng.tex new file mode 100644 index 000000000..a3a529f7f --- /dev/null +++ b/tex/context/base/xtag-rng.tex @@ -0,0 +1,28 @@ +%D \module +%D [ file=xtag-rng, +%D version=2002.10.29, +%D title=\CONTEXT\ XML Support, +%D subtitle=Relax NG, +%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. + +\unprotect + +%D The following commands picks up a named block from the +%D given file and pretty prints it. +%D +%D \starttypen +%D \showRNGcomponent [eximple.rng] [request] +%D \stoptypen +%D +%D If needed, you adapt the colors used by redefining the +%D \type {xtag} color palet. + +\fetchruntimecommand\showRNGcomponent {\f!xtagprefix\s!run} + +\protect \endinput diff --git a/tex/context/base/xtag-run.tex b/tex/context/base/xtag-run.tex index ffdf913c9..759513890 100644 --- a/tex/context/base/xtag-run.tex +++ b/tex/context/base/xtag-run.tex @@ -46,10 +46,10 @@ .egroup -\gdef\@@XMLshow {\@@XML shw} +\gdef\@@XMLshow{\@@XML shw} \gdef\@XMLindent#1% - {\ifnum\XMLlevel>1\advance\leftskip#11em\relax\fi} + {\ifnum\XMLlevel>\plusone\advance\leftskip#11em\relax\fi} \gdef\@XMLlevel#1% {\advance\XMLlevel#11\relax} @@ -64,17 +64,22 @@ \@EA\catcode\string``\@@active \@EA\catcode\string`&\@@active -\gdef\showXMLarguments% - {\ifshowXMLarguments +\gdef\doshowXMLargument#1#2#3#4% + {\hskip\zeropoint % or maybe \allowbreak + \string#1\color[xtag:#3]{#4}\string#2}% + +\gdef\showXMLarguments + {\hskip\zeropoint % or maybe \allowbreak + \ifshowXMLarguments \bgroup \@EA\catcode\string`=\@@active \@EA\catcode\string`"\@@active \@EA\catcode\string``\@@active \@EA\catcode\string`&\@@active \def={\color[xtag:7]{\string=}}% - \def"##1"{\string"\color[xtag:8]{##1}\string"}% - \def`##1`{\string`\color[xtag:8]{##1}\string`}% - \def&##1;{\string&\color[xtag:7]{##1}\string;}% + \def"##1"{\doshowXMLargument""8{##1}}% + \def`##1`{\doshowXMLargument``8{##1}}% + \def&##1;{\doshowXMLargument&;7{##1}}% \scantokens\@EA{\currentXMLarguments}% \egroup \else @@ -95,27 +100,27 @@ \ifcase\@XMLnofelements\else\@@xftussen\fi \fi \fi -\hangindent2em -\indent - \bgroup - \localcolortrue - \advance\XMLlevel -1 - \DoMod\XMLlevel by\XMLprettycycle to\scratchcounter - \advance\scratchcounter 1 - \startcolor[xtag:\ifnum\scratchcounter<0 0\else\number\scratchcounter\fi]% -\ifXMLunspacepretty\unskip\fi - \string<% - \ifnum\kindofXMLelement=2\string/\fi - \currentXMLelement - \stopcolor - \ifcase#1\or\ifx\currentXMLarguments\empty\else - \cleanupXMLarguments - \startcolor[xtag:0]\hbox{\space}\showXMLarguments\unskip\stopcolor - \fi\fi - \startcolor[xtag:\ifnum\scratchcounter<0 0\else\number\scratchcounter\fi]% - \ifnum\kindofXMLelement=3\string/\fi - \string>% - \stopcolor + \hangindent2em + \indent + \bgroup + \localcolortrue + \advance\XMLlevel \minusone + \DoMod\XMLlevel by\XMLprettycycle to\scratchcounter + \advance\scratchcounter \plusone + \startcolor[xtag:\ifnum\scratchcounter<0 0\else\number\scratchcounter\fi]% + \ifXMLunspacepretty\unskip\fi + \string<% + \ifnum\kindofXMLelement=2\string/\fi + \currentXMLelement + \stopcolor + \ifcase#1\or\ifx\currentXMLarguments\empty\else + \cleanupXMLarguments + \startcolor[xtag:0]\hbox{\space}\showXMLarguments\unskip\stopcolor + \fi\fi + \startcolor[xtag:\ifnum\scratchcounter<0 0\else\number\scratchcounter\fi]% + \ifnum\kindofXMLelement=3\string/\fi + \string>% + \stopcolor \egroup \ifnum\XMLlevel<\@@xfniveau\relax \ifnum\kindofXMLelement=1\else @@ -182,12 +187,12 @@ \gdef\showXMLemp[#1]% {\setXMLshow\defineXMLsingular\someXMLword\relax[#1]} -\gdef\doautoshowXMLelement% +\gdef\doautoshowXMLelement {\ifcase\kindofXMLelement \or \nextXMLpara \or \prevXMLpara \or \someXMLline \fi} -\gdef\autoshowXMLelement% +\gdef\autoshowXMLelement {\ifcsname\@@XMLshow:\currentXMLelement\endcsname \expandafter\normalexecuteXMLelement \else @@ -200,18 +205,19 @@ {\bgroup \nohyphens \dontcomplain - \XMLlevel=0 + \XMLlevel\zerocount \increment\@@xfniveau % hack \tttf \startopelkaar[\v!blanko] \ifautoXMLshow \let\executeXMLelement\autoshowXMLelement \fi \let\executeXMLentity\@XMLentity \enableXML\verbatimXML - \readfile{\truefilename{#1}}{}{}\endgraf + \readfile{\truefilename{#1}}\donothing\donothing\endgraf + \removelastskip % really needed \stopopelkaar \egroup} -\gdef\showXMLbuffer% +\gdef\showXMLbuffer {\dosingleempty\doshowXMLbuffer} \gdef\doshowXMLbuffer[#1]% @@ -224,7 +230,7 @@ %D -\gdef\showXSDcomponent% +\gdef\showXSDcomponent {\dodoubleargument\doshowXSDcomponent} \gdef\doshowXSDcomponent[#1][#2]% @@ -236,4 +242,13 @@ \showXMLfile{#1} \egroup} +\gdef\showRNGcomponent + {\dodoubleargument\doshowRNGcomponent} + +\gdef\doshowRNGcomponent[#1][#2]% + {\bgroup + \videXMLcontextblock[#2] + \showXMLfile{#1} + \egroup} + \protect \endinput diff --git a/tex/context/base/xtag-utf.tex b/tex/context/base/xtag-utf.tex new file mode 100644 index 000000000..172f7b303 --- /dev/null +++ b/tex/context/base/xtag-utf.tex @@ -0,0 +1,21 @@ +%D \module +%D [ file=xtag-utf, +%D version=2002.06.24, +%D title=\CONTEXT\ XML Support, +%D subtitle=UTF-8 support, +%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 (UTF-8)} + +%D This filter is kind of obsolete, since \UTF\ is not +%D limited to \XML. So, here we only enable \UTF\ support. + +\enableregime[utf] + +\endinput diff --git a/tex/context/base/xtag-xsd.tex b/tex/context/base/xtag-xsd.tex index e354202d5..ba885d5ff 100644 --- a/tex/context/base/xtag-xsd.tex +++ b/tex/context/base/xtag-xsd.tex @@ -1,5 +1,5 @@ %D \module -%D [ file=xtag-pre, +%D [ file=xtag-xsd, %D version=2001.10.04, %D title=\CONTEXT\ XML Support, %D subtitle=Schemas, diff --git a/tex/context/base/xtag-xsl.tex b/tex/context/base/xtag-xsl.tex index e0a3e2f4e..df7c320de 100644 --- a/tex/context/base/xtag-xsl.tex +++ b/tex/context/base/xtag-xsl.tex @@ -22,11 +22,13 @@ \def\XSLTscriptfile{\bufferprefix xlscript} +% to be sped up: + \def\presetXSLTcharacters {\let\par\empty - \def\{{\rawcharacter{`\{}}% - \def\}{\rawcharacter{`\}}}% - \def\\{\rawcharacter{`\\}}} + \def\{{\rawcharacter{`\{}}% \string^^.. + \def\}{\rawcharacter{`\}}}% \string^^.. + \def\\{\rawcharacter{`\\}}}% \string^^.. \def\obeyXSLTcharacters {\setnaturalcatcodes diff --git a/tex/generic/context/mptopdf.tex b/tex/generic/context/mptopdf.tex index 9cd130fd5..1192a8a94 100644 --- a/tex/generic/context/mptopdf.tex +++ b/tex/generic/context/mptopdf.tex @@ -84,7 +84,7 @@ %D are collected in the file: \input supp-pdf -\input supp-mpe \MPcmyktrue +\input supp-mpe \MPcmykcolorstrue \MPspotcolorstrue %D We use no output routine. |