summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context/data/scite/context/lexers/data/scite-context-data-tex.lua2
-rw-r--r--context/data/scite/context/scite-context-data-tex.properties68
-rw-r--r--context/data/textadept/context/data/scite-context-data-tex.lua2
-rw-r--r--context/data/vscode/extensions/context/syntaxes/context-syntax-tex.json2
-rw-r--r--scripts/context/lua/mtx-context.lua5
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-en.mkii5
-rw-r--r--tex/context/base/mkii/mult-fr.mkii5
-rw-r--r--tex/context/base/mkiv/attr-ini.mkxl8
-rw-r--r--tex/context/base/mkiv/buff-ver.mkxl41
-rw-r--r--tex/context/base/mkiv/catc-ini.mkxl14
-rw-r--r--tex/context/base/mkiv/colo-ini.mkxl36
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv6
-rw-r--r--tex/context/base/mkiv/cont-run.lua6
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkxl14
-rw-r--r--tex/context/base/mkiv/core-env.lmt44
-rw-r--r--tex/context/base/mkiv/core-env.mkxl70
-rw-r--r--tex/context/base/mkiv/driv-shp.lmt2
-rw-r--r--tex/context/base/mkiv/enco-ini.mkxl2
-rw-r--r--tex/context/base/mkiv/font-chk.lua15
-rw-r--r--tex/context/base/mkiv/font-emp.mklx6
-rw-r--r--tex/context/base/mkiv/font-fea.mklx2
-rw-r--r--tex/context/base/mkiv/font-fil.mklx58
-rw-r--r--tex/context/base/mkiv/font-ini.mklx79
-rw-r--r--tex/context/base/mkiv/font-sym.mklx2
-rw-r--r--tex/context/base/mkiv/lang-ini.mkxl2
-rw-r--r--tex/context/base/mkiv/lang-lab.mkxl18
-rw-r--r--tex/context/base/mkiv/math-ali.mkiv14
-rw-r--r--tex/context/base/mkiv/math-ali.mkxl18
-rw-r--r--tex/context/base/mkiv/math-fen.mkiv12
-rw-r--r--tex/context/base/mkiv/math-fen.mkxl829
-rw-r--r--tex/context/base/mkiv/math-ini.mkxl2
-rw-r--r--tex/context/base/mkiv/math-stc.mkvi14
-rw-r--r--tex/context/base/mkiv/meta-ini.mkxl8
-rw-r--r--tex/context/base/mkiv/mult-aux.mkxl13
-rw-r--r--tex/context/base/mkiv/mult-ini.mkiv18
-rw-r--r--tex/context/base/mkiv/mult-ini.mkxl86
-rw-r--r--tex/context/base/mkiv/mult-prm.lua4
-rw-r--r--tex/context/base/mkiv/pack-bar.mkiv10
-rw-r--r--tex/context/base/mkiv/pack-bar.mkxl94
-rw-r--r--tex/context/base/mkiv/page-bck.mkxl6
-rw-r--r--tex/context/base/mkiv/page-lay.mkxl2
-rw-r--r--tex/context/base/mkiv/page-txt.mklx10
-rw-r--r--tex/context/base/mkiv/phys-dim.mkiv2
-rw-r--r--tex/context/base/mkiv/scrn-ini.mklx254
-rw-r--r--tex/context/base/mkiv/scrn-pag.mklx310
-rw-r--r--tex/context/base/mkiv/spac-ali.mkxl4
-rw-r--r--tex/context/base/mkiv/spac-hor.mkxl5
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin29134 -> 29222 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin267808 -> 267591 bytes
-rw-r--r--tex/context/base/mkiv/strc-des.mklx6
-rw-r--r--tex/context/base/mkiv/strc-enu.mklx8
-rw-r--r--tex/context/base/mkiv/strc-flt.mklx2599
-rw-r--r--tex/context/base/mkiv/strc-itm.mklx10
-rw-r--r--tex/context/base/mkiv/strc-lab.mkxl2
-rw-r--r--tex/context/base/mkiv/strc-not.mklx22
-rw-r--r--tex/context/base/mkiv/strc-ref.mklx2196
-rw-r--r--tex/context/base/mkiv/strc-tag.mkiv312
-rw-r--r--tex/context/base/mkiv/supp-box.mkxl10
-rw-r--r--tex/context/base/mkiv/syst-aux.mkxl123
-rw-r--r--tex/context/base/mkiv/syst-ini.mkxl12
-rw-r--r--tex/context/base/mkiv/tabl-ltb.mkxl2
-rw-r--r--tex/context/base/mkiv/tabl-ntb.mkxl58
-rw-r--r--tex/context/base/mkiv/tabl-tbl.mkxl29
-rw-r--r--tex/context/base/mkiv/type-ini.mklx14
-rw-r--r--tex/context/base/mkiv/typo-dir.mkxl2
-rw-r--r--tex/context/interface/mkii/keys-en.xml5
-rw-r--r--tex/context/interface/mkii/keys-fr.xml5
-rw-r--r--tex/context/modules/mkiv/m-tikz.mkiv10
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
72 files changed, 6923 insertions, 739 deletions
diff --git a/context/data/scite/context/lexers/data/scite-context-data-tex.lua b/context/data/scite/context/lexers/data/scite-context-data-tex.lua
index 2521d8935..c5b85808f 100644
--- a/context/data/scite/context/lexers/data/scite-context-data-tex.lua
+++ b/context/data/scite/context/lexers/data/scite-context-data-tex.lua
@@ -1,7 +1,7 @@
return {
["aleph"]={ "Alephminorversion", "Alephrevision", "Alephversion" },
["etex"]={ "botmarks", "clubpenalties", "currentgrouplevel", "currentgrouptype", "currentifbranch", "currentiflevel", "currentiftype", "detokenize", "dimexpr", "displaywidowpenalties", "everyeof", "firstmarks", "fontchardp", "fontcharht", "fontcharic", "fontcharwd", "glueexpr", "glueshrink", "glueshrinkorder", "gluestretch", "gluestretchorder", "gluetomu", "ifcsname", "ifdefined", "iffontchar", "interactionmode", "interlinepenalties", "lastlinefit", "lastnodetype", "marks", "muexpr", "mutoglue", "numexpr", "pagediscards", "parshapedimen", "parshapeindent", "parshapelength", "predisplaydirection", "protected", "savinghyphcodes", "savingvdiscards", "scantokens", "showgroups", "showifs", "showtokens", "splitbotmarks", "splitdiscards", "splitfirstmarks", "topmarks", "tracingalignments", "tracingassigns", "tracinggroups", "tracingifs", "tracingnesting", "unexpanded", "unless", "widowpenalties" },
- ["luatex"]={ "UUskewed", "UUskewedwithdelims", "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelcodenum", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaxis", "Umathbinbinspacing", "Umathbinclosespacing", "Umathbininnerspacing", "Umathbinopenspacing", "Umathbinopspacing", "Umathbinordspacing", "Umathbinpunctspacing", "Umathbinrelspacing", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharnum", "Umathcharnumdef", "Umathcharslot", "Umathclass", "Umathclosebinspacing", "Umathcloseclosespacing", "Umathcloseinnerspacing", "Umathcloseopenspacing", "Umathcloseopspacing", "Umathcloseordspacing", "Umathclosepunctspacing", "Umathcloserelspacing", "Umathcode", "Umathcodenum", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathinnerbinspacing", "Umathinnerclosespacing", "Umathinnerinnerspacing", "Umathinneropenspacing", "Umathinneropspacing", "Umathinnerordspacing", "Umathinnerpunctspacing", "Umathinnerrelspacing", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathopbinspacing", "Umathopclosespacing", "Umathopenbinspacing", "Umathopenclosespacing", "Umathopeninnerspacing", "Umathopenopenspacing", "Umathopenopspacing", "Umathopenordspacing", "Umathopenpunctspacing", "Umathopenrelspacing", "Umathoperatorsize", "Umathopinnerspacing", "Umathopopenspacing", "Umathopopspacing", "Umathopordspacing", "Umathoppunctspacing", "Umathoprelspacing", "Umathordbinspacing", "Umathordclosespacing", "Umathordinnerspacing", "Umathordopenspacing", "Umathordopspacing", "Umathordordspacing", "Umathordpunctspacing", "Umathordrelspacing", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervgap", "Umathpunctbinspacing", "Umathpunctclosespacing", "Umathpunctinnerspacing", "Umathpunctopenspacing", "Umathpunctopspacing", "Umathpunctordspacing", "Umathpunctpunctspacing", "Umathpunctrelspacing", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalkern", "Umathradicalrule", "Umathradicalvgap", "Umathrelbinspacing", "Umathrelclosespacing", "Umathrelinnerspacing", "Umathrelopenspacing", "Umathrelopspacing", "Umathrelordspacing", "Umathrelpunctspacing", "Umathrelrelspacing", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathspaceafterscript", "Umathspacebeforescript", "Umathspacingmode", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvgap", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uradical", "Uright", "Uroot", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustopdisplaymath", "Ustopmath", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "afterassigned", "aftergrouped", "aliased", "alignmark", "aligntab", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "begincsname", "beginlocalcontrol", "boundary", "boxattribute", "boxdirection", "boxorientation", "boxtotal", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "clearmarks", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csstring", "defaliased", "defcsname", "directlua", "edefaliased", "edefcsname", "efcode", "endlocalcontrol", "enforced", "etoksapp", "etokspre", "everytab", "exceptionpenalty", "expand", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "fontid", "fontspecifiedsize", "formatname", "frozen", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gleaders", "glet", "glyphdatafield", "glyphdimensionsmode", "glyphoptions", "glyphscriptfield", "glyphstatefield", "gtoksapp", "gtokspre", "hjcode", "hpack", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchknum", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimval", "ifempty", "ifflags", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifmathparameter", "ifmathstyle", "ifnumval", "ifparameter", "iftok", "ignorearguments", "ignorepars", "immediate", "immutable", "initcatcodetable", "insertht", "instance", "integerdef", "lastarguments", "lastnamedcs", "lastnodesubtype", "leftmarginkern", "letaliased", "letcharcode", "letcsname", "letfrozen", "letprotected", "linedirection", "linepar", "localbrokenpenalty", "localcontrol", "localcontrolled", "localinterlinepenalty", "localleftbox", "localrightbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathdelimitersmode", "mathdirection", "mathdisplayskipmode", "matheqnogapstep", "mathflattenmode", "mathitalicsmode", "mathnolimitsmode", "matholdmode", "mathpenaltiesmode", "mathrulesfam", "mathrulesmode", "mathrulethicknessmode", "mathscriptboxmode", "mathscriptcharmode", "mathscriptsmode", "mathstyle", "mathsurroundmode", "mathsurroundskip", "mutable", "noaligned", "noboundary", "nohrule", "normalizelinemode", "nospaces", "novrule", "orelse", "orunless", "outputbox", "overloaded", "overloadmode", "parattr", "pardirection", "permanent", "postexhyphenchar", "posthyphenchar", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "prerelpenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitvmode", "rightmarginkern", "rpcode", "savecatcodetable", "scantextokens", "setfontid", "snapshotpar", "supmarkmode", "swapcsvalues", "textdirection", "thewithoutunit", "tokenized", "toksapp", "tokspre", "tolerant", "tpack", "tracingfonts", "tracingmath", "unletfrozen", "unletprotected", "vpack", "wordboundary", "wrapuppar", "xtoksapp", "xtokspre" },
+ ["luatex"]={ "UUskewed", "UUskewedwithdelims", "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelcodenum", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaxis", "Umathbinbinspacing", "Umathbinclosespacing", "Umathbininnerspacing", "Umathbinopenspacing", "Umathbinopspacing", "Umathbinordspacing", "Umathbinpunctspacing", "Umathbinrelspacing", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharnum", "Umathcharnumdef", "Umathcharslot", "Umathclass", "Umathclosebinspacing", "Umathcloseclosespacing", "Umathcloseinnerspacing", "Umathcloseopenspacing", "Umathcloseopspacing", "Umathcloseordspacing", "Umathclosepunctspacing", "Umathcloserelspacing", "Umathcode", "Umathcodenum", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathinnerbinspacing", "Umathinnerclosespacing", "Umathinnerinnerspacing", "Umathinneropenspacing", "Umathinneropspacing", "Umathinnerordspacing", "Umathinnerpunctspacing", "Umathinnerrelspacing", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathopbinspacing", "Umathopclosespacing", "Umathopenbinspacing", "Umathopenclosespacing", "Umathopeninnerspacing", "Umathopenopenspacing", "Umathopenopspacing", "Umathopenordspacing", "Umathopenpunctspacing", "Umathopenrelspacing", "Umathoperatorsize", "Umathopinnerspacing", "Umathopopenspacing", "Umathopopspacing", "Umathopordspacing", "Umathoppunctspacing", "Umathoprelspacing", "Umathordbinspacing", "Umathordclosespacing", "Umathordinnerspacing", "Umathordopenspacing", "Umathordopspacing", "Umathordordspacing", "Umathordpunctspacing", "Umathordrelspacing", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervgap", "Umathpunctbinspacing", "Umathpunctclosespacing", "Umathpunctinnerspacing", "Umathpunctopenspacing", "Umathpunctopspacing", "Umathpunctordspacing", "Umathpunctpunctspacing", "Umathpunctrelspacing", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalkern", "Umathradicalrule", "Umathradicalvgap", "Umathrelbinspacing", "Umathrelclosespacing", "Umathrelinnerspacing", "Umathrelopenspacing", "Umathrelopspacing", "Umathrelordspacing", "Umathrelpunctspacing", "Umathrelrelspacing", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathspaceafterscript", "Umathspacebeforescript", "Umathspacingmode", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvgap", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uradical", "Uright", "Uroot", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustopdisplaymath", "Ustopmath", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "afterassigned", "aftergrouped", "aliased", "alignmark", "aligntab", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "begincsname", "beginlocalcontrol", "boundary", "boxattribute", "boxdirection", "boxorientation", "boxtotal", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "clearmarks", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csstring", "defcsname", "directlua", "edefcsname", "efcode", "endlocalcontrol", "enforced", "etoksapp", "etokspre", "everytab", "exceptionpenalty", "expand", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "fontid", "fontspecifiedsize", "formatname", "frozen", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gleaders", "glet", "glyphdatafield", "glyphdimensionsmode", "glyphoptions", "glyphscriptfield", "glyphstatefield", "gtoksapp", "gtokspre", "hjcode", "hpack", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchknum", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimval", "ifempty", "ifflags", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifmathparameter", "ifmathstyle", "ifnumval", "ifparameter", "ifparameters", "iftok", "ignorearguments", "ignorepars", "immediate", "immutable", "initcatcodetable", "insertht", "instance", "integerdef", "lastarguments", "lastnamedcs", "lastnodesubtype", "leftmarginkern", "letcharcode", "letcsname", "letfrozen", "letprotected", "linedirection", "linepar", "localbrokenpenalty", "localcontrol", "localcontrolled", "localinterlinepenalty", "localleftbox", "localrightbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathdelimitersmode", "mathdirection", "mathdisplayskipmode", "matheqnogapstep", "mathflattenmode", "mathitalicsmode", "mathnolimitsmode", "matholdmode", "mathpenaltiesmode", "mathrulesfam", "mathrulesmode", "mathrulethicknessmode", "mathscriptboxmode", "mathscriptcharmode", "mathscriptsmode", "mathstyle", "mathsurroundmode", "mathsurroundskip", "mutable", "noaligned", "noboundary", "nohrule", "normalizelinemode", "nospaces", "novrule", "orelse", "orunless", "outputbox", "overloaded", "overloadmode", "parattr", "pardirection", "permanent", "postexhyphenchar", "posthyphenchar", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "prerelpenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitvmode", "rightmarginkern", "rpcode", "savecatcodetable", "scantextokens", "setfontid", "snapshotpar", "supmarkmode", "swapcsvalues", "textdirection", "thewithoutunit", "tokenized", "toksapp", "tokspre", "tolerant", "tpack", "tracingfonts", "tracingmath", "unletfrozen", "unletprotected", "vpack", "wordboundary", "wrapuppar", "xtoksapp", "xtokspre" },
["omega"]={ "Omegaminorversion", "Omegarevision", "Omegaversion" },
["pdftex"]={ "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "pdfadjustspacing", "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit", "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate", "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode", "pdfeachlinedepth", "pdfeachlineheight", "pdfendlink", "pdfendthread", "pdffirstlineheight", "pdffontattr", "pdffontexpand", "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma", "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", "pdfignoreunknownimages", "pdfimageaddfilename", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", "pdfinclusionerrorlevel", "pdfinfo", "pdfinfoomitdate", "pdfinsertht", "pdflastannot", "pdflastlinedepth", "pdflastlink", "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", "pdfmajorversion", "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", "pdfomitcharset", "pdfomitcidset", "pdfoutline", "pdfoutput", "pdfpageattr", "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", "pdfpagesattr", "pdfpagewidth", "pdfpkfixeddpi", "pdfpkmode", "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", "pdfrandomseed", "pdfrecompress", "pdfrefobj", "pdfrefxform", "pdfrefximage", "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos", "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", "pdfsuppressoptionalinfo", "pdfsuppressptexinfo", "pdftexbanner", "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin", "pdftracingfonts", "pdftrailer", "pdftrailerid", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage" },
["tex"]={ " ", "-", "/", "above", "abovedisplayshortskip", "abovedisplayskip", "abovewithdelims", "accent", "adjdemerits", "advance", "afterassignment", "aftergroup", "atop", "atopwithdelims", "badness", "baselineskip", "batchmode", "begingroup", "belowdisplayshortskip", "belowdisplayskip", "binoppenalty", "botmark", "box", "boxmaxdepth", "brokenpenalty", "catcode", "char", "chardef", "cleaders", "clubpenalty", "copy", "count", "countdef", "cr", "crcr", "csname", "day", "deadcycles", "def", "defaulthyphenchar", "defaultskewchar", "delcode", "delimiter", "delimiterfactor", "delimitershortfall", "dimen", "dimendef", "discretionary", "displayindent", "displaylimits", "displaystyle", "displaywidowpenalty", "displaywidth", "divide", "doublehyphendemerits", "dp", "dump", "edef", "else", "emergencystretch", "end", "endcsname", "endgroup", "endinput", "endlinechar", "eqno", "errhelp", "errmessage", "errorcontextlines", "errorstopmode", "escapechar", "everycr", "everydisplay", "everyhbox", "everyjob", "everymath", "everypar", "everyvbox", "exhyphenchar", "exhyphenpenalty", "expandafter", "fam", "fi", "finalhyphendemerits", "firstmark", "floatingpenalty", "font", "fontdimen", "fontname", "fontspecifiedname", "futurelet", "gdef", "global", "globaldefs", "halign", "hangafter", "hangindent", "hbadness", "hbox", "hfil", "hfill", "hfilneg", "hfuzz", "holdinginserts", "hrule", "hsize", "hskip", "hss", "ht", "hyphenation", "hyphenchar", "hyphenpenalty", "if", "ifcase", "ifcat", "ifdim", "iffalse", "ifhbox", "ifhmode", "ifinner", "ifmmode", "ifnum", "ifodd", "iftrue", "ifvbox", "ifvmode", "ifvoid", "ifx", "ignorespaces", "indent", "input", "inputlineno", "insert", "insertpenalties", "interlinepenalty", "jobname", "kern", "language", "lastbox", "lastkern", "lastpenalty", "lastskip", "lccode", "leaders", "left", "lefthyphenmin", "leftskip", "leqno", "let", "limits", "linepenalty", "lineskip", "lineskiplimit", "long", "looseness", "lower", "lowercase", "mark", "mathaccent", "mathbin", "mathchar", "mathchardef", "mathchoice", "mathclose", "mathcode", "mathinner", "mathop", "mathopen", "mathord", "mathpunct", "mathrel", "mathsurround", "maxdeadcycles", "maxdepth", "meaning", "meaningfull", "meaningless", "medmuskip", "message", "middle", "mkern", "month", "moveleft", "moveright", "mskip", "multiply", "muskip", "muskipdef", "newlinechar", "noalign", "noexpand", "noindent", "nolimits", "nonscript", "nonstopmode", "nulldelimiterspace", "nullfont", "number", "omit", "or", "ordlimits", "outer", "output", "outputpenalty", "over", "overfullrule", "overline", "overshoot", "overwithdelims", "pagedepth", "pagefilllstretch", "pagefillstretch", "pagefilstretch", "pagegoal", "pageshrink", "pagestretch", "pagetotal", "par", "parfillleftskip", "parfillskip", "parindent", "parshape", "parskip", "patterns", "pausing", "penalty", "postdisplaypenalty", "predisplaypenalty", "predisplaysize", "pretolerance", "prevdepth", "prevgraf", "radical", "raise", "relax", "relpenalty", "right", "righthyphenmin", "rightskip", "romannumeral", "scriptfont", "scriptscriptfont", "scriptscriptstyle", "scriptspace", "scriptstyle", "scrollmode", "setbox", "setlanguage", "sfcode", "shipout", "show", "showbox", "showboxbreadth", "showboxdepth", "showlists", "shownodedetails", "showthe", "skewchar", "skip", "skipdef", "spacefactor", "spaceskip", "span", "splitbotmark", "splitfirstmark", "splitmaxdepth", "splittopskip", "string", "tabskip", "textfont", "textstyle", "the", "thickmuskip", "thinmuskip", "time", "todimension", "tointeger", "toks", "toksdef", "tolerance", "topmark", "topskip", "toscaled", "tracingcommands", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingpages", "tracingparagraphs", "tracingrestores", "tracingstats", "uccode", "uchyph", "underline", "unhbox", "unhcopy", "unhpack", "unkern", "unpenalty", "unskip", "unvbox", "unvcopy", "unvpack", "uppercase", "vadjust", "valign", "vbadness", "vbox", "vcenter", "vfil", "vfill", "vfilneg", "vfuzz", "vrule", "vsize", "vskip", "vsplit", "vss", "vtop", "wd", "widowpenalty", "xdef", "xleaders", "xspaceskip", "year" },
diff --git a/context/data/scite/context/scite-context-data-tex.properties b/context/data/scite/context/scite-context-data-tex.properties
index 33dac826b..3c3d82722 100644
--- a/context/data/scite/context/scite-context-data-tex.properties
+++ b/context/data/scite/context/scite-context-data-tex.properties
@@ -56,40 +56,40 @@ automatichyphenpenalty automigrationmode begincsname beginlocalcontrol boundary
boxattribute boxdirection boxorientation boxtotal boxxmove \
boxxoffset boxymove boxyoffset catcodetable clearmarks \
crampeddisplaystyle crampedscriptscriptstyle crampedscriptstyle crampedtextstyle csstring \
-defaliased defcsname directlua edefaliased edefcsname \
-efcode endlocalcontrol enforced etoksapp etokspre \
-everytab exceptionpenalty expand expandafterpars expandafterspaces \
-expandcstoken expanded expandtoken explicitdiscretionary explicithyphenpenalty \
-firstvalidlanguage fontid fontspecifiedsize formatname frozen \
-futuredef futureexpand futureexpandis futureexpandisap gleaders \
-glet glyphdatafield glyphdimensionsmode glyphoptions glyphscriptfield \
-glyphstatefield gtoksapp gtokspre hjcode hpack \
-hyphenationmin hyphenationmode ifabsdim ifabsnum ifarguments \
-ifboolean ifchkdim ifchknum ifcmpdim ifcmpnum \
-ifcondition ifcstok ifdimval ifempty ifflags \
-ifhastok ifhastoks ifhasxtoks ifincsname ifmathparameter \
-ifmathstyle ifnumval ifparameter iftok ignorearguments \
-ignorepars immediate immutable initcatcodetable insertht \
-instance integerdef lastarguments lastnamedcs lastnodesubtype \
-leftmarginkern letaliased letcharcode letcsname letfrozen \
-letprotected linedirection linepar localbrokenpenalty localcontrol \
-localcontrolled localinterlinepenalty localleftbox localrightbox lpcode \
-luabytecode luabytecodecall luacopyinputnodes luadef luaescapestring \
-luafunction luafunctioncall luatexbanner luatexrevision luatexversion \
-mathdelimitersmode mathdirection mathdisplayskipmode matheqnogapstep mathflattenmode \
-mathitalicsmode mathnolimitsmode matholdmode mathpenaltiesmode mathrulesfam \
-mathrulesmode mathrulethicknessmode mathscriptboxmode mathscriptcharmode mathscriptsmode \
-mathstyle mathsurroundmode mathsurroundskip mutable noaligned \
-noboundary nohrule normalizelinemode nospaces novrule \
-orelse orunless outputbox overloaded overloadmode \
-parattr pardirection permanent postexhyphenchar posthyphenchar \
-prebinoppenalty predisplaygapfactor preexhyphenchar prehyphenchar prerelpenalty \
-protrudechars protrusionboundary pxdimen quitvmode rightmarginkern \
-rpcode savecatcodetable scantextokens setfontid snapshotpar \
-supmarkmode swapcsvalues textdirection thewithoutunit tokenized \
-toksapp tokspre tolerant tpack tracingfonts \
-tracingmath unletfrozen unletprotected vpack wordboundary \
-wrapuppar xtoksapp xtokspre
+defcsname directlua edefcsname efcode endlocalcontrol \
+enforced etoksapp etokspre everytab exceptionpenalty \
+expand expandafterpars expandafterspaces expandcstoken expanded \
+expandtoken explicitdiscretionary explicithyphenpenalty firstvalidlanguage fontid \
+fontspecifiedsize formatname frozen futuredef futureexpand \
+futureexpandis futureexpandisap gleaders glet glyphdatafield \
+glyphdimensionsmode glyphoptions glyphscriptfield glyphstatefield gtoksapp \
+gtokspre hjcode hpack hyphenationmin hyphenationmode \
+ifabsdim ifabsnum ifarguments ifboolean ifchkdim \
+ifchknum ifcmpdim ifcmpnum ifcondition ifcstok \
+ifdimval ifempty ifflags ifhastok ifhastoks \
+ifhasxtoks ifincsname ifmathparameter ifmathstyle ifnumval \
+ifparameter ifparameters iftok ignorearguments ignorepars \
+immediate immutable initcatcodetable insertht instance \
+integerdef lastarguments lastnamedcs lastnodesubtype leftmarginkern \
+letcharcode letcsname letfrozen letprotected linedirection \
+linepar localbrokenpenalty localcontrol localcontrolled localinterlinepenalty \
+localleftbox localrightbox lpcode luabytecode luabytecodecall \
+luacopyinputnodes luadef luaescapestring luafunction luafunctioncall \
+luatexbanner luatexrevision luatexversion mathdelimitersmode mathdirection \
+mathdisplayskipmode matheqnogapstep mathflattenmode mathitalicsmode mathnolimitsmode \
+matholdmode mathpenaltiesmode mathrulesfam mathrulesmode mathrulethicknessmode \
+mathscriptboxmode mathscriptcharmode mathscriptsmode mathstyle mathsurroundmode \
+mathsurroundskip mutable noaligned noboundary nohrule \
+normalizelinemode nospaces novrule orelse orunless \
+outputbox overloaded overloadmode parattr pardirection \
+permanent postexhyphenchar posthyphenchar prebinoppenalty predisplaygapfactor \
+preexhyphenchar prehyphenchar prerelpenalty protrudechars protrusionboundary \
+pxdimen quitvmode rightmarginkern rpcode savecatcodetable \
+scantextokens setfontid snapshotpar supmarkmode swapcsvalues \
+textdirection thewithoutunit tokenized toksapp tokspre \
+tolerant tpack tracingfonts tracingmath unletfrozen \
+unletprotected vpack wordboundary wrapuppar xtoksapp \
+xtokspre
keywordclass.tex.omega=\
Omegaminorversion Omegarevision Omegaversion
diff --git a/context/data/textadept/context/data/scite-context-data-tex.lua b/context/data/textadept/context/data/scite-context-data-tex.lua
index 2521d8935..c5b85808f 100644
--- a/context/data/textadept/context/data/scite-context-data-tex.lua
+++ b/context/data/textadept/context/data/scite-context-data-tex.lua
@@ -1,7 +1,7 @@
return {
["aleph"]={ "Alephminorversion", "Alephrevision", "Alephversion" },
["etex"]={ "botmarks", "clubpenalties", "currentgrouplevel", "currentgrouptype", "currentifbranch", "currentiflevel", "currentiftype", "detokenize", "dimexpr", "displaywidowpenalties", "everyeof", "firstmarks", "fontchardp", "fontcharht", "fontcharic", "fontcharwd", "glueexpr", "glueshrink", "glueshrinkorder", "gluestretch", "gluestretchorder", "gluetomu", "ifcsname", "ifdefined", "iffontchar", "interactionmode", "interlinepenalties", "lastlinefit", "lastnodetype", "marks", "muexpr", "mutoglue", "numexpr", "pagediscards", "parshapedimen", "parshapeindent", "parshapelength", "predisplaydirection", "protected", "savinghyphcodes", "savingvdiscards", "scantokens", "showgroups", "showifs", "showtokens", "splitbotmarks", "splitdiscards", "splitfirstmarks", "topmarks", "tracingalignments", "tracingassigns", "tracinggroups", "tracingifs", "tracingnesting", "unexpanded", "unless", "widowpenalties" },
- ["luatex"]={ "UUskewed", "UUskewedwithdelims", "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelcodenum", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaxis", "Umathbinbinspacing", "Umathbinclosespacing", "Umathbininnerspacing", "Umathbinopenspacing", "Umathbinopspacing", "Umathbinordspacing", "Umathbinpunctspacing", "Umathbinrelspacing", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharnum", "Umathcharnumdef", "Umathcharslot", "Umathclass", "Umathclosebinspacing", "Umathcloseclosespacing", "Umathcloseinnerspacing", "Umathcloseopenspacing", "Umathcloseopspacing", "Umathcloseordspacing", "Umathclosepunctspacing", "Umathcloserelspacing", "Umathcode", "Umathcodenum", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathinnerbinspacing", "Umathinnerclosespacing", "Umathinnerinnerspacing", "Umathinneropenspacing", "Umathinneropspacing", "Umathinnerordspacing", "Umathinnerpunctspacing", "Umathinnerrelspacing", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathopbinspacing", "Umathopclosespacing", "Umathopenbinspacing", "Umathopenclosespacing", "Umathopeninnerspacing", "Umathopenopenspacing", "Umathopenopspacing", "Umathopenordspacing", "Umathopenpunctspacing", "Umathopenrelspacing", "Umathoperatorsize", "Umathopinnerspacing", "Umathopopenspacing", "Umathopopspacing", "Umathopordspacing", "Umathoppunctspacing", "Umathoprelspacing", "Umathordbinspacing", "Umathordclosespacing", "Umathordinnerspacing", "Umathordopenspacing", "Umathordopspacing", "Umathordordspacing", "Umathordpunctspacing", "Umathordrelspacing", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervgap", "Umathpunctbinspacing", "Umathpunctclosespacing", "Umathpunctinnerspacing", "Umathpunctopenspacing", "Umathpunctopspacing", "Umathpunctordspacing", "Umathpunctpunctspacing", "Umathpunctrelspacing", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalkern", "Umathradicalrule", "Umathradicalvgap", "Umathrelbinspacing", "Umathrelclosespacing", "Umathrelinnerspacing", "Umathrelopenspacing", "Umathrelopspacing", "Umathrelordspacing", "Umathrelpunctspacing", "Umathrelrelspacing", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathspaceafterscript", "Umathspacebeforescript", "Umathspacingmode", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvgap", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uradical", "Uright", "Uroot", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustopdisplaymath", "Ustopmath", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "afterassigned", "aftergrouped", "aliased", "alignmark", "aligntab", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "begincsname", "beginlocalcontrol", "boundary", "boxattribute", "boxdirection", "boxorientation", "boxtotal", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "clearmarks", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csstring", "defaliased", "defcsname", "directlua", "edefaliased", "edefcsname", "efcode", "endlocalcontrol", "enforced", "etoksapp", "etokspre", "everytab", "exceptionpenalty", "expand", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "fontid", "fontspecifiedsize", "formatname", "frozen", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gleaders", "glet", "glyphdatafield", "glyphdimensionsmode", "glyphoptions", "glyphscriptfield", "glyphstatefield", "gtoksapp", "gtokspre", "hjcode", "hpack", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchknum", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimval", "ifempty", "ifflags", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifmathparameter", "ifmathstyle", "ifnumval", "ifparameter", "iftok", "ignorearguments", "ignorepars", "immediate", "immutable", "initcatcodetable", "insertht", "instance", "integerdef", "lastarguments", "lastnamedcs", "lastnodesubtype", "leftmarginkern", "letaliased", "letcharcode", "letcsname", "letfrozen", "letprotected", "linedirection", "linepar", "localbrokenpenalty", "localcontrol", "localcontrolled", "localinterlinepenalty", "localleftbox", "localrightbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathdelimitersmode", "mathdirection", "mathdisplayskipmode", "matheqnogapstep", "mathflattenmode", "mathitalicsmode", "mathnolimitsmode", "matholdmode", "mathpenaltiesmode", "mathrulesfam", "mathrulesmode", "mathrulethicknessmode", "mathscriptboxmode", "mathscriptcharmode", "mathscriptsmode", "mathstyle", "mathsurroundmode", "mathsurroundskip", "mutable", "noaligned", "noboundary", "nohrule", "normalizelinemode", "nospaces", "novrule", "orelse", "orunless", "outputbox", "overloaded", "overloadmode", "parattr", "pardirection", "permanent", "postexhyphenchar", "posthyphenchar", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "prerelpenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitvmode", "rightmarginkern", "rpcode", "savecatcodetable", "scantextokens", "setfontid", "snapshotpar", "supmarkmode", "swapcsvalues", "textdirection", "thewithoutunit", "tokenized", "toksapp", "tokspre", "tolerant", "tpack", "tracingfonts", "tracingmath", "unletfrozen", "unletprotected", "vpack", "wordboundary", "wrapuppar", "xtoksapp", "xtokspre" },
+ ["luatex"]={ "UUskewed", "UUskewedwithdelims", "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelcodenum", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaxis", "Umathbinbinspacing", "Umathbinclosespacing", "Umathbininnerspacing", "Umathbinopenspacing", "Umathbinopspacing", "Umathbinordspacing", "Umathbinpunctspacing", "Umathbinrelspacing", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharnum", "Umathcharnumdef", "Umathcharslot", "Umathclass", "Umathclosebinspacing", "Umathcloseclosespacing", "Umathcloseinnerspacing", "Umathcloseopenspacing", "Umathcloseopspacing", "Umathcloseordspacing", "Umathclosepunctspacing", "Umathcloserelspacing", "Umathcode", "Umathcodenum", "Umathconnectoroverlapmin", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathinnerbinspacing", "Umathinnerclosespacing", "Umathinnerinnerspacing", "Umathinneropenspacing", "Umathinneropspacing", "Umathinnerordspacing", "Umathinnerpunctspacing", "Umathinnerrelspacing", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathopbinspacing", "Umathopclosespacing", "Umathopenbinspacing", "Umathopenclosespacing", "Umathopeninnerspacing", "Umathopenopenspacing", "Umathopenopspacing", "Umathopenordspacing", "Umathopenpunctspacing", "Umathopenrelspacing", "Umathoperatorsize", "Umathopinnerspacing", "Umathopopenspacing", "Umathopopspacing", "Umathopordspacing", "Umathoppunctspacing", "Umathoprelspacing", "Umathordbinspacing", "Umathordclosespacing", "Umathordinnerspacing", "Umathordopenspacing", "Umathordopspacing", "Umathordordspacing", "Umathordpunctspacing", "Umathordrelspacing", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervgap", "Umathpunctbinspacing", "Umathpunctclosespacing", "Umathpunctinnerspacing", "Umathpunctopenspacing", "Umathpunctopspacing", "Umathpunctordspacing", "Umathpunctpunctspacing", "Umathpunctrelspacing", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalkern", "Umathradicalrule", "Umathradicalvgap", "Umathrelbinspacing", "Umathrelclosespacing", "Umathrelinnerspacing", "Umathrelopenspacing", "Umathrelopspacing", "Umathrelordspacing", "Umathrelpunctspacing", "Umathrelrelspacing", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathspaceafterscript", "Umathspacebeforescript", "Umathspacingmode", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvgap", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervgap", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uradical", "Uright", "Uroot", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustopdisplaymath", "Ustopmath", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "afterassigned", "aftergrouped", "aliased", "alignmark", "aligntab", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "begincsname", "beginlocalcontrol", "boundary", "boxattribute", "boxdirection", "boxorientation", "boxtotal", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "clearmarks", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csstring", "defcsname", "directlua", "edefcsname", "efcode", "endlocalcontrol", "enforced", "etoksapp", "etokspre", "everytab", "exceptionpenalty", "expand", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "fontid", "fontspecifiedsize", "formatname", "frozen", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gleaders", "glet", "glyphdatafield", "glyphdimensionsmode", "glyphoptions", "glyphscriptfield", "glyphstatefield", "gtoksapp", "gtokspre", "hjcode", "hpack", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchknum", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimval", "ifempty", "ifflags", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifmathparameter", "ifmathstyle", "ifnumval", "ifparameter", "ifparameters", "iftok", "ignorearguments", "ignorepars", "immediate", "immutable", "initcatcodetable", "insertht", "instance", "integerdef", "lastarguments", "lastnamedcs", "lastnodesubtype", "leftmarginkern", "letcharcode", "letcsname", "letfrozen", "letprotected", "linedirection", "linepar", "localbrokenpenalty", "localcontrol", "localcontrolled", "localinterlinepenalty", "localleftbox", "localrightbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathdelimitersmode", "mathdirection", "mathdisplayskipmode", "matheqnogapstep", "mathflattenmode", "mathitalicsmode", "mathnolimitsmode", "matholdmode", "mathpenaltiesmode", "mathrulesfam", "mathrulesmode", "mathrulethicknessmode", "mathscriptboxmode", "mathscriptcharmode", "mathscriptsmode", "mathstyle", "mathsurroundmode", "mathsurroundskip", "mutable", "noaligned", "noboundary", "nohrule", "normalizelinemode", "nospaces", "novrule", "orelse", "orunless", "outputbox", "overloaded", "overloadmode", "parattr", "pardirection", "permanent", "postexhyphenchar", "posthyphenchar", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "prerelpenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitvmode", "rightmarginkern", "rpcode", "savecatcodetable", "scantextokens", "setfontid", "snapshotpar", "supmarkmode", "swapcsvalues", "textdirection", "thewithoutunit", "tokenized", "toksapp", "tokspre", "tolerant", "tpack", "tracingfonts", "tracingmath", "unletfrozen", "unletprotected", "vpack", "wordboundary", "wrapuppar", "xtoksapp", "xtokspre" },
["omega"]={ "Omegaminorversion", "Omegarevision", "Omegaversion" },
["pdftex"]={ "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "pdfadjustspacing", "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit", "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate", "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode", "pdfeachlinedepth", "pdfeachlineheight", "pdfendlink", "pdfendthread", "pdffirstlineheight", "pdffontattr", "pdffontexpand", "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma", "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", "pdfignoreunknownimages", "pdfimageaddfilename", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", "pdfinclusionerrorlevel", "pdfinfo", "pdfinfoomitdate", "pdfinsertht", "pdflastannot", "pdflastlinedepth", "pdflastlink", "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", "pdfmajorversion", "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", "pdfomitcharset", "pdfomitcidset", "pdfoutline", "pdfoutput", "pdfpageattr", "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", "pdfpagesattr", "pdfpagewidth", "pdfpkfixeddpi", "pdfpkmode", "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", "pdfrandomseed", "pdfrecompress", "pdfrefobj", "pdfrefxform", "pdfrefximage", "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos", "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", "pdfsuppressoptionalinfo", "pdfsuppressptexinfo", "pdftexbanner", "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin", "pdftracingfonts", "pdftrailer", "pdftrailerid", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage" },
["tex"]={ " ", "-", "/", "above", "abovedisplayshortskip", "abovedisplayskip", "abovewithdelims", "accent", "adjdemerits", "advance", "afterassignment", "aftergroup", "atop", "atopwithdelims", "badness", "baselineskip", "batchmode", "begingroup", "belowdisplayshortskip", "belowdisplayskip", "binoppenalty", "botmark", "box", "boxmaxdepth", "brokenpenalty", "catcode", "char", "chardef", "cleaders", "clubpenalty", "copy", "count", "countdef", "cr", "crcr", "csname", "day", "deadcycles", "def", "defaulthyphenchar", "defaultskewchar", "delcode", "delimiter", "delimiterfactor", "delimitershortfall", "dimen", "dimendef", "discretionary", "displayindent", "displaylimits", "displaystyle", "displaywidowpenalty", "displaywidth", "divide", "doublehyphendemerits", "dp", "dump", "edef", "else", "emergencystretch", "end", "endcsname", "endgroup", "endinput", "endlinechar", "eqno", "errhelp", "errmessage", "errorcontextlines", "errorstopmode", "escapechar", "everycr", "everydisplay", "everyhbox", "everyjob", "everymath", "everypar", "everyvbox", "exhyphenchar", "exhyphenpenalty", "expandafter", "fam", "fi", "finalhyphendemerits", "firstmark", "floatingpenalty", "font", "fontdimen", "fontname", "fontspecifiedname", "futurelet", "gdef", "global", "globaldefs", "halign", "hangafter", "hangindent", "hbadness", "hbox", "hfil", "hfill", "hfilneg", "hfuzz", "holdinginserts", "hrule", "hsize", "hskip", "hss", "ht", "hyphenation", "hyphenchar", "hyphenpenalty", "if", "ifcase", "ifcat", "ifdim", "iffalse", "ifhbox", "ifhmode", "ifinner", "ifmmode", "ifnum", "ifodd", "iftrue", "ifvbox", "ifvmode", "ifvoid", "ifx", "ignorespaces", "indent", "input", "inputlineno", "insert", "insertpenalties", "interlinepenalty", "jobname", "kern", "language", "lastbox", "lastkern", "lastpenalty", "lastskip", "lccode", "leaders", "left", "lefthyphenmin", "leftskip", "leqno", "let", "limits", "linepenalty", "lineskip", "lineskiplimit", "long", "looseness", "lower", "lowercase", "mark", "mathaccent", "mathbin", "mathchar", "mathchardef", "mathchoice", "mathclose", "mathcode", "mathinner", "mathop", "mathopen", "mathord", "mathpunct", "mathrel", "mathsurround", "maxdeadcycles", "maxdepth", "meaning", "meaningfull", "meaningless", "medmuskip", "message", "middle", "mkern", "month", "moveleft", "moveright", "mskip", "multiply", "muskip", "muskipdef", "newlinechar", "noalign", "noexpand", "noindent", "nolimits", "nonscript", "nonstopmode", "nulldelimiterspace", "nullfont", "number", "omit", "or", "ordlimits", "outer", "output", "outputpenalty", "over", "overfullrule", "overline", "overshoot", "overwithdelims", "pagedepth", "pagefilllstretch", "pagefillstretch", "pagefilstretch", "pagegoal", "pageshrink", "pagestretch", "pagetotal", "par", "parfillleftskip", "parfillskip", "parindent", "parshape", "parskip", "patterns", "pausing", "penalty", "postdisplaypenalty", "predisplaypenalty", "predisplaysize", "pretolerance", "prevdepth", "prevgraf", "radical", "raise", "relax", "relpenalty", "right", "righthyphenmin", "rightskip", "romannumeral", "scriptfont", "scriptscriptfont", "scriptscriptstyle", "scriptspace", "scriptstyle", "scrollmode", "setbox", "setlanguage", "sfcode", "shipout", "show", "showbox", "showboxbreadth", "showboxdepth", "showlists", "shownodedetails", "showthe", "skewchar", "skip", "skipdef", "spacefactor", "spaceskip", "span", "splitbotmark", "splitfirstmark", "splitmaxdepth", "splittopskip", "string", "tabskip", "textfont", "textstyle", "the", "thickmuskip", "thinmuskip", "time", "todimension", "tointeger", "toks", "toksdef", "tolerance", "topmark", "topskip", "toscaled", "tracingcommands", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingpages", "tracingparagraphs", "tracingrestores", "tracingstats", "uccode", "uchyph", "underline", "unhbox", "unhcopy", "unhpack", "unkern", "unpenalty", "unskip", "unvbox", "unvcopy", "unvpack", "uppercase", "vadjust", "valign", "vbadness", "vbox", "vcenter", "vfil", "vfill", "vfilneg", "vfuzz", "vrule", "vsize", "vskip", "vsplit", "vss", "vtop", "wd", "widowpenalty", "xdef", "xleaders", "xspaceskip", "year" },
diff --git a/context/data/vscode/extensions/context/syntaxes/context-syntax-tex.json b/context/data/vscode/extensions/context/syntaxes/context-syntax-tex.json
index 7e79acc54..eb80e2861 100644
--- a/context/data/vscode/extensions/context/syntaxes/context-syntax-tex.json
+++ b/context/data/vscode/extensions/context/syntaxes/context-syntax-tex.json
@@ -215,7 +215,7 @@
]
},
"primitive" : {
- "match" : "\u005C\u005C(year|xtokspre|xtoksapp|xspaceskip|xleaders|xdef|wrapuppar|wordboundary|widowpenalty|widowpenalties|wd|vtop|vss|vsplit|vskip|vsize|vrule|vpack|vfuzz|vfilneg|vfill|vfil|vcenter|vbox|vbadness|valign|vadjust|uppercase|unvpack|unvcopy|unvbox|unskip|unpenalty|unletprotected|unletfrozen|unless|unkern|unhpack|unhcopy|unhbox|underline|uchyph|uccode|tracingstats|tracingrestores|tracingparagraphs|tracingpages|tracingoutput|tracingonline|tracingnesting|tracingmath|tracingmacros|tracinglostchars|tracingifs|tracinggroups|tracingfonts|tracingcommands|tracingassigns|tracingalignments|tpack|toscaled|topskip|topmarks|topmark|tolerant|tolerance|tokspre|toksdef|toksapp|toks|tokenized|tointeger|todimension|time|thinmuskip|thickmuskip|thewithoutunit|the|textstyle|textfont|textdirection|tabskip|swapcsvalues|supmarkmode|string|splittopskip|splitmaxdepth|splitfirstmarks|splitfirstmark|splitdiscards|splitbotmarks|splitbotmark|span|spaceskip|spacefactor|snapshotpar|skipdef|skip|skewchar|showtokens|showthe|shownodedetails|showlists|showifs|showgroups|showboxdepth|showboxbreadth|showbox|show|shipout|sfcode|setlanguage|setfontid|setbox|scrollmode|scriptstyle|scriptspace|scriptscriptstyle|scriptscriptfont|scriptfont|scantokens|scantextokens|savingvdiscards|savinghyphcodes|savecatcodetable|rpcode|romannumeral|rightskip|rightmarginkern|righthyphenmin|right|relpenalty|relax|raise|radical|quitvmode|pxdimen|protrusionboundary|protrudechars|protected|prevgraf|prevdepth|pretolerance|prerelpenalty|prehyphenchar|preexhyphenchar|predisplaysize|predisplaypenalty|predisplaygapfactor|predisplaydirection|prebinoppenalty|posthyphenchar|postexhyphenchar|postdisplaypenalty|permanent|penalty|pdfximage|pdfxformresources|pdfxformname|pdfxformmargin|pdfxformattr|pdfxform|pdfvorigin|pdfuniqueresname|pdfuniformdeviate|pdftrailerid|pdftrailer|pdftracingfonts|pdfthreadmargin|pdfthread|pdftexversion|pdftexrevision|pdftexbanner|pdfsuppressptexinfo|pdfsuppressoptionalinfo|pdfstartthread|pdfstartlink|pdfsetrandomseed|pdfsetmatrix|pdfsavepos|pdfsave|pdfretval|pdfrestore|pdfreplacefont|pdfrefximage|pdfrefxform|pdfrefobj|pdfrecompress|pdfrandomseed|pdfpxdimen|pdfprotrudechars|pdfprimitive|pdfpkresolution|pdfpkmode|pdfpkfixeddpi|pdfpagewidth|pdfpagesattr|pdfpageresources|pdfpageref|pdfpageheight|pdfpagebox|pdfpageattr|pdfoutput|pdfoutline|pdfomitcidset|pdfomitcharset|pdfobjcompresslevel|pdfobj|pdfnormaldeviate|pdfnoligatures|pdfnames|pdfminorversion|pdfmapline|pdfmapfile|pdfmajorversion|pdfliteral|pdflinkmargin|pdflastypos|pdflastxpos|pdflastximagepages|pdflastximage|pdflastxform|pdflastobj|pdflastlink|pdflastlinedepth|pdflastannot|pdfinsertht|pdfinfoomitdate|pdfinfo|pdfinclusionerrorlevel|pdfinclusioncopyfonts|pdfincludechars|pdfimageresolution|pdfimagehicolor|pdfimagegamma|pdfimageapplygamma|pdfimageaddfilename|pdfignoreunknownimages|pdfignoreddimen|pdfhorigin|pdfglyphtounicode|pdfgentounicode|pdfgamma|pdffontsize|pdffontobjnum|pdffontname|pdffontexpand|pdffontattr|pdffirstlineheight|pdfendthread|pdfendlink|pdfeachlineheight|pdfeachlinedepth|pdfdraftmode|pdfdestmargin|pdfdest|pdfdecimaldigits|pdfcreationdate|pdfcopyfont|pdfcompresslevel|pdfcolorstackinit|pdfcolorstack|pdfcatalog|pdfannot|pdfadjustspacing|pausing|patterns|parskip|parshapelength|parshapeindent|parshapedimen|parshape|parindent|parfillskip|pardirection|parattr|par|pagetotal|pagestretch|pageshrink|pagegoal|pagefilstretch|pagefillstretch|pagefilllstretch|pagediscards|pagedepth|overwithdelims|overshoot|overloadmode|overloaded|overline|overfullrule|over|outputpenalty|outputbox|output|outer|orunless|orelse|ordlimits|or|omit|numexpr|number|nullfont|nulldelimiterspace|novrule|nospaces|normalyear|normalxtokspre|normalxtoksapp|normalxspaceskip|normalxleaders|normalxdef|normalwrapuppar|normalwordboundary|normalwidowpenalty|normalwidowpenalties|normalwd|normalvtop|normalvss|normalvsplit|normalvskip|normalvsize|normalvrule|normalvpack|normalvfuzz|normalvfilneg|normalvfill|normalvfil|normalvcenter|normalvbox|normalvbadness|normalvalign|normalvadjust|normaluppercase|normalunvpack|normalunvcopy|normalunvbox|normalunskip|normalunpenalty|normalunletprotected|normalunletfrozen|normalunless|normalunkern|normalunhpack|normalunhcopy|normalunhbox|normalunexpanded|normalunderline|normaluchyph|normaluccode|normaltracingstats|normaltracingrestores|normaltracingparagraphs|normaltracingpages|normaltracingoutput|normaltracingonline|normaltracingnesting|normaltracingmath|normaltracingmacros|normaltracinglostchars|normaltracingifs|normaltracinggroups|normaltracingfonts|normaltracingcommands|normaltracingassigns|normaltracingalignments|normaltpack|normaltoscaled|normaltopskip|normaltopmarks|normaltopmark|normaltolerant|normaltolerance|normaltokspre|normaltoksdef|normaltoksapp|normaltoks|normaltokenized|normaltointeger|normaltodimension|normaltime|normalthinmuskip|normalthickmuskip|normalthewithoutunit|normalthe|normaltextstyle|normaltextfont|normaltextdirection|normaltabskip|normalswapcsvalues|normalsupmarkmode|normalstring|normalsplittopskip|normalsplitmaxdepth|normalsplitfirstmarks|normalsplitfirstmark|normalsplitdiscards|normalsplitbotmarks|normalsplitbotmark|normalspan|normalspaceskip|normalspacefactor|normalsnapshotpar|normalskipdef|normalskip|normalskewchar|normalshowtokens|normalshowthe|normalshownodedetails|normalshowlists|normalshowifs|normalshowgroups|normalshowboxdepth|normalshowboxbreadth|normalshowbox|normalshow|normalshipout|normalsfcode|normalsetlanguage|normalsetfontid|normalsetbox|normalscrollmode|normalscriptstyle|normalscriptspace|normalscriptscriptstyle|normalscriptscriptfont|normalscriptfont|normalscantokens|normalscantextokens|normalsavingvdiscards|normalsavinghyphcodes|normalsavecatcodetable|normalrpcode|normalromannumeral|normalrightskip|normalrightmarginkern|normalrighthyphenmin|normalright|normalrelpenalty|normalrelax|normalraise|normalradical|normalquitvmode|normalpxdimen|normalprotrusionboundary|normalprotrudechars|normalprotected|normalprevgraf|normalprevdepth|normalpretolerance|normalprerelpenalty|normalprehyphenchar|normalpreexhyphenchar|normalpredisplaysize|normalpredisplaypenalty|normalpredisplaygapfactor|normalpredisplaydirection|normalprebinoppenalty|normalposthyphenchar|normalpostexhyphenchar|normalpostdisplaypenalty|normalpermanent|normalpenalty|normalpdfximage|normalpdfxformresources|normalpdfxformname|normalpdfxformmargin|normalpdfxformattr|normalpdfxform|normalpdfvorigin|normalpdfuniqueresname|normalpdfuniformdeviate|normalpdftrailerid|normalpdftrailer|normalpdftracingfonts|normalpdfthreadmargin|normalpdfthread|normalpdftexversion|normalpdftexrevision|normalpdftexbanner|normalpdfsuppressptexinfo|normalpdfsuppressoptionalinfo|normalpdfstartthread|normalpdfstartlink|normalpdfsetrandomseed|normalpdfsetmatrix|normalpdfsavepos|normalpdfsave|normalpdfretval|normalpdfrestore|normalpdfreplacefont|normalpdfrefximage|normalpdfrefxform|normalpdfrefobj|normalpdfrecompress|normalpdfrandomseed|normalpdfpxdimen|normalpdfprotrudechars|normalpdfprimitive|normalpdfpkresolution|normalpdfpkmode|normalpdfpkfixeddpi|normalpdfpagewidth|normalpdfpagesattr|normalpdfpageresources|normalpdfpageref|normalpdfpageheight|normalpdfpagebox|normalpdfpageattr|normalpdfoutput|normalpdfoutline|normalpdfomitcidset|normalpdfomitcharset|normalpdfobjcompresslevel|normalpdfobj|normalpdfnormaldeviate|normalpdfnoligatures|normalpdfnames|normalpdfminorversion|normalpdfmapline|normalpdfmapfile|normalpdfmajorversion|normalpdfliteral|normalpdflinkmargin|normalpdflastypos|normalpdflastxpos|normalpdflastximagepages|normalpdflastximage|normalpdflastxform|normalpdflastobj|normalpdflastlink|normalpdflastlinedepth|normalpdflastannot|normalpdfinsertht|normalpdfinfoomitdate|normalpdfinfo|normalpdfinclusionerrorlevel|normalpdfinclusioncopyfonts|normalpdfincludechars|normalpdfimageresolution|normalpdfimagehicolor|normalpdfimagegamma|normalpdfimageapplygamma|normalpdfimageaddfilename|normalpdfignoreunknownimages|normalpdfignoreddimen|normalpdfhorigin|normalpdfglyphtounicode|normalpdfgentounicode|normalpdfgamma|normalpdffontsize|normalpdffontobjnum|normalpdffontname|normalpdffontexpand|normalpdffontattr|normalpdffirstlineheight|normalpdfendthread|normalpdfendlink|normalpdfeachlineheight|normalpdfeachlinedepth|normalpdfdraftmode|normalpdfdestmargin|normalpdfdest|normalpdfdecimaldigits|normalpdfcreationdate|normalpdfcopyfont|normalpdfcompresslevel|normalpdfcolorstackinit|normalpdfcolorstack|normalpdfcatalog|normalpdfannot|normalpdfadjustspacing|normalpausing|normalpatterns|normalparskip|normalparshapelength|normalparshapeindent|normalparshapedimen|normalparshape|normalparindent|normalparfillskip|normalparfillleftskip|normalpardirection|normalparattr|normalpar|normalpagetotal|normalpagestretch|normalpageshrink|normalpagegoal|normalpagefilstretch|normalpagefillstretch|normalpagefilllstretch|normalpagediscards|normalpagedepth|normaloverwithdelims|normalovershoot|normaloverloadmode|normaloverloaded|normaloverline|normaloverfullrule|normalover|normaloutputpenalty|normaloutputbox|normaloutput|normalouter|normalorunless|normalorelse|normalordlimits|normalor|normalomit|normalnumexpr|normalnumber|normalnullfont|normalnulldelimiterspace|normalnovrule|normalnospaces|normalnormalizelinemode|normalnonstopmode|normalnonscript|normalnolimits|normalnoindent|normalnohrule|normalnoexpand|normalnoboundary|normalnoaligned|normalnoalign|normalnewlinechar|normalmutoglue|normalmutable|normalmuskipdef|normalmuskip|normalmultiply|normalmuexpr|normalmskip|normalmoveright|normalmoveleft|normalmonth|normalmkern|normalmiddle|normalmessage|normalmedmuskip|normalmeaningless|normalmeaningfull|normalmeaning|normalmaxdepth|normalmaxdeadcycles|normalmathsurroundskip|normalmathsurroundmode|normalmathsurround|normalmathstyle|normalmathscriptsmode|normalmathscriptcharmode|normalmathscriptboxmode|normalmathrulethicknessmode|normalmathrulesmode|normalmathrulesfam|normalmathrel|normalmathpunct|normalmathpenaltiesmode|normalmathord|normalmathopen|normalmathop|normalmatholdmode|normalmathnolimitsmode|normalmathitalicsmode|normalmathinner|normalmathflattenmode|normalmatheqnogapstep|normalmathdisplayskipmode|normalmathdirection|normalmathdelimitersmode|normalmathcode|normalmathclose|normalmathchoice|normalmathchardef|normalmathchar|normalmathbin|normalmathaccent|normalmarks|normalmark|normalluatexversion|normalluatexrevision|normalluatexbanner|normalluafunctioncall|normalluafunction|normalluaescapestring|normalluadef|normalluacopyinputnodes|normalluabytecodecall|normalluabytecode|normallpcode|normallowercase|normallower|normallooseness|normallong|normallocalrightbox|normallocalleftbox|normallocalinterlinepenalty|normallocalcontrolled|normallocalcontrol|normallocalbrokenpenalty|normallineskiplimit|normallineskip|normallinepenalty|normallinepar|normallinedirection|normallimits|normalletprotected|normalletfrozen|normalletcsname|normalletcharcode|normalletaliased|normallet|normalleqno|normalleftskip|normalleftmarginkern|normallefthyphenmin|normalleft|normalleaders|normallccode|normallastskip|normallastpenalty|normallastnodetype|normallastnodesubtype|normallastnamedcs|normallastlinefit|normallastkern|normallastbox|normallastarguments|normallanguage|normalkern|normaljobname|normalizelinemode|normalinterlinepenalty|normalinterlinepenalties|normalinteractionmode|normalintegerdef|normalinstance|normalinsertpenalties|normalinsertht|normalinsert|normalinputlineno|normalinput|normalinitcatcodetable|normalindent|normalimmutable|normalimmediate|normalignorespaces|normalignorepars|normalignorearguments|normalifx|normalifvoid|normalifvmode|normalifvbox|normaliftrue|normaliftok|normalifpdfprimitive|normalifpdfabsnum|normalifpdfabsdim|normalifparameter|normalifodd|normalifnumval|normalifnum|normalifmmode|normalifmathstyle|normalifmathparameter|normalifinner|normalifincsname|normalifhmode|normalifhbox|normalifhasxtoks|normalifhastoks|normalifhastok|normaliffontchar|normalifflags|normaliffalse|normalifempty|normalifdimval|normalifdim|normalifdefined|normalifcstok|normalifcsname|normalifcondition|normalifcmpnum|normalifcmpdim|normalifchknum|normalifchkdim|normalifcat|normalifcase|normalifboolean|normalifarguments|normalifabsnum|normalifabsdim|normalif|normalhyphenpenalty|normalhyphenchar|normalhyphenationmode|normalhyphenationmin|normalhyphenation|normalht|normalhss|normalhskip|normalhsize|normalhrule|normalhpack|normalholdinginserts|normalhjcode|normalhfuzz|normalhfilneg|normalhfill|normalhfil|normalhbox|normalhbadness|normalhangindent|normalhangafter|normalhalign|normalgtokspre|normalgtoksapp|normalglyphstatefield|normalglyphscriptfield|normalglyphoptions|normalglyphdimensionsmode|normalglyphdatafield|normalgluetomu|normalgluestretchorder|normalgluestretch|normalglueshrinkorder|normalglueshrink|normalglueexpr|normalglobaldefs|normalglobal|normalglet|normalgleaders|normalgdef|normalfuturelet|normalfutureexpandisap|normalfutureexpandis|normalfutureexpand|normalfuturedef|normalfrozen|normalformatname|normalfontspecifiedsize|normalfontspecifiedname|normalfontname|normalfontid|normalfontdimen|normalfontcharwd|normalfontcharic|normalfontcharht|normalfontchardp|normalfont|normalfloatingpenalty|normalfirstvalidlanguage|normalfirstmarks|normalfirstmark|normalfinalhyphendemerits|normalfi|normalfam|normalexplicithyphenpenalty|normalexplicitdiscretionary|normalexpandtoken|normalexpanded|normalexpandcstoken|normalexpandafterspaces|normalexpandafterpars|normalexpandafter|normalexpand|normalexhyphenpenalty|normalexhyphenchar|normalexceptionpenalty|normaleveryvbox|normaleverytab|normaleverypar|normaleverymath|normaleveryjob|normaleveryhbox|normaleveryeof|normaleverydisplay|normaleverycr|normaletokspre|normaletoksapp|normalescapechar|normalerrorstopmode|normalerrorcontextlines|normalerrmessage|normalerrhelp|normaleqno|normalenforced|normalendlocalcontrol|normalendlinechar|normalendinput|normalendgroup|normalendcsname|normalend|normalemergencystretch|normalelse|normalefcode|normaledefcsname|normaledefaliased|normaledef|normaldump|normaldp|normaldoublehyphendemerits|normaldivide|normaldisplaywidth|normaldisplaywidowpenalty|normaldisplaywidowpenalties|normaldisplaystyle|normaldisplaylimits|normaldisplayindent|normaldiscretionary|normaldirectlua|normaldimexpr|normaldimendef|normaldimen|normaldetokenize|normaldelimitershortfall|normaldelimiterfactor|normaldelimiter|normaldelcode|normaldefcsname|normaldefaultskewchar|normaldefaulthyphenchar|normaldefaliased|normaldef|normaldeadcycles|normalday|normalcurrentiftype|normalcurrentiflevel|normalcurrentifbranch|normalcurrentgrouptype|normalcurrentgrouplevel|normalcsstring|normalcsname|normalcrcr|normalcrampedtextstyle|normalcrampedscriptstyle|normalcrampedscriptscriptstyle|normalcrampeddisplaystyle|normalcr|normalcountdef|normalcount|normalcopy|normalclubpenalty|normalclubpenalties|normalclearmarks|normalcleaders|normalchardef|normalchar|normalcatcodetable|normalcatcode|normalbrokenpenalty|normalboxyoffset|normalboxymove|normalboxxoffset|normalboxxmove|normalboxtotal|normalboxorientation|normalboxmaxdepth|normalboxdirection|normalboxattribute|normalbox|normalboundary|normalbotmarks|normalbotmark|normalbinoppenalty|normalbelowdisplayskip|normalbelowdisplayshortskip|normalbeginlocalcontrol|normalbegingroup|normalbegincsname|normalbatchmode|normalbaselineskip|normalbadness|normalautomigrationmode|normalautomatichyphenpenalty|normalautomaticdiscretionary|normalattributedef|normalattribute|normalatopwithdelims|normalatop|normalatendofgrouped|normalatendofgroup|normalaligntab|normalalignmark|normalaliased|normalaftergrouped|normalaftergroup|normalafterassignment|normalafterassigned|normaladvance|normaladjustspacingstretch|normaladjustspacingstep|normaladjustspacingshrink|normaladjustspacing|normaladjdemerits|normalaccent|normalabovewithdelims|normalabovedisplayskip|normalabovedisplayshortskip|normalabove|normalXeTeXversion|normalUvextensible|normalUunderdelimiter|normalUsuperscript|normalUsuperprescript|normalUsubscript|normalUsubprescript|normalUstyle|normalUstopmath|normalUstopdisplaymath|normalUstartmath|normalUstartdisplaymath|normalUstack|normalUskewedwithdelims|normalUskewed|normalUroot|normalUright|normalUradical|normalUoverwithdelims|normalUoverdelimiter|normalUover|normalUnosuperscript|normalUnosuperprescript|normalUnosubscript|normalUnosubprescript|normalUmiddle|normalUmathunderdelimitervgap|normalUmathunderdelimiterbgap|normalUmathunderbarvgap|normalUmathunderbarrule|normalUmathunderbarkern|normalUmathsupsubbottommax|normalUmathsupshiftup|normalUmathsupshiftdrop|normalUmathsupbottommin|normalUmathsubtopmax|normalUmathsubsupvgap|normalUmathsubsupshiftdown|normalUmathsubshiftdrop|normalUmathsubshiftdown|normalUmathstackvgap|normalUmathstacknumup|normalUmathstackdenomdown|normalUmathspacingmode|normalUmathspacebeforescript|normalUmathspaceafterscript|normalUmathskewedfractionvgap|normalUmathskewedfractionhgap|normalUmathrelrelspacing|normalUmathrelpunctspacing|normalUmathrelordspacing|normalUmathrelopspacing|normalUmathrelopenspacing|normalUmathrelinnerspacing|normalUmathrelclosespacing|normalUmathrelbinspacing|normalUmathradicalvgap|normalUmathradicalrule|normalUmathradicalkern|normalUmathradicaldegreeraise|normalUmathradicaldegreebefore|normalUmathradicaldegreeafter|normalUmathquad|normalUmathpunctrelspacing|normalUmathpunctpunctspacing|normalUmathpunctordspacing|normalUmathpunctopspacing|normalUmathpunctopenspacing|normalUmathpunctinnerspacing|normalUmathpunctclosespacing|normalUmathpunctbinspacing|normalUmathoverdelimitervgap|normalUmathoverdelimiterbgap|normalUmathoverbarvgap|normalUmathoverbarrule|normalUmathoverbarkern|normalUmathordrelspacing|normalUmathordpunctspacing|normalUmathordordspacing|normalUmathordopspacing|normalUmathordopenspacing|normalUmathordinnerspacing|normalUmathordclosespacing|normalUmathordbinspacing|normalUmathoprelspacing|normalUmathoppunctspacing|normalUmathopordspacing|normalUmathopopspacing|normalUmathopopenspacing|normalUmathopinnerspacing|normalUmathoperatorsize|normalUmathopenrelspacing|normalUmathopenpunctspacing|normalUmathopenordspacing|normalUmathopenopspacing|normalUmathopenopenspacing|normalUmathopeninnerspacing|normalUmathopenclosespacing|normalUmathopenbinspacing|normalUmathopclosespacing|normalUmathopbinspacing|normalUmathnolimitsupfactor|normalUmathnolimitsubfactor|normalUmathlimitbelowvgap|normalUmathlimitbelowkern|normalUmathlimitbelowbgap|normalUmathlimitabovevgap|normalUmathlimitabovekern|normalUmathlimitabovebgap|normalUmathinnerrelspacing|normalUmathinnerpunctspacing|normalUmathinnerordspacing|normalUmathinneropspacing|normalUmathinneropenspacing|normalUmathinnerinnerspacing|normalUmathinnerclosespacing|normalUmathinnerbinspacing|normalUmathfractionrule|normalUmathfractionnumvgap|normalUmathfractionnumup|normalUmathfractiondenomvgap|normalUmathfractiondenomdown|normalUmathfractiondelsize|normalUmathconnectoroverlapmin|normalUmathcodenum|normalUmathcode|normalUmathcloserelspacing|normalUmathclosepunctspacing|normalUmathcloseordspacing|normalUmathcloseopspacing|normalUmathcloseopenspacing|normalUmathcloseinnerspacing|normalUmathcloseclosespacing|normalUmathclosebinspacing|normalUmathclass|normalUmathcharslot|normalUmathcharnumdef|normalUmathcharnum|normalUmathcharfam|normalUmathchardef|normalUmathcharclass|normalUmathchar|normalUmathbinrelspacing|normalUmathbinpunctspacing|normalUmathbinordspacing|normalUmathbinopspacing|normalUmathbinopenspacing|normalUmathbininnerspacing|normalUmathbinclosespacing|normalUmathbinbinspacing|normalUmathaxis|normalUmathaccent|normalUleft|normalUhextensible|normalUdelimiterunder|normalUdelimiterover|normalUdelimiter|normalUdelcodenum|normalUdelcode|normalUchar|normalUatopwithdelims|normalUatop|normalUabovewithdelims|normalUabove|normalUUskewedwithdelims|normalUUskewed|normalOmegaversion|normalOmegarevision|normalOmegaminorversion|normalAlephversion|normalAlephrevision|normalAlephminorversion|normal |nonstopmode|nonscript|nolimits|noindent|nohrule|noexpand|noboundary|noaligned|noalign|newlinechar|mutoglue|mutable|muskipdef|muskip|multiply|muexpr|mskip|moveright|moveleft|month|mkern|middle|message|medmuskip|meaningless|meaningfull|meaning|maxdepth|maxdeadcycles|mathsurroundskip|mathsurroundmode|mathsurround|mathstyle|mathscriptsmode|mathscriptcharmode|mathscriptboxmode|mathrulethicknessmode|mathrulesmode|mathrulesfam|mathrel|mathpunct|mathpenaltiesmode|mathord|mathopen|mathop|matholdmode|mathnolimitsmode|mathitalicsmode|mathinner|mathflattenmode|matheqnogapstep|mathdisplayskipmode|mathdirection|mathdelimitersmode|mathcode|mathclose|mathchoice|mathchardef|mathchar|mathbin|mathaccent|marks|mark|luatexversion|luatexrevision|luatexbanner|luafunctioncall|luafunction|luaescapestring|luadef|luacopyinputnodes|luabytecodecall|luabytecode|lpcode|lowercase|lower|looseness|long|localrightbox|localleftbox|localinterlinepenalty|localcontrolled|localcontrol|localbrokenpenalty|lineskiplimit|lineskip|linepenalty|linepar|linedirection|limits|letprotected|letfrozen|letcsname|letcharcode|letaliased|let|leqno|leftskip|leftmarginkern|lefthyphenmin|left|leaders|lccode|lastskip|lastpenalty|lastnodetype|lastnodesubtype|lastnamedcs|lastlinefit|lastkern|lastbox|lastarguments|language|kern|jobname|interlinepenalty|interlinepenalties|interactionmode|integerdef|instance|insertpenalties|insertht|insert|inputlineno|input|initcatcodetable|indent|immutable|immediate|ignorespaces|ignorepars|ignorearguments|ifx|ifvoid|ifvmode|ifvbox|iftrue|iftok|ifpdfprimitive|ifpdfabsnum|ifpdfabsdim|ifparameter|ifodd|ifnumval|ifnum|ifmmode|ifmathstyle|ifmathparameter|ifinner|ifincsname|ifhmode|ifhbox|ifhasxtoks|ifhastoks|ifhastok|iffontchar|ifflags|iffalse|ifempty|ifdimval|ifdim|ifdefined|ifcstok|ifcsname|ifcondition|ifcmpnum|ifcmpdim|ifchknum|ifchkdim|ifcat|ifcase|ifboolean|ifarguments|ifabsnum|ifabsdim|if|hyphenpenalty|hyphenchar|hyphenationmode|hyphenationmin|hyphenation|ht|hss|hskip|hsize|hrule|hpack|holdinginserts|hjcode|hfuzz|hfilneg|hfill|hfil|hbox|hbadness|hangindent|hangafter|halign|gtokspre|gtoksapp|glyphstatefield|glyphscriptfield|glyphoptions|glyphdimensionsmode|glyphdatafield|gluetomu|gluestretchorder|gluestretch|glueshrinkorder|glueshrink|glueexpr|globaldefs|global|gleaders|gdef|futurelet|futureexpandisap|futureexpandis|futureexpand|futuredef|frozen|formatname|fontspecifiedsize|fontspecifiedname|fontname|fontid|fontdimen|fontcharwd|fontcharic|fontcharht|fontchardp|font|floatingpenalty|firstvalidlanguage|firstmarks|firstmark|finalhyphendemerits|fi|fam|explicithyphenpenalty|explicitdiscretionary|expandtoken|expandcstoken|expandafterspaces|expandafterpars|expandafter|expand|exhyphenpenalty|exhyphenchar|exceptionpenalty|everyvbox|everytab|everypar|everymath|everyjob|everyhbox|everyeof|everydisplay|everycr|etokspre|etoksapp|escapechar|errorstopmode|errorcontextlines|errmessage|errhelp|eqno|enforced|endlocalcontrol|endlinechar|endinput|endgroup|endcsname|end|emergencystretch|else|efcode|edefcsname|edefaliased|edef|dump|dp|doublehyphendemerits|divide|displaywidth|displaywidowpenalty|displaywidowpenalties|displaystyle|displaylimits|displayindent|discretionary|directlua|dimexpr|dimendef|dimen|detokenize|delimitershortfall|delimiterfactor|delimiter|delcode|defcsname|defaultskewchar|defaulthyphenchar|defaliased|def|deadcycles|day|currentiftype|currentiflevel|currentifbranch|currentgrouptype|currentgrouplevel|csstring|csname|crcr|crampedtextstyle|crampedscriptstyle|crampedscriptscriptstyle|crampeddisplaystyle|cr|countdef|count|copy|clubpenalty|clubpenalties|clearmarks|cleaders|chardef|char|catcodetable|catcode|brokenpenalty|boxyoffset|boxymove|boxxoffset|boxxmove|boxtotal|boxorientation|boxmaxdepth|boxdirection|boxattribute|box|boundary|botmarks|botmark|binoppenalty|belowdisplayskip|belowdisplayshortskip|beginlocalcontrol|begingroup|begincsname|batchmode|baselineskip|badness|automigrationmode|automatichyphenpenalty|automaticdiscretionary|attributedef|attribute|atopwithdelims|atop|atendofgrouped|atendofgroup|aligntab|alignmark|aliased|aftergrouped|aftergroup|afterassignment|afterassigned|advance|adjustspacingstretch|adjustspacingstep|adjustspacingshrink|adjustspacing|adjdemerits|accent|abovewithdelims|abovedisplayskip|abovedisplayshortskip|above|XeTeXversion|Uvextensible|Uunderdelimiter|Usuperscript|Usuperprescript|Usubscript|Usubprescript|Ustyle|Ustopmath|Ustopdisplaymath|Ustartmath|Ustartdisplaymath|Ustack|Uskewedwithdelims|Uskewed|Uroot|Uright|Uradical|Uoverwithdelims|Uoverdelimiter|Uover|Unosuperscript|Unosuperprescript|Unosubscript|Unosubprescript|Umiddle|Umathunderdelimitervgap|Umathunderdelimiterbgap|Umathunderbarvgap|Umathunderbarrule|Umathunderbarkern|Umathsupsubbottommax|Umathsupshiftup|Umathsupshiftdrop|Umathsupbottommin|Umathsubtopmax|Umathsubsupvgap|Umathsubsupshiftdown|Umathsubshiftdrop|Umathsubshiftdown|Umathstackvgap|Umathstacknumup|Umathstackdenomdown|Umathspacingmode|Umathspacebeforescript|Umathspaceafterscript|Umathskewedfractionvgap|Umathskewedfractionhgap|Umathrelrelspacing|Umathrelpunctspacing|Umathrelordspacing|Umathrelopspacing|Umathrelopenspacing|Umathrelinnerspacing|Umathrelclosespacing|Umathrelbinspacing|Umathradicalvgap|Umathradicalrule|Umathradicalkern|Umathradicaldegreeraise|Umathradicaldegreebefore|Umathradicaldegreeafter|Umathquad|Umathpunctrelspacing|Umathpunctpunctspacing|Umathpunctordspacing|Umathpunctopspacing|Umathpunctopenspacing|Umathpunctinnerspacing|Umathpunctclosespacing|Umathpunctbinspacing|Umathoverdelimitervgap|Umathoverdelimiterbgap|Umathoverbarvgap|Umathoverbarrule|Umathoverbarkern|Umathordrelspacing|Umathordpunctspacing|Umathordordspacing|Umathordopspacing|Umathordopenspacing|Umathordinnerspacing|Umathordclosespacing|Umathordbinspacing|Umathoprelspacing|Umathoppunctspacing|Umathopordspacing|Umathopopspacing|Umathopopenspacing|Umathopinnerspacing|Umathoperatorsize|Umathopenrelspacing|Umathopenpunctspacing|Umathopenordspacing|Umathopenopspacing|Umathopenopenspacing|Umathopeninnerspacing|Umathopenclosespacing|Umathopenbinspacing|Umathopclosespacing|Umathopbinspacing|Umathnolimitsupfactor|Umathnolimitsubfactor|Umathlimitbelowvgap|Umathlimitbelowkern|Umathlimitbelowbgap|Umathlimitabovevgap|Umathlimitabovekern|Umathlimitabovebgap|Umathinnerrelspacing|Umathinnerpunctspacing|Umathinnerordspacing|Umathinneropspacing|Umathinneropenspacing|Umathinnerinnerspacing|Umathinnerclosespacing|Umathinnerbinspacing|Umathfractionrule|Umathfractionnumvgap|Umathfractionnumup|Umathfractiondenomvgap|Umathfractiondenomdown|Umathfractiondelsize|Umathconnectoroverlapmin|Umathcodenum|Umathcode|Umathcloserelspacing|Umathclosepunctspacing|Umathcloseordspacing|Umathcloseopspacing|Umathcloseopenspacing|Umathcloseinnerspacing|Umathcloseclosespacing|Umathclosebinspacing|Umathclass|Umathcharslot|Umathcharnumdef|Umathcharnum|Umathcharfam|Umathchardef|Umathcharclass|Umathchar|Umathbinrelspacing|Umathbinpunctspacing|Umathbinordspacing|Umathbinopspacing|Umathbinopenspacing|Umathbininnerspacing|Umathbinclosespacing|Umathbinbinspacing|Umathaxis|Umathaccent|Uleft|Uhextensible|Udelimiterunder|Udelimiterover|Udelimiter|Udelcodenum|Udelcode|Uchar|Uatopwithdelims|Uatop|Uabovewithdelims|Uabove|UUskewedwithdelims|UUskewed|Omegaversion|Omegarevision|Omegaminorversion|Alephversion|Alephrevision|Alephminorversion| )(?=[^a-zA-Z])",
+ "match" : "\u005C\u005C(year|xtokspre|xtoksapp|xspaceskip|xleaders|xdef|wrapuppar|wordboundary|widowpenalty|widowpenalties|wd|vtop|vss|vsplit|vskip|vsize|vrule|vpack|vfuzz|vfilneg|vfill|vfil|vcenter|vbox|vbadness|valign|vadjust|uppercase|unvpack|unvcopy|unvbox|unskip|unpenalty|unletprotected|unletfrozen|unless|unkern|unhpack|unhcopy|unhbox|underline|uchyph|uccode|tracingstats|tracingrestores|tracingparagraphs|tracingpages|tracingoutput|tracingonline|tracingnesting|tracingmath|tracingmacros|tracinglostchars|tracingifs|tracinggroups|tracingfonts|tracingcommands|tracingassigns|tracingalignments|tpack|toscaled|topskip|topmarks|topmark|tolerant|tolerance|tokspre|toksdef|toksapp|toks|tokenized|tointeger|todimension|time|thinmuskip|thickmuskip|thewithoutunit|the|textstyle|textfont|textdirection|tabskip|swapcsvalues|supmarkmode|string|splittopskip|splitmaxdepth|splitfirstmarks|splitfirstmark|splitdiscards|splitbotmarks|splitbotmark|span|spaceskip|spacefactor|snapshotpar|skipdef|skip|skewchar|showtokens|showthe|shownodedetails|showlists|showifs|showgroups|showboxdepth|showboxbreadth|showbox|show|shipout|sfcode|setlanguage|setfontid|setbox|scrollmode|scriptstyle|scriptspace|scriptscriptstyle|scriptscriptfont|scriptfont|scantokens|scantextokens|savingvdiscards|savinghyphcodes|savecatcodetable|rpcode|romannumeral|rightskip|rightmarginkern|righthyphenmin|right|relpenalty|relax|raise|radical|quitvmode|pxdimen|protrusionboundary|protrudechars|protected|prevgraf|prevdepth|pretolerance|prerelpenalty|prehyphenchar|preexhyphenchar|predisplaysize|predisplaypenalty|predisplaygapfactor|predisplaydirection|prebinoppenalty|posthyphenchar|postexhyphenchar|postdisplaypenalty|permanent|penalty|pdfximage|pdfxformresources|pdfxformname|pdfxformmargin|pdfxformattr|pdfxform|pdfvorigin|pdfuniqueresname|pdfuniformdeviate|pdftrailerid|pdftrailer|pdftracingfonts|pdfthreadmargin|pdfthread|pdftexversion|pdftexrevision|pdftexbanner|pdfsuppressptexinfo|pdfsuppressoptionalinfo|pdfstartthread|pdfstartlink|pdfsetrandomseed|pdfsetmatrix|pdfsavepos|pdfsave|pdfretval|pdfrestore|pdfreplacefont|pdfrefximage|pdfrefxform|pdfrefobj|pdfrecompress|pdfrandomseed|pdfpxdimen|pdfprotrudechars|pdfprimitive|pdfpkresolution|pdfpkmode|pdfpkfixeddpi|pdfpagewidth|pdfpagesattr|pdfpageresources|pdfpageref|pdfpageheight|pdfpagebox|pdfpageattr|pdfoutput|pdfoutline|pdfomitcidset|pdfomitcharset|pdfobjcompresslevel|pdfobj|pdfnormaldeviate|pdfnoligatures|pdfnames|pdfminorversion|pdfmapline|pdfmapfile|pdfmajorversion|pdfliteral|pdflinkmargin|pdflastypos|pdflastxpos|pdflastximagepages|pdflastximage|pdflastxform|pdflastobj|pdflastlink|pdflastlinedepth|pdflastannot|pdfinsertht|pdfinfoomitdate|pdfinfo|pdfinclusionerrorlevel|pdfinclusioncopyfonts|pdfincludechars|pdfimageresolution|pdfimagehicolor|pdfimagegamma|pdfimageapplygamma|pdfimageaddfilename|pdfignoreunknownimages|pdfignoreddimen|pdfhorigin|pdfglyphtounicode|pdfgentounicode|pdfgamma|pdffontsize|pdffontobjnum|pdffontname|pdffontexpand|pdffontattr|pdffirstlineheight|pdfendthread|pdfendlink|pdfeachlineheight|pdfeachlinedepth|pdfdraftmode|pdfdestmargin|pdfdest|pdfdecimaldigits|pdfcreationdate|pdfcopyfont|pdfcompresslevel|pdfcolorstackinit|pdfcolorstack|pdfcatalog|pdfannot|pdfadjustspacing|pausing|patterns|parskip|parshapelength|parshapeindent|parshapedimen|parshape|parindent|parfillskip|pardirection|parattr|par|pagetotal|pagestretch|pageshrink|pagegoal|pagefilstretch|pagefillstretch|pagefilllstretch|pagediscards|pagedepth|overwithdelims|overshoot|overloadmode|overloaded|overline|overfullrule|over|outputpenalty|outputbox|output|outer|orunless|orelse|ordlimits|or|omit|numexpr|number|nullfont|nulldelimiterspace|novrule|nospaces|normalyear|normalxtokspre|normalxtoksapp|normalxspaceskip|normalxleaders|normalxdef|normalwrapuppar|normalwordboundary|normalwidowpenalty|normalwidowpenalties|normalwd|normalvtop|normalvss|normalvsplit|normalvskip|normalvsize|normalvrule|normalvpack|normalvfuzz|normalvfilneg|normalvfill|normalvfil|normalvcenter|normalvbox|normalvbadness|normalvalign|normalvadjust|normaluppercase|normalunvpack|normalunvcopy|normalunvbox|normalunskip|normalunpenalty|normalunletprotected|normalunletfrozen|normalunless|normalunkern|normalunhpack|normalunhcopy|normalunhbox|normalunexpanded|normalunderline|normaluchyph|normaluccode|normaltracingstats|normaltracingrestores|normaltracingparagraphs|normaltracingpages|normaltracingoutput|normaltracingonline|normaltracingnesting|normaltracingmath|normaltracingmacros|normaltracinglostchars|normaltracingifs|normaltracinggroups|normaltracingfonts|normaltracingcommands|normaltracingassigns|normaltracingalignments|normaltpack|normaltoscaled|normaltopskip|normaltopmarks|normaltopmark|normaltolerant|normaltolerance|normaltokspre|normaltoksdef|normaltoksapp|normaltoks|normaltokenized|normaltointeger|normaltodimension|normaltime|normalthinmuskip|normalthickmuskip|normalthewithoutunit|normalthe|normaltextstyle|normaltextfont|normaltextdirection|normaltabskip|normalswapcsvalues|normalsupmarkmode|normalstring|normalsplittopskip|normalsplitmaxdepth|normalsplitfirstmarks|normalsplitfirstmark|normalsplitdiscards|normalsplitbotmarks|normalsplitbotmark|normalspan|normalspaceskip|normalspacefactor|normalsnapshotpar|normalskipdef|normalskip|normalskewchar|normalshowtokens|normalshowthe|normalshownodedetails|normalshowlists|normalshowifs|normalshowgroups|normalshowboxdepth|normalshowboxbreadth|normalshowbox|normalshow|normalshipout|normalsfcode|normalsetlanguage|normalsetfontid|normalsetbox|normalscrollmode|normalscriptstyle|normalscriptspace|normalscriptscriptstyle|normalscriptscriptfont|normalscriptfont|normalscantokens|normalscantextokens|normalsavingvdiscards|normalsavinghyphcodes|normalsavecatcodetable|normalrpcode|normalromannumeral|normalrightskip|normalrightmarginkern|normalrighthyphenmin|normalright|normalrelpenalty|normalrelax|normalraise|normalradical|normalquitvmode|normalpxdimen|normalprotrusionboundary|normalprotrudechars|normalprotected|normalprevgraf|normalprevdepth|normalpretolerance|normalprerelpenalty|normalprehyphenchar|normalpreexhyphenchar|normalpredisplaysize|normalpredisplaypenalty|normalpredisplaygapfactor|normalpredisplaydirection|normalprebinoppenalty|normalposthyphenchar|normalpostexhyphenchar|normalpostdisplaypenalty|normalpermanent|normalpenalty|normalpdfximage|normalpdfxformresources|normalpdfxformname|normalpdfxformmargin|normalpdfxformattr|normalpdfxform|normalpdfvorigin|normalpdfuniqueresname|normalpdfuniformdeviate|normalpdftrailerid|normalpdftrailer|normalpdftracingfonts|normalpdfthreadmargin|normalpdfthread|normalpdftexversion|normalpdftexrevision|normalpdftexbanner|normalpdfsuppressptexinfo|normalpdfsuppressoptionalinfo|normalpdfstartthread|normalpdfstartlink|normalpdfsetrandomseed|normalpdfsetmatrix|normalpdfsavepos|normalpdfsave|normalpdfretval|normalpdfrestore|normalpdfreplacefont|normalpdfrefximage|normalpdfrefxform|normalpdfrefobj|normalpdfrecompress|normalpdfrandomseed|normalpdfpxdimen|normalpdfprotrudechars|normalpdfprimitive|normalpdfpkresolution|normalpdfpkmode|normalpdfpkfixeddpi|normalpdfpagewidth|normalpdfpagesattr|normalpdfpageresources|normalpdfpageref|normalpdfpageheight|normalpdfpagebox|normalpdfpageattr|normalpdfoutput|normalpdfoutline|normalpdfomitcidset|normalpdfomitcharset|normalpdfobjcompresslevel|normalpdfobj|normalpdfnormaldeviate|normalpdfnoligatures|normalpdfnames|normalpdfminorversion|normalpdfmapline|normalpdfmapfile|normalpdfmajorversion|normalpdfliteral|normalpdflinkmargin|normalpdflastypos|normalpdflastxpos|normalpdflastximagepages|normalpdflastximage|normalpdflastxform|normalpdflastobj|normalpdflastlink|normalpdflastlinedepth|normalpdflastannot|normalpdfinsertht|normalpdfinfoomitdate|normalpdfinfo|normalpdfinclusionerrorlevel|normalpdfinclusioncopyfonts|normalpdfincludechars|normalpdfimageresolution|normalpdfimagehicolor|normalpdfimagegamma|normalpdfimageapplygamma|normalpdfimageaddfilename|normalpdfignoreunknownimages|normalpdfignoreddimen|normalpdfhorigin|normalpdfglyphtounicode|normalpdfgentounicode|normalpdfgamma|normalpdffontsize|normalpdffontobjnum|normalpdffontname|normalpdffontexpand|normalpdffontattr|normalpdffirstlineheight|normalpdfendthread|normalpdfendlink|normalpdfeachlineheight|normalpdfeachlinedepth|normalpdfdraftmode|normalpdfdestmargin|normalpdfdest|normalpdfdecimaldigits|normalpdfcreationdate|normalpdfcopyfont|normalpdfcompresslevel|normalpdfcolorstackinit|normalpdfcolorstack|normalpdfcatalog|normalpdfannot|normalpdfadjustspacing|normalpausing|normalpatterns|normalparskip|normalparshapelength|normalparshapeindent|normalparshapedimen|normalparshape|normalparindent|normalparfillskip|normalparfillleftskip|normalpardirection|normalparattr|normalpar|normalpagetotal|normalpagestretch|normalpageshrink|normalpagegoal|normalpagefilstretch|normalpagefillstretch|normalpagefilllstretch|normalpagediscards|normalpagedepth|normaloverwithdelims|normalovershoot|normaloverloadmode|normaloverloaded|normaloverline|normaloverfullrule|normalover|normaloutputpenalty|normaloutputbox|normaloutput|normalouter|normalorunless|normalorelse|normalordlimits|normalor|normalomit|normalnumexpr|normalnumber|normalnullfont|normalnulldelimiterspace|normalnovrule|normalnospaces|normalnormalizelinemode|normalnonstopmode|normalnonscript|normalnolimits|normalnoindent|normalnohrule|normalnoexpand|normalnoboundary|normalnoaligned|normalnoalign|normalnewlinechar|normalmutoglue|normalmutable|normalmuskipdef|normalmuskip|normalmultiply|normalmuexpr|normalmskip|normalmoveright|normalmoveleft|normalmonth|normalmkern|normalmiddle|normalmessage|normalmedmuskip|normalmeaningless|normalmeaningfull|normalmeaning|normalmaxdepth|normalmaxdeadcycles|normalmathsurroundskip|normalmathsurroundmode|normalmathsurround|normalmathstyle|normalmathscriptsmode|normalmathscriptcharmode|normalmathscriptboxmode|normalmathrulethicknessmode|normalmathrulesmode|normalmathrulesfam|normalmathrel|normalmathpunct|normalmathpenaltiesmode|normalmathord|normalmathopen|normalmathop|normalmatholdmode|normalmathnolimitsmode|normalmathitalicsmode|normalmathinner|normalmathflattenmode|normalmatheqnogapstep|normalmathdisplayskipmode|normalmathdirection|normalmathdelimitersmode|normalmathcode|normalmathclose|normalmathchoice|normalmathchardef|normalmathchar|normalmathbin|normalmathaccent|normalmarks|normalmark|normalluatexversion|normalluatexrevision|normalluatexbanner|normalluafunctioncall|normalluafunction|normalluaescapestring|normalluadef|normalluacopyinputnodes|normalluabytecodecall|normalluabytecode|normallpcode|normallowercase|normallower|normallooseness|normallong|normallocalrightbox|normallocalleftbox|normallocalinterlinepenalty|normallocalcontrolled|normallocalcontrol|normallocalbrokenpenalty|normallineskiplimit|normallineskip|normallinepenalty|normallinepar|normallinedirection|normallimits|normalletprotected|normalletfrozen|normalletcsname|normalletcharcode|normallet|normalleqno|normalleftskip|normalleftmarginkern|normallefthyphenmin|normalleft|normalleaders|normallccode|normallastskip|normallastpenalty|normallastnodetype|normallastnodesubtype|normallastnamedcs|normallastlinefit|normallastkern|normallastbox|normallastarguments|normallanguage|normalkern|normaljobname|normalizelinemode|normalinterlinepenalty|normalinterlinepenalties|normalinteractionmode|normalintegerdef|normalinstance|normalinsertpenalties|normalinsertht|normalinsert|normalinputlineno|normalinput|normalinitcatcodetable|normalindent|normalimmutable|normalimmediate|normalignorespaces|normalignorepars|normalignorearguments|normalifx|normalifvoid|normalifvmode|normalifvbox|normaliftrue|normaliftok|normalifpdfprimitive|normalifpdfabsnum|normalifpdfabsdim|normalifparameters|normalifparameter|normalifodd|normalifnumval|normalifnum|normalifmmode|normalifmathstyle|normalifmathparameter|normalifinner|normalifincsname|normalifhmode|normalifhbox|normalifhasxtoks|normalifhastoks|normalifhastok|normaliffontchar|normalifflags|normaliffalse|normalifempty|normalifdimval|normalifdim|normalifdefined|normalifcstok|normalifcsname|normalifcondition|normalifcmpnum|normalifcmpdim|normalifchknum|normalifchkdim|normalifcat|normalifcase|normalifboolean|normalifarguments|normalifabsnum|normalifabsdim|normalif|normalhyphenpenalty|normalhyphenchar|normalhyphenationmode|normalhyphenationmin|normalhyphenation|normalht|normalhss|normalhskip|normalhsize|normalhrule|normalhpack|normalholdinginserts|normalhjcode|normalhfuzz|normalhfilneg|normalhfill|normalhfil|normalhbox|normalhbadness|normalhangindent|normalhangafter|normalhalign|normalgtokspre|normalgtoksapp|normalglyphstatefield|normalglyphscriptfield|normalglyphoptions|normalglyphdimensionsmode|normalglyphdatafield|normalgluetomu|normalgluestretchorder|normalgluestretch|normalglueshrinkorder|normalglueshrink|normalglueexpr|normalglobaldefs|normalglobal|normalglet|normalgleaders|normalgdef|normalfuturelet|normalfutureexpandisap|normalfutureexpandis|normalfutureexpand|normalfuturedef|normalfrozen|normalformatname|normalfontspecifiedsize|normalfontspecifiedname|normalfontname|normalfontid|normalfontdimen|normalfontcharwd|normalfontcharic|normalfontcharht|normalfontchardp|normalfont|normalfloatingpenalty|normalfirstvalidlanguage|normalfirstmarks|normalfirstmark|normalfinalhyphendemerits|normalfi|normalfam|normalexplicithyphenpenalty|normalexplicitdiscretionary|normalexpandtoken|normalexpanded|normalexpandcstoken|normalexpandafterspaces|normalexpandafterpars|normalexpandafter|normalexpand|normalexhyphenpenalty|normalexhyphenchar|normalexceptionpenalty|normaleveryvbox|normaleverytab|normaleverypar|normaleverymath|normaleveryjob|normaleveryhbox|normaleveryeof|normaleverydisplay|normaleverycr|normaletokspre|normaletoksapp|normalescapechar|normalerrorstopmode|normalerrorcontextlines|normalerrmessage|normalerrhelp|normaleqno|normalenforced|normalendlocalcontrol|normalendlinechar|normalendinput|normalendgroup|normalendcsname|normalend|normalemergencystretch|normalelse|normalefcode|normaledefcsname|normaledef|normaldump|normaldp|normaldoublehyphendemerits|normaldivide|normaldisplaywidth|normaldisplaywidowpenalty|normaldisplaywidowpenalties|normaldisplaystyle|normaldisplaylimits|normaldisplayindent|normaldiscretionary|normaldirectlua|normaldimexpr|normaldimendef|normaldimen|normaldetokenize|normaldelimitershortfall|normaldelimiterfactor|normaldelimiter|normaldelcode|normaldefcsname|normaldefaultskewchar|normaldefaulthyphenchar|normaldef|normaldeadcycles|normalday|normalcurrentiftype|normalcurrentiflevel|normalcurrentifbranch|normalcurrentgrouptype|normalcurrentgrouplevel|normalcsstring|normalcsname|normalcrcr|normalcrampedtextstyle|normalcrampedscriptstyle|normalcrampedscriptscriptstyle|normalcrampeddisplaystyle|normalcr|normalcountdef|normalcount|normalcopy|normalclubpenalty|normalclubpenalties|normalclearmarks|normalcleaders|normalchardef|normalchar|normalcatcodetable|normalcatcode|normalbrokenpenalty|normalboxyoffset|normalboxymove|normalboxxoffset|normalboxxmove|normalboxtotal|normalboxorientation|normalboxmaxdepth|normalboxdirection|normalboxattribute|normalbox|normalboundary|normalbotmarks|normalbotmark|normalbinoppenalty|normalbelowdisplayskip|normalbelowdisplayshortskip|normalbeginlocalcontrol|normalbegingroup|normalbegincsname|normalbatchmode|normalbaselineskip|normalbadness|normalautomigrationmode|normalautomatichyphenpenalty|normalautomaticdiscretionary|normalattributedef|normalattribute|normalatopwithdelims|normalatop|normalatendofgrouped|normalatendofgroup|normalaligntab|normalalignmark|normalaliased|normalaftergrouped|normalaftergroup|normalafterassignment|normalafterassigned|normaladvance|normaladjustspacingstretch|normaladjustspacingstep|normaladjustspacingshrink|normaladjustspacing|normaladjdemerits|normalaccent|normalabovewithdelims|normalabovedisplayskip|normalabovedisplayshortskip|normalabove|normalXeTeXversion|normalUvextensible|normalUunderdelimiter|normalUsuperscript|normalUsuperprescript|normalUsubscript|normalUsubprescript|normalUstyle|normalUstopmath|normalUstopdisplaymath|normalUstartmath|normalUstartdisplaymath|normalUstack|normalUskewedwithdelims|normalUskewed|normalUroot|normalUright|normalUradical|normalUoverwithdelims|normalUoverdelimiter|normalUover|normalUnosuperscript|normalUnosuperprescript|normalUnosubscript|normalUnosubprescript|normalUmiddle|normalUmathunderdelimitervgap|normalUmathunderdelimiterbgap|normalUmathunderbarvgap|normalUmathunderbarrule|normalUmathunderbarkern|normalUmathsupsubbottommax|normalUmathsupshiftup|normalUmathsupshiftdrop|normalUmathsupbottommin|normalUmathsubtopmax|normalUmathsubsupvgap|normalUmathsubsupshiftdown|normalUmathsubshiftdrop|normalUmathsubshiftdown|normalUmathstackvgap|normalUmathstacknumup|normalUmathstackdenomdown|normalUmathspacingmode|normalUmathspacebeforescript|normalUmathspaceafterscript|normalUmathskewedfractionvgap|normalUmathskewedfractionhgap|normalUmathrelrelspacing|normalUmathrelpunctspacing|normalUmathrelordspacing|normalUmathrelopspacing|normalUmathrelopenspacing|normalUmathrelinnerspacing|normalUmathrelclosespacing|normalUmathrelbinspacing|normalUmathradicalvgap|normalUmathradicalrule|normalUmathradicalkern|normalUmathradicaldegreeraise|normalUmathradicaldegreebefore|normalUmathradicaldegreeafter|normalUmathquad|normalUmathpunctrelspacing|normalUmathpunctpunctspacing|normalUmathpunctordspacing|normalUmathpunctopspacing|normalUmathpunctopenspacing|normalUmathpunctinnerspacing|normalUmathpunctclosespacing|normalUmathpunctbinspacing|normalUmathoverdelimitervgap|normalUmathoverdelimiterbgap|normalUmathoverbarvgap|normalUmathoverbarrule|normalUmathoverbarkern|normalUmathordrelspacing|normalUmathordpunctspacing|normalUmathordordspacing|normalUmathordopspacing|normalUmathordopenspacing|normalUmathordinnerspacing|normalUmathordclosespacing|normalUmathordbinspacing|normalUmathoprelspacing|normalUmathoppunctspacing|normalUmathopordspacing|normalUmathopopspacing|normalUmathopopenspacing|normalUmathopinnerspacing|normalUmathoperatorsize|normalUmathopenrelspacing|normalUmathopenpunctspacing|normalUmathopenordspacing|normalUmathopenopspacing|normalUmathopenopenspacing|normalUmathopeninnerspacing|normalUmathopenclosespacing|normalUmathopenbinspacing|normalUmathopclosespacing|normalUmathopbinspacing|normalUmathnolimitsupfactor|normalUmathnolimitsubfactor|normalUmathlimitbelowvgap|normalUmathlimitbelowkern|normalUmathlimitbelowbgap|normalUmathlimitabovevgap|normalUmathlimitabovekern|normalUmathlimitabovebgap|normalUmathinnerrelspacing|normalUmathinnerpunctspacing|normalUmathinnerordspacing|normalUmathinneropspacing|normalUmathinneropenspacing|normalUmathinnerinnerspacing|normalUmathinnerclosespacing|normalUmathinnerbinspacing|normalUmathfractionrule|normalUmathfractionnumvgap|normalUmathfractionnumup|normalUmathfractiondenomvgap|normalUmathfractiondenomdown|normalUmathfractiondelsize|normalUmathconnectoroverlapmin|normalUmathcodenum|normalUmathcode|normalUmathcloserelspacing|normalUmathclosepunctspacing|normalUmathcloseordspacing|normalUmathcloseopspacing|normalUmathcloseopenspacing|normalUmathcloseinnerspacing|normalUmathcloseclosespacing|normalUmathclosebinspacing|normalUmathclass|normalUmathcharslot|normalUmathcharnumdef|normalUmathcharnum|normalUmathcharfam|normalUmathchardef|normalUmathcharclass|normalUmathchar|normalUmathbinrelspacing|normalUmathbinpunctspacing|normalUmathbinordspacing|normalUmathbinopspacing|normalUmathbinopenspacing|normalUmathbininnerspacing|normalUmathbinclosespacing|normalUmathbinbinspacing|normalUmathaxis|normalUmathaccent|normalUleft|normalUhextensible|normalUdelimiterunder|normalUdelimiterover|normalUdelimiter|normalUdelcodenum|normalUdelcode|normalUchar|normalUatopwithdelims|normalUatop|normalUabovewithdelims|normalUabove|normalUUskewedwithdelims|normalUUskewed|normalOmegaversion|normalOmegarevision|normalOmegaminorversion|normalAlephversion|normalAlephrevision|normalAlephminorversion|normal |nonstopmode|nonscript|nolimits|noindent|nohrule|noexpand|noboundary|noaligned|noalign|newlinechar|mutoglue|mutable|muskipdef|muskip|multiply|muexpr|mskip|moveright|moveleft|month|mkern|middle|message|medmuskip|meaningless|meaningfull|meaning|maxdepth|maxdeadcycles|mathsurroundskip|mathsurroundmode|mathsurround|mathstyle|mathscriptsmode|mathscriptcharmode|mathscriptboxmode|mathrulethicknessmode|mathrulesmode|mathrulesfam|mathrel|mathpunct|mathpenaltiesmode|mathord|mathopen|mathop|matholdmode|mathnolimitsmode|mathitalicsmode|mathinner|mathflattenmode|matheqnogapstep|mathdisplayskipmode|mathdirection|mathdelimitersmode|mathcode|mathclose|mathchoice|mathchardef|mathchar|mathbin|mathaccent|marks|mark|luatexversion|luatexrevision|luatexbanner|luafunctioncall|luafunction|luaescapestring|luadef|luacopyinputnodes|luabytecodecall|luabytecode|lpcode|lowercase|lower|looseness|long|localrightbox|localleftbox|localinterlinepenalty|localcontrolled|localcontrol|localbrokenpenalty|lineskiplimit|lineskip|linepenalty|linepar|linedirection|limits|letprotected|letfrozen|letcsname|letcharcode|let|leqno|leftskip|leftmarginkern|lefthyphenmin|left|leaders|lccode|lastskip|lastpenalty|lastnodetype|lastnodesubtype|lastnamedcs|lastlinefit|lastkern|lastbox|lastarguments|language|kern|jobname|interlinepenalty|interlinepenalties|interactionmode|integerdef|instance|insertpenalties|insertht|insert|inputlineno|input|initcatcodetable|indent|immutable|immediate|ignorespaces|ignorepars|ignorearguments|ifx|ifvoid|ifvmode|ifvbox|iftrue|iftok|ifpdfprimitive|ifpdfabsnum|ifpdfabsdim|ifparameters|ifparameter|ifodd|ifnumval|ifnum|ifmmode|ifmathstyle|ifmathparameter|ifinner|ifincsname|ifhmode|ifhbox|ifhasxtoks|ifhastoks|ifhastok|iffontchar|ifflags|iffalse|ifempty|ifdimval|ifdim|ifdefined|ifcstok|ifcsname|ifcondition|ifcmpnum|ifcmpdim|ifchknum|ifchkdim|ifcat|ifcase|ifboolean|ifarguments|ifabsnum|ifabsdim|if|hyphenpenalty|hyphenchar|hyphenationmode|hyphenationmin|hyphenation|ht|hss|hskip|hsize|hrule|hpack|holdinginserts|hjcode|hfuzz|hfilneg|hfill|hfil|hbox|hbadness|hangindent|hangafter|halign|gtokspre|gtoksapp|glyphstatefield|glyphscriptfield|glyphoptions|glyphdimensionsmode|glyphdatafield|gluetomu|gluestretchorder|gluestretch|glueshrinkorder|glueshrink|glueexpr|globaldefs|global|gleaders|gdef|futurelet|futureexpandisap|futureexpandis|futureexpand|futuredef|frozen|formatname|fontspecifiedsize|fontspecifiedname|fontname|fontid|fontdimen|fontcharwd|fontcharic|fontcharht|fontchardp|font|floatingpenalty|firstvalidlanguage|firstmarks|firstmark|finalhyphendemerits|fi|fam|explicithyphenpenalty|explicitdiscretionary|expandtoken|expandcstoken|expandafterspaces|expandafterpars|expandafter|expand|exhyphenpenalty|exhyphenchar|exceptionpenalty|everyvbox|everytab|everypar|everymath|everyjob|everyhbox|everyeof|everydisplay|everycr|etokspre|etoksapp|escapechar|errorstopmode|errorcontextlines|errmessage|errhelp|eqno|enforced|endlocalcontrol|endlinechar|endinput|endgroup|endcsname|end|emergencystretch|else|efcode|edefcsname|edef|dump|dp|doublehyphendemerits|divide|displaywidth|displaywidowpenalty|displaywidowpenalties|displaystyle|displaylimits|displayindent|discretionary|directlua|dimexpr|dimendef|dimen|detokenize|delimitershortfall|delimiterfactor|delimiter|delcode|defcsname|defaultskewchar|defaulthyphenchar|def|deadcycles|day|currentiftype|currentiflevel|currentifbranch|currentgrouptype|currentgrouplevel|csstring|csname|crcr|crampedtextstyle|crampedscriptstyle|crampedscriptscriptstyle|crampeddisplaystyle|cr|countdef|count|copy|clubpenalty|clubpenalties|clearmarks|cleaders|chardef|char|catcodetable|catcode|brokenpenalty|boxyoffset|boxymove|boxxoffset|boxxmove|boxtotal|boxorientation|boxmaxdepth|boxdirection|boxattribute|box|boundary|botmarks|botmark|binoppenalty|belowdisplayskip|belowdisplayshortskip|beginlocalcontrol|begingroup|begincsname|batchmode|baselineskip|badness|automigrationmode|automatichyphenpenalty|automaticdiscretionary|attributedef|attribute|atopwithdelims|atop|atendofgrouped|atendofgroup|aligntab|alignmark|aliased|aftergrouped|aftergroup|afterassignment|afterassigned|advance|adjustspacingstretch|adjustspacingstep|adjustspacingshrink|adjustspacing|adjdemerits|accent|abovewithdelims|abovedisplayskip|abovedisplayshortskip|above|XeTeXversion|Uvextensible|Uunderdelimiter|Usuperscript|Usuperprescript|Usubscript|Usubprescript|Ustyle|Ustopmath|Ustopdisplaymath|Ustartmath|Ustartdisplaymath|Ustack|Uskewedwithdelims|Uskewed|Uroot|Uright|Uradical|Uoverwithdelims|Uoverdelimiter|Uover|Unosuperscript|Unosuperprescript|Unosubscript|Unosubprescript|Umiddle|Umathunderdelimitervgap|Umathunderdelimiterbgap|Umathunderbarvgap|Umathunderbarrule|Umathunderbarkern|Umathsupsubbottommax|Umathsupshiftup|Umathsupshiftdrop|Umathsupbottommin|Umathsubtopmax|Umathsubsupvgap|Umathsubsupshiftdown|Umathsubshiftdrop|Umathsubshiftdown|Umathstackvgap|Umathstacknumup|Umathstackdenomdown|Umathspacingmode|Umathspacebeforescript|Umathspaceafterscript|Umathskewedfractionvgap|Umathskewedfractionhgap|Umathrelrelspacing|Umathrelpunctspacing|Umathrelordspacing|Umathrelopspacing|Umathrelopenspacing|Umathrelinnerspacing|Umathrelclosespacing|Umathrelbinspacing|Umathradicalvgap|Umathradicalrule|Umathradicalkern|Umathradicaldegreeraise|Umathradicaldegreebefore|Umathradicaldegreeafter|Umathquad|Umathpunctrelspacing|Umathpunctpunctspacing|Umathpunctordspacing|Umathpunctopspacing|Umathpunctopenspacing|Umathpunctinnerspacing|Umathpunctclosespacing|Umathpunctbinspacing|Umathoverdelimitervgap|Umathoverdelimiterbgap|Umathoverbarvgap|Umathoverbarrule|Umathoverbarkern|Umathordrelspacing|Umathordpunctspacing|Umathordordspacing|Umathordopspacing|Umathordopenspacing|Umathordinnerspacing|Umathordclosespacing|Umathordbinspacing|Umathoprelspacing|Umathoppunctspacing|Umathopordspacing|Umathopopspacing|Umathopopenspacing|Umathopinnerspacing|Umathoperatorsize|Umathopenrelspacing|Umathopenpunctspacing|Umathopenordspacing|Umathopenopspacing|Umathopenopenspacing|Umathopeninnerspacing|Umathopenclosespacing|Umathopenbinspacing|Umathopclosespacing|Umathopbinspacing|Umathnolimitsupfactor|Umathnolimitsubfactor|Umathlimitbelowvgap|Umathlimitbelowkern|Umathlimitbelowbgap|Umathlimitabovevgap|Umathlimitabovekern|Umathlimitabovebgap|Umathinnerrelspacing|Umathinnerpunctspacing|Umathinnerordspacing|Umathinneropspacing|Umathinneropenspacing|Umathinnerinnerspacing|Umathinnerclosespacing|Umathinnerbinspacing|Umathfractionrule|Umathfractionnumvgap|Umathfractionnumup|Umathfractiondenomvgap|Umathfractiondenomdown|Umathfractiondelsize|Umathconnectoroverlapmin|Umathcodenum|Umathcode|Umathcloserelspacing|Umathclosepunctspacing|Umathcloseordspacing|Umathcloseopspacing|Umathcloseopenspacing|Umathcloseinnerspacing|Umathcloseclosespacing|Umathclosebinspacing|Umathclass|Umathcharslot|Umathcharnumdef|Umathcharnum|Umathcharfam|Umathchardef|Umathcharclass|Umathchar|Umathbinrelspacing|Umathbinpunctspacing|Umathbinordspacing|Umathbinopspacing|Umathbinopenspacing|Umathbininnerspacing|Umathbinclosespacing|Umathbinbinspacing|Umathaxis|Umathaccent|Uleft|Uhextensible|Udelimiterunder|Udelimiterover|Udelimiter|Udelcodenum|Udelcode|Uchar|Uatopwithdelims|Uatop|Uabovewithdelims|Uabove|UUskewedwithdelims|UUskewed|Omegaversion|Omegarevision|Omegaminorversion|Alephversion|Alephrevision|Alephminorversion| )(?=[^a-zA-Z])",
"name" : "context.primitive.commands.primitive.tex"
},
"reserved" : {
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 92e0ecbf0..2eba08573 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -669,6 +669,7 @@ function scripts.context.run(ctxdata,filename)
local a_arrange = getargument("arrange")
local a_noarrange = getargument("noarrange")
local a_jithash = getargument("jithash")
+ local a_permitloadlib = getargument("permitloadlib")
local a_texformat = getargument("texformat")
local a_keeptuc = getargument("keeptuc")
local a_keeplog = getargument("keeplog")
@@ -714,7 +715,8 @@ function scripts.context.run(ctxdata,filename)
formatfile, scriptfile = resolvers.locateformat(formatname)
end
--
- a_jithash = validstring(a_jithash or analysis.jithash) or nil
+ a_jithash = validstring(a_jithash or analysis.jithash) or nil
+ a_permitloadlib = a_permitloadlib or analysis.permitloadlib or nil
--
if not formatfile or not scriptfile then
report("warning: no format found, forcing remake (source driven)")
@@ -825,6 +827,7 @@ function scripts.context.run(ctxdata,filename)
-- ["lua"] = scriptfile,
["jobname"] = jobname,
["jithash"] = a_jithash,
+ ["permitloadlib"] = a_permitloadlib,
}
--
local directives = { }
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 111230de1..04af96a54 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{2020.11.04 09:28}
+\newcontextversion{2020.11.05 15: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 fdf330ae9..369951155 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{2020.11.04 09:28}
+\edef\contextversion{2020.11.05 15:20}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-en.mkii b/tex/context/base/mkii/mult-en.mkii
index 20021c4ea..8b2a78ba0 100644
--- a/tex/context/base/mkii/mult-en.mkii
+++ b/tex/context/base/mkii/mult-en.mkii
@@ -283,6 +283,7 @@
\setinterfacevariable{intermezzo}{intermezzo}
\setinterfacevariable{intext}{intext}
\setinterfacevariable{intro}{intro}
+\setinterfacevariable{invertedshort}{invertedshort}
\setinterfacevariable{italic}{italic}
\setinterfacevariable{italicbold}{italicbold}
\setinterfacevariable{item}{item}
@@ -386,6 +387,7 @@
\setinterfacevariable{nonumber}{nonumber}
\setinterfacevariable{norepeat}{norepeat}
\setinterfacevariable{normal}{normal}
+\setinterfacevariable{normalshort}{normalshort}
\setinterfacevariable{nospacing}{nospacing}
\setinterfacevariable{nostopper}{nostopper}
\setinterfacevariable{not}{not}
@@ -453,6 +455,7 @@
\setinterfacevariable{rectangular}{rectangular}
\setinterfacevariable{reference}{reference}
\setinterfacevariable{referral}{referral}
+\setinterfacevariable{region}{region}
\setinterfacevariable{register}{register}
\setinterfacevariable{regular}{regular}
\setinterfacevariable{relative}{relative}
@@ -1805,7 +1808,7 @@
\setinterfacecommand{resetpath}{resetpath}
\setinterfacecommand{resetperiodkerning}{resetperiodkerning}
\setinterfacecommand{resetsystemmode}{resetsystemmode}
-\setinterfacecommand{resettext}{resettextcontent}
+\setinterfacecommand{resettextcontent}{resettextcontent}
\setinterfacecommand{resetvisualizers}{resetvisualizers}
\setinterfacecommand{restoreglobalbodyfont}{restoreglobalbodyfont}
\setinterfacecommand{retestfeature}{retestfeature}
diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii
index 160731fd1..6eed238c6 100644
--- a/tex/context/base/mkii/mult-fr.mkii
+++ b/tex/context/base/mkii/mult-fr.mkii
@@ -283,6 +283,7 @@
\setinterfacevariable{intermezzo}{interlude}
\setinterfacevariable{intext}{danstexte}
\setinterfacevariable{intro}{intro}
+\setinterfacevariable{invertedshort}{invertedshort}
\setinterfacevariable{italic}{italique}
\setinterfacevariable{italicbold}{italiquegras}
\setinterfacevariable{item}{élément}
@@ -386,6 +387,7 @@
\setinterfacevariable{nonumber}{sansnumero}
\setinterfacevariable{norepeat}{sansrepetition}
\setinterfacevariable{normal}{normal}
+\setinterfacevariable{normalshort}{normalshort}
\setinterfacevariable{nospacing}{sansespacement}
\setinterfacevariable{nostopper}{sansstoppeur}
\setinterfacevariable{not}{pas}
@@ -453,6 +455,7 @@
\setinterfacevariable{rectangular}{rectangulaire}
\setinterfacevariable{reference}{reference}
\setinterfacevariable{referral}{redirection}
+\setinterfacevariable{region}{region}
\setinterfacevariable{register}{registre}
\setinterfacevariable{regular}{ordinaire}
\setinterfacevariable{relative}{relatif}
@@ -1805,7 +1808,7 @@
\setinterfacecommand{resetpath}{razchemin}
\setinterfacecommand{resetperiodkerning}{razapprochepoint}
\setinterfacecommand{resetsystemmode}{razmodesysteme}
-\setinterfacecommand{resettext}{raztexte}
+\setinterfacecommand{resettextcontent}{raztexte}
\setinterfacecommand{resetvisualizers}{razvisualisateurs}
\setinterfacecommand{restoreglobalbodyfont}{restaurerpolicedecorpsglobale}
\setinterfacecommand{retestfeature}{retesterfonctionnalite}
diff --git a/tex/context/base/mkiv/attr-ini.mkxl b/tex/context/base/mkiv/attr-ini.mkxl
index d36ad1d0e..14d77ec89 100644
--- a/tex/context/base/mkiv/attr-ini.mkxl
+++ b/tex/context/base/mkiv/attr-ini.mkxl
@@ -28,7 +28,7 @@
\permanent\protected\def\pushattribute#1%
{\global\advance\csname\??attributestack\string#1\endcsname\plusone
- \expandafter\xdef\csname\??attributestack\string#1:\number\csname\??attributestack\string#1\endcsname\endcsname{\number\attribute#1}}
+ \global\defcsname\??attributestack\string#1:\number\csname\??attributestack\string#1\endcsname\endcsname{\number\attribute#1}}
\permanent\protected\def\popattribute#1%
{\attribute#1\csname\??attributestack\string#1:\number\csname\??attributestack\string#1\endcsname\endcsname\relax
@@ -69,13 +69,13 @@
\doifinset\s!nomath{#3}%
{\xtoksapp\t_attr_list_nomath{\csname\??attributeprefix#2\endcsname\attributeunsetvalue}}%
\doifinset\s!public{#3}%
- {\aliased\expandafter\glet\csname#2\s!attribute\expandafter\endcsname\csname\??attributeid#2\endcsname}% \attribute\fooattribute
+ {\aliased\global\letcsname#2\s!attribute\expandafter\endcsname\csname\??attributeid#2\endcsname}% \attribute\fooattribute
\doifinset\s!pickup{#3}%
{\global\expandafter\integerdef\csname\??attributepickup#2\endcsname\attributeunsetvalue
\xtoksapp\t_attr_list_pickup{\csname\??attributeprefix#2\endcsname\csname\??attributepickup#2\endcsname}%
\ifcsname#2\s!attribute\endcsname
- \expandafter\xdef\csname\s!pickup#2\s!attribute\endcsname{\expandafter\integerdef\csname\??attributepickup#2\endcsname\csname\??attributeprefix#2\endcsname}%
- \expandafter\xdef\csname\s!forget#2\s!attribute\endcsname{\expandafter\integerdef\csname\??attributepickup#2\endcsname\attributeunsetvalue}%
+ \global\edefcsname\s!pickup#2\s!attribute\endcsname{\expandafter\integerdef\csname\??attributepickup#2\endcsname\csname\??attributeprefix#2\endcsname}%
+ \global\edefcsname\s!forget#2\s!attribute\endcsname{\expandafter\integerdef\csname\??attributepickup#2\endcsname\attributeunsetvalue}%
\fi}%
\fi}
diff --git a/tex/context/base/mkiv/buff-ver.mkxl b/tex/context/base/mkiv/buff-ver.mkxl
index 9f8a20695..db8b62b64 100644
--- a/tex/context/base/mkiv/buff-ver.mkxl
+++ b/tex/context/base/mkiv/buff-ver.mkxl
@@ -581,45 +581,20 @@
\setuevalue{\e!type\currenttyping\v!file}{\typefile[\currenttyping]}%
\to \everydefinetyping
-%% \protected\def\typefile
-%% {\dodoubleempty\buff_verbatim_type_file}
-%%
-%% \def\buff_verbatim_type_file[#1][#2]#3%
-%% {\begingroup
-%% \ifsecondargument
-%% \setuptyping[#1][#2]%
-%% \buff_verbatim_type_file_checked{#1}{#3}%
-%% \orelse\iffirstargument
-%% \ifcondition\validassignment{#1}%
-%% \setuptyping[\v!file][#1]%
-%% \buff_verbatim_type_file_checked\v!file{#3}%
-%% \else
-%% \buff_verbatim_type_file_checked{#1}{#3}%
-%% \fi
-%% \else
-%% \buff_verbatim_type_file_checked\v!file{#3}%
-%% \fi
-%% \useindentnextparameter\typingparameter % needs checking
-%% \endgroup
-%% \dorechecknextindentation} % needs checking
-
-\permanent\tolerant\protected\def\typefile[#1]#*[#2]%
- {\buff_verbatim_type_file{#1}{#2}}
-
-\def\buff_verbatim_type_file#1#2#3%
+\permanent\tolerant\protected\def\typefile[#1]#*[#2]#:#3%
{\begingroup
- \ifarguments
- \buff_verbatim_type_file_checked\v!file{#3}%
- \or
- \ifcondition\validassignment{#1}%
+ \ifparameter#2\or
+ \setuptyping[#1][#2]%
+ \buff_verbatim_type_file_checked{#1}{#3}%
+ \orelse\ifparameter#1\or
+ \ifhastok={#1}%
\setuptyping[\v!file][#1]%
\buff_verbatim_type_file_checked\v!file{#3}%
\else
\buff_verbatim_type_file_checked{#1}{#3}%
\fi
- \or
- \setuptyping[#1][#2]%
- \buff_verbatim_type_file_checked{#1}{#3}%
+ \else
+ \buff_verbatim_type_file_checked\v!file{#3}%
\fi
\useindentnextparameter\typingparameter % needs checking
\endgroup
diff --git a/tex/context/base/mkiv/catc-ini.mkxl b/tex/context/base/mkiv/catc-ini.mkxl
index fb1b5b359..c32ba5fc1 100644
--- a/tex/context/base/mkiv/catc-ini.mkxl
+++ b/tex/context/base/mkiv/catc-ini.mkxl
@@ -90,7 +90,7 @@
\permanent\protected\def\newcatcodetable#1% we could move the cctdefcounter to lua
{\global\advance\c_syst_catcodes_n\plusone
- \expandafter\xdef\csname\??catcodetablen\number\c_syst_catcodes_n\endcsname{\string#1}% logging
+ \global\defcsname\??catcodetablen\number\c_syst_catcodes_n\endcsname{\string#1}% logging
%\setnewconstant#1\c_syst_catcodes_n
\overloaded\integerdef#1\c_syst_catcodes_n
\ctxcommand{registercatcodetable("\expandafter\gobbleoneargument\string#1",\number#1)}}
@@ -178,22 +178,22 @@
\fi}
\def\syst_catcodes_let_c % only first time
- {\frozen\enforced\global\expandafter\def\csname\??catcodelet\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\expandafter\endcsname\expandafter
- {\enforced\expandafter\let\csname\??catcodeget\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname}%
+ {\frozen\enforced\global\defcsname\??catcodelet\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\expandafter\endcsname\expandafter
+ {\enforced\letcsname\??catcodeget\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname}%
\syst_catcodes_reinstate_unexpanded
\csname\??catcodelet\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname}
\def\syst_catcodes_def_c % only first time (we could use \normalexpanded here)
- {\frozen\enforced\global\expandafter\def\csname\??catcodedef\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\expandafter\endcsname
+ {\frozen\enforced\global\defcsname\??catcodedef\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\expandafter\endcsname
\expandafter##\expandafter1\expandafter
- {\frozen\enforced\expandafter\def\csname\??catcodeget\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname{##1}}%
+ {\frozen\enforced\defcsname\??catcodeget\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname{##1}}%
\syst_catcodes_reinstate_normal
\csname\??catcodedef\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname}
\def\syst_catcodes_ued_c % only first time
- {\frozen\enforced\global\expandafter\def\csname\??catcodeued\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\expandafter\endcsname
+ {\frozen\enforced\global\defcsname\??catcodeued\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\expandafter\endcsname
\expandafter##\expandafter1\expandafter
- {\frozen\enforced\protected\expandafter\def\csname\??catcodeget\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname{##1}}%
+ {\frozen\enforced\protected\defcsname\??catcodeget\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname{##1}}%
\syst_catcodes_reinstate_unexpanded
\csname\??catcodeued\number\c_syst_catcodes_a:\number\c_syst_catcodes_b\endcsname}
diff --git a/tex/context/base/mkiv/colo-ini.mkxl b/tex/context/base/mkiv/colo-ini.mkxl
index e8ea71b8d..21d5d5aba 100644
--- a/tex/context/base/mkiv/colo-ini.mkxl
+++ b/tex/context/base/mkiv/colo-ini.mkxl
@@ -244,8 +244,7 @@
\permanent\protected\def\getcolorattributevalue#1#2% obsolete, use \thecolorattribute instead ...
{\begingroup
\colo_helpers_activate{#1}%
- \normalexpanded{\endgroup\edef\noexpand#2%
- {\ifnum\c_attr_color=\attributeunsetvalue\else\number\c_attr_color\fi}}}
+ \normalexpanded{\endgroup\edef\noexpand#2{\ifnum\c_attr_color=\attributeunsetvalue\else\number\c_attr_color\fi}}}
\let\grey\graycolor % these macros are only used in tracing
@@ -282,7 +281,7 @@
\permanent\protected\def\stopcolorset {\clf_stopcolorset}
\permanent\protected\def\usecolors [#1]{\clf_usecolors{#1}}
-\let\setupcolor\usecolors
+\aliased\let\setupcolor\usecolors
\installsetuponlycommandhandler \??color {colors}
@@ -341,7 +340,7 @@
\permanent\protected\def\pushcolor[#1]%
{\global\advance\c_colo_nesting\plusone
- \expandafter\edef\csname\??colorstack\number\c_colo_nesting\endcsname
+ \edefcsname\??colorstack\number\c_colo_nesting\endcsname
{\c_attr_colormodel \the\c_attr_colormodel
\c_attr_color \the\c_attr_color
\c_attr_transparency\the\c_attr_transparency
@@ -431,7 +430,7 @@
\let\c_colo_palet\relax
\def\colo_palet_allocate#1%
- {\expandafter\let\csname\??paletlist#1\endcsname\empty
+ {\letcsname\??paletlist#1\endcsname\empty
\ifcsname\??paletsize#1\endcsname\else
\expandafter\newcount\csname\??paletsize#1\endcsname
\fi}
@@ -448,7 +447,7 @@
\def\colo_palet_extend#1%
{\addtocommalist{#1}\m_colo_palet
- \expandafter\let\csname\??paletlist\colo_palet_name\endcsname\m_colo_palet
+ \letcsname\??paletlist\colo_palet_name\endcsname\m_colo_palet
%\advance\csname\??paletsize\colo_palet_name\endcsname\plusone
\advance\c_colo_palet\plusone}
@@ -472,19 +471,6 @@
\let\paletsize\!!zerocount
\fi}
-%% \protected\def\definepalet
-%% {\dotripleempty\colo_palets_define}
-%%
-%% \def\colo_palets_define
-%% {\ifthirdargument
-%% \expandafter\colo_palets_define_b
-%% \else
-%% \expandafter\colo_palets_define_a
-%% \fi}
-%%
-%% \protected\def\colo_palets_define_a[#1][#2][#3]%
-%% \protected\def\colo_palets_define_b[#1][#2][#3]%
-
\permanent\tolerant\protected\def\definepalet[#1]#*[#2]#*[#3]%
{\ifarguments
\expandafter\gobblethreearguments
@@ -865,7 +851,7 @@
\clf_defineprocesscolorlocal{#1}{#2}\v_colo_freeze_state\relax
\colo_basics_synchronize{#1}%
\ifcase\c_colo_protection
- \protected\setvalue{#1}{\colo_helpers_activate{#1}}%
+ \protected\instance\setvalue{#1}{\colo_helpers_activate{#1}}%
\fi
\fi}
@@ -876,7 +862,7 @@
\clf_defineprocesscolorglobal{#1}{#2}\v_colo_freeze_state\relax
\colo_basics_synchronize{#1}%
\ifcase\c_colo_protection
- \protected\setgvalue{#1}{\colo_helpers_activate{#1}}%
+ \protected\instance\setgvalue{#1}{\colo_helpers_activate{#1}}%
\fi
\fi}
@@ -900,7 +886,7 @@
{\clf_defineprocesscolorlocal{#1}{#2}\v_colo_freeze_state\relax
\colo_basics_synchronize{#1}%
\ifcase\c_colo_protection
- \protected\setvalue{#1}{\colo_helpers_activate{#1}}%
+ \protected\instance\setvalue{#1}{\colo_helpers_activate{#1}}%
\fi}
%D Spotcolors used setxvalue but that messes up currentcolor and probably no global
@@ -911,14 +897,14 @@
{\clf_definespotcolorglobal{#1}{#2}{#3}%
\colo_basics_synchronize{#1}%
\ifcase\c_colo_protection
- \protected\setgvalue{#1}{\colo_helpers_activate{#1}}%
+ \protected\instance\setgvalue{#1}{\colo_helpers_activate{#1}}%
\fi}
\permanent\tolerant\protected\def\definemultitonecolor[#1]#*[#2]#*[#3]#*[#4]%
{\clf_definemultitonecolorglobal{#1}{#2}{#3}{#4}%
\colo_basics_synchronize{#1}%
\ifcase\c_colo_protection
- \protected\setgvalue{#1}{\colo_helpers_activate{#1}}%
+ \protected\instance\setgvalue{#1}{\colo_helpers_activate{#1}}%
\fi}
%D Transparencies (only):
@@ -987,7 +973,7 @@
\v_colo_freeze_state
\relax
\colo_basics_synchronize{#1}%
- \protected\setvalue{#1}{\colo_helpers_activate{#1}}}
+ \protected\instance\setvalue{#1}{\colo_helpers_activate{#1}}}
%D Here is a more efficient helper for pgf:
%D
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index f70c3d2b3..dd018e49b 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{2020.11.04 09:28}
+\newcontextversion{2020.11.05 15: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
@@ -35,8 +35,8 @@
\ifdefined\w \else \unexpanded\def\w{\mathortext\word\mathword} \fi
\appendtoks
- \overloaded\let\t\mathtext
- \overloaded\let\w\mathword
+ \enforced\overloaded\let\t\mathtext
+ \enforced\overloaded\let\w\mathword
\to \everymathematics
\pushoverloadmode
diff --git a/tex/context/base/mkiv/cont-run.lua b/tex/context/base/mkiv/cont-run.lua
index eb0e143d5..8f990cca5 100644
--- a/tex/context/base/mkiv/cont-run.lua
+++ b/tex/context/base/mkiv/cont-run.lua
@@ -222,10 +222,12 @@ local function processjob()
elseif overloadmode == "error" then
overloadmode = 4 -- 6
else
- overloadmode = tonumber(overloadmode) or 0
+ overloadmode = tonumber(overloadmode)
end
- tex.set("overloadmode",overloadmode)
+ if overloadmode then
+ tex.set("overloadmode",overloadmode)
+ end
end
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index d40603575..a6e6f217e 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{2020.11.04 09:28}
+\edef\contextversion{2020.11.05 15:20}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index aeb546250..88959faa9 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.11.04 09:28}
+\edef\contextversion{2020.11.05 15:20}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -263,7 +263,7 @@
\loadmarkfile{strc-ren}
\loadmarkfile{strc-xml}
\loadmarkfile{strc-def} % might happen later
-\loadmkvifile{strc-ref}
+\loadmklxfile{strc-ref}
%loadmarkfile{strc-reg}
\loadmkvifile{strc-lev} % experiment
@@ -278,7 +278,7 @@
\loadmkvifile{spac-prf}
\loadmkxlfile{spac-grd}
-\loadmkvifile{scrn-ini}
+\loadmklxfile{scrn-ini}
\loadmkvifile{scrn-ref}
\loadmarkfile{pack-obj}
@@ -312,7 +312,7 @@
\loadmklxfile{page-txt}
\loadmarkfile{page-sid} % when
-\loadmkvifile{strc-flt}
+\loadmklxfile{strc-flt}
\loadmarkfile{page-pst}
\loadmkvifile{page-mbk}
@@ -353,7 +353,7 @@
\loadmkvifile{page-sel} % optional
\loadmkvifile{page-inj} % optional
-\loadmkvifile{scrn-pag}
+\loadmklxfile{scrn-pag}
\loadmkvifile{scrn-wid}
\loadmkvifile{scrn-but}
\loadmkvifile{scrn-bar}
@@ -487,7 +487,7 @@
\loadmarkfile{math-scr}
\loadmarkfile{math-int}
\loadmarkfile{math-del}
-\loadmarkfile{math-fen}
+\loadmkxlfile{math-fen}
\loadmkvifile{math-acc}
\loadmkvifile{math-rad}
\loadmarkfile{math-inl}
@@ -524,7 +524,7 @@
\loadmkxlfile{grph-pat}
\loadmkxlfile{pack-box}
-\loadmarkfile{pack-bar}
+\loadmkxlfile{pack-bar}
\loadmarkfile{page-app}
\loadmarkfile{meta-fig}
diff --git a/tex/context/base/mkiv/core-env.lmt b/tex/context/base/mkiv/core-env.lmt
index 194600c0a..388e96787 100644
--- a/tex/context/base/mkiv/core-env.lmt
+++ b/tex/context/base/mkiv/core-env.lmt
@@ -46,14 +46,33 @@ local cache = tokens.cache
-- we can have a modes cache too
+local commandcodes = tokens.commands
local iftrue = cache["iftrue"].index
-local dimencode = cache["scratchdimen"] .command -- tokens.commands.register_dimen
-local countcode = cache["scratchcounter"].command -- tokens.commands.register_int
-local tokencode = cache["scratchtoks"] .command -- tokens.commands.register_toks
-local skipcode = cache["scratchskip"] .command -- tokens.commands.register_glue
-local muskipcode = cache["scratchmuskip"] .command -- tokens.commands.register_mu_glue
-local conditioncode = cache["iftrue"] .command -- tokens.commands.if_test
+-- local dimencode = cache["scratchdimen"] .command -- tokens.commands.register_dimen
+-- local countcode = cache["scratchcounter"].command -- tokens.commands.register_int
+-- local tokencode = cache["scratchtoks"] .command -- tokens.commands.register_toks
+-- local skipcode = cache["scratchskip"] .command -- tokens.commands.register_glue
+-- local muskipcode = cache["scratchmuskip"] .command -- tokens.commands.register_mu_glue
+-- local conditioncode = cache["iftrue"] .command -- tokens.commands.if_test
+
+-- local types = {
+-- [dimencode] = "dimen",
+-- [countcode] = "count",
+-- [tokencode] = "token",
+-- [skipcode] = "skip",
+-- [muskipcode] = "muskip",
+-- -- [attributecode] = "attribute",
+-- [conditioncode] = "condition"
+-- }
+
+local dimencode = commandcodes.register_dimen -- cache["scratchdimen"] .command -- tokens.commands.register_dimen
+local countcode = commandcodes.register_int -- cache["scratchcounter"].command -- tokens.commands.register_int
+local tokencode = commandcodes.register_toks -- ["scratchtoks"] .command -- tokens.commands.register_toks
+local skipcode = commandcodes.register_glue -- cache["scratchskip"] .command -- tokens.commands.register_glue
+local muskipcode = commandcodes.register_mu_glue -- cache["scratchmuskip"] .command -- tokens.commands.register_mu_glue
+local conditioncode = commandcodes.if_test -- cache["iftrue"] .command -- tokens.commands.if_test
+local integercode = commandcodes.integer
local types = {
[dimencode] = "dimen",
@@ -62,7 +81,8 @@ local types = {
[skipcode] = "skip",
[muskipcode] = "muskip",
-- [attributecode] = "attribute",
- [conditioncode] = "condition"
+ [conditioncode] = "condition",
+ [integercode] = "integer",
}
setmetatableindex(texmodes, function(t,k)
@@ -96,20 +116,20 @@ setmetatablenewindex(texconditionals, function(t,k) report_mode("you cannot set
setmetatablenewindex(texifs, function(t,k) end)
-- if we really need performance we can have a dedicated cache for each
--- kind of variable
+-- kind of variable ... maybe we no longer have to cache anyway (in lmtx)
setmetatableindex(texconstants, function(t,k)
- return cache[k].command == countcode and texgetcount(k) or 0
+ -- return cache[k].command == countcode and texgetcount(k) or 0
+ return cache[k].command == integercode and texgetintegervalue(k) or 0
end)
setmetatableindex(texconditionals, function(t,k) -- 0 == true
- return cache[k].command == countcode and texgetcount(k) == 0
+ -- return cache[k].command == countcode and texgetcount(k) == 0
+ return cache[k].command == integercode and texgetintegervalue(k) == 0
end)
setmetatableindex(texifs, function(t,k)
local c = cache[k]
- print(k)
- inspect(c)
return c.command == conditioncode and c.index == iftrue
end)
diff --git a/tex/context/base/mkiv/core-env.mkxl b/tex/context/base/mkiv/core-env.mkxl
index 8b22275e1..c862935e6 100644
--- a/tex/context/base/mkiv/core-env.mkxl
+++ b/tex/context/base/mkiv/core-env.mkxl
@@ -506,63 +506,17 @@
% Is doglobal still relevant? Maybe always global? Or never? Anyway, it will become obsolete.
-% \protected\def\startluasetups {\begingroup\doifelsenextoptionalcs\syst_setups_start_lua_a\syst_setups_start_lua_b} \let\stopluasetups \relax
-% \protected\def\startxmlsetups {\begingroup\doifelsenextoptionalcs\syst_setups_start_xml_a\syst_setups_start_xml_b} \let\stopxmlsetups \relax
-% \protected\def\startrawsetups {\begingroup\doifelsenextoptionalcs\syst_setups_start_raw_a\syst_setups_start_raw_b} \let\stoprawsetups \relax
-% \protected\def\startlocalsetups{\begingroup\doifelsenextoptionalcs\syst_setups_start_loc_a\syst_setups_start_loc_b} \let\stoplocalsetups\relax
-% \protected\def\startsetups {\begingroup\doifelsenextoptionalcs\syst_setups_start_tex_a\syst_setups_start_tex_b} \let\stopsetups \relax
-%
-% \def\syst_setups_start_lua_indeed#1#2#3\stopluasetups {\endgroup\dodoglobal\expandafter\def\csname\??setup#1:#2\expandafter\endcsname\expandafter##\expandafter1\expandafter{#3}}
-% \def\syst_setups_start_xml_indeed#1#2#3\stopxmlsetups {\endgroup\dodoglobal\expandafter\def\csname\??setup#1:#2\expandafter\endcsname\expandafter##\expandafter1\expandafter{#3}}
-% \def\syst_setups_start_raw_indeed#1#2#3\stoprawsetups {\endgroup\dodoglobal\expandafter\def\csname\??setup#1:#2\expandafter\endcsname\expandafter##\expandafter1\expandafter{#3}}
-% \def\syst_setups_start_loc_indeed#1#2#3\stoplocalsetups{\endgroup\dodoglobal\expandafter\def\csname\??setup#1:#2\expandafter\endcsname\expandafter##\expandafter1\expandafter{#3}}
-% \def\syst_setups_start_tex_indeed#1#2#3\stopsetups {\endgroup\dodoglobal\expandafter\def\csname\??setup#1:#2\expandafter\endcsname\expandafter##\expandafter1\expandafter{#3}}
-%
-% \def\syst_setups_start_lua{\ifsecondargument\expandafter\syst_setups_start_lua_c\else\expandafter\syst_setups_start_lua_d\fi}
-% \def\syst_setups_start_xml{\ifsecondargument\expandafter\syst_setups_start_xml_c\else\expandafter\syst_setups_start_xml_d\fi}
-% \def\syst_setups_start_raw{\ifsecondargument\expandafter\syst_setups_start_raw_c\else\expandafter\syst_setups_start_raw_d\fi}
-% \def\syst_setups_start_loc{\ifsecondargument\expandafter\syst_setups_start_loc_c\else\expandafter\syst_setups_start_loc_d\fi}
-% \def\syst_setups_start_tex{\ifsecondargument\expandafter\syst_setups_start_tex_c\else\expandafter\syst_setups_start_tex_d\fi}
-%
-% % no need for \the\t_syst_setups_lua in the next, now too often
-%
-% \def\syst_setups_start_lua_a{\the\t_syst_setups_lua\dodoubleempty\syst_setups_start_lua} % [ ] delimited
-% \def\syst_setups_start_xml_a{\the\t_syst_setups_xml\dodoubleempty\syst_setups_start_xml} % [ ] delimited
-% \def\syst_setups_start_raw_a{\the\t_syst_setups_raw\dodoubleempty\syst_setups_start_raw} % [ ] delimited
-% \def\syst_setups_start_loc_a{\the\t_syst_setups_loc\dodoubleempty\syst_setups_start_loc} % [ ] delimited
-% \def\syst_setups_start_tex_a{\the\t_syst_setups_tex\dodoubleempty\syst_setups_start_tex} % [ ] delimited
-%
-% % empty preserves inner {} (is removed by the \expandafter{#3})
-%
-% \def\syst_setups_start_lua_b#1 {\the\t_syst_setups_lua\syst_setups_start_lua_indeed\empty{#1}\empty} % space delimited
-% \def\syst_setups_start_xml_b#1 {\the\t_syst_setups_xml\syst_setups_start_xml_indeed\empty{#1}\empty} % space delimited
-% \def\syst_setups_start_raw_b#1 {\the\t_syst_setups_raw\syst_setups_start_raw_indeed\empty{#1}\empty} % space delimited
-% \def\syst_setups_start_loc_b#1 {\the\t_syst_setups_loc\syst_setups_start_loc_indeed\empty{#1}\empty} % space delimited
-% \def\syst_setups_start_tex_b#1 {\the\t_syst_setups_tex\syst_setups_start_tex_indeed\empty{#1}\empty} % space delimited
-%
-% \def\syst_setups_start_lua_c[#1][#2]{\the\t_syst_setups_lua\syst_setups_start_lua_indeed{#1}{#2}\empty} % [..] [..]
-% \def\syst_setups_start_xml_c[#1][#2]{\the\t_syst_setups_xml\syst_setups_start_xml_indeed{#1}{#2}\empty} % [..] [..]
-% \def\syst_setups_start_raw_c[#1][#2]{\the\t_syst_setups_raw\syst_setups_start_raw_indeed{#1}{#2}\empty} % [..] [..]
-% \def\syst_setups_start_loc_c[#1][#2]{\the\t_syst_setups_loc\syst_setups_start_loc_indeed{#1}{#2}\empty} % [..] [..]
-% \def\syst_setups_start_tex_c[#1][#2]{\the\t_syst_setups_tex\syst_setups_start_tex_indeed{#1}{#2}\empty} % [..] [..]
-%
-% \def\syst_setups_start_lua_d[#1][#2]{\the\t_syst_setups_lua\syst_setups_start_lua_indeed\empty{#1}\empty} % [..]
-% \def\syst_setups_start_xml_d[#1][#2]{\the\t_syst_setups_xml\syst_setups_start_xml_indeed\empty{#1}\empty} % [..]
-% \def\syst_setups_start_raw_d[#1][#2]{\the\t_syst_setups_raw\syst_setups_start_raw_indeed\empty{#1}\empty} % [..]
-% \def\syst_setups_start_loc_d[#1][#2]{\the\t_syst_setups_loc\syst_setups_start_loc_indeed\empty{#1}\empty} % [..]
-% \def\syst_setups_start_tex_d[#1][#2]{\the\t_syst_setups_tex\syst_setups_start_tex_indeed\empty{#1}\empty} % [..]
-
\permanent\protected\def\startluasetups {\begingroup\doifelsenextoptionalcs\syst_setups_start_lua_yes\syst_setups_start_lua_nop} \aliased\let\stopluasetups \relax
\permanent\protected\def\startxmlsetups {\begingroup\doifelsenextoptionalcs\syst_setups_start_xml_yes\syst_setups_start_xml_nop} \aliased\let\stopxmlsetups \relax
\permanent\protected\def\startrawsetups {\begingroup\doifelsenextoptionalcs\syst_setups_start_raw_yes\syst_setups_start_raw_nop} \aliased\let\stoprawsetups \relax
\permanent\protected\def\startlocalsetups{\begingroup\doifelsenextoptionalcs\syst_setups_start_loc_yes\syst_setups_start_loc_nop} \aliased\let\stoplocalsetups\relax
\permanent\protected\def\startsetups {\begingroup\doifelsenextoptionalcs\syst_setups_start_tex_yes\syst_setups_start_tex_nop} \aliased\let\stopsetups \relax
-\def\syst_setups_start_lua_two#1#2#+\stopluasetups {\endgroup\dodoglobal\expandafter\def\csname\??setup#1:#2\endcsname##1{#3}}
-\def\syst_setups_start_xml_two#1#2#+\stopxmlsetups {\endgroup\dodoglobal\expandafter\def\csname\??setup#1:#2\endcsname##1{#3}}
-\def\syst_setups_start_raw_two#1#2#+\stoprawsetups {\endgroup\dodoglobal\expandafter\def\csname\??setup#1:#2\endcsname##1{#3}}
-\def\syst_setups_start_loc_two#1#2#+\stoplocalsetups{\endgroup\dodoglobal\expandafter\def\csname\??setup#1:#2\endcsname##1{#3}}
-\def\syst_setups_start_tex_two#1#2#+\stopsetups {\endgroup\dodoglobal\expandafter\def\csname\??setup#1:#2\endcsname##1{#3}}
+\def\syst_setups_start_lua_two#1#2#+\stopluasetups {\endgroup\dodoglobal\defcsname\??setup#1:#2\endcsname##1{#3}}
+\def\syst_setups_start_xml_two#1#2#+\stopxmlsetups {\endgroup\dodoglobal\defcsname\??setup#1:#2\endcsname##1{#3}}
+\def\syst_setups_start_raw_two#1#2#+\stoprawsetups {\endgroup\dodoglobal\defcsname\??setup#1:#2\endcsname##1{#3}}
+\def\syst_setups_start_loc_two#1#2#+\stoplocalsetups{\endgroup\dodoglobal\defcsname\??setup#1:#2\endcsname##1{#3}}
+\def\syst_setups_start_tex_two#1#2#+\stopsetups {\endgroup\dodoglobal\defcsname\??setup#1:#2\endcsname##1{#3}}
\tolerant\def\syst_setups_start_lua_yes[#1]#*[#2]%
{\the\t_syst_setups_lua
@@ -631,7 +585,7 @@
\def\syst_setups_copy[#1][#2]%
{\ifcsname\??setup:#2\endcsname
- \expandafter\let\csname\??setup:#1\expandafter\endcsname\lastnamedcs
+ \letcsname\??setup:#1\expandafter\endcsname\lastnamedcs
\fi}
\protected\def\showsetupsdefinition[#1]%
@@ -669,10 +623,10 @@
\getvariable{#2}\s!set
\popmacro\currentvariableclass}}
-\permanent\protected\def\setvariable #1#2#3{\expandafter\def \csname\??variables#1:#2\endcsname{#3}}
-\permanent\protected\def\setevariable#1#2#3{\expandafter\edef\csname\??variables#1:#2\endcsname{#3}}
-\permanent\protected\def\setgvariable#1#2#3{\expandafter\gdef\csname\??variables#1:#2\endcsname{#3}}
-\permanent\protected\def\setxvariable#1#2#3{\expandafter\xdef\csname\??variables#1:#2\endcsname{#3}}
+\permanent\protected\def\setvariable #1#2#3{\defcsname \??variables#1:#2\endcsname{#3}}
+\permanent\protected\def\setevariable#1#2#3{\edefcsname \??variables#1:#2\endcsname{#3}}
+\permanent\protected\def\setgvariable#1#2#3{\global\defcsname \??variables#1:#2\endcsname{#3}}
+\permanent\protected\def\setxvariable#1#2#3{\global\edefcsname\??variables#1:#2\endcsname{#3}}
\permanent \def\getvariable #1#2{\begincsname\??variables#1:#2\endcsname}
\permanent\protected\def\showvariable#1#2{\showvalue{\begincsname\??variables#1:#2\endcsname}}
@@ -693,10 +647,10 @@
{\ifcsname\??variables#1:#2\endcsname
\edef\m_syst_variables_temp{\lastnamedcs}%
\ifempty\m_syst_variables_temp
- \expandafter\def\csname\??variables#1:#2\endcsname{#3}%
+ \defcsname\??variables#1:#2\endcsname{#3}%
\fi
\else
- \expandafter\def\csname\??variables#1:#2\endcsname{#3}%
+ \defcsname\??variables#1:#2\endcsname{#3}%
\fi}
%D \macros
diff --git a/tex/context/base/mkiv/driv-shp.lmt b/tex/context/base/mkiv/driv-shp.lmt
index 0d3bddda4..8e3a936bb 100644
--- a/tex/context/base/mkiv/driv-shp.lmt
+++ b/tex/context/base/mkiv/driv-shp.lmt
@@ -958,6 +958,8 @@ local hlist_out, vlist_out do
local total = height + depth
if getid(leader) == rule_code then
depth = 0 -- hm
+-- forgotten ... needs testing
+total = glueheight
if total > 0 then
if width == running then
width = boxwidth
diff --git a/tex/context/base/mkiv/enco-ini.mkxl b/tex/context/base/mkiv/enco-ini.mkxl
index dfd6075c9..104b2f890 100644
--- a/tex/context/base/mkiv/enco-ini.mkxl
+++ b/tex/context/base/mkiv/enco-ini.mkxl
@@ -334,7 +334,7 @@
\protected\def\enco_fast_control_space_define
{\scratchdimen\interwordspace
\definedfont[LMTypewriter-Regular at \the\dimexpr\currentfontbodyscale\dimexpr\fontbody]% see font-sym.mkiv
- \expandafter\glet\csname\??controlspace\number\scratchdimen\endcsname\lastrawfontcall}
+ \global\letcsname\??controlspace\number\scratchdimen\endcsname\lastrawfontcall}
\permanent\protected\def\normalcontrolspace
{\iffontchar\font\textcontrolspace
diff --git a/tex/context/base/mkiv/font-chk.lua b/tex/context/base/mkiv/font-chk.lua
index ab145ce4d..d2a0943f6 100644
--- a/tex/context/base/mkiv/font-chk.lua
+++ b/tex/context/base/mkiv/font-chk.lua
@@ -9,6 +9,8 @@ if not modules then modules = { } end modules ['font-chk'] = {
-- possible optimization: delayed initialization of vectors
-- move to the nodes namespace
+-- This is old code and I'll make a nicer one for lmtx some day.
+
local next = next
local floor = math.floor
@@ -248,11 +250,14 @@ local function addmissingsymbols(tfmdata) -- we can have an alternative with rul
end
end
end
- if #collected > 0 then
- addcharacters(properties.id, {
- type = "real",
- characters = collected,
- })
+ if next(collected) then
+ local id = properties.id
+ if id then
+ addcharacters(properties.id, {
+ type = "real",
+ characters = collected,
+ })
+ end
end
end
diff --git a/tex/context/base/mkiv/font-emp.mklx b/tex/context/base/mkiv/font-emp.mklx
index 5656c168c..da993a82c 100644
--- a/tex/context/base/mkiv/font-emp.mklx
+++ b/tex/context/base/mkiv/font-emp.mklx
@@ -134,11 +134,11 @@
\def\font_emphasis_set_emphasis_boldface
{\let\font_emphasis_saved_emphasis_boldface\bf
\let\font_emphasis_set_emphasis_boldface\relax
- \let\bf\font_emphasis_bold_bold}
+ \enforced\let\bf\font_emphasis_bold_bold}
\protected\def\font_emphasis_bold_bold
{%\relax
- \let\bf\relax % new
+ \enforced\let\bf\relax % new
\ifx\fontalternative\s!it
\bi
\orelse\ifx\fontalternative\s!sl
@@ -146,7 +146,7 @@
\else
\font_emphasis_saved_emphasis_boldface
\fi
- \let\bf\font_emphasis_saved_emphasis_boldface}
+ \enforced\let\bf\font_emphasis_saved_emphasis_boldface}
%D Donald's (adapted) macros take the next character into account when placing
%D italic correction. As a bonus we also look for something that looks like a dash,
diff --git a/tex/context/base/mkiv/font-fea.mklx b/tex/context/base/mkiv/font-fea.mklx
index c92bc21eb..46034f82a 100644
--- a/tex/context/base/mkiv/font-fea.mklx
+++ b/tex/context/base/mkiv/font-fea.mklx
@@ -148,7 +148,7 @@
\permanent\tolerant\protected\def\subtractfeature [#1]#;#2{\edef\m_font_feature_asked{#1#2}\font_feature_subtract}
\permanent\tolerant\protected\def\replacefeature [#1]#;#2{\edef\m_font_feature_asked{#1#2}\font_feature_replace}
\permanent\tolerant\protected\def\resetandaddfeature[#1]#;#2{\edef\m_font_feature_asked{#1#2}\font_feature_reset_add}
-\permanent\tolerant\protected\def\feature [#1]#;#2{\begincsname\??featureshortcut##1#2\endcsname{#1#2}}
+\permanent\tolerant\protected\def\feature [#1]#;#2{\begincsname\??featureshortcut#1#2\endcsname}
% for old times sake
diff --git a/tex/context/base/mkiv/font-fil.mklx b/tex/context/base/mkiv/font-fil.mklx
index 7f08a9348..7f618179c 100644
--- a/tex/context/base/mkiv/font-fil.mklx
+++ b/tex/context/base/mkiv/font-fil.mklx
@@ -81,11 +81,11 @@
\fi}
\protected\def\font_basics_define_font_synonym_nop
- {\expandafter\let\csname\??fontfile\m_font_name\endcsname\m_font_file
+ {\letcsname\??fontfile\m_font_name\endcsname\m_font_file
\doifelsenextoptionalcs\font_basics_define_font_synonym_nop_opt\font_basics_define_font_synonym_nop_nil}
\protected\def\font_basics_define_font_synonym_yes
- {\expandafter\let\csname\??fontfile\fontclass\m_font_name\endcsname\m_font_file
+ {\letcsname\??fontfile\fontclass\m_font_name\endcsname\m_font_file
\doifelsenextoptionalcs\font_basics_define_font_synonym_yes_opt\font_basics_define_font_synonym_yes_nil}
\protected\def\edefinefontsynonym[#name]#spacer[#file]%
@@ -98,11 +98,11 @@
\fi}
\protected\def\font_basics_define_font_synonym_nop_expanded#ignore[#spec]%
- {\expandafter\let\csname\??fontfile\m_font_name\endcsname\m_font_file
+ {\letcsname\??fontfile\m_font_name\endcsname\m_font_file
\normalexpanded{\font_basics_define_font_synonym_nop_opt[#spec]}}
\protected\def\font_basics_define_font_synonym_yes_expanded#ignore[#spec]%
- {\expandafter\let\csname\??fontfile\fontclass\m_font_name\endcsname\m_font_file
+ {\letcsname\??fontfile\fontclass\m_font_name\endcsname\m_font_file
\normalexpanded{\font_basics_define_font_synonym_yes_opt[#spec]}}
\protected\def\font_basics_define_font_synonym_nop_opt[#specification]%
@@ -126,7 +126,7 @@
{\ifarguments
\font_basics_get_font_parameter_nop_finish
\else
- \expandafter\normaldef\csname p_#key\endcsname{#value}% % no edef as we need to keep \mathsizesuffix
+ \defcsname p_#key\endcsname{#value}% % no edef as we need to keep \mathsizesuffix
\expandafter\font_basics_get_font_parameter_nop
\fi}
@@ -134,7 +134,7 @@
{\ifarguments
\font_basics_get_font_parameter_yes_finish
\else
- \expandafter\normaldef\csname p_#key\endcsname{#value}% % no edef as we need to keep \mathsizesuffix
+ \defcsname p_#key\endcsname{#value}% % no edef as we need to keep \mathsizesuffix
\expandafter\font_basics_get_font_parameter_yes
\fi}
@@ -152,35 +152,35 @@
% we could collect them in one macro (but no expansion)
\def\font_basics_define_font_synonym_nop_nil
- {\expandafter\let\csname\??fontfile\m_font_name\s!features \endcsname\undefined
- \expandafter\let\csname\??fontfile\m_font_name\s!fallbacks \endcsname\undefined
- \expandafter\let\csname\??fontfile\m_font_name\s!goodies \endcsname\undefined
- \expandafter\let\csname\??fontfile\m_font_name\s!designsize\endcsname\undefined}
+ {\letcsname\??fontfile\m_font_name\s!features \endcsname\undefined
+ \letcsname\??fontfile\m_font_name\s!fallbacks \endcsname\undefined
+ \letcsname\??fontfile\m_font_name\s!goodies \endcsname\undefined
+ \letcsname\??fontfile\m_font_name\s!designsize\endcsname\undefined}
\def\font_basics_define_font_synonym_yes_nil
- {\expandafter\glet\csname\??fontfile\fontclass\m_font_name\s!features \endcsname\undefined
- \expandafter\glet\csname\??fontfile\fontclass\m_font_name\s!fallbacks \endcsname\undefined
- \expandafter\glet\csname\??fontfile\fontclass\m_font_name\s!goodies \endcsname\undefined
- \expandafter\glet\csname\??fontfile\fontclass\m_font_name\s!designsize\endcsname\undefined}
+ {\global\letcsname\??fontfile\fontclass\m_font_name\s!features \endcsname\undefined
+ \global\letcsname\??fontfile\fontclass\m_font_name\s!fallbacks \endcsname\undefined
+ \global\letcsname\??fontfile\fontclass\m_font_name\s!goodies \endcsname\undefined
+ \global\letcsname\??fontfile\fontclass\m_font_name\s!designsize\endcsname\undefined}
\def\font_basics_get_font_parameter_nop_finish
- {\expandafter\let\csname\??fontfile\m_font_name\s!features \endcsname\p_features
- \expandafter\let\csname\??fontfile\m_font_name\s!fallbacks \endcsname\p_fallbacks
- \expandafter\let\csname\??fontfile\m_font_name\s!goodies \endcsname\p_goodies
- \expandafter\let\csname\??fontfile\m_font_name\s!designsize\endcsname\p_designsize}
+ {\letcsname\??fontfile\m_font_name\s!features \endcsname\p_features
+ \letcsname\??fontfile\m_font_name\s!fallbacks \endcsname\p_fallbacks
+ \letcsname\??fontfile\m_font_name\s!goodies \endcsname\p_goodies
+ \letcsname\??fontfile\m_font_name\s!designsize\endcsname\p_designsize}
\def\font_basics_get_font_parameter_yes_finish
- {\expandafter\glet\csname\??fontfile\fontclass\m_font_name\s!features \endcsname\p_features
- \expandafter\glet\csname\??fontfile\fontclass\m_font_name\s!fallbacks \endcsname\p_fallbacks
- \expandafter\glet\csname\??fontfile\fontclass\m_font_name\s!goodies \endcsname\p_goodies
- \expandafter\glet\csname\??fontfile\fontclass\m_font_name\s!designsize\endcsname\p_designsize}
+ {\global\letcsname\??fontfile\fontclass\m_font_name\s!features \endcsname\p_features
+ \global\letcsname\??fontfile\fontclass\m_font_name\s!fallbacks \endcsname\p_fallbacks
+ \global\letcsname\??fontfile\fontclass\m_font_name\s!goodies \endcsname\p_goodies
+ \global\letcsname\??fontfile\fontclass\m_font_name\s!designsize\endcsname\p_designsize}
%\definefontsynonym [KopFont] [\fontclassname{officina}{SerifBold}]
%\defineclassfontsynonym [KopFont] [officina] [SerifBold]
%\definefontsynonym[#tag][\fontclassname{#class}{#fileortag}]}
\permanent\tolerant\protected\def\defineclassfontsynonym[#tag]#spacer[#class]#spacer[#fileortag]% needs testing
- {\expandafter\normaldef\csname\??fontfile\fontclass#tag\endcsname{\fontclassname{#class}{#fileortag}}%
+ {\defcsname\??fontfile\fontclass#tag\endcsname{\fontclassname{#class}{#fileortag}}%
\font_basics_define_font_synonym_yes_nil}
\aliased\let\definefontfile\definefontsynonym % dedicated to Taco Hoekwater
@@ -371,12 +371,12 @@
% we can pack them (don't use \setxvalue!)
\permanent\protected\def\savefontclassparameters#style#rscale#features#fallbacks#goodies#designsize#direction%
- {\letgvalue{\??fontclass\fontclass#style\s!rscale }#rscale%
- \letgvalue{\??fontclass\fontclass#style\s!features }#features%
- \letgvalue{\??fontclass\fontclass#style\s!fallbacks }#fallbacks%
- \letgvalue{\??fontclass\fontclass#style\s!goodies }#goodies%
- \letgvalue{\??fontclass\fontclass#style\s!designsize}#designsize%
- \letgvalue{\??fontclass\fontclass#style\s!direction }#direction}% math
+ {\global\letcsname\??fontclass\fontclass#style\s!rscale \endcsname#rscale%
+ \global\letcsname\??fontclass\fontclass#style\s!features \endcsname#features%
+ \global\letcsname\??fontclass\fontclass#style\s!fallbacks \endcsname#fallbacks%
+ \global\letcsname\??fontclass\fontclass#style\s!goodies \endcsname#goodies%
+ \global\letcsname\??fontclass\fontclass#style\s!designsize\endcsname#designsize%
+ \global\letcsname\??fontclass\fontclass#style\s!direction \endcsname#direction}% math
% bonus
diff --git a/tex/context/base/mkiv/font-ini.mklx b/tex/context/base/mkiv/font-ini.mklx
index af1414b14..cdd89c5d0 100644
--- a/tex/context/base/mkiv/font-ini.mklx
+++ b/tex/context/base/mkiv/font-ini.mklx
@@ -19,11 +19,6 @@
% todo: split font-nam (style/alternative/size)
% todo: split font-dim (scales etc)
% todo: reconsider defaultfontclass
-%
-
-%D Watch out: as we define inside macros in sometimes special ways,
-%D an occasional \type {\normaldef} is used in order to please the
-%D \MKVI\ parser.
%D Beware, we use a special set of parameters here:
%D
@@ -423,7 +418,7 @@
\def\normalizebodyfontsize_indeed#macro#body%
{\edef#macro{\clf_nbfs\dimexpr#body\relax}%
- \expandafter\glet\csname\??fontnormalizedbody\number\dimexpr#body\endcsname#macro}
+ \global\letcsname\??fontnormalizedbody\number\dimexpr#body\endcsname#macro}
\def\thenormalizedbodyfontsize#body%
{\clf_nbfs\dimexpr#body\relax}
@@ -519,7 +514,7 @@
\fi}
\def\font_helpers_register_fontbody#body%
- {\expandafter\let\csname\??fontbodyknown#body\endcsname\empty}
+ {\letcsname\??fontbodyknown#body\endcsname\empty}
%D \macros
%D {definefontstyle,definefontsize,definefontalternative}
@@ -552,9 +547,9 @@
\def\font_helpers_process_size_list #command{\def\m_font_size_command {#command}\the\t_font_size_commands}
\def\font_helpers_process_alternative_list#command{\def\m_font_alternative_command{#command}\the\t_font_alternative_commands}
-\def\font_helpers_register_style #style{\expandafter\let\csname\??fontstyleknown #style\endcsname\empty}
-\def\font_helpers_register_size #size{\expandafter\let\csname\??fontsizeknown #size\endcsname\empty}
-\def\font_helpers_register_alternative#alternative{\expandafter\let\csname\??fontalternativeknown#alternative\endcsname\empty}
+\def\font_helpers_register_style #style{\letcsname\??fontstyleknown #style\endcsname\empty}
+\def\font_helpers_register_size #size{\letcsname\??fontsizeknown #size\endcsname\empty}
+\def\font_helpers_register_alternative#alternative{\letcsname\??fontalternativeknown#alternative\endcsname\empty}
\permanent\protected\def\definefontstyle[#commands]#spacer[#style]% style: rm ss tt ...
{\ifcsname\??fontstyleknown#style\endcsname \else % can be delayed till used (cg, hw)
@@ -776,7 +771,7 @@
%\scaledfontsize\plusone
\let\somefontspec\empty
\let\lastrawfontcall\relax
- \expandafter\let\csname#csname\endcsname\relax
+ \letcsname#csname\endcsname\relax
\else
\edef\somefontspec{at \number\scaledfontsize sp}% we need the resolved designsize (for fallbacks)
\expandafter\let\expandafter\lastrawfontcall\csname#csname\endcsname
@@ -808,14 +803,6 @@
\settrue\c_font_body_scale
\fi}
-%D The following macros are used at the \LUA\ end. Watch the \type {\normal}
-%D hackery: this makes the mkvi parser happy.
-
-% \normaldef\fntsetdefname {\glet\somefontname\defaultfontfile} % do before calling
-% \normaldef\fntsetnopsize {\let\somefontsize\empty} % do before calling
-% \normaldef\fntsetsomename{\normalgdef\somefontname} % takes argument
-% \normaldef\fntsetsomesize{\normaldef\somefontsize} % takes argument
-
\newif\ifskipfontcharacteristics \skipfontcharacteristicstrue
\tracingfonts\plussix % <id: name @ size>
@@ -930,7 +917,7 @@
\csname#name\endcsname
\glet\lastglobalrawfontcall\lastrawfontcall
\endgroup
- \expandafter\let\csname#name\endcsname\lastglobalrawfontcall
+ \letcsname#name\endcsname\lastglobalrawfontcall
\fi}
%D The instance namespace protection makes the switch local so that we can redefine a
@@ -1186,7 +1173,7 @@
\installcorenamespace{fontenvironmentknown}
\def\font_helpers_register_environment#class#body%
- {\expandafter\let\csname\??fontenvironmentknown#class#body\endcsname\empty}
+ {\letcsname\??fontenvironmentknown#class#body\endcsname\empty}
\newmacro\m_font_body
\newmacro\m_font_body_normalized
@@ -1465,27 +1452,27 @@
\protected\def\font_basics_define_body_font_nop_xx[#one#two#rest=#value]% local
{\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi
- \expandafter\let\csname\??fontinstanceclass\m_font_asked_body-\m_font_asked_style-#one#two-#rest-0\endcsname\undefined
- \protected\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body-\m_font_asked_style-#one#two-#rest-0\endcsname
+ \letcsname\??fontinstanceclass\m_font_asked_body-\m_font_asked_style-#one#two-#rest-0\endcsname\undefined
+ \protected\edefcsname\??fontinstanceready\m_font_asked_body-\m_font_asked_style-#one#two-#rest-0\endcsname
{\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest}{\noexpand\font_rscale_xx{\m_font_asked_style}}{\m_font_asked_body}{\normalunexpanded{#value}}}%
- \expandafter\let\csname\??fontinstanceclass\m_font_asked_body-\m_font_asked_style-#one#two-#rest-4\endcsname\undefined
- \protected\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body-\m_font_asked_style-#one#two-#rest-4\endcsname
+ \letcsname\??fontinstanceclass\m_font_asked_body-\m_font_asked_style-#one#two-#rest-4\endcsname\undefined
+ \protected\edefcsname\??fontinstanceready\m_font_asked_body-\m_font_asked_style-#one#two-#rest-4\endcsname
{\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest}{\noexpand\font_rscale_xx{\m_font_asked_style}}{\m_font_asked_body}{\normalunexpanded{#value}}}%
- \expandafter\let\csname\??fontinstanceclass\m_font_asked_body-\m_font_asked_style-#one#two-#rest-5\endcsname\undefined
- \protected\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body-\m_font_asked_style-#one#two-#rest-5\endcsname
+ \letcsname\??fontinstanceclass\m_font_asked_body-\m_font_asked_style-#one#two-#rest-5\endcsname\undefined
+ \protected\edefcsname\??fontinstanceready\m_font_asked_body-\m_font_asked_style-#one#two-#rest-5\endcsname
{\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest}{\noexpand\font_rscale_xx{\m_font_asked_style}}{\m_font_asked_body}{\normalunexpanded{#value}}}%
}
\protected\def\font_basics_define_body_font_yes_xx[#one#two#rest=#value]% global
{\ifcsname\m_font_asked_style#one#two#rest\endcsname\else\font_basics_check_fontname_combination\m_font_asked_style{#one#two}{#rest}\fi
- \expandafter\glet\csname\??fontinstanceclass\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-1\endcsname\undefined
- \protected\expandafter\normalxdef\csname\??fontinstanceready\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-0\endcsname
+ \global\letcsname\??fontinstanceclass\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-1\endcsname\undefined
+ \global\protected\edefcsname\??fontinstanceready\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-0\endcsname
{\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest-0}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}%
- \expandafter\glet\csname\??fontinstanceclass\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-2\endcsname\undefined
- \protected\expandafter\normalxdef\csname\??fontinstanceready\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-4\endcsname
+ \global\letcsname\??fontinstanceclass\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-2\endcsname\undefined
+ \global\protected\edefcsname\??fontinstanceready\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-4\endcsname
{\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest-4}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}%
- \expandafter\glet\csname\??fontinstanceclass\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-3\endcsname\undefined
- \protected\expandafter\normalxdef\csname\??fontinstanceready\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-5\endcsname
+ \global\letcsname\??fontinstanceclass\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-3\endcsname\undefined
+ \global\protected\edefcsname\??fontinstanceready\fontclass-\m_font_asked_body-\m_font_asked_style-#one#two-#rest-5\endcsname
{\font_helpers_trigger{\m_font_asked_body-\m_font_asked_style-#one#two#rest-5}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}%
}
@@ -1496,10 +1483,10 @@
\protected\def\font_basics_define_body_font_nop_mm[#one#two#rest=#value]% local
{%\ifcsname\s!mm\endcsname\else\font_basics_check_fontname_combination\s!mm{#one#two}{#rest}\fi
- \expandafter\let\csname\??fontinstanceclass\m_font_asked_body-\s!mm-#one#two#rest-1\endcsname\undefined
- % \expandafter\let\csname\??fontinstanceclass\m_font_asked_body-\s!mm-#one#two#rest-2\endcsname\undefined
- % \expandafter\let\csname\??fontinstanceclass\m_font_asked_body-\s!mm-#one#two#rest-3\endcsname\undefined
- \protected\expandafter\normaledef\csname\??fontinstanceready\m_font_asked_body-\s!mm-#one#two#rest\endcsname
+ \letcsname\??fontinstanceclass\m_font_asked_body-\s!mm-#one#two#rest-1\endcsname\undefined
+ % \letcsname\??fontinstanceclass\m_font_asked_body-\s!mm-#one#two#rest-2\endcsname\undefined
+ % \letcsname\??fontinstanceclass\m_font_asked_body-\s!mm-#one#two#rest-3\endcsname\undefined
+ \global\protected\edefcsname\??fontinstanceready\m_font_asked_body-\s!mm-#one#two#rest\endcsname
{\font_helpers_trigger{\m_font_asked_body-\s!mm-#one#two#rest}{\noexpand\font_rscale_mm}{\m_font_asked_body}{\normalunexpanded{#value}}}%
}
@@ -1507,10 +1494,10 @@
\protected\def\font_basics_define_body_font_yes_mm[#one#two#rest=#value]% global
{%\ifcsname\s!mm\endcsname\else\font_basics_check_fontname_combination\s!mm{#one#two}{#rest}\fi
- \expandafter\glet\csname\??fontinstanceclass\fontclass-\m_font_asked_body-\s!mm-#one#two#rest-1\endcsname\undefined
- % \expandafter\glet\csname\??fontinstanceclass\fontclass-\m_font_asked_body-\s!mm-#one#two#rest-2\endcsname\undefined
- % \expandafter\glet\csname\??fontinstanceclass\fontclass-\m_font_asked_body-\s!mm-#one#two#rest-3\endcsname\undefined
- \protected\expandafter\normalxdef\csname\??fontinstanceready\fontclass-\m_font_asked_body-\s!mm-#one#two#rest\endcsname
+ \global\letcsname\??fontinstanceclass\fontclass-\m_font_asked_body-\s!mm-#one#two#rest-1\endcsname\undefined
+ % \global\letcsname\??fontinstanceclass\fontclass-\m_font_asked_body-\s!mm-#one#two#rest-2\endcsname\undefined
+ % \global\letcsname\??fontinstanceclass\fontclass-\m_font_asked_body-\s!mm-#one#two#rest-3\endcsname\undefined
+ \global\protected\edefcsname\??fontinstanceready\fontclass-\m_font_asked_body-\s!mm-#one#two#rest\endcsname
{\font_helpers_trigger{\m_font_asked_body-\s!mm-#one#two#rest}{\number\p_font_rscale}{\m_font_asked_body}{\normalunexpanded{#value}}}%
}
@@ -1534,7 +1521,7 @@
\protected\def\font_basics_define_body_font_name_assignment_a#name#assignments#style%
{%\writestatus\m!fonts{[#name:#style] => [#assignments]}%
- \setevalue{\??fontdefinitions#name:#style}{\font_basics_define_body_font_default{#assignments}}}
+ \edefcsname\??fontdefinitions#name:#style\endcsname{\font_basics_define_body_font_default{#assignments}}}
\protected\def\font_basics_define_body_font_name_identifier[#name][#stylelist][#identifier]%
{\processcommalist[#stylelist]{\font_basics_define_body_font_name_identifier_a{#name}{#identifier}}}
@@ -1542,9 +1529,9 @@
\protected\def\font_basics_define_body_font_name_identifier_a#name#identifier#style%
{%\writestatus\m!fonts{[#name:#style] => [##identifier:#style]}%
\ifcsname\??fontdefinitions#name:#style\endcsname
- \expandafter\let\csname\??fontdefinitions#name:#style\expandafter\endcsname\csname\??fontdefinitions#identifier:#style\endcsname
+ \letcsname\??fontdefinitions#name:#style\expandafter\endcsname\csname\??fontdefinitions#identifier:#style\endcsname
\else
- \expandafter\def\csname\??fontdefinitions#name:#style\endcsname{\csname\??fontdefinitions#identifier:#style\endcsname}%
+ \defcsname\??fontdefinitions#name:#style\endcsname{\csname\??fontdefinitions#identifier:#style\endcsname}%
\fi}
%D The unknown:
@@ -2126,7 +2113,7 @@
\noexpand\edef\noexpand\xtextface {\currentbodyfontdimension\s!x }%
\noexpand\edef\noexpand\xxtextface {\currentbodyfontdimension\s!xx }%
}%
- \expandafter\glet\csname\??fontbodyfaces\fontbody\endcsname\font_basics_set_faces}
+ \global\letcsname\??fontbodyfaces\fontbody\endcsname\font_basics_set_faces}
\def\currentbodyfontdimension#parameter% there can be factors here
{\the\dimexpr
@@ -2445,7 +2432,7 @@
\protected\def\font_basics_predefine#1#2%
{\font_basics_defined_font_yes[#2]%
- \expandafter\glet\csname#1\expandafter\endcsname\csname\v_font_identifier_basic\endcsname}
+ \global\letcsname#1\expandafter\endcsname\csname\v_font_identifier_basic\endcsname}
\protected\def\font_basics_predefined#1%
{\font_basics_predefine{\??predefinedfont#1}{#1}}
diff --git a/tex/context/base/mkiv/font-sym.mklx b/tex/context/base/mkiv/font-sym.mklx
index db80572e8..80b47edab 100644
--- a/tex/context/base/mkiv/font-sym.mklx
+++ b/tex/context/base/mkiv/font-sym.mklx
@@ -166,7 +166,7 @@
\def\font_basics_define_symbolic_font
{\definefont[currentsymbolfont][\askedsymbolfont]%
\currentsymbolfont
- \expandafter\glet\csname\??symbolfont\askedsymbolfont\endcsname\lastrawfontcall}
+ \global\letcsname\??symbolfont\askedsymbolfont\endcsname\lastrawfontcall}
\permanent\protected\def\getnamedglyphstyled#fontname#character{{\setstyledsymbolicfont{#fontname}\clf_fontchar{#character}}}
\permanent\protected\def\getnamedglyphdirect#fontname#character{{\setdirectsymbolicfont{#fontname}\clf_fontchar{#character}}}
diff --git a/tex/context/base/mkiv/lang-ini.mkxl b/tex/context/base/mkiv/lang-ini.mkxl
index 6d0649fa8..5ae1ea35d 100644
--- a/tex/context/base/mkiv/lang-ini.mkxl
+++ b/tex/context/base/mkiv/lang-ini.mkxl
@@ -356,7 +356,7 @@
\appendtoks
% we need to reassign the number because new patterns can be defined later on
% so let's hope not that many \setups happen during a run
- \expandafter\glet\csname\??languagenumbers\currentlanguage\endcsname\undefined
+ \global\letcsname\??languagenumbers\currentlanguage\endcsname\undefined
\to \everysetuplanguage
\def\lang_basics_synchronize_yes
diff --git a/tex/context/base/mkiv/lang-lab.mkxl b/tex/context/base/mkiv/lang-lab.mkxl
index d627e5a42..881ad3861 100644
--- a/tex/context/base/mkiv/lang-lab.mkxl
+++ b/tex/context/base/mkiv/lang-lab.mkxl
@@ -93,10 +93,7 @@
\lastnamedcs
\orelse\ifcsname\??label#1:##1:##2\endcsname
\lastnamedcs
- % \orelse\ifcsname\??language#4\s!default\endcsname
- % \expandafter#5\csname\??language#4\s!default\endcsname{##2}%
\orelse\ifcsname\??language##1\s!default\endcsname
- %\expandafter#5\csname\??language##1\s!default\endcsname{##2}%
\expandafter#5\lastnamedcs{##2}%
\orelse\ifcsname\??label\currentlabelcategory#1:##2\endcsname
\lastnamedcs
@@ -117,16 +114,12 @@
\protected\def#3{#5#4}%
\protected\def#5##1##2%
{\ifcsname\??label#1:##1:##2\endcsname
- %\expandafter\let\expandafter\thetextprefix\csname\??label#1:##1:##2\endcsname
\enforced\expandafter\let\expandafter\thetextprefix\lastnamedcs
\orelse\ifcsname\??language#4\s!default\endcsname
- %\expandafter#5\csname\??language#4\s!default\endcsname{##2}%
\expandafter#5\lastnamedcs{##2}%
\orelse\ifcsname\??label#1:##2\endcsname
- %\expandafter\let\expandafter\thetextprefix\csname\??label#1:##2\endcsname
\enforced\expandafter\let\expandafter\thetextprefix\lastnamedcs
\orelse\ifcsname\??label#1:\s!en:##2\endcsname
- %\expandafter\let\expandafter\thetextprefix\csname\??label#1:\s!en:##2\endcsname
\enforced\expandafter\let\expandafter\thetextprefix\lastnamedcs
\else
\enforced\let\thetextprefix\dummytextprefix
@@ -184,8 +177,7 @@
\grabuntil{stop#1text}\lang_labels_text_prefix_start_indeed}
\def\lang_labels_text_prefix_start_indeed#1% text (not special checking done here yet, only for long texts anyway)
- {\expandafter\edef\csname\??label\currenttextprefixclass:\currenttextprefixtag:\currenttextprefixname\endcsname%
- {{\clf_strip{#1}}\empty}}
+ {\edefcsname\??label\currenttextprefixclass:\currenttextprefixtag:\currenttextprefixname\endcsname{{\clf_strip{#1}}\empty}}
\tolerant\def\lang_labels_text_prefix_setup[#1]#*[#2]%
{\ifarguments\or
@@ -224,7 +216,7 @@
\def\lang_labels_text_prefix_assign_yes#1[#2,#3,#4]%
{\def\m_lang_labels_left {#2}% no longer an edef ... else \Word undefined expansion issues
\def\m_lang_labels_right{#3}% no longer an edef ... else \Word undefined expansion issues
- \expandafter\def\csname\??label\currenttextprefixclass:\currenttextprefixtag:#1%
+ \defcsname\??label\currenttextprefixclass:\currenttextprefixtag:#1%
\ifempty\m_lang_labels_right
\ifempty\m_lang_labels_left
\endcsname{\empty\empty}%
@@ -239,11 +231,11 @@
{}
\def\lang_labels_text_prefix_assign_dumb#1[#2,#3]%
- {\expandafter\def\csname\??label\currenttextprefixclass:\currenttextprefixtag:#1\endcsname{#2}}
+ {\defcsname\??label\currenttextprefixclass:\currenttextprefixtag:#1\endcsname{#2}}
\permanent\protected\def\setlabeltextpair#1#2#3#4#5% a fast one for usage at the Lua end
{%\writestatus{!!!!}{#1:\reallanguagetag{#2}:#3}%
- \expandafter\def\csname\??label#1:\reallanguagetag{#2}:#3\endcsname{{#4}{#5}}} % class tag key left right
+ \defcsname\??label#1:\reallanguagetag{#2}:#3\endcsname{{#4}{#5}}} % class tag key left right
\tolerant\def\lang_labels_text_prefix_copy[#1]#*[#2]%
{\ifarguments\or
@@ -268,7 +260,7 @@
% this delays the aliasing so that we can switch mainlanguage in between
\def\lang_labels_text_prefix_copy_pair_indeed#1[#2,#3]%
- {\expandafter\edef\csname\??label\currenttextprefixclass:#1\endcsname
+ {\edefcsname\??label\currenttextprefixclass:#1\endcsname
{{\noexpand\csname\??label\currenttextprefixclass:\noexpand\reallanguagetag\noexpand\currentmainlanguage:#2\endcsname}{}}}
\definelabelclass [head] [0] % titles
diff --git a/tex/context/base/mkiv/math-ali.mkiv b/tex/context/base/mkiv/math-ali.mkiv
index ea6045e79..0ce9ee6d0 100644
--- a/tex/context/base/mkiv/math-ali.mkiv
+++ b/tex/context/base/mkiv/math-ali.mkiv
@@ -378,7 +378,7 @@
{\advance\c_math_eqalign_column\plusone\math_eqalign_set_column}% takes argument
\global\c_math_eqalign_column\plusone
\dostarttagged\t!math\empty
- \dostarttagged\t!mathtable\currentmathalignment
+ \dostarttagged\t!mtable\currentmathalignment
\numberedeqalign}
\def\math_alignment_stop
@@ -456,13 +456,13 @@
\def\math_first_in_eqalign
{\global\c_math_eqalign_column\plusone
- \dostarttagged\t!mathtablerow \empty
- \dostarttagged\t!mathtablecell\empty}
+ \dostarttagged\t!mtablerow \empty
+ \dostarttagged\t!mtablecell\empty}
\def\math_next_in_eqalign
{\global\advance\c_math_eqalign_column\plusone
\dostoptagged % finish cell
- \dostarttagged\t!mathtablecell\empty}
+ \dostarttagged\t!mtablecell\empty}
\def\math_left_of_eqalign
{\ifcsname\??mathalignmentvariant\number\c_math_eqalign_column\endcsname
@@ -815,7 +815,7 @@
\def\math_matrix_start_table
{\global\c_math_eqalign_column\zerocount
\dostarttagged\t!math\empty
- \dostarttagged\t!mathtable\empty}
+ \dostarttagged\t!mtable\empty}
\def\math_matrix_stop_table
{\dostoptagged
@@ -823,13 +823,13 @@
\def\math_matrix_start_row
{\noalign{\global\c_math_eqalign_column\zerocount}%
- \dostarttagged\t!mathtablerow\empty}
+ \dostarttagged\t!mtablerow\empty}
\def\math_matrix_stop_row
{\dostoptagged}
\unexpanded\def\math_matrix_start_cell
- {\dostarttagged\t!mathtablecell\empty
+ {\dostarttagged\t!mtablecell\empty
\hss
\math_left_of_eqalign
\startimath
diff --git a/tex/context/base/mkiv/math-ali.mkxl b/tex/context/base/mkiv/math-ali.mkxl
index b4336f857..72a9767d2 100644
--- a/tex/context/base/mkiv/math-ali.mkxl
+++ b/tex/context/base/mkiv/math-ali.mkxl
@@ -370,7 +370,7 @@
{\advance\c_math_eqalign_column\plusone\math_eqalign_set_column}% takes argument
\global\c_math_eqalign_column\plusone
\dostarttagged\t!math\empty
- \dostarttagged\t!mathtable\currentmathalignment
+ \dostarttagged\t!mtable\currentmathalignment
\numberedeqalign}
\def\math_alignment_stop % can be protected
@@ -448,13 +448,13 @@
\def\math_first_in_eqalign
{\global\c_math_eqalign_column\plusone
- \dostarttagged\t!mathtablerow \empty
- \dostarttagged\t!mathtablecell\empty}
+ \dostarttagged\t!mtablerow \empty
+ \dostarttagged\t!mtablecell\empty}
\def\math_next_in_eqalign
{\global\advance\c_math_eqalign_column\plusone
\dostoptagged % finish cell
- \dostarttagged\t!mathtablecell\empty}
+ \dostarttagged\t!mtablecell\empty}
\def\math_left_of_eqalign
{\ifcsname\??mathalignmentvariant\number\c_math_eqalign_column\endcsname
@@ -488,10 +488,6 @@
\fi
\fi}
-% \def\math_eqalign_set_column#1% we could just add to the preamble (as with other alignments)
-% {\expandafter\let\csname\??mathalignmentvariant\number\c_math_eqalign_column\expandafter\endcsname
-% \csname\??mathalignmentvariant\ifcsname\??mathalignmentvariant#1\endcsname#1\else\v!normal\fi\endcsname}
-
\def\math_eqalign_set_column#1% we could just add to the preamble (as with other alignments)
{\expandafter\chardef\csname\??mathalignmentvariant\number\c_math_eqalign_column\expandafter\expandafter\expandafter\endcsname
\ifcsname\??mathalignmentvariant#1\endcsname\lastnamedcs\else\zerocount\fi\relax}
@@ -808,7 +804,7 @@
\def\math_matrix_start_table
{\global\c_math_eqalign_column\zerocount
\dostarttagged\t!math\empty
- \dostarttagged\t!mathtable\empty}
+ \dostarttagged\t!mtable\empty}
\def\math_matrix_stop_table
{\dostoptagged
@@ -816,13 +812,13 @@
\def\math_matrix_start_row
{\noalign{\global\c_math_eqalign_column\zerocount}%
- \dostarttagged\t!mathtablerow\empty}
+ \dostarttagged\t!mtablerow\empty}
\def\math_matrix_stop_row
{\dostoptagged}
\protected\def\math_matrix_start_cell
- {\dostarttagged\t!mathtablecell\empty
+ {\dostarttagged\t!mtablecell\empty
\hss
\math_left_of_eqalign
\startimath
diff --git a/tex/context/base/mkiv/math-fen.mkiv b/tex/context/base/mkiv/math-fen.mkiv
index d7c67b7e3..246ff989d 100644
--- a/tex/context/base/mkiv/math-fen.mkiv
+++ b/tex/context/base/mkiv/math-fen.mkiv
@@ -335,8 +335,6 @@
%D A bonus:
-\pushoverloadmode
-
\unexpanded\def\Lparenthesis {\math_fenced_fenced_start{parenthesis}} \unexpanded\def\Rparenthesis {\math_fenced_fenced_stop {parenthesis}}
\unexpanded\def\Lbracket {\math_fenced_fenced_start{bracket}} \unexpanded\def\Rbracket {\math_fenced_fenced_stop {bracket}}
\unexpanded\def\Lbrace {\math_fenced_fenced_start{brace}} \unexpanded\def\Rbrace {\math_fenced_fenced_stop {brace}}
@@ -396,20 +394,14 @@
% \left| \frac{1}{e} \right|
% \stopformula
-\popoverloadmode
-
\installcorenamespace{mathleft}
\installcorenamespace{mathright}
\installcorenamespace{mathmiddle}
-\pushoverloadmode
-
\unexpanded\def\left {\afterassignment\math_left \let\nexttoken}
\unexpanded\def\right {\afterassignment\math_right \let\nexttoken}
\unexpanded\def\middle{\afterassignment\math_middle\let\nexttoken}
-\popoverloadmode
-
\let\leftorright\relax
\newconditional\c_math_fenced_done
@@ -573,8 +565,6 @@
% The names in char-def.lua (historic mess):
-\pushoverloadmode
-
\let\lbrack \lbracket
\let\rbrack \rbracket
\let\lceiling \lceil
@@ -644,8 +634,6 @@
\installmathfencepair \< \Langle \> \Rangle
\installmathfencepair \| \Lbar \| \Rbar
-\popoverloadmode
-
%D As we have overloaded \type {\left} and \type {\right} we also need a more
%D clever version of the following:
diff --git a/tex/context/base/mkiv/math-fen.mkxl b/tex/context/base/mkiv/math-fen.mkxl
new file mode 100644
index 000000000..50495cd2b
--- /dev/null
+++ b/tex/context/base/mkiv/math-fen.mkxl
@@ -0,0 +1,829 @@
+%D \module
+%D [ file=math-fen,
+%D version=2012.02.18,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=Fences,
+%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.
+
+\writestatus{loading}{ConTeXt Math Macros / Fences}
+
+\unprotect
+
+% maybe always "method=auto" for:
+%
+% \switchtobodyfont[cambria]
+% \ruledhbox{$f(x)$}
+% \ruledhbox{\mathdelimitersmode6$f\left(x\right)$}
+% \ruledhbox{\mathdelimitersmode7$f\left(x\right)$}
+% \ruledhbox{$f\left(\frac{1}{x}\right)$}
+
+% todo: mathstyle
+
+% \definemathfence [fancybracket] [bracket] [command=yes,color=blue]
+%
+% test $|x|$ test \par
+% test $||x||$ test (okay) \par
+% test $a\left|\frac{1}{b}\right|c$ test \par
+% test $a\left||\frac{1}{b}\right||c$ test (not okay) \par
+%
+% \setupmathfences [color=red]
+%
+% test $a\fenced[bar]{\frac{1}{b}}c$ test \par
+% test $a\fenced[doublebar]{\frac{1}{b}}c$ test \par
+% test $a\fenced[bracket]{\frac{1}{b}}c$ test \par
+% test $a\fancybracket{\frac{1}{b}}c$ test \par
+
+\installcorenamespace{mathfences}
+
+\installcommandhandler \??mathfences {mathfence} \??mathfences
+
+\aliased\let\setupmathfences\setupmathfence
+
+\setupmathfences
+ [\c!method=, % maybe always \v!auto
+ \c!left=,
+ \c!right=,
+ \c!middle=,
+ \c!mathstyle=,
+ \c!color=,
+ \c!command=,
+ \c!mathclass=,
+ \c!factor=\v!auto]
+
+\appendtoks
+ \edef\p_command{\mathfenceparameter\c!command}%
+ \ifx\p_command\v!yes
+ \setuevalue\currentmathfence{\math_fenced_fenced[\currentmathfence]}%
+ \fi
+\to \everydefinemathfence
+
+% we need the direct use of \Udelimiter because of { etc
+
+%D So we can do:
+%D
+%D \starttyping
+%D $ a + \fenced[bar][size=1] {\frac {b} {c}} + d $
+%D $ a + \fenced[bar][size=2] {\frac {b} {c}} + d $
+%D $ a + \fenced[bar][size=3] {\frac {b} {c}} + d $
+%D $ a + \fenced[bar][size=4] {\frac {b} {c}} + d $
+%D $ a + \fenced[bar][size=big] {\frac {b} {c}} + d $
+%D $ a + \fenced[bar][size=Big] {\frac {b} {c}} + d $
+%D $ a + \fenced[bar][size=bigg]{\frac {b} {c}} + d $
+%D $ a + \fenced[bar][size=Bigg]{\frac {b} {c}} + d $
+%D $ a + \fenced[bar][factor=1] {\frac {b} {c}} + d $
+%D $ a + \fenced[bar][factor=2] {\frac {b} {c}} + d $
+%D $ a + \fenced[bar][factor=4] {\frac {b} {c}} + d $
+%D $ a + \fenced[bar] {\frac {b} {c}} + d $
+%D \stoptyping
+
+\newconditional\c_math_fenced_mirror \settrue \c_math_fenced_mirror
+\newconditional\c_math_fenced_sized \setfalse\c_math_fenced_sized
+
+\installcorenamespace {mathfencesize}
+
+\setvalue{\??mathfencesize big}{1}
+\setvalue{\??mathfencesize Big}{2}
+\setvalue{\??mathfencesize bigg}{3}
+\setvalue{\??mathfencesize Bigg}{4}
+
+\def\math_fenced_force_size#1#2%
+ {\c_attr_mathsize\numexpr
+ #1*\plushundred
+ +\ifcsname\??mathfencesize#2\endcsname\lastnamedcs\else#2\fi
+ \relax}
+
+\protected\def\math_fenced_inject#1#2#3#4%
+ {\ifx#1\empty
+ #2.%
+ \else
+ \edef\p_mathclass{\mathfenceparameter\c!mathclass}%
+ \ifconditional\c_math_fenced_sized
+ \let\p_factor\v!fixed
+ \else
+ \edef\p_factor{\mathfenceparameter\c!factor}%
+ \fi
+ \ifempty\p_factor
+ \ifempty\p_mathclass
+ #2%
+ \else
+ #3%
+ \s!class\p_mathclass
+ \fi
+ \orelse\ifx\p_factor\v!auto
+ \ifempty\p_mathclass
+ #2%
+ \else
+ #3%
+ \s!class\p_mathclass
+ \fi
+ \orelse\ifx\p_factor\v!none
+ #3%
+ \s!height\zeropoint
+ \s!depth\zeropoint
+ \ifempty\p_mathclass\else
+ \s!class\p_mathclass
+ \fi
+ \s!axis
+ % #2%
+ \else
+ \scratchdimen\ifx\p_factor\v!fixed\scaledpoint\else\dimexpr\p_factor\bodyfontsize/2\relax\fi
+ #3%
+ \s!height\scratchdimen
+ \s!depth\scratchdimen
+ \ifempty\p_mathclass\else
+ \s!class\p_mathclass
+ \fi
+ \s!axis
+ \fi
+ \Udelimiter#4\fam#1\relax
+ \fi}
+
+\permanent\def\math_fenced_left
+ {\edef\p_left
+ {\ifconditional\c_math_fenced_mirror
+ \ifconditional\c_math_right_to_left
+ \mathfenceparameter\c!right
+ \else
+ \mathfenceparameter\c!left
+ \fi
+ \else
+ \mathfenceparameter\c!left
+ \fi}%
+ \math_fenced_color_push
+ \math_fenced_inject\p_left\normalleft\Uleft\plusfour
+ \math_fenced_color_pop}
+
+\permanent\def\math_fenced_middle
+ {\edef\p_middle{\mathfenceparameter\c!middle}%
+ \mskip\thinmuskip
+ \math_fenced_color_push
+ \math_fenced_inject\p_middle\normalmiddle\Umiddle\plusfour
+ \math_fenced_color_pop
+ \mskip\thinmuskip}
+
+\permanent\def\math_fenced_right
+ {\edef\p_right
+ {\ifconditional\c_math_fenced_mirror
+ \ifconditional\c_math_right_to_left
+ \mathfenceparameter\c!left
+ \else
+ \mathfenceparameter\c!right
+ \fi
+ \else
+ \mathfenceparameter\c!right
+ \fi}%
+ \math_fenced_color_push
+ \math_fenced_inject\p_right\normalright\Uright\plusfive
+ \math_fenced_color_pop}
+
+\def\math_fenced_color_do_push{\pushcolor[\p_math_fenced_color]}
+\let\math_fenced_color_do_pop \popcolor
+
+\let\math_fenced_color_push\donothing
+\let\math_fenced_color_pop \donothing
+
+\aliased\let\fence \relax
+\aliased\let\fenced\relax
+
+\newcount\c_math_fenced_nesting
+
+\protected\def\math_fenced_fenced_common
+ {\startusemathstyleparameter\mathfenceparameter
+ \enforced\let\fence\math_fenced_middle
+ \edef\p_math_fenced_color{\mathfenceparameter\c!color}%
+ \ifempty\p_math_fenced_color
+ \let\math_fenced_color_push\donothing
+ \let\math_fenced_color_pop \donothing
+ \else
+ \let\math_fenced_color_push\math_fenced_color_do_push
+ \let\math_fenced_color_pop \math_fenced_color_do_pop
+ \fi}
+
+\protected\def\math_fenced_fenced_start#1%
+ {\advance\c_math_fenced_nesting\plusone
+ \begingroup
+ \edef\currentmathfence{#1}%
+ \math_fenced_fenced_common
+ \math_fenced_left}
+
+\protected\def\math_fenced_fenced_stop#1%
+ {\edef\currentmathfence{#1}%
+ \math_fenced_right
+ \stopusemathstyleparameter
+ \endgroup
+ \advance\c_math_fenced_nesting\minusone}
+
+\tolerant\protected\def\math_fenced_fenced[#1]#*[#2]%
+ {\advance\c_math_fenced_nesting\plusone
+ \begingroup
+ \edef\currentmathfence{#1}%
+ \ifparameter#2\or\setupcurrentmathfence[#1]\fi
+ \math_fenced_fenced_common
+ \edef\p_size{\mathfenceparameter\c!size}%
+ \ifempty\p_size
+ \expandafter\math_fenced_fenced_indeed_adapt
+ \else
+ \expandafter\math_fenced_fenced_indeed_fixed
+ \fi}
+
+\protected\def\math_fenced_fenced_indeed_finish
+ {\stopusemathstyleparameter
+ \endgroup
+ \advance\c_math_fenced_nesting\minusone}
+
+\protected\def\math_fenced_fenced_indeed_fixed#1%
+ {\math_fenced_force_size\bigmathdelimitervariant\p_size
+ \settrue\c_math_fenced_sized
+ \math_fenced_left
+ \setfalse\c_math_fenced_sized
+ #1%
+ \settrue\c_math_fenced_sized
+ \math_fenced_right
+ \setfalse\c_math_fenced_sized
+ \math_fenced_fenced_indeed_finish}
+
+\protected\def\math_fenced_fenced_indeed_adapt#1%
+ {\setfalse\c_math_fenced_sized
+ \math_fenced_left
+ #1%
+ \setfalse\c_math_fenced_sized
+ \math_fenced_right
+ \math_fenced_fenced_indeed_finish}
+
+\appendtoks
+ \enforced\let\fenced\math_fenced_fenced
+\to \everymathematics
+
+% todo: | in mathmode letter
+%
+% \appendtoks
+% \let\bar\letterbar
+% \to \everymathematics
+%
+% but then we don't have it in embedded text too so ...
+
+\definemathfence [parenthesis] [\c!left="0028,\c!right="0029]
+\definemathfence [bracket] [\c!left="005B,\c!right="005D]
+\definemathfence [brace] [\c!left="007B,\c!right="007D]
+\definemathfence [bar] [\c!left="007C,\c!right="007C]
+\definemathfence [doublebar] [\c!left="2016,\c!right="2016]
+\definemathfence [triplebar] [\c!left="2980,\c!right="2980]
+\definemathfence [angle] [\c!left="27E8,\c!right="27E9]
+\definemathfence [doubleangle] [\c!left="27EA,\c!right="27EB]
+\definemathfence [solidus] [\c!left="2044,\c!right="2044]
+\definemathfence [ceiling] [\c!left="2308,\c!right="2309]
+\definemathfence [floor] [\c!left="230A,\c!right="230B]
+\definemathfence [moustache] [\c!left="23B0,\c!right="23B1]
+\definemathfence [uppercorner] [\c!left="231C,\c!right="231D]
+\definemathfence [lowercorner] [\c!left="231E,\c!right="231F]
+\definemathfence [group] [\c!left="27EE,\c!right="27EF]
+\definemathfence [openbracket] [\c!left="27E6,\c!right="27E7]
+
+\definemathfence [nothing]
+
+\definemathfence [mirrored] % \v!mirrored
+
+\definemathfence [mirroredparenthesis] [mirrored] [\c!right="0028,\c!left="0029]
+\definemathfence [mirroredbracket] [mirrored] [\c!right="005B,\c!left="005D]
+\definemathfence [mirroredbrace] [mirrored] [\c!right="007B,\c!left="007D]
+\definemathfence [mirroredbar] [mirrored] [\c!right="007C,\c!left="007C]
+\definemathfence [mirroreddoublebar] [mirrored] [\c!right="2016,\c!left="2016]
+\definemathfence [mirroredtriplebar] [mirrored] [\c!right="2980,\c!left="2980]
+\definemathfence [mirroredangle] [mirrored] [\c!right="27E8,\c!left="27E9]
+\definemathfence [mirroreddoubleangle] [mirrored] [\c!right="27EA,\c!left="27EB]
+\definemathfence [mirroredsolidus] [mirrored] [\c!right="2044,\c!left="2044]
+\definemathfence [mirroredceiling] [mirrored] [\c!right="2308,\c!left="2309]
+\definemathfence [mirroredfloor] [mirrored] [\c!right="230A,\c!left="230B]
+\definemathfence [mirroredmoustache] [mirrored] [\c!right="23B0,\c!left="23B1]
+\definemathfence [mirroreduppercorner] [mirrored] [\c!right="231C,\c!left="231D]
+\definemathfence [mirroredlowercorner] [mirrored] [\c!right="231E,\c!left="231F]
+\definemathfence [mirroredgroup] [mirrored] [\c!right="27EE,\c!left="27EF]
+\definemathfence [mirroredopenbracket] [mirrored] [\c!right="27E6,\c!left="27E7]
+
+\definemathfence [mirrorednothing] [mirrored]
+
+%D A bonus:
+
+\pushoverloadmode
+
+\immutable\protected\def\Lparenthesis {\math_fenced_fenced_start{parenthesis}} \protected\def\Rparenthesis {\math_fenced_fenced_stop {parenthesis}}
+\immutable\protected\def\Lbracket {\math_fenced_fenced_start{bracket}} \protected\def\Rbracket {\math_fenced_fenced_stop {bracket}}
+\immutable\protected\def\Lbrace {\math_fenced_fenced_start{brace}} \protected\def\Rbrace {\math_fenced_fenced_stop {brace}}
+\immutable\protected\def\Langle {\math_fenced_fenced_start{angle}} \protected\def\Rangle {\math_fenced_fenced_stop {angle}}
+\immutable\protected\def\Ldoubleangle {\math_fenced_fenced_start{doubleangle}} \protected\def\Rdoubleangle {\math_fenced_fenced_stop {doubleangle}}
+\immutable\protected\def\Lbar {\math_fenced_fenced_start{bar}} \protected\def\Rbar {\math_fenced_fenced_stop {bar}}
+\immutable\protected\def\Ldoublebar {\math_fenced_fenced_start{doublebar}} \protected\def\Rdoublebar {\math_fenced_fenced_stop {doublebar}}
+\immutable\protected\def\Ltriplebar {\math_fenced_fenced_start{triplebar}} \protected\def\Rtriplebar {\math_fenced_fenced_stop {triplebar}}
+\immutable\protected\def\Lsolidus {\math_fenced_fenced_start{solidus}} \protected\def\Rsolidus {\math_fenced_fenced_stop {solidus}}
+\immutable\protected\def\Lfloor {\math_fenced_fenced_start{floor}} \protected\def\Rfloor {\math_fenced_fenced_stop {floor}}
+\immutable\protected\def\Lceiling {\math_fenced_fenced_start{ceiling}} \protected\def\Rceiling {\math_fenced_fenced_stop {ceiling}}
+\immutable\protected\def\Lmoustache {\math_fenced_fenced_start{moustache}} \protected\def\Rmoustache {\math_fenced_fenced_stop {moustache}}
+\immutable\protected\def\Luppercorner {\math_fenced_fenced_start{uppercorner}} \protected\def\Ruppercorner {\math_fenced_fenced_stop {uppercorner}}
+\immutable\protected\def\Llowercorner {\math_fenced_fenced_start{lowercorner}} \protected\def\Rlowercorner {\math_fenced_fenced_stop {lowercorner}}
+\immutable\protected\def\Lgroup {\math_fenced_fenced_start{group}} \protected\def\Rgroup {\math_fenced_fenced_stop {group}}
+\immutable\protected\def\Lopenbracket {\math_fenced_fenced_start{openbracket}} \protected\def\Ropenbracket {\math_fenced_fenced_stop {openbracket}}
+\immutable\protected\def\Lnothing {\math_fenced_fenced_start{nothing}} \protected\def\Rnothing {\math_fenced_fenced_stop {nothing}}
+
+\immutable\protected\def\Lparenthesismirrored {\math_fenced_fenced_stop {mirroredparenthesis}} \protected\def\Rparenthesismirrored {\math_fenced_fenced_start{mirroredparenthesis}}
+\immutable\protected\def\Lbracketmirrored {\math_fenced_fenced_stop {mirroredbracket}} \protected\def\Rbracketmirrored {\math_fenced_fenced_start{mirroredbracket}}
+\immutable\protected\def\Lbracemirrored {\math_fenced_fenced_stop {mirroredbrace}} \protected\def\Rbracemirrored {\math_fenced_fenced_start{mirroredbrace}}
+\immutable\protected\def\Langlemirrored {\math_fenced_fenced_stop {mirroredangle}} \protected\def\Ranglemirrored {\math_fenced_fenced_start{mirroredangle}}
+\immutable\protected\def\Ldoubleanglemirrored {\math_fenced_fenced_stop {mirroreddoubleangle}} \protected\def\Rdoubleanglemirrored {\math_fenced_fenced_start{mirroreddoubleangle}}
+\immutable\protected\def\Lbarmirrored {\math_fenced_fenced_stop {mirroredbar}} \protected\def\Rbarmirrored {\math_fenced_fenced_start{mirroredbar}}
+\immutable\protected\def\Ldoublebarmirrored {\math_fenced_fenced_stop {mirroreddoublebar}} \protected\def\Rdoublebarmirrored {\math_fenced_fenced_start{mirroreddoublebar}}
+\immutable\protected\def\Ltriplebarmirrored {\math_fenced_fenced_stop {mirroredtriplebar}} \protected\def\Rtriplebarmirrored {\math_fenced_fenced_start{mirroredtriplebar}}
+\immutable\protected\def\Lsolidusmirrored {\math_fenced_fenced_stop {mirroredsolidus}} \protected\def\Rsolidusmirrored {\math_fenced_fenced_start{mirroredsolidus}}
+\immutable\protected\def\Lfloormirrored {\math_fenced_fenced_stop {mirroredfloor}} \protected\def\Rfloormirrored {\math_fenced_fenced_start{mirroredfloor}}
+\immutable\protected\def\Lceilingmirrored {\math_fenced_fenced_stop {mirroredceiling}} \protected\def\Rceilingmirrored {\math_fenced_fenced_start{mirroredceiling}}
+\immutable\protected\def\Lmoustachemirrored {\math_fenced_fenced_stop {mirroredmoustache}} \protected\def\Rmoustachemirrored {\math_fenced_fenced_start{mirroredmoustache}}
+\immutable\protected\def\Luppercornermirrored {\math_fenced_fenced_stop {mirroreduppercorner}} \protected\def\Ruppercornermirrored {\math_fenced_fenced_start{mirroreduppercorner}}
+\immutable\protected\def\Llowercornermirrored {\math_fenced_fenced_stop {mirroredlowercorner}} \protected\def\Rlowercornermirrored {\math_fenced_fenced_start{mirroredlowercorner}}
+\immutable\protected\def\Lgroupmirrored {\math_fenced_fenced_stop {mirroredgroup}} \protected\def\Rgroupmirrored {\math_fenced_fenced_start{mirroredgroup}}
+\immutable\protected\def\Lopenbracketmirrored {\math_fenced_fenced_stop {mirroredopenbracket}} \protected\def\Ropenbracketmirrored {\math_fenced_fenced_start{mirroredopenbracket}}
+\immutable\protected\def\Lnothingmirrored {\math_fenced_fenced_stop {mirrorednothing}} \protected\def\Rnothingmirrored {\math_fenced_fenced_start{mirrorednothing}}
+
+\definemathfence [interval] [\c!left="2997,\c!right="2998]
+\definemathfence [openinterval] [interval] [\c!left="2998,\c!right="2998]
+\definemathfence [leftopeninterval] [interval] [\c!left="2997,\c!right="2997]
+\definemathfence [rightopeninterval] [interval] [\c!left="2998,\c!right="2998]
+
+\immutable\protected\def\Linterval {\math_fenced_fenced_start{interval}}
+\immutable\protected\def\Lointerval {\math_fenced_fenced_start{openinterval}}
+\immutable\protected\def\Llointerval {\math_fenced_fenced_start{leftopeninterval}}
+\immutable\protected\def\Lrointerval {\math_fenced_fenced_start{rightopeninterval}}
+
+\immutable\protected\def\Rinterval {\math_fenced_fenced_stop {interval}}
+\immutable\protected\def\Rointerval {\math_fenced_fenced_stop {openinterval}}
+\immutable\protected\def\Rlointerval {\math_fenced_fenced_stop {leftopeninterval}}
+\immutable\protected\def\Rrointerval {\math_fenced_fenced_stop {rightopeninterval}}
+
+% \startformula
+% \left{ \frac{1}{a} \right}
+% \left[ \frac{1}{b} \right]
+% \left( \frac{1}{c} \right)
+% \left< \frac{1}{d} \right>
+% \left| \frac{1}{e} \right|
+% \stopformula
+
+\popoverloadmode
+
+\installcorenamespace{mathleft}
+\installcorenamespace{mathright}
+\installcorenamespace{mathmiddle}
+
+\pushoverloadmode
+
+\protected\def\left {\afterassignment\math_left \let\nexttoken}
+\protected\def\right {\afterassignment\math_right \let\nexttoken}
+\protected\def\middle{\afterassignment\math_middle\let\nexttoken}
+
+\popoverloadmode
+
+\let\leftorright\relax
+
+\newconditional\c_math_fenced_done
+\newconditional\c_math_fenced_unknown \settrue\c_math_fenced_unknown
+
+\protected\def\installmathfencepair#1#2#3#4%
+ {\letcsname\??mathleft \normalmeaning#1\endcsname#2%
+ \letcsname\??mathright\normalmeaning#3\endcsname#4}
+
+\def\math_unknown_left {\setfalse\c_math_fenced_done\ifconditional\c_math_fenced_unknown\normalleft \nexttoken\fi}
+\def\math_unknown_right {\setfalse\c_math_fenced_done\ifconditional\c_math_fenced_unknown\normalright \nexttoken\fi}
+\def\math_unknown_middle{\setfalse\c_math_fenced_done\ifconditional\c_math_fenced_unknown\normalmiddle\nexttoken\fi}
+
+\letvalue{\??mathleft \s!unknown}\math_unknown_left
+\letvalue{\??mathright \s!unknown}\math_unknown_right
+\letvalue{\??mathmiddle\s!unknown}\math_unknown_middle
+
+\def\math_left
+ {\settrue\c_math_fenced_done
+ \ifcsname\??mathleft\normalmeaning\nexttoken\endcsname
+ \expandafter\lastnamedcs
+ \else
+ \expandafter\math_unknown_left
+ \fi}
+
+\def\math_right
+ {\settrue\c_math_fenced_done
+ \ifcsname\??mathright\normalmeaning\nexttoken\endcsname
+ \expandafter\lastnamedcs
+ \else
+ \expandafter\math_unknown_right
+ \fi}
+
+\def\math_middle
+ {\settrue\c_math_fenced_done
+ \ifcsname\??mathmiddle\normalmeaning\nexttoken\endcsname
+ \expandafter\lastnamedcs
+ \else
+ \expandafter\math_unknown_middle
+ \fi}
+
+\protected\def\lfence#1%
+ {\settrue\c_math_fenced_done
+ \let\nexttoken#1%
+ \ifcsname\??mathleft\normalmeaning\nexttoken\endcsname
+ \expandafter\lastnamedcs
+ \else
+ \expandafter\math_unknown_left
+ \fi}
+
+\protected\def\rfence#1%
+ {\settrue\c_math_fenced_done
+ \let\nexttoken#1%
+ \ifcsname\??mathright\normalmeaning\nexttoken\endcsname
+ \expandafter\lastnamedcs
+ \else
+ \expandafter\math_unknown_right
+ \fi}
+
+\protected\def\mfence#1%
+ {\settrue\c_math_fenced_done
+ \let\nexttoken#1%
+ \ifcsname\??mathmiddle\normalmeaning\nexttoken\endcsname
+ \expandafter\lastnamedcs
+ \else
+ \expandafter\math_unknown_middle
+ \fi}
+
+\normalexpanded{\installmathfencepair {|\detokenize {|}} \Ldoublebar {|\detokenize {|}} \Rdoublebar}
+\normalexpanded{\installmathfencepair {|\detokenize{||}} \Ltriplebar {|\detokenize{||}} \Rtriplebar}
+
+\installmathfencepair \bgroup \Lbrace \egroup \Rbrace
+\installmathfencepair \egroup \Rbracemirrored \bgroup \Lbracemirrored
+
+\installmathfencepair \letteropenbrace \Lbrace \letterclosebrace \Rbrace % as we escape in mp textexts
+
+\installmathfencepair . \Lnothing . \Rnothing
+\installmathfencepair . \Rnothingmirrored . \Lnothingmirrored
+
+\installmathfencepair [ \Lbracket ] \Rbracket
+\installmathfencepair ] \Rbracketmirrored [ \Lbracketmirrored
+
+\installmathfencepair ( \Lparenthesis ) \Rparenthesis
+\installmathfencepair ) \Rparenthesismirrored ( \Lparenthesismirrored
+
+\installmathfencepair < \Langle > \Rangle
+\installmathfencepair > \Ranglemirrored < \Langlemirrored
+
+\installmathfencepair / \Lsolidus / \Rsolidus
+%installmathfencepair / \Rsolidusmirrored / \Lsolidusmirrored
+
+\installmathfencepair | \Lbar | \Rbar
+%installmathfencepair | \Rbarmirrored | \Lbarmirrored
+
+\installmathfencepair ⌊ \Lfloor ⌋ \Rfloor
+\installmathfencepair ⌋ \Rfloormirrored ⌊ \Lfloormirrored
+\installmathfencepair ⌈ \Lceiling ⌉ \Rceiling
+\installmathfencepair ⌉ \Rceilingmirrored ⌈ \Lceilingmirrored
+
+\installmathfencepair ⟨ \Langle ⟩ \Rangle
+\installmathfencepair ⟩ \Ranglemirrored ⟨ \Langlemirrored
+
+\installmathfencepair ⟪ \Ldoubleangle ⟫ \Rdoubleangle
+\installmathfencepair ⟫ \Rdoubleanglemirrored ⟪ \Ldoubleanglemirrored
+
+\installmathfencepair ‖ \Ldoublebar ‖ \Rdoublebar
+%installmathfencepair ‖ \Rdoublebarmirrored ‖ \Ldoublebarmirrored
+
+\installmathfencepair ⦀ \Ltriplebar ⦀ \Rtriplebar
+%installmathfencepair ⦀ \Rtriplebarmirrored ⦀ \Ltriplebarmirrored
+
+% \installmathfencepair { \Lbrace } \Rbrace
+% \installmathfencepair } \Rbracemirrored { \Lbracemirrored
+
+\installmathfencepair ⦗ \Linterval ⦘ \Rinterval
+
+\appendtoks
+ \ignorediscretionaries % so $\mtext{a|b}$ works, this is ok because it's an \hbox
+\to \everymathematics
+
+% We unofficial support some synonyms as we need them for some fuzzy web related math.
+
+% The names in char-def.lua (historic mess):
+
+\pushoverloadmode
+
+\let\lbrack \lbracket
+\let\rbrack \rbracket
+\let\lceiling \lceil
+\let\rceiling \rceil
+\let\lparenthesis\lparent
+\let\rparenthesis\rparent
+\let\lparen \lparent
+\let\rparen \rparent
+
+% Just defined:
+
+\let\Lceil \Lceiling
+\let\Rceil \Rceiling
+\let\Lparent\Lparenthesis
+\let\Rparent\Rparenthesis
+\let\Lparen \Lparenthesis
+\let\Rparen \Rparenthesis
+
+\installmathfencepair \lbrace \Lbrace \rbrace \Rbrace
+\installmathfencepair \lbracket \Lbracket \rbracket \Rbracket
+\installmathfencepair \lbrack \Lbracket \rbracket \Rbracket
+\installmathfencepair \lparenthesis \Lparenthesis \rparenthesis \Rparenthesis
+\installmathfencepair \lparent \Lparenthesis \rparent \Rparenthesis
+\installmathfencepair \lparen \Lparenthesis \rparen \Rparenthesis
+\installmathfencepair \langle \Langle \rangle \Rangle
+\installmathfencepair \llangle \Ldoubleangle \rrangle \Rdoubleangle
+%installmathfencepair \lbar \Lbar \rbar \Rbar
+\installmathfencepair \lVert \Ldoublebar \rVert \Rdoublebar
+\installmathfencepair \vert \Lbar \vert \Rbar
+\installmathfencepair \solidus \Lsolidus \solidus \Rsolidus
+\installmathfencepair \lfloor \Lfloor \rfloor \Rfloor
+\installmathfencepair \lceiling \Lceiling \rceiling \Rceiling
+\installmathfencepair \lceil \Lceiling \rceil \Rceiling
+
+\installmathfencepair \ulcorner \Luppercorner \urcorner \Ruppercorner
+\installmathfencepair \llcorner \Llowercorner \lrcorner \Rlowercorner
+\installmathfencepair \lmoustache \Lmoustache \rmoustache \Rmoustache
+\installmathfencepair \llbracket \Lopenbracket \rrbracket \Ropenbracket
+\installmathfencepair \lgroup \Lgroup \rgroup \Rgroup
+
+\installmathfencepair \linterval \Linterval \rinterval \Rinterval
+%installmathfencepair \linterv \Linterval \rinterv \Rinterval
+\installmathfencepair \lointerval \Linterval \rointerval \Rinterval
+\installmathfencepair \llointerval \Llointerval \rlointerval \Rlointerval
+\installmathfencepair \lrointerval \Lrointerval \rrointerval \Rrointerval
+
+\aliased\let\textlbar\lbar \aliased\let\mathlbar\Lbar
+\aliased\let\textrbar\lbar \aliased\let\mathrbar\Rbar
+
+\immutable\protected\def\lbar{\mathortext\mathlbar\textlbar}
+\immutable\protected\def\rbar{\mathortext\mathrbar\textrbar}
+
+% \setupmathfences[color=darkgreen]
+
+\permanent\protected\def\{{\mathortext\lbrace \letterleftbrace } % or maybe a chardef
+\permanent\protected\def\}{\mathortext\rbrace \letterrightbrace } % or maybe a chardef
+\permanent\protected\def\[{\mathortext\lbracket \letterleftbracket } % or maybe a chardef
+\permanent\protected\def\]{\mathortext\rbracket \letterrightbracket } % or maybe a chardef
+\permanent\protected\def\({\mathortext\lparenthesis\letterleftparenthesis } % or maybe a chardef
+\permanent\protected\def\){\mathortext\rparenthesis\letterrightparenthesis} % or maybe a chardef
+\permanent\protected\def\|{\mathortext\vert \letterbar } % or maybe a chardef
+%permanent\protected\def\/{\mathortext\solidus \letterslash } % or maybe a chardef
+
+\installmathfencepair \{ \Lbrace \} \Rbrace
+\installmathfencepair \[ \Lbracket \] \Rbracket
+\installmathfencepair \( \Lparenthesis \) \Rparenthesis
+\installmathfencepair \< \Langle \> \Rangle
+\installmathfencepair \| \Lbar \| \Rbar
+
+\popoverloadmode
+
+%D As we have overloaded \type {\left} and \type {\right} we also need a more
+%D clever version of the following:
+
+% methods:
+%
+% 1: none
+% 2: lua
+% 3: tex
+
+% variants:
+%
+% 1: step 1
+% 2: step 2
+% 3: htdp * 1.33^n
+% 4: size * 1.33^n
+
+\setnewconstant\bigmathdelimitermethod \plusone
+\setnewconstant\bigmathdelimitervariant\plusthree
+
+\protected\def\plainbigdelimiters % traditional method
+ {\bigmathdelimitermethod\plustwo}
+
+\plainbigdelimiters % is default for the moment but not so nice
+
+% \setconstant\bigmathdelimitermethod\plusone
+
+\installcorenamespace{mathbig}
+
+\setvalue{\??mathbig1}{0.85}
+\setvalue{\??mathbig2}{1.15}
+\setvalue{\??mathbig3}{1.45}
+\setvalue{\??mathbig4}{1.75}
+
+\protected\def\choosemathbig#1#2% so we accept \big{||} as well
+ {{\naturalhbox\bgroup
+ \startimath
+ \ifcase\bigmathdelimitermethod
+ \math_fenced_step#2\relax
+ \or
+ \math_fenced_force_size\bigmathdelimitervariant{#1}\relax
+ \math_fenced_step#2\relax
+ \else
+ \math_fenced_step#2{\vpack to\csname\??mathbig#1\endcsname\bodyfontsize{}}%
+ \fi
+ \nulldelimiterspace\zeropoint\relax
+ \mathsurround\zeropoint
+ \stopimath
+ \egroup}}
+
+% needs testing:
+%
+% \protected\def\choosemathbig#1#2% so we accept \big{||} as well
+% {{\naturalhbox\bgroup
+% \startimath
+% \ifcase\bigmathdelimitermethod
+% \Uvextensible#2\relax
+% \or
+% \math_fenced_force_size\bigmathdelimitervariant{#1}\relax
+% \Uvextensible#2\relax
+% \else
+% \scratchdimen.5\dimexpr\csname\??mathbig\number#1\endcsname\bodyfontsize+1.1\exheight\relax
+% \Uvextensible\s!axis \s!depth \scratchdimen \s!height \scratchdimen #2\relax
+% \fi
+% \nulldelimiterspace\zeropoint\relax
+% \mathsurround\zeropoint
+% \stopimath
+% \egroup}}
+
+\def\math_fenced_step#1#2%
+ {\setfalse\c_math_fenced_unknown
+ \setfalse\c_math_fenced_done
+ \left#1\relax
+ \ifconditional\c_math_fenced_done
+ #2%
+ \right.\relax
+ \else
+ \left.\relax
+ #2%
+ \setfalse\c_math_fenced_done
+ \right#1\relax
+ \ifconditional\c_math_fenced_done
+ \else
+ \right.\relax
+ \fi
+ \fi}
+
+\protected\def\mathdelimiterstep#1#2%
+ {\begingroup
+ \math_fenced_force_size\plusone{#1}%
+ \math_fenced_step#2\relax
+ \endgroup}
+
+\definemathcommand [big] {\choosemathbig1}
+\definemathcommand [Big] {\choosemathbig2}
+\definemathcommand [bigg] {\choosemathbig3}
+\definemathcommand [Bigg] {\choosemathbig4}
+
+\definemathcommand [bigl] [open] [one] {\big}
+\definemathcommand [bigm] [rel] [one] {\big}
+\definemathcommand [bigr] [close] [one] {\big}
+\definemathcommand [Bigl] [open] [one] {\Big}
+\definemathcommand [Bigm] [rel] [one] {\Big}
+\definemathcommand [Bigr] [close] [one] {\Big}
+\definemathcommand [biggl] [open] [one] {\bigg}
+\definemathcommand [biggm] [rel] [one] {\bigg}
+\definemathcommand [biggr] [close] [one] {\bigg}
+\definemathcommand [Biggl] [open] [one] {\Bigg}
+\definemathcommand [Biggm] [rel] [one] {\Bigg}
+\definemathcommand [Biggr] [close] [one] {\Bigg}
+
+% \definemathfence [integral] [\c!left="222B]
+%
+% \protected\def\Lintegral {\math_fenced_fenced_start{integral}}
+% \protected\def\Rintegral {\math_fenced_fenced_stop {integral}}
+%
+% \installmathfencepair \lintegral \Lintegral \rintegral \Rintegral
+%
+% \left\lintegral
+% \vrule height 3cm depth 3cm
+% \right\rintegral
+
+%definemathfence [fancybracket] [bracket] [command=yes,color=red]
+
+% experimental accents:
+%
+% \definemathoverextensible [top] [hoed] ["FE302]
+% \definemathoverextensible [top] [slang] ["FE303]
+
+%D The nested fences recovery code is needed for mathml and the original
+%D code can still be found in the mkiv file.
+
+\definesystemattribute[mathautofence][public]
+
+\let\math_fences_normal_left \left
+\let\math_fences_normal_right \right
+\let\math_fences_normal_middle\middle
+\let\math_fences_normal_both \leftorright
+
+\protected\def\math_fences_auto_left #1{\c_attr_mathautofence\plusone #1\c_attr_mathautofence\attributeunsetvalue}
+\protected\def\math_fences_auto_right #1{\c_attr_mathautofence\plustwo #1\c_attr_mathautofence\attributeunsetvalue}
+\protected\def\math_fences_auto_middle#1{\c_attr_mathautofence\plusthree#1\c_attr_mathautofence\attributeunsetvalue}
+\protected\def\math_fences_auto_both #1{\c_attr_mathautofence\plusfour #1\c_attr_mathautofence\attributeunsetvalue}
+
+\permanent\let\autofenceopen \math_fences_auto_left % for testing
+\permanent\let\autofenceclose \math_fences_auto_right % for testing
+\permanent\let\autofenceleft \math_fences_auto_left % for testing
+\permanent\let\autofenceright \math_fences_auto_right % for testing
+\permanent\let\autofencemiddle\math_fences_auto_middle % for testing
+\permanent\let\autofenceboth \math_fences_auto_both % for testing
+
+% fences are used not that often (i.e. no performance issue) so we can use a state
+% instead of \let ... also some state variable can come in handy in the future
+
+\newconditional\c_math_fences_auto
+
+\protected\def\enableautofences
+ {\clf_enableautofences
+ \glet\clf_enableautofences\relax % onlyonce anyway
+ \protected\gdef\enableautofences{\settrue\c_math_fences_auto}%
+ \enableautofences}
+
+\protected\def\disableautofences
+ {\setfalse\c_math_fences_auto}
+
+\protected\def\math_fences_used_left
+ {\ifconditional\c_math_fences_auto
+ \expandafter\math_fences_auto_left
+ \else
+ \expandafter\math_fences_normal_left
+ \fi}
+
+\protected\def\math_fences_used_right
+ {\ifconditional\c_math_fences_auto
+ \expandafter\math_fences_auto_right
+ \else
+ \expandafter\math_fences_normal_right
+ \fi}
+
+\protected\def\math_fences_used_middle
+ {\ifconditional\c_math_fences_auto
+ \expandafter\math_fences_auto_middle
+ \else
+ \expandafter\math_fences_normal_middle
+ \fi}
+
+\protected\def\math_fences_used_both
+ {\ifconditional\c_math_fences_auto
+ \expandafter\math_fences_auto_both
+ \else
+ \expandafter\math_fences_normal_both
+ \fi}
+
+\permanent\let\left \math_fences_used_left
+\permanent\let\right \math_fences_used_right
+\permanent\let\middle \math_fences_used_middle
+\permanent\let\leftorright\math_fences_used_both
+
+% wrappers
+
+\protected\def\startcheckedfences
+ {\begingroup
+ \enableautofences}
+
+\protected\def\stopcheckedfences
+ {\endgroup}
+
+% \appendtoks
+ % maybe: safeguard against overloading
+ %
+ % \let\left \math_fences_used_left
+ % \let\right \math_fences_used_right
+ % \let\middle \math_fences_used_middle
+ % \let\leftorright\math_fences_used_both
+% \to \everymathematics
+
+\appendtoks
+ \ifempty\currentmathfence
+ \doifelse{\mathfenceparameter\c!state}\v!auto\enableautofences\disableautofences
+ \fi
+\to \everysetupmathfence
+
+\newconstant\c_math_fences_delimiters_mode \c_math_fences_delimiters_mode"16 % \numexpr"02+"04+"10\relax
+
+%unexpanded\def\enableautofencemode {\mathdelimitersmode\plussix} % the shift (1) is too fragile
+\protected\def\enableautofencemode {\mathdelimitersmode\c_math_fences_delimiters_mode}
+
+\protected\def\disableautofencemode{\mathdelimitersmode\zerocount}
+
+\appendtoks
+ \ifempty\currentmathfence
+ \doifelse{\mathfenceparameter\c!method}\v!auto\enableautofencemode\disableautofencemode
+ \fi
+\to \everysetupmathfence
+
+% some day default: \setupmathfences[\c!state=\v!auto]
+
+%D The next characters were used for constructing nicer extensibles but
+%D nowadays we have real characters.
+
+\Umathchardef\braceld\zerocount \defaultmathfamily "FF07A
+\Umathchardef\bracerd\zerocount \defaultmathfamily "FF07B
+\Umathchardef\bracelu\zerocount \defaultmathfamily "FF07C
+\Umathchardef\braceru\zerocount \defaultmathfamily "FF07D
+
+\protect
diff --git a/tex/context/base/mkiv/math-ini.mkxl b/tex/context/base/mkiv/math-ini.mkxl
index d6d9ff4f0..2859707e1 100644
--- a/tex/context/base/mkiv/math-ini.mkxl
+++ b/tex/context/base/mkiv/math-ini.mkxl
@@ -2351,7 +2351,7 @@
\c_math_styles_state_cramped\zerocount
\c_math_styles_state_size \zerocount
\rawprocesscommacommand[#2]\math_style_collect
- \expandafter\let\csname\??mathstyle#1\normalexpanded{\endcsname\math_style_add_to_cache_choice}}
+ \letcsname\??mathstyle#1\normalexpanded{\endcsname\math_style_add_to_cache_choice}}
% \def\math_style_set_indeed
% {\csname\??mathstyle
diff --git a/tex/context/base/mkiv/math-stc.mkvi b/tex/context/base/mkiv/math-stc.mkvi
index 8048bf923..19f710061 100644
--- a/tex/context/base/mkiv/math-stc.mkvi
+++ b/tex/context/base/mkiv/math-stc.mkvi
@@ -150,9 +150,9 @@
\let\math_stackers_stop_tagged \relax
\appendtoks
- \def\math_stackers_start_tagged_mid{\dostarttagged\t!mathstackermid\empty\hbox\bgroup}%
- \def\math_stackers_start_tagged_top{\dostarttagged\t!mathstackertop\empty\hbox\bgroup}%
- \def\math_stackers_start_tagged_bot{\dostarttagged\t!mathstackerbot\empty\hbox\bgroup}%
+ \def\math_stackers_start_tagged_mid{\dostarttagged\t!mstackermid\empty\hbox\bgroup}%
+ \def\math_stackers_start_tagged_top{\dostarttagged\t!mstackertop\empty\hbox\bgroup}%
+ \def\math_stackers_start_tagged_bot{\dostarttagged\t!mstackerbot\empty\hbox\bgroup}%
\def\math_stackers_stop_tagged {\egroup\dostoptagged}%
\to \everysetuptagging
@@ -328,7 +328,7 @@
{\begingroup
\edef\currentmathstackers{#category}%
\mathstackersparameter\c!left\relax
- \dostarttagged\t!mathstacker\currentmathstackers
+ \dostarttagged\t!mstacker\currentmathstackers
\ifmmode\math_class_by_parameter\mathstackersparameter\else\dontleavehmode\fi
{\edef\p_offset {\mathstackersparameter\c!offset}%
\edef\p_location {\mathstackersparameter\c!location}%
@@ -415,7 +415,7 @@
\advance\scratchwidth2\scratchhoffset
%
\ifcase#method\relax
- \dostarttagged\t!mathstackermid\empty
+ \dostarttagged\t!mstackermid\empty
\setbox\scratchboxthree\csname\??mathstackersalternative\p_alternative\endcsname
\dostoptagged
\fi
@@ -602,7 +602,7 @@
\setupcurrentmathstackers[#settings]%
\fi
\mathstackersparameter\c!left\relax
- \dostarttagged\t!mathstacker\currentmathstackers
+ \dostarttagged\t!mstacker\currentmathstackers
\ifmmode\math_class_by_parameter\mathstackersparameter\else\dontleavehmode\fi
{\edef\m_math_stackers_text_middle {#text}%
%
@@ -798,7 +798,7 @@
\unexpanded\def\math_stackers_make_double_text#where#category#codepoint#text#extra%
{\math_stackers_start_group{#category}%
\mathstackersparameter\c!left\relax
- \dostarttagged\t!mathstacker\currentmathstackers
+ \dostarttagged\t!mstacker\currentmathstackers
\ifmmode\math_class_by_parameter\mathstackersparameter\else\dontleavehmode\fi
{\edef\currentmathstackers{#category}%
%
diff --git a/tex/context/base/mkiv/meta-ini.mkxl b/tex/context/base/mkiv/meta-ini.mkxl
index 2ca54a38b..fecd07b9d 100644
--- a/tex/context/base/mkiv/meta-ini.mkxl
+++ b/tex/context/base/mkiv/meta-ini.mkxl
@@ -547,16 +547,16 @@
\fi}
\def\meta_prepare_variable_nop
- {\expandafter \let\csname\m_meta_current_variable_template\endcsname\meta_prepare_variable_default}
+ {\expandafter\letcsname\m_meta_current_variable_template\endcsname\meta_prepare_variable_default}
\def\meta_prepare_variable_color % we use the attribute so we dont' go through namedcolor (why not)
- {\expandafter\edef\csname\m_meta_current_variable_template\endcsname{\MPcolor\m_meta_current_variable}}
+ {\expandafter\edefcsname\m_meta_current_variable_template\endcsname{\MPcolor\m_meta_current_variable}}
\def\meta_prepare_variable_number
- {\expandafter\edef\csname\m_meta_current_variable_template\endcsname{\number\m_meta_current_variable}}% also accepts 0.number
+ {\expandafter\edefcsname\m_meta_current_variable_template\endcsname{\number\m_meta_current_variable}}% also accepts 0.number
\def\meta_prepare_variable_dimension
- {\expandafter\edef\csname\m_meta_current_variable_template\endcsname{\the\dimexpr\m_meta_current_variable}}
+ {\expandafter\edefcsname\m_meta_current_variable_template\endcsname{\the\dimexpr\m_meta_current_variable}}
\def\meta_prepare_variable_yes
{\ifchkdim\m_meta_current_variable\or
diff --git a/tex/context/base/mkiv/mult-aux.mkxl b/tex/context/base/mkiv/mult-aux.mkxl
index c1c99edbd..49f473874 100644
--- a/tex/context/base/mkiv/mult-aux.mkxl
+++ b/tex/context/base/mkiv/mult-aux.mkxl
@@ -251,7 +251,7 @@
%D Do, we only interface the assignment definition:
-\protected\def\mult_interfaces_adef#1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
+\protected\def\mult_interfaces_adef#1#2{\defcsname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
\startinterface english
\protected\def\mult_interfaces_adef#1#2{\defcsname#1#2\endcsname}
@@ -319,7 +319,6 @@
\frozen\protected\def#9##1{\edefcsname#1##1:\s!parent\endcsname{#1#2}}}
\permanent\protected\def\installparameterhashhandler#1#2%
-% {\expandafter\let\csname#2namespace\endcsname#1%
{\letcsname#2namespace\endcsname#1%
\normalexpanded
{\mult_interfaces_install_parameter_hash_handler
@@ -388,7 +387,6 @@
\def\mult_check_for_parent#1#2#3#4%
{\ifcsname#1#4:\s!parent\endcsname\orelse\ifx#4\empty\else
\writestatus\m!system{error: invalid parent #4 for #3, #4 defined too (best check it)}%
-% \expandafter\edef\csname#1#4:\s!parent\endcsname{#2}%
\edefcsname#1#4:\s!parent\endcsname{#2}%
\fi}
@@ -753,7 +751,6 @@
%D Here is another experiment:
\protected\def\mult_interfaces_install_action_handler#1#2#3%
-% {\frozen\tolerant\protected\expandafter\def\csname#1\endcsname[##1]##*[##2]%
{\frozen\tolerant\protected\defcsname#1\endcsname[##1]##*[##2]%
{\begingroup
\ifarguments
@@ -1074,13 +1071,13 @@
\permanent\protected\def\installmacrostack#1%
{\ifdefined#1\else\let#1\empty\fi
- \protected\expandafter\gdef\csname push_macro_\csstring#1\endcsname{\localpushmacro#1}%
- \protected\expandafter\gdef\csname pop_macro_\csstring#1\endcsname{\localpopmacro #1}}
+ \global\protected\defcsname push_macro_\csstring#1\endcsname{\localpushmacro#1}%
+ \global\protected\defcsname pop_macro_\csstring#1\endcsname{\localpopmacro #1}}
\permanent\protected\def\installglobalmacrostack#1%
{\ifdefined#1\else\glet#1\empty\fi
- \protected\expandafter\gdef\csname push_macro_\csstring#1\endcsname{\globalpushmacro#1}%
- \protected\expandafter\gdef\csname pop_macro_\csstring#1\endcsname{\globalpopmacro #1}}
+ \global\protected\defcsname push_macro_\csstring#1\endcsname{\globalpushmacro#1}%
+ \global\protected\defcsname pop_macro_\csstring#1\endcsname{\globalpopmacro #1}}
% \showmacrostack can be used to see if there are different entries
diff --git a/tex/context/base/mkiv/mult-ini.mkiv b/tex/context/base/mkiv/mult-ini.mkiv
index c94a55e4d..75fa5c7bf 100644
--- a/tex/context/base/mkiv/mult-ini.mkiv
+++ b/tex/context/base/mkiv/mult-ini.mkiv
@@ -60,6 +60,7 @@
\def\m!prefix!{m!}
\def\s!prefix!{s!}
\def\v!prefix!{v!}
+\def\t!prefix!{t!}
%D \macros
%D [constants,variables,commands]
@@ -168,9 +169,9 @@
%D \def\e!name{meaning}
%D \stoptyping
-\protected\def\defineinterfaceconstant #1#2{\expandafter\def\csname\c!prefix!#1\endcsname{#2}}
-\protected\def\defineinterfacevariable #1#2{\expandafter\def\csname\v!prefix!#1\endcsname{#2}}
-\protected\def\defineinterfaceelement #1#2{\expandafter\def\csname\e!prefix!#1\endcsname{#2}}
+\protected\def\defineinterfaceconstant#1#2{\expandafter\def\csname\c!prefix!#1\endcsname{#2}}
+\protected\def\defineinterfacevariable#1#2{\expandafter\def\csname\v!prefix!#1\endcsname{#2}}
+\protected\def\defineinterfaceelement #1#2{\expandafter\def\csname\e!prefix!#1\endcsname{#2}}
%D Next come some interface independant constants:
%D
@@ -178,7 +179,7 @@
%D \definefileconstant {name} {meaning}
%D \stoptyping
-\protected\def\definefileconstant #1#2{\expandafter\def\csname\f!prefix!#1\endcsname{#2}}
+\protected\def\definefileconstant#1#2{\expandafter\def\csname\f!prefix!#1\endcsname{#2}}
%D And finaly we have the one argument, space saving constants
%D
@@ -187,8 +188,13 @@
%D \definemessageconstant {name}
%D \stoptyping
-\protected\def\definesystemconstant #1{\expandafter\def\csname\s!prefix!#1\endcsname{#1}}
-\protected\def\definemessageconstant #1{\expandafter\def\csname\m!prefix!#1\endcsname{#1}}
+\protected\def\definesystemconstant #1{\expandafter\def\csname\s!prefix!#1\endcsname{#1}}
+\protected\def\definemessageconstant#1{\expandafter\def\csname\m!prefix!#1\endcsname{#1}}
+
+%D For now here:
+
+\protected\def\definetagconstant #1{\expandafter\def\csname\t!prefix!#1\endcsname{#1}}
+\protected\def\aliastagconstant #1#2{\expandafter\let\csname\t!prefix!#1\expandafter\endcsname\csname\t!prefix!#2\endcsname}
%D In a parameter driven system, some parameters are shared by more system
%D components. In \CONTEXT\ we can distinguish parameters by a unique prefix. Such a
diff --git a/tex/context/base/mkiv/mult-ini.mkxl b/tex/context/base/mkiv/mult-ini.mkxl
index 19c76d0cf..709e7142f 100644
--- a/tex/context/base/mkiv/mult-ini.mkxl
+++ b/tex/context/base/mkiv/mult-ini.mkxl
@@ -60,6 +60,7 @@
\immutable\def\m!prefix!{m!}
\immutable\def\s!prefix!{s!}
\immutable\def\v!prefix!{v!}
+\immutable\def\t!prefix!{t!}
%D \macros
%D [constants,variables,commands]
@@ -168,9 +169,9 @@
%D \def\e!name{meaning}
%D \stoptyping
-%permanent\protected\def\defineinterfaceconstant #1#2{\immutable\expandafter\def\csname\c!prefix!#1\endcsname{#2}}
-\permanent\protected\def\defineinterfacevariable #1#2{\immutable\expandafter\def\csname\v!prefix!#1\endcsname{#2}}
-\permanent\protected\def\defineinterfaceelement #1#2{\immutable\expandafter\def\csname\e!prefix!#1\endcsname{#2}}
+%permanent\protected\def\defineinterfaceconstant#1#2{\immutable\defcsname\c!prefix!#1\endcsname{#2}}
+\permanent\protected\def\defineinterfacevariable#1#2{\immutable\defcsname\v!prefix!#1\endcsname{#2}}
+\permanent\protected\def\defineinterfaceelement #1#2{\immutable\defcsname\e!prefix!#1\endcsname{#2}}
%D Next come some interface independant constants:
%D
@@ -178,7 +179,7 @@
%D \definefileconstant {name} {meaning}
%D \stoptyping
-\permanent\protected\def\definefileconstant #1#2{\immutable\expandafter\def\csname\f!prefix!#1\endcsname{#2}}
+\permanent\protected\def\definefileconstant#1#2{\immutable\defcsname\f!prefix!#1\endcsname{#2}}
%D And finaly we have the one argument, space saving constants
%D
@@ -187,10 +188,13 @@
%D \definemessageconstant {name}
%D \stoptyping
-% for now we check if a system variable has been defined, till we fixed all duplicate definitions
+\permanent\protected\def\definesystemconstant #1{\immutable\defcsname\s!prefix!#1\endcsname{#1}}
+\permanent\protected\def\definemessageconstant#1{\immutable\defcsname\m!prefix!#1\endcsname{#1}}
-\permanent\protected\def\definesystemconstant #1{\immutable\expandafter\def\csname\s!prefix!#1\endcsname{#1}}
-\permanent\protected\def\definemessageconstant #1{\immutable\expandafter\def\csname\m!prefix!#1\endcsname{#1}}
+%D For now here:
+
+\permanent\protected\def\definetagconstant #1{\immutable\defcsname\t!prefix!#1\endcsname{#1}}
+\permanent\protected\def\aliastagconstant #1#2{\aliased \letcsname\t!prefix!#1\expandafter\endcsname\csname\t!prefix!#2\endcsname}
%D In a parameter driven system, some parameters are shared by more system
%D components. In \CONTEXT\ we can distinguish parameters by a unique prefix. Such a
@@ -200,7 +204,7 @@
%D \definesystemvariable {name}
%D \stoptyping
-\permanent\protected\def\definesystemvariable#1{\immutable\expandafter\edef\csname\??prefix#1\endcsname{\@@prefix#1}}
+\permanent\protected\def\definesystemvariable#1{\immutable\edefcsname\??prefix#1\endcsname{\@@prefix#1}}
\definesystemvariable{ms}
@@ -403,35 +407,35 @@
\pushoverloadmode
-\permanent\protected\def\doletvalue #1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
-\permanent\protected\def\dosetvalue #1#2{\expandafter\def \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
-\permanent\protected\def\dosetevalue #1#2{\expandafter\edef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
-\permanent\protected\def\dosetgvalue #1#2{\expandafter\gdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
-\permanent\protected\def\dosetxvalue #1#2{\expandafter\xdef\csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
-\permanent\protected\def\doresetvalue #1#2{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty}
-\permanent\protected\def\doignorevalue#1#2#3{\expandafter\let \csname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty}
+\permanent\protected\def\doletvalue #1#2{\letcsname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
+\permanent\protected\def\dosetvalue #1#2{\defcsname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
+\permanent\protected\def\dosetevalue #1#2{\edefcsname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
+\permanent\protected\def\dosetgvalue #1#2{\global\defcsname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
+\permanent\protected\def\dosetxvalue #1#2{\global\edefcsname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname}
+\permanent\protected\def\doresetvalue #1#2{\letcsname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty}
+\permanent\protected\def\doignorevalue#1#2#3{\letcsname#1\ifcsname\k!prefix!#2\endcsname\csname\k!prefix!#2\endcsname\else#2\fi\endcsname\empty}
\permanent\protected\def\docopyvalue#1#2#3%
{\ifcsname\k!prefix!#3\endcsname
- \expandafter\def\csname#1\csname\k!prefix!#3\endcsname\expandafter\endcsname\expandafter
+ \defcsname#1\csname\k!prefix!#3\endcsname\expandafter\endcsname\expandafter
{\csname#2\csname\k!prefix!#3\endcsname\endcsname}%
\else
- \expandafter\def\csname#1#3\expandafter\endcsname\expandafter
+ \defcsname#1#3\expandafter\endcsname\expandafter
{\csname#2#3\endcsname}%
\fi}
\startinterface english
- \permanent\protected\def\doletvalue #1#2{\expandafter \let\csname#1#2\endcsname}
- \permanent\protected\def\dosetvalue #1#2{\expandafter \def\csname#1#2\endcsname}
- \permanent\protected\def\dosetevalue #1#2{\expandafter\edef\csname#1#2\endcsname}
- \permanent\protected\def\dosetgvalue #1#2{\expandafter\gdef\csname#1#2\endcsname}
- \permanent\protected\def\dosetxvalue #1#2{\expandafter\xdef\csname#1#2\endcsname}
- \permanent\protected\def\doresetvalue #1#2{\expandafter \let\csname#1#2\endcsname\empty}
- \permanent\protected\def\doignorevalue#1#2#3{\expandafter \let\csname#1#2\endcsname\empty}
+ \permanent\protected\def\doletvalue #1#2{\letcsname#1#2\endcsname}
+ \permanent\protected\def\dosetvalue #1#2{\defcsname#1#2\endcsname}
+ \permanent\protected\def\dosetevalue #1#2{\edefcsname#1#2\endcsname}
+ \permanent\protected\def\dosetgvalue #1#2{\global\defcsname#1#2\endcsname}
+ \permanent\protected\def\dosetxvalue #1#2{\global\edefcsname#1#2\endcsname}
+ \permanent\protected\def\doresetvalue #1#2{\letcsname#1#2\endcsname\empty}
+ \permanent\protected\def\doignorevalue#1#2#3{\letcsname#1#2\endcsname\empty}
\permanent\protected\def\docopyvalue#1#2#3%
- {\expandafter\def\csname#1#3\expandafter\endcsname\expandafter
+ {\defcsname#1#3\expandafter\endcsname\expandafter
{\csname#2#3\endcsname}}
\stopinterface
@@ -682,11 +686,11 @@
\permanent\overloaded\protected\def\setinterfaceconstant#1#2%
{\clf_setinterfaceconstant{#1}{#2}%
- \immutable\expandafter\def\csname\c!prefix!#1\endcsname{#1}}
+ \immutable\defcsname\c!prefix!#1\endcsname{#1}}
\permanent\overloaded\protected\def\setinterfacevariable#1#2%
{\clf_setinterfacevariable{#1}{#2}%
- \immutable\expandafter\def\csname\v!prefix!#1\endcsname{#2}}
+ \immutable\defcsname\v!prefix!#1\endcsname{#2}}
%D \macros
%D {defineinterfaceconstant}
@@ -696,7 +700,7 @@
%D c||version, but for documentation purposes the x||alternative comes in handy.
\permanent\overloaded\protected\def\defineinterfaceconstant#1#2%
- {\immutable\expandafter\def\csname\c!prefix!#1\endcsname{#2}}
+ {\immutable\defcsname\c!prefix!#1\endcsname{#2}}
%D \macros
%D {startelements}
@@ -720,29 +724,29 @@
\permanent\protected\def\setinterfacecommand#1#2% \frozen ? \permanent ?
{\doifnot{#1}{#2}% todo: let when already defined
- {\expandafter\def\csname#2\expandafter\endcsname\expandafter{\csname#1\endcsname}}}
+ {\defcsname#2\expandafter\endcsname\expandafter{\csname#1\endcsname}}}
%D We just ignore these:
-\permanent\protected\def\startvariables{\gobbleuntil\stopvariables} \let\stopvariables\relax
-\permanent\protected\def\startconstants{\gobbleuntil\stopconstants} \let\stopconstants\relax
-\permanent\protected\def\startelements {\gobbleuntil\stopelements } \let\stopelements \relax
-\permanent\protected\def\startcommands {\gobbleuntil\stopcommands } \let\stopcommands \relax
+\permanent\protected\def\startvariables{\gobbleuntil\stopvariables} \aliased\let\stopvariables\relax
+\permanent\protected\def\startconstants{\gobbleuntil\stopconstants} \aliased\let\stopconstants\relax
+\permanent\protected\def\startelements {\gobbleuntil\stopelements } \aliased\let\stopelements \relax
+\permanent\protected\def\startcommands {\gobbleuntil\stopcommands } \aliased\let\stopcommands \relax
%D For at the \LUA\ end (experiment):
-\def\ui_c#1#2{\immutable\expandafter\gdef\csname\c!prefix!#1\endcsname{#1}%
- \immutable\expandafter\gdef\csname\k!prefix!#2\endcsname{#1}} % backmapping from non english
-\def\ui_s #1{\immutable\expandafter\gdef\csname\c!prefix!#1\endcsname{#1}%
- \immutable\expandafter\gdef\csname\k!prefix!#1\endcsname{#1}} % backmapping from non english
-\def\ui_v#1#2{\immutable\expandafter\gdef\csname\v!prefix!#1\endcsname{#2}}
-\def\ui_e#1#2{\immutable\expandafter\gdef\csname\e!prefix!#1\endcsname{#2}}
+\def\ui_c#1#2{\immutable\global\defcsname\c!prefix!#1\endcsname{#1}%
+ \immutable\global\defcsname\k!prefix!#2\endcsname{#1}} % backmapping from non english
+\def\ui_s #1{\immutable\global\defcsname\c!prefix!#1\endcsname{#1}%
+ \immutable\global\defcsname\k!prefix!#1\endcsname{#1}} % backmapping from non english
+\def\ui_v#1#2{\immutable\global\defcsname\v!prefix!#1\endcsname{#2}}
+\def\ui_e#1#2{\immutable\global\defcsname\e!prefix!#1\endcsname{#2}}
\def\ui_a#1#2{\frozen\protected\def#2{#1}} % will go away
\startinterface english
- \def\ui_c#1#2{\immutable\expandafter\gdef\csname\c!prefix!#1\endcsname{#1}}
- \def\ui_s #1{\immutable\expandafter\gdef\csname\c!prefix!#1\endcsname{#1}}
+ \def\ui_c#1#2{\immutable\global\defcsname\c!prefix!#1\endcsname{#1}}
+ \def\ui_s #1{\immutable\global\defcsname\c!prefix!#1\endcsname{#1}}
\stopinterface
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index 1a2b9bfaa..3685ab0a0 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -263,10 +263,8 @@ return {
"crampedscriptstyle",
"crampedtextstyle",
"csstring",
- "defaliased",
"defcsname",
"directlua",
- "edefaliased",
"edefcsname",
"efcode",
"endlocalcontrol",
@@ -326,6 +324,7 @@ return {
"ifmathstyle",
"ifnumval",
"ifparameter",
+ "ifparameters",
"iftok",
"ignorearguments",
"ignorepars",
@@ -339,7 +338,6 @@ return {
"lastnamedcs",
"lastnodesubtype",
"leftmarginkern",
- "letaliased",
"letcharcode",
"letcsname",
"letfrozen",
diff --git a/tex/context/base/mkiv/pack-bar.mkiv b/tex/context/base/mkiv/pack-bar.mkiv
index f299f04f3..99323b435 100644
--- a/tex/context/base/mkiv/pack-bar.mkiv
+++ b/tex/context/base/mkiv/pack-bar.mkiv
@@ -63,7 +63,8 @@
\unexpanded\def\verticalpositionbar[#1]%
{\vbox to \vsize
- {\setuppositionbar[#1]%
+ {\hsize\positionbarparameter\c!width
+ \setuppositionbar[#1]%
\usepositionbarstyleandcolor\c!style\c!color
\vskip\zeropoint\s!plus \positionbarparameter\c!n \s!fill
\vskip\zeropoint\s!plus-\positionbarparameter\c!min\s!fill
@@ -75,17 +76,18 @@
{\hpack to \hsize
{\setuppositionbar[#1]%
\usepositionbarstyleandcolor\c!style\c!color
- \leaders\vrule\hskip\zeropoint\s!plus\numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\s!fill
\vrule\s!width\zeropoint\s!height\positionbarparameter\c!height\s!depth\positionbarparameter\c!depth
+ \leaders\vrule\hskip\zeropoint\s!plus\numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\s!fill
\hskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill
\hskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}}
\unexpanded\def\verticalgrowingbar[#1]%
{\vpack to \vsize
- {\setuppositionbar[#1]%
+ {\hsize\positionbarparameter\c!width
+ \setuppositionbar[#1]%
\usepositionbarstyleandcolor\c!style\c!color
- \leaders\hrule\vskip\zeropoint\s!plus\numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\s!fill
\hrule\s!width\positionbarparameter\c!width\s!height\zeropoint\s!depth\zeropoint
+ \leaders\hrule\vskip\zeropoint\s!plus\numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\s!fill
\vskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill
\vskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}}
diff --git a/tex/context/base/mkiv/pack-bar.mkxl b/tex/context/base/mkiv/pack-bar.mkxl
new file mode 100644
index 000000000..c6a111531
--- /dev/null
+++ b/tex/context/base/mkiv/pack-bar.mkxl
@@ -0,0 +1,94 @@
+%D \module
+%D [ file=pack-bar,
+%D version=2009.06.26,
+%D title=\CONTEXT\ Packaging Macros,
+%D subtitle=Bars,
+%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.
+
+\writestatus{loading}{ConTeXt Packaging Macros / Bars}
+
+
+\unprotect
+
+%D This code has been moved from scrn-int to here (was some old experimental code).
+%D It could be in scrn-bar but it's static. In the meantime the interface has been
+%D adapted to a key|/|value one.
+%D
+%D \startbuffer
+%D \dorecurse{10}{
+%D \ruledhbox{\horizontalpositionbar[n=#1,min=1,max=10,text=!,color=red]}
+%D \par
+%D }
+%D \stopbuffer
+%D
+%D \typebuffer \stoplinecorrection \getbuffer \stoplinecorrection
+%D
+%D \startbuffer
+%D \dorecurse{10}{
+%D \ruledhbox{\horizontalgrowingbar[n=#1,min=1,max=10,text=!,color=red]}
+%D \par
+%D }
+%D \stopbuffer
+%D
+%D \typebuffer \stoplinecorrection \getbuffer \stoplinecorrection
+
+\installcorenamespace{positionbar}
+
+\installsimplecommandhandler \??positionbar {positionbar} \??positionbar
+
+\setuppositionbar
+ [\c!min=\plusone,
+ \c!max=\plusone,
+ \c!n=\plusone
+ \c!text=?,
+ \c!width=\emwidth,
+ \c!height=\strutheight,
+ \c!depth=\strutdepth]
+
+\permanent\protected\def\horizontalpositionbar[#1]%
+ {\hbox to \hsize
+ {\setuppositionbar[#1]%
+ \usepositionbarstyleandcolor\c!style\c!color
+ \hskip\zeropoint\s!plus \positionbarparameter\c!n \s!fill
+ \hskip\zeropoint\s!plus-\positionbarparameter\c!min\s!fill
+ \positionbarparameter\c!text\relax
+ \hskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill
+ \hskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}}
+
+\permanent\protected\def\verticalpositionbar[#1]%
+ {\vbox to \vsize
+ {\hsize\positionbarparameter\c!width
+ \setuppositionbar[#1]%
+ \usepositionbarstyleandcolor\c!style\c!color
+ \vskip\zeropoint\s!plus \positionbarparameter\c!n \s!fill
+ \vskip\zeropoint\s!plus-\positionbarparameter\c!min\s!fill
+ \positionbarparameter\c!text\relax
+ \vskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill
+ \vskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}}
+
+\permanent\protected\def\horizontalgrowingbar[#1]%
+ {\hpack to \hsize
+ {\setuppositionbar[#1]%
+ \usepositionbarstyleandcolor\c!style\c!color
+ \vrule\s!width\zeropoint\s!height\positionbarparameter\c!height\s!depth\positionbarparameter\c!depth
+ \leaders\vrule\hskip\zeropoint\s!plus\numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\s!fill
+ \hskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill
+ \hskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}}
+
+\permanent\protected\def\verticalgrowingbar[#1]%
+ {\vpack to \vsize
+ {\hsize\positionbarparameter\c!width
+ \setuppositionbar[#1]%
+ \usepositionbarstyleandcolor\c!style\c!color
+ \hrule\s!width\positionbarparameter\c!width\s!height\zeropoint\s!depth\zeropoint
+ \leaders\hrule\vskip\zeropoint\s!plus\numexpr\positionbarparameter\c!n-\positionbarparameter\c!min+\plusone\relax\s!fill
+ \vskip\zeropoint\s!plus \positionbarparameter\c!max\s!fill
+ \vskip\zeropoint\s!plus-\positionbarparameter\c!n \s!fill}}
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/page-bck.mkxl b/tex/context/base/mkiv/page-bck.mkxl
index db1f8d864..3db063dca 100644
--- a/tex/context/base/mkiv/page-bck.mkxl
+++ b/tex/context/base/mkiv/page-bck.mkxl
@@ -139,8 +139,8 @@
\installcorenamespace{layoutbackgrounds}
\installcorenamespace{layoutbackgroundcheck} % we need another hash as \??layoutbackgrounds<...> gets defined
-\def\page_backgrounds_set_yes{\expandafter\let\csname\currentotrbackground\endcsname\relax }
-\def\page_backgrounds_set_nop{\expandafter\let\csname\currentotrbackground\endcsname\undefined}
+\def\page_backgrounds_set_yes{\letcsname\currentotrbackground\endcsname\relax }
+\def\page_backgrounds_set_nop{\letcsname\currentotrbackground\endcsname\undefined}
\protected\def\page_backgrounds_check#1%
{\edef\currentotrbackground{\??layoutbackgrounds#1}%
@@ -657,7 +657,7 @@
\permanent\protected\def\pushbackground[#1]%
{\pushmacro\popbackground
\edef\currentotrbackground{\??layoutbackgrounds#1}%
- \overloaded\permanent\protected\edef\popbackground
+ \enforced\permanent\protected\edef\popbackground
{\setupframed
[\currentotrbackground]
[\c!background=\namedframedparameter{\currentotrbackground}\c!background,
diff --git a/tex/context/base/mkiv/page-lay.mkxl b/tex/context/base/mkiv/page-lay.mkxl
index 5eefc8b9a..063268527 100644
--- a/tex/context/base/mkiv/page-lay.mkxl
+++ b/tex/context/base/mkiv/page-lay.mkxl
@@ -1043,7 +1043,7 @@
\def\page_adapts_reset
{\ifcsname\??pageadaptations\the\realpageno\endcsname
- \expandafter\glet\csname\??pageadaptations\the\realpageno\endcsname\relax
+ \global\letcsname\??pageadaptations\the\realpageno\endcsname\relax
\fi}
\def\page_adepts_push_indeed
diff --git a/tex/context/base/mkiv/page-txt.mklx b/tex/context/base/mkiv/page-txt.mklx
index 6d9af76b0..9058f893d 100644
--- a/tex/context/base/mkiv/page-txt.mklx
+++ b/tex/context/base/mkiv/page-txt.mklx
@@ -91,11 +91,11 @@
\to \everysetuplayoutelement
\def\page_layouts_reset_element_status#vertical%
- {\expandafter\normalgdef\csname\??layouttextsreset#vertical\endcsname{\page_layouts_set_element_status_normal#vertical}}
+ {\global\defcsname\??layouttextsreset#vertical\endcsname{\page_layouts_set_element_status_normal#vertical}}
\def\page_layouts_set_element_status_normal#vertical%
- {\expandafter\glet\csname\namedlayoutelementhash#vertical\c!state\endcsname\v!normal
- \expandafter\glet\csname\??layouttextsreset#vertical\endcsname\relax
+ {\global\letcsname\namedlayoutelementhash#vertical\c!state\endcsname\v!normal
+ \global\letcsname\??layouttextsreset#vertical\endcsname\relax
\page_layouts_synchronize_element{#vertical}}
\def\page_layouts_synchronize_element#vertical%
@@ -430,8 +430,8 @@
%\hsize\zeropoint % hack so that e.g. after=\hairline gives predictable results
\hsize\totaltextwidth
\normalbaselines
- \let\\\ignoredlinebreak
- \let\crlf\ignoredlinebreak
+ \enforced\let\\\ignoredlinebreak
+ \enforced\let\crlf\ignoredlinebreak
\namedlayoutelementparameter\currentlayouttextline\c!before
\doifbothsidesoverruled
\page_layouts_place_text_line_right
diff --git a/tex/context/base/mkiv/phys-dim.mkiv b/tex/context/base/mkiv/phys-dim.mkiv
index decc19bd3..b390ce64a 100644
--- a/tex/context/base/mkiv/phys-dim.mkiv
+++ b/tex/context/base/mkiv/phys-dim.mkiv
@@ -632,7 +632,7 @@
\def\phys_units_start
{\ifmmode
- \dostarttagged\t!mathaction\t!unit
+ \dostarttagged\t!maction\t!unit
\bgroup % make an mrow
\else
\dostarttagged\t!unit\empty
diff --git a/tex/context/base/mkiv/scrn-ini.mklx b/tex/context/base/mkiv/scrn-ini.mklx
new file mode 100644
index 000000000..40b099cfc
--- /dev/null
+++ b/tex/context/base/mkiv/scrn-ini.mklx
@@ -0,0 +1,254 @@
+%D \module
+%D [ file=scrn-ini,
+%D version=2011.02.27,
+%D title=\CONTEXT\ Interaction Macros,
+%D subtitle=Initialization,
+%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.
+
+\writestatus{loading}{ConTeXt Interaction Macros / Initialization}
+
+\unprotect
+
+\registerctxluafile{scrn-ini}{}
+
+%D There is no interaction at all unless enabled by saying:
+%D
+%D \starttyping
+%D \setupinteraction[state=start]
+%D \stoptyping
+%D
+%D The other settings are:
+%D
+%D \showsetup{setupinteraction}
+
+\installcorenamespace{interaction}
+
+\installswitchcommandhandler \??interaction {interaction} \??interaction
+
+\appendtoks
+ \ifx\previousinteraction\empty
+ \checkinteractionstate
+ \orelse\ifx\currentinteraction\previousinteraction
+ \checkinteractionstate
+ \fi
+\to \everysetupinteraction
+
+\protected\def\checkinteractionstate
+ {\doifelse{\interactionparameter\c!state}\v!start
+ {\locationtrue \setsystemmode \v!interaction}%
+ {\locationfalse \resetsystemmode\v!interaction}}
+
+\def\doifelselocation % expandable
+ {\iflocation
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
+\aliased\let\doiflocationelse\doifelselocation
+
+\setupinteraction
+ [\c!state=\v!stop]
+
+\appendtoks
+ \setupinteraction % todo: remember info at the lua end (already possible)
+\to \everyjob
+
+% it makes no sense to create an environment as we will seldom have structured
+% interactions so a general start-stop will do
+%
+% \appendtoks
+% \setuevalue \currentinteraction {\scrn_interaction_direct{\currentinteraction}}%
+% \setuevalue{\e!start\currentinteraction}{\scrn_interaction_start {\currentinteraction}}%
+% \setuevalue{\e!stop \currentinteraction}{\scrn_interaction_stop }%
+% \to \everydefineinteraction
+%
+% \protected\def\scrn_interaction_direct#1%
+% {\edef\currentinteraction{#1}}
+%
+% \protected\def\scrn_interaction_start#1%
+% {\pushmacro\currentinteraction
+% \edef\currentinteraction{#1}}
+%
+% \protected\def\scrn_interaction_stop
+% {\popmacro\currentinteraction}
+%
+% \protected\def\setinteraction[#1]%
+% {\def\currentinteraction{#1}}
+%
+% \defineinteraction[\v!interaction]
+
+\permanent\protected\def\startinteraction[#1]%
+ {\pushmacro\currentinteraction
+ \edef\currentinteraction{#1}}
+
+\permanent\protected\def\stopinteraction
+ {\popmacro\currentinteraction}
+
+\permanent\protected\def\setinteraction[#1]%
+ {\def\currentinteraction{#1}}
+
+\defineinteraction % keep it simple
+ [\v!hidden]
+
+\setupinteraction
+ [\v!hidden]
+ [\c!state=\v!start,
+ \c!color=,
+ \c!contrastcolor=,
+ \c!style=,
+ \c!click=\v!off]
+
+%D As long as there a natural feeling of what can be considered
+%D hyper active or not, we have to tell users where they can
+%D possibly click. We've already seen a few macros that deal
+%D with this visualization, something we definitely do not let
+%D up to the viewer. One way of telling is using a distinctive
+%D typeface, another way is using color.
+%D
+%D There are two colors involved: one for normal hyperlinks,
+%D and one for those that point to the currentpage, the
+%D contrast color.
+
+\definecolor [interactioncolor] [r=0, g=.6, b=0]
+\definecolor [interactioncontrastcolor] [r=.8, g=0, b=0]
+
+%D The next few macros are responsible for highlighting hyper
+%D links. The first one, \type{\showlocation}, is used in those
+%D situations where the typeface is handled by the calling
+%D macro.
+
+%D When we're dealing with pure page references, contrast
+%D colors are used when we are already at the page mentioned.
+
+\permanent\protected\def\setlocationcolorspecified#1% not grouped !
+ {\ifnum#1=\plusone
+ \edef\askedcontrastcolor{\interactionparameter\c!contrastcolor}%
+ \ifx\askedcontrastcolor\empty
+ \useinteractioncolorparameter\c!color
+ \else
+ \useinteractioncolorparameter\c!contrastcolor
+ \fi
+ \else % we could just set and if > 0 set again
+ \useinteractioncolorparameter\c!color
+ \fi}
+
+\permanent\protected\def\setlocationattributesspecified#1% not grouped !
+ {\ifnum#1=\plusone
+ \edef\askedcontrastcolor{\interactionparameter\c!contrastcolor}%
+ \ifx\askedcontrastcolor\empty
+ \useinteractionstyleandcolor\c!style\c!color
+ \else
+ \useinteractionstyleandcolor\c!style\c!contrastcolor
+ \fi
+ \else % we could just set and if > 0 set again
+ \useinteractionstyleandcolor\c!style\c!color
+ \fi}
+
+\permanent\protected\def\setlocationcolorspecspecified#1#2% \resolver
+ {\ifnum#1=\plusone
+ \edef\askedcontrastcolor{#2\c!contrastcolor}%
+ \ifx\askedcontrastcolor\empty
+ \colo_helpers_activate{#2\c!color}%
+ \else
+ \colo_helpers_activate\askedcontrastcolor
+ \fi
+ \else
+ \colo_helpers_activate{#2\c!color}%
+ \fi}
+
+\permanent\protected\def\setlocationcolor {\setlocationcolorspecified \referencepagestate}
+\permanent\protected\def\setlocationattributes{\setlocationattributesspecified\referencepagestate}
+\permanent\protected\def\setlocationcolorspec {\setlocationcolorspecspecified \referencepagestate}
+
+\permanent\protected\def\setlocationfont % not grouped !
+ {\useinteractionstyleparameter\c!style}
+
+\setupinteraction
+ [\c!style=\v!bold,
+ \c!color=interactioncolor,
+ \c!contrastcolor=interactioncontrastcolor]
+
+%D Identity
+
+% \def\scrn_identity_synchronize
+% {\clf_setupidentity
+% title {\interactionparameter\c!title}%
+% subtitle {\interactionparameter\c!subtitle}%
+% author {\interactionparameter\c!author}%
+% % creator {ConTeXt - \contextversion}%
+% date {\interactionparameter\c!date}%
+% keywords {\interactionparameter\c!keyword}%
+% \relax}
+
+\newconditional\c_scrn_identity_preroll
+
+\installtexdirective
+ {interaction.identity.preroll}
+ {\settrue \c_scrn_identity_preroll}
+ {\setfalse\c_scrn_identity_preroll}
+
+\def\scrn_identity_prerolled#1%
+ {\begingroup
+ \edef\tempstring{\interactionparameter#1}%
+ \ifx\tempstring\empty
+ \endgroup
+ \else
+ \the\everypreroll
+ \nodestostring\tempstring{\tempstring}%
+ \normalexpanded{\endgroup\setexpandedinteractionparameter{#1}{\tempstring}}%
+ \fi}
+
+\def\scrn_identity_synchronize
+ {\begingroup
+ \ifconditional\c_scrn_identity_preroll
+ \scrn_identity_prerolled\c!title
+ \scrn_identity_prerolled\c!subtitle
+ \scrn_identity_prerolled\c!author
+ \scrn_identity_prerolled\c!date
+ \scrn_identity_prerolled\c!keyword
+ \fi
+ \clf_setupidentity
+ title {\interactionparameter\c!title}%
+ subtitle {\interactionparameter\c!subtitle}%
+ author {\interactionparameter\c!author}%
+ % creator {ConTeXt - \contextversion}%
+ date {\interactionparameter\c!date}%
+ keywords {\interactionparameter\c!keyword}%
+ \relax
+ \endgroup}
+
+\appendtoks
+ \scrn_identity_synchronize
+\to \everysetupinteraction
+
+% this comes before starttext
+
+\def\scrn_identity_document#1#2%
+ {\doifdocumentvariable{metadata:#1}{\setupinteraction[#2=\documentvariable{metadata:#1}]}}
+
+\appendtoks % not interfaced i.e. english
+ \scrn_identity_document {title}\c!title
+ \scrn_identity_document {subject}\c!subtitle
+ \scrn_identity_document{subtitle}\c!subtitle
+ \scrn_identity_document {author}\c!author
+ \scrn_identity_document {authors}\c!author
+ \scrn_identity_document {keyword}\c!keyword
+ \scrn_identity_document{keywords}\c!keyword
+ \scrn_identity_document {date}\c!date
+\to \everystartdocument % or stop
+
+\setupinteraction
+ [\c!title=,
+ \c!subtitle=,
+ \c!author=,
+ \c!keyword=,
+ \c!date=]
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/scrn-pag.mklx b/tex/context/base/mkiv/scrn-pag.mklx
new file mode 100644
index 000000000..ef3923f56
--- /dev/null
+++ b/tex/context/base/mkiv/scrn-pag.mklx
@@ -0,0 +1,310 @@
+%D \module
+%D [ file=scrn-pag,
+%D version=1998.01.15,
+%D title=\CONTEXT\ Screen Macros,
+%D subtitle=Pages, % moved code
+%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.
+
+% pagecomments will be done differently
+
+\writestatus{loading}{ConTeXt Screen Macros / Pages}
+
+\registerctxluafile{scrn-pag}{}
+
+\unprotect
+
+\installcorenamespace{interactionscreen}
+
+\installparameterhandler \??interactionscreen {interactionscreen}
+\installsetuphandler \??interactionscreen {interactionscreen}
+
+\newdimen\canvaswidth
+\newdimen\canvasheight
+\newdimen\canvasbackoffset
+\newdimen\canvastopoffset
+\newdimen\canvasmaxwidth
+\newdimen\canvasmaxheight
+\newdimen\canvascropoffset
+\newdimen\canvastrimoffset
+\newdimen\canvasbleedoffset
+\newdimen\canvasartoffset
+
+\newconditional\c_scrn_canvas_tight_page
+
+\def\scrn_canvas_calculate
+ {\begingroup
+ \edef\currentinteractionscreenwidth {\interactionscreenparameter\c!width }%
+ \edef\currentinteractionscreenheight{\interactionscreenparameter\c!height}%
+ \canvasbackoffset\backspace
+ \canvastopoffset\topspace
+ \donetrue
+ \ifx\currentinteractionscreenwidth\v!max
+ \global\canvaswidth\printpaperwidth
+ \orelse\ifx\currentinteractionscreenwidth\v!fit
+ \donefalse
+ \global\canvaswidth\dimexpr
+ \leftcombitotal
+ + \makeupwidth
+ + \rightcombitotal
+ + 2\dimexpr
+ \interactionscreenparameter\c!backspace
+ + \interactionscreenparameter\c!horoffset
+ \relax
+ \relax
+ \orelse\ifx\currentinteractionscreenwidth\v!tight
+ \donefalse
+ \ifdim\backspace>\canvaswidth
+ \ifdim\backspace>\zeropoint\relax
+ \global\advance\canvasbackoffset -\canvaswidth
+ \fi
+ \fi
+ \global\advance\canvaswidth\dimexpr
+ \makeupwidth
+ + \rightcombitotal
+ + 2\dimexpr
+ \interactionscreenparameter\c!backspace
+ + \interactionscreenparameter\c!horoffset
+ \relax
+ \relax
+ \else
+ \donefalse
+ \global\canvaswidth\currentinteractionscreenwidth
+ \fi
+ \ifx\currentinteractionscreenheight\v!max
+ \global\canvasheight\printpaperheight
+ \orelse\ifx\currentinteractionscreenheight\v!fit
+ \donefalse
+ \global\canvasheight\dimexpr
+ \topheight
+ + \topdistance
+ + \makeupheight
+ + \bottomdistance
+ + \bottomheight
+ + 2\dimexpr
+ \interactionscreenparameter\c!topspace
+ + \interactionscreenparameter\c!veroffset
+ \relax
+ \relax
+ \orelse\ifx\currentinteractionscreenheight\v!tight
+ \donefalse
+ \global\canvasheight\dimexpr\topheight+\topdistance\relax
+ \ifdim\topspace>\canvasheight
+ \ifdim\topspace>\zeropoint\relax
+ \global\advance\canvastopoffset -\canvasheight
+ \fi
+ \fi
+ \global\advance\canvasheight\dimexpr
+ \makeupheight
+ + \bottomdistance
+ + \bottomheight
+ + 2\dimexpr
+ \interactionscreenparameter\c!topspace
+ + \interactionscreenparameter\c!veroffset
+ \relax
+ \relax
+ \else
+ \donefalse
+ \global\canvasheight\currentinteractionscreenheight
+ \fi
+ \ifconditional\c_page_layouts_location_is_set
+ \global\setfalse\c_scrn_canvas_tight_page
+ \fi
+ \ifconditional\c_scrn_canvas_tight_page
+ \global\canvasmaxwidth \paperwidth
+ \global\canvasmaxheight\paperheight
+ \else
+ \global\canvasmaxwidth \printpaperwidth
+ \global\canvasmaxheight\printpaperheight
+ \fi
+ % new:
+ \ifdone
+ \global\canvascropoffset \layoutcropoffset
+ \global\canvastrimoffset \layouttrimoffset
+ \global\canvasbleedoffset\layoutbleedoffset
+ \global\canvasartoffset \layoutartoffset
+ \else
+ \global\canvascropoffset \zeropoint
+ \global\canvastrimoffset \zeropoint
+ \global\canvasbleedoffset\zeropoint
+ \global\canvasartoffset \zeropoint
+ \fi
+ \endgroup}
+
+\newdimen\layoutcropoffset
+\newdimen\layouttrimoffset
+\newdimen\layoutbleedoffset
+\newdimen\layoutartoffset
+
+\appendtoks
+ \edef\p_cropoffset{\layoutparameter\c!cropoffset}%
+ \ifx\p_cropoffset\v!auto
+ \ifconditional\c_page_layouts_location_is_middle
+ \scratchheight\dimexpr(\printpaperheight-\paperheight)/2\relax
+ \scratchwidth \dimexpr(\printpaperwidth -\paperwidth )/2\relax
+ \layoutcropoffset\ifdim\scratchheight>\scratchwidth\scratchheight\else\scratchwidth\fi
+ \layouttrimoffset \layoutparameter\c!trimoffset
+ \layoutbleedoffset\layoutparameter\c!bleedoffset
+ \layoutartoffset \layoutparameter\c!artoffset
+ \else
+ \writestatus\m!system{auto crop etc only supported when location=middle}%
+ \layoutcropoffset \zeropoint
+ \layouttrimoffset \zeropoint
+ \layoutbleedoffset\zeropoint
+ \layoutartoffset \zeropoint
+ \fi
+ \else
+ \layoutcropoffset \layoutparameter\c!cropoffset
+ \layouttrimoffset \layoutparameter\c!trimoffset
+ \layoutbleedoffset\layoutparameter\c!bleedoffset
+ \layoutartoffset \layoutparameter\c!artoffset
+ \fi
+ \relax
+\to \everysetuplayout
+
+\setuplayout
+ [\c!cropoffset=\zeropoint,
+ \c!trimoffset=\zeropoint,
+ \c!bleedoffset=\zeropoint,
+ \c!artoffset=\zeropoint]
+
+% test the next when something is changed here:
+%
+% \setuppapersize[A5][A3] \showframe
+%
+% % \setuplayout[location=middle] \setupinteractionscreen[option=fit]
+% % \setuplayout[location=middle] \setupinteractionscreen[option=auto]
+% % \setupinteractionscreen[option=fit]
+% % \setupinteractionscreen[option=auto]
+%
+% \starttext \input ward \stoptext
+
+\let\scrn_canvas_synchronize_simple \relax
+\let\scrn_canvas_synchronize_complex\relax
+
+\appendtoks
+ \glet\scrn_canvas_synchronize_simple \scrn_canvas_synchronize_simple_indeed
+ \glet\scrn_canvas_synchronize_complex\scrn_canvas_synchronize_complex_indeed
+\to \everysetuplayout
+
+\appendtoks
+ \glet\scrn_canvas_synchronize_simple \scrn_canvas_synchronize_simple_indeed
+ \glet\scrn_canvas_synchronize_complex\scrn_canvas_synchronize_complex_indeed
+\to \everysetuplayouttarget
+
+\def\scrn_canvas_synchronize_only
+ {\clf_setupcanvas
+ paperwidth \printpaperwidth
+ paperheight \printpaperheight
+ \relax}
+
+\def\scrn_canvas_synchronize_set#width#height%
+ {\clf_setupcanvas
+ paperwidth \dimexpr#width\relax
+ paperheight \dimexpr#height\relax
+ \relax}
+
+\let\scrn_canvas_synchronize_reset\scrn_canvas_synchronize_only
+
+\def\scrn_canvas_synchronize_simple_indeed
+ {\scrn_canvas_synchronize_only
+ %\glet\scrn_canvas_synchronize_simple \relax
+ \glet\scrn_canvas_synchronize_complex\relax}
+
+\def\scrn_canvas_synchronize_complex_indeed
+ {\scrn_canvas_calculate % otherwise we need to hook it into setuppage etc
+ \clf_setupcanvas
+ mode {\interactionscreenparameter\c!option}%
+ singlesided \ifsinglesided true\else false\fi\space
+ doublesided \ifdoublesided true\else false\fi\space
+ leftoffset \canvasbackoffset
+ topoffset \canvastopoffset
+ width \canvaswidth
+ height \canvasheight
+ paperwidth \canvasmaxwidth
+ paperheight \canvasmaxheight
+ cropoffset \canvascropoffset
+ trimoffset \canvastrimoffset
+ bleedoffset \canvasbleedoffset
+ artoffset \canvasartoffset
+ copies \numexpr\interactionscreenparameter\c!copies\relax
+ print {\interactionscreenparameter\c!print}%
+ \relax
+ %\glet\scrn_canvas_synchronize_simple \relax
+ \glet\scrn_canvas_synchronize_complex\relax}
+
+\appendtoks
+ \begingroup
+ \edef\p_option{\interactionscreenparameter\c!option}%
+ \ifx\p_option\v!max
+ \global\settrue \c_scrn_canvas_tight_page
+ \orelse\ifx\p_option\v!fit
+ \global\settrue \c_scrn_canvas_tight_page
+ \else
+ \global\setfalse\c_scrn_canvas_tight_page
+ \fi
+ \endgroup
+\to \everysetupinteractionscreen
+
+\setupinteractionscreen
+ [\c!width=\printpaperwidth,
+ \c!height=\printpaperheight,
+ \c!horoffset=\zeropoint,
+ \c!veroffset=\zeropoint,
+ \c!backspace=\backspace,
+ \c!topspace=\topspace,
+ \c!copies=\plusone, % not the best place but backend anyway
+ \c!option=\v!auto]
+
+\appendtoks
+ \glet\scrn_canvas_synchronize_simple \scrn_canvas_synchronize_simple_indeed
+ \glet\scrn_canvas_synchronize_complex\scrn_canvas_synchronize_complex_indeed
+\to \everysetupinteractionscreen
+
+%D Conditional page breaks:
+
+\permanent\tolerant\protected\def\screen[#list]%
+ {\iflocation
+ \page[#list]%
+ \fi}
+
+%D Page transitions:
+
+\let\scrn_transitions_list\empty
+
+\permanent\tolerant\protected\def\setuppagetransitions[#list]%
+ {\edef\scrn_transitions_list{#list}%
+ \ifx\scrn_transitions_list\v!reset
+ \let\scrn_transitions_list\empty
+ \fi}
+
+\def\scrn_transitions_set
+ {\iflocation \ifx\scrn_transitions_list\empty \else
+ \scrn_transitions_set_indeed
+ \fi \fi}
+
+\def\scrn_transitions_set_indeed
+ {\begingroup
+ \edef\currentinteractionscreendelay{\interactionscreenparameter\c!delay}%
+ \clf_setpagetransition
+ n {\scrn_transitions_list}%
+ delay \ifx\currentinteractionscreendelay\v!none \zerocount\else\currentinteractionscreendelay\fi
+ \relax
+ \endgroup}
+
+\prependtoks
+ \scrn_transitions_set
+\to \everyshipout
+
+\setupinteractionscreen
+ [\c!delay=\v!none]
+
+\setuppagetransitions
+ [\v!reset]
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/spac-ali.mkxl b/tex/context/base/mkiv/spac-ali.mkxl
index a41c99410..4f3e951fa 100644
--- a/tex/context/base/mkiv/spac-ali.mkxl
+++ b/tex/context/base/mkiv/spac-ali.mkxl
@@ -574,8 +574,8 @@
}}% kept, nice for tracing
\edef\raggedcommand {\the\t_spac_align_collected }%
\edef\updateraggedskips{\spac_align_flush_horizontal}%
- \expandafter\glet\csname\??alignmentnormalcache\m_spac_align_asked\endcsname\raggedcommand
- \expandafter\glet\csname\??alignmentraggedcache\m_spac_align_asked\endcsname\updateraggedskips}
+ \global\letcsname\??alignmentnormalcache\m_spac_align_asked\endcsname\raggedcommand
+ \global\letcsname\??alignmentraggedcache\m_spac_align_asked\endcsname\updateraggedskips}
\def\spac_align_collect#1%
{\csname\??aligncommand#1\endcsname}
diff --git a/tex/context/base/mkiv/spac-hor.mkxl b/tex/context/base/mkiv/spac-hor.mkxl
index 9576549d1..3d9729916 100644
--- a/tex/context/base/mkiv/spac-hor.mkxl
+++ b/tex/context/base/mkiv/spac-hor.mkxl
@@ -506,6 +506,8 @@
\let\softhyphen\explicitdiscretionary
\fi
+% todo:
+
\cldcontext{"\string\\protected\string\\def\string\\\string\n{\string\\space}"}
%cldcontext{"\string\\let\string\\\string\n=\string\\space"}
@@ -1001,7 +1003,8 @@
\installcorenamespace{hspace}
\permanent\protected\def\ignorecrlf
- {\let\crlf\justonespace\let\\\crlf}
+ {\enforced\let\crlf\justonespace
+ \enforced\let\\\crlf}
\permanent\protected\def\definehspace
{\dotripleempty\spac_hspaces_define}
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 4fa535e4f..5c22acd41 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 2bbbcb551..0b64f35bb 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-des.mklx b/tex/context/base/mkiv/strc-des.mklx
index e6525448c..11fca5869 100644
--- a/tex/context/base/mkiv/strc-des.mklx
+++ b/tex/context/base/mkiv/strc-des.mklx
@@ -155,9 +155,9 @@
%D Handlers:
-\expandafter\let\csname\??constructionmainhandler \v!description\expandafter\endcsname\csname\??constructionmainhandler \v!construction\endcsname
-\expandafter\let\csname\??constructioncommandhandler\v!description\expandafter\endcsname\csname\??constructioncommandhandler\v!construction\endcsname
-\expandafter\let\csname\??constructiontexthandler \v!description\expandafter\endcsname\csname\??constructiontexthandler \v!construction\endcsname
+\letcsname\??constructionmainhandler \v!description\expandafter\endcsname\csname\??constructionmainhandler \v!construction\endcsname
+\letcsname\??constructioncommandhandler\v!description\expandafter\endcsname\csname\??constructioncommandhandler\v!construction\endcsname
+\letcsname\??constructiontexthandler \v!description\expandafter\endcsname\csname\??constructiontexthandler \v!construction\endcsname
\protected\setvalue{\??constructioncommandhandler\v!description}%
{\dowithpar
diff --git a/tex/context/base/mkiv/strc-enu.mklx b/tex/context/base/mkiv/strc-enu.mklx
index 66d8390f9..011bbedf9 100644
--- a/tex/context/base/mkiv/strc-enu.mklx
+++ b/tex/context/base/mkiv/strc-enu.mklx
@@ -248,10 +248,10 @@
\disablepseudocaps % sorry, uppercase causes troubles
\to \everyenumeration
-\expandafter\let\csname\??constructionmainhandler \v!enumeration\expandafter\endcsname\csname\??constructionmainhandler \v!description\endcsname
-\expandafter\let\csname\??constructioncommandhandler\v!enumeration\expandafter\endcsname\csname\??constructioncommandhandler\v!description\endcsname
-\expandafter\let\csname\??constructionstarthandler \v!enumeration\expandafter\endcsname\csname\??constructionstarthandler \v!description\endcsname
-\expandafter\let\csname\??constructionstophandler \v!enumeration\expandafter\endcsname\csname\??constructionstophandler \v!description\endcsname
+\letcsname\??constructionmainhandler \v!enumeration\expandafter\endcsname\csname\??constructionmainhandler \v!description\endcsname
+\letcsname\??constructioncommandhandler\v!enumeration\expandafter\endcsname\csname\??constructioncommandhandler\v!description\endcsname
+\letcsname\??constructionstarthandler \v!enumeration\expandafter\endcsname\csname\??constructionstarthandler \v!description\endcsname
+\letcsname\??constructionstophandler \v!enumeration\expandafter\endcsname\csname\??constructionstophandler \v!description\endcsname
\protected\setvalue{\??constructiontexthandler\v!enumeration}%
{\begingroup
diff --git a/tex/context/base/mkiv/strc-flt.mklx b/tex/context/base/mkiv/strc-flt.mklx
new file mode 100644
index 000000000..bbe027fd2
--- /dev/null
+++ b/tex/context/base/mkiv/strc-flt.mklx
@@ -0,0 +1,2599 @@
+%D \module
+%D [ file=strc-flt,
+%D version=2008.10.20,
+%D title=\CONTEXT\ Structure Macros,
+%D subtitle=Float Numbering,
+%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.
+
+%D This module will be redone with conditionals and everythings
+
+\writestatus{loading}{ConTeXt Structure Macros / Float Numbering}
+
+\registerctxluafile{strc-flt}{}
+
+\unprotect
+
+% todo: a keyword for this (and then a settings->hash for speed)
+%
+% \setuplayout[width=middle,backspace=3cm]
+%
+% \appendtoks
+% \settrue\inhibitmargindata
+% \to \everyinsidefloat
+%
+% \starttext
+% \dorecurse{20}{
+% \par \inleft{\red\infofont<#1>} \par
+% \placefigure[leftmargin]{}{\framed[height=1cm,width=2cm]{}}
+% % \placefigure{#1}{\framed[height=1cm,width=2cm]{}}
+% \par line #1.1 \par line #1.2 \par
+% }
+% \stoptext
+
+% todo: delay caption creation and make setups for each method instead
+% so that we can have a list of methods and redo them as we can
+% keep the list or even better: recreate it
+%
+% todo: strc_floats_analyze_variables_two could trigger a setup
+% and we could have nofmethods of them
+%
+% todo: move variables from page-flt to strc-flt
+%
+% todo: p_name etc
+%
+% todo: less globals!
+%
+% todo: do all options in lua
+
+%D This module is being converted into a mkvi one.
+%D
+%D - rename macros
+%D - get rid of dead code
+%D - less gobal mess
+%D - more mkiv-ish
+
+\installcorenamespace{float}
+\installcorenamespace{floatbuilder}
+\installcorenamespace{floatcaption}
+\installcorenamespace{floatframed}
+
+\installframedcommandhandler \??float {float} \??float
+\installframedcommandhandler \??floatcaption {floatcaption} \??floatcaption
+\installframedcommandhandler \??floatframed {floatframed} \??floatframed
+
+\aliased\let\setupfloats \setupfloat
+\aliased\let\setupcaption \setupfloatcaption
+\aliased\let\setupcaptions\setupfloatcaption
+
+\permanent\protected\def\dohandlenextfloatindent
+ {\useindentnextparameter\floatparameter
+ \dorechecknextindentation}
+
+\setupcaptions
+ [\c!location=\v!bottom,
+ \c!grid=,
+ \c!before=, % not used (yet)
+ \c!inbetween={\blank[\v!medium]},
+ \c!after=, % not used (yet)
+ \c!spacebefore=,
+ \c!spaceinbetween=, % replaces fuzzy inbetween dual usage
+ \c!spaceafter=,
+ \c!width=\v!fit,
+ \c!minwidth=\v!fit, % id est: the width of the floatbox in some cases
+ \c!headstyle=\v!bold,
+ \c!headcolor=,
+ \c!leftmargin=\zeropoint,
+ \c!rightmargin=\zeropoint,
+ \c!outermargin=\zeropoint,
+ \c!innermargin=\zeropoint,
+ \c!setups=,
+ \c!style=\v!normal,
+ \c!color=,
+ \c!textstyle=,
+ \c!textcolor=,
+ \c!align=,
+ \c!number=\v!yes,
+ \c!offset=\v!overlay,
+ \c!frame=\v!off,
+ % \c!expansion=,
+ % \c!prefix=,
+ % \c!prefixconnector=,
+ % \c!way=,
+ % \c!prefixsegments=,
+ % \c!way=,
+ % \c!blockway=,
+ % \c!sectionnumber=,
+ % \c!separator=,
+ % \c!starter=,
+ % \c!stopper=,
+ \c!suffixseparator=, % currently rather hard coded
+ \c!suffix=\floatcaptionsuffix,
+ \c!distance=\emwidth, % plus .5\emwidth minus .25\emwidth
+ \c!conversion=\v!numbers,
+ \c!maxwidth=\hsize,
+ \c!command=]
+
+% we can comment some of these
+
+\setupfloats
+ [\c!location=\v!middle,
+ \c!width=8\lineheight,
+ \c!height=6\lineheight,
+ \c!offset=\v!overlay,
+ \c!frame=\v!off,
+ \c!strut=\v!no,
+ \c!radius=.5\bodyfontsize,
+ \c!corner=\v!rectangular,
+ \c!grid=,
+ %\c!background=,
+ %\c!backgroundcolor=,
+ \c!backgroundoffset=\!!zeropoint,
+ %\c!topframe=,
+ %\c!bottomframe=,
+ %\c!leftframe=,
+ %\c!rightframe=,
+ \c!frameoffset=\!!zeropoint,
+ %\c!before=,
+ %\c!after=,
+ \c!spacebefore=\v!big,
+ \c!spaceafter=\v!big,
+ \c!sidespacebefore=\rootfloatparameter\c!spacebefore,
+ \c!sidespaceafter=\rootfloatparameter\c!spaceafter,
+ \c!sidespaceinbetween=\rootfloatparameter\c!spacebefore,
+ \c!spacebeforeside=, % extra, not part of, can be used to add whitespace before text
+ \c!spaceafterside=, % idem
+ \c!sidealign=\v!normal,
+ \c!textmethod=\ifgridsnapping2\else0\fi, % 0=raw 1=safe (.99pg) 2=tight (-1pt) % THIS WILL CHANGE
+ \c!sidemethod=\ifgridsnapping2\else1\fi, % 0=raw 1=safe (.99pg) 2=tight (-1pt) % THIS WILL CHANGE
+ \c!indentnext=\v!no,
+ \c!margin=\emwidth,
+ \c!method=1,
+ \c!cache=\v!yes, % when no, then intermediate flush
+ \c!leftmargin=\zeropoint, % displacement in 'normal floats'
+ \c!rightmargin=\zeropoint, % idem
+ \c!innermargin=\zeropoint, % idem
+ \c!outermargin=\zeropoint, % idem
+ \c!leftmargindistance=\zeropoint,
+ \c!rightmargindistance=\floatparameter\c!leftmargindistance,
+ \c!step=\v!small, % the flush side float step (big, medium, small : always depth)
+ \c!ntop=2,
+ \c!nbottom=0,
+ \c!nlines=4, % used?
+ \c!topoffset=\zeropoint,
+ \c!bottomoffset=\zeropoint,
+ \c!freeregion=\v!yes,
+ %\c!local=,
+ %\c!bottombefore=, % e.g. \vfill
+ %\c!bottomafter=,
+ %\c!default=, % default location
+ \c!sidethreshold=.5\strutdp, % set to "old" to check with old method
+ \c!numbering=\v!yes,
+ \c!compress=\v!yes, % when possible pack floats when flushing
+ \c!compressdistance=\emwidth]
+
+\setupfloatframed
+ [\c!frame=\v!off,
+ \c!offset=\v!overlay,
+ \c!strut=\v!no]
+
+\appendtoks
+ \doifelse{\floatparameter\c!compress}\v!yes\settrue\setfalse\c_page_floats_pack_flushed
+ \d_page_floats_compress_distance\floatparameter\c!compressdistance\relax
+\to \everysetupfloat
+
+%D We need to do it again here:
+
+\setupfloat
+ [\c!compress=\v!yes, % when possible pack floats when flushing
+ \c!compressdistance=\emwidth]
+
+%D Individial settings:
+
+\installcounterassociation{floatcaption}
+
+\appendtoks
+ \let\currentfloat\currentfloatcaption % ?
+ \synchronizefloatcaptioncounters
+\to \everysetupfloatcaption
+
+\appendtoks
+ \let\currentfloat\currentfloatcaption % ?
+ \synchronizefloatcaptioncounters
+\to \everydefinefloatcaption
+
+%D Definitions:
+
+\let\strc_floats_define_saved\definefloat
+
+\permanent\tolerant\protected\overloaded\def\definefloat[#1]#*[#2]#*[#3]% name+plural+parent | name+parent+settings
+ {\ifarguments\or
+ \strc_floats_define_c[#1][#1]%
+ \or
+ \doifelsecommandhandler\??float{#2}%
+ {\strc_floats_define_a[#1][#1][#2]}%
+ {\strc_floats_define_c[#1][#2]}%
+ \orelse\ifhastok={#3}%
+ \strc_floats_define_b[#1][#2][#3]%
+ \else
+ \strc_floats_define_a[#1][#2][#3]%
+ \fi}
+
+\def\strc_floats_define_a[#1][#2][#3]% name names parent
+ {\definefloatcaption[#1][#3]%
+ \definefloatframed[#1][#3]%
+ \definecounter[#1][#3]%
+ \definelist[#1][#3]%
+ \copylabeltext[#1=#3]%
+ \strc_floats_define_saved[#1][#3]%
+ \strc_floats_define_commands{#1}{#2}}
+
+\def\strc_floats_define_b[#1][#2][#3]% name parent settings
+ {\definefloatcaption[#1][#2]%
+ \definefloatframed[#1][#2]%
+ \definecounter[#1][#2]%
+ \definelist[#1][#2]%
+ \copylabeltext[#1=#2]%
+ \strc_floats_define_saved[#1][#2][#3]%
+ \strc_floats_define_commands{#1}{#1}}
+
+\def\strc_floats_define_c[#1][#2]% name names
+ {\registerfloatcaptioncounter{#1}%
+ \definefloatcaption[#1]%
+ \definefloatframed[#1]%
+ \definecounter[#1]%
+ \definelist[#1]%
+ \presetlabeltext[#1=\Word{#1}~]%
+ \presetheadtext[#2=\Word{#2}]%
+ \strc_floats_define_saved[#1]%
+ \strc_floats_define_commands{#1}{#2}}
+
+\def\strc_floats_define_commands#1#2%
+ {\setuvalue {\e!place\e!listof#2}{\dodoubleempty\strc_lists_place[#1]}% call will change
+ \setuvalue {\e!complete\e!listof#2}{\dotripleempty\strc_lists_complete_indeed[#1][#2]}% call will change
+ \setuevalue {\e!place#1}{\strc_floats_place[#1]}%
+ \setuevalue {\e!start\e!place#1}{\strc_floats_start_place[#1]}%
+ \setuevalue {\e!stop\e!place#1}{\strc_floats_stop_place}%
+ \setuevalue {\e!start#1\e!text}{\strc_floats_start_text[#1]}%
+ \setuevalue {\e!stop#1\e!text}{\strc_floats_stop_text}%
+ % these will become obsolete:
+ \setuevalue {\e!reserve#1}{\strc_floats_reserve[#1]}%
+ \setuevalue{\e!start\e!reserve#1\e!text}{\strc_floats_start_reserve_text[#1]}%
+ \setuevalue {\e!stop\e!reserve#1\e!text}{\strc_floats_stop_reserve_text}}
+
+%D Fallback float body:
+
+\protected\def\strc_floats_place_empty_box % \inheritedfloatframed
+ {\framed
+ [\c!frame=\v!on,
+ \c!width=\rootfloatparameter\c!width,
+ \c!height=\rootfloatparameter\c!height,
+ \c!location=\v!normal,
+ \c!offset=\rootfloatparameter\c!offset]%
+ {\getmessage\m!floatblocks{12}\empty}}
+
+%D Data. We can generalize this to lists.
+
+\newif\ifnofloatcaption
+\newif\ifnofloatnumber
+\newif\ifemptyfloatcaption
+
+\installstructurelistprocessor\s!float{\usestructurelistprocessor{number+title}}
+
+\permanent\protected\def\thecurrentfloatnumbersuffix
+ {\doifsomething{\floatcaptionparameter\c!suffix}
+ {\floatcaptionparameter\c!suffixseparator
+ \floatcaptionparameter\c!suffix
+ \floatcaptionparameter\c!suffixstopper}}
+
+\permanent\protected\def\thecurrentfloatnumber
+ {\ifnofloatcaption \orelse \ifnofloatnumber \orelse \ifx\currentfloatnumber\relax \else
+ \namedtaggedlabeltexts
+ \t!floatlabel \currentfloat
+ \t!floatnumber\currentfloat
+ {\begstrut
+ \floatcaptionparameter\c!numbercommand
+ {\clf_savedlistprefixednumber{\currentfloat}\currentfloatnumber\relax
+ \thecurrentfloatnumbersuffix}%
+ \endstrut}%
+ \fi}
+
+\permanent\protected\def\thecurrentfloatcaption
+ {\ifnofloatcaption \orelse \ifemptyfloatcaption \orelse \ifx\currentfloatnumber\relax \else
+ \dostarttagged\t!floattext\empty
+ \begstrut
+ \floatcaptionparameter\c!textcommand
+ {\clf_savedlisttitle{\currentfloat}\numexpr\currentfloatnumber\relax}%
+ \endstrut
+ \dostoptagged
+ \fi}
+
+%D Captions.
+
+\let\floatcaptionsuffix\empty % an optional suffix
+\let\floatcaptionnumber\empty % a logical counter
+
+% For a while these were placeholders:
+%
+%D \starttyping
+%D \protected\def\placefloatcaption{\dodoubleempty\strc_floats_place_caption}
+%D \protected\def\setfloatcaption {\dodoubleempty\strc_floats_set_caption}
+%D
+%D \def\strc_floats_place_caption[#tag][#reference]#caption{[not supported]}
+%D \def\strc_floats_set_caption [#tag][#reference]#caption{[not supported]}
+%D
+%D \protected\def\placefloatcaptiontext [#tag]{[not suported yet]}
+%D \protected\def\placefloatcaptionnumber [#tag]{[not suported yet]}
+%D \protected\def\placefloatcaptionreference[#tag]{[not suported yet]}
+%D \stoptyping
+%D
+%D because in \MKII\ we had:
+%D
+%D \starttyping
+%D \let\placefloatlabel \placefloatcaption
+%D \let\placefloatlabeltext \placefloatcaptiontext
+%D \let\placefloatlabelreference\placefloatcaptionreference
+%D \stoptyping
+%D
+%D But as it was never advertised we don't provide it in \MKIV. However, at some
+%D point HvdM wanted this:
+%D
+%D \starttyping
+%D \placefigure {labeltext-1} {\externalfigure[figure-1]}
+%D \placefloatcaption[figure][title={labeltext-2}] \externalfigure[figure-2]
+%D \placefigure {labeltext-3} {\externalfigure[figure-3]}
+%D \stoptyping
+%D
+%D So there you have it:
+
+\permanent\tolerant\protected\def\placefloatcaption[#category]#spacer[#settings]#spacer[#userdata]%
+ {\ifarguments\or\else % >= 2
+ % we need at least a category and title
+ \dontleavehmode
+ \bgroup
+ \edef\currentfloat{#category}%
+ \let\currentfloatcaption\currentfloat
+ \resetfloatcaptionparameter\c!reference
+ \resetfloatcaptionparameter\c!title
+ \resetfloatcaptionparameter\c!marking
+ \resetfloatcaptionparameter\c!list
+ \resetfloatcaptionparameter\c!bookmark
+ \setupcurrentfloatcaption[#settings]%
+ \edef\currentfloatcounter{\namedcounterparameter\currentfloat\s!name}%
+ \iftrialtypesetting\strc_counters_save\currentfloatcounter\fi
+ \strc_counters_increment\currentfloatcounter
+ \strc_counters_register_component
+ \s!float
+ \setupcurrentfloatcaption
+ \floatcaptionparameter
+ \detokenizedfloatcaptionparameter
+ \relax
+ \relax
+ \relax
+ [\s!name=\currentfloat,
+ \s!counter=\currentfloatcounter,%
+ \s!hascaption=\v!yes,%
+ \s!hasnumber=\v!yes,%
+ \s!hastitle=\v!yes]%
+ [#userdata]%
+ \glet\previousfloatnumber \m_strc_counters_last_registered_index
+ \glet\currentfloatnumber \m_strc_counters_last_registered_index
+ \glet\currentfloatattribute \m_strc_counters_last_registered_attribute
+ \glet\currentfloatsynchronize\m_strc_counters_last_registered_synchronize
+ %
+ % \iflocation
+ % \c_attr_destination\currentfloatattribute\relax
+ % \fi
+ \currentfloatsynchronize
+ \strc_floats_make_complete_caption
+ %
+ \iftrialtypesetting\strc_counters_restore\currentfloatcounter\fi
+ \egroup
+ \fi}
+
+\newbox \b_strc_floats_caption
+\newbox \b_strc_floats_content
+\newdimen\d_strc_floats_caption_height
+\newdimen\d_strc_floats_caption_depth
+
+\def\strc_floats_make_complete_caption
+ {\doifsomething{\floatcaptionparameter\c!spacebefore}{\blank[\floatcaptionparameter\c!spacebefore]}%
+ \strc_floats_make_complete_caption_before
+ \synchronizedisplaydirection % temp hack, till we have a proper model
+ \noindent
+ \gdef\lastcaptiontag{\strut\thecurrentfloatnumber}% was xdef ... needs checking
+ \begingroup
+ \ifnofloatcaption
+ \global\d_strc_floats_caption_height\zeropoint
+ \global\d_strc_floats_caption_depth \zeropoint
+ \else
+ \usefloatcaptionstyleandcolor\c!style\c!color
+ \clf_doifelselisthastitle{\currentfloat}\numexpr\currentfloatnumber\relax
+ \donothing
+ \emptyfloatcaptiontrue
+ \ifnofloatnumber \orelse \ifnofloatcaption \else
+ \ifemptyfloatcaption
+ \hbox{\usefloatcaptionstyleandcolor\c!headstyle\c!headcolor\thecurrentfloatnumber}%
+ \else
+ \doifelsenothing{\floatcaptionparameter\c!spaceinbetween}
+ {\scratchskip\floatcaptionparameter\c!distance\relax
+ \setbox\scratchbox\hbox
+ {\usefloatcaptionstyleandcolor\c!headstyle\c!headcolor
+ \thecurrentfloatnumber
+ \floatcaptionparameter\c!headseparator
+ \dotfskip\scratchskip}%
+ \doifelse{\floatcaptionparameter\c!hang}\v!yes
+ {\leftskip\wd\scratchbox
+ \llap{\box\scratchbox}}
+ {\unhbox\scratchbox}%
+ \emergencystretch.5\scratchskip}
+ {\hbox{\usefloatcaptionstyleandcolor\c!headstyle\c!headcolor\thecurrentfloatnumber}%
+ \blank[\floatcaptionparameter\c!spaceinbetween]}%
+ \fi
+ \fi
+ \usefloatcaptionstyleandcolor\c!textstyle\c!textcolor
+ \global\d_strc_floats_caption_height\strutheight
+ \global\d_strc_floats_caption_depth \strutdepth
+ \thecurrentfloatcaption\endgraf
+ \fi
+ \endgroup
+ \strc_floats_make_complete_caption_after
+ \doifsomething{\floatcaptionparameter\c!spaceafter}{\blank[\floatcaptionparameter\c!spaceafter]}}
+
+%let\strc_floats_make_complete_caption_before\relax
+\let\strc_floats_make_complete_caption_after \relax
+
+\def\strc_floats_make_complete_caption_before
+ {\doifelseframed\floatcaptionparameter\strc_floats_make_complete_caption_before_indeed\relax}
+
+\def\strc_floats_make_complete_caption_before_indeed
+ {\edef\m_strc_align{\floatcaptionparameter\c!align}%
+ \edef\m_strc_strut{\floatcaptionparameter\c!strut}%
+ \letfloatcaptionparameter\c!align\v!normal
+ \letfloatcaptionparameter\c!strut\v!no
+ \inheritedfloatcaptionframed
+ \bgroup
+ \letfloatcaptionparameter\c!align\m_strc_align
+ \letfloatcaptionparameter\c!strut\m_strc_strut
+ \let\strc_floats_make_complete_caption_after\egroup}
+
+% \definefloat [figure-1] [figure]
+% \definefloat [figure-2] [figure]
+% \setupfloat [figure-1] [location=left,leftmargin=10mm]
+% \setupfloat [figure-2] [location=left,leftmargin=-5mm]
+% \setupcaption [figure-1] [align=flushleft]
+% \setupcaption [figure-2] [align=flushleft,leftmargin=15mm]
+%
+% \startsetups somefigure
+% \ifdim\wd\nextbox>\textwidth
+% \placefloat[figure-2][][]{}{\box\nextbox}
+% \else
+% \placefloat[figure-1][][]{}{\box\nextbox}
+% \fi
+% \stopsetups
+%
+% \protected\def\setupswithbox[#1]{\dowithnextbox{\setups[#1]}\vbox}
+%
+% test \setupswithbox[somefigure]{\framed[width=3cm] {}} test
+% test \setupswithbox[somefigure]{\framed[width=\dimexpr\textwidth+3cm\relax]{}} test
+
+% temporary removed ... was not applied systematically
+%
+% \def\dosetcaptionthings
+% {\usesetupsparameter\floatcaptionparameter}
+
+\def\strc_floats_check_caption_content
+ {\ifnofloatcaption\else
+ \setbox\b_strc_floats_caption\hbox
+ {\settrialtypesetting
+ \notesenabledfalse
+ \strc_floats_make_complete_caption}%
+ % new, \placefigure{\xmlfirst{#1}{somecaption}}{} passes earlier empty check
+ % so here we misuse the scratch box; actually this means that the previous
+ % test can go away (some day, when i redo this module)
+ \ifzeropt\wd\b_strc_floats_caption
+ \global\emptyfloatcaptiontrue
+ \ifnofloatnumber
+ \global\nofloatcaptiontrue
+ \fi
+ \else
+ \global\emptyfloatcaptionfalse
+ \setbox\b_strc_floats_caption\hpack{\hskip\leftskip\box\b_strc_floats_caption}%
+ \fi
+ \fi}
+
+%D We can do this ...
+%D
+%D \starttyping
+%D \newcount\c_strc_floats_n
+%D
+%D \definedataset[\s!float][\c!delay=\v!yes]
+%D
+%D \let\strc_float_realpage\realpageno
+%D
+%D \def\strc_float_save_data
+%D {\setdataset[\s!float][\number\c_strc_floats_n][]}
+%D
+%D \def\strc_float_load_data % precedes save !
+%D {\global\advance\c_strc_floats_n\plusone
+%D \xdef\strc_float_realpage{\datasetvariable\s!float{\number\c_strc_floats_n}\s!page}%
+%D \ifx\strc_float_realpage\empty
+%D \glet\strc_float_realpage\realpageno % \realfolio
+%D \fi}
+%D \stoptyping
+%D
+%D ... but this is more efficient:
+
+\definepagestate[\s!float][\c!delay=\v!yes]
+
+\newcount\c_strc_floats_n
+
+\let\strc_float_realpage\realpageno
+
+\def\strc_float_save_data
+ {\setpagestate[\s!float][\number\c_strc_floats_n]}
+
+\def\strc_float_load_data % precedes save !
+ {\global\advance\c_strc_floats_n\plusone
+ \xdef\strc_float_realpage{\pagestaterealpage\s!float{\number\c_strc_floats_n}}%
+ \ifempty\strc_float_realpage
+ \glet\strc_float_realpage\realpageno % \realfolio
+ \fi}
+
+%D test case:
+%D
+%D \starttyping
+%D \setupfloat[figure][criterium=\marginwidth,fallback=bottom]
+%D \dorecurse{3}{
+%D \chapter{test}
+%D \placefigure[bottom]{1}{\framed{bottom}}
+%D test
+%D \placetable[bottom]{1}{\framed{table}}
+%D test
+%D \placetable{2}{\framed{table}}
+%D test
+%D \placefigure[left]{2}{\framed{left but way too wide}}
+%D \input tufte
+%D \placefigure[left]{3}{\framed{left but ok}}
+%D \input tufte }
+%D \stoptyping
+
+% A complication is that we may have to handle a pagebreak first, which in turn may
+% issue a (postponed) float. Therefore we may not trust on variable assignments
+% before we're really dealing with the float. Some day I'll root out the global
+% settings.
+
+\let\lastplacedfloat\empty
+
+\def\strc_floats_set_current_tag#tag%
+ {\edef\currentfloat{#tag}%
+ \ifx\currentfloat\empty
+ \let\currentfloat\v!figure % a bit of a hack
+ \fi
+ \doifelsecommandhandler\??float\currentfloat
+ \donothing
+ {\writestatus\m!floatblocks{unknown float type '\currentfloat'}%
+ \let\currentfloat\v!figure}% also a hack
+ \glet\lastplacedfloat\currentfloat
+ \let\m_strc_floats_saved_userdata\empty
+ \let\currentfloatcaption\currentfloat}
+
+\let\askedfloatmethod \empty
+\let\askedfloatoptions\empty
+
+\def\strc_floats_reset_variables
+ {\global\emptyfloatcaptionfalse
+ \global\nofloatcaptionfalse
+ \global\nofloatnumberfalse
+ \glet\askedfloatmethod \empty
+ \glet\askedfloatoptions\empty}
+
+% place
+
+\let\floatlabel \empty
+\let\floatcolumn \empty
+\let\floatrow \empty
+\let\floatlocation \empty
+\let\floatlocationmethod\empty
+
+\def\strc_floats_analyze_location
+ {% more will be moved here
+ \let\floatlabel \empty
+ \let\floatcolumn\empty
+ \let\floatrow \empty
+ %
+ \edef\floatcaptionlocation{\floatcaptionparameter\c!location}%
+ %
+ \setfloatmethodvariables\floatlocation}
+
+\newtoks\c_floats_every_table_float
+
+\appendtoks
+ \edef\floatlocation{\v!force,\v!always,\floatlocation}%
+ \setupfloat[\c!spacebefore=\v!none,\c!spaceafter=\v!none]%
+\to \c_floats_every_table_float
+
+\ifdefined\dotagregisterfloat \else \let\dotagregisterfloat\gobbletwoarguments \fi
+
+\protected\def\strc_floats_place
+ {\flushnotes
+ \page_otr_command_flush_side_floats % here !
+ \strc_floats_begin_group
+ \strc_floats_place_indeed}
+
+\tolerant\def\strc_floats_place_indeed[#tag]#spacer[#location]#spacer[#reference]#:#caption%
+ {\strc_floats_set_current_tag{#tag}%
+ \strc_floats_reset_variables
+ \xdef\askedfloatoptions{#location}%
+ \edef\floatlocation{#location}%
+ \ifempty\floatlocation
+ \edef\floatlocation{\floatparameter\c!default}% beware of a clash between alignment locations
+ \fi
+ \ifintable
+ \the\c_floats_every_table_float
+ \fi
+ \strc_floats_analyze_location
+ % todo: use \lets
+ \setupcurrentfloatcaption[\c!reference={#reference},\c!title={#caption},\c!marking=,\c!list=,\c!bookmark=]%
+ \doifelseinset\v!split\floatlocation\strc_floats_place_next_box_split\strc_floats_place_next_box_normal}
+
+\permanent\protected\def\placefloat% [#tag]%
+ {\flushnotes
+ \page_otr_command_flush_side_floats % here !
+ \strc_floats_begin_group
+ \strc_floats_place_indeed}
+
+% start-stop
+
+% \startplacefigure[title=oeps][subtitle=whatever]
+% \framed[width=10cm,height=5cm]{\floatuserdataparameter{subtitle}}
+% \stopplacefigure
+
+\installcorenamespace{floatuserdata}
+
+\installsetuponlycommandhandler \??floatuserdata {floatuserdata}
+
+\let\m_strc_floats_saved_userdata\empty % todo: reset this in non start|stop cases
+
+\protected\def\strc_floats_start_place
+ {\flushnotes
+ \page_otr_command_flush_side_floats % here !
+ \strc_floats_begin_group
+ \strc_floats_start_place_indeed}
+
+%D We abuse the settings to pick up some float parameters too which makes it
+%D messy.
+
+\tolerant\protected\def\strc_floats_start_place_indeed[#tag]#spacer[#settings]#spacer[#userdata]%
+ {\strc_floats_set_current_tag{#tag}%
+ \strc_floats_reset_variables
+ % save
+ \edef\m_location {\floatcaptionparameter\c!location}%
+ \edef\m_topoffset {\floatcaptionparameter\c!topoffset}%
+ \edef\m_bottomoffset{\floatcaptionparameter\c!bottomoffset}%
+ \edef\m_freeregion {\floatcaptionparameter\c!freeregion}%
+ % preset
+ \letfloatcaptionparameter \c!location \empty
+ \setexpandedfloatcaptionparameter\c!topoffset {\floatparameter\c!topoffset}%
+ \setexpandedfloatcaptionparameter\c!bottomoffset{\floatparameter\c!bottomoffset}%
+ \setexpandedfloatcaptionparameter\c!freeregion {\floatparameter\c!freeregion}%
+ \letfloatcaptionparameter \c!reference \empty
+ \letfloatcaptionparameter \c!title \empty
+ \letfloatcaptionparameter \c!marking \empty
+ \letfloatcaptionparameter \c!list \empty
+ \letfloatcaptionparameter \c!bookmark \empty
+ % pickup
+ \ifparameter#settings\or
+ \setupcurrentfloatcaption[#settings]%
+ \fi
+ \ifparameter#userdata\or
+ \setupcurrentfloatuserdata[#userdata]%
+ \def\m_strc_floats_saved_userdata{#userdata}%
+ \else
+ \let\m_strc_floats_saved_userdata\empty
+ \fi
+ % check
+ \edef\floatlocation{\floatcaptionparameter\c!location}%
+ \ifx\floatlocation\empty
+ \edef\floatlocation{\floatparameter\c!default}%
+ \fi
+ % inherit
+ \setexpandedfloatparameter\c!topoffset {\floatcaptionparameter\c!topoffset}%
+ \setexpandedfloatparameter\c!bottomoffset{\floatcaptionparameter\c!bottomoffset}%
+ \setexpandedfloatparameter\c!freeregion {\floatcaptionparameter\c!freeregion}%
+ % restore
+ \letfloatcaptionparameter\c!location \m_location
+ \letfloatcaptionparameter\c!topoffset \m_topoffset
+ \letfloatcaptionparameter\c!bottomoffset\m_bottomoffset
+ \letfloatcaptionparameter\c!freeregion \m_freeregion
+ %
+ \strc_floats_analyze_location
+ \doifelseinset\v!split\floatlocation\strc_floats_place_next_box_split\strc_floats_place_next_box_normal
+ \bgroup
+ \ignorespaces}
+
+\protected\def\strc_floats_stop_place
+ {\removeunwantedspaces
+ \egroup}
+
+\permanent\protected\def\startplacefloat
+ {\flushnotes
+ \page_otr_command_flush_side_floats % here !
+ \strc_floats_begin_group
+ \strc_floats_start_place_indeed}
+
+\aliased\let\stopplacefloat\strc_floats_stop_place
+
+% reserve
+
+\protected\def\strc_floats_reserve
+ {\flushnotes
+ \page_otr_command_flush_side_floats % here !
+ \strc_floats_begin_group
+ \strc_floats_place_indeed}
+
+\def\strc_floats_reserve_box#settings%
+ {\begingroup
+ \setupcurrentfloat[\c!frame=\v!on,#settings]%
+ \inheritedfloatframed{}%
+ \endgroup}
+
+% text
+
+\protected\def\strc_floats_start_text
+ {\flushnotes % Here indeed?
+ \page_otr_command_flush_side_floats % Here indeed?
+ \strc_floats_begin_text_group
+ \strc_floats_start_text_indeed}
+
+\tolerant\protected\def\strc_floats_start_text_indeed[#tag]#spacer[#location]#spacer[#reference]%
+ {\strc_floats_place_indeed[#tag][\v!text,#location,\v!left][#reference]}
+
+\protected\def\strc_floats_stop_text
+ {\strc_floats_stop_text_indeed}
+
+% reserved text
+
+\tolerant\protected\def\strc_floats_start_reserve_text[#tag]#spacer[#settings]#spacer[#location]#spacer[#reference]#:#caption%%
+ {\flushnotes
+ \page_otr_command_flush_side_floats
+ \strc_floats_begin_text_group
+ \strc_floats_place_indeed[#tag][\v!text,#location,\v!left][#reference]{#caption}{\strc_floats_reserve_box{#settings}}}
+
+\protected\def\strc_floats_stop_reserve_text
+ {\strc_floats_stop_text_indeed}
+
+% special hack
+
+\def\strc_floats_begin_group {\begingroup}
+\def\strc_floats_end_group {\carryoverpar\endgroup} % hm
+\def\strc_floats_end_split_group {\endgroup}
+\def\strc_floats_begin_text_group{\begingroup\let\strc_floats_end_group\relax}
+\def\strc_floats_end_text_group {\endgroup}
+
+% implementation
+
+%setnewconstant\c_page_one_float_method \zerocount % 0=raw 1=safe (.99) 2=tight (-1pt) / belongs in page-one
+\setnewconstant\c_strc_floats_rotation \zerocount % 0 90 180 270
+\newconditional\c_strc_floats_par_float
+
+\ifdefined\page_margin_strc_floats_before \else \let\page_margin_strc_floats_before \relax \fi
+\ifdefined\page_margin_strc_floats_set_hsize \else \let\page_margin_strc_floats_set_hsize\relax \fi
+
+\def\flushfloatslist
+ {\v!left,\v!right,\v!inner,\v!outer,%
+ \v!backspace,\v!cutspace,%
+ \v!inleft,\v!inright,\v!inmargin,%
+ \v!leftmargin,\v!rightmargin,\v!leftedge,\v!rightedge,%
+ \v!innermargin,\v!outermargin,\v!inneredge,\v!outeredge,%
+ \v!text,\v!opposite}% \v!page
+
+\protected\def\strc_floats_place_next_box_split
+ {\let\splitfloatfinalizer\strc_floats_end_split_group
+ \let\strc_floats_end_group\relax
+ \splitfloat{\strc_floats_place_next_box_normal}}
+
+\protected\def\strc_floats_place_next_box_normal
+ {\ifconditional\c_page_floats_some_waiting
+ % this was \checkwaitingfloats spread all over
+ \doifelseinset\v!always\floatlocation
+ {\showmessage\m!floatblocks5\empty}
+ {\doifelsecommon\floatlocation\flushfloatslist\page_otr_command_flush_floats\donothing}%
+ % but which should be done before using box \floatbox
+ \fi
+ \page_margin_strc_floats_before % todo: each float handler gets a before
+ \global\insidefloattrue
+ \dostarttaggedchained\t!float\currentfloat\??float
+ \page_margin_strc_floats_set_hsize % todo: each float handler gets a set_hsize
+ \the\everyinsidefloat
+ \strc_floats_analyze_variables_one
+ \dostarttagged\t!floatcontent\empty
+ \dowithnextboxcontent
+ {\strc_floats_set_local_hsize
+ \floatparameter\c!inner
+ \postponenotes} % new
+ {\page_postprocessors_linenumbers_box\nextbox % for aditya
+ \dostoptagged
+ \strc_floats_finish_placement}
+ \vbox}
+
+%D \starttyping
+%D \definefloat
+%D [one] [figure]
+%D [default=right,
+%D rightmargindistance=-20cm,
+%D criterium=129pt,
+%D fallback=rightmargin]
+%D
+%D \definefloat
+%D [two] [figure]
+%D [default=right,
+%D rightmargindistance=-20cm,
+%D criterium=129pt,
+%D fallback=three]
+%D
+%D \definefloat
+%D [three] [figure]
+%D [default=rightmargin,
+%D rightmargindistance=0cm]
+%D
+%D \placefloat[one]{}{\blackrule[width=30pt]} \samplefile{tufte}
+%D \placefloat[one]{}{\blackrule[width=60pt]} \samplefile{tufte}
+%D \placefloat[one]{}{\blackrule[width=90pt]} \samplefile{tufte}
+%D \placefloat[one]{}{\blackrule[width=130pt]} \samplefile{tufte}
+%D \placefloat[two]{}{\blackrule[width=130pt]} \samplefile{tufte}
+%D \stoptyping
+
+\def\strc_floats_finish_placement
+ {\doifsomething{\floatparameter\c!criterium}
+ {\ifdim\wd\nextbox>\floatparameter\c!criterium\relax
+ \edef\forcedfloatmethod{\floatparameter\c!fallback}%
+ \ifempty\forcedfloatmethod \else
+ \doifelsecommandhandler\??float\forcedfloatmethod
+ {\let\currentfloat\forcedfloatmethod
+ \edef\floatlocation{\floatparameter\c!default}%
+ \let\forcedfloatmethod\floatlocation}
+ \donothing
+ \fi
+ \ifempty\forcedfloatmethod
+ \let\forcedfloatmethod\v!here
+ \fi
+ \fi}%
+ \strc_floats_check_extra_actions
+ \strc_floats_analyze_variables_two
+ \strc_floats_place_packaged_boxes
+ \dotagregisterfloat\askedfloatoptions\askedfloatmethod
+ \dostoptagged % tricky .... needs checking
+ % we need to carry over the par because of side floats
+ \global\d_page_sides_downshift \zeropoint
+ \global\d_page_sides_extrashift\zeropoint
+ \ifconditional\c_strc_floats_par_float
+ \doifinset\v!reset\floatlocation\page_sides_forget_floats
+ \doinhibitblank
+ \fi
+ \strc_floats_end_group}
+
+% nicer is a bunch of states and one loop that sets those states
+
+\newdimen\d_strc_floats_top
+\newdimen\d_strc_floats_bottom
+\newdimen\d_strc_floats_overflow
+
+% \def\strc_floats_calculate_skip#target#skip%
+% {\begingroup
+% \edef\askedfloatskip{\rootfloatparameter#skip}%
+% \ifempty\askedfloatskip
+% \global#target\zeropoint
+% \else\ifx\askedfloatskip\v!none
+% \global#target\zeropoint
+% \else
+% \setbox\scratchbox\vbox{\whitespace\blank[\askedfloatskip]}% todo: move whitespace inside blank
+% \global#target\ht\scratchbox
+% \fi\fi
+% \endgroup}
+
+\def\strc_floats_calculate_skip#target#skip%
+ {\begingroup
+ \edef\p_blank{\rootfloatparameter#skip}%
+ \ifx\p_blank\v!nowhite
+ \edef\p_blank{-\v!white}%
+ \fi
+ \prerollblank[\p_blank]%
+ \global#target\prerolledblank
+ \endgroup}
+
+\def\strc_floats_analyze_variables_two
+ {\ifinsidecolumns
+ \global\setfalse\c_strc_floats_par_float
+ \else
+ \doifelsecommon\floatlocation\flushfloatslist
+ {\global\settrue \c_strc_floats_par_float}%
+ {\global\setfalse\c_strc_floats_par_float}%
+ \fi
+ % variable initializations
+ \global\d_page_sides_shift \zeropoint
+ \global\d_page_sides_maximum \zeropoint
+ \global\c_page_sides_align \zerocount
+ \global\c_page_sides_tolerance \zerocount
+ \global\c_page_sides_skipmode \zerocount
+ \global\c_strc_floats_rotation \zerocount
+ \global\d_page_sides_margin \floatparameter\c!margin
+ \global\d_page_sides_leftshift \floatparameter\c!leftmargindistance
+ \global\d_page_sides_rightshift \floatparameter\c!rightmargindistance
+ \global\d_page_sides_topoffset \floatparameter\c!topoffset
+ \global\d_page_sides_bottomoffset\floatparameter\c!bottomoffset
+ \global\c_page_sides_method \floatparameter\c!sidemethod
+ \global\c_page_one_float_method \floatparameter\c!textmethod
+ \global\c_page_floats_n_of_top \rootfloatparameter\c!ntop
+ \global\c_page_floats_n_of_bottom\rootfloatparameter\c!nbottom
+ \global\d_strc_floats_overflow \zeropoint
+ \ifconditional\c_strc_floats_par_float
+ \global\d_strc_floats_top \zeropoint
+ \global\d_strc_floats_bottom \zeropoint
+ \strc_floats_calculate_skip\d_page_sides_topskip \c!sidespacebefore
+ \strc_floats_calculate_skip\d_page_sides_bottomskip\c!sidespaceafter
+ \strc_floats_calculate_skip\d_page_sides_midskip \c!sidespaceinbetween
+ \strc_floats_calculate_skip\d_strc_floats_top \c!spacebeforeside
+ \strc_floats_calculate_skip\d_strc_floats_bottom \c!spaceafterside
+ \else
+ \global\d_page_sides_topskip \zeropoint
+ \global\d_page_sides_bottomskip \zeropoint
+ \strc_floats_calculate_skip\d_strc_floats_top \c!spacebefore
+ \strc_floats_calculate_skip\d_strc_floats_bottom\c!spaceafter
+ \fi
+ % keyword handling
+ \ifconditional\c_strc_floats_par_float
+ \processaction
+ [\floatparameter\c!sidealign]
+ [\v!height=>\global\c_page_sides_align\plusone ,%
+ \v!line=>\global\c_page_sides_align\plustwo ,% (***)
+ \v!depth=>\global\c_page_sides_align\plusthree,%
+ \v!grid=>\global\c_page_sides_align\plusfour ,%
+ \v!halfline=>\global\c_page_sides_align\plusfive ]%
+ \ifcase\c_page_sides_align\relax % todo: optie v!lokaal => \else
+ \doifinset\v!height \floatlocation{\global\c_page_sides_align\plusone }%
+ \doifinset\v!line \floatlocation{\global\c_page_sides_align\plustwo }%
+ \doifinset\v!depth \floatlocation{\global\c_page_sides_align\plusthree}%
+ \doifinset\v!grid \floatlocation{\global\c_page_sides_align\plusfour }%
+ \doifinset\v!halfline\floatlocation{\global\c_page_sides_align\plusfive }% meant for 'none'
+ \fi
+ \doifinset\v!high \floatlocation{\global\c_page_sides_skipmode \plusone }%
+ \doifinset\v!low \floatlocation{\global\c_page_sides_skipmode \plustwo }%
+ \doifinset\v!fit \floatlocation{\global\c_page_sides_skipmode \plusthree}%
+ \doifinset\v!tolerant \floatlocation{\global\c_page_sides_tolerance\plusone }%
+ \doifinset\v!verytolerant\floatlocation{\global\c_page_sides_tolerance\plustwo }%
+ \else
+ \processallactionsinset
+ [\floatlocation]%
+ [ 90=>\global\c_strc_floats_rotation\commalistelement\relax,%
+ 180=>\global\c_strc_floats_rotation\commalistelement\relax,%
+ 270=>\global\c_strc_floats_rotation\commalistelement\relax]%
+ \fi
+ \doifelseinset\v!nonumber\floatlocation
+ {\global\nofloatnumbertrue}%
+ {\doifelse{\floatcaptionparameter\c!number}\v!yes
+ {\global\nofloatnumberfalse}%
+ {\global\nofloatnumbertrue}}%
+ \doifelseinset\v!none\floatlocation
+ {\global\nofloatcaptiontrue}%
+ {\global\nofloatcaptionfalse}%
+ \doif{\floatcaptionparameter\c!number}\v!none % new
+ {\global\nofloatcaptiontrue}%
+ \doifinset\v!effective\floatlocation
+ {\letfloatparameter \c!leftmargin \effectiveleftskip
+ \letfloatparameter \c!rightmargin\effectiverightskip
+ \letfloatcaptionparameter\c!leftmargin \effectiveleftskip
+ \letfloatcaptionparameter\c!rightmargin\effectiverightskip}%
+ \ifemptyfloatcaption \ifnofloatnumber
+ \global\nofloatcaptiontrue
+ \fi \fi}
+
+% documenteren in details
+
+\def\strc_floats_analyze_variables_one
+ {\doifelse{\floatparameter\c!local}\v!yes\settrue\setfalse\c_page_floats_center_box_global % fout keyword
+ \ifconditional\c_page_floats_center_box_global
+ \settrue\c_page_floats_center_box_local
+ \else
+ \doifelseinset\v!local\floatlocation\settrue\setfalse\c_page_floats_center_box_local
+ \fi
+ \doifelse{\floatparameter\c!freeregion}\v!yes
+ \settrue\setfalse\c_strc_floats_mark_as_free
+ \doifnotcommon{\v!always,\v!here,\v!force}\floatlocation % ! ! ! ! ! !
+ {\setfalse\c_page_floats_center_box_global
+ \setfalse\c_page_floats_center_box_local}}
+
+\permanent\def\naturalfloatheight{\the\naturalfloatwd}
+\permanent\def\naturalfloatwidth {\the\naturalfloatht}
+\permanent\def\naturalfloatdepth {\the\naturalfloatdp}
+
+\permanent\def\floatcaptionheight{\the\floatcaptionwd}
+\permanent\def\floatcaptionwidth {\the\floatcaptionht}
+\permanent\def\floatcaptiondepth {\the\floatcaptiondp}
+
+\newdimen\naturalfloatwd
+\newdimen\naturalfloatht
+\newdimen\naturalfloatdp
+
+\newdimen\floatcaptionwd
+\newdimen\floatcaptionht
+\newdimen\floatcaptiondp
+
+\def\strc_floats_set_natural_dimensions#box%
+ {\global\naturalfloatwd\wd#box\relax
+ \global\naturalfloatht\ht#box\relax
+ \global\naturalfloatdp\dp#box\relax}
+
+\def\strc_floats_set_caption_dimensions#box%
+ {\global\floatcaptionwd\wd#box\relax
+ \global\floatcaptionht\ht#box\relax
+ \global\floatcaptiondp\dp#box\relax}
+
+\def\doifelsemainfloatbody
+ {\ifinsidesplitfloat
+ \ifconditional\splitfloatfirstdone
+ \doubleexpandafter\secondoftwoarguments
+ \else
+ \doubleexpandafter\firstoftwoarguments
+ \fi
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
+
+\let\doifmainfloatbodyelse\doifelsemainfloatbody
+
+% todo: optional user pars
+
+\let\currentfloatattribute\empty % to be checked
+
+\def\floatcaptionattribute
+ {\iflocation
+ \ifempty\currentfloatattribute
+ % safeguard, can be samepage too
+ \orelse\ifnofloatcaption
+ \orelse\ifinsidesplitfloat
+ \ifconditional\splitfloatfirstdone
+ \else
+ attr \destinationattribute \currentfloatattribute
+ \fi
+ \else
+ attr \destinationattribute \currentfloatattribute
+ \fi
+ \fi}
+
+% \def\floatcaptionattribute
+% {\iflocation
+% \ifempty\currentfloatattribute
+% % safeguard, can be samepage too
+% \orelse\ifnofloatcaption
+% % nothing
+% \orunless\ifinsidesplitfloat
+% attr \destinationattribute \currentfloatattribute
+% \orunless\ifconditional\splitfloatfirstdone
+% attr \destinationattribute \currentfloatattribute
+% \fi
+% \fi}
+
+\newconditional\usesamefloatnumber
+
+% \startplacefigure[location=here,reference=first, title=first, group=alpha,groupsuffix=.a]
+% \externalfigure[dummy][height=2cm]
+% \stopplacefigure
+% \startplacefigure[location=here,reference=second,title=second,group=alpha,groupsuffix=.b]
+% \externalfigure[dummy][height=2cm]
+% \stopplacefigure
+%
+% uses:
+
+\def\strc_floats_group_index
+ {\numexpr\clf_listgroupindex{\currentfloat}{\currentfloatgroup}\relax}
+
+\def\strc_floats_place_packaged_boxes
+ {\expandafter\strc_floats_place_packaged_boxes_indeed\expandafter{\m_strc_floats_saved_userdata}}
+
+\def\strc_floats_place_packaged_boxes_indeed#userdata%
+ {\bgroup
+ \ifconditional\usesamefloatnumber
+ \glet\currentfloatnumber \previousfloatnumber
+ \glet\currentfloatattribute \empty
+ \glet\currentfloatsynchronize\relax
+ \else
+ \edef\currentfloatcounter{\namedcounterparameter\currentfloat\s!name}%
+ \edef\currentfloatgroup {\floatcaptionparameter\c!group}%
+ \ifnofloatnumber
+ \orelse\ifnofloatcaption
+ \orelse\ifempty\currentfloatgroup
+ % independent
+ \iftrialtypesetting\strc_counters_save\currentfloatcounter\fi
+ \strc_counters_increment\currentfloatcounter
+ \orelse\ifcase\strc_floats_group_index
+ % first in group
+ \iftrialtypesetting\strc_counters_save\currentfloatcounter\fi
+ \strc_counters_increment\currentfloatcounter
+ \else
+ % next in group
+ \fi
+ % *1* as an alternative we could set counter parameters here if needed
+ \strc_counters_register_component
+ \s!float
+ \setupcurrentfloatcaption
+ \floatcaptionparameter
+ \detokenizedfloatcaptionparameter
+ \relax
+ \relax
+ \relax
+ [\s!name=\currentfloat,% was c!name
+ \s!counter=\currentfloatcounter,%
+ \s!hascaption=\ifnofloatcaption \v!no\else\v!yes\fi,%
+ \s!hasnumber=\ifnofloatnumber \v!no\else\v!yes\fi,%
+ \s!hastitle=\ifemptyfloatcaption\v!no\else\v!yes\fi]%
+ [#userdata]%
+ \glet\previousfloatnumber \m_strc_counters_last_registered_index
+ \glet\currentfloatnumber \m_strc_counters_last_registered_index
+ \glet\currentfloatattribute \m_strc_counters_last_registered_attribute
+ \glet\currentfloatsynchronize\m_strc_counters_last_registered_synchronize
+ \fi
+ %
+ \iftrialtypesetting\else\global\setfalse\usesamefloatnumber\fi % one shot
+ % check float box
+ \strc_floats_set_natural_dimensions\nextbox
+ \global\setbox\floatbox\vbox{\floatparameter\c!command{\box\nextbox}}% can be anything so no pack
+ \strc_floats_set_natural_dimensions\floatbox
+ \ifzeropt\htdp\floatbox
+ \showmessage\m!floatblocks{11}\empty
+ \global\setbox\floatbox\vpack
+ {\dostarttagged\t!floatcontent\empty
+ \strc_floats_place_empty_box
+ \dostoptagged}%
+ \fi
+ % deal with lack of caption
+ \global\setbox\floatbox\vpack \floatcaptionattribute
+ {\doifelsemainfloatbody\currentfloatsynchronize\donothing
+ \unvbox\floatbox
+ \ifnofloatcaption
+ \vss
+ \fi}% gets rid of the depth (unless tabulate)
+ \iftrialtypesetting\strc_counters_restore\currentfloatcounter\fi
+ \egroup
+ % place the float
+ \strc_floats_set_box
+ \strc_floats_get_box
+ \global\insidefloatfalse}
+
+\newdimen\availablefloatwidth
+\newdimen\availablefloatheight
+
+\def\strc_floats_set_local_hsize
+ {\ifconditional\c_page_floats_center_box_local
+ % also available check here?
+ \seteffectivehsize
+ \hsize\localhsize
+ \else
+ \doifinset\v!margin\floatlocation % brr, really needed! see wm will be redone
+ {\hsize\namedmarginblockparameter\empty\c!width}%
+ \fi
+ \edef\p_availablewidth {\floatparameter\c!availablewidth }%
+ \edef\p_availableheight{\floatparameter\c!availableheight}%
+ \availablefloatwidth \ifempty\p_availablewidth \hsize\else\p_availablewidth \relax\fi
+ \availablefloatheight\ifempty\p_availableheight\vsize\else\p_availableheight\relax\fi}
+
+\ifdefined\everyinsidefloat \else \newevery \everyinsidefloat \relax \fi
+
+\appendtoks
+ \everyinsidefloat\emptytoks % in case it's called earlier
+ \strc_float_load_data
+\to \everyinsidefloat
+
+\permanent\def\doifelserightpagefloat
+ {\unless\ifdoublesided
+ \expandafter\firstoftwoarguments
+ \orelse\ifsinglesided
+ \expandafter\firstoftwoarguments
+ \orelse\ifodd\purenumber\strc_float_realpage\space
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
+\permanent\def\doifelseoddpagefloat
+ {\ifodd\purenumber\strc_float_realpage\space
+ \expandafter\firstoftwoarguments
+ \else
+ \expandafter\secondoftwoarguments
+ \fi}
+
+\aliased\let\doifrightpagefloatelse\doifelserightpagefloat
+\aliased\let\doifoddpagefloatelse \doifelseoddpagefloat
+
+\appendtoks
+ \enforced\let\rightorleftpageaction\doifelserightpagefloat
+\to \everyinsidefloat
+
+% \let\movesidefloat\gobbleoneargument
+
+% new : \place...[leftmargin,-2*line]; we need to catch fxtb:2*3
+% watch out: line alone aligns on the line ! ! !
+
+\permanent\protected\def\movesidefloat[#settings]% (-)n*line|x=,y=
+ {\global\d_page_sides_downshift \zeropoint
+ \global\d_page_sides_extrashift\zeropoint
+ \ifhastok={#settings}%
+ \begingroup
+ \setupcurrentfloat[\c!x=\zeropoint,\c!y=\zeropoint,#settings]%
+ \ifgridsnapping
+ \getnoflines{\floatparameter\c!y}%
+ \global\d_page_sides_downshift\noflines\lineheight
+ \else
+ \global\d_page_sides_downshift\floatparameter\c!y
+ \fi
+ \global\d_page_sides_extrashift\floatparameter\c!x
+ \endgroup
+ \else
+ \movedownsidefloat[#settings]%
+ \fi}
+
+\installcorenamespace{floatmovement}
+
+\setvalue{\??floatmovement \v!line}{\strc_floats_move_down_line+}
+\setvalue{\??floatmovement+\v!line}{\strc_floats_move_down_line+}
+\setvalue{\??floatmovement-\v!line}{\strc_floats_move_down_line-}
+\setvalue{\??floatmovement \v!hang}{\strc_floats_move_down_hang\plusone}
+\setvalue{\??floatmovement+\v!hang}{\strc_floats_move_down_hang\plusone}
+\setvalue{\??floatmovement-\v!hang}{\strc_floats_move_down_hang\minusone}
+
+\setvalue{\??floatmovement-2*\v!line}{\strc_floats_move_down_line{-2}}
+\setvalue{\??floatmovement+2*\v!line}{\strc_floats_move_down_line{2}}
+\setvalue{\??floatmovement 2*\v!line}{\strc_floats_move_down_line{2}}
+
+\protected\def\installfloatmovement#1#2{\setvalue{\??floatmovement#1}{#2}}
+
+\def\strc_floats_move_down#setting%
+ {\begincsname\??floatmovement#setting\endcsname}
+
+\def\strc_floats_move_down_line#sign%
+ {\if!!donea \else
+ \global\d_page_sides_downshift\zeropoint
+ \!!doneatrue
+ \fi
+ \global\advance\d_page_sides_downshift#sign\lineheight}
+
+\def\strc_floats_move_down_hang#lines%
+ {\if!!doneb \else
+ \global\c_page_sides_n_of_lines\zerocount
+ \!!donebtrue
+ \fi
+ \global\advance\c_page_sides_n_of_lines#lines\relax}
+
+\permanent\protected\def\movedownsidefloat[#settings]% already in core
+ {\unless\ifhastok:{#settings}%
+ \begingroup
+ \!!doneafalse
+ \!!donebfalse
+ \normalexpanded{\dorepeatwithcommand[#settings]}\strc_floats_move_down
+ \endgroup
+ \fi}
+
+\permanent\protected\def\hangsidefloat[#number]%
+ {\global\c_page_sides_n_of_lines#number\relax}
+
+\def\strc_floats_set_extra_action#rightpagelocation#leftpagelocation%
+ {\rightorleftpageaction
+ {\let\extrafloatlocation#rightpagelocation}%
+ {\let\extrafloatlocation#leftpagelocation}}
+
+\let\extrafloatlocation\empty
+
+\installcorenamespace{extrafloataction}
+
+\setvalue{\??extrafloataction \v!inner}#1{\strc_floats_set_extra_action\v!left \v!right}
+\setvalue{\??extrafloataction \v!outer}#1{\strc_floats_set_extra_action\v!right \v!left}
+\setvalue{\??extrafloataction\v!innermargin}#1{\strc_floats_set_extra_action\v!leftmargin \v!rightmargin}
+\setvalue{\??extrafloataction\v!outermargin}#1{\strc_floats_set_extra_action\v!rightmargin\v!leftmargin}
+\setvalue{\??extrafloataction \v!inneredge}#1{\strc_floats_set_extra_action\v!leftedge \v!rightedge}
+\setvalue{\??extrafloataction \v!outeredge}#1{\strc_floats_set_extra_action\v!rightedge \v!leftedge}
+\setvalue{\??extrafloataction \v!backspace}#1{\strc_floats_set_extra_action\v!backspace \v!cutspace}
+\setvalue{\??extrafloataction \v!cutspace}#1{\strc_floats_set_extra_action\v!cutspace \v!backspace}
+%setvalue{\??extrafloataction \v!margin}#1{\strc_floats_set_extra_action\v!cutspace \v!backspace}
+\setvalue{\??extrafloataction \v!left}#1{\strc_floats_set_extra_action\v!left \v!left}
+\setvalue{\??extrafloataction \v!right}#1{\strc_floats_set_extra_action\v!right \v!right}
+\setvalue{\??extrafloataction \v!line}#1{} % only -n*line is handled (see ***)
+\setvalue{\??extrafloataction \s!unknown}#1{\movedownsidefloat[#1]}
+
+\def\strc_floats_check_extra_actions % less tracingthis way ....
+ {\doifnotinset\v!text\floatlocation % fuzzy, text overloads left, since then it's a directive
+ {\let\extrafloatlocation\empty
+ % \d_page_sides_downshift will be reset afterwards, and can
+ % already be set at this point
+ \processcommacommand[\floatlocation]\strc_floats_check_extra_actions_step
+ \ifempty\extrafloatlocation \else
+ \edef\floatlocation{\extrafloatlocation,\floatlocation}%
+ \setfloatmethodvariables\floatlocation
+ \fi}}
+
+\def\strc_floats_check_extra_actions_step#step%
+ {\csname\??extrafloataction
+ \ifcsname\??extrafloataction#step\endcsname#step\else\s!unknown\fi
+ \endcsname{#step}}
+
+% pas op, maxbreedte niet instellen als plaats=links/rechts
+
+\def\strc_floats_set_local_dimensions
+ {\global\d_page_sides_shift \zeropoint % duplicate
+ \global\d_page_sides_maximum\zeropoint\relax % duplicate
+ \ifzeropt\d_page_sides_downshift\else
+ \global\setbox\floatbox\vpack
+ {\vskip\d_page_sides_downshift
+ \nointerlineskip
+ \box\floatbox}%
+ \fi
+ \edef\p_minwidth{\floatparameter\c!minwidth}%
+ \ifempty\p_minwidth
+ % nothing
+ \else
+ \scratchwidth\p_minwidth\relax
+ \ifdim\wd\floatbox<\scratchwidth
+ \strc_floats_realign_floatbox_horizontal_two
+ \fi
+ \fi
+ % we can also support edges .. in that case no common but a fast loop
+ \doifelseinset\v!hanging\floatlocation
+ {\doifelsecommon{\v!inleft,\v!leftmargin}\floatlocation
+ {\let\p_maxwidth\leftmarginwidth}%
+ {\doifelsecommon{\v!inright,\v!rightmargin}\floatlocation
+ {\let\p_maxwidth\rightmarginwidth}%
+ {\edef\p_maxwidth{\floatparameter\c!maxwidth}}}}%
+ {\edef\p_maxwidth{\floatparameter\c!maxwidth}}%
+ \ifempty\p_maxwidth
+ % nothing
+ \else
+ \scratchwidth\p_maxwidth\relax
+ \ifdim\wd\floatbox>\scratchwidth
+ \doifelsecommon{\v!inright,\v!rightmargin,\v!rightedge,\v!inleft,\v!leftmargin,\v!leftedge}\floatlocation
+ {\global\d_page_sides_maximum\scratchwidth}
+ {\doifelsecommon{\v!right,\v!left}\floatlocation
+ \strc_floats_realign_floatbox_horizontal_one
+ \strc_floats_realign_floatbox_horizontal_two}%
+ \fi
+ \fi}
+
+\def\strc_floats_realign_floatbox_horizontal_one
+ {\global\setbox\floatbox\hpack to \scratchwidth
+ {\doifnotinset\v!right\floatlocation\hss
+ \box\floatbox
+ \doifnotinset\v!left\floatlocation\hss}}
+
+\def\strc_floats_realign_floatbox_horizontal_two % why is this
+ {\global\setbox\floatbox\hpack to \scratchwidth
+ {\doifnot{\floatparameter\c!location}\v!left\hss
+ \box\floatbox
+ \doifnot{\floatparameter\c!location}\v!right\hss}}
+
+\permanent\protected\def\placefloats
+ {\page_otr_command_flush_floats}
+
+\permanent\protected\def\betweenfloatblanko % assumes that spaceafter is present
+ {\blank[\rootfloatparameter\c!spacebefore]} % or v!back,....
+
+% keep as old 1
+%
+% \protected\def\doplacefloatbox % used elsewhere
+% {%\forgetall % NO
+% \whitespace
+% \blank[\rootfloatparameter\c!spacebefore]
+% \page_otr_command_flush_float_box
+% \blank[\rootfloatparameter\c!spaceafter]}
+%
+% keep as old 2
+%
+% \protected\def\doplacefloatbox % used elsewhere
+% {%\forgetall % NO
+% \whitespace
+% \blank[\rootfloatparameter\c!spacebefore]
+% \nointerlineskip
+% \flushnotes % new per 2014-05-29 : todo: move them up in the mvl
+% \nointerlineskip
+% \page_otr_command_flush_float_box
+% \nointerlineskip
+% \blank[\rootfloatparameter\c!spaceafter]}
+
+\def\strc_floats_apply_skip#1%
+ {\edef\m_space{\rootfloatparameter#1}%
+ \ifempty\m_space\orelse\ifx\m_space\v!none\else
+ \directvspacing\m_space
+ \fi}
+
+\permanent\protected\def\doplacefloatbox % used elsewhere
+ {%\forgetall % NO
+ \whitespace
+ \strc_floats_apply_skip\c!spacebefore
+ \nointerlineskip
+ \flushnotes % new per 2014-05-29 : todo: move them up in the mvl
+ \nointerlineskip
+ \page_otr_command_flush_float_box
+ % \nointerlineskip % interferes with depth of caption
+ \strc_floats_apply_skip\c!spaceafter}
+
+% test case:
+%
+% \placefigure[page,none]{}{\blackrule[width=\textwidth,height=0.9\textheight,color=green]}
+% \placefigure[page,none]{}{\blackrule[width=\textwidth,height=1.0\textheight,color=green]}
+% \placefigure[page,none]{}{\blackrule[width=\textwidth,height=1.1\textheight,color=green]}
+
+% the [#1] will go away
+
+\def\page_one_place_float_text % this macro should be defined elsewhere
+ {%\checkwaitingfloats\floatlocationmethod
+ % todo: check if #1 is indeed \floatlocation or maybe more
+ \global\floatwidth \wd\floatbox
+ \global\floatheight \ht\floatbox % forget about the depth
+ \global\floattextwidth\dimexpr\hsize-\floatwidth-\rootfloatparameter\c!margin\relax
+ \edef\floatlocation{\floatlocationmethod}% to be sure .. why
+ \doifelseinset\v!tall\floatlocationmethod
+ {\floattextheight\dimexpr\pagegoal-\pagetotal-\bigskipamount\relax % ugly, this bigskip
+ \ifdim\floattextheight>\textheight
+ \floattextheight\textheight
+ \fi
+ \boxmaxdepth\zeropoint\relax % toegevoegd
+ \ifdim\floattextheight<\floatheight
+ \floattextheight\floatheight
+ \fi
+ \setbox\floattext\vbox to \floattextheight}
+ {\setbox\floattext\vbox}%
+ \bgroup
+ \forgetall
+ \setupblank
+ \setupwhitespace % new, also needed for footnotes
+ \blank[\v!disable]
+ \hsize\floattextwidth
+ \ignorespaces}
+
+\def\strc_floats_stop_text_indeed % todo
+ {\egroup
+ \doifnotinset\v!tall\floatlocation
+ {\floattextheight\ifdim\ht\floattext<\floatheight\floatheight\else\ht\floattext\fi}%
+ \setbox\floatbox\vpack to \floattextheight
+ {\hsize\floatwidth
+ \doifelseinset\v!both\floatlocation
+ {\doifelseinset\v!low\floatlocation
+ {\vfill\box\floatbox}
+ {\doifelseinset\v!middle\floatlocation
+ {\vfill\box\floatbox\vfill}
+ {\box\floatbox\vfill}}}
+ {\box\floatbox\vfill}}%
+ \setbox\floattext\vpack to \floattextheight
+ {\hsize\floattextwidth
+ \doifelseinset\v!low\floatlocation
+ {\vfill
+ \box\floattext
+ \doifinset\c!offset\floatlocation{\whitespace\blank}}
+ {\doifelseinset\v!middle\floatlocation
+ {\vfill
+ \box\floattext
+ \vfill}
+ {\doifinset\v!offset\floatlocation{\whitespace\blank}%
+ \box\floattext
+ \vfill}}}%
+ \doifelseinset\v!right\floatlocation
+ {\setbox\floatbox\hpack to \hsize
+ {\box\floattext
+ \hfill
+ \box\floatbox}}
+ {\setbox\floatbox\hpack to \hsize
+ {\box\floatbox
+ \hfill
+ \box\floattext}}%
+ \baselinecorrection
+ \whitespace
+ \blank[\rootfloatparameter\c!spacebefore]%
+ \doifnotinset\v!tall\floatlocation
+ {\dp\floatbox\openstrutdepth}% dp\strutbox}% % toegevoegd
+ \box\floatbox
+ \dostoptagged
+ \blank[\rootfloatparameter\c!spaceafter]%
+ \strc_floats_end_text_group
+ \page_floats_report_total}
+
+\permanent\def\borderedfloatbox
+ {\begingroup
+ \setupcurrentfloat[\c!location=\v!normal,\c!width=\v!fit,\c!height=\v!fit]%
+ \inheritedfloatframed{\box\floatbox}%
+ \endgroup}
+
+% minwidth=fit,width=max : no overshoot, as wide as graphic
+
+% keep these as reference:
+%
+% \def\strc_floats_align_content_indeed
+% {\alignstrutmode\zerocount
+% \doifnotcommon\floatcaptionlocation{\v!outermargin,\v!innermargin,\v!leftmargin,\v!rightmargin}
+% {\shiftalignedline
+% {\floatparameter\c!leftmargin }{\floatparameter\c!rightmargin}%
+% {\floatparameter\c!innermargin}{\floatparameter\c!outermargin}}%
+% \alignedline{\floatparameter\c!location}\v!middle}
+%
+% \def\strc_floats_align_caption_indeed
+% {\alignstrutmode\zerocount
+% \shiftalignedline
+% {\floatcaptionparameter\c!leftmargin }{\floatcaptionparameter\c!rightmargin}%
+% {\floatcaptionparameter\c!innermargin}{\floatcaptionparameter\c!outermargin}%
+% \alignedline{\floatparameter\c!location}\v!middle}
+%
+% Test case:
+%
+% \setupfloats[location=left]
+% \setupfloatcaption[width=max]
+%
+% \startfloatcombination
+% \placefigure{}{}
+% \placefigure{}{}
+% \stopfloatcombination
+
+%D In a floatcombination we ignore the margins .. if that is ever needed we need another
+%D state (instead of local).
+
+\def\strc_floats_align_indeed
+ {\alignedline{\floatparameter\c!location}\v!middle}
+
+\def\strc_floats_shift_indeed#1%
+ {\shiftalignedline{#1\c!leftmargin}{#1\c!rightmargin}{#1\c!innermargin}{#1\c!outermargin}}
+
+\def\strc_floats_align_content_indeed
+ {\alignstrutmode\zerocount
+ \ifx\forcedfloatmethod\v!local \else
+ \doifnotcommon\floatcaptionlocation{\v!outermargin,\v!innermargin,\v!leftmargin,\v!rightmargin}
+ {\strc_floats_shift_indeed\floatparameter}%
+ \expandafter\strc_floats_align_indeed
+ \fi}
+
+\def\strc_floats_align_caption_indeed
+ {\alignstrutmode\zerocount
+ \ifx\forcedfloatmethod\v!local
+ \expandafter\strc_floats_align_indeed_local
+ \else
+ \strc_floats_shift_indeed\floatcaptionparameter
+ \expandafter\strc_floats_align_indeed
+ \fi}
+
+% \def\strc_floats_align_indeed_local#1%
+% {\begingroup
+% \hsize\wd\floatbox
+% \strc_floats_align_indeed{#1}%
+% \endgroup}
+
+\let\strc_floats_align_indeed_local\firstofoneargument
+
+\newdimen\d_strc_floats_content
+\newdimen\d_strc_float_temp_height
+\newdimen\d_strc_float_temp_width
+
+\newconditional\c_floats_adapt_to_caption_width
+\newconditional\c_floats_store_minimal_package
+
+\def\captionminwidth {15\bodyfontsize} % can become parameter (but what name)
+\def\captionovershoot{2\emwidth} % can become parameter (but what name)
+
+\let\strc_floats_mark_pag_as_free\relax
+
+\def\strc_floats_set_page_variant
+ {\bgroup
+ \strc_floats_set_local_hsize
+ \ifcase\c_strc_floats_rotation\else
+ \swapdimens\hsize\vsize
+ \fi
+ \forgetall
+ \postponenotes
+ \dontcomplain
+ \setbox\b_strc_floats_content\vpack{\borderedfloatbox}%
+ \let\strc_floats_align_content\strc_floats_align_content_indeed
+ \let\strc_floats_align_caption\strc_floats_align_caption_indeed
+ \strc_floats_check_caption_content
+ \d_strc_floats_content\wd\b_strc_floats_content
+ \ifcase\floatparameter\c!method
+ % nothing
+ \or
+ % automatic
+ \ifnofloatcaption
+ \strc_floats_prepare_no_caption
+ \strc_floats_set_caption_dimensions\voidbox
+ %\page_backgrounds_add_local_to_box\floatbox % was \doglobal but not needed
+ \else
+ % todo: installable maken, variant/method=auto vs macro
+ \strc_floats_prepare_page_caption
+ %\page_backgrounds_add_local_to_box\b_strc_floats_content
+ \setbox\b_strc_floats_caption\hbox % text
+ {\floatcaptionparameter\c!command{\box\b_strc_floats_caption}}%
+ \strc_floats_set_caption_dimensions\b_strc_floats_caption
+ %\moveboxontogrid\b_strc_floats_caption{\floatcaptionparameter\c!grid}\d_strc_floats_caption_height
+ %\page_backgrounds_add_local_to_box\b_strc_floats_caption
+ \strc_floats_build_box
+ \fi
+ \or
+ % semi automatic
+ \or
+ % manual
+ \fi
+ \ifconditional\c_floats_store_minimal_package
+ % nothing
+ \orelse\ifcase\c_strc_floats_rotation
+ \doifnotinset\v!margin\floatlocation % brr, really needed! see wm
+ {\postcenterfloatbox\d_strc_floats_content
+ \strc_floats_mark_pag_as_free}%
+ % mark as free not done here
+ \else
+ \global\setbox\floatbox\vpack
+ {\rotate[\c!rotation=\number\c_strc_floats_rotation]{\box\floatbox}}%
+ \strc_floats_mark_pag_as_free
+ \fi
+ \egroup}
+
+\def\strc_floats_prepare_no_caption
+ {\global\setbox\floatbox\vpack % pas op als wd groter dan hsize
+ {\ifinsidecolumns\ifdim\wd\b_strc_floats_content>\hsize
+ \let\strc_floats_align_content\relax
+ \fi\fi
+ \strc_floats_align_content{\copy\b_strc_floats_content}}}
+
+\def\strc_floats_prepare_page_caption
+ {\edef\p_strc_floats_caption_width {\floatcaptionparameter\c!width}%
+ \edef\p_strc_floats_caption_minwidth{\floatcaptionparameter\c!minwidth}%
+ \edef\p_strc_floats_caption_align {\floatcaptionparameter\c!align}%
+ \dostarttagged\t!floatcaption\empty
+ \doifcommonelse\floatcaptionlocation{\v!top,\v!bottom}
+ {\strc_floats_prepare_page_caption_top_bottom}
+ {\ifx\p_strc_floats_caption_width\v!fit
+ \strc_floats_prepare_side_auto_caption
+ \orelse\ifx\p_strc_floats_caption_width\v!max
+ \strc_floats_prepare_side_auto_caption
+ \else
+ \strc_floats_prepare_side_width_caption
+ \fi}%
+ \dostoptagged}
+
+\def\strc_floats_prepare_page_caption_top_bottom
+ {\ifx\p_strc_floats_caption_width\v!fit
+ \strc_floats_prepare_page_caption_top_bottom_fit_max
+ \orelse\ifx\p_strc_floats_caption_width\v!max
+ \strc_floats_prepare_page_caption_top_bottom_fit_max
+ \else
+ \strc_floats_prepare_side_width_caption % new, special effects (see icare)
+ \fi}
+
+\def\strc_floats_prepare_page_caption_top_bottom_fit_max
+ {\unless\ifx\p_strc_floats_caption_minwidth\v!fit
+ \strc_floats_prepare_stack_caption_fixed
+ \orelse\ifx\p_strc_floats_caption_width\v!max
+ \strc_floats_prepare_stack_caption_max
+ \orelse\ifdim\wd\b_strc_floats_caption>\wd\b_strc_floats_content % wider caption
+ \ifx\p_strc_floats_caption_width\v!fit
+ \strc_floats_prepare_stack_caption_auto
+ \else
+ \strc_floats_prepare_stack_caption_width
+ \fi
+ \else
+ \strc_floats_prepare_stack_caption_min
+ \fi}
+
+\def\strc_floats_caption_set_align
+ {\edef\m_align{\v!reset\ifempty\p_strc_floats_caption_align\else,\fi\p_strc_floats_caption_align}%
+ \doifinset\v!tolerant \floatcaptionlocation{\edef\m_align{\m_align,\v!tolerant}}%
+ \doifinset\v!verytolerant\floatcaptionlocation{\edef\m_align{\m_align,\v!verytolerant}}%
+ \doifinset\v!stretch \floatcaptionlocation{\edef\m_align{\m_align,\v!stretch}}%
+ \setupalign[\m_align]}
+
+\def\strc_floats_prepare_side_auto_caption
+ {\scratchdimen\dimexpr\hsize-\wd\b_strc_floats_content-\floatparameter\c!margin\relax
+ \ifdim\wd\b_strc_floats_caption>\scratchdimen
+ \ifdim\wd\b_strc_floats_caption<1.3\scratchdimen
+ \scratchdimen0.8\scratchdimen
+ \fi
+ \fi
+ \setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\scratchdimen
+ \strc_floats_make_complete_caption}}
+
+\def\strc_floats_prepare_side_width_caption
+ {\setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\floatcaptionparameter\c!width
+ \strc_floats_make_complete_caption}}
+
+\def\strc_floats_prepare_stack_caption_fixed
+ {\setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\floatcaptionparameter\c!minwidth % special effects
+ \strc_floats_make_complete_caption}}
+
+\def\strc_floats_prepare_stack_caption_max
+ {\setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\wd\b_strc_floats_content
+ \strc_floats_make_complete_caption}}
+
+\def\strc_floats_prepare_stack_caption_width
+ {\setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\floatcaptionparameter\c!width
+ \strc_floats_make_complete_caption}}
+
+\def\strc_floats_prepare_stack_caption_min
+ {\setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\wd\b_strc_floats_content
+ \ifempty\p_strc_floats_caption_align
+ \raggedcenter % on purpose overloads align !
+ \fi
+ \strc_floats_make_complete_caption}}
+
+\def\strc_floats_prepare_stack_caption_auto
+ {\ifempty\p_strc_floats_caption_align \else
+ \doifnotinset\v!middle\p_strc_floats_caption_align{\let\captionovershoot\!!zeropoint}%
+ \fi
+ \edef\captionhsize{\the\wd\b_strc_floats_content}%
+ \scratchwidth\floatcaptionparameter\c!maxwidth\relax
+ \ifconditional\c_floats_adapt_to_caption_width
+ \let\captionminwidth \!!zeropoint
+ \let\captionovershoot\!!zeropoint
+ \fi
+ \ifdim\captionhsize>\scratchwidth
+ % float is wider than \hsize
+ \setbox\b_strc_floats_caption\vbox
+ {\settrialtypesetting
+ \strc_floats_caption_set_align
+ \hsize\scratchwidth
+ \notesenabledfalse
+ \strc_floats_make_complete_caption}%
+ \ifdim\ht\scratchbox>\lineheight % more lines
+ \setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\dimexpr\captionhsize-\captionovershoot\relax
+ \ifdim\hsize<\captionminwidth\relax
+ \hsize\scratchwidth
+ \fi
+ \strc_floats_make_complete_caption}%
+ \else
+ \setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\scratchwidth
+ \strc_floats_make_complete_caption}%
+ \fi
+ \else
+ % float is smaller of equal to \hsize
+ \ifdim\captionhsize<\captionminwidth\relax
+ \scratchdimen\captionminwidth % float smaller than min width
+ \edef\captionhsize{\the\scratchdimen}%
+% \ifconditional\c_floats_adapt_to_caption_width
+% \setbox\b_strc_floats_content\hpack to \captionhsize{\hss\box\b_strc_floats_content\hss}%
+% \fi
+ \fi
+ \setbox\scratchbox\vbox % test with overshoot
+ {\settrialtypesetting
+ \scratchdimen\dimexpr\captionhsize+\captionovershoot+3\emwidth\relax % 3em is an average word length
+ \ifdim\scratchdimen<\hsize
+ \hsize\scratchdimen
+ \fi
+ \notesenabledfalse
+ \strc_floats_make_complete_caption}%
+ \ifdim\ht\scratchbox>\lineheight
+ % at least an average word longer than a line
+ \setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \scratchdimen\dimexpr\captionhsize+\captionovershoot\relax
+ \ifdim\scratchdimen<\hsize
+ \hsize\scratchdimen
+ \fi
+ \strc_floats_make_complete_caption}%
+ \orelse\if\empty\p_strc_floats_caption_align
+ \setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\captionhsize
+ \raggedcenter % overloads
+ \strc_floats_make_complete_caption}%
+ \else
+ \setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\captionhsize
+ \strc_floats_make_complete_caption}%
+ \fi
+ \fi}
+
+\def\strc_floats_between_stack
+ {\endgraf
+ \nointerlineskip
+ \floatcaptionparameter\c!inbetween
+ \endgraf}
+
+\def\strc_floats_build_box_default % done
+ {\strc_floats_align_content{\box\b_strc_floats_content}}
+
+\def\strc_floats_build_box_next_right#1%
+ {\ifconditional\c_strc_floats_par_float \hpack \else \expandafter \strc_floats_align_content \fi % skip, no pack
+ {\d_strc_float_temp_height\ht\b_strc_floats_content
+ \box\b_strc_floats_content
+ \doifnotinset\v!hang\floatcaptionlocation
+ {\dotfskip{\floatcaptionparameter\c!distance}}%
+ \vbox to\d_strc_float_temp_height{#1}}}
+
+\def\strc_floats_build_box_next_left#1%
+ {\ifconditional\c_strc_floats_par_float \hpack \else \expandafter \strc_floats_align_content \fi % skip, no pack
+ {\d_strc_float_temp_height\ht\b_strc_floats_content
+ \vbox to\d_strc_float_temp_height{#1}%
+ \doifnotinset\v!hang\floatcaptionlocation
+ {\dotfskip{\floatcaptionparameter\c!distance}}%
+ \box\b_strc_floats_content}}
+
+\def\strc_floats_build_box_next_outer
+ {\doifelserightpagefloat\strc_floats_build_box_next_right\strc_floats_build_box_next_left}
+
+\def\strc_floats_build_box_next_inner
+ {\doifelserightpagefloat\strc_floats_build_box_next_left\strc_floats_build_box_next_right}
+
+\def\strc_floats_build_box_next_right_hang#1%
+ {\ifconditional\c_strc_floats_par_float \hpack \else \expandafter \strc_floats_align_content \fi
+ {\d_strc_float_temp_height\ht\b_strc_floats_content
+ \box\b_strc_floats_content
+ \vbox to\d_strc_float_temp_height{#1}}}
+
+\def\strc_floats_build_box_next_left_hang#1%
+ {\ifconditional\c_strc_floats_par_float \hpack \else \expandafter \strc_floats_align_content \fi
+ {\d_strc_float_temp_height\ht\b_strc_floats_content
+ \vbox to\d_strc_float_temp_height{#1}%
+ \box\b_strc_floats_content}}
+
+\def\strc_floats_build_box_next_right_margin_indeed#1#2%
+ {\ifconditional\c_strc_floats_par_float
+ \hpack\bgroup
+ \d_strc_float_temp_height\ht\b_strc_floats_content
+ \box\b_strc_floats_content
+ \hsmash{\hskip#1\vbox to\d_strc_float_temp_height{#2}}%
+ \egroup
+ \else
+ \begingroup
+ \d_strc_float_temp_height\ht\b_strc_floats_content
+ \setbox\scratchboxone\vbox{#2}%
+ \ifdim\htdp\scratchboxone>\htdp\b_strc_floats_content
+ \global\d_strc_floats_overflow\dimexpr\htdp\scratchboxone-\htdp\b_strc_floats_content\relax
+ \fi
+ \ht\scratchboxone\d_strc_float_temp_height
+ \everyrightofalignedline{\hsmash{\hskip#1\box\scratchboxone}}%
+ \strc_floats_align_content{\box\b_strc_floats_content}%
+ \endgroup
+ \fi}
+
+\def\strc_floats_build_box_next_left_margin_indeed#1#2%
+ {\ifconditional\c_strc_floats_par_float
+ \hpack\bgroup
+ \d_strc_float_temp_height\ht\b_strc_floats_content
+ \hsmash{\hskip-\dimexpr#1+\wd\b_strc_floats_caption\relax\vbox to\d_strc_float_temp_height{#2}}%
+ \box\b_strc_floats_content
+ \egroup
+ \else
+ \begingroup
+ \d_strc_float_temp_height\ht\b_strc_floats_content
+ \setbox\scratchboxone\vbox{#2}%
+ \ifdim\htdp\scratchboxone>\htdp\b_strc_floats_content
+ \global\d_strc_floats_overflow\dimexpr\htdp\scratchboxone-\htdp\b_strc_floats_content\relax
+ \fi
+ \ht\scratchboxone\d_strc_float_temp_height
+ \everyleftofalignedline{\hsmash{\hskip-\dimexpr#1+\wd\scratchboxone\relax\box\scratchboxone}}%
+ \strc_floats_align_content{\box\b_strc_floats_content}%
+ \endgroup
+ \fi}
+
+\def\strc_floats_build_box_next_right_margin
+ {\strc_floats_build_box_next_right_margin_indeed\rightmargindistance}
+
+\def\strc_floats_build_box_next_left_margin
+ {\strc_floats_build_box_next_left_margin_indeed \leftmargindistance}
+
+\def\strc_floats_build_box_next_outer_margin
+ {\doifelserightpagefloat
+ {\strc_floats_build_box_next_right_margin_indeed\rightmargindistance}
+ {\strc_floats_build_box_next_left_margin_indeed \rightmargindistance}}
+
+\def\strc_floats_build_box_next_inner_margin
+ {\doifelserightpagefloat
+ {\strc_floats_build_box_next_left_margin_indeed \leftmargindistance}
+ {\strc_floats_build_box_next_right_margin_indeed\leftmargindistance}}
+
+\def\strc_floats_build_box_next % beware, we first check on left/rightmargin because there can be left/right also
+ {\let\next\strc_floats_build_box_next_left
+ \processallactionsinset[\floatcaptionlocation]
+ [ \v!outermargin=>\let\next\strc_floats_build_box_next_outer_margin,
+ \v!innermargin=>\let\next\strc_floats_build_box_next_inner_margin,
+ \v!leftmargin=>\let\next\strc_floats_build_box_next_left_margin,
+ \v!rightmargin=>\let\next\strc_floats_build_box_next_right_margin,
+ \v!lefthanging=>\let\next\strc_floats_build_box_next_left_hang,
+ \v!righthanging=>\let\next\strc_floats_build_box_next_right_hang,
+ \v!outer=>\let\next\strc_floats_build_box_next_outer,
+ \v!inner=>\let\next\strc_floats_build_box_next_inner,
+ \v!left=>\let\next\strc_floats_build_box_next_left,
+ \v!right=>\let\next\strc_floats_build_box_next_right]%
+ \next}
+
+\def\strc_floats_build_box_side
+ {\ifconditional\c_strc_floats_par_float
+ \let\next\strc_floats_build_box_high
+ \else
+ \let\next\strc_floats_build_box_middle
+ \processallactionsinset[\floatcaptionlocation]
+ [ \v!low=>\let\next\strc_floats_build_box_low,
+ \v!middle=>\let\next\strc_floats_build_box_middle,
+ \v!high=>\let\next\strc_floats_build_box_high]%
+ \fi
+ \next}
+
+\def\strc_floats_flush_right_caption_hang
+ {\hsmash{\rlap{\dotfskip{\floatcaptionparameter\c!distance}\box\b_strc_floats_caption}}}
+
+\def\strc_floats_flush_left_caption_hang
+ {\hsmash{\llap{\box\b_strc_floats_caption\dotfskip{\floatcaptionparameter\c!distance}}}}
+
+\def\strc_floats_flush_caption_hang
+ {\doifelseinset\v!righthanging\floatcaptionlocation
+ {\strc_floats_flush_right_caption_hang}
+ {\doifelseinset\v!lefthanging\floatcaptionlocation
+ {\strc_floats_flush_left_caption_hang}
+ {\doifelseinset\v!hang\floatcaptionlocation
+ {\doifelseinset\v!outer\floatcaptionlocation
+ {\doifelserightpagefloat{\strc_floats_flush_right_caption_hang}{\strc_floats_flush_left_caption_hang}}
+ {\doifelseinset\v!right\floatcaptiondirectives
+ {\strc_floats_flush_right_caption_hang}
+ {\strc_floats_flush_left_caption_hang}}}
+ {\box\b_strc_floats_caption}}}}
+
+\def\strc_floats_build_box_high
+ {\strc_floats_build_box_next{\strc_floats_between_stack\strc_floats_flush_caption_hang\vfill}}
+
+\def\strc_floats_build_box_low
+ {\strc_floats_build_box_next{\vfill\strc_floats_flush_caption_hang\strc_floats_between_stack}}
+
+\def\strc_floats_build_box_middle
+ {\strc_floats_build_box_next{\vfill\box\b_strc_floats_caption\vfill}}
+
+% \definefloat
+% [lefty][lefties][figure]
+% \setupfloat
+% [lefty]
+% [default=left,
+% rightmargindistance=-2cm,
+% leftmargindistance=-2cm]
+% \setupcaption
+% [lefty]
+% [location={bottom,overlay}]
+%
+% \starttext
+% \placelefty{}{} \input tufte \input tufte
+% \placelefty{}{} \input tufte \input tufte
+% \stoptext
+
+\def\strc_floats_build_box_top_stack_normal_overlay
+ {\vbox to \ht\b_strc_floats_content{\vss\strc_floats_build_box_top_stack_normal_content}}
+
+\def\strc_floats_build_box_top_stack_normal_content
+ {\d_strc_float_temp_width\wd\b_strc_floats_content
+ \ifconditional\c_strc_floats_par_float
+ \hpack{\strc_floats_locate_side_float{\box\b_strc_floats_caption}}%
+ \strc_floats_between_stack
+ \hpack{\hbox{\box\b_strc_floats_content}}%
+ \else
+ \page_otr_command_set_float_hsize
+ \hpack{\strc_floats_locate_text_float{\box\b_strc_floats_caption}}
+ \strc_floats_between_stack
+ \hpack{\strc_floats_align_content{\box\b_strc_floats_content}}%
+ \fi}
+
+\def\strc_floats_build_box_bottom_stack_normal_overlay
+ {\vbox to \ht\b_strc_floats_content{\strc_floats_build_box_bottom_stack_normal_content\vss}}
+
+\def\strc_floats_build_box_bottom_stack_normal_content
+ {\d_strc_float_temp_width\wd\b_strc_floats_content
+ \ifconditional\c_strc_floats_par_float
+ \hpack{\hpack{\box\b_strc_floats_content}}%
+ \strc_floats_between_stack
+ \hpack{\strc_floats_locate_side_float{\box\b_strc_floats_caption}}%
+ \else
+ \page_otr_command_set_float_hsize
+ \hpack{\strc_floats_align_content{\box\b_strc_floats_content}}%
+ \strc_floats_between_stack
+ \hpack{\strc_floats_locate_text_float{\box\b_strc_floats_caption}}%
+ \fi}
+
+\def\strc_floats_build_box_top_stack_normal
+ {\doifelseinset\v!overlay{\floatcaptionparameter\c!location}
+ \strc_floats_build_box_top_stack_normal_overlay
+ \strc_floats_build_box_top_stack_normal_content}
+
+\def\strc_floats_build_box_bottom_stack_normal
+ {\doifinset\v!overlay{\floatcaptionparameter\c!location}
+ \strc_floats_build_box_bottom_stack_normal_overlay
+ \strc_floats_build_box_bottom_stack_normal_content}
+
+\def\strc_floats_build_box_top_stack_grid
+ {\dp\b_strc_floats_caption\strutdepth
+ \setbox\scratchbox\vbox
+ {\d_strc_float_temp_width\wd\b_strc_floats_content
+ \hsize\d_strc_float_temp_width
+ \ifconditional\c_strc_floats_par_float
+ \strc_floats_locate_side_float{\box\b_strc_floats_caption}%
+ \vss\strc_floats_between_stack
+ \hpack{\box\b_strc_floats_content}%
+ \else
+ \page_otr_command_set_float_hsize
+ \strc_floats_locate_text_float{\box\b_strc_floats_caption}%
+ \vss\strc_floats_between_stack
+ \strc_floats_align_content{\box\b_strc_floats_content}%
+ \fi}%
+ \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy
+ \vpack to \noflines\lineheight{\unvbox\scratchbox}}
+
+\def\strc_floats_build_box_bottom_stack_grid
+ {\dp\b_strc_floats_caption\strutdepth
+ \setbox\scratchbox\vbox
+ {\d_strc_float_temp_width\wd\b_strc_floats_content
+ \hsize\d_strc_float_temp_width
+ \ifconditional\c_strc_floats_par_float
+ \hpack{\box\b_strc_floats_content}%
+ \vss\strc_floats_between_stack
+ \strc_floats_locate_side_float{\box\b_strc_floats_caption}%
+ \else
+ \page_otr_command_set_float_hsize
+ \strc_floats_align_content{\box\b_strc_floats_content}%
+ \vss\strc_floats_between_stack
+ \strc_floats_locate_text_float{\box\b_strc_floats_caption}%
+ \fi}%
+ \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy
+ \vpack to \noflines\lineheight{\unvbox\scratchbox}}
+
+\def\strc_floats_build_box_top_stack_stretch
+ {\dp\b_strc_floats_caption\strutdepth
+ \setbox\scratchbox\vpack
+ {\strc_floats_align_caption{\copy\b_strc_floats_caption}%
+ \strc_floats_align_content{\copy\b_strc_floats_content}}%
+ \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy
+ \vbox to \noflines\lineheight % pack ?
+ {\d_strc_float_temp_width\wd\b_strc_floats_content
+ \hsize\d_strc_float_temp_width
+ \ifconditional\c_strc_floats_par_float
+ \strc_floats_locate_side_float{\box\b_strc_floats_caption}%
+ \vss\strc_floats_between_stack\vss
+ \hpack{\box\b_strc_floats_content}%
+ \else
+ \page_otr_command_set_float_hsize
+ \strc_floats_locate_text_float{\box\b_strc_floats_caption}%
+ \vss\strc_floats_between_stack\vss
+ \strc_floats_align_content{\box\b_strc_floats_content}%
+ \fi}}
+
+\def\strc_floats_build_box_bottom_stack_stretch
+ {\dp\b_strc_floats_caption\strutdepth
+ \setbox\scratchbox\vpack
+ {\strc_floats_align_content{\copy\b_strc_floats_content}%
+ \strc_floats_align_caption{\copy\b_strc_floats_caption}}%
+ \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy
+ \vbox to \noflines\lineheight
+ {\d_strc_float_temp_width\wd\b_strc_floats_content
+ \hsize\d_strc_float_temp_width
+ \ifconditional\c_strc_floats_par_float
+ \hpack{\box\b_strc_floats_content}%
+ \vss\strc_floats_between_stack\vss
+ \strc_floats_locate_side_float{\box\b_strc_floats_caption}%
+ \else
+ \page_otr_command_set_float_hsize
+ \strc_floats_align_content{\box\b_strc_floats_content}%
+ \vss\strc_floats_between_stack\vss
+ \strc_floats_locate_text_float{\box\b_strc_floats_caption}%
+ \fi}}
+
+\def\strc_floats_build_box_top
+ {\let\next\strc_floats_build_box_top_stack_normal
+ \processfirstactioninset[\floatcaptionparameter\c!location]
+ [ \v!grid=>\let\next\strc_floats_build_box_top_stack_grid,
+ \v!lines=>\let\next\strc_floats_build_box_top_stack_stretch]% was \v!grid but interfered
+ \next}
+
+\def\strc_floats_build_box_bottom
+ {\let\next\strc_floats_build_box_bottom_stack_normal
+ \processfirstactioninset[\floatcaptionparameter\c!location]
+ [ \v!grid=>\let\next\strc_floats_build_box_bottom_stack_grid,
+ \v!lines=>\let\next\strc_floats_build_box_bottom_stack_stretch]% was \v!grid but interfered
+ \next}
+
+\def\strc_floats_relocate_caption_right#1{\strc_floats_align_caption{\hbox to \d_strc_float_temp_width{\hss#1}}}
+\def\strc_floats_relocate_caption_left #1{\strc_floats_align_caption{\hbox to \d_strc_float_temp_width{#1\hss}}}
+
+\permanent\protected\def\installfloatboxbuilder#1#2{\setvalue{\??floatbuilder#1}{#2}}
+
+\def\strc_floats_build_box
+ {\strc_floats_build_box_before
+ \global\setbox\floatbox\vbox % pack ? probably not
+ {\strc_floats_set_local_hsize
+ \forgetall
+ \ifconditional\c_floats_store_minimal_package
+ \strc_floats_build_box_separate_make
+ \else
+ % \let\floatcaptionarrangement\s!default
+ \let\floatcaptionarrangement\v!bottom % for Alan
+ \processcommacommand[\floatcaptionparameter\c!location]\strc_floats_build_box_step
+ \ifcsname\??floatbuilder\floatcaptionarrangement\endcsname
+ \lastnamedcs
+ \else
+ \strc_floats_build_box_default
+ \fi
+ \fi}%
+ \strc_floats_build_box_after}
+
+% \let\strc_floats_build_box_before\relax
+% \let\strc_floats_build_box_after \relax
+
+\def\strc_floats_build_box_before
+ {\let\currentfloatframed\currentfloat
+ \floatwidth\wd
+ \ifdim\wd\b_strc_floats_content>\wd\b_strc_floats_caption
+ \b_strc_floats_content\else\b_strc_floats_caption
+ \fi}
+
+\def\strc_floats_build_box_after
+ {\doifelseframed\floatframedparameter\strc_floats_build_box_after_indeed\relax}
+
+\def\strc_floats_build_box_after_indeed
+ {\global\setbox\floatbox\hpack
+ {\edef\m_width{\floatframedparameter\c!width}%
+ \ifx\m_width\v!fit
+ \let\m_width\floatwidth
+ \orelse\ifx\m_width\v!broad
+ \let\m_width\v!fit
+ \fi
+ \letfloatframedparameter\c!strut\v!no
+ \letfloatframedparameter\c!width\m_width
+ \inheritedfloatframedframed
+ {\box\floatbox}}}
+
+% special purpose: used in floatcombinations
+%
+% todo : keep float content and caption separated in local
+
+\newbox\b_strc_floats_separate_content
+\newbox\b_strc_floats_separate_caption
+
+\def\strc_floats_build_box_separate_set
+ {\settrue\c_floats_adapt_to_caption_width
+ \settrue\c_floats_store_minimal_package}
+
+% \def\strc_floats_build_box_separate_make
+% {\offinterlineskip
+% \vpack to \onepoint{\box\b_strc_floats_content}\break
+% \vpack to \onepoint{\box\b_strc_floats_caption}}
+
+%D Remark for \LMTX: we don't want to migrate inserts here so we unpack
+%D (could be a flag). When migrated, the inserts end up in the vertical
+%D list and we no longer have just a box (but inserts and lines again).
+
+\def\strc_floats_build_box_separate_make
+ {\savebox\??localfloatstack{\number\numexpr\c_strc_localfloats_n+1\relax:a}{\box\b_strc_floats_content}%
+ \savebox\??localfloatstack{\number\numexpr\c_strc_localfloats_n+1\relax:b}{\box\b_strc_floats_caption}}
+
+\protected\def\strc_floats_build_box_separate_split#1%
+ {\global\setbox\b_strc_floats_separate_content\vpack{\foundbox\??localfloatstack{\number#1:a}}%
+ \global\setbox\b_strc_floats_separate_caption\tpack{\foundbox\??localfloatstack{\number#1:b}}}
+
+% \def\strc_floats_build_box_step#1%
+% {\doifdefined{\??floatbuilder#1}{\def\floatcaptionarrangement{#1}\quitcommalist}}
+
+\def\strc_floats_build_box_step#1%
+ {\ifcsname\??floatbuilder#1\endcsname
+ \def\floatcaptionarrangement{#1}% \let\floatcaptionarrangement\commalistelement
+ \quitcommalist
+ \fi}
+
+\def\strc_floats_locate_text_float
+ {\let\next\strc_floats_align_caption
+ \processallactionsinset[\floatcaptionparameter\c!location]
+ [ \v!left=>\let\next\strc_floats_relocate_caption_left,
+ \v!right=>\let\next\strc_floats_relocate_caption_right,
+ \v!inner=>\doifelserightpagefloat{\let\next\strc_floats_relocate_caption_left }{\let\next\strc_floats_relocate_caption_right},
+ \v!outer=>\doifelserightpagefloat{\let\next\strc_floats_relocate_caption_right}{\let\next\strc_floats_relocate_caption_left }]%
+ \next}
+
+\installfloatboxbuilder \v!none \strc_floats_build_box_default
+\installfloatboxbuilder \s!default \strc_floats_build_box_default
+\installfloatboxbuilder \v!high \strc_floats_build_box_high
+\installfloatboxbuilder \v!low \strc_floats_build_box_low
+\installfloatboxbuilder \v!middle \strc_floats_build_box_middle
+
+\installfloatboxbuilder \v!rightmargin \strc_floats_build_box_side % added 2016-08-23
+\installfloatboxbuilder \v!leftmargin \strc_floats_build_box_side % added 2016-08-23
+\installfloatboxbuilder \v!innermargin \strc_floats_build_box_side % added 2016-08-23
+\installfloatboxbuilder \v!outermargin \strc_floats_build_box_side % added 2016-08-23
+
+\installfloatboxbuilder \v!left \strc_floats_build_box_side
+\installfloatboxbuilder \v!right \strc_floats_build_box_side
+\installfloatboxbuilder \v!inner \strc_floats_build_box_side % added 2016-08-23
+\installfloatboxbuilder \v!outer \strc_floats_build_box_side % added 2016-08-23
+
+\installfloatboxbuilder \v!lefthanging \strc_floats_build_box_side % added 2016-08-23
+\installfloatboxbuilder \v!righthanging \strc_floats_build_box_side % added 2016-08-23
+\installfloatboxbuilder \v!hang \strc_floats_build_box_side % added 2016-08-23
+
+\installfloatboxbuilder \v!top \strc_floats_build_box_top
+\installfloatboxbuilder \v!bottom \strc_floats_build_box_bottom
+
+% \setuplayout[grid=yes] \showgrid \setupcaptions[style=smallbodyfont,location=grid,inbetween=]
+%
+% \starttext
+% test \placefigure{} {\externalfigure[cow.pdf][frame=on,grid=yes]} test \page
+% test \placefigure{\input zapf\relax}{\externalfigure[cow.pdf][frame=on,grid=yes]} test \page
+% test \placefigure{} {\externalfigure[cow.pdf][frame=on,grid=depth]} test \page
+% test \placefigure{\input zapf\relax}{\externalfigure[cow.pdf][frame=on,grid=depth]} test \page
+% \stoptext
+
+% This might move to page-flt:
+
+\newif\ifpostponecolumnfloats \postponecolumnfloatsfalse % don't change
+
+\setnewconstant\postcenterfloatmethod\plusone
+
+\permanent\def\postcenterfloatbox#1%
+ {\scratchdimen
+ \ifcase\postcenterfloatmethod
+ #1% \wd\floatbox
+ \orelse\ifinsidecolumns
+ \ifpostponecolumnfloats\makeupwidth\else#1\fi
+ \orelse\ifdim#1>\hsize
+ \hsize
+ \else
+ \wd\floatbox
+ \fi
+ \global\setbox\floatbox\hbox to \scratchdimen
+ % {\hfill\box\floatbox\hfill}} % geen \hss, gaat mis in kolommen !
+ % {\hss \box\floatbox\hss }} % wel \hss, anders mis in colset
+ {\ifconditional\c_page_floats_center_box_global
+ \donetrue
+ \orelse\ifconditional\c_page_floats_center_box_local
+ \donetrue
+ \else
+ \donefalse
+ \fi
+ \ifdim\scratchdimen>\effectivehsize
+ \donefalse
+ \fi
+ \hss\ifdone\hskip\effectiveleftskip\fi
+ \box\floatbox
+ \ifdone\hskip\effectiverightskip\fi\hss}}
+
+\def\strc_floats_set_paragraph_variant
+ {\bgroup
+ \forgetall
+ \postponenotes
+ \dontcomplain
+ \setbox\b_strc_floats_content\vbox{\borderedfloatbox}% \vpack >?
+ %\page_backgrounds_add_local_to_box\b_strc_floats_content
+ \ifnofloatcaption
+ \global\setbox\floatbox\vpack{\box\b_strc_floats_content}%
+ \else
+ \strc_floats_check_caption_content
+ \strc_floats_prepare_side_caption
+ \setbox\b_strc_floats_caption\hbox{\floatcaptionparameter\c!command{\box\b_strc_floats_caption}}% \hpack ?
+ %\moveboxontogrid\b_strc_floats_caption{\floatcaptionparameter\c!grid}\d_strc_floats_caption_height
+ %\page_backgrounds_add_local_to_box\b_strc_floats_caption
+ \strc_floats_build_side_box
+ \fi
+ \egroup}
+
+\def\strc_floats_prepare_side_caption
+ {\dostarttagged\t!floatcaption\empty
+ \edef\p_strc_floats_caption_width{\floatcaptionparameter\c!width}%
+ \edef\p_strc_floats_caption_align{\floatcaptionparameter\c!align}%
+ \ifx\p_strc_floats_caption_width\v!max
+ \strc_floats_prepare_side_caption_max
+ \orelse\ifx\p_strc_floats_caption_width\v!fit
+ \strc_floats_prepare_side_caption_fit
+ \else
+ \strc_floats_prepare_side_caption_width
+ \fi
+ \dostoptagged}
+
+% these could be \??floatpreparesidecaption
+
+% \setupfloat[figure][location=left]
+% \setupcaption[figure][width=max]
+%
+% \placefigure{my figure caption my figure caption}{\framed[width=4cm,height=1cm]{}} \input tufte
+% \placefigure{my figure caption} {\framed[width=4cm,height=1cm]{}} \input tufte
+
+\def\strc_floats_prepare_side_caption_max
+ {\setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\wd\b_strc_floats_content
+ \strc_floats_make_complete_caption}}
+
+\def\strc_floats_prepare_side_caption_fit % or center when smaller
+ {\ifdim\wd\b_strc_floats_caption>\wd\b_strc_floats_content\relax
+ \setbox\b_strc_floats_caption\vbox
+ {\forgetall % needed?
+ \strc_floats_caption_set_align
+ \hsize\wd\b_strc_floats_content
+ \strc_floats_make_complete_caption}%
+ \else
+ % maybe we should listen to the align option here (now side floats need the max option
+ \setbox\b_strc_floats_caption\hpack to \wd\b_strc_floats_content
+ {\hss\hbox{\strc_floats_make_complete_caption}\hss}%
+ \fi}
+
+\def\strc_floats_prepare_side_caption_width
+ {\setbox\b_strc_floats_caption\vbox
+ {\strc_floats_caption_set_align
+ \hsize\p_strc_floats_caption_width % \wd\b_strc_floats_content
+ \strc_floats_make_complete_caption}}
+
+% % maybe (but then also prepare_page that way):
+%
+% \installcorenamespace{floatpreparesidecaption}
+%
+% \def\strc_floats_prepare_side_caption
+% {\dostarttagged\t!floatcaption\empty
+% \edef\p_strc_floats_caption_width{\floatcaptionparameter\c!width}%
+% \edef\p_strc_floats_caption_align{\floatcaptionparameter\c!align}%
+% \expandnamespacemacro\??floatpreparesidecaption\p_strc_floats_caption_width\s!unknown
+% \dostoptagged}
+%
+% \setvalue{\??floatpreparesidecaption\v!max}%
+% {\setbox\b_strc_floats_caption\vbox
+% {\strc_floats_caption_set_align
+% \hsize\wd\b_strc_floats_content
+% \strc_floats_make_complete_caption}}
+%
+% \setvalue{\??floatpreparesidecaption\v!fit}%
+% {\ifdim\wd\b_strc_floats_caption>\wd\b_strc_floats_content\relax
+% \setbox\b_strc_floats_caption\vbox
+% {\forgetall % needed?
+% \hsize\wd\b_strc_floats_content
+% \strc_floats_make_complete_caption}%
+% \else
+% \setbox\b_strc_floats_caption\hbox to \wd\b_strc_floats_content
+% {\hss\hbox{\strc_floats_make_complete_caption}\hss}%
+% \fi}
+%
+% \setvalue{\??floatpreparesidecaption\s!unknown}%
+% {\setbox\b_strc_floats_caption\vbox
+% {\strc_floats_caption_set_align
+% \hsize\p_strc_floats_caption_width % \wd\b_strc_floats_content
+% \strc_floats_make_complete_caption}}
+
+\def\strc_floats_locate_side_float#1%
+ {\begingroup
+ \alignstrutmode\zerocount
+ \hsize\d_strc_float_temp_width \forgetall
+ \alignedline{\floatparameter\c!location}\v!middle{#1}%
+ \endgroup}
+
+\def\strc_floats_build_side_box
+ {\let\strc_floats_align_content\relax
+ \let\strc_floats_align_caption\relax
+ \strc_floats_build_box}
+
+\def\strc_floats_set_box % todo : \global\setbox, currently messy
+ {\ifvisible
+ \par
+ \edef\floatcaptiondirectives{\floatparameter\c!location,\floatcaptionparameter\c!location}%
+ \ifconditional\c_strc_floats_par_float
+ \strc_floats_set_paragraph_variant
+ \else
+ \strc_floats_set_page_variant
+ \fi
+ \strc_floats_set_local_dimensions
+ \global\advance\totalnoffloats\plusone
+ \ifconditional\c_floats_store_minimal_package \else
+ \setbox\floatbox\hpack{\strc_float_save_data\box\floatbox}% still needed? we will do renumbering differently
+ \fi
+ \global\floatheight\htdp\floatbox
+ \global\floatwidth\wd\floatbox
+ \ifconditional\c_floats_store_minimal_package \else
+ \doifnotinset\v!margin\floatlocation % gaat namelijk nog fout
+ {\setbox\floatbox\vpack
+ {\parindent\zeropoint
+ \box\floatbox}}%
+ \fi
+ \wd\floatbox\floatwidth
+ \ifdim\dimexpr\floatheight+\lineheight\relax<\textheight \else
+ \global\floatheight\dimexpr\textheight-\lineheight\relax
+ \ht\floatbox\floatheight
+ \dp\floatbox\zeropoint
+ \showmessage\m!floatblocks{10}{\the\totalnoffloats}%
+ \fi
+ \fi}
+
+% \def\dooutput{\sidefloatoutput} % redefinition of \dooutput
+
+\definefloat
+ [\v!figure]
+ [\v!figures]
+
+\definefloat
+ [\v!table]
+ [\v!tables]
+
+\setupfloat
+ [\v!table]
+ [\c!frame=\v!off]
+
+\definefloat
+ [\v!intermezzo]
+ [\v!intermezzi]
+
+\definefloat
+ [\v!graphic]
+ [\v!graphics]
+
+% float strategy, replaces some of the above macros
+
+\installcorenamespace{floatmethods}
+
+\let\floatmethod \empty % set by lua
+\let\floatlabel \empty % set by lua
+\let\floatcolumn \empty % set by lua
+\let\floatrow \empty % set by lua
+\let\forcedfloatmethod\empty % set by lua and floatcombinations
+
+\permanent\protected\def\setfloatmethodvariables#1% \floatmethod \floatlabel \floatrow \floatcolumn
+ {\clf_analysefloatmethod{#1}} % move definition to lua end
+
+\permanent\protected\def\somesomewherefloat[#1]%
+ {\page_floats_save_somewhere_float\s!somewhere{#1}}
+
+\def\strc_floats_get_box
+ {\ifvisible
+% \let\floatlabel \empty
+% \let\floatcolumn\empty
+% \let\floatrow \empty
+% \setfloatmethodvariables\floatlocation
+ % todo: nog algemeen otr
+% \ifdefined\OTRSETsetpreferedcolumnslot
+% \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow
+% \fi
+ \ifcsname\??floatmethods\currentoutputroutine:\floatmethod\endcsname \else
+ \let\floatmethod\v!here
+ \fi
+ \ifempty\forcedfloatmethod \else
+ \let\floatmethod\forcedfloatmethod
+ \fi
+ \let\askedfloatmethod\floatmethod
+ \ifexporting \ifx\askedfloatmethod\v!here \else
+ \showmessage\m!floatblocks{15}{\askedfloatmethod,\v!here}%
+ \let\floatlocation\v!here
+ \fi \fi
+ % [] will go
+ \edef\floatlocationmethod{\floatmethod,\floatlocation}%
+ \csname\??floatmethods\currentoutputroutine:\floatmethod\endcsname
+ \fi}
+
+\installcorenamespace{floatsettings}
+
+\permanent\protected\def\installfloatmethod#1#2#3% routine keyword handler
+ {\setvalue{\??floatmethods#1:#2}{#3}}
+
+\permanent\protected\def\handlefloatmethod#1%
+ {\csname\??floatmethods\currentoutputroutine:#1\endcsname}
+
+% \protected\def\installfloatmethod#1#2#3% routine keyword handler
+% {\ifcsname\??floatsettings#1:#2\endcsname \else
+% \expandafter\newtoks\csname\??floatsettings#1:#2\endcsname
+% \fi
+% \setvalue{\??floatmethods#1:#2}{#3}}
+%
+% \protected\def\startfloatmethodsettings#1#2 #3\stopfloatmethodsettings
+% {\csname\??floatsettings#1:#2\endcsname\expandafter{\the\csname\??floatsettings#1:#2\endcsname#3}}
+%
+% \let\stopfloatmethodsettings\relax
+%
+% \protected\def\applyfloatmethodsettings#1#2{\the\??floatsettings#1:#2\endcsname}
+
+\definesystemconstant{tblr}
+\definesystemconstant{lrtb}
+\definesystemconstant{tbrl}
+\definesystemconstant{rltb}
+\definesystemconstant{btlr}
+\definesystemconstant{lrbt}
+\definesystemconstant{btrl}
+\definesystemconstant{rlbt}
+\definesystemconstant{fxtb}
+\definesystemconstant{fxbt}
+\definesystemconstant{fixd}
+
+% can move to page-one:
+
+\installfloatmethod \s!singlecolumn \v!here \page_one_place_float_here
+\installfloatmethod \s!singlecolumn \v!force \page_one_place_float_force
+\installfloatmethod \s!singlecolumn \v!left \page_one_place_float_left
+\installfloatmethod \s!singlecolumn \v!right \page_one_place_float_right
+\installfloatmethod \s!singlecolumn \v!text \page_one_place_float_text
+\installfloatmethod \s!singlecolumn \v!top \page_one_place_float_top
+\installfloatmethod \s!singlecolumn \v!bottom \page_one_place_float_bottom
+\installfloatmethod \s!singlecolumn \v!auto \page_one_place_float_auto
+\installfloatmethod \s!singlecolumn \v!margin \page_one_place_float_margin
+\installfloatmethod \s!singlecolumn \v!opposite \page_one_place_float_face
+\installfloatmethod \s!singlecolumn \v!page \page_one_place_float_page
+\installfloatmethod \s!singlecolumn \v!leftpage \page_one_place_float_leftpage
+\installfloatmethod \s!singlecolumn \v!rightpage \page_one_place_float_rightpage
+\installfloatmethod \s!singlecolumn \v!inmargin \page_one_place_float_inmargin
+\installfloatmethod \s!singlecolumn \v!inleft \page_one_place_float_leftmargin
+\installfloatmethod \s!singlecolumn \v!inright \page_one_place_float_rightmargin
+\installfloatmethod \s!singlecolumn \v!leftmargin \page_one_place_float_leftmargin
+\installfloatmethod \s!singlecolumn \v!rightmargin \page_one_place_float_rightmargin
+\installfloatmethod \s!singlecolumn \v!leftedge \page_one_place_float_leftedge
+\installfloatmethod \s!singlecolumn \v!rightedge \page_one_place_float_rightedge
+\installfloatmethod \s!singlecolumn \v!somewhere \page_one_place_float_somewhere
+\installfloatmethod \s!singlecolumn \v!backspace \page_one_place_float_backspace
+\installfloatmethod \s!singlecolumn \v!cutspace \page_one_place_float_cutspace
+\installfloatmethod \s!singlecolumn \s!tblr \page_one_place_float_top
+\installfloatmethod \s!singlecolumn \s!lrtb \page_one_place_float_top
+\installfloatmethod \s!singlecolumn \s!tbrl \page_one_place_float_top
+\installfloatmethod \s!singlecolumn \s!fxtb \page_one_place_float_top
+\installfloatmethod \s!singlecolumn \s!rltb \page_one_place_float_top
+\installfloatmethod \s!singlecolumn \s!btlr \page_one_place_float_bottom
+\installfloatmethod \s!singlecolumn \s!lrbt \page_one_place_float_bottom
+\installfloatmethod \s!singlecolumn \s!btrl \page_one_place_float_bottom
+\installfloatmethod \s!singlecolumn \s!rlbt \page_one_place_float_bottom
+\installfloatmethod \s!singlecolumn \s!fxbt \page_one_place_float_bottom
+\installfloatmethod \s!singlecolumn \s!fixd \page_one_place_float_force
+
+%D Local floats:
+
+\installcorenamespace{localfloats}
+\installcorenamespace{localfloatstack}
+
+\installsetuponlycommandhandler \??localfloats {localfloats}
+
+\setuplocalfloats
+ [%\c!before=\blank,
+ %\c!after=\blank,
+ \c!inbetween=\blank]
+
+\initializeboxstack\??localfloatstack
+
+\newcount\c_strc_localfloats_n \let\noflocalfloats\c_strc_localfloats_n
+
+\permanent\protected\def\resetlocalfloats
+ {\global\c_strc_localfloats_n\zerocount
+ \initializeboxstack\??localfloatstack}
+
+\permanent\protected\def\somelocalfloat
+ {\global\advance\c_strc_localfloats_n\plusone
+ \savebox\??localfloatstack{\number\c_strc_localfloats_n}{\box\floatbox}}
+
+\permanent\protected\def\getlocalfloats
+ {\dorecurse\c_strc_localfloats_n
+ {\ifnum\recurselevel=\plusone % 1\relax
+ \directlocalfloatsparameter\c!before
+ \else
+ \directlocalfloatsparameter\c!inbetween
+ \fi
+ \dontleavehmode\hpack{\foundbox\??localfloatstack\recurselevel}% \restorebox...
+ \ifnum\recurselevel=\c_strc_localfloats_n\relax
+ \directlocalfloatsparameter\c!after
+ \fi}}
+
+\permanent\protected\def\flushlocalfloats
+ {\getlocalfloats
+ \resetlocalfloats}
+
+% \protected\def\getlocalfloat#1%
+% {\normalexpanded{\foundbox{\??localfloatstack}{\number#1}}}% \vbox{\restorebox...}
+
+\permanent\protected\def\getlocalfloat#1%
+ {\foundbox\??localfloatstack{\number#1}} % \vbox{\restorebox...}
+
+\permanent\protected\def\forcelocalfloats
+ {\let\forcedfloatmethod\v!local}
+
+\installfloatmethod \s!singlecolumn \v!local \somelocalfloat
+\installfloatmethod \s!multicolumn \v!local \somelocalfloat
+\installfloatmethod \s!mixedcolumn \v!local \somelocalfloat
+\installfloatmethod \s!columnset \v!local \somelocalfloat
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/strc-itm.mklx b/tex/context/base/mkiv/strc-itm.mklx
index ab558e8a8..0b9ae347f 100644
--- a/tex/context/base/mkiv/strc-itm.mklx
+++ b/tex/context/base/mkiv/strc-itm.mklx
@@ -341,16 +341,16 @@
%D Global states
\def\strc_itemgroups_store_continue_state#options#settings%
- {\setxvalue{\??itemgroupoption \currentitemgroup}{\strc_itemgroups_process_options{#options}}%
- \setgvalue{\??itemgroupsetting\currentitemgroup}{\setupcurrentitemgroup[#settings]}}
+ {\global\edefcsname\??itemgroupoption \currentitemgroup\endcsname{\strc_itemgroups_process_options{#options}}%
+ \global\defcsname \??itemgroupsetting\currentitemgroup\endcsname{\setupcurrentitemgroup[#settings]}}
\def\strc_itemgroups_fetch_continue_state
{\csname\??itemgroupoption \currentitemgroup\endcsname
\csname\??itemgroupsetting\currentitemgroup\endcsname}
\def\strc_itemgroups_reset_continue_state
- {\expandafter\glet\csname\??itemgroupoption \currentitemgroup\endcsname\relax
- \expandafter\glet\csname\??itemgroupsetting\currentitemgroup\endcsname\relax}
+ {\global\letcsname\??itemgroupoption \currentitemgroup\endcsname\relax
+ \global\letcsname\??itemgroupsetting\currentitemgroup\endcsname\relax}
% These will become keywords. We will also add a feature to keep the while set
% together.
@@ -1603,7 +1603,7 @@
\ifx\currentinterface \s!english \else
- \def\next#1#2{\ifcsname#1\endcsname\else\enforced\expandafter\let\csname#1\endcsname#2\fi}
+ \def\next#1#2{\ifcsname#1\endcsname\else\enforced\letcsname#1\endcsname#2\fi}
\etoksapp\itemgroupcommands{%
\next{\v!item }\strc_itemgroups_start_do_item
diff --git a/tex/context/base/mkiv/strc-lab.mkxl b/tex/context/base/mkiv/strc-lab.mkxl
index f93114870..a480f782e 100644
--- a/tex/context/base/mkiv/strc-lab.mkxl
+++ b/tex/context/base/mkiv/strc-lab.mkxl
@@ -170,7 +170,7 @@
% no start stop here
-\expandafter\let\csname\??constructionmainhandler\v!label\expandafter\endcsname\csname\??constructionmainhandler\v!description\endcsname
+\letcsname\??constructionmainhandler\v!label\expandafter\endcsname\csname\??constructionmainhandler\v!description\endcsname
\protected\setevalue{\??constructioncommandhandler\v!label}%
{\csname\??constructionstarthandler\v!construction\endcsname
diff --git a/tex/context/base/mkiv/strc-not.mklx b/tex/context/base/mkiv/strc-not.mklx
index e49bf6269..90302095c 100644
--- a/tex/context/base/mkiv/strc-not.mklx
+++ b/tex/context/base/mkiv/strc-not.mklx
@@ -436,11 +436,11 @@
% so far
-%expandafter\let\csname\??constructionstarthandler \v!notation\expandafter\endcsname\csname\??constructionstarthandler \v!enumeration\endcsname
-\expandafter\let\csname\??constructionstarthandler \v!notation\expandafter\endcsname\csname\??constructionstarthandler \v!construction\endcsname % no par mess
-\expandafter\let\csname\??constructionstophandler \v!notation\expandafter\endcsname\csname\??constructionstophandler \v!enumeration \endcsname
-\expandafter\let\csname\??constructioncommandhandler\v!notation\expandafter\endcsname\csname\??constructioncommandhandler\v!enumeration \endcsname
-\expandafter\let\csname\??constructiontexthandler \v!notation\expandafter\endcsname\csname\??constructiontexthandler \v!enumeration \endcsname
+%letcsname\??constructionstarthandler \v!notation\expandafter\endcsname\csname\??constructionstarthandler \v!enumeration\endcsname
+\letcsname\??constructionstarthandler \v!notation\expandafter\endcsname\csname\??constructionstarthandler \v!construction\endcsname % no par mess
+\letcsname\??constructionstophandler \v!notation\expandafter\endcsname\csname\??constructionstophandler \v!enumeration \endcsname
+\letcsname\??constructioncommandhandler\v!notation\expandafter\endcsname\csname\??constructioncommandhandler\v!enumeration \endcsname
+\letcsname\??constructiontexthandler \v!notation\expandafter\endcsname\csname\??constructiontexthandler \v!enumeration \endcsname
\protected\setvalue{\??constructionmainhandler\v!notation}#following%
{\iftrialtypesetting \else
@@ -865,12 +865,12 @@
\permanent\protected\def\currentnoterulecommandcommand{\noteparameter\c!rulecommand}
\permanent\protected\def\currentnoterulecommandnormal {\normalnoterule} % no let as it can be changed afterwards
-\permanent\protected\def\letcurrentnoterulecommand{\enforced\expandafter\let\csname\??notecommand\currentnote\endcsname}
-\permanent\protected\def\letcurrentnoterulealign {\enforced\expandafter\let\csname\??notealign \currentnote\endcsname}
+\permanent\protected\def\letcurrentnoterulecommand{\enforced\letcsname\??notecommand\currentnote\endcsname}
+\permanent\protected\def\letcurrentnoterulealign {\enforced\letcsname\??notealign \currentnote\endcsname}
\appendtoks
- \enforced\expandafter\let\csname\??notecommand\currentnote\endcsname\currentnoterulecommandnormal
- \enforced\expandafter\let\csname\??notealign \currentnote\endcsname\lefttoright
+ \enforced\letcsname\??notecommand\currentnote\endcsname\currentnoterulecommandnormal
+ \enforced\letcsname\??notealign \currentnote\endcsname\lefttoright
\to \everysynchronizenote
\def\strc_notes_set_rule
@@ -1501,7 +1501,7 @@
{\ifcase\insertionmigrationmode
\ifconditional\postponingnotes\else
\global\settrue\postponingnotes
- \glet\flushnotes\doflushnotes
+ \enforced\glet\flushnotes\doflushnotes
\clf_postponenotes
\fi
\fi}
@@ -1534,7 +1534,7 @@
\clf_flushpostponednotes% this also resets the states !
\global\setfalse\postponednote
\global\setfalse\postponingnotes
- \glet\flushnotes\relax
+ \enforced\glet\flushnotes\relax
\endgroup
\fi}
diff --git a/tex/context/base/mkiv/strc-ref.mklx b/tex/context/base/mkiv/strc-ref.mklx
new file mode 100644
index 000000000..2f3475e50
--- /dev/null
+++ b/tex/context/base/mkiv/strc-ref.mklx
@@ -0,0 +1,2196 @@
+%D \module
+%D [ file=strc-ref,
+%D version=2008.10.20,
+%D title=\CONTEXT\ Structure Macros,
+%D subtitle=Cross Referencing,
+%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.
+
+% todo: (1) configure references, (2) rendering => with presets
+%
+% \defineconversionset[default][Character,number,Romannumerals,Character][number]
+% \defineseparatorset [default][.,.,--][.]
+% \setuphead[subsection][sectionstopper=),sectionsegments=4:4]
+% \setupreferencestructureprefix[default][prefixsegments=2:4]
+% \setupreferencestructureprefix[figure][default][prefixsegments=3:4]
+% \chapter {One}
+% \section {One}
+% \subsection[sec:test]{Two}
+% See \in[sec:test] and \in[fig:xx] and \in[fig:yy]
+% \placefigure[here][fig:xx]{}{}
+% \placefigure[here][fig:yy]{}{}
+
+\writestatus{loading}{ConTeXt Structure Macros / Cross Referencing}
+
+\registerctxluafile{strc-rsc}{}
+\registerctxluafile{strc-ref}{}
+\registerctxluafile{node-ref}{optimize}
+
+\unprotect
+
+% todo : unknown/illegal reference no arg
+% todo : +n pages check on 'samepage' (contrastcolor)
+% todo : multiple text in reference
+
+% Makes more sense to build action data first, especially now openaction etc are
+% supported.
+%
+% \definespecial\doexecuteactionchain w h
+% \definespecial\dosetgotolocation
+% \definespecial\dosetexecuteJScode
+% ...
+
+%D This module deals with referencing. In \CONTEXT\ referencing is one of the core
+%D features, although at a first glance probably nobody will notice. This is good,
+%D because referencing should be as hidden as possible.
+%D
+%D Before we start implementing functionality we provide a way to set up this
+%D mechanism.
+%D
+%D \showsetup{setupreferencing}
+%D
+%D In interactive documents verbose references don't always make sense (what is a
+%D page number in an unnumbered document). By setting the \type{interaction}
+%D variable, one can influences the way interactive references are set.
+
+\let\referenceprefix\empty
+
+\installcorenamespace{referencing}
+
+\installdirectcommandhandler \??referencing {referencing} % \??referencing
+
+\newif\ifreferencing \referencingtrue
+
+\appendtoks
+ \edef\p_state{\referencingparameter\c!state}%
+ \ifx\p_state\v!start
+ \referencingtrue
+ \else
+ \referencingfalse
+ \fi
+\to \everysetupreferencing
+
+%D In paper documents, referencing comes down to cross referencing, but in
+%D their interactive counterparts, is also involves navigation. Many features
+%D implemented here are therefore closely related to navigation.
+%D
+%D Many \CONTEXT\ commands can optionally be fed with a reference. Such a
+%D reference, when called upon, returns the number of a figure, table, chapter
+%D etc, a piece of text, or a pagenumber.
+%D
+%D There are three ways of defining a reference:
+%D
+%D \starttyping
+%D \pagereference[here]
+%D \textreference[here]{some text}
+%D \stoptyping
+%D
+%D the third alternative combines them in:
+%D
+%D \starttyping
+%D \reference[here]{some text}
+%D \stoptyping
+
+\permanent\protected\def\showreferences{\enabletrackers[nodes.references.show,nodes.destinations.show]}
+
+%D These are implemented in a low level form as:
+
+\permanent\tolerant\protected\def\textreference [#labels]{\strc_references_set_named_reference\s!text{#labels}{}}
+\permanent\tolerant\protected\def\pagereference [#labels]{\strc_references_set_named_reference\s!page{#labels}{}{}}
+\permanent\tolerant\protected\def\reference [#labels]{\strc_references_set_named_reference\s!full{#labels}{}}
+\permanent\tolerant\protected\def\setreference [#labels]#spacer[#settings]{\strc_references_set_named_reference\s!user{#labels}{#settings}{}}
+
+\permanent\protected\def\dosetdirectpagereference#1{\strc_references_set_named_reference\s!page{#1}{}{}} % low level, maybe use _
+
+\permanent\protected\def\usereferenceparameter#1% faster local variant
+ {\edef\m_strc_references_asked{#1\c!reference}%
+ \ifempty\m_strc_references_asked\else
+ \dosetdirectpagereference\m_strc_references_asked
+ \fi}
+
+%D Actually there is not much difference between a text and a full reference, but
+%D it's the concept that counts. The low level implementation is:
+
+\newcount\lastreferenceattribute
+\newcount\lastdestinationattribute
+
+\def\strc_references_finish#prefix#reference#internal% gets expanded anyway
+ {\normalexpanded{\clf_deferredenhancereference{#prefix}{#reference}}}
+
+\permanent\let\dofinishreference\strc_references_finish % used at lua end
+
+%D This is somewhat tricky: we want to keep the reference with the following word but
+%D that word should also hyphenate. We need to find a better way.
+
+% 0 = nothing
+% 1 = bind to following word
+
+\setnewconstant\c_strc_references_bind_state\plusone
+
+\def\strc_references_inject_before
+ {}
+
+\def\strc_references_inject_after
+ {\ifcase\c_strc_references_bind_state
+ % nothing
+ \or
+ \prewordbreak % to be tested: \removeunwantedspaces\permithyphenation
+ \fi}
+
+
+\protected\def\strc_references_set_named_reference
+ {\ifreferencing
+ \expandafter\strc_references_set_named_reference_indeed
+ \else
+ \expandafter\gobblefourarguments
+ \fi}
+
+\newbox\b_strc_destination_nodes
+
+\protected\def\strc_references_flush_destination_nodes
+ {\ifvoid\b_strc_destination_nodes \else
+ \unhbox\b_strc_destination_nodes
+ \fi}
+
+\def\strc_references_placeholder
+ {\ifempty\dotaggedplaceholder\else
+ \c_attr_destination\lastdestinationattribute
+ \dotaggedplaceholder
+ \fi}
+
+\protected\def\strc_references_destination_point_yes
+ {\strc_references_inject_before % new
+ \dostarttagged\t!reference\empty
+ \dontleavehmode\hbox attr \destinationattribute\lastdestinationattribute\bgroup
+ \strc_references_flush_destination_nodes
+ \strc_references_placeholder
+ \egroup
+ \dostoptagged
+ \strc_references_inject_after}
+
+\protected\def\strc_references_destination_point_nop
+ {\strc_references_inject_before % new
+ \dostarttagged\t!reference\empty
+ \dontleavehmode\hbox \bgroup
+ \strc_references_flush_destination_nodes
+ \strc_references_placeholder
+ \egroup
+ \dostoptagged
+ \strc_references_inject_after}
+
+\protected\def\strc_references_start_destination_nodes % messy but we need the delay
+ {\setbox\b_strc_destination_nodes\hbox\bgroup} % also sets lastdestinationattribute
+
+\protected\def\strc_references_stop_destination_nodes
+ {\normalexpanded{\egroup\lastdestinationattribute\the\lastdestinationattribute\relax}}
+
+\protected\def\strc_references_set_named_reference_indeed#kind#labels#userdata#text% labels userdata text -> todo: userdata
+ {\ifreferencing
+ % we could have a more efficient one for page references but for the moment
+ % we don't care too much
+ \edef\currentreferencekind {#kind}%
+ \edef\currentreferencelabels {#labels}%
+ \edef\currentreferenceuserdata {#userdata}%
+ \edef\currentreferenceexpansion{\referencingparameter\c!expansion}% {\referenceparameter\c!expansion}
+ \ifempty\currentreferencelabels
+ \lastdestinationattribute\attributeunsetvalue
+ \else
+ \ifx\currentreferenceexpansion\s!xml
+ \xmlstartraw
+ \xdef\currentreferencedata{#text}% data, no text else conflict
+ \xmlstopraw
+ \glet\currentreferencecoding\s!xml
+ \else
+ \ifx\currentreferenceexpansion\v!yes
+ \xdef\currentreferencedata{#text}%
+ \else
+ \xdef\currentreferencedata{\detokenize{#text}}%
+ \fi
+ \glet\currentreferencecoding\s!tex
+ \fi
+ % beware, the structures.references.set writes a
+ \setnextinternalreference
+ \strc_references_start_destination_nodes
+ \clf_setdestinationattribute
+ {%
+ references {%
+ internal \locationcount
+ % block {\currentsectionblock}%
+ view {\interactionparameter\c!focus}%
+ \ifempty\referenceprefix\else
+ prefix {\referenceprefix}%
+ \fi
+ reference {\currentreferencelabels}%
+ }%
+ metadata {%
+ kind {\currentreferencekind}%
+ \ifx\currentreferencekind\s!page\else
+ \ifx\currentreferencecoding\s!xml
+ xmlroot {\xmldocument}%
+ \fi
+ catcodes \catcodetable
+ \fi
+ }%
+ \ifempty\currentreferencedata\else
+ entries {%
+ text {\currentreferencedata}%
+ }%
+ \fi
+ \ifempty\currentreferenceuserdata\else
+ userdata {\detokenize{#userdata}}%
+ \fi
+ }%
+ \relax
+ \strc_references_stop_destination_nodes
+ \fi
+ \else
+ \setbox\b_strc_destination_nodes\emptyhbox
+ \lastdestinationattribute\attributeunsetvalue
+ \fi
+ % will become obsolete:
+ \xdef\currentdestinationattribute{\number\lastdestinationattribute}%
+ % will become an option:
+ \ifnum\lastdestinationattribute>\zerocount
+ \strc_references_destination_point_yes
+ \orelse\ifvoid\b_strc_destination_nodes\else
+ \strc_references_destination_point_nop
+ \fi}
+
+\def\strc_references_set_page_only_destination_attribute#labels% could in fact be fully expandable
+ {\ifreferencing
+ \edef\currentreferencelabels{#labels}%
+ \ifempty\currentreferencelabels
+ \setbox\b_strc_destination_nodes\emptyhbox
+ \lastdestinationattribute\attributeunsetvalue
+ \else
+ \strc_references_start_destination_nodes
+ \setnextinternalreference
+ \clf_setdestinationattribute
+ {%
+ references {%
+ internal \locationcount
+ % block {\currentsectionblock}%
+ view {\interactionparameter\c!focus}%
+ \ifempty\referenceprefix\else
+ prefix {\referenceprefix}%
+ \fi
+ reference {\currentreferencelabels}%
+ }%
+ metadata {%
+ kind {page}%
+ }%
+ }%
+ \relax
+ \strc_references_stop_destination_nodes
+ \fi
+ \else
+ \setbox\b_strc_destination_nodes\emptyhbox
+ \lastdestinationattribute\attributeunsetvalue
+ \fi}
+
+\protected\def\strc_references_direct_full_user#user#labels#text%
+ {\ifreferencing
+ \strc_references_start_destination_nodes
+ \setnextinternalreference
+ \edef\m_strc_references_user{#user}%
+ \edef\m_strc_references_text{#text}%
+ \clf_setdestinationattribute
+ {%
+ references {%
+ internal \locationcount
+ % block {\currentsectionblock}%
+ view {\interactionparameter\c!focus}%
+ \ifempty\referenceprefix\else
+ prefix {\referenceprefix}%
+ \fi
+ reference {#labels}%
+ }%
+ metadata {%
+ kind {\s!full}%
+ }%
+ \ifempty\m_strc_references_text \else
+ entries {%
+ text {\m_strc_references_text}%
+ }%
+ \fi
+ \ifempty\m_strc_references_user \else
+ userdata {\m_strc_references_user}% \detokenize\expandafter{\normalexpanded{...}}
+ \fi
+ }%
+ \relax
+ \strc_references_stop_destination_nodes
+ \else
+ \setbox\b_strc_destination_nodes\emptyhbox
+ \lastdestinationattribute\attributeunsetvalue
+ \fi
+ % will become obsolete:
+ \xdef\currentdestinationattribute{\number\lastdestinationattribute}%
+ % will become an option:
+ \ifnum\lastdestinationattribute>\zerocount
+ \strc_references_destination_point_yes
+ \orelse\ifvoid\b_strc_destination_nodes\else
+ \strc_references_destination_point_nop
+ \fi}
+
+\protected\def\strc_references_direct_full
+ {\strc_references_direct_full_user\empty}
+
+\permanent\let\dodirectfullreference\strc_references_direct_full % for at lua end (no longer)
+
+\def\strc_references_set_page_only_destination_box_attribute#cs#labels%
+ {\strc_references_set_page_only_destination_attribute{#labels}%
+ \ifnum\lastdestinationattribute>\zerocount
+ \edef#cs{attr \destinationattribute\number\lastdestinationattribute}%
+ \else
+ \let#cs\empty
+ \fi}
+
+%D It's about time to clean up references .. stable enough now.
+
+\permanent\protected\def\boxreference[#1]%
+ {\begingroup
+ \dowithnextbox
+ {\strc_references_set_page_only_destination_attribute{#1}%
+ \hpack % \hbox
+ \ifnum\lastdestinationattribute=\attributeunsetvalue\else attr \destinationattribute \lastdestinationattribute \fi
+ {\box\b_strc_destination_nodes\box\nextbox}%
+ \endgroup}}
+
+\permanent\protected\def\hboxreference[#1]{\boxreference[#1]\hbox}
+\permanent\protected\def\vboxreference[#1]{\boxreference[#1]\vbox}
+
+% \ifx\currentdestinationattribute\empty
+% \begingroup\c_attr_destination\currentdestinationattribute\emptyhbox\endgroup % todo
+% \fi
+
+\def\defaultreferencepage#text{[[[#text]]]}
+\def\defaultreferencetext#text{[[[#text]]]}
+
+%D For internal usage:
+
+\def\strc_references_set_simple_reference#label%
+ {\iflocation
+ \strc_references_start_destination_nodes
+ \setnextinternalreference
+ \clf_setdestinationattribute
+ {%
+ references {%
+ view {\interactionparameter\c!focus}%
+ \ifempty\referenceprefix\else
+ prefix {\referenceprefix}%
+ \fi
+ reference {#label}%
+ internal \locationcount
+ }%
+ metadata {%
+ kind {\s!page}%
+ }%
+ }%
+ \relax
+ \strc_references_stop_destination_nodes
+ \xdef\currentdestinationattribute{\number\lastdestinationattribute}%
+ \else
+ \setbox\b_strc_destination_nodes\emptyhbox
+ \xdef\currentdestinationattribute{\number\attributeunsetvalue}%
+ \fi}
+
+\def\strc_references_set_simple_internal_reference#label% no prefix
+ {\iflocation
+ \strc_references_start_destination_nodes
+ \setnextinternalreference
+ \clf_setdestinationattribute
+ {%
+ references {%
+ view {\interactionparameter\c!focus}%
+ reference {#label}%
+ internal \locationcount
+ }%
+ metadata {%
+ kind {\s!page}%
+ }%
+ }%
+ \relax
+ \strc_references_stop_destination_nodes
+ \xdef\currentdestinationattribute{\number\lastdestinationattribute}%
+ \else
+ \setbox\b_strc_destination_nodes\emptyhbox
+ \xdef\currentdestinationattribute{\number\attributeunsetvalue}%
+ \fi}
+
+\def\strc_references_get_simple_reference#label%
+ {\iflocation
+ \clf_injectreference
+ {\referenceprefix}%
+ {#label}%
+ {%
+ height \ht\strutbox
+ depth \dp\strutbox
+ \extrareferencearguments
+ }%
+ \relax
+ \xdef\currentreferenceattribute{\number\lastreferenceattribute}%
+ \else
+ \xdef\currentreferenceattribute{\number\attributeunsetvalue}%
+ \fi}
+
+%D \macros
+%D {contentreference}
+%D
+%D \starttyping
+%D \setupinteraction
+%D [state=start,
+%D focus=standard]
+%D
+%D \setupheader
+%D [state=stop]
+%D
+%D See page \goto{page 2}[page2] \page
+%D
+%D \contentreference
+%D [page2]
+%D [offset=1cm,toffset=2cm,frame=on]
+%D {\externalfigure[cow.pdf][factor=fit]}
+%D
+%D \stoptyping
+
+\permanent\tolerant\protected\def\contentreference[#1]#*[#2]%
+ {\ifarguments
+ \expandafter\gobbletwoarguments
+ \or
+ \expandafter\strc_references_content_pickup_nop
+ \else
+ \expandafter\strc_references_content_pickup_yes
+ \fi{#1}{#2}}
+
+\def\strc_references_content_pickup_yes#1#2%
+ {\hbox\bgroup\dowithnextbox{\strc_references_content_yes_finish{#1}{#2}}\hbox}
+
+\def\strc_references_content_pickup_nop#1#2%
+ {\hbox\bgroup\dowithnextbox{\strc_references_content_nop_finish{#1}{#2}}\hbox}
+
+\def\strc_references_content_yes_finish#1#2%
+ {\scratchwidth \wd\nextbox
+ \scratchheight\ht\nextbox
+ \scratchdepth \dp\nextbox
+ \setbox\nextbox\hpack
+ {\framed[\c!frame=\v!off,#2]{\box\nextbox}}%
+ \strc_references_set_simple_reference{#1}%
+ \setbox\nextbox\hpack attr \destinationattribute \currentdestinationattribute % \hpack ?
+ {\strc_references_flush_destination_nodes
+ \box\nextbox}%
+ \setbox\nextbox\hpack{\box\nextbox}%
+ \wd\nextbox\scratchwidth
+ \ht\nextbox\scratchheight
+ \dp\nextbox\scratchdepth
+ \box\nextbox
+ \egroup}
+
+\def\strc_references_content_nop_finish#1#2%
+ {\strc_references_set_simple_reference{#1}%
+ \hpack attr \destinationattribute \currentdestinationattribute % \hpack ?
+ {\strc_references_flush_destination_nodes
+ \box\nextbox}%
+ \egroup}
+
+%D \macros
+%D {everyreference}
+%D
+%D For rather tricky purposes, one can assign sanitizing macros to \type
+%D {\everyreference} (no longer that relevant).
+
+\newevery \everyreference \relax
+
+%D This is really needed, since for instance Polish has a different alphabet and
+%D needs accented entries in registers.
+
+\appendtoks
+ \cleanupfeatures
+\to \everyreference
+
+%D We did not yet discuss prefixing. Especially in interactive documents, it's not
+%D always easy to keep track of duplicate references. The prefix mechanism, which we
+%D will describe later on, solves this problem. By (automatically) adding a prefix
+%D one keeps references local, but the global ones in view. To enable this feature,
+%D we explictly split the prefix from the reference.
+
+\let\referenceprefix\empty
+
+%D For a long time the only way to access an external file was to use the file
+%D prefix (\type {somefile::}. However, when you split up a document, redefining the
+%D references may be such a pain, that another approach is feasible. By setting the
+%D \type {autofile} variable to \type {yes} or \type {page}, you can access the
+%D reference directly.
+%D
+%D \starttabulate[||||]
+%D \NC filename::tag \NC page(filename::pnum) \NC tag \NC\NR
+%D \NC $\star$ \NC \NC \NC\NR
+%D \NC $\star$ \NC $\star$ \NC $\star$ \NC\NR
+%D \NC \NC $\star$ \NC \NC\NR
+%D \stoptabulate
+
+\permanent\protected\def\usereferences[#filename]{} % obsolete
+
+%D As mentioned we will also use the cross reference mechanism for navigational
+%D purposes. The main reason for this is that we want to treat both categories
+%D alike:
+%D
+%D \starttyping
+%D \goto{go back}[PreviousJump]
+%D \goto{colofon}[colofon page]
+%D \stoptyping
+%D
+%D Here \type{PreviousJump} is handled by the viewer, while the
+%D \type{colofon page} reference is, apart from hyperlinking, a
+%D rather normal reference.
+%D
+%D We already saw that cross refences are written to and read from a file. The pure
+%D navigational ones don't need to be written to file, but both for fast processing
+%D and transparant integration, they are saved internally as a sort of reference. We
+%D can easily distinguish such system references from real cross reference ones by
+%D their tag.
+%D
+%D We also use the odd/even characteristic to determine the page state.
+
+\let\currentrealreference \empty
+\let\currentpagereference \empty
+\let\currenttextreference \empty
+\let\currentreferenceorder \empty
+\let\currentsubtextreference \empty
+\let\currentsubsubtextreference\empty
+
+\newcount\referencehastexstate % set in backend
+
+% referencepagestate:
+%
+% 0 = no page ref, 1=same page, 2=before, 3=after
+
+%D Cross references appear as numbers (figure~1.1, chapter~2) or pagenumbers
+%D (page~2, page 3--2), and are called with \type {\in} and \type {\at}. In
+%D interactive documents we also have \type {\goto}, \type {\button} and alike.
+%D These are more versatile and look like:
+%D
+%D \starttyping
+%D \goto[reference]
+%D \goto[outer reference::]
+%D \goto[outer reference::inner reference]
+%D \goto[operation(argument)]
+%D \goto[operation(action{argument,argument})]
+%D \goto[action]
+%D \goto[action{argument}]
+%D \stoptyping
+%D
+%D The first one is a normal reference, the second and third are references to a
+%D file or \URL. The brace delimited references for instance refer to a \JAVASCRIPT.
+%D The last example shows that we can pass arguments to the actions.
+%D
+%D Now we've come to the testing step. As we can see below, this macro does bit more
+%D than testing: it also resolves the reference. This means that whenever we test
+%D for the existance of a reference at an outer level, we have all the relevant
+%D properties of that reference avaliable inside the true branche~(\type {#2}).
+%D
+%D The prefix has to do with localizing references. When a prefix is set, looking
+%D for a reference comes to looking for the prefixed one, and when not found,
+%D looking for the non prefixed one. Consider for instance the prefix set to \type
+%D {sidetrack}.
+%D
+%D \starttyping
+%D \pagereference[important]
+%D \pagereference[unimportant]
+%D \setupreferencing[prefix=sidetrack]
+%D \pagereference[important]
+%D \stoptyping
+%D
+%D results in saving (writing) the references
+%D
+%D \starttyping
+%D ...{}{important}
+%D ...{}{unimportant}
+%D ...{sidetrack}{important}...
+%D \stoptyping
+%D
+%D Now when we call for \type{unimportant}, we will indeed get the pagenumber
+%D associated to this reference. But when we call for \type{important}, while the
+%D prefix is still set, we will get the pagenumber bound to the prefixed one.
+%D
+%D {\em Some day, when processing time and memory are no longer
+%D performance factors, we will introduce multi||level
+%D prefixes.}
+%D
+%D Before we start analyzing, I introduce a general definition macro. Consider:
+%D
+%D \starttyping
+%D \goto{do}[JS(My_Script{"test",123}),titlepage]
+%D \stoptyping
+%D
+%D This can also be achieved by:
+%D
+%D \starttyping
+%D \definereference[startup][JS(My_Script{"test",123}),titlepage]
+%D \goto{do}[startup]
+%D \stoptyping
+%D
+%D Now is this is a handy feature or not?
+%D
+%D \showsetup{definereference}
+%D
+%D We can trace references by setting the next switch to true.
+
+\permanent\tolerant\protected\def\definereference[#name]#spacer[#specification]%
+ {\clf_definereference{\referenceprefix}{#name}{\detokenize{#specification}}}
+
+\permanent\protected\def\resetreference[#name]%
+ {\clf_resetreference{\referenceprefix}{#name}}
+
+\permanent\def\setpagereference#name#specification% hm,. low level ?
+ {\clf_definereference{}{#name}{\v!page(\detokenize{#specification}}} % is detokenize needed here?
+
+%D Chained references are defined as:
+%D
+%D \starttyping
+%D \goto{somewhere}[JS(somescript),nextpage,JS(anotherscript)]
+%D \stoptyping
+%D
+%D Actually supporting chains is up to the special driver. Here we only provide the
+%D hooks.
+
+%D \macros
+%D {highlighthyperlinks}
+%D
+%D The next switch can be used to make user hyperlinks are not highlighted when
+%D clicked on.
+
+\newconditional\highlighthyperlinks \settrue\highlighthyperlinks
+
+%D \macros
+%D {gotonewwindow}
+%D
+%D To make the {\em goto previous jump} feature more convenient when using more than
+%D one file, it makes sense to force the viewer to open a new window for each file
+%D opened.
+
+\newconditional\gotonewwindow \setfalse\gotonewwindow
+
+\permanent\def\expandtexincurrentreference % will happen in lua some time
+ {\ifcase\referencehastexstate\else\clf_expandcurrentreference\fi}
+
+\permanent\def\expandreferenceoperation#tag#content{\clf_setreferenceoperation#tag{#content}}
+\permanent\def\expandreferencearguments#tag#content{\clf_setreferencearguments#tag{#content}}
+
+\permanent\def\doifelsereferencefound#label#yes#nop%
+ {\clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}%
+ {\expandtexincurrentreference
+ #yes}%
+ {#nop}}
+
+\aliased\let\doifreferencefoundelse\doifelsereferencefound
+
+%D The tester only splits the reference in components but does not look into them.
+%D The following macro does a preroll and determines for instance the current real
+%D reference pagenumber. The \type {\currentrealreference} macro does the same so
+%D unless one wants to use the pagestate the next macro seldom needs to be called.
+%D
+%D The inner case is simple. Only two cases have to be taken
+%D care of:
+%D
+%D \starttyping
+%D \goto{some text}[reference]
+%D \goto{some text}[prefix:reference]
+%D \stoptyping
+%D
+%D References to other files however are treated strict or tolerant, depending on
+%D their loading and availability:
+%D
+%D \starttyping
+%D \useexternaldocument[somefile][filename][a nice description]
+%D
+%D \goto{checked reference}[somefile::reference]
+%D \goto{unchecked reference}[somefile::]
+%D \goto{unchecked reference}[anotherfile::reference]
+%D \stoptyping
+%D
+%D An unknown reference is reported on the screen, in the log file and, when
+%D enabled, in the left margin of the text.
+
+\let\unknownreference\gobbleoneargument
+
+%D When a reference is not found, we typeset a placeholder (two glyphs are often
+%D enough to represent the reference text).
+
+\def\dummyreference{{\tttf ??}}
+\def\emptyreference{{\tttf !!}}
+
+\installtextracker
+ {structures.referencing.show}
+ {\let\strc_references_dummy\strc_references_dummy_yes}
+ {\let\strc_references_dummy\strc_references_dummy_nop}
+
+\def\strc_references_dummy_nop
+ {\dummyreference}
+
+\def\strc_references_dummy_yes
+ {\dummyreference
+ \margindata
+ [\referencingparameter\c!labelalternative]% alternative?
+ [\c!style=\referencingparameter\c!labelstyle,
+ \c!color=\referencingparameter\c!labelcolor]
+ {\askedreference}}
+
+\let\strc_references_dummy\strc_references_dummy_nop
+
+\setupreferencing
+ [\c!labelalternative=\v!inleft,
+ \c!labelcolor=darkred,
+ \c!labelstyle=\smallinfofont]
+
+%D To prevent repetitive messages concerning a reference being defined, we set such
+%D an unknown reference to an empty one after the first encounter.
+%D
+%D Apart from cross references supplied by the user, \CONTEXT\ generates cross
+%D references itself. Most of them are not saved as a reference, but stored with
+%D their source, for instance a list or an index entry. Such automatically
+%D generated, for the user invisible, references are called {\em internal
+%D references}. The user supplied ones are labeled as {\em external references}.
+%D
+%D A second important characteristic is that when we want to support different
+%D backends (viewers), we need to support named destinations as well as page
+%D numbers. I invite readers to take a glance at the special driver modules to
+%D understand the fine points of this. As a result we will deal with {\em locations}
+%D as well as {\em real page numbers}. We explictly call this pagenumber a real one,
+%D because it is independant of the page numbering scheme used in the document.
+%D
+%D One of the reasons for \CONTEXT\ being the first \TEX\ base macropackage to
+%D support sophisticated interactive \PDF\ files, lays in the mere fact that real
+%D page numbers are available in most two pass data, like references, list data and
+%D index entries.
+%D
+%D We will speak of \type {thisis...} when we are marking a location, and
+%D \type {goto...} when we point to such a location. The latter one can be seen as a
+%D hyperlink to the former one. In the next macros one we use constructs like:
+%D
+%D \starttyping
+%D \dostart...
+%D \dostop...
+%D \stoptyping
+%D
+%D The flag \type {\iflocation} signals if we're in interactive mode.
+
+\ifdefined\buttonheight \else \newdimen\buttonheight \fi
+\ifdefined\buttonwidth \else \newdimen\buttonwidth \fi
+
+%D Internal references can best be set using the next few macros. Setting such
+%D references to unique values is completely up to the macros that call them.
+%D
+%D \starttyping
+%D \thisissomeinternal{tag}{identifier}
+%D \gotosomeinternal {tag}{identifier}{pagenumber}{text}
+%D \stoptyping
+%D
+%D We could do this in \LUA\ \unknown
+
+\newif \iflocation
+\newcount\locationcount
+\newcount\locationorder
+\newbox \locationbox
+
+\permanent\def\nextinternalreference {\the\locationcount}
+\permanent\def\nextinternalorderreference{\the\locationorder}
+
+\permanent\def\setnextinternalreference
+ {\global\advance\locationcount\plusone}
+
+\permanent\def\setnextinternalreferences#kind#name% plural
+ {\clf_setnextinternalreference{#kind}{#name}}
+
+\permanent\def\getinternalorderreference#kind#name%
+ {\clf_currentreferenceorder{#kind}{#name}}
+
+\permanent\def\thisissomeinternal#kind#name% only for old time sake, will go away
+ {\begingroup
+ \clf_setinternalreference
+ reference {#kind:#name}% no view
+ \relax
+ \hpack attr \destinationattribute\lastdestinationattribute{}%
+ \endgroup}
+
+\installcorenamespace{savedinternalreference}
+
+\letvalue{\??savedinternalreference\s!default}\!!zerocount
+
+\permanent\protected\def\storeinternalreference#1#2%
+ {\setxvalue{\??savedinternalreference\currentstructurename}{\number#2}}
+
+\newconditional\preferpagereferences
+
+\permanent\def\gotosomeinternal#kind#name#target#text%
+ {\ifconditional\preferpagereferences
+ \directgoto{#text}[page(#target)]%
+ \else
+ \directgoto{#text}[#kind:#name]%
+ \fi}
+
+\permanent\def\gotonextinternal#text#target%
+ {\directgoto{#text}[internal(#target)]}
+
+%D In this module we define three system references: one for handling navigational,
+%D viewer specific, commands, another for jumping to special pages, like the first
+%D or last one, and a third reference for linking tree like lists, like tables of
+%D contents. The latter two adapt themselves to the current state.
+%D
+%D An example of an action is:
+%D
+%D \starttyping
+%D \goto{some action}[PreviousJump]
+%D \stoptyping
+%D
+%D as well as:
+%D
+%D \starttyping
+%D \goto{some text}[\v!action(PreviousJump]
+%D \stoptyping
+%D
+%D One can also activate an automatic prefix mechanism. By setting the
+%D \type {\prefix} variable to \type {+}, the prefix is incremented, when set to
+%D \type {-} or empty, the prefix is reset. Other values become the prefix.
+
+\newcount\prefixcounter
+
+\newconditional\autocrossfilereferences
+
+\appendtoks
+ \edef\p_autofile{\referencingparameter\c!autofile}%
+ \ifx\p_autofile\v!yes
+ \settrue \autocrossfilereferences
+ \else
+ \setfalse\autocrossfilereferences
+ \fi
+\to \everysetupreferencing
+
+\appendtoks
+ \edef\p_export{\referencingparameter\c!export}%
+ \ifx\p_export\v!yes
+ \clf_exportreferences
+ \fi
+\to \everygoodbye
+
+\permanent\protected\def\setupglobalreferenceprefix[#prefix]%
+ {\xdef\referenceprefix{#prefix}}
+
+\permanent\protected\def\globalpushreferenceprefix#prefix%
+ {\xdef\referenceprefix{\clf_pushreferenceprefix{#prefix}}}
+
+\permanent\protected\def\globalpopreferenceprefix
+ {\xdef\referenceprefix{\clf_popreferenceprefix}}
+
+\permanent\protected\def\pushreferenceprefix#prefix%
+ {\edef\referenceprefix{\clf_pushreferenceprefix{#prefix}}}
+
+\permanent\protected\def\popreferenceprefix
+ {\edef\referenceprefix{\clf_popreferenceprefix}}
+
+\def\m_strc_references_prefix_yes{+}
+\def\m_strc_references_prefix_nop{-}
+
+\permanent\protected\def\setupreferenceprefix[#prefix]%
+ {\edef\p_prefix{#prefix}%
+ \ifempty\p_prefix
+ \let\referenceprefix\empty
+ \orelse\ifx\p_prefix\m_strc_references_prefix_yes
+ \letreferencingparameter\c!prefix\s!unknown
+ \global\advance\prefixcounter\plusone
+ \edef\referenceprefix{\the\prefixcounter}%
+ \orelse\ifx\p_prefix\m_strc_references_prefix_nop
+ \letreferencingparameter\c!prefix\s!unknown
+ \let\referenceprefix\empty
+ \orelse\ifx\p_prefix\s!unknown
+ % forget about it
+ \else
+ \let\referenceprefix\p_prefix
+ \fi}
+
+\appendtoks
+ \setupreferenceprefix[\referencingparameter\c!prefix]
+\to \everysetupreferencing
+
+%D We can typeset a reference using \type {\in}, \type {\at} and \type {\about} and
+%D goto specific locations using \type {\goto}. The last one does not make that much
+%D sense in a paper document. To complicate things, \PLAIN\ \TEX\ also implements an
+%D \type {\in} but fortunately that one only makes sense in math mode.
+%D
+%D Typesetting the reference is a bit more complicated than one would at first sight
+%D expect. This is due to the fact that we distinguish three (five) alternative
+%D calls:
+%D
+%D \placefigure
+%D [here][three calls]
+%D {Three alternatives reference calls.}
+%D {\startcombination[1*3]
+%D {\framed{\type{ \in }}} {a}
+%D {\framed{\type{ \at }}} {b}
+%D {\framed{\type{\goto}}} {c}
+%D \stopcombination}
+%D
+%D \startbuffer
+%D \in figure[fig:three calls]
+%D \in{figure}[fig:three calls]
+%D \in figure a[fig:three calls]
+%D \in{figure}{a}[fig:three calls]
+%D figure~\in[fig:three calls]
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D This turns up as:
+%D
+%D \startlines
+%D \getbuffer
+%D \stoplines
+%D
+%D The dual \type {{}} results in a split reference. In a document meant for paper,
+%D one is tempted to use the last (most straightforward) alternative. When a
+%D document is also meant voor electronic distribution, the former alternatives have
+%D preference, because everything between the \type {\in} and~\type {[} becomes
+%D active (and when asked for, typeset in a different color and typeface).
+
+\appendtoks
+ \ifdefined\in \let\normalmathin \in \protected\def\in {\mathortext\normalmathin \strc_references_in } \else \let\in \strc_references_in \fi
+ \ifdefined\at \let\normalmathat \at \protected\def\at {\mathortext\normalmathat \strc_references_at } \else \let\at \strc_references_at \fi
+ \ifdefined\about \let\normalmathabout\about \protected\def\about{\mathortext\normalmathabout\strc_references_about} \else \let\about\strc_references_about \fi
+ \ifdefined\from \let\normalmathfrom \from \protected\def\from {\mathortext\normalmathfrom \strc_references_from } \else \let\from \strc_references_from \fi
+ \ifdefined\over \let\normalmathover \over \protected\def\over {\mathortext\normalmathover \strc_references_about} \else \let\over \strc_references_about \fi
+\to \everydump
+
+\permanent \def\filterreference #key{\clf_filterreference{#key}} % no checking, expanded
+\permanent\protected\def\getreferenceentry#key{\clf_filterreference{#key}} % no checking, unexpanded
+
+\def\currentreferencenumber {\clf_filterreference{number}}
+\def\currentreferencepage {\clf_filterreference{page}}
+\def\currentreferencetitle {\clf_filterreference{title}}
+\def\currentreferencetext {\clf_filterreference{text}}
+\def\currentreferencedefault {\clf_filterreference{default}}
+\def\currentreferencerealpage{\clf_filterreference{realpage}}
+
+%D The most straightforward way of retrieving references is using \type {\ref}.
+
+\permanent\tolerant\protected\def\getreference[#key]#spacer[#label]% #key = number page title text default realpage ...
+ {\ifarguments\or
+ \strc_references_dummy
+ \else
+ \doifelsereferencefound{#label}{\clf_filterreference{#key}}\strc_references_dummy
+ \fi}
+
+\aliased\let\ref\getreference
+
+%D Special cases:
+
+\protected\def\strc_references_about[#label]%
+ {\dontleavehmode
+ \begingroup
+ \enforced\let\crlf\space
+ \enforced\let\\\space
+ \postponenotes % might go
+ \referencingparameter\c!left
+ \doifelsereferencefound{#label}
+ {\goto{\limitatetext\currentreferencetitle{\referencingparameter\c!width}\unknown}[#label]}% not so efficient (dup lookup)
+ {}% todo
+ \flushnotes % might go
+ \referencingparameter\c!right
+ \endgroup}
+
+%D The previously discussed setup macro lets us specify the representation of
+%D references. A symbol reference does not show the specific data, like the number
+%D of a figure, but shows one of: \hbox {$^\goforwardcharacter$
+%D $^\gobackwardcharacter$ $^\gonowherecharacter$}, depending on the direction to
+%D go.
+%D
+%D \starttyping
+%D ... \somewhere{backward text}{forward text}[someref] ...
+%D ... \atpage[someref] ...
+%D \stoptyping
+
+% standard detail
+%
+% 0 = unknown unknown
+% 1 = same on same page
+% 2 = before preceding page
+% 3 = after following page
+%
+% 4 = above above on same page
+% 5 = below below on same page
+
+% todo: optimize for use in pagebody
+% todo: maybe make it optional
+
+% \setuppagenumbering[alternative=doublesided]
+% \setupreferencing [doublesided=no] % yes is default
+%
+% \somewhere{backward}{foreward}[label]
+% \someplace{preceding}{backward}{current}{foreward}{following}[label]
+% \atpage[#label]
+% \doifcheckedpagestate{label}{preceding}{backward}{current}{foreward}{following}{otherwise}
+%
+% \dorecurse {20} {
+% \placefigure[here][fig:#1]{}{\externalfigure[dummy]}
+% \dorecurse {20} {
+% ##1: \atpage[fig:##1] /
+% \doifcheckedpagestate
+% {fig:##1}
+% {preceding}{backward}{current}{foreward}{following}
+% {otherwise}
+% }
+% }
+
+\newcount \nofreferencestates
+\newconditional\pagestatespread
+
+\appendtoks
+ \doifelse{\referencingparameter\c!doublesided}\v!yes\settrue\setfalse\pagestatespread
+\to \everysetupreferencing
+
+\setupreferencing
+ [\c!doublesided=\v!yes]
+
+\permanent\def\referencepagestate
+ {\numexpr\clf_referencepagestate
+ {rst::\number\nofreferencestates}%
+ \relax}
+
+\permanent\def\referencepagedetail
+ {\numexpr\clf_referencepagedetail
+ {rst::\number\nofreferencestates}%
+ true %
+ \ifconditional\pagestatespread false\ifdoublesided true\else false\fi\fi
+ \relax}
+
+\permanent\def\referencerealpage {\clf_referencerealpage} % todo: no need for wrapping
+\permanent\def\referencecolumnnumber{\clf_referencecolumn} % todo: no need for wrapping
+
+% So we need : instead of \ but that's only lmtx:
+%
+% \def\referencecolumnnumber
+% {\numexpr\dimexpr\clf_referenceposx-\cutspace\relax:\dimexpr\makeupwidth/\nofcolumns\relax+\plusone\relax}
+%
+% Tacos patch of the older one, kept here as illustration
+%
+% \def\referencecolumnnumber
+% {\numexpr
+% \dimexpr\clf_referenceposx-\cutspace-\makeupwidth/(2*\nofcolumns)\relax
+% /\dimexpr \makeupwidth/ \nofcolumns \relax
+% +\plusone
+% \relax}
+
+
+\permanent\protected\def\tracedpagestate
+ {{\blue\tttf(\ifcase\referencepagedetail unknown\or same\or previous\or next\or above\or below\else unknown\fi)}}
+
+\permanent\protected\def\markreferencepage
+ {\dontleavehmode\begingroup
+ \iftrialtypesetting
+ % issue warning that not stable
+ \else
+ % needs checking ... but probably never in trialmode
+ \global\advance\nofreferencestates\plusone
+ \xypos{rst::\number\nofreferencestates}%
+ % \tracedpagestate
+ \fi
+ \endgroup}
+
+\permanent\protected\def\doifcheckedpagestate#label% #preceding#backward#current#foreward#following#otherwise%
+ {\doifelsereferencefound{#label}\strc_references_handle_page_state_yes\strc_references_handle_page_state_nop}
+
+\let\strc_references_handle_page_state_nop\sixthofsixarguments
+
+\def\strc_references_handle_page_state_yes
+ {\markreferencepage
+ \ifcase\referencepagedetail
+ \expandafter\sixthofsixarguments \or
+ \expandafter\thirdofsixarguments \or
+ \expandafter\firstofsixarguments \or
+ \expandafter\fifthofsixarguments \or
+ \expandafter\secondofsixarguments\or
+ \expandafter\fourthofsixarguments\else
+ \expandafter\sixthofsixarguments \fi}
+
+\permanent\protected\def\referencesymbol
+ {\hpack\bgroup
+ \strut
+ \markreferencepage
+ \high
+ {\setupsymbolset[\interactionparameter\c!symbolset]%
+ \symbol[\ifcase\referencepagedetail\v!somewhere\or\v!nowhere\or\v!previous\or\v!next\or\v!previous\or\v!next\else\v!somewhere\fi]}%
+ \egroup}
+
+%D Hereafter the \type {\ignorespaces} binds the state node to next character (more likely
+%D than a preceding one) and one can always add an explicit space.
+
+\permanent\protected\def\somewhere#backward#foreward#dummy[#label]% #dummy gobbles space around #foreward
+ {\doifcheckedpagestate{#label}%
+ {\goto{#backward}[#label]}%
+ {\goto{#backward}[#label]}%
+ {\ignorespaces}%
+ {\goto{#foreward}[#label]}%
+ {\goto{#foreward}[#label]}%
+ {#label}}%
+
+\permanent\protected\def\someplace#preceding#backward#current#foreward#following#dummy[#label]% #dummy gobbles space around #foreward
+ {\doifcheckedpagestate{#label}%
+ {\doifelsenothing{#preceding}{\goto{#preceding}[#label]}\ignorespaces}%
+ {\doifelsenothing {#backward}{\goto {#backward}[#label]}\ignorespaces}%
+ {\doifelsenothing {#current}{\goto {#current}[#label]}\ignorespaces}%
+ {\doifelsenothing {#foreward}{\goto {#foreward}[#label]}\ignorespaces}%
+ {\doifelsenothing{#following}{\goto{#following}[#label]}\ignorespaces}%
+ {#label}}
+
+\permanent\protected\def\atpage[#label]% todo
+ {\doifcheckedpagestate{#label}%
+ {\goto{\labeltext\v!precedingpage}[#label]}%
+ {\goto{\labeltext\v!hencefore}[#label]}%
+ {\ignorespaces}%
+ {\goto{\labeltext\v!hereafter}[#label]}%
+ {\goto{\labeltext\v!followingpage}[#label]}%
+ {\goto{\labeltexts\v!page\strc_references_dummy}[#label]}}
+
+% Someone requested this but in retrospect didn't need it so we keep it as example.
+% Beware: a node is injected which is why we add ignorespaces!
+%
+% \protected\def\strc_references_conditional#action#text[#condition]#dummy[#label]%
+% {\doifcheckedpagestate{#label}%
+% {\doifelse{#condition}\v!precedingpage{#action{#text}[#label]}\ignorespaces}%
+% {\doifelse{#condition}\v!hencefore {#action{#text}[#label]}\ignorespaces}%
+% {\doifelse{#condition}\v!current {#action{#text}[#label]}\ignorespaces}%
+% {\doifelse{#condition}\v!hereafter {#action{#text}[#label]}\ignorespaces}%
+% {\doifelse{#condition}\v!followingpage{#action{#text}[#label]}\ignorespaces}%
+% {#label}}
+%
+% \protected\def\conditionalat {\strc_references_conditional\at}
+% \protected\def\conditionalin {\strc_references_conditional\in}
+% \protected\def\conditionalabout{\strc_references_conditional\about}
+
+%D The other alternatives just conform their names: only the label, only the text, or the
+%D label and the text.
+
+% \dounknownreference -> \dummyreference
+
+\permanent\def\symbolreference[#label]% for old times sake
+ {\goto{\referencesymbol}[#label]}
+
+% \referencecontentmode 0=all 1=label 2=text 3=symbol
+
+\newtoks\leftreferencetoks
+\newtoks\rightreferencetoks
+\newtoks\defaultleftreferencetoks
+\newtoks\defaultrightreferencetoks
+
+\permanent\let\rightofreferencecontent\empty
+\permanent\let\leftofreference \empty
+\permanent\let\rightofreference \empty
+
+\permanent\protected\def\leftofreferencecontent
+ {\removeunwantedspaces
+ \nonbreakablespace
+ \ignorespaces}
+
+\installcorenamespace{referencinginteraction}
+
+\def\strc_references_interaction_all
+ {\the\leftreferencetoks
+ \doifelsesometoks\leftreferencetoks \leftofreferencecontent \donothing
+ \leftofreference
+ \doifelsesometoks\leftreferencetoks\onlynonbreakablespace\relax % new, replace space by nonbreakable if present
+ \currentreferencecontent
+ \rightofreference
+ \doifelsesometoks\rightreferencetoks\rightofreferencecontent\donothing
+ \the\rightreferencetoks}
+
+\letvalue{\??referencinginteraction\v!all}\strc_references_interaction_all
+
+\setvalue{\??referencinginteraction\v!label}%
+ {\leftofreference
+ \the\leftreferencetoks
+ \the\rightreferencetoks
+ \rightofreference}
+
+\setvalue{\??referencinginteraction\v!text}%
+ {\leftofreference
+ \currentreferencecontent
+ \rightofreference}
+
+\setvalue{\??referencinginteraction\v!symbol}%
+ {\referencesymbol}
+
+\def\referencesequence
+ {\ifcsname\??referencinginteraction\referencingparameter\c!interaction\endcsname
+ \expandafter\lastnamedcs
+ \else
+ \expandafter\strc_references_interaction_all
+ \fi}
+
+\newtoks\everyresetinatreference
+
+\appendtoks
+ \enforced\glet\leftofreference \relax
+ \enforced\glet\rightofreference\relax
+\to \everyresetinatreference
+
+\def\strc_references_start_goto
+ {\dontleavehmode
+ \begingroup}
+
+\def\strc_references_stop_goto
+ {\the\everyresetinatreference
+ \endgroup}
+
+\def\strc_references_pickup_goto
+ {\dodoublegroupempty\strc_references_pickup_goto_indeed}
+
+\def\strc_references_pickup_goto_indeed#left#right#dummy[#label]% #dummy gobbles spaces (really needed)
+ {\leftreferencetoks
+ \iffirstargument
+ {#left}%
+ \else
+ \defaultleftreferencetoks
+ \enforced\let\leftofreferencecontent\empty
+ \fi
+ \rightreferencetoks
+ \ifsecondargument
+ {#right}%
+ \else
+ \defaultrightreferencetoks
+ \enforced\let\rightofreferencecontent\empty
+ \fi
+ % inefficient: double resolve
+ \doifelsereferencefound{#label} % we need to resolve the text
+ {\goto{\referencesequence}[#label]}
+ {\let\currentreferencecontent\strc_references_dummy
+ \goto{\referencesequence}[#label]}%
+ \strc_references_stop_goto}
+
+\protected\def\strc_references_in
+ {\strc_references_start_goto
+ \let\currentreferencecontent\currentreferencedefault
+ \strc_references_pickup_goto}
+
+\protected\def\strc_references_at
+ {\strc_references_start_goto
+ \let\currentreferencecontent\currentreferencepage
+ \strc_references_pickup_goto}
+
+%D \macros
+%D {definereferenceformat}
+%D
+%D The next few macros were made for for David Arnold and Taco Hoekwater. They can
+%D be used for predefining reference texts, and thereby stimulate efficiency.
+%D
+%D \starttyping
+%D \definereferenceformat[informula] [left=(,right=),text=formula]
+%D \definereferenceformat[informulas] [left=(,right=),text=formulas]
+%D \definereferenceformat[andformula] [left=(,right=),text=and]
+%D \definereferenceformat[andformulas][left=(,right=),text=and]
+%D
+%D \informula [b] and \informula [for:c]
+%D the \informula {formulas}[b] \informula {and} [for:c]
+%D the \informulas {formulas}[b] \informula {and} [for:c]
+%D the \informulas [b] \informula {en} [for:c]
+%D the \informulas [b] \andformula [for:c]
+%D \stoptyping
+%D
+%D Instead of a text, one can specify a label, which should be defined with \type
+%D {\setuplabeltext}.
+%D
+%D Watch out: the second argument is somewhat special and mostly meant for a suffix
+%D to a number:
+%D
+%D \startbuffer
+%D \definereferenceformat [intesta] [left=(,right=),text=Whatever~]
+%D \definereferenceformat [intestb] [left=(,right=),label=figure]
+%D
+%D \placeformula[x]\startformula a \stopformula
+%D
+%D \starttabulate[|||||]
+%D \NC \in [x] \NC \in {left}[x] \NC \in {}{right}[x] \NC \in {left}{right}[x] \NC \NR
+%D \NC \intesta[x] \NC \intesta{left}[x] \NC \intesta{}{right}[x] \NC \intesta{left}{right}[x] \NC \NR
+%D \NC \intestb[x] \NC \intestb{left}[x] \NC \intestb{}{right}[x] \NC \intestb{left}{right}[x] \NC \NR
+%D \stoptabulate
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+
+% to be done: interfaced
+
+\installcorenamespace{referenceformat}
+
+\installcommandhandler \??referenceformat {referenceformat} \??referenceformat
+
+\appendtoks
+ \setuevalue\currentreferenceformat{\strc_references_apply_format{\currentreferenceformat}}%
+\to \everydefinereferenceformat
+
+\setupreferenceformat
+ [\c!left=,
+ \c!right=,
+ \c!text=,
+ \c!label=,
+ \c!autocase=\v!no,
+ \c!style=,
+ \c!type=default, % to be done: interfaced
+ \c!setups=,
+ \c!color=]
+
+\protected\def\strc_references_apply_format#name%
+ {\strc_references_start_goto
+ \edef\currentreferenceformat{#name}%
+ \enforced\gdef\leftofreference {\referenceformatparameter\c!left }%
+ \enforced\gdef\rightofreference {\referenceformatparameter\c!right }%
+ \edef\currentreferenceformatlabel {\referenceformatparameter\c!label }%
+ \edef\currentreferenceformattype {\referenceformatparameter\c!type }%
+ \edef\currentreferenceformatsetups {\referenceformatparameter\c!setups }%
+ \edef\currentreferenceformatautocase{\referenceformatparameter\c!autocase}%
+ \usereferenceformatstyleandcolor\c!style\c!color
+ \ifempty\currentstyleparameter \else
+ \resetinteractionparameter\c!style
+ \fi
+ \ifempty\currentcolorparameter \else
+ \resetinteractionparameter\c!contrastcolor
+ \resetinteractionparameter\c!color
+ \fi
+ \ifx\currentreferenceformatlabel\autoreferencelabeltextflag
+ \edef\currentreferenceformatlabel{\autoreferencelabeltext}%
+ \fi
+ \ifx\currentreferenceformatautocase\v!yes
+ \setcharactercleaning[1]%
+ \fi
+ \ifempty\currentreferenceformatlabel
+ \defaultleftreferencetoks {\referenceformatparameter\c!text}%
+ \defaultrightreferencetoks\emptytoks
+ \else
+ \defaultleftreferencetoks {\leftlabeltext \currentreferenceformatlabel}%
+ \defaultrightreferencetoks{\rightlabeltext\currentreferenceformatlabel}%
+ \fi
+ \ifempty\currentreferenceformattype
+ \def\currentreferenceformattype{default}%
+ \fi
+ %
+ \ifempty\currentreferenceformatsetups
+ \def\currentreferencecontent{\filterreference\currentreferenceformattype}%
+ \else
+ \def\currentreferencecontent{\directsetup\currentreferenceformatsetups}%
+ \fi
+ %
+ \enforced\let\leftofreferencecontent \empty
+ \enforced\let\rightofreferencecontent\empty
+ \strc_references_pickup_goto}
+
+\def\autoreferencelabeltextflag{*} % a proper key like 'auto' or 'name' can clash with a label key
+
+\permanent\protected\def\autoreferencelabeltext
+ {\clf_getcurrentreferencemetadata{name}}
+
+% \starttext
+% \definereferenceformat[inxx] [left=(,right=),text=txt]
+% \setupinteraction[state=start]
+% \chapter[one]{xx}
+% [\goto{state}[file(mk-last-state)]]
+% [\goto{state} [file(mk-last-state)]]
+% [\at{page} [one]]
+% [\at{page}[one]]
+% [\at{page}{okay}[one]]
+% [\inxx{a}{b}[one]]
+% \stoptext
+
+% \startsetups referenceformat:numberplustext
+% \filterreference{number}, \filterreference{title}
+% \stopsetups
+%
+% \definereferenceformat[hellup][text=Hellup ,setups=referenceformat:numberplustext]
+
+%D In interactive documents going to a specific location is not bound to cross
+%D references. The \type {\goto} commands can be used to let users access another
+%D part of the document. In this respect, interactive tables of contents and
+%D registers can be considered goto's. Because in fact a \type {\goto} is just a
+%D reference without reference specific data, the previous macros are implemented
+%D using the goto functionality.
+%D
+%D \showsetup{goto}
+%D
+%D One important characteristic is that the first argument of \type {\goto} (and
+%D therefore \type {\at} and \type {\in} is split at spaces. This means that,
+%D although hyphenation is prevented, long references can cross line endings.
+
+% \starttext
+% \setupinteraction[state=start]
+% [\goto{state}[file(mk-last-state)]]
+% [\goto{state} [file(mk-last-state)]]
+% \stoptext
+
+\newconditional\uselocationstrut \settrue\uselocationstrut
+
+\permanent\def\extrareferencearguments
+ {highlight \luaconditional\highlighthyperlinks\space
+ newwindow \luaconditional\gotonewwindow\space
+ layer {\currentviewerlayer}}
+
+\permanent\protected\def\directgoto
+ {\ifconditional\uselocationstrut
+ \expandafter\strc_references_direct_goto
+ \else
+ \expandafter\strc_references_direct_goto_htdp
+ \fi}
+
+\permanent\protected\def\goto
+ {\ifconditional\uselocationstrut
+ \expandafter\strc_references_goto
+ \else
+ \expandafter\strc_references_goto_htdp
+ \fi}
+
+% The unbox trick is needed in order to permit \par inside a reference. Otherwise
+% the reference attribute migrates to the outer boxes.
+
+\newcount\lastsavedreferenceattribute
+
+\newbox\referencebox
+
+\permanent\def\revivesavedreferenceattribute % sometimes handy as no test etc needed
+ {\c_attr_reference\lastsavedreferenceattribute}
+
+\def\strc_references_direct_goto#content[#label]% no test for valid references
+ {\dontleavehmode
+ \begingroup
+ \c_attr_reference\attributeunsetvalue
+ \global\lastsavedreferenceattribute\attributeunsetvalue
+ \iflocation
+ \clf_injectreference
+ {\referenceprefix}%
+ {#label}%
+ {%
+ height \ht\strutbox
+ depth \dp\strutbox
+ \extrareferencearguments
+ }%
+ \relax
+ \setlocationattributes
+ \setstrut % can be option
+ \global\lastsavedreferenceattribute\lastreferenceattribute
+ \c_attr_reference\lastreferenceattribute
+ \dostarttagged\t!link\empty % not here
+ #content%
+ \dostoptagged
+ \else
+ #content%
+ \fi
+ \endgroup}
+
+\def\strc_references_direct_goto_htdp#content[#label]% no test for valid references
+ {\dontleavehmode
+ \begingroup
+ \global\lastsavedreferenceattribute\attributeunsetvalue
+ \c_attr_reference\attributeunsetvalue
+ \iflocation
+ \clf_injectreference
+ {\referenceprefix}%
+ {#label}%
+ {%
+ height \dimexpr\interactionparameter\c!height\relax
+ depth \dimexpr\interactionparameter\c!depth \relax
+ \extrareferencearguments
+ }%
+ \relax
+ \setlocationattributes
+ \c_attr_reference\lastreferenceattribute
+ \global\lastsavedreferenceattribute\lastreferenceattribute
+ \dostarttagged\t!link\empty
+ #content%
+ \dostoptagged
+ \else
+ #content%
+ \fi
+ \endgroup}
+
+\def\strc_references_goto#content#dummy[#label]% #dummy gobbles spaces
+ {\dontleavehmode
+ \begingroup
+ %\setbox\referencebox\hbox\bgroup % experiment, might change again to non \par support
+ \global\lastsavedreferenceattribute\attributeunsetvalue
+ \c_attr_reference\attributeunsetvalue
+ \iflocation
+ \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}%
+ {\expandtexincurrentreference
+ \clf_injectcurrentreferencehtdp
+ \ht\strutbox
+ \dp\strutbox
+ \relax
+ \setlocationattributes
+ \setstrut % can be option
+ \global\lastsavedreferenceattribute\lastreferenceattribute
+ \c_attr_reference\lastreferenceattribute
+ \dostarttagged\t!link\empty
+ #content%
+ \dostoptagged}%
+ {#content}%
+ \else
+ #content%
+ \fi
+ %\egroup\unhbox\referencebox}
+ \endgroup}
+
+\def\strc_references_goto_internal#content#dummy[#internal]% #dummy gobbles spaces
+ {\dontleavehmode
+ \begingroup
+ \global\lastsavedreferenceattribute\attributeunsetvalue
+ \c_attr_reference\attributeunsetvalue
+ \iflocation
+ \setstrut % can be option
+ \strc_references_get_simple_reference{#internal}%
+ \global\lastsavedreferenceattribute\currentreferenceattribute
+ \c_attr_reference\currentreferenceattribute
+ \setlocationattributes
+ \dostarttagged\t!link\empty
+ #content%
+ \dostoptagged
+ \else
+ #content%
+ \fi
+ \endgroup}
+
+\permanent\protected\def\startgoto[#label]%
+ {\dontleavehmode
+ \begingroup
+ \iflocation
+ \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}%
+ {\expandafter\strc_references_start_goto_yes}%
+ {\expandafter\strc_references_start_goto_nop}%
+ \else
+ \expandafter\strc_references_start_goto_nop
+ \fi}
+
+\permanent\protected\def\strc_references_start_goto_nop
+ {\let\stopgoto\strc_references_stop_goto_nop}
+
+\permanent\protected\def\strc_references_stop_goto_nop
+ {\endgroup}
+
+\protected\def\strc_references_start_goto_yes
+ {\expandtexincurrentreference
+ \clf_injectcurrentreferencehtdp
+ \ht\strutbox
+ \dp\strutbox
+ \relax
+ \setlocationattributes
+ \setstrut % can be option
+ \global\lastsavedreferenceattribute\lastreferenceattribute
+ \c_attr_reference\lastreferenceattribute
+ \dostarttagged\t!link\empty
+ \let\stopgoto\strc_references_stop_goto_yes}
+
+\protected\def\strc_references_stop_goto_yes
+ {\dostoptagged
+ \endgroup}
+
+\def\strc_references_goto_htdp#content#dummy[#label]% dummy gobbles spaces
+ {\dontleavehmode
+ \begingroup
+ \global\lastsavedreferenceattribute\attributeunsetvalue
+ \c_attr_reference\attributeunsetvalue
+ \iflocation
+ \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}%
+ {\expandtexincurrentreference
+ \clf_injectcurrentreferencehtdp
+ \dimexpr\interactionparameter\c!height\relax
+ \dimexpr\interactionparameter\c!depth \relax
+ \relax
+ \setlocationattributes
+ \global\lastsavedreferenceattribute\lastreferenceattribute
+ \c_attr_reference\lastreferenceattribute
+ \dostarttagged\t!link\empty
+ #content%
+ \dostoptagged}%
+ {#content}%
+ \else
+ #content%
+ \fi
+ \endgroup}
+
+\permanent\protected\def\directgotobox#content[#label]% no test for valid references
+ {\dontleavehmode
+ \begingroup
+ \global\lastsavedreferenceattribute\attributeunsetvalue
+ \c_attr_reference\attributeunsetvalue
+ \iflocation
+ \clf_injectreference
+ {\referenceprefix}%
+ {#label}%
+ {\extrareferencearguments}%
+ \relax
+ \setlocationattributes
+ \global\lastsavedreferenceattribute\lastreferenceattribute
+ \dostarttagged\t!link\empty
+ \hbox attr \referenceattribute \lastreferenceattribute {#content}%
+ \dostoptagged
+ \else
+ #content%
+ \fi
+ \endgroup}
+
+\permanent\protected\def\directgotospecbox#resolver#content[#label]% no test for valid references
+ {\dontleavehmode
+ \begingroup
+ \global\lastsavedreferenceattribute\attributeunsetvalue
+ \c_attr_reference\attributeunsetvalue
+ \iflocation
+ \clf_injectreference
+ {\referenceprefix}%
+ {#label}%
+ {\extrareferencearguments}%
+ \relax
+ \setlocationcolorspec{#resolver}% no consequence for strut
+ \global\lastsavedreferenceattribute\lastreferenceattribute
+ \dostarttagged\t!link\empty
+ \hbox attr \referenceattribute \lastreferenceattribute {#content}%
+ \dostoptagged
+ \else
+ #content%
+ \fi
+ \endgroup}
+
+\permanent\protected\def\directgotodumbbox#content[#label]% no test for valid references
+ {\dontleavehmode
+ \begingroup
+ \global\lastsavedreferenceattribute\attributeunsetvalue
+ \c_attr_reference\attributeunsetvalue
+ \iflocation
+ \clf_injectreference
+ {\referenceprefix}%
+ {#label}%
+ {\extrareferencearguments}%
+ \relax
+ \global\lastsavedreferenceattribute\lastreferenceattribute
+ \dostarttagged\t!link\empty
+ \hbox attr \referenceattribute \lastreferenceattribute {#content}%
+ \dostoptagged
+ \else
+ #content%
+ \fi
+ \endgroup}
+
+\permanent\protected\def\gotobox#content[#label]%
+ {\dontleavehmode
+ \begingroup
+ \global\lastsavedreferenceattribute\attributeunsetvalue
+ \c_attr_reference\attributeunsetvalue
+ \iflocation
+ \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}%
+ {\expandtexincurrentreference
+ \clf_injectcurrentreference
+ \setlocationattributes
+ \global\lastsavedreferenceattribute\lastreferenceattribute
+ \dostarttagged\t!link\empty
+ \hbox attr \referenceattribute \lastreferenceattribute {#content}%
+ \dostoptagged}%
+ {#content}%
+ \else
+ #content%
+ \fi
+ \endgroup}
+
+\permanent\protected\def\gotowdhtbox#width#height[#label]% fast variant for overlays
+ {\dontleavehmode
+ \begingroup
+ \setbox\scratchbox\emptyhbox
+ \wd\scratchbox#width%
+ \ht\scratchbox#height%
+ \global\lastsavedreferenceattribute\attributeunsetvalue
+ \c_attr_reference\attributeunsetvalue
+ \clf_doifelsereference{\referenceprefix}{#label}{\extrareferencearguments}%
+ {\clf_injectcurrentreference
+ \global\lastsavedreferenceattribute\lastreferenceattribute
+ \hpack attr \referenceattribute \lastreferenceattribute {\box\scratchbox}}
+ {\box\scratchbox}%
+ \endgroup}
+
+%D An reference to another document can be specified as a file or as an \URL. Both
+%D are handled by the same mechanism and can be issued by saying something like:
+%D
+%D \starttyping
+%D \goto[dictionary::the letter a]
+%D \stoptyping
+%D
+%D One can imagine that many references to such a dictionary are made, so in most
+%D cases such a document reference in an indirect one.
+%D
+%D \showsetup{useexternaldocument}
+%D
+%D For example:
+%D
+%D \starttyping
+%D \useexternaldocument
+%D [dictionary][engldict]
+%D [The Famous English Dictionary]
+%D \stoptyping
+%D
+%D The next macro implements these relations, and also take care of loading the
+%D document specific references.
+%D
+%D The \URL\ alternative takes four arguments:
+%D
+%D \showsetup{useURL}
+%D
+%D like:
+%D
+%D \starttyping
+%D \useURL
+%D [dictionary][http://www.publisher.com/public][engldict]
+%D [The Famous English Dictionary]
+%D \stoptyping
+%D
+%D Several specifications are possible:
+%D
+%D \starttyping
+%D \useURL [id] [url] [file] [description]
+%D \useURL [id] [url] [file]
+%D \useURL [id] [url]
+%D \stoptyping
+%D
+%D This time we don't load the references when no file is specified. This is logical
+%D when one keeps in mind that a valid \URL\ can also be a mail address.
+
+\permanent\tolerant\protected\def\useurl[#label]#spacer[#url]#spacer[#file]#spacer[#description]%
+ {\clf_useurl{#label}{\detokenize{#url}}{\detokenize{#file}}{\detokenize{#description}}}
+
+\permanent\tolerant\protected\def\usefile[#label]#spacer[#file]#spacer[#description]%
+ {\clf_usefile{#label}{\detokenize{#file}}{\detokenize{#description}}}
+
+\aliased\let\useURL \useurl
+\aliased\let\useexternaldocument\usefile
+
+\permanent\def\doifelseurldefined #label{\clf_doifelseurldefined {#label}} % todo: no wrap
+\permanent\def\doifelsefiledefined#label{\clf_doifelsefiledefined{#label}} % todo: no wrap
+
+\aliased\let\doifurldefinedelse \doifelseurldefined
+\aliased\let\doiffiledefinedelse\doifelsefiledefined
+
+%D \macros
+%D {url,setupurl}
+%D
+%D We also have: \type {\url} for directly calling the description. So we can say:
+%D
+%D \starttyping
+%D \useURL [one] [http://www.test.nl]
+%D \useURL [two] [http://www.test.nl] [] [Some Site]
+%D
+%D \url[one] or \from[two] or \goto{Whatever Site}[URL(two)]
+%D \stoptyping
+%D
+%D An \URL\ can be set up with
+%D
+%D \showsetup{setupurl}
+
+\installcorenamespace{url}
+
+\installdirectcommandhandler \??url {url}
+
+\setupurl
+ [\c!style=\v!type,
+ \c!color=]
+
+\permanent\protected\def\url[#label]% move \hyphenatedurl to lua end (is already lua)
+ {\dontleavehmode
+ \begingroup
+ \useurlstyleandcolor\c!style\c!color
+ \hyphenatedurl{\clf_geturl{#label}}%
+ \endgroup}
+
+%D This macro is hooked into a support macro, and thereby \URL's break ok, according
+%D to the setting of a switch,
+%D
+%D \startbuffer
+%D \useURL
+%D [test]
+%D [sentence_sentence~sentence//sentence:sentence.sentence]
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D Such an \URL\ is, depending on the settings, hyphenated as:
+%D
+%D \getbuffer
+
+%D When defining the external source of information, one can also specify a suitable
+%D name (the last argument). This name can be called upon with:
+%D
+%D \showsetup{from}
+%D
+%D We keep this for compatibility reasons, hence the hackery.
+
+\permanent\tolerant\protected\def\strc_references_from[#label]%
+ {\dontleavehmode
+ \goto{\clf_from{#label}}[fileorurl(#label)]}
+
+\permanent\def\dofromurldescription#content% called at the lua end
+ {#content}
+
+\permanent\def\dofromurlliteral#content% called at the lua end
+ {\useurlstyleandcolor\c!style\c!color
+ \hyphenatedurl{#content}}
+
+\aliased\let\dofromfiledescription\dofromurldescription
+\aliased\let\dofromfileliteral \dofromurlliteral % maybe some day setupfile that inherits from url
+
+%D We also support:
+%D
+%D \starttyping
+%D \goto{some text}[file(identifier{location}]
+%D \stoptyping
+%D
+%D which is completely equivalent with
+%D
+%D \starttyping
+%D \goto{some text}[identifier::location]
+%D \stoptyping
+
+%D A special case of references are those to programs. These, very system dependant
+%D references are implemented by abusing some of the previous macros.
+%D
+%D \showsetup{setupprograms}
+%D \showsetup{defineprogram}
+%D \showsetup{program} % changed functionality !
+%D
+%D The latter gives access to the description of the program,
+%D being the last argument to the definition command.
+
+% also lua, like urls and files
+
+\installcorenamespace{programs}
+
+\installdirectcommandhandler \??programs {programs}
+
+\permanent\tolerant\protected\def\defineprogram[#name]#spacer[#program]#spacer[#description]%
+ {\clf_defineprogram{#name}{#program}{#description}}
+
+\permanent\protected\def\program[#name]% incompatible, more consistent, hardy used anyway
+ {\dontleavehmode
+ \begingroup
+ \useprogramsstyleandcolor\c!style\c!color
+ \clf_getprogram{#name}%
+ \endgroup}
+
+%D As we can see, we directly use the special reference mechanism, which means that
+%D
+%D \starttyping
+%D \goto{some text}[program(name{args})]
+%D \stoptyping
+%D
+%D is valid.
+
+%D The next macro provides access to the actual pagenumbers. When documenting and
+%D sanitizing the original reference macros, I decided to keep the present meaning
+%D as well as to make this meaning available as a special reference method. So now
+%D one can use:
+%D
+%D \starttyping
+%D \gotopage{some text}[location]
+%D \gotopage{some text}[number]
+%D \gotopage{some text}[file::number]
+%D \stoptyping
+%D
+%D as well as:
+%D
+%D \starttyping
+%D \goto{some text}[page(location)]
+%D \goto{some text}[page(number)]
+%D \goto{some text}[file::page(number)]
+%D \stoptyping
+%D
+%D Here location is a keyword like \type{nextpage}.
+%D
+%D \showsetup{gotopage}
+
+\permanent\tolerant\protected\def\definepage[#name]#spacer[#target]%
+ {\definereference[#name][page(#target)]}
+
+\permanent\protected\def\gotopage#text[#target]%
+ {\goto{#text}[\v!page(#target)]}
+
+%D The previous definitions are somewhat obsolete so we don't use it here.
+
+%D We can cross link documents by using:
+%D
+%D \showsetup{coupledocument}
+%D
+%D like:
+%D
+%D \starttyping
+%D \coupledocument[print][somefile][chapter,section]
+%D \stoptyping
+%D
+%D After which when applicable, we have available the references:
+%D
+%D \starttyping
+%D \goto{print version}[print::chapter]
+%D \stoptyping
+%D
+%D and alike. The title placement definition macros have a key \type {file}, which
+%D is interpreted as the file to jump to, that is, when one clicks on the title.
+
+\permanent\tolerant\protected\def\coupledocument[#name]#spacer[#file]#spacer[#sections]#spacer[#description]%
+ {\ifthirdargument
+ % this will be done differently (when it's needed)
+ \fi}
+
+%D \macros
+%D {dotextprefix}
+%D
+%D In previous macros we used \type {\dotextprefix} to generate a space between
+%D a label and a number.
+%D
+%D \starttyping
+%D \dotextprefix{text}
+%D \stoptyping
+%D
+%D Only when \type {text} is not empty, a space is inserted.
+
+\permanent\protected\def\dotextprefix#text%
+ {\begingroup
+ \setbox\scratchbox\hbox{#text}% to be solved some day
+ \ifdim\wd\scratchbox>\zeropoint
+ \unhbox\scratchbox
+ \edef\p_separator{\referencingparameter\c!separator}%
+ \ifempty\p_separator \else
+ \removeunwantedspaces % remove is new
+ \p_separator
+ \fi
+ \else
+ \unhbox\scratchbox
+ \fi
+ \endgroup}
+
+%D In the next settings we see some variables that were not used here and that
+%D concern the way the pagenumbers refered to are typeset.
+
+\setupreferencing
+ [\c!state=\v!start,
+ \c!autofile=\v!no,
+ \v!part\c!number=\v!yes,
+ \v!chapter\c!number=\v!no,
+ \c!interaction=\v!all,
+ \c!convertfile=\v!no,
+ %\c!strut=\v!no, % some day an option
+ \c!prefix=,
+ \c!width=.75\makeupwidth,
+ \c!left=\quotation\bgroup,
+ \c!right=\egroup,
+ \c!global=\v!no,
+ \c!expansion=\v!no,
+ \c!separator=\nonbreakablespace,
+ \c!export=\v!no]
+
+\setupprograms
+ [\c!directory=,
+ \c!style=\v!type,
+ \c!color=]
+
+\definereference [\v!CloseDocument ] [action(close)]
+\definereference [\v!ExitViewer ] [action(exit)]
+\definereference [\v!FirstPage ] [action(first)]
+\definereference [\v!LastPage ] [action(last)]
+\definereference [\v!NextJump ] [action(forward)]
+\definereference [\v!NextPage ] [action(next)]
+\definereference [\v!PauseMovie ] [action(pausemovie)]
+\definereference [\v!PauseSound ] [action(pausesound)]
+\definereference [\v!PauseRendering ] [action(pauserendering)]
+\definereference [\v!PreviousJump ] [action(backward)]
+\definereference [\v!PreviousPage ] [action(previous)]
+\definereference [\v!PrintDocument ] [action(print)]
+\definereference [\v!SaveForm ] [action(exportform)]
+\definereference [\v!LoadForm ] [action(importform)]
+\definereference [\v!ResetForm ] [action(resetform)]
+\definereference [\v!ResumeMovie ] [action(resumemovie)]
+\definereference [\v!ResumeSound ] [action(resumesound)]
+\definereference [\v!ResumeRendering ] [action(resumerendering)]
+\definereference [\v!SaveDocument ] [action(save)]
+\definereference [\v!SaveNamedDocument] [action(savenamed)]
+\definereference [\v!OpenNamedDocument] [action(opennamed)]
+\definereference [\v!SearchDocument ] [action(search)]
+\definereference [\v!SearchAgain ] [action(searchagain)]
+\definereference [\v!StartMovie ] [action(startmovie)]
+\definereference [\v!StartSound ] [action(startsound)]
+\definereference [\v!StartRendering ] [action(startrendering)]
+\definereference [\v!StopMovie ] [action(stopmovie)]
+\definereference [\v!StopSound ] [action(stopsound)]
+\definereference [\v!StopRendering ] [action(stoprendering)]
+\definereference [\v!SubmitForm ] [action(submitform)]
+\definereference [\v!ToggleViewer ] [action(toggle)]
+\definereference [\v!ViewerHelp ] [action(help)]
+\definereference [\v!HideField ] [action(hide)]
+\definereference [\v!ShowField ] [action(show)]
+\definereference [\v!GotoPage ] [action(gotopage)]
+\definereference [\v!Query ] [action(query)]
+\definereference [\v!QueryAgain ] [action(queryagain)]
+\definereference [\v!FitWidth ] [action(fitwidth)]
+\definereference [\v!FitHeight ] [action(fitheight)]
+\definereference [\v!ShowThumbs ] [action(thumbnails)]
+\definereference [\v!ShowBookmarks ] [action(bookmarks)]
+
+\definereference [\v!HideLayer ] [action(hidelayer)]
+\definereference [\v!VideLayer ] [action(videlayer)]
+\definereference [\v!ToggleLayer ] [action(togglelayer)]
+
+\definereference [\v!firstpage] [page(firstpage)]
+\definereference [\v!previouspage] [page(previouspage)]
+\definereference [\v!nextpage] [page(nextpage)]
+\definereference [\v!lastpage] [page(lastpage)]
+\definereference [\v!forward] [page(forward)]
+\definereference [\v!backward] [page(backward)]
+\definereference [\v!firstsubpage] [page(firstsubpage)]
+\definereference [\v!previoussubpage] [page(previoussubpage)]
+\definereference [\v!nextsubpage] [page(nextsubpage)]
+\definereference [\v!lastsubpage] [page(lastsubpage)]
+
+% we can do this but only when later in resolve (else problems with \chapter[first]{...}
+%
+% \definereference [\v!first] [page(firstpage)]
+% \definereference [\v!previous] [page(prevpage)]
+% \definereference [\v!next] [page(nextpage)]
+% \definereference [\v!last] [page(lastpage)]
+% \definereference [\v!first\v!sub] [page(firstsubpage)]
+% \definereference [\v!previous\v!sub] [page(prevsubpage)]
+% \definereference [\v!next\v!sub] [page(nextsubpage)]
+% \definereference [\v!last\v!sub] [page(lastsubpage)]
+
+%D We cannot set up buttons (not yet, this one calls a menu macro):
+
+%D New (and experimental):
+
+% \starttext
+% \chapter{test}
+% \placefigure[here][xx:1]{}{\framed{one}} \placefigure[here][xx:2]{}{\framed{three}}
+% \placetable [here][xx:3]{}{\framed{two}} \placetable [here][xx:4]{}{\framed{four}}
+% \start
+% \in{fig}[xx:1] and \in{fig}[xx:2] \in{tab}[xx:3] and \in{tab}[xx:4]
+% \stop \blank \start
+% \setupreferencestructureprefix[default][prefix=no]
+% \in{fig}[xx:1] and \in{fig}[xx:2] \in{tab}[xx:3] and \in{tab}[xx:4]
+% \stop \blank \start
+% \setupreferencestructureprefix[float][default][prefix=no]
+% \in{fig}[xx:1] and \in{fig}[xx:2] \in{tab}[xx:3] and \in{tab}[xx:4]
+% \stop \blank \start
+% \setupreferencestructureprefix[figure][default][prefix=no]
+% \in{fig}[xx:1] and \in{fig}[xx:2] \in{tab}[xx:3] and \in{tab}[xx:4]
+% \stop \blank
+% \stoptext
+
+% todo: parameterhandler
+
+\installcorenamespace{referencingprefix}
+
+\permanent\def\getreferencestructureprefix#kind#name#category% name will change
+ {{%
+ prefix {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefix}%
+ separatorset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixseparatorset}%
+ conversion {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixconversion}%
+ conversionset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixconversionset}%
+ starter {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixstarter}%
+ stopper {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixstopper}%
+ set {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixset}%
+ segments {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixsegments}%
+ connector {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixconnector}%
+ }%
+ {%
+ separatorset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberseparatorset}%
+ conversion {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberconversion}%
+ conversionset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberconversionset}%
+ starter {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberstarter}%
+ stopper {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberstopper}%
+ segments {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numbersegments}%
+ }}
+
+\permanent\tolerant\protected\def\setupreferencestructureprefix[#kind]#spacer[#category]#spacer[#settings]%
+ {\ifarguments\or\or
+ \getparameters[\??referencingprefix:#kind][#category]%
+ \else
+ \getparameters[\??referencingprefix#kind:#category][#settings]%
+ \fi}
+
+\def\referencestructureprefixparameter#kind#name#category#parameter%
+ {\ifcsname\??referencingprefix#name:#category#parameter\endcsname
+ \lastnamedcs
+ \orelse\ifcsname\??referencingprefix#kind:#category#parameter\endcsname
+ \lastnamedcs
+ \orelse\ifcsname\??referencingprefix:#category#parameter\endcsname
+ \lastnamedcs
+ \fi}
+
+\permanent\def\currentreferencedefault % for some reason we need to explicitly expand
+ {\normalexpanded{\noexpand\clf_filterdefaultreference
+ {\s!default}%
+ \noexpand\getreferencestructureprefix\clf_getcurrentprefixspec{\s!default}% returns #kind#name#category
+ \relax}}
+
+%D Not all support is visible by looking at the \TEX\ code; here is one of those:^
+%D
+%D \starttyping
+%D \startinteractionmenu[right]
+%D \startbut [section(first {chapter})] first chapter \stopbut
+%D \startbut [section(previous{chapter})] previous chapter \stopbut
+%D \startbut [section(next {chapter})] next chapter \stopbut
+%D \startbut [section(last {chapter})] last chapter \stopbut
+%D \blank[2*big]
+%D \startbut [section(first {section})] first section \stopbut
+%D \startbut [section(previous{section})] previous section \stopbut
+%D \startbut [section(next {section})] next section \stopbut
+%D \startbut [section(last {section})] last section \stopbut
+%D \stopinteractionmenu
+%D \stoptyping
+
+%D Relatively new:
+%D
+%D \starttyping
+%D \chapter{The never ending story}
+%D
+%D \section{An ending story}
+%D
+%D \in{chapter}[match(complex bibliographies)]
+%D \in{chapter}[match(never ending)]
+%D \in{chapter}[match(ending)]
+%D \in{chapter}[match(chapter:never ending)]
+%D \in{chapter}[match(chapter:ending)]
+%D \in{section}[match(section:ending)]
+%D \in{figure}[match(float:mess)]
+%D \in{figure}[match(figure:mess)]
+%D \in{figure (not found)}[match(section:mess)]
+%D \in{figure (not found)}[match(section:xxxx)]
+%D \in{figure}[match(mess)]
+%D
+%D \placefigure{What a mess}{}
+%D
+%D \chapter{About complex bibliographies}
+%D
+%D \in{chapter}[match(complex bibliographies)]
+%D \in{chapter}[match(never ending)]
+%D \in{figure}[match(mess)]
+%D \stoptyping
+
+\protect \endinput
+
+% tricky:
+%
+% \enabletrackers[nodes.references]
+% \setupinteraction[state=start]
+% \def\KnuthTest{\input knuth }
+% \def\KnuthTest{\input tufte }
+% \def\TufteTest{\input tufte }
+% \defineoverlay[xxx][\overlaybutton{page(3)}]
+% \setupbackgrounds[text][background=xxx]
+% \starttext
+% test {\red \KnuthTest} test \par
+% \button{test}[page(1)] \par
+% \goto{page 2 \TeX}[page(2)] \goto{page 2 \TeX}[page(2)] \goto{\TufteTest}[page(2)] test \page
+% test \goto{page 3}[page(3)] \goto{\TufteTest\space\par\TufteTest}[page(4)] test \page
+% \goto{page 1}[page(1)] \goto{\TufteTest\space test}[page(1)] \page
+% \goto{page 1}[page(1)] \goto{\KnuthTest\space test}[page(1)] \page
+% test \goto{page 1}[page(1)] {\goto{\KnuthTest\space test}[page(1)]} test
+% \goto{page 1}[page(1)] \goto{\TufteTest}[page(1)] test \page
+% \stoptext
diff --git a/tex/context/base/mkiv/strc-tag.mkiv b/tex/context/base/mkiv/strc-tag.mkiv
index 19d670215..bae044612 100644
--- a/tex/context/base/mkiv/strc-tag.mkiv
+++ b/tex/context/base/mkiv/strc-tag.mkiv
@@ -20,169 +20,173 @@
\unprotect
-%D Eventually these labels will either move to the modules
-%D where they're used, or they will en dup in mult-tag.
-
-\def\t!document {document} % Div
-
-\def\t!division {division} % Div
-\def\t!paragraph {paragraph} % P
-\def\t!p {p} % P
-\def\t!construct {construct} % Span
-\def\t!highlight {highlight} % Span
-
-\def\t!section {section} % Sect
-\def\t!sectioncaption {sectioncaption} % Div
-\def\t!sectiontitle {sectiontitle} % H
-\def\t!sectionnumber {sectionnumber} % H
-\def\t!sectioncontent {sectioncontent} % Div
-
-\def\t!itemgroup {itemgroup} % L
-\def\t!item {item} % Li
-\def\t!itemtag {itemtag} % Lbl
-\def\t!itemcontent {itemcontent} % LBody
-\def\t!itemhead {itemhead} % Div
-\def\t!itembody {itembody} % Div
-
-\def\t!description {description} % Li
-\def\t!descriptiontag {descriptiontag} % Lbl
-\def\t!descriptioncontent {descriptioncontent} % LBody
-\def\t!descriptionsymbol {descriptionsymbol} % Span
-
-\let\t!construction \t!description
-\let\t!constructiontag \t!descriptiontag
-\let\t!constructioncontent \t!descriptioncontent
-\let\t!constructionsymbol \t!descriptionsymbol
-
-\def\t!verbatimblock {verbatimblock} % Code
-\def\t!verbatimlines {verbatimlines} % Code
-\def\t!verbatimline {verbatimline} % Code
-\def\t!verbatim {verbatim} % Code
-
-\def\t!lines {lines} % Code
-\def\t!line {line} % Code
-\def\t!linenumber {linenumber} % Span
-
-\def\t!sorting {sorting} % Span
-\def\t!synonym {synonym} % Span
-
-\def\t!register {register} % Div
-\def\t!registerlocation {registerlocation} % Span
-\def\t!registersection {registersection} % Div
-\def\t!registertag {registertag} % Span
-\def\t!registerentries {registerentries} % Div
-\def\t!registerentry {registerentry} % Span
-\def\t!registercontent {registercontent} % Span
-\def\t!registersee {registersee} % Span
-\def\t!registersection {registersection} % Span
-\def\t!registerpages {registerpages} % Span
-\def\t!registerpage {registerpage} % Span
-\def\t!registerpagerange {registerpagerange} % Span
-\def\t!registerfrompage {registerfrompage} % Span
-\def\t!registertopage {registertopage} % Span
-\def\t!registerseparator {registerseparator} % Span
-
-\def\t!table {table} % Table
-\def\t!tablerow {tablerow} % TR
-\def\t!tablecell {tablecell} % TD
-\def\t!tableheadcell {tableheadcell} % TH
-\def\t!tablehead {tablehead} % THEAD
-\def\t!tablebody {tablebody} % TBODY
-\def\t!tablefoot {tablefoot} % TFOOT
-
-
-\def\t!tabulate {tabulate} % Table
-\def\t!tabulaterow {tabulaterow} % TR
-\def\t!tabulatecell {tabulatecell} % TD
-\def\t!tabulateheadcell {tabulateheadcell} % TH
-\def\t!tabulatehead {tabulatehead} % THEAD
-\def\t!tabulatebody {tabulatebody} % TBODY
-\def\t!tabulatefoot {tabulatefoot} % TFOOT
-
-\def\t!math {math} % math
-\def\t!mathtable {mtable} % Table
-\def\t!mathtablerow {mtr} % TR
-\def\t!mathtablecell {mtd} % TD
-\def\t!mathaction {maction} %
-\def\t!mathstacker {mstacker}
-\def\t!mathstackertop {mstackertop}
-\def\t!mathstackermid {mstackermid}
-\def\t!mathstackerbot {mstackerbot}
-
-\def\t!munderover {munderover} % special cases
-\def\t!munder {munder} % special cases
-\def\t!mover {mover} % special cases
-
-\def\t!list {list} % TOC
-\def\t!listitem {listitem} % TOCI
-\def\t!listtag {listtag} % Lbl
-\def\t!listcontent {listcontent} % P
-\def\t!listdata {listdata} % P
-\def\t!listpage {listpage} % Reference
-\def\t!listtext {listtext} % Span
-
-\def\t!delimitedblock {delimited} % BlockQuote
-\def\t!delimited {delimited} % Quote
-\def\t!delimitedsymbol {delimitedsymbol} % Span
-\def\t!delimitedcontent {delimitedcontent} % Span
-\def\t!subsentence {subsentence} % Span
-\def\t!subsentencecontent {subsentencecontent} % Span
-\def\t!subsentencesymbol {subsentencesymbol} % Span
-
-\def\t!float {float} % Div
-\def\t!floatcaption {floatcaption} % Caption
-\def\t!floatlabel {floatlabel} % Span
-\def\t!floattext {floattext} % Span
-\def\t!floatnumber {floatnumber} % Span
-\def\t!floatcontent {floatcontent} % P
-
-\def\t!image {image} % P
-
-\def\t!mpgraphic {mpgraphic} % P
-
-\def\t!formulaset {formulaset} % Div
-\def\t!formula {formula} % Div
-\def\t!formulacaption {formulacaption} % Span
-\def\t!formulalabel {formulalabel} % Span
-\def\t!formulanumber {formulanumber} % P
-\def\t!formulacontent {formulacontent} % P
-\def\t!subformula {subformula} % Div
-
-\def\t!link {link} % Link
-\def\t!reference {reference} % Span
-
-\def\t!margintext {margintext} % Span
-\def\t!margintextblock {margintextblock} % Div
-\def\t!marginanchor {marginanchor} % Span
+%D Eventually these labels will either move to the modules where they're used, or
+%D they will en dup in mult-tag.
+
+\definetagconstant{document} % Div
+
+\definetagconstant{division} % Div
+\definetagconstant{paragraph} % P
+\definetagconstant{p} % P
+\definetagconstant{construct} % Span
+\definetagconstant{highlight} % Span
+
+\definetagconstant{section} % Sect
+\definetagconstant{sectioncaption} % Div
+\definetagconstant{sectiontitle} % H
+\definetagconstant{sectionnumber} % H
+\definetagconstant{sectioncontent} % Div
+
+\definetagconstant{itemgroup} % L
+\definetagconstant{item} % Li
+\definetagconstant{itemtag} % Lbl
+\definetagconstant{itemcontent} % LBody
+\definetagconstant{itemhead} % Div
+\definetagconstant{itembody} % Div
+
+\definetagconstant{description} % Li
+\definetagconstant{descriptiontag} % Lbl
+\definetagconstant{descriptioncontent} % LBody
+\definetagconstant{descriptionsymbol} % Span
+
+\aliastagconstant{construction} {description}
+\aliastagconstant{constructiontag} {descriptiontag}
+\aliastagconstant{constructioncontent}{descriptioncontent}
+\aliastagconstant{constructionsymbol} {descriptionsymbol}
+
+\definetagconstant{verbatimblock} % Code
+\definetagconstant{verbatimlines} % Code
+\definetagconstant{verbatimline} % Code
+\definetagconstant{verbatim} % Code
+
+\definetagconstant{lines} % Code
+\definetagconstant{line} % Code
+\definetagconstant{linenumber} % Span
+
+\definetagconstant{sorting} % Span
+\definetagconstant{synonym} % Span
+
+\definetagconstant{register} % Div
+\definetagconstant{registerlocation} % Span
+\definetagconstant{registersection} % Div
+\definetagconstant{registertag} % Span
+\definetagconstant{registerentries} % Div
+\definetagconstant{registerentry} % Span
+\definetagconstant{registercontent} % Span
+\definetagconstant{registersee} % Span
+\definetagconstant{registerpages} % Span
+\definetagconstant{registerpage} % Span
+\definetagconstant{registerpagerange} % Span
+\definetagconstant{registerfrompage} % Span
+\definetagconstant{registertopage} % Span
+\definetagconstant{registerseparator} % Span
+
+\definetagconstant{table} % Table
+\definetagconstant{tablerow} % TR
+\definetagconstant{tablecell} % TD
+\definetagconstant{tableheadcell} % TH
+\definetagconstant{tablehead} % THEAD
+\definetagconstant{tablebody} % TBODY
+\definetagconstant{tablefoot} % TFOOT
+
+\definetagconstant{tabulate} % Table
+\definetagconstant{tabulaterow} % TR
+\definetagconstant{tabulatecell} % TD
+\definetagconstant{tabulateheadcell} % TH
+\definetagconstant{tabulatehead} % THEAD
+\definetagconstant{tabulatebody} % TBODY
+\definetagconstant{tabulatefoot} % TFOOT
+
+\definetagconstant{math} % math
+\definetagconstant{mtable} % Table
+\definetagconstant{mtr} % TR
+\definetagconstant{mtd} % TD
+\definetagconstant{maction} %
+\definetagconstant{mstacker}
+\definetagconstant{mstackertop}
+\definetagconstant{mstackermid}
+\definetagconstant{mstackerbot}
+
+\aliastagconstant{mtablerow} {mtr}
+\aliastagconstant{mtablecell}{mtd}
+
+\definetagconstant{munderover} % special cases
+\definetagconstant{munder} % special cases
+\definetagconstant{mover} % special cases
+
+\definetagconstant{list} % TOC
+\definetagconstant{listitem} % TOCI
+\definetagconstant{listtag} % Lbl
+\definetagconstant{listcontent} % P
+\definetagconstant{listdata} % P
+\definetagconstant{listpage} % Reference
+\definetagconstant{listtext} % Span
+
+\definetagconstant{delimited} % BlockQuote
+%definetagconstant{delimited} % Quote
+\definetagconstant{delimitedsymbol} % Span
+\definetagconstant{delimitedcontent} % Span
+
+\aliastagconstant{delimitedblock}{delimited}
+
+\definetagconstant{subsentence} % Span
+\definetagconstant{subsentencecontent} % Span
+\definetagconstant{subsentencesymbol} % Span
+
+\definetagconstant{float} % Div
+\definetagconstant{floatcaption} % Caption
+\definetagconstant{floatlabel} % Span
+\definetagconstant{floattext} % Span
+\definetagconstant{floatnumber} % Span
+\definetagconstant{floatcontent} % P
+
+\definetagconstant{image} % P
+
+\definetagconstant{mpgraphic} % P
+
+\definetagconstant{formulaset} % Div
+\definetagconstant{formula} % Div
+\definetagconstant{formulacaption} % Span
+\definetagconstant{formulalabel} % Span
+\definetagconstant{formulanumber} % P
+\definetagconstant{formulacontent} % P
+\definetagconstant{subformula} % Div
+
+\definetagconstant{link} % Link
+\definetagconstant{reference} % Span
+
+\definetagconstant{margintext} % Span
+\definetagconstant{margintextblock} % Div
+\definetagconstant{marginanchor} % Span
% we might opt for verbose variants so this is experimental:
-\def\t!label {label} % Span
-\def\t!number {number} % Span
+\definetagconstant{label} % Span
+\definetagconstant{number} % Span
-\def\t!ignore {ignore} % Span
-\def\t!private {private} % Span
+\definetagconstant{ignore} % Span
+\definetagconstant{private} % Span
-\def\t!mid {mid} % Span
-\def\t!sub {sub} % Span
-\def\t!sup {sup} % Span
-\def\t!subsup {subsup} % Span
+\definetagconstant{mid} % Span
+\definetagconstant{sub} % Span
+\definetagconstant{sup} % Span
+\definetagconstant{subsup} % Span
-\def\t!unit {unit} % Span
-\def\t!quantity {quantity} % Span
-\def\t!number {number} % Span
+\definetagconstant{unit} % Span
+\definetagconstant{quantity} % Span
+%definetagconstant{number} % Span
-\def\t!combination {combination} % Span
-\def\t!combinationpair {combinationpair} % Span
-\def\t!combinationcontent {combinationcontent} % Span
-\def\t!combinationcaption {combinationcaption} % Span
+\definetagconstant{combination} % Span
+\definetagconstant{combinationpair} % Span
+\definetagconstant{combinationcontent} % Span
+\definetagconstant{combinationcaption} % Span
-\def\t!publications {publications} % Span
-\def\t!publication {publication} % Span
-\def\t!pubfld {pubfld} % Span
+\definetagconstant{publications} % Span
+\definetagconstant{publication} % Span
+\definetagconstant{pubfld} % Span
-\def\t!block {block} % Div
-\def\t!userdata {userdata} % Div
+\definetagconstant{block} % Div
+\definetagconstant{userdata} % Div
% \setuptaglabeltext
% [en]
diff --git a/tex/context/base/mkiv/supp-box.mkxl b/tex/context/base/mkiv/supp-box.mkxl
index 2ed9ea9c1..fe08876ac 100644
--- a/tex/context/base/mkiv/supp-box.mkxl
+++ b/tex/context/base/mkiv/supp-box.mkxl
@@ -2408,7 +2408,7 @@
\protected\def\syst_boxes_stack_allocate
{\newbox\b_syst_boxes_stack
- \expandafter\let\csname\??boxstack\number\c_syst_boxes_stack\endcsname\b_syst_boxes_stack}
+ \letcsname\??boxstack\number\c_syst_boxes_stack\endcsname\b_syst_boxes_stack}
\protected\def\syst_boxes_push#1#2%
{\global\advance\c_syst_boxes_stack\plusone
@@ -2586,11 +2586,11 @@
\installcorenamespace {box_x}
\installcorenamespace {box_y}
-\permanent\protected\def\setboxllx #1#2{\expandafter\edef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}}
-\permanent\protected\def\setboxlly #1#2{\expandafter\edef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}}
+\permanent\protected\def\setboxllx #1#2{\edefcsname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}}
+\permanent\protected\def\setboxlly #1#2{\edefcsname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}}
-\permanent\protected\def\gsetboxllx#1#2{\expandafter\xdef\csname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}}
-\permanent\protected\def\gsetboxlly#1#2{\expandafter\xdef\csname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}}
+\permanent\protected\def\gsetboxllx#1#2{\global\edefcsname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}}
+\permanent\protected\def\gsetboxlly#1#2{\global\edefcsname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}}
\permanent\def\getboxllx#1{\ifcsname\??box_x\number#1\endcsname\lastnamedcs\else\zeropoint\fi}
\permanent\def\getboxlly#1{\ifcsname\??box_y\number#1\endcsname\lastnamedcs\else\zeropoint\fi}
diff --git a/tex/context/base/mkiv/syst-aux.mkxl b/tex/context/base/mkiv/syst-aux.mkxl
index b94bc285c..9ae18ab71 100644
--- a/tex/context/base/mkiv/syst-aux.mkxl
+++ b/tex/context/base/mkiv/syst-aux.mkxl
@@ -395,17 +395,6 @@
%D As we will see, \CONTEXT\ uses these commands many times, which is mainly due to
%D its object oriented and parameter driven character.
-% \def\setvalue #1{\expandafter\def \csname#1\endcsname}
-% \def\setgvalue #1{\expandafter\gdef\csname#1\endcsname}
-% \def\setevalue #1{\expandafter\edef\csname#1\endcsname}
-% \def\setxvalue #1{\expandafter\xdef\csname#1\endcsname}
-% \def\getvalue #1{\csname#1\endcsname} % maybe: \begincsname#1\endcsname
-% \def\letvalue #1{\expandafter\let \csname#1\endcsname}
-% \def\letgvalue #1{\expandafter\glet\csname#1\endcsname}
-% \def\resetvalue #1{\expandafter\let \csname#1\endcsname\empty}
-% \def\undefinevalue#1{\expandafter\let \csname#1\endcsname\undefined}
-% \def\ignorevalue#1#2{\expandafter\let \csname#1\endcsname\empty}
-
\def\setvalue #1{\expandafter\defcsname#1\endcsname}
\def\setgvalue #1{\global\defcsname#1\endcsname}
\def\setevalue #1{\edefcsname#1\endcsname}
@@ -417,11 +406,6 @@
\def\undefinevalue#1{\letcsname#1\endcsname\undefined}
\def\ignorevalue#1#2{\letcsname#1\endcsname\empty}
-% \def\setuvalue #1{\protected\expandafter \def\csname#1\endcsname}
-% \def\setuevalue #1{\protected\expandafter\edef\csname#1\endcsname}
-% \def\setugvalue #1{\protected\expandafter\gdef\csname#1\endcsname}
-% \def\setuxvalue #1{\protected\expandafter\xdef\csname#1\endcsname}
-
\def\setuvalue #1{\protected\defcsname#1\endcsname}
\def\setuevalue #1{\protected\edefcsname#1\endcsname}
\def\setugvalue #1{\protected\global\defcsname#1\endcsname}
@@ -508,13 +492,13 @@
%D existance is not the same as the one described here. Therefore we introduce:
\protected\def\letbeundefined#1%
- {\expandafter\let\csname#1\endcsname\undefined} % or use \undefinevalue to match \setvalue
+ {\letcsname#1\endcsname\undefined} % or use \undefinevalue to match \setvalue
\protected\def\localundefine#1% conditional
- {\ifcsname#1\endcsname\expandafter\let\csname#1\endcsname\undefined\fi}
+ {\ifcsname#1\endcsname\letcsname#1\endcsname\undefined\fi}
\protected\def\globalundefine#1% conditional
- {\ifcsname#1\endcsname\expandafter\glet\csname#1\endcsname\undefined\fi}
+ {\ifcsname#1\endcsname\global\letcsname#1\endcsname\undefined\fi}
%D Beware, being \type {\undefined} in \ETEX\ means that the macro {\em is} defined!
%D
@@ -1452,12 +1436,12 @@
%D These macros are in fact auxiliary ones and are not meant for use outside the
%D assignment macros.
-\def\dosetvalue #1#2{\expandafter\def \csname#1#2\endcsname} % takes #3
-\def\dosetevalue #1#2{\expandafter\edef\csname#1#2\endcsname} % takes #3
-\def\dosetgvalue #1#2{\expandafter\gdef\csname#1#2\endcsname} % takes #3
-\def\doresetvalue #1#2{\expandafter\let \csname#1#2\endcsname\empty}
-\def\doignorevalue#1#2#3{\expandafter\let \csname#1#2\endcsname\empty}
-\def\docopyvalue #1#2#3{\expandafter\def \csname#1#3\endcsname{\csname#2#3\endcsname}}
+\def\dosetvalue #1#2{\defcsname #1#2\endcsname} % takes #3
+\def\dosetevalue #1#2{\edefcsname #1#2\endcsname} % takes #3
+\def\dosetgvalue #1#2{\global\edefcsname#1#2\endcsname} % takes #3
+\def\doresetvalue #1#2{\letcsname #1#2\endcsname\empty}
+\def\doignorevalue#1#2#3{\letcsname #1#2\endcsname\empty}
+\def\docopyvalue #1#2#3{\defcsname #1#3\endcsname{\csname#2#3\endcsname}}
%D \macros
%D {doassign,undoassign,doassignempty}
@@ -1697,23 +1681,23 @@
{\def\syst_helpers_copy_parameter{\docopyvalue{#1}{#2}}% ##1
\processcommalist[#3]\syst_helpers_copy_parameter}}
-%D \macros
-%D {ifparameters,checkparameters}
-%D
-%D A slightly different one is \type {\checkparameters}, which also checks on the
-%D presence of a~\type {=}.
-%D
-%D The boolean \type {\ifparameters} can be used afterwards. Combining both in one
-%D \type {\if}||macro would lead to problems with nested \type {\if}'s.
-%D
-%D \starttyping
-%D \checkparameters[argument]
-%D \stoptyping
-
-\newif\ifparameters
-
-\protected\def\checkparameters[#1]%
- {\ifhastok={#1}\parameterstrue\else\parametersfalse\fi}
+% %D \macros
+% %D {ifparameters,checkparameters}
+% %D
+% %D A slightly different one is \type {\checkparameters}, which also checks on the
+% %D presence of a~\type {=}.
+% %D
+% %D The boolean \type {\ifparameters} can be used afterwards. Combining both in one
+% %D \type {\if}||macro would lead to problems with nested \type {\if}'s.
+% %D
+% %D \starttyping
+% %D \checkparameters[argument]
+% %D \stoptyping
+%
+% \newif\ifparameters
+%
+% \protected\def\checkparameters[#1]%
+% {\ifhastok={#1}\parameterstrue\else\parametersfalse\fi}
%D \macros
%D {getfromcommalist,getfromcommacommand,
@@ -2772,14 +2756,14 @@
\protected\def\letempty #1{\let #1\empty}
\protected\def\globalletempty#1{\glet#1\empty}
-\protected\def\letvalueempty #1{\expandafter\let \csname#1\endcsname\empty}
-\protected\def\letgvalueempty#1{\expandafter\glet\csname#1\endcsname\empty}
-\protected\def\letvaluerelax #1{\expandafter\let \csname#1\endcsname\relax}
-\protected\def\letgvalurelax #1{\expandafter\glet\csname#1\endcsname\relax}
+\protected\def\letvalueempty #1{\letcsname #1\endcsname\empty}
+\protected\def\letgvalueempty#1{\global\letcsname#1\endcsname\empty}
+\protected\def\letvaluerelax #1{\letcsname #1\endcsname\relax}
+\protected\def\letgvalurelax #1{\global\letcsname#1\endcsname\relax}
\protected\def\relaxvalueifundefined#1%
{\ifcsname#1\endcsname \else
- \expandafter\let\csname#1\endcsname\relax
+ \letcsname#1\endcsname\relax
\fi}
%D \macros
@@ -2848,7 +2832,7 @@
\def\syst_helpers_grab_raw_parameter#1=#2,%
{\ifarguments\or\or
- \expandafter\def\csname\m_syst_parameter_n#1\endcsname{#2}%
+ \defcsname\m_syst_parameter_n#1\endcsname{#2}%
\expandafter\syst_helpers_grab_raw_parameter_next
\fi}
@@ -3086,7 +3070,7 @@
\protected\def\savenormalmeaning#1%
{\ifcsname normal\csstring#1\endcsname \else
- \expandafter\let\csname normal\csstring#1\endcsname#1%
+ \letcsname normal\csstring#1\endcsname#1%
\fi}
%D \macros
@@ -5378,7 +5362,6 @@
\def\executeifdefined#1% #2 / never change this one again
{\ifcsname#1\endcsname
- % \csname#1\expandafter\expandafter\expandafter\endcsname\expandafter\gobbleoneargument
\expandafter\expandafter\expandafter\lastnamedcs\expandafter\gobbleoneargument
\else
\expandafter\firstofoneargument
@@ -6094,13 +6077,13 @@
\installsystemnamespace{measure}
-\permanent\tolerant\protected\def\definemeasure[#1]#*[#2]{\expandafter \def\csname\??measure#1\endcsname{#2}}
-\permanent\tolerant\protected\def\freezemeasure[#1]#*[#2]{\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}}
+\permanent\tolerant\protected\def\definemeasure[#1]#*[#2]{\defcsname \??measure#1\endcsname{#2}}
+\permanent\tolerant\protected\def\freezemeasure[#1]#*[#2]{\edefcsname\??measure#1\endcsname{\the\dimexpr#2}}
-\permanent\protected\def\setmeasure #1#2{\expandafter\def \csname\??measure#1\endcsname{#2}} % quick way
-\permanent\protected\def\setgmeasure#1#2{\expandafter\gdef\csname\??measure#1\endcsname{#2}} % quick way
-\permanent\protected\def\setemeasure#1#2{\expandafter\edef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way
-\permanent\protected\def\setxmeasure#1#2{\expandafter\xdef\csname\??measure#1\endcsname{\the\dimexpr#2}} % quick way
+\permanent\protected\def\setmeasure #1#2{\defcsname \??measure#1\endcsname{#2}} % quick way
+\permanent\protected\def\setgmeasure#1#2{\global\defcsname \??measure#1\endcsname{#2}} % quick way
+\permanent\protected\def\setemeasure#1#2{\edefcsname \??measure#1\endcsname{\the\dimexpr#2}} % quick way
+\permanent\protected\def\setxmeasure#1#2{\global\edefcsname\??measure#1\endcsname{\the\dimexpr#2}} % quick way
\permanent\def\measure {\the\measured}
\permanent\def\measured#1{\dimexpr\ifcsname\??measure#1\endcsname\lastnamedcs\else\zeropoint\fi\relax}
@@ -6118,13 +6101,13 @@
\installsystemnamespace{quantity}
-\permanent\tolerant\protected\def\definequantity[#1]#*[#2]{\expandafter\def \csname\??quantity#1\endcsname{#2}}
-\permanent\tolerant\protected\def\freezequantity[#1]#*[#2]{\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}}
+\permanent\tolerant\protected\def\definequantity[#1]#*[#2]{\defcsname \??quantity#1\endcsname{#2}}
+\permanent\tolerant\protected\def\freezequantity[#1]#*[#2]{\edefcsname\??quantity#1\endcsname{\the\numexpr#2}}
-\permanent\protected\def\setquantity #1#2{\expandafter\def \csname\??quantity#1\endcsname{#2}} % quick way
-\permanent\protected\def\setgquantity#1#2{\expandafter\gdef\csname\??quantity#1\endcsname{#2}} % quick way
-\permanent\protected\def\setequantity#1#2{\expandafter\edef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way
-\permanent\protected\def\setxquantity#1#2{\expandafter\xdef\csname\??quantity#1\endcsname{\the\numexpr#2}} % quick way
+\permanent\protected\def\setquantity #1#2{\defcsname \??quantity#1\endcsname{#2}} % quick way
+\permanent\protected\def\setgquantity#1#2{\global\defcsname \??quantity#1\endcsname{#2}} % quick way
+\permanent\protected\def\setequantity#1#2{\edefcsname \??quantity#1\endcsname{\the\numexpr#2}} % quick way
+\permanent\protected\def\setxquantity#1#2{\global\edefcsname\??quantity#1\endcsname{\the\numexpr#2}} % quick way
\permanent\def\quantity {\the\quantitied}
\permanent\def\quantitied #1{\numexpr\ifcsname\??quantity#1\endcsname\lastnamedcs\else\zeropoint\fi\relax}
@@ -6229,7 +6212,7 @@
% another one, add an item to a commalist
\permanent\protected\def\addvalue#1#2% cs item
- {\ifcsname#1\endcsname\else\expandafter\let\csname#1\endcsname\empty\fi
+ {\ifcsname#1\endcsname\else\letcsname#1\endcsname\empty\fi
\normalexpanded{\addtocommalist{#2}\expandafter\noexpand\csname#1\endcsname}}
%D Are these ever used? Anyway, these variants are somewhat more efficient than
@@ -6266,8 +6249,8 @@
\installsystemnamespace{flag}
-\protected\def\setflag #1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\zerocount}
-\protected\def\resetflag#1{\expandafter\dodoglobal\expandafter\let\csname\??flag#1\endcsname\plusone}
+\protected\def\setflag #1{\dodoglobal\letcsname\??flag#1\endcsname\zerocount}
+\protected\def\resetflag#1{\dodoglobal\letcsname\??flag#1\endcsname\plusone}
\def\flag#1{\csname\??flag#1\endcsname}
@@ -6292,7 +6275,7 @@
\fi}
\protected\def\inheritparameter[#1]#2[#3]#4[#5]% tag tokey fromkey
- {\expandafter\def\csname#1#3\expandafter\endcsname\expandafter{\csname#1#5\endcsname}}
+ {\defcsname#1#3\expandafter\endcsname\expandafter{\csname#1#5\endcsname}}
\def\syst_helpers_if_non_zero_positive_else#1#2\end % #3#4%
{\ifx#1\relax
@@ -6317,10 +6300,10 @@
% here ?
-\protected\def\dosetrawvalue #1#2#3{\expandafter \def\csname#1#2\endcsname{#3}}
-\protected\def\dosetrawevalue#1#2#3{\expandafter\edef\csname#1#2\endcsname{#3}}
-\protected\def\dosetrawgvalue#1#2#3{\expandafter\gdef\csname#1#2\endcsname{#3}}
-\protected\def\dosetrawxvalue#1#2#3{\expandafter\xdef\csname#1#2\endcsname{#3}}
+\protected\def\dosetrawvalue #1#2#3{\defcsname #1#2\endcsname{#3}}
+\protected\def\dosetrawevalue#1#2#3{\edefcsname #1#2\endcsname{#3}}
+\protected\def\dosetrawgvalue#1#2#3{\global\defcsname #1#2\endcsname{#3}}
+\protected\def\dosetrawxvalue#1#2#3{\global\edefcsname#1#2\endcsname{#3}}
\protected\def\getrawparameters {\dogetparameters\dosetrawvalue }
\protected\def\getraweparameters {\dogetparameters\dosetrawevalue}
diff --git a/tex/context/base/mkiv/syst-ini.mkxl b/tex/context/base/mkiv/syst-ini.mkxl
index fbce9d780..202bc62f7 100644
--- a/tex/context/base/mkiv/syst-ini.mkxl
+++ b/tex/context/base/mkiv/syst-ini.mkxl
@@ -147,9 +147,9 @@
\permanent\letcharcode \tildeasciicode \ % tilde
\permanent\letcharcode \spaceasciicode \space % space
-\permanent\expandafter\def\csname\Uchar\tabasciicode \endcsname {\ } % \def\^^I{\ } tab
-\permanent\expandafter\def\csname\Uchar\formfeedasciicode \endcsname {\par} % \def\^^L{\par} formfeed
-\permanent\expandafter\def\csname\Uchar\endoflineasciicode\endcsname {\ } % \def\^^M{\ } return
+\permanent\defcsname\Uchar\tabasciicode \endcsname {\ } % \def\^^I{\ } tab
+\permanent\defcsname\Uchar\formfeedasciicode \endcsname {\par} % \def\^^L{\par} formfeed
+\permanent\defcsname\Uchar\endoflineasciicode\endcsname {\ } % \def\^^M{\ } return
%D For now:
@@ -588,8 +588,8 @@
% We wrap all into one macro (the frozen stuff adds 10% runtime):
\permanent\protected\def\newif#1%
- {\permanent\protected\expandafter\gdef\csname\expandafter\new_if_check\csstring#1true\endcsname {\overloaded\frozen\let#1\iftrue }%
- \permanent\protected\expandafter\gdef\csname\expandafter\new_if_check\csstring#1false\endcsname{\overloaded\frozen\let#1\iffalse}%
+ {\permanent\protected\global\defcsname\expandafter\new_if_check\csstring#1true\endcsname {\overloaded\frozen\let#1\iftrue }%
+ \permanent\protected\global\defcsname\expandafter\new_if_check\csstring#1false\endcsname{\overloaded\frozen\let#1\iffalse}%
\csname\expandafter\new_if_check\csstring#1false\endcsname}
\normalexpanded{\gdef\noexpand\new_if_check\string i\string f{}}
@@ -1029,7 +1029,7 @@
\immediate\write\statuswrite{fatal error: duplicate system namespace '#1'}%
\else
\global\advance\c_syst_helpers_n_of_namespaces\plusone
- \immutable\expandafter\edef\csname ??#1\endcsname{\v_interfaces_prefix_template_system}%
+ \immutable\edefcsname ??#1\endcsname{\v_interfaces_prefix_template_system}%
\fi}
%D It makes more sense to have these here:
diff --git a/tex/context/base/mkiv/tabl-ltb.mkxl b/tex/context/base/mkiv/tabl-ltb.mkxl
index 527bb0860..1ab2a2c4b 100644
--- a/tex/context/base/mkiv/tabl-ltb.mkxl
+++ b/tex/context/base/mkiv/tabl-ltb.mkxl
@@ -562,7 +562,7 @@
\egroup}
\permanent\def\checklinecolumndimension#1#2#3%
- {\expandafter\xdef\csname#1\number#3\endcsname
+ {\global\edef#1\number#3\endcsname
{\expandafter\ifx\csname#1\number#3\endcsname\relax
\the#2\b_tabl_lines_cell
\orelse\ifdim\csname#1\number#3\endcsname<#2\b_tabl_lines_cell
diff --git a/tex/context/base/mkiv/tabl-ntb.mkxl b/tex/context/base/mkiv/tabl-ntb.mkxl
index 300821107..ff8450f15 100644
--- a/tex/context/base/mkiv/tabl-ntb.mkxl
+++ b/tex/context/base/mkiv/tabl-ntb.mkxl
@@ -279,28 +279,28 @@
\letvalue{\??naturaltablesqueeze\v!broad}\donetrue
\letvalue{\??naturaltablesqueeze\v!local}\donetrue
-\def\tabl_ntb_let_gal{\expandafter\glet\csname\??naturaltablegal\m_tabl_tbl_level\endcsname}
+\def\tabl_ntb_let_gal{\global\letcsname\??naturaltablegal\m_tabl_tbl_level\endcsname}
\def\tabl_ntb_get_gal{\csname\??naturaltablegal\m_tabl_tbl_level\endcsname}
-\def\tabl_ntb_let_tal#1{\expandafter\glet\csname\??naturaltabletal\m_tabl_tbl_level:\number#1\endcsname}
+\def\tabl_ntb_let_tal#1{\global\letcsname\??naturaltabletal\m_tabl_tbl_level:\number#1\endcsname}
\def\tabl_ntb_get_tal#1{\csname\??naturaltabletal\m_tabl_tbl_level:\number#1\endcsname}
-\def\tabl_ntb_set_nob#1{\expandafter\let\csname\??naturaltablenob\m_tabl_tbl_level:\number#1\endcsname\plusone}
+\def\tabl_ntb_set_nob#1{\letcsname\??naturaltablenob\m_tabl_tbl_level:\number#1\endcsname\plusone}
\def\tabl_ntb_get_nob#1{\ifcsname\??naturaltablenob\m_tabl_tbl_level:\number#1\endcsname\plusone\else\zerocount\fi}
-%def\tabl_ntb_set_tag#1#2{\expandafter\edef\csname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname}
-\def\tabl_ntb_set_col#1#2{\expandafter\edef\csname\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2\endcsname}
-\def\tabl_ntb_set_row#1#2{\expandafter\edef\csname\??naturaltablerow\m_tabl_tbl_level:\number#1:\number#2\endcsname}
+%def\tabl_ntb_set_tag#1#2{\edefcsname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname}
+\def\tabl_ntb_set_col#1#2{\edefcsname\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2\endcsname}
+\def\tabl_ntb_set_row#1#2{\edefcsname\??naturaltablerow\m_tabl_tbl_level:\number#1:\number#2\endcsname}
-\def\tabl_ntb_let_tag#1#2{\expandafter\let\csname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname}
-\def\tabl_ntb_let_col#1#2{\expandafter\let\csname\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2\endcsname}
-\def\tabl_ntb_let_row#1#2{\expandafter\let\csname\??naturaltablerow\m_tabl_tbl_level:\number#1:\number#2\endcsname}
+\def\tabl_ntb_let_tag#1#2{\letcsname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname}
+\def\tabl_ntb_let_col#1#2{\letcsname\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2\endcsname}
+\def\tabl_ntb_let_row#1#2{\letcsname\??naturaltablerow\m_tabl_tbl_level:\number#1:\number#2\endcsname}
-%def\tabl_ntb_set_wd#1#2{\expandafter\xdef\csname\??naturaltablewd\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global !
-\def\tabl_ntb_set_ht#1#2{\expandafter\xdef\csname\??naturaltableht\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global !
+%def\tabl_ntb_set_wd#1#2{\global\edefcsname\??naturaltablewd\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global !
+\def\tabl_ntb_set_ht#1#2{\global\edefcsname\??naturaltableht\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global !
-%def\tabl_ntb_let_wd#1#2{\expandafter\glet\csname\??naturaltablewd\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global !
-\def\tabl_ntb_let_ht#1#2{\expandafter\glet\csname\??naturaltableht\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global !
+%def\tabl_ntb_let_wd#1#2{\global\letcsname\??naturaltablewd\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global !
+\def\tabl_ntb_let_ht#1#2{\global\letcsname\??naturaltableht\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global !
\def\tabl_ntb_get_tag#1#2{\csname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname}
\def\tabl_ntb_get_col#1#2{\csname\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2\endcsname}
@@ -309,15 +309,15 @@
%def\tabl_ntb_get_wd#1#2{\csname\??naturaltablewd\m_tabl_tbl_level:\number#1:\number#2\endcsname}
\def\tabl_ntb_get_ht#1#2{\csname\??naturaltableht\m_tabl_tbl_level:\number#1:\number#2\endcsname}
-\def\tabl_ntb_set_wid#1{\expandafter\xdef\csname\??naturaltablewid\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
-\def\tabl_ntb_set_hei#1{\expandafter\xdef\csname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
-\def\tabl_ntb_set_dis#1{\expandafter\xdef\csname\??naturaltabledis\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
-\def\tabl_ntb_set_aut#1{\expandafter\xdef\csname\??naturaltableaut\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
+\def\tabl_ntb_set_wid#1{\global\edefcsname\??naturaltablewid\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
+\def\tabl_ntb_set_hei#1{\global\edefcsname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
+\def\tabl_ntb_set_dis#1{\global\edefcsname\??naturaltabledis\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
+\def\tabl_ntb_set_aut#1{\global\edefcsname\??naturaltableaut\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
-\def\tabl_ntb_let_wid#1{\expandafter\glet\csname\??naturaltablewid\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
-\def\tabl_ntb_let_hei#1{\expandafter\glet\csname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
-\def\tabl_ntb_let_dis#1{\expandafter\glet\csname\??naturaltabledis\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
-\def\tabl_ntb_let_aut#1{\expandafter\glet\csname\??naturaltableaut\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
+\def\tabl_ntb_let_wid#1{\global\letcsname\??naturaltablewid\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
+\def\tabl_ntb_let_hei#1{\global\letcsname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
+\def\tabl_ntb_let_dis#1{\global\letcsname\??naturaltabledis\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
+\def\tabl_ntb_let_aut#1{\global\letcsname\??naturaltableaut\m_tabl_tbl_level:\number#1\endcsname} % {#2} global !
\def\tabl_ntb_get_wid#1{\ifcsname\??naturaltablewid\m_tabl_tbl_level:\number#1\endcsname\lastnamedcs\else\zeropoint\fi}
\def\tabl_ntb_get_hei#1{\ifcsname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname\lastnamedcs\else\zeropoint\fi}
@@ -343,7 +343,7 @@
%
% \def\tabl_ntb_let_tag#1#2#3%
% {\ifx#3\c_tabl_ntb_none\else
-% \expandafter\let\csname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname#3%
+% \letcsname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname#3%
% \fi}
%
% \def\tabl_ntb_get_tag#1#2%
@@ -353,26 +353,20 @@
% \c_tabl_ntb_none
% \fi}
-\def\tabl_ntb_let_ref #1#2{\expandafter\glet\csname\??naturaltableref\m_tabl_tbl_level:\number#1:\number#2\endcsname}
-\def\tabl_ntb_set_ref #1#2{\expandafter\xdef\csname\??naturaltableref\m_tabl_tbl_level:\number#1:\number#2\endcsname}
+\def\tabl_ntb_let_ref #1#2{\global\letcsname\??naturaltableref\m_tabl_tbl_level:\number#1:\number#2\endcsname}
+\def\tabl_ntb_set_ref #1#2{\global\edefcsname\??naturaltableref\m_tabl_tbl_level:\number#1:\number#2\endcsname}
%def\tabl_ntb_get_ref #1#2{\ifcsname\??naturaltableref\m_tabl_tbl_level:\number#1:\number#2\endcsname\csname\??naturaltableref\m_tabl_tbl_level:\number#1:\number#2\endcsname\fi}
\def\tabl_ntb_get_ref #1#2{\begincsname\??naturaltableref\m_tabl_tbl_level:\number#1:\number#2\endcsname}
-\def\tabl_ntb_set_spn #1{\expandafter\let\csname\??naturaltablespn\m_tabl_tbl_level:\number#1\endcsname \!!plusone}
+\def\tabl_ntb_set_spn #1{\letcsname\??naturaltablespn\m_tabl_tbl_level:\number#1\endcsname \!!plusone}
\def\tabl_ntb_spn_doifelse#1{\ifcase0\csname\??naturaltablespn\m_tabl_tbl_level:\number#1\endcsname\relax % could be inlined
\expandafter\secondoftwoarguments % unset
\else
\expandafter\firstoftwoarguments % a span
\fi}
-% keep for a while:
-%
-% \protected\def\tabl_ntb_set_txt_process#1#2#3#4#5#6% nasty: we restore the level
-% {\expandafter\def\csname\??naturaltabletxt\m_tabl_tbl_level:\number#1:\number#2\expandafter\endcsname\expandafter
-% {\expandafter\def\expandafter\m_tabl_tbl_level\expandafter{\m_tabl_tbl_level}\tabl_ntb_cell_process{#3}{#4}[#5]{#6}}}
-
\protected\def\tabl_ntb_set_txt_process#1#2#3#4#5#6%
- {\expandafter\def\csname\??naturaltabletxt\m_tabl_tbl_level:\number#1:\number#2\endcsname
+ {\defcsname\??naturaltabletxt\m_tabl_tbl_level:\number#1:\number#2\endcsname
{\tabl_ntb_cell_process{#3}{#4}[#5]{\tabl_ntb_next_level#6\tabl_ntb_prev_level}}}
\def\tabl_ntb_get_txt#1#2%
diff --git a/tex/context/base/mkiv/tabl-tbl.mkxl b/tex/context/base/mkiv/tabl-tbl.mkxl
index e9d45e0e8..1149a38d7 100644
--- a/tex/context/base/mkiv/tabl-tbl.mkxl
+++ b/tex/context/base/mkiv/tabl-tbl.mkxl
@@ -802,7 +802,7 @@
\global\c_tabl_tabulate_colorspan\zerocount
\global\setfalse\c_tabl_auto_align_mode
\global\advance\c_tabl_tabulate_columns\plusone
- \expandafter\let\csname\??tabulatesetup\the\c_tabl_tabulate_columns\endcsname\donothing % here ?
+ \letcsname\??tabulatesetup\the\c_tabl_tabulate_columns\endcsname\donothing % here ?
\edef\currenttabulationtrulespec{#1}%
\ifempty\currenttabulationtrulespec
\global\d_tabl_tabulate_vrulethickness\zeropoint
@@ -1057,10 +1057,10 @@
\fi}
\appendtoks
- \enforced\expandafter\edef\csname\e!start \currenttabulation\endcsname{\tabl_start_defined[\currenttabulation]}%
- \enforced\expandafter\let \csname\e!stop \currenttabulation\endcsname\relax
- \enforced\expandafter\let \csname\??tabulatehead\currenttabulation\endcsname\empty
- \enforced\expandafter\let \csname\??tabulatefoot\currenttabulation\endcsname\empty
+ \enforced\edefcsname\e!start \currenttabulation\endcsname{\tabl_start_defined[\currenttabulation]}%
+ \enforced\letcsname \e!stop \currenttabulation\endcsname\relax
+ \enforced\letcsname \??tabulatehead\currenttabulation\endcsname\empty
+ \enforced\letcsname \??tabulatefoot\currenttabulation\endcsname\empty
\to \everydefinetabulation
\let\tabulateparameter\tabulationparameter % will stay for a while
@@ -1478,7 +1478,7 @@
{\begincsname\??tabulatevrule\the\c_tabl_tabulate_column\endcsname}
\def\tabl_tabulate_column_vruled_nop
- {\expandafter\glet\csname\??tabulatevrule\the\c_tabl_tabulate_column\endcsname\tabl_tabulate_column_vruled_preset
+ {\global\letcsname\??tabulatevrule\the\c_tabl_tabulate_column\endcsname\tabl_tabulate_column_vruled_preset
\tabl_tabulate_column_normal}
\def\tabl_tabulate_column_vruled_step#1%
@@ -1487,7 +1487,7 @@
{\xdef\m_tabl_tabulate_vrule_color_local{#1}}}
\def\tabl_tabulate_column_vruled_yes#1#2[#3]%
- {\expandafter\gdef\csname\??tabulatevrule\the\c_tabl_tabulate_column\endcsname
+ {\global\defcsname\??tabulatevrule\the\c_tabl_tabulate_column\endcsname
{\tabl_tabulate_column_vruled_preset
\rawprocesscommalist[#3]\tabl_tabulate_column_vruled_step}%
\tabl_tabulate_column_normal#1#2}
@@ -1502,21 +1502,12 @@
\global\c_tabl_tabulate_max_vrulecolumn\zerocount}
\def\tabl_tabulate_vrule_reset_step % undefined or relax
- {\expandafter\glet\csname\??tabulatevrule\the\fastloopindex\endcsname\undefined}
+ {\global\letcsname\??tabulatevrule\the\fastloopindex\endcsname\undefined}
\appendtoks
\tabl_tabulate_vrule_reset
\to \t_tabl_tabulate_every_after_row
-% sometimes more efficient:
-%
-% \def\tabl_tabulate_column_vruled_yes#1#2[#3]%
-% {\rawprocesscommalist[#3]\tabl_tabulate_column_vruled_step
-% \expandafter\xdef\csname\??tabulatevrule\the\c_tabl_tabulate_column\endcsname
-% {\global\d_tabl_tabulate_vrulethickness_local\the\d_tabl_tabulate_vrulethickness_default
-% \noexpand\xdef\noexpand\m_tabl_tabulate_vrule_color_local{\m_tabl_tabulate_vrule_color_local}}%
-% \tabl_tabulate_column_normal#1#2}
-
\def\tabl_tabulate_column_vruled_normal
{\vrule\s!width\d_tabl_tabulate_vrulethickness\relax}
@@ -1672,7 +1663,7 @@
\ifnum\c_tabl_tabulate_column>\c_tabl_tabulate_max_colorcolumn
\global\c_tabl_tabulate_max_colorcolumn\c_tabl_tabulate_column
\fi
- \expandafter\xdef\csname\??tabulatecolor\the\c_tabl_tabulate_column\endcsname{#1}%
+ \global\edefcsname\??tabulatecolor\the\c_tabl_tabulate_column\endcsname{#1}%
\hpack \thealignbackgroundcolorattr{#1}{}% pack ?
\endgroup}
@@ -1703,7 +1694,7 @@
{\dofastloopcs\c_tabl_tabulate_max_colorcolumn\tabl_tabulate_color_reset_step}
\def\tabl_tabulate_color_reset_step % undefined or empty?
- {\expandafter\glet\csname\??tabulatecolor\number\fastloopindex\endcsname\undefined}
+ {\global\letcsname\??tabulatecolor\number\fastloopindex\endcsname\undefined}
\appendtoks
\tabl_tabulate_color_reset
diff --git a/tex/context/base/mkiv/type-ini.mklx b/tex/context/base/mkiv/type-ini.mklx
index f6dd7780d..97035f5cb 100644
--- a/tex/context/base/mkiv/type-ini.mklx
+++ b/tex/context/base/mkiv/type-ini.mklx
@@ -196,14 +196,14 @@
\permanent\protected\def\font_typescripts_start_store#definitions\stoptypescript
{\global\advance\c_font_typescripts_n_of_preloaded\plusone
- \expandafter\normalgdef\csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname
+ \global\defcsname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname
{\starttypescript#definitions\stoptypescript}%
\gtoksapp\t_font_typescripts\expandafter
{\csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname}}
\permanent\protected\def\font_typescripts_collection_start_store#definitions\stoptypescriptcollection
{\global\advance\c_font_typescripts_n_of_preloaded\plusone
- \expandafter\normalgdef\csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname
+ \global\defcsname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname
{\starttypescriptcollection#definitions\stoptypescriptcollection}%
\gtoksapp\t_font_typescripts\expandafter
{\csname\??typescriptcache\the\c_font_typescripts_n_of_preloaded\endcsname}}
@@ -238,7 +238,7 @@
\enforced\let\starttypescriptcollection\font_typescripts_collection_start_store
\font_typescript_process_typescript_file
\endgroup
- \expandafter\let\csname\??typescriptfiles\currenttypefile\endcsname\t_font_typescripts}
+ \letcsname\??typescriptfiles\currenttypefile\endcsname\t_font_typescripts}
\def\font_typescript_process_typescript_file
{\clf_doprocesstypescriptfile{\currenttypefile}}
@@ -247,7 +247,7 @@
{\ifcsname\??typescriptonce#one:#two:#three\endcsname
\writestatus\m!fonts{once (#one) (#two) (#three)}%
\else
- \expandafter\let\csname\??typescriptonce#one:#two:#three\endcsname\relax
+ \letcsname\??typescriptonce#one:#two:#three\endcsname\relax
\font_typescripts_use[#one][#two][#three]%
\fi}
@@ -690,9 +690,9 @@
% \fi}
\def\v_font_string_d % default fontstyle (expands to \s!Serif in font-ini)
- {\expandafter\ifx\csname\??typescriptdefaultstyles\fontclass\endcsname\s!rm \s!Serif \else
- \expandafter\ifx\csname\??typescriptdefaultstyles\fontclass\endcsname\s!ss \s!Sans \else
- \expandafter\ifx\csname\??typescriptdefaultstyles\fontclass\endcsname\s!tt \s!Mono \else
+ {\expandafter\ifx\csname\??typescriptdefaultstyles\fontclass\endcsname\s!rm \s!Serif \else % no \orelse !
+ \expandafter\ifx\csname\??typescriptdefaultstyles\fontclass\endcsname\s!ss \s!Sans \else % no \orelse !
+ \expandafter\ifx\csname\??typescriptdefaultstyles\fontclass\endcsname\s!tt \s!Mono \else % no \orelse !
\s!Serif \fi\fi\fi}
\protected\def\font_helpers_set_fontstyle_of_fontclass
diff --git a/tex/context/base/mkiv/typo-dir.mkxl b/tex/context/base/mkiv/typo-dir.mkxl
index e9c7e47d6..ac7924603 100644
--- a/tex/context/base/mkiv/typo-dir.mkxl
+++ b/tex/context/base/mkiv/typo-dir.mkxl
@@ -62,7 +62,7 @@
method {\directionsparameter\c!method}%
fences {\directionsparameter\c!fences}%
}%
- \expandafter\glet\csname\??directionsbidimode\currentbidistamp\endcsname\currentbidimode}
+ \global\letcsname\??directionsbidimode\currentbidistamp\endcsname\currentbidimode}
\appendtoks
\edef\p_bidi{\directionsparameter\c!bidi}%
diff --git a/tex/context/interface/mkii/keys-en.xml b/tex/context/interface/mkii/keys-en.xml
index e39ab834f..54c02665a 100644
--- a/tex/context/interface/mkii/keys-en.xml
+++ b/tex/context/interface/mkii/keys-en.xml
@@ -286,6 +286,7 @@
<cd:variable name='intermezzo' value='intermezzo'/>
<cd:variable name='intext' value='intext'/>
<cd:variable name='intro' value='intro'/>
+ <cd:variable name='invertedshort' value='invertedshort'/>
<cd:variable name='italic' value='italic'/>
<cd:variable name='italicbold' value='italicbold'/>
<cd:variable name='item' value='item'/>
@@ -389,6 +390,7 @@
<cd:variable name='nonumber' value='nonumber'/>
<cd:variable name='norepeat' value='norepeat'/>
<cd:variable name='normal' value='normal'/>
+ <cd:variable name='normalshort' value='normalshort'/>
<cd:variable name='nospacing' value='nospacing'/>
<cd:variable name='nostopper' value='nostopper'/>
<cd:variable name='not' value='not'/>
@@ -456,6 +458,7 @@
<cd:variable name='rectangular' value='rectangular'/>
<cd:variable name='reference' value='reference'/>
<cd:variable name='referral' value='referral'/>
+ <cd:variable name='region' value='region'/>
<cd:variable name='register' value='register'/>
<cd:variable name='regular' value='regular'/>
<cd:variable name='relative' value='relative'/>
@@ -1817,7 +1820,7 @@
<cd:command name='resetpath' value='resetpath'/>
<cd:command name='resetperiodkerning' value='resetperiodkerning'/>
<cd:command name='resetsystemmode' value='resetsystemmode'/>
- <cd:command name='resettext' value='resettextcontent'/>
+ <cd:command name='resettextcontent' value='resettextcontent'/>
<cd:command name='resetvisualizers' value='resetvisualizers'/>
<cd:command name='restoreglobalbodyfont' value='restoreglobalbodyfont'/>
<cd:command name='retestfeature' value='retestfeature'/>
diff --git a/tex/context/interface/mkii/keys-fr.xml b/tex/context/interface/mkii/keys-fr.xml
index 0696e6c7c..74f8d4c99 100644
--- a/tex/context/interface/mkii/keys-fr.xml
+++ b/tex/context/interface/mkii/keys-fr.xml
@@ -286,6 +286,7 @@
<cd:variable name='intermezzo' value='interlude'/>
<cd:variable name='intext' value='danstexte'/>
<cd:variable name='intro' value='intro'/>
+ <cd:variable name='invertedshort' value='invertedshort'/>
<cd:variable name='italic' value='italique'/>
<cd:variable name='italicbold' value='italiquegras'/>
<cd:variable name='item' value='élément'/>
@@ -389,6 +390,7 @@
<cd:variable name='nonumber' value='sansnumero'/>
<cd:variable name='norepeat' value='sansrepetition'/>
<cd:variable name='normal' value='normal'/>
+ <cd:variable name='normalshort' value='normalshort'/>
<cd:variable name='nospacing' value='sansespacement'/>
<cd:variable name='nostopper' value='sansstoppeur'/>
<cd:variable name='not' value='pas'/>
@@ -456,6 +458,7 @@
<cd:variable name='rectangular' value='rectangulaire'/>
<cd:variable name='reference' value='reference'/>
<cd:variable name='referral' value='redirection'/>
+ <cd:variable name='region' value='region'/>
<cd:variable name='register' value='registre'/>
<cd:variable name='regular' value='ordinaire'/>
<cd:variable name='relative' value='relatif'/>
@@ -1817,7 +1820,7 @@
<cd:command name='resetpath' value='razchemin'/>
<cd:command name='resetperiodkerning' value='razapprochepoint'/>
<cd:command name='resetsystemmode' value='razmodesysteme'/>
- <cd:command name='resettext' value='raztexte'/>
+ <cd:command name='resettextcontent' value='raztexte'/>
<cd:command name='resetvisualizers' value='razvisualisateurs'/>
<cd:command name='restoreglobalbodyfont' value='restaurerpolicedecorpsglobale'/>
<cd:command name='retestfeature' value='retesterfonctionnalite'/>
diff --git a/tex/context/modules/mkiv/m-tikz.mkiv b/tex/context/modules/mkiv/m-tikz.mkiv
index 99df42332..73124716b 100644
--- a/tex/context/modules/mkiv/m-tikz.mkiv
+++ b/tex/context/modules/mkiv/m-tikz.mkiv
@@ -1,13 +1,11 @@
%D A fixed variant if the t-tikz module distributed with tikz.
-\unprotect
-
- \ifcase\contextlmtxmode \else
+\ifdefined\pdflastxpos \else
+ \unprotect
\frozen\overloaded\protected\def\pdflastxpos{\numexpr\clf_lastxpos\relax}
\frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax}
- \fi
-
-\protect
+ \protect
+\fi
\ifcase\contextlmtxmode \else
\overloadmode\zerocount
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 43d59d1dc..ea779dc80 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 : 2020-11-04 09:28
+-- merge date : 2020-11-05 15:20
do -- begin closure to overcome local limits and interference