From 75be509021abdcd01f7d5caf35d026647042322a Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 4 Jun 2021 18:35:45 +0200 Subject: 2021-06-04 17:23:00 --- .../lexers/data/scite-context-data-metafun.lua | 2 +- .../context/lexers/scite-context-lexer-tex.lua | 2 +- .../context/scite-context-data-metafun.properties | 4 +- .../context/data/scite-context-data-metafun.lua | 2 +- .../context/lexers/scite-context-lexer-tex.lua | 2 +- .../context/syntaxes/context-syntax-mps.json | 2 +- doc/context/scripts/mkiv/context.html | 1 + doc/context/scripts/mkiv/context.man | 3 + doc/context/scripts/mkiv/context.xml | 3 + doc/context/scripts/mkiv/mtx-context.html | 1 + doc/context/scripts/mkiv/mtx-context.man | 3 + doc/context/scripts/mkiv/mtx-context.xml | 3 + metapost/context/base/mpiv/mp-page.mpiv | 4 + metapost/context/base/mpxl/mp-lmtx.mpxl | 133 ++++ metapost/context/base/mpxl/mp-luas.mpxl | 60 +- metapost/context/base/mpxl/mp-page.mpxl | 7 + scripts/context/lua/mtx-context.lua | 39 +- scripts/context/lua/mtx-context.xml | 3 + tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-ro.mkii | 1 + tex/context/base/mkiv/char-ini.lua | 20 +- tex/context/base/mkiv/cont-fil.mkiv | 2 + tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/lxml-ini.lua | 23 + tex/context/base/mkiv/lxml-tex.lua | 22 + tex/context/base/mkiv/mult-fun.lua | 5 +- tex/context/base/mkiv/s-inf-01-pdf-keep.pdf | Bin 0 -> 23890 bytes tex/context/base/mkiv/s-inf-03-pdf-keep.pdf | Bin 0 -> 230077 bytes tex/context/base/mkiv/status-files.pdf | Bin 23898 -> 23890 bytes tex/context/base/mkiv/status-lua.pdf | Bin 230046 -> 230077 bytes tex/context/base/mkxl/anch-loc.lmt | 94 ++- tex/context/base/mkxl/anch-pos.lmt | 34 +- tex/context/base/mkxl/cont-fil.mkxl | 2 + tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 2 +- tex/context/base/mkxl/font-mat.mklx | 36 +- tex/context/base/mkxl/math-ali.mkxl | 9 +- tex/context/base/mkxl/math-ini.lmt | 762 +++++++++++++++++++++ tex/context/base/mkxl/math-ini.mkxl | 38 +- tex/context/base/mkxl/meta-ini.mkxl | 49 ++ tex/context/base/mkxl/mlib-lua.lmt | 30 +- tex/context/base/mkxl/mlib-scn.lmt | 17 +- tex/context/base/mkxl/pack-rul.mkxl | 12 +- tex/context/base/mkxl/supp-box.mkxl | 12 +- tex/context/base/mkxl/syst-ini.mkxl | 15 + tex/context/base/mkxl/tabl-ntb.mkxl | 175 +++-- tex/context/interface/mkii/keys-ro.xml | 1 + tex/context/modules/mkiv/x-newmml.mkiv | 16 - tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 51 files changed, 1421 insertions(+), 242 deletions(-) create mode 100644 tex/context/base/mkiv/s-inf-01-pdf-keep.pdf create mode 100644 tex/context/base/mkiv/s-inf-03-pdf-keep.pdf create mode 100644 tex/context/base/mkxl/math-ini.lmt delete mode 100644 tex/context/modules/mkiv/x-newmml.mkiv diff --git a/context/data/scite/context/lexers/data/scite-context-data-metafun.lua b/context/data/scite/context/lexers/data/scite-context-data-metafun.lua index 66ab99eed..1247beaf8 100644 --- a/context/data/scite/context/lexers/data/scite-context-data-metafun.lua +++ b/context/data/scite/context/lexers/data/scite-context-data-metafun.lua @@ -1,4 +1,4 @@ return { ["commands"]={ "loadfile", "loadimage", "loadmodule", "dispose", "nothing", "transparency", "tolist", "topath", "tocycle", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "tanh", "zmod", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "unittriangle", "fulltriangle", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "randomizedcontrols", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "perpendicular", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "drawdoublearrows", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "boundingradius", "boundingcircle", "boundingpoint", "crossingunder", "insideof", "outsideof", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withcircularshade", "withlinearshade", "defineshade", "shaded", "shadedinto", "withshadecolors", "withshadedomain", "withshademethod", "withshadefactor", "withshadevector", "withshadecenter", "withshadedirection", "withshaderadius", "withshadetransform", "withshadecenterone", "withshadecentertwo", "withshadestep", "withshadefraction", "withshadeorigin", "shownshadevector", "shownshadeorigin", "shownshadedirection", "shownshadecenter", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "filloutlinetext", "drawoutlinetext", "outlinetexttopath", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "colordecimalslist", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "istextext", "rawmadetext", "validtexbox", "onetimetextext", "rawfmttext", "thefmttext", "fmttext", "onetimefmttext", "notcached", "keepcached", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "withopacity", "property", "properties", "withproperties", "asgroup", "withpattern", "withpatternscale", "withpatternfloat", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "colorlike", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedfunction", "constructedpath", "constructedpairs", "straightfunction", "straightpath", "straightpairs", "curvedfunction", "curvedpath", "curvedpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "resetarrows", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "basiccolors", "complementary", "complemented", "resolvedcolor", "normalfill", "normaldraw", "visualizepaths", "detailpaths", "naturalizepaths", "drawboundary", "drawwholepath", "drawpathonly", "visualizeddraw", "visualizedfill", "detaileddraw", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "pencilled", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "topair", "format", "formatted", "quotation", "quote", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "dofill", "fillup", "eofillup", "nodraw", "dodraw", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright", "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize", "listlast", "uniquelist", "circularpath", "squarepath", "linearpath", "theoffset", "texmode", "systemmode", "texvar", "texstr", "isarray", "prefix", "dimension", "getmacro", "getdimen", "getcount", "gettoks", "setmacro", "setdimen", "setcount", "settoks", "setglobalmacro", "setglobaldimen", "setglobalcount", "setglobaltoks", "positionpath", "positioncurve", "positionxy", "positionpxy", "positionwhd", "positionpage", "positionregion", "positionbox", "positionanchor", "positioninregion", "positionatanchor", "wdpart", "htpart", "dppart", "texvar", "texstr", "inpath", "pointof", "leftof", "rightof", "utfnum", "utflen", "utfsub", "newhash", "disposehash", "inhash", "tohash", "isarray", "prefix", "isobject", "comment", "report", "lua", "lualist", "mp", "MP", "luacall", "mirrored", "mirroredabout", "scriptindex", "newscriptindex", "newcolor", "newrgbcolor", "newcmykcolor", "newnumeric", "newboolean", "newtransform", "newpath", "newpicture", "newstring", "newpair", "mpvard", "mpvarn", "mpvars", "mpvar", "withtolerance" }, - ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "shadeoffset", "textextoffset", "textextanchor", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "ahvariant", "ahdimple", "ahfactor", "ahscale", "metapostversion", "maxdimensions", "drawoptionsfactor", "dq", "sq", "crossingscale", "crossingoption", "contextlmtxmode", "metafunversion", "minifunversion", "getparameters", "presetparameters", "hasparameter", "hasoption", "getparameter", "getparameterdefault", "getparametercount", "getmaxparametercount", "getparameterpath", "getparameterpen", "getparametertext", "applyparameters", "pushparameters", "popparameters", "definecolor", "anchorxy", "anchorx", "anchory", "anchorht", "anchordp", "anchorll", "anchorur", "anchorbox" }, + ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "shadeoffset", "textextoffset", "textextanchor", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "ahvariant", "ahdimple", "ahfactor", "ahscale", "metapostversion", "maxdimensions", "drawoptionsfactor", "dq", "sq", "crossingscale", "crossingoption", "contextlmtxmode", "metafunversion", "minifunversion", "getparameters", "presetparameters", "hasparameter", "hasoption", "getparameter", "getparameterdefault", "getparametercount", "getmaxparametercount", "getparameterpath", "getparameterpen", "getparametertext", "applyparameters", "pushparameters", "popparameters", "definecolor", "anchorxy", "anchorx", "anchory", "anchorht", "anchordp", "anchorul", "anchorll", "anchorlr", "anchorur", "localanchorbox", "localanchorcell", "localanchorspan", "anchorbox", "anchorcell", "anchorspan", "matrixbox", "matrixcell", "matrixspan" }, } \ No newline at end of file diff --git a/context/data/scite/context/lexers/scite-context-lexer-tex.lua b/context/data/scite/context/lexers/scite-context-lexer-tex.lua index d4e28f99b..71cfce0f5 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-tex.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-tex.lua @@ -435,7 +435,7 @@ local stopluacode = #stoplua * token("embedded", stoplua) local luacall = P("clf_") * R("az","__","AZ")^1 -local metafuncall = ( P("reusable") + P("usable") + P("unique") + P("use") + P("reuse") ) * ("MPgraphic") +local metafuncall = ( P("reusable") + P("usable") + P("unique") + P("use") + P("reuse") + P("overlay") ) * ("MPgraphic") + P("uniqueMPpagegraphic") + P("MPpositiongraphic") diff --git a/context/data/scite/context/scite-context-data-metafun.properties b/context/data/scite/context/scite-context-data-metafun.properties index dfe135ba6..2eb79d287 100644 --- a/context/data/scite/context/scite-context-data-metafun.properties +++ b/context/data/scite/context/scite-context-data-metafun.properties @@ -95,5 +95,7 @@ getparameters presetparameters hasparameter hasoption getparameter \ getparameterdefault getparametercount getmaxparametercount getparameterpath getparameterpen \ getparametertext applyparameters pushparameters popparameters definecolor \ anchorxy anchorx anchory anchorht anchordp \ -anchorll anchorur anchorbox +anchorul anchorll anchorlr anchorur localanchorbox \ +localanchorcell localanchorspan anchorbox anchorcell anchorspan \ +matrixbox matrixcell matrixspan diff --git a/context/data/textadept/context/data/scite-context-data-metafun.lua b/context/data/textadept/context/data/scite-context-data-metafun.lua index 66ab99eed..1247beaf8 100644 --- a/context/data/textadept/context/data/scite-context-data-metafun.lua +++ b/context/data/textadept/context/data/scite-context-data-metafun.lua @@ -1,4 +1,4 @@ return { ["commands"]={ "loadfile", "loadimage", "loadmodule", "dispose", "nothing", "transparency", "tolist", "topath", "tocycle", "sqr", "log", "ln", "exp", "inv", "pow", "pi", "radian", "tand", "cotd", "sin", "cos", "tan", "cot", "atan", "asin", "acos", "invsin", "invcos", "invtan", "acosh", "asinh", "sinh", "cosh", "tanh", "zmod", "paired", "tripled", "unitcircle", "fulldiamond", "unitdiamond", "fullsquare", "unittriangle", "fulltriangle", "llcircle", "lrcircle", "urcircle", "ulcircle", "tcircle", "bcircle", "lcircle", "rcircle", "lltriangle", "lrtriangle", "urtriangle", "ultriangle", "uptriangle", "downtriangle", "lefttriangle", "righttriangle", "triangle", "smoothed", "cornered", "superellipsed", "randomized", "randomizedcontrols", "squeezed", "enlonged", "shortened", "punked", "curved", "unspiked", "simplified", "blownup", "stretched", "enlarged", "leftenlarged", "topenlarged", "rightenlarged", "bottomenlarged", "crossed", "laddered", "randomshifted", "interpolated", "perpendicular", "paralleled", "cutends", "peepholed", "llenlarged", "lrenlarged", "urenlarged", "ulenlarged", "llmoved", "lrmoved", "urmoved", "ulmoved", "rightarrow", "leftarrow", "centerarrow", "drawdoublearrows", "boundingbox", "innerboundingbox", "outerboundingbox", "pushboundingbox", "popboundingbox", "boundingradius", "boundingcircle", "boundingpoint", "crossingunder", "insideof", "outsideof", "bottomboundary", "leftboundary", "topboundary", "rightboundary", "xsized", "ysized", "xysized", "sized", "xyscaled", "intersection_point", "intersection_found", "penpoint", "bbwidth", "bbheight", "withshade", "withcircularshade", "withlinearshade", "defineshade", "shaded", "shadedinto", "withshadecolors", "withshadedomain", "withshademethod", "withshadefactor", "withshadevector", "withshadecenter", "withshadedirection", "withshaderadius", "withshadetransform", "withshadecenterone", "withshadecentertwo", "withshadestep", "withshadefraction", "withshadeorigin", "shownshadevector", "shownshadeorigin", "shownshadedirection", "shownshadecenter", "cmyk", "spotcolor", "multitonecolor", "namedcolor", "drawfill", "undrawfill", "inverted", "uncolored", "softened", "grayed", "greyed", "onlayer", "along", "graphictext", "loadfigure", "externalfigure", "figure", "register", "outlinetext", "filloutlinetext", "drawoutlinetext", "outlinetexttopath", "checkedbounds", "checkbounds", "strut", "rule", "withmask", "bitmapimage", "colordecimals", "ddecimal", "dddecimal", "ddddecimal", "colordecimalslist", "textext", "thetextext", "rawtextext", "textextoffset", "texbox", "thetexbox", "rawtexbox", "istextext", "rawmadetext", "validtexbox", "onetimetextext", "rawfmttext", "thefmttext", "fmttext", "onetimefmttext", "notcached", "keepcached", "verbatim", "thelabel", "label", "autoalign", "transparent", "withtransparency", "withopacity", "property", "properties", "withproperties", "asgroup", "withpattern", "withpatternscale", "withpatternfloat", "infont", "space", "crlf", "dquote", "percent", "SPACE", "CRLF", "DQUOTE", "PERCENT", "grayscale", "greyscale", "withgray", "withgrey", "colorpart", "colorlike", "readfile", "clearxy", "unitvector", "center", "epsed", "anchored", "originpath", "infinite", "break", "xstretched", "ystretched", "snapped", "pathconnectors", "function", "constructedfunction", "constructedpath", "constructedpairs", "straightfunction", "straightpath", "straightpairs", "curvedfunction", "curvedpath", "curvedpairs", "evenly", "oddly", "condition", "pushcurrentpicture", "popcurrentpicture", "arrowpath", "resetarrows", "tensecircle", "roundedsquare", "colortype", "whitecolor", "blackcolor", "basiccolors", "complementary", "complemented", "resolvedcolor", "normalfill", "normaldraw", "visualizepaths", "detailpaths", "naturalizepaths", "drawboundary", "drawwholepath", "drawpathonly", "visualizeddraw", "visualizedfill", "detaileddraw", "draworigin", "drawboundingbox", "drawpath", "drawpoint", "drawpoints", "drawcontrolpoints", "drawcontrollines", "drawpointlabels", "drawlineoptions", "drawpointoptions", "drawcontroloptions", "drawlabeloptions", "draworiginoptions", "drawboundoptions", "drawpathoptions", "resetdrawoptions", "undashed", "pencilled", "decorated", "redecorated", "undecorated", "passvariable", "passarrayvariable", "tostring", "topair", "format", "formatted", "quotation", "quote", "startpassingvariable", "stoppassingvariable", "eofill", "eoclip", "nofill", "dofill", "fillup", "eofillup", "nodraw", "dodraw", "area", "addbackground", "shadedup", "shadeddown", "shadedleft", "shadedright", "sortlist", "copylist", "shapedlist", "listtocurves", "listtolines", "listsize", "listlast", "uniquelist", "circularpath", "squarepath", "linearpath", "theoffset", "texmode", "systemmode", "texvar", "texstr", "isarray", "prefix", "dimension", "getmacro", "getdimen", "getcount", "gettoks", "setmacro", "setdimen", "setcount", "settoks", "setglobalmacro", "setglobaldimen", "setglobalcount", "setglobaltoks", "positionpath", "positioncurve", "positionxy", "positionpxy", "positionwhd", "positionpage", "positionregion", "positionbox", "positionanchor", "positioninregion", "positionatanchor", "wdpart", "htpart", "dppart", "texvar", "texstr", "inpath", "pointof", "leftof", "rightof", "utfnum", "utflen", "utfsub", "newhash", "disposehash", "inhash", "tohash", "isarray", "prefix", "isobject", "comment", "report", "lua", "lualist", "mp", "MP", "luacall", "mirrored", "mirroredabout", "scriptindex", "newscriptindex", "newcolor", "newrgbcolor", "newcmykcolor", "newnumeric", "newboolean", "newtransform", "newpath", "newpicture", "newstring", "newpair", "mpvard", "mpvarn", "mpvars", "mpvar", "withtolerance" }, - ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "shadeoffset", "textextoffset", "textextanchor", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "ahvariant", "ahdimple", "ahfactor", "ahscale", "metapostversion", "maxdimensions", "drawoptionsfactor", "dq", "sq", "crossingscale", "crossingoption", "contextlmtxmode", "metafunversion", "minifunversion", "getparameters", "presetparameters", "hasparameter", "hasoption", "getparameter", "getparameterdefault", "getparametercount", "getmaxparametercount", "getparameterpath", "getparameterpen", "getparametertext", "applyparameters", "pushparameters", "popparameters", "definecolor", "anchorxy", "anchorx", "anchory", "anchorht", "anchordp", "anchorll", "anchorur", "anchorbox" }, + ["internals"]={ "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", "shadeoffset", "textextoffset", "textextanchor", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", "huetransparent", "saturationtransparent", "colortransparent", "luminositytransparent", "ahvariant", "ahdimple", "ahfactor", "ahscale", "metapostversion", "maxdimensions", "drawoptionsfactor", "dq", "sq", "crossingscale", "crossingoption", "contextlmtxmode", "metafunversion", "minifunversion", "getparameters", "presetparameters", "hasparameter", "hasoption", "getparameter", "getparameterdefault", "getparametercount", "getmaxparametercount", "getparameterpath", "getparameterpen", "getparametertext", "applyparameters", "pushparameters", "popparameters", "definecolor", "anchorxy", "anchorx", "anchory", "anchorht", "anchordp", "anchorul", "anchorll", "anchorlr", "anchorur", "localanchorbox", "localanchorcell", "localanchorspan", "anchorbox", "anchorcell", "anchorspan", "matrixbox", "matrixcell", "matrixspan" }, } \ No newline at end of file diff --git a/context/data/textadept/context/lexers/scite-context-lexer-tex.lua b/context/data/textadept/context/lexers/scite-context-lexer-tex.lua index d4e28f99b..71cfce0f5 100644 --- a/context/data/textadept/context/lexers/scite-context-lexer-tex.lua +++ b/context/data/textadept/context/lexers/scite-context-lexer-tex.lua @@ -435,7 +435,7 @@ local stopluacode = #stoplua * token("embedded", stoplua) local luacall = P("clf_") * R("az","__","AZ")^1 -local metafuncall = ( P("reusable") + P("usable") + P("unique") + P("use") + P("reuse") ) * ("MPgraphic") +local metafuncall = ( P("reusable") + P("usable") + P("unique") + P("use") + P("reuse") + P("overlay") ) * ("MPgraphic") + P("uniqueMPpagegraphic") + P("MPpositiongraphic") diff --git a/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json b/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json index c91cf2b44..469656cc1 100644 --- a/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json +++ b/context/data/vscode/extensions/context/syntaxes/context-syntax-mps.json @@ -138,7 +138,7 @@ "name" : "context.string.string.text.mps" }, "shortcut" : { - "match" : "(vrbcatcoderegime|txtcatcoderegime|textextoffset|textextanchor|texcatcoderegime|squared|sq|softlighttransparent|shadeoffset|shadefactor|screentransparent|saturationtransparent|rounded|rgbcolormodel|pushparameters|prtcatcoderegime|presetparameters|popparameters|pen_top|pen_rt|pen_lft|pen_bot|overlaytransparent|notcatcoderegime|normaltransparent|nocolormodel|multiplytransparent|mitered|minifunversion|metapostversion|metafunversion|maxdimensions|luminositytransparent|luacatcoderegime|lightentransparent|labeloffset|join_radius|inicatcoderegime|infinity|huetransparent|hasparameter|hasoption|hardlighttransparent|greycolormodel|graycolormodel|getparametertext|getparameters|getparameterpen|getparameterpath|getparameterdefault|getparametercount|getparameter|getmaxparametercount|exclusiontransparent|epsilon|eps|drawoptionsfactor|dq|dotlabeldiam|ditto|differencetransparent|definecolor|defaultscale|defaultpen|darkentransparent|ctxcatcoderegime|crossingscale|crossingoption|contextlmtxmode|colortransparent|colordodgetransparent|colorburntransparent|cmykcolormodel|charscale|catcoderegime|butt|beveled|bboxmargin|applyparameters|anchory|anchorxy|anchorx|anchorur|anchorll|anchorht|anchordp|anchorbox|ahvariant|ahscale|ahlength|ahfactor|ahdimple|ahangle|EOF)(?=[^a-zA-Z\u005C_@!?-ÿ])", + "match" : "(vrbcatcoderegime|txtcatcoderegime|textextoffset|textextanchor|texcatcoderegime|squared|sq|softlighttransparent|shadeoffset|shadefactor|screentransparent|saturationtransparent|rounded|rgbcolormodel|pushparameters|prtcatcoderegime|presetparameters|popparameters|pen_top|pen_rt|pen_lft|pen_bot|overlaytransparent|notcatcoderegime|normaltransparent|nocolormodel|multiplytransparent|mitered|minifunversion|metapostversion|metafunversion|maxdimensions|matrixspan|matrixcell|matrixbox|luminositytransparent|luacatcoderegime|localanchorspan|localanchorcell|localanchorbox|lightentransparent|labeloffset|join_radius|inicatcoderegime|infinity|huetransparent|hasparameter|hasoption|hardlighttransparent|greycolormodel|graycolormodel|getparametertext|getparameters|getparameterpen|getparameterpath|getparameterdefault|getparametercount|getparameter|getmaxparametercount|exclusiontransparent|epsilon|eps|drawoptionsfactor|dq|dotlabeldiam|ditto|differencetransparent|definecolor|defaultscale|defaultpen|darkentransparent|ctxcatcoderegime|crossingscale|crossingoption|contextlmtxmode|colortransparent|colordodgetransparent|colorburntransparent|cmykcolormodel|charscale|catcoderegime|butt|beveled|bboxmargin|applyparameters|anchory|anchorxy|anchorx|anchorur|anchorul|anchorspan|anchorlr|anchorll|anchorht|anchordp|anchorcell|anchorbox|ahvariant|ahscale|ahlength|ahfactor|ahdimple|ahangle|EOF)(?=[^a-zA-Z\u005C_@!?-ÿ])", "name" : "context.data.shortcut.mps" }, "special" : { diff --git a/doc/context/scripts/mkiv/context.html b/doc/context/scripts/mkiv/context.html index 682b8621f..016f6c768 100644 --- a/doc/context/scripts/mkiv/context.html +++ b/doc/context/scripts/mkiv/context.html @@ -108,6 +108,7 @@ --profileprofile job (use: mtxrun --script profile --analyze) --timinggenerate timing and statistics overview --keeptuckeep previous tuc files (jobname-tuc-[run].tmp) + --keeppdfkeep previous pdf files (jobname-pdf-keep.tmp) --keeplogkeep previous log files (jobname-log-[run].tmp) --lmtxforce lmtx mode (when available) --overloadmode=error|warning|0--6|255enable csname overload checking diff --git a/doc/context/scripts/mkiv/context.man b/doc/context/scripts/mkiv/context.man index 7d9e949bb..b6e380237 100644 --- a/doc/context/scripts/mkiv/context.man +++ b/doc/context/scripts/mkiv/context.man @@ -171,6 +171,9 @@ generate timing and statistics overview .B --keeptuc keep previous tuc files (jobname-tuc-[run].tmp) .TP +.B --keeppdf +keep previous pdf files (jobname-pdf-keep.tmp) +.TP .B --keeplog keep previous log files (jobname-log-[run].tmp) .TP diff --git a/doc/context/scripts/mkiv/context.xml b/doc/context/scripts/mkiv/context.xml index 98a75244b..d4e0d33c5 100644 --- a/doc/context/scripts/mkiv/context.xml +++ b/doc/context/scripts/mkiv/context.xml @@ -202,6 +202,9 @@ keep previous tuc files (jobname-tuc-[run].tmp) + + keep previous pdf files (jobname-pdf-keep.tmp) + keep previous log files (jobname-log-[run].tmp) diff --git a/doc/context/scripts/mkiv/mtx-context.html b/doc/context/scripts/mkiv/mtx-context.html index 682b8621f..016f6c768 100644 --- a/doc/context/scripts/mkiv/mtx-context.html +++ b/doc/context/scripts/mkiv/mtx-context.html @@ -108,6 +108,7 @@ --profileprofile job (use: mtxrun --script profile --analyze) --timinggenerate timing and statistics overview --keeptuckeep previous tuc files (jobname-tuc-[run].tmp) + --keeppdfkeep previous pdf files (jobname-pdf-keep.tmp) --keeplogkeep previous log files (jobname-log-[run].tmp) --lmtxforce lmtx mode (when available) --overloadmode=error|warning|0--6|255enable csname overload checking diff --git a/doc/context/scripts/mkiv/mtx-context.man b/doc/context/scripts/mkiv/mtx-context.man index 7d9e949bb..b6e380237 100644 --- a/doc/context/scripts/mkiv/mtx-context.man +++ b/doc/context/scripts/mkiv/mtx-context.man @@ -171,6 +171,9 @@ generate timing and statistics overview .B --keeptuc keep previous tuc files (jobname-tuc-[run].tmp) .TP +.B --keeppdf +keep previous pdf files (jobname-pdf-keep.tmp) +.TP .B --keeplog keep previous log files (jobname-log-[run].tmp) .TP diff --git a/doc/context/scripts/mkiv/mtx-context.xml b/doc/context/scripts/mkiv/mtx-context.xml index 98a75244b..d4e0d33c5 100644 --- a/doc/context/scripts/mkiv/mtx-context.xml +++ b/doc/context/scripts/mkiv/mtx-context.xml @@ -202,6 +202,9 @@ keep previous tuc files (jobname-tuc-[run].tmp) + + keep previous pdf files (jobname-pdf-keep.tmp) + keep previous log files (jobname-log-[run].tmp) diff --git a/metapost/context/base/mpiv/mp-page.mpiv b/metapost/context/base/mpiv/mp-page.mpiv index 7bc7c127c..6aed73868 100644 --- a/metapost/context/base/mpiv/mp-page.mpiv +++ b/metapost/context/base/mpiv/mp-page.mpiv @@ -504,6 +504,10 @@ def OverlayBox = (unitsquare xyscaled (OverlayWidth,OverlayHeight)) enddef ; +def BoundToOverlayBox = + setbounds currentpicture to OverlayBox; +enddef ; + % handy def innerenlarged = diff --git a/metapost/context/base/mpxl/mp-lmtx.mpxl b/metapost/context/base/mpxl/mp-lmtx.mpxl index 204986df3..f06bb6991 100644 --- a/metapost/context/base/mpxl/mp-lmtx.mpxl +++ b/metapost/context/base/mpxl/mp-lmtx.mpxl @@ -2412,3 +2412,136 @@ vardef lmt_do_labtorgb = ) enddef ; +% For now we collect all lmt namespace extensions here, so also this one: + +presetparameters "matrix" [ + % cell = (1, 1), + % from = (1, 1), + % to = (1, 1), + % shape = { "circle", "square" }, + connect = { "center", "center" }, + % text = "", +] ; + +def lmt_matrix = applyparameters "matrix" "lmt_do_matrix" enddef ; + +vardef mfun_lmt_matrix_cell (expr p) = + % anchorbox ("matrix", xpart p, ypart p) ("matrix", xpart p + 1, ypart p) + matrixcell (xpart p, ypart p) +enddef ; + +% todo: lft rt etc but then we need to push/pop the linewidth too + +def mfun_lmt_matrix_connect (expr h, p, r, l, u, d, gap) = + if h == "right" : center rightboundary (p enlarged gap) { r } + elseif h == "left" : center leftboundary (p enlarged gap) { l } + elseif h == "top" : center topboundary (p enlarged gap) { u } + elseif h == "bottom" : center bottomboundary (p enlarged gap) { d } + else : center (p enlarged gap) + fi +enddef ; + +def mfun_lmt_matrix_source (expr p, h, gap) = + mfun_lmt_matrix_connect(h, p, right, left, up, down, gap) +enddef ; + +def mfun_lmt_matrix_target (expr p, h, gap) = + mfun_lmt_matrix_connect(h, p, left, right, down, up, gap) +enddef ; + +vardef mfun_lmt_matrix_enhance (expr p, h) = + if h = "circle" : + fullcircle xysized (bbwidth p, bbheight p) shifted center p + elseif h = "round" : + (p smoothed getparameterdefault "radius" ExHeight) xysized (bbwidth p, bbheight p) + elseif h = "path" : + (getparameterpath "path") shifted center p + elseif h = "scaledpath" : + (getparameterpath "path") xysized (bbwidth p, bbheight p) shifted center p + else : + p + fi +enddef ; + +vardef lmt_do_matrix = + image ( + pushparameters "matrix" ; + draw image ( + save a, b, c, o, g ; path a, b, c ; numeric o, g ; + if (hasparameter "arrowoffset") : + g := getparameter "arrowoffset" ; + elseif (hasparameter "linewidth") : + g := getparameter "linewidth" ; + else : + g := 0; + fi ; + if (hasparameter "from") and (hasparameter "to") : + a := mfun_lmt_matrix_cell(getparameter "from") ; + b := mfun_lmt_matrix_cell(getparameter "to") ; + if hasparameter "offset" : + o := getparameter "offset" ; + a := a enlarged o ; + b := b enlarged o ; + fi ; + if hasparameter "shapes" : + a := mfun_lmt_matrix_enhance(a, getparameter "shapes" 1) ; + b := mfun_lmt_matrix_enhance(b, getparameter "shapes" 2) ; + fi ; + draw a + if (hasparameter "colors") : + withcolor (getparameter "colors" 1) + elseif (hasparameter "color") : + withcolor (getparameter "color") + fi + ; + draw b + if (hasparameter "colors") : + withcolor (getparameter "colors" 2) + elseif (hasparameter "color") : + withcolor (getparameter "color") + fi + ; + c := + mfun_lmt_matrix_source(a, getparameter "connect" 1, g) .. + mfun_lmt_matrix_target(b, getparameter "connect" 2, g) ; + drawarrow c + if (hasparameter "arrowcolor") : + withcolor (getparameter "arrowcolor") + elseif (hasparameter "color") : + withcolor (getparameter "color") + fi + ; + if hasparameter "label" : + pushparameters "label" ; + draw lmt_text [ + text = getparameter "text", + position = point (getparameterdefault "fraction" 1/2) of c, + offset = if hasparameter "offset" : getparameter "offset" fi, + color = if hasparameter "color" : getparameter "color" fi, + anchor = if hasparameter "anchor" : getparameter "anchor" fi, + % strut style format background backgroundcolor + ] ; + popparameters ; + fi ; + elseif (hasparameter "cell") : + a := mfun_lmt_matrix_cell(getparameter "cell") ; + if hasparameter "offset" : + o := getparameter "offset" ; + a := a enlarged o ; + fi ; + if hasparameter "shape" : + a := mfun_lmt_matrix_enhance(a, getparameter "shape") ; + fi ; + draw a + if (hasparameter "color") : + withcolor (getparameter "color") + fi + ; + fi; + ) + if (hasparameter "linewidth") : + withpen pencircle scaled (getparameter "linewidth") + fi + popparameters + ) +enddef ; diff --git a/metapost/context/base/mpxl/mp-luas.mpxl b/metapost/context/base/mpxl/mp-luas.mpxl index 4b92bb423..0fea462ff 100644 --- a/metapost/context/base/mpxl/mp-luas.mpxl +++ b/metapost/context/base/mpxl/mp-luas.mpxl @@ -318,24 +318,50 @@ enddef ; permanent textextanchor ; -newscriptindex mfid_anchorxy ; mfid_anchorxy := scriptindex "anchorxy" ; def anchorxy (expr name, x, y) = runscript mfid_anchorxy name x y enddef ; -newscriptindex mfid_anchorx ; mfid_anchorx := scriptindex "anchorx" ; def anchorx (expr name, x, y) = runscript mfid_anchorx name x y enddef ; -newscriptindex mfid_anchory ; mfid_anchory := scriptindex "anchory" ; def anchory (expr name, x, y) = runscript mfid_anchory name x y enddef ; -newscriptindex mfid_anchorht ; mfid_anchorht := scriptindex "anchorht" ; def anchorht (expr name, x, y) = runscript mfid_anchorht name x y enddef ; -newscriptindex mfid_anchordp ; mfid_anchordp := scriptindex "anchordp" ; def anchordp (expr name, x, y) = runscript mfid_anchordp name x y enddef ; -newscriptindex mfid_anchorll ; mfid_anchorll := scriptindex "anchorll" ; def anchorll (expr name, x, y) = runscript mfid_anchorll name x y enddef ; -newscriptindex mfid_anchorur ; mfid_anchorur := scriptindex "anchorur" ; def anchorur (expr name, x, y) = runscript mfid_anchorur name x y enddef ; -newscriptindex mfid_anchorbox ; mfid_anchorbox := scriptindex "anchorbox" ; - -vardef anchorbox(expr lname, lx, ly, rname, rx, ry) = - (runscript mfid_anchorbox lname lx ly rname rx ry) -enddef ; - -vardef matrixbox (expr fx, fy, tx, ty) = - anchorbox ("matrix", fx, fy) ("matrix", tx + 1, ty) -enddef ; +newscriptindex mfid_anchorxy ; mfid_anchorxy := scriptindex "anchorxy" ; +newscriptindex mfid_anchorx ; mfid_anchorx := scriptindex "anchorx" ; +newscriptindex mfid_anchory ; mfid_anchory := scriptindex "anchory" ; +newscriptindex mfid_anchorht ; mfid_anchorht := scriptindex "anchorht" ; +newscriptindex mfid_anchordp ; mfid_anchordp := scriptindex "anchordp" ; +newscriptindex mfid_anchorul ; mfid_anchorul := scriptindex "anchorul" ; +newscriptindex mfid_anchorll ; mfid_anchorll := scriptindex "anchorll" ; +newscriptindex mfid_anchorlr ; mfid_anchorlr := scriptindex "anchorlr" ; +newscriptindex mfid_anchorur ; mfid_anchorur := scriptindex "anchorur" ; +newscriptindex mfid_anchorbox ; mfid_anchorbox := scriptindex "anchorbox" ; +newscriptindex mfid_anchorspan ; mfid_anchorspan := scriptindex "anchorspan" ; + +def anchorxy (expr name, x, y) = runscript mfid_anchorxy name x y enddef ; +def anchorx (expr name, x, y) = runscript mfid_anchorx name x y enddef ; +def anchory (expr name, x, y) = runscript mfid_anchory name x y enddef ; +def anchorht (expr name, x, y) = runscript mfid_anchorht name x y enddef ; +def anchordp (expr name, x, y) = runscript mfid_anchordp name x y enddef ; +def anchorul (expr name, x, y) = runscript mfid_anchorul name x y enddef ; +def anchorll (expr name, x, y) = runscript mfid_anchorll name x y enddef ; +def anchorlr (expr name, x, y) = runscript mfid_anchorlr name x y enddef ; +def anchorur (expr name, x, y) = runscript mfid_anchorur name x y enddef ; + +% todo: matrix = + +string mfun_local_anchor_tag ; mfun_local_anchor_tag := "matrix" ; % todo: push pop + + +vardef localanchorbox (expr lname, fx, fy, rname, tx, ty) = (runscript mfid_anchorbox lname fx fy rname tx ty) enddef ; +vardef localanchorspan(expr lname, fx, fy, rname, tx, ty) = (runscript mfid_anchorspan lname fx fy rname tx ty) enddef ; +vardef localanchorcell(expr name, x, y ) = (runscript mfid_anchorspan name x y name x y) enddef ; + +vardef anchorbox (expr fx, fy, tx, ty) = (runscript mfid_anchorbox mfun_local_anchor_tag fx fy mfun_local_anchor_tag tx ty) enddef ; +vardef anchorspan(expr fx, fy, tx, ty) = (runscript mfid_anchorspan mfun_local_anchor_tag fx fy mfun_local_anchor_tag tx ty) enddef ; +vardef anchorcell(expr x, y ) = (runscript mfid_anchorspan mfun_local_anchor_tag x y mfun_local_anchor_tag x y) enddef ; + +vardef matrixbox (expr fx, fy, tx, ty) = (runscript mfid_anchorbox mfun_local_anchor_tag fx fy mfun_local_anchor_tag (tx+1) ty) enddef ; +vardef matrixspan(expr fx, fy, tx, ty) = (runscript mfid_anchorspan mfun_local_anchor_tag fx fy mfun_local_anchor_tag (tx+1) ty) enddef ; +vardef matrixcell(expr x, y ) = (runscript mfid_anchorbox mfun_local_anchor_tag x y mfun_local_anchor_tag ( x+1) y) enddef ; permanent anchorxy, anchorx, anchory, anchorht, anchordp, - anchorll, anchorur, anchorbox ; + anchorul, anchorll, anchorlr, anchorur, anchorbox, + anchorspan ; + +permanent + matrixbox, matrixspan, matrixcell diff --git a/metapost/context/base/mpxl/mp-page.mpxl b/metapost/context/base/mpxl/mp-page.mpxl index 72831e927..525a5b157 100644 --- a/metapost/context/base/mpxl/mp-page.mpxl +++ b/metapost/context/base/mpxl/mp-page.mpxl @@ -222,9 +222,16 @@ def OverlayBox = (unitsquare xyscaled (OverlayWidth,OverlayHeight)) enddef ; +def BoundToOverlayBox = + setbounds currentpicture to OverlayBox; +enddef ; + immutable % permanent OverlayBox ; +permanent + BoundToOverlayBox ; + % handy def innerenlarged = diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index d419dd25e..f5971e15c 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -361,20 +361,29 @@ local function multipass_changed(oldhash, newhash) return false end -local f_tempfile = formatters["%s-%s-%02d.tmp"] +local f_tempfile_i = formatters["%s-%s-%02d.tmp"] +local f_tempfile_s = formatters["%s-%s-keep.%s"] local function backup(jobname,run,kind,filename) - if run == 1 then - for i=1,10 do - local tmpname = f_tempfile(jobname,kind,i) - if validfile(tmpname) then - removefile(tmpname) - report("removing %a",tmpname) + if run then + if run == 1 then + for i=1,10 do + local tmpname = f_tempfile_i(jobname,kind,i) + if validfile(tmpname) then + removefile(tmpname) + report("removing %a",tmpname) + end end end - end - if validfile(filename) then - local tmpname = f_tempfile(jobname,kind,run or 1) + if validfile(filename) then + local tmpname = f_tempfile(jobname,kind,run or 1) + report("copying %a into %a",filename,tmpname) + file.copy(filename,tmpname) + else + report("no file %a, nothing kept",filename) + end + elseif validfile(filename) then + local tmpname = f_tempfile_s(jobname,kind,kind) report("copying %a into %a",filename,tmpname) file.copy(filename,tmpname) else @@ -395,6 +404,14 @@ local function multipass_copyluafile(jobname,run) end end +local function multipass_copypdffile(jobname,run) + local pdfname = jobname..".pdf" + if validfile(pdfname) then + backup(jobname,false,"pdf",pdfname) + report() + end +end + local function multipass_copylogfile(jobname,run) local logname = jobname..".log" if validfile(logname) then @@ -673,6 +690,7 @@ function scripts.context.run(ctxdata,filename) local a_texformat = getargument("texformat") local a_keeptuc = getargument("keeptuc") local a_keeplog = getargument("keeplog") + local a_keeppdf = getargument("keeppdf") local a_export = getargument("export") local a_nodates = getargument("nodates") local a_trailerid = getargument("trailerid") @@ -890,6 +908,7 @@ function scripts.context.run(ctxdata,filename) elseif returncode == 0 then multipass_copyluafile(jobname,a_keeptuc and currentrun) multipass_copylogfile(jobname,a_keeplog and currentrun) + multipass_copypdffile(jobname,a_keeppdf and currentrun) if not multipass_forcedruns then newhash = multipass_hashfiles(jobname) if multipass_changed(oldhash,newhash) then diff --git a/scripts/context/lua/mtx-context.xml b/scripts/context/lua/mtx-context.xml index 98a75244b..d4e0d33c5 100644 --- a/scripts/context/lua/mtx-context.xml +++ b/scripts/context/lua/mtx-context.xml @@ -202,6 +202,9 @@ keep previous tuc files (jobname-tuc-[run].tmp) + + keep previous pdf files (jobname-pdf-keep.tmp) + keep previous log files (jobname-log-[run].tmp) diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 3b21edcd9..aac7ad364 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.06.01 17:00} +\newcontextversion{2021.06.04 17:20} %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/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 03b2f79bc..b0041b657 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.06.01 17:00} +\edef\contextversion{2021.06.04 17:20} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii index d67e993c4..c6897ce88 100644 --- a/tex/context/base/mkii/mult-ro.mkii +++ b/tex/context/base/mkii/mult-ro.mkii @@ -1265,6 +1265,7 @@ \setinterfaceconstant{symbolset}{setsimbol} \setinterfaceconstant{symcolor}{culoaresimbol} \setinterfaceconstant{symstyle}{stilsimbol} +\setinterfaceconstant{synchronize}{synchronize} \setinterfaceconstant{synonym}{sinonim} \setinterfaceconstant{synonymcolor}{culoaresinonim} \setinterfaceconstant{synonymcommand}{synonymcommand} diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua index c6c8c915b..9ce52cc8a 100644 --- a/tex/context/base/mkiv/char-ini.lua +++ b/tex/context/base/mkiv/char-ini.lua @@ -47,9 +47,9 @@ loaded!

