diff options
78 files changed, 3115 insertions, 1876 deletions
diff --git a/context/data/cont-cz.tws b/context/data/cont-cz.tws index fe91a1b4e..1fa2335e6 100644 --- a/context/data/cont-cz.tws +++ b/context/data/cont-cz.tws @@ -1334,6 +1334,7 @@ var:pred:*prikaz:: var:mezi:*prikaz:: var:po:*prikaz:: var:odsadpristi:ano,ne:: +var:odsazovani:nikdy,ne,ne,ano,vzdy,prvni,dalsi:: stopsetup startsetup @@ -1355,6 +1356,7 @@ var:zpusobpropojeni:globalne,lokalne:: var:cislo:ne,*jmeno:: var:zarovnejtitul:ne,ano:: var:start:*cislo:: +ivr:nastavvycty:: stopsetup startsetup @@ -1838,6 +1840,7 @@ var:nvrsek:*cislo:: var:nspodek:*cislo:: var:nradky:*cislo:: var:implicitni:*jmeno:: +var:tolerance:0,1,2:: var:vzdalenostlevehookraje:*dimenze:: var:vzdalenostpravehookraje:*dimenze:: var:sidealign:normalni,radek:: @@ -2969,7 +2972,7 @@ stopsetup startsetup com:umisti<<plvouciobjekt>>: typ:val/refs/arg/arg/: -val:vlevo,vpravo,zde,vrsek,spodek, vlevo,vpravo,naokraji,marginalie, levyokraj,pravyokraj,levahrana,pravahrana, innermargin,outermargin,inneredge,outeredge, uvnitr,vnejsi,regel,vysoko,nizko,prizpusobive, stranka,naproti,vzdy,sila,vysoko:zde: +val:vlevo,vpravo,zde,vrsek,spodek, vlevo,vpravo,naokraji,marginalie, levyokraj,pravyokraj,levahrana,pravahrana, innermargin,outermargin,inneredge,outeredge, uvnitr,vnejsi,regel,vysoko,nizko,prizpusobive, stranka,naproti,vzdy,sila,vysoko,reset, radek,vyska,podlehloubky:zde: val:*text:: val:*text:: stopsetup diff --git a/context/data/cont-de.tws b/context/data/cont-de.tws index 73219cd14..dbbc29535 100644 --- a/context/data/cont-de.tws +++ b/context/data/cont-de.tws @@ -1334,6 +1334,7 @@ var:vor:*Befehl:: var:zwischen:*Befehl:: var:nach:*Befehl:: var:ziehefolgendeein:ja,nein:: +var:einziehen:nie,nicht,nein,ja,immer,erste,folgende:: stopsetup startsetup @@ -1355,6 +1356,7 @@ var:verkopplungsart:global,lokal:: var:nummer:nein,*Name:: var:titelausrichten:nein,ja:: var:start:*Nummer:: +ivr:stellebeschreibungein:: stopsetup startsetup @@ -1838,6 +1840,7 @@ var:noben:*Nummer:: var:nunten:*Nummer:: var:zzeile:*Nummer:: var:default:*Name:: +var:toleranz:0,1,2:: var:linkerrandabstand:*Dimension:: var:rechterrandabstand:*Dimension:: var:sidealign:normal,zeile:: @@ -2969,7 +2972,7 @@ stopsetup startsetup com:platziere<<gleitobjekt>>: typ:val/refs/arg/arg/: -val:links,rechts,hier,oben,unten, imlinken,imrechten,imrand,marginalie, linkerrand,rechterrand,linkekante,rechterkante, innermargin,outermargin,inneredge,outeredge, innen,aussen,regel,hoch,tief,passend, seite,gegenueber,immer,zwinge,lang:hier: +val:links,rechts,hier,oben,unten, imlinken,imrechten,imrand,marginalie, linkerrand,rechterrand,linkekante,rechterkante, innermargin,outermargin,inneredge,outeredge, innen,aussen,regel,hoch,tief,passend, seite,gegenueber,immer,zwinge,lang,zuruecksetzten, zeile,hoehe,tiefe:hier: val:*Text:: val:*Text:: stopsetup diff --git a/context/data/cont-en.tws b/context/data/cont-en.tws index a694dfdc9..a122bfe1f 100644 --- a/context/data/cont-en.tws +++ b/context/data/cont-en.tws @@ -1334,6 +1334,7 @@ var:before:*command:: var:inbetween:*command:: var:after:*command:: var:indentnext:yes,no:: +var:indenting:never,not,no,yes,always,first,next:: stopsetup startsetup @@ -1355,6 +1356,7 @@ var:couplingway:global,local:: var:number:no,*name:: var:aligntitle:no,yes:: var:start:*number:: +ivr:setupenumerations:: stopsetup startsetup @@ -1838,6 +1840,7 @@ var:ntop:*number:: var:nbottom:*number:: var:nlines:*number:: var:default:*name:: +var:tolerance:0,1,2:: var:leftmargindistance:*dimension:: var:rightmargindistance:*dimension:: var:sidealign:normal,line:: @@ -2969,7 +2972,7 @@ stopsetup startsetup com:place<<float>>: typ:val/refs/arg/arg/: -val:left,right,here,top,bottom, inleft,inright,inmargin,margin, leftmargin,rightmargin,leftedge,rightedge, innermargin,outermargin,inneredge,outeredge, inner,outer,regel,high,low,fit, page,opposite,always,force,tall:here: +val:left,right,here,top,bottom, inleft,inright,inmargin,margin, leftmargin,rightmargin,leftedge,rightedge, innermargin,outermargin,inneredge,outeredge, inner,outer,regel,high,low,fit, page,opposite,always,force,tall,reset, line,height,depth:here: val:*text:: val:*text:: stopsetup diff --git a/context/data/cont-it.tws b/context/data/cont-it.tws index e9e121751..cf5b4f872 100644 --- a/context/data/cont-it.tws +++ b/context/data/cont-it.tws @@ -1334,6 +1334,7 @@ var:prima:*comando:: var:tra:*comando:: var:dopo:*comando:: var:rientrasuccessivo:si,no:: +var:rientro:mai,non,no,si,sempre,primo,successivo:: stopsetup startsetup @@ -1355,6 +1356,7 @@ var:modoaccoppiamento:globale,locale:: var:numero:no,*nome:: var:allineatitolo:no,si:: var:inizia:*numero:: +ivr:impostaenumerazioni:: stopsetup startsetup @@ -1838,6 +1840,7 @@ var:ncima:*numero:: var:nfondo:*numero:: var:nrighe:*numero:: var:implicito:*nome:: +var:tolleranza:0,1,2:: var:distanzamarginesinistro:*dimensione:: var:distanzamarginedestro:*dimensione:: var:sidealign:normale,riga:: @@ -2969,7 +2972,7 @@ stopsetup startsetup com:metti<<oggettomobile>>: typ:val/refs/arg/arg/: -val:sinistra,destra,qui,cima,fondo, insinistra,indestra,inmargine,margine, marginesinistro,marginedestro,bordosinistro,bordodestro, margineinterno,margineesterno,bordointerno,bordoesterno, interno,esterno,regel,alto,basso,adatta, pagina,opposto,sempre,forza,alto:qui: +val:sinistra,destra,qui,cima,fondo, insinistra,indestra,inmargine,margine, marginesinistro,marginedestro,bordosinistro,bordodestro, margineinterno,margineesterno,bordointerno,bordoesterno, interno,esterno,regel,alto,basso,adatta, pagina,opposto,sempre,forza,alto,reimposta, riga,altezza,profondita:qui: val:*testo:: val:*testo:: stopsetup diff --git a/context/data/cont-nl.tws b/context/data/cont-nl.tws index 5a479a410..84136850e 100644 --- a/context/data/cont-nl.tws +++ b/context/data/cont-nl.tws @@ -1334,6 +1334,7 @@ var:voor:*commando:: var:tussen:*commando:: var:na:*commando:: var:springvolgendein:ja,nee:: +var:inspringen:nooit,niet,nee,ja,altijd,eerste,volgende:: stopsetup startsetup @@ -1355,6 +1356,7 @@ var:koppelwijze:globaal,lokaal:: var:nummer:nee,*naam:: var:titeluitlijnen:nee,ja:: var:start:*getal:: +ivr:steldoornummerenin:: stopsetup startsetup @@ -1838,6 +1840,7 @@ var:nboven:*getal:: var:nonder:*getal:: var:nregels:*getal:: var:default:*naam:: +var:tolerantie:0,1,2:: var:linkermargeafstand:*maat:: var:rechtermargeafstand:*maat:: var:zijuitlijnen:normaal,regel:: @@ -2969,7 +2972,7 @@ stopsetup startsetup com:plaats<<blok>>: typ:val/refs/arg/arg/: -val:links,rechts,hier,boven,onder, inlinker,inrechter,inmarge,marge, linkermarge,rechtermarge,linkerrand,rechterrand, binnenmarge,buitenmarge,binnenrand,buitenrand, binnen,buiten,regel,hoog,laag,passend, pagina,naast,altijd,forceer,lang:hier: +val:links,rechts,hier,boven,onder, inlinker,inrechter,inmarge,marge, linkermarge,rechtermarge,linkerrand,rechterrand, binnenmarge,buitenmarge,binnenrand,buitenrand, binnen,buiten,regel,hoog,laag,passend, pagina,naast,altijd,forceer,lang,reset, regel,hoogte,diepte:hier: val:*tekst:: val:*tekst:: stopsetup diff --git a/context/data/cont-ro.tws b/context/data/cont-ro.tws index 27dc95bad..e21ed31df 100644 --- a/context/data/cont-ro.tws +++ b/context/data/cont-ro.tws @@ -1334,6 +1334,7 @@ var:inainte:*comanda:: var:intre:*comanda:: var:dupa:*comanda:: var:aliniaturmator:da,nu:: +var:aliniat:niciodata,nu,nu,da,totdeauna,primul,urmatorul:: stopsetup startsetup @@ -1355,6 +1356,7 @@ var:modcuplare:global,local:: var:numar:nu,*nume:: var:alinieretitlu:nu,da:: var:start:*numar:: +ivr:seteazaenumerare:: stopsetup startsetup @@ -1838,6 +1840,7 @@ var:nsus:*numar:: var:njos:*numar:: var:nlinii:*numar:: var:implicit:*nume:: +var:toleranta:0,1,2:: var:distantamarginestanga:*dimensiune:: var:distantamarginedreapta:*dimensiune:: var:sidealign:normal,linie:: @@ -2969,7 +2972,7 @@ stopsetup startsetup com:pune<<obiectmobil>>: typ:val/refs/arg/arg/: -val:stanga,dreapta,aici,sus,subsol, instanga,indreapta,inmargine,margine, marginestanga,marginedreapta,bordurastanga,borduradreapta, innermargin,outermargin,inneredge,outeredge, intern,extern,regel,inalt,jos,ajustat, pagina,opus,totdeauna,fortat,inalt:aici: +val:stanga,dreapta,aici,sus,subsol, instanga,indreapta,inmargine,margine, marginestanga,marginedreapta,bordurastanga,borduradreapta, innermargin,outermargin,inneredge,outeredge, intern,extern,regel,inalt,jos,ajustat, pagina,opus,totdeauna,fortat,inalt,reset, linie,inaltime,adancime:aici: val:*text:: val:*text:: stopsetup diff --git a/context/perltk/texexec.pl b/context/perltk/texexec.pl index e0f66d3ff..f2e2351f3 100644 --- a/context/perltk/texexec.pl +++ b/context/perltk/texexec.pl @@ -1240,25 +1240,28 @@ sub CompareFiles # 2 = tuo else { return 0 } } +#sub CheckPositions +# { return if ($DVIspec eq '') || ($OutputFormat eq 'pdftex') ; +# my $JobName = shift ; my $TuoName = "$JobName.tuo" ; +# if (open(POS,"$TuoName")) +# { seek POS, (-s $TuoName) - 5000, 0 ; +# while (<POS>) +# { if (/\% *position commands *\: *(\d*) *\(unresolved\)/io) +# { if ($1) +# { print " dvi positions : $1 ($DVIspec ." ; +# close (POS) ; +# open(POS,">>$TuoName") ; +# $ENV{uc "$DVIspec.TEXFONTSDIR"} = $TeXFontsPath ; +# print POS "\%\n\% extracted from dvi file by $DVIspec:\n\%\n" ; +# close(POS) ; +# print "." ; +# RunPerlScript ($DVIspec, "$JobName >> $TuoName") ; +# print ".)\n" } +# last } } +# close (POS) } } + sub CheckPositions - { return if ($DVIspec eq '') || ($OutputFormat eq 'pdftex') ; - my $JobName = shift ; my $TuoName = "$JobName.tuo" ; - if (open(POS,"$TuoName")) - { seek POS, (-s $TuoName) - 5000, 0 ; - while (<POS>) - { if (/\% *position commands *\: *(\d*) *\(unresolved\)/io) - { if ($1) - { print " dvi positions : $1 ($DVIspec ." ; - close (POS) ; - open(POS,">>$TuoName") ; - $ENV{uc "$DVIspec.TEXFONTSDIR"} = $TeXFontsPath ; - print POS "\%\n\% extracted from dvi file by $DVIspec:\n\%\n" ; - close(POS) ; - print "." ; - RunPerlScript ($DVIspec, "$JobName >> $TuoName") ; - print ".)\n" } - last } } - close (POS) } } + { } # my @ExtraPrograms = () ; # diff --git a/context/perltk/texutil.pl b/context/perltk/texutil.pl index 3eb529122..dcf627a62 100644 --- a/context/perltk/texutil.pl +++ b/context/perltk/texutil.pl @@ -396,6 +396,7 @@ elsif ($UserInterface eq "de") $MS{"Entries"} = "Eintraege" ; $MS{"References"} = "Referenzen" ; + $MS{"ExtraProgram"} = " extra program :" ; $MS{"PlugInInit"} = " plugin initialized :" ; $MS{"PlugInReport"} = " plugin report :" ; @@ -484,6 +485,7 @@ elsif ($UserInterface eq "it") $MS{"Entries"} = "voci" ; $MS{"References"} = "riferimenti" ; + $MS{"ExtraProgram"} = " extra program :" ; $MS{"PlugInInit"} = " plugin initialized :" ; $MS{"PlugInReport"} = " plugin report :" ; @@ -572,6 +574,7 @@ else $MS{"Entries"} = "entries" ; $MS{"References"} = "references" ; + $MS{"ExtraProgram"} = " extra program :" ; $MS{"PlugInInit"} = " plugin initialized :" ; $MS{"PlugInReport"} = " plugin report :" ; @@ -1007,7 +1010,8 @@ sub FlushExtra sub RunExtraPrograms { foreach $EP (@ExtraPrograms) - { system($EP) } } + { Report ("ExtraProgram", $EP) ; + system($EP) } } #D Plugins #D diff --git a/metapost/context/base/mp-core.mp b/metapost/context/base/mp-core.mp index ad90766f4..fca95859a 100644 --- a/metapost/context/base/mp-core.mp +++ b/metapost/context/base/mp-core.mp @@ -392,21 +392,19 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd, numeric wpos ; wpos := 3 ; initialize_box_pos(wpos,wn,wx,wy,ww,wh,wd) ; numeric ppos ; ppos := 4 ; initialize_box_pos(ppos,pn,px,py,pw,ph,pd) ; -if local_multi_par_area : - RealPageNumber := fn ; - NOfTextAreas := 1 ; - NOfSavedTextAreas := 0 ; - TextAreas[1] := TextAreas[0] ; - TextColumns[1] := TextColumns[0] ; - nxy[fpos] := nxy[tpos] := nxy[wpos] := nxy[ppos] := RealPageNumber ; - -%draw TextColumns[1] withcolor green ; -%draw TextAreas[1] withcolor green ; - -elseif ignore_multi_par_page : - RealPageNumber := fn ; - nxy[fpos] := nxy[tpos] := nxy[wpos] := nxy[ppos] := RealPageNumber ; -fi ; + if local_multi_par_area : + RealPageNumber := fn ; + NOfTextAreas := 1 ; + NOfSavedTextAreas := 0 ; + TextAreas[1] := TextAreas[0] ; + TextColumns[1] := TextColumns[0] ; + nxy[fpos] := nxy[tpos] := nxy[wpos] := nxy[ppos] := RealPageNumber ; + % draw TextColumns[1] withcolor green ; + % draw TextAreas[1] withcolor green ; + elseif ignore_multi_par_page : + RealPageNumber := fn ; + nxy[fpos] := nxy[tpos] := nxy[wpos] := nxy[ppos] := RealPageNumber ; + fi ; numeric par_strut_height, par_strut_depth, par_line_height ; @@ -988,7 +986,7 @@ def draw_box = draw lxy -- rxy withcolor boxlinecolor withpen pencircle scaled boxgridwidth ; enddef ; -def draw_par = % 1 2 11 12 +def draw_par = % 1 2 3 11 12 do_draw_par(pxy) ; do_draw_par(txy) ; do_draw_par(bxy) ; for i = pxy, txy, bxy : if boxgridtype= 1 : @@ -997,6 +995,11 @@ def draw_par = % 1 2 11 12 elseif boxgridtype= 2 : boxgriddirection := origin ; draw baseline_grid (i,boxgriddirection,false) withcolor boxgridcolor ; + elseif boxgridtype= 3 : + boxgriddirection := origin ; + draw baseline_grid (i,boxgriddirection,true ) withcolor boxgridcolor ; + draw baseline_grid (i,boxgriddirection,true ) + shifted (0,ExHeight) withcolor boxgridcolor ; elseif boxgridtype=11 : draw graphic_grid(i,boxgriddistance,boxgriddistance,boxgriddistance/2,boxgriddistance/2) ; elseif boxgridtype=12 : @@ -1024,6 +1027,56 @@ def show_par = draw pref withpen pencircle scaled 2pt ; enddef ; +def sort_multi_pars = + if nofmultipars>1 : + begingroup ; save _p_, _n_ ; path _p_ ; numeric _n_ ; + for i := 1 upto nofmultipars : + if multilocs[i] = 3 : + _p_ := multipars[nofmultipars] ; + multipars[nofmultipars] := multipars[i] ; + multipars[i] := _p_ ; + _n_ := multirefs[nofmultipars] ; + multirefs[nofmultipars] := multirefs[i] ; + multirefs[i] := _n_ ; + _n_ := multilocs[nofmultipars] ; + multilocs[nofmultipars] := multilocs[i] ; + multilocs[i] := _n_ ; + fi ; + endfor ; + endgroup ; + fi ; +enddef ; + +% This collapses successive areas (possibly interrupted by +% floats. First we need to sort the areas, since they are +% normally in de order start, end, inbetween. + +def collapse_multi_pars = + if nofmultipars>1 : + begingroup ; save _nofmultipars_ ; numeric _nofmultipars_ ; + _nofmultipars_ := 1 ; + sort_multi_pars ; % block not in order: 1, 3, 2.... + for i:=1 upto nofmultipars-1 : + if (round(xpart(llcorner multipars[i]-llcorner multipars[i+1]))=0) and + (round(xpart(lrcorner multipars[i]-lrcorner multipars[i+1]))=0) : + multipars[_nofmultipars_] := + multipars[_nofmultipars_] := + ulcorner multipars[_nofmultipars_] -- + urcorner multipars[_nofmultipars_] -- + lrcorner multipars[i+1] -- + llcorner multipars[i+1] -- cycle ; + else : + _nofmultipars_ := _nofmultipars_ + 1 ; + multipars[_nofmultipars_] := multipars[i+1] ; + multilocs[_nofmultipars_] := multilocs[i+1] ; + multirefs[_nofmultipars_] := multirefs[i+1] ; + fi ; + endfor ; + nofmultipars := _nofmultipars_ ; + endgroup ; + fi ; +enddef ; + def draw_multi_pars = for i=1 upto nofmultipars : do_draw_par(multipars[i]) ; @@ -1031,6 +1084,10 @@ def draw_multi_pars = draw baseline_grid (multipars[i],up,true ) withcolor boxgridcolor ; elseif boxgridtype= 2 : draw baseline_grid (multipars[i],up,false) withcolor boxgridcolor ; + elseif boxgridtype= 3 : + draw baseline_grid (multipars[i],up,true ) withcolor boxgridcolor ; + draw baseline_grid (multipars[i],up,true ) + shifted (0,ExHeight) withcolor boxgridcolor ; elseif boxgridtype=11 : draw graphic_grid(multipars[i],boxgriddistance,boxgriddistance,boxgriddistance/2,boxgriddistance/2) ; elseif boxgridtype=12 : diff --git a/tex/context/base/colo-ini.tex b/tex/context/base/colo-ini.tex index b06eedda8..9722c5e2d 100644 --- a/tex/context/base/colo-ini.tex +++ b/tex/context/base/colo-ini.tex @@ -947,7 +947,8 @@ %D Experimental: minimize transparency resets. -\newif\ifintransparent \newif\ifoptimizetransparency +\newif\ifintransparent +\newif\ifoptimizetransparency \optimizetransparencytrue % under test \def\conditionalstoptransparency {\iffilterspotcolor @@ -1163,12 +1164,12 @@ %D in three digits precision. \def\realcolorvalue#1% - {\ifnum#1>0 % important, first encountered in --modu supp-mpe - \ifnum#1<10 0.00\the#1\else - \ifnum#1<100 0.0\the#1\else - \ifnum#1<1000 0.\the#1\else - 1\fi\fi\fi - \else 0\fi} + {\ifnum#1>\zerocount % important, first encountered in --modu supp-mpe + \ifnum#1<\plusten 0.00\the#1\else + \ifnum#1<\plushundred 0.0\the#1\else + \ifnum#1<\plusthousand 0.\the#1\else + 1\fi\fi\fi + \else 0\fi} \def\doconvertCMYKtoRGB#1\k#2\to#3% {\ifdim#2\s!pt>#1\s!pt % >= problem, repaired 2/12/2002 @@ -1177,7 +1178,7 @@ \colordimen1\s!pt \advance\colordimen -#1\s!pt \advance\colordimen -#2\s!pt - \multiply\colordimen \!!thousand\relax % 1000 + \multiply\colordimen \plusthousand \colorcount\colordimen \advance\colorcount \medcard \divide\colorcount \maxcard @@ -1191,12 +1192,12 @@ \def\doconvertRGBtoCMYK#1\to#2% {\colordimen#1\s!pt - \multiply\colordimen \!!thousand\relax % 1000 + \multiply\colordimen \plusthousand \colorcount\colordimen \advance\colorcount \medcard \divide\colorcount \maxcard \colorcount-\colorcount - \advance\colorcount \!!thousand\relax % 1000 + \advance\colorcount \plusthousand \edef#2{\realcolorvalue\colorcount}} \def\convertRGBtoCMYK#1#2#3% @@ -1241,7 +1242,7 @@ %\else % \colordimen\colordimen \fi - \multiply\colordimen \!!thousand\relax % 1000 + \multiply\colordimen \plusthousand \colorcount\colordimen \advance\colorcount \medcard \divide\colorcount \maxcard @@ -1789,10 +1790,10 @@ %D hardly pays off; they are only used in the manual. \def\realcolorformat#1% - {\ifnum#1<10 0.00\the#1\else - \ifnum#1<100 0.0\the#1\else - \ifnum#1<1000 0.\the#1\else - 1.000\fi\fi\fi} + {\ifnum#1<\plusten 0.00\the#1\else + \ifnum#1<\plushundred 0.0\the#1\else + \ifnum#1<\plusthousand 0.\the#1\else + 1.000\fi\fi\fi} \def\colorformatseparator{ } @@ -1801,7 +1802,7 @@ \ifdim\colordimen>1\s!pt \colordimen1\s!pt \fi - \multiply\colordimen 1000 + \multiply\colordimen \plusthousand \colorcount\colordimen \advance\colorcount \medcard \divide\colorcount \maxcard \relax diff --git a/tex/context/base/cont-log.tex b/tex/context/base/cont-log.tex index fc08efb60..e2f61e819 100644 --- a/tex/context/base/cont-log.tex +++ b/tex/context/base/cont-log.tex @@ -32,10 +32,18 @@ \unexpanded\def\CMRkern {\doifCMRfontelse{\kern}{\scratchdimen=}} +% \def\TeX +% {T% +% \kern-.1667em\lower.5ex\hbox{E}% +% \kern-.125emX} + +\def\Mkern#1% + {{\setbox\scratchbox\hbox{M}\kern#1\wd\scratchbox}} + \def\TeX {T% - \kern-.1667em\lower.5ex\hbox{E}% - \kern-.125emX} + \Mkern{-.1667}\lower.5ex\hbox{E}% + \Mkern{-.125}X} \def\ConTeXt {C% diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 3b3b6884a..a9c47af0e 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,156 +11,44 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -% manual : offsetbox alignbox -% todo achtergronden in kolommen - %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new %D features. \unprotect - + \writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!} -\def\dodocomplexplaatsblok[#1][#2][#3]#4% +\def\ejectinsert {\flushnotes - \ifsomefloatwaiting - % this was \checkwaitingfloats spread all over - \doifinsetelse\v!altijd{#2} - {\showmessage\m!floatblocks5\empty} - {\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 % waarschijnlijk gebroken ! ! ! ! - \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 - {\setlocalfloathsize - \fuzzysnappingfalse - \postponefootnotes} % new - {\xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}% ** not yet done - % we need to carry over the par because of side floats - \doifnotinset\v!tekst{#2}{\carryoverpar\endgroup}% - \ifparfloat\blanko[\v!blokkeer]\fi}% - \vbox} - - - -\collectMPpositiongraphicstrue - -% adapted - -\def\positionoverlay#1% the test prevents too many redundant positions - {\ifpositioning % in (not used) text* position layers - \vbox to \overlayheight - {\doifpositionactionelse{#1::\MPanchoridentifier}% - {\edef\MPanchorid{#1::\MPanchoridentifier:\MPanchornumber}% - \edef\MPanchor##1{\MPpos{\MPanchorid}}% - \the\everyinsertpositionaction - \copyposition{#1::\MPanchoridentifier}{#1::\MPanchoridentifier:\MPanchornumber}% - \hpos - {#1::\MPanchoridentifier:\MPanchornumber}% - % this is ok - %{\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}}}% - % but this one prevents cyclic runs due to - % rounding errors - {\setbox\scratchbox\hbox to \overlaywidth - {\dopositionaction{#1::\MPanchoridentifier}\hss}% - \ht\scratchbox\overlayheight - \dp\scratchbox\zeropoint - \box\scratchbox}}% - {\hbox to \overlaywidth{\hss}}% - \vfill}% - \fi} - -% reverted back to template parsing - -\def\thirdstagestartTABLE#1% - {\global\setTABLEactiontrue - \setTABLEaction\TABLEunknown - \setTABLEforce\TABLEunknown - \setTABLEerror\TABLEunknown - \global\TABLEgraylinefalse - \global\TABLEgraydonefalse - \globalletempty\TABLEgrayline - \globalletempty\nextTABLEgrayline - \globalletempty\TABLEgraylineerror - \globalletempty\TABLEgraylinestatus - \resetVLvalues - \appendtoks\popouterbarandquote\to\EveryTable - \appendtoks\localTABLEsetup\to\EveryTable - \BeginTable[\ifsplittables u\else b\fi]% - \defineTABLEunits - \defineTABLEsteps - \defineTABLErules - \defineTABLEdivisions - \defineTABLEshorthands - \defineTABLEbackgrounds - \defineTABLEendings - \forgetall % added - \doifsomething{#1} - {\def\TABLEformat{#1}% - \getTABLEnofcolumns\TABLEformat - \expandafter\BeginFormat\TABLEformat\EndFormat}} - -\def\!ttDoHalign - {\baselineskip \zeropoint - \lineskiplimit\zeropoint - \lineskip \zeropoint - \tabskip \zeropoint - % does not work in normal tex - % \expanded{\getTABLEnofcolumns{\the\!taPreamble}}% added - \halign \the\!taTableSpread \bgroup - \span\the\!taPreamble - \ifx \!tfRowOfWidths \empty \else \!tfRowOfWidths \cr \fi} - -\bgroup -\catcode`\|=\@@active -%\gdef\protectTABLEbar{\let|\letterbar} % maybe in \cleanupfeatures -\doglobal \appendtoks \let|\letterbar \to \everycleanupfeatures -\catcode`\|=\@@other -\gdef\getTABLEnofcolumns#1% - {\bgroup - \cleanupfeatures % needed ! -% \protectTABLEbar - \expanded{\convertargument#1}\to\ascii - \@EA\doglobal\@EA\counttoken\@EA|\@EA\in\ascii\to\maxTABLEcolumn - \global\advance\maxTABLEcolumn \minusone - % in case of & counting, divide by 2 + \bgroup + \noftopfloats\plusthousand + \nofbotfloats\zerocount + % this is needed in case a float that has been stored + % ends up at the current page; this border case occurs when + % the calculated room is 'eps' smaller that the room available + % when just flushing; so now we have (maybe optional): + \pagebaselinecorrection + % alas, this is tricky but needed (first surfaced in prikkels) + \doflushfloats \egroup} -\egroup - - -\def\fixedspace - {\setbox\scratchbox\hbox\ifmmode{$0$}\else{0}\fi - \hskip\wd\scratchbox\relax} - -\appendtoks \fixedspaces \to \everytable +\def\overloaded#1#2% + {\appendtoks + \writestatus\m!systems{overloaded: \string#2}% + \to \everybye + #1#2} \def\toplinebox {\dowithnextbox - {\ifdim\dp\nextbox>\strutdepth - \scratchdimen\dp\nextbox + {\ifdim\nextboxdp>\strutdepth + \scratchdimen\nextboxdp \advance\scratchdimen-\strutdepth \getnoflines\scratchdimen - \struttedbox{\box\nextbox}% + \struttedbox{\flushnextbox}% \dorecurse\noflines{\vbox{\hsize\zeropoint\strut}}% \else - \box\nextbox + \flushnextbox \fi}% \tbox} @@ -181,26 +69,6 @@ \def\sectioncountervalue#1% {\@@sectionvalue{\@@sectiesectie{#1}}} -\def\NormalizeFontSize#1#2#3#4#5% the normal struggle with accuracy - {\bgroup - \dimen0=#4% #4 can be \ht0 or so - \setbox0\hbox{\definedfont[#5 at 5pt]#3}% 10pt - \ifdim\wd0>\zeropoint - \dimen2=#10 % #1 is \wd or \ht - \dimen4=\maxdimen % 10000pt - \divide\dimen4 \dimen2 - \divide\dimen0 1638 % 1000 - \dimen0=\number\dimen4\dimen0 - \divide \dimen0 \plustwo % ... - \xdef\TheNormalizedFontSize{\the\dimen0}% - \else - \dimen0\bodyfontsize - \fi - \definedfont[#5 at \the\dimen0]% - \expandafter - \egroup - \expandafter\font\expandafter#2\fontname\font\relax} - % todo namespace \@@meta:#1:... ! ! ! ! ! ! \def\presetMPvariable @@ -222,10 +90,10 @@ \def\stopdisplay {\stopopelkaar\displaybreak\ignorespaces} \def\tightvbox - {\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\vbox} + {\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\vbox} \def\tightvtop - {\dowithnextbox{\ht\nextbox\zeropoint\box\nextbox}\vtop} + {\dowithnextbox{\nextboxht\zeropoint\flushnextbox}\vtop} \def\startpagefigure {\dodoubleempty\dostartpagefigure} @@ -267,15 +135,6 @@ % draw btex MetaPost: ± ¶ etex scaled 5 ; % \stopMPcode -\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 @@ -292,50 +151,6 @@ % \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 - \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 @@ -506,7 +321,8 @@ \advance\scratchdimen-\lineheight \advance\scratchdimen\topskip \setbox\scratchbox - \ifcase\showgridstate\vbox\else\ruledvbox\fi to \scratchdimen\bgroup} + \ifcase\showgridstate\vbox\else\ruledvbox\fi to \scratchdimen\bgroup + \forgetall} % ! don't change \def\stopkolomopmaak {\egroup @@ -527,84 +343,6 @@ \let\figuredescription\empty -% very experimental - -\def\redoanalyzefigurefiles#1% - {\ifcase\figurestatus - \def\@@efcurrenttype{#1}% - \dododoanalyzefigurefiles\empty - \fi} - -\def\analyzefigurefiles - {\let\externalfigurelog\empty - \let\@@efcurrenttype\empty - \let\@@efcurrentpath\empty - \let\@@efcurrentfile\empty - \doanalyzefigurefiles\doanalyzefigurefilesA - \doanalyzefigurefiles\doanalyzefigurefilesB - \doanalyzefigurefiles\doanalyzefigurefilesC - % new, permits rather raw names like e:/.... - \let\dodoanalyzefigurefiles\redoanalyzefigurefiles - \doanalyzefigurefiles\doanalyzefigurefilesA - \doanalyzefigurefiles\doanalyzefigurefilesB - \doanalyzefigurefiles\doanalyzefigurefilesC} - -\def\phantombox[#1]% - {\hbox\bgroup - \getparameters - [\??ol] - [\c!breedte=\zeropoint,\c!hoogte=\zeropoint,\c!diepte=\zeropoint,#1]% - \setbox\scratchbox\null - \wd\scratchbox\@@olbreedte - \ht\scratchbox\@@olhoogte - \dp\scratchbox\@@oldiepte - \box\scratchbox - \egroup} - -\long\@EA\def\csname\e!start\e!instellingen\endcsname#1 % - {\bgroup - \catcode`\^^M=\@@ignore - \xdostartsetups{#1}} - -\expanded - {\long\noexpand\def\noexpand\xdostartsetups##1##2\csname\e!stop\e!instellingen\endcsname% - {\egroup - \long\noexpand\setvalue{\??su##1}{##2}}} - -%\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 @@ -690,6 +428,8 @@ \def\changedpage#1% {\getvalue{\s!paragraph:p:#1}} +% incomplete, will be a special case of float placement + \def\startfixed{\dosingleempty\dostartfixed} \long\def\dostartfixed[#1]% @@ -697,7 +437,7 @@ \vbox\bgroup \setlocalhsize} -\def\stopfixed% +\def\stopfixed {\egroup} \def\dodofixed#1#2% @@ -823,53 +563,6 @@ \def\gobbleparameters{\doquadrupleempty\dogobbleparameters} \def\dogobbleparameters[#1][#2][#3][#4]{} -% \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 - {\dotripleargument\dosetvariables[\getrawparameters]} - -\def\globalsetvariables - {\dotripleargument\dosetvariables[\globalgetrawparameters]} - -\def\dosetvariables[#1][#2][#3]% - {\errorisfataltrue - \def\currentvariableclass{#2}% - #1[\??vars:#2:][#3]% - \errorisfatalfalse} - -\beginTEX - -\def\getvariable#1#2% to be sped up - {\csname - \ifundefined{\??vars:#1:#2}\s!empty\else\??vars:#1:#2\fi - \endcsname} - -\endTEX - -\beginETEX \ifcsname - -\def\getvariable#1#2% to be sped up - {\csname - \ifcsname\??vars:#1:#2\endcsname\??vars:#1:#2\else\s!empty\fi - \endcsname} - -\endETEX - -\def\showvariable#1#2% - {\showvalue{\ifundefined{\??vars:#1:#2}\s!empty\else\??vars:#1:#2\fi}} - -\let\currentvariableclass\empty - -% Let's see how fast Mr Bigfoot aka GB tracks down this new -% feature -) - \def\defineTABLEdivisions {\global\TABLEdivisionfalse % in start \let\DL\TableDL @@ -1060,29 +753,12 @@ %\topskipcorrection % becomes an option ! \EveryPar{\begstrut\EveryPar{}}} % also ! -\def\startcolumnspan% +\def\startcolumnspan {\dosingleempty\dostartcolumnspan} -\def\stopcolumnspan% +\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]% diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 4157b90b1..b3ed031df 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -15,7 +15,7 @@ \catcode`\{=1 \catcode`\}=2 -\def\contextversion{2003.2.11} +\def\contextversion{2003.3.3} %D Welcome to the main module. When this module is ran through %D \type{initex} or \type{tex -i} or \type{whatevertex} using diff --git a/tex/context/base/core-box.tex b/tex/context/base/core-box.tex index f8003f20f..668b0e9a9 100644 --- a/tex/context/base/core-box.tex +++ b/tex/context/base/core-box.tex @@ -480,17 +480,17 @@ \defineexternalfigure[bleed][\c!breedte=\bleedwidth,\c!hoogte=\bleedheight] -% \placefloat[left]{none} +% \placefigure[left]{none} % {\bleed[width=5cm,height=3cm,location=lt]{\externalfigure[koe][bleed]}} % % \input tufte % -% \placefloat[left]{none} +% \placefigure[left]{none} % {\bleed[width=5cm,height=3cm,location=l]{\externalfigure[koe][bleed]}} % % \input tufte % -% \placesomefloat[right]{none} +% \placefigure[right]{none} % {\bleed[width=5cm,height=3cm,location=r]{\externalfigure[koe][bleed]}} % % \input tufte @@ -558,7 +558,7 @@ % width=\paperwidth, % height=\paperheight] % -% \definelayerpreset [lefttop] [location=rb] +% \definelayerpreset [lefttop] [corner={left,top},location={right,bottom}] % \definelayerpreset [righttop] [corner={right,top},location={left,bottom}] % \definelayerpreset [leftbottom] [corner={left,bottom},location={right,top}] % \definelayerpreset [rightbottom] [corner={right,bottom},location={left,top}] @@ -568,4 +568,201 @@ % \setlayer[pagefigures][preset=leftbottom] % \setlayer[pagefigures][preset=rightbottom] +\def\alignedbox + {\dodoubleempty\doalignedbox[]} + +% \def\doalignedbox[#1][#2]% +% {\bgroup +% %\let\iftraceboxplacement\iftracelayers % ugly +% \dowithnextbox +% {\let\next\middlebox +% \processaction +% [#2] +% [ t=>\let\next\topbox , b=>\let\next\bottombox , +% l=>\let\next\leftbox , r=>\let\next\rightbox , +% bl=>\let\next\bottomleftbox,br=>\let\next\bottomrightbox, +% tl=>\let\next\topleftbox ,tr=>\let\next\toprightbox , +% lt=>\let\next\lefttopbox ,lb=>\let\next\leftbottombox , +% rt=>\let\next\righttopbox ,rb=>\let\next\rightbottombox]% +% \next{\flushnextbox}% +% \egroup}#1} + +\def\doalignedbox[#1][#2]% + {\bgroup + %\let\iftraceboxplacement\iftracelayers % ugly + \dowithnextbox + {\serializecommalist[#2]% + \executeifdefined{\??ab\??ab\serializedcommalist}\middlebox{\flushnextbox}% + \egroup}#1} + +\setvalue{\??ab\??ab }{\middlebox} +\setvalue{\??ab\??ab\v!midden}{\middlebox} +\setvalue{\??ab\??ab\v!links }{\leftbox } +\setvalue{\??ab\??ab\v!rechts}{\rightbox } +\setvalue{\??ab\??ab\v!onder }{\bottombox} +\setvalue{\??ab\??ab\v!boven }{\topbox } + +\setvalue{\??ab\??ab\v!links \v!boven }{\lefttopbox} +\setvalue{\??ab\??ab\v!links \v!onder }{\leftbottombox} +\setvalue{\??ab\??ab\v!rechts\v!boven }{\righttopbox} +\setvalue{\??ab\??ab\v!rechts\v!onder }{\rightbottombox} +\setvalue{\??ab\??ab\v!boven \v!links }{\topleftbox} +\setvalue{\??ab\??ab\v!onder \v!links }{\bottomleftbox} +\setvalue{\??ab\??ab\v!boven \v!rechts}{\toprightbox} +\setvalue{\??ab\??ab\v!onder \v!rechts}{\bottomrightbox} + +\setvalue{\??ab\??ab c}{\middlebox} +\setvalue{\??ab\??ab l}{\leftbox} +\setvalue{\??ab\??ab r}{\rightbox} +\setvalue{\??ab\??ab o}{\bottombox} +\setvalue{\??ab\??ab b}{\topbox} + +\setvalue{\??ab\??ab lt}{\lefttopbox} +\setvalue{\??ab\??ab lb}{\leftbottombox} +\setvalue{\??ab\??ab rt}{\righttopbox} +\setvalue{\??ab\??ab rb}{\rightbottombox} +\setvalue{\??ab\??ab tl}{\topleftbox} +\setvalue{\??ab\??ab bl}{\bottomleftbox} +\setvalue{\??ab\??ab tr}{\toprightbox} +\setvalue{\??ab\??ab br}{\bottomrightbox} + +\def\offsetbox + {\dodoubleempty\dooffsetbox[]} + +% left/right/top/bottomoffset -> dimensions change +% x/y -> dimensions don't change + +\def\dooffsetbox[#1][#2]% + {\bgroup + \dowithnextbox + {\getparameters[\??ox] + [\c!x=\zeropoint, + \c!y=\zeropoint, + \c!breedte=\nextboxwd, + \c!hoogte=\nextboxht, + \c!diepte=\nextboxdp, + \c!plaats=, + \c!linkeroffset=\zeropoint, + \c!rechteroffset=\zeropoint, + \c!bovenoffset=\zeropoint, + \c!onderoffset=\zeropoint, + #2]% + \donefalse + \ifdim\@@oxlinkeroffset >\zeropoint\donetrue\fi + \ifdim\@@oxrechteroffset>\zeropoint\donetrue\fi + \ifdim\@@oxbovenoffset >\zeropoint\donetrue\fi + \ifdim\@@oxonderoffset >\zeropoint\donetrue\fi + \ifdone + \setbox\nextbox\vbox + {\forgetall\offinterlineskip + \vskip\@@oxbovenoffset + \hbox + {\hskip\@@oxlinkeroffset + \flushnextbox + \hskip\@@oxrechteroffset}% + \vskip\@@oxonderoffset}% + \scratchdimen\nextboxht + \advance\scratchdimen\nextboxdp + \nextboxht\scratchdimen + \nextboxdp\zeropoint + \fi + \freezedimenmacro\@@oxbreedte + \freezedimenmacro\@@oxhoogte + \freezedimenmacro\@@oxdiepte + \setbox\nextbox\hbox + {\hskip\@@oxx\lower\@@oxy\hbox + {\doifelsenothing\@@oxplaats + {\flushnextbox} + {\alignedbox[\@@oxplaats]\hbox{\flushnextbox}}}}% + \nextboxwd\@@oxbreedte + \nextboxht\@@oxhoogte + \nextboxdp\@@oxdiepte + \flushnextbox + \egroup}#1} + +% \useMPlibrary[pre] \setupbackgrounds[page][background=pagegrid] +% +% \placefigure[left,none]{}{\offset[leftoffset=1cm]{\externalfigure[koe][breedte=3cm]}} +% \input tufte +% \placefigure[left,none]{}{\offset[rightoffset=1cm]{\externalfigure[koe][breedte=3cm]}} +% \input tufte +% \placefigure[left,none]{}{\offset[topoffset=1cm]{\externalfigure[koe][breedte=3cm]}} +% \input tufte +% \placefigure[left,none]{}{\offset[bottomoffset=1cm]{\externalfigure[koe][breedte=3cm]}} +% \input tufte + +\def\offset {\dodoubleempty\dooffsetbox [\hbox]} % yes or no +\def\aligned{\dosingleempty\doalignedbox[\hbox]} % yes or no + +%\ruledhbox{\offsetbox[x=-1cm,y=-1cm,location=c] +% {\framed[width=4cm,height=4cm]{x}}} + +\def\dotabbed#1#2#3#4% + {\dontleavehmode + \bgroup + \setbox\scratchbox\hbox{#3}% + \hbox to \wd\scratchbox{#1#4#2}% + \egroup} + +\def\ltabbed{\dotabbed\relax\hss} +\def\rtabbed{\dotabbed\hss \relax} +\def\ctabbed{\dotabbed\hss \hss} \let\mtabbed\ctabbed + +% \ltabbed{\romeins{3}}{\romeins{1}} test \endgraf +% \ltabbed{\romeins{3}}{\romeins{2}} test \endgraf +% \ltabbed{\romeins{3}}{\romeins{3}} test \endgraf +% +% \rtabbed{\romeins{3}}{\romeins{1}} test \endgraf +% \rtabbed{\romeins{3}}{\romeins{2}} test \endgraf +% \rtabbed{\romeins{3}}{\romeins{3}} test \endgraf +% +% \ctabbed{\romeins{3}}{\romeins{1}} test \endgraf +% \ctabbed{\romeins{3}}{\romeins{2}} test \endgraf +% \ctabbed{\romeins{3}}{\romeins{3}} test \endgraf + +% alternative, if done, then other name +% +% \def\dotabbed#1#2#3#4% +% {\dontleavehmode +% \bgroup +% \scratchdimen\zeropoint +% \def\docommando##1% +% {\setbox\scratchbox\hbox{##1}% +% \ifdim\wd\scratchbox>\scratchdimen +% \scratchdimen\wd\scratchbox +% \fi}% +% \processcommalist[#3]\docommando +% \hbox to \scratchdimen{#1#4#2}% +% \egroup} +% +% \def\ltabbed{\dotabbed\relax\hss} +% \def\rtabbed{\dotabbed\hss \relax} +% \def\ctabbed{\dotabbed\hss \hss} \let\mtabbed\ctabbed +% +% \ltabbed{\romeins{10},\romeins{2000},\romeins{15}}{\romeins{10}} test \endgraf +% \ltabbed{\romeins{10},\romeins{2000},\romeins{15}}{\romeins{15}} test \endgraf +% \ltabbed{\romeins{10},\romeins{2000},\romeins{15}}{\romeins{2000}} test \endgraf +% +% \rtabbed{\romeins{10},\romeins{2000},\romeins{15}}{\romeins{10}} test \endgraf +% \rtabbed{\romeins{10},\romeins{2000},\romeins{15}}{\romeins{15}} test \endgraf +% \rtabbed{\romeins{10},\romeins{2000},\romeins{15}}{\romeins{2000}} test \endgraf +% +% \ctabbed{\romeins{10},\romeins{2000},\romeins{15}}{\romeins{10}} test \endgraf +% \ctabbed{\romeins{10},\romeins{2000},\romeins{15}}{\romeins{15}} test \endgraf +% \ctabbed{\romeins{10},\romeins{2000},\romeins{15}}{\romeins{2000}} test \endgraf + +% to be documented + +\def\phantombox[#1]% + {\hbox\bgroup + \getparameters + [\??ol] + [\c!breedte=\zeropoint,\c!hoogte=\zeropoint,\c!diepte=\zeropoint,#1]% + \setbox\scratchbox\null + \wd\scratchbox\@@olbreedte + \ht\scratchbox\@@olhoogte + \dp\scratchbox\@@oldiepte + \box\scratchbox + \egroup} + \protect \endinput diff --git a/tex/context/base/core-con.tex b/tex/context/base/core-con.tex index 1f3af8029..f3cfa36bc 100644 --- a/tex/context/base/core-con.tex +++ b/tex/context/base/core-con.tex @@ -60,7 +60,7 @@ %D \stoptypen %D %D \unknown but we need to be fully expandable in order to get -%D the utility output file right, so now we have th efollowing +%D the utility output file right, so now we have the following %D solution. It was Patrick Gundlach who first noticed this %D ommision. diff --git a/tex/context/base/core-des.tex b/tex/context/base/core-des.tex index c3f5145e5..9e743f7ba 100644 --- a/tex/context/base/core-des.tex +++ b/tex/context/base/core-des.tex @@ -268,8 +268,7 @@ {\??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 +% \parindent\zeropoint\relax \doifelsevalue{\??dd#1\c!titeluitlijnen}\v!nee {\edef\@@leftdefinitieskip {\the\leftskip }% \edef\@@rightdefinitieskip{\the\rightskip}} @@ -277,10 +276,11 @@ \edef\@@leftdefinitieskip {\the\leftskip }% \edef\@@rightdefinitieskip{\the\rightskip}% \fi}% - \ifcase\insidedefinition - \chardef\insidedefinition1 +\expanded{\inspringen[\getvalue{\??dd#1\c!inspringen}]}% + \ifcase\insidedefinition % better a system mode + \chardef\insidedefinition\plusone \or - \chardef\insidedefinition2 + \chardef\insidedefinition\plustwo \fi} % now happens elsewhere : \noindent\ignorespaces \def\@@stopdefinitie#1% @@ -295,11 +295,18 @@ {\dostartattributes{\??dd#1}\c!letter\c!kleur\empty \ignorespaces} +% \def\@@somedefinitie#1[#2]#3% +% {\bgroup % temporary hack +% \BeforePar{\executedoordefinitie{#1}[#2]{#3}}% +% \AfterPar{\@@stopdefinitie{#1}}% +% \GetPar} +% +% nicer and better: + \def\@@somedefinitie#1[#2]#3% - {\bgroup % temporary hack - \BeforePar{\executedoordefinitie{#1}[#2]{#3}}% - \AfterPar{\@@stopdefinitie{#1}}% - \GetPar} + {\dowithpar + {\bgroup\executedoordefinitie{#1}[#2]{#3}}% + {\@@stopdefinitie{#1}}} \def\@@startsomedefinitie#1[#2]#3% {\bgroup % temporary hack @@ -326,7 +333,8 @@ {\copyparameters[\??dd#1][\??dd] [\c!plaats,\c!kopletter,\c!letter,\c!kleur,\c!kopkleur, \c!breedte,\c!hang,\c!monster,\c!voor,\c!tussen,\c!na,\c!marge, - \c!springvolgendein,\c!uitlijnen,\c!tekst,\c!afstand,\c!commando]% + \c!inspringen,\c!springvolgendein,\c!uitlijnen, + \c!tekst,\c!afstand,\c!commando]% \getparameters[\??dd#1] [\s!do\c!status=\v!stop, \s!do\c!commando=\normal@@definitiewoord, @@ -340,6 +348,7 @@ \setvalue{\e!stop#1}% {\@@stopdefinitie{#1}}}% + \def\@@startdefinitie[#1][#2]% {\doifelsevalue{\??dd#1\s!do\c!status}\v!start {\@@startsomedefinitie{#1}[#2]{}} @@ -527,7 +536,8 @@ \c!breedte,\c!nummer,\c!afstand,\c!commando, \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]% + \c!inspringen,\c!springvolgendein,\c!afsluiter,\c!sectienummer, + \c!nummer]% \doifassignmentelse{#4} {\getparameters[\??dd#3#1]% [\c!tekst=#1,\??dd\c!nummer=#1,\c!conversie=, @@ -541,8 +551,8 @@ [\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!springvolgendein,\c!links,\c!rechts,\c!koppeling,\c!koppelwijze]% + \c!afsluiter,\c!inspringen,\c!springvolgendein,\c!links,\c!rechts, + \c!koppeling,\c!koppelwijze]% \getparameters[\??dd#3#1] [\c!tekst=#1,\??dd\c!nummer=#4,\c!conversie=,#5]}}% \ExpandBothAfter\doif{\getvalue{\??dd#3#1\??dd\c!nummer}}{#1} @@ -633,8 +643,8 @@ \parindent\zeropoint \hskip#2\!!widtha\indent\box2% \hangindent#3\!!widtha - \doattributes{\??ds#1}\c!letter\c!kleur{}% #4}% - \AfterPar% + \doattributes{\??ds#1}\c!letter\c!kleur\empty + \AfterPar% must be redone {\endgroup \getvalue{\??ds#1\c!na}}% \GetPar} @@ -731,6 +741,7 @@ \c!tussen=\blanko, \c!na=\blanko, \c!springvolgendein=\v!ja, + \c!inspringen=\v!nooit, \c!commando=] \steldoornummerenin @@ -749,6 +760,7 @@ \c!tussen=\blanko, \c!na=\blanko, \c!springvolgendein=\v!ja, + \c!inspringen=\v!nooit, \c!tekst=, \c!niveaus=3, % to be upward compatible \c!conversie=, % to be upward compatible diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex index fe9d185ea..11eb2a8e6 100644 --- a/tex/context/base/core-fig.tex +++ b/tex/context/base/core-fig.tex @@ -220,6 +220,23 @@ \let\@@efcurrentpath\empty \let\@@efcurrentfile\empty +% \def\analyzefigurefiles +% {\let\externalfigurelog\empty +% \let\@@efcurrenttype\empty +% \let\@@efcurrentpath\empty +% \let\@@efcurrentfile\empty +% \doanalyzefigurefiles\doanalyzefigurefilesA +% \doanalyzefigurefiles\doanalyzefigurefilesB +% \doanalyzefigurefiles\doanalyzefigurefilesC} +% +% but, we also want to support direct paths, like e:/.... + +\def\redoanalyzefigurefiles#1% + {\ifcase\figurestatus + \def\@@efcurrenttype{#1}% + \dododoanalyzefigurefiles\empty + \fi} + \def\analyzefigurefiles {\let\externalfigurelog\empty \let\@@efcurrenttype\empty @@ -227,6 +244,11 @@ \let\@@efcurrentfile\empty \doanalyzefigurefiles\doanalyzefigurefilesA \doanalyzefigurefiles\doanalyzefigurefilesB + \doanalyzefigurefiles\doanalyzefigurefilesC + % new, permits rather raw names like e:/.... + \let\dodoanalyzefigurefiles\redoanalyzefigurefiles + \doanalyzefigurefiles\doanalyzefigurefilesA + \doanalyzefigurefiles\doanalyzefigurefilesB \doanalyzefigurefiles\doanalyzefigurefilesC} %D The previous macro suggests that there are three main @@ -743,31 +765,31 @@ \def\docalculatefigurescales#1#2#3#4% {\dimen0=#1\relax % #1 = new 1-value \dimen2=#2\relax % #2 = old 1-value - \divide\dimen2 \!!thousand + \divide\dimen2 \plusthousand \divide\dimen0 \dimen2 \figxsca\dimen0 % x scale \figysca\dimen0 % y scale \dimen2=#4\relax % #4 = old 2-value - \divide\dimen2 \!!thousand + \divide\dimen2 \plusthousand \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 \!!thousand + \divide\dimen2 \plusthousand \divide\dimen0 \dimen2 #3=\dimen0 } % #3 = schaal \def\doapplyfigurescale#1#2#3% {\global#1=#2\relax \ifcase0\@@efschaal\relax % beter: doifnum... - #3=\!!thousand + #3=\plusthousand \else #3=\@@efschaal \fi\relax % important ! - \ifnum#3=\!!thousand\else - \global\divide #1 \!!thousand + \ifnum#3=\plusthousand\else + \global\divide #1 \plusthousand \global\multiply#1 #3\relax \fi} @@ -805,16 +827,39 @@ {\edef\@@efhsize{\the\hsize}} {\let\@@efhsize\@@efbreedte}} +% \def\convertfigureinsertscale#1#2#3#4% +% {\scratchdimen#1\relax +% \ifnum#3=\plusthousand\else % better 1000 100 10 ranges, evt round 2sp +% \divide\scratchdimen \plusthousand +% \multiply\scratchdimen #3\relax +% \fi +% \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}}} +% +% more obscure but better: + \def\convertfigureinsertscale#1#2#3#4% {\scratchdimen#1\relax - \ifnum#3=\!!thousand\else % better 1000 100 10 ranges, evt round 2sp - \divide\scratchdimen \!!thousand + \ifnum#3=\plusthousand + % == scale 1 + \else + % better 1000 100 10 ranges, evt round 2sp + \divide\scratchdimen \plusthousand \multiply\scratchdimen #3\relax \fi \scratchdimen-\scratchdimen % beter hier - dan in driver - \edef#2{\the\scratchdimen}% oeps, \the vergeten - \scratchdimen#3\s!pt - \divide\scratchdimen \!!ten + \edef#2{\the\scratchdimen}% + \scratchcounter#3\relax + \ifnum\scratchcounter>\plustenthousand + \divide\scratchcounter \!!ten + \scratchdimen\the\scratchcounter\s!pt + \else + \scratchdimen\the\scratchcounter\s!pt + \divide\scratchdimen \!!ten + \fi \edef#4{\@EA\withoutpt\@EA{\the\scratchdimen}}} \newbox\foundexternalfigure @@ -858,276 +903,6 @@ {\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]% @@ -1384,8 +1159,10 @@ {\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}% + \scratchdimen\scax\s!pt\divide\scratchdimen \plushundred + \edef\scax{\@EA\withoutpt\the\scratchdimen}% + \scratchdimen\scay\s!pt\divide\scratchdimen \plushundred + \edef\scay{\@EA\withoutpt\the\scratchdimen}% \schaal[\c!sx=\scax,\c!sy=\scay]{\dowithfigure{\getobject{FIG}{\@@efobjectname}}}% \xdef\noffigurepages{\number\getvalue{\@@efobjectname\c!n}}% \else\ifdim\wd\foundexternalfigure=\zeropoint @@ -1395,8 +1172,10 @@ \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}% + \scratchdimen\scax\s!pt\divide\scratchdimen \plushundred + \edef\scax{\@EA\withoutpt\the\scratchdimen}% + \scratchdimen\scay\s!pt\divide\scratchdimen \plushundred + \edef\scay{\@EA\withoutpt\the\scratchdimen}% \schaal[\c!sx=\scax,\c!sy=\scay]{\dowithfigure{\box\foundexternalfigure}}% \xdef\noffigurepages{\number\nofinsertpages}% \fi\fi @@ -2112,7 +1891,7 @@ % \dimen0=\@@cpbreedte % \dimen4=\@@cphoffset % \else -% \dimen0=\wd\nextbox +% \dimen0=\nextboxwd % \divide\dimen0 \@@cpnx % \dimen4=\@@cpx\dimen0 % \advance\dimen4 -\dimen0 @@ -2121,31 +1900,31 @@ % \relax % sure % \ifdim\@@cphoogte>\zeropoint % \dimen2=\@@cphoogte -% \dimen6=\ht\nextbox +% \dimen6=\nextboxht % \advance\dimen6 -\@@cpvoffset % \advance\dimen6 -\dimen2 % \else -% \dimen2=\ht\nextbox +% \dimen2=\nextboxht % \divide\dimen2 \@@cpny % \dimen6=-\@@cpy\dimen2 % \advance\dimen6 -\@@cpsy\dimen2 % \advance\dimen6 \dimen2 % \dimen2=\@@cpsy\dimen2 -% \advance\dimen6 \ht\nextbox +% \advance\dimen6 \nextboxht % \fi % \setbox\nextbox\hbox -% {\hskip-\dimen4\lower\dimen6\box\nextbox}% -% \wd\nextbox\zeropoint -% \ht\nextbox\zeropoint -% \dp\nextbox\zeropoint +% {\hskip-\dimen4\lower\dimen6\flushnextbox}% +% \nextboxwd\zeropoint +% \nextboxht\zeropoint +% \nextboxdp\zeropoint % \setbox\nextbox\hbox % {\dostartclipping\@@cpmp{\dimen0}{\dimen2}% -% \box\nextbox +% \flushnextbox % \dostopclipping}% -% \wd\nextbox\dimen0 -% \ht\nextbox\dimen2 -% \dp\nextbox\zeropoint -% \box\nextbox +% \nextboxwd\dimen0 +% \nextboxht\dimen2 +% \nextboxdp\zeropoint +% \flushnextbox % \egroup}% % \hbox} @@ -2157,7 +1936,7 @@ % \dimen0=\@@cpbreedte % \dimen4=\@@cphoffset % \else -% \dimen0=\wd\nextbox +% \dimen0=\nextboxwd % \divide\dimen0 \@@cpnx % \dimen4=\@@cpx\dimen0 % \advance\dimen4 -\dimen0 @@ -2166,41 +1945,41 @@ % \relax % sure % \ifdim\@@cphoogte>\zeropoint % \dimen2=\@@cphoogte -% \dimen6=\ht\nextbox +% \dimen6=\nextboxht % \advance\dimen6 -\@@cpvoffset % \advance\dimen6 -\dimen2 % \else -% \dimen2=\ht\nextbox +% \dimen2=\nextboxht % \divide\dimen2 \@@cpny % \dimen6=-\@@cpy\dimen2 % \advance\dimen6 -\@@cpsy\dimen2 % \advance\dimen6 \dimen2 % \dimen2=\@@cpsy\dimen2 -% \advance\dimen6 \ht\nextbox +% \advance\dimen6 \nextboxht % \fi % \setbox\nextbox\hbox % old % {\advance\dimen4 -\@@cplinkeroffset % new ! % \advance\dimen6 \@@cpbovenoffset % new ! -% \hskip-\dimen4\lower\dimen6\box\nextbox}% old -% \wd\nextbox\zeropoint -% \ht\nextbox\zeropoint -% \dp\nextbox\zeropoint +% \hskip-\dimen4\lower\dimen6\flushnextbox}% old +% \nextboxwd\zeropoint +% \nextboxht\zeropoint +% \nextboxdp\zeropoint % \setbox\nextbox\hbox % {\advance\dimen0 \@@cplinkeroffset % new ! % \advance\dimen0 \@@cprechteroffset % new ! % \advance\dimen2 \@@cpbovenoffset % new ! % \advance\dimen2 \@@cponderoffset % new ! % \dostartclipping\@@cpmp{\dimen0}{\dimen2}% old -% \box\nextbox +% \flushnextbox % \dostopclipping}% % \setbox\nextbox\hbox % new ! % {\dimen0-\@@cplinkeroffset % new ! % \dimen2-\@@cpbovenoffset % new ! -% \hskip\dimen0\lower\dimen2\box\nextbox}% new ! -% \wd\nextbox\dimen0 -% \ht\nextbox\dimen2 -% \dp\nextbox\zeropoint -% \box\nextbox +% \hskip\dimen0\lower\dimen2\flushnextbox}% new ! +% \nextboxwd\dimen0 +% \nextboxht\dimen2 +% \nextboxdp\zeropoint +% \flushnextbox % \egroup}% % \hbox} @@ -2215,7 +1994,7 @@ \!!dimena\@@cpbreedte \!!dimenc\@@cphoffset \else - \!!dimena\wd\nextbox + \!!dimena\nextboxwd \divide\!!dimena \@@cpnx \!!dimenc\@@cpx\!!dimena \advance\!!dimenc -\!!dimena @@ -2224,41 +2003,41 @@ \relax % sure \ifdim\@@cphoogte>\zeropoint \!!dimenb\@@cphoogte - \!!dimend\ht\nextbox + \!!dimend\nextboxht \advance\!!dimend -\@@cpvoffset \advance\!!dimend -\!!dimenb \else - \!!dimenb\ht\nextbox + \!!dimenb\nextboxht \divide\!!dimenb \@@cpny \!!dimend-\@@cpy\!!dimenb \advance\!!dimend -\@@cpsy\!!dimenb \advance\!!dimend \!!dimenb \!!dimenb\@@cpsy\!!dimenb - \advance\!!dimend \ht\nextbox + \advance\!!dimend \nextboxht \fi \setbox\nextbox\hbox % old {\advance\!!dimenc -\@@cplinkeroffset % new ! \advance\!!dimend -\@@cpbovenoffset % new ! % - added - \hskip-\!!dimenc\lower\!!dimend\box\nextbox}% old - \wd\nextbox\zeropoint - \ht\nextbox\zeropoint - \dp\nextbox\zeropoint + \hskip-\!!dimenc\lower\!!dimend\flushnextbox}% old + \nextboxwd\zeropoint + \nextboxht\zeropoint + \nextboxdp\zeropoint \setbox\nextbox\hbox {\advance\!!dimena \@@cplinkeroffset % new ! \advance\!!dimena \@@cprechteroffset % new ! \advance\!!dimenb \@@cpbovenoffset % new ! \advance\!!dimenb \@@cponderoffset % new ! \dostartclipping\@@cpmp{\!!dimena}{\!!dimenb}% old - \box\nextbox + \flushnextbox \dostopclipping}% \setbox\nextbox\hbox % new ! {\!!dimena-\@@cplinkeroffset % new ! \!!dimenb \@@cpbovenoffset % new ! % - removed - \hskip\!!dimena\lower\!!dimenb\box\nextbox}% new ! - \wd\nextbox\!!dimena - \ht\nextbox\!!dimenb - \dp\nextbox\zeropoint - \box\nextbox + \hskip\!!dimena\lower\!!dimenb\flushnextbox}% new ! + \nextboxwd\!!dimena + \nextboxht\!!dimenb + \nextboxdp\zeropoint + \flushnextbox \egroup}% \hbox} diff --git a/tex/context/base/core-grd.tex b/tex/context/base/core-grd.tex index 7942e8202..8bf85846c 100644 --- a/tex/context/base/core-grd.tex +++ b/tex/context/base/core-grd.tex @@ -125,6 +125,18 @@ \fi \fi} +\def\pagebaselinecorrection + {\ifdim\pagegoal<\maxdimen + \ifdim\pagetotal>\lineheight % or \topskip + \scratchdimen\pagetotal + \advance\scratchdimen\lineheight + \ifdim\scratchdimen<\pagegoal + \baselinecorrection + \fi + \fi + \fi} + + % Beware, keep this one as it is, see for instance module % m-steps.tex, where we apply a \localhsize to the \vbox, in % order to follow narrower and side floats ! @@ -323,29 +335,230 @@ \newif\ifboxedsnapping \boxedsnappingtrue +% \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\flushnextbox}}}% +% \fi +% \getnoflines{\nextboxht}% +% \setbox\nextbox\vbox to \noflines\lineheight +% {\ifnum\@@alignsnap=1 \kern\lineheight\kern-\topskip\fi +% \ifnum\@@alignsnap>2 \vfill\fi +% \flushnextbox +% \ifnum\@@alignsnap<4 \vfill\fi}% +% \fi +% \ifshowgridboxes +% \setbox\nextbox\hbox{\color[grid:three]{\ruledhbox{\black\flushnextbox}}}% +% \fi +% \forgetall +% \par +% \ifvbox\nextbox +% \setbox\nextbox\hbox{\flushnextbox}% 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\nextboxht>\ht\strutbox +% \scratchdimen\nextboxht +% \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 % maybe raw ? +% \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 +% \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\nextboxdp>\dp\strutbox +% \getnoflines{\nextboxdp}% +% \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 +% \nextboxht\ht\strutbox +% \nextboxdp\dp\strutbox +% \else +% \scratchdimen\presnap +% \advance\scratchdimen \ht\strutbox +% \nextboxht\scratchdimen +% \scratchdimen\postsnap +% \advance\scratchdimen \dp\strutbox +% \nextboxdp\scratchdimen +% \fi +% \hbox{\tracedsnapping\flushnextbox}% +% \ifstrutsnapping +% \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi +% \fi +% \else +% \scratchdimen\nextboxht\relax +% \ifcase\@@alignsnapbox +% % can't happen here +% \or +% \getrawnoflines\scratchdimen +% \else +% \getnoflines \scratchdimen +% \fi +% \scratchdimen\noflines\lineheight\relax +% \advance\scratchdimen-\strutdepth +% % spoils the whole game (fit/broad/line) +% % \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\flushnextbox}}}% +% \fi +% \nextboxdp\dp\strutbox +% \dimen4=\nextboxht +% \dimen6=\nextboxdp +% \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\flushnextbox}% +% \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\flushnextbox}% +% \nextboxht\dimen4 +% \nextboxdp\dimen6 +% \flushnextbox +% \nointerlineskip % \offinterlineskip +% \ifnum\@@alignsnap<4 \vfill\fi % 2 3 +% \kern\zeropoint}% +% \ifshowgridboxes +% \setbox\nextbox\vbox{\color[grid:three]{\ruledhbox{\black\flushnextbox}}}% +% \fi +% \scratchdimen\@@alignsnapamount +% \edef\presnapskip{\the\scratchdimen}% +% \ifnum\@@alignsnap>2 \def\presnap {+}\fi +% \ifnum\@@alignsnap<4 \def\postsnap{+}\fi +% \setbox\nextbox\hbox{\tracedsnapping\flushnextbox}% +% \par +% \nextboxht\dimen0 +% \nextboxdp\dimen2 +% \forcedpresnapcorrection +% \nointerlineskip +% \flushnextbox +% \fi +% \else +% \setbox\nextbox\vbox to \teksthoogte +% {\ifdim\nextboxdp=\zeropoint +% \hbox{\lower\strutdepth\flushnextbox} +% \else % this branch is yet untested +% \vss +% \hbox{\lower\nextboxdp\flushnextbox} +% \vskip-\strutdepth +% \fi}% +% \nextboxdp\strutdepth +% \flushnextbox +% \fi +% \extrasnapreset +% \enablepresnapcorrection +% \global\chardef\@@alignsnap\zerocount +% \global\chardef\@@alignsnapbox\zerocount +% \egroup}} + \def\dodosnaptogrid {\dowithnextbox {\bgroup - \ifdim\ht\nextbox<\teksthoogte % handle special case (like page fig) + \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}}}% + \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\flushnextbox}}}% \fi - \getnoflines{\ht\nextbox}% + %\getnoflines{\nextboxht}% + \getnoflines\nextboxht \setbox\nextbox\vbox to \noflines\lineheight {\ifnum\@@alignsnap=1 \kern\lineheight\kern-\topskip\fi \ifnum\@@alignsnap>2 \vfill\fi - \box\nextbox + \flushnextbox \ifnum\@@alignsnap<4 \vfill\fi}% \fi \ifshowgridboxes - \setbox\nextbox\hbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}% + \setbox\nextbox\hbox{\color[grid:three]{\ruledhbox{\black\flushnextbox}}}% \fi \forgetall \par \ifvbox\nextbox - \setbox\nextbox\hbox{\box\nextbox}% don't ask + \setbox\nextbox\hbox{\flushnextbox}% don't ask \fi \scratchskip\lastskip \edef\presnapskip{\the\lastskip}% @@ -355,8 +568,8 @@ \forcepresnaptrue \fi \forcedpresnapcorrection - \ifdim\ht\nextbox>\ht\strutbox - \scratchdimen\ht\nextbox + \ifdim\nextboxht>\ht\strutbox + \scratchdimen\nextboxht \ifcase\@@presnap\relax \ifdim\scratchskip>\zeropoint\relax \scratchcounter\scratchskip @@ -399,8 +612,8 @@ \vskip\scratchdimen \fi \fi \fi - \ifdim\dp\nextbox>\dp\strutbox - \getnoflines{\dp\nextbox}% + \ifdim\nextboxdp>\dp\strutbox + \getnoflines{\nextboxdp}% \advance\noflines -1 \ifnum\noflines>0 \scratchdimen\noflines\lineheight @@ -414,22 +627,22 @@ \ifnum\@@extrasnap=3 \advance\scratchdimen \extrasnapsign\lineheight \fi \edef\postsnap{\the\scratchdimen}% \ifstrutsnapping - \ht\nextbox\ht\strutbox - \dp\nextbox\dp\strutbox + \nextboxht\ht\strutbox + \nextboxdp\dp\strutbox \else \scratchdimen\presnap \advance\scratchdimen \ht\strutbox - \ht\nextbox\scratchdimen + \nextboxht\scratchdimen \scratchdimen\postsnap \advance\scratchdimen \dp\strutbox - \dp\nextbox\scratchdimen + \nextboxdp\scratchdimen \fi - \hbox{\tracedsnapping\box\nextbox}% + \hbox{\tracedsnapping\flushnextbox}% \ifstrutsnapping \ifdim\scratchdimen=\zeropoint\else\vskip\scratchdimen\fi \fi \else - \scratchdimen\ht\nextbox\relax + \scratchdimen\nextboxht\relax \ifcase\@@alignsnapbox % can't happen here \or @@ -439,96 +652,98 @@ \fi \scratchdimen\noflines\lineheight\relax \advance\scratchdimen-\strutdepth - \ifnum\pagetotal>\zeropoint - \else % disable this as option - \advance\scratchdimen-\strutheight - \advance\scratchdimen+\topskip - \fi + % spoils the whole game (fit/broad/line) + % \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}}}% + \setbox\nextbox\hbox{\color[grid:two]{\ruledhbox{\black\flushnextbox}}}% \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}% + \nextboxdp\dp\strutbox + \dimen4=\nextboxht + \dimen6=\nextboxdp + \iftracegridsnapping + \setbox\scratchbox\hbox + {\scratchdimen\@@alignsnapamount\relax + \ifdim\scratchdimen<\zeropoint + \tracedgridamount\zeropoint{-\scratchdimen}% + \else + \tracedgridamount\scratchdimen\zeropoint + \fi}% + \smashbox\scratchbox + \setbox\nextbox\hbox{\box\scratchbox\flushnextbox}% + \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 % == \strutdepth + \fi \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}% + \lower\scratchdimen\flushnextbox}% + \nextboxht\dimen4 + \nextboxdp\dimen6 + \ifnum\@@alignsnap<4 % 4 = regel + \setbox\nextbox\vbox to \scratchdimen + {\forgetall + \ifnum\@@alignsnap>2 \vfill\fi % 3 4 + \flushnextbox + \nointerlineskip % \offinterlineskip + \ifnum\@@alignsnap<4 \vfill\fi % 2 3 + \kern\zeropoint}% + \fi \ifshowgridboxes - \setbox\nextbox\vbox{\color[grid:three]{\ruledhbox{\black\box\nextbox}}}% + \setbox\nextbox\vbox{\color[grid:three]{\ruledhbox{\black\flushnextbox}}}% \fi \scratchdimen\@@alignsnapamount \edef\presnapskip{\the\scratchdimen}% \ifnum\@@alignsnap>2 \def\presnap {+}\fi \ifnum\@@alignsnap<4 \def\postsnap{+}\fi - \setbox\nextbox\hbox{\tracedsnapping\box\nextbox}% + \setbox\nextbox\hbox{\tracedsnapping\flushnextbox}% \par - \ht\nextbox\dimen0 - \dp\nextbox\dimen2 + \nextboxht\dimen0 + \nextboxdp\dimen2 \forcedpresnapcorrection \nointerlineskip - \box\nextbox + \flushnextbox \fi \else \setbox\nextbox\vbox to \teksthoogte {\ifdim\nextboxdp=\zeropoint - \hbox{\lower\strutdepth\box\nextbox} + \hbox{\lower\strutdepth\flushnextbox} \else % this branch is yet untested \vss - \hbox{\lower\nextboxdp\box\nextbox} + \hbox{\lower\nextboxdp\flushnextbox} \vskip-\strutdepth \fi}% \nextboxdp\strutdepth - \box\nextbox + \flushnextbox \fi \extrasnapreset \enablepresnapcorrection \global\chardef\@@alignsnap\zerocount \global\chardef\@@alignsnapbox\zerocount \egroup}} - + \def\tracedgridamount#1#2% - {\color[grid:four]{\vrule\!!width\wd\nextbox\!!height#1\!!depth#2}} + {\color[grid:four]{\vrule\!!width\nextboxwd\!!height#1\!!depth#2}} \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{\flushnextbox}\blanko[\v!regel]} \vbox\bgroup \let\setdisplayskips\relax \abovedisplayskip\zeropoint @@ -541,12 +756,12 @@ \def\topsnaptogrid {\ifgridsnapping \dowithnextbox - {\scratchdimen\ht\nextbox + {\scratchdimen\nextboxht \advance\scratchdimen -\ht\strutbox \advance\scratchdimen \topskip - \ht\nextbox\scratchdimen - \dp\nextbox\zeropoint - \box\nextbox + \nextboxht\scratchdimen + \nextboxdp\zeropoint + \flushnextbox \kern\lineheight \kern-\topskip \nointerlineskip} @@ -560,16 +775,16 @@ % \dowithnextbox % {\bgroup % \par -% \scratchdimen\ht\nextbox -% \advance\scratchdimen \dp\nextbox +% \scratchdimen\nextboxht +% \advance\scratchdimen \nextboxdp % \getnoflines\scratchdimen % \setbox\nextbox\vbox to \noflines\lineheight % {\forgetall -% \vskip\zeropoint \!!plus \ht\nextbox +% \vskip\zeropoint \!!plus \nextboxht % \copy\nextbox % \kern.5\dp\strutbox % VOORLOPIGE WAARDE -% \vskip\zeropoint \!!plus \dp\nextbox} -% \noindent\snaptogrid\vbox{\box\nextbox}% +% \vskip\zeropoint \!!plus \nextboxdp} +% \noindent\snaptogrid\vbox{\flushnextbox}% % \egroup} % \hbox % \fi} @@ -632,6 +847,38 @@ \def\doverplaatsopgrid[#1]% {\ifgridsnapping\doifsomething{#1}{\dodoverplaatsopgrid[#1]}\fi} +% \def\dodoverplaatsopgrid[#1]% some day : speed up +% {\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, +% -\v!boven=>\gridwarning-\negativeextrasnap\extrasnapbefore, +% -\v!onder=>\gridwarning-\negativeextrasnap\extrasnapafter, +% -\v!beide=>\negativeextrasnap\extrasnaparound, +% \v!pagina=>\global\chardef\@@alignsnap1, % topskip +% \v!hoog=>\global\chardef\@@alignsnap2, +% \v!midden=>\global\chardef\@@alignsnap3, +% \v!laag=>\global\chardef\@@alignsnap4, +% \v!passend=>\global\chardef\@@alignsnapbox1, % new +% \v!ruim=>\global\chardef\@@alignsnapbox2, % new +% \v!diepte=>\global\chardef\@@alignsnapdepth1, % new +% \v!regel=>\global\chardef\@@alignsnapbox3 +% \global\chardef\@@alignsnap4 +% \global\chardef\@@alignsnapdepth1, +% \v!reset=>\positiveextrasnap\extrasnapreset, +% \v!geen=>\global\chardef\@@alignsnap0 +% \global\chardef\@@alignsnapbox0, +% \s!default=>, +% \s!unknown=>\@@unknowngriddisplacement]} + \def\dodoverplaatsopgrid[#1]% some day : speed up {\global\chardef\@@alignsnap\zerocount \global\chardef\@@alignsnapbox\zerocount @@ -656,8 +903,8 @@ \v!ruim=>\global\chardef\@@alignsnapbox2, % new \v!diepte=>\global\chardef\@@alignsnapdepth1, % new \v!regel=>\global\chardef\@@alignsnapbox3 - \global\chardef\@@alignsnap4 - \global\chardef\@@alignsnapdepth1, +% \global\chardef\@@alignsnapdepth1 + \global\chardef\@@alignsnap4, \v!reset=>\positiveextrasnap\extrasnapreset, \v!geen=>\global\chardef\@@alignsnap0 \global\chardef\@@alignsnapbox0, diff --git a/tex/context/base/core-ins.tex b/tex/context/base/core-ins.tex index 221512aba..1cb08e0af 100644 --- a/tex/context/base/core-ins.tex +++ b/tex/context/base/core-ins.tex @@ -29,7 +29,7 @@ %\def\installinsertion#1% % {\ifx#1\undefined % \newinsert#1% -% \count#1\!!thousand +% \count#1\plusthousand % \skip #1\zeropoint % \dimen#1\maxdimen % \appendtoks\doprocessinsert#1\to\@@insertionlist @@ -41,7 +41,7 @@ \fi \ifx#1\relax % permits \csname...\endcsname \newinsert#1% - \count#1\!!thousand + \count#1\plusthousand \skip #1\zeropoint \dimen#1\maxdimen \appendtoks\doprocessinsert#1\to\@@insertionlist diff --git a/tex/context/base/core-int.tex b/tex/context/base/core-int.tex index 3fd0a0bae..666786674 100644 --- a/tex/context/base/core-int.tex +++ b/tex/context/base/core-int.tex @@ -801,7 +801,8 @@ {\@@amboxcommand\setlocationbox{\??am\currentmenu}[\c!kader=\v!uit,\c!achtergrond=]{\ignorespaces#2\unskip}[#1]\\}% \def\menu@nop#1\\% - {\@@amboxcommand\phantom{\localframed[\??am\currentmenu][]{}}\\}% + %{\@@amboxcommand\phantom{\localframed[\??am\currentmenu][]{#1}}\\}% + {\@@amboxcommand\setlocationboxraw{\??am\currentmenu}[\c!kader=\v!uit,\c!achtergrond=,\c!leeg=\v!ja]{\ignorespaces#1\unskip}[]\\}% \def\menu@txt#1\\% {\@@amboxcommand\localframed[\??am\currentmenu][\c!kader=\v!uit,\c!achtergrond=]{\ignorespaces#1\unskip}\\}% diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex index 4ad389d31..6f8ddb293 100644 --- a/tex/context/base/core-itm.tex +++ b/tex/context/base/core-itm.tex @@ -107,10 +107,10 @@ \doinitializeitemgrouplevel{#1}% \fi} -\def\doinitializeitemgrouplevel#1% +\def\doinitializeitemgrouplevel#1% {\copyparameters [\??op\currentitemgroup#1][\??oo] - [\c!breedte,\c!factor,\c!afstand,\c!uitlijnen, + [\c!breedte,\c!factor,\c!afstand,\c!uitlijnen,\c!optie, \c!letter,\c!marletter,\c!symletter,\c!kopletter, \c!kleur,\c!markleur,\c!symkleur,\c!kopkleur, \c!kopvoor,\c!kopna,\c!voor,\c!tussen,\c!na, @@ -130,7 +130,7 @@ \fi} \def\doitemreference#1,#2,#3\\% - {\ifnum\itemlevel>#1 + {\ifnum\itemlevel>#1\relax \ifnum#1>\zerocount \tempsymbol \fi \getvalue{\@@currentitemsymbol{#2}}% \doitemreference#2,#3\\% @@ -145,7 +145,7 @@ \def\dosetupitemgroupvariable[#1]% [#2]% niveau instellingen {\doifelsenothing{#1} {\getparameters[\??op\currentitemgroup\itemlevel]}% [#2]}% - {\getparameters[\??op\currentitemgroup#1]}}% [#2]}} + {\getparameters[\??op\currentitemgroup#1]}}% [#2]}} \newconditional\inlinelistitem \setfalse\inlinelistitem @@ -204,10 +204,15 @@ {\dododosetupitemgroupconstant[#1][##1*]}% \processcommacommand[#2]\dodosetupitemgroupconstant} % expansion of #2 is handy for xml +%\def\dododododosetupitemgroup[#1][#2]% +% {\doifassignmentelse{#2} +% {\dosetupitemgroupvariable[#1][#2]} +% {\setitemparameter{#1}\empty{\dosetupitemgroupconstant[#1][#2]}}}% + \def\dododododosetupitemgroup[#1][#2]% - {\doifassignmentelse{#2} - {\dosetupitemgroupvariable[#1][#2]} - {\setitemparameter{#1}\empty{\dosetupitemgroupconstant[#1][#2]}}}% + {\doifassignmentelse{#2}% + {\dosetupitemgroupvariable[#1][#2]}% + {\setitemparameter{#1}\c!optie{#2}}}% \def\dodododosetupitemgroup[#1][#2]% {\ConvertToConstant\doifnot{#2}{} @@ -335,7 +340,131 @@ {\dodostartitemgroup[#2][]}% \fi} -\def\dodostartitemgroup[#1][#2]% +% \def\dodostartitemgroup[#1][#2]% +% {\setfalse\inlinelistitem % new, no indent (leftskip) +% \setfalse\concatnextitem % new, concat +% \ifhmode +% \ifconditional\autoconcatnextitem % new, concat +% \ifdim\lastskip=\itemsignal % new, concat +% \settrue\concatnextitem % new, concat +% \fi % new, concat +% \fi % new, concat +% \iftextitems\else\doifnotinset\v!tekst{#1}\par\fi % suboptimal +% \fi +% \ifnum\itemlevel=\maxitemlevel\relax +% \showmessage\m!layouts9\maxitemlevel +% \def\itemincrement{0}% +% \else +% \def\itemincrement{1}% +% \fi +% \doglobal\increment(\itemlevel,\itemincrement)% +% \initializeitemgrouplevel\itemlevel % safeguard +% \begingroup +% \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=\zerocount +% \globallet\itemcolumndepth\itemlevel +% \getitemparameter\itemlevel\c!voor +% \processfirstactioninset +% [#1] +% [ \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 +% \divide\scratchdimen \nofcolumns +% \hbox{\hskip\columneditemleftskip\hbox{\box##1}}}% +% \scratchdimen-\columneditemleftskip +% \multiply\scratchdimen \nofcolumns +% \advance\scratchdimen \columneditemleftskip +% \advance\scratchdimen \hsize +% \edef\columntextwidth{\the\scratchdimen}% +% \leftskip\zeropoint +% % so far +% \startkolommen +% [\c!n=\!!counta, % netter \??op\itemlevel\c!n +% \c!hoogte=, +% \c!lijn=\v!uit, +% \c!balanceren=\v!ja, +% \c!uitlijnen=\v!nee]% +% \fi\fi}% +% \doifinsetelse\v!intro{#1}\itemintrotrue\itemintrofalse +% \doglobal\increment\noflists +% \let\currentlist\noflists +% \newcounter\noflistelements +% \headitemfalse +% \subitemfalse +% \symbolitemfalse +% \let\marsymbol\relax +% \globallet\somdestination\empty +% \let\symsymbol\empty +% \the\itemgroupcommands +% \setitemlevel{#1}% +% \getitemparameter\itemlevel\empty +% \doifelsenothing{#1} % iffirstargument +% {\edef\@@opsymbool{\getitemparameter\itemlevel\c!symbool}% +% \letgvalueempty{\@@globalitemsymbol\itemlevel}% +% \global\letitemparameter\itemlevel\v!verder\empty +% \setitemmark\@@opsymbool +% \dosetupitemgroupvariable[\itemlevel][#2]} +% {\dosetupitemgroupconstant[\itemlevel][#1]% +% \dosetupitemgroupvariable[\itemlevel][#2]% +% \doifinsetelse\v!verder{#1}% \noexpand, else problems in non-etex with chinese +% {\edef\@@opsymbool{\noexpand\getvalue{\@@globalitemsymbol\itemlevel}}% +% \getitemparameter\itemlevel\v!verder} +% {\edef\@@opsymbool{\noexpand\getitemparameter{\itemlevel}{\c!symbool}}% +% \global\setitemparameter\itemlevel\v!verder +% {\dosetupitemgroupconstant[\itemlevel][#1]% +% \dosetupitemgroupvariable[\itemlevel][#2]}}% +% \def\docommando##1% \setitemmark resets \docommando +% {\doifnot{##1}{0}{\setitemmark{##1}}}% +% \processcommalist[#1,\@@opsymbool]\docommando}% +% \ifautoitemintro\ifnum\prevgraf<3 +% \itemintrotrue +% \fi\fi +% \ifparagraphitems +% \ifnum\itemlevel>\plusone +% \letitemparameter\itemlevel\c!tussen\empty +% \fi +% \else\ifpackeditems +% \letitemparameter\itemlevel\c!tussen\empty +% \fi\fi +% \calculatelistwidth\itemlevel{\dimen0}% +% \ifdim\dimen0>\zeropoint\relax +% \ifconditional\inlinelistitem\else +% \advance\leftskip \dimen0\relax +% \fi +% \fi} + +\def\dodostartitemgroup[#1]% [#2]% + {\relax % prevents lookahead + \ifnum\itemlevel=\maxitemlevel\relax + \showmessage\m!layouts9\maxitemlevel + \let\itemincrement\zerocount + \else + \let\itemincrement\plusone + \fi + \doglobal\increment(\itemlevel,\itemincrement)% + \initializeitemgrouplevel\itemlevel % safeguard + \edef\itemgroupoptions{\getitemparameter\itemlevel\c!optie}% + \ifx\itemgroupoptions\empty + \edef\itemgroupoptions{#1}% + \else + \doifsomething{#1}{\edef\itemgroupoptions{\itemgroupoptions,#1}}% + \fi + \expanded{\redostartitemgroup[\itemgroupoptions]}}% [#2] + +\def\redostartitemgroup[#1][#2]% {\setfalse\inlinelistitem % new, no indent (leftskip) \setfalse\concatnextitem % new, concat \ifhmode @@ -346,14 +475,6 @@ \fi % new, concat \iftextitems\else\doifnotinset\v!tekst{#1}\par\fi % suboptimal \fi - \ifnum\itemlevel=\maxitemlevel\relax - \showmessage\m!layouts9\maxitemlevel - \def\itemincrement{0}% - \else - \def\itemincrement{1}% - \fi - \doglobal\increment(\itemlevel,\itemincrement)% - \initializeitemgrouplevel\itemlevel % safeguard \begingroup \ifnum\itemlevel=\plusone % NIEUW \doadaptleftskip{\getitemparameter1\c!marge}% @@ -405,7 +526,7 @@ \let\symsymbol\empty \the\itemgroupcommands \setitemlevel{#1}% - \getitemparameter\itemlevel\empty + %\getitemparameter\itemlevel\empty \doifelsenothing{#1} % iffirstargument {\edef\@@opsymbool{\getitemparameter\itemlevel\c!symbool}% \letgvalueempty{\@@globalitemsymbol\itemlevel}% @@ -563,7 +684,7 @@ \fi \fi\fi \noindent - \setbox8=\hbox + \setbox8\hbox {\ifheaditem \doitemattributes\itemlevel\c!kopletter\c!kopkleur{\listitem}% \else\ifsymbolitem @@ -572,7 +693,7 @@ \doitemattributes\itemlevel\c!letter\c!kleur{\listitem}% \fi\fi}% \doifsomething\somdestination - {\setbox8=\hbox{\naar{\box8}[\somdestination]}}% + {\setbox8\hbox{\naar{\box8}[\somdestination]}}% \globallet\somdestination\empty \dimen2=\getitemparameter\itemlevel\c!breedte\relax % new, prevents loops when symbol is (not yet found) graphic @@ -583,9 +704,9 @@ \llap{\ifsubitem\llap{+}\fi\box8\hskip\linkermargeafstand}% \else \ifdim\dimen2=\zeropoint\relax - \calculatelistwidth{1}{\dimen0}% + \calculatelistwidth1{\dimen0}% \else - \calculatelistwidth{\itemlevel}{\dimen0}% + \calculatelistwidth\itemlevel{\dimen0}% \fi \iftextitems \hbox{\ifsubitem+\fi\box8\hskip\fontdimen2\font}\nobreak @@ -702,10 +823,13 @@ \def\sym#1% {\noindent - \setbox0\hbox{#1}% - \setbox0\hbox\ifdim\wd0<1em to 1.5\else spread 1\fi em{#1\hfil}% - \hangindent\wd0\relax - \box0 + \begingroup + \setbox\scratchbox\hbox{#1}% + \setbox\scratchbox\hbox + \ifdim\wd\scratchbox<1em to 1.5\else spread 1\fi em{#1\hfil}% + \hangindent\wd\scratchbox + \box\scratchbox + \endgroup \ignorespaces} \setupitemgroups % undocumented @@ -740,6 +864,7 @@ \c!linkertekst=(, \c!rechtertekst=), \c!start=1, + \c!optie=, \c!symbool=\itemlevel] % \v!niveau \def\defineitemgroup @@ -766,8 +891,8 @@ % keep these, needed for styles: -\def\startitemize {\startitemgroup[]} -\def\stopitemize {\stopitemgroup} -\def\setupitemize {\setupitemgroup[]} +% \def\startitemize {\startitemgroup[]} +% \def\stopitemize {\stopitemgroup} +% \def\setupitemize {\setupitemgroup[]} \protect \endinput diff --git a/tex/context/base/core-job.tex b/tex/context/base/core-job.tex index 4d5fc9c61..8d4e1dbb6 100644 --- a/tex/context/base/core-job.tex +++ b/tex/context/base/core-job.tex @@ -13,7 +13,7 @@ %D This module is still to be split and documented. -\writestatus{loading}{Context Core Macros (Job Handling)} +\writestatus{loading}{Context Core Macros / Job Handling} %S InputFile \input %S InputFile \omgeving \environment @@ -369,13 +369,6 @@ \def\deelomgeving #1 % {\doexecutefileonce{#1}} -\expanded - {\long\noexpand\def\csname\e!start\e!instellingen\endcsname##1 ##2\csname\e!stop\e!instellingen\endcsname% - {\noexpand\long\noexpand\setvalue{\??su##1}{##2}}} - -\long\def\startsetups#1 #2\stopsetups% for international purposes - {\long\setvalue{\??su#1}{#2}} - \def\setups {\dosingleargument\dosetups} @@ -392,6 +385,34 @@ \def\doifsetupselse#1% {\doifdefinedelse{\??su#1}} + +\long\@EA\def\csname\e!start\e!instellingen\endcsname#1 % + {\bgroup + \catcode`\^^M=\@@ignore + \xdostartsetups{#1}} + +\expanded + {\long\noexpand\def\noexpand\xdostartsetups##1##2\csname\e!stop\e!instellingen\endcsname% + {\egroup + \long\noexpand\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}}} % 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 3c7164b22..7f67930a1 100644 --- a/tex/context/base/core-lst.tex +++ b/tex/context/base/core-lst.tex @@ -128,7 +128,31 @@ {\noexpand\realfolio}}}% \next % \schrijfwegnaarlijst \endgroup}} + +% experimental (no nodes in mvl), needed for naw + +\def\immediatetolist[#1]#2#3#4% + {\begingroup + \convertexpanded{\??li#1}{#3}\asciilistentry + \makesectionformat + \immediatewriteutilitycommand + {\listentry + {#1}{}{#2}{\asciilistentry}% + {\sectionformat\sectionseparator\sectionseparator\number#4}% + {\realfolio}}% + \endgroup} +\def\immediatebetweenlist[#1]#2% + {\begingroup + \convertargument#2\to\asciilistentry + \makesectionformat + \immediatewriteutilitycommand + {\listbetween + {#1}{\asciilistentry}% + {\sectionformat\sectionseparator\sectionseparator0}% + {\realfolio}}% + \endgroup} + \def\listentry#1% {\executeifdefined{#1\c!lijst}\gobblefivearguments} @@ -176,13 +200,13 @@ \def\dodosetlijst#1% {\def\geenlijst{\splitsequence{\getvalue{\??li#1\c!limittext}}}% - \setvalue{#1\c!tussen}{\dotussenlijst{#1}}% + \setvalue{#1\c!tussen}{\dotussenlijst {#1}}% \setvalue{#1\c!lijst }{\dolijstelement{#1}}} \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 @@ -282,8 +306,34 @@ \dosetlistmode \endgroup} +% th esimple appreach: +% +% \def\dosettoclevel#1#2% +% {\dosetfilterlevel{\getvalue{#1#2\c!criterium}}\empty} +% +% but we want to to support selection by number: +% +% \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% - {\dosetfilterlevel{\getvalue{#1#2\c!criterium}}\empty} + {\ifundefined{#1#2\c!nummer}% + \dosetfilterlevel{\getvalue{#1#2\c!criterium}}\empty + \else + \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\dosetlistmode {\iflijstgeplaatst @@ -837,11 +887,11 @@ {\doifelsevalue{\??rl#1\c!status}\v!start {\doglobal\increment\referencecounter % must be resolved due to #2 \referentiebutton - {\box\nextbox + {\flushnextbox \pagereference[\r!from\referencecounter]% \doschrijfnaarreferentielijst{#1}{\referencecounter}{#2}}% [\r!to\referencecounter]} - {\box\nextbox}} + {\flushnextbox}} \hbox} % \vbox ? \def\referencelistentry#1% diff --git a/tex/context/base/core-ltb.tex b/tex/context/base/core-ltb.tex index 31aa1c130..1dfcdffc9 100644 --- a/tex/context/base/core-ltb.tex +++ b/tex/context/base/core-ltb.tex @@ -15,7 +15,12 @@ \expandafter \endinput \endTEX -% Experimental, undocumented, and currently only ETeX. +% This module is experimental, undocumented, and currently only set up +% eTeX. It provides a mechanism for typesetting very large tables, +% spanning many pages horizontally and vertically, with repeated +% header lines and (entry) columns, tab tracking, color, etc. In does +% two passes over a table, which is why the table goes into a +% buffer or file. As said, tables can be real huge. % \BH \BC .. \EC \BC .. \EC \EH % append % \BR \BC .. \EC \BC .. \EC \ER @@ -278,7 +283,7 @@ % forget about them \else \doifelse{\linetableparameter\c!regels}\v!passend - {\scratchdimen\pagetotal} + {\scratchdimen\pagetotal}% {\scratchdimen\zeropoint}% \dorecurse\noflinetableparts {\let\linetablepart\recurselevel @@ -710,6 +715,8 @@ \doifnotmode{demo}{\endinput} +% to be documented, see stan's ledger styles for an example + \setuplinetable[n=6,m={2,2,2},regels=25] \setuplinetable[c][1][width=2cm,background=color,backgroundcolor=red] diff --git a/tex/context/base/core-mak.tex b/tex/context/base/core-mak.tex index efc09452d..e8c75c9c1 100644 --- a/tex/context/base/core-mak.tex +++ b/tex/context/base/core-mak.tex @@ -50,7 +50,7 @@ \doifinset{\getvalue{#1\c!marge}}{\v!standaard,\v!ja}\noindent \hbox to \localhsize {\getvalue{#1\c!links}% - \box\nextbox + \flushnextbox \getvalue{#1\c!rechts}}% \doifvalue{#1\c!dieptecorrectie}\v!aan\baselinecorrection \doifvalue{#1\c!regelcorrectie }\v!aan\stopbaselinecorrection diff --git a/tex/context/base/core-mat.tex b/tex/context/base/core-mat.tex index 549218563..b9517053c 100644 --- a/tex/context/base/core-mat.tex +++ b/tex/context/base/core-mat.tex @@ -350,12 +350,12 @@ \ifdone \nextboxht\lineheight \else - \getnoflines{\ht\nextbox}% + \getnoflines\nextboxht \setbox\nextbox\vbox to \noflines\lineheight - {\vfill\box\nextbox\vfill}% - \setbox\nextbox\hbox{\lower\strutdepth\box\nextbox}% + {\vfill\flushnextbox\vfill}% + \setbox\nextbox\hbox{\lower\strutdepth\flushnextbox}% \fi - \snaptogrid[\displaygridcorrection]\hbox{\box\nextbox}% + \snaptogrid[\displaygridcorrection]\hbox{\flushnextbox}% \gdef\displaygridcorrection{\displaygridsnapping}% \egroup}} @@ -812,7 +812,7 @@ $\strut^{\the\everysupersub#1}_{\the\everysupersub#2}$}% \nextboxht\strutheight \nextboxdp\strutdepth - \box\nextbox + \flushnextbox \endgroup} \def\gridsupsub diff --git a/tex/context/base/core-mis.tex b/tex/context/base/core-mis.tex index c9befd5b7..901df91c0 100644 --- a/tex/context/base/core-mis.tex +++ b/tex/context/base/core-mis.tex @@ -1627,7 +1627,7 @@ \def\betweenbothpairedboxes {\switchtobodyfont[\@@ldkorps]% split under same regime - \setbox\firstpairedbox\box\nextbox + \setbox\firstpairedbox\flushnextbox \ifnum\pairedlocationa<2 \hsize\wd\firstpairedbox % trick \hsize\@@ldbreedte @@ -1650,9 +1650,52 @@ \setrigidcolumnhsize\hsize\@@ldafstand\@@ldn \fi} +% \def\afterbothpairedboxes +% {\setbox\secondpairedbox\vbox +% {\ifnum\@@ldn>1 \rigidcolumnbalance\nextbox \else \flushnextbox \fi}% +% \ifnum\pairedlocationa<2\hbox\else\vbox\fi\bgroup % hide vsize +% \forgetall +% \ifnum\pairedlocationa<2 +% \scratchdimen\maxoftwoboxdimens\ht\firstpairedbox\secondpairedbox +% \vsize\scratchdimen +% \ifdim\scratchdimen<\@@ldhoogte\relax % can be \vsize +% \scratchdimen\@@ldhoogte +% \fi +% \ifdim\scratchdimen>\@@ldmaxhoogte\relax +% \scratchdimen\@@ldmaxhoogte +% \fi +% \valignpairedbox\firstpairedbox \scratchdimen +% \valignpairedbox\secondpairedbox\scratchdimen +% \else +% \scratchdimen\maxoftwoboxdimens\wd\firstpairedbox\secondpairedbox +% \halignpairedbox\firstpairedbox \scratchdimen +% \halignpairedbox\secondpairedbox\scratchdimen +% \scratchdimen\ht\secondpairedbox +% \vsize\scratchdimen +% \ifdim\ht\secondpairedbox<\@@ldhoogte\relax % can be \vsize +% \scratchdimen\@@ldhoogte\relax % \relax needed +% \fi +% \ifdim\scratchdimen>\@@ldmaxhoogte\relax % todo: totale hoogte +% \scratchdimen\@@ldmaxhoogte\relax % \relax needed +% \fi +% \ifdim\scratchdimen>\ht\secondpairedbox +% \setbox\secondpairedbox\vbox to \scratchdimen +% {\ifnum\pairedlocationa=3 \vss\fi % +% \box\secondpairedbox +% \ifnum\pairedlocationa=2 \vss\fi}% \kern\zeropoint +% \fi +% \fi +% \ifcase\pairedlocationa +% \box\secondpairedbox\hskip\@@ldafstand\box\firstpairedbox \or +% \box\firstpairedbox \hskip\@@ldafstand\box\secondpairedbox\or +% \box\secondpairedbox\par \@@ldtussen \box\firstpairedbox \or +% \box\firstpairedbox \par \@@ldtussen \box\secondpairedbox\else +% \fi +% \egroup} + \def\afterbothpairedboxes {\setbox\secondpairedbox\vbox - {\ifnum\@@ldn>1 \rigidcolumnbalance\nextbox \else \box\nextbox \fi}% + {\ifnum\@@ldn>1 \rigidcolumnbalance\nextbox \else \flushnextbox \fi}% \ifnum\pairedlocationa<2\hbox\else\vbox\fi\bgroup % hide vsize \forgetall \ifnum\pairedlocationa<2 @@ -1688,8 +1731,8 @@ \ifcase\pairedlocationa \box\secondpairedbox\hskip\@@ldafstand\box\firstpairedbox \or \box\firstpairedbox \hskip\@@ldafstand\box\secondpairedbox\or - \box\secondpairedbox\par \@@ldtussen \box\firstpairedbox \or - \box\firstpairedbox \par \@@ldtussen \box\secondpairedbox\else + \box\secondpairedbox\par \nointerlineskip \@@ldtussen \box\firstpairedbox \or + \box\firstpairedbox \par \nointerlineskip \@@ldtussen \box\secondpairedbox\else \fi \egroup} @@ -1750,7 +1793,7 @@ \fi \forgetall \doifelse{\combinationparameter\c!hoogte}\v!passend - {\vbox}{\vbox to \combinationparameter\c!hoogte}% + \vbox {\vbox to \combinationparameter\c!hoogte}% \bgroup %\doifelsenothing{#1} % {\dodostartcombination[2*1*]} @@ -1781,9 +1824,9 @@ \def\docombination % we want to add struts but still ignore an empty box {\dowithnextbox - {\setbox0\box\nextbox + {\setbox0\flushnextbox \dowithnextbox - {\setbox2\box\nextbox + {\setbox2\flushnextbox \dodocombination}% \vtop\bgroup \def\next @@ -2021,9 +2064,9 @@ % \doifelsenothing{\@@rorotatie} % {\dostartrotation{90}} % {\dostartrotation{\@@rorotatie}}% -% \wd\nextbox\zeropoint -% \ht\nextbox\zeropoint -% \box\nextbox +% \nextboxwd\zeropoint +% \nextboxht\zeropoint +% \flushnextbox % \dostoprotation % #6} % #3}% @@ -2052,7 +2095,7 @@ % \hbox\bgroup % compatibility hack % \dowithnextbox % {\edef\@@rorotatie{#1}% -% \setbox\nextbox=\vbox{\box\nextbox}% +% \setbox\nextbox=\vbox{\flushnextbox}% % \dostoprotate % \egroup}} @@ -2061,7 +2104,7 @@ \hbox\bgroup % compatibility hack \dowithnextbox {\edef\@@rorotatie{#1}% - \setbox\nextbox=\vbox{\box\nextbox}% + \setbox\nextbox=\vbox{\flushnextbox}% \dostoprotate \egroup}} @@ -2069,7 +2112,7 @@ {\dontshowcomposition \scratchdimen\nextboxht\advance\scratchdimen\nextboxdp \doif\@@roplaats\v!hoog - {\setbox\nextbox\vbox{\hbox{\raise\nextboxdp\box\nextbox}}}% + {\setbox\nextbox\vbox{\hbox{\raise\nextboxdp\flushnextbox}}}% \setbox\nextbox\vbox to #1 {#2\relax \hbox to #4 @@ -2081,12 +2124,12 @@ \nextboxwd\zeropoint \nextboxht\zeropoint %\nextboxdp\zeropoint - \box\nextbox + \flushnextbox \dostoprotation #6} #3}% \nextboxdp\zeropoint -\box\nextbox +\flushnextbox \egroup} \def\dostoprotate @@ -2152,8 +2195,8 @@ % \let \@@efregels \@@xyregels % \let \@@epx \!!zeropoint % \let \@@epy \!!zeropoint -% \edef\@@epw {\the\wd\nextbox}% -% \edef\@@eph {\the\ht\nextbox}% +% \edef\@@epw {\the\nextboxwd}% +% \edef\@@eph {\the\nextboxht}% % \checkfiguresettings % \setfactorfiguresize % \setscalefiguresize @@ -2175,22 +2218,22 @@ % \c!sx=1,\c!sy=1,#1]% % \dowithnextbox % {\dontshowcomposition -% \ifdim\ht\nextbox>\zeropoint \ifdim\wd\nextbox>\zeropoint +% \ifdim\nextboxht>\zeropoint \ifdim\nextboxwd>\zeropoint % \doscalelikeafigure -% \dimen0=\@@xysy\ht\nextbox -% \dimen2=\@@xysy\dp\nextbox -% \dimen4=\@@xysx\wd\nextbox +% \dimen0=\@@xysy\nextboxht +% \dimen2=\@@xysy\nextboxdp +% \dimen4=\@@xysx\nextboxwd % \dimen6=\dimen0\advance\dimen6 \dimen2 % \setbox\nextbox\vbox to \dimen6 -% {\ht\nextbox\zeropoint -% \dp\nextbox\zeropoint +% {\nextboxht\zeropoint +% \nextboxdp\zeropoint % \vfill % erbij -% \dostartscaling\@@xysx\@@xysy\box\nextbox\dostopscaling}% -% \ht\nextbox\dimen0 -% \dp\nextbox\dimen2 -% \wd\nextbox\dimen4 +% \dostartscaling\@@xysx\@@xysy\flushnextbox\dostopscaling}% +% \nextboxht\dimen0 +% \nextboxdp\dimen2 +% \nextboxwd\dimen4 % \fi \fi -% \box\nextbox +% \flushnextbox % \egroup} % \hbox} @@ -2206,8 +2249,8 @@ \let \@@efregels \@@xyregels \let \@@epx \!!zeropoint \let \@@epy \!!zeropoint - \edef\@@epw {\the\wd\nextbox}% - \edef\@@eph {\the\ht\nextbox}% + \edef\@@epw {\the\nextboxwd}% + \edef\@@eph {\the\nextboxht}% \figwid\zeropoint \figxsca\plusone % see note * (core-fig) \fighei\zeropoint \figysca\plusone % see note * (core-fig) \checkfiguresettings @@ -2216,9 +2259,9 @@ \setdimensionfiguresize \convertfigureinsertscale\@@epx\figx\figxsca\scax \convertfigureinsertscale\@@epy\figy\figysca\scay - \scratchdimen\scax\s!pt \divide\scratchdimen 100 + \scratchdimen\scax\s!pt \divide\scratchdimen \plushundred \edef\@@xysx{\withoutpt\the\scratchdimen}% - \scratchdimen\scay\s!pt \divide\scratchdimen 100 + \scratchdimen\scay\s!pt \divide\scratchdimen \plushundred \edef\@@xysy{\withoutpt\the\scratchdimen}}} \def\doschaal[#1]% @@ -2231,25 +2274,25 @@ \c!sx=1,\c!sy=1,#1]% \dowithnextbox {\dontshowcomposition - \ifdim\ht\nextbox>\zeropoint \ifdim\wd\nextbox>\zeropoint + \ifdim\nextboxht>\zeropoint \ifdim\nextboxwd>\zeropoint \doscalelikeafigure - \dimen0=\@@xysy\ht\nextbox - \dimen2=\@@xysy\dp\nextbox - \dimen4=\@@xysx\wd\nextbox + \dimen0=\@@xysy\nextboxht + \dimen2=\@@xysy\nextboxdp + \dimen4=\@@xysx\nextboxwd \dimen6=\dimen0\advance\dimen6 \dimen2 % \setbox\nextbox\vbox to \dimen6 -% {\ht\nextbox\zeropoint -% \dp\nextbox\zeropoint +% {\nextboxht\zeropoint +% \nextboxdp\zeropoint % \vfill % erbij -% \dostartscaling\@@xysx\@@xysy\box\nextbox\dostopscaling}% +% \dostartscaling\@@xysx\@@xysy\flushnextbox\dostopscaling}% \setbox\nextbox\hbox {\smashbox\nextbox - \dostartscaling\@@xysx\@@xysy\box\nextbox\dostopscaling}% - \ht\nextbox\dimen0 - \dp\nextbox\dimen2 - \wd\nextbox\dimen4 + \dostartscaling\@@xysx\@@xysy\flushnextbox\dostopscaling}% + \nextboxht\dimen0 + \nextboxdp\dimen2 + \nextboxwd\dimen4 \fi \fi - \box\nextbox + \flushnextbox \egroup} \hbox} @@ -2262,11 +2305,11 @@ {\bgroup \dowithnextbox {\dontshowcomposition - \scratchdimen\wd\nextbox + \scratchdimen\nextboxwd \setbox\nextbox\vbox - {\dostartmirroring\hskip-\wd\nextbox\box\nextbox\dostopmirroring}% - \wd\nextbox\scratchdimen - \box\nextbox + {\dostartmirroring\hskip-\nextboxwd\flushnextbox\dostopmirroring}% + \nextboxwd\scratchdimen + \flushnextbox \egroup}} \def\spiegel diff --git a/tex/context/base/core-nav.tex b/tex/context/base/core-nav.tex index 5f43da39b..e3e2e3a76 100644 --- a/tex/context/base/core-nav.tex +++ b/tex/context/base/core-nav.tex @@ -303,7 +303,7 @@ \def\dostartinteractie {\bgroup \let\stopinteractie\egroup - \dowithnextbox{\dostarthide\box\nextbox\dostophide\egroup}\hbox} + \dowithnextbox{\dostarthide\flushnextbox\dostophide\egroup}\hbox} \let\startinteractie = \relax \let\stopinteractie = \relax diff --git a/tex/context/base/core-new.tex b/tex/context/base/core-new.tex index 0a3eb82e7..28d667cab 100644 --- a/tex/context/base/core-new.tex +++ b/tex/context/base/core-new.tex @@ -239,103 +239,9 @@ {\egroup \setbox\nointerferencebox\box\voidb@x} -% will go to ... - -\def\alignedbox - {\dodoubleempty\doalignedbox[]} - -% \def\doalignedbox[#1][#2]% -% {\bgroup -% %\let\iftraceboxplacement\iftracelayers % ugly -% \dowithnextbox -% {\let\next\middlebox -% \processaction -% [#2] -% [ t=>\let\next\topbox , b=>\let\next\bottombox , -% l=>\let\next\leftbox , r=>\let\next\rightbox , -% bl=>\let\next\bottomleftbox,br=>\let\next\bottomrightbox, -% tl=>\let\next\topleftbox ,tr=>\let\next\toprightbox , -% lt=>\let\next\lefttopbox ,lb=>\let\next\leftbottombox , -% rt=>\let\next\righttopbox ,rb=>\let\next\rightbottombox]% -% \next{\box\nextbox}% -% \egroup}#1} - -\def\doalignedbox[#1][#2]% - {\bgroup - %\let\iftraceboxplacement\iftracelayers % ugly - \dowithnextbox - {\serializecommalist[#2]% - \executeifdefined{\??ab\??ab\serializedcommalist}\middlebox{\box\nextbox}% - \egroup}#1} - -\setvalue{\??ab\??ab }{\middlebox} -\setvalue{\??ab\??ab\v!midden}{\middlebox} -\setvalue{\??ab\??ab\v!links }{\leftbox } -\setvalue{\??ab\??ab\v!rechts}{\rightbox } -\setvalue{\??ab\??ab\v!onder }{\bottombox} -\setvalue{\??ab\??ab\v!boven }{\topbox } - -\setvalue{\??ab\??ab\v!links \v!boven }{\lefttopbox} -\setvalue{\??ab\??ab\v!links \v!onder }{\leftbottombox} -\setvalue{\??ab\??ab\v!rechts\v!boven }{\righttopbox} -\setvalue{\??ab\??ab\v!rechts\v!onder }{\rightbottombox} -\setvalue{\??ab\??ab\v!boven \v!links }{\topleftbox} -\setvalue{\??ab\??ab\v!onder \v!links }{\bottomleftbox} -\setvalue{\??ab\??ab\v!boven \v!rechts}{\toprightbox} -\setvalue{\??ab\??ab\v!onder \v!rechts}{\bottomrightbox} - -\setvalue{\??ab\??ab c}{\middlebox} -\setvalue{\??ab\??ab l}{\leftbox} -\setvalue{\??ab\??ab r}{\rightbox} -\setvalue{\??ab\??ab o}{\bottombox} -\setvalue{\??ab\??ab b}{\topbox} - -\setvalue{\??ab\??ab lt}{\lefttopbox} -\setvalue{\??ab\??ab lb}{\leftbottombox} -\setvalue{\??ab\??ab rt}{\righttopbox} -\setvalue{\??ab\??ab rb}{\rightbottombox} -\setvalue{\??ab\??ab tl}{\topleftbox} -\setvalue{\??ab\??ab bl}{\bottomleftbox} -\setvalue{\??ab\??ab tr}{\toprightbox} -\setvalue{\??ab\??ab br}{\bottomrightbox} - -\def\offsetbox - {\dodoubleempty\dooffsetbox[]} - -\def\dooffsetbox[#1][#2]% - {\bgroup - \dowithnextbox - {\getparameters[\??ox] - [\c!x=\zeropoint, - \c!y=\zeropoint, - \c!breedte=\wd\nextbox, - \c!hoogte=\ht\nextbox, - \c!diepte=\dp\nextbox, - \c!plaats=, - #2]% - \freezedimenmacro\@@oxbreedte - \freezedimenmacro\@@oxhoogte - \freezedimenmacro\@@oxdiepte - \setbox\nextbox\hbox - {\hskip\@@oxx\lower\@@oxy\hbox - {\doifelsenothing\@@oxplaats - {\box\nextbox} - {\alignedbox[\@@oxplaats]\hbox{\box\nextbox}}}}% - \wd\nextbox\@@oxbreedte - \ht\nextbox\@@oxhoogte - \dp\nextbox\@@oxdiepte - \box\nextbox - \egroup}#1} - -\def\offset {\dodoubleempty\dooffsetbox [\hbox]} % yes or no -\def\aligned{\dosingleempty\doalignedbox[\hbox]} % yes or no - -%\ruledhbox{\offsetbox[x=-1cm,y=-1cm,location=c] -% {\framed[width=4cm,height=4cm]{x}}} - %D new and beta -% \def\defineshortcut% +% \def\defineshortcut % {\dodoubleargument\dodefineshortcut} % % \bgroup @@ -353,7 +259,7 @@ % % \egroup % -% \def\doshortcut% +% \def\doshortcut % {\bgroup % \catcode`\>=\@@other % \dodoshortcut} diff --git a/tex/context/base/core-not.tex b/tex/context/base/core-not.tex index 28716b8ee..e9afb604d 100644 --- a/tex/context/base/core-not.tex +++ b/tex/context/base/core-not.tex @@ -13,6 +13,8 @@ \writestatus{loading}{Context Core Macros / Footnote Handling} +%D BEWARE: THIS MODULE IS REPLACED BY A NEW VERSION (FOR IDRIS) + %D Unfortunately we cannot force an even number of lines in %D a two column footnote placement. diff --git a/tex/context/base/core-ntb.tex b/tex/context/base/core-ntb.tex index e673cedd7..04f1b52fc 100644 --- a/tex/context/base/core-ntb.tex +++ b/tex/context/base/core-ntb.tex @@ -96,8 +96,11 @@ \def\settblhei#1#2{\setxvalue{\@@tblprefix#1:h}{#2}} % global ! \def\settblaut#1#2{\setxvalue{\@@tblprefix#1:a}{#2}} % global ! -\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\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\gettblwid#1{\executeifdefined{\@@tblprefix#1:w}\zeropoint} +\def\gettblhei#1{\executeifdefined{\@@tblprefix#1:h}\zeropoint} \def\gettblaut#1{\csname\@@tblprefix#1:a\endcsname} \def\doiftbltag #1#2{\doifdefined {\@@tblprefix#1:#2:s}} @@ -518,12 +521,21 @@ \fi \egroup}} +%\def\begintbl +% {\doglobal\newcounter\colTBL +% \doglobal\newcounter\rowTBL +% \doglobal\decrement\rowTBL +% \tabskip\zeropoint +% \halign\bgroup\ignorespaces##\unskip&&\ignorespaces##\unskip\cr} + \def\begintbl {\doglobal\newcounter\colTBL \doglobal\newcounter\rowTBL \doglobal\decrement\rowTBL \tabskip\zeropoint - \halign\bgroup\ignorespaces##\unskip&&\ignorespaces##\unskip\cr} + \halign\bgroup + \registerparoptions % new + \ignorespaces##\unskip&&\ignorespaces##\unskip\cr} \def\endtbl {\egroup} diff --git a/tex/context/base/core-obj.tex b/tex/context/base/core-obj.tex index 346a292cb..33473b4c7 100644 --- a/tex/context/base/core-obj.tex +++ b/tex/context/base/core-obj.tex @@ -123,26 +123,26 @@ \@EA\xdef\csname\r!object#2::#3\endcsname {\noexpand\dohandleobject{#2}{#3}% {\ifhbox\nextbox\hbox\else\vbox\fi}% - %{\the\wd\nextbox}{\the\ht\nextbox}{\the\dp\nextbox}}% - {\number\wd\nextbox}{\number\ht\nextbox}{\number\dp\nextbox}}% + %{\the\nextboxwd}{\the\nextboxht}{\the\nextboxdp}}% + {\number\nextboxwd}{\number\nextboxht}{\number\nextboxdp}}% \expanded % freeze the dimensions since \dostartobject may use \nextbox {\dostartobject - {#2}{#3}{\the\wd\nextbox}{\the\ht\nextbox}{\the\dp\nextbox}}% + {#2}{#3}{\the\nextboxwd}{\the\nextboxht}{\the\nextboxdp}}% \ifcase#1\relax\else \ifdim\objectoffset>\zeropoint \scratchdimen\objectoffset - \edef\width {\the\wd\nextbox}% - \edef\height{\the\ht\nextbox}% - \edef\depth {\the\dp\nextbox}% + \edef\width {\the\nextboxwd}% + \edef\height{\the\nextboxht}% + \edef\depth {\the\nextboxdp}% \setbox\nextbox\vbox spread 2\scratchdimen {\forgetall - \vss\hbox spread 2\scratchdimen{\hss\box\nextbox\hss}\vss}% + \vss\hbox spread 2\scratchdimen{\hss\flushnextbox\hss}\vss}% \setbox\nextbox\hbox - {\hskip-\scratchdimen\lower\scratchdimen\box\nextbox}% - \wd\nextbox\width - \ht\nextbox\height - \dp\nextbox\depth + {\hskip-\scratchdimen\lower\scratchdimen\flushnextbox}% + \nextboxwd\width + \nextboxht\height + \nextboxdp\depth \fi \fi - \box\nextbox + \flushnextbox \dostopobject \elabelgroup} diff --git a/tex/context/base/core-pos.tex b/tex/context/base/core-pos.tex index 6af729aad..b60186eed 100644 --- a/tex/context/base/core-pos.tex +++ b/tex/context/base/core-pos.tex @@ -115,17 +115,69 @@ \let\pospxywhd \setpospxywhd \let\pospxyplus\setpospxyplus} +% \def\setpospxy#1#2#3#4% +% {\dosetpositionnm\@@posp{#2}% +% \dosetpositionpt\@@posx{#3}% +% \dosetpositionpt\@@posy{#4}% +% %\setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy}}% +% \@EA\xdef\csname\POSprefix#1\endcsname{\@@posp,\@@posx,\@@posy}}% +% +% \def\setpospxywhd#1#2#3#4#5#6#7% +% {\dosetpositionnm\@@posp{#2}% +% \dosetpositionpt\@@posx{#3}% +% \dosetpositionpt\@@posy{#4}% +% \dosetpositionpt\@@posw{#5}% +% \dosetpositionpt\@@posh{#6}% +% \dosetpositionpt\@@posd{#7}% +% %\setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd}}% +% \@EA\xdef\csname\POSprefix#1\endcsname{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd}}% +% +% \def\setpospxyplus#1#2#3#4#5#6#7#8% +% {\dosetpositionnm\@@posp{#2}% +% \dosetpositionpt\@@posx{#3}% +% \dosetpositionpt\@@posy{#4}% +% \dosetpositionpt\@@posw{#5}% +% \dosetpositionpt\@@posh{#6}% +% \dosetpositionpt\@@posd{#7}% +% %\setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd,#8}} +% \@EA\xdef\csname\POSprefix#1\endcsname{\@@posp,\@@posx,\@@posy,\@@posw,\@@posh,\@@posd,#8}} + +%D This is real tricky! The page anchor is applied to the +%D page box and therefore flushed first. So, when present, it +%D is applied to all positions except itself. + +\chardef\positionanchormode=0 % don't relocate page origin +\chardef\positionanchormode=1 % relocate page origin once + +\def\pageanchor{page:0} + +\def\registerpageposition#1% this one is flushed first ! + {\ifpositioning\ifcase\realpageno\or + \ifdim\printpapierhoogte=\papierhoogte\else + \ifdim\printpapierbreedte=\papierbreedte\else + \setbox#1\hbox{\hpos\pageanchor{\box#1}}% + \fi + \fi + \fi\fi} + +\def\dosetpositionxy#1#2#3% todo: scaled points + {\scratchdimen#2\s!sp + \ifcase\positionanchormode\or + \advance\scratchdimen-#3\pageanchor + \fi + \xdef#1{\@EA\withoutpt\the\scratchdimen}} + \def\setpospxy#1#2#3#4% {\dosetpositionnm\@@posp{#2}% - \dosetpositionpt\@@posx{#3}% - \dosetpositionpt\@@posy{#4}% + \dosetpositionxy\@@posx{#3}\MPx + \dosetpositionxy\@@posy{#4}\MPy %\setxvalue{\POSprefix#1}{\@@posp,\@@posx,\@@posy}}% \@EA\xdef\csname\POSprefix#1\endcsname{\@@posp,\@@posx,\@@posy}}% \def\setpospxywhd#1#2#3#4#5#6#7% {\dosetpositionnm\@@posp{#2}% - \dosetpositionpt\@@posx{#3}% - \dosetpositionpt\@@posy{#4}% + \dosetpositionxy\@@posx{#3}\MPx + \dosetpositionxy\@@posy{#4}\MPy \dosetpositionpt\@@posw{#5}% \dosetpositionpt\@@posh{#6}% \dosetpositionpt\@@posd{#7}% @@ -134,8 +186,8 @@ \def\setpospxyplus#1#2#3#4#5#6#7#8% {\dosetpositionnm\@@posp{#2}% - \dosetpositionpt\@@posx{#3}% - \dosetpositionpt\@@posy{#4}% + \dosetpositionxy\@@posx{#3}\MPx + \dosetpositionxy\@@posy{#4}\MPy \dosetpositionpt\@@posw{#5}% \dosetpositionpt\@@posh{#6}% \dosetpositionpt\@@posd{#7}% @@ -258,17 +310,17 @@ %D expressions. \def\doMPp #1,#2,#3,#4,#5,#6,#7\relax{#1} -\def\doMPx #1,#2,#3,#4,#5,#6,#7\relax{#2pt} -\def\doMPy #1,#2,#3,#4,#5,#6,#7\relax{#3pt} -\def\doMPw #1,#2,#3,#4,#5,#6,#7\relax{#4pt} -\def\doMPh #1,#2,#3,#4,#5,#6,#7\relax{#5pt} -\def\doMPd #1,#2,#3,#4,#5,#6,#7\relax{#6pt} -\def\doMPxy #1,#2,#3,#4,#5,#6,#7\relax{(#2pt,#3pt)} -\def\doMPll #1,#2,#3,#4,#5,#6,#7\relax{(#2pt,#3pt-#6pt)} -\def\doMPlr #1,#2,#3,#4,#5,#6,#7\relax{(#2pt+#4pt,#3pt-#6pt)} -\def\doMPur #1,#2,#3,#4,#5,#6,#7\relax{(#2pt+#4pt,#3pt+#5pt)} -\def\doMPul #1,#2,#3,#4,#5,#6,#7\relax{(#2pt,#3pt+#5pt)} -\def\doMPpos#1,#2,#3,#4,#5,#6,#7\relax{#1,#2pt,#3pt,#4pt,#5pt,#6pt} +\def\doMPx #1,#2,#3,#4,#5,#6,#7\relax{#2\s!pt} +\def\doMPy #1,#2,#3,#4,#5,#6,#7\relax{#3\s!pt} +\def\doMPw #1,#2,#3,#4,#5,#6,#7\relax{#4\s!pt} +\def\doMPh #1,#2,#3,#4,#5,#6,#7\relax{#5\s!pt} +\def\doMPd #1,#2,#3,#4,#5,#6,#7\relax{#6\s!pt} +\def\doMPxy #1,#2,#3,#4,#5,#6,#7\relax{(#2\s!pt,#3\s!pt)} +\def\doMPll #1,#2,#3,#4,#5,#6,#7\relax{(#2\s!pt,#3\s!pt-#6\s!pt)} +\def\doMPlr #1,#2,#3,#4,#5,#6,#7\relax{(#2\s!pt+#4\s!pt,#3\s!pt-#6\s!pt)} +\def\doMPur #1,#2,#3,#4,#5,#6,#7\relax{(#2\s!pt+#4\s!pt,#3\s!pt+#5\s!pt)} +\def\doMPul #1,#2,#3,#4,#5,#6,#7\relax{(#2\s!pt,#3\s!pt+#5\s!pt)} +\def\doMPpos#1,#2,#3,#4,#5,#6,#7\relax{#1,#2\s!pt,#3\s!pt,#4\s!pt,#5\s!pt,#6\s!pt} %D As said, we will default to zero (dimensions) when a %D position is unknown. @@ -383,31 +435,31 @@ % % \def\setpositionbox#1% % {\dowithnextbox -% {\hbox to \wd\nextbox +% {\hbox to \nextboxwd % {\initializenextposition % \def\currentposition{#1}% % \dosetpositionwhd \currentposition -% {\number\wd\nextbox}% -% {\number\ht\nextbox}% -% {\number\dp\nextbox}% +% {\number\nextboxwd}% +% {\number\nextboxht}% +% {\number\nextboxdp}% % \traceposstring\llap\green{\currentposition>}% -% \setbox\positionbox\box\nextbox +% \setbox\positionbox\flushnextbox % \dopositionaction\currentposition % \box\positionbox % \hss}}} % % \def\setpositionplus#1#2% % {\dowithnextbox -% {\hbox to \wd\nextbox +% {\hbox to \nextboxwd % {\initializenextposition % \def\currentposition{#1}% % \dosetpositionplus \currentposition -% {\number\wd\nextbox}% -% {\number\ht\nextbox}% -% {\number\dp\nextbox}% +% {\number\nextboxwd}% +% {\number\nextboxht}% +% {\number\nextboxdp}% % {#2}% % \traceposstring\rlap\magenta{<\currentposition}% -% \setbox\positionbox\box\nextbox +% \setbox\positionbox\flushnextbox % \dopositionaction\currentposition % \box\positionbox % \hss}}} @@ -431,40 +483,69 @@ \dopositionaction\currentposition \fi} +\def\setpositiondata#1#2#3#4% + {\iftrialtypesetting \else + \initializenextposition + \hbox + {\def\currentposition{#1}% + \dosetpositionwhd\currentposition + {\number#2}% + {\number#3}% + {\number#4}% + \traceposstring\llap\green{\currentposition>}% + \dopositionaction\currentposition + \hss}% + \fi} + \def\setpositionbox#1% {\dowithnextbox {\iftrialtypesetting - \box\nextbox + \flushnextbox \else \initializenextposition - \hbox to \wd\nextbox + \hbox to \nextboxwd {\def\currentposition{#1}% \dosetpositionwhd\currentposition - {\number\wd\nextbox}% - {\number\ht\nextbox}% - {\number\dp\nextbox}% + {\number\nextboxwd}% + {\number\nextboxht}% + {\number\nextboxdp}% \traceposstring\llap\green{\currentposition>}% - \setbox\positionbox\box\nextbox + \setbox\positionbox\flushnextbox \dopositionaction\currentposition \box\positionbox \hss}% \fi}} +\def\setpositiondataplus#1#2#3#4#5% + {\iftrialtypesetting \else + \initializenextposition + \hbox to \nextboxwd + {\def\currentposition{#1}% + \dosetpositionplus\currentposition + {\number#2}% + {\number#3}% + {\number#4}% + {#5}% + \traceposstring\rlap\magenta{<\currentposition}% + \dopositionaction\currentposition + \hss}% + \fi} + \def\setpositionplus#1#2% {\dowithnextbox {\iftrialtypesetting - \box\nextbox + \flushnextbox \else \initializenextposition - \hbox to \wd\nextbox + \hbox to \nextboxwd {\def\currentposition{#1}% \dosetpositionplus\currentposition - {\number\wd\nextbox}% - {\number\ht\nextbox}% - {\number\dp\nextbox}% + {\number\nextboxwd}% + {\number\nextboxht}% + {\number\nextboxdp}% {#2}% \traceposstring\rlap\magenta{<\currentposition}% - \setbox\positionbox\box\nextbox + \setbox\positionbox\flushnextbox \dopositionaction\currentposition \box\positionbox \hss}% @@ -492,52 +573,38 @@ \let\cleanuppositionaction\gobbleoneargument %D The next one will be overloaded later. - -% \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 -% \getvalue{\POSactionprefix#1::}% -% \cleanuppositionaction{#1}% -% \egroup -% \else -% % shouldn't happen too often -% \traceposstring\clap\cyan{<#1>}% -% \fi -% \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 - % shouldn't happen too often - \traceposstring\clap\cyan{<#1>}% - \fi - \fi} +%D +%D \starttypen +%D \def\dopositionaction#1% test saves hash entry in etex +%D {\ifundefined{\POSactionprefix#1::}\else +%D \ifnum\MPp{#1}>\zerocount % new +%D \setbox\scratchbox\hbox \bgroup +%D \traceposstring\clap\red{<#1>}% +%D \the\everyinsertpositionaction +%D \the\everypositionaction +%D \ifcollectMPpositiongraphics +%D % can save a lot of run time +%D \pushMPdrawing +%D \MPshiftdrawingtrue +%D \resetMPdrawing +%D \getvalue{\POSactionprefix#1::}% +%D \ifMPdrawingdone +%D \getMPdrawing +%D \fi +%D \resetMPdrawing +%D \popMPdrawing +%D \else +%D \getvalue{\POSactionprefix#1::}% +%D \fi +%D \cleanuppositionaction{#1}% +%D \egroup +%D \smashedbox\scratchbox +%D \else +%D % shouldn't happen too often +%D \traceposstring\clap\cyan{<#1>}% +%D \fi +%D \fi} +%D \stoptypen \def\doifpositionaction#1% {\ifundefined{\POSactionprefix#1::}% @@ -695,20 +762,24 @@ \fi \fi \fi \fi \fi \fi} +\chardef\parposstrut=1 % 0 => no strut data, so fall backs used + \def\doregisterparoptions {\doglobal\increment\parposcounter \bgroup \leftskip 1\leftskip \rightskip1\rightskip - \setpositionplus + \setpositiondataplus {p:\parposcounter}% % identifier + {\zeropoint} + {\ht\strutbox} + {\dp\strutbox} {\efficientdimen\hsize ,% 1 \efficientdimen\leftskip ,% 2 \efficientdimen\rightskip ,% 3 \efficientdimen\hangindent,% 4 \the\hangafter ,% 5 \efficientdimen\parindent }% 6 - % no strut here ! (see stepcharts and pascal) \normalhbox{\registerparsymbol}% \egroup} @@ -840,22 +911,41 @@ \dopresetpositionanchors \fi} +% \def\dopresetpositionanchors +% {\bgroup +% \dimen0=\ifdim\topskip>\ht\strutbox\topskip\else\ht\strutbox\fi +% \dimen2=\MPy\textanchor +% \dimen4=\dimen2 +% \advance\dimen2 \MPh\textanchor % space is essential +% \advance\dimen2 -\dimen0 +% \advance\dimen4 \dp\strutbox +% \dimen6=\MPx\textanchor +% \dimen8=\MPw\textanchor +% \setxvalue{\POSprefix\headanchor}% +% {\realfolio,\withoutpt{\the\dimen6},\withoutpt{\the\dimen2},% +% \withoutpt{\the\dimen8},\withoutpt{\the\dimen0},\withoutpt{\the\dp\strutbox}}% +% \setxvalue{\POSprefix\tailanchor}% +% {\realfolio,\withoutpt{\the\dimen6},\withoutpt{\the\dimen4},% +% \withoutpt{\the\dimen8},\withoutpt{\the\ht\strutbox},\withoutpt{\the\dp\strutbox}}% +% %\showanchor\textanchor\showanchor\headanchor\showanchor\tailanchor\wait +% \egroup} + \def\dopresetpositionanchors {\bgroup - \dimen0=\ifdim\topskip>\ht\strutbox\topskip\else\ht\strutbox\fi - \dimen2=\MPy\textanchor - \dimen4=\dimen2 - \advance\dimen2 \MPh\textanchor % space is essential - \advance\dimen2 -\dimen0 - \advance\dimen4 \dp\strutbox - \dimen6=\MPx\textanchor - \dimen8=\MPw\textanchor + \!!dimena\ifdim\topskip>\ht\strutbox\topskip\else\ht\strutbox\fi + \!!dimenb\MPy\textanchor + \!!dimenc\!!dimenb + \advance\!!dimenb \MPh\textanchor % space is essential + \advance\!!dimenb -\!!dimena + \advance\!!dimenc \dp\strutbox + \!!dimend\MPx\textanchor + \!!dimene\MPw\textanchor \setxvalue{\POSprefix\headanchor}% - {\realfolio,\withoutpt{\the\dimen6},\withoutpt{\the\dimen2},% - \withoutpt{\the\dimen8},\withoutpt{\the\dimen0},\withoutpt{\the\dp\strutbox}}% + {\realfolio,\withoutpt{\the\!!dimend},\withoutpt{\the\!!dimenb},% + \withoutpt{\the\!!dimene},\withoutpt{\the\!!dimena},\withoutpt{\the\dp\strutbox}}% \setxvalue{\POSprefix\tailanchor}% - {\realfolio,\withoutpt{\the\dimen6},\withoutpt{\the\dimen4},% - \withoutpt{\the\dimen8},\withoutpt{\the\ht\strutbox},\withoutpt{\the\dp\strutbox}}% + {\realfolio,\withoutpt{\the\!!dimend},\withoutpt{\the\!!dimenc},% + \withoutpt{\the\!!dimene},\withoutpt{\the\ht\strutbox},\withoutpt{\the\dp\strutbox}}% %\showanchor\textanchor\showanchor\headanchor\showanchor\tailanchor\wait \egroup} @@ -922,8 +1012,10 @@ \def\MPanchoridentifier{mpa} % {mp-anchor} \def\MPoverlayposprefix{MO::} -\long\def\defineMPpositiongraphic#1% - {\long\setvalue{\MPoverlayposprefix#1}} +% obsolete and wrong anyway +% +% \long\def\defineMPpositiongraphic#1% +% {\long\setvalue{\MPoverlayposprefix#1}} %D The rest of the definitions concerning such overlays may %D look complicated, @@ -960,8 +1052,23 @@ % \vfill}% % \fi} -\def\positionoverlay#1% the test prevents too many redundant positions - {\ifpositioning % in (not used) text* position layers +% \def\positionoverlay#1% the test prevents too many redundant positions +% {\ifpositioning % in (not used) text* position layers +% \vbox to \overlayheight +% {\doifpositionactionelse{#1::\MPanchoridentifier}% +% {\edef\MPanchorid{#1::\MPanchoridentifier:\MPanchornumber}% +% \edef\MPanchor##1{\MPpos{\MPanchorid}}% +% \the\everyinsertpositionaction +% \copyposition{#1::\MPanchoridentifier}{#1::\MPanchoridentifier:\MPanchornumber}% +% \hpos +% {#1::\MPanchoridentifier:\MPanchornumber}% +% {\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}}}% +% {\hbox to \overlaywidth{\hss}}% +% \vfill}% +% \fi} + +\def\positionoverlay#1% the test prevents too many redundant positions + {\ifpositioning % in (not used) text* position layers \vbox to \overlayheight {\doifpositionactionelse{#1::\MPanchoridentifier}% {\edef\MPanchorid{#1::\MPanchoridentifier:\MPanchornumber}% @@ -970,7 +1077,15 @@ \copyposition{#1::\MPanchoridentifier}{#1::\MPanchoridentifier:\MPanchornumber}% \hpos {#1::\MPanchoridentifier:\MPanchornumber}% - {\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}}}% + % this is ok + %{\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}}}% + % but this one prevents cyclic runs due to + % rounding errors + {\setbox\scratchbox\hbox to \overlaywidth + {\dopositionaction{#1::\MPanchoridentifier}\hss}% + \ht\scratchbox\overlayheight + \dp\scratchbox\zeropoint + \box\scratchbox}}% {\hbox to \overlaywidth{\hss}}% \vfill}% \fi} @@ -1022,7 +1137,7 @@ \def\handlepositionaction#1\with#2\on#3% {\bgroup \ifx\currentpositionoverlay\empty - \edef\!!stringa{#3}% + \edef\!!stringa{#3}% no layer, just pos itself as anchor \else \edef\!!stringa{\currentpositionoverlay::\MPanchoridentifier}% \fi @@ -1053,7 +1168,7 @@ \def\docleanpositionboxes#1#2#3% pos tag setups {\ifnum\MPp{#1}<\realpageno \else - \noexpand \dohandlepositionboxes{#1}{#2}{#3}% + \noexpand \dohandlepositionboxes{#1}{#2}{#3}% reinsert \fi} \appendtoks @@ -1092,7 +1207,7 @@ % \placeMPgraphic % \egroup} -\newif\ifcollectMPpositiongraphics +\newif\ifcollectMPpositiongraphics \collectMPpositiongraphicstrue \long\def\useMPpositiongraphic#1#2#3% {\bgroup @@ -1112,10 +1227,41 @@ % 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\dopositionaction#1% test saves hash entry in etex {\ifundefined{\POSactionprefix#1::}\else \ifnum\MPp{#1}>\zerocount % new \bgroup + \setbox\scratchbox\hbox + \bgroup \traceposstring\clap\red{<#1>}% \the\everyinsertpositionaction \the\everypositionaction @@ -1134,7 +1280,9 @@ \getvalue{\POSactionprefix#1::}% \fi \cleanuppositionaction{#1}% - \egroup + \egroup % smashed is really needed else + \smashedbox\scratchbox % we get problems with too big + \egroup % overlays (s-pre-0x.tex) \else % shouldn't happen too often \traceposstring\clap\cyan{<#1>}% @@ -1231,7 +1379,7 @@ \def\handlepositiongraphicsrange#1#2#3#4% {\handlepositionaction\dohandleMPpositiongraphicrange\with{#1}{#2}{#3}{#4}\on{#2}} -% \def\doinsertMPpositiongraphicrange#1#2#3#4% pos tag setups +% \def\doinsertMPpositiongraphicrange#1#2#3#4% pos pos tag setups % {\donefalse % \ifnum\MPp{#1}=\realpageno\relax \donetrue % \else\ifnum\MPp{#2}=\realpageno\relax \donetrue @@ -1240,7 +1388,7 @@ % \def\currentposition{#1}\MPpositiongraphic{#3}{#4}% % \fi} -\def\doinsertMPpositiongraphicrange#1#2#3#4% pos tag setups +\def\doinsertMPpositiongraphicrange#1#2#3#4% pos pos tag setups {\ifnum\MPp{#1}\MPp{#2}>\zerocount \iflocalpositioning \donetrue @@ -1409,7 +1557,7 @@ \def\MPl#1{\MPplus{#1}20} \def\MPr#1{\MPplus{#1}30} -\startMPpositionmethod{mpos:par} +\startMPpositionmethod{mpos:par} %%%%%%%%%%% will become obsolete \edef\MPparcounter{\MPv\MPbself{1}{0}}% \doifpositionelse\MPwself {\startMPpositiongraphic{mpos:par}% @@ -1541,6 +1689,8 @@ {\dopresettextbackground{#1}}% \dodostarttextbackground} +% todo \backgroundvariable\c!variant + \def\dopresettextbackground#1% todo: \backgroundparameter {\ExpandFirstAfter\processaction % \EFA niet echt nodig [\getvalue{\??td#1\c!plaats}] @@ -1625,7 +1775,7 @@ % \endgraf % new % \getvalue{\??td\currenttextbackground\c!na}} -\def\dostarttextbackgroundpar +\def\dostarttextbackgroundpar {\endgraf % new \getvalue{\??td\currenttextbackground\c!voor}% \doassignsomeskip\getvalue{\??td\currenttextbackground\c!bovenoffset}\to\scratchskip @@ -1653,7 +1803,7 @@ \dostartattributes{\??td\currenttextbackground}\c!letter\c!kleur\empty \geenwitruimte \seteffectivehsize - \blanko[\v!blokkeer]% new + \doinhibitblank % \blanko[\v!blokkeer]% new \par} \def\dostoptextbackgroundpar @@ -1927,13 +2077,13 @@ \hpos{\POSstackprefix\currentautopos} {\doifoverlappingelse{\POSstackprefix\currentautopos}{\POSstackprefix\previousautopos} {#1} - {\box\nextbox}}}}% + {\flushnextbox}}}}% \hbox} -\def\stackposup {\dostackposbox{\raise\lineheight\box\nextbox}} -\def\stackposdown {\dostackposbox{\lower\lineheight\box\nextbox}} -\def\stackposleft {\dostackposbox{\copy\nextbox\hskip\wd\nextbox\hskip\stackposdistance}} -\def\stackposright{\dostackposbox{\hskip\stackposdistance\hskip\wd\nextbox\box\nextbox}} +\def\stackposup {\dostackposbox{\raise\lineheight\flushnextbox}} +\def\stackposdown {\dostackposbox{\lower\lineheight\flushnextbox}} +\def\stackposleft {\dostackposbox{\copy\nextbox\hskip\nextboxwd\hskip\stackposdistance}} +\def\stackposright{\dostackposbox{\hskip\stackposdistance\hskip\nextboxwd\flushnextbox}} %D The next hack make sure that margin texts near faulty %D strutted lines are handled ok. @@ -2024,7 +2174,7 @@ \def\do@@ammenuposition#1% {\ifnum\currentamposition>0 - \dowithnextbox{\hpos{menu:#1:\realfolio}{\box\nextbox}}\hbox + \dowithnextbox{\hpos{menu:#1:\realfolio}{\flushnextbox}}\hbox \fi} %D \macros diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex index 4546a927b..659aba09e 100644 --- a/tex/context/base/core-ref.tex +++ b/tex/context/base/core-ref.tex @@ -1615,20 +1615,9 @@ \let\unharmedreferenceprefix\empty \xdef\predefinedreference% {\currentreferencespecial::\currentreferenceoperation}% -% \doifdefinedelse{\s!do\v!test\currentreferencespecial} -% {\getvalue{\s!do\v!test\currentreferencespecial}% -% {\global\referencefoundtrue}% -% {\global\referencefoundfalse}} -% {\global\referencefoundtrue}% - \executeifdefined{\s!do\v!test\currentreferencespecial}% + \executeifdefined{\s!do:\v!test:\currentreferencespecial}% {\global\referencefoundtrue\gobbletwoarguments}% {\global\referencefoundtrue}{\global\referencefoundfalse}% -% \ifcsname\s!do\v!test\currentreferencespecial\endcsname -% \csname\s!do\v!test\currentreferencespecial\endcsname -% {\global\referencefoundtrue}{\global\referencefoundfalse}% -% \else -% \global\referencefoundtrue -% \fi \doifpredefinedreferenceelse{\global\referencefoundfalse}\donothing} %D An unknown reference is reported on the screen, in the log @@ -2024,7 +2013,7 @@ %D The associated test is to be defined by: \def\definespecialtest#1% - {\setvalue{\s!do\v!test#1}} + {\setvalue{\s!do:\v!test:#1}} %D This \type{\def} alike macro is to be used as: %D @@ -2077,18 +2066,13 @@ %D \stoptypen \def\setexecutecommandcheck#1#2% #2 permits \first \second - {\setvalue{\s!do\s!do#1}{#2}} - -% \def\checkexecutecommand#1#2% -% {\def\docheckexecutecommand##1% -% {\doifdefined{\s!do\s!do#1}{\getvalue{\s!do\s!do#1}{##1}}}% -% \processcommacommand[#2]\docheckexecutecommand} + {\setvalue{\s!do:\s!do:#1}{#2}} \beginETEX \def\checkexecutecommand#1#2% evt geen #1 en #2 - {\ifx#2\empty \else \ifcsname\s!do\s!do#1\endcsname - \@EA\let\@EA\docheckexecutecommand\csname\s!do\s!do#1\endcsname + {\ifx#2\empty \else \ifcsname\s!do:\s!do:#1\endcsname + \@EA\let\@EA\docheckexecutecommand\csname\s!do:\s!do:#1\endcsname \rawprocesscommalist[#2]\docheckexecutecommand \fi \fi } @@ -2097,8 +2081,8 @@ \beginTEX \def\checkexecutecommand#1#2% evt geen #1 en #2 - {\ifx#2\empty \else \@EA\ifx\csname\s!do\s!do#1\endcsname\relax \else - \@EA\let\@EA\docheckexecutecommand\csname\s!do\s!do#1\endcsname + {\ifx#2\empty \else \@EA\ifx\csname\s!do:\s!do:#1\endcsname\relax \else + \@EA\let\@EA\docheckexecutecommand\csname\s!do:\s!do:#1\endcsname \rawprocesscommalist[#2]\docheckexecutecommand \fi \fi } diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex index 7bf646001..cef50c349 100644 --- a/tex/context/base/core-rul.tex +++ b/tex/context/base/core-rul.tex @@ -846,7 +846,7 @@ % \setbox\framebox=\next} % second alternative %\dowithnextbox - % {\setbox\framebox=\box\nextbox + % {\setbox\framebox\flushnextbox % \let\postprocessframebox\undefined %new % \stoplocalframed} % \next} @@ -2949,7 +2949,7 @@ \def\dobackground {\bgroup \dowithnextbox - {\localframed[\??ag][\c!offset=\v!overlay]{\box\nextbox}\egroup} + {\localframed[\??ag][\c!offset=\v!overlay]{\flushnextbox}\egroup} \vbox} %D \stopdocumentation @@ -3087,6 +3087,29 @@ \egroup} %D \macros +%D {backgroundline} +%D +%D For the moment an undocumented feature, but a cancidate +%D for going public. + +\def\backgroundline[#1]% + %{\doifsomething{#1}{\dobackgroundline{#1}}\hbox} + {\doifcolorelse{#1}{\dobackgroundline{#1}\hbox}\hbox} + +\def\dobackgroundline#1% + {\dowithnextbox + {\hbox + {\localcolortrue + \startcolor[#1]% + \vrule + \!!width \nextboxwd + \!!height\nextboxht + \!!depth \nextboxdp + \stopcolor + \hskip-\nextboxwd + \flushnextbox}}} + +%D \macros %D {encircled} %D %D Some not so robust left||overs (borrowed from Knuth, diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex index f00a96e14..9c5293304 100644 --- a/tex/context/base/core-spa.tex +++ b/tex/context/base/core-spa.tex @@ -629,6 +629,165 @@ \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 +% \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 +% \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 +% \global\doeblankotrue +% \fi +% \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 +% \fi +% \fi +% \global\fuzzyvskipfalse +% \presetindentation} + \def\docomplexdoblanko[#1]% pas op \relax's zijn nodig ivm volgende \if {\global\blankoresetfalse \global\blankoblokkeerfalse @@ -740,15 +899,22 @@ \!!plus\skipgluefactor\blankoskip \!!minus\skipgluefactor\blankoskip \fi - \ifgridsnapping - \ifdim\lastkern=\noblanksignal - \global\doeblankofalse - \fi - \else - \ifdim\prevdepth=\newprevdepth - \global\doeblankofalse - \fi - \fi +% \ifgridsnapping +% \ifdim\lastkern=\noblanksignal +% \global\doeblankofalse +% \fi +% \else +% \ifdim\prevdepth=\newprevdepth +% \global\doeblankofalse +% \fi +% \fi +% + \ifdim\lastkern=\noblanksignal % controled and grid + \global\doeblankofalse + \else\ifgridsnapping\else\ifdim\prevdepth=\newprevdepth + \global\doeblankofalse + \fi\fi\fi +% \ifdoeblanko \iffuzzyvskip \removelastfuzzyvskip @@ -788,6 +954,9 @@ \global\fuzzyvskipfalse \presetindentation} +\def\doinhibitblank + {\kern\noblanksignal} + %D For a long time we had: %D %D \starttypen @@ -944,7 +1113,7 @@ \v!altijd=>\parindent\voorwit\relax, % geen \indent ! \v!nooit=>\parindent\zeropoint\relax]} -\def\inspringen% +\def\inspringen {\dosingleargument\doinspringen} \def\nietinspringen{\inspringen[\v!nee,\v!volgende]} @@ -980,18 +1149,34 @@ \definecomplexorsimple\stelspatieringin -\bgroup -\catcode`\~=\@@active % eigenlijk is ~ al actief -\gdef\fixedspaces% % in Plain \TeX, maar we weten - {\catcode`\~=\@@active % nooit wat er inmiddels is - \def~{\fixedspace}} % gebeurd, vandaar. -\egroup - -\def\space { } -\def\fixedspace {\hskip.5em\relax} -\def\removelastspace {\ifhmode\unskip\fi} -\def\nospace {\removelastspace\ignorespaces} -\def\removeunwantedspaces{\ifhmode\unskip\unskip\unskip\unskip\unskip\fi} +\catcode`\~=\@@active % to be sure + +\unexpanded\def~{\nonbreakablespace} + +\def\space { } +\def\removelastspace{\ifhmode\unskip\fi} +\def\nospace {\removelastspace\ignorespaces} + +% in tables we need: +% +% \def\fixedspace {\hskip.5em\relax} +% +% but, since not all fonts have .5em digits: + +\def\fixedspace + {\setbox\scratchbox\hbox\ifmmode{$0$}\else{0}\fi + \hskip\wd\scratchbox\relax} + +\def\fixedspaces + {\catcode`\~=\@@active + \def~{\fixedspace}} + +% \def\removeunwantedspaces{\ifhmode\unskip\unskip\unskip\unskip\unskip\fi} + +\def\removeunwantedspaces + {\ifhmode + \doloop{\ifdim\lastskip>\zeropoint\unskip\else\exitloop\fi}% + \fi} % better, but not done: % @@ -1390,7 +1575,7 @@ \def\corrigeerwitruimte {\dowithnextbox {\startbaselinecorrection - \box\nextbox + \flushnextbox \stopbaselinecorrection}% \vbox} @@ -1710,12 +1895,12 @@ %D The plain ones: \def\offinterlineskip - {\baselineskip-1000\p@ + {\baselineskip-\thousandpoint \lineskip\zeropoint \lineskiplimit\maxdimen} \def\nointerlineskip - {\prevdepth-1000\p@} + {\prevdepth-\thousandpoint} \let\normaloffinterlineskip=\offinterlineskip % knuth's original @@ -2039,26 +2224,26 @@ \let\checkindentation=\relax -\def\donoindentation% +\def\donoindentation {\ifdim\parindent=\zeropoint \else \bgroup \setbox\scratchbox\lastbox \egroup \fi} -\def\noindentation% made global +\def\noindentation % made global {\ifinpagebody \else \global\indentationfalse - \gdef\checkindentation% + \gdef\checkindentation {\donoindentation \gdef\checkindentation{\global\indentationtrue}}% \fi} -\def\nonoindentation% bv bij floats +\def\nonoindentation % bv bij floats {\ifinpagebody \else \global\indentationtrue \gdef\checkindentation{\global\indentationtrue}% \fi} -\def\indentation% +\def\indentation {\ifvmode \ifdim\parindent=\zeropoint \else % was : \hskip\parindent % can be: \indent @@ -2068,18 +2253,18 @@ % vergeten -%\def\forgeteverypar% +%\def\forgeteverypar % {\everypar\emptytoks} -\def\forgeteverypar% +\def\forgeteverypar {\everypar{\the\neverypar}} -%\def\forgetparindent% +%\def\forgetparindent % {\forgeteverypar % \indentfirstparagraphtrue % recently added % \stelinspringenin[\v!geen]} -%\def\forgetparskip% +%\def\forgetparskip % {\stelwitruimtein[\v!geen]} \def\forgetparindent diff --git a/tex/context/base/core-tab.tex b/tex/context/base/core-tab.tex index 299dd86b5..0032962e2 100644 --- a/tex/context/base/core-tab.tex +++ b/tex/context/base/core-tab.tex @@ -1015,7 +1015,16 @@ %D The third stage involves a lot of (re)sets, which we will %D explain later. -\let \everytable \EveryTable % convenient and more in tune +%D The next definition is convenient and more in tune with +%D \CONTEXT. + +\let \everytable \EveryTable + +%D We immediately use this register: + +\appendtoks \fixedspaces \to \everytable + +%D Now we can start the table. \def\thirdstagestartTABLE#1% {\global\setTABLEactiontrue @@ -1042,9 +1051,10 @@ \forgetall % added \doifsomething{#1} {\def\TABLEformat{#1}% - %\expandafter\getTABLEnofcolumns\expandafter{\TABLEformat}% + \getTABLEnofcolumns\TABLEformat \expandafter\BeginFormat\TABLEformat\EndFormat}} + \def\finishTABLE {\chuckTABLEautorow \unskip\crcr @@ -1644,13 +1654,18 @@ %D \TABLE\ changes the catcode when needed.} \bgroup -\catcode`\&=\@@other +\catcode`\|=\@@active +%\gdef\protectTABLEbar{\let|\letterbar} % maybe in \cleanupfeatures +\doglobal \appendtoks \let|\letterbar \to \everycleanupfeatures +\catcode`\|=\@@other \gdef\getTABLEnofcolumns#1% {\bgroup - \convertargument#1\to\ascii - \@EA\doglobal\@EA\counttoken\@EA&\@EA\in\ascii\to\maxTABLEcolumn + \cleanupfeatures % needed ! +% \protectTABLEbar + \expanded{\convertargument#1}\to\ascii + \@EA\doglobal\@EA\counttoken\@EA|\@EA\in\ascii\to\maxTABLEcolumn \global\advance\maxTABLEcolumn \minusone - \global\divide\maxTABLEcolumn 2 + % in case of & counting, divide by 2 \egroup} \egroup @@ -1659,7 +1674,8 @@ \lineskiplimit\zeropoint \lineskip \zeropoint \tabskip \zeropoint - \expanded{\getTABLEnofcolumns{\the\!taPreamble}}% added + % does not work in normal tex + % \expanded{\getTABLEnofcolumns{\the\!taPreamble}}% added \halign \the\!taTableSpread \bgroup \span\the\!taPreamble \ifx \!tfRowOfWidths \empty \else \!tfRowOfWidths \cr \fi} diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex index 9238a4a55..ce682bb8d 100644 --- a/tex/context/base/core-tbl.tex +++ b/tex/context/base/core-tbl.tex @@ -633,25 +633,18 @@ {\ifundefined{\??tt\currenttabulate\v!hoofd}% \let\tabulateheadcontent\empty \else - \@EA\let\@EA\tabulateheadcontent - \csname\??tt\currenttabulate\v!hoofd\endcsname - \fi - \ifundefined{\??tt\currenttabulate\v!voet}% - \let\tabulatetailcontent\empty - \else - \@EA\let\@EA\tabulatetailcontent - \csname\??tt\currenttabulate\v!voet\endcsname - \fi - \ifx\tabulateheadcontent\empty\else \def\tabulateheadcontent {\TABLEnoalign{\global\settrue\tabulatesomeamble}% - \tabulateheadcontent + \csname\??tt\currenttabulate\v!hoofd\endcsname \TABLEnoalign{\global\setfalse\tabulatesomeamble}}% \fi - \ifx\tabulatetailcontent\empty\else + \ifundefined{\??tt\currenttabulate\v!voet}% + \let\tabulatetailcontent\empty + \else \def\tabulatetailcontent {\TABLEnoalign{\global\settrue\tabulatesomeamble}% - \tabulatetailcontent}% + \csname\??tt\currenttabulate\v!voet\endcsname + \TABLEnoalign{\global\setfalse\tabulatesomeamble}}% \fi} \def\fulltabulatecontent @@ -759,11 +752,21 @@ {\iftabulatefirstflushed\else\getvalue{\??tt\currenttabulate EQ}\fi \global\tabulateequalfalse} +% \def\tabulatenormalcolumn#1% +% {&\iftabulateequal\tabulateEQ\fi&\global\chardef\tabulatetype#1&} +% +% \def\tabulateequalcolumn#1% +% {&\tabulateEQ&\global\chardef\tabulatetype#1&} +% +% however, \unskip en \ignorespaces permit usage in complex XML/\starttabulate + \def\tabulatenormalcolumn#1% - {&\iftabulateequal\tabulateEQ\fi&\global\chardef\tabulatetype#1&} + {\unskip&\iftabulateequal\tabulateEQ\fi&\global\chardef\tabulatetype#1&% + \ignorespaces} \def\tabulateequalcolumn#1% - {&\tabulateEQ&\global\chardef\tabulatetype#1&} + {\unskip&\tabulateEQ&\global\chardef\tabulatetype#1&% + \ignorespaces} \def\tabulateautocolumn {\tabulatenormalcolumn\zerocount diff --git a/tex/context/base/core-var.tex b/tex/context/base/core-var.tex index 1be0ad723..41ff5bba7 100644 --- a/tex/context/base/core-var.tex +++ b/tex/context/base/core-var.tex @@ -135,6 +135,55 @@ \fi +%D \macros +%D {setvariables,getvariable} +%D +%D \starttyping +%D \setvariables[xx][titel=] +%D \setvariables[xx][titel=test test] +%D \setvariables[xx][titel=test $x=1$ test] % fatal error reported +%D \setvariables[xx][titel=test {$x=1$} test] +%D \setvariables[xx][titel] % fatal error reported +%D \setvariables[xx][titel=e] +%D \stoptyping + +\def\??vars{@@vars} + +\def\setvariables + {\dotripleargument\dosetvariables[\getrawparameters]} + +\def\globalsetvariables + {\dotripleargument\dosetvariables[\globalgetrawparameters]} + +\def\dosetvariables[#1][#2][#3]% + {\errorisfataltrue + \def\currentvariableclass{#2}% + #1[\??vars:#2:][#3]% + \errorisfatalfalse} + +\beginTEX + +\def\getvariable#1#2% to be sped up + {\csname + \ifundefined{\??vars:#1:#2}\s!empty\else\??vars:#1:#2\fi + \endcsname} + +\endTEX + +\beginETEX \ifcsname + +\def\getvariable#1#2% to be sped up + {\csname + \ifcsname\??vars:#1:#2\endcsname\??vars:#1:#2\else\s!empty\fi + \endcsname} + +\endETEX + +\def\showvariable#1#2% + {\showvalue{\ifundefined{\??vars:#1:#2}\s!empty\else\??vars:#1:#2\fi}} + +\let\currentvariableclass\empty + %D We store some original meanings, maybe in \type %D {math-ini}. diff --git a/tex/context/base/core-ver.tex b/tex/context/base/core-ver.tex index e7511c2fb..09e90e34c 100644 --- a/tex/context/base/core-ver.tex +++ b/tex/context/base/core-ver.tex @@ -552,6 +552,7 @@ \c!letter=\tt\tf, % \tttf gives problems with {\tx \type...} \c!pagina=\v!nee, \c!tab=\v!nee, + \c!palet=colorpretty, \c!optie=\v!normaal] %D \macros @@ -797,14 +798,14 @@ %D Specific inline verbatim commands can be defined with the %D following command. -\def\definetype% +\def\definetype {\dodoubleempty\dodefinetype} \def\dodefinetype[#1][#2]% {\unexpanded\setvalue{#1}{\dotype{#1}}% \copyparameters [\??ty#1][\??ty] - [\c!spatie,\c!kleur,\c!letter,\c!pagina,\c!tab,\c!optie]% + [\c!spatie,\c!palet,\c!kleur,\c!letter,\c!pagina,\c!tab,\c!optie]% \getparameters[\??ty#1][#2]} %D \macros @@ -1057,54 +1058,6 @@ %D setup values are inherited from display verbatim. %D The implementation of \type{\typefile} is straightforward: -% \presettyping[\v!file][] -% -% \definecomplexorsimple\typefile -% -% \def\simpletypefile -% {\complextypefile[\v!file]} -% -% % \def\complextypefile[#1]#2% -% % {\getvalue{\??tp#1\c!voor}% -% % \doiflocfileelse{#2} -% % {\startopelkaar % includes \bgroup -% % \doifinset{\getvalue{\??tp#1\c!optie}}{\v!commandos,\v!schuin,\v!normaal} -% % {\setuptyping[#1][\c!optie=\v!geen]}% -% % \doifvalue{\??tp#1\c!optie}{\v!kleur} -% % {\expandafter\aftersplitstring#2\at.\to\prettyidentifier -% % \letvalue{\??tp#1\c!optie}=\prettyidentifier}% -% % \initializetyping{#1}% -% % \startverbatimcolor -% % \processfileverbatim{\pathplusfile\f!currentpath{#2}}% -% % \stopverbatimcolor -% % \stopopelkaar} % includes \egroup -% % {{\tttf[\makemessage{\m!verbatims}{1}{#2}]}% -% % \showmessage{\m!verbatims}{1}{#2}}% -% % \getvalue{\??tp#1\c!na}} -% -% \def\complextypefile[#1]#2% -% {\getvalue{\??tp#1\c!voor}% -% \doiflocfileelse{#2} -% {\startopelkaar % includes \bgroup -% \doifinset{\getvalue{\??tp#1\c!optie}}{\v!commandos,\v!schuin,\v!normaal} -% {\setuptyping[#1][\c!optie=\v!geen]}% -% \doifvalue{\??tp#1\c!optie}\v!kleur -% {\expandafter\aftersplitstring#2\at.\to\prettyidentifier -% \letvalue{\??tp#1\c!optie}\prettyidentifier}% -% \initializetyping{#1}% -% \startverbatimcolor -% \makelocreadfilename{#2}% -% \processfileverbatim\readfilename -% %\processfileverbatim{\pathplusfile\f!currentpath{#2}}% -% \stopverbatimcolor -% \stopopelkaar} % includes \egroup -% {\bgroup -% \expanded{\convertargument#2}\to\ascii -% \tttf[\makemessage\m!verbatims1\ascii]% -% \showmessage\m!verbatims1\ascii -% \egroup}% -% \getvalue{\??tp#1\c!na}} - % new feature (not yet 100\% ok) % % \setuptyping[file][numbering=file] diff --git a/tex/context/base/core-vis.tex b/tex/context/base/core-vis.tex index a61b00eaf..2c26e3a48 100644 --- a/tex/context/base/core-vis.tex +++ b/tex/context/base/core-vis.tex @@ -388,15 +388,15 @@ \def\cuthbox {\normalhbox\bgroup - \dowithnextbox{\makecutbox\nextbox\box\nextbox\egroup}\normalhbox} + \dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\normalhbox} \def\cutvbox {\normalvbox\bgroup - \dowithnextbox{\makecutbox\nextbox\box\nextbox\egroup}\normalvbox} + \dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\normalvbox} \def\cutvtop {\normalvtop\bgroup - \dowithnextbox{\makecutbox\nextbox\box\nextbox\egroup}\normalvtop} + \dowithnextbox{\makecutbox\nextbox\flushnextbox\egroup}\normalvtop} %D \macros %D {colormarkbox,rastermarkbox} @@ -728,7 +728,7 @@ \def\dotagbox[#1]#2% {\bgroup \dowithnextbox - {\setbox\scratchbox\box\nextbox + {\setbox\scratchbox\flushnextbox \setbox\nextbox\ifhbox\nextbox\hbox\else\vbox\fi \bgroup \startoverlay @@ -737,10 +737,10 @@ [\c!achtergrond=\v!raster,\c!achtergrondraster=1]{#2}}} \stopoverlay \egroup - \wd\nextbox\the\wd\scratchbox - \ht\nextbox\the\ht\scratchbox - \dp\nextbox\the\dp\scratchbox - \box\nextbox + \nextboxwd\the\wd\scratchbox + \nextboxht\the\ht\scratchbox + \nextboxdp\the\dp\scratchbox + \flushnextbox \egroup}} \def\tagbox diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex index 1c5ca7074..e0676fee9 100644 --- a/tex/context/base/font-ini.tex +++ b/tex/context/base/font-ini.tex @@ -475,6 +475,84 @@ %D \kap{THIS}: \ruledhbox{$\rm \scriptstyle scriptstyle: THIS$} %D or \ruledhbox{\kap{x style: THIS}} makes a big difference. +%D The \type{x..d} sizes should be used grouped. If you +%D don't group them, i.e. call them in a row, \CONTEXT\ will +%D not be able to sort out your intention (\type {x} inside +%D \type {d} inside \type {x}. etc.). The following table +%D demonstrates this: +%D +%D \def\FontState{\setstrut\ruledhbox{\strut Hello}} +%D +%D \starttabulatie[|||||] +%D \HL +%D \NC \rlap{\quad\bf grouped} \NC \NC \type {\tx} \NC \type {\txx} \NC \NR +%D \HL +%D \NC \type{\tfx} \NC \tfx \FontState \NC \tfx \tx \FontState \NC \tfx \txx \FontState \NC \NR +%D \NC \type{\tfxx} \NC \tfxx \FontState \NC \tfxx\tx \FontState \NC \tfxx\txx \FontState \NC \NR +%D \NC \type{\tf} \NC \tf \FontState \NC \tf \tx \FontState \NC \tf \txx \FontState \NC \NR +%D \NC \type{\tfa} \NC \tfa \FontState \NC \tfa \tx \FontState \NC \tfa \txx \FontState \NC \NR +%D \NC \type{\tfb} \NC \tfb \FontState \NC \tfb \tx \FontState \NC \tfb \txx \FontState \NC \NR +%D \NC \type{\tfc} \NC \tfc \FontState \NC \tfc \tx \FontState \NC \tfc \txx \FontState \NC \NR +%D \NC \type{\tfd} \NC \tfd \FontState \NC \tfd \tx \FontState \NC \tfd \txx \FontState \NC \NR +%D \NC \type{\tfx} \NC \tfx \FontState \NC \tfx \tx \FontState \NC \tfx \txx \FontState \NC \NR +%D \NC \type{\tfxx} \NC \tfxx \FontState \NC \tfxx\tx \FontState \NC \tfxx\txx \FontState \NC \NR +%D \HL +%D \stoptabulatie +%D +%D \blanko +%D +%D \starttabulatie[|||||] +%D \HL +%D \NC \rlap{\quad\bf stacked} \NC \NC \type {\tx} \NC \type {\txx} \NC \NR +%D \HL +%D \NC \type{\tfx} +%D \NC \tfx \FontState +%D \NC \tfx \tx \FontState +%D \NC \tfx \txx \FontState +%D \NC \NR +%D \NC \type{\tfxx} +%D \NC \tfx\tfxx \FontState +%D \NC \tfx\tfxx \tx \FontState +%D \NC \tfx\tfxx \txx \FontState +%D \NC \NR +%D \NC \type{\tf} +%D \NC \tfx\tfxx\tf \FontState +%D \NC \tfx\tfxx\tf \tx \FontState +%D \NC \tfx\tfxx\tf \txx \FontState +%D \NC \NR +%D \NC \type{\tfa} +%D \NC \tfx\tfxx\tf\tfa \FontState +%D \NC \tfx\tfxx\tf\tfa \tx \FontState +%D \NC \tfx\tfxx\tf\tfa \txx \FontState +%D \NC \NR +%D \NC \type{\tfb} +%D \NC \tfx\tfxx\tf\tfa\tfb \FontState +%D \NC \tfx\tfxx\tf\tfa\tfb \tx \FontState +%D \NC \tfx\tfxx\tf\tfa\tfb \txx \FontState +%D \NC \NR +%D \NC \type{\tfc} +%D \NC \tfx\tfxx\tf\tfa\tfb\tfc \FontState +%D \NC \tfx\tfxx\tf\tfa\tfb\tfc \tx \FontState +%D \NC \tfx\tfxx\tf\tfa\tfb\tfc \txx \FontState +%D \NC \NR +%D \NC \type{\tfd} +%D \NC \tfx\tfxx\tf\tfa\tfb\tfd \FontState +%D \NC \tfx\tfxx\tf\tfa\tfb\tfd \tx \FontState +%D \NC \tfx\tfxx\tf\tfa\tfb\tfd \txx \FontState +%D \NC \NR +%D \NC \type{\tfx} +%D \NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx \FontState +%D \NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx \tx \FontState +%D \NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx \txx \FontState +%D \NC \NR +%D \NC \type{\tfxx} +%D \NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx\tfxx \FontState +%D \NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx\tfxx \tx \FontState +%D \NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx\tfxx \txx \FontState +%D \NC \NR +%D \HL +%D \stoptabulatie + %D \macros %D {mf} %D @@ -606,7 +684,7 @@ %D \starttypen %D \def\mbox% %D {\normalhbox\bgroup\mf -%D \dowithnextbox{\box\nextbox\egroup}% +%D \dowithnextbox{\flushnextbox\egroup}% %D \normalhbox} %D \stoptypen %D @@ -629,9 +707,11 @@ %D although for instance unboxing goes ok. Therefore we %D introduce: +% better use \dowithnextboxcontent + \def\normalmbox {\normalhbox\bgroup\mf - \dowithnextbox{\box\nextbox\egroup}\normalhbox} + \dowithnextbox{\flushnextbox\egroup}\normalhbox} % to test: % @@ -1155,17 +1235,19 @@ \newdimen\scaledfont +\let\somefontspec\empty + \def\@fs@{@fs@} % \def\parsefontspec#1% -% {\edef\somefontspec{#1\space\relax}% +% {\xdef\somefontspec{#1\space\relax}% % \@EA\doparsefontspec\somefontspec]% =>#1 \relax] % \donoparsefontspec} % % but, better: \def\parsefontspec#1% - {\edef\somefontspec{#1\space}% + {\xdef\somefontspec{#1\space}% \@EA\doparsefontspec\somefontspec\relax]% =>#1 \relax] \donoparsefontspec} @@ -1181,7 +1263,7 @@ #2} \def\setnaturalfontspec#1]% - {\@fs@scaled\!!thousand\relax} + {\@fs@scaled\plusthousand\relax} \def\setforcedfontspec#1 #2\relax]% {\csname\@fs@#1\endcsname#2\relax} @@ -1196,7 +1278,7 @@ \scratchcounter\scaledfont % \scaledfont is now pretty large \advance\scratchcounter \medcard \divide\scratchcounter \maxcard - \edef\somefontspec{ scaled \the\scratchcounter}} + \xdef\somefontspec{ scaled \the\scratchcounter}} \def\@fs@at {\afterassignment\do@fs@at\scaledfont} @@ -1204,7 +1286,7 @@ \def\do@fs@at#1\relax {\scaledfont\localrelativefontsize\scaledfont \ifautofontsize\scaledfont\currentfontbodyscale\scaledfont\fi - \edef\somefontspec{ at \the\scaledfont}} + \xdef\somefontspec{ at \the\scaledfont}} \def\@fs@sa {\scaledfont\localabsolutefontsize @@ -1218,7 +1300,7 @@ {\checkfontscale#1\end\scaledfont \scaledfont\localrelativefontsize\scaledfont \ifautofontsize\scaledfont\currentfontbodyscale\scaledfont\fi - \edef\somefontspec{ at \the\scaledfont}} + \xdef\somefontspec{ at \the\scaledfont}} \def\getfontparameters {\expandafter\setfontparameter\@@fontdata,]=,} @@ -2584,11 +2666,11 @@ \def\dosetsubstitutefont#1#2% #1 = set/switch state {\scratchdimen#2\relax - \advance\scratchdimen .499pt + \advance\scratchdimen .499\s!pt \dimensiontocount\scratchdimen\scratchcounter - \advance\scratchcounter -1 - \ifnum\scratchcounter>3 - \dododosetfont{#1}{\the\scratchcounter pt}{}% + \advance\scratchcounter \minusone + \ifnum\scratchcounter>\plusthree + \dododosetfont{#1}{\the\scratchcounter\s!pt}{}% \fi} % The following bunch of macros deals with the (run time) @@ -2639,7 +2721,7 @@ \let\bigmathfontsize\empty -\def\synchronizebigmath% +\def\synchronizebigmath {\ifx\bigmathfontsize\fontsize % already in sync \else @@ -2709,7 +2791,7 @@ \dosetcurrentfontalternative{#2}% \synchronizefont} -\def\setcurrentfontstylesize#1#2% \rmsl +\def\setcurrentfontstylesize#1#2% \rmsla {%\message{[8 #1 #2]}% \edef\fontstyle{#1}% \dosetcurrentfontsize{#2}% @@ -2734,14 +2816,31 @@ \newtoks\fontstrategies \newif\iftryingfont +% \def\synchronizefont +% {\tryingfonttrue +% \ifx\fontclass\empty\else +% \let\fontstrategy\dofontclassstrategy +% \the\fontstrategies \relax % \relax still needed ? +% \fi +% \iftryingfont +% \let\fontstrategy\dofontstrategy +% \the\fontstrategies \relax % \relax still needed ? +% \fi +% \ifskipfontcharacteristics +% \setfontcharacteristics +% \the\everyfontswitch +% \fi} + +\let\fontstrategy\relax + \def\synchronizefont {\tryingfonttrue \ifx\fontclass\empty\else - \let\fontstrategy\dofontclassstrategy + \global\let\fontstrategy\dofontclassstrategy \the\fontstrategies \relax % \relax still needed ? \fi \iftryingfont - \let\fontstrategy\dofontstrategy + \global\let\fontstrategy\dofontstrategy \the\fontstrategies \relax % \relax still needed ? \fi \ifskipfontcharacteristics @@ -2851,11 +2950,33 @@ \let\tx\empty \let\txx\empty} +\def\checknestedxfontsize % option + {\ifcase\currentxfontsize\else\ifx\fontsize\empty\else + \chardef\currentxfontsize\zeropoint + \let\fontsize\empty + \let\tx\normaltx + \let\txx\normaltxx + \fi\fi} + +\def\setcurrentfontxalternative#1% + {\checknestedxfontsize + \dosetcurrentfontxxxalternative{#1}1\c!x\scriptstyle + \let\tx\txx} + +\def\setcurrentfontxxalternative#1% + {\checknestedxfontsize + \dosetcurrentfontxxxalternative{#1}2\c!xx\scriptscriptstyle + \let\tx\empty + \let\txx\empty} + % This alterative is not really needed, but for old time's sake % we keep it there. We can speed it up when needed. -\def\setcurrentfontxstylealternative #1{\csname#1\endcsname\tfx} -\def\setcurrentfontxxstylealternative#1{\csname#1\endcsname\tfxx} +% \def\setcurrentfontxstylealternative #1{\csname#1\endcsname\tfx} +% \def\setcurrentfontxxstylealternative#1{\csname#1\endcsname\tfxx} + +\def\setcurrentfontxstylealternative #1{\csname#1\endcsname\tx} +\def\setcurrentfontxxstylealternative#1{\csname#1\endcsname\txx} %D These macros also show us that when we call for \type{\tx}, %D this macro is redefined to be \type{\txx}. Therefore calls @@ -2885,6 +3006,9 @@ \unexpanded\def\tx {\setcurrentfontxalternative \fontalternative} \unexpanded\def\txx{\setcurrentfontxxalternative\fontalternative} +\let\normaltx \tx +\let\normaltxx\txx + %D \macros %D {definefontstyle} %D @@ -3220,7 +3344,7 @@ \unexpanded\def\setsmallbodyfont{\setbodyfontstep\v!klein\the\everybodyfont} \unexpanded\def\setbigbodyfont {\setbodyfontstep\v!groot\the\everybodyfont} -\unexpanded\def\setmainbodyfont% +\unexpanded\def\setmainbodyfont {\doswitchpoints[\normalizedbodyfontsize]% \doswitchstyle[\fontstyle]% \the\everybodyfont} @@ -3579,16 +3703,16 @@ %D The next emphasis alternatives are for \THANH. They adapt %D their style as good as possible. -\def\emphbf% +\def\emphbf {\groupedcommand{\bf\def\emphit{\bi}\def\emphsl{\bs}}{}} -\def\emphit% +\def\emphit {\groupedcommand{\it\def\emphbf{\bi}\def\emphsl{\sl}}{}} -\def\emphsl% +\def\emphsl {\groupedcommand{\sl\def\emphbf{\bs}\def\emphit{\it}}{}} -\def\emphtf% +\def\emphtf {\groupedcommand{\tf\def\emphbf{\bf}\def\emphit{\it}\def\emphsl{\sl}}{}} %D \startbuffer @@ -3713,19 +3837,19 @@ %D {cont-log} and \type {symb-eur} for examples of symbolic %D definitions. -\def\fontstringA% +\def\fontstringA {\ifx\fontstyle\c!rm \s!Serif \else \ifx\fontstyle\c!ss \s!Sans \else \ifx\fontstyle\c!tt \s!Mono \else \s!Serif \fi\fi\fi} -\def\fontstringB% +\def\fontstringB {\ifx\fontstyle\c!rm \s!Regular \else \ifx\fontstyle\c!ss \s!Support \else \ifx\fontstyle\c!tt \s!Type \else \s!Serif \fi\fi\fi} -\def\fontstringC% +\def\fontstringC {\ifx\fontalternative\c!bf \s!Bold \else \ifx\fontalternative\c!sl \s!Slanted \else \ifx\fontalternative\c!it \s!Italic \else diff --git a/tex/context/base/hand-ini.tex b/tex/context/base/hand-ini.tex index 863b83de5..e79a71145 100644 --- a/tex/context/base/hand-ini.tex +++ b/tex/context/base/hand-ini.tex @@ -89,8 +89,8 @@ \appendtoks \disableprotruding \to \everyforgetall % Here or not here? \def\setprotrudingfactor#1#2% - {\lproddimen=#1pt\multiply\lproddimen\!!thousand\divide\lproddimen \!!maxcard\relax - \rproddimen=#2pt\multiply\rproddimen\!!thousand\divide\rproddimen \!!maxcard\relax} + {\lproddimen=#1pt\multiply\lproddimen\plusthousand\divide\lproddimen \!!maxcard\relax + \rproddimen=#2pt\multiply\rproddimen\plusthousand\divide\rproddimen \!!maxcard\relax} \def\dodefineprotrudefactor#1#2 #3 #4 % {\ifskipprotrudingdef \else diff --git a/tex/context/base/lang-ini.tex b/tex/context/base/lang-ini.tex index 6d2beeaf8..540589126 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} @@ -369,6 +369,15 @@ \egroup \increment\loadedlanguage} +%D Since we can only load patterns in ini\TeX, we nil the +%D loading before dumping (which saves a bit of memory, but +%D strangely enough not in the format). + +\appendtoks + \gdef\doloadpatterns{\increment\loadedlanguage\gobbletwoarguments}% + \globallet\dodoloadpatterns\gobblefourarguments +\to \everydump + %D \macros %D {setuplanguage} %D diff --git a/tex/context/base/m-level.tex b/tex/context/base/m-level.tex new file mode 100644 index 000000000..67d598733 --- /dev/null +++ b/tex/context/base/m-level.tex @@ -0,0 +1,94 @@ +%D \module +%D [ file=level, +%D version=2002.10.20, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Catching Nesting Errors, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=\PRAGMA] +%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 + +\newcount\currentnesting + +\def\startnesting#1% + {\global\advance\currentnesting\plusone + \setxvalue{level::\number\currentnesting}{#1}} + +\def\stopnesting#1% + {\edef\nestingstring{#1}% + \relax\ifnum\currentnesting>\zerocount + \doifelsevalue{level::\number\currentnesting}\nestingstring + {\global\advance\currentnesting\minusone} + {\@EA\reportnestingerror\@EA\stoptext} + \else + \@EA\reportnestingerror\@EA\stoptext + \fi} + +\def\checknesting + {\relax\ifnum\currentnesting>\zerocount + \def\nestingstring{end of document}% + \@EA\reportnestingerror + \fi} + +\def\reportnestingerror + {\endgraf + \global\let\checknesting\relax + \bgroup \definedfont[Mono at 18pt]\incolortrue + \setupinterlinespace + \raggedright + \bgroup \red + \ifnum\currentnesting>\plusone + wrong end level + \else + too many end levels + \fi + at \nestingstring\space in line \number\inputlineno + \ifnum\currentnesting>\zerocount, stack:\fi\endgraf + \egroup + \dostepwiserecurse\currentnesting\plusone\minusone + {\space\getvalue{level::\recurselevel}} + \endgraf + \egroup + \writestatus\m!systems{quitting due to level error}\wait + \batchmode} + +\prependtoks + \checknesting +\to \everystoptext + +\protect \doifnotmode{demo}{\endinput} + +\starttext + +% \startnesting{eerste} +% \startnesting{tweede} +% \startnesting{derde} +% \startnesting{vierde} +% test +% \stopnesting{vierde} +% \stopnesting{eerste} + +% \startnesting{eerste} +% \startnesting{tweede} +% test +% \stopnesting{vierde} +% \stopnesting{derde} +% \stopnesting{tweede} +% \stopnesting{eerste} + +\startnesting{eerste} + \startnesting{tweede} + \startnesting{derde} + \startnesting{vierde} + test + \stopnesting{vierde} + \stopnesting{derde} + \stopnesting{tweede} +\stopnesting{eerste} + +\stoptext diff --git a/tex/context/base/m-units.tex b/tex/context/base/m-units.tex index b58e73ac4..c0b0222d8 100644 --- a/tex/context/base/m-units.tex +++ b/tex/context/base/m-units.tex @@ -362,7 +362,7 @@ \def\Kilo {\dimensionprefix{k}} \def\Mega {\dimensionprefix{M}} \def\Giga {\dimensionprefix{G}} -\def\Terra {\dimensionprefix{T}} % for odl times sake +\def\Terra {\dimensionprefix{T}} % for old times sake \def\Tera {\dimensionprefix{T}} \def\Peta {\dimensionprefix{P}} \def\Exa {\dimensionprefix{E}} @@ -807,6 +807,11 @@ \let \Kubic \Cubic \let \IKubic \ICubic +%D Option: + +% \def\Micro{\dimensionprefix{\iftextdimensions\mathematics\mu \else\mu \fi}} +% \def\Times{\dimensionnopfix{\iftextdimensions\mathematics\cdot\else\cdot\fi}} + \protect \endinput diff --git a/tex/context/base/mult-com.tex b/tex/context/base/mult-com.tex index c73d6d026..c6a8ba11d 100644 --- a/tex/context/base/mult-com.tex +++ b/tex/context/base/mult-com.tex @@ -656,6 +656,12 @@ emptylines: legeregels emptylines page: pagina page seite strana pagina pagina + testcolumn: testkolom testcolumn + testcolumn testcolumn + testcolumn testcolumn + testpage: testpagina testpage + testpage testpage + testpage testpage koppelpagina: koppelpagina couplepage doppelseite parovastrana accoppiapagina paginadubla @@ -797,12 +803,12 @@ stelnummerin: stelnummerin setupnumber ran: ran ran ran ran ran ran -% new +% new setupitemgroups: stelitemgroepenin setupitemgroups setupitemgroups setupitemgroups setupitemgroups setupitemgroups - % downward compatible definitions + % downward compatible definitions setupitemgroups: stelopsommingenin setupitemizations stelleaufzaehlungenein nastavvycty @@ -817,7 +823,7 @@ stelnummerin: stelnummerin setupnumber stopaufzaehlung stopvycet terminaelenco stopenumerare - % so far + % so far definieerkop: definieerkop definehead definiereueberschrift definujnadpis @@ -970,8 +976,8 @@ setuppaper: stelpapierin setuppaper definierefarbe definujbarvu definiscicolore definesteculoare %definespotcolor: definespotcolor definespotcolor -% definespotcolor definespotcolor -% definespotcolor definespotcolor +% definespotcolor definespotcolor +% definespotcolor definespotcolor definecolorgroup: definieerkleurgroep definecolorgroup definierefarbengruppe definujskupinubarev definiscigruppocolori definestegrupculori @@ -1080,6 +1086,17 @@ listsymbol: lijstsymbool listsymbol schrijftussenlijst: schrijftussenlijst writebetweenlist schreibezwischenliste zapismeziseznam scrividentroelenco scrieintreliste + +% new + + immediatetolist: directnaarlijst immediatetolist + immediatetolist immediatetolist + immediatetolist immediatetolist + + immediatebetweenlist: directtussenlijst immediatebetweenlist + immediatebetweenlist immediatebetweenlist + immediatebetweenlist immediatebetweenlist + stellijstin: stellijstin setuplist stellelisteein nastavseznam impostaelenco seteazalista @@ -1408,8 +1425,8 @@ movesidefloat: verplaatszijblok movesidefloat platziereunterformel umistipodrovnici mettisottoformula punesubformula moveformula: verplaatsformule moveformula - moveformula moveformula - spostaformula moveformula + moveformula moveformula + spostaformula moveformula setupformulas: stelformulesin setupformulae stelleformelnein nastavrovnice impostaformule seteazaformule @@ -1780,20 +1797,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 - definepagebreak: definieerpaginaovergang definepagebreak - definepagebreak definepagebreak - definepagebreak definepagebreak -definecolumnbreak: definieerkolomovergang definecolumnbreak - definecolumnbreak definecolumnbreak - definecolumnbreak definecolumnbreak + definepagebreak: definieerpaginaovergang definepagebreak + definepagebreak definepagebreak + definepagebreak definepagebreak +definecolumnbreak: definieerkolomovergang definecolumnbreak + definecolumnbreak definecolumnbreak + definecolumnbreak definecolumnbreak \stopcommands @@ -1874,11 +1891,11 @@ definecolumnbreak: definieerkolomovergang definecolumnbreak rechterrandafstand: rechterrandafstand rightedgedistance abstandrechterrand vzdalenostpravehookraje distanzabordodestro distantacoltdreapta - innermarginwidth: binnenmargebreedte innermarginwidth - innermarginwidth innermarginwidth + innermarginwidth: binnenmargebreedte innermarginwidth innermarginwidth innermarginwidth - outermarginwidth: buitenmargebreedte outermarginwidth - outermarginwidth outermarginwidth + innermarginwidth innermarginwidth + outermarginwidth: buitenmargebreedte outermarginwidth + outermarginwidth outermarginwidth outermarginwidth outermarginwidth innermargindistance: binnenmargeafstand innermargindistance innermargindistance innermargindistance @@ -1886,11 +1903,11 @@ innermargindistance: binnenmargeafstand innermargindistance outermargindistance: buitenmargeafstand outermargindistance outermargindistance outermargindistance outermargindistance outermargindistance - inneredgewidth: binnenrandbreedte inneredgewidth - inneredgewidth inneredgewidth + inneredgewidth: binnenrandbreedte inneredgewidth inneredgewidth inneredgewidth - outeredgewidth: buitenrandbreedte outeredgewidth - outeredgewidth outeredgewidth + inneredgewidth inneredgewidth + outeredgewidth: buitenrandbreedte outeredgewidth + outeredgewidth outeredgewidth outeredgewidth outeredgewidth inneredgedistance: binnenrandafstand inneredgedistance inneredgedistance inneredgedistance @@ -1934,9 +1951,9 @@ outermargindistance: buitenmargeafstand outermargindistance pageoffset: paginaoffset pageoffset pageoffset pageoffset pageoffset pageoffset - pagedepth: paginadiepte pagedepth - pagedepth pagedepth - pagedepth pagedepth + pagedepth: paginadiepte pagedepth + pagedepth pagedepth + pagedepth pagedepth kopniveau: kopniveau headlevel kopfniveau hlavniuroven livellotesta niveltitlu % GB @@ -1951,18 +1968,18 @@ outermargindistance: buitenmargeafstand outermargindistance useXMLfilter useXMLfilter useXMLfilter useXMLfilter -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 - terminagruppocolonne stopcolumnset +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 + terminagruppocolonne stopcolumnset usetypescript: gebruiktypescript usetypescript usetypescript usetypescript diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex index 7d02aff65..7e34cb065 100644 --- a/tex/context/base/mult-con.tex +++ b/tex/context/base/mult-con.tex @@ -796,6 +796,12 @@ clipoffset: clipoffset clipoffset menu: menu menu menue menu menu meniu + tekstmethode: tekstmethode textmethod + textmethod textmethod + textmethod textmethod + zijmethode: zijmethode sidemethod + sidemethod sidemethod + sidemethod sidemethod methode: methode method methode metoda metodo metoda @@ -2459,6 +2465,10 @@ geencontrole: geencontrole nocheck lokaleumgebung lokalnihoprostredi ambientelocale mediulocal + linenote: regelnoot linenote + linenote linenote + linenote linenote + \stopelements %D \stopcompressdefinitions diff --git a/tex/context/base/mult-ini.tex b/tex/context/base/mult-ini.tex index 186364762..82e68bc41 100644 --- a/tex/context/base/mult-ini.tex +++ b/tex/context/base/mult-ini.tex @@ -745,7 +745,7 @@ % \endcsname\@EA{\csname#2#3\endcsname}% % \fi} % -% sligntly more efficient (but not faster in day to day runs) +% slightly more efficient (but not faster in day to day runs) \def\dosetvalue#1#2% {\let\c!internal!\c!internal!n @@ -1456,6 +1456,4 @@ \appendtoks \showcontextbanner \to \everydump -\protect - -\endinput +\protect \endinput diff --git a/tex/context/base/page-app.tex b/tex/context/base/page-app.tex index 6d3d04ff0..5b5d49f49 100644 --- a/tex/context/base/page-app.tex +++ b/tex/context/base/page-app.tex @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\writestatus{loading}{Context Page Macros / Applications} + %D The fitting page code is moved from \type {meta-fig} to %D here. diff --git a/tex/context/base/page-bck.tex b/tex/context/base/page-bck.tex index 22bf96db0..c6d2e90ed 100644 --- a/tex/context/base/page-bck.tex +++ b/tex/context/base/page-bck.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\writestatus{loading}{Context Page Macros (Backgrounds)} +\writestatus{loading}{Context Page Macros / Backgrounds} \unprotect diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex index d96ddb385..289eaf13b 100644 --- a/tex/context/base/page-flt.tex +++ b/tex/context/base/page-flt.tex @@ -182,6 +182,12 @@ [\??fl#1][\c!kader=\v!aan]% {\getmessage\m!floatblocks{12}}} +% A complication is that we may have to handle a pagebreak +% first, which in turn may issue a (postponed) float. +% Therefore we may not trust on variable assignments before +% we're realy dealing with the float. Some day I'll root out +% the global settings. + \def\docomplexplaatsblok[#1][#2]% [#3]#4% {\edef\floattype{#1}% \doifelsenothing\floattype @@ -192,24 +198,80 @@ {\edef\floatlocation{#2}}% \expanded{\dodocomplexplaatsblok[\floattype][\floatlocation]}} -\def\presetfloatvariables#1#2#3#4% better a processaction +\def\dodocomplexplaatsblok[#1][#2][#3]#4% + {\flushnotes + \ifsomefloatwaiting + % this was \checkwaitingfloats spread all over + \doifinsetelse\v!altijd{#2} + {\showmessage\m!floatblocks5\empty} + {\doifcommonelse + {#2} + {\v!links,\v!rechts,\v!binnen,\v!buiten,% + \v!inlinker,\v!inrechter,\v!inmarge,% + \v!linkermarge,\v!rechtermarge,\v!linkerrand,\v!rechterrand,% + \v!binnenmarge,\v!buitenmarge,\v!binnenrand,\v!buitenrand,% + \v!tekst,\v!naast}% \v!pagina + {\doflushfloats} + {}}% + % but which should be done before using box \floatbox + \fi + \ifmargeblokken % waarschijnlijk gebroken ! ! ! ! + \doifinset\v!marge{#2} + {\endgraf + \bgroup\everypar{\egroup\the\everypar}% + \hsize\@@mbbreedte}% + \fi + \global\insidefloattrue + \begingroup % ** + \the\everyinsidefloat + \let\@@extrafloat\empty + \presetmorefloatvariables{#2}% + \dowithnextboxcontent % better a \the\everyfloattoks + {\setlocalfloathsize + \getvalue{\??fl#1\c!binnen}% + \fuzzysnappingfalse + \postponefootnotes} % new + {\xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}% ** not yet done + % we need to carry over the par because of side floats + \doifnotinset\v!tekst{#2}{\carryoverpar\endgroup}% + \ifparfloat + \doifinset\v!reset{#2}\forgetsidefloats + \doinhibitblank + \fi}% better move this to side floats + \vbox} + +%\def\xxdocompletefloat#1#2% +% {\setbox\nextbox\hbox{\signalrightpage\flushnextbox}% +% \doifrightpageelse{\let\@@extrafloat#1}{\let\@@extrafloat#2}} + +\def\xxdocompletefloat#1#2% + {\rightorleftpageaction{\let\@@extrafloat#1}{\let\@@extrafloat#2}} + +\chardef\textfloatmethod=0 % 0=raw 1=safe (.99) 2=tight (-1pt) +\chardef\sidefloatmethod=1 % 0=raw 1=safe (.99) 2=tight (-1pt) + +\def\presetfloatvariables#1#2#3#4% {\doifcommonelse {#2} - {\v!links,\v!rechts,\v!inlinker,\v!inrechter,\v!inmarge,% + {\v!links,\v!rechts,\v!binnen,\v!buiten,% + \v!inlinker,\v!inrechter,\v!inmarge,% + \v!binnenmarge,\v!buitenmarge,\v!binnenrand,\v!buitenrand,% \v!linkermarge,\v!linkerrand,\v!rechtermarge,\v!rechterrand} {\global\parfloattrue} {\global\parfloatfalse}% - \global\sidefloatshift\zeropoint \ifbinnenkolommen \global\parfloatfalse \fi - \calculatefloatskips{#1}% + \global\sidefloatshift\zeropoint + \global\chardef\sidefloatmethod\getvalue{\??fl#1\c!zijmethode}% + \global\chardef\textfloatmethod\getvalue{\??fl#1\c!tekstmethode}% \global\chardef\sidefloatalign\zerocount + \calculatefloatskips{#1}% \ifparfloat \processaction [\getvalue{\??fl#1\c!zijuitlijnen}] [\v!hoogte=>\global\chardef\sidefloatalign\plusone,% - \v!regel=>\global\chardef\sidefloatalign\plustwo,% + \v!regel=>\global\chardef\sidefloatalign\plustwo,% (***) \v!diepte=>\global\chardef\sidefloatalign\plusthree]% \ifcase\sidefloatalign\relax \doifinset\v!hoogte{#2}{\global\chardef\sidefloatalign\plusone}% @@ -240,6 +302,8 @@ \global\nofloatcaptiontrue \fi \fi} +% documenteren in details + \def\presetmorefloatvariables#1% {\doifelse\@@bklokaal\v!ja % fout keyword \globalcenterfloatboxtrue @@ -251,7 +315,7 @@ \localcenterfloatboxtrue \localcenterfloatboxfalse \fi - \doifnotinset\v!altijd{#1} + \doifnotcommon{\v!altijd,\v!hier,\v!forceer}{#1} % ! ! ! ! ! ! {\globalcenterfloatboxfalse \localcenterfloatboxfalse}} @@ -269,50 +333,9 @@ \to \everyinsidefloat %\appendtoks -% \fuzzysnappingfalse % what is otr is +% \fuzzysnappingfalse %\to \everyinsidefloat -\def\dodocomplexplaatsblok[#1][#2][#3]#4% - {\flushnotes - \ifsomefloatwaiting - % this was \checkwaitingfloats spread all over - \doifinsetelse\v!altijd{#2} - {\showmessage\m!floatblocks5\empty} - {\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 % waarschijnlijk gebroken ! ! ! ! - \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 - {\setlocalfloathsize - \fuzzysnappingfalse - \postponefootnotes} % new - {\xdocompletefloat{#1}{#3}{#1}{#2}{#1}{#4}% - % we need to carry over the par because of side floats - \doifnotinset\v!tekst{#2}{\carryoverpar\endgroup}} % ** not yet done - \vbox} - -%\def\xxdocompletefloat#1#2% -% {\setbox\nextbox\hbox{\signalrightpage\box\nextbox}% -% \doifrightpageelse{\let\@@extrafloat#1}{\let\@@extrafloat#2}} - -\def\xxdocompletefloat#1#2% - {\rightorleftpageaction{\let\@@extrafloat#1}{\let\@@extrafloat#2}} - \def\doifrightpagefloatelse % watch out: other default ! ! ! {\ifdubbelzijdig \ifodd\purenumber\twopassfloatdata\space @@ -332,55 +355,41 @@ % \let\movesidefloat\gobbleoneargument -% new : \place...[leftmargin,-2*line] +% new : \place...[leftmargin,-2*line]; we need to catch fxtb:2*3 +% watch out: line alone aligns on the line ! ! ! -% (keep this) this fails on fxtb:2*3 -% -% \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} -% -% so we need to catch the : +\def\movesidefloat[#1]% (-)line|x=,y= + {\doifassignmentelse{#1}% + {\bgroup + \getparameters[\??fl][\c!x=\zeropoint,\c!y=\zeropoint,#1]% + \ifgridsnapping + \getnoflines\@@fly + \global\sidefloatdownshift\noflines\lineheight + \else + \global\sidefloatdownshift\@@fly + \fi + \global\sidefloatextrashift\@@flx + \egroup} + {\movedownsidefloat[#1]}} -\def\movesidefloat[#1]% +\def\movedownsidefloat[#1]% already in core {\bgroup \cleanupfeatures \doifinstringelse{:}{#1} \donothing {\donefalse - \def\movesidefloat##1% - {\doifnumber{##1} - {\ifdone\else\global\sidefloatdownshift\zeropoint\donetrue\fi - \global\advance\sidefloatdownshift##1\lineheight}}% - \expanded{\dorepeatwithcommand[#1]}\domovesidefloat}% + \def\movedownsidefloat##1% + {\processaction + [##1]% + [ \v!regel=>\docommando+,% + +\v!regel=>\docommando+,% + -\v!regel=>\docommando-]} + \def\docommando##1% + {\ifdone\else\global\sidefloatdownshift\zeropoint\donetrue\fi + \global\advance\sidefloatdownshift##1\lineheight}% + \expanded{\dorepeatwithcommand[#1]}\movedownsidefloat}% \egroup} -% or cleaner but 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 @@ -396,7 +405,8 @@ \v!buitenrand=>\xxdocompletefloat\v!rechterrand \v!linkerrand, ininner=>\xxdocompletefloat\v!inlinker \v!inrechter, inouter=>\xxdocompletefloat\v!inrechter \v!inlinker, - \s!unknown=>{\movesidefloat[\commalistelement]}]% + \v!regel=>, % only -n*line is handled (see ***) + \s!unknown=>{\movedownsidefloat[\commalistelement]}]% \ifx\@@extrafloat\empty \docompletefloat{#1}{#2}{#3}{#4}{#5}{#6}\nextbox \else @@ -432,14 +442,15 @@ % \fi}% % \fi} +\newdimen\sidefloatextrashift + \def\setlocalfloatdimensions#1#2#3#4% experimental / #3 box number #4 prefix {\global\sidefloatshift\zeropoint\relax % duplicate \ifextrafloatactions -\ifdim\sidefloatdownshift=\zeropoint\else - \global\setbox\floatbox\vbox - {\vskip\sidefloatdownshift\nointerlineskip\box\floatbox}% -\fi -\global\sidefloatdownshift\zeropoint + \ifdim\sidefloatdownshift=\zeropoint\else + \global\setbox\floatbox\vbox + {\vskip\sidefloatdownshift\nointerlineskip\box\floatbox}% + \fi \doifvaluesomething{\??fl#1\c!minbreedte} {\scratchdimen\getvalue{\??fl#1\c!minbreedte}\relax \ifdim\wd#3<\scratchdimen @@ -471,7 +482,10 @@ \box#3% \doifnotvalue{\??fl#1\c!plaats}\v!rechts\hss}}}}% \fi}% - \fi} + \advance\sidefloatshift\sidefloatextrashift + \fi + \global\sidefloatdownshift \zeropoint + \global\sidefloatextrashift\zeropoint} \def\docomplexstarttekstblok[#1][#2][#3]% {\flushnotes @@ -528,6 +542,8 @@ \c!kaderoffset=\@@bkkaderoffset, %\c!lokaal=\@@bklokaal, \c!paginaovergangen=, + \c!tekstmethode=\@@bktekstmethode, + \c!zijmethode=\@@bkzijmethode, \c!default=]% \stelblokkopjein [#1] @@ -597,7 +613,8 @@ \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]% + \c!kaderoffset,\c!paginaovergangen,\c!default, + \c!tekstmethode,\c!zijmethode]% \copyparameters[\??kj#1][\??kj#3] [\c!plaats,\c!voor,\c!tussen,\c!na, \c!breedte,\c!kopletter,\c!kopkleur,\c!letter,\c!kleur, @@ -649,14 +666,25 @@ \let\twopassfloatdata\realpageno -\def\dogetfloatdata % precedes save ! - {\doglobal\increment\noffloatpages - \gettwopassdata{\s!float\s!data}% - \iftwopassdatafound - \globallet\twopassfloatdata\twopassdata - \else - \globallet\twopassfloatdata\realpageno % \realfolio - \fi} +% \def\dogetfloatdata % precedes save ! +% {\doglobal\increment\noffloatpages +% \gettwopassdata{\s!float\s!data}% +% \iftwopassdatafound +% \globallet\twopassfloatdata\twopassdata +% \else +% \globallet\twopassfloatdata\realpageno % \realfolio +% \fi} +% +% \def\dosavefloatdata +% {\bgroup +% \edef\dosavefloatdata +% {\writeutilitycommand +% {\twopassentry +% {\s!float\s!data}% +% {\noffloatdata}% +% {\noexpand\realfolio}}}% later {}{}{}{} and \getfirst... +% \dosavefloatdata +% \egroup} \def\dosavefloatdata {\bgroup @@ -665,9 +693,18 @@ {\twopassentry {\s!float\s!data}% {\noffloatdata}% - {\noexpand\realfolio}}}% later {}{}{}{} and \getfirst... + {\noffloatpages::\noexpand\realfolio}}}% later {}{}{}{} and \getfirst... \dosavefloatdata \egroup} + +\def\dogetfloatdata % precedes save ! + {\doglobal\increment\noffloatpages + \findtwopassdata{\s!float\s!data}{\noffloatpages::}% + \iftwopassdatafound + \globallet\twopassfloatdata\twopassdata + \else + \globallet\twopassfloatdata\realpageno % \realfolio + \fi} % Er wordt bij \v!altijd als dat nodig is hernummerd. % Daarbij wordt gebruik gemaakt van de opgeslagen nummers en @@ -829,7 +866,7 @@ \fi \egroup} -\def\doplacefloatbox% +\def\doplacefloatbox {%\forgetall % NJET! \witruimte \blanko[\@@bkvoorwit] @@ -846,6 +883,8 @@ \ifx\somefacefloat\undefined \let\somefacefloat\doplacefloatbox \fi \ifx\sometextfloat\undefined \let\sometextfloat\doplacefloatbox \fi +% brr, wordt deze niet overladen in page-one? weg er mee + \def\somepagefloat[#1]% links, rechts, midden, hoog, midden, laag {%\checkwaitingfloats{#1}% \global\setbox\collectedpagefloats\vbox @@ -1544,15 +1583,66 @@ \let\naturalfloatwidth \!!zeropoint \let\naturalfloatdepth \!!zeropoint +% \long\def\docompletefloat#1#2#3#4#5#6#7% #7 = box number +% {\flushsidefloats +% \presetfloatvariables{#1}{#4}{#2}{#6}% +% \bgroup +% %\setlocalfloatdimensions{#1}{#4}{#7}\relax +% \global\setbox\floatbox\vbox{\box#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}\empty +% \global\setbox\floatbox\vbox{\getvalue{\e!lege#3}}% +% \fi +% \ifnofloatcaption +% \global\setbox\floatbox\vbox +% {\unvbox\floatbox +% \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 +% \ifnofloatnumber +% \global\setbox\floatbox\vbox +% {\unvbox\floatbox % no \vss, keep the depth +% \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}}% +% \egroup +% \preparethenumber{\??kj#1}\hetnummer\preparednumber +% \dofloat{#4}{\labeltexts{#5}{\preparednumber}}{#6}{#1}% +% \fi +% \fi +% \global\insidefloatfalse} + +\def\setnaturalfloatdimensions#1% + {\xdef\naturalfloatheight{\the\ht#1}% + \xdef\naturalfloatwidth {\the\wd#1}% + \xdef\naturalfloatdepth {\the\dp#1}} + \long\def\docompletefloat#1#2#3#4#5#6#7% #7 = box number {\flushsidefloats \presetfloatvariables{#1}{#4}{#2}{#6}% \bgroup - %\setlocalfloatdimensions{#1}{#4}{#7}\relax - \global\setbox\floatbox\vbox{\box#7}% - \xdef\naturalfloatheight{\the\ht\floatbox}% - \xdef\naturalfloatwidth {\the\wd\floatbox}% - \xdef\naturalfloatdepth {\the\dp\floatbox}% + \setnaturalfloatdimensions#7% + \global\setbox\floatbox\vbox + {\executeifdefined{\??fl#1\c!commando}\firstofoneargument{\box#7}}% + \setnaturalfloatdimensions\floatbox \dimen0 \ht\floatbox \advance\dimen0 \dp\floatbox \ifdim\dimen0=\zeropoint @@ -1568,7 +1658,6 @@ \dofloat{#4}{}{#6}{#1}% \else \doglobal\convertargument#6\to\asciititle % \asciititle is global -% \doifelsevalue{\??kj#1\c!nummer}\v!ja \ifnofloatnumber \global\setbox\floatbox\vbox {\unvbox\floatbox % no \vss, keep the depth @@ -1731,33 +1820,109 @@ \appendtoks\the\everytopofpage \to\everystarttext \appendtoks\global\everytopofpage{}\to\everystoptext +% \def\douitstellen +% {\the\everytopofpage +% \ifvoid\collectedpagefloats\else +% % message +% \unvbox\collectedpagefloats +% \fi +% \ifinuitstellen\else\ifcase\nofpostponedblocks\else % The \nof-test is +% \bgroup % we need the color/font switch, else problems inside split verbatim +% \setnormalcatcodes % uitstellen in verbatim +% \edef\savedtopofpagecolor{\topofpagecolor}% +% \doifsomething\savedtopofpagecolor\restorecolormode % \stopcolormode +% \restoreglobalbodyfont +% \global\pagetotal\zeropoint % recently added and +% \global\inuitstellentrue % definitely needed else +% \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 +% \global\inuitstellenfalse % proper analysis +% \doifsomething\savedtopofpagecolor\startcolormode\savedtopofpagecolor +% \egroup +% \fi\fi} +% +% \setvalue{\e!start\e!uitstellen}% +% {\doglobal\increment\nofpostponedblocks +% \showmessage\m!layouts3\nofpostponedblocks +% \dostartbuffer[buf-\nofpostponedblocks] +% [\e!start\e!uitstellen][\e!stop\e!uitstellen]} + +% \startpostponing [pagenumber] [+pageoffset] +% +% \startpostponing[2] +% PAGE 2 \blank +% \stoppostponing +% +% \startpostponing[+1] +% PAGE +1 \blank +% \stoppostponing +% +% \startpostponing[+2] +% PAGE +2 \blank +% \stoppostponing +% +% \starttext \dorecurse{4}{\input tufte \page} \stoptext + +\newtoks \postponedpageblocks +\newcounter\nofpostponedpageblocks + \def\douitstellen {\the\everytopofpage \ifvoid\collectedpagefloats\else % message \unvbox\collectedpagefloats \fi - \ifinuitstellen\else\ifcase\nofpostponedblocks\else % The \nof-test is + \donefalse + \ifinuitstellen \else + \ifcase\nofpostponedblocks \else \donetrue \fi + \ifcase\nofpostponedpageblocks \else \donetrue \fi + \fi + \ifdone \bgroup % we need the color/font switch, else problems inside split verbatim \setnormalcatcodes % uitstellen in verbatim \edef\savedtopofpagecolor{\topofpagecolor}% \doifsomething\savedtopofpagecolor\restorecolormode % \stopcolormode - \restoreglobalbodyfont + \restoreglobalbodyfont % The \nof-test is \global\pagetotal\zeropoint % recently added and \global\inuitstellentrue % definitely needed else - \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 - \global\inuitstellenfalse % proper analysis + \the\postponedpageblocks % we can loose or disorder + \dorecurse\nofpostponedblocks % floats; anyhow, this + {\haalbuffer[pbuf-\recurselevel]} % mechanism is still + \doflushfloats % new but potential dangerous % suboptimal and needs a + \doglobal\newcounter\nofpostponedblocks % proper analysis + \global\inuitstellenfalse \doifsomething\savedtopofpagecolor\startcolormode\savedtopofpagecolor \egroup - \fi\fi} + \fi} + +\def\getpostponedblock#1#2% + {\doif{#1}\realfolio{\haalbuffer[rbuf-#2]}} % no \ifnum, avoid \fi + +% beware, \dosingleempty conflicts with buffers (feeds back the \par) \setvalue{\e!start\e!uitstellen}% + {\bgroup + \obeylines + \doifnextcharelse[% + {\egroup\nodostartpostponing}{\egroup\dodostartpostponing}} + +\def\nodostartpostponing[#1]% + {\doglobal\increment\nofpostponedpageblocks + \bgroup % a little bit of misusing grouping + \doifinstring{+}{#1}\advance \realpageno#1\relax % ugly but efficient + \doglobal\appendetoks\noexpand\getpostponedblock + {\realfolio}{\nofpostponedpageblocks}\to\postponedpageblocks + \egroup + \showmessage\m!layouts3\nofpostponedpageblocks + \dostartbuffer[rbuf-\nofpostponedpageblocks]% + [\e!start\e!uitstellen][\e!stop\e!uitstellen]} + +\def\dodostartpostponing {\doglobal\increment\nofpostponedblocks \showmessage\m!layouts3\nofpostponedblocks - \dostartbuffer[buf-\nofpostponedblocks] + \dostartbuffer[pbuf-\nofpostponedblocks]% [\e!start\e!uitstellen][\e!stop\e!uitstellen]} \definieernummer @@ -1789,18 +1954,18 @@ \setbox2\vbox{\unvbox2} \ifdim\ht2>\lineheight \verhoognummer[\??si]% - \ifnum\ruwenummer[\??si]=1 \ifdim\ht\nextbox=\zeropoint + \ifnum\ruwenummer[\??si]=1 \ifdim\nextboxht=\zeropoint \let\floatcaptionsuffix\empty \fi \fi \bgroup #2{\unvbox2} \egroup - \ifdim\ht\nextbox>\zeropoint + \ifdim\nextboxht>\zeropoint \pagina \verlaagnummer[\floatcaptionnumber]% \fi \fi - \ifdim\ht\nextbox>\zeropoint\else + \ifdim\nextboxht>\zeropoint\else \expandafter\exitloop \fi}% \egroup} @@ -1891,6 +2056,8 @@ \c!zijvoorwit=\@@bkvoorwit, \c!zijnawit=\@@bknawit, \c!zijuitlijnen=\v!normaal, + \c!tekstmethode=\ifgridsnapping2\else0\fi, % 0=raw 1=safe (.99pg) 2=tight (-1pt) + \c!zijmethode=\ifgridsnapping2\else1\fi, % 0=raw 1=safe (.99pg) 2=tight (-1pt) \c!springvolgendein=\v!nee, \c!marge=1em, \c!linkermargeafstand=\zeropoint, diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex index 1ea17741a..f35b08bf2 100644 --- a/tex/context/base/page-imp.tex +++ b/tex/context/base/page-imp.tex @@ -121,7 +121,7 @@ {\dowithnextbox {\global\setbox\postponedcontent\hbox to \zeropoint {%\hskip-\maxdimen % niet hier, gaat mis in acrobat (clipt) - \box\postponedcontent\box\nextbox}% + \box\postponedcontent\flushnextbox}% \global\ht\postponedcontent\zeropoint \global\dp\postponedcontent\zeropoint \global\wd\postponedcontent\zeropoint}% @@ -162,7 +162,7 @@ \hbox % \setbox0=\box.. is nicer {\setbox0\hbox{#1}% just in case there are objects there \setbox\scratchbox\hbox - {\the\everyshipout + {\the\everyshipout\relax \ifnum\realpageno=\lastpage\relax \flushtextdata \the\everylastshipout diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex index bd1235a21..167f59af8 100644 --- a/tex/context/base/page-ini.tex +++ b/tex/context/base/page-ini.tex @@ -700,7 +700,7 @@ \mainoutput{\invokeoutputroutine} \output{\inotrtrue\the\mainoutput} -\installoutput\synchronizeoutput +\installoutput\synchronizeoutput % maybe add pagediscards {\ifvoid\normalpagebox\else\unvbox\normalpagebox\fi} %D In order to force consistent use of variables, we @@ -864,7 +864,7 @@ \def\ejectinsert {\flushnotes \bgroup - \noftopfloats\!!thousand + \noftopfloats\plusthousand \nofbotfloats\zerocount \doflushfloats \egroup} @@ -954,10 +954,11 @@ \maxdeadcycles=1000 -% will be installable tracer +% will be installable tracer; better use chardef \newif\ifvoorlopig \voorlopigfalse -\newif\ifconcept \conceptfalse + +\chardef\conceptmode\zerocount \def\doplaatsversieaanduiding#1#2% {\doifsomething{#2} @@ -966,7 +967,17 @@ \!!doneatrue}} \def\plaatsversieaanduiding% nog engels maken - {\ifvoorlopig + {\ifcase\conceptmode + % nothing + \or + % simple + \vskip\!!sixpoint + \hbox to \zetbreedte + {\infofont + Concept: \currentdate + \hss\reportpagedimensions}% + \or + % extensive \vskip\!!sixpoint \hbox to \zetbreedte {\infofont @@ -976,64 +987,50 @@ \doplaatsversieaanduiding{Onderdeel}\currentcomponent \if!!donea\else\ File: \jobname\fi \hss\reportpagedimensions}% - \fi - \ifconcept - \vskip\!!sixpoint - \hbox to \zetbreedte - {\infofont - Concept: \currentdate - \hss\reportpagedimensions}% \fi} % tot hier \def\doversie[#1]% {\voorlopigfalse - \conceptfalse + \chardef\conceptmode\zerocount \overfullrule\zeropoint - \processaction + \processaction % \v!definitief=> [#1] - [\v!voorlopig=>\voorlopigtrue\overfullrule5pt, - \v!concept=>\concepttrue]} + [ \v!concept=>\chardef\conceptmode\plusone,% simple banner + \v!file=>\chardef\conceptmode\plustwo,% full banner + \v!voorlopig=>\chardef\conceptmode\plustwo % full banner plus + \overfullrule5\s!pt]} % info in the margin \def\versie {\dosingleargument\doversie} -%\def\addstatusinfo#1% -% {\ifvoorlopig \donetrue \else -% \ifconcept \donetrue \else -% \donefalse \fi \fi -% \ifdone -% \setbox#1=\vbox to \papierhoogte -% {\vsmashbox#1\box#1 -% \offinterlineskip -% \vskip\kopwit -% \hsize\papierbreedte -% \hfill\hbox{\plaatstestinfo\hskip.5cm}\vss -% \settexthoffset\hskip\texthoffset -% \tlap{\plaatsversieaanduiding} -% \vskip.5cm}% -% \fi} +%\def\addstatusinfo +% {\ifvoorlopig +% \@EA\doaddstatusinfo +% \else\ifcase\conceptmode +% \@EAEAEA\gobbleoneargument +% \else +% \@EAEAEA\doaddstatusinfo +% \fi\fi} \def\addstatusinfo - {\ifvoorlopig - \@EA\doaddstatusinfo - \else\ifconcept - \@EAEAEA\doaddstatusinfo + {\ifcase\conceptmode + \@EA\gobbleoneargument \else - \@EAEAEA\gobbleoneargument - \fi\fi} + \@EA\doaddstatusinfo + \fi} \def\doaddstatusinfo#1% {\setbox#1\vbox to \papierhoogte - {\vsmashbox#1\box#1 + {\vsmashbox#1\box#1% \offinterlineskip \vskip\kopwit \hsize\papierbreedte \hfill\hbox{\plaatstestinfo\hskip.5cm}\vss - \settexthoffset\hskip\texthoffset - \tlap{\plaatsversieaanduiding} - \vskip.5cm}} + \settexthoffset\hskip\texthoffset % brrrr + %\tlap{\plaatsversieaanduiding}\vskip.5cm}} + \vbox to 1cm{\vss\plaatsversieaanduiding\vss}}} \def\dotestinfo#1#2#3% {\ifvoorlopig\ifinpagebody\else @@ -1186,8 +1183,14 @@ \let\poparrangedpages\relax \let\pusharrangedpage\relax -\let\shiftprintpagebox\gobbleoneargument -\let\shiftpaperpagebox\gobbleoneargument +\ifx\shiftprintpagebox\undefined + \let\shiftprintpagebox\gobbleoneargument + \let\shiftpaperpagebox\gobbleoneargument +\fi + +\ifx\registerpageposition\undefined + \let\registerpageposition\gobbleoneargument +\fi \def\reportarrangedpage#1% {\showmessage\m!systems @@ -1225,6 +1228,7 @@ \ifpagebodyornaments \addpagebackground \pagebox \fi + \registerpageposition\pagebox \ifarrangingpages \shiftpaperpagebox \pagebox % \v!papier \else @@ -1289,30 +1293,58 @@ % not here -\newif\ifpaginageblokkeerd -\paginageblokkeerdfalse - -\def\testpagina[#1][#2]% - {\relax % needed ! - \ifpaginageblokkeerd \else - \ifdim\pagegoal<\maxdimen - \ifdim\pagetotal<\pagegoal % \relax - \scratchdimen\lineheight - \multiply\scratchdimen#1\relax - \advance\scratchdimen \pagetotal - \ifdim\lastskip<\parskip - \advance\scratchdimen \parskip - \fi +\newif\ifpaginageblokkeerd \paginageblokkeerdfalse + +\def\testpage + {\dodoubleempty\dotestpage} + +\def\dotestpage[#1][#2]% + {%\relax % needed before \if + \endgraf + \ifpaginageblokkeerd \else \ifdim\pagegoal<\maxdimen + \ifdim\pagetotal<\pagegoal % \relax + \scratchdimen\lineheight + \multiply\scratchdimen#1\relax + \advance\scratchdimen \pagetotal + \ifdim\lastskip<\parskip + \advance\scratchdimen \parskip + \fi + \ifsecondargument \advance\scratchdimen#2\relax - \ifdim\scratchdimen>.99\pagegoal - \penalty-\!!tenthousand\relax - \fi - \fi - \else - \goodbreak + \fi + % quite inaccurate, better pagegoal 1pt or so + \ifdim\scratchdimen>.99\pagegoal + \penalty-\!!tenthousand\relax + \fi + \fi + \else + \goodbreak + \fi \fi} + +\def\testcolumn + {\dodoubleempty\dotestcolumn} + +\def\dotestcolumn[#1][#2]% + {%\relax % needed before \if ! + \endgraf + \ifdim\pagegoal<\maxdimen \ifdim\pagetotal<\pagegoal % \relax + \scratchdimen\pagegoal + \advance\scratchdimen-\pagetotal + \ifdim\lastskip<\parskip + \advance\scratchdimen \parskip \fi - \fi} - + \ifsecondargument + \advance\scratchdimen#2% + \fi + \getrawnoflines\scratchdimen % raw ! + % \message{[\number#1>\number\noflines ?}\wait + \ifnum#1>\noflines + \column + \fi + \else + \penalty-\!!tenthousand % untested ! ! \column + \fi \fi} + \let\resetcurrentsectionmarks\relax % was: \resetsectionmarks\firstsection, zie \handelpaginaaf @@ -1402,7 +1434,7 @@ \ifbinnenkolommen % this will move to MUL \dosomebreak\goodbreak \else - \testpagina[3][\zeropoint]% + \testpage[3][\zeropoint]% \fi \fi} @@ -1411,7 +1443,7 @@ \ifbinnenkolommen % this will move to MUL \dosomebreak\goodbreak \else - \testpagina[5][\zeropoint]% + \testpage[5][\zeropoint]% \fi \fi} diff --git a/tex/context/base/page-lay.tex b/tex/context/base/page-lay.tex index 938100570..3ea33ee4e 100644 --- a/tex/context/base/page-lay.tex +++ b/tex/context/base/page-lay.tex @@ -15,10 +15,10 @@ % swapmargins will disappear, and be replaced by inner/outer -% to be translated into english +% to be translated into english -% hoofdhoogte wordt bij status=hoog niet aangepast op outer -% level, wel binnen bepaalde berekeningen +% hoofdhoogte wordt bij status=hoog niet aangepast op outer +% level, wel binnen bepaalde berekeningen %D Before you start wondering why some of the page related %D modules skip upward or left in order to place elements, you @@ -44,7 +44,7 @@ \newdimen\papierbreedte \papierbreedte = 210mm \newdimen\printpapierhoogte \printpapierhoogte = \papierhoogte -\newdimen\printpapierbreedte \printpapierbreedte = \papierbreedte +\newdimen\printpapierbreedte \printpapierbreedte = \papierbreedte \newdimen\zethoogte % calculated \newdimen\zetbreedte % calculated @@ -73,9 +73,9 @@ \newdimen\onderhoogte \onderhoogte = \bovenhoogte \newcount\layoutlines \layoutlines = 0 -\newcount\layoutcolumns \layoutcolumns = 0 +\newcount\layoutcolumns \layoutcolumns = 0 \newdimen\layoutcolumndistance\layoutcolumndistance= 0pt -\newdimen\layoutcolumnwidth \layoutcolumnwidth = 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. @@ -89,7 +89,7 @@ % \getvalue{\??ly\currentlayout#1}% % \fi} % -% faster +% faster \def\layoutparameter#1% {\csname\??ly @@ -117,7 +117,7 @@ \@EA\ifx\csname\??ly#1#2\endcsname\relax \@EA\ifx\csname\??ly\currentlayout#2\endcsname\relax \else\currentlayout\fi - \else#1\fi + \else#1\fi \fi#2\endcsname} \endTEX @@ -151,10 +151,10 @@ \newif\iffixedlayoutdimensions \fixedlayoutdimensionstrue \iffixedlayoutdimensions - \let\@the\the + \let\@the\the \else \let\@the\empty -\fi +\fi %D The next series of dimensions are complemented by left %D and rights ones. @@ -264,12 +264,12 @@ \fi -%D \macros +%D \macros %D {definepapersize} %D %D Before we start calculating layout dimensions, we will %D first take care of paper sizes. The first argument can be -%D either an assignment (for defaults) or an identifier, in +%D either an assignment (for defaults) or an identifier, in %D which case the second argument is an assignment. %D %D \showsetup{\y!definepapersize} @@ -290,14 +290,14 @@ \setuppapersize \fi} -%D For the moment we need to fake this macro. +%D For the moment we need to fake this macro. -\ifx\setuppapersize\undefined - \let\setuppapersize\relax +\ifx\setuppapersize\undefined + \let\setuppapersize\relax \fi -%D We set the defaults to the dimensions of an A4 sheet of -%D paper. +%D We set the defaults to the dimensions of an A4 sheet of +%D paper. \definepapersize [\c!breedte=210mm,\c!hoogte=297mm,\c!offset=\!!zeropoint] @@ -306,12 +306,12 @@ %D {setuppaper,setuppapersize} %D %D When setting up the papersize on which to typeset and -%D print, we can also determine some more characteristics. +%D print, we can also determine some more characteristics. %D %D \showsetup{\y!setuppapersize} %D %D We keep track of these features with the following -%D variables. +%D variables. \chardef\papermirror =0 \chardef\printmirror =0 \chardef\paperrotation =0 \chardef\printrotation =0 @@ -329,14 +329,14 @@ % {\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 +% 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 + \multiply\scratchcounter\@@ppny \edef\@@ppxy{\the\scratchcounter}% \doifelsenothing\@@pppagina {\doifsomething\@@pppapier @@ -465,16 +465,16 @@ \global\snijwit\layoutparameter\c!snijwit \relax \doifelse{\layoutparameter\c!breedte}\v!midden - {\ifdim\snijwit=\zeropoint - \global\snijwit\rugwit - \fi + {\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 + {\ifdim\snijwit=\zeropoint + \global\snijwit\rugwit + \fi \global\zetbreedte\papierbreedte \global\advance\zetbreedte -\snijwit \scratchdimen\rugwit @@ -491,15 +491,15 @@ \global\advance\zetbreedte -\rechterrandbreedte \global\advance\zetbreedte -\scratchdimen} {\global\zetbreedte\layoutparameter\c!breedte\relax - \ifdim\snijwit=\zeropoint + \ifdim\snijwit=\zeropoint \global\snijwit\papierbreedte \global\advance\snijwit-\zetbreedte \global\advance\snijwit-\rugwit - % \else - % A kind of inconsistent specification, but used - % in for instance s-pre-19.tex; the cutspace is - % used only for determining some kind of right - % margin; don't use this in doublesided mode + % \else + % A kind of inconsistent specification, but used + % in for instance s-pre-19.tex; the cutspace is + % used only for determining some kind of right + % margin; don't use this in doublesided mode \fi}}% \scratchdimen\layoutparameter\c!bodemwit\relax %\ifdim\scratchdimen=\zeropoint @@ -509,16 +509,16 @@ \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 + {\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 + {\ifdim\bodemwit=\zeropoint + \global\bodemwit\kopwit + \fi \global\zethoogte\papierhoogte \global\advance\zethoogte -\bodemwit \scratchdimen\kopwit @@ -531,22 +531,22 @@ \global\advance\zethoogte -\onderhoogte \global\advance\zethoogte -\scratchdimen} {\global\zethoogte\layoutparameter\c!hoogte\relax - \ifdim\bodemwit=\zeropoint + \ifdim\bodemwit=\zeropoint \global\bodemwit\papierhoogte \global\advance\bodemwit-\zethoogte \global\advance\bodemwit-\kopwit - \else - % inconsistent specification + \else + % inconsistent specification \fi}}% \else \global\zethoogte\layoutparameter\c!regels\lineheight - % new, cleaner + % new, cleaner \global\advance\zethoogte-\strutheight \global\advance\zethoogte \topskip - % new, was a bug + % new, was a bug \global\advance\zethoogte \hoofdafstand \global\advance\zethoogte \voetafstand - % so far + % so far \global\advance\zethoogte \hoofdhoogte \global\advance\zethoogte \voethoogte \fi @@ -554,7 +554,7 @@ \kopoffset\layoutparameter\c!kopoffset \global\setdimentoatleast\zetbreedte\!!onepoint \global\setdimentoatleast\zethoogte \!!onepoint - % \checkcurrentlayout % here ? + % \checkcurrentlayout % here ? \calculatehsizes \calculatevsizes \calculatepseudocolumns @@ -562,7 +562,7 @@ \recalculatelogos \recalculatebackgrounds} -\newtoks \everylayoutcalculation \relax +\newtoks \everylayoutcalculation \relax \def\calculatepseudocolumns {\global\layoutcolumns\layoutparameter\c!kolommen @@ -585,13 +585,13 @@ \def\layoutcolumnoffset#1% {\executeifdefined{\??ly:c:#1}\!!zeropoint} - + \def\checklayout {\ifdim\zethoogte=\layoutlines\lineheight \else \recalculatelayout \fi} - + \appendtoks \checklayout \to \everystarttext -\def\checkcurrentlayout +\def\checkcurrentlayout % public and used in naw, so keep this name {\ifundefined{\??ly\realfolio\c!status}% \doifoddpageelse\checkcurrentoddlayout\checkcurrentevenlayout \else @@ -634,7 +634,7 @@ {\getparameters[\??ly#1][\c!status=\v!start,#2]} \def\dodosetuplayout[#1][#2]% - {\ConvertToConstant\doifnot{#2}{\v!reset} + {\ConvertToConstant\doifnot{#2}\v!reset {\getparameters[\??ly#1][#2]% \checkforems[#2]}} @@ -648,7 +648,7 @@ {\doifnot{#1}\v!reset{\def\currentlayout{#1}}}% \fi\fi \recalculatelayout -\checkcurrentlayout % here ? + \checkcurrentlayout % here ? \presetcenterpagebox} \def\setuplayout @@ -732,11 +732,11 @@ \def\paslayoutaan% {\dodoubleempty\dopaslayoutaan} -% describe interface +% describe interface %D Centering the paper area on the print area is determined %D by the \type {top}, \type {bottom}, \type {left} and \type -%D {right} parameters. +%D {right} parameters. \def\centerpagebox#1% {\printpapierbreedte\paperscale\printpapierbreedte @@ -747,22 +747,22 @@ {\ifdoublesidedprint \doifbothsides \@@pplinks \box#1\@@pprechts \orsideone \@@pplinks \box#1\@@pprechts - \orsidetwo \@@pprechts\box#1\@@pplinks + \orsidetwo \@@pprechts\box#1\@@pplinks \od \else \@@pplinks \box#1\@@pprechts \fi}% \par \@@pponder}} \def\offsetprintbox#1% - {\ifdim\kopoffset=\zeropoint % \relax - \ifdim\rugoffset=\zeropoint + {\ifdim\kopoffset=\zeropoint % \relax + \ifdim\rugoffset=\zeropoint \donefalse - \else - \donetrue - \fi - \else - \donetrue - \fi + \else + \donetrue + \fi + \else + \donetrue + \fi \ifdone \edef\next{\wd#1\the\wd#1\ht#1\the\ht#1\dp#1\the\dp#1}% \setbox#1\vbox @@ -788,7 +788,7 @@ % {\hbox{\dorecurse{#2}{\copy#1\hskip\@@lydx}\unskip}% % \vskip\@@lydy} % \unskip}} -% +% % \def\replicatepagebox#1% % {\ifnum\@@lynx>0 \ifnum\@@lyny>0 % \replicatebox{#1}{\@@lynx}{\@@lyny}% @@ -802,7 +802,7 @@ \else \donefalse \fi\fi - \ifdone + \ifdone \setbox#1\vbox {%\forgetall \offinterlineskip @@ -863,7 +863,7 @@ \let\cutmarklength\pagecutmarklength \makecutbox{#1}}} -\def\addpagecolormarks % #1 +\def\addpagecolormarks % #1 {\doifelse\@@lymarkering\v!kleur {\doaddpagecolormarks\colormarkbox} {\doifelse\@@lymarkering\v!raster @@ -921,7 +921,7 @@ \doifsometextlineelse \v!hoofd {\advance\teksthoogte -\hoofdhoogte \advance\teksthoogte -\hoofdafstand}% - {\hoofdhoogte\zeropoint + {\hoofdhoogte\zeropoint \setlayoutdistances}% \doifsometextlineelse \v!voet {\advance\teksthoogte -\voethoogte @@ -932,10 +932,10 @@ \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}% + {\tekstbreedte\layoutparameter\c!tekstbreedte}% % local \doifsomething{\layoutparameter\c!tekstmarge}% - {\advance\tekstbreedte-\layoutparameter\c!tekstmarge - \advance\tekstbreedte-\layoutparameter\c!tekstmarge}} + {\advance\tekstbreedte-\layoutparameter\c!tekstmarge % local + \advance\tekstbreedte-\layoutparameter\c!tekstmarge}} % local \def\calculatehsizes {\freezetextwidth @@ -977,7 +977,7 @@ \let\doifonevenpaginaelse\doifoddpageelse -% what are those \relax'es doing there? +% what are those \relax'es doing there? \def\doifbothsidesoverruled#1\orsideone#2\orsidetwo#3\od {\ifdubbelzijdig @@ -1062,56 +1062,56 @@ \def\outermarginwidth {\rightorleftpageaction\rechtermargebreedte\linkermargebreedte} \def\innermarginwidth - {\rightorleftpageaction\linkermargebreedte\rechtermargebreedte} + {\rightorleftpageaction\linkermargebreedte \rechtermargebreedte} \def\outermargindistance {\rightorleftpageaction\rechtermargeafstand\linkermargeafstand} \def\innermargindistance - {\rightorleftpageaction\linkermargeafstand\rechtermargeafstand} + {\rightorleftpageaction\linkermargeafstand \rechtermargeafstand} \def\outeredgewidth {\rightorleftpageaction\rechterrandbreedte\linkerrandbreedte} \def\inneredgewidth - {\rightorleftpageaction\linkerrandbreedte\rechterrandbreedte} + {\rightorleftpageaction\linkerrandbreedte \rechterrandbreedte} \def\outeredgedistance {\rightorleftpageaction\rechterrandafstand\linkerrandafstand} \def\inneredgedistance - {\rightorleftpageaction\linkerrandafstand\rechterrandafstand} + {\rightorleftpageaction\linkerrandafstand \rechterrandafstand} + +\beginETEX \dimexpr + + \def\leftmargintotal {\dimexpr(\linkermargebreedte +\linkermargeafstand )} + \def\rightmargintotal{\dimexpr(\rechtermargebreedte+\rechtermargeafstand)} + \def\leftedgetotal {\dimexpr(\linkerrandbreedte +\linkerrandafstand )} + \def\rightedgetotal {\dimexpr(\rechterrandbreedte +\rechterrandafstand )} -\beginETEX \dimexpr + \def\leftsidetotal {\dimexpr(\linkermargebreedte +\leftedgetotal )} + \def\rightsidetotal {\dimexpr(\rechtermargebreedte+\rightedgetotal)} - \def\leftmargintotal {\dimexpr(\linkermargebreedte +\linkermargeafstand )} - \def\rightmargintotal{\dimexpr(\rechtermargebreedte +\rechtermargeafstand)} - \def\leftedgetotal {\dimexpr(\linkerrandbreedte +\linkerrandafstand )} - \def\rightedgetotal {\dimexpr(\rechterrandbreedte +\rechterrandafstand )} + \def\leftcombitotal {\dimexpr(\leftmargintotal +\leftedgetotal )} + \def\rightcombitotal {\dimexpr(\rightmargintotal+\rightedgetotal)} - \def\leftsidetotal {\dimexpr(\linkermargebreedte +\leftedgetotal )} - \def\rightsidetotal {\dimexpr(\rechtermargebreedte +\rightedgetotal)} + \def\innermargintotal{\dimexpr(\innermarginwidth+\innermargindistance)} + \def\outermargintotal{\dimexpr(\outermarginwidth+\outermargindistance)} + \def\inneredgetotal {\dimexpr(\inneredgewidth +\inneredgedistance )} + \def\outeredgetotal {\dimexpr(\outeredgewidth +\outeredgedistance )} - \def\leftcombitotal {\dimexpr(\leftmargintotal +\leftedgetotal )} - \def\rightcombitotal {\dimexpr(\rightmargintotal +\rightedgetotal)} - - \def\innermargintotal{\dimexpr(\innermarginwidth +\innermargindistance)} - \def\outermargintotal{\dimexpr(\outermarginwidth +\outermargindistance)} - \def\inneredgetotal {\dimexpr(\inneredgewidth +\inneredgedistance )} - \def\outeredgetotal {\dimexpr(\outeredgewidth +\outeredgedistance )} - - \def\innercombitotal {\dimexpr(\innermargintotal +\inneredgetotal)} - \def\outercombitotal {\dimexpr(\outermargintotal +\outeredgetotal)} + \def\innercombitotal {\dimexpr(\innermargintotal+\inneredgetotal)} + \def\outercombitotal {\dimexpr(\outermargintotal+\outeredgetotal)} - \def\innersidetotal {\dimexpr(\innermarginwidth + \inneredgetotal)} - \def\outersidetotal {\dimexpr(\outermarginwidth + \outeredgetotal)} + \def\innersidetotal {\dimexpr(\innermarginwidth+\inneredgetotal)} + \def\outersidetotal {\dimexpr(\outermarginwidth+\outeredgetotal)} \endETEX %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 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. +%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 @@ -1121,7 +1121,7 @@ {\popmacro\currentlayout \popmacro\restorepapersize \restorepapersize - \setuplayout} + \setuplayout} %D \macros %D {showprint, showframe, showlayout, showsetups} @@ -1181,9 +1181,9 @@ \c!rechterrand=\layoutparameter\c!rand, \c!kopoffset=\!!zeropoint, \c!rugoffset=\!!zeropoint, - \c!tekstbreedte=, % dangerous option -> centered + \c!tekstbreedte=, % dangerous option -> centered / local \c!tekstmarge=, % dangerous option -> both sides - \c!tekstafstand=\!!zeropoint, % shift down on grid + \c!tekstafstand=\!!zeropoint, % shift down on grid \c!letter=, \c!kleur=, \c!markering=\v!uit, @@ -1245,8 +1245,9 @@ \definepapersize [S4] [\c!breedte=400pt,\c!hoogte=300pt] \definepapersize [S5] [\c!breedte=500pt,\c!hoogte=375pt] \definepapersize [S6] [\c!breedte=600pt,\c!hoogte=450pt] +\definepapersize [SW] [\c!breedte=800pt,\c!hoogte=450pt] -%D These are handy too: +%D These are handy too: \definepapersize [S33] [\c!breedte=300pt,\c!hoogte=300pt] \definepapersize [S44] [\c!breedte=400pt,\c!hoogte=400pt] @@ -1260,8 +1261,8 @@ \definepapersize [CD] [\c!breedte=120mm,\c!hoogte=120mm] %D The next series is for our English speaking friends who -%D decided to stick to non metric values. Thanks to Nelson -%D Beebe for completing the inch based list. +%D decided to stick to non metric values. Thanks to Nelson +%D Beebe for completing the inch based list. \definepapersize [letter] [\c!breedte=8.5in,\c!hoogte=11in] \definepapersize [ledger] [\c!breedte=11in,\c!hoogte=17in] @@ -1271,8 +1272,8 @@ \definepapersize [folio] [\c!breedte=8.5in,\c!hoogte=13in] \definepapersize [executive] [\c!breedte=7.25in,\c!hoogte=10.5in] -\definepapersize [A] [\c!breedte=8.5in,\c!hoogte=11in] % 1 sheet -\definepapersize [B] [\c!breedte=11in,\c!hoogte=17in] % 2 sheets +\definepapersize [A] [\c!breedte=8.5in,\c!hoogte=11in] % 1 sheet +\definepapersize [B] [\c!breedte=11in,\c!hoogte=17in] % 2 sheets \definepapersize [C] [\c!breedte=17in,\c!hoogte=22in] % 4 sheets %D The next set is for Tobias Burnus, who gave me the sizes. @@ -1296,15 +1297,15 @@ %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, +\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] + \c!rugwit=\zeropoint, + \c!dx=\zeropoint, + \c!dy=\zeropoint, + \c!nx=1, + \c!ny=1] \setuppapersize [\c!boven=, diff --git a/tex/context/base/page-lin.tex b/tex/context/base/page-lin.tex index f5b01b86e..12af9dc27 100644 --- a/tex/context/base/page-lin.tex +++ b/tex/context/base/page-lin.tex @@ -370,8 +370,12 @@ \the\aftereverylinenumbering \egroup} +% \unexpanded \def\crlf +% {\ifhmode\unskip\else\strut\fi\ifcase\raggedstatus\hfil\fi\break} + \unexpanded \def\crlf - {\ifhmode\unskip\else\strut\fi\ifcase\raggedstatus\hfil\fi\break} + {\ifhmode\unskip\else\strut\fi + \ifcase\raggedstatus\hfil\or\or\or\hfil\fi\break} \def\opeenregel {\def\crlf{\removelastspace\space}\let\\\crlf} diff --git a/tex/context/base/page-mak.tex b/tex/context/base/page-mak.tex index 2643292fa..c44ddc59d 100644 --- a/tex/context/base/page-mak.tex +++ b/tex/context/base/page-mak.tex @@ -120,8 +120,8 @@ \def\dodostartmakeup {\doifvaluesomething{\??do\currentmakeup\c!pagina} - {\ExpandFirstAfter\pagina[\makeupparameter\c!pagina]} - \soortpagina[\currentmakeup] + {\ExpandFirstAfter\pagina[\makeupparameter\c!pagina]}% + \soortpagina[\currentmakeup]% \setsystemmode\v!opmaak \setupmakeuplayout \makeupparameter\c!commandos @@ -169,6 +169,7 @@ \setupmakeuplayout \pagina \makeupparameter\c!na + \relax % voor fi \ifdubbelzijdig \ifodd\realpageno\else \processaction [\makeupparameter\c!dubbelzijdig] @@ -187,13 +188,16 @@ %D by setting their associated status variables. The %D connection between them is made by the following macro + \def\setupmakeuplayout {\setupfooter[\c!status=\makeupparameter\c!voetstatus ]% \setupheader[\c!status=\makeupparameter\c!hoofdstatus]% \setuptext [\c!status=\makeupparameter\c!tekststatus]% \setupbottom[\c!status=\makeupparameter\c!onderstatus]% - \setuptop [\c!status=\makeupparameter\c!bovenstatus]} - + \setuptop [\c!status=\makeupparameter\c!bovenstatus]% + % this is needed, but no \setuplayout here; fails in texexec --fig=c + \recalculatelayout} + %D The standard page template is defined as follows: \definemakeup diff --git a/tex/context/base/page-new.tex b/tex/context/base/page-new.tex index c72c14cfe..b5f9faf43 100644 --- a/tex/context/base/page-new.tex +++ b/tex/context/base/page-new.tex @@ -7,7 +7,7 @@ % although we may assume that they will not cross page % boundaries. -\def\OTRSETcheckcontent% +\def\OTRSETcheckcontent {\bgroup \donefalse \def\OTRSETcheckcontent##1% @@ -33,7 +33,7 @@ \scratchdimen=\ht\scratchbox \advance\scratchdimen \OTRSETgetparameter\c!bovenoffset#1% \advance\scratchdimen \ht\columntopbox#1% -\advance\scratchdimen -\getvalue{\??mc\number\mofcolumns-f}% + \advance\scratchdimen -\getvalue{\??mc\number\mofcolumns-f}% \advance\scratchdimen \ht\columnbotbox#1} % not used \def\OTRSETdobalance% splitten in met en zonder footnotes diff --git a/tex/context/base/page-num.tex b/tex/context/base/page-num.tex index 41ccc8cff..bbb224658 100644 --- a/tex/context/base/page-num.tex +++ b/tex/context/base/page-num.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\writestatus{loading}{Context Core Macros (Numbering)} +\writestatus{loading}{Context Core Macros / Numbering} \unprotect diff --git a/tex/context/base/page-one.tex b/tex/context/base/page-one.tex index aba915b97..02a6e139f 100644 --- a/tex/context/base/page-one.tex +++ b/tex/context/base/page-one.tex @@ -398,10 +398,30 @@ %\egroup \dofloatflushedinfo \fi + % there is a chance that due to rounding errors, the float + % fits on a page where it was first rejected, in which case + % the prevdepth is -maxdimen and we cannot obey the grid \doplacefloatbox \expandafter\OTRONEdodoflushfloats \fi} +% \def\OTRONEdocheckiffloatfits % vervangen ivm downward comp +% {\ifnofloatpermitted +% \global\roomforfloatfalse +% \else +% \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 +% \ifdim\dimen0>\pagegoal +% \global\roomforfloatfalse +% \else +% \global\roomforfloattrue +% \fi +% \fi} + \def\OTRONEdocheckiffloatfits % vervangen ivm downward comp {\ifnofloatpermitted \global\roomforfloatfalse @@ -412,7 +432,19 @@ \advance\dimen0 \floattopskip \advance\dimen0 -\pageshrink % toegevoegd %\message{c:\the\mofcolumns,t:\the\pagetotal,g:\the\pagegoal}%\wait - \ifdim\dimen0>\pagegoal + \dimen2\pagegoal + \relax % needed + \ifcase\textfloatmethod + % method 0 : raw + \or + % method 1 : safe + \dimen2 .99\pagegoal + \or + % method 2 : tight + \advance\dimen0 -\!!onepoint + \fi + \relax % really needed ! ! ! ! + \ifdim\dimen0>\dimen2 \global\roomforfloatfalse \else \global\roomforfloattrue diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex index 4e35eac77..16ca38798 100644 --- a/tex/context/base/page-set.tex +++ b/tex/context/base/page-set.tex @@ -58,12 +58,15 @@ \def\OTRSETsetgridcell#1#2% {\global\setbox\csname\@otr@:\number#1:\number#2\endcsname} +% \def\OTRSETgetgridcell{\box \OTRSETgridcell} +% \def\OTRSETsetgridcell{\global\setbox\OTRSETgridcell} + \long\def\OTRSETdoifcellelse#1#2#3#4% {\relax\ifvoid\csname\@otr@:\number#1:\number#2\endcsname#4\else#3\fi} \beginETEX \ifcsname -\def\columnerasegridboxes +\def\columnerasegridboxes % maybe dedicated loops {\bgroup \increment\columnmaxcells\relax \ifodd\realpageno @@ -491,7 +494,7 @@ \OTRSETsynchronizehsize} % 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 +% 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). diff --git a/tex/context/base/page-sid.tex b/tex/context/base/page-sid.tex index 9a62c7934..286ffacec 100644 --- a/tex/context/base/page-sid.tex +++ b/tex/context/base/page-sid.tex @@ -168,7 +168,7 @@ \!!heighta\sidefloatvsize \advance\!!heighta -\pagetotal \ifdim\!!heighta>\zeropoint - \ifnum\recurselevel>100 + \ifnum\recurselevel>\plushundred \exitloop \fi \else @@ -357,8 +357,7 @@ \fi \previoussidefloat \stallsidefloat -\global - \setbox\floatbox\hbox + \global\setbox\floatbox\hbox {\ifmarginfloat\else\ifrightfloat\else\kern\sidefloatleftshift\fi\fi \ifrightfloat\else\hskip\sidefloatshift\fi \scratchdimen @@ -376,18 +375,10 @@ \or % height \advance\scratchdimen\strutdepth % == \sidefloattopoffset \or % line -% \advance\scratchdimen\lineheight \or % depth \advance\scratchdimen\lineheight \advance\scratchdimen\strutdepth \fi - % equivalent but more compact: -% \advance\scratchdimen\strutdepth\relax -% \ifcase\sidefloatalign -% \or -% \or \advance\scratchdimen\strutheight -% \or \advance\scratchdimen\lineheight -% \fi \vbox{\vskip\scratchdimen\nointerlineskip#1}% \ifrightfloat\kern\sidefloatshift\fi % no \hskip, but \kern here @@ -420,6 +411,45 @@ \newdimen\sidefloatpagetotal +% \def\measuresidefloat +% {\global\floatflagtrue +% \global\sidefloatpagetotal \pagetotal % global +% \ifmarginfloat +% \global \sidefloatwidth \zeropoint +% \else\ifedgefloat +% \global \sidefloatwidth \zeropoint +% \else +% \global \sidefloatwidth \wd\floatbox +% \global\advance\sidefloatwidth \floatsideskip +% \fi\fi +% \ifdim\sidefloatwidth<\zeropoint +% \global\sidefloatwidth\zeropoint +% \fi +% \global \sidefloathsize \hsize +% \global\advance\sidefloathsize -\sidefloatwidth +% \global \sidefloatheight \ht\floatbox +% \global\advance\sidefloatheight \dp\floatbox +% \global\advance\sidefloatheight \sidefloattopskip +% \global \sidefloatvsize \sidefloatheight +% \global\advance\sidefloatvsize \sidefloatpagetotal +% \dimen0=\sidefloatvsize +% \ifdim\dimen0>.99\pagegoal \relax +% \roomforfloatfalse +% \else +% \dimen0=\pagegoal +% \advance\dimen0 -\sidefloatvsize +% \ifdim\dimen0<\sidefloatbottomskip +% \global\advance\sidefloatvsize \dimen0 +% \global\floatshorttrue +% \pushpenalties +% \global\holdinginserts\plusone +% \else +% \global\advance\sidefloatvsize \sidefloatbottomskip +% \global\floatshortfalse +% \fi +% \roomforfloattrue +% \fi} + \def\measuresidefloat {\global\floatflagtrue \global\sidefloatpagetotal \pagetotal % global @@ -431,9 +461,9 @@ \global \sidefloatwidth \wd\floatbox \global\advance\sidefloatwidth \floatsideskip \fi\fi -\ifdim\sidefloatwidth<\zeropoint - \global\sidefloatwidth\zeropoint -\fi + \ifdim\sidefloatwidth<\zeropoint + \global\sidefloatwidth\zeropoint + \fi \global \sidefloathsize \hsize \global\advance\sidefloathsize -\sidefloatwidth \global \sidefloatheight \ht\floatbox @@ -441,8 +471,20 @@ \global\advance\sidefloatheight \sidefloattopskip \global \sidefloatvsize \sidefloatheight \global\advance\sidefloatvsize \sidefloatpagetotal - \dimen0=\sidefloatvsize - \ifdim\dimen0>.99\pagegoal \relax + \dimen0\sidefloatvsize + \dimen2\pagegoal + \relax + \ifcase\sidefloatmethod + % method 0 : raw + \or + % method 1 : safe + \dimen2 .99\pagegoal + \or + % method 2 : tight + \advance\dimen0 -\!!onepoint + \fi + \relax % really needed ! ! ! ! + \ifdim\dimen0>\dimen2 \roomforfloatfalse \else \dimen0=\pagegoal @@ -458,7 +500,7 @@ \fi \roomforfloattrue \fi} - + % \def\setsidefloat% nilling everypar saves time and redudant pos's % {% removed here dec 2001 % %{\everypar\emptytoks\forgetall\vbox{\strut}\vskip-\lineheight}% diff --git a/tex/context/base/page-txt.tex b/tex/context/base/page-txt.tex index b6f095392..4fb80a972 100644 --- a/tex/context/base/page-txt.tex +++ b/tex/context/base/page-txt.tex @@ -455,7 +455,7 @@ {\ifcase\showgridstate\else % 1=bottom 2=top \setgridbox\scratchbox\zetbreedte\teksthoogte \setbox#1\hbox - {\ifcase\showgridstate\or\box#1\hskip-\zetbreedte\fi + {\ifcase\showgridstate\or\or\box#1\hskip-\zetbreedte\fi \bgroup % color \incolortrue \ifcase\layoutcolumns\else @@ -474,7 +474,7 @@ \red \box\scratchbox \egroup - \ifcase\showgridstate\or\or\hskip-\zetbreedte\box#1\fi}% + \ifcase\showgridstate\or\hskip-\zetbreedte\box#1\fi}% \fi} %D The placement of a whole line is handled by the next two diff --git a/tex/context/base/s-pre-08.tex b/tex/context/base/s-pre-08.tex index 2b768beb3..5680e86d2 100644 --- a/tex/context/base/s-pre-08.tex +++ b/tex/context/base/s-pre-08.tex @@ -79,7 +79,6 @@ %D We are going to put all three elements on a layer. \definelayer [main] - \defineoverlay [main] [\composedlayer{main}] %D The page backgrounds are as follows: @@ -120,10 +119,10 @@ %D on the page so that the page is flushed. Here we also take %D care of placing the page number. -\def\StartIdea% +\def\StartIdea {\null \dontcomplain} -\def\StopIdea% +\def\StopIdea {\setlayer [main] [x=\makeupwidth,y=.5cm,hoffset=-.5cm,location=lb] @@ -132,27 +131,31 @@ %D Both texts get their position registered. -\def\StartSample% +\def\StartSample {\setlayer [main] [hoffset=.75cm,voffset=.75cm] \bgroup \hpos {SampText:\realfolio} \bgroup \startSampleText [none]} -\def\StopSample% - {\stopSampleText \egroup \egroup } +\def\StopSample + {\stopSampleText \egroup \egroup} %D Here the position of the sample text and explanationary %D text are passed on to the graphic that concerns the latter. -\def\StartText% +% use setlayertext instead + +\def\StartText {\setMPpositiongraphic {TextText:\realfolio}{text}{other=SampText:\realfolio} \setlayer [main] - [x=\makeupwidth,y=\makeupheight,hoffset=-.75cm,voffset=-.75cm,location=lt] - \bgroup \hpos {TextText:\realfolio} \bgroup \startTextText [none]} + [x=\makeupwidth,y=\makeupheight, + hoffset=-.75cm,voffset=-.75cm, + location=lt] + \bgroup \noindent \hpos {TextText:\realfolio} \bgroup \startTextText [none]} -\def\StopText% +\def\StopText {\stopTextText \egroup \egroup} %D The graphics that encircle the two texts are related to @@ -202,7 +205,7 @@ %D In order to be complete, we also define a title page. %D Here suddenly the text background shows up. -\def\StartTitlePage% +\def\StartTitlePage {\startstandardmakeup \dontcomplain \setupframedtexts[TextText][width=fit] @@ -210,7 +213,7 @@ \bfd\setupinterlinespace \def\\{\blank\bfc\setupinterlinespace\def\\{\blank}}} -\def\StopTitlePage% +\def\StopTitlePage {\StopText \stopstandardmakeup} @@ -237,6 +240,7 @@ draw q withcolor (white-\MPcolor{PageColor}) ; fi ; anchor_box(\MPanchor{\MPvar{self}}) ; +% setbounds currentpicture to boundingbox origin ; \stopMPpositiongraphic \doifnotmode{demo}{\endinput} diff --git a/tex/context/base/s-pre-19.tex b/tex/context/base/s-pre-19.tex index 45ac152cc..204cb41a1 100644 --- a/tex/context/base/s-pre-19.tex +++ b/tex/context/base/s-pre-19.tex @@ -43,7 +43,7 @@ %D developed using an $1400\times1050$ pixel LCD screen, so I %D may be biased. -\startmode[asintended] \setupbodyfont[ppl] \stopmode +%\startmode[asintended] \setupbodyfont[ppl] \stopmode %D The layout specification sets up a text area and a right %D edge area where the menus will go. Watch the rather large diff --git a/tex/context/base/setupb.tex b/tex/context/base/setupb.tex index bb5f2a0d9..3096670a5 100644 --- a/tex/context/base/setupb.tex +++ b/tex/context/base/setupb.tex @@ -2505,6 +2505,10 @@ [\c!springvolgendein] [\v!ja,\v!nee] [\v!ja] + \variable + [\c!inspringen] + [\v!nooit,\v!niet,\v!nee,\v!ja,\v!altijd,\v!eerste,\v!volgende] + [\v!nooit] \stopsetup \startsetup @@ -2575,6 +2579,9 @@ [\c!start] [\c!number!] [0] + \inheritvariables + [\y!steldoornummerenin] + [] \stopsetup \startsetup @@ -3747,6 +3754,10 @@ [\c!identifier!] [] \variable + [\c!tolerantie] + [0,1,2] + [1] + \variable [\c!linkermargeafstand] [\c!dimension!] [\!!zeropoint] @@ -6298,7 +6309,8 @@ \v!linkermarge,\v!rechtermarge,\v!linkerrand,\v!rechterrand, \v!binnenmarge,\v!buitenmarge,\v!binnenrand,\v!buitenrand, \v!binnen,\v!buiten,\c!regel,\v!hoog,\v!laag,\v!passend, - \v!pagina,\v!naast,\v!altijd,\v!forceer,\v!lang] + \v!pagina,\v!naast,\v!altijd,\v!forceer,\v!lang,\v!reset, + \v!regel,\v!hoogte,\v!diepte] [\v!hier] \value [\c!text!] diff --git a/tex/context/base/spec-dvi.tex b/tex/context/base/spec-dvi.tex index 2e08c7a8b..2748fa512 100644 --- a/tex/context/base/spec-dvi.tex +++ b/tex/context/base/spec-dvi.tex @@ -97,9 +97,23 @@ \let\flushDVIpositionpapersize\relax +% \definespecial\dosetpositionpapersize#1#2% +% {\xdef\flushDVIpositionpapersize% +% {\special{pos:papersize #1 #2}% +% \global\noexpand\let\noexpand\flushDVIpositionpapersize\relax}} +% +% \appendtoksonce +% \ifspecialbasedsettings +% \ifpositioning\installprogram{dvipos \jobname}\fi +% \fi +% \to \everystoptext +% +% less tokens: + \definespecial\dosetpositionpapersize#1#2% {\xdef\flushDVIpositionpapersize% {\special{pos:papersize #1 #2}% + \noexpand\installprogram{dvipos \jobname}% \global\noexpand\let\noexpand\flushDVIpositionpapersize\relax}} \prependtoksonce \flushDVIpositionpapersize \to \everyshipout diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex index 2bc130b00..ce63603dd 100644 --- a/tex/context/base/spec-tpd.tex +++ b/tex/context/base/spec-tpd.tex @@ -584,12 +584,12 @@ \definespecial\doflushJSpreamble#1% {\bgroup - \let\compositeJScode=\empty + \let\compositeJScode\empty \def\docommando##1% {\edef\sanitizedJScode{\getJSpreamble{##1}}% \@EA\doPSsanitizeJScode\sanitizedJScode\to\sanitizedJScode \immediate\pdfobj {<< /S /JavaScript /JS (\sanitizedJScode) >>}% - \edef\compositeJScode% + \edef\compositeJScode {\compositeJScode\space (##1) \the\pdflastobj\space 0 R}}% \processcommalist[#1]\docommando \immediate\pdfobj{<< /Names [ \compositeJScode ] >>}% diff --git a/tex/context/base/supp-box.tex b/tex/context/base/supp-box.tex index 2a96bcef6..243add4bd 100644 --- a/tex/context/base/supp-box.tex +++ b/tex/context/base/supp-box.tex @@ -133,15 +133,15 @@ % % Better, but a waste of tokens: % -% \def\hsmash {\bgroup\dowithnextbox{\hsmashbox\nextbox\box\nextbox\egroup}\normalhbox} -% \def\vsmash {\bgroup\dowithnextbox{\vsmashbox\nextbox\box\nextbox\egroup}\normalvbox} -% \def\hsmashed{\bgroup\dowithnextbox{\smashbox \nextbox\box\nextbox\egroup}\normalhbox} -% \def\vsmashed{\bgroup\dowithnextbox{\smashbox \nextbox\box\nextbox\egroup}\normalvbox} +% \def\hsmash {\bgroup\dowithnextbox{\hsmashbox\nextbox\flushnextbox\egroup}\normalhbox} +% \def\vsmash {\bgroup\dowithnextbox{\vsmashbox\nextbox\flushnextbox\nextbox\egroup}\normalvbox} +% \def\hsmashed{\bgroup\dowithnextbox{\smashbox \nextbox\flushnextbox\nextbox\egroup}\normalhbox} +% \def\vsmashed{\bgroup\dowithnextbox{\smashbox \nextbox\flushnextbox\nextbox\egroup}\normalvbox} % % The best: \def\dosomesmash#1% (begin|end)group ipv (b|e)group ? - {\bgroup\dowithnextbox{#1\nextbox\box\nextbox\egroup}} + {\bgroup\dowithnextbox{#1\nextbox\flushnextbox\egroup}} \def\hsmash {\dosomesmash\hsmashbox\normalhbox} \def\vsmash {\dosomesmash\vsmashbox\normalvbox} @@ -159,7 +159,7 @@ %D \stoptypen \def\dosmashedbox#1% - %{#1\bgroup\dowithnextbox{\smashbox\nextbox\box\nextbox\egroup}#1} + %{#1\bgroup\dowithnextbox{\smashbox\nextbox\flushnextbox\egroup}#1} {#1\bgroup\dowithnextbox{\smashedbox\nextbox\egroup}#1} \def\smashedhbox{\dosmashedbox\hbox} @@ -207,7 +207,7 @@ \def\finsm@sh % redefined plain macro {\dowithnextbox - {\@EA\handletokens\@@smash\with\makesm@sh\box\nextbox}\normalhbox} + {\@EA\handletokens\@@smash\with\makesm@sh\flushnextbox}\normalhbox} %D \starttabulatie[|l|l|] %D \NC w \NC \ruledhbox{\smash [w]{This is some great smashing, isn't it?}} \NC \NR @@ -332,7 +332,7 @@ \divide\noflinesheight \openlineheight \noflines\noflinesheight #1\ifdim\noflines\openlineheight=#2\relax \else - \advance\noflines \plusone + \advance\noflines\ifdim#2>\zeropoint\plusone\else\minusone\fi \fi\fi \fi} @@ -422,7 +422,7 @@ %D %D \starttypen %D \def\getfloat% -%D {\def\handlefloat{...\box\nextbox...} +%D {\def\handlefloat{...\flushnextbox...} %D \dowithnextbox\handlefloat\normalvbox} %D \stoptypen %D @@ -524,19 +524,19 @@ %D way. \def\rlap{\begingroup\dowithnextbox{\normalhbox to \zeropoint - {\box\nextbox\normalhss}\endgroup}\normalhbox} + {\flushnextbox\normalhss}\endgroup}\normalhbox} \def\llap{\begingroup\dowithnextbox{\normalhbox to \zeropoint - {\normalhss\box\nextbox}\endgroup}\normalhbox} + {\normalhss\flushnextbox}\endgroup}\normalhbox} \def\clap{\begingroup\dowithnextbox{\normalhbox to \zeropoint - {\normalhss\box\nextbox\normalhss}\endgroup}\normalhbox} + {\normalhss\flushnextbox\normalhss}\endgroup}\normalhbox} \def\tlap{\begingroup\dowithnextbox{\normalvbox to \zeropoint - {\normalvss\box\nextbox}\endgroup}\normalvbox} + {\normalvss\flushnextbox}\endgroup}\normalvbox} \def\blap{\begingroup\dowithnextbox{\normalvbox to \zeropoint - {\box\nextbox\normalvss}\endgroup}\normalvbox} + {\flushnextbox\normalvss}\endgroup}\normalvbox} %D \macros %D {beginofshapebox, @@ -830,7 +830,7 @@ {\dowithnextbox {\nextboxht\zeropoint \nextboxdp\zeropoint - \box\nextbox} + \flushnextbox} \normalhbox} %D \macros @@ -1053,7 +1053,7 @@ \ifdim\nextboxwd>\scratchdimen \setbox\scratchbox\normalhbox{\ifdone\space#2\else#2\space\fi}% \advance\scratchdimen -\wd\scratchbox - \setbox0\box\nextbox + \setbox0\flushnextbox \setbox\nextbox\normalvbox {\hsize\scratchdimen \hfuzz\maxdimen @@ -1325,7 +1325,7 @@ {\setbox\scratchbox\normalhbox {\strut \nextboxdp\zeropoint - \lower\strutdepth\box\nextbox}% + \lower\strutdepth\flushnextbox}% \dp\scratchbox\strutdepth \ht\scratchbox\strutheight \box\scratchbox @@ -1337,7 +1337,7 @@ \dowithnextbox {\nextboxdp\strutdepth \nextboxht\strutheight - \box\nextbox + \flushnextbox \egroup}% \normalhbox} @@ -1406,7 +1406,7 @@ \dowithnextbox {\hskip-\wd0 \hss - \box\nextbox + \flushnextbox \hss \egroup \vss @@ -1433,7 +1433,7 @@ \dowithnextbox {\hsize\nextboxwd \vsize\nextboxht - \centeredbox#1{\box\nextbox}% + \centeredbox#1{\flushnextbox}% \egroup} \normalhbox} @@ -1457,7 +1457,7 @@ \setbox2\normalvbox{\hrule\!!height\zeropoint#1}% \hsize\ifdim\wd0=\zeropoint\hsize\else\wd0\fi \vsize\ifdim\ht2=\zeropoint\vsize\else\ht2\fi - \normalvbox to \vsize{\vss\normalhbox to \hsize{\hss\box\nextbox\hss}\vss}% + \normalvbox to \vsize{\vss\normalhbox to \hsize{\hss\flushnextbox\hss}\vss}% \egroup}% \normalhbox} @@ -1806,11 +1806,11 @@ % \def\dooverlaybox% % {\ifhmode\unskip\fi % \ifdim\nextboxht>\ht\processbox -% \setbox\processbox=\normalvbox to \nextboxht +% \setbox\processbox\normalvbox to \nextboxht % {\vss\box\processbox\vss}% % \else -% \setbox\nextbox=\normalvbox to \ht\processbox -% {\vss\box\nextbox\vss}% +% \setbox\nextbox\normalvbox to \ht\processbox +% {\vss\flushnextbox\vss}% % \fi % \scratchdimen=\wd % \ifdim\nextboxwd>\wd\processbox @@ -1821,7 +1821,7 @@ % \setbox\processbox=\normalhbox to \scratchdimen % {\normalhbox to \scratchdimen{\hss\box\processbox\hss}% % \hskip-\scratchdimen -% \normalhbox to \scratchdimen{\hss\box\nextbox\hss}}} +% \normalhbox to \scratchdimen{\hss\flushnextbox\hss}}} % % \def\startoverlay% % {\bgroup @@ -1841,7 +1841,7 @@ {\dp\processbox\zeropoint\vss\box\processbox\vss}% \else \setbox\nextbox\normalvbox to \ht\processbox - {\nextboxdp\zeropoint\vss\box\nextbox\vss}% + {\nextboxdp\zeropoint\vss\flushnextbox\vss}% \fi \nextboxdp\scratchdimen \dp\processbox\scratchdimen @@ -1854,7 +1854,7 @@ \setbox\processbox\normalhbox to \scratchdimen {\normalhbox to \scratchdimen{\hss\box\processbox\hss}% \hskip-\scratchdimen - \normalhbox to \scratchdimen{\hss\box\nextbox\hss}}} + \normalhbox to \scratchdimen{\hss\flushnextbox\hss}}} \def\startoverlay {\bgroup @@ -1883,8 +1883,8 @@ % %D \leavevmode\haalbuffer % % \def\dohspread% -% {\box\nextbox -% \def\dohspread{\hfil\box\nextbox}} +% {\flushnextbox +% \def\dohspread{\hfil\flushnextbox}} % % \def\starthspread% % {\normalhbox to \hsize \bgroup @@ -1971,10 +1971,10 @@ #1\nextbox#1\strutbox #2\nextbox\scratchdimen \setbox\nextbox\normalhbox - {\lower\nextboxdp\box\nextbox}% + {\lower\nextboxdp\flushnextbox}% #1\nextbox#1\strutbox #2\nextbox\scratchdimen - \box\nextbox + \flushnextbox \egroup} \normalhbox} @@ -1983,9 +1983,9 @@ %D %D A few more boxes. -\def\lhbox{\dowithnextbox{\normalhbox to \hsize{\box\nextbox\hss }}\normalhbox} -\def\mhbox{\dowithnextbox{\normalhbox to \hsize{\hss\box\nextbox\hss}}\normalhbox} -\def\rhbox{\dowithnextbox{\normalhbox to \hsize{\hss\box\nextbox }}\normalhbox} +\def\lhbox{\dowithnextbox{\normalhbox to \hsize{\flushnextbox\hss }}\normalhbox} +\def\mhbox{\dowithnextbox{\normalhbox to \hsize{\hss\flushnextbox\hss}}\normalhbox} +\def\rhbox{\dowithnextbox{\normalhbox to \hsize{\hss\flushnextbox }}\normalhbox} \let\lefthbox =\lhbox \let\midhbox =\mhbox @@ -2047,7 +2047,7 @@ \dimen0\nextboxht \nextboxht\ht\strutbox \nextboxdp\dp\strutbox - \normalhbox{\box\nextbox} + \normalhbox{\flushnextbox} \prevdepth\dp\strutbox \doloop {\advance\dimen0 -\lineheight @@ -2260,7 +2260,7 @@ % \setxvalue{\@@stacktag#2}{\csname\@@stackmax#1\endcsname}% % \global\setbox\csname\@@stackbox#1\endcsname=\normalvbox % {\forgetall -% \setbox\scratchbox=\normalvbox{\box\nextbox} +% \setbox\scratchbox=\normalvbox{\flushnextbox} % \ht\scratchbox=\!!onepoint % \dp\scratchbox=\zeropoint % \unvbox\csname\@@stackbox#1\endcsname @@ -2311,7 +2311,7 @@ \setxvalue{\@@stacklst#1}{\getvalue{\@@stacklst#1},#2}% \global\setbox\csname\@@stackbox#1\endcsname\normalvbox {\forgetall - \setbox\scratchbox\normalvbox{\box\nextbox} + \setbox\scratchbox\normalvbox{\flushnextbox} \ht\scratchbox\!!onepoint \dp\scratchbox\zeropoint \unvbox\csname\@@stackbox#1\endcsname @@ -2432,10 +2432,10 @@ \def\doraiselowerbox#1#2% a nice trick us used to accept {\def\next % both direct and {} dimensions {\dowithnextbox - {\setbox\nextbox\normalhbox{#1\scratchdimen\box\nextbox}% + {\setbox\nextbox\normalhbox{#1\scratchdimen\flushnextbox}% \nextboxht\ht\strutbox \nextboxdp\dp\strutbox - \box\nextbox}}% + \flushnextbox}}% \afterassignment\next\scratchdimen=#2} \def\raisebox{\doraiselowerbox\raise} @@ -2511,8 +2511,8 @@ \def\halfwaybox {\dowithnextbox {\nextboxdp\zeropoint - \setbox\nextbox\normalhbox{\lower.5\nextboxht\box\nextbox}% - \box\nextbox} + \setbox\nextbox\normalhbox{\lower.5\nextboxht\flushnextbox}% + \flushnextbox} \normalhbox} %D New: @@ -2550,7 +2550,7 @@ \def\vcenter {\normalvbox\bgroup - \dowithnextbox{\normalhbox{$\verynormalvcenter{\box\nextbox}$}\egroup} + \dowithnextbox{\normalhbox{$\verynormalvcenter{\flushnextbox}$}\egroup} \normalvbox} \prependtoks \let\vcenter\normalvcenter \to \everymath @@ -2561,6 +2561,6 @@ %D A not so well unhboxable bxo can be made with: \def\frozenhbox - {\hbox\bgroup\dowithnextbox{\hbox{\hbox{\box\nextbox}}\egroup}\hbox} + {\hbox\bgroup\dowithnextbox{\hbox{\hbox{\flushnextbox}}\egroup}\hbox} \protect \endinput diff --git a/tex/context/base/supp-fun.tex b/tex/context/base/supp-fun.tex index 71c0405db..352cb7e98 100644 --- a/tex/context/base/supp-fun.tex +++ b/tex/context/base/supp-fun.tex @@ -605,16 +605,38 @@ \def\NormalizeFontHeight{\NormalizeFontSize\ht} \def\NormalizeFontWidth {\NormalizeFontSize\wd} -\def\NormalizeFontSize#1#2#3#4#5% +% \def\NormalizeFontSize#1#2#3#4#5% +% {\bgroup +% \dimen0=#4% #4 can be \ht0 or so +% \setbox0\hbox{\definedfont[#5 at 10pt]#3}% +% \ifdim\wd0>\zeropoint +% \dimen2=#10 % #1 is \wd or \ht +% \dimen4=10000pt +% \divide\dimen4 \dimen2 +% \divide\dimen0 \plusthousand +% \dimen0=\number\dimen4\dimen0 +% \xdef\TheNormalizedFontSize{\the\dimen0}% +% \else +% \dimen0\bodyfontsize +% \fi +% \definedfont[#5 at \the\dimen0]% +% \expandafter +% \egroup +% \expandafter\font\expandafter#2\fontname\font\relax} +% +% the familiar struggle with accuracy forces us to use: + +\def\NormalizeFontSize#1#2#3#4#5% {\bgroup \dimen0=#4% #4 can be \ht0 or so - \setbox0\hbox{\definedfont[#5 at 10pt]#3}% + \setbox0\hbox{\definedfont[#5 at 5pt]#3}% 10pt \ifdim\wd0>\zeropoint \dimen2=#10 % #1 is \wd or \ht - \dimen4=10000pt + \dimen4=\maxdimen % 10000pt \divide\dimen4 \dimen2 - \divide\dimen0 1000 + \divide\dimen0 1638 % 1000 \dimen0=\number\dimen4\dimen0 + \divide \dimen0 \plustwo % ... \xdef\TheNormalizedFontSize{\the\dimen0}% \else \dimen0\bodyfontsize @@ -624,6 +646,8 @@ \egroup \expandafter\font\expandafter#2\fontname\font\relax} + + %D Afterwards, we have access to the calculated size by: \let\TheNormalizedFontSize\!!zeropoint diff --git a/tex/context/base/supp-mps.tex b/tex/context/base/supp-mps.tex index 05442dc25..483084c3c 100644 --- a/tex/context/base/supp-mps.tex +++ b/tex/context/base/supp-mps.tex @@ -230,7 +230,7 @@ \ifx \overlayheight \undefined \def \overlayheight {3cm} \fi \ifx \overlaylinewidth \undefined \def \overlaylinewidth {0pt} \fi -\def\presetMPdefinitions% +\def\presetMPdefinitions {\edef\overlaywidth {\overlaywidth \space}% \edef\overlayheight {\overlayheight \space}% \edef\overlaylinewidth {\overlaylinewidth\space}% @@ -470,11 +470,11 @@ \xdef\MPgraphic{\the\currentMPgraphic}% \the\everyMPgraphic \ifrunMPgraphics - \openMPgraphicfile{1}{runtime}% + \openMPgraphicfile1{runtime}% % no reset here ! \theMPinclusions \else - \openMPgraphicfile{0}{collected}% + \openMPgraphicfile0{collected}% % reset here ! global added (due to adding \blabelgroup) \theMPinclusions \global\let\theMPinclusions\relax @@ -595,7 +595,7 @@ \newif\ifsetMPrandomseed \setMPrandomseedtrue % false by default -\def\setMPrandomseed% +\def\setMPrandomseed {\ifsetMPrandomseed \ifx\getrandomnumber\undefined \else \getrandomnumber\localMPseed{0}{4095}% \writeMPgraphic{randomseed := \localMPseed ;}% diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex index a170ca08f..c8eb03955 100644 --- a/tex/context/base/syst-ext.tex +++ b/tex/context/base/syst-ext.tex @@ -69,17 +69,20 @@ \def\@@dodoglobal {\resetglobal\global} -\def\saveglobal - {\let\@@dodoglobal\dodoglobal - \let\@@redoglobal\redoglobal} +% for the moment only one level: -\def\restoreglobal - {\let\dodoglobal\@@dodoglobal - \let\redoglobal\@@redoglobal} +\def\saveglobal % slower but safer + {\let\@@dodoglobal\dodoglobal % \pushmacro\dodoglobal + \let\@@redoglobal\redoglobal % \pushmacro\redoglobal + \resetglobal} -%D A very useful application of this macro is \type{\newif}, +\def\restoreglobal % slower but safer + {\let\redoglobal\@@redoglobal % \popmacro\redoglobal + \let\dodoglobal\@@dodoglobal} % \popmacro\dodoglobal + +%D A very useful application of this macro is \type {\newif}, %D \TEX's fake boolean type. Not being a primitive, -%D \type{\global} hopelessly fails here. But a slight +%D \type {\global} hopelessly fails here. But a slight %D adaption of Knuth's original macro permits: %D %D \starttypen @@ -701,7 +704,7 @@ \long\def\ydorecurse#1#2% {\global\advance\outerrecurse \plusone \global\@EA\let\csname\@@irecurse\recursedepth\endcsname\recurselevel - \def\recurselevel{1}% + \let\recurselevel\!!plusone #2% \@EA\let\@EA\recurselevel\csname\@@irecurse\recursedepth\endcsname \global\advance\outerrecurse \minusone} @@ -1739,49 +1742,57 @@ \let\endoflinetoken=^^M -\def\doGotoPar - {\ifx\nextchar\blankspace - \@EA\GotoPar - \else\ifx\nextchar\endoflinetoken - \@EAEAEA\GotoPar - \else - \@EAEAEA\dodoGotoPar - \fi\fi} - -\def\dodoGotoPar - {\the\BeforePar - \BeforePar\emptytoks - \nextchar} - -\def\GotoPar - {\afterassignment\doGotoPar\let\nextchar=} +%D The original definition was: +%D +%D \starttypen +%D \def\doGotoPar +%D {\ifx\nextchar\blankspace +%D \@EA\GotoPar +%D \else\ifx\nextchar\endoflinetoken +%D \@EAEAEA\GotoPar +%D \else +%D \@EAEAEA\dodoGotoPar +%D \fi\fi} +%D +%D \def\dodoGotoPar +%D {\the\BeforePar +%D \BeforePar\emptytoks +%D \nextchar} +%D +%D \def\GotoPar +%D {\afterassignment\doGotoPar\let\nextchar=} +%D \stoptypen %D Its big brother \type{\GetPar} redefines the \type{\par} %D primitive, which can lead to unexpected results, depending %D in the context. +%D +%D \starttypen +%D \def\GetPar +%D {\expanded +%D {\BeforePar +%D {\the\BeforePar +%D \BeforePar\emptytoks +%D \bgroup +%D \def\par +%D {\egroup +%D \par +%D \the\AfterPar +%D \BeforePar\emptytoks +%D \AfterPar\emptytoks}}}% +%D \GotoPar} +%D \stoptypen -\def\GetPar - {\expanded - {\BeforePar - {\the\BeforePar - \BeforePar\emptytoks - \bgroup - \def\par - {\egroup - \par - \the\AfterPar - \BeforePar\emptytoks - \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 +%D However, we can implement a better alternative by using: +%D +%D \starttypen +%D \def\dowithpar#1#2% +%D {\def\handlepar##1\par{#1##1#2}% +%D \def\gobblepar\par{\dowithpar{#1}{#2}}% +%D \doifnextcharelse\par\gobblepar\handlepar} +%D \stoptypen +%D +%D Or, nicer \def\redowithpar\par {\doifnextcharelse\par\redowithpar\dodowithpar}% @@ -1797,6 +1808,23 @@ {\def\dodogotopar{#1}% \redogotopar\par} +%D The previosuly defined macros now become: + +\def\GetPar + {\expanded + {\dowithpar + {\the\BeforePar + \BeforePar\emptytoks} + {\the\AfterPar + \BeforePar\emptytoks + \AfterPar\emptytoks}}} + +\def\GotoPar + {\expanded + {\dogotopar + {\the\BeforePar + \BeforePar\emptytoks}}} + %D \macros %D {dowithpargument,dowithwargument} %D @@ -1972,12 +2000,32 @@ \def\dorepeatwithcommand[#1]% {\dodorepeatwithcommand#1*\empty*\relax} +% \long\def\dodorepeatwithcommand#1*#2#3*#4\relax#5% +% {\ifx#2\empty +% #5{#1}% +% \else +% \dorecurse{#1}{#5{#2#3}}% +% \fi} +% +% more complex but better: + \long\def\dodorepeatwithcommand#1*#2#3*#4\relax#5% {\ifx#2\empty #5{#1}% + \else\ifnum#1<\zerocount + % a la etex + % \dorecurse{-\numexpr(#1)}{#5{-#2#3}}% + % indirect + %\innerrecurse#1% + %\expanded{\dorecurse{\number-\innerrecurse}}{#5{-#2#3}}% + % safer: + \bgroup\scratchcounter#1% + \expanded{\egroup\noexpand\dorecurse{\number-\scratchcounter}}{#5{-#2#3}}% + \else\ifx#2+% + \dorecurse{#1}{#5{#3}}% \else \dorecurse{#1}{#5{#2#3}}% - \fi} + \fi\fi\fi} %D \macros %D {normalbgroup,normalgroup} @@ -2118,24 +2166,39 @@ \doifintokselse\@@scratchtoks\@@toks\donothing\dodoprependtoks} %D The test macro: - -\def\doifintokselse#1#2% #1 en #2 zijn toks - {\edef\!!stringa{\the#1}\convertcommand\!!stringa\to\asciiA - \edef\!!stringb{\the#2}\convertcommand\!!stringb\to\asciiB - \doifinstringelse\asciiA\asciiB} - +%D +%D \starttypen +%D \def\doifintokselse#1#2% #1 en #2 zijn toks +%D {\edef\!!stringa{\the#1}\convertcommand\!!stringa\to\asciiA +%D \edef\!!stringb{\the#2}\convertcommand\!!stringb\to\asciiB +%D \doifinstringelse\asciiA\asciiB} +%D \stoptypen +%D %D Better: - -\def\doifintokselse#1#2% #1 en #2 zijn toks - {\edef\!!stringa{\the#1}\convertcommand\!!stringa\to\asciiA - \edef\!!stringb{\the#2}\convertcommand\!!stringb\to\asciiB - \doifstringinstringelse\asciiA\asciiB} - +%D +%D \starttypen +%D \def\doifintokselse#1#2% #1 en #2 zijn toks +%D {\edef\!!stringa{\the#1}\convertcommand\!!stringa\to\asciiA +%D \edef\!!stringb{\the#2}\convertcommand\!!stringb\to\asciiB +%D \doifstringinstringelse\asciiA\asciiB} +%D \stoptypen +%D %D Even better: +%D +%D \starttypen +%D \def\doifintokselse#1#2% #1 en #2 zijn toks +%D {\@EA\convertargument\the#1\to\asciiA +%D \@EA\convertargument\the#2\to\asciiB +%D \doifstringinstringelse\asciiA\asciiB} +%D \stoptypen +%D +%D The correct one (with regards to global): -\def\doifintokselse#1#2% #1 en #2 zijn toks - {\@EA\convertargument\the#1\to\asciiA +\def\doifintokselse#1#2% #1 en #2 zijn toks + {\saveglobal + \@EA\convertargument\the#1\to\asciiA \@EA\convertargument\the#2\to\asciiB + \restoreglobal \doifstringinstringelse\asciiA\asciiB} %D Also: diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex index 4e8e95275..895a191e1 100644 --- a/tex/context/base/syst-gen.tex +++ b/tex/context/base/syst-gen.tex @@ -359,6 +359,14 @@ \ifx\plusthree\undefined \chardef\plusthree=3 \fi \ifx\minusone \undefined \count\minusone \minusone=-1 \fi +\ifx\@m\undefined \else \let\plusthousand \@m \fi +\ifx\@M\undefined \else \let\plusttenhousand\@M \fi + +\ifx\plusten \undefined \mathchardef\plusten = 10 \fi +\ifx\plushundred \undefined \mathchardef\plushundred = 100 \fi +\ifx\plusthousand \undefined \mathchardef\plusthousand = 1000 \fi +\ifx\plustenthousand\undefined \mathchardef\plustenthousand=10000 \fi + \newcount\zerocount %D \macros @@ -1570,7 +1578,7 @@ \newcount\commalevel -\def\dododoprocesscommaitem% +\def\dododoprocesscommaitem {\csname\s!next\the\commalevel\endcsname} %\def\dodoprocesscommaitem% @@ -1594,7 +1602,7 @@ \@EAEAEA\dododoprocesscommaitem \fi\fi} -\def\doprocesscommaitem% +\def\doprocesscommaitem {\futurelet\nexttoken\dodoprocesscommaitem} %D Empty arguments are not processed. Empty items (\type{,,}) @@ -1639,7 +1647,7 @@ \def\processcommalist[% {\futurelet\nexttoken\docheckcommaitem} -\def\docheckcommaitem% +\def\docheckcommaitem {\ifx\nexttoken]% \expandafter\gobblethreearguments \else @@ -1656,13 +1664,13 @@ %D One way of quitting a commalist halfway is: -\def\quitcommalist% +\def\quitcommalist {\begingroup\let\doprocesscommaitem\doquitcommalist} \def\doquitcommalist#1]% {\endgroup} -\def\quitprevcommalist% +\def\quitprevcommalist {\begingroup\let\doprocesscommaitem\doquitprevcommalist} \def\doquitprevcommalist#1]% @@ -3288,13 +3296,13 @@ % % less to pass -\def\doshowargumenterror% +\def\doshowargumenterror {\ifnum\expectedarguments>\noexpectedarguments \showargumenterror{\number\expectedarguments}{\number\inputlineno}% \fi \noshowargumenterror} -\def\noshowargumenterror% +\def\noshowargumenterror {\let\expectedarguments\noexpectedarguments} % \long\def\dogetargument#1#2#3#4% @@ -4115,7 +4123,7 @@ %D nesting is to be expected, we can reuse \type{\wait} within %D \type{\wait} itself. -\def\wait% +\def\wait {\begingroup \read16 to \wait \endgroup} @@ -4174,10 +4182,10 @@ \chardef\statuswidth=15 \chardef\statuswrite=16 -\def\writestring% +\def\writestring {\immediate\write\statuswrite} -\def\writeline% +\def\writeline {\writestring{}} \newcount\statuscounter @@ -4191,7 +4199,7 @@ \expandafter\dosplitstatus \fi} -\def\nosplitstatus#1\end% +\def\nosplitstatus#1\end {} \def\writestatus#1#2% @@ -4206,6 +4214,12 @@ \@EA\writestring\@EA{\the\scratchtoks\space:\space#2}% \endgroup} +%D Because we're grouped, we could have initialized at forehand: +%D +%D \starttypen +%D \statuscounter\statuswidth +%D \stoptypen + %D The next implementation saves only some 10 words of format %D memory, but we hardly gain any speed. %D @@ -4213,7 +4227,7 @@ %D \def\dosplitstatus#1#2#3#4#5#6#7#8#9% %D {#1#2#3#4#5#6#7#8#9\dodosplitstatus} %D -%D \def\dodosplitstatus#1#2#3#4#5#6\end% +%D \def\dodosplitstatus#1#2#3#4#5#6\end %D {#1#2#3#4#5} %D %D \def\writestatus#1#2% @@ -4225,6 +4239,18 @@ %D \space:\space#2}} %D \stoptypen +%D Okay then. More obscure but slightly faster: no split grabs +%D the do split part and skipping the else branch has to happen +%D anyway, so: + +\def\dosplitstatus#1% + {\advance\statuscounter \minusone + \ifcase\statuscounter + \expandafter\nosplitstatus + \fi + \scratchtoks\@EA{\the\scratchtoks#1}% + \dosplitstatus} + %D \macros %D {emptytoks} %D diff --git a/tex/context/base/verb-ini.tex b/tex/context/base/verb-ini.tex index 254667cc6..9934938ab 100644 --- a/tex/context/base/verb-ini.tex +++ b/tex/context/base/verb-ini.tex @@ -1156,8 +1156,8 @@ \global\chardef\prettychar#2\relax} \def\getprettydata#1% - {\global\chardef\prettytype0 - \global\chardef\prettychar0 + {\global\chardef\prettytype\zerocount + \global\chardef\prettychar\zerocount \bgroup \let\handleprettytoken\setprettydata \setbox0\hbox{#1}% expands #1 and ignores space @@ -1166,7 +1166,7 @@ %D If needed the current and next token can be handled alongside: \def\getpretties#1#2% - {\char#1\bgroup\let\handleprettytoken=\getsecondpretty#2\egroup} + {\char#1\bgroup\let\handleprettytoken\getsecondpretty#2\egroup} \def\getsecondpretty#1#2% {\char#2} @@ -1532,7 +1532,7 @@ %D possible but leads to fuzzy situations. %D \macros -%D {ifdisablepretty,disablepretynow,disableprettyafterwards} +%D {ifdisablepretty,disableprettynow,disableprettyafterwards} %D %D Although for pretty printing \PERL\ and \JAVASCRIPT\ code %D one has to implement a bit more clever mechanism, the next diff --git a/tex/context/base/x-xml-01.tex b/tex/context/base/x-xml-01.tex index 6a1601f27..b53101b78 100644 --- a/tex/context/base/x-xml-01.tex +++ b/tex/context/base/x-xml-01.tex @@ -20,7 +20,7 @@ \doifnothing {\inputfilename} {\end} \doiffileelse {\inputfilename} {} {\end} -% makes pdftotext to too slow +% makes pdftotext too slow % % \definepapersize % [mine] diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex index 88fd1a2b6..2e258de99 100644 --- a/tex/context/base/xtag-ini.tex +++ b/tex/context/base/xtag-ini.tex @@ -1585,10 +1585,15 @@ {#2\long\@EA\gdef\csname\@@XMLdata:#1\endcsname{##1}#3}% \next} +% \long\gdef\dododefineXMLprocess#1% +% {\long\setvalue{\@@XMLelement:#1/}{}% +% \long\setvalue{\@@XMLelement:#1}{}% +% \long\setvalue{\@@XMLelement:/#1}{}} + \long\gdef\dododefineXMLprocess#1% - {\long\setvalue{\@@XMLelement:#1/}{}% - \long\setvalue{\@@XMLelement:#1}{}% - \long\setvalue{\@@XMLelement:/#1}{}} + {\letvalue{\@@XMLelement:#1/}\donothing + \letvalue{\@@XMLelement:#1}\donothing + \letvalue{\@@XMLelement:/#1}\donothing} \long\gdef\dododefineXMLnestedenvironment#1#2#3% {\long\setvalue{\@@XMLelement:#1}{\getXMLgroupedenvironment{#1}{#2}{#3}}} diff --git a/tex/context/base/xtag-pre.tex b/tex/context/base/xtag-pre.tex index f17928e9c..efe505656 100644 --- a/tex/context/base/xtag-pre.tex +++ b/tex/context/base/xtag-pre.tex @@ -91,6 +91,7 @@ \fetchruntimecommand\showXMLfile {\f!xtagprefix\s!run} \fetchruntimecommand\showXMLbuffer{\f!xtagprefix\s!run} +\fetchruntimecommand\showXMLtext {\f!xtagprefix\s!run} \fetchruntimecommand\showXMLign {\f!xtagprefix\s!run} \fetchruntimecommand\showXMLnop {\f!xtagprefix\s!run} diff --git a/tex/context/base/xtag-run.tex b/tex/context/base/xtag-run.tex index 759513890..b8ba2b36e 100644 --- a/tex/context/base/xtag-run.tex +++ b/tex/context/base/xtag-run.tex @@ -228,6 +228,20 @@ \processcommalist[#1]\dodoprocessXMLbuffer \egroup}} +\gdef\showXMLtext#1% + {\bgroup + \dontcomplain + \XMLlevel\maxcard + \increment\@@xfniveau % hack + \tttf + \ifautoXMLshow \let\executeXMLelement\autoshowXMLelement \fi + \let\executeXMLentity\@XMLentity + \let\par\allowbreak\let\endgraf\par + \setbox\scratchbox\hbox + {\enableXML\verbatimXML\scantokens{#1}\removelastskip}% + \unhbox\scratchbox + \egroup} + %D \gdef\showXSDcomponent |