diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-07-24 10:59:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-07-24 10:59:00 +0200 |
commit | f64d7fc23ab538ccddc90651bc002df6d1d1729f (patch) | |
tree | de7833ccfdb6894238c3f45ccdf66c27a03bcafd | |
parent | 665c304e7a58811e8f6225721685bf13259f19b3 (diff) | |
download | context-f64d7fc23ab538ccddc90651bc002df6d1d1729f.tar.gz |
beta 2012.07.24 10:59
-rw-r--r-- | metapost/context/base/mp-chem.mpiv | 124 | ||||
-rw-r--r-- | tex/context/base/chem-str.lua | 12 | ||||
-rw-r--r-- | tex/context/base/chem-str.mkiv | 17 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4078 -> 4090 bytes | |||
-rw-r--r-- | tex/context/base/context-version.png | bin | 106362 -> 106541 bytes | |||
-rw-r--r-- | tex/context/base/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mult-aux.mkiv | 3 | ||||
-rw-r--r-- | tex/context/base/page-set.mkiv | 425 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24353 -> 24356 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 184566 -> 184572 bytes | |||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
14 files changed, 310 insertions, 281 deletions
diff --git a/metapost/context/base/mp-chem.mpiv b/metapost/context/base/mp-chem.mpiv index cb595f2c6..066a60bfd 100644 --- a/metapost/context/base/mp-chem.mpiv +++ b/metapost/context/base/mp-chem.mpiv @@ -3,7 +3,7 @@ %D version=2009.05.13, %D title=\CONTEXT\ \METAPOST\ graphics, %D subtitle=chemicals, -%D author=Hans Hagen, +%D author=Hans Hagen \& Alan Braslau", %D date=\currentdate, %D copyright=\PRAGMA] %C @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See licen-en.pdf for %C details. -%D This module in incomplete and experimental. +%D This module is incomplete and experimental. % either consistent setting or not @@ -30,6 +30,9 @@ boolean chem_setting_fixedwidth, chem_setting_fixedheight, chem_doing_pb, chem_text_trace ; +color + chem_axis_color ; + path chem_setting_bbox ; @@ -82,7 +85,7 @@ chem_adjacent := 0 ; chem_substituent := 0 ; chem_direction := 0 ; chem_stack_n := 0 ; -chem_doing_pb := false ; +chem_doing_pb := false ; chem_shift := origin ; chem_dot_factor := 4 ; chem_text_trace := false ; @@ -90,6 +93,7 @@ chem_bd_n := 4 ; chem_bw_n := 4 ; chem_bd_angle := 4 ; chem_bb_angle := 4 ; +chem_axis_color := blue ; % TODO: add "axiscolor=" option in lua... vardef chem_start_structure(expr n, l, r, t, b, scale, axis, fixedwidth, fixedheight, offset) = chem_setting_axis := axis ; @@ -127,17 +131,18 @@ def chem_stop_structure = chem_setting_bbox := (-chem_setting_l,-chem_setting_b) -- ( chem_setting_r,-chem_setting_b) -- ( chem_setting_r, chem_setting_t) -- (-chem_setting_l, chem_setting_t) -- cycle ; - % maybe put it behind the picture - if chem_setting_axis : + if chem_setting_axis : % put it behind the picture + picture chem_picture ; chem_picture := currentpicture ; currentpicture := nullpicture ; save stp ; stp := chem_base_width/ 2 * chem_setting_scale ; - save siz ; siz := chem_base_width/10 * chem_setting_scale ; - draw (-chem_setting_l,0) -- (chem_setting_r,0) withcolor blue ; - draw (0,-chem_setting_b) -- (0,chem_setting_t) withcolor blue ; - for i = 0 step stp until chem_setting_r : draw (i,-siz) -- (i,siz) withcolor blue ; endfor ; - for i = 0 step -stp until -chem_setting_l : draw (i,-siz) -- (i,siz) withcolor blue ; endfor ; - for i = 0 step stp until chem_setting_t : draw (-siz,i) -- (siz,i) withcolor blue ; endfor ; - for i = 0 step -stp until -chem_setting_b : draw (-siz,i) -- (siz,i) withcolor blue ; endfor ; - draw chem_setting_bbox withcolor blue ; + save siz ; siz := stp/5 ; + draw (-chem_setting_l,0) -- (chem_setting_r,0) withcolor chem_axis_color ; + draw (0,-chem_setting_b) -- (0,chem_setting_t) withcolor chem_axis_color ; + for i = 0 step stp until chem_setting_r : draw (i,-siz) -- (i,siz) withcolor chem_axis_color ; endfor ; + for i = 0 step -stp until -chem_setting_l : draw (i,-siz) -- (i,siz) withcolor chem_axis_color ; endfor ; + for i = 0 step stp until chem_setting_t : draw (-siz,i) -- (siz,i) withcolor chem_axis_color ; endfor ; + for i = 0 step -stp until -chem_setting_b : draw (-siz,i) -- (siz,i) withcolor chem_axis_color ; endfor ; + % frame=on: draw chem_setting_bbox withcolor chem_axis_color ; + addto currentpicture also chem_picture ; fi ; setbounds currentpicture to chem_setting_bbox ; enddef ; @@ -146,8 +151,8 @@ def chem_start_component = enddef ; def chem_stop_component = enddef ; def chem_pb = -% draw boundingbox currentpicture withpen pencircle scaled 1mm withcolor blue ; -% draw origin withpen pencircle scaled 2mm withcolor blue ; +% draw boundingbox currentpicture withpen pencircle scaled 1mm withcolor chem_axis_color ; +% draw origin withpen pencircle scaled 2mm withcolor chem_axis_color ; chem_doing_pb := true ; enddef ; @@ -174,6 +179,7 @@ vardef chem_do (expr p) = fi enddef ; +% f_rom, t_o, r_ule, c_olor vardef chem_b (expr n, f, t, r, c) = chem_draw (n, chem_b_path[n], f, t, r, c) ; enddef ; @@ -545,7 +551,7 @@ vardef chem_c_text(expr txt, z) = % adapted copy of thelabel@ enddef ; vardef chem_ang (expr n, d) = - ((-1 * (d-1) * chem_angle[n]) + (-chem_rotation+1) * 90 + chem_start[n]) % no ; + ((1-d)*chem_angle[n] + (1-chem_rotation)*90 + chem_start[n]) % no ; enddef ; vardef chem_rot (expr n, d) = @@ -562,7 +568,7 @@ enddef ; vardef chem_dir (expr n, d) = if n = 1 : - chem_direction_p := (origin - 2*center(chem_b_path[n] rotated chem_ang(n,d+1))) ; + chem_direction_p := (origin - 2*center(chem_b_path[n] rotated chem_ang(n,d))/cosd(chem_angle[n])) ; currentpicture := currentpicture shifted chem_direction_p ; chem_shift := chem_shift + chem_direction_p ; fi ; @@ -580,16 +586,12 @@ vardef chem_mov (expr n, d) = enddef ; vardef chem_off (expr n, d) = - if (d = 1) or (d = 2) or (d = 8) : % positive - currentpicture := currentpicture shifted (-chem_setting_offset,0) ; - chem_shift := chem_shift + (-chem_setting_offset,0) - elseif (d = 4) or (d = 5) or (d = 6) : % negative - currentpicture := currentpicture shifted ( chem_setting_offset,0) ; - chem_shift := chem_shift + ( chem_setting_offset,0) - fi ; + pair o ; o := (-chem_setting_offset,0) rotated chem_ang(1,d+chem_initialmov[1]) ; + currentpicture := currentpicture shifted o ; + chem_shift := chem_shift + o ; enddef ; -vardef chem_set(expr n, m) = +vardef chem_set (expr n, m) = if chem_adjacent > 0 : chem_adjacent_d := xpart chem_b_zero[n] + xpart chem_b_zero[m] ; if chem_adjacent = 1 : chem_adjacent_p := (-chem_adjacent_d, 0) ; @@ -693,14 +695,16 @@ vardef chem_restore = fi ; enddef ; -def chem_init_some(expr n, ratio, start, initialrot, initialmov) = - chem_width [n] := ratio * chem_base_width * chem_setting_scale ; +def chem_init_some(expr n, initialrot, initialmov, front) = chem_angle [n] := 360/abs(n) ; - chem_start [n] := start ; + chem_width [n] := chem_setting_scale * (chem_base_width/2) / sind(chem_angle[n]/2) ; + chem_start [n] := 0 ; chem_initialrot[n] := initialrot ; chem_initialmov[n] := initialmov ; - chem_b_zero [n] := (chem_width[n],0) rotated (chem_angle[n]/2) ; - chem_n_zero [n] := (chem_text_min*chem_width[n],0) rotated (chem_angle[n]/2) ; + chem_b_path [n] := ((chem_width[n],0) rotated -(chem_angle[n]/2))-- + ((chem_width[n],0) rotated +(chem_angle[n]/2)) ; + chem_b_zero [n] := point 1 of chem_b_path [n] ; + chem_n_zero [n] := chem_text_min*chem_b_zero[n] ; chem_r_max [n] := chem_radical_max*chem_b_zero[n] ; chem_r_path [n] := chem_b_zero[n] -- chem_r_max[n] ; chem_mr_path [n] := chem_r_path [n] rotatedaround(chem_b_zero[n], (180-chem_angle[n])/2) ; @@ -714,8 +718,7 @@ def chem_init_some(expr n, ratio, start, initialrot, initialmov) = chem_rt_zero [n] := (((chem_radical_max+chem_radical_min)/2)*chem_width[n],0) rotated (chem_angle[n]/2) ; chem_rtt_zero [n] := chem_rt_zero[n] rotated + 10 ; chem_rbt_zero [n] := chem_rt_zero[n] rotated - 10 ; - chem_b_path [n] := reverse(chem_b_zero[n] -- (chem_b_zero[n] rotated -chem_angle[n])) ; - chem_bx_path [n] := reverse(chem_b_zero[n] -- (chem_b_zero[n] rotated -chem_angle[n])) ; % ? + chem_bx_path [n] := reverse(chem_b_zero[n] -- (chem_b_zero[n] rotated -chem_angle[n])) ; % ? NOT USED... chem_sb_path [n] := subpath (0.25,0.75) of chem_b_path[n] ; chem_s_path [n] := point 0 of chem_b_path[n] -- point 0 of (chem_b_path[n] rotated (2chem_angle[n])) ; chem_ss_path [n] := subpath (0.25,0.75) of (chem_s_path[n]) ; @@ -740,59 +743,56 @@ def chem_init_some(expr n, ratio, start, initialrot, initialmov) = point 0 of chem_sb_path[n] rotatedaround(point 1 of chem_sb_path[n], -4) -- point 0 of chem_sb_path[n] rotatedaround(point 1 of chem_sb_path[n], 4) -- cycle ; chem_rb_path [n] := chem_b_zero[n] -- chem_r_max[n] rotated -2 -- chem_r_max[n] -- chem_r_max[n] rotated 2 -- cycle ; - chem_mrb_path [n] := chem_rb_path[n] rotatedaround(chem_b_zero[n], (180-chem_angle[n])/2) ; + chem_mrb_path [n] := chem_rb_path[n] rotatedaround(chem_b_zero[n],+(180-chem_angle[n])/2) ; chem_prb_path [n] := chem_rb_path[n] rotatedaround(chem_b_zero[n],-(180-chem_angle[n])/2) ; - chem_msr_path [n] := chem_sr_path[n] rotatedaround(chem_b_zero[n], (180-chem_angle[n])/2) ; + chem_msr_path [n] := chem_sr_path[n] rotatedaround(chem_b_zero[n],+(180-chem_angle[n])/2) ; chem_psr_path [n] := chem_sr_path[n] rotatedaround(chem_b_zero[n],-(180-chem_angle[n])/2) ; % not yet ok: % chem_c_path [n] := subpath (30/45, -30/45) of (fullcircle scaled (1.25*chem_circle_radius*chem_width[n])); % chem_cc_path [n] := subpath (30/45,8-30/45) of (fullcircle rotated 90 scaled (1.25*chem_circle_radius*chem_width[n])); chem_c_path [n] := subpath (30/45, -30/45) of (fullcircle scaled (chem_width[n])); chem_cc_path [n] := subpath (30/45,8-30/45) of (fullcircle rotated 90 scaled (chem_width[n])); -enddef ; -def chem_init_three = chem_init_some(3,30/52 ,-60,1,2) ; enddef ; % 60 -def chem_init_four = chem_init_some(4,30/42.5, 0,1,0) ; enddef ; % 45 -def chem_init_five = chem_init_some(5,30/35 , 0,1,0) ; enddef ; % 36 -def chem_init_six = chem_init_some(6, 1 , 0,1,0) ; enddef ; % 30 -def chem_init_eight = chem_init_some(8,30/22.5, 0,1,0) ; enddef ; % 22.5 - -% bb R -R R Z -RZ +RZ - -def chem_init_some_front(expr n, ratio, start, initialrot, initialmov) = - chem_init_some(n, ratio, start, initialrot, initialmov) ; - chem_bb_path [n] := chem_b_path[n] rotated -chem_angle[n] -- chem_b_path[n] -- chem_b_path[n] rotated chem_angle[n] -- + if (front) : + chem_bb_path [n] := chem_b_path[n] rotated -chem_angle[n] -- chem_b_path[n] -- chem_b_path[n] rotated chem_angle[n] -- (reverse(chem_b_path[n] shortened (chem_base_width/20))) paralleled (chem_base_width/20) -- cycle ; - chem_r_max [n] := chem_radical_max*chem_b_zero[n] ; - chem_mr_path [n] := origin -- origin shifted (0,-.25chem_base_width) ; - chem_pr_path [n] := origin -- origin shifted (0, .25*chem_base_width) ; - chem_r_path [n] := point 1 of chem_mr_path[n] -- point 1 of chem_pr_path[n] ; - chem_mr_zero [n] := point 1 of chem_mr_path[n] ; - chem_pr_zero [n] := point 1 of chem_pr_path[n] ; + chem_r_max [n] := chem_radical_max*chem_b_zero[n] ; + chem_mr_path [n] := origin -- origin shifted (0,-.25chem_base_width) ; + chem_pr_path [n] := origin -- origin shifted (0,+.25chem_base_width) ; + chem_r_path [n] := point 1 of chem_mr_path[n] -- point 1 of chem_pr_path[n] ; + chem_mr_zero [n] := point 1 of chem_mr_path[n] ; + chem_pr_zero [n] := point 1 of chem_pr_path[n] ; + fi enddef ; -def chem_init_five_front = chem_init_some_front(-5,30/35,0,2,0) ; enddef ; % 36 -def chem_init_six_front = chem_init_some_front(-6, 1 ,0,2,0) ; enddef ; % 30 +def chem_init_three = chem_init_some(3,1,2,false) ; enddef ; +def chem_init_four = chem_init_some(4,1,0,false) ; enddef ; +def chem_init_five = chem_init_some(5,1,0,false) ; enddef ; +def chem_init_six = chem_init_some(6,1,0,false) ; enddef ; +def chem_init_eight = chem_init_some(8,1,0,false) ; enddef ; +def chem_init_five_front = chem_init_some(-5,2,0,true) ; enddef ; +def chem_init_six_front = chem_init_some(-6,2,0,true) ; enddef ; + +% bb R -R R Z -RZ +RZ vardef chem_init_one = - chem_width [1] := .75 * chem_base_width * chem_setting_scale ; + chem_width [1] := chem_setting_scale * chem_base_width ; chem_angle [1] := 360/8 ; chem_start [1] := 0 ; chem_initialrot[1] := 1 ; - chem_initialmov[1] := 1 ; - chem_b_zero [1] := (1.75*chem_width[1],0) ; + chem_initialmov[1] := 0 ; + chem_b_path [1] := origin -- (chem_width[1],0) ; + chem_b_zero [1] := point 1 of chem_b_path[1] ; chem_r_min [1] := chem_radical_min*chem_b_zero[1] ; chem_r_max [1] := chem_radical_max*chem_b_zero[1] ; chem_r_path [1] := (.5*chem_width[1],0) -- (1.25*chem_width[1],0) ; chem_r_zero [1] := point 1 of chem_r_path [1] ; - chem_b_path [1] := chem_r_path[1] rotated + (chem_angle[1]) ; % used for move here - chem_b_zero [1] := chem_r_zero[1] ; chem_crz_zero [1] := chem_r_zero[1] enlonged chem_center_offset ; chem_e_path [1] := (.5*chem_width[1],-.25*chem_width[1]) -- (.5*chem_width[1],.25*chem_width[1]) ; - chem_sb_path [1] := chem_r_path [1] ; - chem_msb_path [1] := chem_r_path [1] shifted (0,-.1chem_width[1]) ; - chem_psb_path [1] := chem_r_path [1] shifted (0, .1chem_width[1]) ; + chem_sb_path [1] := subpath(.25,.75) of chem_b_path [1] ; + chem_msb_path [1] := subpath (0.00,0.75) of chem_b_path[1] ; + chem_psb_path [1] := subpath (0.25,1.00) of chem_b_path[1] ; chem_ddt_path [1] := subpath(0,.4) of chem_r_path [1] ; chem_ddb_path [1] := subpath(.6,1) of chem_r_path [1] ; chem_ldt_path [1] := chem_ddt_path [1] shifted (0,-.1chem_width[1]) ; % parallel diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua index 77ca0a319..b56525e3f 100644 --- a/tex/context/base/chem-str.lua +++ b/tex/context/base/chem-str.lua @@ -1,12 +1,15 @@ if not modules then modules = { } end modules ['chem-str'] = { version = 1.001, comment = "companion to chem-str.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + author = "Hans Hagen and Alan Braslau", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } --- This module in incomplete and experimental. +-- The original \PPCHTEX\ code was written in pure \TEX\, although later we made +-- the move from \PICTEX\ to \METAPOST\. The current implementation is a mix between +-- \TEX\, \LUA\ and \METAPOST. Although the first objective is to get a compatible +-- but better implementation, later versions might provide more, -- We can push snippets into an mp instance. @@ -52,7 +55,7 @@ local common_keys = { mid = "fixed", mids = "fixed", midz = "text", z = "text", rz = "text", mrz = "text", prz = "text", crz = "text", rt = "text", rtt = "text", rbt = "text", zt = "text", zn = "number", - mov = "transform", rot = "transform", adj = "transform", dir = "transform", sub = "transform", + mov = "transform", rot = "transform", adj = "transform", sub = "transform", } local front_keys = { @@ -63,6 +66,7 @@ local front_keys = { } local one_keys = { + b = "line", msb = "line", psb = "line", sb = "line", db = "line", tb = "line", ep = "line", es = "line", ed = "line", et = "line", sd = "line", ldd = "line", rdd = "line", @@ -81,7 +85,7 @@ local syntax = { one = { n = 1, max = 8, keys = one_keys, align = { - z = { { "r", "r_b", "b", "l_b", "l", "l_t", "t", "r_t" } }, +-- z = { { "r", "r_b", "b", "l_b", "l", "l_t", "t", "r_t" } }, --~ z = { { "r", "r", "b", "l", "l", "l", "t", "r" } }, } }, diff --git a/tex/context/base/chem-str.mkiv b/tex/context/base/chem-str.mkiv index c0eaa8c28..183eeb181 100644 --- a/tex/context/base/chem-str.mkiv +++ b/tex/context/base/chem-str.mkiv @@ -2,7 +2,7 @@ %D [ file=chem-ini, %D version=2009.05.13, %D subtitle=Chemistry, -%D author=Hans Hagen, +%D author=Hans Hagen \& Alan Braslau, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C @@ -10,8 +10,10 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D This module in incomplete and experimental. Eventually this code -%D will replace \PPCHTEX. +%D The original \PPCHTEX\ code was written in pure \TEX\, although later we made +%D the move from \PICTEX\ to \METAPOST\. The current implementation is a mix between +%D \TEX\, \LUA\ and \METAPOST. Although the first objective is to get a compatible +%D but better implementation, later versions might provide more, \writestatus{loading}{ConTeXt Chemistry Macros / Structure} @@ -58,6 +60,10 @@ \let\setupchemicals\setupchemical +%D We use a dedicated framed macro instead of inheriting one. This is both +%D a historical and practical reason (like shared keys with different meaning +%D that could clash, e.g.\ align). + \defineframed [\??chemicalframed] [\c!align=\v!normal, @@ -101,11 +107,6 @@ \edef\chemicaltoplocation{t} \edef\chemicalbotlocation{b} -% \unexpanded\def\chemicaltext#1% in ppchtex we had a more clever alignment -% {\usechemicalstyleandcolor\c!style\c!color -% \strut -% #1} % maybe also \setstrut - \unexpanded\def\chemicaltext#1% {\mathematics {\usechemicalstyleandcolor\c!style\c!color diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 650d129cd..ceae7e699 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.07.23 20:18} +\newcontextversion{2012.07.24 10:59} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 6af5aff9c..264511c3a 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.07.23 20:18} +\newcontextversion{2012.07.24 10:59} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 98526f426..df1cdb8a8 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 09cb78f21..c6e119c8d 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 0fecb78a5..b53641cf9 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.07.23 20:18} +\edef\contextversion{2012.07.24 10:59} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 6756fb304..8e386872c 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.07.23 20:18} +\edef\contextversion{2012.07.24 10:59} %D For those who want to use this: diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index 18cafd153..a2ebf6e2c 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -14,6 +14,9 @@ % todo: setupxxx and setupxxxs (so a plural for the root setup and % we can consider blocking the root) +% todo (e.g for columnsets and registers): \definexxx[parent][1] +% + %D A generalization of \MKIV-like inheritance. Just something to play %D with (interface might change). The code here evolved in an email %D exchange between me and Wolgang Schuster. diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index 51e4896bc..3e3141b15 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -13,7 +13,9 @@ % getnoflines vs getrawnoflines -% some day: cleanup and go etex +% This is a rather old mechanism and we can best keep it as it is. If it gets +% replaced by a more modern solution, it will be an extra mechanism. So, we +% only do some basic cleanup. \writestatus{loading}{ConTeXt Page Macros / Column Sets} @@ -29,9 +31,6 @@ \unprotect -\definesystemvariable {mc} % MultiColumn -\definesystemvariable {mt} % MulTicolumn - \newcount\tofcolumns % total \newcount\lofcolumns % left \newcount\rofcolumns % right @@ -47,7 +46,7 @@ \newif\ifenoughcolumncells \newif\ifsomefreecolumncells \newif\ifcolumnspread -\newif\iftracecolumnset % \tracecolumnsettrue +\newif\iftracecolumnset \newif\ifforcecolumnsetgrid \forcecolumnsetgridtrue \newif\ifcollectingsetcontent % never set @@ -55,16 +54,87 @@ \newif\iflastcolumnfootnotes % never set \lastcolumnfootnotestrue \newif\ifintermediatefootnotes -\newbox\b_page_set_preceding -\newbox\b_page_set_trailing +\newbox \b_page_set_preceding +\newbox \b_page_set_trailing + +\newdimen \d_page_set_local_hsize +\newconditional\c_page_set_width_set -\newdimen\d_page_set_local_hsize +\installcorenamespace{columnsetgrid} \def\columnmaxcells {75} % runtime \def\columnmaxfreecells {0} % runtime \def\columngaplimit {0} % {5} -\def\@otr@{otr} +\def\page_set_cell #1#2{\csname \??columnsetgrid:\number#1:\number#2\endcsname} +\def\page_set_cell_get#1#2{\box\csname \??columnsetgrid:\number#1:\number#2\endcsname} +\def\page_set_cell_set#1#2{\global\setbox\csname\??columnsetgrid:\number#1:\number#2\endcsname} + +\def\page_set_cell_doifelse#1#2% + {\relax + \ifvoid\csname\??columnsetgrid:\number#1:\number#2\endcsname + \expandafter\secondoftwoarguments + \else + \expandafter\firstoftwoarguments + \fi} + +\def\page_set_cell_erase_grid % maybe dedicated loops ... make another loop when max's have changed + {\bgroup + \increment\columnmaxcells\relax + \ifodd\realpageno \else + \columnspreadfalse + \fi + \ifcolumnspread + \page_set_cell_erase_grid_spread + \else + \page_set_cell_erase_grid_page + \fi + \page_set_cell_erase_grid_top + \global\columnfirstcell\zerocount + \global\columnlastcell \columnfirstcell + \global\columnfreecells\columnfirstcell + \egroup} + +\let\m_page_column_l\relax +\let\m_page_column_r\relax + +\def\page_set_cell_erase_grid_spread + {\dorecurse\nofcolumns + {\let \m_page_column_l\recurselevel + \edef\m_page_column_r{\the\numexpr\recurselevel+\lofcolumns}% + \dostepwiserecurse \zerocount \columnmaxcells \plusone + {\ifcsname\??columnsetgrid:\m_page_column_l:\recurselevel\endcsname + \global\setbox\csname\??columnsetgrid:\m_page_column_l:\recurselevel\endcsname + \ifcsname\??columnsetgrid:\m_page_column_r:\recurselevel\endcsname + \box\csname\??columnsetgrid:\m_page_column_r:\recurselevel\endcsname + \else + \emptyhbox + \expandafter\newbox\csname\??columnsetgrid:\m_page_column_r:\recurselevel\endcsname + \fi + \else + \expandafter\newbox\csname\??columnsetgrid:\m_page_column_l:\recurselevel\endcsname + \ifcsname\??columnsetgrid:\m_page_column_r:\recurselevel\endcsname + \global\setbox\csname\??columnsetgrid:\m_page_column_l:\recurselevel\endcsname\box\csname\??columnsetgrid:\m_page_column_r:\recurselevel\endcsname + \else + \expandafter\newbox\csname\??columnsetgrid:\m_page_column_r:\recurselevel\endcsname + \fi + \fi}}} + +\def\page_set_cell_erase_grid_page + {\dorecurse \tofcolumns + {\let\m_page_column_l\recurselevel + \dostepwiserecurse \zerocount \columnmaxcells \plusone + {\ifcsname\??columnsetgrid:\m_page_column_l:\recurselevel\endcsname + \global\setbox\csname\??columnsetgrid:\m_page_column_l:\recurselevel\endcsname\emptybox + \else + \expandafter\newbox\csname\??columnsetgrid:\m_page_column_l:\recurselevel\endcsname + \fi}}} + +\def\page_set_cell_erase_grid_top + {\dorecurse\tofcolumns + {\global\setbox\csname\??columnsetgrid:\recurselevel:\columnmaxcells\endcsname\copy\placeholderboxa}} + +% % % % \def\OTRSETmakeupwidth{\innermakeupwidth} @@ -74,15 +144,6 @@ \unexpanded\def\page_set_command_synchronize_side_floats {\page_sides_forget_floats} -\def\OTRSETgridcell #1#2{\csname \@otr@:\number#1:\number#2\endcsname} -\def\OTRSETgetgridcell#1#2{\box\csname \@otr@:\number#1:\number#2\endcsname} -\def\OTRSETsetgridcell#1#2{\global\setbox\csname\@otr@:\number#1:\number#2\endcsname} - -\long\def\OTRSETdoifcellelse#1#2% - {\relax\ifvoid\csname\@otr@:\number#1:\number#2\endcsname - \@EA\secondoftwoarguments\else\@EA\firstoftwoarguments - \fi} - % The following two macros are used to compensate for a switch in body fonts % as in: % @@ -198,64 +259,16 @@ \relax % needed ! ! ! ! else lookahead over \fi and \@EA \@EA\egroup\@EA\scratchdimen\the\!!dimena\relax} -\def\columnerasegridboxes % maybe dedicated loops - {\bgroup - \increment\columnmaxcells\relax - \ifodd\realpageno - \else % we are on the other page - \columnspreadfalse - \fi - \ifcolumnspread - \dorecurse\nofcolumns - {\let\!!stringa\recurselevel - \scratchcounter\recurselevel \advance\scratchcounter\lofcolumns - \edef\!!stringb{\the\scratchcounter}% - \dostepwiserecurse \zerocount \columnmaxcells \plusone - {\ifcsname\@otr@:\!!stringa:\recurselevel\endcsname - \global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname - \ifcsname\@otr@:\!!stringb:\recurselevel\endcsname - \box\csname\@otr@:\!!stringb:\recurselevel\endcsname - %\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\csname\@otr@:\!!stringb:\recurselevel\endcsname - \else - \emptyhbox - %\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\emptybox - \expandafter\newbox\csname\@otr@:\!!stringb:\recurselevel\endcsname - \fi - \else - \expandafter\newbox\csname\@otr@:\!!stringa:\recurselevel\endcsname - \ifcsname\@otr@:\!!stringb:\recurselevel\endcsname - \global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\csname\@otr@:\!!stringb:\recurselevel\endcsname - \else - \expandafter\newbox\csname\@otr@:\!!stringb:\recurselevel\endcsname - \fi - \fi}}% - \else - \dorecurse \tofcolumns - {\let\!!stringa\recurselevel - \dostepwiserecurse \zerocount \columnmaxcells \plusone - {\ifcsname\@otr@:\!!stringa:\recurselevel\endcsname - \global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\emptybox - \else - \expandafter\newbox\csname\@otr@:\!!stringa:\recurselevel\endcsname - \fi}}% - \fi - \dorecurse\tofcolumns - {\global\setbox\csname\@otr@:\recurselevel:\columnmaxcells\endcsname\copy\placeholderboxa}% - \global\columnfirstcell\zerocount - \global\columnlastcell\columnfirstcell - \global\columnfreecells\columnfirstcell - \egroup} - \def\doOTRSETsetgridcells#1#2#3#4#5#6% placeholder col row wid hei {data} {\!!countd#2\advance\!!countd#4\advance\!!countd\minusone \!!counte#3\advance\!!counte#5\advance\!!counte\minusone \dostepwiserecurse{#2}\!!countd\plusone {\!!countf\recurselevel \dostepwiserecurse{#3}\!!counte\plusone - {\OTRSETsetgridcell\!!countf\recurselevel#1}}% + {\page_set_cell_set\!!countf\recurselevel#1}}% \dostepwiserecurse{#3}\!!counte\plusone - {\wd\OTRSETgridcell{#2}\recurselevel\hsize}% - \OTRSETsetgridcell{#2}\!!counte#6} + {\wd\page_set_cell{#2}\recurselevel\hsize}% + \page_set_cell_set{#2}\!!counte#6} \def\OTRSETsetgridcells {\doOTRSETsetgridcells{\copy\placeholderboxb}} @@ -266,19 +279,17 @@ \unexpanded\def\setupcolumnsetlines{\doquintupleempty\dosetupcolumnsettrick[l]} \unexpanded\def\setupcolumnsetstart{\doquintupleempty\dosetupcolumnsettrick[s]} +\installcorenamespace{columnsettag} % temp hack + \def\dosetupcolumnsettrick[#1][#2][#3][#4][#5]% tag id page col value - {% not needed, is already relative - % \doifinstringelse{+}{#3}{\scratchcounter\realpageno}{\scratchcounter\zerocount}% - % \advance\scratchcounter#3\relax % \relax needed - % \setevalue{\??mc:#1:#2:\the\scratchcounter:\number#4}{\number#5}} - \iffifthargument - \setevalue{\??mc:#1:#2:\number#3:\number#4}{\number#5}% + {\iffifthargument + \setevalue{\??columnsettag:#1:#2:\number#3:\number#4}{\number#5}% \else - \setevalue{\??mc:#1:#2:\number#3:0}{\number#4}% + \setevalue{\??columnsettag:#1:#2:\number#3:0}{\number#4}% \fi} -\def\currentcolumnmaxcellstag #1{\??mc:l:\OTRSETidentifier:\columnsetpage:\number#1} -\def\currentcolumnstartcelltag#1{\??mc:s:\OTRSETidentifier:\columnsetpage:\number#1} +\def\currentcolumnmaxcellstag #1{\??columnsettag:l:\OTRSETidentifier:\columnsetpage:\number#1} +\def\currentcolumnstartcelltag#1{\??columnsettag:s:\OTRSETidentifier:\columnsetpage:\number#1} \def\doresetcolumnsetlines#1% {\ifcsname\currentcolumnmaxcellstag{#1}\endcsname @@ -326,7 +337,7 @@ {\ifnum\columnfirstcell>\columnmaxcells\relax \exitloop \else - \OTRSETdoifcellelse{#1}\columnfirstcell + \page_set_cell_doifelse{#1}\columnfirstcell {\global\advance\columnfirstcell\plusone}\exitloop \fi}% \global\columnlastcell\columnfirstcell @@ -334,7 +345,7 @@ {\ifnum\columnlastcell>\columnmaxcells\relax \exitloop \else - \OTRSETdoifcellelse{#1}\columnlastcell + \page_set_cell_doifelse{#1}\columnlastcell {\global\advance\columnlastcell \minusone \exitloop} {\global\advance\columnlastcell \plusone }% \fi}% @@ -365,7 +376,7 @@ \edef\columnmaxcells{\the\scratchcounter}% \scratchcounter\zerocount \dostepwiserecurse{#2}\columnmaxcells\plusone - {\OTRSETdoifcellelse{#1}\recurselevel + {\page_set_cell_doifelse{#1}\recurselevel {\ifnum\columnmaxfreecells<\scratchcounter \edef\columnmaxfreecells{\the\scratchcounter}% \let\columnfrmfreecells\recurselevel @@ -376,7 +387,7 @@ \long\def\OTRSETrecurseRL#1% {\dostepwiserecurse\nofcolumns\plusone\minusone - {#1\hskip\OTRSETgetparameter\c!distance\recurselevel}} + {#1\hskip\namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!distance}} \def\OTRSETmakegridbox {\ifcase\columndirection @@ -387,6 +398,26 @@ \def\OTRSETmakeupwidth{\makeupwidth} % temporary indirectness +\def\page_set_make_background_box + {\begingroup + \d_page_set_local_hsize\OTRSETlocalwidth\recurselevel + \scratchdistance\namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!distance\relax + \edef\currentcolumnset{\currentcolumnset:\recurselevel}% + \letcolumnsetparameter\c!width\d_page_set_local_hsize + \letcolumnsetparameter\c!height\!!heighta + \letcolumnsetparameter\c!lines\empty + \setbox\scratchbox\hbox\inheritedcolumnsetframed{}% maybe \fastlocalframed + \wd\scratchbox\d_page_set_local_hsize + \ht\scratchbox\!!heighta + \ifcase\columndirection + \hskip\scratchdistance + \box\scratchbox + \else + \box\scratchbox + \hskip\scratchdistance + \fi + \endgroup} + \def\OTRSETdomakegridbox#1#2#3% {\hbox\bgroup \dontcomplain @@ -394,22 +425,7 @@ \!!heighta \textheight % test first ! \hbox to \OTRSETmakeupwidth - {\dostepwiserecurse{#1}{#2}{#3} - {\mofcolumns\recurselevel - \d_page_set_local_hsize\OTRSETlocalwidth\mofcolumns - \setbox\scratchbox\hbox\localframed - [\??mc\OTRSETidentifier\number\mofcolumns]% - [\c!width=\d_page_set_local_hsize,\c!height=\!!heighta,\c!lines=]% - {}% - \wd\scratchbox\d_page_set_local_hsize - \ht\scratchbox\!!heighta - \ifcase\columndirection - \hskip\OTRSETgetparameter\c!distance\recurselevel - \box\scratchbox - \else - \box\scratchbox - \hskip\OTRSETgetparameter\c!distance\recurselevel - \fi}}% + {\dostepwiserecurse{#1}{#2}{#3}\page_set_make_background_box}% \hskip-\OTRSETmakeupwidth % main text \hbox to \OTRSETmakeupwidth @@ -431,7 +447,7 @@ \vfill \fi \dorecurse\columnmaxcells - {\setbox\scratchbox\hbox{\OTRSETgetgridcell\mofcolumns\recurselevel}% + {\setbox\scratchbox\hbox{\page_set_cell_get\mofcolumns\recurselevel}% \ht\scratchbox\strutht \dp\scratchbox\strutdp \ifcase\columndirection @@ -456,9 +472,9 @@ \wd\scratchbox\d_page_set_local_hsize % \textwidth \page_marks_synchronize_column{#1}{#2}\recurselevel\scratchbox \ifcase\columndirection - \hskip\OTRSETgetparameter\c!distance\recurselevel\box\scratchbox + \hskip\namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!distance\box\scratchbox \else - \box\scratchbox\hskip\OTRSETgetparameter\c!distance\recurselevel + \box\scratchbox\hskip\namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!distance \fi}}% \egroup} @@ -473,7 +489,7 @@ \!!counta\columnmaxcells \donetrue \doloop - {\dorecurse\nofcolumns{\OTRSETdoifcellelse\recurselevel\!!counta\donefalse\donothing}% + {\dorecurse\nofcolumns{\page_set_cell_doifelse\recurselevel\!!counta\donefalse\donothing}% \ifdone \ifnum\!!counta>\plusone\advance\!!counta\minusone\else\exitloop\fi \else @@ -497,11 +513,11 @@ {\placebottomnotes}% \ifdim\ht\scratchbox>\zeropoint \setbox\scratchbox\hbox - {\hbox to \zeropoint{\OTRSETgetgridcell\nofcolumns\lastcolumnlastcell}% + {\hbox to \zeropoint{\page_set_cell_get\nofcolumns\lastcolumnlastcell}% \box\scratchbox}% \ht\scratchbox\strutht \dp\scratchbox\strutdp - \OTRSETsetgridcell\nofcolumns\lastcolumnlastcell\box\scratchbox + \page_set_cell_set\nofcolumns\lastcolumnlastcell\box\scratchbox \fi \global\lastcolumnlastcell\zerocount \fi} @@ -512,7 +528,7 @@ \else \OTRSETdofinalflush \OTRSETdofinaloutput - \ifnum\columnsetpage>0 + \ifnum\columnsetpage>\zerocount \dorecurse\nofcolumns{\doresetcolumnsetlines\recurselevel}% \fi \doglobal\increment\columnsetpage @@ -568,11 +584,10 @@ \newdimen \OTRSETtextsheight \let \OTRSETidentifier=\empty -\def\OTRSETgetparameter#1#2{\csname\??mc\OTRSETidentifier\number#2#1\endcsname} -\def\OTRSETsetparameter#1#2{\setvalue{\??mc\OTRSETidentifier\number#2#1}} - \def\OTRSETskipstart - {\scratchcounter\executeifdefined{\??mc\OTRSETidentifier\c!start}\zerocount + {\doifelsenothing{\columnsetparameter\c!start} + {\scratchcounter\zerocount}% + {\scratchcounter\columnsetparameter\c!start}% \relax % needed ! \ifcase\scratchcounter\else \advance\scratchcounter\plusone @@ -605,7 +620,7 @@ \hsize\d_page_set_local_hsize} \unexpanded\def\page_set_command_synchronize_hsize - {\ifcase0\getvalue{\??mc\??mc\c!width}\else % some width set + {\ifconditional\c_page_set_width_set \bgroup \scratchdimen\OTRSETlocalwidth\mofcolumns \ifdim\scratchdimen=\textwidth @@ -843,7 +858,7 @@ {\ifnum\columngaplimit>\zerocount \donefalse \dostepwiserecurse{#2}\columnmaxcells\plusone - {\OTRSETdoifcellelse{#1}\recurselevel + {\page_set_cell_doifelse{#1}\recurselevel {\ifdone \!!countb\recurselevel \advance\!!countb -\!!counta\relax \ifnum\!!countb>\plusone @@ -851,7 +866,7 @@ \ifnum\!!countb<\columngaplimit\relax \!!countb\recurselevel \advance\!!countb \minusone \dostepwiserecurse\!!counta\!!countb\plusone - {\OTRSETsetgridcell{#1}\recurselevel\copy\placeholderboxc}% + {\page_set_cell_set{#1}\recurselevel\copy\placeholderboxc}% %\message{[gap]}% \fi \fi @@ -965,7 +980,7 @@ \else \advance\columnhcells \plusone \advance\scratchcounter \plusone - \advance\totalcolumnspace \OTRSETgetparameter\c!distance\scratchcounter + \advance\totalcolumnspace \namedcolumnsetparameter{\currentcolumnset:\number\scratchcounter}\c!distance \fi \else \exitloop @@ -987,9 +1002,9 @@ %\scratchcounter#2\advance\scratchcounter\minusone %\ifnum\scratchcounter>0 % \dostepwiserecurse{#1}\!!countd\plusone -% {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint +% {\ifdim\wd\page_set_cell\recurselevel\scratchcounter>\zeropoint % \let\columnspacetopoffset\plusone -% \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint +% \else\ifdim\dp\page_set_cell\recurselevel\scratchcounter>\zeropoint % \let\columnspacetopoffset\plusone % \fi\fi}% % \advance\!!counte \columnspacetopoffset \relax @@ -1000,9 +1015,9 @@ %\advance\scratchcounter \columnvcells \relax %\ifnum\scratchcounter>\columnmaxcells\else % \dostepwiserecurse{#1}\!!countd\plusone -% {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint +% {\ifdim\wd\page_set_cell\recurselevel\scratchcounter>\zeropoint % \let\columnspacebotoffset\plusone -% \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint +% \else\ifdim\dp\page_set_cell\recurselevel\scratchcounter>\zeropoint % \let\columnspacebotoffset\plusone % \fi\fi}% % \advance\!!counte \columnspacebotoffset \relax @@ -1013,7 +1028,7 @@ \!!countf\recurselevel\relax \dostepwiserecurse{#2}\!!counte\plusone % rows {\ifenoughcolumncells - \OTRSETdoifcellelse\!!countf\recurselevel + \page_set_cell_doifelse\!!countf\recurselevel {\enoughcolumncellsfalse}{}% \fi}% \fi}% @@ -1095,7 +1110,7 @@ \def\OTRSETstoreincolumnslotFXTB#1% fixed column {\OTRSETcheckprefered - \OTRSETdoifcellelse\pofcolumns\plusone + \page_set_cell_doifelse\pofcolumns\plusone {\OTRSETprepareforcolumnslot2}{\OTRSETprepareforcolumnslot1}{#1}% % 1/2 dependent of place, todo \OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed @@ -1104,7 +1119,7 @@ \def\OTRSETstoreincolumnslotFXBT#1% fixed column {\OTRSETcheckprefered - \OTRSETdoifcellelse\pofcolumns\columnmaxcells + \page_set_cell_doifelse\pofcolumns\columnmaxcells {\OTRSETprepareforcolumnslot2}{\OTRSETprepareforcolumnslot3}{#1}% % 3/2 dependent of place, todo \OTRSETflushtextsofar \OTRSETstoreincolumnslotindeed @@ -1350,9 +1365,9 @@ \else % only span if there is a next column with content \dorecurse\columnmaxcells - {\ifdim\ht\OTRSETgridcell\currenthcell\currentvcell>\zeropoint + {\ifdim\ht\page_set_cell\currenthcell\currentvcell>\zeropoint \centergridcellonlyfalse - \else\ifdim\dp\OTRSETgridcell\currenthcell\currentvcell>\zeropoint + \else\ifdim\dp\page_set_cell\currenthcell\currentvcell>\zeropoint \centergridcellonlyfalse \fi\fi}% \fi @@ -1360,10 +1375,10 @@ \currenthcell\recurselevel \dorecurse\columnmaxcells {\currentvcell\recurselevel\relax - \ifdim\ht\OTRSETgridcell\currenthcell\currentvcell>\zeropoint - \ifdim\dp\OTRSETgridcell\currenthcell\currentvcell=\zeropoint + \ifdim\ht\page_set_cell\currenthcell\currentvcell>\zeropoint + \ifdim\dp\page_set_cell\currenthcell\currentvcell=\zeropoint \bgroup - \setbox\scratchbox\OTRSETgetgridcell\currenthcell\currentvcell + \setbox\scratchbox\page_set_cell_get\currenthcell\currentvcell \getnoflines{\ht\scratchbox}% \!!counta\currentvcell \advance\!!counta -\noflines @@ -1380,9 +1395,9 @@ {\if!!doneb \let\xrecurselevel\recurselevel \dostepwiserecurse\!!counta\currentvcell\plusone - {\ifdim\ht\OTRSETgridcell\xrecurselevel\recurselevel>\zeropoint + {\ifdim\ht\page_set_cell\xrecurselevel\recurselevel>\zeropoint \!!donebfalse - \else\ifdim\wd\OTRSETgridcell\xrecurselevel\recurselevel>\zeropoint + \else\ifdim\wd\page_set_cell\xrecurselevel\recurselevel>\zeropoint \!!donebfalse \fi\fi}% \if!!doneb @@ -1392,11 +1407,11 @@ \totalcolumnspace\OTRSETlocalwidth\currenthcell \dostepwiserecurse\!!countc\!!countb\plusone {\advance\totalcolumnspace \OTRSETlocalwidth\recurselevel - \advance\totalcolumnspace \OTRSETgetparameter\c!distance\recurselevel}% + \advance\totalcolumnspace \namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!distance}% \ifdim\totalcolumnspace>\wd\scratchbox \setbox\scratchbox\hbox to \totalcolumnspace{\hss\box\scratchbox\hss}% \fi - \OTRSETsetgridcell\currenthcell\currentvcell\box\scratchbox + \page_set_cell_set\currenthcell\currentvcell\box\scratchbox \egroup \fi \fi}}% @@ -1405,8 +1420,8 @@ \def\OTRSETinitializecolumns% once per page {\columnspreadtrue % todo \ifcolumnspread - \global\rofcolumns\getvalue{\??mc\OTRSETidentifier\c!nright}% - \global\lofcolumns\getvalue{\??mc\OTRSETidentifier\c!nleft}% + \global\rofcolumns\columnsetparameter\c!nright + \global\lofcolumns\columnsetparameter\c!nleft \global\tofcolumns\rofcolumns \relax \ifodd\realpageno\relax \global\nofcolumns\rofcolumns @@ -1415,67 +1430,70 @@ \global\nofcolumns\lofcolumns \fi \else - \global\nofcolumns\getvalue{\??mc\OTRSETidentifier\c!n}% + \global\nofcolumns\columnsetparameter\c!n \global\rofcolumns\nofcolumns \global\lofcolumns\nofcolumns \global\tofcolumns\nofcolumns \fi \OTRSETassignwidths \global\mofcolumns\plusone - \columnerasegridboxes} + \page_set_cell_erase_grid} -% vanaf hier: - -\unexpanded\def\definecolumnset - {\dodoubleargument\dodefinecolumnset} - -\def\dodefinecolumnset[#1][#2]% - {\getparameters[\??mc#1] - [\c!direction=\v!right, - \c!balance=\v!no, - \c!distance=1.5\bodyfontsize, % controleren - \c!n=2, - \c!nleft=\getvalue{\??mc#1\c!n}, - \c!nright=\getvalue{\??mc#1\c!n}, - \c!width=\v!fit, - \c!lines=0, - \c!start=0, - #2]% - \dorecurse{\getvalue{\??mc#1\c!nleft}} % todo - {\dododefinecolumnset[#1][\recurselevel]}% - \dorecurse{\getvalue{\??mc#1\c!nright}} % todo - {\dododefinecolumnset[#1][\recurselevel]}% - % redo framed settings - \setupcolumnset[#1][1][\c!distance=\zeropoint]} - -\def\dododefinecolumnset[#1][#2]% - {\presetlocalframed - [\??mc#1#2]% - \setupcolumnset - [#1][#2] - [\c!offset=\v!overlay, - \c!frame=\v!off, - \c!align=, - \c!lines=0,% really needed since c!regels is now part of framed - \c!width=\getvalue{\??mc#1\c!width}, - \c!distance=\getvalue{\??mc#1\c!distance}]} +% this is a first step in upgrading + +\installcorenamespace{columnset} + +\installframedcommandhandler \??columnset {columnset} \??columnset + +\setupcolumnset % todo, use the rather basic backgroundframed + [\c!direction=\v!right, + \c!balance=\v!no, + \c!distance=1.5\bodyfontsize, + \c!n=2, + \c!nleft=\columnsetparameter\c!n, + \c!nright=\columnsetparameter\c!n, + \c!width=\v!fit, + \c!lines=0, + \c!start=0, + \c!frame=\v!off, + \c!offset=\v!overlay, + \c!frame=\v!off, + \c!align=, + \c!lines=0] + +\let\page_set_setup_saved\setupcolumnset + +\newconditional\c_page_set_defining + +\appendtoks + \ifconditional\c_page_set_defining \else + \settrue\c_page_set_defining + \dorecurse{\columnsetparameter\c!nleft} + {\normalexpanded{\definecolumnset[\currentcolumnset:\recurselevel][\currentcolumnset]}}% + \dorecurse{\columnsetparameter\c!nright} + {\normalexpanded{\definecolumnset[\currentcolumnset:\recurselevel][\currentcolumnset]}}% + \normalexpanded{\page_set_setup_saved[\currentcolumnset:1][\c!distance=\zeropoint]}% + \setfalse\c_page_set_defining + \fi +\to \everydefinecolumnset \unexpanded\def\setupcolumnset - {\dotripleargument\dosetupcolumnset} + {\dotripleargument\page_set_setup} -\def\dosetupcolumnset[#1][#2][#3]% +\def\page_set_setup[#1][#2][#3]% {\ifthirdargument - \def\docommand##1% + \unexpanded\def\page_set_setup_step##1% {\doifelse{##1}\v!each - {\dorecurse{\getvalue{\??mc#1\c!n}}{\docommand\recurselevel}} - {\getparameters[\??mc#1##1][#3]}}% - \processcommalist[#2]\docommand + {\dorecurse{\namedcolumnsetparameter{#1}\c!n}{\page_set_setup_step\recurselevel}} + {\normalexpanded{\page_set_setup_saved[#1:\recurselevel]}[#3]}}% + \processcommalist[#2]\page_set_setup_step \else - \getparameters[\??mc#1][#2]% + \page_set_setup_saved[#1][#2]% \fi} - -\definecolumnset[\s!default][\c!n=2] % fallback - + +\definecolumnset + [\s!default] + \unexpanded\def\page_set_command_next_page {\page_otr_fill_and_eject_page \relax\ifnum\mofcolumns>\plusone @@ -1487,7 +1505,6 @@ \let\page_set_command_next_page_and_inserts\page_set_command_next_page - \def\OTRSETgotocolumn {\dosingleempty\doOTRSETgotocolumn} @@ -1517,7 +1534,7 @@ \currenthcell\mofcolumns \currentvcell#1\advance\currentvcell \minusone \dorecurse\currentvcell - {\OTRSETdoifcellelse\mofcolumns\recurselevel\donothing + {\page_set_cell_doifelse\mofcolumns\recurselevel\donothing {\advance\scratchcounter\plusone}} \getnoflines\pagetotal \advance\scratchcounter-\noflines @@ -1564,7 +1581,7 @@ % \currenthcell\mofcolumns % \currentvcell#2\advance\currentvcell \minusone % \dorecurse\currentvcell -% {\OTRSETdoifcellelse\mofcolumns\recurselevel\donothing +% {\page_set_cell_doifelse\mofcolumns\recurselevel\donothing % {\advance\scratchcounter\plusone}} % \getnoflines\pagetotal % \advance\scratchcounter-\noflines @@ -1627,7 +1644,7 @@ % \stoptext \def\OTRSETflushleftovers % new per 13/4/2006 - {\OTRSETdoifcellelse{1}{1} + {\page_set_cell_doifelse\plusone\plusone {\bgroup \OTRSETcentergridcells \OTRSETbalancemethod\plusone @@ -1742,8 +1759,8 @@ {\doifsomething\OTRSETlist {\getfromcommacommand[\OTRSETlist][1]% \global\let\OTRSETidentifier\commalistelement - \doifundefined{\??mc\OTRSETidentifier\c!n} - {\globallet\OTRSETidentifier\s!default}% + \xdef\currentcolumnset{\commalistelement}% + \checkcolumnsetparent \let\newcommalistelement\empty \doglobal\replaceincommalist\OTRSETlist1% \OTRSETrestart}} @@ -1769,8 +1786,8 @@ \OTRSETsetcorrectnofcells\currentcolumnstartcell \advance\scratchcounter \minusone \dorecurse\scratchcounter - {\OTRSETdoifcellelse\mofcolumns\recurselevel - \donothing{\OTRSETsetgridcell\mofcolumns\recurselevel\copy\placeholderboxe}}% + {\page_set_cell_doifelse\mofcolumns\recurselevel + \donothing{\page_set_cell_set\mofcolumns\recurselevel\copy\placeholderboxe}}% \egroup}} \unexpanded\def\page_set_command_routine @@ -1795,13 +1812,13 @@ % new: raw \OTRSETsetcolumnmaxcells % direction - \doifelsevalue{\??mc\OTRSETidentifier\c!direction}\v!right + \doifelse{\columnsetparameter\c!direction}\v!right {\columndirection\zerocount} {\columndirection\plusone}% % balancing \OTRSETbalancemethod\zerocount \processaction - [\getvalue{\??mc\OTRSETidentifier\c!balance}] + [\columnsetparameter\c!balance] [ \v!yes=>\OTRSETbalancemethod\plusone, \v!top=>\OTRSETbalancemethod\plustwo, \v!bottom=>\OTRSETbalancemethod\plusthree]} @@ -1911,29 +1928,31 @@ % interface to footnotes +\installcorenamespace{columnsetwidth} + \def\OTRSETassignwidths {%\scratchdimen\makeupwidth \freezetextwidth \scratchdimen\textwidth % \scratchcounter\zerocount \dorecurse\nofcolumns - {\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!width}\v!fit - {\advance\scratchcounter \plusone } - {\advance\scratchdimen -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!width}}% - \advance\scratchdimen -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!distance}}% + {\doifelse{\namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!width}\v!fit + {\advance\scratchcounter \plusone} + {\advance\scratchdimen -\namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!width}% + \advance\scratchdimen -\namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!distance}% \ifcase\scratchcounter\else \divide\scratchdimen \scratchcounter \fi - \setgvalue{\??mc\??mc\c!width}{0}% + \global\setfalse\c_page_set_width_set \dorecurse\nofcolumns - {\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!width}\v!fit + {\doifelse{\namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!width}\v!fit {\dimen0=\scratchdimen} - {\setgvalue{\??mc\??mc\c!width}{1}% - \dimen0=\getvalue{\??mc\OTRSETidentifier\recurselevel\c!width}}% - \setxvalue{\??mc\recurselevel\??mc\c!width}{\the\dimen0}}} + {\global\settrue\c_page_set_width_set + \dimen0=\namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!width}% + \setxvalue{\??columnsetwidth\recurselevel}{\the\dimen0}}} \def\OTRSETlocalwidth#1% - {\getvalue{\??mc\number#1\??mc\c!width}} + {\getvalue{\??columnsetwidth\number#1}} \newbox\placeholderboxa \newbox\placeholderboxb @@ -2154,6 +2173,8 @@ % links rechts => odd, even, n, named +\definesystemvariable {mt} % MulTicolumn + \unexpanded\def\definecolumntextarea {\dotripleempty\dodefinecolumntextarea} @@ -2330,7 +2351,7 @@ \c!height=\!!heighta]% {\copy\scratchbox}% \fi}% - \OTRSETsetgridcell\!!counta\!!countb\box0 + \page_set_cell_set\!!counta\!!countb\box0 \ifcase\!!countc\else \advance\!!counta \columntextareaparameter\c!nx \advance\!!counta -\!!countc @@ -2347,7 +2368,7 @@ \c!height=\!!heighta,% \c!hoffset=\!!widthb]% {\copy\scratchbox}}% - \OTRSETsetgridcell\!!counta\!!countb\box0% + \page_set_cell_set\!!counta\!!countb\box0% \fi} \unexpanded\def\setupcolumntextareatext @@ -2385,7 +2406,7 @@ \fi \advance\!!counta \plusone \dostepwiserecurse\!!counta\!!countb\plusone - {\advance\!!widtha\OTRSETgetparameter\c!distance\recurselevel}% + {\advance\!!widtha\namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!distance}% \!!widthb\!!widtha \advance\!!widthb -\!!countc\textwidth \ifodd\realpageno \else % tricky, assumes that we keep there @@ -2395,7 +2416,7 @@ \advance\!!widtha \namedlayoutparameter\v!odd \c!backspace \advance\!!widthb \namedlayoutparameter\v!even\c!backspace \dorecurse\!!countc - {\advance\!!widtha\OTRSETgetparameter\c!distance\recurselevel}% + {\advance\!!widtha\namedcolumnsetparameter{\currentcolumnset:\recurselevel}\c!distance}% \fi \fi} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 5b66e2e1f..d2407bdd9 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 378d9be23..a410bf055 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index fb3d0fe82..081dbca80 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 07/23/12 20:18:32 +-- merge date : 07/24/12 10:59:59 do -- begin closure to overcome local limits and interference |