-- todo: in 'char-def.lua' assume defaults: -- --- directtions = l --- cjkwd = a --- linebreak = al +-- directions = l +-- cjkwd = a +-- linebreak = al characters = characters or { } local characters = characters @@ -66,9 +66,17 @@ end Extending the table. --ldx]]-- -if context and not characters.private then +if context then - require("char-prv") + if not characters.private then + + require("char-prv") + + if storage then + storage.register("characters/private", characters.private, "characters.private") + end + + end for unicode, d in next, characters.private do data[unicode] = d @@ -932,7 +940,7 @@ if not characters.fallbacks then end -if storage then +if storage then -- in case we extend storage.register("characters/fallbacks", characters.fallbacks, "characters.fallbacks") -- accents and such end diff --git a/tex/context/base/mkiv/cont-fil.mkiv b/tex/context/base/mkiv/cont-fil.mkiv index edef8dbc8..1d2a44b1f 100644 --- a/tex/context/base/mkiv/cont-fil.mkiv +++ b/tex/context/base/mkiv/cont-fil.mkiv @@ -149,4 +149,6 @@ %definefilesynonym [set-13] [setups-proofing] %definefilesynonym [set-15] [setups-generate] +\definefilesynonym [newmml] [mathml] + \endinput diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index caf46fe43..d4815dd08 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.06.01 17:00} +\newcontextversion{2021.06.04 17:20} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 005fbf05a..ac9434b86 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.06.01 17:00} +\edef\contextversion{2021.06.04 17:20} %D Kind of special: diff --git a/tex/context/base/mkiv/lxml-ini.lua b/tex/context/base/mkiv/lxml-ini.lua index 43bc3efc8..6524670fc 100644 --- a/tex/context/base/mkiv/lxml-ini.lua +++ b/tex/context/base/mkiv/lxml-ini.lua @@ -162,6 +162,8 @@ if CONTEXTLMTXMODE > 0 then local found = xml.found local empty = xml.empty local checkedempty = xml.checkedempty + local ifatt = lxml.ifatt + local ifattempty = lxml.ifattempty implement { name = "ifxml", @@ -183,6 +185,27 @@ if CONTEXTLMTXMODE > 0 then end } + implement { + name = "ifxmlatt", + public = true, + usage = "condition", + arguments = "3 arguments", + actions = function(id,name,value) + return boolean_code, ifatt(getid(id),name,value) + end + } + + implement { + name = "ifxmlattempty", + public = true, + usage = "condition", + arguments = "2 arguments", + actions = function(id,name) + return boolean_code, ifattempty(getid(id),name) + end + } + + implement { name = "ifxmlempty", public = true, diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua index 75bd9b84c..148484f51 100644 --- a/tex/context/base/mkiv/lxml-tex.lua +++ b/tex/context/base/mkiv/lxml-tex.lua @@ -2070,6 +2070,28 @@ do end end + function lxml.ifatt(id,a,value) + local e = getid(id) + if e then + local at = e.at + att = at and at[a] or "" + else + att = "" + end + return att == value + end + + function lxml.ifattempty(id,a) + local e = getid(id) + if e then + local at = e.at + if at and at[a] ~= "" then + return true + end + end + return false + end + function lxml.refatt(id,a) local e = getid(id) if e then diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua index 1cacdff27..e9572f983 100644 --- a/tex/context/base/mkiv/mult-fun.lua +++ b/tex/context/base/mkiv/mult-fun.lua @@ -40,7 +40,10 @@ return { -- "anchorxy", "anchorx", "anchory", "anchorht", "anchordp", - "anchorll", "anchorur", "anchorbox", + "anchorul", "anchorll", "anchorlr", "anchorur", + "localanchorbox", "localanchorcell", "localanchorspan", + "anchorbox", "anchorcell", "anchorspan", + "matrixbox", "matrixcell", "matrixspan", }, commands = { "loadfile", "loadimage", "loadmodule", diff --git a/tex/context/base/mkiv/s-inf-01-pdf-keep.pdf b/tex/context/base/mkiv/s-inf-01-pdf-keep.pdf new file mode 100644 index 000000000..0002d614e Binary files /dev/null and b/tex/context/base/mkiv/s-inf-01-pdf-keep.pdf differ diff --git a/tex/context/base/mkiv/s-inf-03-pdf-keep.pdf b/tex/context/base/mkiv/s-inf-03-pdf-keep.pdf new file mode 100644 index 000000000..b037b49ab Binary files /dev/null and b/tex/context/base/mkiv/s-inf-03-pdf-keep.pdf differ diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 3b3e4165a..0002d614e 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index f276ac586..b037b49ab 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkxl/anch-loc.lmt b/tex/context/base/mkxl/anch-loc.lmt index 56ddeb7e2..09c1406ff 100644 --- a/tex/context/base/mkxl/anch-loc.lmt +++ b/tex/context/base/mkxl/anch-loc.lmt @@ -131,7 +131,25 @@ local function anchordp(name,x,y) end end +local function anchorlr(name,x,y) + local v = valid(name,x,y) + if v then + return v[1] + v[7][1], v[2] - v[7][3] + else + return 0, 0 + end +end + local function anchorur(name,x,y) + local v = valid(name,x,y) + if v then + return v[1] + v[7][1], v[2] + v[7][2] + else + return 0, 0 + end +end + +local function anchorul(name,x,y) local v = valid(name,x,y) if v then return v[1], v[2] + v[7][2] @@ -398,31 +416,21 @@ do return injectpair(x*bpfactor,y*bpfactor) end) - registerdirect("anchorx", function() - return anchorx(scanstring(),scaninteger(),scaninteger()) * bpfactor - end) - - registerdirect("anchory", function() - return anchory(scanstring(),scaninteger(),scaninteger()) * bpfactor - end) + registerdirect("anchorx", function() return anchorx(scanstring(),scaninteger(),scaninteger()) * bpfactor end) + registerdirect("anchory", function() return anchory(scanstring(),scaninteger(),scaninteger()) * bpfactor end) - registerdirect("anchorht", function() - return anchorht(scanstring(),scaninteger(),scaninteger()) * bpfactor - end) + registerdirect("anchorht", function() return anchorht(scanstring(),scaninteger(),scaninteger()) * bpfactor end) + registerdirect("anchordp", function() return anchordp(scanstring(),scaninteger(),scaninteger()) * bpfactor end) - registerdirect("anchordp", function() - return anchordp(scanstring(),scaninteger(),scaninteger()) * bpfactor - end) - - registerdirect("anchorur", function() - local x, y = anchorur(scanstring(),scaninteger(),scaninteger()) + local function corner(f) + local x, y = f(scanstring(),scaninteger(),scaninteger()) return injectpair(x*bpfactor,y*bpfactor) - end) + end - registerdirect("anchorll", function() - local x, y = anchorll(scanstring(),scaninteger(),scaninteger()) - return injectpair(x*bpfactor,y*bpfactor) - end) + registerdirect("anchorlr", function() return corner(anchorlr) end) + registerdirect("anchorur", function() return corner(anchorur) end) + registerdirect("anchorul", function() return corner(anchorul) end) + registerdirect("anchorll", function() return corner(anchorll) end) registerscript("anchorbox", function() local l = valid(scanstring(),scaninteger(),scaninteger()) @@ -464,14 +472,42 @@ do { urx, ury }, { llx, ury } } - -- local p = { - -- cycle = true, - -- -- curled = true, - -- { x_coord = llx, y_coord = lly }, - -- { x_coord = urx, y_coord = lly }, - -- { x_coord = urx, y_coord = ury }, - -- { x_coord = llx, y_coord = ury } - -- } + injectpath(p) + end) + + -- boundingbox ( + -- anchorul(lname, lx, ly) -- + -- anchorlr(rname, rx, ry) + -- ) + + local min = math.min + local max = math.max + + registerscript("anchorspan", function() + local l = valid(scanstring(),scaninteger(),scaninteger()) + local r = valid(scanstring(),scaninteger(),scaninteger()) + local llx, lly, urx, ury, lb, ub + if l and r then + lb = l[7] + rb = r[7] + llx = min((l[1] ),(r[1] )) * bpfactor + lly = min((l[2] - lb[3]),(r[2] - rb[3])) * bpfactor + urx = max((l[1] + lb[1]),(r[1] + rb[1])) * bpfactor + ury = max((l[2] + lb[2]),(r[2] + rb[2])) * bpfactor + else + llx = 0 + lly = 0 + urx = 0 + ury = 0 + end + local p = { + cycle = true, +-- curled = true, + { llx, lly }, + { urx, lly }, + { urx, ury }, + { llx, ury } + } injectpath(p) end) diff --git a/tex/context/base/mkxl/anch-pos.lmt b/tex/context/base/mkxl/anch-pos.lmt index 67d1657f2..94eb443c6 100644 --- a/tex/context/base/mkxl/anch-pos.lmt +++ b/tex/context/base/mkxl/anch-pos.lmt @@ -477,25 +477,29 @@ implement { local function b_region(specification) local tag = specification.tag or specification local last = tobesaved[tag] - local x, y = getpos() - last.x = x ~= 0 and x or nil - last.y = y ~= 0 and y or nil - last.p = texgetcount("realpageno") - insert(regions,tag) -- todo: fast stack - region = tag + if last then + local x, y = getpos() + last.x = x ~= 0 and x or nil + last.y = y ~= 0 and y or nil + last.p = texgetcount("realpageno") + insert(regions,tag) -- todo: fast stack + region = tag + end end local function e_region(specification) local last = tobesaved[region] - local y = getvpos() - local x, y = getpos() - if specification.correct then - local h = (last.y or 0) - y - last.h = h ~= 0 and h or nil - end - last.y = y ~= 0 and y or nil - remove(regions) -- todo: fast stack - region = regions[#regions] + if last then + local y = getvpos() + local x, y = getpos() + if specification.correct then + local h = (last.y or 0) - y + last.h = h ~= 0 and h or nil + end + last.y = y ~= 0 and y or nil + remove(regions) -- todo: fast stack + region = regions[#regions] + end end jobpositions.b_region = b_region diff --git a/tex/context/base/mkxl/cont-fil.mkxl b/tex/context/base/mkxl/cont-fil.mkxl index 57bfd2794..e7fdd6f82 100644 --- a/tex/context/base/mkxl/cont-fil.mkxl +++ b/tex/context/base/mkxl/cont-fil.mkxl @@ -150,4 +150,6 @@ \definefilesynonym [zint] [libs-imp-zint] \definefilesynonym [barcode] [libs-imp-zint] +\definefilesynonym [newmml] [mathml] + \endinput diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 730c7896c..05c0fc8b2 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.06.01 17:00} +\newcontextversion{2021.06.04 17:20} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 916b1bb8f..bbd67d48b 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.06.01 17:00} +\immutable\edef\contextversion{2021.06.04 17:20} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/font-mat.mklx b/tex/context/base/mkxl/font-mat.mklx index 055624d03..1963d808d 100644 --- a/tex/context/base/mkxl/font-mat.mklx +++ b/tex/context/base/mkxl/font-mat.mklx @@ -127,7 +127,7 @@ \def\font_helpers_set_math_family_set_scales_compact {% these are used when no font setting is there, the settings come before setting the parameters % and are stored with the family - \glyphtextscale \plusthousand + \glyphtextscale \plusthousand \glyphscriptscale \numexpr\plusthousand*\dimexpr\scriptface \relax/\dimexpr\textface\relax\relax \glyphscriptscriptscale \numexpr\plusthousand*\dimexpr\scriptscriptface\relax/\dimexpr\textface\relax\relax} @@ -186,8 +186,8 @@ \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusone \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% defines \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% enables - \scriptfont #mbfam\scriptfont #mrfam% reuses - \scriptscriptfont#mbfam\scriptscriptfont#mrfam% reuses + \scriptfont #mbfam\textfont#mbfam% reuses + \scriptscriptfont#mbfam\textfont#mbfam% reuses \let\mathsizesuffix\empty \let\fontface\!!zerocount \let\fontbody\savedfontbody \let\defaultfontclass\savedfontclass @@ -255,36 +255,6 @@ %D little in restoring global states and, what's more important, we get rid of large %D math parameter push/pop in tracingall when not needed. -% \def\font_helpers_preset_math_family_indeed#fam#familytag% -% {\expandafter\let\expandafter\v_font_math_one\csname\??fontinstanceclass\fontclass-\fontbody-\s!mm-#familytag-\fontsize-1\endcsname -% \ifrelax\v_font_math_one -% \font_helpers_preset_math_family_warning -% \orelse\ifnum\fontid\textfont#fam=\fontid\v_font_math_one\else -% \font_helpers_preset_math_family_indeed_changed#fam#familytag% -% \fi} - -% \def\font_helpers_preset_math_family_warning -% {\writestatus{fonts}{math: unset for global bodyfont \fontclass\space at \fontbody}} - -% \def\font_helpers_preset_math_family_indeed_changed_normal#fam#familytag% -% {\font_helpers_set_math_family_set_scales_normal -% \scriptscriptfont#fam\csname\??fontinstanceclass\fontclass-\fontbody-\s!mm-#familytag-\fontsize-3\endcsname -% \scriptfont #fam\csname\??fontinstanceclass\fontclass-\fontbody-\s!mm-#familytag-\fontsize-2\endcsname -% \textfont #fam\v_font_math_one} - -% \def\font_helpers_preset_math_family_indeed_changed_compact#fam#familytag% -% {\font_helpers_set_math_family_set_scales_compact -% \scriptscriptfont#fam\v_font_math_one -% \scriptfont #fam\v_font_math_one -% \textfont #fam\v_font_math_one} - -% \def\font_helpers_preset_math_family_indeed_changed -% {\ifconditional\c_font_compact -% \expandafter\font_helpers_preset_math_family_indeed_changed_compact -% \else -% \expandafter\font_helpers_preset_math_family_indeed_changed_normal -% \fi} - \def\font_helpers_preset_math_family_indeed_normal#fam#familytag% {\expandafter\let\expandafter\font_math_last_font\csname\??fontinstanceclass\fontclass-\fontbody-\s!mm-#familytag-\fontsize-1\endcsname \font_math_last_font diff --git a/tex/context/base/mkxl/math-ali.mkxl b/tex/context/base/mkxl/math-ali.mkxl index ddc004198..f4294a978 100644 --- a/tex/context/base/mkxl/math-ali.mkxl +++ b/tex/context/base/mkxl/math-ali.mkxl @@ -400,9 +400,16 @@ \appendtoks \frozen\instance\setuevalue{\e!start\currentmathalignment}{\math_alignment_start[\currentmathalignment]}% - \frozen\instance\setvalue {\e!stop \currentmathalignment}{\math_alignment_stop}% + \frozen\instance\setvalue {\e!stop \currentmathalignment}{\math_alignment_stop}% can this be protected now? \to \everydefinemathalignment +% to be tested +% +% \appendtoks +% \frozen\instance\protected\defcsname\e!start\currentmathalignment\endcsname{\math_alignment_start[\currentmathalignment]}% +% \noaligned\frozen\instance\protected\defcsname\e!stop \currentmathalignment\endcsname{\math_alignment_stop}% +% \to \everydefinemathalignment + \setupmathalignment [\c!n=2, \c!m=1, diff --git a/tex/context/base/mkxl/math-ini.lmt b/tex/context/base/mkxl/math-ini.lmt new file mode 100644 index 000000000..857f21013 --- /dev/null +++ b/tex/context/base/mkxl/math-ini.lmt @@ -0,0 +1,762 @@ +if not modules then modules = { } end modules ['math-ini'] = { + version = 1.001, + comment = "companion to math-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- if needed we can use the info here to set up xetex definition files +-- the "8000 hackery influences direct characters (utf) as indirect \char's +-- +-- isn't characters.data loaded already ... shortcut it here +-- +-- replace code 7 by 0 as we don't use it anyway (chars with code 7 will adapt to +-- to the fam when set ... we use other means .. ok, we could use it for spacing but +-- then we also have to set the other characters (only a subset done now) + +local next, type = next, type +local formatters, find = string.formatters, string.find +local utfchar, utfbyte, utflength = utf.char, utf.byte, utf.length +----- floor = math.floor +local sortedhash = table.sortedhash +local toboolean = toboolean + +local context = context +local commands = commands +local implement = interfaces.implement + +local ctx_sprint = context.sprint +local ctx_doifelsesomething = commands.doifelsesomething + +local trace_defining = false trackers.register("math.defining", function(v) trace_defining = v end) + +local report_math = logs.reporter("mathematics","initializing") + +mathematics = mathematics or { } +local mathematics = mathematics + +mathematics.extrabase = fonts.privateoffsets.mathextrabase -- here we push some virtuals +mathematics.privatebase = fonts.privateoffsets.mathbase -- here we push the ex + +local unsetvalue = attributes.unsetvalue +local allocate = utilities.storage.allocate +local chardata = characters.data + +local texsetattribute = tex.setattribute +local setmathcode = tex.setmathcode +local setdelcode = tex.setdelcode + +local families = allocate { + mr = 0, + mb = 1, +} + +--- to be checked .. a few defaults in char-def that should be alpha + +local classes = allocate { + ord = 0, -- mathordcomm mathord + op = 1, -- mathopcomm mathop + bin = 2, -- mathbincomm mathbin + rel = 3, -- mathrelcomm mathrel + open = 4, -- mathopencomm mathopen + middle = 4, + close = 5, -- mathclosecomm mathclose + punct = 6, -- mathpunctcomm mathpunct + alpha = 7, -- mathalphacomm firstofoneargument + accent = 8, -- class 0 + radical = 9, + xaccent = 10, -- class 3 + topaccent = 11, -- class 0 + botaccent = 12, -- class 0 + under = 13, + over = 14, + delimiter = 15, + inner = 0, -- mathinnercomm mathinner + nothing = 0, -- mathnothingcomm firstofoneargument + choice = 0, -- mathchoicecomm @@mathchoicecomm + box = 0, -- mathboxcomm @@mathboxcomm + limop = 1, -- mathlimopcomm @@mathlimopcomm + nolop = 1, -- mathnolopcomm @@mathnolopcomm + -- + ordinary = 0, -- ord + alphabetic = 7, -- alpha + unknown = 0, -- nothing + default = 0, -- nothing + punctuation = 6, -- punct + normal = 0, -- nothing + opening = 4, -- open + closing = 5, -- close + binary = 2, -- bin + relation = 3, -- rel + fence = 0, -- unknown + diacritic = 8, -- accent + large = 1, -- op + variable = 7, -- alphabetic + number = 7, -- alphabetic + root = 16, -- a private one +} + +local open_class = 4 +local middle_class = 4 +local close_class = 5 +local accent_class = 8 +local radical_class = 9 +local topaccent_class = 11 +local botaccent_class = 12 +local under_class = 13 +local over_class = 14 +local delimiter_class = 15 +local root_class = 16 + +local accents = allocate { + accent = true, -- some can be both + topaccent = true, [11] = true, + botaccent = true, [12] = true, + under = true, [13] = true, + over = true, [14] = true, + unknown = false, +} + +local codes = allocate { + ordinary = 0, [0] = "ordinary", + largeoperator = 1, [1] = "largeoperator", + binaryoperator = 2, [2] = "binaryoperator", + relation = 3, [3] = "relation", + openingsymbol = 4, [4] = "openingsymbol", + closingsymbol = 5, [5] = "closingsymbol", + punctuation = 6, [6] = "punctuation", + variable = 7, [7] = "variable", +} + +local extensibles = allocate { + unknown = 0, + l = 1, left = 1, + r = 2, right = 2, + h = 3, horizontal = 3,-- lr or rl + u = 5, up = 4, + d = 5, down = 5, + v = 6, vertical = 6,-- ud or du + m = 7, mixed = 7, +} + +table.setmetatableindex(extensibles,function(t,k) t[k] = 0 return 0 end) + +local virtualized = allocate { +} + +function mathematics.virtualize(unicode,virtual) + + local function virtualize(k,v) + local c = virtualized[k] + if c == v then + report_math("character %C is already virtualized to %C",k,v) + elseif c then + report_math("character %C is already virtualized to %C, ignoring mapping to %C",k,c,v) + else + virtualized[k] = v + end + end + + if type(unicode) == "table" then + for k, v in next, unicode do + virtualize(k,v) + end + elseif type(unicode) == "number" and type(virtual) == "number" then + virtualize(unicode,virtual) + -- else + -- error + end +end + +mathematics.extensibles = extensibles +mathematics.classes = classes +mathematics.codes = codes +-----------.accents = codes +mathematics.families = families +mathematics.virtualized = virtualized + +do + + -- not that many so no need to reuse tables + + local setmathcharacter = function(class,family,slot,unicode,mset,dset) + if mset and codes[class] then -- regular codes < 7 + setmathcode("global",slot,class,family,unicode) + mset = false + end + if dset and class == open_class or class == close_class or class == middle_class then + setdelcode("global",slot,family,unicode,0,0) + dset = false + end + return mset, dset + end + + -- todo: make nice setters for this in lua + + local f_accent = formatters[ [[\defUmathtopaccent \%s{%X}{%X}{%X}]] ] + local f_topaccent = formatters[ [[\defUmathtopaccent \%s{%X}{%X}{%X}]] ] + local f_botaccent = formatters[ [[\defUmathbotaccent \%s{%X}{%X}{%X}]] ] + local f_over = formatters[ [[\defUdelimiterover \%s{%X}{%X}{%X}]] ] + local f_under = formatters[ [[\defUdelimiterunder\%s{%X}{%X}{%X}]] ] + local f_fence = formatters[ [[\defUdelimiter \%s{%X}{%X}{%X}]] ] + local f_delimiter = formatters[ [[\defUdelimiter \%s{%X}{%X}{%X}]] ] + local f_radical = formatters[ [[\defUradical \%s{%X}{%X}]] ] + local f_root = formatters[ [[\defUroot \%s{%X}{%X}]] ] + local f_char = formatters[ [[\defUmathchar \%s{%X}{%X}{%X}]] ] + + local texmathchardef = tex.mathchardef + + local setmathsymbol = function(name,class,family,slot) -- hex is nicer for tracing + if class == accent_class then + ctx_sprint(f_topaccent(name,0,family,slot)) + elseif class == topaccent_class then + ctx_sprint(f_topaccent(name,0,family,slot)) + elseif class == botaccent_class then + ctx_sprint(f_botaccent(name,0,family,slot)) + elseif class == over_class then + ctx_sprint(f_over(name,0,family,slot)) + elseif class == under_class then + ctx_sprint(f_under(name,0,family,slot)) + elseif class == open_class or class == close_class or class == middle_class then +-- setdelcode("global",slot,{family,slot,0,0}) + setdelcode("global",slot,family,slot,0,0) + ctx_sprint(f_fence(name,class,family,slot)) + elseif class == delimiter_class then +-- setdelcode("global",slot,{family,slot,0,0}) + setdelcode("global",slot,family,slot,0,0) + ctx_sprint(f_delimiter(name,0,family,slot)) + elseif class == radical_class then + ctx_sprint(f_radical(name,family,slot)) + elseif class == root_class then + ctx_sprint(f_root(name,family,slot)) + elseif texmathchardef then + texmathchardef(name,class,family,slot,"permanent") + else + -- beware, open/close and other specials should not end up here + ctx_sprint(f_char(name,class,family,slot)) + end + end + + local function report(class,family,unicode,name) + local nametype = type(name) + if nametype == "string" then + report_math("class name %a, class %a, family %a, char %C, name %a",classname,class,family,unicode,name) + elseif nametype == "number" then + report_math("class name %a, class %a, family %a, char %C, number %U",classname,class,family,unicode,name) + else + report_math("class name %a, class %a, family %a, char %C", classname,class,family,unicode) + end + end + + -- there will be a combined \(math)chardef (tracker) + + function mathematics.define(family) + family = family or 0 + family = families[family] or family + local data = characters.data + for unicode, character in sortedhash(data) do + local symbol = character.mathsymbol + local mset = true + local dset = true + if symbol then + local other = data[symbol] + local class = other.mathclass + if class then + class = classes[class] or class -- no real checks needed + if trace_defining then + report(class,family,unicode,symbol) + end + mset, dset = setmathcharacter(class,family,unicode,symbol,mset,dset) + end + local spec = other.mathspec + if spec then + for i=1,#spec do + local m = spec[i] + local class = m.class + if class then + class = classes[class] or class -- no real checks needed + mset, dset = setmathcharacter(class,family,unicode,symbol,mset,dset) + end + end + end + end + local mathclass = character.mathclass + local mathspec = character.mathspec + if mathspec then + if mathclass then + local name = character.mathname + if name then + report_math("fatal error, conflicting mathclass and mathspec for %C",unicode) + os.exit() + else + local class = classes[mathclass] or mathclass -- no real checks needed + if not class then + if trace_defining then + report("unknown",family,unicode) + end + else + if trace_defining then + report(class,family,unicode) + end + mset, dset = setmathcharacter(class,family,unicode,unicode,mset,dset) + end + end + end + for i=1,#mathspec do + local m = mathspec[i] + local name = m.name + local class = m.class + if class then + class = classes[class] or class -- no real checks needed + if name then + if trace_defining then + report(class,family,unicode,name) + end + setmathsymbol(name,class,family,unicode) + else + name = (class == classes.variable or class == classes.number) and character.adobename -- bad + if name and trace_defining then + report(class,family,unicode,name) + end + end + mset, dset = setmathcharacter(class,family,unicode,m.unicode or unicode,mset,dset) -- see solidus + end + end + elseif mathclass then + local name = character.mathname + local class = classes[mathclass] or mathclass -- no real checks needed + if not class then + if trace_defining then + report("unknown",family,unicode,name) + end + elseif name == false then + if trace_defining then + report(class,family,unicode,name) + end + mset, dset = setmathcharacter(class,family,unicode,unicode,mset,dset) + else + -- if not name then + -- name = character.contextname -- too dangerous, we loose textslash and a few more + -- end + if name then + if trace_defining then + report(class,family,unicode,name) + end + setmathsymbol(name,class,family,unicode) + else + if trace_defining then + report(class,family,unicode,character.adobename) + end + end + mset, dset = setmathcharacter(class,family,unicode,unicode,mset,dset) + end + end + end + end + +end + +-- needed for mathml analysis +-- string with # > 1 are invalid +-- we could cache + +do + + local lpegmatch = lpeg.match + local utf8byte = lpeg.patterns.utf8byte * lpeg.P(-1) + + -- function somechar(c) + -- local b = lpegmatch(utf8byte,c) + -- return b and chardata[b] + -- end + + local somechar = table.setmetatableindex(function(t,k) + if k then + local b = lpegmatch(utf8byte,k) + local v = b and chardata[b] or false + t[k] = v + return v + end + end) + + local function utfmathclass(chr, default) + local cd = somechar[chr] + return cd and cd.mathclass or default or "unknown" + end + + local function utfmathlimop(chr) + local cd = somechar[chr] + return cd and cd.mathclass == "limop" or false + end + + local function utfmathaccent(chr,default,asked1,asked2) + local cd = somechar[chr] + if not cd then + return default or false + end + if asked1 and asked1 ~= "" then + local mc = cd.mathclass + if mc and (mc == asked1 or mc == asked2) then + return true + end + local ms = cd.mathspec + if not ms then + local mp = cd.mathparent + if mp then + ms = chardata[mp].mathspec + end + end + if ms then + for i=1,#ms do + local msi = ms[i] + local mc = msi.class + if mc and (mc == asked1 or mc == asked2) then + return true + end + end + end + else + local mc = cd.mathclass + if mc then + return accents[mc] or default or false + end + local ms = cd.mathspec + if ms then + for i=1,#ms do + local msi = ms[i] + local mc = msi.class + if mc then + return accents[mc] or default or false + end + end + end + end + return default or false + end + + local function utfmathstretch(chr,default) -- "h", "v", "b", "" + local cd = somechar[chr] + return cd and cd.mathstretch or default or "" + end + + local function utfmathcommand(chr,default,asked1,asked2) + local cd = somechar[chr] + if not cd then + return default or "" + end + if asked1 then + local mn = cd.mathname + local mc = cd.mathclass + if mn and mc and (mc == asked1 or mc == asked2) then + return mn + end + local ms = cd.mathspec + if not ms then + local mp = cd.mathparent + if mp then + ms = chardata[mp].mathspec + end + end + if ms then + for i=1,#ms do + local msi = ms[i] + local mn = msi.name + if mn then + local mc = msi.class + if mc == asked1 or mc == asked2 then + return mn + end + end + end + end + else + local mn = cd.mathname + if mn then + return mn + end + local ms = cd.mathspec + if ms then + for i=1,#ms do + local msi = ms[i] + local mn = msi.name + if mn then + return mn + end + end + end + end + return default or "" + end + + local function utfmathfiller(chr, default) + local cd = somechar[chr] + local cmd = cd and cd.mathfiller -- or cd.mathname + return cmd or default or "" + end + + mathematics.utfmathclass = utfmathclass + mathematics.utfmathstretch = utfmathstretch + mathematics.utfmathcommand = utfmathcommand + mathematics.utfmathfiller = utfmathfiller + mathematics.utfmathaccent = utfmathaccent + + -- interfaced + + implement { + name = "utfmathclass", + public = true, + actions = { utfmathclass, context }, + arguments = "argument" + } + + implement { + name = "utfmathstretch", + public = true, + actions = { utfmathstretch, context }, + arguments = "argument" + } + + implement { + name = "utfmathcommand", + public = true, + actions = { utfmathcommand, context }, + arguments = "argument" + } + + implement { + name = "utfmathfiller", + public = true, + actions = { utfmathfiller, context }, + arguments = "argument" + } + + implement { + name = "utfmathcommandabove", + public = true, + actions = { utfmathcommand, context }, + arguments = { "argument", false, "'topaccent'","'over'" } + } + + implement { + name = "utfmathcommandbelow", + public = true, + actions = { utfmathcommand, context }, + arguments = { "argument", false, "'botaccent'","'under'" } + } + + implement { + name = "utfmathcommandfiller", + public = true, + actions = { utfmathfiller, context }, + arguments = "argument" + } + + -- todo: make this a helper: + + implement { + name = "doifelseutfmathabove", + public = true, + actions = { utfmathaccent, ctx_doifelsesomething }, + arguments = { "argument", false, "'topaccent'", "'over'" } + } + + implement { + name = "doifelseutfmathbelow", + public = true, + actions = { utfmathaccent, ctx_doifelsesomething }, + arguments = { "argument", false, "'botaccent'", "'under'" } + } + + implement { + name = "doifelseutfmathaccent", + public = true, + actions = { utfmathaccent, ctx_doifelsesomething }, + arguments = "argument", + } + + implement { + name = "doifelseutfmathfiller", + public = true, + actions = { utfmathfiller, ctx_doifelsesomething }, + arguments = "argument", + } + + implement { + name = "doifelseutfmathlimop", + public = true, + actions = { utfmathlimop, ctx_doifelsesomething }, + arguments = "argument" + } + +end + +-- helpers +-- +-- 1: step 1 +-- 2: step 2 +-- 3: htdp * 1.33^n +-- 4: size * 1.33^n + +function mathematics.big(tfmdata,unicode,n,method) + local t = tfmdata.characters + local c = t[unicode] + if c and n > 0 then + local vv = c.vert_variants or c.next and t[c.next].vert_variants + if vv then + local vvn = vv[n] + return vvn and vvn.glyph or vv[#vv].glyph or unicode + elseif method == 1 or method == 2 then + if method == 2 then -- large steps + n = n * 2 + end + local next = c.next + while next do + if n <= 1 then + return next + else + n = n - 1 + local tn = t[next].next + if tn then + next = tn + else + return next + end + end + end + elseif method >= 3 then + local size = 1.33^n + if method == 4 then + size = tfmdata.parameters.size * size + else -- if method == 3 then + size = (c.height + c.depth) * size + end + local next = c.next + while next do + local cn = t[next] + if (cn.height + cn.depth) >= size then + return next + else + local tn = cn.next + if tn then + next = tn + else + return next + end + end + end + end + end + return unicode +end + +do -- experimental + + -- local categories = { } -- indexed + hashed + -- + -- local a_mathcategory = attributes.private("mathcategory") + -- + -- local function registercategory(category,tag,data) -- always same data for tag + -- local c = categories[category] + -- if not c then + -- c = { } + -- categories[category] = c + -- end + -- local n = c[tag] + -- if not n then + -- n = #c + 1 + -- c[n] = data + -- n = n * 1000 + category + -- c[tag] = n + -- end + -- return n + -- end + -- + -- function mathematics.getcategory(n) + -- local category = n % 1000 + -- return category, categories[category][floor(n/1000)] + -- end + -- + -- mathematics.registercategory = registercategory + -- + -- function commands.taggedmathfunction(tag,label) + -- if label then + -- texsetattribute(a_mathcategory,registercategory(1,tag,tag)) + -- context.mathlabeltext(tag) + -- else + -- texsetattribute(a_mathcategory,1) + -- context(tag) + -- end + -- end + + local categories = { } + mathematics.categories = categories + + local a_mathcategory = attributes.private("mathcategory") + + local functions = storage.allocate() + categories.functions = functions + local noffunctions = 1000 -- offset + + implement { + name = "tagmfunctiontxt", + arguments = { "string", "conditional" }, + actions = function(tag,apply) + local delta = apply and 1000 or 0 + texsetattribute(a_mathcategory,1000 + delta) + end + } + + implement { + name = "tagmfunctionlab", + arguments = { "string", "conditional" }, + actions = function(tag,apply) + local delta = apply and 1000 or 0 + local n = functions[tag] + if not n then + noffunctions = noffunctions + 1 + functions[noffunctions] = tag + functions[tag] = noffunctions + texsetattribute(a_mathcategory,noffunctions + delta) + else + texsetattribute(a_mathcategory,n + delta) + end + end + } + +end + +do + + local list + + function mathematics.resetattributes() + if not list then + list = { } + for k, v in next, attributes.numbers do + if find(k,"^math") then + list[#list+1] = v + end + end + end + for i=1,#list do + texsetattribute(list[i],unsetvalue) + end + end + +end + +implement { + name = "resetmathattributes", + public = true, + protected = true, + actions = mathematics.resetattributes +} + +-- weird to do this here but it's a side affect of math anyway + +interfaces.implement { + name = "enableasciimode", + onlyonce = true, + actions = resolvers.macros.enablecomment, +} diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index 33e52ebbf..c97cfbb77 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -64,7 +64,7 @@ % test [[\char948 \cldcontext{utf.char(948)}]] % test $[[\char948 \cldcontext{utf.char(948)}]]$ -\registerctxluafile{math-ini}{} +\registerctxluafile{math-ini}{autosuffix} \registerctxluafile{math-dim}{} \registerctxluafile{math-act}{autosuffix} \registerctxluafile{math-ext}{} @@ -138,7 +138,7 @@ \defaultmathfamily \zerocount % 255 -\permanent\protected\def\resetmathattributes{\clf_resetmathattributes} +% defined at lua end \permanent\protected\def\resetmathattributes{\resetmathattributes} % handy @@ -193,9 +193,9 @@ \permanent\protected\def\rawmathematics#1% slow but only for tracing {\begingroup \ifmmode - \clf_resetmathattributes#1% + \resetmathattributes#1% \else - \startimath\clf_resetmathattributes#1\stopimath + \startimath\resetmathattributes#1\stopimath \fi \endgroup} @@ -601,22 +601,22 @@ \permanent\protected\def\boldsymbol {\mathortext\mathboldsymbol\bold} -%D Helpers +%D Helpers (defined at the \LUA\ end): -\permanent\def\utfmathclass #1{\clf_utfmathclass {#1}} -\permanent\def\utfmathstretch#1{\clf_utfmathstretch{#1}} -\permanent\def\utfmathcommand#1{\clf_utfmathcommand{#1}} -\permanent\def\utfmathfiller #1{\clf_utfmathfiller {#1}} - -\permanent\def\utfmathcommandabove #1{\clf_utfmathcommandabove {#1}} -\permanent\def\utfmathcommandbelow #1{\clf_utfmathcommandbelow {#1}} -\permanent\def\utfmathcommandfiller#1{\clf_utfmathcommandfiller{#1}} - -\permanent\protected\def\doifelseutfmathaccent#1{\clf_doifelseutfmathaccent{#1}} -\permanent\protected\def\doifelseutfmathabove #1{\clf_doifelseutfmathabove {#1}} -\permanent\protected\def\doifelseutfmathbelow #1{\clf_doifelseutfmathbelow {#1}} -\permanent\protected\def\doifelseutfmathfiller#1{\clf_doifelseutfmathfiller{#1}} -\permanent\protected\def\doifelseutfmathlimop #1{\clf_doifelseutfmathlimop {#1}} +% \utfmathclass #1 +% \utfmathstretch #1 +% \utfmathcommand #1 +% \utfmathfiller #1 +% +% \utfmathcommandabove #1.. +% \utfmathcommandbelow #1.. +% \utfmathcommandfiller #1.. +% +% \doifelseutfmathaccent #1#2#3 +% \doifelseutfmathabove #1#2#3 +% \doifelseutfmathbelow #1#2#3 +% \doifelseutfmathfiller #1#2#3 +% \doifelseutfmathlimop #1#2#3 \aliased\let\doifutfmathaccentelse \doifelseutfmathaccent \aliased\let\doifutfmathaboveelse \doifelseutfmathabove diff --git a/tex/context/base/mkxl/meta-ini.mkxl b/tex/context/base/mkxl/meta-ini.mkxl index faf0d3c69..db1e69d48 100644 --- a/tex/context/base/mkxl/meta-ini.mkxl +++ b/tex/context/base/mkxl/meta-ini.mkxl @@ -735,6 +735,55 @@ \aliased\let\reuseMPgraphic \useMPgraphic % we can save a setup here if needed \aliased\let\reusableMPgraphic\reuseMPgraphic % we can save a setup here if needed +%D Saves an overlaydefinition: + +\permanent\protected\def\startoverlayMPgraphic + {\dodoublegroupempty\meta_start_overlay_graphic} + +\aliased\let\stopoverlayMPgraphic\relax + +\def\meta_start_overlay_graphic#1% + {\normalexpanded{% + \pack_overlay_define{#1}{\useMPgraphic{#1}}% + \meta_start_overlay_graphic_indeed{#1}}% + } + +\protected\def\meta_start_overlay_graphic_indeed#1#2#3\stopoverlayMPgraphic + {\gdefcsname\??mpgraphic#1\endcsname{\meta_handle_overlay_graphic{#1}{#2}{#3}}} + +\def\meta_handle_overlay_graphic#1#2#3% + {\begingroup + \edef\currentmpcategory{#1}% + \meta_process_graphic{#3;BoundToOverlayBox;}% + \endgroup} + +%D New in \LMTX: + +\newtoks\MPoverlaydata + +\aliased\let\stopMPoverlaydata\relax + +\permanent\protected\def\startMPoverlaydata + {\iftrialtypesetting + \expandafter\startMPoverlaydata_nop + \else + \expandafter\startMPoverlaydata_yes + \fi} + +\permanent\protected\def\startMPoverlaydata_nop#0\stopMPoverlaydata + {} + +\permanent\protected\def\startMPoverlaydata_yes#1\stopMPoverlaydata + {\xtoksapp\MPoverlaydata{#1;}} + +\def\includeMPoverlaydata % expandable + {\the\MPoverlaydata + \resetMPoverlaydata} + +\def\resetMPoverlaydata % expandable + {\localcontrolled{\global\MPoverlaydata\emptytoks}} + + %D \macros %D {startuniqueMPpagegraphic,uniqueMPpagegraphic} %D diff --git a/tex/context/base/mkxl/mlib-lua.lmt b/tex/context/base/mkxl/mlib-lua.lmt index 137aa6223..6acb159f6 100644 --- a/tex/context/base/mkxl/mlib-lua.lmt +++ b/tex/context/base/mkxl/mlib-lua.lmt @@ -55,21 +55,21 @@ local skiptoken = mplib.skiptoken local gethashentry = mplib.gethashentry -scan.next = function(k) if trace then reporti("next") end return scannext (currentmpx,k) end -scan.expression = function(k) if trace then reporti("expression") end return scanexpression(currentmpx,k) end -scan.token = function(k) if trace then reporti("token") end return scantoken (currentmpx,k) end -scan.symbol = function(k,e) if trace then reporti("symbol") end return scansymbol (currentmpx,k,e) end -scan.property = function(k) if trace then reporti("property") end return scanproperty (currentmpx,k) end -scan.numeric = function() if trace then reporti("numeric") end return scannumeric (currentmpx) end -scan.integer = function() if trace then reporti("integer") end return scaninteger (currentmpx) end -scan.boolean = function() if trace then reporti("boolean") end return scanboolean (currentmpx) end -scan.string = function() if trace then reporti("string") end return scanstring (currentmpx) end -scan.pair = function(t) if trace then reporti("pair") end return scanpair (currentmpx,t) end -scan.color = function(t) if trace then reporti("color") end return scancolor (currentmpx,t) end -scan.cmykcolor = function(t) if trace then reporti("cmykcolor") end return scancmykcolor (currentmpx,t) end -scan.transform = function(t) if trace then reporti("transform") end return scantransform (currentmpx,t) end -scan.path = function(t) if trace then reporti("path") end return scanpath (currentmpx,t) end -scan.pen = function(t) if trace then reporti("pen") end return scanpen (currentmpx,t) end +scan.next = function(k) if trace then reporti("next") end return scannext (currentmpx,k) end +scan.expression = function(k) if trace then reporti("expression") end return scanexpression(currentmpx,k) end +scan.token = function(k) if trace then reporti("token") end return scantoken (currentmpx,k) end +scan.symbol = function(k,e) if trace then reporti("symbol") end return scansymbol (currentmpx,k,e) end +scan.property = function(k) if trace then reporti("property") end return scanproperty (currentmpx,k) end +scan.numeric = function() if trace then reporti("numeric") end return scannumeric (currentmpx) end +scan.integer = function() if trace then reporti("integer") end return scaninteger (currentmpx) end +scan.boolean = function() if trace then reporti("boolean") end return scanboolean (currentmpx) end +scan.string = function() if trace then reporti("string") end return scanstring (currentmpx) end +scan.pair = function(t) if trace then reporti("pair") end return scanpair (currentmpx,t) end +scan.color = function(t) if trace then reporti("color") end return scancolor (currentmpx,t) end +scan.cmykcolor = function(t) if trace then reporti("cmykcolor") end return scancmykcolor (currentmpx,t) end +scan.transform = function(t) if trace then reporti("transform") end return scantransform (currentmpx,t) end +scan.path = function(t,k,c) if trace then reporti("path") end return scanpath (currentmpx,t,k,c) end -- compact kind (prim) check +scan.pen = function(t) if trace then reporti("pen") end return scanpen (currentmpx,t) end skip.token = function(t) return skiptoken (currentmpx,t) end get.hashentry = function(n) return gethashentry(currentmpx,n) end diff --git a/tex/context/base/mkxl/mlib-scn.lmt b/tex/context/base/mkxl/mlib-scn.lmt index 217a57ae4..5339fff6e 100644 --- a/tex/context/base/mkxl/mlib-scn.lmt +++ b/tex/context/base/mkxl/mlib-scn.lmt @@ -230,10 +230,13 @@ local function get_parameters(nested) data[s] = (typescanners[kind] or scanexpression)() elseif kind == leftbracket_code then data[s] = get_parameters(true) + elseif kind == comma_code then + goto again else data[s] = tokenscanners[kind]() end end + ::again:: end return data end @@ -305,7 +308,7 @@ local function collectnames() local t = scantoken(true) -- (1) not really needed if t == numeric_code then - n = n + 1 l[n] = scaninteger(1) + n = n + 1 l[n] = scannumeric(1) elseif t == string_code then n = n + 1 l[n] = scanstring(1) elseif t == nullary_code then @@ -522,16 +525,16 @@ local function getparameterdefault() end v = vl end - -- if v == nil then - -- return injectnumeric(0) - -- else - -- return get(v) - -- end - return v or 0 + if v == nil then + return 0 + else + return v + end end -- return injectnumeric(0) return 0 else + print("LAST",last) -- return get(last) return last end diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl index 52c2255fe..b87547472 100644 --- a/tex/context/base/mkxl/pack-rul.mkxl +++ b/tex/context/base/mkxl/pack-rul.mkxl @@ -455,8 +455,12 @@ \vsize\d_overlay_height \to \everyoverlay +\protected\def\pack_overlay_define#1#2% + {\defcsname\??overlay#1\endcsname{\executedefinedoverlay{#1}{#2}}} + \permanent\tolerant\protected\def\defineoverlay[#1]#*[#2]% wil be overloaded - {\def\pack_framed_define_overlay_indeed##1{\defcsname\??overlay##1\endcsname{\executedefinedoverlay{##1}{#2}}}% +% {\def\pack_framed_define_overlay_indeed##1{\defcsname\??overlay##1\endcsname{\executedefinedoverlay{##1}{#2}}}% + {\def\pack_framed_define_overlay_indeed##1{\pack_overlay_define{##1}{#2}}% \processcommalist[#1]\pack_framed_define_overlay_indeed} \permanent\protected\def\executedefinedoverlay#1#2% we can share the definitions @@ -915,7 +919,11 @@ %D can better be correct. \protected\def\pack_framed_process_box_indeed#1#2% component box (assumes parameters set and grouped usage) - {\setbox\b_framed_normal\box#2% could actually be \let\b_framed_normal#2 + {% + %\setbox\b_framed_normal\box#2% + %\def\b_framed_normal{#2}% protected against overload + \enforced\let\b_framed_normal#2% + % \edef\m_overlay_region{\framedparameter\c!region}% \ifempty\m_overlay_region\else \pack_framed_set_region diff --git a/tex/context/base/mkxl/supp-box.mkxl b/tex/context/base/mkxl/supp-box.mkxl index 943415596..751293383 100644 --- a/tex/context/base/mkxl/supp-box.mkxl +++ b/tex/context/base/mkxl/supp-box.mkxl @@ -224,11 +224,13 @@ \installcorenamespace {smashoptions} -\setvalue{\??smashoptions w}{\wd\nextbox\zeropoint} -\setvalue{\??smashoptions h}{\ht\nextbox\zeropoint} -\setvalue{\??smashoptions d}{\dp\nextbox\zeropoint} -\setvalue{\??smashoptions t}{\ht\nextbox\zeropoint} -\setvalue{\??smashoptions b}{\dp\nextbox\zeropoint} +\defcsname\??smashoptions w\endcsname{\wd\nextbox\zeropoint} +\defcsname\??smashoptions h\endcsname{\ht\nextbox\zeropoint} +\defcsname\??smashoptions d\endcsname{\dp\nextbox\zeropoint} +\defcsname\??smashoptions t\endcsname{\ht\nextbox\zeropoint} +\defcsname\??smashoptions b\endcsname{\dp\nextbox\zeropoint} +\defcsname\??smashoptions hd\endcsname{\ht\nextbox\zeropoint\dp\nextbox\zeropoint} +\defcsname\??smashoptions whd\endcsname{\wd\nextbox\zeropoint\ht\nextbox\zeropoint\dp\nextbox\zeropoint} \def\syst_boxes_smash_process_option#1% {\ifx#1\relax\else diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index 462b8500a..d147e07aa 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -24,6 +24,21 @@ %D but we're prestine and have no macros defined yet. Abstraction also makes it %D possible to avoid the \type {^^} in the input. +% cheatsheet +% +% # : 0--9 +% * : ignore spaces +% + : keep the braces +% - : discard and don't count the argument +% . : ignore pars and spaces +% , : push back space when no match +% / : remove leading and trailing spaces and pars +% : : pick up scanning here +% ; : quit scanning +% = : braces are mandate +% ^ : keep leading spaces +% _ : braces are mandate and kept + \immutable\integerdef\escapecatcode 0 \immutable\integerdef\begingroupcatcode 1 \immutable\integerdef\endgroupcatcode 2 diff --git a/tex/context/base/mkxl/tabl-ntb.mkxl b/tex/context/base/mkxl/tabl-ntb.mkxl index 5b30c449c..4c77aded8 100644 --- a/tex/context/base/mkxl/tabl-ntb.mkxl +++ b/tex/context/base/mkxl/tabl-ntb.mkxl @@ -205,6 +205,52 @@ \newconstant \c_tabl_ntb_foot \newconditional \c_tabl_ntb_okay +%D For local anchoring: + + +\installcorenamespace{naturaltableanchor} + +\let\tabl_ntb_anchor_start \gobbletwoarguments +\let\tabl_ntb_anchor_stop \relax +\let\tabl_ntb_anchor_process\gobbleoneargument + +\let\m_tabl_ntb_anchor_background\empty + +\let\xanchor\!!zerocount +\let\yanchor\!!zerocount + +\def\tabl_ntb_anchor_start_normal#1#2% + {\hpack\bgroup + \edef\xanchor{\number#2}% + \edef\yanchor{\number#1}% + \markanchor{matrix}{#1}{#2}} + +\def\tabl_ntb_anchor_start_traced#1#2% + {\hpack\bgroup + \edef\xanchor{\number#2}% + \edef\yanchor{\number#1}% + \markanchor{matrix}{#2}{#1}% + \smash[whd]{\smallinfofont#2-#1}} + +\let\tabl_ntb_anchor_start_indeed\tabl_ntb_anchor_start_normal +\let\tabl_ntb_anchor_stop_indeed \egroup + +\def\tabl_ntb_anchor_process_indeed#1% + {\localframed[\??naturaltableanchor]{\box#1}} + +\installtextracker + {localanchor} + {\let\tabl_ntb_anchor_start_indeed\tabl_ntb_anchor_start_traced} + {\let\tabl_ntb_anchor_start_indeed\tabl_ntb_anchor_start_normal} + +\definesimplifiedframed + [\??naturaltableanchor] + +\setupframed + [\??naturaltableanchor] + [\c!synchronize=\v!background, + \c!background=\m_tabl_ntb_anchor_background] + %D We have already prepared the previous macros for nesting, so we only have to pop %D in the right ones: @@ -273,11 +319,11 @@ \installcorenamespace{naturaltablesqueeze} \installcorenamespace{naturaltabletok} -\letvalue{\??naturaltablesqueeze }\donefalse -\letvalue{\??naturaltablesqueeze\v!fit }\donetrue -\letvalue{\??naturaltablesqueeze\v!fixed}\donetrue -\letvalue{\??naturaltablesqueeze\v!broad}\donetrue -\letvalue{\??naturaltablesqueeze\v!local}\donetrue +\letcsname\??naturaltablesqueeze \endcsname\donefalse +\letcsname\??naturaltablesqueeze\v!fit \endcsname\donetrue +\letcsname\??naturaltablesqueeze\v!fixed\endcsname\donetrue +\letcsname\??naturaltablesqueeze\v!broad\endcsname\donetrue +\letcsname\??naturaltablesqueeze\v!local\endcsname\donetrue \def\tabl_ntb_let_gal{\gletcsname\??naturaltablegal\m_tabl_tbl_level\endcsname} \def\tabl_ntb_get_gal{\csname\??naturaltablegal\m_tabl_tbl_level\endcsname} @@ -444,18 +490,18 @@ \def\tabl_ntb_setup_three[#1]{\ifcsname\??naturaltablesetupthree#1\endcsname\expandafter\lastnamedcs\else\expandafter\tabl_ntb_setup_un\fi[#1]} \def\tabl_ntb_setup_two [#1]{\ifcsname\??naturaltablesetuptwo #1\endcsname\expandafter\lastnamedcs\else\expandafter\tabl_ntb_setup_ux\fi[#1]} -\setvalue{\??naturaltablesetupthree \v!row}[#1]{\tabl_ntb_setup_xy [\c!y]} -\setvalue{\??naturaltablesetupthree \v!column}[#1]{\tabl_ntb_setup_xy [\c!x]} -\setvalue{\??naturaltablesetupthree \v!start}[#1]{\tabl_ntb_setup_xy [\v!start]} -\setvalue{\??naturaltablesetupthree \v!header}[#1]{\tabl_ntb_setup_xy [\v!header]} +\defcsname\??naturaltablesetupthree \v!row\endcsname[#1]{\tabl_ntb_setup_xy [\c!y]} +\defcsname\??naturaltablesetupthree \v!column\endcsname[#1]{\tabl_ntb_setup_xy [\c!x]} +\defcsname\??naturaltablesetupthree \v!start\endcsname[#1]{\tabl_ntb_setup_xy [\v!start]} +\defcsname\??naturaltablesetupthree \v!header\endcsname[#1]{\tabl_ntb_setup_xy [\v!header]} -\setvalue{\??naturaltablesetuptwo \v!row}[#1]{\tabl_ntb_setup_each[\c!y]} -\setvalue{\??naturaltablesetuptwo \v!column}[#1]{\tabl_ntb_setup_each[\c!x]} -\setvalue{\??naturaltablesetuptwo \v!start}[#1]{\tabl_ntb_setup_each[\v!start]} -\setvalue{\??naturaltablesetuptwo \v!header}[#1]{\tabl_ntb_setup_each[\v!header]} +\defcsname\??naturaltablesetuptwo \v!row\endcsname[#1]{\tabl_ntb_setup_each[\c!y]} +\defcsname\??naturaltablesetuptwo \v!column\endcsname[#1]{\tabl_ntb_setup_each[\c!x]} +\defcsname\??naturaltablesetuptwo \v!start\endcsname[#1]{\tabl_ntb_setup_each[\v!start]} +\defcsname\??naturaltablesetuptwo \v!header\endcsname[#1]{\tabl_ntb_setup_each[\v!header]} -\letvalue{\??naturaltablesetupthree\s!unknown}\tabl_ntb_setup_un -\letvalue{\??naturaltablesetuptwo \s!unknown}\tabl_ntb_setup_ux +\letcsname\??naturaltablesetupthree\s!unknown\endcsname\tabl_ntb_setup_un +\letcsname\??naturaltablesetuptwo \s!unknown\endcsname\tabl_ntb_setup_ux \letcsnamecsname\csname\??naturaltablesetupthree r\endcsname\csname\??naturaltablesetupthree \v!row\endcsname \letcsnamecsname\csname\??naturaltablesetupthree c\endcsname\csname\??naturaltablesetupthree\v!column\endcsname @@ -694,13 +740,14 @@ % \ifempty\m_tabl_ntb_n \global\advance\c_tabl_ntb_spn\c_tabl_ntb_nx\relax - \orelse\ifnum\m_tabl_ntb_n=\c_tabl_ntb_running_col\else + \orelse\ifnum\m_tabl_ntb_n=\c_tabl_ntb_running_col + \else \tabl_ntb_td_pass_n{#1}% \fi - \ifempty\m_tabl_ntb_m \else - \ifnum\m_tabl_ntb_m=\c_tabl_ntb_running_col\else - \tabl_ntb_td_pass_m{#1}% - \fi + \ifempty\m_tabl_ntb_m + \orelse\ifnum\m_tabl_ntb_m=\c_tabl_ntb_running_col + \else + \tabl_ntb_td_pass_m{#1}% \fi \doloop % skip over columns that result from earlier span {\advance\c_tabl_ntb_running_col\plusone @@ -926,15 +973,33 @@ \resetcharacteralign % new \setupcurrentnaturaltablelocal[\c!align={\v!right,\v!broad,\v!high},#1]% % + \ifcstok{\naturaltablelocalparameter\c!synchronize}\v!background + \let\tabl_ntb_anchor_start \tabl_ntb_anchor_start_indeed + \let\tabl_ntb_anchor_stop \tabl_ntb_anchor_stop_indeed + \let\tabl_ntb_anchor_process \tabl_ntb_anchor_process_indeed + \edef\m_tabl_ntb_anchor_background{\naturaltablelocalparameter\c!background}% + \resetnaturaltablelocalparameter\c!background + \else + \let\m_tabl_ntb_anchor_background\empty + \let\tabl_ntb_anchor_start \gobbletwoarguments + \let\tabl_ntb_anchor_stop \relax + \let\tabl_ntb_anchor_process \gobbleoneargument + \fi + \resetnaturaltablelocalparameter\c!synchronize + % \d_tabl_ntb_leftmargindistance \naturaltablelocalparameter\c!leftmargindistance\relax \d_tabl_ntb_rightmargindistance\naturaltablelocalparameter\c!rightmargindistance\relax \d_tabl_ntb_columndistance \naturaltablelocalparameter\c!columndistance\relax \d_tabl_ntb_maxwidth \naturaltablelocalparameter\c!maxwidth\relax % \usesetupsparameter\naturaltablelocalparameter - \doifelse{\naturaltablelocalparameter\c!textwidth}\v!local - {\hsize\availablehsize} - {\hsize\naturaltablelocalparameter\c!textwidth}% + \hsize + \ifcstok{\naturaltablelocalparameter\c!textwidth}\v!local + \availablehsize + \else + \naturaltablelocalparameter\c!textwidth + \fi + \relax \enableTBLbreakfalse \multipleTBLheadsfalse \autoTBLspreadfalse @@ -1524,7 +1589,7 @@ \def\tabl_ntb_table_get_max_width {\scratchdimen\wd\scratchbox\relax} -% enable dper 2018-02-22 +% enabled per 2018-02-22 \def\tabl_ntb_table_get_max_width_step {\advance\scratchdimen\tabl_ntb_get_wid\fastloopindex @@ -1657,6 +1722,7 @@ \def\tabl_ntb_split_nop {\setbox\b_tabl_ntb_final\vbox{\tabl_ntb_flush_content}% \postprocessTABLEbox\b_tabl_ntb_final + \tabl_ntb_anchor_process\b_tabl_ntb_final \beforeTABLEbox % packaging prevents max hsized box % \hbox{\registerparoptions\box\b_tabl_ntb_final}% (*) better here @@ -1749,12 +1815,10 @@ \advance\scratchcounterone \plusone \orelse\ifdim\scratchdimen>\zeropoint\relax \advance\scratchdimenone -\scratchdimen - \else + \orelse\ifnum\c_tabl_ntb_encountered_max=\c_tabl_ntb_maximum_col % *nx* bah % eigenlijk moet dit alleen als de kolom wordt overspannen door een % vorige, maw extra dubbele loop en status var - \ifnum\c_tabl_ntb_encountered_max=\c_tabl_ntb_maximum_col % *nx* bah \advance\scratchcounterone \plusone % setting maxwidth to a large value also works - \fi \fi \fi}% \ifconditional\c_tabl_ntb_trace_widths\tabl_ntb_show_widths M#1\fi @@ -1911,7 +1975,7 @@ \fi} \protected\def\tabl_ntb_cell_process_a#1#2[#3]#4% grouping added ! ! ! - {\bgroup + {\begingroup \letnaturaltablelocalparameter\c!option\empty \tabl_ntb_setup_cell{#1}{#2}% \setupcurrentnaturaltablelocal[#3]% @@ -1968,31 +2032,33 @@ \ht\scratchboxone\ht\scratchbox \dp\scratchboxone\dp\scratchbox \box\scratchboxone - \egroup} + \endgroup} \protected\def\tabl_ntb_cell_process_b_c#1#2#3[#4]#5% - {\setbox\scratchbox\hbox + {\begingroup + \setbox\scratchbox\hbox {\tabl_ntb_setup_cell{#2}{#3}% \setupcurrentnaturaltablelocal[#4,#1]% \letnaturaltablelocalparameter\c!background\empty \letnaturaltablelocalparameter\c!frame\v!off \inheritednaturaltablelocalframed{\tabl_ntb_cell_start#5\tabl_ntb_cell_stop}}% - \setbox2\emptyhbox % todo: \scratchboxtwo - \wd2\wd\scratchbox - \ht2\ht\scratchbox - \dp2\dp\scratchbox + \setbox\scratchboxone\emptyhbox + \wd\scratchboxone\wd\scratchbox + \ht\scratchboxone\ht\scratchbox + \dp\scratchboxone\dp\scratchbox \ifautoTBLrowspan \scratchcounter\numexpr\c_tabl_ntb_row+\plusone\relax \ifcsname\tabl_ntb_row_pattern\scratchcounter\c_tabl_ntb_col\endcsname \scratchdimen\tabl_ntb_get_hei\scratchcounter\relax \ifnum\tabl_ntb_get_row\scratchcounter\c_tabl_ntb_col>\plusone \ifdim\ht\scratchbox>\scratchdimen - \ht2\dimexpr-\scratchdimen-\ht\scratchbox\relax + \ht\scratchboxone\dimexpr-\scratchdimen-\ht\scratchbox\relax \fi \fi \fi \fi - \box2 } + \box\scratchboxone + \endgroup} \protected\def\tabl_ntb_cell_process_b#1#2[#3]#4% {\scratchdimen\tabl_ntb_get_aut\c_tabl_ntb_col\relax @@ -2022,24 +2088,27 @@ \egroup} \protected\def\tabl_ntb_cell_process_e#1#2[#3]#4% - {\tabl_ntb_setup_cell{#1}{#2}% + {\begingroup + \tabl_ntb_setup_cell{#1}{#2}% \setupcurrentnaturaltablelocal[#3]% to get the color right, the way we - \color % handle color here prevents interference due to whatsit nodes - [\naturaltablelocalparameter\c!color] % as well as permits local colors to take precedence - {\letnaturaltablelocalparameter\c!color\empty - \setnaturaltablelocalparameter\c!width{\d_tabl_ntb_width}% - \ifzeropt\d_tabl_ntb_height % case: nc=maxcolumns - \else - \setnaturaltablelocalparameter\c!height{\d_tabl_ntb_height}% - \fi - \ifcase\c_anch_backgrounds_text_count\else - \edef\p_region{\naturaltablelocalparameter\c!region}% - \ifempty\p_region\ifnum\tabl_ntb_get_bck{#1}{#2}>\zerocount - \letnaturaltablelocalparameter\c!region\v!yes - \fi\fi - \fi - \inheritednaturaltablelocalframed{\tabl_ntb_cell_start\tabl_ntb_char_align{#1}{#2}#4\tabl_ntb_cell_stop}}% - \hskip\tabl_ntb_get_dis{#2}} + \directcolor[\naturaltablelocalparameter\c!color]% + \letnaturaltablelocalparameter\c!color\empty + \setnaturaltablelocalparameter\c!width{\d_tabl_ntb_width}% + \ifzeropt\d_tabl_ntb_height % case: nc=maxcolumns + \else + \setnaturaltablelocalparameter\c!height{\d_tabl_ntb_height}% + \fi + \ifcase\c_anch_backgrounds_text_count\else + \edef\p_region{\naturaltablelocalparameter\c!region}% + \ifempty\p_region\ifnum\tabl_ntb_get_bck{#1}{#2}>\zerocount + \letnaturaltablelocalparameter\c!region\v!yes + \fi\fi + \fi + \tabl_ntb_anchor_start{#1}{#2}% + \inheritednaturaltablelocalframed{\tabl_ntb_cell_start\tabl_ntb_char_align{#1}{#2}#4\tabl_ntb_cell_stop}% + \tabl_ntb_anchor_stop + \hskip\tabl_ntb_get_dis{#2}% + \endgroup} \newtoks\everyresetTABLEyes \newtoks\everyresetTABLEnop diff --git a/tex/context/interface/mkii/keys-ro.xml b/tex/context/interface/mkii/keys-ro.xml index d6ba17bde..eb60b4b58 100644 --- a/tex/context/interface/mkii/keys-ro.xml +++ b/tex/context/interface/mkii/keys-ro.xml @@ -1271,6 +1271,7 @@ + diff --git a/tex/context/modules/mkiv/x-newmml.mkiv b/tex/context/modules/mkiv/x-newmml.mkiv deleted file mode 100644 index 4c12daeee..000000000 --- a/tex/context/modules/mkiv/x-newmml.mkiv +++ /dev/null @@ -1,16 +0,0 @@ -%D \module -%D [ file=x-newmml, -%D version=2008.05.28, -%D title=\CONTEXT\ XML Modules, -%D subtitle=MathML Renderer, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\input x-mathml.mkiv - -\endinput diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index aed87aa35..a28630bfe 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-06-01 17:00 +-- merge date : 2021-06-04 17:20 do -- begin closure to overcome local limits and interference -- cgit v1.2.3