summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context/config/texexec.rme2
-rw-r--r--context/data/cont-cz.tws4
-rw-r--r--context/data/cont-de.tws4
-rw-r--r--context/data/cont-en.tws4
-rw-r--r--context/data/cont-it.tws4
-rw-r--r--context/data/cont-nl.tws4
-rw-r--r--context/data/cont-ro.tws4
-rw-r--r--context/data/context.properties2
-rw-r--r--metapost/context/base/mp-core.mp11
-rw-r--r--metapost/context/base/mp-spec.mp153
-rw-r--r--metapost/context/base/mp-text.mp321
-rw-r--r--metapost/context/base/mp-tool.mp22
-rw-r--r--scripts/context/perl/texexec.pl124
-rw-r--r--scripts/context/perl/texexec.rme2
-rw-r--r--scripts/context/perl/texfont.pl13
-rw-r--r--scripts/context/ruby/xmltools.rb11
-rw-r--r--tex/context/base/colo-ini.tex324
-rw-r--r--tex/context/base/cont-fil.tex2
-rw-r--r--tex/context/base/cont-new.tex393
-rw-r--r--tex/context/base/cont-usr.ori20
-rw-r--r--tex/context/base/context.tex3
-rw-r--r--tex/context/base/core-box.tex15
-rw-r--r--tex/context/base/core-fig.tex8
-rw-r--r--tex/context/base/core-int.tex68
-rw-r--r--tex/context/base/core-itm.tex21
-rw-r--r--tex/context/base/core-mar.tex17
-rw-r--r--tex/context/base/core-obj.tex40
-rw-r--r--tex/context/base/core-pos.tex23
-rw-r--r--tex/context/base/core-ref.tex5
-rw-r--r--tex/context/base/core-reg.tex25
-rw-r--r--tex/context/base/core-rul.tex56
-rw-r--r--tex/context/base/core-sec.tex111
-rw-r--r--tex/context/base/core-spa.tex33
-rw-r--r--tex/context/base/core-tab.tex66
-rw-r--r--tex/context/base/core-tbl.tex2
-rw-r--r--tex/context/base/core-vis.tex43
-rw-r--r--tex/context/base/filt-ini.tex87
-rw-r--r--tex/context/base/font-arb.tex148
-rw-r--r--tex/context/base/font-chi.tex12
-rw-r--r--tex/context/base/font-ini.tex71
-rw-r--r--tex/context/base/hand-def.tex2
-rw-r--r--tex/context/base/hand-ini.tex72
-rw-r--r--tex/context/base/m-cweb.tex4
-rw-r--r--tex/context/base/m-newmat.tex138
-rw-r--r--tex/context/base/m-visual.tex287
-rw-r--r--tex/context/base/meta-ini.tex13
-rw-r--r--tex/context/base/mult-com.tex6
-rw-r--r--tex/context/base/mult-con.tex9
-rw-r--r--tex/context/base/page-app.tex18
-rw-r--r--tex/context/base/page-imp.tex26
-rw-r--r--tex/context/base/page-ini.tex37
-rw-r--r--tex/context/base/page-lay.tex261
-rw-r--r--tex/context/base/page-mul.tex95
-rw-r--r--tex/context/base/page-one.tex38
-rw-r--r--tex/context/base/page-set.tex4
-rw-r--r--tex/context/base/page-sid.tex3
-rw-r--r--tex/context/base/s-abr-01.tex3
-rw-r--r--tex/context/base/s-map-01.tex6
-rw-r--r--tex/context/base/s-pre-19.tex238
-rw-r--r--tex/context/base/s-pre-60.tex33
-rw-r--r--tex/context/base/s-pre-61.tex27
-rw-r--r--tex/context/base/setupb.tex22
-rw-r--r--tex/context/base/spec-def.tex15
-rw-r--r--tex/context/base/spec-dpm.tex52
-rw-r--r--tex/context/base/spec-dpx.tex212
-rw-r--r--tex/context/base/spec-dvi.tex1
-rw-r--r--tex/context/base/spec-fdf.tex173
-rw-r--r--tex/context/base/spec-ini.tex9
-rw-r--r--tex/context/base/spec-mis.tex148
-rw-r--r--tex/context/base/spec-ps.tex5
-rw-r--r--tex/context/base/spec-tpd.tex142
-rw-r--r--tex/context/base/spec-tr.tex5
-rw-r--r--tex/context/base/spec-var.tex70
-rw-r--r--tex/context/base/supp-box.tex78
-rw-r--r--tex/context/base/supp-fil.tex2
-rw-r--r--tex/context/base/supp-mat.tex61
-rw-r--r--tex/context/base/supp-mpe.tex123
-rw-r--r--tex/context/base/supp-mps.tex11
-rw-r--r--tex/context/base/supp-pdf.tex119
-rw-r--r--tex/context/base/supp-vis.tex36
-rw-r--r--tex/context/base/syst-con.tex22
-rw-r--r--tex/context/base/syst-etx.tex4
-rw-r--r--tex/context/base/syst-ext.tex94
-rw-r--r--tex/context/base/syst-gen.tex2
-rw-r--r--tex/context/base/syst-omg.tex2
-rw-r--r--tex/context/base/verb-ini.tex17
-rw-r--r--tex/context/base/x-res-01.tex10
-rw-r--r--tex/context/base/xtag-ext.tex10
-rw-r--r--tex/context/base/xtag-ini.tex158
-rw-r--r--tex/context/base/xtag-mml.tex3
-rw-r--r--tex/context/base/xtag-pre.tex2
-rw-r--r--tex/context/base/xtag-run.tex15
-rw-r--r--tex/context/config/cont-usr.tex20
-rw-r--r--tex/latex/context/m-ch-de.sty20
-rw-r--r--tex/latex/context/m-ch-en.sty20
-rw-r--r--tex/latex/context/m-ch-nl.sty20
-rw-r--r--tex/latex/context/m-metapo.sty6
-rw-r--r--tex/latex/context/m-pictex.sty6
98 files changed, 3627 insertions, 1686 deletions
diff --git a/context/config/texexec.rme b/context/config/texexec.rme
index 5ccf1f645..419d1faec 100644
--- a/context/config/texexec.rme
+++ b/context/config/texexec.rme
@@ -51,6 +51,8 @@ set TeXShell to tetex
%
% Here are some general defaults. They can be overruled later.
+set UseEnginePath to false
+
set UsedInterfaces to en nl metafun mptopdf
set UserInterface to en
diff --git a/context/data/cont-cz.tws b/context/data/cont-cz.tws
index 7078cfe90..bf88d0ff7 100644
--- a/context/data/cont-cz.tws
+++ b/context/data/cont-cz.tws
@@ -1675,6 +1675,8 @@ var:textdistance:*dimenze::
var:sirkatextu:*cislo::
var:textmargin:*dimenze::
var:clipoffset:*dimenze::
+var:stranka:*jmeno::
+var:papir:*jmeno::
stopsetup
startsetup
@@ -2420,6 +2422,8 @@ val:*jmeno::
val:*cislo,kazdy::
val:standardni,repeat/siroky,repeat/semknuto,zhustene, rozbalene,predel,spojeno,naokraji,naokraji, autouvod,uvolnene,sekce,dotextu:standardni:
var:marginalie:ne,standardni,*dimenze::
+var:levyokraj:ne,standardni,*dimenze::
+var:pravyokraj:ne,standardni,*dimenze::
var:sirka:*dimenze::
var:vzdalenost:*dimenze::
var:faktor:*cislo::
diff --git a/context/data/cont-de.tws b/context/data/cont-de.tws
index 8dfa23d4e..30ab7124d 100644
--- a/context/data/cont-de.tws
+++ b/context/data/cont-de.tws
@@ -1675,6 +1675,8 @@ var:textdistance:*Dimension::
var:textbreite:*Nummer::
var:textmargin:*Dimension::
var:clipoffset:*Dimension::
+var:seite:*Name::
+var:papier:*Name::
stopsetup
startsetup
@@ -2420,6 +2422,8 @@ val:*Name::
val:*Nummer,jede::
val:standard,repeat/breit,repeat/kleinerabstand,gepackt, ungepackt,trenner,keinabstand,amrand,imrand, autointro,lose,absatz,imtext:standard:
var:marginalie:nein,standard,*Dimension::
+var:linkerrand:nein,standard,*Dimension::
+var:rechterrand:nein,standard,*Dimension::
var:breite:*Dimension::
var:abstand:*Dimension::
var:faktor:*Nummer::
diff --git a/context/data/cont-en.tws b/context/data/cont-en.tws
index c3ad4f80b..05b6edd35 100644
--- a/context/data/cont-en.tws
+++ b/context/data/cont-en.tws
@@ -1675,6 +1675,8 @@ var:textdistance:*dimension::
var:textwidth:*number::
var:textmargin:*dimension::
var:clipoffset:*dimension::
+var:page:*name::
+var:paper:*name::
stopsetup
startsetup
@@ -2420,6 +2422,8 @@ val:*name::
val:*number,each::
val:standard,repeat/broad,repeat/serried,packed, unpacked,stopper,joinedup,atmargin,inmargin, autointro,loose,section,intext:standard:
var:margin:no,standard,*dimension::
+var:leftmargin:no,standard,*dimension::
+var:rightmargin:no,standard,*dimension::
var:width:*dimension::
var:distance:*dimension::
var:factor:*number::
diff --git a/context/data/cont-it.tws b/context/data/cont-it.tws
index abdb1b9d0..d7b4ca0b6 100644
--- a/context/data/cont-it.tws
+++ b/context/data/cont-it.tws
@@ -1675,6 +1675,8 @@ var:distanzatesto:*dimensione::
var:ampiezzatesto:*numero::
var:textmargin:*dimensione::
var:clipoffset:*dimensione::
+var:pagina:*nome::
+var:carta:*nome::
stopsetup
startsetup
@@ -2420,6 +2422,8 @@ val:*nome::
val:*numero,ogni::
val:standard,repeat/ampio,repeat/vicino,impaccato, unpacked,stopper,unito,almargine,inmargine, autointro,lento,capoverso,intesto:standard:
var:margine:no,standard,*dimensione::
+var:marginesinistro:no,standard,*dimensione::
+var:marginedestro:no,standard,*dimensione::
var:ampiezza:*dimensione::
var:distanza:*dimensione::
var:fattore:*numero::
diff --git a/context/data/cont-nl.tws b/context/data/cont-nl.tws
index 554e2a165..2d2a90cc3 100644
--- a/context/data/cont-nl.tws
+++ b/context/data/cont-nl.tws
@@ -1675,6 +1675,8 @@ var:tekstafstand:*maat::
var:tekstbreedte:*getal::
var:tekstmarge:*maat::
var:clipoffset:*maat::
+var:pagina:*naam::
+var:papier:*naam::
stopsetup
startsetup
@@ -2420,6 +2422,8 @@ val:*naam::
val:*getal,elk::
val:standaard,repeat/ruim,repeat/aanelkaar,opelkaar, vanelkaar,afsluiter,aansluitend,opmarge,inmarge, autointro,los,paragraaf,intekst:standaard:
var:marge:nee,standaard,*maat::
+var:linkermarge:nee,standaard,*maat::
+var:rechtermarge:nee,standaard,*maat::
var:breedte:*maat::
var:afstand:*maat::
var:factor:*getal::
diff --git a/context/data/cont-ro.tws b/context/data/cont-ro.tws
index 3a36f7eba..bd82534c3 100644
--- a/context/data/cont-ro.tws
+++ b/context/data/cont-ro.tws
@@ -1675,6 +1675,8 @@ var:textdistance:*dimensiune::
var:latimetext:*numar::
var:textmargin:*dimensiune::
var:clipoffset:*dimensiune::
+var:pagina:*nume::
+var:hartie:*nume::
stopsetup
startsetup
@@ -2420,6 +2422,8 @@ val:*nume::
val:*numar,fiecare::
val:standard,repeat/broad,repeat/serried,impachetat, despachetat,stopper,unit,lamargine,inmargine, autointro,larg,sectiune,intext:standard:
var:margine:nu,standard,*dimensiune::
+var:marginestanga:nu,standard,*dimensiune::
+var:marginedreapta:nu,standard,*dimensiune::
var:latime:*dimensiune::
var:distanta:*dimensiune::
var:factor:*numar::
diff --git a/context/data/context.properties b/context/data/context.properties
index 52144e11d..9d25a14c1 100644
--- a/context/data/context.properties
+++ b/context/data/context.properties
@@ -115,7 +115,7 @@ command.compile.*.fo=$(name.example.xmlcheck) $(FileNameExt)
command.build.$(file.patterns.context)=$(name.context.texexec) --pdf $(FileNameExt)
command.build.$(file.patterns.metafun)=$(name.context.texexec) --pdf --mptex $(FileNameExt)
command.build.$(file.patterns.example)=$(name.context.texexec) --pdf --xml $(FileNameExt)
-command.build.*.fo=$(name.context.texexec) --pdf --autopdf --xml --use=fo,foe $(FileNameExt)
+command.build.*.fo=$(name.context.texexec) --pdf --autopdf --xml --use=foxet $(FileNameExt)
command.build.subsystem.$(file.patterns.context)=1
command.build.subsystem.$(file.patterns.metafun)=1
diff --git a/metapost/context/base/mp-core.mp b/metapost/context/base/mp-core.mp
index 51d2d0025..b905d85ce 100644
--- a/metapost/context/base/mp-core.mp
+++ b/metapost/context/base/mp-core.mp
@@ -520,11 +520,12 @@ par_hang_after := ra + estimated_par_lines(py-fy) ;
if (par_hang_indent>0) and (par_hang_after<0) and obey_multi_par_hang :
pair _ul_ ; _ul_ := (xpart ulcorner multipar, ypart snapped_multi_pos(ulxy[fpos]));
pair _pa_ ; _pa_ := _ul_ shifted (0,par_hang_after*par_line_height) ;
- _pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ;
+% _pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ;
+ _pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart llcorner multipar)) ;
if same_area :
- _pa_ := (xpart _pa_,max(ypart _pa_,ypart llxy[tpos])) ;
+% _pa_ := (xpart _pa_,max(ypart _pa_,ypart llxy[tpos])) ;
+ _pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart llxy[tpos])) ;
fi ;
-% vervalt:
if obey_multi_par_more and (round(par_line_height)>0) :
par_hang_after := min(0,round(par_hang_after +
(ypart urxy[fpos]-ypart _pa_)/par_line_height)) ;
@@ -539,7 +540,8 @@ par_hang_after := ra + estimated_par_lines(py-fy) ;
vardef right_top_hang (expr same_area) =
-par_hang_after := ra - estimated_par_lines(py-fy) ;
+% par_hang_after := ra - estimated_par_lines(py-fy) ;
+par_hang_after := ra + estimated_par_lines(py-fy) ;
if (par_hang_indent<0) and (par_hang_after<0) and obey_multi_par_hang :
pair _ur_ ; _ur_ := (xpart urcorner multipar, ypart snapped_multi_pos(urxy[fpos])) ;
@@ -1240,6 +1242,7 @@ vardef PrepareSyncTasks(expr n, collapse, extendtop, prestartnext) =
NOfSyncPaths := NOfSyncPaths + 1 ;
if not ok :
if i>1 :
+% not yet correct when two of teh same follow each other
if sync_t[n][i-1] = sync_t[n][i] :
SyncPaths[NOfSyncPaths] := SyncBox(n, i, SyncLeftOffset, SyncWidth, PaperHeight, -PaperHeight) ;
SyncTasks[NOfSyncPaths] := i ;
diff --git a/metapost/context/base/mp-spec.mp b/metapost/context/base/mp-spec.mp
index b005eb381..ceff7fe90 100644
--- a/metapost/context/base/mp-spec.mp
+++ b/metapost/context/base/mp-spec.mp
@@ -414,34 +414,106 @@ resetspotcolors ; boolean spotcolors ; spotcolors := false ; % true
string spotcolorpattern[] ; % needed for transparancies
+% vardef spotcolor(expr p, s) =
+% if spotcolors :
+% save ok, pc_tag ; boolean ok ; string pc_tag ;
+% pc_tag := "_pct_"&p ;
+% if not unstringed(pc_tag) :
+% _spotcolor_number_ := _spotcolor_number_ + 1 ;
+% setunstringed(pc_tag,_spotcolor_number_) ;
+% fi ;
+% pp := getunstringed(pc_tag) ;
+% if unknown spotcolorhash[pp][s] :
+% ok := false ; % not yet defined
+% elseif spotcolorhash[pp][s] = -1 :
+% ok := false ; % locally defined and undefined
+% else :
+% ok := true ; % globally already defined
+% fi ;
+% if not ok :
+% save ss ; string ss ; ss := p & " " & decimal s ;
+% _spotcolor_counter_ := _spotcolor_counter_ + 1 ;
+% spotcolorpattern[_spotcolor_counter_/1000] := ss ;
+% spotcolorhash[pp][s] := _spotcolor_counter_ ;
+% flush_special(2, 5, decimal _spotcolor_counter_ & " " & ss) ;
+% _local_specials_ := _local_specials_ &
+% "spotcolorhash["&decimal pp&"]["&decimal s&"]:=-1;" ;
+% fi ;
+% (_special_signal_/1000,2/1000,spotcolorhash[pp][s]/1000)
+% else :
+% (1-s,1-s,1-s)
+% fi
+% enddef ;
+
+% vardef spotcolor(expr p, s) =
+% if spotcolors :
+% save ok, pc_tag ; boolean ok ; string pc_tag ;
+% pc_tag := "_pct_"&p ;
+% if not unstringed(pc_tag) :
+% _spotcolor_number_ := _spotcolor_number_ + 1 ;
+% setunstringed(pc_tag,_spotcolor_number_) ;
+% fi ;
+% pp := getunstringed(pc_tag) ;
+% if unknown spotcolorhash[pp][s] :
+% ok := false ; % not yet defined
+% elseif spotcolorhash[pp][s] = -1 :
+% ok := false ; % locally defined and undefined
+% else :
+% ok := true ; % globally already defined
+% fi ;
+% if not ok :
+% save ss ; string ss ; ss := p & " " & decimal s ;
+% _spotcolor_counter_ := _spotcolor_counter_ + 1 ;
+% spotcolorpattern[_spotcolor_counter_/1000] := ss ;
+% spotcolorhash[pp][s] := _spotcolor_counter_ ;
+% flush_special(2, 5, decimal _spotcolor_counter_ & " " & ss) ;
+% _local_specials_ := _local_specials_ &
+% "spotcolorhash["&decimal pp&"]["&decimal s&"]:=-1;" ;
+% fi ;
+% (_special_signal_/1000,2/1000,spotcolorhash[pp][s]/1000)
+% else :
+% (1-s,1-s,1-s)
+% fi
+% enddef ;
+
vardef spotcolor(expr p, s) =
+ multitonecolor(p, 1, "", decimal s)
+enddef ;
+
+vardef multitonecolor(expr n, f, d, p) = % name fractions names factors
if spotcolors :
save ok, pc_tag ; boolean ok ; string pc_tag ;
- pc_tag := "_pct_"&p ;
+ pc_tag := "_pct_" & n ;
if not unstringed(pc_tag) :
_spotcolor_number_ := _spotcolor_number_ + 1 ;
setunstringed(pc_tag,_spotcolor_number_) ;
fi ;
pp := getunstringed(pc_tag) ;
- if unknown spotcolorhash[pp][s] :
+ pc_tag := "_pct_"& decimal f & "_" & if d = "" : n else : d fi & "_" & p ; % check for d empty
+ if not unstringed(pc_tag) :
+ _spotcolor_number_ := _spotcolor_number_ + 1 ;
+ setunstringed(pc_tag,_spotcolor_number_) ;
+ fi ;
+ ps := getunstringed(pc_tag) ;
+ if unknown spotcolorhash[pp][ps] :
ok := false ; % not yet defined
- elseif spotcolorhash[pp][s] = -1 :
+ elseif spotcolorhash[pp][ps] = -1 :
ok := false ; % locally defined and undefined
else :
ok := true ; % globally already defined
fi ;
if not ok :
- save ss ; string ss ; ss := p & " " & decimal s ;
+ save ss ; string ss ; ss := n & " " & decimal f & " " & if d = "" : n else : d fi & " " & p ;
_spotcolor_counter_ := _spotcolor_counter_ + 1 ;
spotcolorpattern[_spotcolor_counter_/1000] := ss ;
- spotcolorhash[pp][s] := _spotcolor_counter_ ;
- flush_special(2, 5, decimal _spotcolor_counter_ & " " & ss) ;
+ spotcolorhash[pp][ps] := _spotcolor_counter_ ;
+ flush_special(2, 7, decimal _spotcolor_counter_ & " " & ss) ;
_local_specials_ := _local_specials_ &
- "spotcolorhash["&decimal pp&"]["&decimal s&"]:=-1;" ;
+ "spotcolorhash["&decimal pp&"]["&decimal ps&"]:=-1;" ;
fi ;
- (_special_signal_/1000,2/1000,spotcolorhash[pp][s]/1000)
+ (_special_signal_/1000,2/1000,spotcolorhash[pp][ps]/1000)
else :
- (1-s,1-s,1-s)
+ .5white
fi
enddef ;
@@ -459,6 +531,63 @@ differencetransparent := 11 ; exclusiontransparent := 12 ;
% fill fullcircle scaled 10cm withcolor transparant(.8,3,color) ;
+% vardef transparent(expr n, t, c) =
+% save s, ss, nn, cc, is_cmyk, is_spot, ok ;
+% string s, ss ; numeric nn ; color cc ; boolean is_cmyk, is_spot, ok ;
+% % transparancy type
+% if string n :
+% if expandafter known scantokens(n&"transparent") :
+% nn := scantokens(n&"transparent") ;
+% else :
+% nn := 0 ;
+% fi
+% else : % nn := min(n,13)
+% nn := if n<13 : n else : nn := 0 fi ;
+% fi ;
+% % we need to expand the color (can be cmyk(..) or predefined)
+% cc := c ; % expand color
+% % check for cmyk special
+% is_cmyk := (redpart cc = _special_signal_/1000)
+% and (greenpart cc = 1/1000) ;
+% is_spot := (redpart cc = _special_signal_/1000)
+% and (greenpart cc = 2/1000) ;
+% % build special string, fetch cmyk components
+% s := decimal nn & " " & decimal t & " " &
+% if is_cmyk : cmykcolorpattern[bluepart cc]
+% elseif is_spot : spotcolorpattern[bluepart cc]
+% else : dddecimal cc fi ;
+% % check if this one is already used
+% ss := "tr_" & s ;
+% % efficiency hack
+% if expandafter unknown scantokens(ss) :
+% ok := false ; % not yet defined
+% elseif scantokens(ss) < 0 :
+% ok := false ; % locally defined and undefined
+% else :
+% ok := true ; % globally already defined
+% fi ;
+% if not ok :
+% if is_spot :
+% flush_special(5, 6, s) ;
+% elseif is_cmyk :
+% flush_special(4, 8, s) ;
+% else :
+% flush_special(3, 7, s) ;
+% fi ;
+% scantokens(ss) := _special_counter_ ;
+% _local_specials_ := _local_specials_ &
+% "scantokens(" & ditto & ss & ditto & ") := -1 ;" ;
+% fi ;
+% % go ahead
+% if is_spot :
+% (_special_signal_/1000,5/1000,scantokens(ss)/1000)
+% elseif is_cmyk :
+% (_special_signal_/1000,4/1000,scantokens(ss)/1000)
+% else :
+% (_special_signal_/1000,3/1000,scantokens(ss)/1000)
+% fi
+% enddef ;
+
vardef transparent(expr n, t, c) =
save s, ss, nn, cc, is_cmyk, is_spot, ok ;
string s, ss ; numeric nn ; color cc ; boolean is_cmyk, is_spot, ok ;
@@ -485,7 +614,9 @@ vardef transparent(expr n, t, c) =
elseif is_spot : spotcolorpattern[bluepart cc]
else : dddecimal cc fi ;
% check if this one is already used
- ss := "tr_" & s ;
+% ss := "tr_" & s ;
+% ss := cleanstring(ss) ;
+ ss := cleanstring("tr_" & s) ;
% efficiency hack
if expandafter unknown scantokens(ss) :
ok := false ; % not yet defined
@@ -496,7 +627,7 @@ vardef transparent(expr n, t, c) =
fi ;
if not ok :
if is_spot :
- flush_special(5, 6, s) ;
+ flush_special(5, 8, s) ;
elseif is_cmyk :
flush_special(4, 8, s) ;
else :
diff --git a/metapost/context/base/mp-text.mp b/metapost/context/base/mp-text.mp
index cb6bb3895..2e061df09 100644
--- a/metapost/context/base/mp-text.mp
+++ b/metapost/context/base/mp-text.mp
@@ -2,165 +2,182 @@
%D [ file=mp-text.mp,
%D version=2000.07.10,
%D title=\CONTEXT\ \METAPOST\ graphics,
-%D subtitle=text support,
+%D subtitle=text support,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
+%C details.
%D Under construction.
-if unknown context_tool : input mp-tool ; fi ;
-if known context_text : endinput ; fi ;
+if unknown context_tool : input mp-tool ; fi ;
+if known context_text : endinput ; fi ;
-boolean context_text ; context_text := true ;
+boolean context_text ; context_text := true ;
-if unknown noftexpictures :
- numeric noftexpictures ; noftexpictures := 0 ;
-fi ;
+if unknown noftexpictures :
+ numeric noftexpictures ; noftexpictures := 0 ;
+fi ;
-if unknown texpictures[1] :
- picture texpictures[] ;
-fi ;
+if unknown texpictures[1] :
+ picture texpictures[] ;
+fi ;
-numeric textextoffset ; textextoffset := 0 ;
+numeric textextoffset ; textextoffset := 0 ;
-% vardef textext@#(expr txt) =
-% interim labeloffset := textextoffset ;
-% noftexpictures := noftexpictures + 1 ;
-% if string txt :
-% write "% figure " & decimal charcode & " : " &
-% "texpictures[" & decimal noftexpictures & "] := btex " &
-% txt & " etex ;" to jobname & ".mpt" ;
-% if unknown texpictures[noftexpictures] :
-% thelabel@#("unknown",origin)
+% vardef textext@#(expr txt) =
+% interim labeloffset := textextoffset ;
+% noftexpictures := noftexpictures + 1 ;
+% if string txt :
+% write "% figure " & decimal charcode & " : " &
+% "texpictures[" & decimal noftexpictures & "] := btex " &
+% txt & " etex ;" to jobname & ".mpt" ;
+% if unknown texpictures[noftexpictures] :
+% thelabel@#("unknown",origin)
% else :
-% thelabel@#(texpictures[noftexpictures],origin)
-% fi
+% thelabel@#(texpictures[noftexpictures],origin)
+% fi
% else :
-% thelabel@#(txt,origin)
-% fi
-% enddef ;
-
-boolean hobbiestextext ; hobbiestextext := false ;
-
-vardef textext@#(expr txt) =
- interim labeloffset := textextoffset ;
- noftexpictures := noftexpictures + 1 ;
- if string txt :
+% thelabel@#(txt,origin)
+% fi
+% enddef ;
+
+boolean hobbiestextext ; hobbiestextext := false ;
+% string textextstring ; textextstring := "" ;
+
+% def resettextextdirective =
+% textextstring := "" ;
+% enddef ;
+
+% def textextdirective text t =
+% textextstring := textextstring & t ;
+% enddef ;
+
+vardef textext@#(expr txt) =
+ save _s_ ; string _s_ ;
+ interim labeloffset := textextoffset ;
+ noftexpictures := noftexpictures + 1 ;
+ if string txt :
+% if textextstring <> "" :
+% _s_ := "verbatimtex " & textextstring & " etex ;" ;
+% else :
+% _s_ := "" ;
+% fi ;
if hobbiestextext : % the tex.mp method as fallback (see tex.mp)
- write "btex " & txt & " etex" to "mptextmp.mp" ;
+% write _s_ to "mptextmp.mp" ;
+ write _s_ & "btex " & txt & " etex" to "mptextmp.mp" ;
write EOF to "mptextmp.mp" ;
scantokens "input mptextmp"
else :
- write "% figure " & decimal charcode & " : " &
- "texpictures[" & decimal noftexpictures & "] := btex " &
- txt & " etex ;" to jobname & ".mpt" ;
- if unknown texpictures[noftexpictures] :
- thelabel@#("unknown",origin)
+% write "% setup : " & _s_ to jobname & ".mpt" ;
+ write "% figure " & decimal charcode & " : " &
+ "texpictures[" & decimal noftexpictures & "] := btex " &
+ txt & " etex ;" to jobname & ".mpt" ;
+ if unknown texpictures[noftexpictures] :
+ thelabel@#("unknown",origin)
else :
- thelabel@#(texpictures[noftexpictures],origin)
+ thelabel@#(texpictures[noftexpictures],origin)
fi
- fi
+ fi
else :
- thelabel@#(txt,origin)
- fi
-enddef ;
-
-string laboff_ ; laboff_ := "" ;
-string laboff_c ; laboff_c := "" ;
-string laboff_l ; laboff_l := ".lft" ;
-string laboff_r ; laboff_r := ".rt" ;
-string laboff_b ; laboff_b := ".bot" ;
-string laboff_t ; laboff_t := ".top" ;
-string laboff_lt ; laboff_lt := ".ulft" ;
-string laboff_rt ; laboff_rt := ".urt" ;
-string laboff_lb ; laboff_lb := ".llft" ;
-string laboff_rb ; laboff_rb := ".lrt" ;
-string laboff_tl ; laboff_tl := ".ulft" ;
-string laboff_tr ; laboff_tr := ".urt" ;
-string laboff_bl ; laboff_bl := ".llft" ;
-string laboff_br ; laboff_br := ".lrt" ;
-
-vardef textextstr(expr s, a) =
- save ss ; string ss ;
- ss := "laboff_" & a ;
- ss := scantokens ss ;
+ thelabel@#(txt,origin)
+ fi
+enddef ;
+
+string laboff_ ; laboff_ := "" ;
+string laboff_c ; laboff_c := "" ;
+string laboff_l ; laboff_l := ".lft" ;
+string laboff_r ; laboff_r := ".rt" ;
+string laboff_b ; laboff_b := ".bot" ;
+string laboff_t ; laboff_t := ".top" ;
+string laboff_lt ; laboff_lt := ".ulft" ;
+string laboff_rt ; laboff_rt := ".urt" ;
+string laboff_lb ; laboff_lb := ".llft" ;
+string laboff_rb ; laboff_rb := ".lrt" ;
+string laboff_tl ; laboff_tl := ".ulft" ;
+string laboff_tr ; laboff_tr := ".urt" ;
+string laboff_bl ; laboff_bl := ".llft" ;
+string laboff_br ; laboff_br := ".lrt" ;
+
+vardef textextstr(expr s, a) =
+ save ss ; string ss ;
+ ss := "laboff_" & a ;
+ ss := scantokens ss ;
ss := "textext" & ss & "(" & ditto & s & ditto & ")" ;
- scantokens ss
-enddef ;
+ scantokens ss
+enddef ;
-pair laboff.origin ; laboff.origin = (infinity,infinity) ;
-pair laboff.raw ; laboff.raw = (infinity,infinity) ;
+pair laboff.origin ; laboff.origin = (infinity,infinity) ;
+pair laboff.raw ; laboff.raw = (infinity,infinity) ;
-vardef thelabel@#(expr s, z) =
+vardef thelabel@#(expr s, z) =
save p ; picture p ;
p = s if not picture s : infont defaultfont scaled defaultscale fi ;
- if laboff@#<>laboff.origin :
- (p shifted (z + labeloffset*laboff@# - (labxf@#*lrcorner p +
+ if laboff@#<>laboff.origin :
+ (p shifted (z + labeloffset*laboff@# - (labxf@#*lrcorner p +
labyf@#*ulcorner p + (1-labxf@#-labyf@#)*llcorner p)))
else :
(p shifted z)
fi
enddef;
-def build_parshape (expr p, offset_or_path, dx, dy,
+def build_parshape (expr p, offset_or_path, dx, dy,
baselineskip, strutheight, strutdepth, topskip) =
-
- if unknown trace_parshape :
- boolean trace_parshape ; trace_parshape := false ;
+
+ if unknown trace_parshape :
+ boolean trace_parshape ; trace_parshape := false ;
fi ;
begingroup ;
- save q, l, r, line, tt, bb,
- n, hsize, vsize, vvsize, voffset, hoffset, width, indent,
- ll, lll, rr, rrr, cp, cq, t, b ;
+ save q, l, r, line, tt, bb,
+ n, hsize, vsize, vvsize, voffset, hoffset, width, indent,
+ ll, lll, rr, rrr, cp, cq, t, b ;
- path q, l, r, line, tt, bb ;
+ path q, l, r, line, tt, bb ;
numeric n, hsize, vsize, vvsize, voffset, hoffset, width[], indent[] ;
- pair ll, lll, rr, rrr, cp, cq, t, b ;
+ pair ll, lll, rr, rrr, cp, cq, t, b ;
- n := 0 ; cp := center p ;
+ n := 0 ; cp := center p ;
- if path offset_or_path :
- q := offset_or_path ; cq := center q ;
- voffset := dy ;
- hoffset := dx ;
- else :
- q := p ; cq := center q ;
+ if path offset_or_path :
+ q := offset_or_path ; cq := center q ;
+ voffset := dy ;
+ hoffset := dx ;
+ else :
+ q := p ; cq := center q ;
hoffset := offset_or_path + dx ;
- voffset := offset_or_path + dy ;
- fi ;
+ voffset := offset_or_path + dy ;
+ fi ;
- hsize := xpart lrcorner q - xpart llcorner q ;
- vsize := ypart urcorner q - ypart lrcorner q ;
+ hsize := xpart lrcorner q - xpart llcorner q ;
+ vsize := ypart urcorner q - ypart lrcorner q ;
- q := p shifted - cp ;
+ q := p shifted - cp ;
- startsavingdata ;
+ startsavingdata ;
- savedata "\global\parvoffset " & decimal voffset&"bp " ;
- savedata "\global\parhoffset " & decimal hoffset&"bp " ;
- savedata "\global\parwidth " & decimal hsize&"bp " ;
- savedata "\global\parheight " & decimal vsize&"bp " ;
+ savedata "\global\parvoffset " & decimal voffset&"bp " ;
+ savedata "\global\parhoffset " & decimal hoffset&"bp " ;
+ savedata "\global\parwidth " & decimal hsize&"bp " ;
+ savedata "\global\parheight " & decimal vsize&"bp " ;
- if not path offset_or_path :
- q := q xscaled ((hsize-2hoffset)/hsize)
- yscaled ((vsize-2voffset)/vsize) ;
- fi ;
+ if not path offset_or_path :
+ q := q xscaled ((hsize-2hoffset)/hsize)
+ yscaled ((vsize-2voffset)/vsize) ;
+ fi ;
- hsize := xpart lrcorner q - xpart llcorner q ;
- vsize := ypart urcorner q - ypart lrcorner q ;
+ hsize := xpart lrcorner q - xpart llcorner q ;
+ vsize := ypart urcorner q - ypart lrcorner q ;
- t := (ulcorner q -- urcorner q) intersection_point q ;
- b := (llcorner q -- lrcorner q) intersection_point q ;
+ t := (ulcorner q -- urcorner q) intersection_point q ;
+ b := (llcorner q -- lrcorner q) intersection_point q ;
- if xpart directionpoint t of q < 0 :
- q := reverse q ;
+ if xpart directionpoint t of q < 0 :
+ q := reverse q ;
fi ;
l := q cutbefore t ;
@@ -169,82 +186,82 @@ def build_parshape (expr p, offset_or_path, dx, dy,
r := q cutbefore b ;
r := r if xpart point 0 of q > 0 : & q fi cutafter t ;
-% tt := (ulcorner q -- urcorner q) shifted (0,-topskip) ;
-% bb := (llcorner q -- lrcorner q) shifted (0,strutdepth) ;
+% tt := (ulcorner q -- urcorner q) shifted (0,-topskip) ;
+% bb := (llcorner q -- lrcorner q) shifted (0,strutdepth) ;
%
-% l := l cutbefore (l intersection_point tt) ;
-% l := l cutafter (l intersection_point bb) ;
-% r := r cutbefore (r intersection_point bb) ;
-% r := r cutafter (r intersection_point tt) ;
+% l := l cutbefore (l intersection_point tt) ;
+% l := l cutafter (l intersection_point bb) ;
+% r := r cutbefore (r intersection_point bb) ;
+% r := r cutafter (r intersection_point tt) ;
- if trace_parshape :
+ if trace_parshape :
drawarrow p withpen pencircle scaled 2pt withcolor red ;
drawarrow l shifted cp withpen pencircle scaled 1pt withcolor green ;
drawarrow r shifted cp withpen pencircle scaled 1pt withcolor blue ;
- fi ;
+ fi ;
- vardef found_point (expr lin, pat, sig) =
+ vardef found_point (expr lin, pat, sig) =
pair a, b ;
a := pat intersection_point (lin shifted (0,strutheight)) ;
- if intersection_found :
+ if intersection_found :
a := a shifted (0,-strutheight) ;
else :
a := pat intersection_point lin ;
fi ;
b := pat intersection_point (lin shifted (0,-strutdepth)) ;
- if intersection_found :
- if sig :
- if xpart b > xpart a : a := b shifted (0,strutdepth) fi ;
- else :
- if xpart b < xpart a : a := b shifted (0,strutdepth) fi ;
- fi ;
- fi ;
- a
+ if intersection_found :
+ if sig :
+ if xpart b > xpart a : a := b shifted (0,strutdepth) fi ;
+ else :
+ if xpart b < xpart a : a := b shifted (0,strutdepth) fi ;
+ fi ;
+ fi ;
+ a
enddef ;
- if (strutheight+strutdepth<baselineskip) :
- vvsize := vsize ;
- else :
- vvsize := (vsize div baselineskip) * baselineskip ;
- fi ;
+ if (strutheight+strutdepth<baselineskip) :
+ vvsize := vsize ;
+ else :
+ vvsize := (vsize div baselineskip) * baselineskip ;
+ fi ;
- for i=topskip step baselineskip until vvsize :
+ for i=topskip step baselineskip until vvsize :
- line := (ulcorner q -- urcorner q) shifted (0,-i-eps) ;
+ line := (ulcorner q -- urcorner q) shifted (0,-i-eps) ;
ll := found_point(line,l,true ) ;
rr := found_point(line,r,false) ;
- if trace_parshape :
- fill (ll--rr--rr shifted (0,strutheight)--ll
+ if trace_parshape :
+ fill (ll--rr--rr shifted (0,strutheight)--ll
shifted (0,strutheight)--cycle) shifted cp withcolor .5white ;
- fill (ll--rr--rr shifted (0,-strutdepth)--ll
+ fill (ll--rr--rr shifted (0,-strutdepth)--ll
shifted (0,-strutdepth)--cycle) shifted cp withcolor .7white ;
- draw ll shifted cp withpen pencircle scaled 2pt ;
- draw rr shifted cp withpen pencircle scaled 2pt ;
+ draw ll shifted cp withpen pencircle scaled 2pt ;
+ draw rr shifted cp withpen pencircle scaled 2pt ;
draw (ll--rr) shifted cp withpen pencircle scaled .5pt ;
- fi ;
+ fi ;
- n := n + 1 ;
+ n := n + 1 ;
indent[n] := abs(xpart ll - xpart llcorner q) ;
width[n] := abs(xpart rr - xpart ll) ;
- if (i=strutheight) and (width[n]<baselineskip) :
- n := n - 1 ;
- savedata "\global\chardef\parfirst=1 " ;
+ if (i=strutheight) and (width[n]<baselineskip) :
+ n := n - 1 ;
+ savedata "\global\chardef\parfirst=1 " ;
fi ;
- endfor ;
+ endfor ;
- savedata "\global\parlines " & decimal n ;
- savedata "\global\partoks{ " ;
- for i=1 upto n:
- savedata decimal indent[i]&"bp " & decimal width[i]&"bp " ;
- endfor ;
+ savedata "\global\parlines " & decimal n ;
+ savedata "\global\partoks{ " ;
+ for i=1 upto n:
+ savedata decimal indent[i]&"bp " & decimal width[i]&"bp " ;
+ endfor ;
savedata "}" ;
-
- stopsavingdata ;
+
+ stopsavingdata ;
endgroup ;
-enddef ;
+enddef ;
diff --git a/metapost/context/base/mp-tool.mp b/metapost/context/base/mp-tool.mp
index 3064cf239..0db4a3f47 100644
--- a/metapost/context/base/mp-tool.mp
+++ b/metapost/context/base/mp-tool.mp
@@ -1981,12 +1981,20 @@ vardef dodostraightened(expr sign, p) =
fi
enddef ;
+% vardef simplified expr p =
+% dostraightened(+1,p)
+% enddef ;
+
+% vardef unspiked expr p =
+% dostraightened(-1,p)
+% enddef ;
+
vardef simplified expr p =
- dostraightened(+1,p)
+ (reverse dostraightened(+1,dostraightened(+1,reverse p)))
enddef ;
vardef unspiked expr p =
- dostraightened(-1,p)
+ (reverse dostraightened(-1,dostraightened(-1,reverse p)))
enddef ;
% path p ;
@@ -2124,9 +2132,13 @@ enddef ;
string _clean_ascii[] ;
-_clean_ascii[ASCII "-"] := "_" ;
-_clean_ascii[ASCII ":"] := "_" ;
-_clean_ascii[ASCII "."] := "_" ;
+def register_dirty_chars(expr str) =
+ for i = 0 upto length(str)-1 :
+ _clean_ascii[ASCII substring(i,i+1) of str] := "_" ;
+ endfor ;
+enddef ;
+
+register_dirty_chars("+-*/:;.,") ;
vardef cleanstring (expr s) =
save ss ; string ss, si ; ss = "" ;
diff --git a/scripts/context/perl/texexec.pl b/scripts/context/perl/texexec.pl
index eb1664357..00e336ea5 100644
--- a/scripts/context/perl/texexec.pl
+++ b/scripts/context/perl/texexec.pl
@@ -184,6 +184,7 @@ my $Random = 0;
my $Filters = '';
my $NoMapFiles = 0 ;
my $Foxet = 0 ;
+my $UseEnginePath = 0 ;
my $StartLine = 0 ;
my $StartColumn = 0 ;
@@ -285,6 +286,7 @@ my $MakeMpy = '';
"globalfile" => \$GlobalFile,
"nomapfiles" => \$NoMapFiles,
"foxet" => \$Foxet,
+ "engine" => \$UseEnginePath,
#### exxperiment
"startline=s" => \$StartLine,
"startcolumn=s" => \$StartColumn,
@@ -347,7 +349,7 @@ if ( ( $LogFile ne '' ) && ( $LogFile =~ /\w+\.log$/io ) ) {
*STDERR = *LOGFILE;
}
-my $Program = " TeXExec 4.3 - ConTeXt / PRAGMA ADE 1997-2004";
+my $Program = " TeXExec 4.4 - ConTeXt / PRAGMA ADE 1997-2004";
print "\n$Program\n\n";
@@ -645,6 +647,11 @@ if ( open( INI, $IniPath ) ) {
sub IniValue {
my ( $Key, $Default ) = @_;
if ( defined( $Done{$Key} ) ) { $Default = $Done{$Key} }
+ if ($Default =~ /^(true|yes|on)$/io) {
+ $Default = 1 ;
+ } elsif ($Default =~ /^(false|no|off)$/io) {
+ $Default = 0 ;
+ }
if ($Verbose) { print " used setting : $Key = $Default\n" }
return $Default;
}
@@ -676,11 +683,14 @@ my $MpPassString = IniValue( 'MpPassString', '' );
my $MpFormat = IniValue( 'MpFormat', $MetaFun );
my $MpFormatPath = IniValue( 'MpFormatPath', $TeXFormatPath );
+my $UseEnginePath = IniValue( 'UseEnginePath', $UseEnginePath);
+
my $FmtLanguage = IniValue( 'FmtLanguage', '' );
my $FmtBodyFont = IniValue( 'FmtBodyFont', '' );
my $FmtResponse = IniValue( 'FmtResponse', '' );
my $TcXPath = IniValue( 'TcXPath', '' );
+
$SetFile = IniValue( 'SetFile', $SetFile );
if ( ($Verbose) && ( $kpsewhich ne '' ) ) {
@@ -718,6 +728,11 @@ if ( $MpFormatFlag eq "" ) {
$MpFormatFlag = "-mem=" ;
}
+if ($UseEnginePath && (! $MakeFormats)) {
+ $MpFormatFlag .= $MpExecutable . '/' ;
+ $TeXFormatFlag .= $TeXExecutable . '/' ;
+}
+
#~ if ( $TeXFormatFlag eq "" ) { $TeXFormatFlag = "&" }
#~ if ( $MpFormatFlag eq "" ) { $MpFormatFlag = "&" }
@@ -730,8 +745,12 @@ if ($TeXProgram) { $TeXExecutable = $TeXProgram }
my $fmtutil = '';
+# for the moment forget about fmtutil, since it does not support $engine subpaths
+
+$Alone = 1 ;
+
if ( $MakeFormats || $Verbose ) {
- if ($Alone) {
+ if ($Alone || $UseEnginePath) {
if ($Verbose) { print " generating format : not using fmtutil\n" }
} elsif ( $TeXShell =~ /tetex|fptex/i ) {
foreach (@paths) {
@@ -739,7 +758,7 @@ if ( $MakeFormats || $Verbose ) {
if ( -e $p ) { $fmtutil = $p; last }
elsif ( -e $p . '.exe' ) { $fmtutil = $p . '.exe'; last }
}
- $fmtutil = ($fmtutil =~ m/^[^\"].* / ? "\"$fmtutil\"" : "$fmtutil") ;
+ $fmtutil = ($fmtutil =~ m/^[^\"].* / ? "\"$fmtutil\"" : "$fmtutil") ;
if ($Verbose) {
if ( $fmtutil eq '' ) {
print " locating fmtutil : not found in path\n";
@@ -921,11 +940,14 @@ sub print_opt {
sub show_help_options {
print # "\n" .
- " --help overview of all options and their values\n"
+ " --help overview of all options and their values\n"
. " --help all all about all options\n"
. " --help short just the main options\n"
. " --help mode ... pdf all about a few options\n"
- . " --help '*.pdf' all about options containing 'pdf'\n";
+ . " --help '*.pdf' all about options containing 'pdf'\n"
+ . "\n"
+ . " more info http://www.pragma-ade.com/general/manuals/mtexexec.pdf\n"
+ . " http://www.ntg.nl/mailman/listinfo/ntg-context\n";
}
# determine what user wants to see
@@ -1238,7 +1260,7 @@ sub CheckPositions { }
my $ConTeXtVersion = "unknown";
my $ConTeXtModes = '';
-sub ScanPreamble {
+sub ScanTeXPreamble {
my ($FileName) = @_;
open( TEX, $FileName );
while (<TEX>) {
@@ -1266,6 +1288,12 @@ sub ScanPreamble {
}
}
close(TEX);
+
+ # handy later on
+
+ $ProducePdfT = ($OutputFormat eq "pdftex") ;
+ $ProducePdfM = ($OutputFormat eq "dvipdfm") ;
+ $ProducePdfX = ($OutputFormat eq "dvipdfmx") ;
}
sub ScanContent {
@@ -1570,6 +1598,23 @@ sub RunConTeXtFile {
if ($DummyFile) {
open( TMP, ">$JobName.run" );
if ( ( $JobSuffix =~ /(xml|fo|fox)/io ) || $ForceXML ) {
+ # scan xml preamble
+ open(XML,"<$JobName.$JobSuffix") ;
+ while (<XML>) {
+ if (/\<[a-z]+/io) {
+ last ;
+ } elsif (/\<\?context\-directive\s+(.+?)\s+(.+?)\s+(.+?)\s*\?\>/o) {
+ my ($class, $key, $value) = ($1, $2, $3) ;
+ if ($class eq 'job') {
+ if ($key eq 'stylefile') {
+ print TMP "\\environment $value\n" ;
+ } elsif ($key eq 'interface') {
+ $ConTeXtInterface = $value ;
+ }
+ }
+ }
+ }
+ close(XML) ;
if ( $Filters ne "" ) {
print " using xml filters : $Filters\n";
}
@@ -1585,9 +1630,8 @@ sub RunConTeXtFile {
$JobSuffix = "run";
}
if ( ( -e "$JobName.$JobSuffix" ) || ($GlobalFile) ) {
- unless ($DummyFile) # we don't need this for xml
- {
- ScanPreamble("$JobName.$JobSuffix");
+ unless ($DummyFile) { # we don't need this for xml
+ ScanTeXPreamble("$JobName.$JobSuffix");
if ( $ConTeXtInterface eq "unknown" ) {
ScanContent("$JobName.$JobSuffix");
}
@@ -1692,6 +1736,11 @@ sub RunConTeXtFile {
CopyFile( "$JobName.top", "$JobName.tmp" );
unlink "$JobName.tup"; # previous tuo file
unlink "$JobName.top"; # runtime option file
+ if ($ProducePdfX) {
+ system("dvipdfmx -f dvipdfmx.map -d 4 $JobName") ;
+ } elsif ($ProducePdfM) {
+ system("dvipdfm $JobName") ;
+ }
PopResult($JobName);
}
if ($Purge) { PurgeFiles($JobName) }
@@ -2033,6 +2082,7 @@ sub RunCombine {
sub LocatedFormatPath {
my $FormatPath = shift;
+ my $EnginePath = shift;
if ( ( $FormatPath eq '' ) && ( $kpsewhich ne '' ) ) {
$FormatPath = `$kpsewhich --show-path=fmt`;
chomp $FormatPath;
@@ -2048,6 +2098,14 @@ sub LocatedFormatPath {
print " located formatpath : $FormatPath\n";
}
}
+
+ if ($UseEnginePath && ($FormatPath ne '' && ($FormatPath !~ /$EnginePath\/$/))) {
+ $FormatPath .= $EnginePath . '/' ;
+ unless (-d $FormatPath) {
+ mkdir $FormatPath ;
+ }
+ }
+
return $FormatPath;
}
@@ -2056,6 +2114,7 @@ sub RunOneFormat {
my @TeXFormatPath;
my $TeXPrefix = "";
if ( ( $fmtutil ne "" ) && ( $FormatName !~ /metafun|mptopdf/io ) ) {
+# could not happen, not supported any more
my $cmd = "$fmtutil --byfmt $FormatName";
if ($Verbose) { print "\n$cmd\n\n" }
MakeUserFile; # this works only when the path is kept
@@ -2072,11 +2131,11 @@ sub RunOneFormat {
$TeXPrefix = "*";
}
my $CurrentPath = cwd();
- $TeXFormatPath = LocatedFormatPath($TeXFormatPath);
- if ( $TeXFormatPath ne '' ) { chdir $TeXFormatPath }
+ my $TheTeXFormatPath = LocatedFormatPath($TeXFormatPath, $TeXExecutable);
+ if ( $TheTeXFormatPath ne '' ) { chdir $TheTeXFormatPath }
MakeUserFile;
MakeResponseFile;
- $own_quote = ($TeXProgramPath =~ m/^[^\"].* / ? "\"" : "") ;
+ $own_quote = ($TeXProgramPath =~ m/^[^\"].* / ? "\"" : "") ;
my $cmd =
"$own_quote$TeXProgramPath$TeXExecutable$own_quote $TeXVirginFlag "
. "$TeXPassString $PassOn ${TeXPrefix}$FormatName";
@@ -2085,7 +2144,7 @@ sub RunOneFormat {
RemoveResponseFile;
RestoreUserFile;
- if ( ( $TeXFormatPath ne '' ) && ( $CurrentPath ne '' ) ) {
+ if ( ( $TheTeXFormatPath ne '' ) && ( $CurrentPath ne '' ) ) {
chdir $CurrentPath;
}
}
@@ -2130,15 +2189,15 @@ sub RunMpFormat {
my $MpFormat = shift;
return if ( $MpFormat eq '' );
my $CurrentPath = cwd();
- $MpFormatPath = LocatedFormatPath($MpFormatPath);
- if ( $MpFormatPath ne '' ) { chdir "$MpFormatPath" }
+ my $TheMpFormatPath = LocatedFormatPath($MpFormatPath, $MpExecutable);
+ if ( $TheMpFormatPath ne '' ) { chdir $TheMpFormatPath }
$own_quote = ($MpExecutable =~ m/^[^\"].* / ? "\"" : "") ;
my $cmd =
"$own_quote$MpExecutable$own_quote $MpVirginFlag $MpPassString $MpFormat";
if ($Verbose) { print "\n$cmd\n\n" }
system($cmd ) ;
- if ( ( $MpFormatPath ne '' ) && ( $CurrentPath ne '' ) ) {
+ if ( ( $TheMpFormatPath ne '' ) && ( $CurrentPath ne '' ) ) {
chdir $CurrentPath;
}
}
@@ -2298,14 +2357,37 @@ sub checkMPlabels {
return 0 unless ( -s "$MpName.mpt" > 10 );
return 0 unless open( MP, "$MpName.mpt" );
my $n = 0;
+ my $t = "" ;
while (<MP>) {
- if (/% figure (\d+) : (.*)/o) { $mpbetex{$1} .= "$2\n"; ++$n }
+ if (/% setup : (.*)/o) {
+ $t = $1 ;
+ } else {
+ $t = "" ;
+ }
+ if (/% figure (\d+) : (.*)/o) {
+ if ($t ne "") {
+ $mpbetex{$1} .= "$t\n" ;
+ $t = "" ;
+ }
+ $mpbetex{$1} .= "$2\n";
+ ++$n ;
+ }
}
close(MP);
print " second MP run needed : $n tex labels found\n" if $n;
return $n;
}
+sub doMergeMP {
+ # make sure that the verbatimtex ends up before btex etc
+ my ($n,$str) = @_ ;
+ if ($str =~ /(.*?)(verbatimtex.*?etex)\s*\;(.*)/mois) {
+ return "beginfig($n)\;\n$1$2\;\n$mpbetex{$n}\n$3\;endfig\;\n" ;
+ } else {
+ return "beginfig($n)\;\n$mpbetex{$n}\n$str\;endfig\;\n" ;
+ }
+}
+
sub doRunMP { ###########
my ( $MpName, $MergeBE ) = @_;
my $TexFound = 0;
@@ -2337,9 +2419,9 @@ sub doRunMP { ###########
s/(\".*?)\@\@\@(.*?\")/$1\;$2/gmois; # added
# merge labels
if ($MergeBE) {
- s/beginfig\s*\((\d+)\)\s*\;/beginfig($1)\;\n$mpbetex{$1}\n/goims;
+ # i hate this indirect (sub regexp) mess
+ s/beginfig\s*\((\d+)\)\s*\;(.*?)endfig\s*\;/doMergeMP($1,$2)/gems ;
}
- # flush
unless (/beginfig\s*\(\s*0\s*\)/gmois) { print MP $mpbetex{0} }
print MP $_;
print MP "\n" . "end" . "\n";
@@ -2347,7 +2429,7 @@ sub doRunMP { ###########
}
if ($TexFound) {
print " metapost to tex : $MpName\n";
- $own_quote = ($MpToTeXExecutable =~ m/^[^\"].* / ? "\"" : "") ;
+ $own_quote = ($MpToTeXExecutable =~ m/^[^\"].* / ? "\"" : "") ;
$Problems =
system("$own_quote$MpToTeXExecutable$own_quote $MpFile > $MpTex");
if ( -e $MpTex && !$Problems ) {
@@ -2411,7 +2493,7 @@ sub RunMPX {
local $/ = "\0777";
$_ = <MP>;
close(MP);
- if (/(btex|etex|verbatimtex)/o) {
+ if (/(btex|etex|verbatimtex)/mos) {
print " generating mpx file : $MpName\n";
$own_quote = ($MpToTeXExecutable =~ m/^[^\"].* / ? "\"" : "") ;
$Problems =
diff --git a/scripts/context/perl/texexec.rme b/scripts/context/perl/texexec.rme
index 5ccf1f645..419d1faec 100644
--- a/scripts/context/perl/texexec.rme
+++ b/scripts/context/perl/texexec.rme
@@ -51,6 +51,8 @@ set TeXShell to tetex
%
% Here are some general defaults. They can be overruled later.
+set UseEnginePath to false
+
set UsedInterfaces to en nl metafun mptopdf
set UserInterface to en
diff --git a/scripts/context/perl/texfont.pl b/scripts/context/perl/texfont.pl
index bf93ccaf1..bebb636f5 100644
--- a/scripts/context/perl/texfont.pl
+++ b/scripts/context/perl/texfont.pl
@@ -155,9 +155,6 @@ my $variant = "" ; # atl: encoding variant
my $extension = "pfb" ; # atl: default font extension
my $lcdf = "" ; # atl: trigger for lcdf otftotfm
-my $mappath = 'fonts/map/pdftex/context' ; # will be set later
-my $encpath = 'fonts/enc/dvips/context' ; # will be set later
-
my @cleanup = () ; # atl: build list of generated files to delete
# todo: parse name for style, take face from command line
@@ -495,7 +492,7 @@ if ($sourcepath eq "auto") # todo uppercase root
else
{ $path = `kpsewhich -expand-path=\\\$$root` }
chomp $path ;
- $path = $ENV{$root} if (($path == '') && defined($ENV{$root})) ;
+ $path = $ENV{$root} if (($path eq '') && defined($ENV{$root})) ;
report ("checking root : $root") ;
if ($preproc)
{ $sourcepath = "$path/fonts/truetype/$vendor/$collection" }
@@ -566,7 +563,7 @@ if ($sourcepath eq "auto") # todo uppercase root
error ("unknown subpath ../fonts/afm/$vendor/$collection") unless -d $sourcepath }
error ("unknown source path $sourcepath") unless -d $sourcepath ;
-error ("unknown option $ARGV[0]") if ($ARGV[0] =~ /\-\-/) ;
+error ("unknown option $ARGV[0]") if (($ARGV[0]||'') =~ /\-\-/) ;
my $afmpath = "$fontroot/fonts/afm/$vendor/$collection" ;
my $tfmpath = "$fontroot/fonts/tfm/$vendor/$collection" ;
@@ -694,7 +691,7 @@ sub globafmfiles
}
return @files }
-if ($ARGV[0] ne "")
+if ($ARGV[0])
{ $pattern = $ARGV[0] ;
report ("processing files : all in pattern $ARGV[0]") ;
@files = globafmfiles($runpath,$pattern) }
@@ -760,7 +757,7 @@ if ($map)
print MAP "%\n" ;
print MAP "% Alternatively in your TeX source you can say:\n" ;
print MAP "%\n" ;
- print MAP "% \\pdfmapfile\{+$mapfile\}\n" ;
+ print MAP "% \\pdf \{+$mapfile\}\n" ;
print MAP "%\n" ;
print MAP "% In ConTeXt you can best use:\n" ;
print MAP "%\n" ;
@@ -906,7 +903,7 @@ foreach my $file (@files)
if ($afmpl)
{ report " generating pl : $cleanname$fontsuffix (from $cleanname)" ;
$encstr = " -p $encfil" ;
- my $command = "afm2pl $shape $passon $encstr $file $cleanname$fontsuffix.vpl" ;
+ my $command = "afm2pl -f afm2tfm $shape $passon $encstr $file $cleanname$fontsuffix.vpl" ;
print "$command\n" if $trace ;
my $ok = `$command` ;
if (open (TMP,"$cleanname$fontsuffix.map"))
diff --git a/scripts/context/ruby/xmltools.rb b/scripts/context/ruby/xmltools.rb
index b4a983c9c..c4fcc5937 100644
--- a/scripts/context/ruby/xmltools.rb
+++ b/scripts/context/ruby/xmltools.rb
@@ -35,7 +35,7 @@ class Commands
class << output
def xputs(str,n=0)
- puts("#{' '*n} #{str}")
+ puts("#{' '*n}#{str}")
end
end
@@ -170,7 +170,7 @@ class Commands
end
f.close
else
- report("missing data log file #{filename}")
+ report("missing data log file #{file}")
end
end
if png then
@@ -182,11 +182,11 @@ class Commands
system("imagemagick #{long}.pdf #{long}-%d.jpg")
end
else
- report("error in processing file #{filename}")
+ report("error in processing file #{file}")
end
system("texmfstart texutil --purge")
else
- report("error in processing file #{filename}")
+ report("error in processing file #{file}")
end
end
@@ -199,6 +199,9 @@ commandline = CommandLine.new
commandline.registeraction('dir', 'generate directory listing')
commandline.registeraction('mmlpages','generate graphic from mathml')
+# commandline.registeraction('dir', 'filename --pattern= --output= [--recurse --stripname --url --root]')
+# commandline.registeraction('mmlpages','filename [--eps --jpg --png --style= --mode=]')
+
commandline.registeraction('ls')
commandline.registeraction('help')
diff --git a/tex/context/base/colo-ini.tex b/tex/context/base/colo-ini.tex
index 60be87005..e0f476a49 100644
--- a/tex/context/base/colo-ini.tex
+++ b/tex/context/base/colo-ini.tex
@@ -16,7 +16,7 @@
%D To do: stroke versus fill color
%D 1000 100 10 -> constants
-%D Possible optimizaiton: store level in mark instead of name
+%D Possible optimization: store level in mark instead of name
\unprotect
@@ -232,12 +232,20 @@
\def\@@cl@@z{0}
\def\@@cl@@o{1}
+% \def\@@resetcolorparameters
+% {\let\@@cl@@r\@@cl@@z\let\@@cl@@g\@@cl@@z\let\@@cl@@b\@@cl@@z
+% \let\@@cl@@c\@@cl@@z\let\@@cl@@m\@@cl@@z\let\@@cl@@y\@@cl@@z\let\@@cl@@k\@@cl@@z
+% \let\@@cl@@s\@@cl@@z\let\@@cl@@p\@@cl@@o
+% \let\@@cl@@t\@@cl@@z\let\@@cl@@a\@@cl@@z
+% \let\@@cl@@h\empty \let\@@cl@@n\empty}
+
\def\@@resetcolorparameters
- {\let\@@cl@@r\@@cl@@z\let\@@cl@@g\@@cl@@z\let\@@cl@@b\@@cl@@z
- \let\@@cl@@c\@@cl@@z\let\@@cl@@m\@@cl@@z\let\@@cl@@y\@@cl@@z
- \let\@@cl@@k\@@cl@@z\let\@@cl@@s\@@cl@@z\let\@@cl@@p\@@cl@@o
- \let\@@cl@@t\@@cl@@z\let\@@cl@@a\@@cl@@z
- \let\@@cl@@h\empty \let\@@cl@@n\empty}
+ {\let\@@cl@@r\@@cl@@z \let\@@cl@@g\@@cl@@z \let\@@cl@@b\@@cl@@z
+ \let\@@cl@@c\@@cl@@z \let\@@cl@@m\@@cl@@z \let\@@cl@@y\@@cl@@z \let\@@cl@@k\@@cl@@z
+ \let\@@cl@@s\@@cl@@z
+ \let\@@cl@@p\@@cl@@o \let\@@cl@@n\empty \let\@@cl@@d\empty \let\@@cl@@f\@@cl@@o
+ \let\@@cl@@h\empty
+ \let\@@cl@@t\@@cl@@z \let\@@cl@@a\@@cl@@z}
\def\@@cl@@A{\@@cl@@a} % a hook for symbolic conversion, see below
@@ -263,7 +271,10 @@
\def\colorSpattern{0S:\@@cl@@s:\@@cl@@A:\@@cl@@t}
\def\colorCpattern{0C:\@@cl@@c:\@@cl@@m:\@@cl@@y:\@@cl@@k:\@@cl@@A:\@@cl@@t}
\def\colorRpattern{0R:\@@cl@@r:\@@cl@@g:\@@cl@@b:\@@cl@@A:\@@cl@@t}
-\def\colorPpattern{0P:\@@cl@@n:\@@cl@@p:\@@cl@@A:\@@cl@@t}
+
+%def\colorPpattern{0P:\@@cl@@n:\@@cl@@p:\@@cl@@A:\@@cl@@t}
+
+\def\colorPpattern{0P:\@@cl@@n:\@@cl@@f:\@@cl@@d:\@@cl@@p:\@@cl@@A:\@@cl@@t}
%D The extra 0 catches empty colors specs (needed for the
%D \type {\MPcolor} and \type {\PDFcolor} conversion (\type
@@ -342,22 +353,22 @@
%D New and experimental.
-\let\allspotcolors\empty
+\let\allspotcolors \empty
+\let\usedspotcolors \empty
+\let\usedcolorchannels\empty
\def\definespotcolor % [name] [color] [p=,t=,a=]
{\dotripleempty\dodefinespotcolor}
-\def\dodefinespotcolor[#1][#2][#3]%
+\def\dodefinespotcolor[#1][#2][#3]% todo: always global
{\doifnot{#1}{#2}
{\@@resetcolorparameters
\edef\@@cl@@n{#2}%
\getparameters[\??cl @@][#3]%
\doifnothing\@@cl@@p{\let\@@cl@@p\!!plusone}%
\doglobal\addtocommalist{#2}\allspotcolors
- \setevalue{\??cr#1}{\colorPpattern}%
- \setvalue{#1}{\switchtocolor[#1]}}}
-
-\let\usedspotcolors\empty
+ \setxvalue{\??cr#1}{\colorPpattern}% was \setevalue
+ \setgvalue{#1}{\switchtocolor[#1]}}} % was \setvalue
\def\registerusedspotcolors
{\ifx\allspotcolors\empty \else
@@ -370,8 +381,6 @@
\egroup
\fi}
-\let\usedcolorchannels\empty
-
\def\registerusedcolorchannels
{\bgroup
\doifdefinedelse{\??cs c}
@@ -393,6 +402,90 @@
\def\registerusedspotcolor#1%
{\global\@EA\chardef\csname\??cs#1\endcsname\zerocount}
+%D On top of spotcolors, we define multitone colors. You'd better know
+%D what you're doing because invalid definitions will lead to invalid
+%D documents (i.e.\ resources).
+
+% \definecolor [darkblue] [c=.5,m=.5]
+% \definecolor [darkyellow] [y=.5]
+%
+% \definemultitonecolor [whatever] [darkblue=.5,darkyellow=.5] [c=.25,m=.25,y=.25] [a=1,t=.5]
+% \definemultitonecolor [another] [darkblue=.5,darkyellow=.5] [c=.25,m=.25,y=.25]
+
+\def\definemultitonecolor
+ {\doquadrupleempty\dodefinemultitonecolor}
+
+\def\dodefinemultitonecolor[#1][#2][#3][#4]%
+ {\let\@@cl@@cl@@D\empty % n's
+ \let\@@cl@@cl@@P\empty % p's
+ \let\@@cl@@cl@@N\empty % name
+ \scratchcounter\zerocount
+ \processcommacommand[#2]\dododefinemultitonecolor
+ \bgroup
+ \lccode`\.=`\_\lccode`\,=`\_\lccode`\:=`\_\lccode`\;=`\_%
+ \lccode`\+=`\_\lccode`\-=`\_\lccode`\*=`\_\lccode`\/=`\_%
+ % not needed, other attribute in driver:
+ %
+ % \@@resetcolorparameters
+ % \getparameters[#4]%
+ % \ifx\@@cl@@t\@@cl@@z\else
+ % \edef\@@cl@@cl@@N{\@@cl@@cl@@N_\@@cl@@t_\@@cl@@a}%
+ % \fi
+ \lowercase\@EA{\@EA\xdef\@EA\multitonecolor\@EA{\@@cl@@cl@@N}}%
+ \egroup
+ \setxvalue{\??cl\multitonecolor\s!check}{\noexpand\docheckmultitonecolor{\@@cl@@cl@@D}}%
+ \expanded{\defineglobalcolor[\multitonecolor][#3,#4]}%
+ \expanded{\definespotcolor[#1][\multitonecolor][#4,f=\the\scratchcounter,p={\@@cl@@cl@@P},d={\@@cl@@cl@@D}]}}
+
+\def\docheckmultitonecolor#1%
+ {\flushatshipout
+ {\let\checkmultitonecolor\gobbleoneargument
+ \def\docommand##1{\hbox{\definecolor[\s!dummy-100][##1][p=1]\color[\s!dummy-100]}}%
+ \processcommalist[#1]\docommand}}
+
+\def\checkmultitonecolor#1%
+ {\getvalue{\??cl#1\s!check}\letgvalue{\??cl#1\s!check}\relax}
+
+\def\dodefinespotcolor[#1][#2][#3]% todo: always global
+ {\doifnot{#1}{#2}
+ {\@@resetcolorparameters
+ \edef\@@cl@@n{#2}%
+ \getparameters[\??cl @@][#3]%
+ \doifnothing\@@cl@@p{\let\@@cl@@p\!!plusone}%
+ \doglobal\addtocommalist{#2}\allspotcolors
+ \setxvalue{\??cr#1}{\colorPpattern}% was \setevalue
+ \setgvalue{#1}{\switchtocolor[#1]}}}% was \setvalue
+
+\def\dododefinemultitonecolor#1%
+ {\advance\scratchcounter\plusone
+ \splitstring#1\at=\to\!!stringa\and\!!stringb
+ \ifx\@@cl@@cl@@D\empty
+ \let\@@cl@@cl@@D\!!stringa
+ \let\@@cl@@cl@@P\!!stringb
+ \normalizecolor\!!stringb
+ \edef\@@cl@@cl@@N{\!!stringa_\!!stringb}%
+ \else
+ \edef\@@cl@@cl@@D{\@@cl@@cl@@D,\!!stringa}%
+ \edef\@@cl@@cl@@P{\@@cl@@cl@@P,\!!stringb}%
+ \normalizecolor\!!stringb
+ \edef\@@cl@@cl@@N{\@@cl@@cl@@N_\!!stringa_\!!stringb}%
+ \fi}
+
+% \def\dododefinemultitonecolor#1% a/b safe
+% {\advance\scratchcounter\plusone
+% \splitstring#1\at=\to\@@cl@@one\and\@@cl@@two
+% \ifx\@@cl@@cl@@D\empty
+% \let\@@cl@@cl@@D\@@cl@@one
+% \let\@@cl@@cl@@P\@@cl@@two
+% \normalizecolor\@@cl@@two
+% \edef\@@cl@@cl@@N{\@@cl@@one_\@@cl@@two}%
+% \else
+% \edef\@@cl@@cl@@D{\@@cl@@cl@@D,\@@cl@@one}%
+% \edef\@@cl@@cl@@P{\@@cl@@cl@@P,\@@cl@@two}%
+% \normalizecolor\@@cl@@two
+% \edef\@@cl@@cl@@N{\@@cl@@cl@@N_\@@cl@@one_\@@cl@@two}%
+% \fi}
+
%D We now redefine the color definition macro so that you
%D can define both normal and spotcolors.
@@ -403,7 +496,7 @@
{\ifthirdargument
\doifassignmentelse{#2}
{\dododefinecolor[#1][#2,#3]}% actually this is an error
- {\dodefinespotcolor[#1][#2][#3]}%
+ {\dodefinespotcolor[#1][#2][#3]}% and this the prefered method
\else
\dodefinecolor[#1][#2]%
\fi}
@@ -709,11 +802,35 @@
\doexeccolorgray
\exectransparency}
-\def\doexeccolorP#1:#2:%
+% \def\doexeccolorP#1:#2:%
+% {\edef\@@cl@@n{#1}%
+% \edef\@@cl@@p{#2}%
+% \registerusedspotcolor\@@cl@@n
+% \ifSPOTsupported
+% \dowithcolor\registerspotcolor\@@cl@@n
+% \dostartspotcolormode\@@cl@@n\@@cl@@p
+% \else
+% \doingspotcolortrue
+% \let\spotcolorfactor\@@cl@@p
+% \factorizecolortrue % using counter and array
+% \dowithcolor\execcolorRCSP\@@cl@@n
+% \factorizecolorfalse
+% \let\spotcolorfactor\@@cl@@o
+% \doingspotcolorfalse
+% \fi
+% \exectransparency}
+
+\def\doexeccolorP#1:#2:#3:#4:%
{\edef\@@cl@@n{#1}%
- \edef\@@cl@@p{#2}%
+ \edef\@@cl@@f{#2}%
+ \edef\@@cl@@d{#3}%
+ \edef\@@cl@@p{#4}%
+ \ifx\@@cl@@d\empty
+ \let\@@cl@@d\@@cl@@n
+ \fi
\registerusedspotcolor\@@cl@@n
\ifSPOTsupported
+ \checkmultitonecolor\@@cl@@n
\dowithcolor\registerspotcolor\@@cl@@n
\dostartspotcolormode\@@cl@@n\@@cl@@p
\else
@@ -727,17 +844,19 @@
\fi
\exectransparency}
-% \def\doexeccolorPP#1:#2:%
-% {\edef\@@cl@@n{#1}%
-% \edef\@@cl@@p{#2}%
-% \registerusedspotcolor\@@cl@@n
-% \ifx\@@cl@@n\currentspotcolor
-% \normalizeSPOT
-% \dostartgraycolormode\@@cl@@p % was spotcolormode
-% \else
-% \dostartgraycolormode\@@cl@@o
-% \fi
-% \exectransparency}
+\def\doexeccolorPindex#1:#2:#3:#4:%
+ {\edef\@@cl@@n{#1}%
+ \edef\@@cl@@f{#2}%
+ \edef\@@cl@@d{#3}%
+ \edef\@@cl@@p{#4}%
+ \ifx\@@cl@@d\empty
+ \let\@@cl@@d\@@cl@@n
+ \fi
+ \ifSPOTsupported
+ \checkmultitonecolor\@@cl@@n
+ \dowithcolor\registerindexcolor\@@cl@@n
+ \fi
+ \noexectransparency}
\def\doexeccolorPP#1:#2:%
{\edef\@@cl@@n{#1}%
@@ -840,8 +959,12 @@
{\edef\@@cl@@s{#1}%
\dohidecolor\@@cl@@s\@@cl@@o}
-\def\noexeccolorP#1:#2:#3\od
- {\edef\@@cl@@p{#2}%
+% \def\noexeccolorP#1:#2:#3\od
+% {\edef\@@cl@@p{#2}%
+% \dohidecolor\@@cl@@p\@@cl@@z}
+
+\def\noexeccolorP#1:#2:#3:#4:#5\od
+ {\edef\@@cl@@p{#4}%
\dohidecolor\@@cl@@p\@@cl@@z}
%D For the sake of postprocessing (i.e.\ color separation)
@@ -912,29 +1035,86 @@
%D We need to register spot colors (i.e.\ resources need to
%D be created.
+% \def\registerspotcolor#1:%
+% {\ifundefined{\??cl:\c!p:\@@cl@@n}%
+% \letgvalue{\??cl:\c!p:\@@cl@@n}\empty
+% %\@EA\@EA\csname registerspotcolor#1\endcsname
+% \csname registerspotcolor#1\@EA\endcsname
+% \else
+% \@EA\dontregisterspotcolor
+% \fi}
+
\def\registerspotcolor#1:%
{\ifundefined{\??cl:\c!p:\@@cl@@n}%
\letgvalue{\??cl:\c!p:\@@cl@@n}\empty
%\@EA\@EA\csname registerspotcolor#1\endcsname
\csname registerspotcolor#1\@EA\endcsname
\else
- \@EA\dontregistersplotcolor
+ \@EA\dontregisterspotcolor
\fi}
-\def\dontregistersplotcolor#1\od
- {}
+% \def\dontregisterspotcolor #1\od{}
+% \def\registerspotcolorR #1:#2:#3:#4\od{\doregisterrgbspotcolor \@@cl@@n{#1}{#2}{#3}}
+% \def\registerspotcolorC#1:#2:#3:#4:#5\od{\doregistercmykspotcolor\@@cl@@n{#1}{#2}{#3}{#4}}
+% \def\registerspotcolorS #1:#2\od{\doregistergrayspotcolor\@@cl@@n{#1}}
+% \def\registerspotcolorP #1:#2:#3\od{\doregistergrayspotcolor\@@cl@@n{#2}}
-\def\registerspotcolorR#1:#2:#3:#4\od
- {\doregisterrgbspotcolor\@@cl@@n{#1}{#2}{#3}}
+\def\dontregisterspotcolor #1\od{}
+\def\registerspotcolorR #1:#2:#3:#4\od{\doregisterrgbspotcolor \@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}{#2}{#3}}
+\def\registerspotcolorC#1:#2:#3:#4:#5\od{\doregistercmykspotcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}{#2}{#3}{#4}}
+\def\registerspotcolorS #1:#2\od{\doregistergrayspotcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}}
+\def\registerspotcolorP #1:#2:#3\od{\doregistergrayspotcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#2}}
-\def\registerspotcolorC#1:#2:#3:#4:#5\od
- {\doregistercmykspotcolor\@@cl@@n{#1}{#2}{#3}{#4}}
+%D Experimental feature:
-\def\registerspotcolorS#1:#2\od
- {\doregistergrayspotcolor\@@cl@@n{#1}}
+% \definecolor [darkblue] [c=1,m=.38,y=0,k=.64] % pantone pms 2965 uncoated m
+% \definecolor [darkyellow] [c=0,m=.28,y=1,k=.06] % pantone pms 124 uncoated m
+%
+% \definecolor [darkblue-50] [darkblue] [p=.5]
+% \definecolor [darkyellow-50] [darkyellow] [p=.5]
+% \definecolor [darkblue-80] [darkblue] [p=.8]
+% \definecolor [darkyellow-80] [darkyellow] [p=.8]
+%
+% \definecolor [darkblue,darkyellow] [r=.8]
+% \definecolor [darkdull-5030] [darkblue,darkyellow] [p={.5,.3}]
+%
+% \setupcolors[state=start]
+%
+% \blackrule[width=4cm,height=3cm,color=darkblue-50]
+% \blackrule[width=4cm,height=3cm,color=darkblue-80]
+% \blackrule[width=4cm,height=3cm,color=darkyellow-50]
+% \blackrule[width=4cm,height=3cm,color=darkyellow-80]
+% \blackrule[width=4cm,height=3cm,color=darkdull-5030]
+
+%D Experimental too (special purpose code).
+
+\def\registerindexcolor#1:%
+ {\ifundefined{\??cl:i:\@@cl@@n}%
+ \letgvalue{\??cl:i:\@@cl@@n}\empty % signal
+ \writestatus\m!colors{registering index color \@@cl@@n}%
+ \@EA\@EA\csname registerindexcolor#1\endcsname
+ \else
+ \@EA\dontregisterindexcolor
+ \fi}
+
+\let\dontregisterindexcolor\dontregisterspotcolor
+
+\def\registerindexcolorR #1:#2:#3:#4\od{\doregisterrgbindexcolor \@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}{#2}{#3}}
+\def\registerindexcolorC#1:#2:#3:#4:#5\od{\doregistercmykindexcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}{#2}{#3}{#4}}
+\def\registerindexcolorS #1:#2\od{\doregistergrayindexcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}}
+\def\registerindexcolorP #1:#2:#3\od{\doregistergrayindexcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#2}}
+
+\def\predefinecolor[#1]%
+ {\bgroup
+ \flushatshipout{\hbox{\localcolortrue\color[#1]}}% real ones
+ \egroup}
-\def\registerspotcolorP#1:#2:#3\od
- {\doregistergrayspotcolor\@@cl@@n{#2}}
+\def\predefineindexcolor[#1]%
+ {\bgroup
+ \flushatshipout{\hbox{\localcolortrue\color[#1]}}% real ones
+ \let\doexeccolorP\doexeccolorPindex
+ \flushatshipout{\hbox{\localcolortrue\color[#1]}}% index one
+ \egroup}
%D Transparency is handled similar for all three color modes. We
%D can turn transparency off with the following switch:
@@ -1900,7 +2080,10 @@
\def\doformatgrayS#1:#2:#3\od
{\dodoformatcolor{#1}}
-\def\doformatgrayP#1:#2:#3:#4\od
+% \def\doformatgrayP#1:#2:#3:#4\od
+% {\dowithcolor\doformatcolor{#1}}
+
+\def\doformatgrayP#1:#2:#3:#4:#5:#6\od
{\dowithcolor\doformatcolor{#1}}
\def\doformatgray#1:%
@@ -2344,11 +2527,17 @@
\def\doMPcmykN#1:#2:#3:#4:#5\end#6\end
{\doMPtransparent{\cmykASrgbMP(#1,#2,#3,#4,#6)}#5\end}
-\def\doMPspotY#1:#2:#3\end#4\end
- {\doMPtransparent{\spotMP("#1",#2)}#3\end}
+% \def\doMPspotY#1:#2:#3\end#4\end
+% {\doMPtransparent{\spotMP("#1",#2)}#3\end}
+%
+% \def\doMPspotN#1:#2:#3\end#4\end
+% {\scaledMPcolor{#2}{#1}}
+
+\def\doMPspotY#1:#2:#3:#4:#5\end#6\end % best make #3 same as #1 when empty
+ {\doMPtransparent{multitonecolor("#1",#2,"#3","#4")}#5\end}
-\def\doMPspotN#1:#2:#3\end#4\end
- {\scaledMPcolor{#2}{#1}}
+\def\doMPspotN#1:#2:#3:#4:#5\end#6\end
+ {\scaledMPcolor{#4}{#1}}
\def\doMPblack#1\end#2\end
{\unknownMPcolor}
@@ -2361,36 +2550,55 @@
%D
%D Similar alternatives are avaliable for \PDF:
-\def\PDFcolor#1%
- {\handlecolorwith\doPDFcolor\csname\??cr#1\endcsname:::::::\end}
+\def\PDFcolor #1{\handlecolorwith\doPDFcolor \csname\??cr#1\endcsname:::::::\end}
+\def\PDFcolorvalue#1{\handlecolorwith\doPDFcolorvalue\csname\??cr#1\endcsname:::::::\end}
+\def\FDFcolor #1{\handlecolorwith\doFDFcolor \csname\??cr#1\endcsname:::::::\end}
+
+% \def\doPDFcolor#1:#2:#3:#4:#5:#6:#7:#8\end
+% {\if #1R#2 #3 #4 rg%
+% \else\if#1C#2 #3 #4 #5 k%
+% \else\if#1S#2 g%
+% \else\if#1P#3 g% todo
+% \else 0 g%
+% \fi\fi\fi\fi}
+%
+% \def\doPDFcolorvalue#1:#2:#3:#4:#5:#6:#7:#8\end
+% {\if #1R#2 #3 #4%
+% \else\if#1C#2 #3 #4 #5%
+% \else\if#1S#2%
+% \else\if#1P#3%
+% \else 0%
+% \fi\fi\fi\fi}
+%
+% \def\doFDFcolor#1:#2:#3:#4:#5:#6:#7:#8\end
+% {[\if #1R#2 #3 #4%
+% \else\if#1C#2 #3 #4 #5%
+% \else\if#1S#2%
+% \else\if#1P#3% todo
+% \else 0%
+% \fi\fi\fi\fi]}
\def\doPDFcolor#1:#2:#3:#4:#5:#6:#7:#8\end
{\if #1R#2 #3 #4 rg%
\else\if#1C#2 #3 #4 #5 k%
\else\if#1S#2 g%
- \else\if#1P#3 g% todo
+ \else\if#1P#5 g%
\else 0 g%
\fi\fi\fi\fi}
-\def\PDFcolorvalue#1%
- {\handlecolorwith\doPDFcolorvalue\csname\??cr#1\endcsname:::::::\end}
-
\def\doPDFcolorvalue#1:#2:#3:#4:#5:#6:#7:#8\end
{\if #1R#2 #3 #4%
\else\if#1C#2 #3 #4 #5%
\else\if#1S#2%
- \else\if#1P#3%
+ \else\if#1P#5%
\else 0%
\fi\fi\fi\fi}
-\def\FDFcolor#1%
- {\handlecolorwith\doFDFcolor\csname\??cr#1\endcsname:::::::\end}
-
\def\doFDFcolor#1:#2:#3:#4:#5:#6:#7:#8\end
{[\if #1R#2 #3 #4%
\else\if#1C#2 #3 #4 #5%
\else\if#1S#2%
- \else\if#1P#3% todo
+ \else\if#1P#5%
\else 0%
\fi\fi\fi\fi]}
diff --git a/tex/context/base/cont-fil.tex b/tex/context/base/cont-fil.tex
index 8cd6a5639..fa4d567b9 100644
--- a/tex/context/base/cont-fil.tex
+++ b/tex/context/base/cont-fil.tex
@@ -26,6 +26,8 @@
%definefilesynonym [sch-base] [sch-00]
%definefilesynonym [sch-make] [sch-01]
+\definefilesynonym [dir-make] [dir-01]
+
\definefilesynonym [xml-format] [xml-01]
\definefilesynonym [xml-pretty] [xml-02]
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index c156137f9..055b12317 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -21,17 +21,73 @@
\writestatus{\m!systems}{beware: some patches loaded from cont-new.tex!}
-\def\doifelsefontsynonym#1%
- {\ifcsname\??ff\fontclass#1\endcsname
- \expandafter\firstoftwoarguments
- \else
- \expandafter\secondoftwoarguments
- \fi}
+% \definemarkedpage[nobackgrounds]
+% \markpage[nobackgrounds]
+% \doifmarkedpageelse{nobackgrounds}
+
+\def\gettwopassdatalist#1%
+ {\loadtwopassdata
+ \letcscsname\twopassdatalist\csname#1:\s!list\endcsname
+ \ifx\twopassdatalist\relax\let\twopassdatalist\empty\fi}
+
+\newcounter\nofmarkedpages
+
+\def\definemarkedpage[#1]%
+ {\definetwopasslist{\v!pagina:#1}}
-\def\expandfontsynonym#1#2% #2 := onelevelexpansion(#1)
- {\ifcsname\??ff\fontclass#2\endcsname
- \expandafter\def\expandafter#1\expandafter{\csname\??ff\fontclass#2\endcsname}%
+\def\markpage[#1]% looks very much like domarginreference and doparagraphreference
+ {\iftrialtypesetting\else
+ \doglobal\increment\nofmarkedpages\relax
+ \edef\writeparref%
+ {\writeutilitycommand%
+ {\twopassentry%
+ {\v!pagina:#1}%
+ {\nofmarkedpages}%
+ {\noexpand\realfolio}}}%
+ \writeparref
\fi}
+
+\def\doifmarkedpageelse#1%
+ {\gettwopassdatalist{\v!pagina:#1}%
+ \expanded{\doifinsetelse{\realfolio}{\twopassdatalist}}}
+
+% Just a simple and fast hanger, for usage in macros.
+
+\def\setuphanging
+ {\dodoubleempty\getparameters[\??ha]}
+
+\setuphanging
+ [\c!afstand=.5em]
+
+\def\starthanging
+ {\noindent\bgroup
+ \dowithnextbox
+ {\setbox\nextbox\hbox{\flushnextbox\hskip\@@haafstand}%
+ \hangindent\nextboxwd
+ \hangafter\plusone
+ \flushnextbox\ignorespaces}
+ \hbox}
+
+\def\stophanging
+ {\endgraf
+ \egroup}
+
+\def\modevalue#1#2#3%
+ {\@EA\ifx\csname\@mode@\systemmodeprefix#1\endcsname\endcsname\enabledmode#2\else#2\fi}
+
+\def\systemmodevalue#1%
+ {\modevalue{\systemmodeprefix#1}}
+
+% \getmulticolumnlines -> now in cont-loc, to be tested and really needed
+
+\def\naturaltextext#1\relax
+ {\bgroup
+ \prettynaturalfont
+ \def\ascii{#1}%
+ \setnormalcatcodes
+ \restorecatcodes
+ \scantokens\expandafter{\ascii}\ifhmode\unskip\fi
+ \egroup}
\long\def\startprocesscommalist[#1]#2\stopprocesscommalist
{\long\def\currentcommalistcommand##1{\def\currentcommalistitem{##1}#2}%
@@ -42,88 +98,6 @@
\tracefonthandlingtrue
-% \def\resetXMLelement[#1]% handy in case only singular
-% {\@EA\let\csname\@@XMLelement:#1\endcsname \donothing
-% \@EA\let\csname\@@XMLelement:/#1\endcsname\donothing
-% \@EA\let\csname\@@XMLelement:#1/\endcsname\donothing}
-%
-% is the same as:
-
-\def\resetXMLelement[#1]{\dododefineXMLprocess{#1}}
-
-\let\dorecalculatelayout\recalculatelayout
-
-\def\recalculatelayout
- {\doifsomething{\layoutparameter\c!pagina\layoutparameter\c!papier}
- {\dododosetuppapersize[\layoutparameter\c!pagina][\layoutparameter\c!papier]}%
- \dorecalculatelayout}
-
-\def\dodosetuppapersize[#1][#2]%
- {\ifsecondargument
- \dododosetuppapersize[#1][#2]%
- \calculatehsizes
- \calculatevsizes
- \recalculatelogos
- \recalculatebackgrounds
- \recalculatelayout
- \else\iffirstargument
- \setuppapersize[#1][#2]%
- \else\ifx\papersize\undefined\else
- \restorepapersize
- \fi\fi\fi}
-
-\def\dododosetuppapersize[#1][#2]%
- {\xdef\restorepapersize
- {\noexpand\setuppapersize[#1][#2]}%
- \dostelpapierrichtingin{#1}\paperlandscape\paperrotation\paperreverse\papermirror
- \dostelpapierrichtingin{#2}\printlandscape\printrotation\printreverse\printmirror
- \def\docommando##1%
- {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
- {\global\papierbreedte\getvalue{\??pp##1\c!breedte}%
- \global\papierhoogte\getvalue{\??pp##1\c!hoogte}%
- \calculatepaperoffsets{##1}%
- \xdef\papersize{##1}}}}%
- \processcommacommand[#1]\docommando
- \doifdefinedelse{\??pp#1\c!schaal}
- {\edef\paperscale{\getvalue{\??pp#1\c!schaal}}}
- {\edef\paperscale{1}}%
- \def\docommando##1%
- {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
- {\global\printpapierbreedte\getvalue{\??pp##1\c!breedte}%
- \global\printpapierhoogte\getvalue{\??pp##1\c!hoogte}%
- \xdef\printpapersize{##1}}}}%
- \processcommacommand[#2]\docommando
- \global\setdimentoatleast\papierbreedte \onepoint
- \global\setdimentoatleast\papierhoogte \onepoint
- \global\setdimentoatleast\printpapierbreedte\onepoint
- \global\setdimentoatleast\printpapierhoogte \onepoint
- \ifcase\paperlandscape\else
- \doglobal\swapdimens\papierbreedte\papierhoogte
- \fi
- \ifcase\printlandscape\else
- \doglobal\swapdimens\printpapierbreedte\printpapierhoogte
- \fi
- % this check can be confusing, so we've added the possibility
- % to bypass this test: \setuppapersize[option=fit]
- \doif\@@ppoptie\v!max % \v!fit is
- {\bgroup
- % we need to pre-swap else we get the wrong paper size
- \doifinset\paperrotation{90,270}{\swapdimens\papierbreedte\papierhoogte}%
- \doifinset\printrotation{90,270}{\swapdimens\printpapierbreedte\printpapierhoogte}%
- \ifdim\papierhoogte>\printpapierhoogte
- \global\printpapierhoogte\papierhoogte
- \writestatus\m!systems{print height forced to paper height}%
- \fi
- \ifdim\papierbreedte>\printpapierbreedte
- \global\printpapierbreedte\papierbreedte
- \writestatus\m!systems{print width forced to paper width}%
- \fi
- \egroup}}
-
-\setuplayout
- [\c!papier=,
- \c!pagina=]
-
\def\parseTR[#1][#2]% [#2] is dummy that kills spaces / no #3 argument
{\def\currentcol{0}\increment\maximumrow
\let\currentcolpos\currentcol
@@ -212,52 +186,6 @@
\egroup
-\def\complexdozieregister[#1]#2#3%
- {\begingroup
- \thisisnextinternal\s!ind
- \ifduplicate\getlastregisterentry{#2}\fi
- \convertexpanded{\??id\currentregister}{#2}\asciiregisterentryA
- \convertexpanded{\??id\currentregister}{#3}\asciiregisterentryB
- \makesectionformat
- \edef\schrijfwegnaarregister%
- {\writeutility%
- {r s %
- {\currentregister} %
- {\nextinternalreference} %
- {#1} %
- {\asciiregisterentryA} %
- {\asciiregisterentryB} %
- {\sectionformat}}}%
- \schrijfwegnaarregister
- \endgroup
- \registerinfo{> zie}{#2}%
- \GotoPar}
-
-\def\dodododoinatreference#1#2#3[#4]% \removeunwantedspaces added june 2004
- {\ifx\next\bgroup
- \dododododoinatreference
- % fails on metafun {\leftofreference#1\ignorespaces#3\removeunwantedspaces\rightofreference}{#2}[#4]%
- {\leftofreference#1\ignorespaces#3\rightofreference}{#2}[#4]%
- \else
- \dododododoinatreference
- {\leftofreference#1\rightofreference}{#2#3}[#4]%
- \fi}
-
-\dostepwiserecurse{0}{9}{1}{\setevalue{@@uc@@\recurselevel}{\recurselevel}}
-
-\setvalue{@@uc@@a}{A} \setvalue{@@uc@@A}{A}
-\setvalue{@@uc@@b}{B} \setvalue{@@uc@@B}{B}
-\setvalue{@@uc@@c}{C} \setvalue{@@uc@@C}{C}
-\setvalue{@@uc@@d}{D} \setvalue{@@uc@@D}{D}
-\setvalue{@@uc@@e}{E} \setvalue{@@uc@@E}{E}
-\setvalue{@@uc@@f}{F} \setvalue{@@uc@@F}{F}
-
-\def\hexstringtonumber#1% {FF}
- {\dohexstringtonumber#1}
-
-\def\dohexstringtonumber#1#2% FF
- {"\csname @@uc@@#1\endcsname\csname @@uc@@#2\endcsname}
-
% \def\doshowpardata#1#2{\hbox{\string#1: \the#2}\endgraf}
%
% \def\showpardata
@@ -386,44 +314,6 @@
%
% \endETEX
-\def\OTRONEdocheckiffloatfits % vervangen ivm downward comp
- {\ifnofloatpermitted
- \global\roomforfloatfalse
- \else
- % new per 31/5/2004, should be an option, only one column mode
- \begingroup
- \scratchdimen\pagetotal
- \advance\scratchdimen\lineheight % maybe strutheight
- \ifdim\scratchdimen>\pagegoal
- \goodbreak % hack ? needed in icare-az
- \fi
- % should be an option
- \endgroup
- \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
- \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
- \fi
- \fi}
-
% cleaner
%
% \long\def\doMPTEXcheck#1%
@@ -452,123 +342,6 @@
% \the\MPTEXgrapicchecks\relax % \relax is end condition!
% \fi}
-\def\endmulticolumns
- {%\par
- \vskip\lineheight\vskip-\lineheight % take footnotes into account
- \dontshowcomposition
- \doflushcolumnfloat % added recently
- %\doflushcolumnfloats % no, since it results in wrong top floats
- \flushnotes % before start of columns
- \par
- \ifbalancecolumns
- \global\output{\continuousmulticolumnsout}%
- \goodbreak
- \global\output{\balancedmulticolumnsout}%
- \else
- \goodbreak
- \fi
- \eject % the prevdepth is important, try e.g. toclist in
- \prevdepth\zeropoint % columns before some noncolumned text text
- \global\output\singlecolumnout
- \global\output{\the\mainoutput}% % % % % todo
- \ifvoid\precolumnbox\else
- \unvbox\precolumnbox
- \fi
- \global\precolumnboxheight\zeropoint
- \endgroup % here
- \nofcolumns\plusone
- \setvsize % the outer one!
- \synchronizeoutput % new may 2004 / we need to: \pagegoal\vsize
- \checkendcolumnfootnotes
- \dosomebreak\allowbreak
- \restoresavedfloats}
-
-% this one already catches both define/setup
-
-\def\setupbodyfontenvironment{\definebodyfontenvironment}
-
-% officially, but not needed (yet):
-%
-% \def\dosetupbodyfontenvironment[#1][#2][#3]% class size settings
-% {\ifthirdargument
-% \localbodyfontsize#2\relax
-% \normalizebodyfontsize\localbodyfontsize\to\normalizedbodyfontsize
-% \doifundefinedelse{\??ft#1\normalizedbodyfontsize\c!em}
-% {\definebodyfontenvironment[#1][#2][#3]}%
-% {\getparameters[\??ft#1\normalizedbodyfontsize][#3]}%
-% \else
-% \localbodyfontsize#1\relax
-% \normalizebodyfontsize\localbodyfontsize\to\normalizedbodyfontsize
-% \doifundefinedelse{\??ft\normalizedbodyfontsize\c!em}
-% {\definebodyfontenvironment[#1][#2]}%
-% {\getparameters[\??ft\normalizedbodyfontsize][#2]}%
-% \fi}
-
-\def\dogetobject#1#2#3#4#5#6#7%
- {\initializepaper
- \forgetall
- \dontshowcomposition
- \setbox\scratchbox\vbox
- {\doinsertobject{#1}{#2}}%
- \setbox\scratchbox#3%
- {\vbox to #5\scaledpoint
- {\ifdim\ht\scratchbox>#5\scaledpoint
- \vss\hbox to #4\scaledpoint{\hss\box\scratchbox\hss}\vss
- \else\ifdim\wd\scratchbox>#4\scaledpoint
- \vss\hbox to #4\scaledpoint{\hss\box\scratchbox\hss}\vss
- \else
- \vss\box\scratchbox
- \fi\fi}}%
- \box\scratchbox
- \elabelgroup}
-
-% todo: make it work in balancing
-%
-% \definemarking[vers][]
-% \setupheadertexts
-% [\doiftext{\getmarking[vers][first]}
-% {\doiftextelse{\getmarking[vers][column:last]}
-% {\getmarking[vers][first] -- \getmarking[vers][column:last]}
-% {\getmarking[vers][first]}}]
-% \starttext
-% \startcolumns[n=2,balance=no]
-% \dorecurse{10}{\expanded{\marking[vers]{\recurselevel}} \recurselevel:\dorecurse{4}{\input ward } \endgraf}
-% \stopcolumns
-% \stoptext
-
-\letvalue{\??mk\??mk\v!kolom:\v!eerste }\getsplitfirstmark
-\letvalue{\??mk\??mk\v!kolom:\v!laatste}\getsplitbottommark
-
-% \definemarkedpage[nobackgrounds]
-% \markpage[nobackgrounds]
-% \doifmarkedpageelse{nobackgrounds}
-
-\def\gettwopassdatalist#1%
- {\loadtwopassdata
- \letcscsname\twopassdatalist\csname#1:\s!list\endcsname
- \ifx\twopassdatalist\relax\let\twopassdatalist\empty\fi}
-
-\newcounter\nofmarkedpages
-
-\def\definemarkedpage[#1]%
- {\definetwopasslist{\v!pagina:#1}}
-
-\def\markpage[#1]% looks very much like domarginreference and doparagraphreference
- {\iftrialtypesetting\else
- \doglobal\increment\nofmarkedpages\relax
- \edef\writeparref%
- {\writeutilitycommand%
- {\twopassentry%
- {\v!pagina:#1}%
- {\nofmarkedpages}%
- {\noexpand\realfolio}}}%
- \writeparref
- \fi}
-
-\def\doifmarkedpageelse#1%
- {\gettwopassdatalist{\v!pagina:#1}%
- \expanded{\doifinsetelse{\realfolio}{\twopassdatalist}}}
-
% no, wrong! never!
%
% \def\tightlayer[#1]%
@@ -593,15 +366,6 @@
{\processcommacommand[.,\allinputpaths]\docommando}%
\fi}
-\def\setfontstrut
- {\setcharstrut{(gplQT}}
-
-\def\doifXMLtextelse#1%
- {\doiftextelse{\simplifyXMLelements#1}}
-
-\def\doifXMLtext#1#2%
- {\doiftextelse{\simplifyXMLelements#1}{#2}\donothing}
-
% todo : share symbols
% \definecolor[rollover:n][red]
@@ -1274,27 +1038,6 @@
{\endgraf\verticalstrut\endgraf\kern-2\lineheight
\egroup}
-% Just a simple and fast hanger, for usage in macros.
-
-\def\setuphanging
- {\dodoubleempty\getparameters[\??ha]}
-
-\setuphanging
- [\c!afstand=.5em]
-
-\def\starthanging
- {\noindent\bgroup
- \dowithnextbox
- {\setbox\nextbox\hbox{\flushnextbox\hskip\@@haafstand}%
- \hangindent\nextboxwd
- \hangafter\plusone
- \flushnextbox\ignorespaces}
- \hbox}
-
-\def\stophanging
- {\endgraf
- \egroup}
-
\def\definepushbutton % name optional setup
{\dodoubleempty\dodefinepushbutton}
@@ -1782,8 +1525,8 @@
% \the\@@everyparagraphtoks}
\def\doinsertparagraphintro
- {%\begingroup
- %\everypar\emptytoks
+ {\begingroup
+ \everypar\emptytoks
\ifcase\everyparagraphintro\relax
% no data
\@@everyparagraphtoks\emptytoks
@@ -1797,7 +1540,7 @@
\@@everyparagraphtoks\everynextparagraphintro
\fi
\the\@@everyparagraphtoks
- }%\endgroup}
+ \endgroup}
\def\insertparagraphintro
{\ifcase\everyparagraphintro\else\@EA\doinsertparagraphintro\fi}
diff --git a/tex/context/base/cont-usr.ori b/tex/context/base/cont-usr.ori
index 22b8a63f5..6c6c2f121 100644
--- a/tex/context/base/cont-usr.ori
+++ b/tex/context/base/cont-usr.ori
@@ -50,7 +50,17 @@
\definefilesynonym [lang-tr.pat] [trhyph.tex]
\definefilesynonym [lang-ua.pat] [ukrenhyp.tex]
\definefilesynonym [lang-uk.pat] [ukhyphen.tex]
-\definefilesynonym [lang-us.pat] [ushyph1.tex]
+\definefilesynonym [lang-us.pat] [ushyph.tex]
+
+%D Ah, something changed in 2003 with respect to ushyph.tex, so let's
+%D fall back when needed. I first noticed this during a workshop at the
+%D practical tex conference 2004 in sf. Yet another proof of a mess in
+%D filenames.
+
+ \doiffileelse{ushyph.tex} {\definefilesynonym[lang-us.pat][ushyph.tex]}
+{\doiffileelse{ushyph1.tex} {\definefilesynonym[lang-us.pat][ushyph1.tex]}
+{\doiffileelse{ushyph2.tex} {\definefilesynonym[lang-us.pat][ushyph2.tex]}
+ {\definefilesynonym[lang-us.pat][ukhyph.tex]}}}
%D When the dutch spelling changed, new patterns were
%D constructed. For long these were named \type {dutch96.pat}.
@@ -60,11 +70,9 @@
%D files as well as their coding is one of the dark areas of
%D \TEX\ distributions.
-\doiffileelse{nehyph96.tex}
- {\definefilesynonym[lang-nl.pat][nehyph96.tex]}
- {\doiffileelse{dutch96.pat}
- {\definefilesynonym[lang-nl.pat][dutch96.pat]}
- {\definefilesynonym[lang-nl.pat][nehyph.tex]}}
+ \doiffileelse{nehyph96.tex} {\definefilesynonym[lang-nl.pat][nehyph96.tex]}
+{\doiffileelse{dutch96.pat} {\definefilesynonym[lang-nl.pat][dutch96.pat]}
+ {\definefilesynonym[lang-nl.pat][nehyph.tex]}}
%D Pattern files are (can be) encoded! And, alas, not all
%D pattern files are self contained, which is why (for the
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index e2a4ff29e..ec535265a 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -15,7 +15,7 @@
\catcode`\{=1 \catcode`\}=2
-\def\contextversion{2004.6.30}
+\def\contextversion{2004.8.15}
%D Welcome to the main module. When this module is ran through
%D \type{initex} or \type{tex -i} or \type{whatevertex} using
@@ -141,6 +141,7 @@
\input spec-mis.tex
\input spec-ini.tex
\input spec-def.tex
+\input spec-var.tex
%D For the moment we load a lot of languages. In the future
%D we'll have to be more space conservative.
diff --git a/tex/context/base/core-box.tex b/tex/context/base/core-box.tex
index 9ee21e7a6..f9d30c43e 100644
--- a/tex/context/base/core-box.tex
+++ b/tex/context/base/core-box.tex
@@ -718,6 +718,21 @@
\setvalue{\??ab\??ab bl}{\bottomleftbox}
\setvalue{\??ab\??ab tr}{\toprightbox}
\setvalue{\??ab\??ab br}{\bottomrightbox}
+
+\setvalue{\??ab\??ab m}{\middlebox}
+
+% The next ones were desparately needed by Vit Zyka (see
+% \type {supp-box} for definitions).
+
+\setvalue{\??ab\??ab g}{\baselinemiddlebox}
+\setvalue{\??ab\??ab gl}{\baselineleftbox}
+\setvalue{\??ab\??ab gc}{\baselinemiddlebox}
+\setvalue{\??ab\??ab gr}{\baselinerightbox}
+
+\setvalue{\??ab\??ab \v!regel }{\baselinemiddlebox} % \v!grid is taken
+\setvalue{\??ab\??ab \v!regel\v!links }{\baselineleftbox}
+\setvalue{\??ab\??ab \v!regel\v!midden}{\baselinemiddlebox}
+\setvalue{\??ab\??ab \v!regel\v!rechts}{\baselinerightbox}
\def\offsetbox
{\dodoubleempty\dooffsetbox[]}
diff --git a/tex/context/base/core-fig.tex b/tex/context/base/core-fig.tex
index 37b22bd40..143dec45b 100644
--- a/tex/context/base/core-fig.tex
+++ b/tex/context/base/core-fig.tex
@@ -987,18 +987,21 @@
\getparameters
[\??ef]
[\c!type=\s!unknown,\c!methode=\@@eftype,\c!symbool=\v!nee,
- \c!object=\@@exobject,\c!preset=\v!ja,
+ \c!object=\@@exobject,\c!preset=\v!ja,\c!splitsen=,\c!formaat=,
\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!grid=,
%\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
+ \doifinsetelse\@@efformaat{mediabox,cropbox,artbox,bleedbox,trimbox}
+ {\let\@@DriverImageBox\@@efformaat}%
+ {\let\@@DriverImageBox\empty}%
% new, color separation
\doifseparatingcolorselse
{\let\@@efvoorgrondkleur\empty
@@ -1212,6 +1215,7 @@
\doifelse\@@efobject\v!nee
\donefalse
{\doifobjectssupportedelse\donetrue\donefalse}%
+ % this (for the moment) conveniently maps onto pdf which saves mapping
\ifdone
\doifobjectfoundelse{FIG}\@@efobjectname
\donothing
diff --git a/tex/context/base/core-int.tex b/tex/context/base/core-int.tex
index af6dcf792..2a9899095 100644
--- a/tex/context/base/core-int.tex
+++ b/tex/context/base/core-int.tex
@@ -2218,11 +2218,15 @@
{\let\@@ccopen \!!plusone}{\let\@@ccopen \!!zerocount}%
\doifelse\@@ccoptie\v!buffer
{\let\@@cccollect\!!plusone}{\let\@@cccollect\!!zerocount}%
+ \preparecommentvariables
\doinsertcomment
\@@cctitel\!!widtha\!!heighta
\@@cckleur\@@ccopen\@@ccsymbool
\@@cccollect{#1}}
+\def\preparecommentvariables % more will move here as with fields
+ {\let\@@DriverCommentLayer\@@cctekstlaag}
+
\def\dopreparecommentaar#1#2%
{\doifassignmentelse{#1}
{\getparameters[\??cc][#1]}
@@ -2355,29 +2359,62 @@
\edef\attachmentname{\attachmentname.\!!stringd}%
\fi}
-\def\attachment[#1]% currently title equals newname
+% \def\attachment[#1]% currently title equals newname
+% {\iflocation
+% \doifundefinedelse{\??at:#1}
+% {\writestatus\m!interactions6{#1}}%
+% {\doif\@@atstatus\v!start
+% {\bgroup
+% \getattachmentdata[#1]%
+% \doiffileelse\attachmentfile
+% {\doattachfile
+% \attachmenttitle
+% {1em}{\strutheight}{\strutdepth}\@@atkleur\@@atsymbool
+% \attachmentname
+% \attachmentfile}%
+% {\writestatus\m!interactions5\attachmentfile}%
+% \egroup}}%
+% \fi}
+
+\def\attachment
+ {\dodoubleempty\doattachment}
+
+\def\doattachment[#1][#2]% currently title equals newname
{\iflocation
- \doifundefinedelse{\??at:#1}
- {\writestatus\m!interactions6{#1}}%
- {\doif\@@atstatus\v!start
- {\bgroup
- \getattachmentdata[#1]%
- \doiffileelse\attachmentfile
- {\doattachfile
- \attachmenttitle
- {1em}{\strutheight}{\strutdepth}\@@atkleur\@@atsymbool
- \attachmentname
- \attachmentfile}%
- {\writestatus\m!interactions5\attachmentfile}%
- \egroup}}%
+ \ifsecondargument
+ \doifundefined{\??at:#2}
+ {\writestatus\m!interactions6{#2}%
+ \useattachment[#2]}%
+ \doif\@@atstatus\v!start
+ {\bgroup
+ \getattachmentdata[#2]%
+ \doiffileelse\attachmentfile
+ {\setupattachments[#1]%
+ \presetattachmentvariables
+\struttedbox{\tbox{%
+ \doattachfile
+ \attachmenttitle
+ {1em}\strutheight\strutdepth\@@atkleur\@@atsymbool
+ \attachmentname
+ \attachmentfile}%
+}}%
+ {\writestatus\m!interactions5\attachmentfile}%
+ \egroup}%
+ \else\iffirstargument
+ \attachment[][#1]%
+ \fi\fi
\fi}
+\def\presetattachmentvariables
+ {\let\@@DriverAttachmentLayer\@@attekstlaag}
+
\def\setupattachments
{\dodoubleempty\getparameters[\??at]}
\setupattachments
[\c!status=\v!start,
\c!kleur=\@@iakleur,
+ \c!tekstlaag=,
\c!symbool=]
% jammer, tussen/midden had erin gemoeten; \c!commando toevoegen
@@ -2599,7 +2636,8 @@
\c!spatie=\v!nee,
\c!symbool=\v!normaal,
\c!plaats=\v!inmarge,
- \c!optie=]
+ \c!optie=,
+ \c!tekstlaag=]
\stelversiesin % beware, @ is made active here,
[\c!nummer=1, % therefore we set this one at the end
diff --git a/tex/context/base/core-itm.tex b/tex/context/base/core-itm.tex
index 69fe63dec..a67d22603 100644
--- a/tex/context/base/core-itm.tex
+++ b/tex/context/base/core-itm.tex
@@ -116,6 +116,7 @@
\c!kopvoor,\c!kopna,\c!voor,\c!tussen,\c!na,
\c!afsluiter,\c!plaatsafsluiter,\c!inspringen,
\c!n,\c!binnen,\c!symbool,\c!marge,\c!items,
+ \c!linkermarge,\c!rechtermarge,
\c!start,\c!linkertekst,\c!rechtertekst]}
\def\setupitemgroups
@@ -416,7 +417,7 @@
% \edef\columntextwidth{\the\scratchdimen}%
% \leftskip\zeropoint
% % so far
-% \startkolommen
+% \startcolumns
% [\c!n=\!!counta, % netter \??op\itemlevel\c!n
% \c!hoogte=,
% \c!lijn=\v!uit,
@@ -533,7 +534,7 @@
% \edef\columntextwidth{\the\scratchdimen}%
% \leftskip\zeropoint
% % so far
-% \startkolommen
+% \startcolumns
% [\c!n=\!!counta, % netter \??op\itemlevel\c!n
% \c!hoogte=,
% \c!lijn=\v!uit,
@@ -601,7 +602,9 @@
\fi
\begingroup
\ifnum\itemlevel=\plusone % NIEUW
- \doadaptleftskip{\getitemparameter1\c!marge}%
+ \doadaptleftskip {\getitemparameter1\c!marge}%
+ \doadaptleftskip {\getitemparameter1\c!linkermarge}%
+ \doadaptrightskip{\getitemparameter1\c!rechtermarge}%
\fi
\dosetraggedcommand{\getitemparameter\itemlevel\c!uitlijnen}\raggedcommand
\doifsomething{\getitemparameter\itemlevel\c!inspringen}
@@ -632,7 +635,7 @@
\edef\columntextwidth{\the\scratchdimen}%
\leftskip\zeropoint
% so far
- \startkolommen
+ \startcolumns
[\c!n=\!!counta, % netter \??op\itemlevel\c!n
\c!hoogte=,
\c!lijn=\v!uit,
@@ -704,7 +707,7 @@
\ifnum\itemcolumndepth=\zerocount \dolistreference \fi % beware !
\iffirstlist \else \endgroup \fi % toegevoegd, eerste \som opent groep
\ifnum\itemcolumndepth=\itemlevel\relax
- \stopkolommen
+ \stopcolumns
\doglobal\newcounter\itemcolumndepth
\getitemparameter\itemlevel\c!na
\else
@@ -723,7 +726,9 @@
\fi
\endgroup
\doglobal\decrement(\itemlevel,\itemincrement)%
- \egroup}
+ \egroup
+ % new needed in sidefloats (surfaced in volker's proceedings)
+ \iftextitems\else\par\fi}
\newtoks\itemgroupcommands
@@ -1010,7 +1015,9 @@
\setupitemgroups % undocumented
[\c!niveaus=6,
- \c!marge=\!!zeropoint,
+ \c!marge=\zeropoint,
+ \c!linkermarge=\zeropoint,
+ \c!rechtermarge=\zeropoint,
\c!springvolgendein=\v!ja,
\c!breedte=1.5em,
\c!factor=0,
diff --git a/tex/context/base/core-mar.tex b/tex/context/base/core-mar.tex
index 1ec951f8a..bb9fc0eca 100644
--- a/tex/context/base/core-mar.tex
+++ b/tex/context/base/core-mar.tex
@@ -84,6 +84,23 @@
\letvalue{\??mk\??mk\v!laatste}\getbotmark
\letvalue{\??mk\??mk\v!huidige}\getcurrentmark
+% todo: make it work in balancing
+%
+% \definemarking[vers][]
+% \setupheadertexts
+% [\doiftext{\getmarking[vers][first]}
+% {\doiftextelse{\getmarking[vers][column:last]}
+% {\getmarking[vers][first] -- \getmarking[vers][column:last]}
+% {\getmarking[vers][first]}}]
+% \starttext
+% \startcolumns[n=2,balance=no]
+% \dorecurse{10}{\expanded{\marking[vers]{\recurselevel}} \recurselevel:\dorecurse{4}{\input ward } \endgraf}
+% \stopcolumns
+% \stoptext
+
+\letvalue{\??mk\??mk\v!kolom:\v!eerste }\getsplitfirstmark
+\letvalue{\??mk\??mk\v!kolom:\v!laatste}\getsplitbottommark
+
\ifx\decouplemarking\undefined \def\decouplemarking[#1]{} \fi
\def\dododefinemarking[#1][#2]%
diff --git a/tex/context/base/core-obj.tex b/tex/context/base/core-obj.tex
index 48e7b11ba..2b2fcc98b 100644
--- a/tex/context/base/core-obj.tex
+++ b/tex/context/base/core-obj.tex
@@ -115,7 +115,6 @@
%D clip.
\def\objectoffset{1cm}
- {}
% \def\dodosetobject#1#2#3%
% {\bgroup
@@ -177,7 +176,30 @@
% \box\scratchbox
% \elabelgroup}
-\def\dogetobject#1#2#3#4#5#6#7%
+% \def\dogetobject#1#2#3#4#5#6#7%
+% {\initializepaper
+% \forgetall
+% \dontshowcomposition
+% \setbox\scratchbox\vbox
+% {\doinsertobject{#1}{#2}}%
+% \setbox\scratchbox#3%
+% {\vbox to #5\scaledpoint
+% {\ifdim\ht\scratchbox>#5\scaledpoint
+% % or \ifdim\wd\scratchbox>#4\scaledpoint
+% \vss\hbox to #4\scaledpoint{\hss\box\scratchbox\hss}\vss
+% \else
+% \vss\box\scratchbox
+% \fi}}%
+% \scratchdimen#7\scaledpoint
+% \setbox\nextbox\hbox
+% {\hskip-\scratchdimen\lower\scratchdimen\flushnextbox}%
+% \wd\scratchbox#4\scaledpoint
+% \ht\scratchbox#5\scaledpoint
+% \dp\scratchbox#6\scaledpoint
+% \box\scratchbox
+% \elabelgroup}
+
+\def\dogetobject#1#2#3#4#5#6#7% don't change this, should work for dvi & pdf
{\initializepaper
\forgetall
\dontshowcomposition
@@ -186,17 +208,12 @@
\setbox\scratchbox#3%
{\vbox to #5\scaledpoint
{\ifdim\ht\scratchbox>#5\scaledpoint
- % or \ifdim\wd\scratchbox>#4\scaledpoint
+ \vss\hbox to #4\scaledpoint{\hss\box\scratchbox\hss}\vss
+ \else\ifdim\wd\scratchbox>#4\scaledpoint
\vss\hbox to #4\scaledpoint{\hss\box\scratchbox\hss}\vss
\else
\vss\box\scratchbox
- \fi}}%
- \scratchdimen#7\scaledpoint
- \setbox\nextbox\hbox
- {\hskip-\scratchdimen\lower\scratchdimen\flushnextbox}%
- \wd\scratchbox#4\scaledpoint
- \ht\scratchbox#5\scaledpoint
- \dp\scratchbox#6\scaledpoint
+ \fi\fi}}%
\box\scratchbox
\elabelgroup}
@@ -243,7 +260,6 @@
%D These commands are to be called by the \type{\startobject},
%D \type{\stopobject} and \type{\insertobject} specials.
-
\def\objectreferenced{\global\chardef\crossreferenceobject\plusone}
\def\driverreferenced{\global\chardef\crossreferenceobject\zerocount}
@@ -388,4 +404,4 @@
%D support objects while we still want to be able to use the
%D \DVI\ output.
-\protect \endinput
+\protect \endinput \ No newline at end of file
diff --git a/tex/context/base/core-pos.tex b/tex/context/base/core-pos.tex
index c05cb68d9..2e37c8440 100644
--- a/tex/context/base/core-pos.tex
+++ b/tex/context/base/core-pos.tex
@@ -1750,6 +1750,29 @@
\def\backgroundvariable#1%
{\csname\??td\currenttextbackground#1\endcsname}
+% \definetextbackground[more][state=start,backgroundcolor=red] % location=paragraph
+% \definetextbackground[test][state=start,backgroundcolor=green]
+%
+% \page \placefigure[left]{}{}
+%
+% \starttextbackground[test]
+% \readfile{ward}{}{}
+% \starttextbackground[more]
+% \readfile{ward}{}{}
+% \stoptextbackground
+% \readfile{ward}{}{}
+% \stoptextbackground
+%
+% \page \placefigure[right]{}{}
+%
+% \starttextbackground[test]
+% \readfile{ward}{}{}
+% \starttextbackground[more]
+% \readfile{ward}{}{}
+% \stoptextbackground
+% \readfile{ward}{}{}
+% \stoptextbackground
+
\def\dostarttextbackground[#1][#2]%
{\checktextbackgrounds
\def\currenttextbackground{#1}%
diff --git a/tex/context/base/core-ref.tex b/tex/context/base/core-ref.tex
index 4a1733368..67b4cf3e1 100644
--- a/tex/context/base/core-ref.tex
+++ b/tex/context/base/core-ref.tex
@@ -2609,9 +2609,10 @@
\let\textofreference \relax
\def\dodododoinatreference#1#2#3[#4]% \removeunwantedspaces added june 2004
- {\ifx\next\bgroup
+ {\ifx\next\bgroup % but removed later, fails on metafun
\dododododoinatreference
- {\leftofreference#1\ignorespaces#3\removeunwantedspaces\rightofreference}{#2}[#4]%
+ % fails on metafun {\leftofreference#1\ignorespaces#3\removeunwantedspaces\rightofreference}{#2}[#4]%
+ {\leftofreference#1\ignorespaces#3\rightofreference}{#2}[#4]%
\else
\dododododoinatreference
{\leftofreference#1\rightofreference}{#2#3}[#4]%
diff --git a/tex/context/base/core-reg.tex b/tex/context/base/core-reg.tex
index fd046af52..33a93b25d 100644
--- a/tex/context/base/core-reg.tex
+++ b/tex/context/base/core-reg.tex
@@ -150,6 +150,27 @@
\def\currentregister{#1}%
\donoregister[#2]}
+% \def\complexdozieregister[#1]#2#3%
+% {\begingroup
+% \thisisnextinternal\s!ind
+% \ifduplicate\getlastregisterentry{#2}\fi
+% \convertexpanded{\??id\currentregister}{#2}\asciiregisterentryA
+% \convertexpanded{\??id\currentregister}{#3}\asciiregisterentryB
+% \makesectionformat
+% \edef\schrijfwegnaarregister%
+% {\writeutility%
+% {r s %
+% {\currentregister} %
+% {\nextinternalreference} %
+% {#1} %
+% {\asciiregisterentryA} %
+% {\asciiregisterentryB} %
+% {\sectionformat}}}%
+% \schrijfwegnaarregister
+% \endgroup
+% \registerinfo{> zie}{#2}%
+% \GotoPar}
+
\def\complexdozieregister[#1]#2#3%
{\begingroup
\thisisnextinternal\s!ind
@@ -891,7 +912,7 @@
{\begingroup
\stelregisterin[\currentregister][#1]%
\raggedright
- \startkolommen
+ \startcolumns
[\c!n=\getvalue{\??id\currentregister\c!n},
\c!balanceren=\getvalue{\??id\currentregister\c!balanceren},
\c!uitlijnen=\getvalue{\??id\currentregister\c!uitlijnen}]%
@@ -899,7 +920,7 @@
\startopelkaar[\v!blanko]%
\doutilities\currentregister\jobname\currentregister\relax\par
\stopopelkaar
- \stopkolommen
+ \stopcolumns
\endgroup}
% \def\complexdovolledigregister[#1]% \@EA's kunnen weg
diff --git a/tex/context/base/core-rul.tex b/tex/context/base/core-rul.tex
index 73f432dab..202511786 100644
--- a/tex/context/base/core-rul.tex
+++ b/tex/context/base/core-rul.tex
@@ -2549,6 +2549,42 @@
\localhsize\hsize
\fi\fi}
+% \def\dododostartframedtext[#1][#2][#3]%
+% {\doifsomething{#2}{\setvalue{\??kd#1\c!plaats}{#2}}%
+% \processaction % \v!laag en \v!diepte are already taken !
+% [\framedtextparameter{#1}\c!plaats]
+% [ \v!links=>\letvalue{\??kd#1\c!links }\relax
+% \letvalue{\??kd#1\c!rechts}\hfill,
+% \v!rechts=>\letvalue{\??kd#1\c!links }\hfill
+% \letvalue{\??kd#1\c!rechts}\relax,
+% \v!midden=>\letvalue{\??kd#1\c!links }\hfill
+% \letvalue{\??kd#1\c!rechts}\hfill,
+% \v!geen=>\letvalue{\??kd#1\c!links }\relax % new
+% \letvalue{\??kd#1\c!rechts}\relax]% new
+% \letvalue{\??kd#1\c!plaats}\empty
+% % removed 06/2001
+% % \forgetparindent
+% % added 06/2001 [see demo-bbv]
+% \localhsize\hsize \checkframedtext
+% % so far
+% \setbox\framebox\vbox
+% \startboxedcontent
+% \hsize\localhsize
+% % \insidefloattrue % ? better
+% \expanded{\switchtobodyfont[\framedtextparameter{#1}\c!korps]}%
+% \startcolor[\framedtextparameter{#1}\c!kleur]%
+% \localframed[\??kd#1][\c!strut=\v!nee,#3]%
+% \bgroup
+% \let\\=\endgraf
+% \framedtextparameter{#1}\c!binnen % oud spul
+% \doifvalue{\??kd#1\c!dieptecorrectie}\v!aan % new, inside box
+% {\bgroup
+% \verticalstrut
+% \vskip-\struttotal}%
+% \doinhibitblank % \blanko[\v!blokkeer]% plaatst signal
+% \doconvertfont{\framedtextparameter{#1}\c!letter}\empty
+% \def\dostopframedtext{\dodostopframedtext{#1}{#2}}}
+
\def\dododostartframedtext[#1][#2][#3]%
{\doifsomething{#2}{\setvalue{\??kd#1\c!plaats}{#2}}%
\processaction % \v!laag en \v!diepte are already taken !
@@ -2580,7 +2616,11 @@
\doifvalue{\??kd#1\c!dieptecorrectie}\v!aan % new, inside box
{\bgroup
\verticalstrut
- \vskip-\struttotal}%
+ % we need \geenwitruimte in case of setups setting whitespace
+ % nb, not safe, text vs \vbox as next
+ \vskip-\struttotal
+ \geenwitruimte % na vskip ! new 20/05/2004, fails with next content being box (\scale{..})
+ }%
\doinhibitblank % \blanko[\v!blokkeer]% plaatst signal
\doconvertfont{\framedtextparameter{#1}\c!letter}\empty
\def\dostopframedtext{\dodostopframedtext{#1}{#2}}}
@@ -2661,7 +2701,7 @@
%D
%D Putting rules before and after a paragraph is very space
%D sensitive, but the next command handles that quite well. It
-%D comes in to disguises:
+%D comes in two disguises:
%D
%D \startbuffer
%D \textrule[boven]{fragments}
@@ -2754,6 +2794,7 @@
%\witruimte % no
\@@tlvoor
\docomplextextrule{#1}%
+% todo, option: \doifnothing{#1}{\ruledvskip-.5ex}
\geenwitruimte
\@@tltussen
\endgraf}
@@ -2763,7 +2804,7 @@
\endgraf
\fi
\dimen0\strutdp
- \ifdim\prevdepth<\strutdp
+ \ifdim\prevdepth>\strutdp\else % was <\strutdp
\ifdim\prevdepth>\zeropoint
\advance\dimen0 -\prevdepth
\fi
@@ -2793,11 +2834,10 @@
\def\dounknowntextrule
{\iffirstargument
- \let\next\dotoptextrule
+ \@EA\dotoptextrule
\else
- \def\next{\dobottomtextrule{}}%
- \fi
- \next}
+ \@EA\dobottomtextrule\@EA\empty
+ \fi}
%D The grouped commands also supports bodyfont switching:
@@ -2811,7 +2851,7 @@
\def\stoptextrule
{\par
\egroup
- \dobottomtextrule{}%
+ \dobottomtextrule\empty
\egroup}
%D \macros
diff --git a/tex/context/base/core-sec.tex b/tex/context/base/core-sec.tex
index 512dd2e94..3bd26334d 100644
--- a/tex/context/base/core-sec.tex
+++ b/tex/context/base/core-sec.tex
@@ -392,32 +392,6 @@
% Omdat een markering kan worden herdefinieerd moeten we
% eerst testen of er wel een keten||afhankelijkheid is.
-% \def\doresetsectionmarks#1%
-% {\doifdefined{\??se#1\c!markering} % skip zero level
-% {\fastresetmarkerlist[\getvalue{\??se#1\c!markering}]}%
-% \donexttracklevel{#1}}
-%
-% \def\resetsectionmarks#1%
-% {\doifdefinedelse{\??se#1}
-% {\let\donexttrackcommando\doresetsectionmarks
-% \donexttracklevel{#1}}%
-% {\fastresetmarker[\mainmarking{#1}]}} % redundant \mainmarking
-
-% \def\doresetsectionmarks#1%
-% {\ifundefined{\??se#1\c!markering}\else % skip zero level
-% \fastresetmarkerlist[\csname\??se#1\c!markering\endcsname]%
-% \fi
-% \donexttracklevel{#1}}
-%
-% not sure if the next one is better:
-
-\def\doresetsectionmarks#1%
- {\ifundefined{\??se#1\c!markering}% skip zero level
- \donexttracklevel{#1}%
- \else
- \fastresetmarkerlist[\csname\??se#1\c!markering\endcsname]%
- \fi}
-
\def\resetsectionmarks#1%
{\ifundefined{\??se#1}%
\fastresetmarker[\mainmarking{#1}]% % redundant \mainmarking
@@ -426,6 +400,23 @@
\donexttracklevel{#1}%
\fi}
+\def\doresetsectionmarks#1%
+ {\ifundefined{\??se#1\c!markering}\else % skip zero level
+ \fastresetmarkerlist[\csname\??se#1\c!markering\endcsname]%
+ \fi
+ \donexttracklevel{#1}}
+
+% I'm not sure if the next one is better:
+%
+% \def\doresetsectionmarks#1%
+% {\ifundefined{\??se#1\c!markering}% skip zero level
+% \donexttracklevel{#1}%
+% \else
+% \fastresetmarkerlist[\csname\??se#1\c!markering\endcsname]%
+% \fi}
+%
+% and indeed, it isn't, actually, it does not work at all, so let's drop it.
+
% packaged:
%
% \def\resetsectioncounters#1%
@@ -456,10 +447,18 @@
% evt ook level gaan opslaan tbv snelle selectie
-\def\makesectionformat
- {\edef\sectionformat
+% \def\makesectionformat
+% {\edef\sectionformat
+% {\@@sectiontype\sectionseparator
+% \csname\lastsection\s!format\endcsname}}
+
+\unprotected \def\makesectionformat % we don't want eigennummers here
+ {\pushmacro\@@shortsectionnumber
+ \let\@@shortsectionnumber\@@sectionvalue
+ \edef\sectionformat
{\@@sectiontype\sectionseparator
- \csname\lastsection\s!format\endcsname}}
+ \csname\lastsection\s!format\endcsname}%
+ \popmacro\@@shortsectionnumber}
\def\dobacktracklevel#1%
{\doifnot{\previoussection{#1}}\zerosection
@@ -887,28 +886,56 @@
% will result in an additional last page, which needs to be
% captured at the end
-\def\doaroundsectieblok#1%
- {\doifvaluesomething{\??sb#1\c!pagina}
- {\ExpandFirstAfter\pagina[\getvalue{\??sb#1\c!pagina}]}%
+% \def\doaroundsectieblok#1%
+% {\doifvaluesomething{\??sb#1\c!pagina}
+% {\ExpandFirstAfter\pagina[\getvalue{\??sb#1\c!pagina}]}%
+% \resetsectioncounters\zerosection % was firstsection
+% \resetsectionmarks\zerosection}
+
+% \def\dostartsectieblok#1#2%
+% {\begingroup
+% \doaroundsectieblok{#1}% % going to a new page or so
+% \getvalue{\??sb#1}% % set name of section block
+% \getsectieblokomgeving{#1}% % special settings, grouped
+% %\expandafter\csname#2true\endcsname % obsolete
+% \setsystemmode{#1}% % can be used in conditionals
+% \getvalue{\??sb\@@sectieblok\c!voor}% this one is not to be moved!
+% \showmessage\m!structures1\@@sectieblokken}
+
+% \def\dostopsectieblok
+% {\showmessage\m!structures2\@@sectieblokken
+% \getvalue{\??sb\@@sectieblok\c!na}% don't move
+% \doaroundsectieblok\@@sectieblok
+% \endgroup}
+
+\def\doaroundsectieblok
+ {\doifvaluesomething{\??sb\@@sectieblok\c!pagina}
+ {\pagina[\getvalue{\??sb\@@sectieblok\c!pagina}]}%
\resetsectioncounters\zerosection % was firstsection
\resetsectionmarks\zerosection}
\def\dostartsectieblok#1#2%
{\begingroup
- \doaroundsectieblok{#1}% % going to a new page or so
- \getvalue{\??sb#1}% % set name of section block
- \getsectieblokomgeving{#1}% % special settings, grouped
- %\expandafter\csname#2true\endcsname % obsolete
- \setsystemmode{#1}% % can be used in conditionals
- \getvalue{\??sb\@@sectieblok\c!voor}% this one is not to be moved!
+ \getvalue{\??sb#1}%
+ \doaroundsectieblok
+% \doifvaluesomething{\??sb\@@sectieblok\c!pagina}{\pagina[\getvalue{\??sb\@@sectieblok\c!pagina}]}%
+% \resetsectioncounters\zerosection % was firstsection
+% \resetsectionmarks\zerosection
+ \getsectieblokomgeving\@@sectieblok
+ \setsystemmode\@@sectieblok
+ \getvalue{\??sb\@@sectieblok\c!voor}%
\showmessage\m!structures1\@@sectieblokken}
\def\dostopsectieblok
{\showmessage\m!structures2\@@sectieblokken
\getvalue{\??sb\@@sectieblok\c!na}% don't move
- \doaroundsectieblok\@@sectieblok
+ \doaroundsectieblok
+% \doifvaluesomething{\??sb\@@sectieblok\c!pagina}{\pagina[\getvalue{\??sb\@@sectieblok\c!pagina}]}%
+% \resetsectioncounters\zerosection % was firstsection
+% \resetsectionmarks\zerosection
\endgroup}
+
\def\dostelsectieblokin[#1]% [#2]
{\getparameters[\??sb#1]}
@@ -1003,7 +1030,7 @@
\global\paginageblokkeerdtrue
\fi}
-\def\dohandelpaginaafAB#1%
+\def\dohandelpaginaafAB#1% will be replaced by a more clever (signaling) mechanism (in beta)
{\flushsidefloats
\getvalue{\??ko#1\c!voor}%
%\witruimte vervangen door \noindent elders
@@ -1837,13 +1864,13 @@
\hskip\dimen0 \!!plus \dimen0 \!!minus .25\dimen0
\hskip\headsignal\ignorespaces
\fi
- \ifdisplaysectionhead
+ \ifdisplaysectionhead \ifvmode
\ifgridsnapping % important, font related depth, see comment
\prevdepth\strutdp
\else
\prevdepth\localheaddepth
\fi
- \fi
+ \fi \fi
\stopsynchronisatie
\egroup
\egroup
diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex
index efbb4890e..953e91962 100644
--- a/tex/context/base/core-spa.tex
+++ b/tex/context/base/core-spa.tex
@@ -75,8 +75,8 @@
\global\let\carriedoverpar\relax
\def\carryoverpar#1%
- {\expanded
- {\noexpand#1%
+ {\expanded % \scratchtoks{#1}%
+ {\noexpand#1% \the\scratchtoks
\hangindent\the\hangindent
\hangafter \the\hangafter
\parskip \the\parskip
@@ -434,8 +434,9 @@
% \TestBlank[2*big,whatever]
% \TestBlank[3\lineheight]
-\def\addblankskip#1#2#3%
- {\global\advance\blankoskip#1\ifgridsnapping#3\else#2\fi}
+% this will be replaced/enhanced
+
+\def\addblankskip#1#2#3{\global\advance\blankoskip#1\ifgridsnapping#3\else#2\fi}
\def\defineblankmethod[#1]#2{\setvalue{\??bo\??bo#1}{#2}}
@@ -445,10 +446,10 @@
\defineblankmethod [-\v!middel]{\addblankskip-\medskipamount {.5\openlineheight}}
\defineblankmethod [\v!klein]{\addblankskip+\smallskipamount{.25\openlineheight}}
\defineblankmethod [-\v!klein]{\addblankskip-\smallskipamount{.25\openlineheight}}
-\defineblankmethod [\v!wit]{\addblankskip+\parskip\openlineheight}
-\defineblankmethod [-\v!wit]{\addblankskip-\parskip\openlineheight}
-\defineblankmethod [\v!regel]{\addblankskip+\openlineheight\openlineheight}
-\defineblankmethod [-\v!regel]{\addblankskip-\openlineheight\openlineheight}
+\defineblankmethod [\v!wit]{\addblankskip+\parskip \openlineheight}
+\defineblankmethod [-\v!wit]{\addblankskip-\parskip \openlineheight}
+\defineblankmethod [\v!regel]{\addblankskip+\openlineheight \openlineheight}
+\defineblankmethod [-\v!regel]{\addblankskip-\openlineheight \openlineheight}
\defineblankmethod [\v!formule ]{\global\advance\blankoskip\medskipamount}
\defineblankmethod [\v!geenwit ]{\global\blankogeenwittrue}
@@ -1903,8 +1904,13 @@
\edef\strutdepth {\the\strutdp}%
\dosetstrut}
+% \def\setfontstrut
+% {\setcharstrut{(}}
+%
+% better, since some fonts have small (but descending Q etc)
+
\def\setfontstrut
- {\setcharstrut{(}}
+ {\setcharstrut{(gplQT}}
\def\setcapstrut% could be M, but Q has descender
{\setcharstrut{Q}}
@@ -2285,15 +2291,6 @@
\def\definieerhbox%
{\dodoubleargument\dodefinieerhbox}
-\def\lrcbox#1#2#%
- {\vbox#2\bgroup
- \let\\=\endgraf
- \forgetall#1\let\next=}
-
-\def\lbox{\lrcbox\raggedleft}
-\def\rbox{\lrcbox\raggedright}
-\def\cbox{\lrcbox\raggedcenter}
-
\def\iobox#1#2#3#% here #3# is not really needed
{\vbox\bgroup % we want to return a vbox like the others
\hbox\bgroup% we need to pack the signal with the box
diff --git a/tex/context/base/core-tab.tex b/tex/context/base/core-tab.tex
index 2558e7d6b..93e480fd0 100644
--- a/tex/context/base/core-tab.tex
+++ b/tex/context/base/core-tab.tex
@@ -13,6 +13,12 @@
\writestatus{loading}{Context Core Macros / TaBlE Embedding}
+% Don't change the splitter:
+%
+% ... \NR
+% \TABLEnoalign{\page}\TABLEhead
+% \NC ...
+
% e-tex: reverse rows or vadjust or ... in tables
% \ifalign
% \xhrule : calls for 'special' with width
@@ -493,6 +499,63 @@
\fi % i.e. vtop
\box\scratchbox}
+% We also need to patch away the interfering math switch:
+
+% \mathpunctuationtrue
+
+% test, test
+% \starttable[|c|]
+% \NC1,,10\NC\AR
+% \stoptable
+% test, test
+
+\def\!ttBeginTableA[#1]{%
+ \if #1u% % "unboxed" table
+ \ifmmode
+ \def\!ttEndTable{% % user had better be in display math mode
+ \relax}% % and have only one table at the outer level
+ \else % user had better be in vertical mode
+ \bgroup
+ \def\!ttEndTable{%
+ \egroup}%
+ \fi
+ \else
+ %\hbox\bgroup $
+ %\def\!ttEndTable{%
+ % \egroup % for the \vtop, \vbox, or \vcenter, yet to come
+ % $% for math mode
+ % \egroup}% for the \hbox
+ %\if #1t%
+ % \vtop
+ %\else
+ % \if #1b%
+ % \vbox
+ % \else
+ % \vcenter % math mode was essential for this
+ % \fi
+ %\fi
+ %
+ \hbox\bgroup
+ \def\!ttEndTable{\egroup\egroup}%
+ \if#1t%
+ \vtop
+ \else\if#1b%
+ \vbox
+ \else
+ \def\!ttEndTable{\egroup$\egroup}%
+ %$\vcenter
+ \scratchtoks\everymath\everymath\emptytoks$\everymath\scratchtoks\vcenter
+ \fi\fi
+ %
+ \bgroup % for the \vtop, \vbox, or \vcenter
+ \fi
+ \advance\!taRecursionLevel 1 % RecursionLevel governs initialization
+ \let\!ttRightGlue=\relax % This may be changed by \JustCenter, etc
+ \everycr\emptytoks % ={}
+ \ifnum \!taRecursionLevel=1
+ \!ttInitializeTable
+ \fi}
+
% (*) Try this one with \type {direction} and {girection};
% the \PPCHTEX\ manual is a nice testcase.
%
@@ -976,6 +1039,9 @@
% \catcode`\|=\@@other
% \dodoubleargument\dodefinetabletemplate}
+
+% \TABLEnoalign{\page}\TABLEhead is valid
+
\def\douseTABLEtemplate#1#2#3%
{\gdef\TABLEhead{\getvalue{@@TABLEhead#2}}%
\gdef\TABLEtail{\getvalue{@@TABLEtail#3}}%
diff --git a/tex/context/base/core-tbl.tex b/tex/context/base/core-tbl.tex
index 22ce37474..b796587c5 100644
--- a/tex/context/base/core-tbl.tex
+++ b/tex/context/base/core-tbl.tex
@@ -573,7 +573,7 @@
{\dontcomplain
\global\setbox\tabulatebox % % % global ? % % %
\vsplit\tablebox\tabulatecolumn to \lineheight
- \setbox\tabulatebox\vbox
+ \setbox\tabulatebox\normalvbox
{\unvbox\tabulatebox}%
\setbox\tabulatebox\hbox to \wd\tabulatebox
{\hss\dotabulatehook{\box\tabulatebox}\hss}%
diff --git a/tex/context/base/core-vis.tex b/tex/context/base/core-vis.tex
index 01e0d1471..c4121b934 100644
--- a/tex/context/base/core-vis.tex
+++ b/tex/context/base/core-vis.tex
@@ -61,13 +61,13 @@
\dontcomplain
\boxrulewidth5\testrulewidth
#3#4\relax
- \setbox0\normalhbox to \scratchdimen
+ \setbox\scratchbox\normalhbox to \scratchdimen
{#2{\ruledhbox to \scratchdimen
{\vrule #5 20\testrulewidth \!!width \zeropoint
\normalhss}}}%
- \smashbox0
+ \smashbox\scratchbox
\normalpenalty\!!tenthousand
- \box0
+ \box\scratchbox
\egroup}
\def\ruledhanging
@@ -75,7 +75,7 @@
\ifnum\hangafter<\zerocount
\normalhbox
{\boxrulewidth5\testrulewidth
- \setbox0\ruledhbox to \hangindent
+ \setbox\scratchbox\ruledhbox to \hangindent
{\scratchdimen\strutht
\advance\scratchdimen \strutdp
\vrule
@@ -83,8 +83,8 @@
\!!height \zeropoint
\!!depth -\hangafter\scratchdimen}%
\normalhskip-\hangindent
- \smashbox0
- \raise\strutht\box0}%
+ \smashbox\scratchbox
+ \raise\strutht\box\scratchbox}%
\fi
\fi}
@@ -214,14 +214,14 @@
\vrule
\!!height \testrulewidth
\!!depth \testrulewidth
- \!!width 120pt}
+ \!!width 120\points}
\normalvfill}%
\smashbox\scratchbox
\advance\scratchdimen \strutheightfactor\baselineskip
\setbox\scratchbox\normalhbox
- {\normalhskip -48pt
- \normalhbox to 24pt
- {\normalhss\debuggertext\ruledbaselines\normalhskip6pt}%
+ {\normalhskip -48\points
+ \normalhbox to 24\points
+ {\normalhss\debuggertext\ruledbaselines\normalhskip6\points}%
\raise\scratchdimen\box\scratchbox}%
\smashbox\scratchbox
\box\scratchbox
@@ -414,7 +414,7 @@
\boxmaxdepth\maxdimen
\offinterlineskip
\scratchdimen\cutmarklength
- \divide\scratchdimen 2
+ \divide\scratchdimen \plustwo
\hsize\ruledwidth
\setbox\scratchbox\normalvbox
{\setbox\scratchbox\normalhbox{\horizontalcuts}%
@@ -526,7 +526,7 @@
\def\colorrangeB
{\hbox
{\scratchdimen-\colormarklength
- \multiply\scratchdimen 2
+ \multiply\scratchdimen \plustwo
\advance\scratchdimen \ruledwidth
\divide\scratchdimen 11
\def\docommando ##1 ##2 ##3##4##5##6%
@@ -598,7 +598,7 @@
\edef\ruledwidth {\the\wd#2}%
\setbox#2\hbox
{\scratchdimen\colormarklength
- \divide\scratchdimen 2
+ \divide\scratchdimen \plustwo
\forgetall
\ssxx
\setbox\scratchbox\vbox
@@ -671,7 +671,7 @@
\ifx\eTeXversion\undefined
- \let\showwhatsits\relax
+ \let\showwhatsits \relax
\let\dontshowwhatsits\relax
\else
@@ -720,13 +720,8 @@
\vrule\!!width\wd\scratchbox\dostopcolormode
\hskip-\wd\scratchbox\box\scratchbox}%
\scratchdimen1ex
- \ifdone
- \setbox\scratchbox\hbox
- {\hskip#4\scratchdimen\box\scratchbox}%
- \else
- \setbox\scratchbox\hbox
- {\raise#4\scratchdimen\box\scratchbox}%
- \fi
+ \setbox\scratchbox\hbox
+ {\ifdone\hskip\else\raise#4\fi\scratchdimen\box\scratchbox}%
\smashbox\scratchbox
\ifdone\nointerlineskip\fi
\box\scratchbox
@@ -751,7 +746,7 @@
\ifhmode
\edef\popwhatsit{\kern\the\lastkern}\unkern
\else
- \edef\popwhatsit{\kern\the\lastkern\prevdepth\the\prevdepth}
+ \edef\popwhatsit{\kern\the\lastkern\prevdepth\the\prevdepth}%
\kern-\lastkern
\fi
\fi
@@ -768,7 +763,7 @@
\ifhmode
\edef\popwhatsit{\hskip\the\lastskip}\unskip
\else
- \edef\popwhatsit{\vskip\the\lastskip\prevdepth\the\prevdepth}
+ \edef\popwhatsit{\vskip\the\lastskip\prevdepth\the\prevdepth}%
\vskip-\lastskip
\fi
\fi}
@@ -843,6 +838,6 @@
\def\coloredvtop{\coloredbox\vtop}
\def\coloredstrut
- {\color[strutcolor]{\def\strutwidth{2pt}\setstrut\strut}}
+ {\color[strutcolor]{\def\strutwidth{2\points}\setstrut\strut}}
\protect \endinput \ No newline at end of file
diff --git a/tex/context/base/filt-ini.tex b/tex/context/base/filt-ini.tex
index fbc46a518..6fe8a37fa 100644
--- a/tex/context/base/filt-ini.tex
+++ b/tex/context/base/filt-ini.tex
@@ -8,72 +8,72 @@
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
\writestatus{loading}{Context Filter Macros (ini)}
-\ifx\OmegaVersion\undefined
+% \ifx\OmegaVersion\undefined
- \let\definefiltersynonym \gobbledoubleempty
- \let\definefiltersequence \gobbledoubleempty
-\unexpanded\def\usefiltersequence {\gobblesingleempty}
- \let\usefilter \gobblesingleempty
- \let\truefiltername \gobbleoneargument
+% \let\definefiltersynonym \gobbledoubleempty
+% \let\definefiltersequence \gobbledoubleempty
+% \unexpanded\def\usefiltersequence {\gobblesingleempty}
+% \let\usefilter \gobblesingleempty
+% \let\truefiltername \gobbleoneargument
- \expandafter \endinput
-\fi
+% \expandafter \endinput
+% \fi
\unprotect
-%D The real work starts here.
+%D The real work starts here.
-\startmessages dutch library: filters
+\startmessages dutch library: filters
title: filter
1: filter -- wordt geladen
2: onbekend filter --
\stopmessages
-\startmessages english library: filters
+\startmessages english library: filters
title: filter
1: filter -- is loaded
2: unknown filter --
\stopmessages
-\startmessages german library: filters
+\startmessages german library: filters
title: filter
1: filter -- is loaded
2: unknown filter --
\stopmessages
-\startmessages czech library: filters
+\startmessages czech library: filters
title: filter
1: filter -- is loaded
2: unknown filter --
\stopmessages
-\startmessages italian library: filters
+\startmessages italian library: filters
title: filtri
1: filtro -- caricato
2: filtro sconosciuto --
\stopmessages
-%D \macros
+%D \macros
%D {definefiltersynonym}
-\def\definefiltersynonym%
+\def\definefiltersynonym
{\dodoubleargument\dodefinefiltersynonym}
\def\dodefinefiltersynonym[#1][#2]%
{\setvalue{\??or#1}{#2}}
-%D \macros
+%D \macros
%D {truefiltername}
\def\truefiltername#1%
{\ifundefined{\??or#1}#1\else\truefiltername{\getvalue{\??or#1}}\fi}
-%D \macros
+%D \macros
%D {definefiltersequence}
\def\definefiltersequence%
@@ -82,38 +82,61 @@
\def\dodefinefiltersequence[#1][#2]%
{\setvalue{\??ot#1}{#2}}
-%D \macros
+%D \macros
%D {usefiltersequence}
+%D
\def\magicocpnumber{1}
+% \def\dodousefiltersequence#1%
+% {\expandafter\ocp\csname\??or:#1\endcsname=\truefiltername{#1}\relax
+% \@EA \appendtoks
+% \@EA \addbeforeocplist \@EA \magicocpnumber \csname\??or:#1\endcsname
+% \to \scratchtoks}
+
+% one can do:
+%
+% \definefiltersequence
+% [farsi]
+% [utf8 to unicode16=>5,
+% persian fix,
+% arabic analysis=>3,
+% arabic glyphs]
+%
+% so, => is used to signal a priority
+
\def\dodousefiltersequence#1%
{\expandafter\ocp\csname\??or:#1\endcsname=\truefiltername{#1}\relax
- \@EA \appendtoks
- \@EA \addbeforeocplist \@EA \magicocpnumber \csname\??or:#1\endcsname
- \to {\toks0}}
+ \splitstring#1\at=>\to\!!stringa\and\!!stringb
+ \edef\!!stringb{\number\ifx\!!stringb\empty\magicocpnumber\else\!!stringb\fi}%
+ \appendetoks
+ \noexpand\addbeforeocplist
+ \!!stringb\space
+ \expandafter\noexpand\csname\??or:\!!stringa\endcsname
+ \to \scratchtoks}
\unexpanded\def\usefiltersequence[#1]%
{\edef\currentfiltersequence{\getvalue{\??ot#1}}%
- \toks0=\emptytoks
+ \scratchtoks\emptytoks
\processcommacommand[\currentfiltersequence]\dodousefiltersequence
- \expanded{\ocplist\csname\??ot:#1\endcsname=\the\toks0}\nullocplist
+ % \showthe\scratchtoks
+ \expanded{\ocplist\csname\??ot:#1\endcsname=\the\scratchtoks}\nullocplist
\expanded{\pushocplist\csname\??ot:#1\endcsname}\relax}
-%D \macros
+%D \macros
%D {usefilter}
\def\dousefilter#1%
{\doifundefined{\c!file\f!filterprefix#1}%
- {\setvalue{\c!file\f!filterprefix#1}{}%
+ {\letvalue{\c!file\f!filterprefix#1}\empty
\makeshortfilename[\f!filterprefix#1]%
\startreadingfile
- \readsysfile{\shortfilename}
- {\showmessage{\m!filters}{1}{#1}}
- {\showmessage{\m!filters}{2}{#1}}%
+ \readsysfile\shortfilename
+ {\showmessage\m!filters1{#1}}
+ {\showmessage\m!filters2{#1}}%
\stopreadingfile}}
\def\usefilter[#1]%
{\processcommalist[#1]\dousefilter}
-\protect \endinput
+\protect \endinput \ No newline at end of file
diff --git a/tex/context/base/font-arb.tex b/tex/context/base/font-arb.tex
index d468f6c28..239ca436e 100644
--- a/tex/context/base/font-arb.tex
+++ b/tex/context/base/font-arb.tex
@@ -1,10 +1,10 @@
-% NOT YET ADAPTED TO THE NEW FONT MACROS
+% NOT YET ADAPTED TO THE NEW FONT MACROS
-% I still need to hook in some features into the setup
-% macro. I also have to (re)define farsi etc. in ways
-% similar to arab, so that we have dedicated environments.
+% I still need to hook in some features into the setup
+% macro. I also have to (re)define farsi etc. in ways
+% similar to arab, so that we have dedicated environments.
%
-% keywords needed: vocalize transscribe
+% keywords needed: vocalize transscribe
%
% \startarabic[option=vocalize] % or vocalize=yes
% ......
@@ -20,8 +20,8 @@
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
\writestatus{loading}{Context Font Macros / ArabTeX support}
@@ -35,40 +35,40 @@
%D Having implemented support for chinese a few weeks before,
%D I could not resist to build in support for arab and hebrew
%D too. Writing support for languages that don't give me any
-%D cue on how to pronounce their script, is kind of special.
+%D cue on how to pronounce their script, is kind of special.
-%D This is a beta version, since I still have to take care of some
-%D macros that conflict with existing stuff.
+%D This is a beta version, since I still have to take care of some
+%D macros that conflict with existing stuff.
-\unprotect
+\unprotect
\definesystemvariable{ARABTEX}
%D A few (maybe too) simple hooks into the font mechanism. The
-%D hook into the language module is not yet done.
+%D hook into the language module is not yet done.
\unexpanded\def\setarabicfont#1%
{\scratchdimen=1.2\bodyfontsize
\font\arbfont=\truefontname{Arabic#1} at \currentfontscale\scratchdimen
\setx@skels
-\newfonttrue
+\newfonttrue
\arbfont}
-%D Just to be compatible with Arab\TEX\ we define:
+%D Just to be compatible with Arab\TEX\ we define:
\unexpanded\def\nash {\setarabicfont\s!Regular}
-\unexpanded\def\nashbf {\setarabicfont\s!Bold }
+\unexpanded\def\nashbf {\setarabicfont\s!Bold }
\unexpanded\def\pnash {\setarabicfont\s!Regular}
-\unexpanded\def\pnashbf {\setarabicfont\s!Bold }
+\unexpanded\def\pnashbf {\setarabicfont\s!Bold }
\unexpanded\def\xnash {\setarabicfont\s!Regular}
-\unexpanded\def\xnashbf {\setarabicfont\s!Bold }
+\unexpanded\def\xnashbf {\setarabicfont\s!Bold }
-%D The display arabic environment (will be an installable
-%D object) uses a few conditionals. Let's do it the
+%D The display arabic environment (will be an installable
+%D object) uses a few conditionals. Let's do it the
%D \CONTEXT\ way and define an anvironment that we later can
-%D adapt.
+%D adapt.
-\newif\if@ignore
+\newif\if@ignore
\newif\if@endpe
\def\setupARABTEXalternative[#1]%
@@ -88,10 +88,10 @@
\setvalue{\e!start#1}%
{\dodoubleempty\dostartARABTEXalternative[#1]}%
\unexpanded\setvalue{#1}##1%
- {{\initializeARABTEXinternals{#1}\a@RL{##1}}}%
+ {{\initializeARABTEXinternals{#1}\a@RL{##1}}}%
\unexpanded\def\RL{\getvalue{#1}}%
\unexpanded\def\LR{\a@LR}%
- \let\R=\RL
+ \let\R=\RL
\let\L=\LR
\else
\defineARABTEXalternative[arabic]%
@@ -107,15 +107,15 @@
\let \d=\ARABTEXd
\let |=\ARABTEXbar
\let \,=\ARABTEXcomma
- \let\protect=\ARABTEXprotect
+ \let\protect=\ARABTEXprotect
\let\normaltx \tx \def\tx {\normaltx \setarabicfont\fontstylesuffix}%
\let\normaltxx\txx\def\txx{\normaltxx\setarabicfont\fontstylesuffix}}
-\def\dostartARABTEXalternative[#1][#2]%
+\def\dostartARABTEXalternative[#1][#2]%
{\begingroup
\getparameters[\??ARABTEX#1][#2]%
\ifnum1<0\getvalue{\??ARABTEX#1\c!n}\relax
- \startkolommen
+ \startcolumns
\else
\getvalue{\??ARABTEX#1\c!voor}%
\fi
@@ -127,42 +127,42 @@
\def\initializeARABTEXalternative#1%
{\getvalue{\??ARABTEX#1\c!letter}}
-\def\initializeARABTEXend#1% \CONTEXT\ does use \end quite differently
+\def\initializeARABTEXend#1% \CONTEXT\ does use \end quite differently
{\long\def\end##1%
{\endarabtext
\ifnum1<0\getvalue{\??ARABTEX#1\c!n}\relax
- \stopkolommen
+ \stopcolumns
\else
\getvalue{\??ARABTEX#1\c!na}%
\fi
\endgroup}%
- \let\a@l@end\end
+ \let\a@l@end\end
\letvalue{\e!stop#1}=\end
\long\def\end##1%
{\endarabtext
\endgroup
\if@ignore\global\@ignorefalse\expandafter\ignorespaces\fi}}
-%D Arabic verbatim.
+%D Arabic verbatim.
-\def\typearab{\a@@verb}
+\def\typearab{\a@@verb}
%D Some \LATEX\ macros.
\def \makeatletter {\unprotect}
-\def \makeatother {\protect}
+\def \makeatother {\protect}
\def \typeout #1{\writestatus{arabtex}{#1}}
%D We have to save some macros.
\let\ARABTEXversion=\empty
-\def\startloadingARABTEX% ugly hacks
- {\catcode`!=12
- \catcode`?=12
+\def\startloadingARABTEX% ugly hacks
+ {\catcode`!=12
+ \catcode`?=12
\pushmacro\output \let \output \scratchtokens
- \pushmacro\LaTeX \let \LaTeX \undefined
- \pushmacro\CJK \let \CJK \undefined
+ \pushmacro\LaTeX \let \LaTeX \undefined
+ \pushmacro\CJK \let \CJK \undefined
\pushmacro\year \let \year \normalyear
\pushmacro\month \let \month \normalmonth
\pushmacro\day \let \day \normalday
@@ -175,11 +175,11 @@
\pushmacro\cap}
\def\stoploadingARABTEX%
- {\catcode`!=11
- \catcode`?=11
+ {\catcode`!=11
+ \catcode`?=11
\popmacro\cap
\popmacro\emphasize
- \popmacro\theversion
+ \popmacro\theversion
\popmacro\version
\popmacro\datum
\popmacro\linewidth
@@ -187,25 +187,25 @@
\popmacro\day
\popmacro\month
\popmacro\year
- \popmacro\CJK
+ \popmacro\CJK
\popmacro\LaTeX
- \popmacro\output}
+ \popmacro\output}
-%D We save some macros:
+%D We save some macros:
\startloadingARABTEX
-%D When loading \ARABTEX\ we have to set back the~! and~?.
+%D When loading \ARABTEX\ we have to set back the~! and~?.
-\input arabtex.sty
+\input arabtex.sty
-%D Since \ARABTEX\ has its own \type {\cap}, we save the
-%D new meaning. We also redefine some \PLAIN\ macros, which
-%D happen to have a different meaning in \LATEX.
+%D Since \ARABTEX\ has its own \type {\cap}, we save the
+%D new meaning. We also redefine some \PLAIN\ macros, which
+%D happen to have a different meaning in \LATEX.
-\let\ARABTEXversion=\theversion
+\let\ARABTEXversion=\theversion
-\let\ARABTEXcap=\cap
+\let\ARABTEXcap=\cap
\def\ARABTEXsh@ft#1%
{\dimen@.00#1ex
@@ -220,7 +220,7 @@
{{\o@lign{\relax#1\crcr\hidewidth\sh@ft{29}%
\vbox to.2ex{\hbox{\char22}\vss}\hidewidth}}}
-%D A few internals:
+%D A few internals:
\def \ARABTEXcomma {\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi}
\def \ARABTEXbreakA {\hfill\break}
@@ -228,38 +228,38 @@
\edef\ARABTEXbar {\string|}
\let \ARABTEXprotect \relax
-%D Now we can pop the saved macros.
+%D Now we can pop the saved macros.
\stoploadingARABTEX
%D Ah, we have to get rid of some \type {\protect} stuff but
-%D to permit testing we add it in the \CONTEXT\ way.
+%D to permit testing we add it in the \CONTEXT\ way.
\bgroup
-\catcode`\<=\@other
+\catcode`\<=\@other
\unexpanded\gdef\a@ins%
- {\ifmmode
+ {\ifmmode
\expandafter<%
- \else
- \leavevmode \bgroup
+ \else
+ \leavevmode \bgroup
\arab@codes \set@arabfont \@waslafalse \@wasfalse
- \expandafter\arab@insert
+ \expandafter\arab@insert
\fi}
-\unexpanded\gdef\<{\a@ins}
+\unexpanded\gdef\<{\a@ins}
\catcode`\<=\active
\global\let<=\a@ins
\egroup
-%D We also need to register a few macros:
+%D We also need to register a few macros:
\all@w@ne\initializeARABTEXalternative % one argument, internal command
-\all@wcmd\tx % no argument, small font
-\all@wcmd\txx % no argument, smaller font
+\all@wcmd\tx % no argument, small font
+\all@wcmd\txx % no argument, smaller font
-%D The main definitions are:
+%D The main definitions are:
-\definefontsynonym [ArabicRegular] [xnsh14]
-\definefontsynonym [ArabicBold] [xnsh14bf]
+\definefontsynonym [ArabicRegular] [xnsh14]
+\definefontsynonym [ArabicBold] [xnsh14bf]
\defineARABTEXalternative
[arabic]
@@ -281,9 +281,9 @@
[\c!binnen=\setmaghribi,
\c!letter=\setarabfont\fontstylesuffix]
-%D Apart from such definitions, one can adapt the settings
-%D using \type {\setupARABTEXalternative}.
-%D
+%D Apart from such definitions, one can adapt the settings
+%D using \type {\setupARABTEXalternative}.
+%D
%D A few years ago at the Holland Festivities, I attended {\em
%D The Cave}, one of the most impressive combinations of music
%D and video I know. This composition of Steve Reich (music)
@@ -294,25 +294,25 @@
%D interviews, music, and |<|believe it or not|>| rhythmic
%D typography are the cornerstones. Remembering those big
%D screens, it strikes me that like music, \TEX\ too is a
-%D perfect instrument to cross cultural and linguistic
-%D borders. So, let's:
+%D perfect instrument to cross cultural and linguistic
+%D borders. So, let's:
-\protect
+\protect
%D those macros,
-\endinput
+\endinput
%D and use them!
% \defineconversion [abjad] [\abj@d]
%
% voetnoten verbatim lijsten indexen tabellen uitlijnen
-%
+%
% \v!hoofdstuk=al-fa.slu
% \v!inhoud=al-mu.htawayAtu
% \v!figuren=qA'imaTu al-.suwaru
% \v!tabellen=qA'imaTu al-^gadAwilu
% \v!grafieken=qA'imaTu al-rusUmu
-% \v!index=al-fihrisu
+% \v!index=al-fihrisu
% \v!bijlage=al-mul.haqu
diff --git a/tex/context/base/font-chi.tex b/tex/context/base/font-chi.tex
index c72f464c7..6f5f77d3b 100644
--- a/tex/context/base/font-chi.tex
+++ b/tex/context/base/font-chi.tex
@@ -400,7 +400,7 @@
\advance\dimen2 \@@vtafstand
\divide\dimen0 \number\dimen2
\edef\@@vtn{\number\dimen0}}%
- \startkolommen
+ \startcolumns
[\c!richting=\@@vtrichting,
\c!balanceren=\@@vtbalanceren,
\c!afstand=\@@vtafstand,
@@ -408,7 +408,7 @@
#1]}
\def\stopvertical
- {\stopkolommen
+ {\stopcolumns
\egroup}
\setupchinese
@@ -492,22 +492,22 @@
%D \def\DoIt #1 #2 %
%D {\hbox{\hbox to 2em{\uchar{#1}{#2}\hss}#1 #2}\par}
%D
-%D \startkolommen[n=5]
+%D \startcolumns[n=5]
%D \DoIt 161 162 \DoIt 161 163 \DoIt 161 164 \DoIt 161 167 \DoIt 161 173
%D \DoIt 161 175 \DoIt 161 177 \DoIt 161 179 \DoIt 161 181 \DoIt 161 183
%D \DoIt 161 185 \DoIt 161 187 \DoIt 161 189 \DoIt 161 191 \DoIt 161 227
%D \DoIt 161 228 \DoIt 161 229 \DoIt 163 161 \DoIt 163 162 \DoIt 163 167
%D \DoIt 163 169 \DoIt 163 172 \DoIt 163 174 \DoIt 163 186 \DoIt 163 187
%D \DoIt 163 190 \DoIt 163 191 \DoIt 163 221 \DoIt 163 253
-%D \stopkolommen
+%D \stopcolumns
%D
%D A linebreak is not permitted after the following glyphs:
%D
-%D \startkolommen[n=5]
+%D \startcolumns[n=5]
%D \DoIt 161 174 \DoIt 161 176 \DoIt 161 178 \DoIt 161 180 \DoIt 161 182
%D \DoIt 161 184 \DoIt 161 186 \DoIt 161 188 \DoIt 161 190 \DoIt 163 168
%D \DoIt 163 219 \DoIt 163 224 \DoIt 163 251
-%D \stopkolommen
+%D \stopcolumns
%D \macros
%D {tracechinesetrue, showchinesetracelegend}
diff --git a/tex/context/base/font-ini.tex b/tex/context/base/font-ini.tex
index 494308489..4e5ead1f6 100644
--- a/tex/context/base/font-ini.tex
+++ b/tex/context/base/font-ini.tex
@@ -1456,7 +1456,8 @@
%D for helping me sort this out.
%D \macros
-%D {definefontsynonym}
+%D {definefontsynonym, doifelsefontsynonym,
+%D expandfontsynonym, truefontname, truefontdata}
%D
%D While looking for fonts, fontsynonyms are used for accessing
%D the files!
@@ -1541,6 +1542,18 @@
\@EA\truefontname\csname\??ff\fontclass#1\endcsname
\fi}
+\def\expandfontsynonym#1#2% #2 := onelevelexpansion(#1)
+ {\@EA\ifx\csname\??ff\fontclass#2\endcsname\relax\else
+ \expandafter\def\expandafter#1\expandafter{\csname\??ff\fontclass#2\endcsname}%
+ \fi}
+
+\def\doifelsefontsynonym#1%
+ {\@EA\ifx\csname\??ff\fontclass#1\endcsname\relax
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
+
\endTEX
\beginETEX \ifcsname
@@ -1569,7 +1582,20 @@
#1%
\fi\fi}
+\def\expandfontsynonym#1#2% #2 := onelevelexpansion(#1)
+ {\ifcsname\??ff\fontclass#2\endcsname
+ \expandafter\def\expandafter#1\expandafter{\csname\??ff\fontclass#2\endcsname}%
+ \fi}
+
+\def\doifelsefontsynonym#1%
+ {\ifcsname\??ff\fontclass#1\endcsname
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
\endETEX
+
%D \macros
%D {tracedfontname}
@@ -2074,17 +2100,40 @@
\def\checkbodyfontenvironment[#1]%
{\definebodyfontenvironment[\fontclass][#1][]}
-\def\setupbodyfontenvironment
- {\dotripleempty\dosetupbodyfontenvironment}
+% original
+%
+% \def\setupbodyfontenvironment
+% {\dotripleempty\dosetupbodyfontenvironment}
+%
+% \def\dosetupbodyfontenvironment[#1][#2][#3]% class size settings
+% {\@@beginfontdef
+% \ifthirdargument
+% \getparameters[\??ft#1#2][#3]%
+% \else
+% \getparameters[\??ft#1][#2]%
+% \fi
+% \@@endfontdef}
+%
+% this one already catches both define/setup
-\def\dosetupbodyfontenvironment[#1][#2][#3]% class size settings
- {\@@beginfontdef
- \ifthirdargument
- \getparameters[\??ft#1#2][#3]%
- \else
- \getparameters[\??ft#1][#2]%
- \fi
- \@@endfontdef}
+\def\setupbodyfontenvironment{\definebodyfontenvironment}
+
+% officially, but not needed (yet):
+%
+% \def\dosetupbodyfontenvironment[#1][#2][#3]% class size settings
+% {\ifthirdargument
+% \localbodyfontsize#2\relax
+% \normalizebodyfontsize\localbodyfontsize\to\normalizedbodyfontsize
+% \doifundefinedelse{\??ft#1\normalizedbodyfontsize\c!em}
+% {\definebodyfontenvironment[#1][#2][#3]}%
+% {\getparameters[\??ft#1\normalizedbodyfontsize][#3]}%
+% \else
+% \localbodyfontsize#1\relax
+% \normalizebodyfontsize\localbodyfontsize\to\normalizedbodyfontsize
+% \doifundefinedelse{\??ft\normalizedbodyfontsize\c!em}
+% {\definebodyfontenvironment[#1][#2]}%
+% {\getparameters[\??ft\normalizedbodyfontsize][#2]}%
+% \fi}
%D Just a couple of interface macros:
diff --git a/tex/context/base/hand-def.tex b/tex/context/base/hand-def.tex
index 5da5b9d94..ac1c8566a 100644
--- a/tex/context/base/hand-def.tex
+++ b/tex/context/base/hand-def.tex
@@ -376,7 +376,7 @@
% combined variants
-\definefonthandling [quality] [hz,extended,pure]
+\definefonthandling [quality] [hz,pure]
% A special case of guillemots, beware: when used ungrouped,
% it overloads all successive (current) encoding vector
diff --git a/tex/context/base/hand-ini.tex b/tex/context/base/hand-ini.tex
index a8a87db7e..d9a2edddc 100644
--- a/tex/context/base/hand-ini.tex
+++ b/tex/context/base/hand-ini.tex
@@ -323,8 +323,12 @@
{\dotripleempty\dodefinefonthandling}
\def\dodefinefonthandling[#1][#2][#3]%
- {\setvalue{\@fha@\@fha@#1}{#2}%
- \getparameters[\@fha@\@fha@#1][\c!type=\v!hangend,\c!links=1,\c!rechts=1,\c!min=20,\c!max=20,\c!stap=5,#3]}
+ {\ifthirdargument
+ \setvalue{\@fha@\@fha@#1}{#2}%
+ \getparameters[\@fha@\@fha@#1][\c!type=\v!hangend,\c!links=1,\c!rechts=1,\c!min=20,\c!max=20,\c!stap=5,#3]%
+ \else
+ \setvalue{\@fha@\@fha@\@fha@#1}{#2}%
+ \fi}
\def\setupfonthandling
{\dodoubleempty\dosetupfonthandling}
@@ -342,22 +346,45 @@
\def\fastenablehandling#1%
{\edef\askedfonthandling{#1}%
- \@EA\ifx\csname\@fha@\@fha@\askedfonthandling\endcsname\relax
- \expandafter\nofastenablehandling
+ \@EA\ifx\csname\@fha@\@fha@\@fha@\askedfonthandling\endcsname\relax
+ \@EA\ifx\csname\@fha@\@fha@\askedfonthandling\endcsname\relax
+ \@EAEAEA\nofastenablehandling
+ \else
+ \@EAEAEA\dofastenablehandling
+ \fi
+ \else
+ \@EA\redofastenablehandling
+ \fi}
+
+\def\xfastenablehandling#1%
+ {\edef\askedfonthandling{#1}%
+ \@EA\ifx\csname\@fha@\@fha@\askedfonthandling\endcsname
+ \@EA\nofastenablehandling
\else
- \expandafter\dofastenablehandling
+ \@EA\dofastenablehandling
\fi}
\endTEX
\beginETEX \ifcsname
-\def\fastenablehandling#1% also gets #2 passed
+\def\fastenablehandling#1#2% also gets #2 passed
+ {\edef\askedfonthandling{#1}%
+ \edef\filoffonthandling{#2}%
+ \ifcsname\@fha@\@fha@\@fha@\askedfonthandling\endcsname
+ \@EA\redofastenablehandling
+ \else\ifcsname\@fha@\@fha@\askedfonthandling\endcsname
+ \@EAEAEA\dofastenablehandling
+ \else
+ \@EAEAEA\nofastenablehandling
+ \fi\fi}
+
+\def\xfastenablehandling#1%
{\edef\askedfonthandling{#1}%
\ifcsname\@fha@\@fha@\askedfonthandling\endcsname
- \expandafter\dofastenablehandling
+ \@EA\dofastenablehandling
\else
- \expandafter\nofastenablehandling
+ \@EA\nofastenablehandling
\fi}
\endETEX
@@ -372,14 +399,18 @@
\setfontadjusting\askedfonthandling
\to \everyenablefonthandling
-\def\dofastenablehandling#1%
+\def\redofastenablehandling
+ {\edef\fonthandling{\csname\@fha@\@fha@\@fha@\askedfonthandling\endcsname}%
+ \rawprocesscommacommand[\fonthandling]\xfastenablehandling}
+
+\def\dofastenablehandling
{\the\everyenablefonthandling
\edef\fonthandling{\csname\@fha@\@fha@\askedfonthandling\endcsname}%
- \checkfonthandling{#1}%
+ \checkfonthandling\filoffonthandling
\rawprocesscommacommand[\fonthandling]\dodoenablehandling
- \registerfonthandling{#1}}
+ \registerfonthandling\filoffonthandling}
-\def\nofastenablehandling#1%
+\def\nofastenablehandling
{\the\everyenablefonthandling
\let\fonthandling\askedfonthandling
\dodoenablehandling\fonthandling}
@@ -404,12 +435,17 @@
%D We must not use \type {\purefontname} here (was a bug)!
-\def\checkfonthandling#1% we need a fast compare
- {\doifelsevalue{#1\s!handling\c!file}{\fontname\font}
- \skiphandlingdeftrue\skiphandlingdeffalse}
-
-\def\registerfonthandling#1%
- {\@EA\xdef\csname#1\s!handling\c!file\endcsname{\fontname\font}}
+% not robust as long as tex reuses definitions internally
+%
+% \def\checkfonthandling#1% we need a fast compare
+% {\doifelsevalue{#1\s!handling\c!file}{\fontname\font}
+% \skiphandlingdeftrue\skiphandlingdeffalse}
+%
+% \def\registerfonthandling#1%
+% {\@EA\xdef\csname#1\s!handling\c!file\endcsname{\fontname\font}}
+
+\def\checkfonthandling #1{\skiphandlingdeffalse}
+\let\registerfonthandling \gobbleoneargument
%D This one makes live easier (less definitions):
diff --git a/tex/context/base/m-cweb.tex b/tex/context/base/m-cweb.tex
index 805ec3b77..19f6a8375 100644
--- a/tex/context/base/m-cweb.tex
+++ b/tex/context/base/m-cweb.tex
@@ -1259,8 +1259,8 @@
\showCWEBindexentry{\currentCWEBindexentry}}}%
\egroup}
-\def\theCWEBbeforeindex {\startkolommen}
-\def\theCWEBafterindex {\stopkolommen}
+\def\theCWEBbeforeindex {\startcolumns}
+\def\theCWEBafterindex {\stopcolumns}
\def\processCWEBindex #1 %
{\bgroup
diff --git a/tex/context/base/m-newmat.tex b/tex/context/base/m-newmat.tex
index 8179af432..32aa7783b 100644
--- a/tex/context/base/m-newmat.tex
+++ b/tex/context/base/m-newmat.tex
@@ -8,8 +8,8 @@
%D copyright={PRAGMA / Taco Hoekwater}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
+%C details.
%D This module collects macros that \TEX\ users kind of expect
%D to be available when typesetting math. Most of them
@@ -17,73 +17,73 @@
%D freedom to adapt them to \CONTEXT. This module is derived
%D from the \type {m-math} module by Taco Hoekwater (partially
%D derived from AMS math modules) and adapted|/|extended by
-%D Hans Hagen.
+%D Hans Hagen.
%D Here we will add code on demand. So, just let us know what
-%D should go in here.
+%D should go in here.
%M \usemodule[newmat]
-\unprotect
+\unprotect
-%D \macros
+%D \macros
%D {qedsymbol}
-%D
+%D
%D [HH] The general Quod Erat Domonstrandum symbol is defined
%D in such a way that we can configure it. Because this symbol
%D is also used in text mode, we make it a normal text symbol
-%D with special behavior.
+%D with special behavior.
\def\qedsymbol#1%
- {\ifhmode
+ {\ifhmode
\unskip~\hfill#1\par
- \else\ifmmode
+ \else\ifmmode
\eqno#1\relax % Do we really need the \eqno here?
\else
\leavevmode\hbox{}\hfill#1\par
\fi\fi}
-\definesymbol [qed] [\qedsymbol{\mathematics{\square}}]
+\definesymbol [qed] [\qedsymbol{\mathematics{\square}}]
%D \macros
%D {QED}
-%D
+%D
%D [HH] For compatbility reasons we also provide the \type
%D {\QED} command. In case this command is overloaded, we still
-%D have the symbol available. \symbol[qed]
+%D have the symbol available. \symbol[qed]
\def\QED{\symbol[qed]}
%D \macros
%D {genfrac}
-%D
+%D
%D [TH] The definition of \type {\genfrac} \& co. is not
%D trivial, because it allows some flexibility. This is
%D supposed to be a user||level command, but will fail quite
%D desparately if called outside math mode (\CONTEXT\ redefines
-%D \type {\over})
-%D
-%D [HH] We clean up this macro a bit and (try) to make it
-%D understandable. The expansion is needed for generating
-%D the second argument to \type {\dogenfrac}, which is to
-%D be a control sequence like \type {\over}.
+%D \type {\over})
+%D
+%D [HH] We clean up this macro a bit and (try) to make it
+%D understandable. The expansion is needed for generating
+%D the second argument to \type {\dogenfrac}, which is to
+%D be a control sequence like \type {\over}.
\unexpanded\def\genfrac#1#2#3#4%
{\edef\!!stringa
{#1#2}%
\expanded
- {\dogenfrac{#4}%
+ {\dogenfrac{#4}%
\csname
\ifx @#3@%
- \ifx\!!stringa\empty
+ \ifx\!!stringa\empty
\strippedcsname\normalover
- \else
+ \else
\strippedcsname\normaloverwithdelims
\fi
- \else
- \ifx\!!stringa\empty
+ \else
+ \ifx\!!stringa\empty
\strippedcsname\normalabove
- \else
+ \else
\strippedcsname\normalabovewithdelims
\fi
\fi
@@ -115,84 +115,84 @@
%D Better:
-\def\frac#1#2{\mathematics{\genfrac{}{}{}\donothing{#1}{#2}}}
+\unexpanded\def\frac#1#2{\mathematics{\genfrac{}{}{}\donothing{#1}{#2}}}
-%D [HH] This shows up as:
+%D [HH] This shows up as:
%D
%D \startbuffer
%D $\dfrac {1}{2} \tfrac {1}{2} \frac {1}{2}$
%D $\dbinom{1}{2} \tbinom{1}{2} \binom{1}{2}$
%D \stopbuffer
-%D
+%D
%D \typebuffer
-%D
+%D
%D \getbuffer
%D \macros
%D {text}
-%D
+%D
%D [TH] \type {\text} is a command to typeset more or less
%D ordinary text inside of super- and sub|-|scripts. It has to
%D do a full font switch to get the sides right, so it will be
%D quite slow. \type {\text} kind of replaces \CONTEXT's \type
-%D {\mathstyle} command.
+%D {\mathstyle} command.
-%D [HH] This macro is now also moved to the core, but we
-%D keep it here as well for completeness.
-%D
-%D \startypen
+%D [HH] This macro is now also moved to the core, but we
+%D keep it here as well for completeness.
+%D
+%D \startypen
%D \unexpanded\def\mathtext
%D {\mathortext\domathtext\hbox} % {\ifmmode\@EA\dotext\else\@EA\hbox\fi}
-%D
+%D
%D \def\domathtext#1%
%D {\mathchoice
%D {\dodomathtext\displaystyle\textface {#1}}%
%D {\dodomathtext\textstyle \textface {#1}}%
%D {\dodomathtext\textstyle \scriptface {#1}}%
%D {\dodomathtext\textstyle \scriptscriptface{#1}}}
-%D
+%D
%D \def\dodomathtext#1#2#3% no \everymath !
%D %{\hbox{\everymath{#1}\switchtobodyfont [#2]#3}} % 15 sec
%D {\hbox{\everymath{#1}\setcurrentfontbody{#2}#3}} % 3 sec (no math)
-%D \stoptypen
+%D \stoptypen
-%D [HH] We use the following indirectness because \type {\text}
-%D is a natural candidate for user macros (actually, it is
-%D used in some modules).
+%D [HH] We use the following indirectness because \type {\text}
+%D is a natural candidate for user macros (actually, it is
+%D used in some modules).
%D
-%D \starttypen
-%D \let\text\mathtext
-%D \stoptypen
+%D \starttypen
+%D \let\text\mathtext
+%D \stoptypen
-%D [HH] Actually, the font switch is not that slow when
-%D typefaces are used. If needed this macro can be sped up.
-%D
+%D [HH] Actually, the font switch is not that slow when
+%D typefaces are used. If needed this macro can be sped up.
+%D
%D \startbuffer
%D ordinary text $x^{\text{extra ordinary text}}$
%D \stopbuffer
%D
%D \typebuffer
-%D
+%D
%D \getbuffer
%D \macros
%D {mathhexbox}
-%D
+%D
%D [TH] \type {\mathhexbox} is also user||level (already
%D defined in Plain \TEX). It allows to get a math character
-%D inserted as if it was a text character.
+%D inserted as if it was a text character.
\gdef\mathhexbox#1#2#3{\mathtext{$\m@th\mathchar"#1#2#3$}}
-%D \macros
+%D \macros
%D {boxed}
%D
-%D [HH] Another macro that users expect (slightly adapted):
+%D [HH] Another macro that users expect (slightly adapted):
\def\boxed%
{\ifmmode\expandafter\mframed\else\expandafter\framed\fi}
-%D \macros
+%D \macros
%D {cfrac}
%D
%D [HH] Now let us see what this one does:
@@ -201,9 +201,9 @@
%D $\cfrac{12}{3} \cfrac[l]{12}{3} \cfrac[c]{12}{3} \cfrac[r]{12}{3}$
%D $\cfrac{1}{23} \cfrac[l]{1}{23} \cfrac[c]{1}{23} \cfrac[r]{1}{23}$
%D \stopbuffer
-%D
-%D \typebuffer
-%D
+%D
+%D \typebuffer
+%D
%D \getbuffer
\definecomplexorsimple\cfrac
@@ -218,7 +218,7 @@
{#3}}%
\kern-\nulldelimiterspace}
-%D [HH] The next alternative is nicer:
+%D [HH] The next alternative is nicer:
\def\simplecfrac {\docfrac[cc]}
\def\complexcfrac[#1]{\docfrac[#1cc]}
@@ -231,7 +231,7 @@
{\ifx r#2\hfill\fi#5\ifx l#2\hfill\fi}%
\kern-\nulldelimiterspace}}
-%D [HH] Now we can align every combination we want:
+%D [HH] Now we can align every combination we want:
%D
%D \startbuffer
%D $\cfrac{12}{3} \cfrac[l]{12}{3} \cfrac[c]{12}{3} \cfrac[r]{12}{3}$
@@ -239,19 +239,19 @@
%D $\cfrac[cl]{12}{3} \cfrac[cc]{12}{3} \cfrac[cr]{12}{3}$
%D $\cfrac[lc]{1}{23} \cfrac[cc]{1}{23} \cfrac[rc]{1}{23}$
%D \stopbuffer
-%D
-%D \typebuffer
-%D
+%D
+%D \typebuffer
+%D
%D \getbuffer
-\protect \endinput
+\protect \endinput
%D \macros
%D {startsubarray,substack,startsmallmatrix}
%D
-%D [HH] I wonder what these are supposed to do. An example
-%D will be inserted later. Contrary to the original we
-%D support an optional argument between either \type {{}} or
+%D [HH] I wonder what these are supposed to do. An example
+%D will be inserted later. Contrary to the original we
+%D support an optional argument between either \type {{}} or
%D \type {[]}.
\def\startsubarray
@@ -287,8 +287,8 @@
{\null
\,%
\vcenter\bgroup
- \baselineskip6\ex@
- \lineskip1.5\ex@
+ \baselineskip6\ex@
+ \lineskip1.5\ex@
\lineskiplimit\lineskip
\ialign\bgroup\hfil$\m@th\scriptstyle##$\hfil&&\thickspace\hfil
$\m@th\scriptstyle##$\hfil\crcr}
@@ -298,4 +298,4 @@
\egroup
\,}
-\protect \endinput
+\protect \endinput
diff --git a/tex/context/base/m-visual.tex b/tex/context/base/m-visual.tex
new file mode 100644
index 000000000..30daf3405
--- /dev/null
+++ b/tex/context/base/m-visual.tex
@@ -0,0 +1,287 @@
+%D \module
+%D [ file=m-visual,
+%D version=2000.01.10,
+%D title=\CONTEXT\ Extra Modules,
+%D subtitle=Visualization and Faking,
+%D author={Hans Hagen \& Ton Otten},
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+%D This module collect a few more visual debugger features. I
+%D needed them for manuals and styles. The macros are documented
+%D in a my way document.
+
+\definecolor[fakerulecolor] [black]
+\definecolor[fakebaselinecolor] [green]
+\definecolor[fakeparindentcolor][blue]
+
+\newif\iffakebaseline \fakebaselinetrue
+
+\def\fakerule#1%
+ {\strut
+% \startcolor[fakerulecolor]%
+ \iffakebaseline
+ \vrule\!!height1.25ex\!!depth-.05ex\!!width#1%
+ \kern-#1%
+ \vrule\!!height-.05ex\!!depth .25ex\!!width#1%
+ \else
+ \vrule\!!height1.25ex\!!depth .25ex\!!width#1%
+ \fi
+ \stopcolor
+ \allowbreak}
+
+% can be used in hbox, so %'s are really needed
+
+\unexpanded\def\fakelines#1#2% min max / 3 10
+ {\fakeparindent
+ \scratchdimen\hsize
+ \ifindentation
+ \advance\scratchdimen -\parindent
+ \fi
+ \fakerule\scratchdimen\break
+ \getrandomcount\scratchcounter{\ifcase0#1 3\else#1\fi}{\ifcase0#2 10\else#2\fi}%
+ \dorecurse\scratchcounter{\fakerule\hsize}%
+ \getrandomdimen\scratchdimen{.25\hsize}\hsize
+ \fakerule\scratchdimen
+ \par} % indeed
+
+\unexpanded\def\fakewords
+ {\ifvmode\fakeparindent\fi\onlyfakewords}
+
+\definepalet
+ [fakerule]
+ [fr1c=darkred,
+ fr2c=darkgreen,
+ fr3c=darkblue,
+ fr4c=darkyellow,
+ fr5c=darkgray]
+
+\unexpanded\def\onlyfakewords#1#2% min max / 10 40
+ {\getrandomcount\scratchcounter{\ifcase0#1 10\else#1\fi}{\ifcase0#2 40\else#2\fi}%
+ \dofakewords\scratchcounter
+ } % no \par
+
+\unexpanded\def\fakenwords#1#2% words seed
+ {\fakeparindent
+ \getrandomseed\fakedwordseed
+ \setrandomseed{\ifcase0#2 #1\else#2\fi}%
+ \dofakewords{#1}%
+ \setrandomseed\fakedwordseed
+ } % no \par
+
+\def\dofakewords#1%
+ {\bgroup
+ \dorecurse{#1}
+ {\getrandomcount\scratchcounter{1}{5}%
+ \dorecurse\scratchcounter
+ {\getrandomdimen\scratchdimen{.5em}{1.25em}%
+ \fakerule\scratchdimen}%
+ \space}%
+ \removeunwantedspaces
+ \egroup}
+
+\def\doshowfakewords#1%
+ {\bgroup
+ \setuppalet[fakerule]%
+ \definecolor[fakerulecolor]%
+ \dorecurse{#1}
+ {\getrandomcount\scratchcounter{1}{5}%
+ \dorecurse\scratchcounter
+ {\getrandomdimen\scratchdimen{.5em}{1.25em}%
+ \color[fr\recurselevel c]{\fakerule\scratchdimen}}%
+ \space}%
+ \removeunwantedspaces
+ \egroup}
+
+\def\showfakewords{\let\dofakewords\doshowfakewords}
+
+\def\fakeword
+ {\fakewords{1}{1}} % no \plusone
+
+\def\fakeparindent
+ {\noindent
+ \ifindentation
+ \ifx\dofakedroppedcaps\relax
+ {\fakeparindentcolor
+ \vrule
+ \!!height \strutheight % not longer .5ex
+ \!!depth \strutdepth % not longer 0pt
+ \!!width \parindent}%
+ \else
+ \dofakedroppedcaps \let\dofakedroppedcaps\relax
+ \fi
+% \else
+% \dontleavehmode
+ \fi}
+
+\let\dofakedroppedcaps\relax
+
+\unexpanded\def\fakedroppedcaps#1%
+ {\ifnum#1>0
+ \def\dofakedroppedcaps
+ {\setbox\scratchbox\hbox
+ {\setbox\scratchbox\hbox{W}%
+ \scratchdimen#1\lineheight
+ \advance\scratchdimen -\lineheight
+ \advance\scratchdimen \dp\strutbox
+ \vrule
+ \!!width#1\wd\scratchbox
+ \!!height\ht\scratchbox
+ \!!depth\scratchdimen}%
+ \ht\scratchbox\ht\strutbox
+ \dp\scratchbox\dp\strutbox
+ \hangindent\wd\scratchbox
+ \advance\hangindent .5em
+ \wd\scratchbox\hangindent
+ \hangafter-#1\noindent
+ \llap{\fakeparindentcolor\box\scratchbox}}%
+ \fi}
+
+\newcounter\noffakedfigures
+
+\unexpanded\def\showfakefigure
+ {\donetrue\dodoubleempty\dofakefigure}
+
+\unexpanded\def\fakefigure
+ {\donefalse\dodoubleempty\dofakefigure}
+
+\def\dofakefigure[#1][#2]#3#4#5#6% [] [] minwidth maxwidth minheight maxheight
+ {\doglobal\increment\noffakedfigures
+ \ifdone
+ \endgraf
+ \hbox to \hsize
+ {\hss\fakeparindentcolor
+ \strut\bf Figure \noffakedfigures
+ \doifsomething{#1}{\space(#1)}%
+ \hss}
+ \endgraf
+ \fi
+ \getvalue{\e!plaats\v!figuur}
+ [#1][#2]%
+ {\freezerandomseed
+ \let\endstrut\relax
+ \let\begstrut\relax
+ \doifinsetelse{#1}{\v!links,\v!rechts}
+ {\fakewords{2}{4}}
+ {\fakewords{4}{10}}}%
+ {\getrandomdimen{\dimen0}{#3}{#4}%
+ \getrandomdimen{\dimen2}{#5}{#6}%
+ \doifinset{#1}{\v!links,\v!rechts}
+ {\dimen0=.75\dimen0
+ \ifdim\dimen0>.6\hsize \dimen0=.5\hsize\fi
+ \ifdim\dimen0<.3\hsize \dimen0=.3\hsize\fi}%
+ \framed
+ [\c!breedte=\dimen0,
+ \c!hoogte=\dimen2,
+ \c!kader=\ifincolor\v!uit\else\v!aan\fi,
+ \c!achtergrond=\v!kleur,
+ \c!achtergrondkleur=fakeparindentcolor]
+ {\bf\white#1}}%
+ \defrostrandomseed}
+
+\def\fakeformula
+ {\dimen0\zeropoint
+ \getrandomcount\scratchcounter{3}{6}%
+ \dorecurse\scratchcounter
+ {\getrandomdimen\scratchdimen{1em}{3em}%
+ \mathinner{\red\fakerule\scratchdimen}%
+ \ifnum\recurselevel<\scratchcounter+\fi
+ \advance\scratchdimen\dimen0}%
+ =\mathinner{\red\fakerule\scratchdimen}}
+
+\def\fakespacingformula
+ {\color[fakebaselinecolor]{\ruledbaseline}\fakeformula}
+
+%D test \bodyfontgrid\space test
+%D test \emexgrid \space test
+
+\def\smashedgrid
+ {\dosingleempty\dosmashedgrid}
+
+\def\dosmashedgrid[#1]%
+ {\hsmashed
+ {\setbox\scratchbox=\hbox
+ {\basegrid
+ [\c!nx=10,\c!ny=10,\c!dx=1,\c!dy=1,
+ \c!eenheid=\bodyfontsize,#1]}%
+ \hbox to \zeropoint
+ {\hss\lower.5\ht\scratchbox\box\scratchbox\hss}%
+ \hbox to \zeropoint
+ {\hss
+ \black\vrule\!!width6\linewidth\!!height3\linewidth\!!depth3\linewidth
+ \hss}}}
+
+\def\bodyfontgrid
+ {\hbox
+ {{\linewidth.1pt\yellow\smashedgrid[\c!nx=30,\c!ny=30,\c!schaal=.3333]}%
+ {\linewidth.2pt\green \smashedgrid[\c!nx=20,\c!ny=20,\c!schaal=.5]}%
+ {\linewidth.3pt\red \smashedgrid[\c!nx=10,\c!ny=10,\c!schaal=1]}}}
+
+\def\emexgrid
+ {\hbox
+ {{\linewidth.15pt\green\smashedgrid[\c!nx=20,\c!ny=20,\c!eenheid=ex]}%
+ {\linewidth.15pt\red \smashedgrid[\c!nx=10,\c!ny=10,\c!eenheid=em]}}}
+
+%D The next few macros are not really public and kind of low
+%D level. They are obscure and a bit perverse.
+
+\definecolor[llblack][s=0.01]
+
+\def\lowlevelstream#1#2#3%
+ {\ifinotr \else
+ \dontleavehmode
+ \prewordbreak
+ \bgroup\bgroup % make sure aftergroup stuff is handled
+ %\let#1#2\optimizetransparencyfalse\black
+ \infofont\clap{\vl}\ignorespaces#3\unskip\clap{\vl}%
+ \egroup\egroup
+ \prewordbreak
+ \fi
+ #2{#3}}
+
+\let\normalPDFcode\PDFcode
+\let\normalspecial\special
+
+\def\showlowlevelstream
+ {\def\PDFcode{\lowlevelstream\PDFcode\normalPDFcode}%
+ \def\special{\lowlevelstream\special\normalspecial}}
+
+\def\showlowlevelstreamonly
+ {\def\PDFcode{\lowlevelstream\PDFcode\gobbleoneargument}%
+ \def\special{\lowlevelstream\special\gobbleoneargument}}
+
+\let\normaldostartgraymode \dostartgraymode
+\let\normaldostartgraycolormode\dostartgraycolormode
+\let\normaldostartrgbcolormode \dostartrgbcolormode
+\let\normaldostartcmykcolormode\dostartcmykcolormode
+\let\normaldostartspotcolormode\dostartspotcolormode
+
+\def\traceddostartgraymode#1%
+ {#1\normaldostartgraymode{#1}}
+
+\def\traceddostartgraycolormode#1%
+ {#1\normaldostartgraycolormode{#1}}
+
+\def\traceddostartrgbcolormode#1#2#3%
+ {#1 #2 #3\normaldostartrgbcolormode{#1}{#2}{#3}}
+
+\def\traceddostartcmykcolormode#1#2#3#4%
+ {#1 #2 #3 #4\normaldostartcmykcolormode{#1}{#2}{#3}{#4}}
+
+\def\traceddostartspotcolormode#1#2%
+ {#1 #2\normaldostartspotcolormode{#1}{#2}}
+
+\def\showcolormodes
+ {\let\dostartgraymode \traceddostartgraymode
+ \let\dostartgraycolormode\traceddostartgraycolormode
+ \let\dostartrgbcolormode \traceddostartrgbcolormode
+ \let\dostartcmykcolormode\traceddostartcmykcolormode
+ \let\dostartspotcolormode\traceddostartspotcolormode}
+
+\protect \endinput \ No newline at end of file
diff --git a/tex/context/base/meta-ini.tex b/tex/context/base/meta-ini.tex
index 802b669ec..f348b2ffd 100644
--- a/tex/context/base/meta-ini.tex
+++ b/tex/context/base/meta-ini.tex
@@ -86,6 +86,10 @@
graphictextdirective "\the\everyMPTEXgraphic";
\to \MPextensions
+% \appendtoks
+% textextdirective "\the\everyMPTEXgraphic";
+% \to \MPextensions
+
%D A signal that we're in combines \CONTEXT||\METAFUN mode:
\appendtoks
@@ -788,12 +792,7 @@
%D However, on a 1 Gig Pentium, the next alternative saves
%D us 20 seconds run time for the 300 page \METAFUN\ manual:
-\def\insertMPfile#1#2%
- {\doiffileelse{./#1}
- {\ifcase\pdfoutput
- \@EA\includeMPasEPS\else\@EA\includeMPasPDF
- \fi{./#1}}
- {\message{[MP #1]}}}
+\def\insertMPfile#1#2{\doinsertMPfile{#1}}
\def\includeMPasEPS#1%
{\bgroup
@@ -803,7 +802,7 @@
\setbox\scratchbox\vbox to \!!heightb
{\vfill
\doinsertfile
- {\c!mps,\c!mps}{#1,\empty}{100}{100}
+ {\c!mps,\c!mps}{#1,\empty}{100}{100}%
\!!widtha\!!heighta\!!widthb\!!heightb\zerocount}%
\wd\scratchbox\!!widthb
\dp\scratchbox\zeropoint
diff --git a/tex/context/base/mult-com.tex b/tex/context/base/mult-com.tex
index cb8dafc1a..db1435ab1 100644
--- a/tex/context/base/mult-com.tex
+++ b/tex/context/base/mult-com.tex
@@ -773,13 +773,13 @@ stelnummerin: stelnummerin setupnumber
regelrechts: regelrechts rightaligned
rechtsbuendig zarovnanovpravo
allineadestra aliniatdreapta
- startkolommen: startkolommen startcolumns
+ startcolumns: startkolommen startcolumns
startspalten startsloupce
iniziacolonne startcoloane
- stopkolommen: stopkolommen stopcolumns
+ stopcolumns: stopkolommen stopcolumns
stopspalten stopsloupce
terminacolonne stopcoloane
- stelkolommenin: stelkolommenin setupcolumns
+ setupcolumns: stelkolommenin setupcolumns
stellespaltenein nastavsloupce
impostacolonne seteazacoloane
column: kolom column
diff --git a/tex/context/base/mult-con.tex b/tex/context/base/mult-con.tex
index 587a0c9a1..a4e24f508 100644
--- a/tex/context/base/mult-con.tex
+++ b/tex/context/base/mult-con.tex
@@ -1307,9 +1307,12 @@ zijuitlijnen: zijuitlijnen sidealign
objektabstand pocitat
lato parte
% new
-veldlaag: veldlaag fieldlayer
- fieldlayer fieldlayer
- fieldlayer fieldlayer
+ veldlaag: veldlaag fieldlayer
+ fieldlayer fieldlayer
+ fieldlayer fieldlayer
+tekstlaag: tekstlaag textlayer
+ textlayer textlayer
+ textlayer textlayer
veldachtergrondkleur: veldachtergrondkleur fieldbackgroundcolor
feldhintergrundfarbe barvapozadipole
coloresfondocampo culoarefundalcamp
diff --git a/tex/context/base/page-app.tex b/tex/context/base/page-app.tex
index 6f21c82f2..e522b5673 100644
--- a/tex/context/base/page-app.tex
+++ b/tex/context/base/page-app.tex
@@ -74,19 +74,23 @@
\def\dostartfittingpage[#1][#2]%
{\pagina % this is kind of tricky! there can be preceding page refs
\bgroup % resulting in a zero height page; test fig-make !
+ \def\currentfittingpage{#1}%
\dontcomplain
% runs under current page regime, i.e. page variables passed to mp
+ \getparameters[\currentfittingpage][\c!papier=,#2]% auto or size or nothing
\setbox\scratchbox\hbox
\bgroup
- \getparameters[#1][#2]%
- \doifvalue{#1\c!marge}{\v!pagina}
+ % needed later \getparameters[\currentfittingpage][\c!papier=,#2]% auto or size or nothing
+ \doifvalue{\currentfittingpage\c!marge}\v!pagina % undocumented
{\offsetbox
[\c!linkeroffset=\rugwit,
\c!rechteroffset=\snijwit,
\c!bovenoffset=\kopwit,
\c!onderoffset=\bodemwit]\hbox}%
\bgroup
- \schaal[\c!schaal=\getvalue{#1\c!schaal}]\bgroup\localframed[#1]\bgroup}
+ \schaal[\c!schaal=\getvalue{\currentfittingpage\c!schaal}]%
+ \bgroup\localframed[\currentfittingpage]%
+ \bgroup}
\def\dostopfittingpage
{\egroup % localframed
@@ -102,8 +106,12 @@
\edef\fittinght{\the\lineheight}%
\fi
\let\checkcurrentlayout\relax % else interference with odd/even layout
- \setuppapersize
- [\??fp\s!dummy][\??fp\s!dummy]%
+ \processaction
+ [\getvalue{\currentfittingpage\c!papier}]
+ [ \v!auto=>\let\fittingpapersize\printpapersize,
+ \s!unknown=>\let\fittingpapersize\commalistelement,
+ \s!default=>\def\fittingpapersize{\??fp\s!dummy}]%
+ \expanded{\setuppapersize[\??fp\s!dummy][\fittingpapersize]}%
\definelayout
[\v!pagina]%
[\c!plaats=\v!midden,
diff --git a/tex/context/base/page-imp.tex b/tex/context/base/page-imp.tex
index 3c9a899bd..7d0491e4c 100644
--- a/tex/context/base/page-imp.tex
+++ b/tex/context/base/page-imp.tex
@@ -164,13 +164,14 @@
\hbox % \setbox0=\box.. is nicer
{\setbox0\hbox{#1}% just in case there are objects there
\setbox\scratchbox\hbox
- {\the\everyshipout\relax
- % so, these two come *after* the main one
+ {% before the main one !
\ifcase\realfolio \or
\the\everyfirstshipout
\global\everyfirstshipout\emptytoks
\fi
- % one page document can do both
+ % the main one
+ \the\everyshipout\relax
+ % always last (and after the main one)
\ifnum\realpageno=\lastpage\relax
\flushtextdata
\the\everylastshipout
@@ -1045,10 +1046,9 @@
\@@ipboven
\hbox to \hsize
{\@@iplinks
-\ifnum\combinedpagescounter>\@@ipstop\relax
- \globallet\@@ipn\!!zerocount
-\else
- \ifnum\combinedpagescounter>\@@ipn \else
+ \ifnum\combinedpagescounter>\@@ipstop\relax
+ \globallet\@@ipn\!!zerocount
+ \else\ifnum\combinedpagescounter>\@@ipn \else
\externalfigure[#1]
[\c!object=\v!nee,
\c!pagina=\combinedpagescounter,
@@ -1056,8 +1056,7 @@
\c!achtergrond=\@@ipachtergrond,
\c!achtergrondkleur=\@@ipachtergrondkleur,
\c!kader=\@@ipkader]%
- \fi
-\fi
+ \fi\fi
\@@iprechts}
\@@iponder}%
\doglobal\increment\combinedpagescounter
@@ -1079,13 +1078,14 @@
{\dorecurse\@@ipnx
{\doglobal\increment\combinedpagescounter
\ifnum\combinedpagescounter>\@@ipn \else
- \externalfigure[#1]
+ \expanded{\externalfigure[#1]
[\c!pagina=\combinedpagescounter,
- \c!breedte=\!!widtha,
+ \c!breedte=\the\!!widtha,% todo \freezedimenmacro
\c!achtergrond=\@@ipachtergrond,
\c!achtergrondkleur=\@@ipachtergrondkleur,
- \c!kader=\@@ipkader]%
- \fi}}%
+ \c!kader=\@@ipkader]}%
+ \hfill
+ \fi}\hfillneg}%
\stopbaselinecorrection
\ifnum\combinedpagescounter<\@@ipn\relax
\@@iptussen
diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex
index 2cd300ccf..37dbc8835 100644
--- a/tex/context/base/page-ini.tex
+++ b/tex/context/base/page-ini.tex
@@ -664,19 +664,6 @@
\newtoks \mainoutput
\newcount\otrlevel
-% Shipout handler (see page[stop] for example usage)
-
-\ifx\undefined\normalshipout \let\normalshipout=\shipout \fi
-
-\def\noshipout
- {\writestatus\m!systems{ignoring further shipouts}%
- \dowithnextbox{\deadcycles\zerocount}}
-
-\def\doignorerestoftext
- {\ifarrangingpages \else \ifnum\textlevel>\zerocount \else
- \globallet\shipout\noshipout
- \fi \fi}
-
% When issuing two \par\penalty-\@M's, only the first
% triggers the otr; obscure feature or optimization?
@@ -1501,7 +1488,7 @@
\installpagebreakhandler \s!default
{} % do nothing if empty
-\installpagebreakhandler \v!reset
+\installpagebreakhandler \v!reset
{% better not: \global\chardef\pageornamentstate\zerocount
\resetpagebreak}
@@ -1696,14 +1683,16 @@
% We don't want spurious last pages (due to left over marks):
+\ifx\undefined\normalshipout \let\normalshipout=\shipout \fi
+
+\def\noshipout
+ {\writestatus\m!systems{ignoring further shipouts}%
+ \dowithnextbox{\deadcycles\zerocount}}
+
\def\doignorerestoftext
- {\ifarrangingpages \else
- \ifnum\textlevel>\zerocount \else
- \gdef\shipout
- {\writestatus\m!systems{ignoring further shipouts}%
- \dowithnextbox{\deadcycles\zerocount}}%
- \fi
- \fi}
+ {\ifarrangingpages \else \ifnum\textlevel>\zerocount \else
+ \globallet\shipout\noshipout
+ \fi \fi}
\let\ignorerestoftext\donothing
@@ -1711,9 +1700,9 @@
\globallet\ignorerestoftext\doignorerestoftext
\to \everystarttext
-\appendtoks
- \ignorerestoftext
-\to \everylastshipout
+% \appendtoks
+% \ignorerestoftext
+% \to \everylastshipout
\newif\ifgeselecteerd \geselecteerdtrue
\newif\ifselecteren \selecterenfalse
diff --git a/tex/context/base/page-lay.tex b/tex/context/base/page-lay.tex
index 2f5954b62..309471878 100644
--- a/tex/context/base/page-lay.tex
+++ b/tex/context/base/page-lay.tex
@@ -279,9 +279,10 @@
\def\dodefinepapersize[#1][#2]%
{\ifsecondargument
- \getparameters
- [\??pp#1] % geen \c!schaal, scheelt hash ruimte
- [\c!breedte=\@@ppbreedte,\c!hoogte=\@@pphoogte,\c!offset=\@@ppoffset,#2]%
+ \doifsomething{#1} % to be sure
+ {\getparameters
+ [\??pp#1] % geen \c!schaal, scheelt hash ruimte
+ [\c!breedte=\@@ppbreedte,\c!hoogte=\@@pphoogte,\c!offset=\@@ppoffset,#2]}%
\else
\getparameters[\??pp][#1]%
\setuppapersize
@@ -352,55 +353,69 @@
{\getparameters[\??pp#1][#2]}
{\dodosetuppapersize[#1][#2]}}}
+% \def\dodosetuppapersize[#1][#2]%
+% {\ifsecondargument
+% \xdef\restorepapersize
+% {\noexpand\setuppapersize[#1][#2]}%
+% \dostelpapierrichtingin{#1}\paperlandscape\paperrotation\paperreverse\papermirror
+% \dostelpapierrichtingin{#2}\printlandscape\printrotation\printreverse\printmirror
+% \def\docommando##1%
+% {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
+% {\global\papierbreedte\getvalue{\??pp##1\c!breedte}%
+% \global\papierhoogte\getvalue{\??pp##1\c!hoogte}%
+% \calculatepaperoffsets{##1}%
+% \xdef\papersize{##1}}}}%
+% \processcommacommand[#1]\docommando
+% \doifdefinedelse{\??pp#1\c!schaal}
+% {\edef\paperscale{\getvalue{\??pp#1\c!schaal}}}
+% {\edef\paperscale{1}}%
+% \def\docommando##1%
+% {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
+% {\global\printpapierbreedte\getvalue{\??pp##1\c!breedte}%
+% \global\printpapierhoogte\getvalue{\??pp##1\c!hoogte}%
+% \xdef\printpapersize{##1}}}}%
+% \processcommacommand[#2]\docommando
+% \global\setdimentoatleast\papierbreedte \onepoint
+% \global\setdimentoatleast\papierhoogte \onepoint
+% \global\setdimentoatleast\printpapierbreedte\onepoint
+% \global\setdimentoatleast\printpapierhoogte \onepoint
+% \ifcase\paperlandscape\else
+% \doglobal\swapdimens\papierbreedte\papierhoogte
+% \fi
+% \ifcase\printlandscape\else
+% \doglobal\swapdimens\printpapierbreedte\printpapierhoogte
+% \fi
+% % this check can be confusing, so we've added the possibility
+% % to bypass this test: \setuppapersize[option=fit]
+% \doif\@@ppoptie\v!max % \v!fit is
+% {\bgroup
+% % we need to pre-swap else we get the wrong paper size
+% \doifinset\paperrotation{90,270}{\swapdimens\papierbreedte\papierhoogte}%
+% \doifinset\printrotation{90,270}{\swapdimens\printpapierbreedte\printpapierhoogte}%
+% \ifdim\papierhoogte>\printpapierhoogte
+% \global\printpapierhoogte\papierhoogte
+% \writestatus\m!systems{print height forced to paper height}%
+% \fi
+% \ifdim\papierbreedte>\printpapierbreedte
+% \global\printpapierbreedte\papierbreedte
+% \writestatus\m!systems{print width forced to paper width}%
+% \fi
+% \egroup}%
+% %
+% \calculatehsizes
+% \calculatevsizes
+% \recalculatelogos
+% \recalculatebackgrounds
+% \recalculatelayout
+% \else\iffirstargument
+% \setuppapersize[#1][#2]%
+% \else\ifx\papersize\undefined\else
+% \restorepapersize
+% \fi\fi\fi}
+
\def\dodosetuppapersize[#1][#2]%
{\ifsecondargument
- \xdef\restorepapersize
- {\noexpand\setuppapersize[#1][#2]}%
- \dostelpapierrichtingin{#1}\paperlandscape\paperrotation\paperreverse\papermirror
- \dostelpapierrichtingin{#2}\printlandscape\printrotation\printreverse\printmirror
- \def\docommando##1%
- {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
- {\global\papierbreedte\getvalue{\??pp##1\c!breedte}%
- \global\papierhoogte\getvalue{\??pp##1\c!hoogte}%
- \calculatepaperoffsets{##1}%
- \xdef\papersize{##1}}}}%
- \processcommacommand[#1]\docommando
- \doifdefinedelse{\??pp#1\c!schaal}
- {\edef\paperscale{\getvalue{\??pp#1\c!schaal}}}
- {\edef\paperscale{1}}%
- \def\docommando##1%
- {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
- {\global\printpapierbreedte\getvalue{\??pp##1\c!breedte}%
- \global\printpapierhoogte\getvalue{\??pp##1\c!hoogte}%
- \xdef\printpapersize{##1}}}}%
- \processcommacommand[#2]\docommando
- \global\setdimentoatleast\papierbreedte \onepoint
- \global\setdimentoatleast\papierhoogte \onepoint
- \global\setdimentoatleast\printpapierbreedte\onepoint
- \global\setdimentoatleast\printpapierhoogte \onepoint
- \ifcase\paperlandscape\else
- \doglobal\swapdimens\papierbreedte\papierhoogte
- \fi
- \ifcase\printlandscape\else
- \doglobal\swapdimens\printpapierbreedte\printpapierhoogte
- \fi
- % this check can be confusing, so we've added the possibility
- % to bypass this test: \setuppapersize[option=fit]
- \doif\@@ppoptie\v!max % \v!fit is
- {\bgroup
- % we need to pre-swap else we get the wrong paper size
- \doifinset\paperrotation{90,270}{\swapdimens\papierbreedte\papierhoogte}%
- \doifinset\printrotation{90,270}{\swapdimens\printpapierbreedte\printpapierhoogte}%
- \ifdim\papierhoogte>\printpapierhoogte
- \global\printpapierhoogte\papierhoogte
- \writestatus\m!systems{print height forced to paper height}%
- \fi
- \ifdim\papierbreedte>\printpapierbreedte
- \global\printpapierbreedte\papierbreedte
- \writestatus\m!systems{print width forced to paper width}%
- \fi
- \egroup}%
- %
+ \dododosetuppapersize[#1][#2]%
\calculatehsizes
\calculatevsizes
\recalculatelogos
@@ -412,6 +427,54 @@
\restorepapersize
\fi\fi\fi}
+\def\dododosetuppapersize[#1][#2]%
+ {\xdef\restorepapersize
+ {\noexpand\setuppapersize[#1][#2]}%
+ \dostelpapierrichtingin{#1}\paperlandscape\paperrotation\paperreverse\papermirror
+ \dostelpapierrichtingin{#2}\printlandscape\printrotation\printreverse\printmirror
+ \def\docommando##1%
+ {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
+ {\global\papierbreedte\getvalue{\??pp##1\c!breedte}%
+ \global\papierhoogte\getvalue{\??pp##1\c!hoogte}%
+ \calculatepaperoffsets{##1}%
+ \xdef\papersize{##1}}}}%
+ \processcommacommand[#1]\docommando
+ \doifdefinedelse{\??pp#1\c!schaal}
+ {\edef\paperscale{\getvalue{\??pp#1\c!schaal}}}
+ {\edef\paperscale{1}}%
+ \def\docommando##1%
+ {\doifsomething{##1}{\doifdefined{\??pp##1\c!breedte}
+ {\global\printpapierbreedte\getvalue{\??pp##1\c!breedte}%
+ \global\printpapierhoogte\getvalue{\??pp##1\c!hoogte}%
+ \xdef\printpapersize{##1}}}}%
+ \processcommacommand[#2]\docommando
+ \global\setdimentoatleast\papierbreedte \onepoint
+ \global\setdimentoatleast\papierhoogte \onepoint
+ \global\setdimentoatleast\printpapierbreedte\onepoint
+ \global\setdimentoatleast\printpapierhoogte \onepoint
+ \ifcase\paperlandscape\else
+ \doglobal\swapdimens\papierbreedte\papierhoogte
+ \fi
+ \ifcase\printlandscape\else
+ \doglobal\swapdimens\printpapierbreedte\printpapierhoogte
+ \fi
+ % this check can be confusing, so we've added the possibility
+ % to bypass this test: \setuppapersize[option=fit]
+ \doif\@@ppoptie\v!max % \v!fit is
+ {\bgroup
+ % we need to pre-swap else we get the wrong paper size
+ \doifinset\paperrotation{90,270}{\swapdimens\papierbreedte\papierhoogte}%
+ \doifinset\printrotation{90,270}{\swapdimens\printpapierbreedte\printpapierhoogte}%
+ \ifdim\papierhoogte>\printpapierhoogte
+ \global\printpapierhoogte\papierhoogte
+ \writestatus\m!systems{print height forced to paper height}%
+ \fi
+ \ifdim\papierbreedte>\printpapierbreedte
+ \global\printpapierbreedte\papierbreedte
+ \writestatus\m!systems{print width forced to paper width}%
+ \fi
+ \egroup}}
+
\def\dostelpapierrichtingin#1#2#3#4#5%
{\global\chardef#2\zerocount
\global\chardef#5\zerocount
@@ -453,7 +516,13 @@
% \newtoks \everybeforelayout \relax
% \newtoks \everyafterlayout \relax
+
\def\recalculatelayout
+ {\doifsomething{\layoutparameter\c!pagina\layoutparameter\c!papier}
+ {\dododosetuppapersize[\layoutparameter\c!pagina][\layoutparameter\c!papier]}%
+ \dorecalculatelayout}
+
+\def\dorecalculatelayout
{%\the\everybeforelayout
\setups[\layoutparameter\c!preset]%
\global\linkermargebreedte \layoutparameter\c!linkermarge
@@ -468,6 +537,11 @@
\global\kopwit \layoutparameter\c!kopwit
\setlayoutdimensions % the rest of the `dimensions'
\doifelse\@@lygrid\v!ja\gridsnappingtrue\gridsnappingfalse
+ \ifgridsnapping
+ \setsystemmode\v!grid
+ \else
+ \resetsystemmode\v!grid
+ \fi
\setups[\layoutparameter\c!setups]% depends on gridsnapping !
\simplesetupwhitespace
\simplesetupblank
@@ -1247,7 +1321,9 @@
\c!rechterrandafstand=\layoutparameter\c!randafstand,
\c!rechterrand=\layoutparameter\c!rand,
\c!kopoffset=\!!zeropoint,
+ \c!bodemwit=\!!zeropoint,
\c!rugoffset=\!!zeropoint,
+ \c!snijwit=\!!zeropoint,
\c!tekstbreedte=, % dangerous option -> centered / local
\c!tekstmarge=, % dangerous option -> both sides
\c!tekstafstand=\!!zeropoint, % shift down on grid
@@ -1265,10 +1341,10 @@
\c!setups=\systemsetupsprefix\s!default,
\c!clipoffset=\!!zeropoint,
\c!regels=0,
+ \c!papier=, % for foxet
+ \c!pagina=, % for foxet
\c!kolommen=1,
- \c!kolomafstand=\!!zeropoint,
- \c!snijwit=\!!zeropoint,
- \c!bodemwit=\!!zeropoint]
+ \c!kolomafstand=\!!zeropoint]
%D First we define a whole range of (DIN) papersizes,
%D of which the A-series makes most sense. We enable checking.
@@ -1293,38 +1369,50 @@
\c!links=,
\c!rechts=\hss]
-\definepapersize [A0] [\c!breedte=841mm,\c!hoogte=1189mm]
-\definepapersize [A1] [\c!breedte=594mm,\c!hoogte=841mm]
-\definepapersize [A2] [\c!breedte=420mm,\c!hoogte=594mm]
-\definepapersize [A3] [\c!breedte=297mm,\c!hoogte=420mm]
-\definepapersize [A4] [\c!breedte=210mm,\c!hoogte=297mm]
-\definepapersize [A5] [\c!breedte=148mm,\c!hoogte=210mm]
-\definepapersize [A6] [\c!breedte=105mm,\c!hoogte=148mm]
-\definepapersize [A7] [\c!breedte=74mm,\c!hoogte=105mm]
-\definepapersize [A8] [\c!breedte=52mm,\c!hoogte=74mm]
-\definepapersize [A9] [\c!breedte=37mm,\c!hoogte=52mm]
-
-\definepapersize [B0] [\c!breedte=1000mm,\c!hoogte=1414mm]
-\definepapersize [B1] [\c!breedte=707mm,\c!hoogte=1000mm]
-\definepapersize [B2] [\c!breedte=500mm,\c!hoogte=707mm]
-\definepapersize [B3] [\c!breedte=354mm,\c!hoogte=500mm]
-\definepapersize [B4] [\c!breedte=250mm,\c!hoogte=354mm]
-\definepapersize [B5] [\c!breedte=177mm,\c!hoogte=250mm]
-\definepapersize [B6] [\c!breedte=125mm,\c!hoogte=177mm]
-\definepapersize [B7] [\c!breedte=88mm,\c!hoogte=125mm]
-\definepapersize [B8] [\c!breedte=63mm,\c!hoogte=88mm]
-\definepapersize [B9] [\c!breedte=44mm,\c!hoogte=63mm]
-
-\definepapersize [C0] [\c!breedte=917mm,\c!hoogte=1297mm]
-\definepapersize [C1] [\c!breedte=649mm,\c!hoogte=917mm]
-\definepapersize [C2] [\c!breedte=459mm,\c!hoogte=649mm]
-\definepapersize [C3] [\c!breedte=324mm,\c!hoogte=459mm]
-\definepapersize [C4] [\c!breedte=229mm,\c!hoogte=324mm]
-\definepapersize [C5] [\c!breedte=162mm,\c!hoogte=229mm]
-\definepapersize [C6] [\c!breedte=115mm,\c!hoogte=162mm]
-\definepapersize [C7] [\c!breedte=81mm,\c!hoogte=115mm]
-\definepapersize [C8] [\c!breedte=57mm,\c!hoogte=81mm]
-\definepapersize [C9] [\c!breedte=40mm,\c!hoogte=57mm]
+\definepapersize [A0] [\c!breedte=841mm,\c!hoogte=1189mm]
+\definepapersize [A1] [\c!breedte=594mm,\c!hoogte=841mm]
+\definepapersize [A2] [\c!breedte=420mm,\c!hoogte=594mm]
+\definepapersize [A3] [\c!breedte=297mm,\c!hoogte=420mm]
+\definepapersize [A4] [\c!breedte=210mm,\c!hoogte=297mm]
+\definepapersize [A5] [\c!breedte=148mm,\c!hoogte=210mm]
+\definepapersize [A6] [\c!breedte=105mm,\c!hoogte=148mm]
+\definepapersize [A7] [\c!breedte=74mm,\c!hoogte=105mm]
+\definepapersize [A8] [\c!breedte=52mm,\c!hoogte=74mm]
+\definepapersize [A9] [\c!breedte=37mm,\c!hoogte=52mm]
+\definepapersize [A10] [\c!breedte=26mm,\c!hoogte=37mm]
+
+\definepapersize [B0] [\c!breedte=1000mm,\c!hoogte=1414mm]
+\definepapersize [B1] [\c!breedte=707mm,\c!hoogte=1000mm]
+\definepapersize [B2] [\c!breedte=500mm,\c!hoogte=707mm]
+\definepapersize [B3] [\c!breedte=353mm,\c!hoogte=500mm] % [\c!breedte=354mm,\c!hoogte=500mm]
+\definepapersize [B4] [\c!breedte=250mm,\c!hoogte=353mm] % [\c!breedte=250mm,\c!hoogte=354mm]
+\definepapersize [B5] [\c!breedte=176mm,\c!hoogte=250mm] % [\c!breedte=177mm,\c!hoogte=250mm]
+\definepapersize [B6] [\c!breedte=125mm,\c!hoogte=176mm] % [\c!breedte=125mm,\c!hoogte=177mm]
+\definepapersize [B7] [\c!breedte=88mm,\c!hoogte=125mm]
+\definepapersize [B8] [\c!breedte=62mm,\c!hoogte=88mm] % [\c!breedte=63mm,\c!hoogte=88mm]
+\definepapersize [B9] [\c!breedte=44mm,\c!hoogte=62mm] % [\c!breedte=44mm,\c!hoogte=63mm]
+\definepapersize [B10] [\c!breedte=31mm,\c!hoogte=44mm]
+
+\definepapersize [C0] [\c!breedte=917mm,\c!hoogte=1297mm]
+\definepapersize [C1] [\c!breedte=648mm,\c!hoogte=917mm] % [\c!breedte=649mm,\c!hoogte=917mm]
+\definepapersize [C2] [\c!breedte=458mm,\c!hoogte=648mm] % [\c!breedte=459mm,\c!hoogte=649mm]
+\definepapersize [C3] [\c!breedte=324mm,\c!hoogte=458mm] % [\c!breedte=324mm,\c!hoogte=459mm]
+\definepapersize [C4] [\c!breedte=229mm,\c!hoogte=324mm]
+\definepapersize [C5] [\c!breedte=162mm,\c!hoogte=229mm]
+\definepapersize [C6] [\c!breedte=114mm,\c!hoogte=162mm] % [\c!breedte=115mm,\c!hoogte=162mm]
+\definepapersize [C7] [\c!breedte=81mm,\c!hoogte=114mm] % [\c!breedte=81mm,\c!hoogte=115mm]
+\definepapersize [C8] [\c!breedte=57mm,\c!hoogte=81mm]
+\definepapersize [C9] [\c!breedte=40mm,\c!hoogte=57mm]
+\definepapersize [C10] [\c!breedte=28mm,\c!hoogte=40mm]
+
+%D Per August 2004 the rounding of some (seldom used) sizes
+%D were corrected top the latest DIN specifications. Peter
+%D Rolf came up with these and a few more missing sizes.
+%D Watch out: spaces and slashes!
+
+\definepapersize [4 A0] [\c!breedte=1682mm,\c!hoogte=2378mm]
+\definepapersize [2 A0] [\c!breedte=1189mm,\c!hoogte=1682mm]
+\definepapersize [C6/C5] [\c!breedte=114mm,\c!hoogte=229mm]
%D Because there are no standardized screen sizes, we define
%D a bunch of sizes with $4:3$ ratios. The \type {S6} size is
@@ -1376,7 +1464,8 @@
\definepapersize [envelope 14] [\c!breedte=11.5in,\c!hoogte=5.0in]
\definepapersize [monarch] [\c!breedte=7.5in,\c!hoogte=3.88in]
\definepapersize [check] [\c!breedte=8.58in,\c!hoogte=3.88in]
-\definepapersize [DL] [\c!breedte=220mm,\c!hoogte=110mm]
+\definepapersize [DL] [\c!breedte=110mm,\c!hoogte=220mm] % [\c!breedte=220mm,\c!hoogte=110mm]
+\definepapersize [E4] [\c!breedte=280mm,\c!hoogte=400mm]
%D We can now default to a reasonable size. We match the print
%D paper size with the typeset paper size. This setting should
diff --git a/tex/context/base/page-mul.tex b/tex/context/base/page-mul.tex
index 2c3e5c131..ca85bc6d4 100644
--- a/tex/context/base/page-mul.tex
+++ b/tex/context/base/page-mul.tex
@@ -286,9 +286,9 @@
%D
%D \startbuffer
%D \startbuffer[b]
-%D \startkolommen
+%D \startcolumns
%D \input tufte
-%D \stopkolommen
+%D \stopcolumns
%D \stopbuffer
%D \typebuffer[b] \haalbuffer[b]
%D
@@ -300,44 +300,44 @@
%D \typebuffer[b] \haalbuffer[b]
%D
%D \startbuffer[b]
-%D \startkolommen \startsmaller
+%D \startcolumns \startsmaller
%D \input tufte
-%D \stopsmaller \stopkolommen
+%D \stopsmaller \stopcolumns
%D \stopbuffer
%D \typebuffer[b] \haalbuffer[b]
%D
%D \startbuffer[b]
-%D \startsmaller \startkolommen
+%D \startsmaller \startcolumns
%D \input tufte
-%D \stopkolommen \stopsmaller
+%D \stopcolumns \stopsmaller
%D \stopbuffer
%D \typebuffer[b] \haalbuffer[b]
%D
%D \startbuffer[b]
-%D \startkolommen \startsmaller[left]
+%D \startcolumns \startsmaller[left]
%D \input tufte
-%D \stopsmaller \stopkolommen
+%D \stopsmaller \stopcolumns
%D \stopbuffer
%D \typebuffer[b] \haalbuffer[b]
%D
%D \startbuffer[b]
-%D \startsmaller[left] \startkolommen
+%D \startsmaller[left] \startcolumns
%D \input tufte
-%D \stopkolommen \stopsmaller
+%D \stopcolumns \stopsmaller
%D \stopbuffer
%D \typebuffer[b] \haalbuffer[b]
%D
%D \startbuffer[b]
-%D \startsmaller \startkolommen \startsmaller
+%D \startsmaller \startcolumns \startsmaller
%D \input tufte
-%D \stopsmaller\stopkolommen \stopsmaller
+%D \stopsmaller\stopcolumns \stopsmaller
%D \stopbuffer
%D \typebuffer[b] \haalbuffer[b]
%D
%D \startbuffer[b]
-%D \startsmaller[left] \startkolommen \startsmaller
+%D \startsmaller[left] \startcolumns \startsmaller
%D \input tufte
-%D \stopsmaller\stopkolommen \stopsmaller
+%D \stopsmaller\stopcolumns \stopsmaller
%D \stopbuffer
%D \typebuffer[b] \haalbuffer[b]
%D \stopbuffer
@@ -492,6 +492,36 @@
%D e.g. when there is no text given between \type{\begin..}
%D and \type{\end..}. The \type{\par} is needed!
+% \def\endmulticolumns
+% {%\par
+% \vskip\lineheight\vskip-\lineheight % take footnotes into account
+% \dontshowcomposition
+% \doflushcolumnfloat % added recently
+% %\doflushcolumnfloats % no, since it results in wrong top floats
+% \flushnotes % before start of columns
+% \par
+% \ifbalancecolumns
+% \global\output{\continuousmulticolumnsout}%
+% \goodbreak
+% \global\output{\balancedmulticolumnsout}%
+% \else
+% \goodbreak
+% \fi
+% \eject % the prevdepth is important, try e.g. toclist in
+% \prevdepth\zeropoint % columns before some noncolumned text text
+% \global\output\singlecolumnout
+% \global\output{\the\mainoutput}% % % % % todo
+% \ifvoid\precolumnbox\else
+% \unvbox\precolumnbox
+% \fi
+% \global\precolumnboxheight\zeropoint
+% \endgroup % here
+% \nofcolumns\plusone
+% \setvsize % the outer one!
+% \checkendcolumnfootnotes
+% \dosomebreak\allowbreak
+% \restoresavedfloats}
+
\def\endmulticolumns
{%\par
\vskip\lineheight\vskip-\lineheight % take footnotes into account
@@ -507,10 +537,10 @@
\else
\goodbreak
\fi
- \eject % the prevdepth is important, try e.g. toclist in
+ \eject % the prevdepth is important, try e.g. toclist in
\prevdepth\zeropoint % columns before some noncolumned text text
\global\output\singlecolumnout
- \global\output{\the\mainoutput}% % % % % todo
+ \global\output{\the\mainoutput}% % % % % todo
\ifvoid\precolumnbox\else
\unvbox\precolumnbox
\fi
@@ -518,6 +548,7 @@
\endgroup % here
\nofcolumns\plusone
\setvsize % the outer one!
+ \synchronizeoutput % new may 2004 / we need to: \pagegoal\vsize
\checkendcolumnfootnotes
\dosomebreak\allowbreak
\restoresavedfloats}
@@ -670,9 +701,9 @@
%D \def\postprocesscolumnline#1% or \postprocesscolumnbox
%D {\ruledhbox{\box#1}\hss}
%D
-%D \startkolommen[n=4]
+%D \startcolumns[n=4]
%D \dorecurse{25}{line: \recurselevel\par}
-%D \stopkolommen
+%D \stopcolumns
%D \stopbuffer
%D
%D \typebuffer
@@ -691,9 +722,9 @@
%D \relax\unhbox#1\hfill
%D \fi}
%D
-%D \startkolommen[n=4]
+%D \startcolumns[n=4]
%D \dorecurse{25}{line \recurselevel\par}
-%D \stopkolommen
+%D \stopcolumns
%D \stopbuffer
%D
%D \typebuffer
@@ -1503,13 +1534,13 @@
% border case, should fit on one page
%
-% \startkolommen
+% \startcolumns
%
% 1 \input tufte \par \plaatsfiguur{}{\omlijnd[breedte=\hsize,hoogte=3cm]{1}}
% 2 \input tufte \par \plaatsfiguur{}{\omlijnd[breedte=\hsize,hoogte=3cm]{2}}
% 3 \input tufte \par \plaatsfiguur{}{\omlijnd[breedte=\hsize,hoogte=3cm]{3}}
%
-% \stopkolommen
+% \stopcolumns
\newif\ifbinnenkolommen
\newif\if@@klbalanceren
@@ -1517,10 +1548,10 @@
\binnenkolommenfalse
-\def\stelkolommenin
- {\dodoubleargument\dostelkolommenin}
+\def\setupcolumns
+ {\dosingleempty\dosetupcolumns}
-\def\stelkolommenin[#1]%
+\def\dosetupcolumns[#1]%
{\getparameters[\??kl][#1]%
\nofcolumns\@@kln\relax
\processaction
@@ -1567,14 +1598,14 @@
\let\restorecolumnsettings\relax
-\definecomplexorsimpleempty\startkolommen
+\definecomplexorsimpleempty\startcolumns
-\def\complexstartkolommen[#1]% %% \startkolommen
+\def\complexstartcolumns[#1]% %% \startcolumns
{\bgroup
- \let\stopkolommen\egroup
+ \let\stopcolumns\egroup
\ifbinnenkolommen
\else
- \stelkolommenin[#1]%
+ \setupcolumns[#1]%
\ifnum\@@kln>1\relax
\witruimte
\begingroup
@@ -1614,12 +1645,12 @@
%
\edef\fixedcolumnheight{\@@klhoogte}%
\edef\minbalancetoplines{\@@klnboven}%
- \setuptolerance[\@@kltolerantie]% %% \startkolommen
+ \setuptolerance[\@@kltolerantie]% %% \startcolumns
\setupblank[\@@klblanko]%
\ifdim\tussenwit>\zeropoint\relax
\setupwhitespace[\@@klblanko]%
\fi
- \def\stopkolommen
+ \def\stopcolumns
{\endmulticolumns
\global\binnenkolommenfalse
\endgroup
@@ -1639,7 +1670,7 @@
\vskip-\teksthoogte
\prevdepth-\thousandpoint} % signals top of column to \blanko
-\stelkolommenin
+\setupcolumns
[\c!n=2,
\c!nboven=1,
\c!commando=,
diff --git a/tex/context/base/page-one.tex b/tex/context/base/page-one.tex
index 6be6e515f..68c919e8c 100644
--- a/tex/context/base/page-one.tex
+++ b/tex/context/base/page-one.tex
@@ -553,10 +553,48 @@
% \fi
% \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
+% \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
+% \fi
+% \fi}
+
\def\OTRONEdocheckiffloatfits % vervangen ivm downward comp
{\ifnofloatpermitted
\global\roomforfloatfalse
\else
+ % new per 31/5/2004, should be an option, only one column mode
+ \begingroup
+ \scratchdimen\pagetotal
+ \advance\scratchdimen\lineheight % maybe strutheight
+ \ifdim\scratchdimen>\pagegoal
+ \goodbreak % hack ? needed in icare-az
+ \fi
+ % should be an option
+ \endgroup
\dimen0 \pagetotal
\advance\dimen0 \ht\floatbox
\advance\dimen0 \dp\floatbox
diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex
index e72892a51..a77563eba 100644
--- a/tex/context/base/page-set.tex
+++ b/tex/context/base/page-set.tex
@@ -436,6 +436,10 @@
\fi
\dorecurse\columnmaxcells
{\setbox\scratchbox\hbox{\OTRSETgetgridcell\mofcolumns\recurselevel}%
+% {\setbox\scratchbox\hbox
+% {\localstarttextcolor
+% \OTRSETgetgridcell\mofcolumns\recurselevel
+% \localstoptextcolor}%
\ht\scratchbox\strutht
\dp\scratchbox\strutdp
\ifcase\columndirection
diff --git a/tex/context/base/page-sid.tex b/tex/context/base/page-sid.tex
index bbdc1fe9a..e83d3e17f 100644
--- a/tex/context/base/page-sid.tex
+++ b/tex/context/base/page-sid.tex
@@ -50,6 +50,7 @@
\newdimen\sidefloatextrashift
\newdimen\sidefloatvsize \def\nofloatvsize{-1pt }
\newdimen\sidefloatprogress
+\newdimen\sidefloatpagetotal
\newbox\floatbottom
@@ -628,8 +629,6 @@
\def\tosssidefloat
{\vfill\eject}
-\newdimen\sidefloatpagetotal
-
\def\measuresidefloat
{\global\floatflagtrue
\global\sidefloatpagetotal \pagetotal % global
diff --git a/tex/context/base/s-abr-01.tex b/tex/context/base/s-abr-01.tex
index 93c8e93d4..ca3bdf5d6 100644
--- a/tex/context/base/s-abr-01.tex
+++ b/tex/context/base/s-abr-01.tex
@@ -21,7 +21,7 @@
\logo [ACROBAT] {Acro\-bat}
\logo [AFM] {afm}
-\logo [ALEPH] {Aleph}
+\logo [ALEPH] {Aleph} % {\mathematics{\aleph}}
\logo [ALGOL] {ALGOL}
\logo [AMSLATEX] {\AmSLaTeX}
\logo [AMSTEX] {\AmSTeX}
@@ -204,6 +204,7 @@
\logo [XPDFETEX] {xpdfe\TeX}
\logo [XSLT] {xslt}
\logo [XSL] {xsl}
+\logo [XSLFO] {xsl-fo}
\logo [YandY] {y\&y}
\def\METAFUN {\MetaFun}
diff --git a/tex/context/base/s-map-01.tex b/tex/context/base/s-map-01.tex
index 9250b20ae..f64e53546 100644
--- a/tex/context/base/s-map-01.tex
+++ b/tex/context/base/s-map-01.tex
@@ -108,7 +108,7 @@
\c!hoofd=35pt,
\c!voet=35pt]
-\stelkolommenin
+\setupcolumns
[\c!afstand=1pc]
%D Later zullen we zonodig nog instellen dat de \MAPS\ op een
@@ -459,7 +459,7 @@
\kern 3.5pt
\egroup
\egroup
- \ifMapsInKolommen\startkolommen\fi
+ \ifMapsInKolommen\startcolumns\fi
\MapsAffiliatieB}
\def\startBijdrage%
@@ -467,7 +467,7 @@
\dosingleempty\dostartBijdrage}
\def\stopBijdrage%
- {\ifMapsInKolommen\stopkolommen\fi
+ {\ifMapsInKolommen\stopcolumns\fi
\stoptekst}
%D De affiliatie wordt in de marge gezet. De wat gecompliceerde
diff --git a/tex/context/base/s-pre-19.tex b/tex/context/base/s-pre-19.tex
index 204cb41a1..56c7c78c4 100644
--- a/tex/context/base/s-pre-19.tex
+++ b/tex/context/base/s-pre-19.tex
@@ -8,8 +8,8 @@
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
%D This style is made in the process or writing the \METAFUN\
%D manual. It exploits a few tricks, like graphics calculated
@@ -17,64 +17,64 @@
%D moment) new menu list placement alternative. If you forget
%D about the definition of the button shapes, which is
%D complicated in any system, this style is not even that hard
-%D to follow. Watch how the left side of the buttons follow
-%D the right side of the text graphic.
-%D
-%D While playing bit with this style, the random alternative
-%D made me think of those organic building with non equal
-%D windows (we have a few in The Netherlands), so I decided to
-%D label this style as \type {pre-organic}.
+%D to follow. Watch how the left side of the buttons follow
+%D the right side of the text graphic.
%D
-%D At the end of this file, there is a small test file, so
-%D when you process this file with \TEXEXEC\ and the options
-%D \type {--mode=demo} and \type {--pdf}, you will get a demo
-%D document.
+%D While playing bit with this style, the random alternative
+%D made me think of those organic building with non equal
+%D windows (we have a few in The Netherlands), so I decided to
+%D label this style as \type {pre-organic}.
+%D
+%D At the end of this file, there is a small test file, so
+%D when you process this file with \TEXEXEC\ and the options
+%D \type {--mode=demo} and \type {--pdf}, you will get a demo
+%D document.
-%D We use one of the standard screen \citeer {paper} sizes, and
-%D map it onto the same size, so that we get a nicely cropped
-%D page.
+%D We use one of the standard screen \citeer {paper} sizes, and
+%D map it onto the same size, so that we get a nicely cropped
+%D page.
\setuppapersize
[S6][S6]
-%D Like in the \METAFUN\ manual, we use the Palatino as main
-%D bodyfont. This font is quite readable on even low
-%D resolution screens, although I admit that this style is
+%D Like in the \METAFUN\ manual, we use the Palatino as main
+%D bodyfont. This font is quite readable on even low
+%D resolution screens, although I admit that this style is
%D developed using an $1400\times1050$ pixel LCD screen, so I
-%D may be biased.
+%D may be biased.
%\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
%D edge distance. By setting the header and footer dimensions
-%D to zero, we automatically get rid of page body ornaments,
-%D like the pagenumber.
+%D to zero, we automatically get rid of page body ornaments,
+%D like the pagenumber.
\setuplayout
[topspace=48pt,
backspace=48pt,
cutspace=12pt,
width=400pt,
- margin=0cm,
+ margin=0cm,
rightedge=88pt,
rightedgedistance=48pt,
header=0cm,
footer=0cm,
height=middle]
-%D We use a moderate, about a line height, interparagraph
-%D white space.
+%D We use a moderate, about a line height, interparagraph
+%D white space.
\setupwhitespace
[big]
-%D Of course we use colors, since on computer displays they
-%D come for free.
+%D Of course we use colors, since on computer displays they
+%D come for free.
\setupcolors
[state=start]
-
+
\definecolor [red] [r=.75]
\definecolor [yellow] [r=.75,g=.75]
\definecolor [gray] [s=.50]
@@ -87,11 +87,11 @@
\definecolor [ContrastColor] [gray]
%D This is an interactive document, so we enable interaction.
-%D In this style, we disable the viewer's \citeer {highlight a
-%D hyperlink when it's clicked on} feature. We will use a
-%D menu, so we enable menus. Later we will see the contract
-%D color |<|hyperlinks gets that color when we are already on
-%D the location|>| in action.
+%D In this style, we disable the viewer's \citeer {highlight a
+%D hyperlink when it's clicked on} feature. We will use a
+%D menu, so we enable menus. Later we will see the contract
+%D color |<|hyperlinks gets that color when we are already on
+%D the location|>| in action.
\setupinteraction
[state=start,
@@ -103,7 +103,7 @@
%D The menu itself is set up as follows. Because we will
%D calculate menubuttons based on their position on the page,
%D we have to keep track of the positions. Therefore, we set
-%D the \type {position} variable to \type {yes}.
+%D the \type {position} variable to \type {yes}.
\setupinteractionmenu
[right]
@@ -118,9 +118,9 @@
before=,
after=]
-%D The menu content is rather sober: a list of topics (later
-%D we will define the command that generates topic entries),
-%D and a close button.
+%D The menu content is rather sober: a list of topics (later
+%D we will define the command that generates topic entries),
+%D and a close button.
\startinteractionmenu[right]
\placelist[Topic][alternative=right]
@@ -134,7 +134,7 @@
%D \METAPOST\ graphic. Page backgrounds are recalculated each
%D page, opposite to the other backgrounds that are calculated
%D when a new background is defined, or when repetitive
-%D calculation is turned on.
+%D calculation is turned on.
\setupbackgrounds
[page]
@@ -146,141 +146,141 @@
\setupMPvariables
[page]
- [alternative=3]
+ [alternative=3]
\startuseMPgraphic{page}
- \includeMPgraphic{rightsuperbutton}
+ \includeMPgraphic{rightsuperbutton}
StartPage ;
path p, q ; pickup pencircle scaled 3pt ;
-
+
p := Field[Text][Text] enlarged 36pt superellipsed .90 ;
- fill Page withcolor \MPcolor{PageColor} ;
- fill p withcolor \MPcolor{TextColor} ;
- draw p withcolor \MPcolor{OrnamentColor} ;
+ fill Page withcolor \MPcolor{PageColor} ;
+ fill p withcolor \MPcolor{TextColor} ;
+ draw p withcolor \MPcolor{OrnamentColor} ;
- p := Field[Text][Text] enlarged 48pt superellipsed .90 ;
+ p := Field[Text][Text] enlarged 48pt superellipsed .90 ;
- def right_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
- if (pp>0) and (rr>0) :
- q := rightsuperbutton(p,xx,yy,RightEdgeWidth,hh) ;
- fill q withcolor \MPcolor{TextColor} ;
- draw q withcolor if rr=2 : \MPcolor{ContrastColor}
- else : \MPcolor{InteractionColor} fi ;
- fi ;
- enddef ;
+ def right_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
+ if (pp>0) and (rr>0) :
+ q := rightsuperbutton(p,xx,yy,RightEdgeWidth,hh) ;
+ fill q withcolor \MPcolor{TextColor} ;
+ draw q withcolor if rr=2 : \MPcolor{ContrastColor}
+ else : \MPcolor{InteractionColor} fi ;
+ fi ;
+ enddef ;
- \MPmenubuttons{right}
+ \MPmenubuttons{right}
- StopPage ;
+ StopPage ;
\stopuseMPgraphic
\startuseMPgraphic{page}
- \includeMPgraphic{rightsuperbutton}
+ \includeMPgraphic{rightsuperbutton}
StartPage ;
- numeric alternative, seed, superness, squeezeness, randomness ;
- path p, q ; transform t ;
+ numeric alternative, seed, superness, squeezeness, randomness ;
+ path p, q ; transform t ;
alternative := \MPvar{alternative} ;
- seed := uniformdeviate 100 ;
+ seed := uniformdeviate 100 ;
- if alternative > 10 :
- superness := .85 + ((\realfolio-1)/\lastpage) * .15 ;
+ if alternative > 10 :
+ superness := .85 + ((\realfolio-1)/\lastpage) * .15 ;
squeezeness := 12pt - ((\realfolio-1)/\lastpage) * 10pt ;
- else :
+ else :
superness := .90 ;
squeezeness := 12pt ;
fi ;
- randomness := squeezeness ;
+ randomness := squeezeness ;
- alternative := alternative mod 10 ;
+ alternative := alternative mod 10 ;
- t := identity if alternative=3: shifted (9pt,-9pt) fi ;
-
- % first we draw the shape that surrounds the text
+ t := identity if alternative=3: shifted (9pt,-9pt) fi ;
- randomseed := seed ;
+ % first we draw the shape that surrounds the text
- p := Field[Text][Text] enlarged if
- alternative = 1 : 36pt superellipsed superness elseif
- alternative = 2 : 36pt squeezed squeezeness elseif
+ randomseed := seed ;
+
+ p := Field[Text][Text] enlarged if
+ alternative = 1 : 36pt superellipsed superness elseif
+ alternative = 2 : 36pt squeezed squeezeness elseif
alternative = 3 : 36pt randomized randomness else
- : 36pt fi ;
+ : 36pt fi ;
pickup pencircle scaled 3pt ;
- fill Page withcolor \MPcolor{PageColor} ;
- fill p withcolor \MPcolor{TextColor} ;
- draw p withcolor \MPcolor{OrnamentColor} ;
+ fill Page withcolor \MPcolor{PageColor} ;
+ fill p withcolor \MPcolor{TextColor} ;
+ draw p withcolor \MPcolor{OrnamentColor} ;
- % we set p to the wider shape from which we will chip off pieces
+ % we set p to the wider shape from which we will chip off pieces
- randomseed := seed ;
+ randomseed := seed ;
- p := ( Field[Text][Text] enlarged if
- alternative = 1 : 48pt superellipsed superness elseif
- alternative = 2 : 48pt squeezed squeezeness elseif
+ p := ( Field[Text][Text] enlarged if
+ alternative = 1 : 48pt superellipsed superness elseif
+ alternative = 2 : 48pt squeezed squeezeness elseif
alternative = 3 : 36pt randomized randomness else
: 48pt fi ) transformed t ;
% calls to *_menu_button are generated automatically ...
- def right_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
- if (pp>0) and (rr>0) :
- q := rightsuperbutton(p,xx,yy,RightEdgeWidth,hh) ; % \MPw{menu:right:\realfolio}
- fill q withcolor \MPcolor{TextColor} ;
- draw q withcolor if rr=2 : \MPcolor{ContrastColor}
- else : \MPcolor{InteractionColor} fi ;
- fi ;
- enddef ;
+ def right_menu_button (expr nn, rr, pp, xx, yy, ww, hh, dd) =
+ if (pp>0) and (rr>0) :
+ q := rightsuperbutton(p,xx,yy,RightEdgeWidth,hh) ; % \MPw{menu:right:\realfolio}
+ fill q withcolor \MPcolor{TextColor} ;
+ draw q withcolor if rr=2 : \MPcolor{ContrastColor}
+ else : \MPcolor{InteractionColor} fi ;
+ fi ;
+ enddef ;
- % ... and inserted when the graphic data is flushed here ...
+ % ... and inserted when the graphic data is flushed here ...
- \MPmenubuttons{right}
+ \MPmenubuttons{right}
- StopPage ;
+ StopPage ;
\stopuseMPgraphic
\startuseMPgraphic{rightsuperbutton}
vardef rightsuperbutton (expr pat, xpos, ypos, wid, hei) =
- save p, ptop, pbot, t, b, edge, shift, width, height ;
- path p, ptop, pbot ; pair t, b ; numeric edge, shift, width, height ;
+ save p, ptop, pbot, t, b, edge, shift, width, height ;
+ path p, ptop, pbot ; pair t, b ; numeric edge, shift, width, height ;
- edge := xpos + wid ; shift := ypos + hei ;
+ edge := xpos + wid ; shift := ypos + hei ;
- p := rightpath pat ;
+ p := rightpath pat ;
ptop := ((-infinity,shift)--(edge,shift)) ;
- pbot := ((-infinity,shift-hei)--(edge,shift-hei)) ;
+ pbot := ((-infinity,shift-hei)--(edge,shift-hei)) ;
- t := p intersectionpoint ptop ;
- b := p intersectionpoint pbot ;
+ t := p intersection_point ptop ;
+ b := p intersection_point pbot ;
p := subpath(0,xpart (p intersectiontimes ptop)) of p ;
p := subpath(xpart (p intersectiontimes pbot),length(p)) of p ;
- (p -- t -- point 1 of ptop &
- point 1 of ptop -- point 1 of pbot &
- point 1 of pbot -- b
- -- cycle)
+ (p -- t -- point 1 of ptop &
+ point 1 of ptop -- point 1 of pbot &
+ point 1 of pbot -- b
+ -- cycle)
-enddef ;
+enddef ;
\stopuseMPgraphic
%D Topics are identified with \type {\Topic}, which is an
%D instance of chapter headings. The number is made invisible.
%D Since it still is a numbered section header, \CONTEXT\ will
-%D write the header to the table of contents.
+%D write the header to the table of contents.
\definehead
[Topic]
@@ -290,19 +290,19 @@ enddef ;
[Topic]
[number=no]
-%D We will use a bold font in the table of contents. We also
-%D force a complete list.
+%D We will use a bold font in the table of contents. We also
+%D force a complete list.
\setuplist
[Topic]
[criterium=all,
style=bold,
before=,
- after=]
+ after=]
-%D The \type {\TitlePage} macro looks horrible, because we
-%D want to keep the interface simple: a list of small
-%D sentences, separated by \type {\\}.
+%D The \type {\TitlePage} macro looks horrible, because we
+%D want to keep the interface simple: a list of small
+%D sentences, separated by \type {\\}.
\def\StartTitlePage
{\startstandardmakeup
@@ -318,17 +318,17 @@ enddef ;
\def\TitlePage#1%
{\StartTitlePage#1\StopTitlePage}
-%D A couple of goodies:
+%D A couple of goodies:
\def\Subject {\Topic}
\def\Topics #1{}
\def\Subjects {}
-%D For those who want to test:
+%D For those who want to test:
\doifnotmode{demo}{\endinput}
-\starttext
+\starttext
\setupMPvariables[page][alternative=3]
@@ -337,10 +337,10 @@ enddef ;
A Simple Style Demo\\
Hans Hagen, August 2000}
-\Topic {Douglas R. Hofstadter} \input douglas \page
-\Topic {Donald E. Knuth} \input knuth \page
-\Topic {Edward R. Tufte} \input tufte \page
-\Topic {Hermann Zapf} \input zapf \page
-%Topic {David F. Stork} \input stork \page
+\Topic {Douglas R. Hofstadter} \input douglas \page
+\Topic {Donald E. Knuth} \input knuth \page
+\Topic {Edward R. Tufte} \input tufte \page
+\Topic {Hermann Zapf} \input zapf \page
+%Topic {David F. Stork} \input stork \page
-\stoptext
+\stoptext
diff --git a/tex/context/base/s-pre-60.tex b/tex/context/base/s-pre-60.tex
index a5198b97c..060bf44c8 100644
--- a/tex/context/base/s-pre-60.tex
+++ b/tex/context/base/s-pre-60.tex
@@ -48,14 +48,16 @@
% todo: roll back blank
+\def\StepLayer{step:\StepCounter}
+
\def\StartStep
{\ifvmode
\scratchskip\lastskip
\vskip-\scratchskip
- \startproperty[step:\StepCounter]%
+ \startproperty[\StepLayer]%
\vskip\scratchskip
\else
- \startproperty[step:\StepCounter]%
+ \startproperty[\StepLayer]%
\fi
\ignorespaces}
@@ -63,9 +65,9 @@
{\removeunwantedspaces
\stopproperty}
-\def\StartSteps{\ResetStep\NextStep\StartStep}
-\def\StopSteps {\StopStep\PrevStep}
-\def\FlushStep {\StopStep\NextStep\StartStep}
+\def\StartSteps{\iftrialtypesetting\else\ResetStep\NextStep\StartStep\fi}
+\def\StopSteps {\iftrialtypesetting\else\StopStep\PrevStep\fi}
+\def\FlushStep {\iftrialtypesetting\else\StopStep\NextStep\StartStep\fi}
\appendtoks
\ResetStep
@@ -85,4 +87,25 @@
[text]
[background=invoke]
+% bonus
+
+\useMPlibrary[nav]
+
+\definepalet
+ [navplus]
+ [attach=interactioncolor,
+ comment=interactioncolor]
+
+\setupcomment
+ [symbol={comment-normal,comment-down},
+ textlayer=\StepLayer,
+ option=buffer,
+ height=\textheight,
+ width=\textwidth,
+ margin=0pt]
+
+\setupattachments
+ [symbol={attach-normal,attach-down},
+ textlayer=\StepLayer]
+
\endinput \ No newline at end of file
diff --git a/tex/context/base/s-pre-61.tex b/tex/context/base/s-pre-61.tex
index 5d43ac757..3e60c7c8c 100644
--- a/tex/context/base/s-pre-61.tex
+++ b/tex/context/base/s-pre-61.tex
@@ -42,7 +42,10 @@
\setupinteraction
[state=start,
click=off,
- menu=on]
+ menu=on,
+ style=,
+ color=interactioncolor,
+ contrastcolor=interactioncolor]
\setupinteractionscreen
[option=max]
@@ -86,6 +89,8 @@
\definecolor [maincolor] [bright]
\definecolor [textcolor] [red]
+\definecolor [interactioncolor] [r=.8,g=.8,b=.6]
+
\setupcolors
[state=start,
textcolor=maincolor]
@@ -95,6 +100,19 @@
[background=page,
backgroundcolor=textcolor]
+\setupbackgrounds
+ [text]% [text]
+ [background={comments,text,invoke}]
+
+\definelayer
+ [text]
+ [width=\textwidth,
+ height=\textheight]
+
+\defineoverlay
+ [comments]
+ [{\setlayer[text][preset=middle]{\placecomments}}]
+
\defineoverlay[page][\uniqueMPgraphic{page-\ifcase\realpageno\or one\else plus\fi}]
\startuniqueMPgraphic{page-one}
@@ -122,9 +140,10 @@
StopPage ;
\stopuniqueMPgraphic
-\NormalizeFontHeight \HeadFont {\setstrut\strut\quad} {1.0\headerheight} {SansBold}
-\NormalizeFontHeight \TitleFont {\setstrut\strut\quad} {2.0\headerheight} {SansBold}
-\NormalizeFontHeight \SubTitleFont {\setstrut\strut\quad} {1.5\headerheight} {SansBold}
+\NormalizeFontHeight \HeadFont {\setstrut\strut\quad} {1.0\headerheight} {SansBold}
+\NormalizeFontHeight \TitleFont {\setstrut\strut\quad} {2.0\headerheight} {SansBold}
+\NormalizeFontHeight \SubTitleFont {\setstrut\strut\quad} {1.5\headerheight} {SansBold}
+\NormalizeFontHeight \SubSubTitleFont {\setstrut\strut\quad} {1.0\headerheight} {SansBold}
\setuphead
[chapter]
diff --git a/tex/context/base/setupb.tex b/tex/context/base/setupb.tex
index 666971b4f..1aa66f16b 100644
--- a/tex/context/base/setupb.tex
+++ b/tex/context/base/setupb.tex
@@ -2787,7 +2787,7 @@
\startsetup
\command
- [\y!stelkolommenin]
+ [\y!setupcolumns]
\type
[\c!vars!]
\variable
@@ -2841,11 +2841,11 @@
\startsetup
\command
- [\y!startkolommen]
+ [\y!startcolumns]
\type
[\c!opt!\c!vars!\c!stp!]
\inheritvariables
- [\y!stelkolommenin]
+ [\y!setupcolumns]
[]
\stopsetup
@@ -3338,6 +3338,14 @@
[\c!clipoffset]
[\c!dimension!]
[\!!zeropoint]
+ \variable
+ [\c!pagina]
+ [\c!identifier!]
+ []
+ \variable
+ [\c!papier]
+ [\c!identifier!]
+ []
\stopsetup
\startsetup
@@ -5220,6 +5228,14 @@
[\v!nee,\v!standaard,\c!dimension!]
[0pt]
\variable
+ [\c!linkermarge]
+ [\v!nee,\v!standaard,\c!dimension!]
+ [0pt]
+ \variable
+ [\c!rechtermarge]
+ [\v!nee,\v!standaard,\c!dimension!]
+ [0pt]
+ \variable
[\c!breedte]
[\c!dimension!]
[1.5em]
diff --git a/tex/context/base/spec-def.tex b/tex/context/base/spec-def.tex
index bdcc32785..57dcb7ae5 100644
--- a/tex/context/base/spec-def.tex
+++ b/tex/context/base/spec-def.tex
@@ -158,9 +158,13 @@
\installspecial [\dostartspotcolormode] [or] [2]
-\installspecial [\doregistercmykspotcolor] [or] [5]
-\installspecial [\doregisterrgbspotcolor] [or] [4]
-\installspecial [\doregistergrayspotcolor] [or] [2]
+\installspecial [\doregisterrgbspotcolor] [or] [7]
+\installspecial [\doregistercmykspotcolor] [or] [8]
+\installspecial [\doregistergrayspotcolor] [or] [5]
+
+\installspecial [\doregisterrgbindexcolor] [or] [7]
+\installspecial [\doregistercmykindexcolor] [or] [8]
+\installspecial [\doregistergrayindexcolor] [or] [5]
\installspecial [\dostartnonecolormode] [or] [0]
\installspecial [\doregisternonecolor] [or] [0]
@@ -169,7 +173,7 @@
%D simply call the start one with zero arguments.
%D \macros
-%D {doinsertfile}
+%D {doinsertfile,doinsertMPfile}
%D
%D Probably the most problematic special is the following
%D one. Because we want to be able to support different
@@ -198,7 +202,8 @@
%D When option 1 is passed, the viewers is asked to present a
%D preview, like the first frame of a movie.
-\installspecial [\doinsertfile] [or] [9]
+\installspecial [\doinsertfile] [or] [9]
+\installspecial [\doinsertMPfile] [or] [1] % speed up
%D No start||stop construction is needed here, because there in
%D no further interference of \TEX. All dimensions are output
diff --git a/tex/context/base/spec-dpm.tex b/tex/context/base/spec-dpm.tex
index d1b6b541b..710ca70c4 100644
--- a/tex/context/base/spec-dpm.tex
+++ b/tex/context/base/spec-dpm.tex
@@ -228,26 +228,52 @@
%D \macros
%D {dostartobject,dostopobject,doinsertobject}
+% \definespecial\dostartobject#1#2#3#4#5%
+% {\bgroup
+% \setbox\nextbox=\hbox\bgroup
+% \dosetobjectreference{#1}{#2}{#1::#2}%
+% \scratchdimen#3\edef\width {\the\scratchdimen\space}%
+% \scratchdimen#4\edef\height{\the\scratchdimen\space}%
+% \special{pdf: bxobj @#1::#2 width \width height \height}}
+
+% \definespecial\dostopobject%
+% {\special{pdf: exobj}%
+% \egroup
+% \smashbox\nextbox
+% \flushatshipout{\box\nextbox}%
+% \egroup}
+
\definespecial\dostartobject#1#2#3#4#5%
{\bgroup
- \setbox\nextbox=\hbox\bgroup
- \dosetobjectreference{#1}{#2}{#1::#2}%
- \scratchdimen#3\edef\width {\the\scratchdimen\space}%
- \scratchdimen#4\edef\height{\the\scratchdimen\space}%
- \special{pdf: bxobj @#1::#2 width \width height \height}}
-
-\definespecial\dostopobject%
- {\special{pdf: exobj}%
- \egroup
- \smashbox\nextbox
- \flushatshipout{\box\nextbox}%
- \egroup}
+ \dowithnextbox
+ {\dosetobjectreference{#1}{#2}{#1::#2}%
+ \scratchdimen#3\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#4\edef\height{\the\scratchdimen\space}%
+ \setbox\nextbox\vbox
+ {\special{pdf: bxobj @#1::#2 width \width height \height}%
+ % we need to compensate for the box offset (ugly, sigh)
+ \scratchdimen\nextboxht
+ \advance\scratchdimen\nextboxdp
+ \advance\scratchdimen-#4\relax
+ \nextboxdp\zeropoint
+ \nextboxht\zeropoint
+ \hbox to #3{\hss\lower.5\scratchdimen\box\nextbox\hss}%
+ \special{pdf: exobj}%
+ \global\let\currentPDFresources\empty}%
+ \smashbox\nextbox
+ \flushatshipout{\box\nextbox}%
+ \egroup}%
+ \hbox\bgroup}
+
+\definespecial\dostopobject
+ {\egroup}
+
\definespecial\doinsertobject#1#2%
{\hbox
{\dogetobjectreference{#1}{#2}\PDFobjectreference
\ifx\PDFobjectreference\empty \else
- \special{pdf: usexobj @\PDFobjectreference}%
+ \special{pdf: usexobj @#1::#2}%
\fi}}
%D \macros
diff --git a/tex/context/base/spec-dpx.tex b/tex/context/base/spec-dpx.tex
index f453e08b4..f3f77ff4d 100644
--- a/tex/context/base/spec-dpx.tex
+++ b/tex/context/base/spec-dpx.tex
@@ -40,14 +40,14 @@
%D DVIPDFMx supports the special command \type{pdf: literal ...}
%D since the version \type{dvipdfmx-20021028}.
%D
-%D 1. \type{pdf: linteral #1} puts the given PDF commands \#1
+%D 1. \type{pdf: literal #1} puts the given PDF commands \#1
%D after changing the text matrix with \type{"1 0 0 1 x y cm"}
%D to set the current DVI position $(x,y)$ to the origin.
%D
-%D 2. \type{pdf: linteral reverse #1} puts the given PDF commands \#1
+%D 2. \type{pdf: literal reverse #1} puts the given PDF commands \#1
%D after changing the text matrix with \type{"1 0 0 1 -x -y cm"}.
%D
-%D 3. \type{pdf: linteral direct #1} puts directly the given PDF
+%D 3. \type{pdf: literal direct #1} puts directly the given PDF
%D commands \#1 without changing the text matrix.
%D
%D Literal \PDF\ inclusion is implemented as:
@@ -203,18 +203,70 @@
%D Negation is not (yet) supported:
+% we need resource access
+%
% \definespecial\dostartnegative {}
% \definespecial\dostopnegative {}
% \definespecial\dostarttransparency {}
% \definespecial\dostoptransparency {}
+\definespecial\dostarttransparency{\doPDFstarttransparency}
+\definespecial\dostoptransparency {\doPDFstoptransparency}
+
+\PDFtransparencysupportedtrue
+
+\def\@@PDT{@PDT@}
+
+\ifx\PDFcurrenttransparency\undefined
+ \newcount\PDFcurrenttransparency \PDFcurrenttransparency=0 % -1
+\fi
+
+\def\assignPDFtransparency#1#2%
+ {\def\PDFtransparencyidentifier{/Tr#1}%
+ %\def\PDFtransparencyreference{#2 0 R}}
+ \def\PDFtransparencyreference{@TR:#2}}
+
+\def\presetPDFtransparency#1#2%
+ {\initializePDFtransparency
+ \executeifdefined{\@@PDT#1:#2}{\dopresetPDFtransparency{#1}{#2}}}
+
+\def\dopresetPDFtransparency#1#2%
+ {\global\advance\PDFcurrenttransparency \plusone
+ %\immediate\pdfobj{\PDFtransparancydictionary{#1}{#2}{}}%
+% \special{pdf: object @TR:\the\PDFcurrenttransparency\space \PDFtransparancydictionary{#1}{#2}{}}%
+ \doPDFreserveDPXobject{TR:\the\PDFcurrenttransparency}{<< >>}%
+ \special{pdf: \doPDFcheckedDPXobject{TR:\the\PDFcurrenttransparency}\PDFtransparancydictionary{#1}{#2}{}}%
+ \edef\PDFtransparencyidentifier{/Tr\the\PDFcurrenttransparency}%
+ %\edef\PDFtransparencyreference {\the\pdflastobj\space 0 R}%
+ \edef\PDFtransparencyreference {@TR:\the\PDFcurrenttransparency}%
+ \setxvalue{\@@PDT#1:#2}%
+ {\noexpand\assignPDFtransparency{\the\PDFcurrenttransparency}{\the\PDFcurrenttransparency}}%
+ \appendtoPDFdocumentextgstates
+ {\PDFtransparencyidentifier\space
+ \PDFtransparencyreference\space}}
+
+\def\initializePDFtransparency
+ %{\immediate\pdfobj{\PDFtransparancydictionary{1}{1}{/AIS false}}%
+% {\special{pdf: object @TR:0 \PDFtransparancydictionary{1}{1}{/AIS false}}%
+ {\doPDFreserveDPXobject{TR:0}{<< >>}%
+ \special{pdf: \doPDFcheckedDPXobject{TR:0}\PDFtransparancydictionary{1}{1}{/AIS false}}%
+ \xdef\PDFtransparencyresetidentifier{/Tr0}%
+ %\xdef\PDFtransparencyresetreference{\the\pdflastobj\space 0 R}%
+ \xdef\PDFtransparencyresetreference{@TR:0}%
+ \setxvalue{\@@PDT0:0}%
+ %{\noexpand\assignPDFtransparency{0}{\the\pdflastobj}}%
+ {\noexpand\assignPDFtransparency{0}{0}}%
+ \appendtoPDFdocumentextgstates
+ {\PDFtransparencyresetidentifier\space
+ \PDFtransparencyresetreference\space}%
+ \global\let\initializePDFtransparency\relax}
%D \macros
%D {dosetupinteraction,
%D dosetupopenaction,dosetupcloseaction}
\definespecial\dosetupinteraction
- {\showmessage{\m!interactions}{21}{DVIPDFMx}}
+ {\showmessage\m!interactions{21}{DVIPDFMx}}
\definespecial\dosetupopenaction {\doPDFsetupopenaction}
\definespecial\dosetupcloseaction{\doPDFsetupcloseaction}
@@ -306,35 +358,46 @@
%D \macros
%D {dostartobject,dostopobject,doinsertobject}
+%D
+%D Modified to support the color shading feature since version
+%D \type{dvipdfmx-20021128}.
+
+% wd nextbox > #3 ivm offset
\definespecial\dostartobject#1#2#3#4#5%
{\bgroup
- \setbox\nextbox\hbox\bgroup
- \dosetobjectreference{#1}{#2}{#1::#2}%
- \scratchdimen#3\edef\width {\the\scratchdimen\space}%
- \scratchdimen#4\edef\height{\the\scratchdimen\space}%
- \special{pdf: bxobj @#1::#2 width \width height \height}}
-
-%D Modified to support the color shading feature since version
-%D \type{dvipdfmx-20021128}.
+ \dowithnextbox
+ {\dosetobjectreference{#1}{#2}{@#1::#2}%
+ \scratchdimen#3\edef\width {\the\scratchdimen\space}%
+ \scratchdimen#4\edef\height{\the\scratchdimen\space}%
+ \setbox\nextbox\vbox
+ {\special{pdf: bxobj @#1::#2 width \width height \height}%
+ % we need to compensate for the box offset (ugly, sigh)
+ \scratchdimen\nextboxht
+ \advance\scratchdimen\nextboxdp
+ \advance\scratchdimen-#4\relax
+ \nextboxdp\zeropoint
+ \nextboxht\zeropoint
+ \hbox to #3{\hss\lower.5\scratchdimen\box\nextbox\hss}%
+ \ifx\currentPDFresources\empty
+ \special{pdf: exobj}%
+ \else
+ \special{pdf: exobj <<\currentPDFresources\the\pdfpageresources>>}%
+ \global\let\currentPDFresources\empty
+ \fi}%
+ \smashbox\nextbox
+ \flushatshipout{\box\nextbox}%
+ \egroup}%
+ \hbox\bgroup}
\definespecial\dostopobject
- {\ifx\currentPDFresources\empty
- \special{pdf: exobj}%
- \else
- \special{pdf: exobj <<\currentPDFresources>>}%
- \global\let\currentPDFresources\empty
- \fi
- \egroup
- \smashbox\nextbox
- \flushatshipout{\box\nextbox}%
- \egroup}
+ {\egroup}
\definespecial\doinsertobject#1#2%
{\hbox
- {\dogetobjectreference{#1}{#2}\PDFobjectreference
+ {\doPDFgetobjectreference{#1}{#2}\PDFobjectreference
\ifx\PDFobjectreference\empty \else
- \special{pdf: usexobj @\PDFobjectreference}%
+ \special{pdf: usexobj @#1::#2}%
\fi}}
%D \macros
@@ -439,17 +502,44 @@
\scratchdimen#3\edef\width {\the\scratchdimen\space}%
\scratchdimen#4\edef\height{\the\scratchdimen\space}%
\special{pdf: ann @#1::#2 width \width height \height <<#5>>}%
- \dosetobjectreference{#1}{#2}{#1::#2}%
+ \dosetobjectreference{#1}{#2}{@#1::#2}%
\egroup}
\def\doPDFactionobject class #1 name #2 width #3 height #4 action #5%
{\dodoPDFaction{@#1::#2}{#3}{#4}{#5}%
- \dosetobjectreference{#1}{#2}{#1::#2}}
+ \dosetobjectreference{#1}{#2}{@#1::#2}}
%D \macros
%D {doPDFaddtocatalog,doPDFaddtoinfo,
%D doPDFpageattribute,doPDFpagesattribute}
+% we could move much more to spec-fdf
+
+% \ifx\pdfcatalog \undefined \newtoks\pdfcatalog \fi
+% \ifx\pdfinfo \undefined \newtoks\pdfinfo \fi
+% \ifx\pdfpageattr \undefined \newtoks\pdfpageattr \fi
+% \ifx\pdfpageresources\undefined \newtoks\pdfpageresources \fi
+% \ifx\pdfpagesattr \undefined \newtoks\pdfpagesattr \fi
+
+% \def\doPDFaddtocatalog #1{\expanded{\global\pdfcatalog {#1\the\pdfcatalog }}}
+% \def\doPDFaddtoinfo #1{\expanded{\global\pdfinfo {#1\the\pdfinfo }}}
+% \def\doPDFpageattribute #1{\expanded{\global\pdfpageattr {#1\the\pdfpageattr }}}
+% \def\doPDFpageresource #1{\expanded{\global\pdfpageresources{#1\the\pdfpageresources}}}
+% \def\doPDFpagesattribute#1{\expanded{\global\pdfpagesattr {#1\the\pdfpagesattr }}}
+
+% \def\doPDFresetpageattributes{\global\pdfpageattr\emptytoks}
+% \def\doPDFresetpageresources {\global\pdfpageresources\emptytoks}
+
+% \appendtoks
+% \special{pdf: put @catalog <<#1>>}%
+% \special{pdf: docinfo <<#1>>}%
+% \special{pdf: put @pages <<#1>>}%
+% \to \everylastshipout
+
+% \appendtoks
+% \special{pdf: put @thispage <<#1>>}%
+% \to\everyshipout
+
\def\doPDFaddtocatalog#1%
{\special{pdf: put @catalog <<#1>>}}
@@ -463,7 +553,7 @@
{\special{pdf: put @pages <<#1>>}}
\def\doPDFpageresource#1%
- {\message{[skipping PDF resource]}}
+ {\special{pdf: put @resources <<#1>>}}
\let\doPDFresetpageresources =\relax
\let\doPDFresetpageattributes=\relax
@@ -483,21 +573,58 @@
%D \macros
%D {doPDFdictionaryobject,doPDFarrayobject}
+% Dvipdfmx can't handle
+%
+% \special{pdf:put @foo << /Bar @bar >>}
+% \special{pdf:put @bar << /Foo @foo >>}
+%
+% Objects must be defined before they are used.
+%
+% \special{pdf:obj @foo << >>}
+% \special{pdf:obj @bar << >>}
+% \special{pdf:put @foo << /Bar @bar >>}
+% \special{pdf:put @bar << /Foo @foo >>}
+%
+% However, this only works for dictionary and array.
+
+\def\doPDFreserveDPXobject#1#2%
+ {\ifundefined{r:pdx:d:#1}%
+ % we need a \flushatshipoutprep (prepended, normally appended)
+ \flushatshipout{\special{pdf: object @#1 #2}}%
+ \global\letvalue{r:pdx:d:#1}\empty
+ \fi}
+
+\def\doPDFreserveDPXobjectfirst#1#2%
+ {\ifundefined{r:pdx:d:#1}%
+ \doglobal\prependtoks\special{pdf: object @#1 #2}\to\everyfirstshipout
+ \global\letvalue{r:pdx:d:#1}\empty
+ \fi}
+
+\def\doPDFcheckedDPXobject#1{\ifundefined{r:pdx:d:#1}object\else put\fi\space @#1\space}
+
+% todo when etex is fixed, \everyPDFpresets, leeg voor pdftex, nodig voor dvipdfmx
+
+\doPDFreserveDPXobjectfirst{FDF::docuextgstates}{<< >>}
+
\def\doPDFdictionaryobject class #1 name #2 data #3%
- {\special{pdf: object @#1::#2 <<#3>>}}
+ {\flushatshipout
+ {\special{pdf: \doPDFcheckedDPXobject{#1::#2}<<#3>>}%
+ \dosetobjectreference{#1}{#2}{@#1::#2}}}
\def\doPDFarrayobject class #1 name #2 data #3%
- {\special{pdf: object @#1::#2 [#3]}}
+ {\flushatshipout
+ {\special{pdf: \doPDFcheckedDPXobject{#1::#2}[#3]}%
+ \dosetobjectreference{#1}{#2}{@#1::#2}}}
%D \macros
%D {defaultobjectreference,doPDFgetobjectreference}
-\def\defaultobjectreference#1#2{#1::#2}
+\def\defaultobjectreference#1#2{@#1::#2}
%D \type{\doPDFgetobjectreference} in \type{spec-dpm} had a bug.
\def\doPDFgetobjectreference#1#2#3%
- {\dogetobjectreference{@#1}{#2}#3%
+ {\dogetobjectreference{#1}{#2}#3%
\ifx#3\empty\else\edef#3{#3}\fi}
% \def\doPDFgetobjectpage #1#2#3{..}
@@ -578,14 +705,33 @@
%D 5. Modified codes from \type{supp-pdf}
-\let\dohandleMPfshow\handleMPfshow
-
\def\handleMPfshow
{\special{pdf: literal direct q}%
\special{pdf: literal reverse}%
\dohandleMPfshow
\special{pdf: literal direct Q}}
+\newcounter\MPPDFcounter
+
+\def\setMPPDFobject#1#2% resources boxnumber / see other object macros / unchecked
+ {\doglobal\increment\MPPDFcounter
+ \bgroup
+ \setbox\nextbox\vbox
+ {\scratchdimen\wd#2\edef\width {\the\scratchdimen\space}%
+ \scratchdimen\ht#2\edef\height{\the\scratchdimen\space}%
+ \special{pdf: bxobj @MPPDF:\MPPDFcounter\space width \width height \height}%
+ \box#2%
+ \special{pdf: exobj <<\currentPDFresources>>}}%
+ \smashbox\nextbox
+ \flushatshipout{\box\nextbox}%
+ \egroup
+ \edef\getMPPDFobject{\special{pdf: usexobj @MPPDF:\MPPDFcounter}}}
+
+\let\getMPPDFobject\relax
+
+\definespecial\doinsertMPfile#1%
+ {\doiffileelse{./#1}{\includeMPasPDF{./#1}}{\message{[MP #1]}}}
+
%D Experimental (untested):
\definespecial\dostartfonteffect{\doPDFstartfonteffect}
diff --git a/tex/context/base/spec-dvi.tex b/tex/context/base/spec-dvi.tex
index 3a39e5229..52b2a421d 100644
--- a/tex/context/base/spec-dvi.tex
+++ b/tex/context/base/spec-dvi.tex
@@ -61,7 +61,6 @@
\hbox{\unhbox0}% the \hbox is really needed!
\egroup}
-
%D \macros
%D {dosetposition,
%D dosetpositionwhd,
diff --git a/tex/context/base/spec-fdf.tex b/tex/context/base/spec-fdf.tex
index 0a4013b6f..a888fa41c 100644
--- a/tex/context/base/spec-fdf.tex
+++ b/tex/context/base/spec-fdf.tex
@@ -378,12 +378,24 @@
{\ifcase#6 \or\or\else /ViewerPreferences << /FitWindow true >>\fi}%
\egroup}
+% not that good if we switch drivers
+
\appendtoksonce % hack to prevent duplicates
\doPDFaddtocatalog{\currentPDFpagemode\currentPDFviewerprefs}%
\doPDFaddtoinfo{/Trapped /False}%
\doPDFaddtoinfo{/ConTeXt.Version (\contextversion)}%
\to \everyfirstshipout
+\def\PDFversion{1.5}
+
+\appendtoksonce
+ \def\PDFversion{1.5}%
+\to \everyresetspecials
+
+\appendtoksonce % we catch both n and 1.n
+ \doPDFaddtocatalog{/Version \ifdim\PDFversion00\points>100\points 1.\fi\PDFversion}%
+\to \everylastshipout
+
\def\doPDFsetupwhateverbox#1#2#3#4#5#6% watch the extra arguments
{\bgroup
\!!widtha#5%
@@ -1022,11 +1034,13 @@
\startPDFsymbolappearance
\doPDFembedfile\PDFfile{#7}{#8}%
\doPDFgetembeddedfilereference\PDFfile\PDFobjectreference
+ \setFDFlayer\@@DriverAttachmentLayer
\doPDFannotation width {\width} height {\totalheight} data
{/Subtype /FileAttachment
/FS \PDFobjectreference\space
/Contents (#1)
\PDFsymbol
+ \FDFlayer
\PDFattributes}%
\stopPDFsymbolappearance
\egroup}
@@ -1257,37 +1271,6 @@
%D support. These macros are complicated by the fact that
%D cloning is possible.
-% new approach, 'global' variables, since we run out of
-% arguments
-
-\ifx\undefined\@@DriverFieldName
-
- \letempty \@@DriverFieldName
- \letempty \@@DriverFieldWidth
- \letempty \@@DriverFieldHeight
- \letempty \@@DriverFieldDefault
- \letempty \@@DriverFieldNumber
- \letempty \@@DriverFieldNumber
- \letempty \@@DriverFieldStyle
- \letempty \@@DriverFieldColor
- \letempty \@@DriverFieldBackgroundColor
- \letempty \@@DriverFieldFrameColor
- \letempty \@@DriverFieldLayer
- \letempty \@@DriverFieldOption
- \letempty \@@DriverFieldAlign
- \letempty \@@DriverFieldClickIn
- \letempty \@@DriverFieldClickOut
- \letempty \@@DriverFieldRegionIn
- \letempty \@@DriverFieldRegionOut
- \letempty \@@DriverFieldAfterKey
- \letempty \@@DriverFieldFormat
- \letempty \@@DriverFieldValidate
- \letempty \@@DriverFieldCalculate
- \letempty \@@DriverFieldFocusIn
- \letempty \@@DriverFieldFocusOut
-
-\fi
-
%D \macros
%D {FDFflag...,FDFplus...}
%D
@@ -1819,7 +1802,7 @@
\def\doFDFpresetlinefield#1#2#3#4#5#6#7#8#9%
{\bgroup
- \setFDFlayer
+ \setFDFlayer\@@DriverFieldLayer
\setFDFswitches[#7]%
\setFDFattributes[#6]%
\setFDFalignment[#8]%
@@ -1884,7 +1867,7 @@
\def\doFDFpresetchoicefield#1#2#3#4#5#6#7#8%
{\bgroup
- \setFDFlayer
+ \setFDFlayer\@@DriverFieldLayer
\setFDFswitches[#6]%
\setFDFattributes[#5]%
\setFDFvalues[#7][#4]%
@@ -1949,7 +1932,7 @@
\def\doFDFpresetpushcheckfield#1#2#3#4#5#6#7#8% in acro<5 (\FDFdefault)
{\bgroup % in acro>5 /\FDFdefault
- \setFDFlayer
+ \setFDFlayer\@@DriverFieldLayer
\ifcase#8\relax\FDFvaluesfalse\else\FDFvaluestrue\fi
\setFDFswitches[#5]%
\setFDFactions[#7]%
@@ -2030,7 +2013,7 @@
\def\doFDFpresetradiofield#1#2#3#4#5#6#7#8%
{\bgroup
- \setFDFlayer
+ \setFDFlayer\@@DriverFieldLayer
\FDFvaluestrue
\setFDFswitches[#5]%
\setFDFactions[#8]%
@@ -2195,13 +2178,13 @@
%D Layer support:
-\def\setFDFlayer % todo : \ifx\PDFobjectreference\noPDFobjectreference ipv found
+\def\setFDFlayer#1% todo : \ifx\PDFobjectreference\noPDFobjectreference ipv found
{\letempty\FDFlayer
- \doifsomething\@@DriverFieldLayer
- {\checkproperty[\@@DriverFieldLayer]% == \dodocheckproperty\@@DriverFieldLayer
- \doifobjectreferencefoundelse{PDLN}\@@DriverFieldLayer
- {\doPDFgetobjectreference{PDLN}\@@DriverFieldLayer\PDFobjectreference
- \edef\FDFlayer{/OC \PDFobjectreference}}%
+ \doifsomething{#1}%
+ {\checkproperty[#1]% == \dodocheckproperty\@@DriverFieldLayer
+ \doifobjectreferencefoundelse{PDLN}{#1}
+ {\doPDFgetobjectreference{PDLN}{#1}\!!stringa % we need to avoid a clash with other macros
+ \edef\FDFlayer{/OC \!!stringa}}%
\donothing}}
%D The three appearances {\em normal}, \type{roll over} and
@@ -2519,13 +2502,14 @@
\def\doPDFflushcomments
{\box\PDFsymbolbox}
-\long\def\doPDFinsertcomment#1#2#3#4#5#6#7#8%
+\long\def\doPDFinsertcomment#1#2#3#4#5#6#7#8% % \@@DriverCommentLayer set otherwise
{\bgroup % title width height color open symbol collect data
\presetPDFsymbolappearance{#4}{#6}{#2}{#3}\!!zeropoint% sets width/height
\doifelsenothing{#1}
{\let\PDFidentifier\empty}
{\def\PDFidentifier{/T (#1)}}%
\sanitizePDFencoding#8\to\PDFdata
+ \setFDFlayer\@@DriverCommentLayer
\startPDFsymbolappearance
\ifPDFpopupcomments
\doglobal\increment\nofFDFcomments
@@ -2535,22 +2519,26 @@
\donefalse
\ifdone
\setbox\scratchbox\hbox
- % pdftex (efficient)
- % {\doPDFannotation
- % generic (less efficient)
{\doPDFannotationobject class FDF name {c::\nofFDFcomments}
- % argument (common)
- width #2 height #3 data % text window
+ width #2 height #3 data % text window, size does not work
{/Subtype /Popup
/Parent \PDFobjectreference}}%
\ifcase#7\relax
\vbox to \height{\forgetall\vskip#3\box\scratchbox\vss}%
\else % incredible trial and error hack
+ % it's quite a mess, the annot width cannot be set, well, it can
+ % but the appearance and text sizes get mixed up
+% \setbox\scratchbox\vbox to \height{\forgetall\vskip#3\box\scratchbox\vss}%
+% \global\setbox\PDFsymbolbox\vbox
+% {\hsize#2%
+% \forgetall
+% \vsmash{\box\PDFsymbolbox}
+% \box\scratchbox}%
+ % this may change when acrobat gets less bugged
+ \setbox\scratchbox\vbox to #3{\forgetall\vss\box\scratchbox}%
+ \wd\scratchbox#2%
\global\setbox\PDFsymbolbox\vbox
- {\hsize#2%
- \forgetall
- \vsmash{\box\PDFsymbolbox}
- \box\scratchbox}%
+ {\startoverlay{\box\PDFsymbolbox}{\box\scratchbox}\stopoverlay}%
\fi
\fi
% generic
@@ -2568,6 +2556,7 @@
\ifdone /Popup \PDFobjectreference\fi
/Contents \ifPDFunicode <\PDFdata> \else(\PDFdata) \fi
\PDFidentifier
+ \FDFlayer
\PDFsymbol
\PDFattributes}%
\else
@@ -2575,6 +2564,7 @@
{/Subtype /Text
\ifcase#5 \else/Open true\fi
/Contents \ifPDFunicode <\PDFdata> \else(\PDFdata) \fi
+ \FDFlayer
\PDFsymbol
\PDFidentifier
\PDFattributes}%
@@ -2753,8 +2743,27 @@
\def\doPDFstartgraycolormode#1%
{\PDFcode{#1 g\ifPDFstrokecolor\space#1 G\fi}}
-\def\doPDFstartspotcolormode#1#2%
- {\PDFcode{/#1 CS #2 SC /#1 cs #2 sc}}
+% \def\doPDFstartspotcolormode#1#2%
+% {\PDFcode{/#1 CS #2 SC /#1 cs #2 sc}}
+
+\def\doPDFstartspotcolormode#1#2% redefining spotcolors is not possible anyway
+ {\ifundefined{pdf:scs:#2}%
+ \bgroup
+ \getcommacommandsize[#2]%
+ \ifcase\commalistsize\or
+ \setxvalue{pdf:scs:#2}{#2 SCN #2 scn}% \setxvalue{pdf:scs:#2}{#2 SC #2 sc}%
+ \else
+ \let\PDFspotcolorspecs\empty
+ \def\dospotcolorcommand##1{\edef\PDFspotcolorspecs{\PDFspotcolorspecs##1\space}}%
+ \processcommacommand[#2]\dospotcolorcommand
+ \setxvalue{pdf:scs:#2}{\PDFspotcolorspecs SCN \PDFspotcolorspecs scn}%
+ \fi
+ \egroup
+ \fi
+ \PDFcode{/#1 cs /#1 CS \PDFgetspotcolorspec{#2}}}
+
+\def\PDFgetspotcolorspec#1%
+ {\executeifdefined{pdf:scs:#1}\empty} % better no default than one with too less args
\def\doPDFstartnonecolormode
{\PDFcode{/None CS 1 SC /None cs 1 sc}}
@@ -2769,27 +2778,53 @@
% /Device#2 \the\pdflastobj\space0 R]} so we use separation
% colors that work and print ok
-\def\doPDFregistersomespotcolor#1#2#3#4%
+\def\doPDFregistersomespotcolor#1#2#3#4% implemented in the driver
{\writestatus\m!systems{missing spot color definition}\wait}
\def\doPDFregisternonecolor % internal command
{\doPDFregistergrayspotcolor{None}{1}%
\globallet\doPDFregisternonecolor\relax}
-\def\doPDFregisterrgbspotcolor#1#2#3#4%
- {\doPDFregistersomespotcolor
- {#1}{RGB}{[0.0 1.0 0.0 1.0 0.0 1.0]}%
- {{dup #2 mul exch dup #3 mul exch #4 mul}}}
+% \def\doPDFregisterrgbspotcolor#1#2#3#4%
+% {\doPDFregistersomespotcolor
+% {#1}{RGB}{[0.0 1.0 0.0 1.0 0.0 1.0]}%
+% {{dup #2 mul exch dup #3 mul exch #4 mul}}}
+%
+% \def\doPDFregistercmykspotcolor#1#2#3#4#5%
+% {\doPDFregistersomespotcolor
+% {#1}{CMYK}{[0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0]}%
+% {{dup #2 mul exch dup #3 mul exch dup #4 mul exch #5 mul}}}
+%
+% \def\doPDFregistergrayspotcolor#1#2%
+% {\doPDFregistersomespotcolor
+% {#1}{Gray}{[0.0 1.0]}%
+% {{pop}}}
+
+\def\doPDFregisterrgbspotcolor#1#2#3#4#5#6#7% name noffractions names p's r g b
+ {\doPDFregistersomespotcolor{#1}{#2}{#3}{#4}{RGB}{0.0 1.0 0.0 1.0 0.0 1.0}%
+ {\ifcase#2\or dup #5 mul exch dup #6 mul exch #7 mul\else#5 #6 #7\fi}}
+
+\def\doPDFregistercmykspotcolor#1#2#3#4#5#6#7#8% name noffractions names p's c m y k
+ {\doPDFregistersomespotcolor{#1}{#2}{#3}{#4}{CMYK}{0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0}%
+ {\ifcase#2\or dup #5 mul exch dup #6 mul exch dup #7 mul exch #8 mul\else #5 #6 #7 #8\fi}}
+
+\def\doPDFregistergrayspotcolor#1#2#3#4#5% name noffractions names p's s
+ {\doPDFregistersomespotcolor{#1}{#2}{#3}{#4}{Gray}{0.0 1.0}%
+ {\ifcase#2\or pop\else#5\fi}}
-\def\doPDFregistercmykspotcolor#1#2#3#4#5%
- {\doPDFregistersomespotcolor
- {#1}{CMYK}{[0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0]}%
- {{dup #2 mul exch dup #3 mul exch dup #4 mul exch #5 mul}}}
+%D New and very experimental.
-\def\doPDFregistergrayspotcolor#1#2%
- {\doPDFregistersomespotcolor
- {#1}{Gray}{[0.0 1.0]}%
- {{pop}}}
+\def\doPDFregistercmykindexcolor#1#2#3#4#5#6#7#8% name noffractions names p's c m y k
+ {\doPDFregistersomeindexcolor{#1}{#2}{#3}{#4}{CMYK}{0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0}%
+ {dup #5 mul exch dup #6 mul exch dup #7 mul exch #8 mul}}
+
+\def\doPDFregisterrgbindexcolor#1#2#3#4#5#6#7% name noffractions names p's r g b
+ {\doPDFregistersomeindexcolor{#1}{#2}{#3}{#4}{RGB}{0.0 1.0 0.0 1.0 0.0 1.0}%
+ {dup #5 mul exch dup #6 mul exch #7 mul}}
+
+\def\doPDFregistergrayindexcolor#1#2#3#4#5% name noffractions names p's s
+ {\doPDFregistersomeindexcolor{#1}{#2}{#3}{#4}{Gray}{0.0 1.0}%
+ {pop}}
%D \macros
%D {doPDFstartrotation,doPDFstoprotation}
@@ -2911,6 +2946,8 @@
%D Transparency support (experimental):
+\newif\ifPDFtransparencysupported
+
\def\PDFtransparancydictionary#1#2#3% type fraction extras
{<</Type /ExtGState
/ca #2 /CA #2
@@ -2920,8 +2957,6 @@
Exclusion\else Compatible\fi
#3>>}
-\newif\ifPDFtransparencysupported
-
\def\dodoPDFstarttransparency#1#2%
{\presetPDFtransparency{#1}{#2}%
\PDFcode{\PDFtransparencyidentifier\space gs }}
@@ -3008,7 +3043,7 @@
\fi
/Name (#2)}%
\doPDFgetobjectreference{PDLN}{#1}\PDFobjectreference
- \xdef\PDFtextlayers{\PDFtextlayers\space\PDFobjectreference}%
+ \xdef\PDFtextlayers{\PDFtextlayers\space\PDFobjectreference}%
\doifelse{#3}\v!start
{\xdef\PDFvidelayers{\PDFvidelayers\space\PDFobjectreference}}%
{\xdef\PDFhidelayers{\PDFhidelayers\space\PDFobjectreference}}%
diff --git a/tex/context/base/spec-ini.tex b/tex/context/base/spec-ini.tex
index 33cae54dc..1f5a8975d 100644
--- a/tex/context/base/spec-ini.tex
+++ b/tex/context/base/spec-ini.tex
@@ -11,10 +11,11 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newif\ifsimplifyspecials \simplifyspecialstrue % see later
-
+% todo: make this one more plain so that i can use it in plain jobs
% todo: no args, named vars instead
-% maybe also drop multiple drivers and make simply the default, then simplier defs
+% maybe also drop multiple drivers and make simplify the default, then simplier defs
+
+\newif\ifsimplifyspecials \simplifyspecialstrue % see later
%D We will forbid loading specials after the first page is
%D shipped out.
@@ -658,4 +659,4 @@
\resetspecials\processcommacommand[#1]\dosetupoutput
\fi}
-\protect \endinput
+\protect \endinput \ No newline at end of file
diff --git a/tex/context/base/spec-mis.tex b/tex/context/base/spec-mis.tex
index 49c7d40dd..948d8fcca 100644
--- a/tex/context/base/spec-mis.tex
+++ b/tex/context/base/spec-mis.tex
@@ -8,13 +8,13 @@
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
%D Quite some modules in this group are dedicated to supporting
%D \PDF\ directly by means of \PDFTEX or indirectly by using
%D Acrobat Distiller. This module implements some common
-%D features.
+%D features.
\writestatus{loading}{Context Special Macros / Miscellaneous Macros}
@@ -23,13 +23,13 @@
%D \macros
%D {URLhash}
%D
-%D A rather trivial macro:
+%D A rather trivial macro:
\expandafter\def\expandafter\URLhash\expandafter{\string#}
-%D \macros
+%D \macros
%D {ifusepagedestinations}
-%D
+%D
%D In \PDF\ version 1.0 only page references were supported,
%D while in \DVIWINDO\ 1.N only named references were accepted.
%D Therefore \CONTEXT\ supports both methods of referencing. In
@@ -38,55 +38,79 @@
%D therefore sometimes forces us to prefer page references. As
%D a bonus, they are faster too and have no limitations. How
%D fortunate we were having both mechanisms available when the
-%D version 3.0 (\PDF\ version 1.2) viewers proved to be too
-%D bugged to support named destinations.
+%D version 3.0 (\PDF\ version 1.2) viewers proved to be too
+%D bugged to support named destinations.
\newif\ifusepagedestinations
-%D \macros
-%D {ifhighlighthyperlinks}
-%D
-%D The next switch can be used to make user hyperlinks are
-%D not highlighted when clicked on.
+%D \macros
+%D {ifhighlighthyperlinks}
+%D
+%D The next switch can be used to make user hyperlinks are
+%D not highlighted when clicked on.
-\newif\ifhighlighthyperlinks
+\newif\ifhighlighthyperlinks
-%D \macros
+%D \macros
%D {ifgotonewwindow}
-%D
-%D To make the {\em goto previous jump} feature more
-%D convenient when using more than one file, it makes sense
-%D to force the viewer to open a new window for each file
-%D opened.
+%D
+%D To make the {\em goto previous jump} feature more
+%D convenient when using more than one file, it makes sense
+%D to force the viewer to open a new window for each file
+%D opened.
-\newif\ifgotonewwindow
+\newif\ifgotonewwindow
-%D \macros
+%D \macros
%D {ifPDFstrokecolor}
%D
-%D We can reduce the filesize a bit by setting the next switch
-%D to false. The amount of reduction depends on the use of
-%D color, but don't expect more than a few percent. Zip
-%D compression is already rather efficient in itself.
+%D We can reduce the filesize a bit by setting the next switch
+%D to false. The amount of reduction depends on the use of
+%D color, but don't expect more than a few percent. Zip
+%D compression is already rather efficient in itself.
\newif\ifPDFstrokecolor \PDFstrokecolortrue
-%D \macros
+%D \macros
%D {dodoinsertfile,dofileinsertion,
%D definefileinsertion,doiffileinsertionsupported}
-%D
+%D
%D File insertion depend on the driver or \TEX\ variant used.
%D All driver modules use the same scheme for file insertion,
-%D and therefore have the next macro in common:
-
-\def\dododoinsertfile[#1][#2,#3][#4,#5]% \next kan weg
- {\def\fileinsertionclass{do#1insert}%
- \doifdefinedelse{\fileinsertionclass#3}
- {\def\next{\getvalue{\fileinsertionclass#3}}}
- {\doifdefinedelse{\fileinsertionclass#2}
- {\def\next{\getvalue{\fileinsertionclass#2}}}
- {\def\next{\gobbleninearguments}}}%
- \next{#4}{#5}}
+%D and therefore have the next macro in common:
+
+% \def\dododoinsertfile[#1][#2,#3][#4,#5]% \next kan weg
+% {\def\fileinsertionclass{do#1insert}%
+% \doifdefinedelse{\fileinsertionclass#3}
+% {\def\next{\getvalue{\fileinsertionclass#3}}}
+% {\doifdefinedelse{\fileinsertionclass#2}
+% {\def\next{\getvalue{\fileinsertionclass#2}}}
+% {\def\next{\gobbleninearguments}}}%
+% \next{#4}{#5}}
+%
+% more modern
+%
+% \def\dododoinsertfile[#1][#2,#3][#4,#5]%
+% {\def\fileinsertionclass{do#1insert}%
+% \doifdefinedelse{\fileinsertionclass#3}
+% {\getvalue{\fileinsertionclass#3}}
+% {\doifdefinedelse{\fileinsertionclass#2}
+% {\getvalue{\fileinsertionclass#2}}
+% {\gobbleninearguments}}%
+% {#4}{#5}}
+%
+% more efficient
+%
+% \def\dododoinsertfile[#1][#2,#3][#4,#5]%
+% {\def\fileinsertionclass{do#1insert}%
+% \executeifdefined{\fileinsertionclass#3}
+% {\executeifdefined{\fileinsertionclass#2}\gobbleninearguments}%
+% {#4}{#5}}
+%
+% cleaner
+
+\def\dododoinsertfile[#1][#2,#3][#4,#5]%
+ {\executeifdefined{do#1insert#3}{\executeifdefined{do#1insert#2}\gobbleninearguments}{#4}{#5}}
\def\dodoinsertfile#1#2#3%
{\dododoinsertfile[#1][#2][#3]}
@@ -107,18 +131,18 @@
\def\doiffileinsertionsupportedelse#1%
{\ExpandBothAfter\doifinstringelse{#1}{\c!tex,\c!tmp,\supportedfileinsertions}}
-%D This macro is called with 10 arguments, where the first
+%D This macro is called with 10 arguments, where the first
%D one specifies the driver, like \type{yy} or \type{tr}. The
-%D second argument is a \type{{type,method}} pair and the
-%D third the filename.
+%D second argument is a \type{{type,method}} pair and the
+%D third the filename.
-%D Just in case this one is undefined (which can happen if
-%D this module is used outside \CONTEXT):
+%D Just in case this one is undefined (which can happen if
+%D this module is used outside \CONTEXT):
\ifx\setreferencefilename\undefined
\def\setreferencefilename#1\to#2{\edef#2{#1}}
-
+
\fi
%D When submitting forms, we need to communicate the format.
@@ -127,20 +151,20 @@
\def\setsubmitoutputformat#1%
{\doifinsetelse{#1}{FDF,fdf}
- {\chardef\submitoutputformat2}
+ {\chardef\submitoutputformat2}
{\doifinsetelse{#1}{XML,xml}
{\chardef\submitoutputformat3}
{\chardef\submitoutputformat1}}%
- \relax}
+ \relax}
-%D \macros
+%D \macros
%D {escapePSstring}
%D
-%D \starttypen
-%D \escapePSstring(t\e\1st)))))\to\crap \crap
-%D \stoptypen
+%D \starttypen
+%D \escapePSstring(t\e\1st)))))\to\crap \crap
+%D \stoptypen
-% testcase: webschrift met lege regels en unbalanced ()
+% testcase: webschrift met lege regels en unbalanced ()
\bgroup
@@ -188,12 +212,26 @@
\def\par{\rawcharacter{12}\rawcharacter{12}}%
\expanded{\egroup\noexpand\def\noexpand#2{#1}}}
-%D \macros
+%D \macros
%D {ifPDFunicode}
-%D
+%D
%D We can use this switch to signal that content streams has
-%D to be unicoded.
+%D to be unicoded.
\newif\ifPDFunicode
-\protect \endinput
+%D \macros
+%D {makeMPintoPDFobject, handleMPfshow, setMPPDFobject, getMPPDFobject}
+%D
+%D \METAPOST\ support.
+
+\appendtoks
+ \chardef\makeMPintoPDFobject\zerocount
+ \def\setMPPDFobject#1#2{\def\getMPPDFobject{\box#2}}%
+\to \everyresetspecials
+
+\appendtoks
+ \let\handleMPfshow\dohandleMPfshow
+\to \everyresetspecials
+
+\protect \endinput \ No newline at end of file
diff --git a/tex/context/base/spec-ps.tex b/tex/context/base/spec-ps.tex
index db9d82f53..df9097b08 100644
--- a/tex/context/base/spec-ps.tex
+++ b/tex/context/base/spec-ps.tex
@@ -219,6 +219,11 @@
\definespecial\dostopclipping
{\special{\@@insertpostscriptliteral\space restore}}
+%D Some MP stuff:
+
+\definespecial\doinsertMPfile#1%
+ {\doiffileelse{./#1}{\includeMPasEPS{./#1}}{\message{[MP #1]}}}
+
\stopspecials
\endinput \ No newline at end of file
diff --git a/tex/context/base/spec-tpd.tex b/tex/context/base/spec-tpd.tex
index 10ab42ed3..224f7520e 100644
--- a/tex/context/base/spec-tpd.tex
+++ b/tex/context/base/spec-tpd.tex
@@ -125,6 +125,8 @@
\pdfoptionpdfminorversion=5
+\def\PDFversion{1.\the\pdfoptionpdfminorversion}%
+
% %D Why are the Acrobat viewers so buggy? To prevent font cache
% %D mismatches, we say:
%
@@ -243,7 +245,7 @@
\definespecial\dogetnofinsertpages#1%
{\xdef\nofinsertpages{1}% global
\doifvalidpdfimagefileelse{#1}%
- {\pdfximage{#1}\xdef\nofinsertpages{\the\pdflastximagepages}}
+ {\pdfximage {#1}\xdef\nofinsertpages{\the\pdflastximagepages}}
{}}
%D Currently we support \type{pdf} for \PDF\ files, \type{mps}
@@ -320,6 +322,7 @@
\ifdim#7>\zeropoint \!!width #7\fi
\ifdim#8>\zeropoint \!!height #8\fi
\pdfimagepagenumber
+% \@@DriverImageBox
{#1}%
\xdef\PDFimagereference{\the\pdflastximage}%
\xdef\nofinsertpages{\the\pdflastximagepages}%
@@ -370,6 +373,8 @@
%D themselves have alternatives, especially cylcic
%D dependencies.
+\ifx\@@DriverImageBox\undefined \def\@@DriverImageBox{artbox} \fi
+
\ifnum\pdftexversion>13
\def\checkpdfimageattributes
@@ -400,8 +405,9 @@
\the\everyPDFximage
\checkpdfimagepagenumber{#3}%
\checkpdfimageattributes
- \global\setbox\foundexternalfigure\vbox
- {\immediate\pdfximage \pdfimageattributes \pdfimagepagenumber{#2}%
+ \global\setbox\foundexternalfigure\hbox
+ {\immediate\pdfximage
+ \pdfimageattributes \pdfimagepagenumber \@@DriverImageBox {#2}%
\xdef\PDFimagereference{\the\pdflastximage}%
\xdef\nofinsertpages{\the\pdflastximagepages}%
\pdfrefximage\pdflastximage}%
@@ -419,19 +425,19 @@
\else
-\def\dogetTPDfiguresize#1#2#3#4#5#6#7%
- {\ifmeasureTPDfiguresize
- #4\zeropoint
- #5\zeropoint
- \doifvalidpdfimagefileelse{#2}
- {\global\setbox\foundexternalfigure\vbox{\pdfimage{#2}}%
- #6\wd\foundexternalfigure
- #7\ht\foundexternalfigure}
- {#6\zeropoint
- #7\zeropoint}%
- \else
- #1{#2}{#3}{#4}{#5}{#6}{#7}% \normaldogetfiguresize...
- \fi}
+ \def\dogetTPDfiguresize#1#2#3#4#5#6#7%
+ {\ifmeasureTPDfiguresize
+ #4\zeropoint
+ #5\zeropoint
+ \doifvalidpdfimagefileelse{#2}
+ {\global\setbox\foundexternalfigure\vbox{\pdfimage{#2}}%
+ #6\wd\foundexternalfigure
+ #7\ht\foundexternalfigure}
+ {#6\zeropoint
+ #7\zeropoint}%
+ \else
+ #1{#2}{#3}{#4}{#5}{#6}{#7}% \normaldogetfiguresize...
+ \fi}
\fi
@@ -510,17 +516,77 @@
\definespecial\doregisterrgbspotcolor {\doPDFregisterrgbspotcolor}
\definespecial\doregistergrayspotcolor{\doPDFregistergrayspotcolor}
+\definespecial\doregistercmykindexcolor{\doPDFregistercmykindexcolor}
+\definespecial\doregisterrgbindexcolor {\doPDFregisterrgbindexcolor}
+\definespecial\doregistergrayindexcolor{\doPDFregistergrayindexcolor}
+
\definespecial\dostartnonecolormode{\doPDFstartnonecolormode}
\definespecial\doregisternonecolor {\doPDFregisternonecolor}
-\def\doPDFregistersomespotcolor#1#2#3#4%
- {\immediate \pdfobj stream attr
- {/FunctionType 4 /Domain [0.0 1.0] /Range #3}{#4}%
+% \def\doPDFregistersomespotcolor#1#2#3#4%
+% {\immediate \pdfobj stream attr
+% {/FunctionType 4 /Domain [0.0 1.0] /Range #3}{#4}%
+% \immediate \pdfobj
+% {[/Separation /#1 /Device#2 \the\pdflastobj\space0 R]}%
+% \dosetobjectreference{PDFCS}{#1}{\the\pdflastobj}%
+% \appendtoPDFdocumentcolorspaces
+% {/#1 \the\pdflastobj\space0 R}}
+
+\def\doPDFregistersomespotcolor#1#2#3#4#5#6#7% name fractions names p's space domain function
+ {\bgroup
+ \let\spotpops\empty
+ \ifcase#2\or
+ \def\PDFspotcolornames{/Separation /#1}%
+ \def\PDFspotcolordomain{0.0 1.0}%
+ \else
+ \dorecurse{#2}{\edef\spotpops{\spotpops pop }}%
+ \let\PDFspotcolornames \empty
+ \let\PDFspotcolordomain\empty
+ \def\dospotcolorcommand##1%
+ {\edef\PDFspotcolornames {\PDFspotcolornames/##1\space}%
+ \edef\PDFspotcolordomain{\PDFspotcolordomain 0.0 1.0\space}}%
+ \processcommacommand[#3]\dospotcolorcommand
+ \edef\PDFspotcolornames{/DeviceN [\PDFspotcolornames]}%
+ \fi
+ \immediate \pdfobj stream attr
+ {/FunctionType 4 /Domain [\PDFspotcolordomain] /Range [#6]}{{\spotpops#7}}%
\immediate \pdfobj
- {[/Separation /#1 /Device#2 \the\pdflastobj\space0 R]}%
+ {[\PDFspotcolornames\space /Device#5 \the\pdflastobj\space0 R]}%
\dosetobjectreference{PDFCS}{#1}{\the\pdflastobj}%
- \appendtoPDFdocumentcolorspaces
- {/#1 \the\pdflastobj\space0 R}}
+ \appendtoPDFdocumentcolorspaces{/#1 \the\pdflastobj\space0 R}%
+ \egroup}
+
+%D New and very experimental.
+
+\def\doPDFregistersomeindexcolor#1#2#3#4#5#6#7% name fractions names p's space domain function
+ {\bgroup
+ \let\spotpops\empty
+ \dorecurse{#2}{\edef\spotpops{\spotpops exch pop\space}}%
+ \let\PDFspotcolornames \empty
+ \let\PDFspotcolordomain\empty
+ \def\docommand##1%
+ {\edef\PDFspotcolornames {\PDFspotcolornames/##1\space}%
+ \edef\PDFspotcolordomain{\PDFspotcolordomain 0.0 1.0\space}}%
+ \processcommacommand[#3,None]\docommand
+ \let\PDFcolorindexvector\empty
+ \def\docommand##1%
+ {\scratchdimen##1\points
+ \scratchdimen\recurselevel\scratchdimen
+ \scratchcounter\scratchdimen
+ \divide\scratchcounter \maxcard
+ \edef\PDFcolorindexvector{\PDFcolorindexvector\uchexnumbers\scratchcounter}}%
+ \dostepwiserecurse\zerocount{255}\plusone
+ {\rawprocesscommacommand[#4,1]\docommand
+ \xdef\PDFcolorindexvector{\PDFcolorindexvector\space}}%
+ \immediate \pdfobj stream attr
+ {/FunctionType 4 /Domain [\PDFspotcolordomain] /Range [#6]}{{\spotpops#7}}%
+ \immediate \pdfobj
+ {[/Indexed
+ [/DeviceN [\PDFspotcolornames] /Device#5 \the\pdflastobj\space0 R] %
+ 255 <\PDFcolorindexvector>]}%
+ \dosetobjectreference{PDFIX}{#1}{\the\pdflastobj}%
+ \appendtoPDFdocumentcolorspaces{/#1_INDEXED \the\pdflastobj\space0 R}%
+ \egroup}
%D \macros
%D {dostarttransparency,dostoptransparency}
@@ -535,7 +601,9 @@
\def\@@PDT{@PDT@}
-\newcount\PDFcurrenttransparency \PDFcurrenttransparency=0 % -1
+\ifx\PDFcurrenttransparency\undefined
+ \newcount\PDFcurrenttransparency \PDFcurrenttransparency=0 % -1
+\fi
\def\assignPDFtransparency#1#2%
{\def\PDFtransparencyidentifier{/Tr#1}%
@@ -1140,11 +1208,13 @@
\def\doPDFdictionaryobject class #1 name #2 data #3%
{\flushatshipout
- {\immediate\pdfobj{<< #3 >>}\dosetobjectreference{#1}{#2}{\the\pdflastobj}}}
+ {\immediate\pdfobj{<< #3 >>}%
+ \dosetobjectreference{#1}{#2}{\the\pdflastobj}}}
\def\doPDFarrayobject class #1 name #2 data #3%
{\flushatshipout
- {\immediate\pdfobj{[ #3 ]}\dosetobjectreference{#1}{#2}{\the\pdflastobj}}}
+ {\immediate\pdfobj{[ #3 ]}%
+ \dosetobjectreference{#1}{#2}{\the\pdflastobj}}}
%D \macros
%D {defaultobjectreference,doPDFgetobjectreference}
@@ -1234,6 +1304,28 @@
\definespecial\dostartfonteffect{\doPDFstartfonteffect}
\definespecial\dostopfonteffect {\doPDFstopfonteffect}
+%D Some MP stuff:
+
+\let\handleMPfshow\dohandleMPfshow % default anyway
+
+\ifnum\pdftexversion<14
+
+ \def\setMPPDFobject#1#2% resources boxnumber
+ {\def\getMPPDFobject{\box#2}}
+
+\else
+
+ \def\setMPPDFobject#1#2% resources boxnumber
+ {\immediate\pdfxform resources{#1}#2%
+ \edef\getMPPDFobject{\noexpand\pdfrefxform\the\pdflastxform}}
+
+\fi
+
+\let\getMPPDFobject\relax
+
+\definespecial\doinsertMPfile#1%
+ {\doiffileelse{./#1}{\includeMPasPDF{./#1}}{\message{[MP #1]}}}
+
%D Now we can finish this module.
\stopspecials
diff --git a/tex/context/base/spec-tr.tex b/tex/context/base/spec-tr.tex
index 3a3f51ab9..fcf2d6727 100644
--- a/tex/context/base/spec-tr.tex
+++ b/tex/context/base/spec-tr.tex
@@ -62,6 +62,11 @@
\dodoinsertfile{tr}{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9}%
\egroup}
+%D Some MP stuff:
+
+\definespecial\doinsertMPfile#1%
+ {\doiffileelse{./#1}{\includeMPasEPS{./#1}}{\message{[MP #1]}}}
+
%D \macros
%D {dostartrotation}
%D
diff --git a/tex/context/base/spec-var.tex b/tex/context/base/spec-var.tex
new file mode 100644
index 000000000..390e178c4
--- /dev/null
+++ b/tex/context/base/spec-var.tex
@@ -0,0 +1,70 @@
+%D \module
+%D [ file=spec-var,
+%D version=2003.10.10,
+%D title=\CONTEXT\ Special Macros,
+%D subtitle=Variables,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This module used to be integrated in \type {spec-ini},
+%D but testing optimization is more convenient this way.
+
+\writestatus{loading}{Context Special Macros / Variables}
+
+% new approach, 'global' variables, since we run out of
+% arguments
+
+\unprotect
+
+\ifx\undefined\@@DriverFieldName
+
+ \letempty \@@DriverFieldName
+ \letempty \@@DriverFieldWidth
+ \letempty \@@DriverFieldHeight
+ \letempty \@@DriverFieldDefault
+ \letempty \@@DriverFieldNumber
+ \letempty \@@DriverFieldNumber
+ \letempty \@@DriverFieldStyle
+ \letempty \@@DriverFieldColor
+ \letempty \@@DriverFieldBackgroundColor
+ \letempty \@@DriverFieldFrameColor
+ \letempty \@@DriverFieldLayer
+ \letempty \@@DriverFieldOption
+ \letempty \@@DriverFieldAlign
+ \letempty \@@DriverFieldClickIn
+ \letempty \@@DriverFieldClickOut
+ \letempty \@@DriverFieldRegionIn
+ \letempty \@@DriverFieldRegionOut
+ \letempty \@@DriverFieldAfterKey
+ \letempty \@@DriverFieldFormat
+ \letempty \@@DriverFieldValidate
+ \letempty \@@DriverFieldCalculate
+ \letempty \@@DriverFieldFocusIn
+ \letempty \@@DriverFieldFocusOut
+
+\fi
+
+\ifx\undefined\@@DriverCommentLayer
+
+ \letempty \@@DriverCommentLayer
+
+\fi
+
+\ifx\undefined\@@DriverAttachmentLayer
+
+ \letempty \@@DriverAttachmentLayer
+
+\fi
+
+\ifx\undefined\@@DriverImageBox
+
+ \letempty \@@DriverImageBox
+
+\fi
+
+\protect \endinput \ No newline at end of file
diff --git a/tex/context/base/supp-box.tex b/tex/context/base/supp-box.tex
index 847e76167..1d305dded 100644
--- a/tex/context/base/supp-box.tex
+++ b/tex/context/base/supp-box.tex
@@ -260,7 +260,7 @@
\futurelet\nextph@nt\doph@nt}
\def\makeph@nt#1#2#3%
- {\begingroup
+ {\begingroup % why no \bgroup
\dowithnextbox
{\setbox\scratchbox\null
\ht\scratchbox\ht#1\dp\scratchbox\dp#2\wd\scratchbox\wd#3%
@@ -909,6 +909,8 @@
%D These macros are slow but effective and not that hard to
%D program at all.
+\ifx\scantokens\undefined \let\scantokens\firstofoneargument \fi
+
\def\dohyphenateword#1#2#3%
{\bgroup
\setbox\scratchbox\normalhbox
@@ -917,13 +919,15 @@
\hyphenpenalty \zerocount
\exhyphenpenalty\zerocount
\setbox0\normalvbox
- {\hsize\zeropoint \space
+ {\hsize\zeropoint
+ \hskip\zeropoint % really needed
\ifnum#1=\minusone
\obeyspaces
\obeylines
\def\obeyedspace{\hskip\zeropoint\hbox to \onepoint{}\hskip\zeropoint}%
\let\obeyedline \obeyedspace
- \def\next{#3}\scantokens{\next}%
+ \def\next{#3}\scantokens\expandafter{\next}%
+ % also ok: \scantokens{#3}%
\else
#3%
\fi}%
@@ -1564,6 +1568,7 @@
\newif\ifalignrigidcolumns
\newif\ifstretchrigidcolumns
+\newif\iftightrigidcolumns % if true: just a vbox, no depth/noflines/gridsnap corrrections
%D De eerste switch bepaald het uitlijnen, de tweede rekt de
%D individuele kolommen op naar \type{\vsize}.
@@ -1605,23 +1610,28 @@
\setbox\scratchbox\normalhbox to \savedrigidhsize
{\dorecurse\rigidcolumns
{\setbox\scratchbox\vsplit\rigidcolumnbox to \scratchdimen
- \dp\scratchbox\openstrutdepth
+ \dp\scratchbox\openstrutdepth
\setbox\scratchbox\normalvtop
- \ifalignrigidcolumns to
- \ifstretchrigidcolumns\vsize\else\scratchdimen\fi
- \fi
+ \ifalignrigidcolumns to
+ \ifstretchrigidcolumns\vsize\else\scratchdimen\fi
+ \fi
{\unvbox\scratchbox}%
\wd\scratchbox\hsize
\box\scratchbox
\hfill}%
\hfillneg}%
- \advance\scratchdimen -\openstrutdepth
- \setbox\scratchbox\normalhbox{\raise\scratchdimen\box\scratchbox}%
- \dp\scratchbox\openstrutdepth
- \ht\scratchbox\scratchdimen
+ \iftightrigidcolumns
+ \setbox\scratchbox\normalhbox{\raise\dp\scratchbox\box\scratchbox}%
+ \else
+ \advance\scratchdimen -\openstrutdepth
+ \setbox\scratchbox\normalhbox{\raise\scratchdimen\box\scratchbox}%
+ \dp\scratchbox\openstrutdepth
+ \ht\scratchbox\scratchdimen
+ \fi
\box\scratchbox}%
\fi}
+
%D \macros
%D {startvboxtohbox,stopvboxtohbox,convertvboxtohbox}
%D
@@ -2023,14 +2033,16 @@
%D middle and right. These box types can be used to typeset
%D paragraphs.
-\def\lbox{\lrcbox\raggedleft}
-\def\cbox{\lrcbox\raggedcenter}
-\def\rbox{\lrcbox\raggedright}
+\def\lbox{\makelrcbox\normalvbox\raggedleft}
+\def\cbox{\makelrcbox\normalvbox\raggedcenter}
+\def\rbox{\makelrcbox\normalvbox\raggedright}
+
+\def\ltop{\makelrcbox\normalvtop\raggedleft}
+\def\ctop{\makelrcbox\normalvtop\raggedcenter}
+\def\rtop{\makelrcbox\normalvtop\raggedright}
-\def\lrcbox#1#2#%
- {\normalvbox#2\bgroup
- \let\\=\endgraf
- \forgetall#1\let\next=}
+\def\makelrcbox#1#2#3#%
+ {#1#3\bgroup \forgetall \let\\=\endgraf #2\let\next=}
%D The alternatives \type {\tbox} and \type {\bbox} can be used
%D to properly align boxes, like in:
@@ -2309,6 +2321,29 @@
\def\middlebox#1%
{\normalhbox{\setbox0\placedbox{#1}\boxoffset=-.5\wd0\rightbox{\box0}}}
+
+\def\baselinemiddlebox#1%
+ {\normalhbox
+ {\setbox0\placedbox{#1}%
+ \global\boxhdisplacement-.5\wd0
+ \global\advance\boxhdisplacement-\boxoffset
+ \global\boxvdisplacement-\boxoffset
+ \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}}
+
+\def\baselineleftbox#1%
+ {\normalhbox
+ {\setbox0\placedbox{#1}%
+ \global\boxhdisplacement-\wd0
+ \global\advance\boxhdisplacement-\boxoffset
+ \global\boxvdisplacement-\boxoffset
+ \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}}
+
+\def\baselinerightbox#1%
+ {\normalhbox
+ {\setbox0\placedbox{#1}%
+ \global\boxhdisplacement\boxoffset
+ \global\boxvdisplacement-\boxoffset
+ \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}}
%D \macros
%D {toplinebox}
@@ -2640,9 +2675,10 @@
%D And even rawer:
-\let\naturalhbox \normalhbox
-\let\naturalvbox \normalvbox
-%let\naturalvtop \normalvtop
+\let\naturalhbox \normalhbox
+\let\naturalvbox \normalvbox
+\let\naturalvtop \normalvtop
+\let\naturalvcenter \normalvtop
\beginOMEGA dir
diff --git a/tex/context/base/supp-fil.tex b/tex/context/base/supp-fil.tex
index b5df1e20c..fe96069ae 100644
--- a/tex/context/base/supp-fil.tex
+++ b/tex/context/base/supp-fil.tex
@@ -183,12 +183,14 @@
\catcode`\/=\@@active
\catcode`\:=\@@active
\catcode`\~=\@@active
+\catcode`\_=\@@active
\gdef\sanitizefilename#1\to#2%
{\bgroup
\edef/{\string/}%
\edef:{\string:}%
\edef~{\string~}%
+ \edef_{\string_}%
\expanded{\xdef\noexpand\sanitizedfilename{#1}}%
\egroup
% maybe \convertcommand\sanitizedfilename\to#2%
diff --git a/tex/context/base/supp-mat.tex b/tex/context/base/supp-mat.tex
index 66357407c..682fe59f7 100644
--- a/tex/context/base/supp-mat.tex
+++ b/tex/context/base/supp-mat.tex
@@ -8,11 +8,11 @@
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
-%D For practical reasons, I decided to move some math things to
-%D a support module. There is nothing spectacular here.
+%D For practical reasons, I decided to move some math things to
+%D a support module. There is nothing spectacular here.
\writestatus{loading}{Context Support Macros / Math}
@@ -20,33 +20,32 @@
%D \macros
%D {mathematics, math, nomathematics, startmathmode}
-%D
+%D
%D The \type{$} can be both an begin and end math character.
%D This can lead to confusing and errorprone situations when
-%D macros insert \type{$}. When for instance we have defined:
-%D
+%D macros insert \type{$}. When for instance we have defined:
+%D
%D \starttypen
%D \def\MyPlus{$\,+\,$}
%D \stoptypen
-%D
+%D
%D the sequence \type{$x^2 \MyPlus y^2 = r^2$} will expand to:
-%D
+%D
%D \starttypen
%D $x^2 $\,+\,$ y^2 = r^2$
%D \stoptypen
-%D
+%D
%D Here the \type{\,} are given outside math mode and \TEX\ will
-%D definitely complain about this. A more save definition would
-%D have been:
-%D
+%D definitely complain about this. A more save definition would
+%D have been:
+%D
%D \starttypen
%D \def\MyPlus{\mathematics{\,+\,}}
%D \stoptypen
-%D
+%D
%D Which is implemented as:
-\def\mathematics#1%
- {\ifmmode#1\else$#1$\fi}
+\def\mathematics#1{\relax\ifmmode#1\else$#1$\fi} % lookahead bug reported by brooks
\def\startmathmode
{\ifmmode
@@ -64,11 +63,11 @@
%D {dimension, nodimension}
%D
%D The next few macros are used for typesetting dimensions in
-%D such a way that spacing is acceptable. I won't spend much
-%D words on these macros, because they will be overloaded in
+%D such a way that spacing is acceptable. I won't spend much
+%D words on these macros, because they will be overloaded in
%D the units module.
-\newsignal\dimensionsignal
+\newsignal\dimensionsignal
\def\dimensiontypeface {\tf}
\def\dimensionhalfspace {\,}
@@ -98,13 +97,13 @@
%D \macros
%D {super, suber}
%D
-%D \TEX\ uses \type{^} and \type{_} for entering super- and
-%D subscript mode. We want however a bit more control than
-%D normally provided, and therefore provide \type {\super}
-%D and \type{\suber} (\type {\sub} is already taken).
+%D \TEX\ uses \type{^} and \type{_} for entering super- and
+%D subscript mode. We want however a bit more control than
+%D normally provided, and therefore provide \type {\super}
+%D and \type{\suber} (\type {\sub} is already taken).
-\global\let\normalsuper=^
-\global\let\normalsuber=_
+\global\let\normalsuper=^
+\global\let\normalsuber=_
\newcount\supersubmode
@@ -114,10 +113,10 @@
% \def\dodosuper#1{\normalsuper{\the\everysupersub#1}}
% \def\dodosuber#1{\normalsuber{\the\everysupersub#1}}
-%
+%
% \def\dosuper{\ifx\next\bgroup\expandafter\dodosuper\else\normalsuper\fi}
% \def\dosuber{\ifx\next\bgroup\expandafter\dodosuber\else\normalsuber\fi}
-%
+%
% \def\super{\futurelet\next\dosuper}
% \def\suber{\futurelet\next\dosuber}
@@ -126,9 +125,9 @@
%D \macros
%D {enablesupsub}
-%D
-%D We can let \type {^} and \type {_} act like \type {\super}
-%D and \type {\suber} by saying \type {\enablesupsub}.
+%D
+%D We can let \type {^} and \type {_} act like \type {\super}
+%D and \type {\suber} by saying \type {\enablesupsub}.
\bgroup
\catcode`\^=\@@active
@@ -143,7 +142,7 @@
%D \macro
%D {restoremathstyle}
%D
-%D We can pick up the current math style by calling \type
+%D We can pick up the current math style by calling \type
%D {\restoremathstyle}.
\def\restoremathstyle
diff --git a/tex/context/base/supp-mpe.tex b/tex/context/base/supp-mpe.tex
index d2c8e5b6b..497f077e6 100644
--- a/tex/context/base/supp-mpe.tex
+++ b/tex/context/base/supp-mpe.tex
@@ -216,8 +216,11 @@
\def\normalhandleMPgraycolor
{{\checkPDFMPstrokecolor\execcolorS\gMPa1:0:0\od}}
- \def\normalhandleMPspotcolor
- {{\checkPDFMPstrokecolor\execcolorP\gMPa1:\gMPa2:0:0\od}}
+% \def\normalhandleMPspotcolor
+% {{\checkPDFMPstrokecolor\execcolorP\gMPa1:\gMPa2:0:0\od}}
+
+ \def\normalhandleMPspotcolor % ???
+ {{\checkPDFMPstrokecolor\execcolorP\gMPa1:\gMPa2:\gMPa3:\gMPa4:0:0\od}}
\fi
@@ -597,17 +600,17 @@
\fi
\or
% 3 = rgb transparency
- % to do
+ % to do
\or
% 4 == cmyk transparency
- % \ifMPcmykcolors
- % to do
- % \fi
+ % \ifMPcmykcolors
+ % to do
+ % \fi
\or
% 5 == spot transparency
- % \ifMPspotcolors
- % to do
- % \fi
+ % \ifMPspotcolors
+ % to do
+ % \fi
\fi
\else
\ifx\tempMPrvalue\tempMPgvalue
@@ -738,9 +741,9 @@
{\immediate\pdfximage\!!width\onebasepoint\!!height\onebasepoint{#7}%
\setxvalue{mps:x:#7}{\pdfrefximage\the\pdflastximage}}%
{\message{[reusing figure #7]}}%
- \pdfliteral{q #1 #2 #3 #4 #5 #6 cm}%
+ \PDFcode{q #1 #2 #3 #4 #5 #6 cm}%
\rlap{\getvalue{mps:x:#7}}%
- \pdfliteral{Q}}
+ \PDFcode{Q}}
{\message{[unknown figure #7]}}%
\fi
\hss}}}
@@ -846,19 +849,38 @@
% \setxvalue{\@@MPSP\gMPs1}{\gMPs2 \gMPs3 }%
% \fi}
+% \defineMPspecial{2}
+% {\ifMPspotcolors
+% \setxvalue{\@@MPSP\gMPs1}{\gMPs2 \gMPs3 }%
+% \checkMPspot{\gMPs2}{\gMPs3}%
+% \fi}
+%
+% \def\setMPspot#1 #2 %
+% {\setvalue{\@@MP01}{#1}%
+% \setvalue{\@@MP02}{#2}}
+%
+% \def\checkMPspot#1#2%
+% {\expanded{\resolveMPspotcolor#1 #2}\end
+% \ifx\MPspotspace\MPresolvedspace
+% \edef\MPspotspacespec{/\MPspotspace\space}%
+% \doifinstringelse\MPspotspacespec\currentMPcolorspaces
+% \donothing\registerMPcolorspace
+% \fi}
\defineMPspecial{2}
{\ifMPspotcolors
- \setxvalue{\@@MPSP\gMPs1}{\gMPs2 \gMPs3 }%
- \checkMPspot{\gMPs2}{\gMPs3}%
+ \setxvalue{\@@MPSP\gMPs1}{\gMPs2 \gMPs3 \gMPs4 \gMPs5 }% space is essential
+ \checkMPspot{\gMPs2}{\gMPs3}{\gMPs4}{\gMPs5}%
\fi}
-\def\setMPspot#1 #2 %
+\def\setMPspot#1 #2 #3 #4 %
{\setvalue{\@@MP01}{#1}%
- \setvalue{\@@MP02}{#2}}
+ \setvalue{\@@MP02}{#2}%
+ \setvalue{\@@MP03}{#3}%
+ \setvalue{\@@MP04}{#4}}
-\def\checkMPspot#1#2%
- {\expanded{\resolveMPspotcolor#1 #2}\end
+\def\checkMPspot#1#2#3#4%
+ {\expanded{\resolveMPspotcolor#1 #2 #3 #4}\end
\ifx\MPspotspace\MPresolvedspace
\edef\MPspotspacespec{/\MPspotspace\space}%
\doifinstringelse\MPspotspacespec\currentMPcolorspaces
@@ -976,16 +998,32 @@
\edef\PDFtransparencyreference {#2}%
\edef\PDFtransparencycolorspecs{#3}}
-\def\PDFtransparencyspec
+% \def\PDFtransparencyspec
+% {\ifx\MPresolvedspace\MPgrayspace
+% \MPresolvedcolor\space g \MPresolvedcolor\space G%
+% \else\ifx\MPresolvedspace\MPrgbspace
+% \MPresolvedcolor\space rg \MPresolvedcolor\space RG%
+% \else\ifx\MPresolvedspace\MPcmykspace
+% \MPresolvedcolor\space k \MPresolvedcolor\space K%
+% \else\ifx\MPresolvedspace\empty\else
+% /\MPresolvedspace\space cs \MPresolvedcolor\space sc
+% /\MPresolvedspace\space CS \MPresolvedcolor\space SC%
+% \fi\fi\fi\fi}
+
+\def\PDFtransparencyspec % todo
{\ifx\MPresolvedspace\MPgrayspace
- \MPresolvedcolor\space g \MPresolvedcolor\space G%
+ \MPresolvedcolor\space g
+ \MPresolvedcolor\space G%
\else\ifx\MPresolvedspace\MPrgbspace
- \MPresolvedcolor\space rg \MPresolvedcolor\space RG%
+ \MPresolvedcolor\space rg
+ \MPresolvedcolor\space RG%
\else\ifx\MPresolvedspace\MPcmykspace
- \MPresolvedcolor\space k \MPresolvedcolor\space K%
+ \MPresolvedcolor\space k
+ \MPresolvedcolor\space K%
\else\ifx\MPresolvedspace\empty\else
- /\MPresolvedspace\space cs \MPresolvedcolor\space sc
- /\MPresolvedspace\space CS \MPresolvedcolor\space SC%
+ /\MPresolvedspace\space cs
+ /\MPresolvedspace\space CS
+ \PDFgetspotcolorspec\MPresolvedcolor
\fi\fi\fi\fi}
\defineMPspecial{3} % rgb
@@ -1008,25 +1046,20 @@
{\PDFtransparencyreference}%
{\PDFtransparencyspec}}}
-%\defineMPspecial{5} % spot
-% {\edef\currentMPspecial{\gMPs5}%
-% \presetPDFtransparency{\gMPs1}{\gMPs2}%
-% \expanded{\resolveMPspotcolor\gMPs3 \gMPs4}\end
-% \ifx\MPspotspace\MPresolvedspace
-% \edef\MPspotspacespec{/\MPspotspace\space}%
-% \doifinstringelse\MPspotspacespec\currentMPcolorspaces
-% \donothing\registerMPcolorspace
-% \fi
-% \setevalue{\@@MPST\currentMPspecial}% was \setxvalue, bug !
-% {\noexpand\assignMPStransparency
-% {\PDFtransparencyidentifier}%
-% {\PDFtransparencyreference}%
-% {\PDFtransparencyspec}}}
+% \defineMPspecial{5} % spot
+% {\edef\currentMPspecial{\gMPs5}%
+% \presetPDFtransparency{\gMPs1}{\gMPs2}%
+% \checkMPspot{\gMPs3}{\gMPs4}%
+% \setevalue{\@@MPST\currentMPspecial}% was \setxvalue, bug !
+% {\noexpand\assignMPStransparency
+% {\PDFtransparencyidentifier}%
+% {\PDFtransparencyreference}%
+% {\PDFtransparencyspec}}}
\defineMPspecial{5} % spot
- {\edef\currentMPspecial{\gMPs5}%
+ {\edef\currentMPspecial{\gMPs7}%
\presetPDFtransparency{\gMPs1}{\gMPs2}%
- \checkMPspot{\gMPs3}{\gMPs4}%
+ \checkMPspot{\gMPs3}{\gMPs4}{\gMPs5}{\gMPs6}%
\setevalue{\@@MPST\currentMPspecial}% was \setxvalue, bug !
{\noexpand\assignMPStransparency
{\PDFtransparencyidentifier}%
@@ -1247,9 +1280,17 @@
\execcolorS#1:0:0\od
\stopMPcolorresolve}
- \def\resolveMPspotcolor#1 #2\end
+% \def\resolveMPspotcolor#1 #2\end
+% {\startMPcolorresolve
+% \execcolorP#1:#2:0:0\od
+% \stopMPcolorresolve}
+
+ \def\resolveMPspotcolor#1 #2 #3 #4\end
{\startMPcolorresolve
- \execcolorP#1:#2:0:0\od
+ \ifnum#2>\plusone
+ \checkmultitonecolor{#1}%
+ \fi
+ \execcolorP#1:#2:#3:#4:0:0\od
\stopMPcolorresolve}
\else
diff --git a/tex/context/base/supp-mps.tex b/tex/context/base/supp-mps.tex
index cd795eca2..26c9d37fe 100644
--- a/tex/context/base/supp-mps.tex
+++ b/tex/context/base/supp-mps.tex
@@ -791,8 +791,7 @@
\fi
\def\loadMPgraphic#1#2%
- {\setbox\MPgraphicbox=\hbox
- {\ifinsertMPgraphics\insertMPfile{#1}{#2}\fi}}
+ {\setbox\MPgraphicbox\hbox{\ifinsertMPgraphics\insertMPfile{#1}{#2}\fi}}
\def\MPllx{0}
\def\MPlly{0}
@@ -1151,7 +1150,7 @@
\endlinechar=-1
\setMPspecials
\obeyMPspecials
- \setbox\scratchbox=\hbox
+ \setbox\scratchbox\hbox
{\hskip-\maxdimen
\doprocessfile\scratchread{#1}\handleMPfont}%
\smashbox\scratchbox
@@ -1614,12 +1613,14 @@
{\globallet\MPdrawingdata\empty
\global\MPdrawingdonefalse}
+% why global push/pop here?
+
\def\pushMPdrawing
- {\pushmacro\MPdrawingdata
+ {\globalpushmacro\MPdrawingdata
\globallet\MPdrawingdata\empty}
\def\popMPdrawing
- {\popmacro\MPdrawingdata}
+ {\globalpopmacro\MPdrawingdata}
\def\getMPdrawing
{\ifMPdrawingdone
diff --git a/tex/context/base/supp-pdf.tex b/tex/context/base/supp-pdf.tex
index e5a9dc371..718963cd2 100644
--- a/tex/context/base/supp-pdf.tex
+++ b/tex/context/base/supp-pdf.tex
@@ -223,24 +223,24 @@
% \newif\ifPDFmediaboxprefered
-% \def\setPDFboundingbox#1#2#3#4#5#6%
-% {\dimen0=#1\dimen0=#5\dimen0
-% \ScaledPointsToBigPoints{\number\dimen0}\PDFxoffset
-% \dimen0=#3\dimen0=#5\dimen0
-% \xdef\PDFwidth{\the\dimen0}%
-% \dimen0=#2\dimen0=#6\dimen0
-% \ScaledPointsToBigPoints{\number\dimen0}\PDFyoffset
-% \dimen0=#4\dimen0=#6\dimen0
-% \xdef\PDFheight{\the\dimen0}%
-% \global\let\PDFxoffset\PDFxoffset
-% \global\let\PDFyoffset\PDFyoffset}
-
-% \def\setPDFmediabox#1[#2 #3 #4 #5]#6\done
-% {\dimen2=#2bp\dimen2=-\dimen2 % \dimen2=-#2bp also works since tex handles --
-% \dimen4=#3bp\dimen4=-\dimen4 % \dimen4=-#3bp also works since tex handles --
-% \dimen6=#4bp\advance\dimen6 \dimen2
-% \dimen8=#5bp\advance\dimen8 \dimen4
-% \setPDFboundingbox{\dimen2}{\dimen4}{\dimen6}{\dimen8}\PDFxscale\PDFyscale}
+\def\setPDFboundingbox#1#2#3#4#5#6%
+ {\dimen0=#1\dimen0=#5\dimen0
+ \ScaledPointsToBigPoints{\number\dimen0}\PDFxoffset
+ \dimen0=#3\dimen0=#5\dimen0
+ \xdef\PDFwidth{\the\dimen0}%
+ \dimen0=#2\dimen0=#6\dimen0
+ \ScaledPointsToBigPoints{\number\dimen0}\PDFyoffset
+ \dimen0=#4\dimen0=#6\dimen0
+ \xdef\PDFheight{\the\dimen0}%
+ \global\let\PDFxoffset\PDFxoffset
+ \global\let\PDFyoffset\PDFyoffset}
+
+\def\setPDFmediabox#1[#2 #3 #4 #5]#6\done
+ {\dimen2=#2bp\dimen2=-\dimen2 % \dimen2=-#2bp also works since tex handles --
+ \dimen4=#3bp\dimen4=-\dimen4 % \dimen4=-#3bp also works since tex handles --
+ \dimen6=#4bp\advance\dimen6 \dimen2
+ \dimen8=#5bp\advance\dimen8 \dimen4
+ \setPDFboundingbox{\dimen2}{\dimen4}{\dimen6}{\dimen8}\PDFxscale\PDFyscale}
% \def\checkPDFmediabox#1/MediaBox#2#3\done
% {\ifx#2\relax \else
@@ -891,7 +891,7 @@
\let\MPfshowcommand\empty
-\def\handleMPfshow
+\def\dohandleMPfshow
{\bgroup
\setbox\scratchbox\hbox
{\obeyMPspecials
@@ -938,7 +938,7 @@
\fi
\unskip}}%
%
- % this fails in latest pdftex's
+ % this fails in some versions of pdftex
%
% \dimen0=\lastMPmoveY bp
% \advance\dimen0 by \ht0
@@ -959,6 +959,8 @@
\box\scratchbox
\egroup}
+\let\handleMPfshow\dohandleMPfshow % so we can overload this one later
+
%D You could consider the following definition to be the most
%D natural one.
@@ -1834,7 +1836,9 @@
%D The last object number used is avaliable in the macro
%D \type {\lastPDFMPobject}.
-\chardef\makeMPintoPDFobject=0 \def\lastPDFMPobject{0}
+\ifx\makeMPintoPDFobject\undefined \chardef\makeMPintoPDFobject=0 \fi
+
+\def\lastPDFMPobject{0}
%D The additional code needed can be made available in the
%D (global) macro \type {\currentPDFresources}.
@@ -1936,18 +1940,6 @@
\def\finishMPgraphic
{\stopMPresources
\egroup
- % we go simple when in doubt, this macro will get a proper
- % context counterpart so that we can also cover dvipdfmx
- \ifx\pdfxform\undefined
- \chardef\makeMPintoPDFobject\zerocount % no pdftex at all
- \else\ifx\pdftexversion\undefined
- \chardef\makeMPintoPDFobject\zerocount % no pdftex at all
- \else\ifnum\pdftexversion<14
- \chardef\makeMPintoPDFobject\zerocount % no resource support
- \fi\fi\fi
- \ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else
- \chardef\makeMPintoPDFobject\plusone
- \fi\fi
\setbox\scratchbox\vbox
{\forgetall
\hbox
@@ -1957,35 +1949,60 @@
\ht\scratchbox\MPheight
\wd\scratchbox\MPwidth
\dp\scratchbox\zeropoint\relax
+ \dopackageMPgraphic\scratchbox
+ \egroup
+ \endinput}
+
+%D Alternative for \PDFTEX. We cannot come up with something more contexy
+%D because this module is also used in \LATEX.
+
+\def\dopackageMPgraphic#1% #1 = boxregister
+ {%\ifx\pdfxform\undefined
+ % \chardef\makeMPintoPDFobject\zerocount % no pdftex at all
+ %\else\ifx\pdftexversion\undefined
+ % \chardef\makeMPintoPDFobject\zerocount % no pdftex at all
+ %\else\ifnum\pdftexversion<14
+ % \chardef\makeMPintoPDFobject\zerocount % no resource support
+ %\else
+ % % keep the default value
+ %\fi\fi\fi
+ \ifcase\makeMPintoPDFobject\or\or\ifx\currentPDFresources\empty\else
+ % an existing value of 2 signals object support (set elsewhere)
+ \chardef\makeMPintoPDFobject\plusone
+ \fi\fi
\ifcase\makeMPintoPDFobject
- \box\scratchbox
+ \box#1%
\or
\scratchdimen\PDFMPformoffset\relax
\ifdim\scratchdimen>\zeropoint % compensate for error
- \setbox\scratchbox\vbox spread 2\scratchdimen
- {\forgetall
- \vss
- \hbox spread 2\scratchdimen
- {\hss
- \box\scratchbox
- \hss}%
- \vss}%
+ \setbox#1\vbox spread 2\scratchdimen
+ {\forgetall\vss\hbox spread 2\scratchdimen{\hss\box#1\hss}\vss}%
\fi
- \immediate\pdfxform resources{\currentPDFresources}\scratchbox
- \xdef\lastPDFMPobject{\the\pdflastxform}%
+ \setMPPDFobject{\currentPDFresources}{#1}%
\ifdim\scratchdimen>\zeropoint % compensate for error
\vbox to \MPheight
- {\forgetall
- \vss\hbox to \MPwidth{\hss\pdfrefxform\lastPDFMPobject\hss}\vss}%
+ {\forgetall\vss\hbox to \MPwidth{\hss\getMPPDFobject\hss}\vss}%
\else
- \pdfrefxform\lastPDFMPobject
+ \getMPPDFobject
\fi
\global\let\currentPDFresources\empty
\else
- \box\scratchbox
- \fi
- \egroup
- \endinput}
+ \box#1%
+ \fi}
+
+\def\setMPPDFobject#1#2% resources boxnumber
+ {\ifx\pdfxform\undefined
+ \def\getMPPDFobject{\box#2}%
+ \else\ifx\pdftexversion\undefined
+ \def\getMPPDFobject{\box#2}%
+ \else\ifnum\pdftexversion<14
+ \def\getMPPDFobject{\box#2}%
+ \else
+ \immediate\pdfxform resources{#1}#2%
+ \edef\getMPPDFobject{\noexpand\pdfrefxform\the\pdflastxform}%
+ \fi\fi\fi}
+
+\let\getMPPDFobject\relax
%D \macros
%D {deleteMPgraphic,
diff --git a/tex/context/base/supp-vis.tex b/tex/context/base/supp-vis.tex
index 93bb5126e..a3545bfc5 100644
--- a/tex/context/base/supp-vis.tex
+++ b/tex/context/base/supp-vis.tex
@@ -736,9 +736,9 @@
\def\setvisiblehfilbox#1\to#2#3#4%
{\setbox#1\normalhbox
{\visualvrule
- \!!width#2\testrulewidth
+ \!!width #2\testrulewidth
\!!height#3\testrulewidth
- \!!depth#4\testrulewidth}%
+ \!!depth #4\testrulewidth}%
\smashbox#1}
\def\doruledhfiller#1#2#3#4%
@@ -846,9 +846,9 @@
\def\setvisiblevfilbox#1\to#2#3#4%
{\setbox#1\normalhbox
{\visualvrule
- \!!width#2\testrulewidth
+ \!!width #2\testrulewidth
\!!height#3\testrulewidth
- \!!depth#4\testrulewidth}%
+ \!!depth #4\testrulewidth}%
\smashbox#1}%
\def\doruledvfiller#1#2#3%
@@ -907,20 +907,11 @@
%D Keep in mind that \type{\vfillneg} is not part of \PLAIN\
%D \TEX, but are mimmicked by a macro.
-\unexpanded\def\ruledvss
- {\doruledvfiller\normalvss\normalvfilneg{2}}
-
-\unexpanded\def\ruledvfil
- {\doruledvfiller\normalvfil\normalvfilneg{-4}}
-
-\unexpanded\def\ruledvfill
- {\doruledvfiller\normalvfill\normalvfillneg{-12}}
-
-\unexpanded\def\ruledvfilneg
- {\doruledvfiller\normalvfilneg\normalvfil{8}}
-
-\unexpanded\def\ruledvfillneg
- {\doruledvfiller\normalvfillneg\normalvfill{16}}
+\unexpanded\def\ruledvss {\doruledvfiller\normalvss \normalvfilneg {2}}
+\unexpanded\def\ruledvfil {\doruledvfiller\normalvfil \normalvfilneg {-4}}
+\unexpanded\def\ruledvfill {\doruledvfiller\normalvfill \normalvfillneg{-12}}
+\unexpanded\def\ruledvfilneg {\doruledvfiller\normalvfilneg \normalvfil {8}}
+\unexpanded\def\ruledvfillneg{\doruledvfiller\normalvfillneg\normalvfill {16}}
%D \macros
%D {ruledhskip}
@@ -1584,11 +1575,8 @@
\def\setruledpenaltybox#1#2#3#4#5#6%
{\setbox#1\normalhbox
{\ifnum#2=0 \else
- \ifnum#2>0
- \def\sign{+}%
- \else
- \def\sign{-}%
- \fi
+ \edef\sign
+ {\ifnum#2>0 +\else-\fi}%
\dimen0=\ifnum\sign#2>9999
28\else
\ifnum\sign#2>999
@@ -1916,4 +1904,4 @@
%D lines in this two column index don't allign, then this is
%D due to some still unknown interference.
-\endinput
+\endinput \ No newline at end of file
diff --git a/tex/context/base/syst-con.tex b/tex/context/base/syst-con.tex
index a2f2a949e..0db485c7a 100644
--- a/tex/context/base/syst-con.tex
+++ b/tex/context/base/syst-con.tex
@@ -152,6 +152,28 @@
370\or 371\or 372\or 373\or 374\or 375\or 376\or 377\fi}
%D \macros
+%D {hexstringtonumber}
+%D
+%D This macro converts a two character hexadecimal number into
+%D a decimal number, thereby taking care of lowercase characters
+%D as well.
+
+\dostepwiserecurse{0}{9}{1}{\setevalue{@@uc@@\recurselevel}{\recurselevel}}
+
+\setvalue{@@uc@@a}{A} \setvalue{@@uc@@A}{A}
+\setvalue{@@uc@@b}{B} \setvalue{@@uc@@B}{B}
+\setvalue{@@uc@@c}{C} \setvalue{@@uc@@C}{C}
+\setvalue{@@uc@@d}{D} \setvalue{@@uc@@D}{D}
+\setvalue{@@uc@@e}{E} \setvalue{@@uc@@E}{E}
+\setvalue{@@uc@@f}{F} \setvalue{@@uc@@F}{F}
+
+\def\hexstringtonumber#1% {FF}
+ {\dohexstringtonumber#1}
+
+\def\dohexstringtonumber#1#2% FF
+ {"\csname @@uc@@#1\endcsname\csname @@uc@@#2\endcsname}
+
+%D \macros
%D {rawcharacter}
%D
%D This conversion macro produces raw characters. We have to
diff --git a/tex/context/base/syst-etx.tex b/tex/context/base/syst-etx.tex
index d2821de7e..ba5fc0f3f 100644
--- a/tex/context/base/syst-etx.tex
+++ b/tex/context/base/syst-etx.tex
@@ -200,7 +200,9 @@
%D But, for critical editions, we may need many more, so
%D here we go again:
-\chardef\@@insallocation=16 % 24
+\chardef\@@insallocation=24
+\chardef\@@insallocation=16
+\chardef\@@insallocation=8
%D My low level allocation macro now comes down to:
diff --git a/tex/context/base/syst-ext.tex b/tex/context/base/syst-ext.tex
index a613847f5..5cfe86d83 100644
--- a/tex/context/base/syst-ext.tex
+++ b/tex/context/base/syst-ext.tex
@@ -24,9 +24,9 @@
%D A raw and dirty alternative for \type {\getparameters}; no
%D checking is done!
-\def\rawgetparameters[#1][#2]% scheelt 5\%
- {\def\rawparameterprefix{#1}%
- \expandafter\rawsetparameter#2,]=,}
+% \def\rawgetparameters[#1][#2]% scheelt 5\%
+% {\def\rawparameterprefix{#1}%
+% \expandafter\rawsetparameter#2,]=,}
\def\rawsetparameter#1=#2,%
{\if]#1\else
@@ -34,6 +34,19 @@
\expandafter\rawsetparameter
\fi}
+% the next one handles empty #1 okay:
+
+\def\rawgetparameters[#1][#2% some 5-10% faster
+ {\ifx#2]% test is needed, else bomb on [#1][]
+ \expandafter\gobbleoneargument
+ \else
+ \def\rawparameterprefix{#1}%
+ \expandafter\dorawgetparameters
+ \fi#2}
+
+\def\dorawgetparameters#1]%
+ {\expandafter\rawsetparameter#1,]=,}
+
%D \macros
%D {doglobal,
%D redoglobal,dodoglobal,resetglobal}
@@ -1981,21 +1994,19 @@
%D a row. In both commands, the \type{n*} is optional. When this
%D specification is missing, the command executes once.
-% ! ! ! obsolete ! ! !
+% this one is obsolete:
\def\dorepeat[#1]%
{\dodorepeat#1*\empty*\relax}
\long\def\dodorepeat#1*#2#3*#4\relax
- {\ifx#2\empty
- #1%
- \else
- \dorecurse{#1}{#2#3}%
- \fi}
+ {\ifx#2\empty#1\else\dorecurse{#1}{#2#3}\fi}
\def\repeater
{\recurselevel}
+% this one will be kept
+
\def\dorepeatwithcommand[#1]%
{\dodorepeatwithcommand#1*\empty*\relax}
@@ -2008,24 +2019,63 @@
%
% 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}
+
+\def\dorepeatwithcommand[#1]%
+ {\dodorepeatwithcommand#1*\empty*\relax}
+
\long\def\dodorepeatwithcommand#1*#2#3*#4\relax#5%
- {\ifx#2\empty
- #5{#1}%
+ {\ifx#2\empty\redorepeatwithcommand[#1]#5\else\dododorepeatwithcommand{#1}{#2}{#3}#5\fi}
+
+\long\def\dododorepeatwithcommand#1#2#3#4%
+ {\ifx#2\empty % redundant but gives cleaner extensions
+ #4{#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}}%
+ \expanded{\egroup\noexpand\dorecurse{\number-\scratchcounter}}{#4{-#2#3}}%
\else\ifx#2+%
- \dorecurse{#1}{#5{#3}}%
+ \dorecurse{#1}{#4{#3}}%
\else
- \dorecurse{#1}{#5{#2#3}}%
+ \dorecurse{#1}{#4{#2#3}}%
\fi\fi\fi}
+\def\redorepeatwithcommand[#1]#2%
+ {#2{#1}}
+
+%D The extension hook permits something like:
+%D
+%D \starttyping
+%D \bgroup
+%D
+%D \catcode`\*=\@@superscript
+%D
+%D \gdef\redorepeatwithcommand[#1]%
+%D {\redodorepeatwithcommand#1*\empty*\relax}
+%D
+%D \long\gdef\redodorepeatwithcommand#1*#2#3*#4\relax#5%
+%D {\dododorepeatwithcommand{#1}{#2}{#3}#5}
+%D
+%D \egroup
+%D \stoptyping
+%D
+%D although one may wonder if changing the catcode of \type {*} is wise.
+
%D \macros
%D {normalbgroup,normalgroup}
%D
@@ -3747,6 +3797,10 @@
{\mathsurround\zeropoint\everymath\emptytoks$ $}%
\fi \fi}
+%D And now your version of \TEX\ may provide:
+
+\ifx\quitvmode\undefined \else \let\dontleavehmode\quitvmode \fi
+
%D \macros
%D {uppercasestring,lowercasestring}
%D
diff --git a/tex/context/base/syst-gen.tex b/tex/context/base/syst-gen.tex
index d732463c5..5fd300d94 100644
--- a/tex/context/base/syst-gen.tex
+++ b/tex/context/base/syst-gen.tex
@@ -3935,7 +3935,7 @@
%D core modules.
\def\definestartstopcommand#1#2#3#4% can be done with \expanded ot better, toks
- {\def\!stringa{#3}% % but let's keep this unuded one crappy
+ {\def\!stringa{#3}% % but let's keep this unused one crappy
\def\!stringb{\e!start#2}%
\def\!stringc{#4}%
\def\!stringd{\e!stop#2}%
diff --git a/tex/context/base/syst-omg.tex b/tex/context/base/syst-omg.tex
index e01bdf371..3e5b4a536 100644
--- a/tex/context/base/syst-omg.tex
+++ b/tex/context/base/syst-omg.tex
@@ -74,7 +74,7 @@
\mathchardef\@@medallocation = 256
\mathchardef\@@maxallocation = 32767
-\chardef\@@insallocation=8
+\chardef\@@insallocation=24
\def\myalloc@#1#2#3#4#5%
{\global\advance\count1#1by\@ne
diff --git a/tex/context/base/verb-ini.tex b/tex/context/base/verb-ini.tex
index 770144263..ce859bee9 100644
--- a/tex/context/base/verb-ini.tex
+++ b/tex/context/base/verb-ini.tex
@@ -1318,6 +1318,12 @@
\newif\ifnaturaltextext
+% \starttyping
+% test /naturaltextext\hpos{word}{test}/relax test
+% \stoptyping
+%
+% \MPxy{word}
+
\beginETEX \scantokens
%\def\naturaltextext#1#2\relax
@@ -1328,6 +1334,17 @@
\prettynaturalfont{\restorecatcodes\scantokens{\ignorespaces#1}}%
\egroup}
+% new, test first
+%
+% \def\naturaltextext#1\relax
+% {\bgroup
+% \prettynaturalfont
+% \def\ascii{#1}%
+% \setnormalcatcodes
+% \restorecatcodes
+% \scantokens\expandafter{\ascii}\ifhmode\unskip\fi
+% \egroup}
+
\endETEX
\beginTEX
diff --git a/tex/context/base/x-res-01.tex b/tex/context/base/x-res-01.tex
index 9b724411f..d28baecf4 100644
--- a/tex/context/base/x-res-01.tex
+++ b/tex/context/base/x-res-01.tex
@@ -91,7 +91,7 @@
background=color,
backgroundcolor=gray,
foregroundcolor=darkred,
- align=normal,
+ align={lohi,middle}, % normal,
frame=off]
{\bf \XMLflush{rl:dummy}}
\stopbuffer
@@ -145,14 +145,14 @@
% Ulgy:
-\startnotmode[previewpage-letter,previewpage-S6]
- \enablemode[previewpage-A4]
-\stopnotmode
-
\startmode[letter] % downward compatible
\enablemode[previewpage-letter]
\stopmode
+\startnotmode[previewpage-letter,previewpage-S6]
+ \enablemode[previewpage-A4]
+\stopnotmode
+
%startbuffer[paper]
\startsetups[paper]
\startmode[previewpage-A4]
diff --git a/tex/context/base/xtag-ext.tex b/tex/context/base/xtag-ext.tex
index a700fcfae..7d50d6156 100644
--- a/tex/context/base/xtag-ext.tex
+++ b/tex/context/base/xtag-ext.tex
@@ -147,8 +147,8 @@
% \defineXMLdirective [flowchart] [shapes] \setupFLOWshapes % [#2=#3]
% \defineXMLdirective [flowchart] [lines] \setupFLOWlines % [#2=#3]
-\defineXMLprocessor [context-begin-group] {\begingroup\gobbleoneargument}
-\defineXMLprocessor [context-end-group] {\endgroup \gobbleoneargument}
+\defineXMLprocessor [context-begin-group] {\bgroup\gobbleoneargument}
+\defineXMLprocessor [context-end-group] {\egroup\gobbleoneargument}
% \def\XMLnspart#1:#2\empty{#1} % call ...:\empty\empty
% \def\XMLidpart#1:#2#3\empty{\ifx#2\empty#1\else\XMLidpart#2#3\empty\empty\fi}
@@ -207,6 +207,12 @@
\@EA\secondoftwoarguments
\fi}
+\def\doifXMLtextelse#1% new
+ {\doiftextelse{\simplifyXMLelements#1}}
+
+\def\doifXMLtext#1#2% new
+ {\doiftextelse{\simplifyXMLelements#1}{#2}\donothing}
+
\gdef\convertXMLelement#1\to#2%
{\ifcsname\@@XMLsave:#1\endcsname
\@EA\convertcommand\csname\@@XMLsave:#1\endcsname\to#2%
diff --git a/tex/context/base/xtag-ini.tex b/tex/context/base/xtag-ini.tex
index ff475e162..2968c572d 100644
--- a/tex/context/base/xtag-ini.tex
+++ b/tex/context/base/xtag-ini.tex
@@ -179,6 +179,7 @@
\edef\@@XMLdepth {\@@XML dep} % used to track nesting
\edef\@@XMLdopth {\@@XML dop} % used to track nesting
\edef\@@XMLsave {\@@XML sav} % namespace for saved elements
+\edef\@@XMLglobal {\@@XML glb} % global assignment
\iffalse % slightly faster
@@ -199,6 +200,7 @@
\edef\@@XMLdepth {\@@XML n} % used to track nesting
\edef\@@XMLdopth {\@@XML o} % used to track nesting
\edef\@@XMLsave {\@@XML p} % namespace for saved elements
+\edef\@@XMLglobal {\@@XML x} % global assignment
\fi
@@ -847,10 +849,13 @@
\def\beginXMLelement
{\global\advance\XMLdepth\plusone
- \global\@EA\let\csname\@@XMLdepth:\the\XMLdepth\endcsname\currentXMLelement}
+ \global\@EA\let\csname\@@XMLdepth:\the\XMLdepth\endcsname\currentXMLelement
+ }%\writestatus{XML TRACE}{[begin] [\the\XMLdepth] [\XMLself]}}
\def\endXMLelement
- {\global\advance\XMLdepth\minusone}
+ {%\writestatus{XML TRACE}{[end] [\the\XMLdepth] [\XMLself]}%
+ \global\@EA\let\csname\@@XMLdepth:\the\XMLdepth\endcsname\undefined
+ \global\advance\XMLdepth\minusone}
% 0 = nothing
% 1 = unknown
@@ -865,16 +870,16 @@
\ifcase\XMLancestormode\or\s!unknown\or\currentXMLelement\fi
\fi}
-\def\XMLparent
- {\XMLancestor\plusone}
-
\def\XMLpureancestor#1%
{\ifnum\numexpr(\XMLdepth-#1)>0
\csname\@@XMLdepth:\the\numexpr(\XMLdepth-#1)\endcsname
\fi}
-\def\XMLpureparent
- {\XMLpureancestor\plusone}
+\def\XMLparent{\XMLancestor\plusone}
+\def\XMLself {\XMLancestor\zerocount}
+
+\def\XMLpureparent{\XMLpureancestor\plusone}
+\def\XMLpureself {\XMLpureancestor\zerocount}
% \def\XMLpureancestor#1%
% {\csname
@@ -888,6 +893,87 @@
\def\XMLpureparent
{\XMLpureancestor\plusone}
+% probleem: depth is vast en dus ook ancestor
+
+% \XMLinh{...} will backtrack definitions (given that the elements
+% use begin/end, the backtracking stops when a non-empty value is
+% encountered; maybe we will add some keyword (inherit) some day
+
+% \def\XMLinh#1% will recurse so no trickery can be used
+% {\ifcsname\@@XMLvariable:\XMLpureancestor\plusone:#1\endcsname
+% \@EA\@EA\csname\@@XMLvariable:\XMLpureancestor\plusone:#1\endcsname
+% \fi}
+
+\def\XMLinh#1%
+ {\@EA\ifx\csname\@@XMLvariable:\currentXMLelement:#1\endcsname\empty
+ \@EA\pXMLinh
+ \else
+ \csname\@@XMLvariable:\currentXMLelement:#1\endcsname
+ \@EA\gobbletwoarguments
+ \fi\XMLdepth{#1}}
+
+\def\pXMLinh#1%
+ {\@EA\ppXMLinh\@EA{\the\numexpr(#1-\plusone)}}
+
+% \def\ppXMLinh#1#2%
+% {\ifcsname\@@XMLvariable:\csname\@@XMLdepth:#1\endcsname:#2\endcsname
+% \@EA\ifx\csname\@@XMLvariable:\csname\@@XMLdepth:#1\endcsname:#2\endcsname\empty
+% \@EAEAEA\pppXMLinh
+% \else
+% \csname\@@XMLvariable:\csname\@@XMLdepth:#1\endcsname:#2\endcsname
+% \@EAEAEA\gobbletwoarguments
+% \fi
+% \else
+% \@EA\pppXMLinh
+% \fi{#1}{#2}}
+
+% \def\pppXMLinh#1%
+% {\ifnum#1>\zerocount
+% \@EA\pXMLinh
+% \else
+% \@EA\gobbletwoarguments
+% \fi{#1}}
+
+\def\ppXMLinh#1#2%
+ {\@EA\ifx\csname\@@XMLvariable:\csname\@@XMLdepth:#1\endcsname:#2\endcsname\empty
+ \ifnum#1>\plusone
+ \@EAEAEA\pXMLinh
+ \else
+ \@EAEAEA\gobbletwoarguments
+ \fi
+ \else
+ \csname\@@XMLvariable:\csname\@@XMLdepth:#1\endcsname:#2\endcsname
+ \@EA\gobbletwoarguments
+ \fi{#1}{#2}}
+
+% better
+%
+% \def\XMLpureancestor#1%
+% {\ifcsname\@@XMLdepth:\the\numexpr(\XMLdepth-#1)\endcsname
+% \csname\@@XMLdepth:\the\numexpr(\XMLdepth-#1)\endcsname
+% \fi}
+
+% replaces macro in xtag-ini: ! ! !
+
+\def\edefXMLop#1#2% \macro{att}
+ {\edef#1%
+ {\csname\ifcsname\@@XMLvariable:\ownXMLelement:#2\endcsname
+ \@@XMLvariable:\ownXMLelement:#2\else\s!empty
+ \fi\endcsname}}
+
+\def\edefXMLinh#1#2% \macro{att}
+ {\edef#1{\XMLinh{#2}}}
+
+% \def\doifXMLopdef#1#2% \macro{att}
+% {\ifcsname\@@XMLvariable:\ownXMLelement:#1\endcsname
+% \@EA\let\@EA#1\csname\@@XMLvariable:\ownXMLelement:#1\endcsname
+% \expandafter\firstofoneargument
+% \else
+% \expandafter\gobbleoneargument
+% \fi}
+
+\fetchruntimecommand \tracebackXMLattribute {\f!xtagprefix\s!run}
+
% \defineXMLenvironment[one]
% {\beginXMLelement}
% {\endXMLelement}
@@ -909,7 +995,7 @@
% {fallback A: \setXMLfallbackmode 0 \processXMLbuffer}\par
% {fallback B: \setXMLfallbackmode 1 \processXMLbuffer}\par
% {fallback C: \setXMLfallbackmode 2 \processXMLbuffer}\par
-
+
% todo: split #1 into raws en reconstruct, set current etc, push and pop
%
% \def\beginXMLelement
@@ -1285,6 +1371,7 @@
\def\dosetXMLattributeB#1%
{\ifx\@@XMLspac\originalXMLnamespace
\@EA\def\csname\@@XMLvariable:\@@XMLclass:\@@XMLname\endcsname{#1}%
+ % maybe some day global handling here as well
\fi}
% \def\dosetXMLattributeC#1%
@@ -1305,10 +1392,9 @@
% \@EA\def\csname\@@XMLvariable:\@@XMLclass:\@@XMLspac:\@@XMLname\endcsname{#1}%
% \fi}
-\def\dosetXMLattributeD%
+\def\dosetXMLattributeD
{\@EA\def\csname\@@XMLvariable:\@@XMLclass:\ifx\@@XMLspac
- \originalXMLnamespace\currentXMLnamespace\else\@@XMLspac\fi
- :\@@XMLname\endcsname}
+ \originalXMLnamespace\currentXMLnamespace\else\@@XMLspac\fi:\@@XMLname\endcsname}
\def\setXMLattributemode#1%
{\ifcase#1\relax
@@ -1466,6 +1552,22 @@
%
% the ugly alternative
+% \def\dosetXMLargument#1% ugly alternative
+% {\ifXMLnamespace
+% \XMLnamespacefalse
+% \ifx\@@XMLspac\@@XMLns
+% \@EAEAEA\checkXMLnamespaceattr % xmlns:\@@XMLname="#1"
+% \else
+% \@EAEAEA\dosetXMLattribute % some:\@@XMLname="#1"
+% \fi
+% \else\ifx\@@XMLname\@@XMLns
+% \@EAEAEA\checkXMLnamespaceattr % xmlns="#1"
+% \else
+% \@EAEAEA\dodosetXMLargument
+% \fi\fi{#1}%
+% \let\dodoparseXMLarguments\doparseXMLarguments
+% \dodoparseXMLarguments}
+
\def\dosetXMLargument#1% ugly alternative
{\ifXMLnamespace
\XMLnamespacefalse
@@ -1479,10 +1581,22 @@
\else
\@EAEAEA\dodosetXMLargument
\fi\fi{#1}%
+ \dodocopyXMLargument
\let\dodoparseXMLarguments\doparseXMLarguments
\dodoparseXMLarguments}
-\def\dodosetXMLargumentA%
+\let\dodocopyXMLargument\relax
+
+\def\dododocopyXMLargument
+ {\@EA\@EA\@EA\let\@EA\@EA
+ \csname\@@XMLvariable:\csname\@@XMLglobal:\currentXMLelement\endcsname:\@@XMLname\endcsname
+ \csname\@@XMLvariable:\@@XMLclass :\@@XMLname\endcsname}
+
+\def\copyXMLargumentindeed
+ {\def\dodocopyXMLargument{\ifcsname\@@XMLglobal:\currentXMLelement\endcsname\dododocopyXMLargument\fi}%
+ \let\copyXMLargumentindeed\relax}
+
+\def\dodosetXMLargumentA
{\@EA\def\csname\@@XMLvariable:\@@XMLclass:\@@XMLname\endcsname}
\def\dodosetXMLargumentB#1%
@@ -1741,6 +1855,19 @@
\def\defineXMLnestedsave {\dotripleempty\dodefineXMLnestedsave}
\def\defineXMLnestedenvironmentsave{\dotripleempty\dodefineXMLnestedenvironmentsave}
+%D We can nill definitions with:
+
+\def\resetXMLelement[#1]{\dododefineXMLprocess{#1}}
+
+%D This is equivalent to:
+%D
+%D \starttypen
+%D \def\resetXMLelement[#1]% handy in case only singular
+%D {\@EA\let\csname\@@XMLelement:#1\endcsname \donothing
+%D \@EA\let\csname\@@XMLelement:/#1\endcsname\donothing
+%D \@EA\let\csname\@@XMLelement:#1/\endcsname\donothing}
+%D \stoptypen
+
% push is (not yet) a real push, so:
\def\defineXMLpush {\dotripleempty\dodefineXMLsave}
@@ -2181,6 +2308,11 @@
\def\expandXMLta{\expandXMLarguments\@@XMLmapmap}
\def\expandXMLtp{\expandTEXpar\@@XMLmapmap} % #1
+\def\getXMLparameters[#1]% faster than \rawgetparameters[#1][\theXMLar..]
+ {\ifcsname\@@XMLmap:#1\endcsname
+ \expanded{\rawgetparameters[#1][\csname\@@XMLmap:#1\endcsname]}%
+ \fi}
+
\def\defXMLop#1#2{\@EA\let\@EA#1\csname\@@XMLvariable:\ownXMLelement:#2\endcsname}
\def\defXMLtp#1#2{\@EA\let\@EA#1\csname\@@XMLmapmap\interfaced{#2}\endcsname}
@@ -2218,7 +2350,7 @@
\protectXMLdata
\dostartXMLdata}
-\long\def\dostartXMLdata#1\stopXMLdata
+\long\def\dostartXMLdata#1\stopXMLdata % evt \everyeof{}
{\enableXML\scantokens{#1<gobblespacetokens/>}%
\endgroup
\ifhmode\unskip\unskip\fi}
diff --git a/tex/context/base/xtag-mml.tex b/tex/context/base/xtag-mml.tex
index cacdaf4e3..cb2ccaea7 100644
--- a/tex/context/base/xtag-mml.tex
+++ b/tex/context/base/xtag-mml.tex
@@ -399,7 +399,8 @@
\def\somespaceentity#1#2%
{\mathortext
{\mskip#1mu}
- {\unskip\hskip#2em\strut\hskip\zeropoint\ignorespaces}\relax}
+ {\ifvmode\dontleavehmode\else\unskip\fi\hskip#2em\strut\hskip\zeropoint\ignorespaces}%
+ \relax}
\defineXMLentity [VeryThinSpace] {\somespaceentity {2}{.125}}
\defineXMLentity [ThinSpace] {\somespaceentity {3}{.25}}
diff --git a/tex/context/base/xtag-pre.tex b/tex/context/base/xtag-pre.tex
index 1c5933f3e..71ea6d04f 100644
--- a/tex/context/base/xtag-pre.tex
+++ b/tex/context/base/xtag-pre.tex
@@ -312,7 +312,7 @@
{\docontextXMLdirective#1 @ @ @\end}
\def\docontextXMLdirective#1 #2 #3 #4\end % class variable value
- {\csname\@@XMLvariable:#1:#2\endcsname{#3}}
+ {\expandafter\def\csname\@@XMLvariable:#1:#2\endcsname{#3}}
%D A simple processing instruction is the following. It just
%D writes a message to the screen.
diff --git a/tex/context/base/xtag-run.tex b/tex/context/base/xtag-run.tex
index bc88b5cc3..a1ad21bdf 100644
--- a/tex/context/base/xtag-run.tex
+++ b/tex/context/base/xtag-run.tex
@@ -287,4 +287,19 @@
\showXMLfile{#1}
\egroup}
+%D
+
+\gdef\tracebackXMLattribute#1%
+ {\bgroup
+ \doloop
+ {\ifcsname\@@XMLdepth:\recurselevel\endcsname
+ \edef\!!stringa{\csname\@@XMLdepth:\recurselevel\endcsname}%
+ \writestatus
+ {XML TRACE}
+ {[#1] [\recurselevel] [\!!stringa] [\XMLinh{#1}]}%
+ \else
+ \exitloop
+ \fi}%
+ \egroup}
+
\protect \endinput \ No newline at end of file
diff --git a/tex/context/config/cont-usr.tex b/tex/context/config/cont-usr.tex
index 22b8a63f5..6c6c2f121 100644
--- a/tex/context/config/cont-usr.tex
+++ b/tex/context/config/cont-usr.tex
@@ -50,7 +50,17 @@
\definefilesynonym [lang-tr.pat] [trhyph.tex]
\definefilesynonym [lang-ua.pat] [ukrenhyp.tex]
\definefilesynonym [lang-uk.pat] [ukhyphen.tex]
-\definefilesynonym [lang-us.pat] [ushyph1.tex]
+\definefilesynonym [lang-us.pat] [ushyph.tex]
+
+%D Ah, something changed in 2003 with respect to ushyph.tex, so let's
+%D fall back when needed. I first noticed this during a workshop at the
+%D practical tex conference 2004 in sf. Yet another proof of a mess in
+%D filenames.
+
+ \doiffileelse{ushyph.tex} {\definefilesynonym[lang-us.pat][ushyph.tex]}
+{\doiffileelse{ushyph1.tex} {\definefilesynonym[lang-us.pat][ushyph1.tex]}
+{\doiffileelse{ushyph2.tex} {\definefilesynonym[lang-us.pat][ushyph2.tex]}
+ {\definefilesynonym[lang-us.pat][ukhyph.tex]}}}
%D When the dutch spelling changed, new patterns were
%D constructed. For long these were named \type {dutch96.pat}.
@@ -60,11 +70,9 @@
%D files as well as their coding is one of the dark areas of
%D \TEX\ distributions.
-\doiffileelse{nehyph96.tex}
- {\definefilesynonym[lang-nl.pat][nehyph96.tex]}
- {\doiffileelse{dutch96.pat}
- {\definefilesynonym[lang-nl.pat][dutch96.pat]}
- {\definefilesynonym[lang-nl.pat][nehyph.tex]}}
+ \doiffileelse{nehyph96.tex} {\definefilesynonym[lang-nl.pat][nehyph96.tex]}
+{\doiffileelse{dutch96.pat} {\definefilesynonym[lang-nl.pat][dutch96.pat]}
+ {\definefilesynonym[lang-nl.pat][nehyph.tex]}}
%D Pattern files are (can be) encoded! And, alas, not all
%D pattern files are self contained, which is why (for the
diff --git a/tex/latex/context/m-ch-de.sty b/tex/latex/context/m-ch-de.sty
index 5988d7a53..d35f8cf2d 100644
--- a/tex/latex/context/m-ch-de.sty
+++ b/tex/latex/context/m-ch-de.sty
@@ -1 +1,19 @@
-\input m-ch-de.tex \relax \endinput
+\ProvidesPackage{m-ch-de}[2004/07/30 package wrapper for m-ch-de.tex]
+
+\newif\ifPPCH@PSTRICKS
+
+\DeclareOption{pstricks}{\PPCH@PSTRICKStrue}
+\DeclareOption{pictex}{\PPCH@PSTRICKSfalse}
+
+\ExecuteOptions{pictex}
+\ProcessOptions\relax
+
+\ifPPCH@PSTRICKS
+ \RequirePackage{pstricks,pst-plot}
+\else
+ \RequirePackage{m-pictex}
+\fi
+
+\input{m-ch-de.tex}
+
+\endinput \ No newline at end of file
diff --git a/tex/latex/context/m-ch-en.sty b/tex/latex/context/m-ch-en.sty
index f22512d05..e93a49867 100644
--- a/tex/latex/context/m-ch-en.sty
+++ b/tex/latex/context/m-ch-en.sty
@@ -1 +1,19 @@
-\input m-ch-en.tex \relax \endinput
+\ProvidesPackage{m-ch-en}[2004/07/30 package wrapper for m-ch-en.tex]
+
+\newif\ifPPCH@PSTRICKS
+
+\DeclareOption{pstricks}{\PPCH@PSTRICKStrue}
+\DeclareOption{pictex}{\PPCH@PSTRICKSfalse}
+
+\ExecuteOptions{pictex}
+\ProcessOptions\relax
+
+\ifPPCH@PSTRICKS
+ \RequirePackage{pstricks,pst-plot}
+\else
+ \RequirePackage{m-pictex}
+\fi
+
+\input{m-ch-en.tex}
+
+\endinput \ No newline at end of file
diff --git a/tex/latex/context/m-ch-nl.sty b/tex/latex/context/m-ch-nl.sty
index 29c40be30..6e2b8d43d 100644
--- a/tex/latex/context/m-ch-nl.sty
+++ b/tex/latex/context/m-ch-nl.sty
@@ -1 +1,19 @@
-\input m-ch-nl.tex \relax \endinput
+\ProvidesPackage{m-ch-nl}[2004/07/30 package wrapper for m-ch-nl.tex]
+
+\newif\ifPPCH@PSTRICKS
+
+\DeclareOption{pstricks}{\PPCH@PSTRICKStrue}
+\DeclareOption{pictex}{\PPCH@PSTRICKSfalse}
+
+\ExecuteOptions{pictex}
+\ProcessOptions\relax
+
+\ifPPCH@PSTRICKS
+ \RequirePackage{pstricks,pst-plot}
+\else
+ \RequirePackage{m-pictex}
+\fi
+
+\input{m-ch-nl.tex}
+
+\endinput \ No newline at end of file
diff --git a/tex/latex/context/m-metapo.sty b/tex/latex/context/m-metapo.sty
index c1d9f3a9f..2d568df96 100644
--- a/tex/latex/context/m-metapo.sty
+++ b/tex/latex/context/m-metapo.sty
@@ -1 +1,5 @@
-\input m-metapo.tex \relax \endinput
+\ProvidesPackage{m-metapo}[2004/07/30 package wrapper for m-metapo.tex]
+
+\input{m-metapo.tex}
+
+\endinput \ No newline at end of file
diff --git a/tex/latex/context/m-pictex.sty b/tex/latex/context/m-pictex.sty
index be5dd8504..18630f2cc 100644
--- a/tex/latex/context/m-pictex.sty
+++ b/tex/latex/context/m-pictex.sty
@@ -1 +1,5 @@
-\input m-pictex.tex \relax \endinput
+\ProvidesPackage{m-pictex}[2004/07/30 package wrapper for m-pictex.tex]
+
+\input{m-pictex.tex}
+
+\endinput \ No newline at end of file