diff options
author | Hans Hagen <pragma@wxs.nl> | 2013-08-20 12:31:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2013-08-20 12:31:00 +0200 |
commit | 488ee4c3ae53b13303679b2df068134b0051bc53 (patch) | |
tree | ddef27e9bae66aef659884d5a954a6be98bd0f14 | |
parent | 401de1c2c872bea063a085a2128c7ef7ae122b61 (diff) | |
download | context-488ee4c3ae53b13303679b2df068134b0051bc53.tar.gz |
beta 2013.08.20 12:31
36 files changed, 426 insertions, 346 deletions
diff --git a/context/data/scite/lexers/data/scite-context-data-metapost.lua b/context/data/scite/lexers/data/scite-context-data-metapost.lua index df97c0a26..55003c237 100644 --- a/context/data/scite/lexers/data/scite-context-data-metapost.lua +++ b/context/data/scite/lexers/data/scite-context-data-metapost.lua @@ -1,7 +1,7 @@ return { ["commands"]={ "beginfig", "endfig", "rotatedaround", "reflectedabout", "arrowhead", "currentpen", "currentpicture", "cuttings", "defaultfont", "extra_beginfig", "extra_endfig", "ditto", "EOF", "down", "evenly", "fullcircle", "halfcircle", "identity", "in", "left", "origin", "pensquare", "quartercircle", "right", "unitsquare", "up", "withdots", "abs", "bbox", "ceiling", "center", "cutafter", "cutbefore", "dir", "directionpoint", "div", "dotprod", "intersectionpoint", "inverse", "mod", "round", "unitvector", "whatever", "cutdraw", "draw", "drawarrow", "drawdblarrow", "fill", "filldraw", "drawdot", "loggingall", "interact", "tracingall", "tracingnone", "pickup", "undraw", "unfill", "unfilldraw", "buildcycle", "dashpattern", "decr", "dotlabel", "dotlabels", "drawoptions", "incr", "label", "labels", "max", "min", "thelabel", "z", "beginchar", "blacker", "capsule_end", "change_width", "define_blacker_pixels", "define_corrected_pixels", "define_good_x_pixels", "define_good_y_pixels", "define_horizontal_corrected_pixels", "define_pixels", "define_whole_blacker_pixels", "define_whole_pixels", "define_whole_vertical_blacker_pixels", "define_whole_vertical_pixels", "endchar", "extra_beginchar", "extra_endchar", "extra_setup", "font_coding_scheme", "clearxy", "clearit", "clearpen", "shipit", "font_extra_space", "exitunless", "relax", "hide", "gobble", "gobbled", "stop", "blankpicture", "counterclockwise", "tensepath", "takepower", "direction", "softjoin", "makelabel", "rotatedabout", "flex", "superellipse", "erase", "image", "nullpen", "savepen", "clearpen", "penpos", "penlabels", "range", "numtok", "thru", "z", "laboff", "bye", "red", "green", "blue", "cyan", "magenta", "yellow", "black", "white", "background", "graypart", "graycolor", "mm", "pt", "dd", "bp", "cm", "pc", "cc", "in" }, ["internals"]={ "mitered", "rounded", "beveled", "butt", "squared", "eps", "epsilon", "infinity", "bboxmargin", "ahlength", "ahangle", "labeloffset", "dotlabeldiam", "defaultpen", "defaultscale", "join_radius", "pen_lft", "pen_rt", "pen_top", "pen_bot" }, - ["primitives"]={ "charcode", "day", "linecap", "linejoin", "miterlimit", "month", "pausing", "prologues", "showstopping", "time", "tracingcapsules", "tracingchoices", "mpprocset", "tracingcommands", "tracingequations", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingrestores", "tracingspecs", "tracingstats", "tracingtitles", "truecorners", "warningcheck", "year", "false", "nullpicture", "pencircle", "true", "and", "angle", "arclength", "arctime", "ASCII", "boolean", "bot", "char", "color", "cosd", "cycle", "decimal", "directiontime", "floor", "fontsize", "hex", "infont", "intersectiontimes", "known", "length", "llcorner", "lrcorner", "makepath", "makepen", "mexp", "mlog", "normaldeviate", "not", "numeric", "oct", "odd", "or", "path", "pair", "pen", "penoffset", "picture", "point", "postcontrol", "precontrol", "reverse", "rotated", "scaled", "shifted", "sind", "slanted", "sqrt", "str", "string", "subpath", "substring", "transform", "transformed", "ulcorner", "uniformdeviate", "unknown", "urcorner", "xpart", "xscaled", "xxpart", "xypart", "ypart", "yscaled", "yxpart", "yypart", "zscaled", "addto", "clip", "input", "interim", "let", "newinternal", "save", "setbounds", "shipout", "show", "showdependencies", "showtoken", "showvariable", "special", "begingroup", "endgroup", "of", "curl", "tension", "and", "controls", "interpath", "on", "off", "def", "vardef", "enddef", "expr", "suffix", "text", "primary", "secondary", "tertiary", "primarydef", "secondarydef", "tertiarydef", "randomseed", "also", "contour", "doublepath", "withcolor", "withpen", "dashed", "if", "else", "elseif", "fi", "for", "endfor", "forever", "exitif", "within", "forsuffixes", "downto", "upto", "step", "until", "charlist", "extensible", "fontdimen", "headerbyte", "kern", "ligtable", "boundarychar", "chardp", "charext", "charht", "charic", "charwd", "designsize", "fontmaking", "charexists", "cullit", "currenttransform", "gfcorners", "grayfont", "hround", "imagerules", "lowres_fix", "nodisplays", "notransforms", "openit", "displaying", "currentwindow", "screen_rows", "screen_cols", "pixels_per_inch", "cull", "display", "openwindow", "numspecial", "totalweight", "autorounding", "fillin", "proofing", "tracingpens", "xoffset", "chardx", "granularity", "smoothing", "turningcheck", "yoffset", "chardy", "hppp", "tracingedges", "vppp", "extra_beginfig", "extra_endfig", "mpxbreak", "endinput", "message", "delimiters", "turningnumber", "errmessage", "readstring", "scantokens", "end", "outer", "inner", "write", "to", "readfrom", "withprescript", "withpostscript", "top", "bot", "lft", "rt", "ulft", "urt", "llft", "lrt", "redpart", "greenpart", "bluepart", "cyanpart", "magentapart", "yellowpart", "blackpart", "greypart", "rgbcolor", "cmykcolor", "greycolor", "graycolor", "colormodel", "graypart", "dashpart", "penpart", "stroked", "filled", "textual", "clipped", "bounded", "expandafter" }, + ["primitives"]={ "charcode", "day", "linecap", "linejoin", "miterlimit", "month", "pausing", "prologues", "showstopping", "time", "tracingcapsules", "tracingchoices", "mpprocset", "tracingcommands", "tracingequations", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingrestores", "tracingspecs", "tracingstats", "tracingtitles", "truecorners", "warningcheck", "year", "false", "nullpicture", "pencircle", "true", "and", "angle", "arclength", "arctime", "ASCII", "boolean", "bot", "char", "color", "cosd", "cycle", "decimal", "directiontime", "floor", "fontsize", "hex", "infont", "intersectiontimes", "known", "length", "llcorner", "lrcorner", "makepath", "makepen", "mexp", "mlog", "normaldeviate", "not", "numeric", "oct", "odd", "or", "path", "pair", "pen", "penoffset", "picture", "point", "postcontrol", "precontrol", "reverse", "rotated", "scaled", "shifted", "sind", "slanted", "sqrt", "str", "string", "subpath", "substring", "transform", "transformed", "ulcorner", "uniformdeviate", "unknown", "urcorner", "xpart", "xscaled", "xxpart", "xypart", "ypart", "yscaled", "yxpart", "yypart", "zscaled", "addto", "clip", "input", "interim", "let", "newinternal", "save", "setbounds", "shipout", "show", "showdependencies", "showtoken", "showvariable", "special", "begingroup", "endgroup", "of", "curl", "tension", "and", "controls", "interpath", "on", "off", "def", "vardef", "enddef", "expr", "suffix", "text", "primary", "secondary", "tertiary", "primarydef", "secondarydef", "tertiarydef", "randomseed", "also", "contour", "doublepath", "withcolor", "withpen", "dashed", "if", "else", "elseif", "fi", "for", "endfor", "forever", "exitif", "within", "forsuffixes", "downto", "upto", "step", "until", "charlist", "extensible", "fontdimen", "headerbyte", "kern", "ligtable", "boundarychar", "chardp", "charext", "charht", "charic", "charwd", "designsize", "fontmaking", "charexists", "cullit", "currenttransform", "gfcorners", "grayfont", "hround", "imagerules", "lowres_fix", "nodisplays", "notransforms", "openit", "displaying", "currentwindow", "screen_rows", "screen_cols", "pixels_per_inch", "cull", "display", "openwindow", "numspecial", "totalweight", "autorounding", "fillin", "proofing", "tracingpens", "xoffset", "chardx", "granularity", "smoothing", "turningcheck", "yoffset", "chardy", "hppp", "tracingedges", "vppp", "extra_beginfig", "extra_endfig", "mpxbreak", "endinput", "message", "delimiters", "turningnumber", "errmessage", "readstring", "scantokens", "end", "outer", "inner", "write", "to", "readfrom", "withprescript", "withpostscript", "top", "bot", "lft", "rt", "ulft", "urt", "llft", "lrt", "redpart", "greenpart", "bluepart", "cyanpart", "magentapart", "yellowpart", "blackpart", "greypart", "rgbcolor", "cmykcolor", "greycolor", "graycolor", "colormodel", "graypart", "dashpart", "penpart", "stroked", "filled", "textual", "clipped", "bounded", "pathpart", "expandafter" }, ["shortcuts"]={ "..", "...", "--", "---", "&" }, ["tex"]={ "btex", "etex", "verbatimtex" }, }
\ No newline at end of file diff --git a/context/data/scite/lexers/themes/scite-context-theme.lua b/context/data/scite/lexers/themes/scite-context-theme.lua index e32fe9dee..6e161b22f 100644 --- a/context/data/scite/lexers/themes/scite-context-theme.lua +++ b/context/data/scite/lexers/themes/scite-context-theme.lua @@ -192,9 +192,12 @@ context.styleset = styleset function context.stylesetcopy() local t = { } for i=1,#styleset do - t[i] = styleset[i] + local s = styleset[i] + t[i] = s +t[s[1]] = t[s[2]] -- new style ? end t[#t+1] = { "whitespace", style_nothing } +t.whitespace = style_nothing -- new style ? return t end diff --git a/context/data/scite/scite-context-data-metapost.properties b/context/data/scite/scite-context-data-metapost.properties index 5566a3865..ad0de9dec 100644 --- a/context/data/scite/scite-context-data-metapost.properties +++ b/context/data/scite/scite-context-data-metapost.properties @@ -87,7 +87,7 @@ greenpart bluepart cyanpart magentapart yellowpart \ blackpart greypart rgbcolor cmykcolor greycolor \ graycolor colormodel graypart dashpart penpart \ stroked filled textual clipped bounded \ -expandafter +pathpart expandafter keywordclass.metapost.shortcuts=\ .. ... -- --- \ diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mp-tool.mpiv index a6b39bfe3..10549468f 100644 --- a/metapost/context/base/mp-tool.mpiv +++ b/metapost/context/base/mp-tool.mpiv @@ -192,32 +192,32 @@ def newpair text v = forsuffixes i=v : save i ; pair i ; endfor ; endd %D box, draw the graphics that may not count, and restore the %D bounding box. %D -%D \starttypen +%D \starttyping %D push_boundingbox currentpicture; %D pop_boundingbox currentpicture; -%D \stoptypen +%D \stoptyping %D %D The bounding box can be called with: %D -%D \starttypen +%D \starttyping %D boundingbox currentpicture %D inner_boundingbox currentpicture %D outer_boundingbox currentpicture -%D \stoptypen +%D \stoptyping %D %D Especially the latter one can be of use when we include %D the graphic in a document that is clipped to the bounding %D box. In such occasions one can use: %D -%D \starttypen +%D \starttyping %D set_outer_boundingbox currentpicture; -%D \stoptypen +%D \stoptyping %D %D Its counterpart is: %D -%D \starttypen +%D \starttyping %D set_inner_boundingbox p -%D \stoptypen +%D \stoptyping path mfun_boundingbox_stack ; numeric mfun_boundingbox_stack_depth ; @@ -321,67 +321,209 @@ vardef cosh primary x = save xx ; xx = exp x ; (xx+1/xx)/2 enddef ; %D the second argument identifier the way the shape is to be %D drawn. %D -%D \starttypen +%D \starttyping %D stripe_path_n %D (dashed evenly withcolor blue) %D (filldraw) %D fullcircle xscaled 100 yscaled 40 shifted (50,50) withpen pencircle scaled 4; -%D \stoptypen +%D \stoptyping %D %D The a (or angle) alternative supports arbitrary angles and %D is therefore more versatile. %D -%D \starttypen +%D \starttyping %D stripe_path_a %D (withpen pencircle scaled 2 withcolor red) %D (draw) %D fullcircle xscaled 100 yscaled 40 withcolor blue; -%D \stoptypen +%D \stoptyping +%D +%D We have two alternatives, controlled by arguments or defaults (when arguments +%D are zero). +%D +%D The newer and nicer interface is used as follows (triggered by a question by Mari): +%D +%D \starttyping +%D draw image (draw fullcircle scaled 3cm shifted (0cm,0cm) withcolor green) numberstriped (1,10,3) withcolor red ; +%D draw image (draw fullcircle scaled 3cm shifted (3cm,0cm) withcolor green) numberstriped (2,20,3) withcolor green ; +%D draw image (draw fullcircle scaled 3cm shifted (3cm,3cm) withcolor green) numberstriped (3,10,5) withcolor blue ; +%D draw image (draw fullcircle scaled 3cm shifted (0cm,3cm) withcolor green) numberstriped (4,20,5) withcolor yellow ; +%D +%D draw image (draw fullcircle scaled 3cm shifted (6cm,0cm) withcolor green) anglestriped (1,20,2) withcolor red ; +%D draw image (draw fullcircle scaled 3cm shifted (9cm,0cm) withcolor green) anglestriped (2,40,2) withcolor green ; +%D draw image (draw fullcircle scaled 3cm shifted (9cm,3cm) withcolor green) anglestriped (3,60,2) withcolor blue ; +%D draw image (draw fullcircle scaled 3cm shifted (6cm,3cm) withcolor green) anglestriped (4,80,2) withcolor yellow ; +%D +%D draw image ( +%D draw fullcircle scaled 3cm shifted (0cm,0cm) withcolor green withpen pencircle scaled 2mm ; +%D draw fullcircle scaled 2cm shifted (0cm,1cm) withcolor blue withpen pencircle scaled 3mm ; +%D ) shifted (9cm,0cm) numberstriped (1,10,3) withcolor red ; +%D +%D draw image ( +%D draw fullcircle scaled 3cm shifted (0cm,0cm) withcolor green withpen pencircle scaled 2mm ; +%D draw fullcircle scaled 2cm shifted (0cm,1cm) withcolor blue withpen pencircle scaled 3mm ; +%D ) shifted (12cm,0cm) numberstriped (2,10,3) withcolor red ; %D -%D The first alternative obeys: +%D draw image ( +%D draw fullcircle scaled 3cm shifted (0cm,0cm) withcolor green withpen pencircle scaled 2mm ; +%D draw fullcircle scaled 2cm shifted (0cm,1cm) withcolor blue withpen pencircle scaled 3mm ; +%D ) shifted (9cm,5cm) numberstriped (3,10,3) withcolor red ; +%D +%D draw image ( +%D draw fullcircle scaled 3cm shifted (0cm,0cm) withcolor green withpen pencircle scaled 2mm ; +%D draw fullcircle scaled 2cm shifted (0cm,1cm) withcolor blue withpen pencircle scaled 3mm ; +%D ) shifted (12cm,5cm) numberstriped (4,10,3) withcolor red ; +%D \stoptyping stripe_n := 10; stripe_slot := 3; +stripe_gap := 5; +stripe_angle := 45; -%D When no pen dimensions are passed, the slot determines -%D the spacing. -%D -%D The angle alternative is influenced by: +def mfun_tool_striped_number_action text extra = + for i = 1/used_n step 1/used_n until 1 : + draw point (1+i) of bounds -- point (3-i) of bounds withpen pencircle scaled penwidth extra ; + endfor ; + for i = 0 step 1/used_n until 1 : + draw point (3+i) of bounds -- point (1-i) of bounds withpen pencircle scaled penwidth extra ; + endfor ; +enddef ; -% to be redone: use image +def mfun_tool_striped_set_options(expr option) = + save isinner, swapped ; + boolean isinner, swapped ; + if option = 1 : + isinner := false ; + swapped := false ; + elseif option = 2 : + isinner := true ; + swapped := false ; + elseif option = 3 : + isinner := false ; + swapped := true ; + elseif option = 4 : + isinner := true ; + swapped := true ; + else : + isinner := false ; + swapped := false ; + fi ; +enddef ; -stripe_gap := 5; -stripe_angle := 45; +vardef mfun_tool_striped_number(expr option, p, s_n, s_slot) text extra = + image ( + begingroup ; + save pattern, shape, bounds, penwidth, used_n, used_slot ; + picture pattern, shape ; path bounds ; numeric used_s, used_slot ; + mfun_tool_striped_set_options(option) ; + used_slot := if s_slot = 0 : stripe_slot else : s_slot fi ; + used_n := if s_n = 0 : stripe_n else : s_n fi ; + shape := image(draw p) ; + bounds := boundingbox shape ; + penwidth := min(ypart urcorner shape - ypart llcorner shape, xpart urcorner shape - xpart llcorner shape) / (used_slot * used_n) ; + pattern := image ( + if isinner : + mfun_tool_striped_number_action extra ; + for s within shape : + if stroked s or filled s : + clip currentpicture to pathpart s ; + fi + endfor ; + else : + for s within shape : + if stroked s or filled s : + draw image ( + mfun_tool_striped_number_action extra ; + clip currentpicture to pathpart s ; + ) ; + fi ; + endfor ; + fi ; + ) ; + if swapped : + addto currentpicture also shape ; + addto currentpicture also pattern ; + else : + addto currentpicture also pattern ; + addto currentpicture also shape ; + fi ; + endgroup ; + ) +enddef ; + +def mfun_tool_striped_angle_action text extra = + for i = minimum -.5used_gap step used_gap until maximum : + draw (minimum,i) -- (maximum,i) extra ; + endfor ; + currentpicture := currentpicture rotated used_angle ; +enddef ; + +vardef mfun_tool_striped_angle(expr option, p, s_angle, s_gap) text extra = + image ( + begingroup ; + save pattern, shape, mask, maximum, minimum, centrum, used_angle, used_gap ; + picture pattern, shape, mask ; numeric maximum, minimum ; pair centrum ; numeric used_angle, used_gap ; + mfun_tool_striped_set_options(option) ; + used_angle := if s_angle = 0 : stripe_angle else : s_angle fi ; + used_gap := if s_gap = 0 : stripe_gap else : s_gap fi ; + shape := image(draw p) ; + centrum := center shape ; + shape := shape shifted - centrum ; + mask := shape rotated used_angle ; + maximum := max (xpart llcorner mask, xpart urcorner mask, ypart llcorner mask, ypart urcorner mask) ; + minimum := min (xpart llcorner mask, xpart urcorner mask, ypart llcorner mask, ypart urcorner mask) ; + pattern := image ( + if isinner : + mfun_tool_striped_angle_action extra ; + for s within shape : + if stroked s or filled s : + clip currentpicture to pathpart s ; + fi + endfor ; + else : + for s within shape : + if stroked s or filled s : + draw image ( + mfun_tool_striped_angle_action extra ; + clip currentpicture to pathpart s ; + ) ; + fi ; + endfor ; + fi ; + ) ; + if swapped : + addto currentpicture also shape ; + addto currentpicture also pattern ; + else : + addto currentpicture also pattern ; + addto currentpicture also shape ; + fi ; + currentpicture := currentpicture shifted - centrum ; + endgroup ; + ) +enddef; + +newinternal striped_normal_inner ; striped_normal_inner := 1 ; +newinternal striped_reverse_inner ; striped_reverse_inner := 2 ; +newinternal striped_normal_outer ; striped_normal_outer := 3 ; +newinternal striped_reverse_outer ; striped_reverse_outer := 4 ; + +secondarydef p anglestriped s = + mfun_tool_striped_angle(redpart s,p,greenpart s,bluepart s) +enddef ; + +secondarydef p numberstriped s = + mfun_tool_striped_number(redpart s,p,greenpart s,bluepart s) +enddef ; + +% for old times sake: def stripe_path_n (text s_spec) (text s_draw) expr s_path = do_stripe_path_n (s_spec) (s_draw) (s_path) enddef; def do_stripe_path_n (text s_spec) (text s_draw) (expr s_path) text s_text = - begingroup ; - save curpic, newpic, bb, pp, ww ; - picture curpic, newpic ; - path bb, pp ; - pp := s_path ; - curpic := currentpicture ; - currentpicture := nullpicture ; - s_draw pp s_text ; - bb := boundingbox currentpicture ; - newpic := currentpicture ; - currentpicture := nullpicture; - ww := min(ypart urcorner newpic - ypart llcorner newpic,xpart urcorner newpic - xpart llcorner newpic) ; - ww := ww/(stripe_slot*stripe_n) ; - for i=1/stripe_n step 1/stripe_n until 1 : - draw point (1+i) of bb -- point (3-i) of bb withpen pencircle scaled ww s_spec ; - endfor ; - for i=0 step 1/stripe_n until 1 : - draw point (3+i) of bb -- point (1-i) of bb withpen pencircle scaled ww s_spec; - endfor ; - clip currentpicture to pp ; - addto newpic also currentpicture ; - currentpicture := curpic ; - addto currentpicture also newpic ; - endgroup ; + draw image(s_draw s_path s_text) numberstriped(3,0,0) s_spec ; enddef ; def stripe_path_a (text s_spec) (text s_draw) expr s_path = @@ -389,33 +531,8 @@ def stripe_path_a (text s_spec) (text s_draw) expr s_path = enddef; def do_stripe_path_a (text s_spec) (text s_draw) (expr s_path) text s_text = - begingroup ; - save curpic, newpic, pp; picture curpic, newpic; path pp ; - pp := s_path ; - curpic := currentpicture ; - currentpicture := nullpicture ; - s_draw pp s_text ; - def do_stripe_rotation (expr p) = - (currentpicture rotatedaround(center p,stripe_angle)) - enddef ; - s_max := max ( - xpart llcorner do_stripe_rotation(currentpicture), - xpart urcorner do_stripe_rotation(currentpicture), - ypart llcorner do_stripe_rotation(currentpicture), - ypart urcorner do_stripe_rotation(currentpicture) - ) ; - newpic := currentpicture ; - currentpicture := nullpicture ; - for i=-s_max-.5stripe_gap step stripe_gap until s_max : - draw (-s_max,i)--(s_max,i) s_spec ; - endfor ; - currentpicture := do_stripe_rotation(newpic) ; - clip currentpicture to pp ; - addto newpic also currentpicture ; - currentpicture := curpic ; - addto currentpicture also newpic ; - endgroup ; -enddef; + draw image(s_draw s_path s_text) anglestriped(3,0,0) s_spec ; +enddef ; %D A few normalizing macros: @@ -1165,10 +1282,10 @@ def centerarrow (expr pat,tim,len) = pointarrow(pat,tim,len, 0) enddef ; %D The \type {along} and \type {on} operators can be used %D as follows: %D -%D \starttypen +%D \starttyping %D drawdot point .5 along somepath ; %D drawdot point 3cm on somepath ; -%D \stoptypen +%D \stoptyping %D %D The number denotes a percentage (fraction). @@ -1225,9 +1342,9 @@ vardef freedotlabel (expr str, loc, ori) = draw thefreelabel(str,loc,ori) ; enddef ; -%D \starttypen +%D \starttyping %D drawarrow anglebetween(line_a,line_b,somelabel) ; -%D \stoptypen +%D \stoptyping newinternal angleoffset ; angleoffset := 0pt ; newinternal anglelength ; anglelength := 20pt ; diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua index 86e6eef2a..7902ad95a 100644 --- a/tex/context/base/char-def.lua +++ b/tex/context/base/char-def.lua @@ -990,7 +990,7 @@ characters.data={ direction="on", linebreak="op", mathclass="open", - mathname="lbrack", + mathname="lbracket", mirror=0x005D, unicodeslot=0x005B, }, @@ -1014,7 +1014,7 @@ characters.data={ direction="on", linebreak="cp", mathclass="close", - mathname="rbrack", + mathname="rbracket", mirror=0x005B, unicodeslot=0x005D, }, @@ -61520,6 +61520,8 @@ characters.data={ description="NABLA", direction="on", linebreak="ai", + mathclass="default", + mathname="nabla", unicodeslot=0x2207, }, [0x2208]={ @@ -61746,8 +61748,20 @@ characters.data={ description="SQUARE ROOT", direction="on", linebreak="ai", - mathclass="radical", - mathname="surd", + mathspec={ + { + class="root", + name="rootradical", + }, + { + class="radical", + name="surdradical", + }, + { + class="ordinary", + name="surd", + }, + }, unicodeslot=0x221A, }, [0x221B]={ @@ -173811,7 +173825,6 @@ characters.data={ }, [0x1D6FB]={ category="sm", - comment="mathname='nabla'", description="MATHEMATICAL ITALIC NABLA", direction="l", linebreak="al", diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 462293d37..13bfcc907 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{2013.08.17 00:58} +\newcontextversion{2013.08.20 12:31} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 2f1e7f2fb..9b5a5f67e 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 184a9f356..c4747fd46 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{2013.08.17 00:58} +\edef\contextversion{2013.08.20 12:31} \edef\contextkind {beta} %D For those who want to use this: @@ -420,7 +420,7 @@ \loadmarkfile{math-ini} \loadmarkfile{math-pln} \loadmarkfile{math-for} -\loadmarkfile{math-def} +\loadmarkfile{math-def} % also saves some meanings \loadmarkfile{math-ali} %loadmarkfile{math-arr} \loadmkvifile{math-stc} diff --git a/tex/context/base/font-con.lua b/tex/context/base/font-con.lua index 091058075..2e35d3ad7 100644 --- a/tex/context/base/font-con.lua +++ b/tex/context/base/font-con.lua @@ -475,7 +475,7 @@ function constructors.scale(tfmdata,specification) -- target.postprocessors = tfmdata.postprocessors -- - local targetslant = (parameters.slant or parameters[1] or 0) + local targetslant = (parameters.slant or parameters[1] or 0) -- *hdelta ? needs checking local targetspace = (parameters.space or parameters[2] or 0)*hdelta local targetspace_stretch = (parameters.space_stretch or parameters[3] or 0)*hdelta local targetspace_shrink = (parameters.space_shrink or parameters[4] or 0)*hdelta diff --git a/tex/context/base/math-def.mkiv b/tex/context/base/math-def.mkiv index 4b881d705..cc75252aa 100644 --- a/tex/context/base/math-def.mkiv +++ b/tex/context/base/math-def.mkiv @@ -15,7 +15,7 @@ \unprotect -% this will be done at the lua end +%D Some day this will be done at the lua end. \startluacode mathematics.define(\number\defaultmathfamily) @@ -24,22 +24,8 @@ \activatemathcharacters -% will go to math-ext (if used at all) - -\Umathchardef\braceld=0 \defaultmathfamily "FF07A -\Umathchardef\bracerd=0 \defaultmathfamily "FF07B -\Umathchardef\bracelu=0 \defaultmathfamily "FF07C -\Umathchardef\braceru=0 \defaultmathfamily "FF07D - -% ctx specific - -% \bgroup -% \catcode`|=\othercatcode -% \global\let\|=| -% \egroup - -% The \mfunction macro is an alternative for \hbox with a -% controlable font switch. +%D The \mfunction macro is an alternative for \hbox with a controlable font +%D switch. \definemathcommand [arccos] [nolop] {\mfunctionlabeltext{arccos}} \definemathcommand [arcsin] [nolop] {\mfunctionlabeltext{arcsin}} @@ -69,7 +55,7 @@ \definemathcommand [max] [limop] {\mfunctionlabeltext{max}} \definemathcommand [min] [limop] {\mfunctionlabeltext{min}} \definemathcommand [mod] [limop] {\mfunctionlabeltext{mod}} -%definemathcommand [div] [limop] {\mfunctionlabeltext{div}} % overloads \div symbol +%definemathcommand [div] [limop] {\mfunctionlabeltext{div}} % overloads \div symbol \definemathcommand [projlim] [limop] {\mfunctionlabeltext{projlim}} \definemathcommand [Pr] [limop] {\mfunctionlabeltext{Pr}} \definemathcommand [sec] [nolop] {\mfunctionlabeltext{sec}} @@ -79,170 +65,23 @@ \definemathcommand [tanh] [nolop] {\mfunctionlabeltext{tanh}} \definemathcommand [tan] [nolop] {\mfunctionlabeltext{tan}} -% \definemathcommand [integers] {{\mathblackboard Z}} -% \definemathcommand [reals] {{\mathblackboard R}} -% \definemathcommand [rationals] {{\mathblackboard Q}} -% \definemathcommand [naturalnumbers]{{\mathblackboard N}} -% \definemathcommand [complexes] {{\mathblackboard C}} -% \definemathcommand [primes] {{\mathblackboard P}} - \let\normalmatharg\arg % todo: maybe automatically -% moved to fences -% -% methods: -% -% 1: none -% 2: lua -% 3: tex -% -% variants: -% -% 1: step 1 -% 2: step 2 -% 3: htdp * 1.33^n -% 4: size * 1.33^n -% -% \setnewconstant\bigmathdelimitermethod \plusone -% \setnewconstant\bigmathdelimitervariant\plusthree -% -% \unexpanded\def\plainbigdelimiters % traditional method -% {\bigmathdelimitermethod\plustwo} -% -% \plainbigdelimiters % is default for the moment but not so nice -% -% \def\doleftbigmath #1{\ifx#1\relax\else\left#1\fi} -% \def\dorightbigmath#1{\ifx#1\relax\else\right.\fi} -% -% \installcorenamespace{mathbig} -% -% \unexpanded\def\choosemathbig#1#2% so we accept \big{||} as well -% {{\hbox{$% -% \ifcase\bigmathdelimitermethod -% \doleftbigmath#2\relax -% \dorightbigmath#2\relax -% \or -% \attribute\mathsizeattribute\numexpr\bigmathdelimitervariant*\plushundred+#1\relax -% \doleftbigmath#2\relax -% \dorightbigmath#2\relax -% \else -% \doleftbigmath#2\relax -% \vbox to\getvalue{\??mathbig\number#1}\bodyfontsize{}% -% \dorightbigmath#2\relax -% \fi -% \nulldelimiterspace\zeropoint\relax -% \mathsurround\zeropoint -% $}}} -% -% \unexpanded\def\mathdelimiterstep#1#2% -% {\begingroup -% \attribute\mathsizeattribute\numexpr\plushundred+#1\relax -% \doleftbigmath#2\relax -% \dorightbigmath#2\relax -% \endgroup} -% -% \definemathcommand [big] {\choosemathbig\plusone } -% \definemathcommand [Big] {\choosemathbig\plustwo } -% \definemathcommand [bigg] {\choosemathbig\plusthree} -% \definemathcommand [Bigg] {\choosemathbig\plusfour } -% -% \definemathcommand [bigl] [open] [one] {\big} -% \definemathcommand [bigm] [rel] [one] {\big} -% \definemathcommand [bigr] [close] [one] {\big} -% \definemathcommand [Bigl] [open] [one] {\Big} -% \definemathcommand [Bigm] [rel] [one] {\Big} -% \definemathcommand [Bigr] [close] [one] {\Big} -% \definemathcommand [biggl] [open] [one] {\bigg} -% \definemathcommand [biggm] [rel] [one] {\bigg} -% \definemathcommand [biggr] [close] [one] {\bigg} -% \definemathcommand [Biggl] [open] [one] {\Bigg} -% \definemathcommand [Biggm] [rel] [one] {\Bigg} -% \definemathcommand [Biggr] [close] [one] {\Bigg} - %D This needs checking: -\def\setoperatorlimits#1#2% operator limits +\unexpanded\def\setoperatorlimits#1#2% operator limits {\savenormalmeaning{#1}% - \def#1{\csname normal\strippedcsname#1\endcsname#2}} - -\setoperatorlimits\int \intlimits -\setoperatorlimits\iint \intlimits -\setoperatorlimits\iiint \intlimits -\setoperatorlimits\oint \intlimits -\setoperatorlimits\oiint \intlimits -\setoperatorlimits\oiiint \intlimits -\setoperatorlimits\intclockwise \intlimits -\setoperatorlimits\ointclockwise \intlimits -\setoperatorlimits\ointctrclockwise \intlimits - -%D This is a temporary hack until we figure out how to do this correctly, -%D preferably using math parameters but we can also consider doing some -%D node juggling here. - -\unexpanded\def\implies {\mathrel{\;\Longrightarrow\;}} -\unexpanded\def\impliedby{\mathrel{\;\Longleftarrow\;}} -\unexpanded\def\And {\mathrel{\;\internalAnd\;}} -%unexpanded\def\iff {\;\Longleftrightarrow\;} -\setuvalue {iff}{\;\Longleftrightarrow\;} % nicer for if checker - -% todo: virtual in math-vfu - -% \definemathcommand [mapsto] {\mapstochar\rightarrow} -% \definemathcommand [hookrightarrow] {\lhook\joinrel\rightarrow} -% \definemathcommand [hookleftarrow] {\leftarrow\joinrel\rhook} -% \definemathcommand [bowtie] {\mathrel\triangleright\joinrel\mathrel\triangleleft} -% \definemathcommand [models] {\mathrel|\joinrel=} -% \definemathcommand [iff] {\;\Longleftrightarrow\;} - -% hm - -% ldots = 2026 -% vdots = 22EE -% cdots = 22EF -% ddots = 22F1 -% udots = 22F0 - -% \def\PLAINldots{\ldotp\ldotp\ldotp} -% \def\PLAINcdots{\cdotp\cdotp\cdotp} - -% \def\PLAINvdots -% {\vbox{\baselineskip.4\bodyfontsize\lineskiplimit\zeropoint\kern.6\bodyfontsize\hbox{.}\hbox{.}\hbox{.}}} - -% \def\PLAINddots -% {\mkern1mu% -% \raise.7\bodyfontsize\vbox{\kern.7\bodyfontsize\hbox{.}}% -% \mkern2mu% -% \raise.4\bodyfontsize\relax\hbox{.}% -% \mkern2mu% -% \raise.1\bodyfontsize\hbox{.}% -% \mkern1mu} - -% \definemathcommand [ldots] [inner] {\PLAINldots} -% \definemathcommand [cdots] [inner] {\PLAINcdots} -% \definemathcommand [vdots] [nothing] {\PLAINvdots} -% \definemathcommand [ddots] [inner] {\PLAINddots} - -%D \starttyping -%D $\sqrt[3]{10}$ -%D \stoptyping -%D -%D This root command will be overloaded later: - -\def\rootradical{\Uroot \defaultmathfamily "221A } % can be done in char-def - -\def\root#1\of{\rootradical{#1}} % #2 - -\unexpanded\def\sqrt{\doifnextoptionalelse\rootwithdegree\rootwithoutdegree} - -\def\rootwithdegree [#1]{\rootradical{#1}} -\def\rootwithoutdegree {\rootradical {}} - -\definemathcommand [mathstrut] {\vphantom{(}} -\definemathcommand [joinrel] {\mathrel{\mkern-3mu}} - -\unexpanded\def\{{\mathortext\lbrace\letterleftbrace } % or maybe a chardef -\unexpanded\def\}{\mathortext\rbrace\letterrightbrace} % or maybe a chardef -\unexpanded\def\|{\mathortext\vert \letterbar } % or maybe a chardef + \expandafter\def\expandafter#1\expandafter{\csname normal\strippedcsname#1\endcsname#2}} + +\setoperatorlimits \int \intlimits +\setoperatorlimits \iint \intlimits +\setoperatorlimits \iiint \intlimits +\setoperatorlimits \oint \intlimits +\setoperatorlimits \oiint \intlimits +\setoperatorlimits \oiiint \intlimits +\setoperatorlimits \intclockwise \intlimits +\setoperatorlimits \ointclockwise \intlimits +\setoperatorlimits \ointctrclockwise \intlimits %D The following colon related definitions are provided by Aditya %D Mahajan who derived them from \type {mathtools.sty} and \type @@ -288,7 +127,7 @@ \definemathcommand [doublecolonsep] {\mkern-0.9mu} %D Now we define all the colon relations .. needs checking with char-def.lua ... -%d will move to a separate module. +%D will move to a separate module. \definemathcommand [centercolon] [rel] {\mathstylevcenteredhbox\colon} \definemathcommand [colonminus] [rel] {\centercolon\colonsep\mathrel{-}} @@ -348,9 +187,6 @@ % let's keep this -\def\Umathbotaccent{\Umathaccent \s!bottom } -\def\Umathaccents {\Umathaccent \s!both } - \let\normaloverbrace \overbrace \let\normalunderbrace \underbrace \let\normaloverparent \overparent @@ -365,34 +201,9 @@ \unexpanded\def\mathopwithlimits#1#2{\mathop{#1{#2}}\limits} \unexpanded\def\stackrel #1#2{\mathrel{\mathop{#2}\limits^{#1}}} -% these are stackers now - -%\unexpanded\def\overbrace {\mathopwithlimits\normaloverbrace } -%\unexpanded\def\underbrace {\mathopwithlimits\normalunderbrace } -%\unexpanded\def\doublebrace {\mathopwithlimits\normaldoublebrace } -%\unexpanded\def\overparent {\mathopwithlimits\normaloverparent } -%\unexpanded\def\underparent {\mathopwithlimits\normalunderparent } -%\unexpanded\def\overbracket {\mathopwithlimits\normaloverbracket } -%\unexpanded\def\underbracket {\mathopwithlimits\normalunderbracket } -%\unexpanded\def\doubleparent {\mathopwithlimits\normaldoubleparent } - -%unexpanded\def\underleftarrow {\mathopwithlimits\normalunderleftarrow } -%unexpanded\def\overleftarrow {\mathopwithlimits\normaloverleftarrow } -%unexpanded\def\underrightarrow{\mathopwithlimits\normalunderrightarrow} -%unexpanded\def\overrightarrow {\mathopwithlimits\normaloverrightarrow } - \let\lceil \lceiling \let\rceil \rceiling -\let\normalsurd\surd - -\unexpanded\def\surd{\normalsurd{}} - -% Some special characters: - -\unexpanded\def\nabla{∇} % this one adapts - -% % todo mathclass=punctuation ord % \Umathcode"02C="6 \defaultmathfamily "02C diff --git a/tex/context/base/math-fen.mkiv b/tex/context/base/math-fen.mkiv index 9ad1a1ec1..2a05ac5a1 100644 --- a/tex/context/base/math-fen.mkiv +++ b/tex/context/base/math-fen.mkiv @@ -56,17 +56,17 @@ \def\math_fenced_left {\edef\p_left{\mathfenceparameter\c!left}% \math_fenced_color_push - \normalleft\ifx\p_left\empty.\else\Udelimiter\plusfour\fam\p_left\fi + \normalleft\ifx\p_left\empty.\else\Udelimiter\plusfour\fam\p_left\relax\fi \math_fenced_color_pop} \def\math_fenced_middle{\edef\p_middle{\mathfenceparameter\c!middle}% \mskip\thinmuskip \math_fenced_color_push - \normalmiddle\ifx\p_middle\empty.\else\Udelimiter\plusfour\fam\p_middle\fi + \normalmiddle\ifx\p_middle\empty.\else\Udelimiter\plusfour\fam\p_middle\relax\fi \math_fenced_color_pop \mskip\thinmuskip} \def\math_fenced_right {\edef\p_right{\mathfenceparameter\c!right}% \math_fenced_color_push - \normalright\ifx\p_right\empty.\else\Udelimiter\plusfive\fam\p_right\fi + \normalright\ifx\p_right\empty.\else\Udelimiter\plusfive\fam\p_right\relax\fi \math_fenced_color_pop} \def\math_fenced_color_do_push{\pushcolor[\p_math_fenced_color]} @@ -178,25 +178,48 @@ \setvalue{\??mathright \s!unknown}{\setfalse\c_math_fenced_done\ifconditional\c_math_fenced_unknown\normalright \nexttoken\fi} \setvalue{\??mathmiddle\s!unknown}{\setfalse\c_math_fenced_done\ifconditional\c_math_fenced_unknown\normalmiddle\nexttoken\fi} -\bgroup - - \let\temp [ \global\expandafter\let\csname\??mathleft\meaning\temp\endcsname\Lbracket - \let\temp ( \global\expandafter\let\csname\??mathleft\meaning\temp\endcsname\Lparent - \let\temp < \global\expandafter\let\csname\??mathleft\meaning\temp\endcsname\Langle - \let\temp { \global\expandafter\let\csname\??mathleft\meaning\temp\endcsname\Lbrace - \let\temp | \global\expandafter\let\csname\??mathleft\meaning\temp\endcsname\Lbar - \let\temp ‖ \global\expandafter\let\csname\??mathleft\meaning\temp\endcsname\Ldoublebar - \let\temp . \global\expandafter\let\csname\??mathleft\meaning\temp\endcsname\Lnothing - - \let\temp ] \global\expandafter\let\csname\??mathright\meaning\temp\endcsname\Rbracket - \let\temp ) \global\expandafter\let\csname\??mathright\meaning\temp\endcsname\Rparent - \let\temp > \global\expandafter\let\csname\??mathright\meaning\temp\endcsname\Rangle - \let\temp } \global\expandafter\let\csname\??mathright\meaning\temp\endcsname\Rbrace - \let\temp | \global\expandafter\let\csname\??mathright\meaning\temp\endcsname\Rbar - \let\temp ‖ \global\expandafter\let\csname\??mathright\meaning\temp\endcsname\Rdoublebar - \let\temp . \global\expandafter\let\csname\??mathright\meaning\temp\endcsname\Rnothing - -\egroup +\unexpanded\def\installmathfencepair#1#2#3#4% + {\expandafter\let\csname\??mathleft \meaning#1\endcsname#2% + \expandafter\let\csname\??mathright\meaning#3\endcsname#4} + +\expandafter\let\csname\??mathleft\meaning [\endcsname\Lbracket +\expandafter\let\csname\??mathleft\meaning (\endcsname\Lparent +\expandafter\let\csname\??mathleft\meaning <\endcsname\Langle +\expandafter\let\csname\??mathleft\meaning {\endcsname\Lbrace +\expandafter\let\csname\??mathleft\meaning |\endcsname\Lbar +\expandafter\let\csname\??mathleft\meaning ‖\endcsname\Ldoublebar +\expandafter\let\csname\??mathleft\meaning .\endcsname\Lnothing + +\expandafter\let\csname\??mathright\meaning ]\endcsname\Rbracket +\expandafter\let\csname\??mathright\meaning )\endcsname\Rparent +\expandafter\let\csname\??mathright\meaning >\endcsname\Rangle +\expandafter\let\csname\??mathright\meaning }\endcsname\Rbrace +\expandafter\let\csname\??mathright\meaning |\endcsname\Rbar +\expandafter\let\csname\??mathright\meaning ‖\endcsname\Rdoublebar +\expandafter\let\csname\??mathright\meaning .\endcsname\Rnothing + +\let\lbrack\lbracket +\let\rbrack\rbracket + +\installmathfencepair \lbrace \Lbrace \rbrace \Rbrace +\installmathfencepair \lbracket \Lbracket \rbracket \Rbracket +\installmathfencepair \lparent \Lparent \rparent \Rparent +\installmathfencepair \langle \Langle \rangle \Rangle +%installmathfencepair \lbar \Lbar \rbar \Rbar + +\unexpanded\def\{{\mathortext\lbrace \letterleftbrace } % or maybe a chardef +\unexpanded\def\}{\mathortext\rbrace \letterrightbrace } % or maybe a chardef +\unexpanded\def\[{\mathortext\lbracket\letterleftbracket } % or maybe a chardef +\unexpanded\def\]{\mathortext\rbracket\letterrightbracket} % or maybe a chardef +\unexpanded\def\({\mathortext\lparent \letterleftparent } % or maybe a chardef +\unexpanded\def\){\mathortext\rparent \letterrightparent } % or maybe a chardef +\unexpanded\def\|{\mathortext\vert \letterbar } % or maybe a chardef + +\installmathfencepair \{ \Lbrace \} \Rbrace +\installmathfencepair \[ \Lbracket \] \Rbracket +\installmathfencepair \( \Lparent \) \Rparent +\installmathfencepair \< \Langle \> \Rangle +\installmathfencepair \| \Lbar \| \Rbar %D As we have overloaded \type {\left} and \type {\right} we also need a more %D clever version of the following: @@ -296,4 +319,12 @@ % \definemathoverextensible [top] [hoed] ["FE302] % \definemathoverextensible [top] [slang] ["FE303] +%D The next characters were used for constructing nicer extensibles but +%D nowadays we have real characters. + +\Umathchardef\braceld=0 \defaultmathfamily "FF07A +\Umathchardef\bracerd=0 \defaultmathfamily "FF07B +\Umathchardef\bracelu=0 \defaultmathfamily "FF07C +\Umathchardef\braceru=0 \defaultmathfamily "FF07D + \protect diff --git a/tex/context/base/math-ini.lua b/tex/context/base/math-ini.lua index c6d96dab2..6be06e634 100644 --- a/tex/context/base/math-ini.lua +++ b/tex/context/base/math-ini.lua @@ -90,6 +90,7 @@ local classes = allocate { large = 1, -- op variable = 7, -- alphabetic number = 7, -- alphabetic + root = 16, -- a private one } local open_class = 4 @@ -154,6 +155,10 @@ local function radical(family,slot) return formatters['\\Uradical "%X "%X '](family,slot) end +local function root(family,slot) + return formatters['\\Uroot "%X "%X '](family,slot) +end + local function mathchardef(name,class,family,slot) return formatters['\\Umathchardef\\%s "%X "%X "%X '](name,class,family,slot) end @@ -194,29 +199,42 @@ local setmathcharacter = function(class,family,slot,unicode,mset,dset) return mset, dset end +local f_accent = formatters[ [[\ugdef\%s{\Umathaccent 0 "%X "%X }]] ] +local f_topaccent = formatters[ [[\ugdef\%s{\Umathaccent 0 "%X "%X }]] ] +local f_botaccent = formatters[ [[\ugdef\%s{\Umathbotaccent 0 "%X "%X }]] ] +local f_over = formatters[ [[\ugdef\%s{\Udelimiterover "%X "%X }]] ] +local f_under = formatters[ [[\ugdef\%s{\Udelimiterunder "%X "%X }]] ] +local f_fence = formatters[ [[\ugdef\%s{\Udelimiter "%X "%X "%X }]] ] +local f_delimiter = formatters[ [[\ugdef\%s{\Udelimiter 0 "%X "%X }]] ] +local f_radical = formatters[ [[\ugdef\%s{\Uradical "%X "%X }]] ] +local f_root = formatters[ [[\ugdef\%s{\Uroot "%X "%X }]] ] +----- f_char = formatters[ [[\ugdef\%s{\Umathchar "%X "%X "%X }]] +local f_char = formatters[ [[\Umathchardef\%s "%X "%X "%X ]] ] + local setmathsymbol = function(name,class,family,slot) -- hex is nicer for tracing if class == classes.accent then - contextsprint(formatters[ [[\ugdef\%s{\Umathaccent 0 "%X "%X }]] ](name,family,slot)) + contextsprint(f_accent(name,family,slot)) elseif class == classes.topaccent then - contextsprint(formatters[ [[\ugdef\%s{\Umathaccent 0 "%X "%X }]] ](name,family,slot)) + contextsprint(f_topaccent(name,family,slot)) elseif class == classes.botaccent then - contextsprint(formatters[ [[\ugdef\%s{\Umathbotaccent 0 "%X "%X }]] ](name,family,slot)) + contextsprint(f_botaccent(name,family,slot)) elseif class == classes.over then - contextsprint(formatters[ [[\ugdef\%s{\Udelimiterover "%X "%X }]] ](name,family,slot)) + contextsprint(f_over(name,family,slot)) elseif class == classes.under then - contextsprint(formatters[ [[\ugdef\%s{\Udelimiterunder "%X "%X }]] ](name,family,slot)) + contextsprint(f_under(name,family,slot)) elseif class == open_class or class == close_class or class == middle_class then setdelcode("global",slot,{family,slot,0,0}) - contextsprint(formatters[ [[\ugdef\%s{\Udelimiter "%X "%X "%X }]] ](name,class,family,slot)) + contextsprint(f_fence(name,class,family,slot)) elseif class == classes.delimiter then setdelcode("global",slot,{family,slot,0,0}) - contextsprint(formatters[ [[\ugdef\%s{\Udelimiter 0 "%X "%X }]] ](name,family,slot)) + contextsprint(f_delimiter(name,family,slot)) elseif class == classes.radical then - contextsprint(formatters[ [[\ugdef\%s{\Uradical "%X "%X }]] ](name,family,slot)) + contextsprint(f_radical(name,family,slot)) + elseif class == classes.root then + contextsprint(f_root(name,family,slot)) else -- beware, open/close and other specials should not end up here - -- contextsprint(formatters[ [[\ugdef\%s{\Umathchar "%X "%X "%X }]],name,class,family,slot)) - contextsprint(formatters[ [[\Umathchardef\%s "%X "%X "%X ]] ](name,class,family,slot)) + contextsprint(f_char(name,class,family,slot)) end end diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index f386cdd30..bac46cbec 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -45,6 +45,13 @@ \registerctxluafile{math-tag}{1.001} \registerctxluafile{math-fbk}{1.001} +%D A few compatibility helpers: + +\def\Umathbotaccent{\Umathaccent \s!bottom } +\def\Umathaccents {\Umathaccent \s!both } + +%D The attributes that we will use: + \definesystemattribute[mathalphabet] [public] \definesystemattribute[mathsize] [public] \definesystemattribute[mathpunctuation][public] @@ -355,6 +362,11 @@ \unexpanded\def\mathcommand#1% {\csname\??mathcommand#1\endcsname} +%D Let's define a few comands here: + +\definemathcommand [mathstrut] {\vphantom{(}} +\definemathcommand [joinrel] {\mathrel{\mkern-3mu}} + %D Moved from font-ini.mkiv: %D %D \macros @@ -500,10 +512,6 @@ %D \tt test $\sin{(x^{\sin(x^{\sin(x)})})}$ test %D \stoptyping -%D Some goodies: - -\unexpanded\def\Angstrom{\nomathematics{\Aring}} - %D \macros %D {nonknuthmode, donknuthmode} %D @@ -679,8 +687,8 @@ \newconditional \knuthmode -\let\nonknuthmode\relax -\let\donknuthmode\relax +\let\nonknuthmode\relax % no longer needed in MkIV +\let\donknuthmode\relax % no longer needed in MkIV % \def\nonknuthmode % {\pushcatcodetable diff --git a/tex/context/base/math-rad.mkvi b/tex/context/base/math-rad.mkvi index b9d4021c3..b3a6a24c9 100644 --- a/tex/context/base/math-rad.mkvi +++ b/tex/context/base/math-rad.mkvi @@ -15,18 +15,33 @@ \unprotect -%D This is already defined in math-def.mkiv: +%D \starttyping +%D $\sqrt[3]{10}$ +%D \stoptyping +%D +%D This root command will be overloaded later: -% \def\rootradical{\Uroot \defaultmathfamily "221A } % can be done in char-def -% -% \def\root#1\of{\rootradical{#1}} % #2 -% -% A traditional approach: -% -% \unexpanded\def\sqrt{\doifnextoptionalelse\rootwithdegree\rootwithoutdegree} +%D Old stuff: + +% \def\rootradical{\Uroot \defaultmathfamily "221A } % can be done in char-def +% \def\surdradical{\Uradical \defaultmathfamily "221A } % can be done in char-def + +\def\root#1\of{\rootradical{#1}} % #2 + +\unexpanded\def\sqrt{\doifnextoptionalelse\rootwithdegree\rootwithoutdegree} + +\def\rootwithdegree[#1]{\rootradical{#1}} +\def\rootwithoutdegree {\rootradical {}} + +%D Even older stuff: + +% % is now a ordinary character % -% \def\rootwithdegree [#1]{\rootradical{#1}} -% \def\rootwithoutdegree {\rootradical {}} +% \let\normalsurd\surd % \Uradical "0 "221A +% \unexpanded\def\surd{\normalsurd{}} + + +%D The real thing: \installcorenamespace{mathradical} \installcorenamespace{mathradicalalternative} diff --git a/tex/context/base/math-stc.mkvi b/tex/context/base/math-stc.mkvi index 4652ee564..dd74f494c 100644 --- a/tex/context/base/math-stc.mkvi +++ b/tex/context/base/math-stc.mkvi @@ -265,7 +265,6 @@ \edef\currentmathstackers{#category}% \mathstackersparameter\c!left\relax \ifmmode\math_class_by_parameter\mathstackersparameter\else\dontleavehmode\fi -% \ifmmode\mathrel\else\dontleavehmode\fi {\edef\p_offset {\mathstackersparameter\c!offset}% \edef\p_location {\mathstackersparameter\c!location}% \edef\p_order {\mathstackersparameter\c!order}% @@ -890,6 +889,40 @@ % \mathchardef\doublebond"003D % \mathchardef\triplebond"2261 +%D Also handy: + +\unexpanded\def\definemathunstacked + {\dotripleempty\math_stackers_define_unstacked_normal} + +\def\math_stackers_define_unstacked_normal[#1][#2][#3]% category name unicode + {\ifthirdargument + \setuevalue{#2}{\math_stackers_unstacked_normal{#1}{\number#3}}% + \else + \setuevalue{#1}{\math_stackers_unstacked_normal\noexpand\currentmathstackers{\number#2}}% + \fi} + +\unexpanded\def\math_stackers_unstacked_normal#category#codepoint% + {\begingroup + \edef\currentmathstackers{#category}% + \edef\p_moffset{\mathstackersparameter\c!moffset}% + \ifx\p_moffset\empty \else + \mskip\scratchmuskip + \fi + \ifmmode\math_class_by_parameter\mathstackersparameter\else\dontleavehmode\fi + {\usemathstackerscolorparameter\c!color + \Umathchar\zerocount\defaultmathfamily#codepoint}% + \ifx\p_moffset\empty \else + \mskip\scratchmuskip + \fi + \endgroup} + +\definemathstackers [\v!wide] [\c!moffset=\thickmuskip,\c!mathclass=\s!rel] + +\definemathunstacked [\v!wide] [And] ["0026] % \mathrel{\;&\;} +\definemathunstacked [\v!wide] [impliedby] ["27F8] % \mathrel{\;\Longleftarrow\;} +\definemathunstacked [\v!wide] [implies] ["27F9] % \mathrel{\;\Longrightarrow\;} +\definemathunstacked [\v!wide] [iff] ["27FA] % \mathrel{\;\Longleftrightarrow\;} + \protect \endinput % \mathrel{\mathop{\hbox to \dimen0{\hss\copy4\hss}} diff --git a/tex/context/base/mult-de.mkii b/tex/context/base/mult-de.mkii index 4b7a54e61..4ac85404b 100644 --- a/tex/context/base/mult-de.mkii +++ b/tex/context/base/mult-de.mkii @@ -822,6 +822,7 @@ \setinterfaceconstant{mindepth}{mindepth} \setinterfaceconstant{minheight}{minhoehe} \setinterfaceconstant{minwidth}{minbreite} +\setinterfaceconstant{moffset}{moffset} \setinterfaceconstant{monthconversion}{monthconversion} \setinterfaceconstant{more}{more} \setinterfaceconstant{mpdepth}{mpdepth} diff --git a/tex/context/base/mult-def.lua b/tex/context/base/mult-def.lua index 07e1139f0..9398733bc 100644 --- a/tex/context/base/mult-def.lua +++ b/tex/context/base/mult-def.lua @@ -8932,6 +8932,16 @@ return { ["pe"]="کمترینعرض", ["ro"]="latimeminima", }, + ["moffset"]={ + ["cs"]="moffset", + ["de"]="moffset", + ["en"]="moffset", + ["fr"]="moffset", + ["it"]="moffset", + ["nl"]="moffset", + ["pe"]="moffset", + ["ro"]="moffset", + }, ["mpwidth"]={ ["en"]="mpwidth", ["nl"]="mpbreedte", diff --git a/tex/context/base/mult-en.mkii b/tex/context/base/mult-en.mkii index 7b06ec627..aee58f9b5 100644 --- a/tex/context/base/mult-en.mkii +++ b/tex/context/base/mult-en.mkii @@ -822,6 +822,7 @@ \setinterfaceconstant{mindepth}{mindepth} \setinterfaceconstant{minheight}{minheight} \setinterfaceconstant{minwidth}{minwidth} +\setinterfaceconstant{moffset}{moffset} \setinterfaceconstant{monthconversion}{monthconversion} \setinterfaceconstant{more}{more} \setinterfaceconstant{mpdepth}{mpdepth} diff --git a/tex/context/base/mult-fr.mkii b/tex/context/base/mult-fr.mkii index 55aa3af79..fff2def29 100644 --- a/tex/context/base/mult-fr.mkii +++ b/tex/context/base/mult-fr.mkii @@ -822,6 +822,7 @@ \setinterfaceconstant{mindepth}{profondeurmin} \setinterfaceconstant{minheight}{hauteurmin} \setinterfaceconstant{minwidth}{largeurmin} +\setinterfaceconstant{moffset}{moffset} \setinterfaceconstant{monthconversion}{monthconversion} \setinterfaceconstant{more}{more} \setinterfaceconstant{mpdepth}{mpdepth} diff --git a/tex/context/base/mult-it.mkii b/tex/context/base/mult-it.mkii index 6d3591c04..140c12198 100644 --- a/tex/context/base/mult-it.mkii +++ b/tex/context/base/mult-it.mkii @@ -822,6 +822,7 @@ \setinterfaceconstant{mindepth}{mindeoth} \setinterfaceconstant{minheight}{altezzamin} \setinterfaceconstant{minwidth}{ampiezzamin} +\setinterfaceconstant{moffset}{moffset} \setinterfaceconstant{monthconversion}{monthconversion} \setinterfaceconstant{more}{more} \setinterfaceconstant{mpdepth}{mpdepth} diff --git a/tex/context/base/mult-mps.lua b/tex/context/base/mult-mps.lua index 59411cd97..48fe36b52 100644 --- a/tex/context/base/mult-mps.lua +++ b/tex/context/base/mult-mps.lua @@ -55,7 +55,7 @@ return { "colormodel", "graypart", "dashpart", "penpart", -- "colorpart", - "stroked", "filled", "textual", "clipped", "bounded", + "stroked", "filled", "textual", "clipped", "bounded", "pathpart", "expandafter", }, commands = { diff --git a/tex/context/base/mult-nl.mkii b/tex/context/base/mult-nl.mkii index 275f86c1a..0624b01bf 100644 --- a/tex/context/base/mult-nl.mkii +++ b/tex/context/base/mult-nl.mkii @@ -822,6 +822,7 @@ \setinterfaceconstant{mindepth}{mindiepte} \setinterfaceconstant{minheight}{minhoogte} \setinterfaceconstant{minwidth}{minbreedte} +\setinterfaceconstant{moffset}{moffset} \setinterfaceconstant{monthconversion}{maandconversie} \setinterfaceconstant{more}{meer} \setinterfaceconstant{mpdepth}{mpdiepte} diff --git a/tex/context/base/mult-pe.mkii b/tex/context/base/mult-pe.mkii index cff5dfce4..857a46cac 100644 --- a/tex/context/base/mult-pe.mkii +++ b/tex/context/base/mult-pe.mkii @@ -822,6 +822,7 @@ \setinterfaceconstant{mindepth}{کمترینعمق} \setinterfaceconstant{minheight}{کمترینارتفاع} \setinterfaceconstant{minwidth}{کمترینعرض} +\setinterfaceconstant{moffset}{moffset} \setinterfaceconstant{monthconversion}{monthconversion} \setinterfaceconstant{more}{more} \setinterfaceconstant{mpdepth}{mpdepth} diff --git a/tex/context/base/mult-ro.mkii b/tex/context/base/mult-ro.mkii index e901e28f4..e73e59962 100644 --- a/tex/context/base/mult-ro.mkii +++ b/tex/context/base/mult-ro.mkii @@ -822,6 +822,7 @@ \setinterfaceconstant{mindepth}{mindepth} \setinterfaceconstant{minheight}{inaltimeminima} \setinterfaceconstant{minwidth}{latimeminima} +\setinterfaceconstant{moffset}{moffset} \setinterfaceconstant{monthconversion}{monthconversion} \setinterfaceconstant{more}{more} \setinterfaceconstant{mpdepth}{mpdepth} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 8f9abcd1a..f032aa51f 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log index 838cc2383..f8901d762 100644 --- a/tex/context/base/status-lua.log +++ b/tex/context/base/status-lua.log @@ -1,6 +1,6 @@ (cont-yes.mkiv -ConTeXt ver: 2013.08.17 00:58 MKIV beta fmt: 2013.8.17 int: english/english +ConTeXt ver: 2013.08.20 12:31 MKIV beta fmt: 2013.8.20 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index 62bfc790c..6901db4cc 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -1857,6 +1857,12 @@ return { }, { category = "mkiv", + filename = "math-rad", + loading = "always", + status = "okay", + }, + { + category = "mkiv", comment = "code might move to here", filename = "math-inl", loading = "always", diff --git a/tex/context/interface/keys-cs.xml b/tex/context/interface/keys-cs.xml index f7de67072..122bd7a22 100644 --- a/tex/context/interface/keys-cs.xml +++ b/tex/context/interface/keys-cs.xml @@ -828,6 +828,7 @@ <cd:constant name='mindepth' value='mindepth'/> <cd:constant name='minheight' value='minvyska'/> <cd:constant name='minwidth' value='minsirka'/> + <cd:constant name='moffset' value='moffset'/> <cd:constant name='monthconversion' value='monthconversion'/> <cd:constant name='more' value='more'/> <cd:constant name='mpdepth' value='mpdepth'/> diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml index 07add1d02..a024e918f 100644 --- a/tex/context/interface/keys-de.xml +++ b/tex/context/interface/keys-de.xml @@ -828,6 +828,7 @@ <cd:constant name='mindepth' value='mindepth'/> <cd:constant name='minheight' value='minhoehe'/> <cd:constant name='minwidth' value='minbreite'/> + <cd:constant name='moffset' value='moffset'/> <cd:constant name='monthconversion' value='monthconversion'/> <cd:constant name='more' value='more'/> <cd:constant name='mpdepth' value='mpdepth'/> diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml index 954dcffd2..8e4ef2561 100644 --- a/tex/context/interface/keys-en.xml +++ b/tex/context/interface/keys-en.xml @@ -828,6 +828,7 @@ <cd:constant name='mindepth' value='mindepth'/> <cd:constant name='minheight' value='minheight'/> <cd:constant name='minwidth' value='minwidth'/> + <cd:constant name='moffset' value='moffset'/> <cd:constant name='monthconversion' value='monthconversion'/> <cd:constant name='more' value='more'/> <cd:constant name='mpdepth' value='mpdepth'/> diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml index b71707d8f..db2719fe6 100644 --- a/tex/context/interface/keys-fr.xml +++ b/tex/context/interface/keys-fr.xml @@ -828,6 +828,7 @@ <cd:constant name='mindepth' value='profondeurmin'/> <cd:constant name='minheight' value='hauteurmin'/> <cd:constant name='minwidth' value='largeurmin'/> + <cd:constant name='moffset' value='moffset'/> <cd:constant name='monthconversion' value='monthconversion'/> <cd:constant name='more' value='more'/> <cd:constant name='mpdepth' value='mpdepth'/> diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml index ffdc8e2a6..eadd1ca4b 100644 --- a/tex/context/interface/keys-it.xml +++ b/tex/context/interface/keys-it.xml @@ -828,6 +828,7 @@ <cd:constant name='mindepth' value='mindeoth'/> <cd:constant name='minheight' value='altezzamin'/> <cd:constant name='minwidth' value='ampiezzamin'/> + <cd:constant name='moffset' value='moffset'/> <cd:constant name='monthconversion' value='monthconversion'/> <cd:constant name='more' value='more'/> <cd:constant name='mpdepth' value='mpdepth'/> diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml index b09d73183..37b7c6213 100644 --- a/tex/context/interface/keys-nl.xml +++ b/tex/context/interface/keys-nl.xml @@ -828,6 +828,7 @@ <cd:constant name='mindepth' value='mindiepte'/> <cd:constant name='minheight' value='minhoogte'/> <cd:constant name='minwidth' value='minbreedte'/> + <cd:constant name='moffset' value='moffset'/> <cd:constant name='monthconversion' value='maandconversie'/> <cd:constant name='more' value='meer'/> <cd:constant name='mpdepth' value='mpdiepte'/> diff --git a/tex/context/interface/keys-pe.xml b/tex/context/interface/keys-pe.xml index 069de9a1f..a517697e3 100644 --- a/tex/context/interface/keys-pe.xml +++ b/tex/context/interface/keys-pe.xml @@ -828,6 +828,7 @@ <cd:constant name='mindepth' value='کمترینعمق'/> <cd:constant name='minheight' value='کمترینارتفاع'/> <cd:constant name='minwidth' value='کمترینعرض'/> + <cd:constant name='moffset' value='moffset'/> <cd:constant name='monthconversion' value='monthconversion'/> <cd:constant name='more' value='more'/> <cd:constant name='mpdepth' value='mpdepth'/> diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml index b16f25e2c..d5935e6e5 100644 --- a/tex/context/interface/keys-ro.xml +++ b/tex/context/interface/keys-ro.xml @@ -828,6 +828,7 @@ <cd:constant name='mindepth' value='mindepth'/> <cd:constant name='minheight' value='inaltimeminima'/> <cd:constant name='minwidth' value='latimeminima'/> + <cd:constant name='moffset' value='moffset'/> <cd:constant name='monthconversion' value='monthconversion'/> <cd:constant name='more' value='more'/> <cd:constant name='mpdepth' value='mpdepth'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index d2d3b3d83..8e883bf9a 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 : 08/17/13 00:58:38 +-- merge date : 08/20/13 12:31:41 do -- begin closure to overcome local limits and interference @@ -3802,7 +3802,7 @@ function constructors.scale(tfmdata,specification) end target.type=isvirtual and "virtual" or "real" target.postprocessors=tfmdata.postprocessors - local targetslant=(parameters.slant or parameters[1] or 0) + local targetslant=(parameters.slant or parameters[1] or 0) local targetspace=(parameters.space or parameters[2] or 0)*hdelta local targetspace_stretch=(parameters.space_stretch or parameters[3] or 0)*hdelta local targetspace_shrink=(parameters.space_shrink or parameters[4] or 0)*hdelta |