diff options
Diffstat (limited to 'tex')
28 files changed, 1005 insertions, 410 deletions
diff --git a/tex/context/base/colo-rgb.tex b/tex/context/base/colo-rgb.tex index 39f34d569..25322b70c 100644 --- a/tex/context/base/colo-rgb.tex +++ b/tex/context/base/colo-rgb.tex @@ -523,4 +523,8 @@ \definecolor [texcolorthree] [middleblue] \definecolor [texcolorfour] [darkyellow] +%D Bonus (needed for FO test): + +\definecolor [orange] [r=1,g=.5] + \endinput diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index a9c47af0e..cdeae1d2f 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -16,7 +16,44 @@ %D features. \unprotect + +\def\showexternalfigured + {\bgroup + \immediate\openout\scratchwrite=mpfigs.mp + \def\presetfigure[##1][##2]% + {\getfiguredimensionsonly[##1]% \pagefigure[##1]% + \immediate\write\scratchwrite + {registerfigure("##1",\figurewidth,\figureheight)}} + \pushendofline + \readjobfile\@@exfile\donothing\donothing + \popendofline + \immediate\closeout\scratchwrite + \egroup} + +\def\setsidefloatparagraph + {%\advance\sidefloatprogress \sidefloatbottomskip + %\!!counta\sidefloatprogress +\scratchdimen\sidefloatprogress +\advance\scratchdimen \ht\strutbox +\advance\scratchdimen -10sp % new, needed in prikkels, prevent rounding errors +\!!counta\scratchdimen + \divide\!!counta \baselineskip + \ifnum\!!counta>0 + \hangindent \ifrightfloat-\fi\sidefloatwidth + \hangafter-\!!counta + \fi + \global\advance\sidefloatparagraph \plusone + \iftracesidefloats + \hskip-\sidefloatwidth + \color[darkgray]% + {\vrule\!!height.5\s!pt\!!depth.5\s!pt\!!width\sidefloatwidth + %\hskip-.25\bodyfontsize\showstruts\strut\hskip.25\bodyfontsize}% + \llap{\showstruts\strut\hskip.25\bodyfontsize}}% + \fi} + + + \writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!} \def\ejectinsert diff --git a/tex/context/base/core-box.tex b/tex/context/base/core-box.tex index 86a7c16ab..47374e0fe 100644 --- a/tex/context/base/core-box.tex +++ b/tex/context/base/core-box.tex @@ -160,51 +160,62 @@ \egroup} \hbox} +\def\collectorparameter#1{\csname\??cb\currentcollector#1\endcsname} + \def\dodosetcollector[#1][#2]% todo: keep reference point - {\getparameters[\??cb#1][#2]% - \@@layerxsiz\wd\csname\@@collectorbox#1\endcsname - \@@layerysiz\ht\csname\@@collectorbox#1\endcsname + {\def\currentcollector{#1}% + \chardef\collectorbox\csname\@@collectorbox#1\endcsname + \getparameters[\??cb#1][#2]% + \@@layerxsiz\wd\collectorbox + \@@layerysiz\ht\collectorbox \doifvaluesomething{\??cb#1\c!rotatie} {\setbox\nextbox\hbox {\rotate [\c!plaats=\v!hoog, - \c!rotatie=\getvalue{\??cb#1\c!rotatie}] + \c!rotatie=\collectorparameter\c!rotatie] {\flushnextbox}}}% - \advance\@@layerysiz\dp\csname\@@collectorbox#1\endcsname - \@@layerxpos\getvalue{\??cb#1\c!x}% - \advance\@@layerxpos\getvalue{\??cb#1\c!hoffset}% - \@@layerypos\getvalue{\??cb#1\c!y}% - \advance\@@layerypos\getvalue{\??cb#1\c!voffset}% - \ExpandBothAfter\doifinset{\v!onder}{\getvalue{\??cb#1\c!hoek}} - {\ifdim\@@layerysiz>\zeropoint - \advance\@@layerypos-\@@layerysiz - \@@layerypos-\@@layerypos - \fi}% - \ExpandBothAfter\doifinset{\v!rechts}{\getvalue{\??cb#1\c!hoek}} + \advance\@@layerysiz\dp\collectorbox + \@@layerxpos\collectorparameter\c!x + \advance\@@layerxpos\collectorparameter\c!hoffset + \@@layerypos\collectorparameter\c!y + \advance\@@layerypos\collectorparameter\c!voffset + \doifelse\v!midden{\collectorparameter\c!hoek} {\ifdim\@@layerxsiz>\zeropoint - \advance\@@layerxpos-\@@layerxsiz - \@@layerxpos-\@@layerxpos + \advance\@@layerxpos.5\@@layerxsiz + \fi + \ifdim\@@layerysiz>\zeropoint + \advance\@@layerypos.5\@@layerysiz \fi}% + {\ExpandBothAfter\doifinset\v!onder{\collectorparameter\c!hoek} + {\ifdim\@@layerysiz>\zeropoint + \advance\@@layerypos-\@@layerysiz + \@@layerypos-\@@layerypos + \fi}% + \ExpandBothAfter\doifinset\v!rechts{\collectorparameter\c!hoek} + {\ifdim\@@layerxsiz>\zeropoint + \advance\@@layerxpos-\@@layerxsiz + \@@layerxpos-\@@layerxpos + \fi}}% \setbox\nextbox\hbox - {\alignedbox[\getvalue{\??cb#1\c!plaats}]\vbox{\flushnextbox}}% + {\alignedbox[\collectorparameter\c!plaats]\vbox{\flushnextbox}}% \boxmaxdepth\zeropoint % really needed, nice example \global\advance\boxhdisplacement\@@layerxpos \ifdim\boxhdisplacement<\zeropoint - \global\setbox\csname\@@collectorbox#1\endcsname\hbox + \global\setbox\collectorbox\hbox {\hskip-\boxhdisplacement - \box\csname\@@collectorbox#1\endcsname}% + \box\collectorbox}% \fi \global\advance\boxvdisplacement\@@layerypos \ifdim\boxvdisplacement<\zeropoint - \global\setbox\csname\@@collectorbox#1\endcsname\hbox + \global\setbox\collectorbox\hbox {\lower-\boxvdisplacement - \box\csname\@@collectorbox#1\endcsname}% + \box\collectorbox}% \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 - {\box\csname\@@collectorbox#1\endcsname + \@@layerxsiz\wd\collectorbox + \@@layerysiz\ht\collectorbox + \advance\@@layerysiz\dp\collectorbox + \global\setbox\collectorbox\hbox + {\box\collectorbox \hskip-\@@layerxsiz \hskip\@@layerxpos\relax \ifdim\boxhdisplacement<\zeropoint @@ -216,8 +227,12 @@ \else \flushnextbox \fi}}% - \ifdim\wd\csname\@@collectorbox#1\endcsname<\@@layerxsiz - \global\wd\csname\@@collectorbox#1\endcsname\@@layerxsiz + % combine height and depth into depth only (later flushed as height) + \global\setbox\collectorbox\hbox + {\lower\ht\collectorbox\box\collectorbox}% + % just to be sure + \ifdim\wd\collectorbox<\@@layerxsiz + \global\wd\collectorbox\@@layerxsiz \fi} \def\flushcollector[#1]% @@ -302,9 +317,12 @@ {\!!widtha \nextboxwd \!!heighta\nextboxht \bgroup % preserve \nextbox + \setuplayer + [caption] + [\c!breedte=\!!widtha,\c!hoogte=\!!heighta]% \setlayer [caption] - [\c!breedte=\!!widtha,\c!hoogte=\!!heighta,#1] + [#1] {\getparameters[\??du][#2]% \dosetfontattribute\??du\c!letter\stelinterliniein \framed @@ -345,7 +363,7 @@ \def\doornamenttext[#1][#2]% {\bgroup \doifassignmentelse{#1} - {\getparameters[\s!dummy][\c!variant=\v!a,#2]% + {\getparameters[\s!dummy][\c!variant=\v!a,#1]% \doifelse\dummyvariant\v!a {\egroup\collectedtext}% {\egroup\layeredtext }% @@ -622,6 +640,7 @@ \setvalue{\??ab\??ab\v!onder }{\bottombox} \setvalue{\??ab\??ab\v!boven }{\topbox } +\setvalue{\??ab\??ab\v!midden\v!midden}{\middlebox} \setvalue{\??ab\??ab\v!links \v!boven }{\lefttopbox} \setvalue{\??ab\??ab\v!links \v!onder }{\leftbottombox} \setvalue{\??ab\??ab\v!rechts\v!boven }{\righttopbox} diff --git a/tex/context/base/core-dat.tex b/tex/context/base/core-dat.tex index c2d13f864..2389aa616 100644 --- a/tex/context/base/core-dat.tex +++ b/tex/context/base/core-dat.tex @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% THIS WILL DISAPPEAR, I.E. BE MOVED TO A MODULE + \writestatus{loading}{Context Database Support} \startmessages dutch library: databases @@ -176,7 +178,7 @@ %\newevery \everyrecord \EveryRecord -\def\definerecord% +\def\definerecord {\dodoubleempty\dodefinerecord} \def\dodefinerecord[#1][#2]% @@ -186,7 +188,7 @@ \c!commando=\gobbleoneargument, #2]} -\def\setuprecord% +\def\setuprecord {\dodoubleargument\dosetuprecord} \def\dosetuprecord[#1][#2]% @@ -200,18 +202,18 @@ %D Watch out: the entries are defined global! While %D processing a record, no grouping is applied. -\def\getrecordentry #1{\getvalue{\??db:#1}} +\def\getrecordentry #1{\getvalue {\??db:#1}} \def\resetrecordentry #1{\letgvalueempty{\??db:#1}} -\def\assignrecordentry#1{\setgvalue{\??db:#1}} +\def\assignrecordentry#1{\setgvalue {\??db:#1}} -\long\def\skiprecord#1\stoprecord% +\long\def\skiprecord#1\stoprecord {\egroup} \newif\ifrecordok \newtoks\resetrecordlist -\def\processrecords% +\def\processrecords {\dotripleargument\doprocessrecords} \def\doprocessrecords[#1][#2][#3]% @@ -223,11 +225,11 @@ \processcommacommand[\getvalue{\??db#1\c!velden}]\docommando \let\setrecordentry\skiprecord \the\resetrecordlist - \doifelse{#2}{\v!alles} % 't Is nu eenmaal alles - {\recordoktrue} + \doifelse{#2}\v!alles % 't Is nu eenmaal alles + \recordoktrue {\doifelsenothing{#2} % of niets - {\recordoktrue} - {\recordokfalse}}% % zullen we maar zeggen. + \recordoktrue + \recordokfalse}% % zullen we maar zeggen. \ifrecordok \let\askedrecords\v!alles \else @@ -266,10 +268,10 @@ \showmessage\m!databases1\askedrecords \def\doprocessrecords##1% {\readjobfile{##1} - {\showmessage{\m!databases}{2}{(job)}} + {\showmessage\m!databases2{(job)}} {\readsysfile{##1} - {\showmessage{\m!databases}{3}{(sys)}} - {\showmessage{\m!databases}{4}{}}}}% + {\showmessage\m!databases3{(sys)}} + {\showmessage\m!databases4{}}}}% \processcommalist[#3]\doprocessrecords \egroup} diff --git a/tex/context/base/core-des.tex b/tex/context/base/core-des.tex index 9e743f7ba..676209341 100644 --- a/tex/context/base/core-des.tex +++ b/tex/context/base/core-des.tex @@ -495,22 +495,22 @@ \def\@@ddvolgendesubsubsubnummer#1[#2]% {\edef\doornummer{\getvalue{\??dd#1\??dd\c!nummer}}% \verhoognummer[\v!sub\v!sub\v!sub\doornummer]% - \rawreference{\s!num}{#2}{\showdnsubsubsubnummer{\doornummer}}}% + \rawreference\s!num{#2}{\showdnsubsubsubnummer{\doornummer}}}% \def\@@ddvolgendesubsubnummer#1[#2]% {\@@ddresetsubsubsubnummer{#1}% \verhoognummer[\v!sub\v!sub\doornummer]% - \rawreference{\s!num}{#2}{\showdnsubsubnummer{\doornummer}}} + \rawreference\s!num{#2}{\showdnsubsubnummer{\doornummer}}} \def\@@ddvolgendesubnummer#1[#2]% {\@@ddresetsubsubnummer{#1}% \verhoognummer[\v!sub\doornummer]% - \rawreference{\s!num}{#2}{\showdnsubnummer{\doornummer}}} + \rawreference\s!num{#2}{\showdnsubnummer{\doornummer}}} \def\@@ddvolgendenummer#1[#2]% {\@@ddresetsubnummer{#1}% \verhoognummer[\doornummer]% - \rawreference{\s!num}{#2}{\showdnnummer{\doornummer}}} + \rawreference\s!num{#2}{\showdnnummer{\doornummer}}} \def\dodosteldoornummerenin[#1][#2]% {\getparameters[\??dd#1][#2]% diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex index 6f8ddb293..0d7865cf8 100644 --- a/tex/context/base/core-itm.tex +++ b/tex/context/base/core-itm.tex @@ -309,7 +309,7 @@ \let\docommando\gobbleoneargument} {\let\listitem\empty}}} -\def\calculatelistwidth#1#2% +\def\calculatelistwidth#1#2% distance deals with 'broad' {#2=\getitemparameter{#1}\c!afstand\relax \ifnum\getitemparameter{#1}\c!factor>\zerocount \ifdim#2=\zeropoint #2=.5em\fi @@ -714,6 +714,7 @@ \ifconditional\inlinelistitem \hbox to \dimen0{\ifsubitem\llap{+}\fi\box8\hfill}% \else + % todo: align+marge binnen de hbox \llap{\hbox to \dimen0{\ifsubitem\llap{+}\fi\box8\hfill}}% \fi \fi diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex index 901df91c0..2d86723fd 100644 --- a/tex/context/base/core-mis.tex +++ b/tex/context/base/core-mis.tex @@ -1592,6 +1592,7 @@ \c!breedte,\c!hoogte,\c!maxbreedte,\c!maxhoogte, \c!korps,\c!uitlijnen,\c!plaats]% \@@ldvoor\bgroup + \global\setsystemmode{pairedbox}% \beforefirstpairedbox \dowithnextbox {\betweenbothpairedboxes @@ -1759,6 +1760,15 @@ \ifcase\pairedlocationb\hss\or\or\or\or\hss\fi}} \definepairedbox[\e!legenda] + +%D Goody: + +\newevery \everyinsidefloat \relax + +\appendtoks + \global\resetsystemmode{combination}% + \global\resetsystemmode{pairedbox}% +\to \everyinsidefloat \newcount\horcombination % counter \newcount\totcombination @@ -1786,6 +1796,7 @@ \def\dostartcombination[#1][#2]% {\bgroup + \global\setsystemmode{combination}% \ifsecondargument \def\currentcombination{#1}% \else diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex index cef50c349..70c4af511 100644 --- a/tex/context/base/core-rul.tex +++ b/tex/context/base/core-rul.tex @@ -28,10 +28,10 @@ %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}} + {\assigndimension{#1}\linewidth{.2\s!pt}{.4\s!pt}{.6\s!pt}} \def\setuplinewidth {\dosingleargument\dosetuplinewidth} @@ -200,7 +200,7 @@ {\vrule\!!width#1\!!height#2\!!depth#3}% \def\dofilledroundbox\width#1\height#2\depth#3\radius#4\\% - {\ovalbox{#1}{#2}{#3}{\ruledlinewidth}{#4}\v!uit\v!aan} + {\ovalbox{#1}{#2}{#3}\ruledlinewidth{#4}\v!uit\v!aan} \def\ovalbox#1#2#3#4#5#6#7% direct #1 etc passeren {\bgroup @@ -242,7 +242,7 @@ \dophantombox\width#1\height#2\depth#3\corner#5\radius#6\\% \fi}} -\def\colorbox% +\def\colorbox {\setcolorbox} %D \macros @@ -339,7 +339,7 @@ \scratchdimen#3% \edef\overlaywidth{\the\scratchdimen\space}% \scratchdimen#4% - \advance\scratchdimen #5% + \advance\scratchdimen#5% \edef\overlayheight{\the\scratchdimen\space}% \scratchdimen#5% \edef\overlaydepth{\the\scratchdimen\space}% @@ -1853,7 +1853,7 @@ \definecomplexorsimple\startmarginrule -\def\simplestartmarginrule% +\def\simplestartmarginrule {\bgroup \let\drawmarginrule\relax \let\stopmarginrule\dostopmarginrule @@ -2349,10 +2349,10 @@ \c!marge=\v!standaard, #2]% \setvalue{\e!start#1}{\dostartframedtext[#1]}% - \setvalue{\e!stop#1}{\dostopframedtext}% - \setvalue{#1}{\doframedtext[#1]}} + \setvalue{\e!stop #1}{\dostopframedtext }% + \setvalue {#1}{\doframedtext [#1]}} -\def\defineframedtext% +\def\defineframedtext {\dodoubleempty\dodefineframedtext} %D We define the general (and original) case by just saying: diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex index 937fd4506..44612b528 100644 --- a/tex/context/base/core-sec.tex +++ b/tex/context/base/core-sec.tex @@ -1478,89 +1478,6 @@ % todo: kap -% \def\doplaatskoptekst#1#2#3#4% -% {\beginheadplacement{#1}% -% \iflegekop -% \setbox0\ifvertical\vbox\else\hbox\fi to \zeropoint -% {\headnumbercontentfalse -% \resetsystemmode\v!sectienummer -% #2}% -% \makestrutofbox0 -% \else -% \setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox -% {\headnumbercontentfalse -% \resetsystemmode\v!sectienummer -% \getvalue{\??ko#1\c!commando} -% {} % no number -% {\doattributes -% {\??ko#1}\c!letter\c!kleur -% {\doattributes -% {\??ko#1}\c!tekstletter\c!tekstkleur -% {\dontconvertfont -% \ifdisplaysectionhead -% \stelinterliniein -% \else -% \stelspatieringin -% \fi -% #2% -% \getvalue{\??ko#1\c!voorcommando}% -% \ifdisplaysectionhead -% \getvalue{\??ko#1\c!tekstcommando}% -% {\setstrut\begstrut#3\endstrut}% -% \xdef\localheaddepth{\the\dp\strutbox}% -% \else -% \getvalue{\??ko#1\c!tekstcommando}{#3}% -% \fi -% \getvalue{\??ko#1\c!nacommando}% -% \ifdisplaysectionhead\endgraf\fi}}}}% -% \fi -% \endheadplacement{#1}{#4}} -% -% \def\doplaatskopnummertekst#1#2#3#4#5% -% {\beginheadplacement{#1}% -% \iflegekop -% \setbox0\ifvertical\vbox\else\hbox\fi to \zeropoint -% {\doiftextelse{#3} -% {\setsystemmode \v!sectienummer\headnumbercontenttrue } -% {\resetsystemmode\v!sectienummer\headnumbercontentfalse}% -% #2}% -% \makestrutofbox0 -% \else -% \setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox -% {\doiftextelse{#3} -% {\setsystemmode \v!sectienummer\headnumbercontenttrue } -% {\resetsystemmode\v!sectienummer\headnumbercontentfalse}% -% \getvalue{\??ko#1\c!commando}% -% {\doattributes{\??ko#1}\c!letter\c!kleur -% {\doattributes{\??ko#1}\c!nummerletter\c!nummerkleur -% {\getvalue{\??ko#1\c!voorcommando}% -% \ifdisplaysectionhead -% \getvalue{\??ko#1\c!nummercommando}% -% {\setstrut\begstrut#3\endstrut}% -% \else -% \getvalue{\??ko#1\c!nummercommando}{#3}% -% \fi}}} -% {\doattributes{\??ko#1}\c!letter\c!kleur -% {\doattributes{\??ko#1}\c!tekstletter\c!tekstkleur -% {\dontconvertfont -% \ifdisplaysectionhead -% \stelinterliniein -% \else -% \stelspatieringin -% \fi -% #2% -% \ifdisplaysectionhead -% \getvalue{\??ko#1\c!tekstcommando}% -% {\setstrut\begstrut#4\endstrut}% -% \xdef\localheaddepth{\the\dp\strutbox}% -% \else -% \getvalue{\??ko#1\c!tekstcommando}{#4}% -% \fi -% \getvalue{\??ko#1\c!nacommando}% -% \ifdisplaysectionhead\endgraf\fi}}}}% -% \fi -% \endheadplacement{#1}{#5}} - % to be documented: \placeheadtext \placeheadnumber \unexpanded\def\placeheadtext @@ -1584,6 +1501,24 @@ \dostopattributes \egroup} +\chardef\headtimingmode=0 + +% \chardef\headtimingmode=1 +% +% Martin Kolarik's problem: +% +% \setuphead[section][command=\doTitle] +% +% \def\doTitle#1#2% +% {\ruledvbox{\forgetall \hsize=4cm +% \ruledhbox{\ruledvtop{#1}\ruledvtop{#2}}}} +% +% \section{test test test test test test test test test test +% test test test test test test test} + +\def\placeheadmargintexts#1% + {\doifvalue{\??ko#1\c!margetekst}\v!ja\placemargintexts} + \def\doplaatskoptekst#1#2#3#4% {\beginheadplacement{#1}% \iflegekop @@ -1596,6 +1531,8 @@ \setbox0=\ifvertical\vbox\else\hbox\fi % \vhbox {\headnumbercontentfalse \resetsystemmode\v!sectienummer + % less interfering + \ifcase\headtimingmode\or#2\fi % outerside font determines distance \dosetfontattribute{\??ko#1}\c!letter % but we don't want color to influence user commands @@ -1609,8 +1546,9 @@ \else \stelspatieringin \fi - #2% + \ifcase\headtimingmode#2\fi \getvalue{\??ko#1\c!voorcommando}% + \placeheadmargintexts{#1}% binnen #3? \ifdisplaysectionhead \getvalue{\??ko#1\c!tekstcommando}% {\setstrut\begstrut#3\endstrut}% @@ -1625,7 +1563,7 @@ \fi \endheadplacement{#1}{#4}} -\def\doplaatskopnummertekst#1#2#3#4#5% +\def\doplaatskopnummertekst#1#2#3#4#5% maybe move modes outside box {\beginheadplacement{#1}% \iflegekop \setbox0\ifvertical\vbox\else\hbox\fi to \zeropoint @@ -1639,6 +1577,8 @@ {\doiftextelse{#3} {\setsystemmode \v!sectienummer\headnumbercontenttrue } {\resetsystemmode\v!sectienummer\headnumbercontentfalse}% + % less interfering + \ifcase\headtimingmode\or#2\fi % outerside font determines distance \dosetfontattribute{\??ko#1}\c!letter % but we don't want color to influence user commands @@ -1646,6 +1586,7 @@ {\dostartattributes{\??ko#1}\c!letter\c!kleur\empty \dostartattributes{\??ko#1}\c!nummerletter\c!nummerkleur\empty \getvalue{\??ko#1\c!voorcommando}% + \placeheadmargintexts{#1}% binnen #3? \ifdisplaysectionhead \getvalue{\??ko#1\c!nummercommando}% {\setstrut\begstrut#3\endstrut}% @@ -1662,7 +1603,8 @@ \else \stelspatieringin \fi - #2% + \ifcase\headtimingmode#2\fi + \placeheadmargintexts{#1}% binnen #3? \ifdisplaysectionhead \getvalue{\??ko#1\c!tekstcommando}% {\setstrut\begstrut#4\endstrut}% @@ -2014,6 +1956,7 @@ \c!file=, \c!expansie=, \c!grid=, + \c!margetekst=, #2]% \ConvertToConstant\doifnot{#1}{\getvalue{\??ko#1\c!default}} {\doifsomething{\getvalue{\??ko#1\c!default}} @@ -2026,7 +1969,7 @@ %\c!nummerletter,\c!tekstletter, %\c!expansie, % why njet ? \c!uitlijnen,\c!titeluitlijnen,\c!tolerantie,\c!grid, - \c!nummercommando,\c!tekstcommando]}}% + \c!nummercommando,\c!tekstcommando,\c!margetekst]}}% \getparameters[\??ko#1][#2]% \doifsomething{\getvalue{\??ko#1\c!sectie}} {\doifelsemarking{#1}% \doifundefined{\??mk#1} @@ -2051,7 +1994,7 @@ %\c!nummerletter,\c!tekstletter, %\c!expansie, % why njet ? \c!uitlijnen,\c!titeluitlijnen,\c!tolerantie,\c!grid, - \c!nummercommando,\c!tekstcommando]% + \c!nummercommando,\c!tekstcommando,\c!margetekst]% \getparameters[\??ko#1][\c!expansie=]% iig een value, rather fuzzy \definieermarkering[#1][#2]% \definieermarkering[#1\v!nummer][#2\v!nummer]% diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex index 9c5293304..53ba96cc7 100644 --- a/tex/context/base/core-spa.tex +++ b/tex/context/base/core-spa.tex @@ -429,17 +429,21 @@ \defineblankmethod [\v!regel]{\addblankskip+\openlineheight\openlineheight} \defineblankmethod [-\v!regel]{\addblankskip-\openlineheight\openlineheight} -\defineblankmethod [\v!formule ]{\global\advance\blankoskip\medskipamount} -\defineblankmethod [\v!geenwit ]{\global\blankogeenwittrue} -\defineblankmethod [\v!blokkeer ]{\global\blankoblokkeertrue} -\defineblankmethod [\v!forceer ]{\global\blankoforceertrue} -\defineblankmethod [\v!buiten ]{\ifvmode\ifinner\blankobuitentrue\fi\fi} -\defineblankmethod [\v!reset ]{\global\blankoresettrue} -\defineblankmethod [\v!flexibel ]{\global\lokaalblankoflexibeltrue} -\defineblankmethod [\v!vast ]{\global\lokaalblankovasttrue} -\defineblankmethod [\v!back ]{\geenblanko} -\defineblankmethod [\v!halveregel]{\ifgridsnapping\global\fuzzyvskiptrue\fi - \global\advance\blankoskip .5\lineheight} +\defineblankmethod [\v!formule ]{\global\advance\blankoskip\medskipamount} +\defineblankmethod [\v!geenwit ]{\global\blankogeenwittrue} +\defineblankmethod [\v!blokkeer ]{\global\blankoblokkeertrue} +\defineblankmethod [\v!forceer ]{\global\blankoforceertrue} +\defineblankmethod [\v!buiten ]{\ifvmode\ifinner\blankobuitentrue\fi\fi} +\defineblankmethod [\v!reset ]{\global\blankoresettrue} +\defineblankmethod [\v!flexibel ]{\global\lokaalblankoflexibeltrue} +\defineblankmethod [\v!vast ]{\global\lokaalblankovasttrue} +\defineblankmethod [\v!back ]{\geenblanko} +\defineblankmethod [\v!halveregel ]{\ifgridsnapping\global\fuzzyvskiptrue\fi + \global\advance\blankoskip .5\lineheight} + +\defineblankmethod [\v!geen ]{\global\blankoresettrue} +\defineblankmethod [\v!aansluitend]{\ifvmode\nointerlineskip\fi} + % happens often \defineblankmethod [2*\v!groot]{\addblankskip+{2\bigskipamount}{2\openlineheight}} @@ -1787,7 +1791,7 @@ %D Centered looks nicer: -\def\dosetstrut% +\def\dosetstrut {\let\strut\normalstrut \setbox\strutbox\normalhbox {\normalhbox to \zeropoint @@ -1942,14 +1946,13 @@ % gemaakt. \def\tfskipsize{1em\relax} - \def\tfkernsize{1ex\relax} -\def\tfskip% - {{\tf\hskip\tfskipsize}} +\def\tfskip{\dotfskip\tfskipsize} +\def\tfkern{\dotfkern\tfkernsize} -\def\tfkern% - {{\tf\kern\tfkernsize}} +\def\dotfskip#1{{\tf\hskip#1}} +\def\dotfkern#1{{\tf\kern #1}} \newskip\linkssmaller \newskip\rechtssmaller @@ -2103,8 +2106,8 @@ \let\raggedtopcommand\empty \let\raggedbottomcommand\empty \doifsomething{#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 \!!donectrue \rawprocesscommalist[#1]\dododosetraggedcommand}} @@ -3171,6 +3174,15 @@ \localstoptextcolor \dostopgraphicgroup}}% \vbox} + +%D This works only in a properly strutted line, and is meant +%D for deeply burried operations, like in heads. + +\def\fakedvadjust + {\dowithnextbox + {\setbox\nextbox\hbox{\llap{\lower\strutdepth\box\nextbox}}% + \smashedbox\nextbox}% + \vtop} \def\flexiblespaceamount#1#2#3% {#1\fontdimen2\font diff --git a/tex/context/base/core-sys.tex b/tex/context/base/core-sys.tex index 1376030fa..746103037 100644 --- a/tex/context/base/core-sys.tex +++ b/tex/context/base/core-sys.tex @@ -44,7 +44,7 @@ \def\setuprandomize[#1]% {\doifsomething{#1} {\bgroup - \setrandomseed{-1}% + \setrandomseed\minusone \processaction [#1] [ \v!klein=>\divide\time 900, % 15 taco vragen hoe diff --git a/tex/context/base/core-tab.tex b/tex/context/base/core-tab.tex index 0032962e2..df2db6ab6 100644 --- a/tex/context/base/core-tab.tex +++ b/tex/context/base/core-tab.tex @@ -1054,7 +1054,6 @@ \getTABLEnofcolumns\TABLEformat \expandafter\BeginFormat\TABLEformat\EndFormat}} - \def\finishTABLE {\chuckTABLEautorow \unskip\crcr @@ -1655,13 +1654,12 @@ \bgroup \catcode`\|=\@@active -%\gdef\protectTABLEbar{\let|\letterbar} % maybe in \cleanupfeatures -\doglobal \appendtoks \let|\letterbar \to \everycleanupfeatures +\gdef\protectTABLEbar{\let|\letterbar} \catcode`\|=\@@other \gdef\getTABLEnofcolumns#1% {\bgroup \cleanupfeatures % needed ! -% \protectTABLEbar + \protectTABLEbar % is still a feature \expanded{\convertargument#1}\to\ascii \@EA\doglobal\@EA\counttoken\@EA|\@EA\in\ascii\to\maxTABLEcolumn \global\advance\maxTABLEcolumn \minusone diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex index ce682bb8d..8a7753504 100644 --- a/tex/context/base/core-tbl.tex +++ b/tex/context/base/core-tbl.tex @@ -841,11 +841,16 @@ %D would make things less clear. \def\doregistertabulateparoptions - {\ifinsidefloat \else \iftrialtypesetting \else + {\iftrialtypesetting \else \registerparoptions -% unsafe in crossing pages, at each b... -% \global\let\registertabulateparoptions\empty - \fi \fi} + \ifinsidefloat + % that is, an unbreakable one + \global\let\registertabulateparoptions\empty + \else + % unsafe in crossing pages, at each b... + % \global\let\registertabulateparoptions\empty + \fi + \fi} \appendtoks \global\let\registertabulateparoptions\doregistertabulateparoptions diff --git a/tex/context/base/m-educat.tex b/tex/context/base/m-educat.tex new file mode 100644 index 000000000..01e156797 --- /dev/null +++ b/tex/context/base/m-educat.tex @@ -0,0 +1,250 @@ +%D \module +%D [ file=m-educat, +%D version=2003.03.05, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Educational Extras, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module will collect a few macros cq.\ definitions +%D meant for educational use. Most of the code has been laying +%D around for some time and has been (or is still) used in +%D \PRAGMA\ projects. + +\unprotect + +\startvariables dutch english + german czech + italian romanian + + answerarea: antwoordgebied answerarea + answerarea answerarea + answerarea answerarea + +\stopvariables + +\startelements dutch english + german czech + italian romanian + + answerspace: antwoordruimte answerspace + answerspace answerspace + answerspace answerspace + answerlines: antwoordregels answerlines + answerlines answerlines + answerlines answerlines + +\stopelements + +\startcommands dutch english + german czech + italian romanian + + setupanswerarea: stelantwoordgebiedin setupanswerarea + setupanswerarea setupanswerarea + setupanswerarea setupanswerarea + +\stopcommands + +\definesystemvariable{iv} + +\definecolor [answerareacolor] [s=.90] +\definecolor [answerlinecolor] [white] + +\definetextbackground + [\v!answerarea] + [\c!plaats=\v!tekst, + \c!n=0, + \c!kader=\v!uit, + \c!kaderkleur=answerlinecolor, + \c!lijndikte=2pt, + \c!achtergrond=\v!kleur, + \c!achtergrondkleur=answerareacolor, + \c!variant=2] % betweenline + +% n=gedwongen +% m=extra auto + +\def\setupanswerarea + {\setuptextbackground[\v!answerarea]} + +\def\answerspace + {\dosingleempty\doanswerspace} + +\def\doanswerspace[#1]% + {\begingroup + \dontcomplain + \setupanswerarea + [\c!n=0,\c!m=,#1,\c!plaats=\v!tekst]% + \doifelsenothing{\backgroundvariable\c!m} + {\expandafter\donoanswerspace} + {\expandafter\dodoanswerspace}% + [#1]} + +\def\donoanswerspace[#1]#2% + {\setupthinrules + [\c!variant=\backgroundvariable\c!variant, + \c!kleur=\backgroundvariable\c!kaderkleur, + \c!achtergrond=\backgroundvariable\c!achtergrond, + \c!achtergrondkleur=\backgroundvariable\c!achtergrondkleur, + \c!lijndikte=\backgroundvariable\c!lijndikte]% + \doifelse{\backgroundvariable\c!n}{*} + {\thinrule + \par} + {\scratchcounter0\backgroundvariable\c!n\relax + % tricky, guess + \def\processisolatedword##1% + {\setbox\scratchbox=\hbox{##1}% + \vbox{\hsize\wd\scratchbox\thinrule + \ifcase\scratchcounter\else + \setbox\scratchbox=\hbox{\space}% + \nobreak\hskip\zeropoint \!!minus \wd\scratchbox + \vbox{\hsize\wd\scratchbox\thinrule}% + \fi}}% + \processisolatedwords{#2}\processisolatedword + % so far + \ifcase\scratchcounter \else \ifnum\scratchcounter<3 + \nobreak \vbox{\hsize\scratchcounter em\thinrule}% + \else % more + \advance \scratchcounter -2 + \dorecurse\scratchcounter{\allowbreak\vbox{\hsize1em\thinrule}}% + \nobreak \vbox{\hsize2em\thinrule}% + \fi \fi}% + \endgroup} + +\def\dodoanswerspace[#1]#2% m case + {\getvalue{\e!start\v!answerarea}% + #2% + \doifelse{\backgroundvariable\c!m}{*} + {\hfill\strut + \getvalue{\e!stop\v!answerarea}% + \par} + {\scratchcounter0\backgroundvariable\c!m\relax + \ifcase\scratchcounter \else \ifnum\scratchcounter<3 + \nobreak \hbox to \scratchcounter em{\strut\hss}% + \else % more + \advance \scratchcounter -2 + \dorecurse\scratchcounter{\allowbreak\hbox to 1em{\strut\hss}}% + \nobreak \hbox to 2em{\strut\hss}% + \fi \fi + \getvalue{\e!stop\v!answerarea}}% + \endgroup} + +\setvalue{\e!start\e!answerlines}% + {\dosingleempty\dostartanswerlines} + +\def\dostartanswerlines[#1]% + {\begingroup + \dontcomplain + \setupanswerarea + [\c!n=0,\c!m=,#1,\c!plaats=\v!tekst]% + \doifnot{\backgroundvariable\c!optie}\v!aansluitend\softbreak + \doifelsenothing{\backgroundvariable\c!m} + {\expandafter\donostartanswerlines} + {\expandafter\dodostartanswerlines}% + [#1]} + +\def\donostartanswerlines[#1]% + {\setupthinrules + [\c!variant=\backgroundvariable\c!variant, + \c!kleur=\backgroundvariable\c!kaderkleur, + \c!achtergrond=\backgroundvariable\c!achtergrond, + \c!achtergrondkleur=\backgroundvariable\c!achtergrondkleur, + \c!lijndikte=\backgroundvariable\c!lijndikte]% + \thinrules[\c!n=\backgroundvariable\c!n]\par + \endgroup + \grabuntil{\e!stop\e!answerlines}} + +\def\dodostartanswerlines[#1]% + {\begingroup + \getvalue{\e!start\v!answerarea}% + \ignorespaces} + +\setvalue{\e!stop\e!answerlines}% + {\scratchcounter0\backgroundvariable\c!m\relax + % a \softbreak is more efficient in pos dan \par + \ifcase\scratchcounter + % nothing + \or + \softbreak + \else + \softbreak + \advance \scratchcounter \minusone + \dorecurse\scratchcounter{\strut\hfill\strut\softbreak}% + \fi + \strut\hfill\strut + \getvalue{\e!stop\v!answerarea}% + \par\endgroup\endgroup} + +\def\answerlines + {\dosingleempty\doanswerlines} + +\def\doanswerlines[#1]#2% + {\getvalue{\e!start\e!answerlines}[#1]% + #2% + \getvalue{\e!stop\e!answerlines}} + +\protect \doifnotmode{demo}{\endinput} + +%D Test materiaal. + +\starttext + +\startnotmode[answers] + + \setupanswerarea[level=+1] + +\stopnotmode + +\setupcolors[state=start] + +test test test \answerspace [n=10] {Whow}. test test test +test tets test test \answerspace [n=10] {Whow}. test test +test test tets test test \answerspace [n=10] {Whow}. test +test test test tets test test \answerspace [n=10] {Whow}. +test test test test test test \answerspace [n=*] {Whow.} + +test test test test test test test \startanswerlines +[n=3] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[n=3,alternative=0] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[n=3,alternative=1] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[n=3,alternative=2] What A Junk Answer \stopanswerlines + +\startitemize[paragraph] +\item \startanswerlines [option=seried,n=2] xxx \stopanswerlines +\stopitemize + +test test test \answerspace [m=10] {Whow}. test test test +test tets test test \answerspace [m=10] {Whow}. test test +test test tets test test \answerspace [m=10] {Whow}. test +test test test tets test test \answerspace [m=10] {Whow}. +test test test test test test \answerspace [m=*] {Whow.} + +test test test test test test test \startanswerlines +[m=2] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[m=2,alternative=0] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[m=2,alternative=1] What A Junk Answer \stopanswerlines + +test test test test test test test \startanswerlines +[m=2,alternative=2] What A Junk Answer \stopanswerlines + +\startitemize[paragraph] +\item \startanswerlines [option=seried,m=2] xxx \stopanswerlines +\stopitemize + +\stoptext diff --git a/tex/context/base/m-quest.tex b/tex/context/base/m-quest.tex index eb9787b81..f56ee90b3 100644 --- a/tex/context/base/m-quest.tex +++ b/tex/context/base/m-quest.tex @@ -153,19 +153,19 @@ \def\dostelinvullenin[#1]% {\getparameters[\??iv][#1]% - \doif{\@@ivstatus}{\v!reset} - {\global\invulput=0 - \global\invulget=0 + \doif\@@ivstatus\v!reset + {\global\invulput\zerocount + \global\invulget\zerocount \let\@@ivstatus\empty}} -\def\definieerinvulwoord% +\def\definieerinvulwoord {\dosingleempty\dodefinieerinvulwoord} \def\dodefinieerinvulwoord[#1]#2% {\iffirstargument \setgvalue{\r!fillin#1}{\simpleinvulwoord{#2}}% \else - \global\advance\invulput by 1 + \global\advance\invulput \plusone \setgvalue{\r!fillin\the\invulput}{\simpleinvulwoord{#2}}% \fi \ifvoorlopig \ifnum\invulput>0 @@ -175,27 +175,22 @@ \fi \fi} \def\dosimpleinvulwoord#1% - {\ifnum\@@ivnummer>0 \advance\invulteller by 1 \fi + {\ifnum\@@ivnummer>0 \advance\invulteller \plusone \fi \ifnum\invulteller=\@@ivnummer\relax \bgroup - \doconvertfont - {\@@ivletter} + \doconvertfont\@@ivletter {\@@ivlinks - \doifelse{\@@ivstatus}{\v!leeg} - {\doifelse{\@@ivlijn}{\v!aan} - {\let\next\leeginvulwoord} - {\let\next\geeninvulwoord}} - {\doifelse{\@@ivlijn}{\v!aan} - {\let\next\underbar} - {\let\next\firstofoneargument}}% - \next{#1}% + \doifelse\@@ivstatus\v!leeg + {\doifelse\@@ivlijn\v!aan\leeginvulwoord\geeninvulwoord} + {\doifelse\@@ivlijn\v!aan\underbar \firstofoneargument}% + {#1}% \@@ivrechts}% \egroup \fi}% \def\simpleinvulwoord#1% {\ifnum\@@ivnummer>0 - \invulteller=0 + \invulteller\zerocount \processcommalist[#1]\dosimpleinvulwoord \else \dosimpleinvulwoord{#1}% @@ -204,17 +199,11 @@ \def\complexinvulwoord[#1]% {\bgroup \doifsomething{#1} - {\global\advance\invulget by 1 - \doconvertfont - {\@@ivletter} - {\@@ivlinks - \getvalue{\r!fillin\the\invulget}% - \@@ivrechts}} - {\doconvertfont - {\@@ivletter} - {\@@ivlinks - \getvalue{\r!fillin#1}% - \@@ivrechts}}% + {\global\advance\invulget \plusone + \doconvertfont\@@ivletter + {\@@ivlinks\getvalue{\r!fillin\the\invulget}\@@ivrechts}} + {\doconvertfont\@@ivletter + {\@@ivlinks\getvalue{\r!fillin #1}\@@ivrechts}}% \egroup} \definecomplexorsimple\invulwoord diff --git a/tex/context/base/mult-ini.tex b/tex/context/base/mult-ini.tex index 82e68bc41..d6f6d4c5b 100644 --- a/tex/context/base/mult-ini.tex +++ b/tex/context/base/mult-ini.tex @@ -517,44 +517,58 @@ %D %D These macros are called upon quite often and so we optimized %D them a bit. - -\def\dosetvalue#1#2#3% - {\let\c!internal!\c!internal!n - \p!doifundefined{\k!prefix!#2}% - \let\c!internal!\c!internal!y - \let\donottest\doprocesstest - \@EA\def\csname#1#2\endcsname{#3}% - \else - \let\c!internal!\c!internal!y - \let\donottest\doprocesstest - \@EA\def\csname#1\csname\k!prefix!#2\endcsname\endcsname{#3}% - \fi} - -\def\dosetevalue#1#2#3% - {\let\c!internal!\c!internal!n - \p!doifundefined{\k!prefix!#2}% - \let\c!internal!\c!internal!y - \let\donottest\doprocesstest - \@EA\edef\csname#1#2\endcsname{#3}% - \else - \let\c!internal!\c!internal!y - \let\donottest\doprocesstest - \@EA\edef\csname#1\csname\k!prefix!#2\endcsname\endcsname{#3}% - \fi} - -\def\docopyvalue#1#2#3% - {\let\c!internal!\c!internal!n - \p!doifundefined{\k!prefix!#3}% - \let\c!internal!\c!internal!y - \let\donottest\doprocesstest - \@EA\def\csname#1#3\endcsname% - {\csname#2#3\endcsname}% - \else - \let\c!internal!\c!internal!y - \let\donottest\doprocesstest - \@EA\def\csname#1\csname\k!prefix!#3\endcsname\endcsname% - {\csname#2\csname\k!prefix!#3\endcsname\endcsname}% - \fi} +%D +%D \starttypen +%D \def\dosetvalue#1#2#3% +%D {\let\c!internal!\c!internal!n +%D \p!doifundefined{\k!prefix!#2}% +%D \let\c!internal!\c!internal!y +%D \let\donottest\doprocesstest +%D \@EA\def\csname#1#2\endcsname{#3}% +%D \else +%D \let\c!internal!\c!internal!y +%D \let\donottest\doprocesstest +%D \@EA\def\csname#1\csname\k!prefix!#2\endcsname\endcsname{#3}% +%D \fi} +%D +%D \def\dosetevalue#1#2#3% +%D {\let\c!internal!\c!internal!n +%D \p!doifundefined{\k!prefix!#2}% +%D \let\c!internal!\c!internal!y +%D \let\donottest\doprocesstest +%D \@EA\edef\csname#1#2\endcsname{#3}% +%D \else +%D \let\c!internal!\c!internal!y +%D \let\donottest\doprocesstest +%D \@EA\edef\csname#1\csname\k!prefix!#2\endcsname\endcsname{#3}% +%D \fi} +%D +%D \def\dosetgvalue#1#2#3% +%D {\let\c!internal!\c!internal!n +%D \p!doifundefined{\k!prefix!#2}% +%D \let\c!internal!\c!internal!y +%D \let\donottest\doprocesstest +%D \@EA\gdef\csname#1#2\endcsname{#3}% +%D \else +%D \let\c!internal!\c!internal!y +%D \let\donottest\doprocesstest +%D \@EA\gdef\csname#1\csname\k!prefix!#2\endcsname\endcsname{#3}% +%D \fi} +%D +%D \def\docopyvalue#1#2#3% +%D {\let\c!internal!\c!internal!n +%D \p!doifundefined{\k!prefix!#3}% +%D \let\c!internal!\c!internal!y +%D \let\donottest\doprocesstest % still needed ? +%D \@EA\def\csname#1#3\endcsname% +%D {\csname#2#3\endcsname}% +%D \else +%D \let\c!internal!\c!internal!y +%D \let\donottest\doprocesstest % still needed ? +%D \@EA\def\csname#1\csname\k!prefix!#3\endcsname\endcsname% +%D {\csname#2\csname\k!prefix!#3\endcsname\endcsname}% +%D \fi} +%D \stoptypen \def\doresetvalue#1#2% {\dosetvalue{#1}{#2}{}} @@ -562,27 +576,29 @@ \def\doignorevalue#1#2#3% {\dosetvalue{#1}{#2}{}} -%\def\dogetvalue#1#2% -% {\csname#1\csname\k!prefix!#2\endcsname\endcsname} +% \def\dogetvalue#1#2% +% {\csname#1\csname\k!prefix!#2\endcsname\endcsname} %D Although maybe not clearly visible, there is a %D considerable profit in further optimization. By expanding %D the embedded \type {\csname} we can reduce the format file %D by about 5\% (60~KB out of 1.9~MB). - -\def\docopyvalue#1#2#3% c -> k - {\p!doifundefined{\k!prefix!#3}% - \let\donottest\doprocesstest - \@EAEAEA\def\@EA - \csname\@EA#1\@EA#3\@EA - \endcsname\@EA{\csname#2#3\endcsname}% - \else - \let\donottest\doprocesstest - \@EAEAEA\def\@EA - \csname\@EA#1\@EA\csname\@EA\k!prefix!\@EA#3\@EA\endcsname\@EA - \endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}% - \fi} - +%D +%D \starttypen +%D \def\docopyvalue#1#2#3% c -> k +%D {\p!doifundefined{\k!prefix!#3}% +%D \let\donottest\doprocesstest +%D \@EAEAEA\def\@EA +%D \csname\@EA#1\@EA#3\@EA +%D \endcsname\@EA{\csname#2#3\endcsname}% +%D \else +%D \let\donottest\doprocesstest +%D \@EAEAEA\def\@EA +%D \csname\@EA#1\@EA\csname\@EA\k!prefix!\@EA#3\@EA\endcsname\@EA +%D \endcsname\@EA{\csname#2\csname\k!prefix!#3\endcsname\endcsname}% +%D \fi} +%D \stoptypen +%D %D The next alternatives are slightly faster. \beginTEX @@ -1173,7 +1189,7 @@ \fi} %D The constants and variables are defined as described. When -%D \type{\interfacetranslation} is \type{true}, we also +%D \type {\interfacetranslation} is \type{true}, we also %D generate a reverse translation. Because we don't want to put %D too big a burden on \TEX's hash table, this is no default %D behavior. Reverse translation is used in the commands that @@ -1182,6 +1198,9 @@ %D those reference cards for each language without further %D interference. +%D Anno 2003 I've forgotten why the \type {\c!internal} is +%D still in there; it's probably a left over from an experiment. + \let\c!internal!y \string \def\c!internal!n {-} \let\c!internal! \c!internal!y diff --git a/tex/context/base/page-bck.tex b/tex/context/base/page-bck.tex index 9e99be34a..073edfdfd 100644 --- a/tex/context/base/page-bck.tex +++ b/tex/context/base/page-bck.tex @@ -575,25 +575,40 @@ \resetglobal \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 +% \redoglobal\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 +% \doglobal\increment\localpositionnumber % afterwards ! +% \next} + \def\doaddlocalbackground#1% - {\scratchdimen\dp#1% - \edef\next + {\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 - \redoglobal\setbox#1\hbox + \dodoglobal\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 -\doglobal\increment\localpositionnumber % afterwards ! - \next} + \next + \doglobal\increment\localpositionnumber\relax} % afterwards ! % Test how previous macro behaves with depth: % diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex index 289eaf13b..2178d4b26 100644 --- a/tex/context/base/page-flt.tex +++ b/tex/context/base/page-flt.tex @@ -272,11 +272,13 @@ [\getvalue{\??fl#1\c!zijuitlijnen}] [\v!hoogte=>\global\chardef\sidefloatalign\plusone,% \v!regel=>\global\chardef\sidefloatalign\plustwo,% (***) - \v!diepte=>\global\chardef\sidefloatalign\plusthree]% + \v!diepte=>\global\chardef\sidefloatalign\plusthree,% + \v!grid=>\global\chardef\sidefloatalign4]% \ifcase\sidefloatalign\relax \doifinset\v!hoogte{#2}{\global\chardef\sidefloatalign\plusone}% \doifinset\v!regel {#2}{\global\chardef\sidefloatalign\plustwo}% \doifinset\v!diepte{#2}{\global\chardef\sidefloatalign\plusthree}% + \doifinset\v!grid {#2}{\global\chardef\sidefloatalign4}% \fi \doifinset\v!hoog{#2}{\global\sidefloattopskip \zeropoint}% \doifinset\v!laag{#2}{\global\sidefloatbottomskip\zeropoint}% @@ -302,6 +304,7 @@ \global\nofloatcaptiontrue \fi \fi} + % documenteren in details \def\presetmorefloatvariables#1% @@ -563,6 +566,7 @@ \c!wijze=\@@kjwijze, \c!blokwijze=\@@kjblokwijze, \c!sectienummer=\@@kjsectienummer, + \c!afstand=\@@kjafstand, \c!scheider=\@@kjscheider, \c!conversie=\@@kjconversie]% \definieernummer % \doorlabelen @@ -620,7 +624,7 @@ \c!breedte,\c!kopletter,\c!kopkleur,\c!letter,\c!kleur, \c!tekstletter,\c!tekstkleur, \c!uitlijnen,\c!nummer,\c!wijze,\c!blokwijze, - \c!sectienummer,\c!scheider,\c!conversie]% + \c!sectienummer,\c!scheider,\c!afstand,\c!conversie]% \definieernummer[#1][#3]% \presetlabeltext[#1=\labeltext{#3}]% \dodefinefloatcommands[#1][#2]} @@ -1141,7 +1145,7 @@ {\doattributes{\??kj#1}\c!kopletter\c!kopkleur {\labeltexts{#1}{\preparednumber}}% \doattributes{\??kj#1}\c!tekstletter\c!tekstkleur - {\tfskip#3}}}% + {\dotfskip\@@kjkjafstand#3}}}% \fi} \def\placefloatcaptiontext [#1]{\getvalue{@fl@t@#1}} @@ -1173,7 +1177,8 @@ \hbox{\doattributes{\??kj#1}\c!kopletter\c!kopkleur{\strut#2\floatcaptionsuffix}}% \ifnofloatcaption \else \ifemptyfloatcaption \else \ifcase#4\relax - \tfskip\emergencystretch.5em + \scratchskip\@@kjkjafstand\relax + \dotfskip\scratchskip\emergencystretch.5\scratchskip \else \ifx\@@kjkjtussen\empty\else\unskip\@@kjkjtussen\fi \fi @@ -1194,6 +1199,38 @@ %\stelblokkopjesin[\c!uitlijnen=\v!links] %\stelblokkopjesin[\c!uitlijnen=\v!rechts] +% \def\dosetpagfloat#1#2#3#4% \copy wegwerken +% {\bgroup +% \setlocalfloathsize +% \forgetall +% \postponefootnotes +% \mindermeldingen +% \setbox\tempfloatbox\vbox{\borderedfloatbox{#4}}% +% \def\locatefloat{\doregelplaats\@@flflplaats}% +% \ifnofloatcaption +% \dopreparenocaption{#1}{#2}{#3}{#4} +% \edef\width{\the\wd\floatbox}% +% \else +% \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 +% \fi +% \doglobal\addlocalbackgroundtobox\floatbox +% \postcenterfloatbox\width +% \egroup} + \def\dosetpagfloat#1#2#3#4% \copy wegwerken {\bgroup \setlocalfloathsize @@ -1205,6 +1242,7 @@ \ifnofloatcaption \dopreparenocaption{#1}{#2}{#3}{#4} \edef\width{\the\wd\floatbox}% +\doglobal\addlocalbackgroundtobox\floatbox \else \setbox\tempcaptionbox\hbox {\footnotesenabledfalse\putcompletecaption{#4}{#2}{#3}{0}}% @@ -1220,9 +1258,11 @@ \dopreparestackcaptionmin{#1}{#2}{#3}{#4}% \fi}}% \edef\width{\the\wd\tempfloatbox}% - \buildfloatbox +\doglobal\addlocalbackgroundtobox\tempfloatbox +\doglobal\addlocalbackgroundtobox\tempcaptionbox + \buildfloatbox \fi - \doglobal\addlocalbackgroundtobox\floatbox +% \doglobal\addlocalbackgroundtobox\floatbox \postcenterfloatbox\width \egroup} @@ -1349,7 +1389,7 @@ \v!hoog=>\locatefloat {\doifelse\@@flflplaats\v!links {\box\tempfloatbox - \tfskip + \dotfskip\@@kjkjafstand \vbox to\ht\tempfloatbox{\@@kjkjtussen\box\tempcaptionbox\vfill}} {\vbox to\ht\tempfloatbox{\@@kjkjtussen\box\tempcaptionbox\vfill}% \tfskip @@ -1357,20 +1397,20 @@ \v!laag=>\locatefloat {\doifelse\@@flflplaats\v!links {\box\tempfloatbox - \tfskip + \dotfskip\@@kjkjafstand \vbox to\ht\tempfloatbox {\vfill\box\tempcaptionbox\@@kjkjtussen}} {\vbox to\ht\tempfloatbox {\vfill\box\tempcaptionbox\@@kjkjtussen}% - \tfskip + \dotfskip\@@kjkjafstand \box\tempfloatbox}}, \v!midden=>\locatefloat {\doifelse\@@flflplaats\v!links {\box\tempfloatbox - \tfskip + \dotfskip\@@kjkjafstand \vbox to\ht\tempfloatbox{\vfill\box\tempcaptionbox\vfill}} {\vbox to\ht\tempfloatbox{\vfill\box\tempcaptionbox\vfill}% - \tfskip + \dotfskip\@@kjkjafstand \box\tempfloatbox}}, \s!unknown=>\locatefloat{\box\tempfloatbox}, \v!geen=>\locatefloat{\box\tempfloatbox}]}} @@ -1459,42 +1499,82 @@ \box\floatbox \ifdone\hskip\effectiverightskip\fi\hss}} +% \def\dosetparfloat#1#2#3#4% +% {\bgroup +% \forgetall +% \postponefootnotes +% \mindermeldingen +% %\showcomposition +% \setbox4\vbox{\borderedfloatbox{#4}}% +% \ifnofloatcaption +% \global\setbox\floatbox\vbox{\box4}% +% \else +% \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]}% +% \fi +% \doglobal\addlocalbackgroundtobox\floatbox +% \egroup} + \def\dosetparfloat#1#2#3#4% {\bgroup \forgetall \postponefootnotes \mindermeldingen %\showcomposition - \setbox4\vbox{\borderedfloatbox{#4}}% + \setbox\tempfloatbox\vbox{\borderedfloatbox{#4}}% +\doglobal\addlocalbackgroundtobox\tempfloatbox \ifnofloatcaption - \global\setbox\floatbox\vbox{\box4}% + \global\setbox\floatbox\vbox{\box\tempfloatbox}% \else - \setbox2\hbox + \setbox\tempcaptionbox\hbox {\forgetall\putcompletecaption{#4}{#2}{#3}{0}}% \doifelse\@@kjkjbreedte\v!max {\dosetraggedvbox\@@kjkjuitlijnen - \setbox2\raggedbox - {\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}}% + \setbox\tempcaptionbox\raggedbox + {\hsize\wd\tempfloatbox\putcompletecaption{#4}{#2}{#3}{0}}}% {\doifelse\@@kjkjbreedte\v!passend - {\ifdim\wd2>\wd4\relax - \setbox2\vbox - {\forgetall\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}% + {\ifdim\wd\tempcaptionbox>\wd\tempfloatbox\relax + \setbox\tempcaptionbox\vbox + {\forgetall\hsize\wd\tempfloatbox\putcompletecaption{#4}{#2}{#3}{0}}% \else - \setbox2\hbox to \wd4 - {\hss\box2\hss}% + \setbox\tempcaptionbox\hbox to \wd\tempfloatbox + {\hss\box\tempcaptionbox\hss}% \fi} {\dosetraggedvbox\@@kjkjuitlijnen - \setbox2\raggedbox - {\hsize\wd4\putcompletecaption{#4}{#2}{#3}{0}}}}% + \setbox\tempcaptionbox\raggedbox + {\hsize\wd\tempfloatbox\putcompletecaption{#4}{#2}{#3}{0}}}}% +\doglobal\addlocalbackgroundtobox\tempcaptionbox \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]}% + [ \v!boven=>\box\tempcaptionbox\endgraf\@@kjkjtussen\box\tempfloatbox, + \v!onder=>\box\tempfloatbox\endgraf\@@kjkjtussen\box\tempcaptionbox, + \v!geen=>\box\tempfloatbox, + \s!unknown=>\box\tempfloatbox\endgraf\@@kjkjtussen\box\tempcaptionbox]}% \fi - \doglobal\addlocalbackgroundtobox\floatbox +% \doglobal\addlocalbackgroundtobox\floatbox \egroup} \newif\ifparfloat @@ -1504,6 +1584,7 @@ \par \edef\@@kjkjbreedte {\getvalue{\??kj#4\c!breedte }}% \def\@@kjkjtussen {\getvalue{\??kj#4\c!tussen }}% no \edef + \edef\@@kjkjafstand {\getvalue{\??kj#4\c!afstand }}% \edef\@@kjkjplaats {\getvalue{\??kj#4\c!plaats }}% \edef\@@kjkjuitlijnen{\getvalue{\??kj#4\c!uitlijnen}}% \edef\@@flflplaats {\getvalue{\??fl#4\c!plaats }}% @@ -2030,6 +2111,7 @@ \c!blokwijze=\@@nrblokwijze, \c!sectienummer=\@@nrsectienummer, \c!scheider=\@@koscheider, + \c!afstand=1em, \c!conversie=\v!cijfers] \stelplaatsblokkenin diff --git a/tex/context/base/page-mar.tex b/tex/context/base/page-mar.tex index f12a2a318..5109446b1 100644 --- a/tex/context/base/page-mar.tex +++ b/tex/context/base/page-mar.tex @@ -264,19 +264,29 @@ \newcounter\margincontent -\def\flushmargincontent% [#1][#2]#3% hier plaats 'globaal' (geen 1,2 enz) +\def\doflushmargincontent % [#1][#2]#3% hier plaats 'globaal' (geen 1,2 enz) {\doinmarge[\@@implaats][\doinlinker][\doinrechter]} % [#1][#2]{#3}} \newdimen\marginheight \let\restoreinterlinepenalty=\relax -\def\flushmargincontents +\def\flushmargincontents % plural {\restoreinterlinepenalty % here? \ifcase\margincontent\else % called quite often, so we \expandafter\doflushmargincontents % speed up the \fi scan by \fi} % using a \do.. +% for a manual flush in for instance headers + +\def\placemargintexts % to be documented and translated + {\ifcase\margincontent\else + \bgroup + \let\normalvadjust\fakedvadjust + \doflushmargincontents + \egroup + \fi} + % \def\doflushmargincontents% % links + rechts % {\bgroup % \forgetall @@ -323,7 +333,7 @@ \edef\margetekstscheider{\getvalue{\??im\recurselevel\c!scheider}}% \let\margetekstnummer\recurselevel \getvalue{\??im\recurselevel}% - \global\setvalue{\??im\recurselevel}{}% + \letgvalue{\??im\recurselevel}\empty \egroup}% \ifbinnenkolommen \donetrue % how fuzzy @@ -359,7 +369,7 @@ \def\docomplexmargewoord#1#2#3% {\@EA\setgvalue\@EA{\@EA\??im\@EA\margincontent\@EA}\@EA {\@EA\stelinmargein\@EA[\margincontent][]% see next macro - \flushmargincontent[#1][#2]{#3}}} + \doflushmargincontent[#1][#2]{#3}}} \def\complexmargewoord[#1][#2]#3% {\doglobal\increment\margincontent @@ -381,7 +391,7 @@ \stelinmargein[#1][]% when at outer level, saves local settings \setgvalue{\??im#1}% {\stelinmargein[#1][]% needed when par start outside group - \flushmargincontent[][]{#2}}} + \doflushmargincontent[][]{#2}}} \def\margewoord% {\dodoubleempty\complexmargewoord} diff --git a/tex/context/base/page-sid.tex b/tex/context/base/page-sid.tex index 286ffacec..b0919842f 100644 --- a/tex/context/base/page-sid.tex +++ b/tex/context/base/page-sid.tex @@ -378,6 +378,8 @@ \or % depth \advance\scratchdimen\lineheight \advance\scratchdimen\strutdepth + \or % grid + % experimental, see cont-loc \fi \vbox{\vskip\scratchdimen\nointerlineskip#1}% \ifrightfloat\kern\sidefloatshift\fi diff --git a/tex/context/base/s-abr-01.tex b/tex/context/base/s-abr-01.tex index bc9414d50..deed0a7f5 100644 --- a/tex/context/base/s-abr-01.tex +++ b/tex/context/base/s-abr-01.tex @@ -54,6 +54,11 @@ \logo [EMACS] {emacs} \logo [EMTEX] {em\TeX} \logo [EPS] {eps} +\logo [EXAMPLEX] {examplex} +\logo [EXAMPLET] {examplet} +\logo [EXAMPLER] {exampler} +\logo [EXAMPLEQ] {exampleq} +\logo [EXAMPLED] {exampled} \logo [EXAMPLE] {eXaMpLe} \logo [EXIMPLE] {eXiMpLe} \logo [ETEX] {\eTeX} @@ -75,6 +80,7 @@ \logo [HTTP] {http} \logo [HTML] {html} \logo [IBM] {ibm} +\logo [IMAGEMAGICK]{ImageMagick} \logo [INRSTEX] {inrs\TeX} \logo [IRCNET] {IRCnet} \logo [JAVASCRIPT] {Java\-Script} @@ -123,6 +129,7 @@ \logo [PRIFIL] {prifil} \logo [PSCHECK] {pscheck} \logo [PSTOPAGE] {pstopage} +\logo [PSTOPDF] {pstopdf} \logo [PSTRICKS] {pstricks} \logo [PSTOEDIT] {pstoedit} \logo [PS] {Post\-Script} diff --git a/tex/context/base/s-pre-50.tex b/tex/context/base/s-pre-50.tex index 80c351a0d..49a206fd7 100644 --- a/tex/context/base/s-pre-50.tex +++ b/tex/context/base/s-pre-50.tex @@ -25,37 +25,6 @@ %D texexec --pdf --mode=demo s-pre-50 %D \stoptypen -%D Hack. This will move to the kernel. - -\ifx\nofshipouts\undefined - - \newcount\nofshipouts - - \appendtoks - \global\advance\nofshipouts\plusone - \to \everyaftershipout - - \def\cwriteutility#1% - {\write\uti{\noexpand\checkedutility{\number\nofshipouts}{#1}}} - - \def\cwriteutilitycommand#1% - {\write\uti{\noexpand\checkedutility{\number\nofshipouts}{c \string#1}}} - - \let\checkedutility\secondoftwoarguments - - \def\docheckedutility#1#2{\ifnum#1=\nofshipouts#2\fi} - - \prependtoks - \let\checkedutility\docheckedutility - \to \everybeforeshipout - - \def\checkutilities - {\let\writeutility \cwriteutility - \let\writeutilitycommand\cwriteutilitycommand - \let\checkutilities \relax} - -\fi - % Basic definitions. \defineframedtext @@ -90,7 +59,7 @@ \stopmode -%D Structure. +%D Structure and trick. \def\StartSteps {\checkutilities} @@ -114,9 +83,7 @@ \doifnotmode{demo}{\endinput} -\setupcolors[state=start] -\setuppapersize[S6][S6] -\setuplayout[middle] +\setupcolors[state=start] \setuppapersize[S6][S6] \setuplayout[middle] \starttext diff --git a/tex/context/base/setupb.tex b/tex/context/base/setupb.tex index 3096670a5..f407f3c4f 100644 --- a/tex/context/base/setupb.tex +++ b/tex/context/base/setupb.tex @@ -3677,6 +3677,10 @@ [\c!scheider] [\c!text!] [.] + \variable + [\c!afstand] + [\c!dimension!] + [1em] \stopsetup \startsetup @@ -5076,6 +5080,10 @@ [\c!expansie] [\v!ja,\v!commando,\v!nee] [\v!nee] + \variable + [\c!margetekst] + [\v!ja,\v!nee] + [\v!ja] \inheritvariables [\y!stelkoppenin] [] @@ -5840,7 +5848,7 @@ \value [\c!repeat!\v!klein,\c!repeat!\v!middel,\c!repeat!\v!groot, \v!geenwit,\v!back,\v!wit,\v!blokkeer,\v!forceer,\v!reset, - \v!regel,\v!halveregel,\v!formule,\v!vast,\v!flexibel] + \v!regel,\v!halveregel,\v!formule,\v!vast,\v!flexibel,\v!geen] [\v!groot] \stopsetup diff --git a/tex/context/base/supp-box.tex b/tex/context/base/supp-box.tex index 243add4bd..b32274f38 100644 --- a/tex/context/base/supp-box.tex +++ b/tex/context/base/supp-box.tex @@ -1882,11 +1882,11 @@ % %D % %D \leavevmode\haalbuffer % -% \def\dohspread% +% \def\dohspread % {\flushnextbox % \def\dohspread{\hfil\flushnextbox}} % -% \def\starthspread% +% \def\starthspread % {\normalhbox to \hsize \bgroup % \let\stophspread\egroup % \processboxes\dohspread} @@ -2216,7 +2216,7 @@ \let\bottomrightbox\rightbottombox \def\middlebox#1% - {\normalhbox{\setbox0=\placedbox{#1}\boxoffset=-.5\wd0\rightbox{\box0}}} + {\normalhbox{\setbox0\placedbox{#1}\boxoffset=-.5\wd0\rightbox{\box0}}} %D \macros %D {initializeboxstack,savebox,foundbox} diff --git a/tex/context/base/supp-ran.tex b/tex/context/base/supp-ran.tex index 43aff0ed7..06875fca9 100644 --- a/tex/context/base/supp-ran.tex +++ b/tex/context/base/supp-ran.tex @@ -56,8 +56,8 @@ \ifx\nextrandom\undefined - \def\setrannum#1#2#3{#1=1 } - \def\setrandim#1#2#3{#1=1pt} + \def\setrannum#1#2#3{#1\plusone} + \def\setrandim#1#2#3{#1\onepoint} \else @@ -72,7 +72,7 @@ \verynormalnextrandom \egroup} - \chardef\randomseedfrozen=0 + \chardef\randomseedfrozen\zerocount \def\nextrandom {\bgroup @@ -81,17 +81,17 @@ {\ifcase\randomseedfrozen\normalnextrandom\fi}% \egroup} - % avoid scratch dimens 0 and 2 - - \unprotect - - \def\setrandim#1#2#3% dimen register, minimum length, maximum length - {\scratchdimen#2\edef\!!stringa{\number\scratchdimen}% - \scratchdimen#3\edef\!!stringb{\number\scratchdimen}% - \setrannum\ranval\!!stringa\!!stringb - #1\ranval sp\relax} - - \protect + % avoid scratch dimens 0 and 2 (already recoded in third-ran + % + % \unprotect + % + % \def\setrandim#1#2#3% dimen register, minimum length, maximum length + % {\scratchdimen#2\edef\!!stringa{\number\scratchdimen}% + % \scratchdimen#3\edef\!!stringb{\number\scratchdimen}% + % \setrannum\ranval\!!stringa\!!stringb + % #1\ranval\s!sp\relax} + % + % \protect \fi @@ -109,15 +109,15 @@ \let\getrandomdimen = \setrandim \def\getrandomnumber#1#2#3% - {\getrandomcount{\scratchcounter}{#2}{#3}% + {\getrandomcount\scratchcounter{#2}{#3}% \edef#1{\the\scratchcounter}} \def\getrandomfloat#1#2#3% - {\getrandomdimen{\scratchdimen}{#2pt}{#3pt}% + {\getrandomdimen\scratchdimen{#2\s!pt}{#3\s!pt}% \edef#1{\withoutpt\the\scratchdimen}} \unexpanded \def\setrandomseed#1% - {\randomi=#1\relax} + {\randomi#1\relax} \unexpanded \def\getrandomseed#1% {\edef#1{\number\randomi}} diff --git a/tex/context/base/thrd-ran.tex b/tex/context/base/thrd-ran.tex index 9dd509492..ea19c7a20 100644 --- a/tex/context/base/thrd-ran.tex +++ b/tex/context/base/thrd-ran.tex @@ -1,6 +1,9 @@ % Since we cannot be sure that this file is available at any % system, we have copied the original in this file. These % macros are encapsulates and extended in supp-ran.tex. +% +% This module is slightly recoded to bring it more in tune +% with \CONTEXT's scratch registers and protection mechanisms. % RANDOM.TEX v.1 (Donald Arseneau) % Generating "random" numbers in TeX. @@ -39,66 +42,127 @@ % reduce the complexity of the macros a bit, but not much--most of the % code deals with initialization and type-conversion. On the other hand, % the large range may be wasted due to the sparse seed initialization. + +% original code +% +% \newcount\randomi % the random number seed (while executing) +% \global\randomi\catcode`\@ % scratch variable during definitions +% \catcode`\@=11 +% +% \def\nextrandom{\begingroup +% \ifnum\randomi<\@ne % then initialize with time +% \global\randomi\time +% \global\multiply\randomi388 \global\advance\randomi\year +% \global\multiply\randomi31 \global\advance\randomi\day +% \global\multiply\randomi97 \global\advance\randomi\month +% \message{Randomizer initialized to \the\randomi.}% +% \nextrandom \nextrandom \nextrandom +% \fi +% \count@ii\randomi +% \divide\count@ii 127773 % modulus = multiplier * 127773 + 2836 +% \count@\count@ii +% \multiply\count@ii 127773 +% \global\advance\randomi-\count@ii % random mod 127773 +% \global\multiply\randomi 16807 +% \multiply\count@ 2836 +% \global\advance\randomi-\count@ +% \ifnum\randomi<\z@ \global\advance\randomi 2147483647\relax\fi +% \endgroup +% } +% +% \countdef\count@ii=2 % use only in boxes! +% \ifx\@tempcnta\undefined \csname newcount\endcsname \@tempcnta \fi +% \ifx\@tempcntb\undefined \csname newcount\endcsname \@tempcntb \fi +% +% \def\setrannum#1#2#3{% count register, minimum, maximum +% \@tempcnta#3\advance\@tempcnta-#2\advance\@tempcnta\@ne +% \@tempcntb 2147483645 % = m - 2 = 2^{31} - 3 +% \divide\@tempcntb\@tempcnta +% \getr@nval +% \advance\ranval#2\relax +% #1\ranval +% } +% +% \def\setrandim#1#2#3{% dimen register, minimum length, maximum length +% \dimen@#2\dimen@ii#3\relax +% \setrannum\ranval\dimen@\dimen@ii +% #1\ranval sp\relax +% } +% +% \def\getr@nval{% The values in \@tempcnta and \@tempcntb are parameters +% \nextrandom +% \ranval\randomi \advance\ranval\m@ne \divide\ranval\@tempcntb +% \ifnum\ranval<\@tempcnta\else \expandafter\getr@nval \fi +% } +% +% %D The next macro is not needed in \CONTEXT, which provides +% %D the \type {\withoutpt} macro. +% %D +% %D \starttypen +% %D \def\pointless{\expandafter\PoinTless\the} +% %D {\catcode`p=12 \catcode`t=12 \gdef\PoinTless#1pt{#1}} +% %D \stoptypen +% +% \catcode`\@=\randomi +% \global\randomi=0 +% \newcount\ranval + +% the recoded version, using \CONTEXT\ methods and variables; +% the magic is kept untouched + +\unprotect \newcount\randomi % the random number seed (while executing) -\global\randomi\catcode`\@ % scratch variable during definitions -\catcode`\@=11 +\newcount\ranval -\def\nextrandom{\begingroup - \ifnum\randomi<\@ne % then initialize with time - \global\randomi\time - \global\multiply\randomi388 \global\advance\randomi\year - \global\multiply\randomi31 \global\advance\randomi\day - \global\multiply\randomi97 \global\advance\randomi\month - \message{Randomizer initialized to \the\randomi.}% - \nextrandom \nextrandom \nextrandom - \fi - \count@ii\randomi - \divide\count@ii 127773 % modulus = multiplier * 127773 + 2836 - \count@\count@ii - \multiply\count@ii 127773 - \global\advance\randomi-\count@ii % random mod 127773 - \global\multiply\randomi 16807 - \multiply\count@ 2836 - \global\advance\randomi-\count@ - \ifnum\randomi<\z@ \global\advance\randomi 2147483647\relax\fi - \endgroup -} +\ifx\m!systems\undefined \def\m!systems{system} \fi -\countdef\count@ii=2 % use only in boxes! -\ifx\@tempcnta\undefined \csname newcount\endcsname \@tempcnta \fi -\ifx\@tempcntb\undefined \csname newcount\endcsname \@tempcntb \fi +\def\nextrandom + {\begingroup + \ifnum\randomi<\plusone % then initialize with time + \global\randomi\time + \global\multiply\randomi388 \global\advance\randomi\year + \global\multiply\randomi 31 \global\advance\randomi\day + \global\multiply\randomi 97 \global\advance\randomi\month + \writestatus\m!systems{randomizer starts with \the\randomi}% + \nextrandom \nextrandom \nextrandom + \fi + \!!countd\randomi + \divide\!!countd 127773 % modulus = multiplier * 127773 + 2836 + \!!countc\!!countd + \multiply\!!countd 127773 + \global\advance\randomi-\!!countd % random mod 127773 + \global\multiply\randomi 16807 + \multiply\!!countc 2836 + \global\advance\randomi-\!!countc + \ifnum\randomi<\zerocount + \global\advance\randomi 2147483647 + \fi + \endgroup} -\def\setrannum#1#2#3{% count register, minimum, maximum - \@tempcnta#3\advance\@tempcnta-#2\advance\@tempcnta\@ne - \@tempcntb 2147483645 % = m - 2 = 2^{31} - 3 - \divide\@tempcntb\@tempcnta - \getr@nval - \advance\ranval#2\relax - #1\ranval -} +\def\setrannum#1#2#3% count register, minimum, maximum + {\!!counta#3% + \advance\!!counta-#2% + \advance\!!counta\plusone + \!!countb 2147483645 % = m - 2 = 2^{31} - 3 + \divide\!!countb\!!counta + \getr@nval + \advance\ranval#2% + #1\ranval} -\def\setrandim#1#2#3{% dimen register, minimum length, maximum length - \dimen@#2\dimen@ii#3\relax - \setrannum\ranval\dimen@\dimen@ii - #1\ranval sp\relax -} +\def\setrandim#1#2#3% dimen register, minimum length, maximum length + {\!!dimenc#2% + \!!dimend#3% + \setrannum\ranval\!!dimenc\!!dimend + #1\ranval\s!sp\relax} -\def\getr@nval{% The values in \@tempcnta and \@tempcntb are parameters - \nextrandom - \ranval\randomi \advance\ranval\m@ne \divide\ranval\@tempcntb - \ifnum\ranval<\@tempcnta\else \expandafter\getr@nval \fi -} +\def\getr@nval % The values in \!!counta and \!!countb are parameters + {\nextrandom + \ranval\randomi + \advance\ranval\minusone + \divide\ranval\!!countb + \ifnum\ranval<\!!counta \else + \expandafter\getr@nval + \fi} -%D The next macro is not needed in \CONTEXT, which provides -%D the \type {\withoutpt} macro. -%D -%D \starttypen -%D \def\pointless{\expandafter\PoinTless\the} -%D {\catcode`p=12 \catcode`t=12 -%D \gdef\PoinTless#1pt{#1}} -%D \stoptypen - -\catcode`\@=\randomi -\global\randomi=0 -\newcount\ranval +\protect \endinput diff --git a/tex/context/base/x-res-08.tex b/tex/context/base/x-res-08.tex new file mode 100644 index 000000000..0eb315a7b --- /dev/null +++ b/tex/context/base/x-res-08.tex @@ -0,0 +1,95 @@ +%D \module +%D [ file=x-fig-08, +%D version=2002.06.27, +%D title=\CONTEXT\ Style File, +%D subtitle=Resource Reporting, +%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 Experimental module! +%D +%D \starttyping +%D <rl:library> +%D <rl:usage> +%D <rl:type>figure<rr:type> +%D <rl:state>found|missing<rr:state> +%D <rl:name>filename<rr:name> +%D <rl:suffix>filesuffix<rr:suffix> +%D <rl:width>width in pt<rr:width> +%D <rl:height>height in pt<rr:height> +%D </rl:usage> +%D <rl:library> +%D \stoptyping + +\unprotect + +\def\XMLrlprefix{rl:} + +\newwrite\XMLrllog + +\def\openXMLresourcelog + {%\global\let\openXMLresourcelog\relax + \immediate\openout\XMLrllog\jobname.rlg\relax + \immediate\write\XMLrllog{\writtenXMLstart{\XMLrlprefix library}}} + +\def\closeXMLresourcelog + {%\global\let\closeXMLresourcelog\relax + \immediate\write\XMLrllog{\writtenXMLend{\XMLrlprefix library}}% + \immediate\closeout\XMLrllog} + +\let\figurefilelabel \empty +\let\figurefileoriginal\empty +\let\figurefilefile \empty + +\def\XMLfeedbackresource#1#2% + {\immediate\write\XMLrllog + {\writtenXMLelement{\XMLrlprefix usage}% + {\writtenXMLelement{\XMLrlprefix type}{#2}% + \writtenXMLelement{\XMLrlprefix state}{#1}% + \ifx\figurefilelabel\empty + \ifx\figurelabel\s!dummy + % label equals filename + \else + \writtenXMLelement{\XMLrlprefix label}{\figurelabel}% + \fi + \writtenXMLelement{\XMLrlprefix file}{\figurefilename}% + \ifx\figurefiletype\empty\else + \writtenXMLelement{\XMLrlprefix suffix}{\figurefiletype}% + \fi + \else + % \figurefilelabel is set in x-res-04 and since + % we fetch from this base using the normal + % \externalfigure macro, the label becomes the + % name of the figurebase + \writtenXMLelement{\XMLrlprefix base}{\figurefilename}% + \writtenXMLelement{\XMLrlprefix label}{\figurefilelabel}% +\ifx\figurefilefile\empty\else + \writtenXMLelement{\XMLrlprefix file}{\figurefilefile}% +\fi +\ifx\figurefileoriginal\empty\else + \writtenXMLelement{\XMLrlprefix original}{\figurefileoriginal}% +\fi + \fi + \ifnum\figurefilepage>\zerocount + \writtenXMLelement{\XMLrlprefix page}{\figurefilepage}% + \fi + \writtenXMLelement{\XMLrlprefix width}{\figurewidth}% + \writtenXMLelement{\XMLrlprefix height}{\figureheight}}}} + +\def\XMLfeedbackexternalfigure + {\doifmodeelse{*\v!figuur}% + {\XMLfeedbackresource{found}}% + {\XMLfeedbackresource{missing}}% + {figure}} + +\appendtoks \openXMLresourcelog \to \everystarttext +\appendtoks \closeXMLresourcelog \to \everystoptext + +\let \feedbackexternalfigure \XMLfeedbackexternalfigure + +\protect \endinput diff --git a/tex/context/base/x-res-09.tex b/tex/context/base/x-res-09.tex new file mode 100644 index 000000000..8b6421b47 --- /dev/null +++ b/tex/context/base/x-res-09.tex @@ -0,0 +1,55 @@ +%D \module +%D [ file=x-fig-09, +%D version=2002.06.27, +%D title=\CONTEXT\ Style File, +%D subtitle=Resource Reporting (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. + +\usemodule[res-00] + +\defineXMLenvironment [rl:library] + {\starttext} + {\stoptext} + +\defineXMLenvironment [rl:usage] + {\bgroup} + {\setups[rl usage]\egroup} + +\defineXMLsave [rl:type] % figure +\defineXMLsave [rl:state] % found|missing +\defineXMLsave [rl:file] % filename +\defineXMLsave [rl:suffix] % filesuffix +\defineXMLsave [rl:width] % width in pt +\defineXMLsave [rl:height] % height in pt +\defineXMLsave [rl:page] % page from file + +\def\XMLbpentry#1% + {\PointsToWholeBigPoints{\XMLflush{#1}}\temp\temp bp} + +\def\XMLrlentry#1#2#3% + {\doiftext{\XMLflush{#2}} + {\NC\bf#1\NC\XMLflush{#2}\doif{#3}{1}{ (\XMLbpentry{#2})}\NC\NR}% + \ignorespaces} + +\startsetups[rl usage] + +\starttabulate +\XMLrlentry {type} {rl:type} {0} +\XMLrlentry {state} {rl:state} {0} +\XMLrlentry {file} {rl:file} {0} +\XMLrlentry {name} {rl:name} {0} +\XMLrlentry {suffix} {rl:suffix} {0} +\XMLrlentry {page} {rl:page} {0} +\XMLrlentry {width} {rl:width} {1} +\XMLrlentry {height} {rl:height} {1} +\stoptabulate + +\stopsetups + +\endinput |