diff options
26 files changed, 1428 insertions, 1243 deletions
diff --git a/bibtex/bst/context/cont-ab.bst b/bibtex/bst/context/cont-ab.bst index c524ff8ee..e09da7ca5 100644 --- a/bibtex/bst/context/cont-ab.bst +++ b/bibtex/bst/context/cont-ab.bst @@ -618,6 +618,7 @@ FUNCTION {misc} format.t.title format.key "" "\city" address do.out + "" "\day" day do.out "" "\month" month do.out "" "\pubname" publisher do.out "" "\howpublished" howpublished do.out diff --git a/bibtex/bst/context/cont-au.bst b/bibtex/bst/context/cont-au.bst index 2eba98b0a..d0b87186c 100644 --- a/bibtex/bst/context/cont-au.bst +++ b/bibtex/bst/context/cont-au.bst @@ -618,6 +618,7 @@ FUNCTION {misc} format.t.title format.key "" "\city" address do.out + "" "\day" day do.out "" "\month" month do.out "" "\pubname" publisher do.out "" "\howpublished" howpublished do.out diff --git a/bibtex/bst/context/cont-no.bst b/bibtex/bst/context/cont-no.bst index dbeb8a45d..393d13db8 100644 --- a/bibtex/bst/context/cont-no.bst +++ b/bibtex/bst/context/cont-no.bst @@ -618,6 +618,7 @@ FUNCTION {misc} format.t.title format.key "" "\city" address do.out + "" "\day" day do.out "" "\month" month do.out "" "\pubname" publisher do.out "" "\howpublished" howpublished do.out diff --git a/bibtex/bst/context/cont-ti.bst b/bibtex/bst/context/cont-ti.bst index 734cbb4b6..34175a0ba 100644 --- a/bibtex/bst/context/cont-ti.bst +++ b/bibtex/bst/context/cont-ti.bst @@ -618,6 +618,7 @@ FUNCTION {misc} format.t.title format.key "" "\city" address do.out + "" "\day" day do.out "" "\month" month do.out "" "\pubname" publisher do.out "" "\howpublished" howpublished do.out diff --git a/context/data/scite/lexers/data/scite-context-data-context.lua b/context/data/scite/lexers/data/scite-context-data-context.lua index 4039a2e5d..f622f095d 100644 --- a/context/data/scite/lexers/data/scite-context-data-context.lua +++ b/context/data/scite/lexers/data/scite-context-data-context.lua @@ -1,4 +1,4 @@ return { ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "plussixteen", "plushundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "etexversion", "pdftexversion", "xetexversion", "xetexrevision", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "spaceasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vcentergroupcode", "mathchoicegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "vadjustgroupcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "charifcode", "catifcode", "numifcode", "dimifcode", "oddifcode", "vmodeifcode", "hmodeifcode", "mmodeifcode", "innerifcode", "voidifcode", "hboxifcode", "vboxifcode", "xifcode", "eofifcode", "trueifcode", "falseifcode", "caseifcode", "definedifcode", "csnameifcode", "fontcharifcode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathsupdisplay", "mathsupnormal", "mathsupcramped", "mathsubnormal", "mathsubcombined", "mathaxisheight", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifmodeelse", "doifnotmode", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "startmodule", "stopmodule", "usemodule", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordcode", "mathopcode", "mathbincode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctcode", "mathalphacode", "mathinnercode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathboxcode", "mathchoicecode", "mathaccentcode", "mathradicalcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "continueifinputfile" }, - ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "startcontextcode", "stopcontextcode", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "doifelsecommandhandler", "doifnotcommandhandler", "doifcommandhandler", "newmode", "setmode", "resetmode", "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode", "booleanmodevalue", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newlanguage", "newfamily", "newfam", "newhelp", "then", "donothing", "dontcomplain", "donetrue", "donefalse", "htdp", "unvoidbox", "vfilll", "mathbox", "mathlimop", "mathnolop", "mathnothing", "mathalpha", "currentcatcodetable", "defaultcatcodetable", "catcodetablename", "newcatcodetable", "startcatcodetable", "stopcatcodetable", "startextendcatcodetable", "stopextendcatcodetable", "pushcatcodetable", "popcatcodetable", "restorecatcodes", "setcatcodetable", "letcatcodecommand", "defcatcodecommand", "uedcatcodecommand", "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruledvcenter", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "scratchcounter", "globalscratchcounter", "scratchdimen", "globalscratchdimen", "scratchskip", "globalscratchskip", "scratchmuskip", "globalscratchmuskip", "scratchtoks", "globalscratchtoks", "scratchbox", "globalscratchbox", "availablehsize", "localhsize", "setlocalhsize", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchhsize", "scratchvsize", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchboxone", "scratchboxtwo", "scratchboxthree", "doif", "doifnot", "doifelse", "doifinset", "doifnotinset", "doifinsetelse", "doifnextcharelse", "doifnextoptionalelse", "doifnextbgroupelse", "doifnextparenthesiselse", "doiffastoptionalcheckelse", "doifundefinedelse", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifdimensionelse", "doifnumberelse", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifinstringelse", "doifassignmentelse", "tracingall", "tracingnone", "loggingall", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "empty", "null", "space", "quad", "enspace", "obeyspaces", "obeylines", "normalspace", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "wait", "writestatus", "define", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "measure", "getvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "glet", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protected", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "firstofoneunexpanded", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "newconstant", "setnewconstant", "newconditional", "settrue", "setfalse", "setconstant", "newmacro", "setnewmacro", "newfraction", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doiffirstcharelse", "startnointerference", "stopnointerference", "strut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "begstrut", "endstrut" }, + ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "startcontextcode", "stopcontextcode", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "doifelsecommandhandler", "doifnotcommandhandler", "doifcommandhandler", "newmode", "setmode", "resetmode", "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode", "booleanmodevalue", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newlanguage", "newfamily", "newfam", "newhelp", "then", "donothing", "dontcomplain", "donetrue", "donefalse", "htdp", "unvoidbox", "vfilll", "mathbox", "mathlimop", "mathnolop", "mathnothing", "mathalpha", "currentcatcodetable", "defaultcatcodetable", "catcodetablename", "newcatcodetable", "startcatcodetable", "stopcatcodetable", "startextendcatcodetable", "stopextendcatcodetable", "pushcatcodetable", "popcatcodetable", "restorecatcodes", "setcatcodetable", "letcatcodecommand", "defcatcodecommand", "uedcatcodecommand", "hglue", "vglue", "hfillneg", "vfillneg", "hfilllneg", "vfilllneg", "ruledhss", "ruledhfil", "ruledhfill", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruledvcenter", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "scratchcounter", "globalscratchcounter", "scratchdimen", "globalscratchdimen", "scratchskip", "globalscratchskip", "scratchmuskip", "globalscratchmuskip", "scratchtoks", "globalscratchtoks", "scratchbox", "globalscratchbox", "availablehsize", "localhsize", "setlocalhsize", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchhsize", "scratchvsize", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchboxone", "scratchboxtwo", "scratchboxthree", "doif", "doifnot", "doifelse", "doifinset", "doifnotinset", "doifinsetelse", "doifnextcharelse", "doifnextoptionalelse", "doifnextbgroupelse", "doifnextparenthesiselse", "doiffastoptionalcheckelse", "doifundefinedelse", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifdimensionelse", "doifnumberelse", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifinstringelse", "doifassignmentelse", "tracingall", "tracingnone", "loggingall", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "empty", "null", "space", "quad", "enspace", "obeyspaces", "obeylines", "normalspace", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "wait", "writestatus", "define", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "measure", "getvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "glet", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protected", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "firstofoneunexpanded", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "newconstant", "setnewconstant", "newconditional", "settrue", "setfalse", "setconstant", "newmacro", "setnewmacro", "newfraction", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doiffirstcharelse", "startnointerference", "stopnointerference", "strut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "begstrut", "endstrut" }, }
\ No newline at end of file diff --git a/context/data/scite/scite-context-data-context.properties b/context/data/scite/scite-context-data-context.properties index fc86aad44..ea3a4c8c7 100644 --- a/context/data/scite/scite-context-data-context.properties +++ b/context/data/scite/scite-context-data-context.properties @@ -65,11 +65,12 @@ recurselevel recursedepth dofastloopcs newconstant setnewconstant \ newconditional settrue setfalse setconstant newmacro \ setnewmacro newfraction dosingleempty dodoubleempty dotripleempty \ doquadrupleempty doquintupleempty dosixtupleempty doseventupleempty dosingleargument \ -dodoubleargument dotripleargument doquadrupleargument dosinglegroupempty dodoublegroupempty \ -dotriplegroupempty doquadruplegroupempty doquintuplegroupempty nopdfcompression maximumpdfcompression \ -normalpdfcompression modulonumber dividenumber getfirstcharacter doiffirstcharelse \ -startnointerference stopnointerference strut setstrut strutbox \ -strutht strutdp strutwd begstrut endstrut +dodoubleargument dotripleargument doquadrupleargument doquintupleargument dosixtupleargument \ +doseventupleargument dosinglegroupempty dodoublegroupempty dotriplegroupempty doquadruplegroupempty \ +doquintuplegroupempty nopdfcompression maximumpdfcompression normalpdfcompression modulonumber \ +dividenumber getfirstcharacter doiffirstcharelse startnointerference stopnointerference \ +strut setstrut strutbox strutht strutdp \ +strutwd begstrut endstrut keywordclass.context.constants=\ zerocount minusone minustwo plusone \ diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 75980ba4e..751918cc3 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.06.18 17:11} +\newcontextversion{2012.06.19 22:27} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 67e72221b..89ef24be6 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.06.18 17:11} +\newcontextversion{2012.06.19 22:27} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 90f70bdcd..88a6b4620 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 1c34d9d55..7aa0f8eb7 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index aaa7046ee..51916df1f 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.06.18 17:11} +\edef\contextversion{2012.06.19 22:27} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 472881e66..72a9d796a 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -23,7 +23,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.06.18 17:11} +\edef\contextversion{2012.06.19 22:27} %D For those who want to use this: diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index 4c8bc98e3..fa6708d0c 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -141,9 +141,9 @@ local parameters = allocate() local properties = allocate() local resources = allocate() local quaddata = allocate() -- maybe also spacedata -local markdata = allocate() local xheightdata = allocate() local csnames = allocate() -- namedata +local markdata = allocate() local italicsdata = allocate() local lastmathids = allocate() @@ -153,75 +153,113 @@ hashes.parameters = parameters hashes.properties = properties hashes.resources = resources hashes.quads = quaddata -hashes.marks = markdata +hashes.emwidths = quaddata hashes.xheights = xheightdata +hashes.exheights = xheightdata hashes.csnames = csnames +hashes.marks = markdata hashes.italics = italicsdata hashes.lastmathids = lastmathids -setmetatableindex(chardata, function(t,k) - local characters = fontdata[k].characters - t[k] = characters - return characters +setmetatableindex(chardata, function(t,k) + if k == true then + return chardata[currentfont()] + else + local characters = fontdata[k].characters + t[k] = characters + return characters + end end) -setmetatableindex(descriptions, function(t,k) - local descriptions = fontdata[k].descriptions - t[k] = descriptions - return descriptions +setmetatableindex(descriptions, function(t,k) + if k == true then + return descriptions[currentfont()] + else + local descriptions = fontdata[k].descriptions + t[k] = descriptions + return descriptions + end end) setmetatableindex(parameters, function(t,k) - local parameters = fontdata[k].parameters - t[k] = parameters - return parameters + if k == true then + return parameters[currentfont()] + else + local parameters = fontdata[k].parameters + t[k] = parameters + return parameters + end end) setmetatableindex(properties, function(t,k) - local properties = fontdata[k].properties - t[k] = properties - return properties + if k == true then + return properties[currentfont()] + else + local properties = fontdata[k].properties + t[k] = properties + return properties + end end) setmetatableindex(resources, function(t,k) - local shared = fontdata[k].shared - local rawdata = shared and shared.rawdata - local resources = rawdata and rawdata.resources - t[k] = resources or false -- better than resolving each time - return resources + if k == true then + return resources[currentfont()] + else + local shared = fontdata[k].shared + local rawdata = shared and shared.rawdata + local resources = rawdata and rawdata.resources + t[k] = resources or false -- better than resolving each time + return resources + end end) setmetatableindex(quaddata, function(t,k) - local parameters = parameters[k] - local quad = parameters and parameters.quad or 0 - t[k] = quad - return quad + if k == true then + return quaddata[currentfont()] + else + local parameters = parameters[k] + local quad = parameters and parameters.quad or 0 + t[k] = quad + return quad + end end) setmetatableindex(markdata, function(t,k) - local resources = fontdata[k].resources or { } - local marks = resources.marks or { } - t[k] = marks - return marks + if k == true then + return markdata[currentfont()] + else + local resources = fontdata[k].resources or { } + local marks = resources.marks or { } + t[k] = marks + return marks + end end) setmetatableindex(xheightdata, function(t,k) - local parameters = parameters[k] - local xheight = parameters and parameters.xheight or 0 - t[k] = xheight - return quad + if k == true then + return xheightdata[currentfont()] + else + local parameters = parameters[k] + local xheight = parameters and parameters.xheight or 0 + t[k] = xheight + return xheight + end end) setmetatableindex(italicsdata, function(t,k) -- is test ! - local properties = fontdata[k].properties - local hasitalics = properties and properties.hasitalics - if hasitalics then - hasitalics = chardata[k] -- convenient return + if k == true then + return italicsdata[currentfont()] else - hasitalics = false + local properties = fontdata[k].properties + local hasitalics = properties and properties.hasitalics + if hasitalics then + hasitalics = chardata[k] -- convenient return + else + hasitalics = false + end + t[k] = hasitalics + return hasitalics end - t[k] = hasitalics - return hasitalics end) -- this cannot be a feature initializer as there is no auto namespace diff --git a/tex/context/base/lxml-css.lua b/tex/context/base/lxml-css.lua index 112a5e75d..c5a85c2bd 100644 --- a/tex/context/base/lxml-css.lua +++ b/tex/context/base/lxml-css.lua @@ -24,22 +24,49 @@ local cmf = 1/dimenfactors.cm local mmf = 1/dimenfactors.mm local inf = 1/dimenfactors["in"] +local percentage, exheight, emwidth, pixels + +if tex then + + local exheights = fonts.hashes.exheights + local emwidths = fonts.hashes.emwidths + + percentage = function(s,pcf) return tonumber(s) * (pcf or tex.hsize) end + exheight = function(s,exf) return tonumber(s) * (exf or exheights[true]) end + emwidth = function(s,emf) return tonumber(s) * (emf or emwidths[true]) end + pixels = function(s,pxf) return tonumber(s) * (pxf or emwidths[true]/300) end + +else + + local function generic(s,unit) return tonumber(s) * unit end + + percentage = generic + exheight = generic + emwidth = generic + pixels = generic + +end + local validdimen = Cg(lpegpatterns.number,'a') * ( - Cb('a') * P("pt") / function(s) return tonumber(s) * bpf end - + Cb('a') * P("cm") / function(s) return tonumber(s) * cmf end - + Cb('a') * P("mm") / function(s) return tonumber(s) * mmf end - + Cb('a') * P("in") / function(s) return tonumber(s) * inf end - + Cb('a') * P("px") * Carg(1) / function(s,pxf) return tonumber(s) * pxf end - + Cb('a') * P("%") * Carg(2) / function(s,pcf) return tonumber(s) * pcf end - + Cb('a') * P("ex") * Carg(3) / function(s,exf) return tonumber(s) * exf end - + Cb('a') * P("em") * Carg(4) / function(s,emf) return tonumber(s) * emf end - + Cb('a') * Carg(1) / function(s,pxf) return tonumber(s) * pxf end + Cb('a') * P("pt") / function(s) return tonumber(s) * bpf end + + Cb('a') * P("cm") / function(s) return tonumber(s) * cmf end + + Cb('a') * P("mm") / function(s) return tonumber(s) * mmf end + + Cb('a') * P("in") / function(s) return tonumber(s) * inf end + + Cb('a') * P("px") * Carg(1) / pixels + + Cb('a') * P("%") * Carg(2) / percentage + + Cb('a') * P("ex") * Carg(3) / exheight + + Cb('a') * P("em") * Carg(4) / emwidth + + Cb('a') * Carg(1) / pixels ) local pattern = (validdimen * lpegpatterns.whitespace^0)^1 -- todo: default if "" +local function dimension(str,pixel,percent,exheight,emwidth) + return (lpegmatch(pattern,str,1,pixel,percent,exheight,emwidth)) +end + local function padding(str,pixel,percent,exheight,emwidth) local top, bottom, left, right = lpegmatch(pattern,str,1,pixel,percent,exheight,emwidth) if not bottom then @@ -52,7 +79,8 @@ local function padding(str,pixel,percent,exheight,emwidth) return top, bottom, left, right end -css.padding = padding +css.dimension = dimension +css.padding = padding -- local hsize = 655360*100 -- local exheight = 65536*4 diff --git a/tex/context/base/m-spreadsheet.mkiv b/tex/context/base/m-spreadsheet.mkiv index a4f567397..f2b042d09 100644 --- a/tex/context/base/m-spreadsheet.mkiv +++ b/tex/context/base/m-spreadsheet.mkiv @@ -88,8 +88,18 @@ \unexpanded\def\dodoifelsespreadsheetcell[#1]#2#3% {\ctxlua{moduledata.spreadsheets.doifelsecell("#1","#2","#3")}} -\def\TABLEsetspreadsheet#1{\ctxlua{moduledata.spreadsheets.set("",\number\tblrow+1,\number\tblcol,\!!bs#1\!!es)}} -\def\TABLEgetspreadsheet#1{\ctxlua{moduledata.spreadsheets.get("",\number\tblrow+1,\number\tblcol,\!!bs#1\!!es)}} +\ifdefined\tblrow + + \def\TABLEsetspreadsheet#1{\ctxlua{moduledata.spreadsheets.set("",\number\tblrow+1,\number\tblcol,\!!bs#1\!!es)}} + \def\TABLEgetspreadsheet#1{\ctxlua{moduledata.spreadsheets.get("",\number\tblrow+1,\number\tblcol,\!!bs#1\!!es)}} + +\else + + \def\TABLEsetspreadsheet#1{\ctxlua{moduledata.spreadsheets.set("",\number\c_tabl_ntb_row+1,\number\c_tabl_ntb_col,\!!bs#1\!!es)}} + \def\TABLEgetspreadsheet#1{\ctxlua{moduledata.spreadsheets.get("",\number\c_tabl_ntb_row+1,\number\c_tabl_ntb_col,\!!bs#1\!!es)}} + +\fi + \appendtoks \resetspreadsheet diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index 6fa7022c4..9cc2e943d 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -511,7 +511,7 @@ {\noexpand#1}% \??aa \expandafter\noexpand\csname setup#2\endcsname \expandafter\noexpand\csname setup_#2\endcsname % semi-public - \expandafter\noexpand\csname setupcurrent#2\endcsname % no \every (we use 'current' for rconsistency) + \expandafter\noexpand\csname setupcurrent#2\endcsname % no \every (we use 'current' for consistency) \expandafter\noexpand\csname everysetup#2\endcsname}} \unexpanded\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5% diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index 6c1880c90..fe4a34337 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -239,7 +239,7 @@ return { "newmacro", "setnewmacro", "newfraction", -- "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", - "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", + "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", -- "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", diff --git a/tex/context/base/node-inj.lua b/tex/context/base/node-inj.lua index 246aaade2..bcc7b08c5 100644 --- a/tex/context/base/node-inj.lua +++ b/tex/context/base/node-inj.lua @@ -352,16 +352,13 @@ function injections.handler(head,where,keep) -- new per 2010-10-06, width adapted per 2010-02-03 -- we used to negate the width of marks because in tfm -- that makes sense but we no longer do that so as a - -- consequence the sign of p.width was changed (we need - -- to keep an eye on it as we don't have that many fonts - -- that enter this branch .. I'm still not sure if this - -- one is right + -- consequence the sign of p.width was changed local k = wx[p] if k then - n.xoffset = p.xoffset + p.width + d[1] - k[2] + -- brill roman: A\char"0300 (but ugly anyway) + n.xoffset = p.xoffset - p.width + d[1] - k[2] -- was + p.width else - -- n.xoffset = p.xoffset + p.width + d[1] - -- lucida U\char"032F (default+mark) + -- lucida: U\char"032F (default+mark) n.xoffset = p.xoffset - p.width + d[1] -- 01-05-2011 end else diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index 72ee80d4f..66d55a57a 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -527,8 +527,6 @@ {\removeunwantedspaces \egroup} -\newdimen\d_spac_prevdepth - \def\spac_lines_start_correction_yes[#1]% {\edef\m_spac_lines_around{#1}% \spac_lines_action_around diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 6ee3c4f18..212cbcfd1 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex f1e84a241..2ff5c0720 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index 6d5ba34f7..87b23499b 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -946,7 +946,8 @@ return { { filename = "tabl-ntb", marktype = "mkiv", - status = "unknown", + status = "okay", + comment = "frozen functionaly so no drastic cleanup", }, { filename = "tabl-nte", diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index a29fbefee..8a791e900 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -208,6 +208,18 @@ \def\gobblefouroptionals [#1][#2][#3][#4]{} \def\gobblefiveoptionals [#1][#2][#3][#4][#5]{} +%D Reserved macros for tests: + +\let\donothing\empty + +\let\m_syst_string_one \empty +\let\m_syst_string_two \empty +\let\m_syst_string_three\empty +\let\m_syst_string_four \empty + +\let\m_syst_action_yes \empty +\let\m_syst_action_nop \empty + %D \macros %D {doifnextcharelse} %D @@ -235,8 +247,8 @@ \unexpanded\def\doifnextcharelse#1#2#3% #1 should not be {} ! {\let\charactertoken=#1% = needed here - \def\!!stringa{#2}% - \def\!!stringb{#3}% + \def\m_syst_action_yes{#2}% + \def\m_syst_action_nop{#3}% \futurelet\nexttoken\syst_helpers_inspect_next_character} \def\syst_helpers_inspect_next_character @@ -248,9 +260,9 @@ \def\syst_helpers_inspect_next_character_indeed {\ifx\nexttoken\charactertoken - \expandafter\!!stringa + \expandafter\m_syst_action_yes \else - \expandafter\!!stringb + \expandafter\m_syst_action_nop \fi} %D Because we will mostly use this macro for testing if the next @@ -274,14 +286,14 @@ \let\syst_helpers_next_optional_character_token=[ \unexpanded\def\doifnextoptionalelse#1#2% - {\def\syst_helpers_next_optional_command_yes{#1}% - \def\syst_helpers_next_optional_command_nop{#2}% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% \let\if_next_blank_space_token\iffalse \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} \unexpanded\def\doifnextoptionalcselse#1#2% \cs \cs (upto 10% faster) - {\let\syst_helpers_next_optional_command_yes#1% - \let\syst_helpers_next_optional_command_nop#2% + {\let\m_syst_action_yes#1% + \let\m_syst_action_nop#2% \let\if_next_blank_space_token\iffalse \futurelet\nexttoken\syst_helpers_inspect_next_optional_character} @@ -294,16 +306,16 @@ \def\syst_helpers_inspect_next_optional_character_indeed {\ifx\nexttoken\syst_helpers_next_optional_character_token - \expandafter\syst_helpers_next_optional_command_yes + \expandafter\m_syst_action_yes \else - \expandafter\syst_helpers_next_optional_command_nop + \expandafter\m_syst_action_nop \fi} \let\syst_helpers_next_bgroup_character_token\bgroup \unexpanded\def\doifnextbgroupelse#1#2% - {\def\syst_helpers_next_bgroup_command_yes{#1}% - \def\syst_helpers_next_bgroup_command_nop{#2}% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% \let\if_next_blank_space_token\iffalse \futurelet\nexttoken\syst_helpers_inspect_next_bgroup_character} @@ -316,16 +328,16 @@ \def\syst_helpers_inspect_next_bgroup_character_indeed {\ifx\nexttoken\syst_helpers_next_bgroup_character_token - \expandafter\syst_helpers_next_bgroup_command_yes + \expandafter\m_syst_action_yes \else - \expandafter\syst_helpers_next_bgroup_command_nop + \expandafter\m_syst_action_nop \fi} \let\syst_helpers_next_parenthesis_character_token( \unexpanded\def\doifnextparenthesiselse#1#2% - {\def\syst_helpers_next_parenthesis_command_yes{#1}% - \def\syst_helpers_next_parenthesis_command_nop{#2}% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% \let\if_next_blank_space_token\iffalse \futurelet\nexttoken\syst_helpers_inspect_next_parenthesis_character} @@ -338,28 +350,28 @@ \def\syst_helpers_inspect_next_parenthesis_character_indeed {\ifx\nexttoken\syst_helpers_next_parenthesis_character_token - \expandafter\syst_helpers_next_parenthesis_command_yes + \expandafter\m_syst_action_yes \else - \expandafter\syst_helpers_next_parenthesis_command_nop + \expandafter\m_syst_action_nop \fi} %D The next one is handy in predictable situations: \unexpanded\def\doiffastoptionalcheckelse#1#2% - {\def\syst_helpers_next_optional_command_yes{#1}% - \def\syst_helpers_next_optional_command_nop{#2}% + {\def\m_syst_action_yes{#1}% + \def\m_syst_action_nop{#2}% \futurelet\nexttoken\syst_helpers_do_if_fast_optional_check_else} \unexpanded\def\doiffastoptionalcheckcselse#1#2% \cs \cs - {\let\syst_helpers_next_optional_command_yes#1% - \let\syst_helpers_next_optional_command_nop#2% + {\let\m_syst_action_yes#1% + \let\m_syst_action_nop#2% \futurelet\nexttoken\syst_helpers_do_if_fast_optional_check_else} \def\syst_helpers_do_if_fast_optional_check_else {\ifx\nexttoken\syst_helpers_next_optional_character_token - \expandafter\syst_helpers_next_optional_command_yes + \expandafter\m_syst_action_yes \else - \expandafter\syst_helpers_next_optional_command_nop + \expandafter\m_syst_action_nop \fi} %D This macro uses some auxiliary macros. Although we were able @@ -571,27 +583,27 @@ %D \stoptyping \unexpanded\def\doif#1#2% - {\edef\!!stringa{#1}% - \edef\!!stringb{#2}% - \ifx\!!stringa\!!stringb + {\edef\m_syst_string_one{#1}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} \unexpanded\def\doifnot#1#2% - {\edef\!!stringa{#1}% - \edef\!!stringb{#2}% - \ifx\!!stringa\!!stringb + {\edef\m_syst_string_one{#1}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} \unexpanded\def\doifelse#1#2% - {\edef\!!stringa{#1}% - \edef\!!stringb{#2}% - \ifx\!!stringa\!!stringb + {\edef\m_syst_string_one{#1}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments @@ -611,24 +623,24 @@ %D This time, the string is not expanded. \unexpanded\def\doifemptyelse#1% - {\def\!!stringa{#1}% - \ifx\!!stringa\empty + {\def\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} \unexpanded\def\doifempty#1% - {\def\!!stringa{#1}% - \ifx\!!stringa\empty + {\def\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} \unexpanded\def\doifnotempty#1% - {\def\!!stringa{#1}% - \ifx\!!stringa\empty + {\def\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument \else \expandafter\firstofoneargument @@ -680,119 +692,119 @@ \def\syst_helpers_do_quit_if_item_in_set #1],\relax{\firstofoneargument} \def\syst_helpers_do_quit_if_item_not_in_set #1],\relax{\gobbleoneargument} -\def\syst_helpers_re_do_if_in_set_else{\expandafter\syst_helpers_do_check_if_item_in_set_else\!!stringb,],\relax} -\def\syst_helpers_re_do_if_in_set {\expandafter\syst_helpers_do_check_if_item_in_set \!!stringb,],\relax} -\def\syst_helpers_re_do_if_not_in_set {\expandafter\syst_helpers_do_check_if_item_not_in_set \!!stringb,],\relax} +\def\syst_helpers_re_do_if_in_set_else{\expandafter\syst_helpers_do_check_if_item_in_set_else\m_syst_string_two,],\relax} +\def\syst_helpers_re_do_if_in_set {\expandafter\syst_helpers_do_check_if_item_in_set \m_syst_string_two,],\relax} +\def\syst_helpers_re_do_if_not_in_set {\expandafter\syst_helpers_do_check_if_item_not_in_set \m_syst_string_two,],\relax} \unexpanded\def\doifinsetelse#1% make this two step too - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\thirdofthreearguments \else \expandafter\syst_helpers_do_if_in_set_else \fi} \def\syst_helpers_do_if_in_set_else#1% - {\edef\!!stringb{#1}% - \ifx\!!stringb\empty + {\edef\m_syst_string_two{#1}% + \ifx\m_syst_string_two\empty \expandafter\secondoftwoarguments \else \expandafter\syst_helpers_re_do_if_in_set_else \fi} \unexpanded\def\doifinset#1% - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\gobbletwoarguments \else \expandafter\syst_helpers_do_if_in_set \fi} \def\syst_helpers_do_if_in_set#1% - {\edef\!!stringb{#1}% - \ifx\!!stringb\empty + {\edef\m_syst_string_two{#1}% + \ifx\m_syst_string_two\empty \expandafter\gobbleoneargument \else \expandafter\syst_helpers_re_do_if_in_set \fi} \unexpanded\def\doifnotinset#1% - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\secondoftwoarguments \else \expandafter\syst_helpers_do_if_not_in_set \fi} \def\syst_helpers_do_if_not_in_set#1% - {\edef\!!stringb{#1}% - \ifx\!!stringb\empty + {\edef\m_syst_string_two{#1}% + \ifx\m_syst_string_two\empty \expandafter\firstofoneargument \else \expandafter\syst_helpers_re_do_if_not_in_set % ...]{true} \fi} \def\syst_helpers_do_check_if_item_in_set_else#1,#2% #2 eats up preceding space - {\edef\!!stringb{#1}% - \ifx\!!stringb\empty + {\edef\m_syst_string_two{#1}% + \ifx\m_syst_string_two\empty \expandafter\syst_helpers_do_check_if_item_in_set_else \else \expandafter\syst_helpers_do_do_check_if_item_in_set_else \fi#2} \def\syst_helpers_do_do_check_if_item_in_set_else - {\ifx\!!stringb\v_syst_helpers_right_optional_bracket + {\ifx\m_syst_string_two\v_syst_helpers_right_optional_bracket \expandafter\thirdofthreearguments \else \expandafter\syst_helpers_do_do_do_check_if_item_in_set_else \fi} \def\syst_helpers_do_do_do_check_if_item_in_set_else - {\ifx\!!stringa\!!stringb + {\ifx\m_syst_string_one\m_syst_string_two \expandafter\syst_helpers_do_quit_if_item_in_set_else \else \expandafter\syst_helpers_do_check_if_item_in_set_else \fi} \def\syst_helpers_do_check_if_item_in_set#1,#2% #2 eats up preceding space - {\edef\!!stringb{#1}% - \ifx\!!stringb\empty + {\edef\m_syst_string_two{#1}% + \ifx\m_syst_string_two\empty \expandafter\syst_helpers_do_check_if_item_in_set \else \expandafter\syst_helpers_do_do_check_if_item_in_set \fi#2} \def\syst_helpers_do_do_check_if_item_in_set - {\ifx\!!stringb\v_syst_helpers_right_optional_bracket + {\ifx\m_syst_string_two\v_syst_helpers_right_optional_bracket \expandafter\gobbletwoarguments \else \expandafter\syst_helpers_do_do_do_check_if_item_in_set \fi} \def\syst_helpers_do_do_do_check_if_item_in_set - {\ifx\!!stringa\!!stringb + {\ifx\m_syst_string_one\m_syst_string_two \expandafter\syst_helpers_do_quit_if_item_in_set \else \expandafter\syst_helpers_do_check_if_item_in_set \fi} \def\syst_helpers_do_check_if_item_not_in_set#1,#2% #2 eats up preceding space - {\edef\!!stringb{#1}% - \ifx\!!stringb\empty + {\edef\m_syst_string_two{#1}% + \ifx\m_syst_string_two\empty \expandafter\syst_helpers_do_check_if_item_not_in_set \else \expandafter\syst_helpers_do_do_check_if_item_not_in_set \fi#2} \def\syst_helpers_do_do_check_if_item_not_in_set - {\ifx\!!stringb\v_syst_helpers_right_optional_bracket + {\ifx\m_syst_string_two\v_syst_helpers_right_optional_bracket \expandafter\secondoftwoarguments \else \expandafter\syst_helpers_do_do_do_check_if_item_not_in_set \fi} \def\syst_helpers_do_do_do_check_if_item_not_in_set - {\ifx\!!stringa\!!stringb + {\ifx\m_syst_string_one\m_syst_string_two \expandafter\syst_helpers_do_quit_if_item_not_in_set \else \expandafter\syst_helpers_do_check_if_item_not_in_set @@ -964,13 +976,13 @@ %D One way of quitting a commalist halfway is: -\def\quitcommalist +\unexpanded\def\quitcommalist {\begingroup\let\syst_helpers_do_process_comma_item\syst_helpers_do_quit_comma_list} \def\syst_helpers_do_quit_comma_list#1]% {\endgroup} -\def\quitprevcommalist +\unexpanded\def\quitprevcommalist {\begingroup\let\syst_helpers_do_process_comma_item\syst_helpers_do_quit_prev_comma_list} \def\syst_helpers_do_quit_prev_comma_list#1]% @@ -1052,6 +1064,9 @@ {\def\currentcommalistcommand##1{\def\currentcommalistitem{##1}#2}% \normalexpanded{\processcommalist[#1]}\currentcommalistcommand} +\let\stopprocesscommalist \relax +\let\stopprocesscommacommand\relax + %D \macros %D {processaction, %D processfirstactioninset, @@ -1097,8 +1112,8 @@ % obsolete: \def\expandactions{\let\expandedaction\edef} \expandactions (see mkii) \unexpanded\def\syst_helpers_do_compare_process_action_a[#1=>#2][#3]% - {\edef\!!stringb{#1}% - \ifx\!!stringb\s!default + {\edef\m_syst_string_two{#1}% + \ifx\m_syst_string_two\s!default \let\commalistelement\empty #2% \fi} @@ -1106,19 +1121,19 @@ % met \quitcommalist tot meer dan 25\% sneller \unexpanded\def\syst_helpers_do_compare_process_action_b[#1=>#2][#3]% - {\edef\!!stringb{#1}% - \ifx\!!stringa\!!stringb + {\edef\m_syst_string_two{#1}% + \ifx\m_syst_string_one\m_syst_string_two \def\commalistelement{#3}% #2% \expandafter\quitcommalist - \else\ifx\!!stringb\s!unknown + \else\ifx\m_syst_string_two\s!unknown \def\commalistelement{#3}% beware of loops #2% \fi\fi} \unexpanded\def\processaction[#1]#2[% - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \let\syst_helpers_do_compare_process_action\syst_helpers_do_compare_process_action_a \else \let\syst_helpers_do_compare_process_action\syst_helpers_do_compare_process_action_b @@ -1127,23 +1142,23 @@ \processnextcommalist\relax\relax\syst_helpers_do_process_action[} \unexpanded\def\syst_helpers_do_compare_process_action_c[#1=>#2][#3]% - {\edef\!!stringa{#1}% - \edef\!!stringb{#3}% - \ifx\!!stringa\!!stringb + {\edef\m_syst_string_one{#1}% + \edef\m_syst_string_two{#3}% + \ifx\m_syst_string_one\m_syst_string_two \def\commalistelement{#3}% #2% \expandafter\quitprevcommalist \else - \edef\!!stringa{#1}% - \ifx\!!stringa\s!unknown + \edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\s!unknown \def\commalistelement{#3}% #2% \fi \fi} \unexpanded\def\processfirstactioninset[#1]% - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\processaction \else \expandafter\syst_helpers_process_first_action_in_set_indeed @@ -1157,15 +1172,15 @@ \normalexpanded{\processcommalist[#1]}\syst_helpers_do_process_action} \unexpanded\def\syst_helpers_do_compare_process_action_d[#1=>#2][#3]% - {\edef\!!stringa{#1}% - \edef\!!stringb{#3}% - \ifx\!!stringa\!!stringb + {\edef\m_syst_string_one{#1}% + \edef\m_syst_string_two{#3}% + \ifx\m_syst_string_one\m_syst_string_two \def\commalistelement{#3}% #2% \expandafter\quitcommalist \else - \edef\!!stringa{#1}% - \ifx\!!stringa\s!unknown + \edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\s!unknown \def\commalistelement{#3}% #2% \fi @@ -1175,8 +1190,8 @@ {\csname\s!do\the\processlevel\endcsname} \unexpanded\def\processallactionsinset[#1]% - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\processaction \else \expandafter\syst_helpers_process_all_actions_in_set_indeed @@ -1231,46 +1246,48 @@ %D \doifinsetelse {substring} {string} {then ...} {else ...} %D \stoptyping +\let\m_syst_sub_string\empty + \unexpanded\def\doifinstringelse#1% - {\edef\@@@instring{#1}% expand #1 here - \ifx\@@@instring\empty + {\edef\m_syst_sub_string{#1}% expand #1 here + \ifx\m_syst_sub_string\empty \expandafter\thirdofthreearguments \else \expandafter\syst_helpers_do_if_in_string_else_indeed \fi} \unexpanded\def\syst_helpers_do_if_in_string_else_indeed#1% - {\syst_helpers_do_if_in_string_else\@@@instring{#1}% + {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} \unexpanded\def\doifinstring#1%% - {\edef\@@@instring{#1}% expand #1 here - \ifx\@@@instring\empty + {\edef\m_syst_sub_string{#1}% expand #1 here + \ifx\m_syst_sub_string\empty \expandafter\gobbletwoarguments \else \expandafter\syst_helpers_do_if_in_string_indeed \fi} \unexpanded\def\syst_helpers_do_if_in_string_indeed#1% - {\syst_helpers_do_if_in_string_else\@@@instring{#1}% + {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} \unexpanded\def\doifnotinstring#1%% - {\edef\@@@instring{#1}% expand #1 here - \ifx\@@@instring\empty + {\edef\m_syst_sub_string{#1}% expand #1 here + \ifx\m_syst_sub_string\empty \expandafter\gobbletwoarguments \else \expandafter\syst_helpers_do_if_not_in_string_indeed \fi} \unexpanded\def\syst_helpers_do_if_not_in_string_indeed#1% - {\syst_helpers_do_if_in_string_else\@@@instring{#1}% + {\syst_helpers_do_if_in_string_else\m_syst_sub_string{#1}% \expandafter\gobbleoneargument \else \expandafter\firstofoneargument @@ -1280,8 +1297,8 @@ \unexpanded\def\syst_helpers_do_if_in_string_else#1#2% ##2 can be {abc} {\expandafter\def\expandafter\syst_helpers_do_do_if_in_string_else - \expandafter##\expandafter1#1##2##3\war{\unless\if##2@}% expand #1 here - \expandafter\syst_helpers_do_do_if_in_string_else\normalexpanded{#2#1}@@\war} % expand #2 here + \expandafter##\expandafter1#1##2##3\m_end_of_string{\unless\if##2@}% expand #1 here + \expandafter\syst_helpers_do_do_if_in_string_else\normalexpanded{#2#1}@@\m_end_of_string} % expand #2 here %D The next alternative proved to be upto twice as fast on %D tasks like checking reserved words in pretty verbatim @@ -1297,13 +1314,12 @@ %D expansion. \unexpanded\def\syst_helpers_do_if_in_csname_else#1#2% - {\def\syst_helpers_do_do_if_in_csname_else##1#1##2##3\war + {\def\syst_helpers_do_do_if_in_csname_else##1#1##2##3\m_end_of_string {\unless\if##2@}% - \expandafter\syst_helpers_do_do_if_in_csname_else#2#1@@\war} + \expandafter\syst_helpers_do_do_if_in_csname_else#2#1@@\m_end_of_string} \unexpanded\def\doifincsnameelse#1#2% - {\edef\@@@instring{#1}% - \expandafter\syst_helpers_do_if_in_csname_else\expandafter{\@@@instring}{#2}% + {\normalexpanded{\syst_helpers_do_if_in_csname_else{#1}}{#2}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments @@ -1388,33 +1404,33 @@ % \def\rawdoifinsetelse#1#2{\doifinstringelse{,#1,}{,#2,}} % \def\rawdoifinset #1#2{\doifinstring {,#1,}{,#2,}} -\def\@@rawempty{,,} +\def\m_syst_two_commas{,,} \unexpanded\def\rawdoifinsetelse#1% - {\edef\@@@instring{,#1,}% expand #1 here - \ifx\@@@instring\@@rawempty + {\edef\m_syst_sub_string{,#1,}% expand #1 here + \ifx\m_syst_sub_string\m_syst_two_commas \expandafter\thirdofthreearguments \else \expandafter\syst_helpers_raw_do_if_in_set_else \fi} \unexpanded\def\syst_helpers_raw_do_if_in_set_else#1% - {\syst_helpers_do_if_in_string_else\@@@instring{,#1,}% + {\syst_helpers_do_if_in_string_else\m_syst_sub_string{,#1,}% \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} \unexpanded\def\rawdoifinset#1% - {\edef\@@@instring{,#1,}% expand #1 here - \ifx\@@@instring\@@rawempty + {\edef\m_syst_sub_string{,#1,}% expand #1 here + \ifx\m_syst_sub_string\m_syst_two_commas \expandafter\gobbletwoarguments \else \expandafter\syst_helpers_raw_do_if_in_set \fi} \unexpanded\def\syst_helpers_raw_do_if_in_set#1%% - {\syst_helpers_do_if_in_string_else\@@@instring{,#1,}% + {\syst_helpers_do_if_in_string_else\m_syst_sub_string{,#1,}% \expandafter\firstofoneargument \else \expandafter\gobbleoneargument @@ -1423,25 +1439,25 @@ %D Some more raw material: \def\syst_helpers_do_raw_process_action[#1][#2]% - {\def\syst_helpers_do_do_raw_process_action##1,#1=>##2,##3\war + {\def\syst_helpers_do_do_raw_process_action##1,#1=>##2,##3\m_end_of_string {\if##3@\else \def\!!processaction{##2}% \fi}% - \syst_helpers_do_do_raw_process_action,#2,#1=>,@\war} + \syst_helpers_do_do_raw_process_action,#2,#1=>,@\m_end_of_string} \unexpanded\def\rawprocessaction[#1]#2[#3]% - {\edef\!!stringa{#1}% - \edef\!!stringb{undefined}% better \!!undefined - \let\!!processaction\!!stringb - \ifx\!!stringa\empty + {\edef\m_syst_string_one{#1}% + \edef\m_syst_string_two{undefined}% better \!!undefined + \let\!!processaction\m_syst_string_two + \ifx\m_syst_string_one\empty \expandafter\syst_helpers_do_raw_process_action\expandafter[\s!default][#3]% \else - \expandafter\syst_helpers_do_raw_process_action\expandafter[\!!stringa][#3]% - \ifx\!!processaction\!!stringb + \expandafter\syst_helpers_do_raw_process_action\expandafter[\m_syst_string_one][#3]% + \ifx\!!processaction\m_syst_string_two \expandafter\syst_helpers_do_raw_process_action\expandafter[\s!unknown][#3]% \fi \fi - \ifx\!!processaction\!!stringb + \ifx\!!processaction\m_syst_string_two \else \!!processaction \fi} @@ -1820,11 +1836,11 @@ \newif\ifparameters -\def\p!checkparameters#1=#2#3\war% +\def\p!checkparameters#1=#2#3\m_end_of_string% {\if#2@\parametersfalse\else\parameterstrue\fi} \def\checkparameters[#1]% - {\p!checkparameters#1=@@\war} + {\p!checkparameters#1=@@\m_end_of_string} %D \macros %D {getfromcommalist,getfromcommacommand, @@ -3328,13 +3344,13 @@ \let\nextrecurse\relax -\def\@@irecurse{@@ir@@} % ecurse} % stepper -\def\@@arecurse{@@ar@@} % ecurse} % action +\def\??recurseindex {1>>} % no \installcorenamespace available yet +\def\??recurseaction{2>>} % no \installcorenamespace available yet \unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 {\global\advance\outerrecurse \plusone - \global\expandafter\def\csname\@@arecurse\recursedepth\endcsname{#4}% - \global\expandafter\let\csname\@@irecurse\recursedepth\endcsname\recurselevel + \global\expandafter\def\csname\??recurseaction\recursedepth\endcsname{#4}% + \global\expandafter\let\csname\??recurseindex\recursedepth\endcsname\recurselevel \ifnum#3>0\relax \ifnum#2<#1\relax \let\nextrecurse\exitstepwiserecurse @@ -3362,7 +3378,7 @@ \fi\expandafter{\the\numexpr\recurselevel+#3\relax}{#2}{#3}} \unexpanded\def\expandrecursecontent - {\csname\@@arecurse\recursedepth\endcsname} + {\csname\??recurseaction\recursedepth\endcsname} \unexpanded\def\redostepwiserecurse {\expandrecursecontent\dodostepwiserecurse} @@ -3384,11 +3400,11 @@ {\nodostepwiserecurse\relax} \unexpanded\def\nodostepwiserecurse#1#2#3#4% - {\expandafter\let\expandafter\recurselevel\csname\@@irecurse\recursedepth\endcsname + {\expandafter\let\expandafter\recurselevel\csname\??recurseindex\recursedepth\endcsname \global\advance\outerrecurse \minusone} \unexpanded\def\nonostepwiserecurse#1#2#3% - {\expandafter\let\expandafter\recurselevel\csname\@@irecurse\recursedepth\endcsname + {\expandafter\let\expandafter\recurselevel\csname\??recurseindex\recursedepth\endcsname \global\advance\outerrecurse \minusone} \unexpanded\def\dorecurse#1% @@ -3429,16 +3445,16 @@ \unexpanded\def\xdorecurse#1#2% {\global\advance\outerrecurse \plusone - \expandafter\gdef\csname\@@arecurse\recursedepth\endcsname{#2}% - \global\expandafter\let\csname\@@irecurse\recursedepth\endcsname\recurselevel + \expandafter\gdef\csname\??recurseaction\recursedepth\endcsname{#2}% + \global\expandafter\let\csname\??recurseindex\recursedepth\endcsname\recurselevel \expandafter\dodorecurse\expandafter1\expandafter{\number#1}} \unexpanded\def\ydorecurse#1#2% {\global\advance\outerrecurse \plusone - \global\expandafter\let\csname\@@irecurse\recursedepth\endcsname\recurselevel + \global\expandafter\let\csname\??recurseindex\recursedepth\endcsname\recurselevel \let\recurselevel\!!plusone #2% - \expandafter\let\expandafter\recurselevel\csname\@@irecurse\recursedepth\endcsname + \expandafter\let\expandafter\recurselevel\csname\??recurseindex\recursedepth\endcsname \global\advance\outerrecurse \minusone} \unexpanded\def\dodorecurse#1#2% from to @@ -3462,7 +3478,7 @@ {\expandrecursecontent\dodorecurse} \unexpanded\def\nodorecurse#1#2#3% - {\expandafter\let\expandafter\recurselevel\csname\@@irecurse\recursedepth\endcsname + {\expandafter\let\expandafter\recurselevel\csname\??recurseindex\recursedepth\endcsname \global\advance\outerrecurse \minusone } %D \macros @@ -3487,8 +3503,8 @@ \unexpanded\def\doloop#1% {\global\advance\outerrecurse \plusone - \expandafter\gdef\csname\@@arecurse\recursedepth\endcsname{#1}% - \global\expandafter\let\csname\@@irecurse\recursedepth\endcsname\recurselevel + \expandafter\gdef\csname\??recurseaction\recursedepth\endcsname{#1}% + \global\expandafter\let\csname\??recurseindex\recursedepth\endcsname\recurselevel \let\endofloop\dodoloop \dodoloop1} % no \plusone else \recurselevel wrong @@ -3501,7 +3517,7 @@ \unexpanded\def\nodoloop#1% {\let\endofloop\dodoloop % new, permits nested \doloop's - \expandafter\let\expandafter\recurselevel\csname\@@irecurse\recursedepth\endcsname + \expandafter\let\expandafter\recurselevel\csname\??recurseindex\recursedepth\endcsname \global\advance\outerrecurse\minusone} \unexpanded\def\exitloop % \exitloop quits at end @@ -3549,28 +3565,28 @@ %D \stoptyping \def\expandrecursecontent - {\csname\@@arecurse\recursedepth\expandafter\expandafter\expandafter\endcsname + {\csname\??recurseaction\recursedepth\expandafter\expandafter\expandafter\endcsname \expandafter\expandafter\expandafter{\expandafter\recurselevel\expandafter}\expandafter{\recursedepth}} \unexpanded\def\xdorecurse#1#2% {\global\advance\outerrecurse \plusone - \global\expandafter\def\csname\@@arecurse\recursedepth\endcsname##1##2{#2}% - \global\expandafter\let\csname\@@irecurse\recursedepth\endcsname\recurselevel + \global\expandafter\def\csname\??recurseaction\recursedepth\endcsname##1##2{#2}% + \global\expandafter\let\csname\??recurseindex\recursedepth\endcsname\recurselevel \expandafter\dodorecurse\expandafter1\expandafter{\number#1}} \unexpanded\def\ydorecurse#1#2% {\global\advance\outerrecurse \plusone - \global\expandafter\let\csname\@@irecurse\recursedepth\endcsname\recurselevel + \global\expandafter\let\csname\??recurseindex\recursedepth\endcsname\recurselevel \let\recurselevel\!!plusone - \global\expandafter\def\csname\@@arecurse\recursedepth\endcsname##1##2{#2}% + \global\expandafter\def\csname\??recurseaction\recursedepth\endcsname##1##2{#2}% \expandrecursecontent - \expandafter\let\expandafter\recurselevel\csname\@@irecurse\recursedepth\endcsname + \expandafter\let\expandafter\recurselevel\csname\??recurseindex\recursedepth\endcsname \global\advance\outerrecurse \minusone} \unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 {\global\advance\outerrecurse \plusone - \global\expandafter\def\csname\@@arecurse\recursedepth\endcsname##1##2{#4}% - \global\expandafter\let\csname\@@irecurse\recursedepth\endcsname\recurselevel + \global\expandafter\def\csname\??recurseaction\recursedepth\endcsname##1##2{#4}% + \global\expandafter\let\csname\??recurseindex\recursedepth\endcsname\recurselevel \ifnum#3>0\relax \ifnum#2<#1\relax \let\nextrecurse\exitstepwiserecurse @@ -3591,8 +3607,8 @@ \unexpanded\def\doloop#1% {\global\advance\outerrecurse \plusone - \global\expandafter\def\csname\@@arecurse\recursedepth\endcsname##1##2{#1}% - \global\expandafter\let\csname\@@irecurse\recursedepth\endcsname\recurselevel + \global\expandafter\def\csname\??recurseaction\recursedepth\endcsname##1##2{#1}% + \global\expandafter\let\csname\??recurseindex\recursedepth\endcsname\recurselevel \let\endofloop\dodoloop \dodoloop1} % no \plusone else \recurselevel wrong @@ -3600,8 +3616,8 @@ \unexpanded\def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 {\global\advance\outerrecurse \plusone - \global\expandafter\def\csname\@@arecurse\recursedepth\endcsname##1##2{#4}% - \global\expandafter\let\csname\@@irecurse\recursedepth\endcsname\recurselevel + \global\expandafter\def\csname\??recurseaction\recursedepth\endcsname##1##2{#4}% + \global\expandafter\let\csname\??recurseindex\recursedepth\endcsname\recurselevel \csname @swr% \ifnum#3>\zerocount \ifnum#2<#1\else d\fi @@ -3618,8 +3634,8 @@ % % \def\dostepwiserecurse#1#2#3#4% can be made faster by postponing #4 % {\global\advance\outerrecurse \plusone -% \global\expandafter\def\csname\@@arecurse\recursedepth\endcsname##1##2{#4}% -% \global\expandafter\let\csname\@@irecurse\recursedepth\endcsname\recurselevel +% \global\expandafter\def\csname\??recurseaction\recursedepth\endcsname##1##2{#4}% +% \global\expandafter\let\csname\??recurseindex\recursedepth\endcsname\recurselevel % \normalexpanded % {\ifnum#3>\zerocount % \ifnum#2<#1 @@ -3646,7 +3662,7 @@ \let\fastloopcs\relax \unexpanded\def\dofastloopcs#1#2% - {\let\fastloopcs#2 + {\let\fastloopcs#2% \fastloopindex\plusone \fastloopfinal#1\relax \dodofastloopcs} @@ -3693,10 +3709,10 @@ \unexpanded\def\doloopoverlist#1#2% {\global\advance\outerrecurse\plusone - \expandafter\gdef\csname\@@arecurse\recursedepth\endcsname##1{\edef\recursestring{##1}#2}% - \expandafter\glet\csname\@@irecurse\recursedepth\endcsname\recursestring - \normalexpanded{\processcommalist[#1]{\expandafter\noexpand\csname\@@arecurse\recursedepth\endcsname}}% - \expandafter\let\expandafter\recursestring\csname\@@irecurse\recursedepth\endcsname + \expandafter\gdef\csname\??recurseaction\recursedepth\endcsname##1{\edef\recursestring{##1}#2}% + \expandafter\glet\csname\??recurseindex\recursedepth\endcsname\recursestring + \normalexpanded{\processcommalist[#1]{\expandafter\noexpand\csname\??recurseaction\recursedepth\endcsname}}% + \expandafter\let\expandafter\recursestring\csname\??recurseindex\recursedepth\endcsname \global\advance\outerrecurse\minusone} %D \macros @@ -3939,10 +3955,10 @@ %D Watch the one level expansion of the second argument. \def\doifmeaningelse#1#2% - {\edef\!!stringa{\meaning#1}% - \def \!!stringb{#2}% - \edef\!!stringb{\meaning\!!stringb}% - \ifx\!!stringa\!!stringb + {\edef\m_syst_string_one{\meaning#1}% + \def \m_syst_string_two{#2}% + \edef\m_syst_string_two{\meaning\m_syst_string_two}% + \ifx\m_syst_string_one\m_syst_string_two \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments @@ -3961,9 +3977,9 @@ %D \stoptyping \def\@@doifsamestringelse#1#2#3#4% - {\edef\!!stringa{\detokenize\expandafter{\normalexpanded{#3}}}% - \edef\!!stringb{\detokenize\expandafter{\normalexpanded{#4}}}% - \ifx\!!stringa\!!stringb\expandafter#1\else\expandafter#2\fi} + {\edef\m_syst_string_one{\detokenize\expandafter{\normalexpanded{#3}}}% + \edef\m_syst_string_two{\detokenize\expandafter{\normalexpanded{#4}}}% + \ifx\m_syst_string_one\m_syst_string_two\expandafter#1\else\expandafter#2\fi} \def\doifsamestringelse{\@@doifsamestringelse\firstoftwoarguments\secondoftwoarguments} \def\doifsamestring {\@@doifsamestringelse\firstofoneargument \gobbleoneargument } @@ -3996,9 +4012,9 @@ %D they differ. \def\ConvertToConstant#1#2#3% - {\edef\!!stringa{\expandafter\detokenize\expandafter{#2}}% - \edef\!!stringb{\expandafter\detokenize\expandafter{#3}}% - #1{\!!stringa}{\!!stringb}} + {\edef\m_syst_string_one{\expandafter\detokenize\expandafter{#2}}% + \edef\m_syst_string_two{\expandafter\detokenize\expandafter{#3}}% + #1{\m_syst_string_one}{\m_syst_string_two}} %D When the argument \type{#1} consists of commands, we had %D better use @@ -4547,9 +4563,9 @@ \fi} \def\doifstringinstringelse#1#2% - {\expandafter\def\expandafter\p!doifstringinstringelse\expandafter##\expandafter1#1##2##3\war + {\expandafter\def\expandafter\p!doifstringinstringelse\expandafter##\expandafter1#1##2##3\m_end_of_string {\pp!doifstringinstringelse##2}% - \expandafter\expandafter\expandafter\p!doifstringinstringelse\expandafter#2#1@@\war} + \expandafter\expandafter\expandafter\p!doifstringinstringelse\expandafter#2#1@@\m_end_of_string} %D \macros %D {appendtoks,prependtoks,appendtoksonce,prependtoksonce, @@ -4617,8 +4633,8 @@ \unexpanded\def\removetoks#1\from#2% {\def\doremovetoks##1#1##2\empty\empty\empty##3\\% - {\def\!!stringa{##3}% - \ifx\!!stringa\empty#2{##1}\else#2{##1##2}\fi}% + {\def\m_syst_string_one{##3}% + \ifx\m_syst_string_one\empty#2{##1}\else#2{##1##2}\fi}% \expandafter\doremovetoks\the#2\empty\empty\empty#1\empty\empty\empty\\} %D Also: @@ -4772,8 +4788,8 @@ %D Which in terms of \TEX\ looks like: \def\removesubstring#1\from#2\to#3% - {\splitstring#2\to\!!stringa\and\!!stringb - \dodoglobal#3{\!!stringa\!!stringb}} + {\splitstring#2\to\m_syst_string_one\and\m_syst_string_two + \dodoglobal#3{\m_syst_string_one\m_syst_string_two}} %D \macros %D {appendtocommalist,prependtocommalist, @@ -4848,9 +4864,9 @@ {\dodoglobal\edef#2{#1\ifx#2\empty\else,#2\fi}}} \unexpanded\def\robustdoifinsetelse#1#2% - {\edef\!!stringa{\detokenize\expandafter{\normalexpanded{#1}}}% - \edef\!!stringb{\detokenize\expandafter{\normalexpanded{#2}}}% - \rawdoifinsetelse\!!stringa\!!stringb} + {\edef\m_syst_string_one{\detokenize\expandafter{\normalexpanded{#1}}}% + \edef\m_syst_string_two{\detokenize\expandafter{\normalexpanded{#2}}}% + \rawdoifinsetelse\m_syst_string_one\m_syst_string_two} \unexpanded\def\robustaddtocommalist#1#2% {item} \cs {\robustdoifinsetelse{#1}#2\resetglobal @@ -4862,8 +4878,8 @@ \def\xsplitstring#1#2% \cs {str} {\def\dosplitstring##1,#2,##2,#2,##3\\% - {\edef\!!stringa{\bcleanedupcommalist##1\empty\empty\relax}% - \edef\!!stringb{\acleanedupcommalist##2,,\relax}}% + {\edef\m_syst_string_one{\bcleanedupcommalist##1\empty\empty\relax}% + \edef\m_syst_string_two{\acleanedupcommalist##2,,\relax}}% \expandafter\dosplitstring\expandafter,#1,,#2,,#2,\\} \def\bcleanedupcommalist#1#2#3\relax{\if#1,\else#1\fi\if#2,\else#2\fi#3} @@ -4874,10 +4890,10 @@ {\rawdoifinsetelse{#1}#2% {\normalexpanded{\noexpand\xsplitstring\noexpand#2{#1}}% \dodoglobal\edef#2% - {\ifx\!!stringa\empty - \!!stringb + {\ifx\m_syst_string_one\empty + \m_syst_string_two \else - \!!stringa\ifx\!!stringb\empty\else,\!!stringb\fi + \m_syst_string_one\ifx\m_syst_string_two\empty\else,\m_syst_string_two\fi \fi}} \resetglobal} @@ -4898,21 +4914,21 @@ %D \stoptyping \def\substituteincommalist#1#2#3% old, new, list (slooow) - {\edef\!!stringb{#1}% - \edef\!!stringd{#2}% - \let\!!stringa#3% + {\edef\m_syst_string_two{#1}% + \edef\m_syst_string_four{#2}% + \let\m_syst_string_one#3% \let#3\empty \def\dosubstituteincommalist##1% - {\edef\!!stringc{##1}% - \ifx\!!stringb\!!stringc - \ifx\!!stringd\empty\else - \edef#3{#3\ifx#3\empty\else,\fi\!!stringd}% + {\edef\m_syst_string_three{##1}% + \ifx\m_syst_string_two\m_syst_string_three + \ifx\m_syst_string_four\empty\else + \edef#3{#3\ifx#3\empty\else,\fi\m_syst_string_four}% \fi \def\docommand####1{\edef#3{#3,####1}}% \else \edef#3{#3\ifx#3\empty\else,\fi##1}% \fi}% - \expandafter\rawprocesscommacommand\expandafter[\!!stringa]\dosubstituteincommalist} + \expandafter\rawprocesscommacommand\expandafter[\m_syst_string_one]\dosubstituteincommalist} %D A not so useful macro: @@ -4924,8 +4940,8 @@ \fi} \def\dofrontstrip#1% - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty \else + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \else \expandafter\dodofrontstrip\expandafter[#1]#1% \fi} @@ -5167,80 +5183,83 @@ %D ones, can derive their meaning from the definitions. \def\doifvalue#1#2% - {\edef\!!stringa{\csname#1\endcsname}\edef\!!stringb{#2}% - \ifx\!!stringa\!!stringb + {\edef\m_syst_string_one{\csname#1\endcsname}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} \def\doifnotvalue#1#2% - {\edef\!!stringa{\csname#1\endcsname}\edef\!!stringb{#2}% - \ifx\!!stringa\!!stringb + {\edef\m_syst_string_one{\csname#1\endcsname}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} \def\doifelsevalue#1#2% - {\edef\!!stringa{\csname#1\endcsname}\edef\!!stringb{#2}% - \ifx\!!stringa\!!stringb + {\edef\m_syst_string_one{\csname#1\endcsname}% + \edef\m_syst_string_two{#2}% + \ifx\m_syst_string_one\m_syst_string_two \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} \def\doifnothing#1% - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} \def\doifsomething#1% - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} \def\doifelsenothing#1% - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments \fi} \def\doifsomethingelse#1% - {\edef\!!stringa{#1}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{#1}% + \ifx\m_syst_string_one\empty \expandafter\secondoftwoarguments \else \expandafter\firstoftwoarguments \fi} \def\doifvaluenothing#1% - {\edef\!!stringa{\csname#1\endcsname}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{\csname#1\endcsname}% + \ifx\m_syst_string_one\empty \expandafter\firstofoneargument \else \expandafter\gobbleoneargument \fi} \def\doifvaluesomething#1% - {\edef\!!stringa{\csname#1\endcsname}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{\csname#1\endcsname}% + \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} \def\doifelsevaluenothing#1% - {\edef\!!stringa{\csname#1\endcsname}% - \ifx\!!stringa\empty + {\edef\m_syst_string_one{\csname#1\endcsname}% + \ifx\m_syst_string_one\empty \expandafter\firstoftwoarguments \else \expandafter\secondoftwoarguments @@ -5425,8 +5444,8 @@ {\edef\!!strippedstring{\!!strippedstring##1}% \doifnotempty{##2}{\dostripcharacter##2\end}}% \let\!!strippedstring\empty - \edef\!!stringa{#2}% - \expandafter\dostripcharacter\!!stringa#1\end + \edef\m_syst_string_one{#2}% + \expandafter\dostripcharacter\m_syst_string_one#1\end \dodoglobal\let#3\!!strippedstring} \def\stripspaces\from#1\to#2% will become \unspacestring#1\from#2 @@ -5489,10 +5508,10 @@ %D Is this one still needed? -\def\p!doifsomespaceelse#1 #2#3\war{\if\noexpand#2@} +\def\p!doifsomespaceelse#1 #2#3\m_end_of_string{\if\noexpand#2@} -\def\doifsomespaceelse#1% % #2#3% - {\p!doifsomespaceelse#1 @ @\war % #3\else#2\fi} +\def\doifsomespaceelse#1% % #2#3% + {\p!doifsomespaceelse#1 @ @\m_end_of_string % #3\else#2\fi} \expandafter\secondoftwoarguments \else \expandafter\firstoftwoarguments @@ -5581,10 +5600,10 @@ \def\doprocessseparatedlist#1]#2[#3]#4% {\def\dodoprocessseparatedlist##1##2#3% - {\def\!!stringa{##2}% suggested by VZ + {\def\m_syst_string_one{##2}% suggested by VZ \if]##1% \let\dodoprocessseparatedlist\relax - \else\ifx\blankspace\!!stringa + \else\ifx\blankspace\m_syst_string_one #4{##1}% \else\if]##2% \let\dodoprocessseparatedlist\relax @@ -5824,12 +5843,12 @@ \def\counttoken#1\in#2\to#3% {\scratchcounter\zerocount - \def\!!stringa{#1}% - \def\!!stringb{\end}% + \def\m_syst_string_one{#1}% + \def\m_syst_string_two{\end}% \def\docounttoken##1% obeys {} - {\def\!!stringc{##1}% - \ifx\!!stringb\!!stringc \else - \ifx\!!stringa\!!stringc + {\def\m_syst_string_three{##1}% + \ifx\m_syst_string_two\m_syst_string_three \else + \ifx\m_syst_string_one\m_syst_string_three \advance\scratchcounter\plusone \fi \expandafter\docounttoken @@ -6159,24 +6178,24 @@ %D registers being empty. \def\doifsometokselse#1% - {\edef\!!stringa{\the#1}% one level expansion so quite ok - \ifx\!!stringa\empty + {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok + \ifx\m_syst_string_one\empty \expandafter\secondoftwoarguments \else \expandafter\firstoftwoarguments \fi} \def\doifsometoks#1% - {\edef\!!stringa{\the#1}% one level expansion so quite ok - \ifx\!!stringa\empty + {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok + \ifx\m_syst_string_one\empty \expandafter\gobbleoneargument \else \expandafter\firstofoneargument \fi} \def\doifemptytoks#1% - {\edef\!!stringa{\the#1}% one level expansion so quite ok - \ifx\!!stringa\empty + {\edef\m_syst_string_one{\the#1}% one level expansion so quite ok + \ifx\m_syst_string_one\empty \expandafter\firstofoneargument \else \expandafter\gobbleoneargument @@ -6191,9 +6210,9 @@ \def\syst_helpers_strict_inspect_next_character% no user macro ! {\ifx\nexttoken\charactertoken - \expandafter\!!stringa + \expandafter\m_syst_action_yes \else - \expandafter\!!stringb + \expandafter\m_syst_action_nop \fi} % better: push/pop @@ -6521,11 +6540,11 @@ % sometimes handy: \def\doifhasspaceelse#1% - {\edef\!!stringa{#1}% + {\edef\m_syst_string_one{#1}% \normalexpanded{\noexpand\dodoifhasspaceelse#1\space}\empty\relax} \def\dodoifhasspaceelse#1 #2#3\relax % \space\empty\relax - {\ifx\!!stringa\space + {\ifx\m_syst_string_one\space \expandafter\firstoftwoarguments \else\ifx#2\empty \doubleexpandafter\secondoftwoarguments @@ -6728,11 +6747,7 @@ \fi \csname#1\endcsname} -%D Very handy, more efficient than \type{{}}, and more readable -%D than \type {\empty}. -\let\donothing\empty - % The following macros are used in XML handling. \setvalue{@u@s@"}#1#2"{#2} \setvalue{@g@s@"}#1#2"{\scratchtoks{#2}} @@ -6841,7 +6856,7 @@ \def\compresscommalist[#1]% {\let\compressedlist\empty - \let\!!stringa\empty + \let\m_syst_string_one\empty \processcommalist[#1]\docompresslist} \def\compresscommacommand[#1]% @@ -6850,13 +6865,13 @@ \def\docompresslist#1% {\edef\commalistelement{#1}% \ifx\commalistelement\empty \else - \ifx\!!stringa\commalistelement \else + \ifx\m_syst_string_one\commalistelement \else \ifx\compressedlist\empty \def\compressedlist{#1}% \else \appended\def\compressedlist{,#1}% \fi - \let\!!stringa\commalistelement + \let\m_syst_string_one\commalistelement \fi \fi} diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv index 79569e62e..86b1baec9 100644 --- a/tex/context/base/tabl-ntb.mkiv +++ b/tex/context/base/tabl-ntb.mkiv @@ -11,16 +11,15 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D This is an unfinished, preliminary module. At least two -%D runs are needed to get the table fixed. Ugly code. +%D This module as a more modern variant in xtables but as we follow a bit +%D different approach with settings there, this mechanism will stay. In fact +%D each of them has its advantages. This module could be sped up a bit and made +%D more efficient by delegating some housekeeping to \LUA\ but it's not worth +%D the effort. The code could me made more readable but again, there is no +%D real purpose in it. If needed I can squeeze out a few more percentages +%D runtime. -% todo: TABLE TBL -> ntb -% todo: special parsetb for argless variant -% todo: protect \tbl... -% todo: tblnx also count -% todo: get rid of recurse -% todo: fast if -% todo: avoid halign (just do it manual) and thereby globals +\writestatus{loading}{ConTeXt Table Macros / Natural Tables} % bug: width 3cm is not honored and column becomes too wide % as given width is added to distributed width @@ -56,65 +55,14 @@ % \stopcelltable % \stoptext -% optie=rek beschrijven - -\writestatus{loading}{ConTeXt Table Macros / Natural Tables} - -%D As always, this is the nth version. Much time went in +%D As always, this is the n\high{th} version. Much time went in %D trying to speed up the many cell calculations, some %D optimizations were rejected in order not to complicate this -%D module too much (and in order to prevail extensibility). - -% shapebox fails here in mkii -% -% \setupcolors[state=start] -% \bTABLE -% \bTR [align=middle]\bTH Range\eTH{}\bTH Value\eTH{}\eTR -% \bTR \bTD \type{<} 12\eTD{}\bTD 3\eTD{}\eTR -% \bTR \bTD 12--16\eTD{}\bTD 2\eTD{}\eTR -% \bTR \bTD \type{>}16\eTD{}\bTD 1\eTD{}\eTR -% \eTABLE +%D module too much (and in order to prevail extensibility). In the +%D meantime we've sacrified some speed for readability. -% \starttext -% \placefigure[left]{}{} -% \startlinecorrection \dontleavehmode \bTABLE -% \bTR \bTD oeps \eTD \eTR -% \eTABLE \stoplinecorrection -% \placefigure[right]{}{} -% \startlinecorrection \dontleavehmode \bTABLE -% \bTR \bTD oeps \eTD \eTR -% \eTABLE \stoplinecorrection -% \stoptext - -%D To Do: -%D -%D \starttyping -%D break over pagina -%D kop herhalen -%D reset settings -%D -%D \setupTABLE [c|column|x] [nx|odd|even|first|last][a=b] -%D \setupTABLE [r|row |y] [nx|odd|even|first|last][a=b] -%D \setupTABLE [nx|odd|even|first|last][ny|odd|even|first|last][a=b] -%D \setupTABLE [nx|odd|even|first|last] [a=b] -%D \setupTABLE [a=b] -%D -%D \bTH \eTH -%D \stoptyping - -% the section setup does not work yet, data needs to be stored, -% i.e.each row should know if it's a head/body/foot, and there -% should be \setupTABLE[head]... and alike - \unprotect -%D A simple way to force equal line spacing is to say: -%D -%D \starttyping -%D \def\bTBLCELL{\begstrut} -%D \def\eTBLCELL{\endstrut} -%D \stoptyping -%D %D The next alternative also takes care of preceding and following %D white space. %D @@ -126,22 +74,25 @@ %D %D \typebuffer \getbuffer -\ifdefined\dotagTABLEcell \else \let\dotagTABLEcell \relax \fi -\ifdefined\dotagTABLEsignal \else \let\dotagTABLEsignal\relax \fi +\ifdefined\dotagTABLEcell \else \let\dotagTABLEcell \relax \fi % todo: namespace +\ifdefined\dotagTABLEsignal \else \let\dotagTABLEsignal\relax \fi % todo: namespace + +\let\tabl_tnb_next_level\relax -\def\bTBLCELL % why not \doinhibitblank +\unexpanded\def\tabl_tnb_cell_start {\inhibitblank \dotagTABLEcell - \dousestyleparameter\tbltblstyle - \everypar{\tbltblleft\delayedbegstrut}} + \tabl_tnb_next_level + \usenaturaltablelocalstyleandcolor\c!style\c!color + \everypar{\naturaltablelocalparameter\c!left\delayedbegstrut}} -\def\eTBLCELL +\unexpanded\def\tabl_tnb_cell_stop {\ifhmode \delayedendstrut - \tbltblright + \naturaltablelocalparameter\c!right \par % added 13/4/2006 \else - % not sure yet:\tbltblright + % not sure yet:\naturaltablelocalparameter\c!right \par \ifdim\prevdepth<\zeropoint % =-1000pt ? \vskip-\strutdp @@ -150,92 +101,189 @@ \fi \fi} -\newcount\currenttbl +\newcount\c_tabl_ntb_row +\newcount\c_tabl_ntb_col +\newcount\c_tabl_ntb_spn -\def\@@tbl{tbl} \def\tblcell{1} \def\tblnone{2} +\newcount\c_tabl_ntb_nx +\newcount\c_tabl_ntb_ny -\def\@@tblprefix{tbl:} \let\@@rawtblprefix\@@tblprefix +\setnewconstant\c_tabl_ntb_cell \plusone +\setnewconstant\c_tabl_ntb_none \plustwo -%D This should be done more efficient: soon +\newcount\c_tabl_ntb_current_row +\newcount\c_tabl_ntb_current_col +\newcount\c_tabl_ntb_current_row_one +\newcount\c_tabl_ntb_current_col_one +\newcount\c_tabl_ntb_current_row_two +\newcount\c_tabl_ntb_current_col_two +\newcount\c_tabl_ntb_current_row_three +\newcount\c_tabl_ntb_current_col_three +\newcount\c_tabl_ntb_current_row_four +\newcount\c_tabl_ntb_current_col_four -% \let as well as \expandafter\edef's +\newcount\c_tabl_maximum_row +\newcount\c_tabl_maximum_col +\newcount\c_tabl_maximum_row_span +\newcount\c_tabl_maximum_col_span -\newcounter\TBLlevel +\newtoks\t_tabl_ntb +\newtoks\t_tabl_ntb_row -\def\@@tblprefix{\@@tbl:\ifnum\TBLlevel>1 :\TBLlevel:\fi} +\newconstant\c_tabl_tbl_pass -% \def\tblsetprefix % not yet used, figure out when .. may interfere with setup -% {\edef\@@tblprefix{\@@tbl:\ifnum\TBLlevel>1 :\TBLlevel:\fi}} +\newtoks\t_tabl_ntb_head +\newtoks\t_tabl_ntb_next +\newtoks\t_tabl_ntb_body +\newtoks\t_tabl_ntb_foot -\def\settblnob#1{\expandafter\let\csname\@@tblprefix\number#1:b\endcsname\plusone} -\def\gettblnob#1{\ifcsname\@@tblprefix\number#1:b\endcsname\plusone\else\zerocount\fi} +\newcount\c_tabl_ntb_n_of_head_lines +\newcount\c_tabl_ntb_n_of_next_lines +\newcount\c_tabl_ntb_n_of_hdnx_lines -\def\settbltag#1#2{\expandafter\edef\csname\@@tblprefix\number#1:\number#2:s\endcsname} -\def\settblcol#1#2{\expandafter\edef\csname\@@tblprefix\number#1:\number#2:c\endcsname} -\def\settblrow#1#2{\expandafter\edef\csname\@@tblprefix\number#1:\number#2:r\endcsname} +\newdimen\d_tabl_ntb_height +\newdimen\d_tabl_ntb_width -\def\lettbltag#1#2{\expandafter\let\csname\@@tblprefix\number#1:\number#2:s\endcsname} -\def\lettblcol#1#2{\expandafter\let\csname\@@tblprefix\number#1:\number#2:c\endcsname} -\def\lettblrow#1#2{\expandafter\let\csname\@@tblprefix\number#1:\number#2:r\endcsname} +\newtoks\everyTABLEpass % public -\def\settblwd#1#2{\expandafter\xdef\csname\@@tblprefix\number#1:\number#2:wd\endcsname} % global ! -\def\settblht#1#2{\expandafter\xdef\csname\@@tblprefix\number#1:\number#2:ht\endcsname} % global ! -\def\lettblwd#1#2{\global\expandafter\let\csname\@@tblprefix\number#1:\number#2:wd\endcsname} % global ! -\def\lettblht#1#2{\global\expandafter\let\csname\@@tblprefix\number#1:\number#2:ht\endcsname} % global ! +\newcount\tablecellrows % public (needs checking) +\newcount\tablecellcolumns % public (needs checking) -\def\gettbltag#1#2{\csname\@@tblprefix\number#1:\number#2:s\endcsname} -\def\gettblcol#1#2{\csname\@@tblprefix\number#1:\number#2:c\endcsname} -\def\gettblrow#1#2{\csname\@@tblprefix\number#1:\number#2:r\endcsname} +\newbox\b_tabl_ntb_final -\def\gettblwd #1#2{\csname\@@tblprefix\number#1:\number#2:wd\endcsname} -\def\gettblht #1#2{\csname\@@tblprefix\number#1:\number#2:ht\endcsname} +%D We have already prepared the previous macros for nesting, +%D so we only have to pop in the right ones: -\def\settblwid#1{\expandafter\xdef\csname\@@tblprefix\number#1:w\endcsname} % {#2} global ! -\def\settblhei#1{\expandafter\xdef\csname\@@tblprefix\number#1:h\endcsname} % {#2} global ! -\def\settbldis#1{\expandafter\xdef\csname\@@tblprefix\number#1:d\endcsname} % {#2} global ! -\def\settblaut#1{\expandafter\xdef\csname\@@tblprefix\number#1:a\endcsname} % {#2} global ! +\newcount\c_tabl_level -\def\lettblwid#1{\global\expandafter\let\csname\@@tblprefix\number#1:w\endcsname} % {#2} global ! -\def\lettblhei#1{\global\expandafter\let\csname\@@tblprefix\number#1:h\endcsname} % {#2} global ! -\def\lettbldis#1{\global\expandafter\let\csname\@@tblprefix\number#1:d\endcsname} % {#2} global ! -\def\lettblaut#1{\global\expandafter\let\csname\@@tblprefix\number#1:a\endcsname} % {#2} global ! +\def\tabl_ntb_table_push + {\ifnum\m_tabl_tbl_level>\plusone + \tabl_ntb_parameters_reset + % we need a proper count push/pop + \xdef\m_tabl_ntb_saved_row{\the\c_tabl_ntb_row}\globalpushmacro\m_tabl_ntb_saved_row + \xdef\m_tabl_ntb_saved_col{\the\c_tabl_ntb_col}\globalpushmacro\m_tabl_ntb_saved_col + \else + \global\intabletrue + \fi} -\def\gettblwid#1{\ifcsname\@@tblprefix\number#1:w\endcsname\csname\@@tblprefix\number#1:w\endcsname\else\zeropoint\fi} -\def\gettblhei#1{\ifcsname\@@tblprefix\number#1:h\endcsname\csname\@@tblprefix\number#1:h\endcsname\else\zeropoint\fi} -\def\gettbldis#1{\ifcsname\@@tblprefix\number#1:d\endcsname\csname\@@tblprefix\number#1:d\endcsname\else\zeropoint\fi} -\def\gettblaut#1{\csname \@@tblprefix\number#1:a\endcsname} +\def\tabl_ntb_table_pop + {\ifnum\m_tabl_tbl_level>\plusone + \globalpopmacro\m_tabl_ntb_saved_row\global\c_tabl_ntb_row\m_tabl_ntb_saved_row + \globalpopmacro\m_tabl_ntb_saved_col\global\c_tabl_ntb_col\m_tabl_ntb_saved_col + \else + \global\intablefalse + \fi} -\def\doiftbltag #1#2{\ifcsname\@@tblprefix\number#1:\number#2:s\endcsname\@EA\firstofoneargument \else\@EA\gobbleoneargument \fi} -\def\doifnottbltag #1#2{\ifcsname\@@tblprefix\number#1:\number#2:s\endcsname\@EA\gobbleoneargument \else\@EA\firstofoneargument \fi} -\def\doifelsetbltag#1#2{\ifcsname\@@tblprefix\number#1:\number#2:s\endcsname\@EA\firstoftwoarguments\else\@EA\secondoftwoarguments\fi} -\def\doiftblrow #1#2{\ifcsname\@@tblprefix\number#1:\number#2:r\endcsname\@EA\firstofoneargument \else\@EA\gobbleoneargument \fi} -\def\doiftblcol #1#2{\ifcsname\@@tblprefix\number#1:\number#2:c\endcsname\@EA\firstofoneargument \else\@EA\gobbleoneargument \fi} -\def\doifnottblcol #1#2{\ifcsname\@@tblprefix\number#1:\number#2:c\endcsname\@EA\gobbleoneargument \else\@EA\firstofoneargument \fi} +\def\tabl_tnb_next_level + {\advance\c_tabl_level\plusone + \edef\m_tabl_tbl_level{\the\c_tabl_level}} + +\tabl_tnb_next_level % go to level 1 + +\installcorenamespace{naturaltable} % was tbl +\installcorenamespace{naturaltablelocal} % was tbltbl + +\installdirectcommandhandler \??naturaltable {naturaltable} % \??naturaltable +\installsimpleframedcommandhandler \??naturaltablelocal {naturaltablelocal} \??naturaltablelocal + +\installcorenamespace{naturaltablenob} +\installcorenamespace{naturaltabletag} +\installcorenamespace{naturaltablecol} +\installcorenamespace{naturaltablerow} +\installcorenamespace{naturaltablewd} +\installcorenamespace{naturaltableht} +\installcorenamespace{naturaltabledp} +\installcorenamespace{naturaltablewid} +\installcorenamespace{naturaltablehei} +\installcorenamespace{naturaltabledis} +\installcorenamespace{naturaltableaut} +\installcorenamespace{naturaltabletxt} +\installcorenamespace{naturaltablespn} +\installcorenamespace{naturaltableref} +\installcorenamespace{naturaltableset} +\installcorenamespace{naturaltablecell} + +\def\tabl_ntb_set_nob#1{\expandafter\let\csname\??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_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_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_let_wd#1#2{\global\expandafter\let\csname\??naturaltablewd\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global ! +\def\tabl_ntb_let_ht#1#2{\global\expandafter\let\csname\??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} +\def\tabl_ntb_get_row#1#2{\csname\??naturaltablerow\m_tabl_tbl_level:\number#1:\number#2\endcsname} + +\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_let_wid#1{\global\expandafter\let\csname\??naturaltablewid\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! +\def\tabl_ntb_let_hei#1{\global\expandafter\let\csname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! +\def\tabl_ntb_let_dis#1{\global\expandafter\let\csname\??naturaltabledis\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! +\def\tabl_ntb_let_aut#1{\global\expandafter\let\csname\??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\csname\??naturaltablewid\m_tabl_tbl_level:\number#1\endcsname\else\zeropoint\fi} +\def\tabl_ntb_get_hei#1{\ifcsname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname\csname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname\else\zeropoint\fi} +\def\tabl_ntb_get_dis#1{\ifcsname\??naturaltabledis\m_tabl_tbl_level:\number#1\endcsname\csname\??naturaltabledis\m_tabl_tbl_level:\number#1\endcsname\else\zeropoint\fi} +\def\tabl_ntb_get_aut#1{\csname \??naturaltableaut\m_tabl_tbl_level:\number#1\endcsname} + +\def\tabl_ntb_tag_pattern#1#2{\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2} +\def\tabl_ntb_row_pattern#1#2{\??naturaltablerow\m_tabl_tbl_level:\number#1:\number#2} +\def\tabl_ntb_col_pattern#1#2{\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2} + +\def\tabl_ntb_tag_doif #1#2{\ifcsname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname\expandafter\firstofoneargument \else\expandafter\gobbleoneargument \fi} +\def\tabl_ntb_tag_doifnot #1#2{\ifcsname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname\expandafter\gobbleoneargument \else\expandafter\firstofoneargument \fi} +\def\tabl_ntb_tag_doifelse#1#2{\ifcsname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname\expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi} +\def\tabl_ntb_row_doif #1#2{\ifcsname\??naturaltablerow\m_tabl_tbl_level:\number#1:\number#2\endcsname\expandafter\firstofoneargument \else\expandafter\gobbleoneargument \fi} +\def\tabl_ntb_col_doif #1#2{\ifcsname\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2\endcsname\expandafter\firstofoneargument \else\expandafter\gobbleoneargument \fi} +\def\tabl_ntb_col_doifnot #1#2{\ifcsname\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2\endcsname\expandafter\gobbleoneargument \else\expandafter\firstofoneargument \fi} + +% not used +% +% \def\tabl_ntb_tag_state#1#2{\ifcsname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname\zerocount\else\plusone\fi} +% \def\tabl_ntb_row_state#1#2{\ifcsname\??naturaltablerow\m_tabl_tbl_level:\number#1:\number#2\endcsname\zerocount\else\plusone\fi} +% \def\tabl_ntb_col_state#1#2{\ifcsname\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2\endcsname\zerocount\else\plusone\fi} -\def\tbltagstate#1#2{\ifcsname\@@tblprefix\number#1:\number#2:s\endcsname\zerocount\else\plusone\fi} -\def\tblrowstate#1#2{\ifcsname\@@tblprefix\number#1:\number#2:r\endcsname\zerocount\else\plusone\fi} -\def\tblcolstate#1#2{\ifcsname\@@tblprefix\number#1:\number#2:c\endcsname\zerocount\else\plusone\fi} +\def\tabl_ntb_set_spn #1{\expandafter\let\csname\??naturaltablespn\m_tabl_tbl_level:\number#1\endcsname \!!plusone} +\def\tabl_ntb_spn_doifelse#1{\doifelse {\csname\??naturaltablespn\m_tabl_tbl_level:\number#1\endcsname}\!!plusone} -\def\settblspn #1{\expandafter\let\csname\@@tblprefix\number#1:s\endcsname \!!plusone} -\def\doifelsetblspn#1{\doifelse {\csname\@@tblprefix\number#1:s\endcsname}\!!plusone} -% \def\doifelsetblspn#1{\@EA\ifx\csname\@@tblprefix\number#1:s\endcsname\plusone\@EA\firstoftwoarguments\else\@EA\secondoftwoarguments\fi} +\def\tabl_ntb_set_spn #1{\setvalue {\??naturaltablespn\m_tabl_tbl_level:\number#1}{1}} +\def\tabl_ntb_spn_doifelse#1{\doifelsevalue{\??naturaltablespn\m_tabl_tbl_level:\number#1}{1}} -\def\settblspn #1{\setvalue {\@@tblprefix\number#1:s}{1}} -\def\doifelsetblspn#1{\doifelsevalue{\@@tblprefix\number#1:s}{1}} +\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_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} -\long\def\settbltxt#1#2#3% - {\long\@EA\def\csname\@@tblprefix\number#1:\number#2:t\@EA\endcsname\@EA{\@EA\def\@EA\TBLlevel\@EA{\TBLlevel}#3}} +% keep for a while: +% +% \unexpanded\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}}} -\def\gettbltxt#1#2% - {\csname\@@tblprefix\number#1:\number#2:t\endcsname} +\unexpanded\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{\tabl_ntb_cell_process{#3}{#4}[#5]{#6}}} -\newtoks\tbltoks -\newtoks\tblrowtoks +\def\tabl_ntb_get_txt#1#2% + {\csname\??naturaltabletxt\m_tabl_tbl_level:\number#1:\number#2\endcsname} -\let\pushTBLparameters\relax -\let\popTBLparameters \relax +% to be changed: -\newif\ifsqueezeTBLspan \squeezeTBLspantrue % spans one column cell over multi column par cells +\newif\ifsqueezeTBLspan \squeezeTBLspantrue % spans one column cell over multi column par cells \newif\ifautosqueezeTBLspan \autosqueezeTBLspantrue % unless explicit widths are given \newif\ifautoTBLspread \autoTBLspreadfalse \newif\ifautoTBLhsize \autoTBLhsizetrue @@ -249,78 +297,116 @@ \newif\iftraceTABLE \traceTABLEfalse -\def\noftblheadlines{0} -\def\noftblnextlines{0} -\def\noftblhdnxlines{0} - -\long\def\handleTBLcell#1#2[#3]{} +% so far -\long\def\bTC#1\eTC{\bTD#1\eTD} -\long\def\bTX#1\eTX{\bTD#1\eTD} -\long\def\bTY#1\eTY{\bTR#1\eTR} +\unexpanded\def\tabl_ntb_cell_process#1#2[#3]{} -\let\getTABLEparameters\getparameters +\unexpanded\def\bTC#1\eTC{\bTD#1\eTD} \let\eTC\relax +\unexpanded\def\bTX#1\eTX{\bTD#1\eTD} \let\eTX\relax +\unexpanded\def\bTY#1\eTY{\bTR#1\eTR} \let\eTY\relax \unexpanded\def\setupTABLE - {\dotripleempty\dosetupTABLE} + {\dotripleempty\tabl_ntb_setup} + +\let\tabl_ntb_parameters_get\setupcurrentnaturaltablelocal -\def\dosetupTABLE[#1][#2][#3]% +\def\tabl_ntb_setup {\ifthirdargument - \processaction - [#1] - [ \v!row=>{\dosetupTABLExy[\c!y][#2][#3]},% - \v!column=>{\dosetupTABLExy[\c!x][#2][#3]},% - r=>{\dosetupTABLExy[\c!y][#2][#3]},% - c=>{\dosetupTABLExy[\c!x][#2][#3]},% - y=>{\dosetupTABLExy[\c!y][#2][#3]},% - x=>{\dosetupTABLExy[\c!x][#2][#3]},% - \v!start=>{\dosetupTABLExy[#1][#2][#3]},% - \v!header=>{\dosetupTABLExy[#1][#2][#3]},% - \s!unknown=>{\dosetupTABLEzz[#1][#2][#3]}]% + \expandafter\tabl_ntb_setup_three \else\ifsecondargument - \processaction - [#1] - [ \v!row=>{\dosetupTABLExy[\c!y][\v!each][#2]},% - \v!column=>{\dosetupTABLExy[\c!x][\v!each][#2]},% - r=>{\dosetupTABLExy[\c!y][\v!each][#2]},% - c=>{\dosetupTABLExy[\c!x][\v!each][#2]},% - y=>{\dosetupTABLExy[\c!y][\v!each][#2]},% - x=>{\dosetupTABLExy[\c!x][\v!each][#2]},% - \v!start=>{\dosetupTABLExy[#1][\v!each][#2]},% - \v!header=>{\dosetupTABLExy[#1][\v!each][#2]},% - \s!unknown=>{\dosetupTABLEzz[\c!x][#1][#2]}]% + \doubleexpandafter\tabl_ntb_setup_two \else - \getparameters[\@@tbl\@@tbl][#1]% + \doubleexpandafter\tabl_ntb_setup_one \fi\fi} -\def\dosetupTABLExy[#1][#2][#3]% - {\def\dodosetupTABLE##1{\setTABLEparameters[#1##1][#3]}% - \processcommalist[#2]\dodosetupTABLE} - -\def\dosetupTABLEzz[#1][#2][#3]% - {\def\dodosetupTABLE##1% - {\def\dododosetupTABLE####1{\setTABLEparameters[\c!x##1\c!y####1][#3]}% - \processcommalist[#2]\dododosetupTABLE}% - \processcommalist[#1]\dodosetupTABLE} - -\def\nopTABLEparameters[#1][#2]% - {\letvalueempty{\@@tblprefix#1}} % can be made faster - -\def\setTABLEparameters[#1][#2]% - {\pushTBLparameters - \ifappendTBLsetups - \doifdefinedelse{\@@tblprefix#1} - {\def\getTABLEparameters[##1][##2]% - {\setvalue{\@@tblprefix#1}{\getTABLEparameters[\@@tbl\@@tbl][##2,#2]}}% - \getvalue{\@@tblprefix#1}% - \let\getTABLEparameters\getparameters} - {\setvalue{\@@tblprefix#1}{\getTABLEparameters[\@@tbl\@@tbl][#2]}}% +% \def\tabl_ntb_setup_three[#1][#2][#3]% +% {\processaction +% [#1] +% [ \v!row=>{\tabl_ntb_setup_xy[\c!y][#2][#3]},% +% \v!column=>{\tabl_ntb_setup_xy[\c!x][#2][#3]},% +% r=>{\tabl_ntb_setup_xy[\c!y][#2][#3]},% +% c=>{\tabl_ntb_setup_xy[\c!x][#2][#3]},% +% y=>{\tabl_ntb_setup_xy[\c!y][#2][#3]},% +% x=>{\tabl_ntb_setup_xy[\c!x][#2][#3]},% +% \v!start=>{\tabl_ntb_setup_xy[#1][#2][#3]},% +% \v!header=>{\tabl_ntb_setup_xy[#1][#2][#3]},% +% \s!unknown=>{\tabl_ntb_setup_un[#1][#2][#3]}]} + +% \def\tabl_ntb_setup_two[#1][#2][#3]% +% {\processaction +% [#1] +% [ \v!row=>{\tabl_ntb_setup_xy[\c!y][\v!each][#2]},% +% \v!column=>{\tabl_ntb_setup_xy[\c!x][\v!each][#2]},% +% r=>{\tabl_ntb_setup_xy[\c!y][\v!each][#2]},% +% c=>{\tabl_ntb_setup_xy[\c!x][\v!each][#2]},% +% y=>{\tabl_ntb_setup_xy[\c!y][\v!each][#2]},% +% x=>{\tabl_ntb_setup_xy[\c!x][\v!each][#2]},% +% \v!start=>{\tabl_ntb_setup_xy[#1][\v!each][#2]},% +% \v!header=>{\tabl_ntb_setup_xy[#1][\v!each][#2]},% +% \s!unknown=>{\tabl_ntb_setup_xy[\c!x][#1][#2]}]} + +\def\tabl_ntb_setup_one[#1][#2][#3]% + {\setupcurrentnaturaltablelocal[#1]} + +\def\tabl_ntb_setup_xy[#1][#2][#3]% + {\def\tabl_ntb_setup_step##1{\tabl_ntb_parameters_set[#1##1][#3]}% + \processcommalist[#2]\tabl_ntb_setup_step} + +\def\tabl_ntb_setup_un[#1][#2][#3]% + {\def\tabl_ntb_setup_step##1% + {\def\tabl_ntb_setup_step_step####1{\tabl_ntb_parameters_set[\c!x##1\c!y####1][#3]}% + \processcommalist[#2]\tabl_ntb_setup_step_step}% + \processcommalist[#1]\tabl_ntb_setup_step} + +\def\tabl_ntb_setup_each[#1][#2][#3]% ignores #3 + {\tabl_ntb_parameters_set[#1\v!each][#2]} + +\def\tabl_ntb_setup_ux[#1][#2][#3]% ignores #3 + {\def\tabl_ntb_setup_step##1{\tabl_ntb_parameters_set[\c!x##1][#2]}% + \processcommalist[#1]\tabl_ntb_setup_step} + +\installcorenamespace{naturaltablesetupthree} +\installcorenamespace{naturaltablesetuptwo} + +\def\tabl_ntb_setup_three[#1]{\csname\??naturaltablesetupthree\ifcsname\??naturaltablesetupthree#1\endcsname#1\else\s!unknown\fi\endcsname[#1]} +\def\tabl_ntb_setup_two [#1]{\csname\??naturaltablesetuptwo \ifcsname\??naturaltablesetuptwo #1\endcsname#1\else\s!unknown\fi\endcsname[#1]} + +\setvalue{\??naturaltablesetupthree \v!row}[#1]{\tabl_ntb_setup_xy [\c!y]} +\setvalue{\??naturaltablesetupthree \v!column}[#1]{\tabl_ntb_setup_xy [\c!x]} +\setvalue{\??naturaltablesetupthree \v!start}[#1]{\tabl_ntb_setup_xy [\v!start]} +\setvalue{\??naturaltablesetupthree \v!header}[#1]{\tabl_ntb_setup_xy [\v!header]} + +\setvalue{\??naturaltablesetuptwo \v!row}[#1]{\tabl_ntb_setup_each[\c!y]} +\setvalue{\??naturaltablesetuptwo \v!column}[#1]{\tabl_ntb_setup_each[\c!x]} +\setvalue{\??naturaltablesetuptwo \v!start}[#1]{\tabl_ntb_setup_each[\v!start]} +\setvalue{\??naturaltablesetuptwo \v!header}[#1]{\tabl_ntb_setup_each[\v!header]} + +\letvalue{\??naturaltablesetupthree\s!unknown}\tabl_ntb_setup_un +\letvalue{\??naturaltablesetuptwo \s!unknown}\tabl_ntb_setup_ux + +\letcsnamecsname\csname\??naturaltablesetupthree r\endcsname\csname\??naturaltablesetupthree \v!row\endcsname +\letcsnamecsname\csname\??naturaltablesetupthree c\endcsname\csname\??naturaltablesetupthree\v!column\endcsname +\letcsnamecsname\csname\??naturaltablesetupthree y\endcsname\csname\??naturaltablesetupthree \v!row\endcsname +\letcsnamecsname\csname\??naturaltablesetupthree x\endcsname\csname\??naturaltablesetupthree\v!column\endcsname + +\letcsnamecsname\csname\??naturaltablesetuptwo r\endcsname\csname\??naturaltablesetuptwo \v!row\endcsname +\letcsnamecsname\csname\??naturaltablesetuptwo c\endcsname\csname\??naturaltablesetuptwo \v!column\endcsname +\letcsnamecsname\csname\??naturaltablesetuptwo y\endcsname\csname\??naturaltablesetuptwo \v!row\endcsname +\letcsnamecsname\csname\??naturaltablesetuptwo x\endcsname\csname\??naturaltablesetuptwo \v!column\endcsname + +\def\tabl_ntb_parameters_set[#1][#2]% + {\ifappendTBLsetups + \ifcsname\??naturaltableset\m_tabl_tbl_level:#1\endcsname + \def\tabl_ntb_parameters_get[##1]% + {\setvalue{\??naturaltableset\m_tabl_tbl_level:#1}{\tabl_ntb_parameters_get[##1,#2]}}% + \getvalue{\??naturaltableset\m_tabl_tbl_level:#1}% + \let\tabl_ntb_parameters_get\setupcurrentnaturaltablelocal + \else + \setvalue{\??naturaltableset\m_tabl_tbl_level:#1}{\tabl_ntb_parameters_get[#2]}% + \fi \else - \setvalue{\@@tblprefix#1}{\getTABLEparameters[\@@tbl\@@tbl][#2]}% - \fi - \popTBLparameters} - -\let\setupTBLsection\relax + \setvalue{\??naturaltableset\m_tabl_tbl_level:#1}{\tabl_ntb_parameters_get[#2]}% + \fi} % % \setupTABLE [y] [first][background=color,backgroundcolor=blue,frame=off,bottomframe=on,topframe=on,framecolor=white] % \setupTABLE [first][first][backgroundcorner=2,corner=10,frame=on] @@ -382,87 +468,91 @@ %D %D \start \tightTBLrowspanfalse \getbuffer \stop -\unexpanded\def\setupTBLcell#1#2% cell over col over row - {\setupTBLsection % already forgotten - \edef\positiverow{\number#1}% - \edef\positivecol{\number#2}% - \edef\negativerow{\the\numexpr-\maximumrow+#1+\minusone\relax}% - \edef\negativecol{\the\numexpr-\maximumcol+#2+\minusone\relax}% +\let\tabl_ntb_setup_section\relax + +\unexpanded\def\tabl_ntb_setup_cell#1#2% cell over col over row + {\tabl_ntb_setup_section % already forgotten + \edef\m_tabl_ntb_positive_row{\number#1}% + \edef\m_tabl_ntb_positive_col{\number#2}% + \edef\m_tabl_ntb_negative_row{\the\numexpr-\c_tabl_maximum_row+#1+\minusone\relax}% + \edef\m_tabl_ntb_negative_col{\the\numexpr-\c_tabl_maximum_col+#2+\minusone\relax}% + % saves tokens (no speed gain) + \edef\m_tabl_ntb_prefix{\??naturaltableset\m_tabl_tbl_level:}% % each each - \csname\@@tblprefix\c!x\v!each\c!y\v!each\endcsname - \csname\@@tblprefix\c!y\v!each\endcsname - \csname\@@tblprefix\c!x\v!each\endcsname + \csname\m_tabl_ntb_prefix\c!x\v!each\c!y\v!each\endcsname + \csname\m_tabl_ntb_prefix\c!y\v!each\endcsname + \csname\m_tabl_ntb_prefix\c!x\v!each\endcsname % odd even - \csname\@@tblprefix\c!y\v!oddeven\positiverow\endcsname - \csname\@@tblprefix\c!x\v!oddeven\positivecol\endcsname - \csname\@@tblprefix\c!x\v!oddeven\positivecol\c!y\v!oddeven\positiverow\endcsname + \csname\m_tabl_ntb_prefix\c!y\v!oddeven\m_tabl_ntb_positive_row\endcsname + \csname\m_tabl_ntb_prefix\c!x\v!oddeven\m_tabl_ntb_positive_col\endcsname + \csname\m_tabl_ntb_prefix\c!x\v!oddeven\m_tabl_ntb_positive_col\c!y\v!oddeven\m_tabl_ntb_positive_row\endcsname % row/col number combinations - \ifcsname\@@tblprefix\c!y\positiverow\endcsname\csname\@@tblprefix\c!y\positiverow\endcsname\fi - \ifcsname\@@tblprefix\c!y\negativerow\endcsname\csname\@@tblprefix\c!y\negativerow\endcsname\fi - \csname\@@tbl\@@tbl\c!extras\endcsname - \@EA\let\csname\@@tbl\@@tbl\c!extras\endcsname\relax % new, see x-fo - \ifcsname\@@tblprefix\c!x\positivecol\endcsname\csname\@@tblprefix\c!x\positivecol\endcsname\fi - \ifcsname\@@tblprefix\c!x\negativecol\endcsname\csname\@@tblprefix\c!x\negativecol\endcsname\fi - \csname\@@tbl\@@tbl\c!extras\endcsname - \@EA\let\csname\@@tbl\@@tbl\c!extras\endcsname\relax % new, see x-fo + \ifcsname\m_tabl_ntb_prefix\c!y\m_tabl_ntb_positive_row\endcsname\csname\m_tabl_ntb_prefix\c!y\m_tabl_ntb_positive_row\endcsname\fi + \ifcsname\m_tabl_ntb_prefix\c!y\m_tabl_ntb_negative_row\endcsname\csname\m_tabl_ntb_prefix\c!y\m_tabl_ntb_negative_row\endcsname\fi + \naturaltablelocalparameter\c!extras + \letnaturaltablelocalparameter\c!extras\relax % new, see x-fo + \ifcsname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_positive_col\endcsname\csname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_positive_col\endcsname\fi + \ifcsname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_negative_col\endcsname\csname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_negative_col\endcsname\fi + \naturaltablelocalparameter\c!extras + \letnaturaltablelocalparameter\c!extras\relax % new, see x-fo % first/last combinations - \ifnum\positiverow=\plusone - \csname\@@tblprefix\c!y\v!first\endcsname - \ifcsname\@@tblprefix\c!x\positivecol\c!y\v!first\endcsname\csname\@@tblprefix\c!x\positivecol\c!y\v!first\endcsname\fi + \ifnum\m_tabl_ntb_positive_row=\plusone + \csname\m_tabl_ntb_prefix\c!y\v!first\endcsname + \ifcsname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_positive_col\c!y\v!first\endcsname\csname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_positive_col\c!y\v!first\endcsname\fi \fi - \ifnum\positivecol=\plusone - \csname\@@tblprefix\c!x\v!first\endcsname - \ifcsname\@@tblprefix\c!x\v!first\c!y\positiverow\endcsname\csname\@@tblprefix\c!x\v!first\c!y\positiverow\endcsname\fi + \ifnum\m_tabl_ntb_positive_col=\plusone + \csname\m_tabl_ntb_prefix\c!x\v!first\endcsname + \ifcsname\m_tabl_ntb_prefix\c!x\v!first\c!y\m_tabl_ntb_positive_row\endcsname\csname\m_tabl_ntb_prefix\c!x\v!first\c!y\m_tabl_ntb_positive_row\endcsname\fi \fi - \ifnum\positiverow=\maximumrow\relax - \csname\@@tblprefix\c!y\v!last\endcsname - \ifcsname\@@tblprefix\c!x\positivecol\c!y\v!last\endcsname\csname\@@tblprefix\c!x\positivecol\c!y\v!last\endcsname\fi + \ifnum\m_tabl_ntb_positive_row=\c_tabl_maximum_row\relax + \csname\m_tabl_ntb_prefix\c!y\v!last\endcsname + \ifcsname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_positive_col\c!y\v!last\endcsname\csname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_positive_col\c!y\v!last\endcsname\fi \fi - \ifnum\positivecol=\maximumcol\relax - \csname\@@tblprefix\c!x\v!last\endcsname - \ifcsname\@@tblprefix\c!x\v!last\c!y\positiverow\endcsname\csname\@@tblprefix\c!x\v!last\c!y\positiverow\endcsname\fi + \ifnum\m_tabl_ntb_positive_col=\c_tabl_maximum_col\relax + \csname\m_tabl_ntb_prefix\c!x\v!last\endcsname + \ifcsname\m_tabl_ntb_prefix\c!x\v!last\c!y\m_tabl_ntb_positive_row\endcsname\csname\m_tabl_ntb_prefix\c!x\v!last\c!y\m_tabl_ntb_positive_row\endcsname\fi \fi - \ifnum\positiverow=\maximumrow\relax \ifnum\positivecol=\maximumcol\relax - \csname\@@tblprefix\c!x\v!last\c!y\v!last\endcsname + \ifnum\m_tabl_ntb_positive_row=\c_tabl_maximum_row\relax \ifnum\m_tabl_ntb_positive_col=\c_tabl_maximum_col\relax + \csname\m_tabl_ntb_prefix\c!x\v!last\c!y\v!last\endcsname \fi\fi - \ifnum\positiverow=\plusone \ifnum\positivecol=\plusone - \csname\@@tblprefix\c!x\v!first\c!y\v!first\endcsname + \ifnum\m_tabl_ntb_positive_row=\plusone \ifnum\m_tabl_ntb_positive_col=\plusone + \csname\m_tabl_ntb_prefix\c!x\v!first\c!y\v!first\endcsname \fi\fi - \ifnum\positiverow=\plusone \ifnum\positivecol=\maximumcol\relax - \csname\@@tblprefix\c!x\v!last\c!y\v!first\endcsname + \ifnum\m_tabl_ntb_positive_row=\plusone \ifnum\m_tabl_ntb_positive_col=\c_tabl_maximum_col\relax + \csname\m_tabl_ntb_prefix\c!x\v!last\c!y\v!first\endcsname \fi\fi - \ifnum\positiverow=\maximumrow\relax \ifnum\positivecol=\plusone - \csname\@@tblprefix\c!x\v!first\c!y\v!last\endcsname + \ifnum\m_tabl_ntb_positive_row=\c_tabl_maximum_row\relax \ifnum\m_tabl_ntb_positive_col=\plusone + \csname\m_tabl_ntb_prefix\c!x\v!first\c!y\v!last\endcsname \fi\fi % special case: two rows and last row : two&first and two&last (round corners) - \ifnum\maximumrow=\plustwo\relax - \ifnum\positiverow=\maximumrow\relax \ifnum\positivecol=\plusone - \csname\@@tblprefix\c!x\v!first\c!y\v!two\endcsname + \ifnum\c_tabl_maximum_row=\plustwo\relax + \ifnum\m_tabl_ntb_positive_row=\c_tabl_maximum_row\relax \ifnum\m_tabl_ntb_positive_col=\plusone + \csname\m_tabl_ntb_prefix\c!x\v!first\c!y\v!two\endcsname \fi\fi - \ifnum\positiverow=\maximumrow\relax \ifnum\positivecol=\maximumcol\relax - \csname\@@tblprefix\c!x\v!last\c!y\v!two\endcsname + \ifnum\m_tabl_ntb_positive_row=\c_tabl_maximum_row\relax \ifnum\m_tabl_ntb_positive_col=\c_tabl_maximum_col\relax + \csname\m_tabl_ntb_prefix\c!x\v!last\c!y\v!two\endcsname \fi\fi \fi - \ifnum\gettblcol\positiverow\positivecol=\maximumcol\relax % top span over whole width - \ifnum\positiverow=\plusone - \csname\@@tblprefix\c!x\v!one\c!y\v!first\endcsname + \ifnum\tabl_ntb_get_col\m_tabl_ntb_positive_row\m_tabl_ntb_positive_col=\c_tabl_maximum_col\relax % top span over whole width + \ifnum\m_tabl_ntb_positive_row=\plusone + \csname\m_tabl_ntb_prefix\c!x\v!one\c!y\v!first\endcsname \fi - \ifnum\positiverow=\maximumrow\relax - \csname\@@tblprefix\c!x\v!one\c!y\v!last\endcsname + \ifnum\m_tabl_ntb_positive_row=\c_tabl_maximum_row\relax + \csname\m_tabl_ntb_prefix\c!x\v!one\c!y\v!last\endcsname \fi \fi % header things - \ifnum#1>\noftblhdnxlines\else - \ifcsname\@@tblprefix\v!header\v!each \endcsname\csname\@@tblprefix\v!header\v!each \endcsname\fi - \ifcsname\@@tblprefix\v!header\positivecol\endcsname\csname\@@tblprefix\v!header\positivecol\endcsname\fi + \ifnum#1>\c_tabl_ntb_n_of_hdnx_lines\else + \ifcsname\m_tabl_ntb_prefix\v!header\v!each \endcsname\csname\m_tabl_ntb_prefix\v!header\v!each \endcsname\fi + \ifcsname\m_tabl_ntb_prefix\v!header\m_tabl_ntb_positive_col\endcsname\csname\m_tabl_ntb_prefix\v!header\m_tabl_ntb_positive_col\endcsname\fi \fi % explicit cells - \ifcsname\@@tblprefix\c!x\positivecol\c!y\positiverow\endcsname\csname\@@tblprefix\c!x\positivecol\c!y\positiverow\endcsname\fi - \ifcsname\@@tblprefix\c!x\negativecol\c!y\negativerow\endcsname\csname\@@tblprefix\c!x\negativecol\c!y\negativerow\endcsname\fi + \ifcsname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_positive_col\c!y\m_tabl_ntb_positive_row\endcsname\csname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_positive_col\c!y\m_tabl_ntb_positive_row\endcsname\fi + \ifcsname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_negative_col\c!y\m_tabl_ntb_negative_row\endcsname\csname\m_tabl_ntb_prefix\c!x\m_tabl_ntb_negative_col\c!y\m_tabl_ntb_negative_row\endcsname\fi % local - \ifcsname\@@tblprefix\c!y++\positiverow\endcsname\csname\@@tblprefix\c!y++\positiverow\endcsname\fi + \ifcsname\m_tabl_ntb_prefix\c!y++\m_tabl_ntb_positive_row\endcsname\csname\m_tabl_ntb_prefix\c!y++\m_tabl_ntb_positive_row\endcsname\fi % done - \global\letcscsname\@@tblsplitafter\csname\@@tbl\@@tbl\c!after\endcsname + \xdef\m_tabl_ntb_after_split{\naturaltablelocalparameter\c!after}% to be checked \relax} % we cannot use +n (checking on number/last/first would slow down too much) @@ -478,7 +568,7 @@ % \dorecurse{10}{\bTR \dorecurse{6}{\bTD xxx \eTD} \eTR} % \eTABLE -\globallet\@@tblsplitafter\relax +\let\m_tabl_ntb_after_split\relax % split + page: % @@ -488,101 +578,154 @@ % \bTR \bTD left \eTD\bTD right \eTD\eTR % \eTABLE -% todo: protect counters +\unexpanded\def\tabl_ntb_tr + {\c_tabl_ntb_current_col\zerocount + \advance\c_tabl_maximum_row\plusone + \iffirstargument + \expandafter\tabl_ntb_tr_yes + \else + \expandafter\gobbleoneoptional + \fi} -\newcount\row \newcount\col -\newcount\xrow \newcount\xcol -\newcount\xxrow \newcount\xxcol -\newcount\maximumrow \newcount\maximumcol \newcount\maximumrowspan - \newcount\currentcol -\newcount\tblspn +\def\tabl_ntb_tr_yes[#1]% + {\setvalue{\??naturaltableset\m_tabl_tbl_level:\c!y++\the\c_tabl_maximum_row}{\setupcurrentnaturaltablelocal[#1]}} -\def\settblref#1#2{\expandafter\xdef\csname\@@tblprefix\number#1:\number#2:x\endcsname} -\def\gettblref#1#2{\ifcsname\@@tblprefix\number#1:\number#2:x\endcsname\csname\@@tblprefix\number#1:\number#2:x\endcsname\fi} +\def\m_tabl_ntb_default_nr{\naturaltableparameter\c!nr} +\def\m_tabl_ntb_default_nc{\naturaltableparameter\c!nc} -\def\parseTR[#1]% - {\currentcol\zerocount - \advance\maximumrow\plusone - \iffirstargument - \setvalue{\@@tblprefix\c!y++\number\maximumrow}{\getparameters[\@@tbl\@@tbl][#1]}% maybe also in mkii +% \naturaltableparameter\c!action => \empty (brr, only needed for nesting) + +\unexpanded\def\tabl_ntb_td + {\iffirstargument + \expandafter\tabl_ntb_td_yes + \else + \expandafter\tabl_ntb_td_nop \fi} -\long\def\parseTD[#1]#2\eTD - {\def\tblny{\tblnr}% - \def\tblnx{\tblnc}% - \let\tblnc\plusone - \let\tblnr\plusone - \let\tbln\currentcol - \let\tblm\empty - \iffirstargument - \getparameters[\@@tbl][#1]% - \fi +\def\tabl_ntb_td_yes[#1]#2\eTD + {\letnaturaltableparameter\c!ny \m_tabl_ntb_default_nr + \letnaturaltableparameter\c!nx \m_tabl_ntb_default_nc + \letnaturaltableparameter\c!nc \plusone + \letnaturaltableparameter\c!nr \plusone + \letnaturaltableparameter\c!n \c_tabl_ntb_current_col + \letnaturaltableparameter\c!m \empty + \letnaturaltableparameter\c!action\empty + \setupcurrentnaturaltable[#1]% + % + \c_tabl_ntb_nx\naturaltableparameter\c!nx\relax + \c_tabl_ntb_ny\naturaltableparameter\c!ny\relax % goto first cell % NEW, n/m=cellnumber - \edef\@@tblnindeed{\csname\@@tbl\c!n\endcsname}% - \ifx\@@tblnindeed\empty - \global\advance\tblspn\tblnx\relax - \else\ifnum\@@tblnindeed=\currentcol\else - \scratchcounter\numexpr\@@tblnindeed-\currentcol+\minusone-\tblspn\relax - \ifnum\scratchcounter>\zerocount - \normalexpanded{\noexpand\parseTD[\c!nx=\the\scratchcounter,\c!n=,\c!m=,*sq=\v!no]}\eTD - \fi - % can also be made faster - \getparameters[\@@tbl][\c!ny=\tblnr,\c!nx=\tblnc,nc=1,nr=1,#1,\c!n=,\c!m=]% + \edef\m_tabl_ntb_n{\naturaltableparameter\c!n}% + \edef\m_tabl_ntb_m{\naturaltableparameter\c!m}% + % + \ifx\m_tabl_ntb_n\empty + \global\advance\c_tabl_ntb_spn\c_tabl_ntb_nx\relax + \else\ifnum\m_tabl_ntb_n=\c_tabl_ntb_current_col\else + \tabl_ntb_td_pass_n{#1}% \fi\fi - \edef\@@tblmindeed{\csname\@@tbl\c!m\endcsname}% - \ifx\@@tblmindeed\empty \else - \ifnum\@@tblmindeed=\currentcol \else - \scratchcounter\numexpr\@@tblmindeed-\currentcol+\minusone-\tblspn\relax - \dorecurse\scratchcounter{\normalexpanded{\noexpand\parseTD[\c!n=,\c!m=]}\eTD}% - % can be sped up - \getparameters[\@@tbl][\c!ny=\tblnr,\c!nx=\tblnc,nc=1,nr=1,#1,\c!n=,\c!m=]% kind of double, see prev + \ifx\m_tabl_ntb_m\empty \else + \ifnum\m_tabl_ntb_m=\c_tabl_ntb_current_col \else + \tabl_ntb_td_pass_m{#1}% \fi \fi \doloop % skip over columns that result from earlier span - {\advance\currentcol\plusone - \doifnottbltag\maximumrow\currentcol\exitloop}% - % == \def\next{\advance\currentcol\plusone\doiftbltag\maximumrow\currentcol\next}\next + {\advance\c_tabl_ntb_current_col\plusone + \ifcsname\tabl_ntb_tag_pattern\c_tabl_maximum_row\c_tabl_ntb_current_col\endcsname \else + \exitloop + \fi}% % fill r*c cells and set span - \ifnum\tblnx=\plusone - \ifnum\tblny=\plusone - \ifnum\currentcol>\maximumcol\relax - \maximumcol\currentcol + \c_tabl_ntb_nx\naturaltableparameter\c!nx\relax + \c_tabl_ntb_ny\naturaltableparameter\c!ny\relax + \ifnum\c_tabl_ntb_nx=\plusone + \ifnum\c_tabl_ntb_ny=\plusone + \ifnum\c_tabl_ntb_current_col>\c_tabl_maximum_col\relax + \c_tabl_maximum_col\c_tabl_ntb_current_col \fi \else - \presetTBLcell + \tabl_ntb_cell_preset \fi \else - \presetTBLcell + \tabl_ntb_cell_preset \fi % set values - \lettbltag\maximumrow\currentcol\tblcell - \settblcol\maximumrow\currentcol{\number\tblnx}% - \settblrow\maximumrow\currentcol{\number\tblny}% + \tabl_ntb_let_tag\c_tabl_maximum_row\c_tabl_ntb_current_col\c_tabl_ntb_cell + \tabl_ntb_set_col\c_tabl_maximum_row\c_tabl_ntb_current_col{\the\c_tabl_ntb_nx}% + \tabl_ntb_set_row\c_tabl_maximum_row\c_tabl_ntb_current_col{\the\c_tabl_ntb_ny}% % the action key will change! - \settblref\maximumrow\currentcol{\ifcsname\@@tbl\c!action\endcsname\csname\@@tbl\c!action\endcsname\fi}% + \tabl_ntb_set_ref\c_tabl_maximum_row\c_tabl_ntb_current_col{\naturaltableparameter\c!action}% % save text - \edef\celltag{{\number\maximumrow}{\number\currentcol}}% - \@EA\settbltxt\@EA\maximumrow\@EA\currentcol\@EA{\@EA\handleTBLcell\celltag[#1]{#2}}} - -\def\presetTBLcell - {\row\maximumrow - \col\currentcol - \dorecurse\tblny - {\col\currentcol - \settblcol\row\col{\number\tblnx}% - \ifnum\tblnx>\maximumrowspan\relax - \maximumrowspan\tblnx - \fi - \dorecurse\tblnx - {\lettbltag\row\col\tblnone - \advance\col\plusone}% - \advance\row\plusone}% + \normalexpanded + {\tabl_ntb_set_txt_process\c_tabl_maximum_row\c_tabl_ntb_current_col{\the\c_tabl_maximum_row}{\the\c_tabl_ntb_current_col}}% + {#1}{#2}} + +\def\tabl_ntb_td_nop[#1]#2\eTD + {\global\advance\c_tabl_ntb_spn\plusone\relax + \doloop + {\advance\c_tabl_ntb_current_col\plusone + \ifcsname\tabl_ntb_tag_pattern\c_tabl_maximum_row\c_tabl_ntb_current_col\endcsname \else + \exitloop + \fi}% + \c_tabl_ntb_nx\plusone + \c_tabl_ntb_ny\plusone + \ifnum\c_tabl_ntb_current_col>\c_tabl_maximum_col\relax + \c_tabl_maximum_col\c_tabl_ntb_current_col + \fi + \tabl_ntb_let_tag\c_tabl_maximum_row\c_tabl_ntb_current_col\c_tabl_ntb_cell + \tabl_ntb_set_col\c_tabl_maximum_row\c_tabl_ntb_current_col{\the\c_tabl_ntb_nx}% + \tabl_ntb_set_row\c_tabl_maximum_row\c_tabl_ntb_current_col{\the\c_tabl_ntb_ny}% + \tabl_ntb_let_ref\c_tabl_maximum_row\c_tabl_ntb_current_col\empty + \normalexpanded + {\tabl_ntb_set_txt_process\c_tabl_maximum_row\c_tabl_ntb_current_col{\the\c_tabl_maximum_row}{\the\c_tabl_ntb_current_col}}% + {#1}{#2}} + +\def\tabl_ntb_td_pass_n#1% + {\scratchcounter\numexpr\m_tabl_ntb_n-\c_tabl_ntb_current_col+\minusone-\c_tabl_ntb_spn\relax + \ifnum\scratchcounter>\zerocount + \normalexpanded{\tabl_ntb_td[\c!nx=\the\scratchcounter,\c!n=,\c!m=,*sq=\v!no]}\eTD + \fi + \letnaturaltableparameter\c!ny\m_tabl_ntb_default_nr + \letnaturaltableparameter\c!nx\m_tabl_ntb_default_nc + \letnaturaltableparameter\c!nc\plusone + \letnaturaltableparameter\c!nr\plusone + \setupcurrentnaturaltable[#1]% + \letnaturaltableparameter\c!n \empty + \letnaturaltableparameter\c!m \empty} + +\def\tabl_ntb_td_pass_m#1% + {\scratchcounter\numexpr\m_tabl_ntb_m-\c_tabl_ntb_current_col+\minusone-\c_tabl_ntb_spn\relax + \dorecurse\scratchcounter{\normalexpanded{\tabl_ntb_td[\c!n=,\c!m=]}\eTD}% + % can be sped up + \letnaturaltableparameter\c!ny\m_tabl_ntb_default_nr + \letnaturaltableparameter\c!nx\m_tabl_ntb_default_nc + \letnaturaltableparameter\c!nc\plusone + \letnaturaltableparameter\c!nr\plusone + \setupcurrentnaturaltable[#1]% + \letnaturaltableparameter\c!n \empty + \letnaturaltableparameter\c!m \empty} + +\def\tabl_ntb_cell_preset + {\c_tabl_ntb_current_row\c_tabl_maximum_row + \c_tabl_ntb_current_col\c_tabl_ntb_current_col + \dorecurse\c_tabl_ntb_ny\tabl_ntb_cell_preset_rows % check max column - \advance\col\minusone - \ifnum\col>\maximumcol\relax - \maximumcol\col + \advance\c_tabl_ntb_current_col\minusone + \ifnum\c_tabl_ntb_current_col>\c_tabl_maximum_col\relax + \c_tabl_maximum_col\c_tabl_ntb_current_col \fi} +\def\tabl_ntb_cell_preset_rows + {\c_tabl_ntb_current_col\c_tabl_ntb_current_col + \tabl_ntb_set_col\c_tabl_ntb_current_row\c_tabl_ntb_current_col{\the\c_tabl_ntb_nx}% + \ifnum\c_tabl_ntb_nx>\c_tabl_maximum_row_span\relax + \c_tabl_maximum_row_span\c_tabl_ntb_nx + \fi + \dorecurse\c_tabl_ntb_nx\tabl_ntb_cell_preset_cells + \advance\c_tabl_ntb_current_row\plusone} + +\def\tabl_ntb_cell_preset_cells + {\tabl_ntb_let_tag\c_tabl_ntb_current_row\c_tabl_ntb_current_col\c_tabl_ntb_none + \advance\c_tabl_ntb_current_col\plusone} + %D The usage of n and m: %D %D \startbuffer @@ -617,13 +760,13 @@ %D \stopbuffer %D %D \typebuffer \getbuffer - -\long\def\parseTH[#1]#2\eTH - {\parseTD[#1,\c!color=\tbltblheadcolor,\c!style=\tbltblheadstyle,\c!aligncharacter=\v!no]#2\eTD} -\long\def\parseTN[#1]#2\eTN - {\parseTD[#1]\digits#2\relax\eTD} - +\def\tabl_ntb_th[#1]#2\eTH + {\tabl_ntb_td[#1,\c!color=\naturaltablelocalparameter\c!headcolor,\c!style=\naturaltablelocalparameter\c!headstyle,\c!aligncharacter=\v!no]#2\eTD} + +\def\tabl_ntb_tn[#1]#2\eTN + {\tabl_ntb_td[#1]\digits#2\relax\eTD} + %D Vit Zyka needed the option to create a distance between columns, so I %D added support for individual column distances. %D @@ -668,89 +811,80 @@ %D \stopbuffer %D %D \typebuffer \startlinecorrection \getbuffer \stoplinecorrection - -\newtoks\TBLhead -\newtoks\TBLnext -\newtoks\TBLbody -\newtoks\TBLfoot % to be done: head <raw> foot, dus state var -\unexpanded\def\bTABLEhead{\dosingleempty\doTABLEhead} \let\eTABLEhead\relax -\unexpanded\def\bTABLEnext{\dosingleempty\doTABLEnext} \let\eTABLEnext\relax -\unexpanded\def\bTABLEbody{\dosingleempty\doTABLEbody} \let\eTABLEbody\relax -\unexpanded\def\bTABLEfoot{\dosingleempty\doTABLEfoot} \let\eTABLEfoot\relax +\unexpanded\def\bTABLEhead{\dosingleempty\tabl_ntb_head} \let\eTABLEhead\relax +\unexpanded\def\bTABLEnext{\dosingleempty\tabl_ntb_next} \let\eTABLEnext\relax +\unexpanded\def\bTABLEbody{\dosingleempty\tabl_ntb_body} \let\eTABLEbody\relax +\unexpanded\def\bTABLEfoot{\dosingleempty\tabl_ntb_foot} \let\eTABLEfoot\relax -\long\def\doTABLEhead[#1]#2\eTABLEhead{\appendtoks\doTABLEsection[#1]{#2}\to\TBLhead} -\long\def\doTABLEnext[#1]#2\eTABLEnext{\appendtoks\doTABLEsection[#1]{#2}\to\TBLnext} -\long\def\doTABLEbody[#1]#2\eTABLEbody{\appendtoks\doTABLEsection[#1]{#2}\to\TBLbody} -\long\def\doTABLEfoot[#1]#2\eTABLEfoot{\appendtoks\doTABLEsection[#1]{#2}\to\TBLfoot} +\def\tabl_ntb_head[#1]#2\eTABLEhead{\appendtoks\tabl_ntb_section[#1]{#2}\to\t_tabl_ntb_head} +\def\tabl_ntb_next[#1]#2\eTABLEnext{\appendtoks\tabl_ntb_section[#1]{#2}\to\t_tabl_ntb_next} +\def\tabl_ntb_body[#1]#2\eTABLEbody{\appendtoks\tabl_ntb_section[#1]{#2}\to\t_tabl_ntb_body} +\def\tabl_ntb_foot[#1]#2\eTABLEfoot{\appendtoks\tabl_ntb_section[#1]{#2}\to\t_tabl_ntb_foot} -\long\def\doTABLEsection[#1]#2% also used in tabl-nte - {\unexpanded\def\setupTBLsection{\getparameters[\@@tbl\@@tbl][#1]}% +\def\tabl_ntb_section[#1]#2% also used in tabl-nte + {\unexpanded\def\tabl_ntb_setup_section{\setupcurrentnaturaltablelocal[#1]}% #2% - \let\setupTBLsection\relax} - -\let\pushTBL\relax -\let\popTBL \relax + \let\tabl_ntb_setup_section\relax} -\newconstant\tblpass - -\def\presetallTABLEparameters% each odd|even level / can be sped up but only once per table - {\executeifdefined{\@@rawtblprefix\v!start\v!each}\relax - \executeifdefined{\@@rawtblprefix\v!start\v!oddeven\TBLlevel}\relax - \executeifdefined{\@@rawtblprefix\v!start\number\TBLlevel}\relax} +\def\tabl_ntb_preset_parameters% each odd|even level / can be sped up but only once per table + {\ifcsname\??naturaltableset\m_tabl_tbl_level:\v!start\v!each\endcsname + \csname\??naturaltableset\m_tabl_tbl_level:\v!start\v!each\endcsname + \fi + \ifcsname\??naturaltableset\m_tabl_tbl_level:\v!start\v!oddeven\m_tabl_tbl_level\endcsname % hm + \csname\??naturaltableset\m_tabl_tbl_level:\v!start\v!oddeven\m_tabl_tbl_level\endcsname + \fi + \ifcsname\??naturaltableset\m_tabl_tbl_level:\v!start\m_tabl_tbl_level\endcsname % hm + \csname\??naturaltableset\m_tabl_tbl_level:\v!start\m_tabl_tbl_level\endcsname + \fi} \unexpanded\def\bTABLE - {\dosingleempty\dobTABLE} + {\dosingleempty\tabl_ntb_table} -\def\dobTABLE[#1]% - {\pushTBL +\def\tabl_ntb_table[#1]% + {\tabl_ntb_table_push % box not here \bgroup - \TBLhead\emptytoks - \TBLnext\emptytoks - \TBLbody\emptytoks - \TBLfoot\emptytoks + \t_tabl_ntb_head\emptytoks + \t_tabl_ntb_next\emptytoks + \t_tabl_ntb_body\emptytoks + \t_tabl_ntb_foot\emptytoks \ifhmode\kern\zeropoint\fi % blocks \removeunwantedspaces: check this on icare handelingsschema \resetcharacteralign % new - \getparameters - [\@@tbl\@@tbl] - [\c!align={\v!right,\v!broad,\v!high},#1]% - \ifx\tbltblsetups\empty\else - \doprocesslocalsetups\tbltblsetups - \fi - %\hsize\tbltbltextwidth - \doifelse\tbltbltextwidth\v!local + \setupcurrentnaturaltablelocal[\c!align={\v!right,\v!broad,\v!high},#1]% + \doifsomething{\naturaltablelocalparameter\c!setups}\doprocesslocalsetups{\naturaltablelocalparameter\c!setups}% + \doifelse{\naturaltablelocalparameter\c!textwidth}\v!local {\hsize\availablehsize} - {\hsize\tbltbltextwidth}% + {\hsize\naturaltablelocalparameter\c!textwidth}% \processaction - [\tbltblsplit] + [\naturaltablelocalparameter\c!split] [ \v!yes=>\enableTBLbreaktrue, \v!repeat=>\enableTBLbreaktrue\multipleTBLheadstrue, \v!auto=>\ifinsidesplitfloat\enableTBLbreaktrue\fi] \processaction - [\tbltblheader] + [\naturaltablelocalparameter\c!header] [\v!repeat=>\multipleTBLheadstrue]% - \presetallTABLEparameters + \tabl_ntb_preset_parameters \processallactionsinset - [\tbltbloption] + [\naturaltablelocalparameter\c!option] [\v!stretch=>\autoTBLspreadtrue]% - \linewidth\tbltblrulethickness % needs to be frozen + \linewidth\naturaltablelocalparameter\c!rulethickness % needs to be frozen \dontcomplain - \currentcol\zerocount - \maximumrowspan\plusone - \maximumcol\zerocount - \maximumrow\zerocount + \c_tabl_ntb_current_col\zerocount + \c_tabl_maximum_row_span\plusone + \c_tabl_maximum_col\zerocount + \c_tabl_maximum_row\zerocount \let\bTR\dobTR \let\bTD\dobTD \let\bTH\dobTH \let\bTN\dobTN} -\unexpanded\def\dobTR{\dosingleempty\parseTR} % also used in tabl-nte -\unexpanded\def\dobTD{\dosingleempty\parseTD} % also used in tabl-nte -\unexpanded\def\dobTH{\dosingleempty\parseTH} % also used in tabl-nte -\unexpanded\def\dobTN{\dosingleempty\parseTN} % also used in tabl-nte +\unexpanded\def\dobTR{\dosingleempty\tabl_ntb_tr} % also used in tabl-nte +\unexpanded\def\dobTD{\dosingleempty\tabl_ntb_td} % also used in tabl-nte +\unexpanded\def\dobTH{\dosingleempty\tabl_ntb_th} % also used in tabl-nte +\unexpanded\def\dobTN{\dosingleempty\tabl_ntb_tn} % also used in tabl-nte % permits \expanded{\bTD ... \eTD} @@ -761,302 +895,329 @@ \unexpanded\def\eTABLE % beware, we need to get rid of spurious spaces when in hmode {% tricky and dirty order -) - \doifsometokselse\TBLhead % slow, better a flag - {\the\TBLhead - \edef\noftblheadlines{\number\maximumrow}% - \doifsometokselse\TBLnext - {\the\TBLnext - \edef\noftblnextlines{\number\numexpr\maximumrow-\noftblheadlines\relax}}% - {\let\noftblnextlines\zerocount}% was 1 - \edef\noftblhdnxlines{\number\maximumrow}} - {\let\noftblheadlines\zerocount % was 1 - \let\noftblnextlines\zerocount - \let\noftblhdnxlines\zerocount}% - \the\TBLbody - \the\TBLfoot + \doifsometokselse\t_tabl_ntb_head % slow, better a flag + {\the\t_tabl_ntb_head + \c_tabl_ntb_n_of_head_lines\c_tabl_maximum_row\relax + \doifsometokselse\t_tabl_ntb_next + {\the\t_tabl_ntb_next + \c_tabl_ntb_n_of_next_lines\numexpr\c_tabl_maximum_row-\c_tabl_ntb_n_of_head_lines\relax}% + {\c_tabl_ntb_n_of_next_lines\zerocount}% was 1 + \c_tabl_ntb_n_of_hdnx_lines\c_tabl_maximum_row} + {\c_tabl_ntb_n_of_head_lines\zerocount % was 1 + \c_tabl_ntb_n_of_next_lines\zerocount + \c_tabl_ntb_n_of_hdnx_lines\zerocount}% + \the\t_tabl_ntb_body + \the\t_tabl_ntb_foot \removeunwantedspaces % only if hmode % finish cells - \dorecurse\maximumrow - {\row\recurselevel\relax - \dorecurse\maximumcol - {\col\recurselevel\relax - \doifnottbltag\row\col - {\xxcol\col - \xxrow\row - \xrow\row - \doloop - {\xcol\col - \doloop - {\doifelsetbltag\xrow\xcol \exitloop - {\advance\xcol\plusone - \ifnum\xcol>\maximumcol\relax \exitloop \fi}}% - \doifelsetbltag\xrow\xcol \exitloop - {\xxrow\xrow \xxcol\xcol \advance\xrow\plusone - \ifnum\xrow>\maximumrow \exitloop \fi}}% - \ifnum\xxrow>\maximumrow\xxrow\maximumrow\fi - \ifnum\xxcol>\maximumcol\xxcol\maximumcol\fi - \xxrow\numexpr\xxrow-\row+\plusone\relax - \xxcol\numexpr\xxcol-\col+\plusone\relax - \xrow\row - \dorecurse\xxrow - {\xcol\col \settblcol\xrow\xcol{\number\xxcol}% - \dorecurse\xxcol - {\lettbltag\xrow\xcol\tblnone \advance\xcol\plusone}% - \advance\xrow\plusone}% - \lettbltag\row\col\tblcell - \settblcol\row\col{\the\xxcol}% - \settblrow\row\col{\the\xxrow}% - \ifautoTBLemptycell - \edef\celltag{{\number\row}{\number\col}}% - \@EA\settbltxt\@EA\row\@EA\col\@EA{\@EA\handleTBLcell\celltag[]{\strut}}% - \fi}}}% + \tabl_ntb_loop_one % to be sure - \dorecurse\maximumrow - {\row\recurselevel\relax - \dorecurse\maximumcol - {\col\recurselevel\relax - \doiftblrow\row\col - {\scratchcounter\numexpr\maximumrow-\row+\plusone\relax - \ifnum\gettblrow\row\col>\scratchcounter - \settblrow\row\col{\the\scratchcounter}% - \fi}% - \lettblht\row\col\zeropoint - \lettblwd\row\col\zeropoint - \doifnottblcol\row\col{\lettblcol\row\col\zerocount}% - \doifnottbltag\row\col{\lettbltag\row\col\tblnone}}}% + \tabl_ntb_loop_two % check and do - \ifcase\maximumcol\else + \ifcase\c_tabl_maximum_col\else \startTBLprocessing - \begTBL - \dorecurse\maximumrow - {\bTBL - \row\recurselevel\relax - \dorecurse\maximumcol - {\col\recurselevel\relax - \normalexpanded{\noexpand\doTBL{\number\row}{\number\col}}}% - \eTBL}% + \tabl_ntb_table_start + \dorecurse\c_tabl_maximum_row + {\tabl_ntb_row_start + \c_tabl_ntb_current_row\recurselevel\relax + \dorecurse\c_tabl_maximum_col + {\c_tabl_ntb_current_col\recurselevel\relax + \normalexpanded{\tabl_ntb_cell{\the\c_tabl_ntb_current_row}{\the\c_tabl_ntb_current_col}}}% + \tabl_ntb_row_stop}% \removeunwantedspaces % only if hmode - \endTBL + \tabl_ntb_table_stop \stopTBLprocessing % wrong ! ! ! better to have an auto-offset-overlay - % \ifnum\TBLlevel>1 + % \ifnum\m_tabl_tbl_level>1 % \vskip-\strutdp % \fi \fi % tracing % \iftrue % \blank \tttf - % \dorecurse\maximumrow - % {\row\recurselevel\relax - % \dorecurse\maximumcol - % {\col\recurselevel\relax - % [r=\the\row,c=\the\col,h=\the\dimexpr\gettblht\row\col,w=\the\dimexpr\gettblwd\row\col]}% + % \dorecurse\c_tabl_maximum_row + % {\c_tabl_ntb_current_row\recurselevel\relax + % \dorecurse\c_tabl_maximum_col + % {\c_tabl_ntb_current_col\recurselevel\relax + % [r=\the\c_tabl_ntb_current_row,c=\the\c_tabl_ntb_current_col,h=\the\dimexpr\tabl_ntb_get_ht\c_tabl_ntb_current_row\c_tabl_ntb_current_col,w=\the\dimexpr\tabl_ntb_get_wd\c_tabl_ntb_current_row\c_tabl_ntb_current_col]}% % \par}% % \blank % \fi \egroup - \popTBL} + \tabl_ntb_table_pop} + +\def\tabl_ntb_loop_one + {\dorecurse\c_tabl_maximum_row{\tabl_ntb_loop_one_rows}} + +\def\tabl_ntb_loop_one_rows + {\c_tabl_ntb_current_row\recurselevel\relax + \dorecurse\c_tabl_maximum_col\tabl_ntb_loop_one_cells} + +\def\tabl_ntb_loop_one_cells + {\c_tabl_ntb_current_col\recurselevel\relax + \ifcsname\tabl_ntb_tag_pattern\c_tabl_ntb_current_row\c_tabl_ntb_current_col\endcsname \else + \tabl_ntb_loop_one_cells_indeed + \fi} + +\def\tabl_ntb_loop_one_cells_indeed + {\c_tabl_ntb_current_col_two\c_tabl_ntb_current_col + \c_tabl_ntb_current_row_two\c_tabl_ntb_current_row + \c_tabl_ntb_current_row_one\c_tabl_ntb_current_row + \doloop + {\c_tabl_ntb_current_col_one\c_tabl_ntb_current_col + \doloop + {\ifcsname\tabl_ntb_tag_pattern\c_tabl_ntb_current_row_one\c_tabl_ntb_current_col_one\endcsname + \exitloop + \else + \advance\c_tabl_ntb_current_col_one\plusone + \ifnum\c_tabl_ntb_current_col_one>\c_tabl_maximum_col\relax + \exitloop + \fi + \fi}% + \ifcsname\tabl_ntb_tag_pattern\c_tabl_ntb_current_row_one\c_tabl_ntb_current_col_one\endcsname + \exitloop + \else + \c_tabl_ntb_current_row_two\c_tabl_ntb_current_row_one + \c_tabl_ntb_current_col_two\c_tabl_ntb_current_col_one + \advance\c_tabl_ntb_current_row_one\plusone + \ifnum\c_tabl_ntb_current_row_one>\c_tabl_maximum_row + \exitloop + \fi + \fi}% + \ifnum\c_tabl_ntb_current_row_two>\c_tabl_maximum_row\c_tabl_ntb_current_row_two\c_tabl_maximum_row\fi + \ifnum\c_tabl_ntb_current_col_two>\c_tabl_maximum_col\c_tabl_ntb_current_col_two\c_tabl_maximum_col\fi + \c_tabl_ntb_current_row_two\numexpr\c_tabl_ntb_current_row_two-\c_tabl_ntb_current_row+\plusone\relax + \c_tabl_ntb_current_col_two\numexpr\c_tabl_ntb_current_col_two-\c_tabl_ntb_current_col+\plusone\relax + \c_tabl_ntb_current_row_one\c_tabl_ntb_current_row + \dorecurse\c_tabl_ntb_current_row_two + {\c_tabl_ntb_current_col_one\c_tabl_ntb_current_col + \tabl_ntb_set_col\c_tabl_ntb_current_row_one\c_tabl_ntb_current_col_one{\the\c_tabl_ntb_current_col_two}% + \dorecurse\c_tabl_ntb_current_col_two + {\tabl_ntb_let_tag\c_tabl_ntb_current_row_one\c_tabl_ntb_current_col_one\c_tabl_ntb_none + \advance\c_tabl_ntb_current_col_one\plusone}% + \advance\c_tabl_ntb_current_row_one\plusone}% + \tabl_ntb_let_tag\c_tabl_ntb_current_row\c_tabl_ntb_current_col\c_tabl_ntb_cell + \tabl_ntb_set_col\c_tabl_ntb_current_row\c_tabl_ntb_current_col{\the\c_tabl_ntb_current_col_two}% + \tabl_ntb_set_row\c_tabl_ntb_current_row\c_tabl_ntb_current_col{\the\c_tabl_ntb_current_row_two}% + \ifautoTBLemptycell + \normalexpanded + {\tabl_ntb_set_txt_process\c_tabl_ntb_current_row\c_tabl_ntb_current_col{\the\c_tabl_ntb_current_row}{\the\c_tabl_ntb_current_col}}% + {}{\strut}% + \fi} + +\def\tabl_ntb_loop_two + {\dorecurse\c_tabl_maximum_row\tabl_ntb_loop_two_rows} + +\def\tabl_ntb_loop_two_rows + {\c_tabl_ntb_current_row\recurselevel\relax + \dorecurse\c_tabl_maximum_col\tabl_ntb_loop_two_cells} + +\def\tabl_ntb_loop_two_cells + {\c_tabl_ntb_current_col\recurselevel\relax + \ifcsname\tabl_ntb_row_pattern\c_tabl_ntb_current_row\c_tabl_ntb_current_col\endcsname + \scratchcounter\numexpr\c_tabl_maximum_row-\c_tabl_ntb_current_row+\plusone\relax + \ifnum\tabl_ntb_get_row\c_tabl_ntb_current_row\c_tabl_ntb_current_col>\scratchcounter + \tabl_ntb_set_row\c_tabl_ntb_current_row\c_tabl_ntb_current_col{\the\scratchcounter}% + \fi + \fi + \tabl_ntb_let_ht\c_tabl_ntb_current_row\c_tabl_ntb_current_col\zeropoint + \tabl_ntb_let_wd\c_tabl_ntb_current_row\c_tabl_ntb_current_col\zeropoint + \ifcsname\tabl_ntb_col_pattern\c_tabl_ntb_current_row\c_tabl_ntb_current_col\endcsname \else + \tabl_ntb_let_col\c_tabl_ntb_current_row\c_tabl_ntb_current_col\zerocount + \fi + \ifcsname\tabl_ntb_tag_pattern\c_tabl_ntb_current_row\c_tabl_ntb_current_col\endcsname \else + \tabl_ntb_let_tag\c_tabl_ntb_current_row\c_tabl_ntb_current_col\c_tabl_ntb_none + \fi} -\let\startTBLprocessing\relax -\let\stopTBLprocessing \relax +\let\startTBLprocessing\relax % public +\let\stopTBLprocessing \relax % public -\newcount\prelocatedTBLrows % \prelocateTBLrows{1000} may speed up large tables +\newcount\c_tabl_prelocated_rows % \prelocateTBLrows{1000} may speed up large tables -\def\bTBL{\tblrowtoks\emptytoks} -\def\eTBL{\tbltoks\@EA\@EA\@EA{\@EA\the\@EA\tbltoks\@EA\begintblrow\the\tblrowtoks\endtblrow}}% +\def\tabl_ntb_row_start{\t_tabl_ntb_row\emptytoks} +\def\tabl_ntb_row_stop {\normalexpanded{\t_tabl_ntb{\the\t_tabl_ntb\noexpand\tabl_ntb_row_align_start\the\t_tabl_ntb_row\tabl_ntb_row_align_stop}}} -\def\prelocateTBLerror - {\writestatus\m!system{fatal error: use \string\prelocateTBLrows\space to increase table memory (now: \number\prelocatedTBLrows)}} +\def\tabl_ntb_prelocate_error + {\writestatus\m!system{fatal error: use \string\prelocateTBLrows\space to increase table memory (now: \the\c_tabl_prelocated_rows)}} \def\prelocateTBLrows#1% we start at zero so we have one to much, better play safe anyway - {\dostepwiserecurse\prelocatedTBLrows{#1}\plusone{\expandafter\newtoks\csname tbl:\recurselevel\endcsname}% - \def\bTBL - {\ifnum\tblrow<\prelocatedTBLrows\relax - \@EA\let\@EA\tblrowtoks\csname tbl:\the\tblrow\endcsname\tblrowtoks\emptytoks + {\dostepwiserecurse\c_tabl_prelocated_rows{#1}\plusone{\expandafter\newtoks\csname tbl:\recurselevel\endcsname}% + \def\tabl_ntb_row_stop + {\ifnum\c_tabl_ntb_row<\c_tabl_prelocated_rows\relax + \expandafter\let\expandafter\t_tabl_ntb_row\csname tbl:\the\c_tabl_ntb_row\endcsname\t_tabl_ntb_row\emptytoks \else - \prelocateTBLerror + \tabl_ntb_prelocate_error \fi}% - \def\eTBL - {\tbltoks\@EA\@EA\@EA{\@EA\the\@EA\tbltoks\@EA\begintblrow\@EA\the\csname tbl:\the\tblrow\endcsname\endtblrow}}% - \global\prelocatedTBLrows#1\relax} + \def\tabl_ntb_row_stop + {\normalexpanded{\t_tabl_ntb{\the\t_tabl_ntb\noexpand\tabl_ntb_row_align_start\the\csname tbl:\the\c_tabl_ntb_row\endcsname\tabl_ntb_row_align_stop}}}% + \global\c_tabl_prelocated_rows#1\relax} % \prelocateTBLrows{1000} % may speed up large tables % We use aligments to handle the empty (skipped) columns, so % that we don't have to (re|)|calculate these. -\def\skiptblcol - {\global\advance\tblcol\plusone} +\def\tabl_ntb_column_skip + {\global\advance\c_tabl_ntb_col\plusone} -\def\nexttblcol - {\global\advance\tblcol\plusone - \kern\tbltblcolumndistance - &} +\def\tabl_ntb_column_next + {\global\advance\c_tabl_ntb_col\plusone + \kern\naturaltablelocalparameter\c!columndistance + \aligntab} -\def\spantblcol +\def\tabl_ntb_column_span {\span} -\newcount\tblrow -\newcount\tblcol +\let\m_tabl_ntb_saved_row\!!zerocount +\let\m_tabl_ntb_saved_col\!!zerocount -\let\savedtblrow\!!zerocount -\let\savedtblcol\!!zerocount +\def\tabl_ntb_row_align_start + {\noalign{\tabl_ntb_row_align_reset}% + \tabl_ntb_column_next + \kern\dimexpr\naturaltablelocalparameter\c!leftmargindistance-\naturaltablelocalparameter\c!columndistance\relax} -\def\begintblrow - {\noalign - {\global\advance\tblrow\plusone - \global\tblcol\zerocount - \global\tblspn\zerocount}% - % \iftrue - % \bgroup\tbox{\tttf[\number\tblrow]}\egroup - % \fi - \nexttblcol - \kern\dimexpr\tbltblleftmargindistance-\tbltblcolumndistance\relax} +\unexpanded\def\tabl_ntb_row_align_reset + {\global\advance\c_tabl_ntb_row\plusone + \global\c_tabl_ntb_col\zerocount + \global\c_tabl_ntb_spn\zerocount} -\def\endtblrow - {\kern\dimexpr\tbltblrightmargindistance-\tbltblcolumndistance\relax +\unexpanded\def\tabl_ntb_row_align_stop + {\kern\dimexpr\naturaltablelocalparameter\c!rightmargindistance-\naturaltablelocalparameter\c!columndistance\relax \crcr \noalign {\nointerlineskip - \ifnum\tblrow>\noftblheadlines - \ifnum\gettblnob\tblrow=\zerocount + \ifnum\c_tabl_ntb_row>\c_tabl_ntb_n_of_head_lines + \ifnum\tabl_ntb_get_nob\c_tabl_ntb_row=\zerocount \allowbreak \fi \else \allowbreak % else no proper head split off \fi \bgroup % protect local vars - \@@tblsplitafter + \m_tabl_ntb_after_split \egroup \bgroup % protect local vars - \scratchcounter\numexpr\tblrow+\plusone\relax - \ifnum\scratchcounter>\noftblhdnxlines\relax - \ifnum\scratchcounter<\maximumrow\relax - \doifsomething\tbltblspaceinbetween{\blank[\tbltblspaceinbetween]}% + \scratchcounter\numexpr\c_tabl_ntb_row+\plusone\relax + \ifnum\scratchcounter>\c_tabl_ntb_n_of_hdnx_lines\relax + \ifnum\scratchcounter<\c_tabl_maximum_row\relax + \doifsomething{\naturaltablelocalparameter\c!spaceinbetween} + {\blank[\naturaltablelocalparameter\c!spaceinbetween]}% \fi \fi \egroup}} -\def\begintbl - {\global\tblspn\zerocount - \global\tblcol\zerocount - \global\tblrow\zerocount - \global\advance\tblrow\minusone +\def\tabl_ntb_flush_content + {\the\everyTABLEpass + \global\c_tabl_ntb_spn\zerocount + \global\c_tabl_ntb_col\zerocount + \global\c_tabl_ntb_row\zerocount + \global\advance\c_tabl_ntb_row\minusone \tabskip\zeropoint \dostarttagged\t!table\empty \dostarttagged\t!tablerow\empty \appendtoks\dostoptagged\dostarttagged\t!tablerow\empty\to\everycr \halign\bgroup - \registerparoptions - % watch out: tagging the cell happens at the outer level (faster) -% \ignorespaces##\unskip&&\dostarttagged\t!tablecell\empty\ignorespaces##\unskip\dostoptagged\cr} % one too many - \ignorespaces##\unskip&&\ignorespaces##\unskip\cr} % one too many - -\def\endtbl - {\dostoptagged + \registerparoptions + % watch out: tagging the cell happens at the outer level (faster) + \ignorespaces##\unskip&&\ignorespaces##\unskip\cr % one too many + \the\t_tabl_ntb + \dostoptagged \egroup \dostoptagged} -\setvalue{\tblnone TBL}#1#2% - {\spanTBL{#1}{#2}} +\setvalue{\??naturaltablecell\the\c_tabl_ntb_none}#1#2% + {\tabl_ntb_span{#1}{#2}} -\setvalue{\tblcell TBL}#1#2% - {\tblrowtoks\expandafter{\the\tblrowtoks\makeTBL #1 #2 }% space delimited -> less tokens - \spanTBL{#1}{#2}} +\setvalue{\??naturaltablecell\the\c_tabl_ntb_cell}#1#2% + {\t_tabl_ntb_row\expandafter{\the\t_tabl_ntb_row\tabl_ntb_pass #1 #2 }% space delimited -> less tokens + \tabl_ntb_span{#1}{#2}} -\def\spanTBL#1#2% - {\scratchcounter\gettblcol{#1}{#2}\relax +\def\tabl_ntb_span#1#2% + {\scratchcounter\tabl_ntb_get_col{#1}{#2}\relax \ifnum\scratchcounter>\zerocount \advance\scratchcounter \minusone - \dorecurse\scratchcounter{\tblrowtoks\expandafter{\the\tblrowtoks\spantblcol}}% - \dorecurse\scratchcounter{\tblrowtoks\expandafter{\the\tblrowtoks\skiptblcol}}% - \tblrowtoks\expandafter{\the\tblrowtoks\nexttblcol}% + \dorecurse\scratchcounter{\t_tabl_ntb_row\expandafter{\the\t_tabl_ntb_row\tabl_ntb_column_span}}% + \dorecurse\scratchcounter{\t_tabl_ntb_row\expandafter{\the\t_tabl_ntb_row\tabl_ntb_column_skip}}% + \t_tabl_ntb_row\expandafter{\the\t_tabl_ntb_row\tabl_ntb_column_next}% \fi} -\def\doTBL#1#2% - {\csname\gettbltag{#1}{#2}TBL\endcsname{#1}{#2}} +\unexpanded\def\tabl_ntb_cell#1#2% + {\csname\??naturaltablecell\the\tabl_ntb_get_tag{#1}{#2}\endcsname{#1}{#2}} -\def\begTBL - {\global\tblspn\zerocount - \global\tblrow\zerocount - \global\tblcol\zerocount - \tblpass\zerocount - \tbltoks\emptytoks} +\unexpanded\def\tabl_ntb_table_start + {\global\c_tabl_ntb_spn\zerocount + \global\c_tabl_ntb_row\zerocount + \global\c_tabl_ntb_col\zerocount + \c_tabl_tbl_pass\zerocount + \t_tabl_ntb\emptytoks} -\newtoks\everyTABLEpass +\def\tabl_ntb_pass_one#1 #2 % + {\tabl_ntb_get_txt{#1}{#2}}% -\def\flushtbltoks - {\the\everyTABLEpass - \begintbl - \the\tbltoks - \endtbl} - -\def\domakeTBLone#1 #2 % - {\gettbltxt{#1}{#2}}% - -\def\domakeTBLtwo#1 #2 % meer in cellD - {\scratchdimen\zeropoint - \scratchcounter\tblcol - \!!counta\gettblcol{#1}{#2}\relax +\def\tabl_ntb_pass_two#1 #2 % meer in cellD + {\d_tabl_ntb_width\zeropoint + \scratchcounter\c_tabl_ntb_col + \!!counta\tabl_ntb_get_col{#1}{#2}\relax \dorecurse\!!counta - {\advance\scratchdimen\dimexpr\gettblwid\scratchcounter+\tbltblcolumndistance\relax - \ifnum\recurselevel<\!!counta \advance\scratchdimen \gettbldis\scratchcounter\fi + {\advance\d_tabl_ntb_width\dimexpr + \tabl_ntb_get_wid\scratchcounter + +\naturaltablelocalparameter\c!columndistance + \ifnum\recurselevel<\!!counta + \tabl_ntb_get_dis\scratchcounter + \fi + \relax \advance\scratchcounter\plusone}% - \edef\widthTBL{\the\dimexpr\scratchdimen-\tbltblcolumndistance\relax}% - \setbox\scratchbox\hbox{\gettbltxt{#1}{#2}}% - \settblht{#1}{#2}{\the\ht\scratchbox}% - \settblwd{#1}{#2}{\the\wd\scratchbox}% - \ifdim\ht\scratchbox>\gettblhei{#1}\relax - \settblhei{#1}{\the\ht\scratchbox}% + \advance\d_tabl_ntb_width-\naturaltablelocalparameter\c!columndistance\relax + \setbox\scratchbox\hbox{\tabl_ntb_get_txt{#1}{#2}}% + \tabl_ntb_set_ht{#1}{#2}{\the\ht\scratchbox}% + \tabl_ntb_set_wd{#1}{#2}{\the\wd\scratchbox}% + \ifdim\ht\scratchbox>\tabl_ntb_get_hei{#1}\relax + \tabl_ntb_set_hei{#1}{\the\ht\scratchbox}% \fi}% -\newcount\tablecellrows -\newcount\tablecellcolumns - -\def\domakeTBLthree#1 #2 % +\def\tabl_ntb_pass_three#1 #2 % {% height \dostarttagged\t!tablecell\empty - \!!counta \gettblcol{#1}{#2}\relax - \!!countb \gettblrow{#1}{#2}\relax - \!!heighta\gettblht {#1}{#2}\relax + \!!counta \tabl_ntb_get_col{#1}{#2}\relax + \!!countb \tabl_ntb_get_row{#1}{#2}\relax + \!!heighta\tabl_ntb_get_ht {#1}{#2}\relax \tablecellcolumns\!!counta % used later so don't adapt these \tablecellrows \!!countb % used later so don't adapt these - \scratchdimen\zeropoint - \ifnum\!!counta=\maximumcol\relax + \d_tabl_ntb_height\zeropoint + \ifnum\!!counta=\c_tabl_maximum_col\relax % case: nc=maxcolumns \else \scratchcounter#1\relax \dorecurse\!!countb - {\advance\scratchdimen\gettblhei\scratchcounter + {\advance\d_tabl_ntb_height\tabl_ntb_get_hei\scratchcounter \advance\scratchcounter\plusone}% - \ifdim\scratchdimen<\!!heighta\relax - \scratchdimen\!!heighta + \ifdim\d_tabl_ntb_height<\!!heighta\relax + \d_tabl_ntb_height\!!heighta \fi \fi - \edef\heightTBL{\the\scratchdimen}% % width - \scratchdimen\zeropoint - \scratchcounter\tblcol + \d_tabl_ntb_width\zeropoint + \scratchcounter\c_tabl_ntb_col \dorecurse\!!counta - {\advance\scratchdimen\dimexpr\gettblwid\scratchcounter+\tbltblcolumndistance\relax - \ifnum\recurselevel<\!!counta \advance\scratchdimen \gettbldis\scratchcounter\fi + {\advance\d_tabl_ntb_width\dimexpr\tabl_ntb_get_wid\scratchcounter+\naturaltablelocalparameter\c!columndistance\relax + \ifnum\recurselevel<\!!counta \advance\d_tabl_ntb_width \tabl_ntb_get_dis\scratchcounter\fi \advance\scratchcounter\plusone}% - \edef\widthTBL{\the\dimexpr\scratchdimen-\tbltblcolumndistance\relax}% + \advance\d_tabl_ntb_width-\naturaltablelocalparameter\c!columndistance\relax % cell \setbox\scratchbox\hbox attr \taggedattribute \attribute\taggedattribute \bgroup \dotagTABLEsignal % maybe we need to add some packaging in this case - \gettbltxt{#1}{#2}% + \tabl_ntb_get_txt{#1}{#2}% \egroup - \ifnum\!!counta=\maximumcol\relax + \ifnum\!!counta=\c_tabl_maximum_col\relax % case: nc=maxcolumns \else - \scratchdimen\gettblhei{#1}% + \scratchdimen\tabl_ntb_get_hei{#1}% \setbox\scratchbox\hbox {\lower\ht\scratchbox\hbox{\raise\scratchdimen\box\scratchbox}}% \ht\scratchbox\scratchdimen \fi \dp\scratchbox\zeropoint - \edef\!!stringa{\gettblref{#1}{#2}}% + \edef\!!stringa{\tabl_ntb_get_ref{#1}{#2}}% \ifx\!!stringa\empty \box\scratchbox \else @@ -1064,108 +1225,103 @@ \fi \dostoptagged} % right spot -\def\inTBLcell#1#2% hm, do we need #1 #2 ? we use tblcol anyway +\def\tabl_tnb_cell_finalize {\doifnotinset\localwidth{\v!fit,\v!broad}% user set - {\scratchdimen\gettblaut\tblcol\relax + {\scratchdimen\tabl_ntb_get_aut\c_tabl_ntb_col\relax \ifdim\localwidth>\scratchdimen - \settblaut\tblcol{\the\dimexpr\localwidth\relax}% + \tabl_ntb_set_aut\c_tabl_ntb_col{\the\dimexpr\localwidth\relax}% \fi}}% -\def\endTBL +\def\tabl_ntb_table_stop {\setbox\scratchbox\hbox - {\localframed - [\@@tbl\@@tbl] - [\c!frame=\v!off,\c!background=,\c!align=\v!no] - {\strut}}% - \edef\minimalcellheight{\the\ht\scratchbox}% - \dorecurse\maximumcol - {\lettblaut\recurselevel\zeropoint + {\setupcurrentnaturaltablelocal[\c!frame=\v!off,\c!background=,\c!align=\v!no]% + \inheritednaturaltablelocalframed{\strut}}% + \edef\minimalcellheight{\the\ht\scratchbox}% not used + \dorecurse\c_tabl_maximum_col + {\tabl_ntb_let_aut\recurselevel\zeropoint % new - \xcol\recurselevel\relax - \dorecurse\maximumrow - {\lettblwd\recurselevel\xcol\zeropoint - \lettblht\recurselevel\xcol\zeropoint}% + \c_tabl_ntb_current_col_one\recurselevel\relax + \dorecurse\c_tabl_maximum_row + {\tabl_ntb_let_wd\recurselevel\c_tabl_ntb_current_col_one\zeropoint + \tabl_ntb_let_ht\recurselevel\c_tabl_ntb_current_col_one\zeropoint}% % till here - \lettblwid\recurselevel\zeropoint - \lettbldis\recurselevel\zeropoint}% - \dorecurse\maximumrow - {\lettblhei\recurselevel\maxdimen}% - \tblpass\plusone - \let\makeTBL\domakeTBLone - \let\handleTBLcell\dohandleTBLcellA - \setbox0\vbox{\settrialtypesetting \flushtbltoks}% -% \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% - \lettbldis\maximumcol\zeropoint + \tabl_ntb_let_wid\recurselevel\zeropoint + \tabl_ntb_let_dis\recurselevel\zeropoint}% + \dorecurse\c_tabl_maximum_row + {\tabl_ntb_let_hei\recurselevel\maxdimen}% + \c_tabl_tbl_pass\plusone + \let\tabl_ntb_pass\tabl_ntb_pass_one + \let\tabl_ntb_cell_process\tabl_ntb_cell_process_a + \setbox0\vbox{\settrialtypesetting \tabl_ntb_flush_content}% + \tabl_ntb_let_dis\c_tabl_maximum_col\zeropoint \ifautoTBLspread % experimental, stretch non fixed cells to \hsize - \checktblwidthsone % trial run - \checktblwidthstwo % real run - \stretchtblwidths - \let\handleTBLcell\dohandleTBLcellB - \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% + \tabl_ntb_check_widths_one % trial run + \tabl_ntb_check_widths_two % real run + \tabl_ntb_stretch_widths + \let\tabl_ntb_cell_process\tabl_ntb_cell_process_b + \setbox\scratchbox\vbox{\settrialtypesetting \tabl_ntb_flush_content}% \else\ifdim\wd0>\hsize \ifautoTBLhsize - \checktblwidthsone % trial run - \checktblwidthstwo % real run - \let\handleTBLcell\dohandleTBLcellB - \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% + \tabl_ntb_check_widths_one % trial run + \tabl_ntb_check_widths_two % real run + \let\tabl_ntb_cell_process\tabl_ntb_cell_process_b + \setbox\scratchbox\vbox{\settrialtypesetting \tabl_ntb_flush_content}% \fi - \else\ifautoTBLrowspan\ifnum\maximumrowspan>1 % max ? + \else\ifautoTBLrowspan\ifnum\c_tabl_maximum_row_span>1 % max ? % added jan 2002 because nx=* did no longer work \edef\savedhsize{\the\hsize}% \hsize\wd0\relax % new per 17/04/2006 - \checktblwidthsone % trial run - \checktblwidthstwo % real run + \tabl_ntb_check_widths_one % trial run + \tabl_ntb_check_widths_two % real run \hsize\savedhsize % - \let\handleTBLcell\dohandleTBLcellC - \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% + \let\tabl_ntb_cell_process\tabl_ntb_cell_process_c + \setbox\scratchbox\vbox{\settrialtypesetting \tabl_ntb_flush_content}% \fi\fi\fi\fi - \let\handleTBLcell\dohandleTBLcellD - \tblpass\plustwo - \let\makeTBL\domakeTBLtwo - \setbox\scratchbox\vbox{\settrialtypesetting \flushtbltoks}% - \checktblheightsone - \checktblheightstwo - \let\handleTBLcell\dohandleTBLcellE - \tblpass\plusthree - \let\makeTBL\domakeTBLthree - \ifnum\TBLlevel>\plusone - \@EA\notsplittblbox + \let\tabl_ntb_cell_process\tabl_ntb_cell_process_d + \c_tabl_tbl_pass\plustwo + \let\tabl_ntb_pass\tabl_ntb_pass_two + \setbox\scratchbox\vbox{\settrialtypesetting \tabl_ntb_flush_content}% + \tabl_ntb_check_heights_one + \tabl_ntb_check_heights_two + \let\tabl_ntb_cell_process\tabl_ntb_cell_process_e + \c_tabl_tbl_pass\plusthree + \let\tabl_ntb_pass\tabl_ntb_pass_three + \ifnum\m_tabl_tbl_level>\plusone + \expandafter\tabl_tbl_split_nop \else\ifenableTBLbreak - \@EAEAEA\splittblbox + \doubleexpandafter\tabl_tbl_split_yes \else - \@EAEAEA\notsplittblbox - \fi\fi{\flushtbltoks}} + \doubleexpandafter\tabl_tbl_split_nop + \fi\fi{\tabl_ntb_flush_content}} -\def\stretchtblwidths % more variants, e.g. a max to \dimend - {\ifcase\maximumcol\else % else division by zero +\def\tabl_ntb_stretch_widths % more variants, e.g. a max to \dimend + {\ifcase\c_tabl_maximum_col\else % else division by zero \!!dimend\zeropoint \!!dimene\hsize - \dorecurse\maximumcol - {\advance\!!dimend\dimexpr\gettblwid\recurselevel+\tbltblcolumndistance\relax - \advance\!!dimene-\gettbldis\recurselevel}% - \advance\!!dimend\dimexpr-\tbltblcolumndistance+\tbltblleftmargindistance+\tbltblrightmargindistance\relax + \dorecurse\c_tabl_maximum_col + {\advance\!!dimend\dimexpr\tabl_ntb_get_wid\recurselevel+\naturaltablelocalparameter\c!columndistance\relax + \advance\!!dimene-\tabl_ntb_get_dis\recurselevel}% + \advance\!!dimend\dimexpr-\naturaltablelocalparameter\c!columndistance+\naturaltablelocalparameter\c!leftmargindistance+\naturaltablelocalparameter\c!rightmargindistance\relax % distribute width (stretch) \ifdim\!!dimend<\!!dimene \advance\!!dimend-\!!dimene \!!dimend-\!!dimend - \divide\!!dimend\maximumcol - \dorecurse\maximumcol - {\settblwid\recurselevel{\the\dimexpr\gettblwid\recurselevel+\!!dimend\relax}}% + \divide\!!dimend\c_tabl_maximum_col + \dorecurse\c_tabl_maximum_col + {\tabl_ntb_set_wid\recurselevel{\the\dimexpr\tabl_ntb_get_wid\recurselevel+\!!dimend\relax}}% \fi \fi} -\newbox\finaltblbox - -\def\notsplittblbox#1% - {\setbox\finaltblbox\vbox{#1}% - \postprocessTABLEbox\finaltblbox +\def\tabl_tbl_split_nop#1% + {\setbox\b_tabl_ntb_final\vbox{#1}% + \postprocessTABLEbox\b_tabl_ntb_final \beforeTABLEbox - \box\finaltblbox + \box\b_tabl_ntb_final \afterTABLEbox} -\def\splittblbox#1% +\def\tabl_tbl_split_yes % #1 {\ifinsidesplitfloat \donetrue \else\ifinsidefloat @@ -1174,33 +1330,33 @@ \donetrue \fi\fi \ifdone - \executeifdefined{dosplittblbox\tbltblsplitmethod}\dosplittblbox{#1}% + \expandafter\tabl_ntb_split_box \else - \notsplittblbox{#1}% + \expandafter\tabl_tbl_split_nop \fi} \newbox\TABLEsplitbox % public, don't change \let\extratblsplitheight\zeropoint % additional space taken by before/afterTABLEsplitbox -\def\dosplittblbox#1% +\def\tabl_ntb_split_box#1% {\resettsplit \def\tsplitminimumfreelines{2}% - \def\tsplitminimumfreespace{\dimexpr\extratblsplitheight+\tbltblsplitoffset\relax}% + \def\tsplitminimumfreespace{\dimexpr\extratblsplitheight+\naturaltablelocalparameter\c!splitoffset\relax}% \def\tsplitbeforeresult {\beforeTABLEsplitbox}% \def\tsplitafterresult {\afterTABLEsplitbox}% - \def\tsplitafter {\@@tblsplitafter}% + \def\tsplitafter {\m_tabl_ntb_after_split}% \setbox\tsplitcontent\vbox{#1}% \ifmultipleTBLheads - \dorecurse\noftblheadlines + \dorecurse\c_tabl_ntb_n_of_head_lines {\setbox\scratchbox\vsplit\tsplitcontent to \lineheight \setbox\tsplithead\vbox{\unvcopy\tsplithead\unvcopy\scratchbox}}% - \dorecurse\noftblnextlines + \dorecurse\c_tabl_ntb_n_of_next_lines {\setbox\scratchbox\vsplit\tsplitcontent to \lineheight \setbox\tsplitnext\vbox{\unvcopy\tsplitnext\unvcopy\scratchbox}}% \fi - \doifsomething\tbltblspaceinbetween - {\def\tsplitinbetween{\blank[\tbltblspaceinbetween]}}% + \doifsomething{\naturaltablelocalparameter\c!spaceinbetween} + {\def\tsplitinbetween{\blank[\naturaltablelocalparameter\c!spaceinbetween]}}% \def\postprocesstsplit{\postprocessTABLEsplitbox{\box\tsplitresult}}% \handletsplit} @@ -1214,22 +1370,22 @@ \let\beforeTABLEbox \relax \let\afterTABLEbox \relax -\def\checktblwidthsone{\dochecktblwidths0} % 0 = trial run -\def\checktblwidthstwo{\dochecktblwidths1} % 1 = real run +\def\tabl_ntb_check_widths_one{\tabl_ntb_check_widths_indeed0} % 0 = trial run +\def\tabl_ntb_check_widths_two{\tabl_ntb_check_widths_indeed1} % 1 = real run -\def\dochecktblwidths#1% - {\iftraceTABLE\showtblwids{B#1}\fi +\def\tabl_ntb_check_widths_indeed#1% + {\iftraceTABLE\tabl_ntb_show_widths{B#1}\fi \!!counta\zerocount - \!!dimena\dimexpr\hsize-\tbltblleftmargindistance-\tbltblrightmargindistance-\tbltblcolumndistance\relax - \dorecurse\maximumcol - {\scratchdimen\gettblaut\recurselevel\relax - \advance\!!dimena-\gettbldis\recurselevel\relax + \!!dimena\dimexpr\hsize-\naturaltablelocalparameter\c!leftmargindistance-\naturaltablelocalparameter\c!rightmargindistance-\naturaltablelocalparameter\c!columndistance\relax + \dorecurse\c_tabl_maximum_col + {\scratchdimen\tabl_ntb_get_aut\recurselevel\relax + \advance\!!dimena-\tabl_ntb_get_dis\recurselevel\relax \ifdim\scratchdimen>\zeropoint\relax \advance\!!dimena -\scratchdimen \else - \scratchdimen\gettblwid\recurselevel\relax - \ifdim\scratchdimen>\tbltblmaxwidth\relax - \ifcase#1\else\lettblwid\recurselevel\zeropoint\fi + \scratchdimen\tabl_ntb_get_wid\recurselevel\relax + \ifdim\scratchdimen>\naturaltablelocalparameter\c!maxwidth\relax + \ifcase#1\else\tabl_ntb_let_wid\recurselevel\zeropoint\fi \advance\!!counta \plusone \else \ifdim\scratchdimen>\zeropoint\relax @@ -1242,163 +1398,157 @@ \fi \fi}% \ifcase\!!counta \else \divide\!!dimena \!!counta \fi - \dorecurse\maximumcol - {\scratchdimen\gettblwid\recurselevel\relax + \dorecurse\c_tabl_maximum_col + {\scratchdimen\tabl_ntb_get_wid\recurselevel\relax \ifcase#1\relax \ifdim\scratchdimen<\!!dimena % take natural width - \settblaut\recurselevel{\the\scratchdimen}% + \tabl_ntb_set_aut\recurselevel{\the\scratchdimen}% \fi \else \ifdim\scratchdimen=\zeropoint % auto set width - \settblwid\recurselevel{\the\!!dimena}% + \tabl_ntb_set_wid\recurselevel{\the\!!dimena}% \fi \fi}% - \iftraceTABLE\showtblwids{E#1}\fi} - -\newcount\xrowTBL -\newcount\xcolTBL -\newcount\xxrowTBL - -% dikke arg naar recurse wegwerken + \iftraceTABLE\tabl_ntb_show_widths{E#1}\fi} -\def\dochecktblheightsone - {\!!countb\gettblrow\xrowTBL\xcolTBL\relax +\def\tabl_ntb_check_heights_one_indeed + {\!!countb\tabl_ntb_get_row\c_tabl_ntb_current_row_three\c_tabl_ntb_current_col_three\relax % check row span \ifnum\!!countb>\plusone % current height in row - \dimen0=\gettblht\xrowTBL\xcolTBL + \dimen0=\tabl_ntb_get_ht\c_tabl_ntb_current_row_three\c_tabl_ntb_current_col_three % find nearest height in row \dimen2=\zeropoint - \dorecurse\maximumcol - {\ifnum\recurselevel=\xcolTBL\else - \doiftblrow\xrowTBL\recurselevel - {\!!countc=\gettblrow\xrowTBL\recurselevel\relax - \ifnum\!!countc=\plusone - \dimen4=\gettblht\xrowTBL\recurselevel\relax - \ifdim\dimen2<\dimen4 - \dimen2=\dimen4 - \fi - \fi}% + \dorecurse\c_tabl_maximum_col + {\ifnum\recurselevel=\c_tabl_ntb_current_col_three\else + \ifcsname\tabl_ntb_row_pattern\c_tabl_ntb_current_row_three\recurselevel\endcsname + \!!countc=\tabl_ntb_get_row\c_tabl_ntb_current_row_three\recurselevel\relax + \ifnum\!!countc=\plusone + \dimen4=\tabl_ntb_get_ht\c_tabl_ntb_current_row_three\recurselevel\relax + \ifdim\dimen2<\dimen4 + \dimen2=\dimen4 + \fi + \fi + \fi \fi}% - \xxrowTBL\xrowTBL + \c_tabl_ntb_current_row_four\c_tabl_ntb_current_row_three % calculate cummulative height \dimen4=\dimen2 - \!!countc\xrowTBL + \!!countc\c_tabl_ntb_current_row_three \advance\!!countc\minusone \dorecurse\!!countb - {\ifnum\xxrowTBL=\xrowTBL\else - \advance\dimen4 \gettblhei\xxrowTBL + {\ifnum\c_tabl_ntb_current_row_four=\c_tabl_ntb_current_row_three\else + \advance\dimen4 \tabl_ntb_get_hei\c_tabl_ntb_current_row_four \fi \ifnum\recurselevel=\!!countb\else - \settblnob\!!countc + \tabl_ntb_set_nob\!!countc \advance\!!countc\plusone \fi - \advance\xxrowTBL\plusone}% + \advance\c_tabl_ntb_current_row_four\plusone}% % distribute overshoot equally \ifdim\dimen2>\zeropoint % new: test on natural-003 \ifdim\dimen4<\dimen0 \advance\dimen0 -\dimen4 \divide\dimen0 \!!countb - \xxrowTBL\xrowTBL - \settblhei\xrowTBL{\the\dimen2}% + \c_tabl_ntb_current_row_four\c_tabl_ntb_current_row_three + \tabl_ntb_set_hei\c_tabl_ntb_current_row_three{\the\dimen2}% \dorecurse\!!countb - {\dorecurse\maximumcol - {\ifnum\recurselevel=\xcolTBL\else - \scratchdimen\dimexpr\gettblht\xxrowTBL\recurselevel+\dimen0\relax - \settblht\xxrowTBL\recurselevel{\the\scratchdimen}% - \ifdim\gettblhei\xxrowTBL<\scratchdimen - \settblhei\xxrowTBL{\the\scratchdimen}% + {\dorecurse\c_tabl_maximum_col + {\ifnum\recurselevel=\c_tabl_ntb_current_col_three\else + \scratchdimen\dimexpr\tabl_ntb_get_ht\c_tabl_ntb_current_row_four\recurselevel+\dimen0\relax + \tabl_ntb_set_ht\c_tabl_ntb_current_row_four\recurselevel{\the\scratchdimen}% + \ifdim\tabl_ntb_get_hei\c_tabl_ntb_current_row_four<\scratchdimen + \tabl_ntb_set_hei\c_tabl_ntb_current_row_four{\the\scratchdimen}% \fi \fi}% - \advance\xxrowTBL\plusone}% + \advance\c_tabl_ntb_current_row_four\plusone}% \else\ifdim\dimen4>\dimen0 \iftightTBLrowspan - \settblhei\xrowTBL{\the\dimen2}% + \tabl_ntb_set_hei\c_tabl_ntb_current_row_three{\the\dimen2}% \fi \fi\fi \fi \fi} -\def\checktblheightsone - {\dorecurse\maximumrow - {\xrowTBL\recurselevel\relax - \dorecurse\maximumcol - {\xcolTBL\recurselevel\relax - \doiftblrow\xrowTBL\xcolTBL\dochecktblheightsone}}} -\def\checktblheightstwo +\def\tabl_ntb_check_heights_one + {\dorecurse\c_tabl_maximum_row + {\c_tabl_ntb_current_row_three\recurselevel\relax + \dorecurse\c_tabl_maximum_col + {\c_tabl_ntb_current_col_three\recurselevel\relax + \ifcsname\tabl_ntb_row_pattern\c_tabl_ntb_current_row_three\c_tabl_ntb_current_col_three\endcsname + \tabl_ntb_check_heights_one_indeed + \fi}}} + +\def\tabl_ntb_check_heights_two {} -\def\showtblwids#1% +\def\tabl_ntb_show_widths#1% {\vbox - {\forgetall\tttf[#1]\dorecurse\maximumcol - {\scratchdimen\gettblwid\recurselevel\relax + {\forgetall\tttf[#1]\dorecurse\c_tabl_maximum_col + {\scratchdimen\tabl_ntb_get_wid\recurselevel\relax [\recurselevel:\the\scratchdimen]}}} -\def\TBLcharalign - {\doifelse\tbltblaligncharacter\v!yes - \doTBLcharalign\gobbleoneargument} +\def\tabl_ntb_char_align + {\doifelse{\naturaltablelocalparameter\c!aligncharacter}\v!yes + \tabl_ntb_char_align_indeed\gobbleoneargument} -\long\def\doTBLcharalign#1#2% column data +\def\tabl_ntb_char_align_indeed#1#2% column data {\edef\alignmentclass{#1}% - \edef\alignmentcharacter{\tbltblalignmentcharacter}% - \ifcase\tblpass\or + \edef\alignmentcharacter{\naturaltablelocalparameter\c!alignmentcharacter}% + \ifcase\c_tabl_tbl_pass\or \setfirstpasscharacteralign\checkalignment{#2}% {\strut#2\unskip}% \fi % force hsize, so always a second \setsecondpasscharacteralign \checkalignment{#2}% {\strut#2\unskip}% \ignorespaces} -% new, needed for icare first col of 'doeltabel', experimental - -\long\def\dohandleTBLcellA#1#2[#3]#4% grouping added ! ! ! +\unexpanded\def\tabl_ntb_cell_process_a#1#2[#3]#4% grouping added ! ! ! {\bgroup - \setupTBLcell{#1}{#2}% + \tabl_ntb_setup_cell{#1}{#2}% \setbox\scratchbox\hbox - {\scratchdimen\tbltbldistance\relax - \ifdim\scratchdimen>\gettbldis{#2}\relax - \settbldis{#2}{\the\scratchdimen}% + {\scratchdimen\naturaltablelocalparameter\c!distance\relax + \ifdim\scratchdimen>\tabl_ntb_get_dis{#2}\relax + \tabl_ntb_set_dis{#2}{\the\scratchdimen}% \fi - \localframed - [\@@tbl\@@tbl] - [#3,\c!background=,\c!frame=\v!off]% 25% faster - {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL\inTBLcell{#1}{#2}}}% - \scratchdimen\gettblwid\tblcol\relax + \setupcurrentnaturaltablelocal[#3,\c!background=,\c!frame=\v!off]% 25% faster + \inheritednaturaltablelocalframed{\tabl_tnb_cell_start\tabl_ntb_char_align{#2}{#4}\tabl_tnb_cell_stop\tabl_tnb_cell_finalize}}% + \scratchdimen\tabl_ntb_get_wid\c_tabl_ntb_col\relax \ifdim\wd\scratchbox>\scratchdimen \ifsqueezeTBLspan \ifautosqueezeTBLspan - \doifinsetelse\tbltblwidth{\v!fit,\v!fixed,\v!broad,\v!local} + \doifinsetelse{\naturaltablelocalparameter\c!width}{\v!fit,\v!fixed,\v!broad,\v!local} \donetrue \donefalse \else \donetrue \fi \ifdone % brr, 0 - \ifnum\number\gettblcol{#1}{#2}>\plusone \settblspn\tblcol\fi + \ifnum\tabl_ntb_get_col{#1}{#2}>\plusone \tabl_ntb_set_spn\c_tabl_ntb_col\fi \fi \fi - \doifelsetblspn\tblcol + \tabl_ntb_spn_doifelse\c_tabl_ntb_col \donothing - {\ifdim\gettblwid\tblcol<\wd\scratchbox - \settblwid\tblcol{\the\wd\scratchbox}% + {\ifdim\tabl_ntb_get_wid\c_tabl_ntb_col<\wd\scratchbox + \tabl_ntb_set_wid\c_tabl_ntb_col{\the\wd\scratchbox}% \fi}% auto set \fi - \scratchcounter\numexpr\tblrow+\plusone\relax - \scratchdimen\gettblhei\scratchcounter\relax + \scratchcounter\numexpr\c_tabl_ntb_row+\plusone\relax + \scratchdimen\tabl_ntb_get_hei\scratchcounter\relax \ifdim\ht\scratchbox<\scratchdimen - \settblhei\scratchcounter{\the\ht\scratchbox}% auto set + \tabl_ntb_set_hei\scratchcounter{\the\ht\scratchbox}% auto set \fi - \settblht{#1}{#2}{\the\ht\scratchbox}% - \settblwd{#1}{#2}{\the\wd\scratchbox}% + \tabl_ntb_set_ht{#1}{#2}{\the\ht\scratchbox}% + \tabl_ntb_set_wd{#1}{#2}{\the\wd\scratchbox}% \ifautoTBLcheckwidth \ifdim\wd\scratchbox<.75\hsize % fuzzy guess \ifdim\ht\scratchbox>2\openlineheight % honor width since this - \scratchdimen\gettblaut\tblcol\relax % can be a figure or so + \scratchdimen\tabl_ntb_get_aut\c_tabl_ntb_col\relax % can be a figure or so \ifdim\scratchdimen=\zeropoint % side effect: when width is set to 0pt, % we can force a span that fits the sum of spans widths - \settblaut\tblcol{\the\scratchdimen}% + \tabl_ntb_set_aut\c_tabl_ntb_col{\the\scratchdimen}% \else\ifdim\wd\scratchbox>\scratchdimen % unless span - \settblaut\tblcol{\the\wd\scratchbox}% + \tabl_ntb_set_aut\c_tabl_ntb_col{\the\wd\scratchbox}% % to be translated \writestatus\m!TABLE {no auto width in (\number#1,\number#2)\space\the\wd\scratchbox/\the\hsize}% @@ -1407,155 +1557,102 @@ \fi \fi \setbox2\emptyhbox - \wd2\wd\scratchbox \ht2\ht\scratchbox \dp2\dp\scratchbox + \wd2\wd\scratchbox + \ht2\ht\scratchbox + \dp2\dp\scratchbox \box2 \egroup} -\long\def\dohandleTBLcellBC#1#2#3[#4]#5% +\unexpanded\def\tabl_ntb_cell_process_b_c#1#2#3[#4]#5% {\setbox\scratchbox\hbox - {\setupTBLcell{#2}{#3}% - \localframed - [\@@tbl\@@tbl] - [#4,#1,\c!frame=\v!off,\c!background=] - {\bTBLCELL#5\eTBLCELL}}% + {\tabl_ntb_setup_cell{#2}{#3}% + \setupcurrentnaturaltablelocal[#4,#1,\c!frame=\v!off,\c!background=]% + \inheritednaturaltablelocalframed{\tabl_tnb_cell_start#5\tabl_tnb_cell_stop}}% \setbox2\emptyhbox - \wd2\wd\scratchbox \ht2\ht\scratchbox \dp2\dp\scratchbox + \wd2\wd\scratchbox + \ht2\ht\scratchbox + \dp2\dp\scratchbox \ifautoTBLrowspan - \scratchcounter\numexpr\tblrow+\plusone\relax - \doiftblrow\scratchcounter\tblcol - {\scratchdimen\gettblhei\scratchcounter\relax % moved inside test - \ifnum\gettblrow\scratchcounter\tblcol>\plusone \ifdim\ht\scratchbox>\scratchdimen - \scratchdimen-\scratchdimen \advance\scratchdimen -\ht\scratchbox - \ht2\scratchdimen - \fi \fi}% + \scratchcounter\numexpr\c_tabl_ntb_row+\plusone\relax + \ifcsname\tabl_ntb_row_pattern\scratchcounter\c_tabl_ntb_col\endcsname + \scratchdimen\tabl_ntb_get_hei\scratchcounter\relax + \ifnum\tabl_ntb_get_row\scratchcounter\c_tabl_ntb_col>\plusone + \ifdim\ht\scratchbox>\scratchdimen + \ht2\dimexpr-\scratchdimen-\ht\scratchbox\relax + \fi + \fi + \fi \fi \box2 } -\long\def\dohandleTBLcellB#1#2[#3]#4% - {\scratchdimen\gettblaut\tblcol\relax +\unexpanded\def\tabl_ntb_cell_process_b#1#2[#3]#4% + {\scratchdimen\tabl_ntb_get_aut\c_tabl_ntb_col\relax \ifdim\scratchdimen>\zeropoint\relax - \let\tblwidthkey\c!width - \edef\tblwidth{\the\scratchdimen}% \else - \scratchdimen\gettblwid\tblcol\relax + \scratchdimen\tabl_ntb_get_wid\c_tabl_ntb_col\relax \ifdim\scratchdimen>\zeropoint\relax - \ifnum\gettblcol{#1}{#2}=\maximumcol\relax + \ifnum\tabl_ntb_get_col{#1}{#2}=\c_tabl_maximum_col\relax \scratchdimen\hsize \fi - \let\tblwidthkey\c!width - \edef\tblwidth{\the\scratchdimen}% - \else - \let\tblwidthkey\s!unknown - \let\tblwidth\zeropoint \fi \fi - \dohandleTBLcellBC{\tblwidthkey=\tblwidth}{#1}{#2}[#3]{\TBLcharalign{#2}{#4}}} + \normalexpanded{\tabl_ntb_cell_process_b_c{\ifdim\scratchdimen>\zeropoint \c!width=\the\scratchdimen\fi}}% + {#1}{#2}[#3]{\tabl_ntb_char_align{#2}{#4}}} -\long\def\dohandleTBLcellC - {\dohandleTBLcellBC{}} +\unexpanded\def\tabl_ntb_cell_process_c + {\tabl_ntb_cell_process_b_c{}} -\long\def\dohandleTBLcellD#1#2[#3]#4% - {\setupTBLcell{#1}{#2}% +\unexpanded\def\tabl_ntb_cell_process_d#1#2[#3]#4% + {\tabl_ntb_setup_cell{#1}{#2}% \bgroup - \localframed - [\@@tbl\@@tbl] - [#3,\c!width=\widthTBL,\c!background=,\c!frame=\v!off]% 25% faster - {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL}% + \setupcurrentnaturaltablelocal[#3,\c!width=\d_tabl_ntb_width,\c!background=,\c!frame=\v!off]% 25% faster + \inheritednaturaltablelocalframed{\tabl_tnb_cell_start\tabl_ntb_char_align{#2}{#4}\tabl_tnb_cell_stop}% \egroup} -\long\def\dohandleTBLcellE#1#2[#3]#4% - {\setupTBLcell{#1}{#2}% - \getparameters[\@@tbl\@@tbl][#3]% to get the color right, the way we +\unexpanded\def\tabl_ntb_cell_process_e#1#2[#3]#4% + {\tabl_ntb_setup_cell{#1}{#2}% + \setupcurrentnaturaltablelocal[#3]% to get the color right, the way we \color % handle color here prevents interference due to whatsit nodes - [\tbltblcolor] % as well as permits local colors to take precedence - {\ifdim\heightTBL=\zeropoint\relax % case: nc=maxcolumns - \localframed - [\@@tbl\@@tbl] - [\c!color=,\c!width=\widthTBL] - {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL}% + [\naturaltablelocalparameter\c!color] % as well as permits local colors to take precedence + {\ifdim\d_tabl_ntb_height=\zeropoint\relax % case: nc=maxcolumns + \setupcurrentnaturaltablelocal[\c!color=,\c!width=\d_tabl_ntb_width]% \else - \localframed - [\@@tbl\@@tbl] - [\c!color=,\c!width=\widthTBL,\c!height=\heightTBL] - {\bTBLCELL\TBLcharalign{#2}{#4}\eTBLCELL}% - \fi}% - \hskip\gettbldis{#2}} - -\presetlocalframed % todo: tableparameter etc - [\@@tbl\@@tbl] - -\setupTABLE [% - \c!frameoffset=.5\linewidth, - \c!backgroundoffset=\v!frame, - \c!framecolor=\s!black, - \c!width=\v!fit, - \c!height=\v!fit, - \c!autowidth=\v!yes, - \c!rulethickness=\linewidth, - \c!strut=\v!yes, - \c!autostrut=\v!no, - % - \c!color=, - \c!style=, - \c!headstyle=\v!bold, - \c!headcolor=, - \c!aligncharacter=\v!no, - \c!alignmentcharacter={,}, - \c!option=, % \v!stretch - \c!header=, - \c!spaceinbetween=, - \c!maxwidth=8em, - \c!textwidth=\v!local, % was \hsize - \c!split=\v!auto, - \c!splitoffset=0pt, - \c!distance=\zeropoint, % individual column - \c!columndistance=\zeropoint, % each column (whole table) - \c!leftmargindistance=\zeropoint, % whole table - \c!rightmargindistance=\zeropoint,% whole table - \c!left=, - \c!right=, - \c!setups=, - \c!splitmethod=a% -] - -%D We have already prepared the previous macros for nesting, -%D so we only have to pop in the right ones: - -%D New: - -\def\pushTBLparameters - {\globalpushmacro\TBLlevel - \ifcase\tblpass - % we're just after \bTABLE - \else\ifnum\TBLlevel>\zerocount - \doglobal\increment\TBLlevel\relax - \fi\fi} - -\def\popTBLparameters - {\globalpopmacro\TBLlevel} - -\def\pushTBL - {\ifnum\TBLlevel=\zerocount - \global\advance\currenttbl\plusone - \fi - \doglobal\increment\TBLlevel\relax - \ifnum\TBLlevel>\plusone - \resetallTABLEparameters - % we need a proper count push/pop - \xdef\savedtblrow{\the\tblrow}\globalpushmacro\savedtblrow - \xdef\savedtblcol{\the\tblcol}\globalpushmacro\savedtblcol - \else - \global\intabletrue - \fi} - -\def\popTBL - {\ifnum\TBLlevel>\plusone - \globalpopmacro\savedtblrow\global\tblrow\savedtblrow - \globalpopmacro\savedtblcol\global\tblcol\savedtblcol - \else - \global\intablefalse - \fi - \doglobal\decrement\TBLlevel\relax} + \setupcurrentnaturaltablelocal[\c!color=,\c!width=\d_tabl_ntb_width,\c!height=\d_tabl_ntb_height]% + \fi + \inheritednaturaltablelocalframed{\tabl_tnb_cell_start\tabl_ntb_char_align{#2}{#4}\tabl_tnb_cell_stop}}% + \hskip\tabl_ntb_get_dis{#2}} + +\setupTABLE + [\c!frameoffset=.5\linewidth, + \c!backgroundoffset=\v!frame, + \c!framecolor=\s!black, + \c!width=\v!fit, + \c!height=\v!fit, + \c!autowidth=\v!yes, + \c!rulethickness=\linewidth, + \c!strut=\v!yes, + \c!autostrut=\v!no, + % + \c!color=, + \c!style=, + \c!headstyle=\v!bold, + \c!headcolor=, + \c!aligncharacter=\v!no, + \c!alignmentcharacter={,}, + \c!option=, % \v!stretch + \c!header=, + \c!spaceinbetween=, + \c!maxwidth=8\emwidth, + \c!textwidth=\v!local, % was \hsize + \c!split=\v!auto, + \c!splitoffset=\zeropoint, + \c!distance=\zeropoint, % individual column + \c!columndistance=\zeropoint, % each column (whole table) + \c!leftmargindistance=\zeropoint, % whole table + \c!rightmargindistance=\zeropoint,% whole table + \c!left=, + \c!right=, + \c!setups=] % \bgroup % \setupTABLE[column][1][aligncharacter=yes, alignmentcharacter={,}] @@ -1573,23 +1670,21 @@ \newconditional\resetTABLEmode \settrue\resetTABLEmode -\def\resetallTABLEparameters% moet genest wel werken - {\ifnum\TBLlevel>\plusone % in ieder geval +\def\tabl_ntb_parameters_reset + {\ifnum\m_tabl_tbl_level>\plusone % in ieder geval \ifconditional\resetTABLEmode -% \presetlocalframed % breedte hoogte diepte offset -% [\@@tbl\@@tbl]% % achtergrond, achtergrondraster, achtergrondkleur % not ok yet - \setupTABLE [% - \c!frameoffset=.5\linewidth, + \setupTABLE + [\c!frameoffset=.5\linewidth, \c!backgroundoffset=\v!frame, \c!framecolor=\s!black, \c!width=fit, \c!height=fit, -\c!autowidth=\v!yes, -% \c!rulethickness=\linewidth, + \c!autowidth=\v!yes, + % \c!rulethickness=\linewidth, \c!strut=\v!no, -\c!strut=\v!yes, % needed for mathml, but ... maybe we need another resetTABLEmode -\c!autostrut=\v!no, + \c!strut=\v!yes, % needed for mathml, but ... maybe we need another resetTABLEmode + \c!autostrut=\v!no, \c!color=, \c!style=, \c!headstyle=, @@ -1614,21 +1709,22 @@ % \bTRs[xx] \bTD oeps \eTD \bTD oeps \eTD \eTRs % \eTABLE +\installcorenamespace{naturaltablesetup} + \unexpanded\def\defineTABLEsetup - {\dodoubleargument\dodefineTABLEsetup} + {\dodoubleargument\tabl_ntb_define_setup} + +\def\tabl_ntb_define_setup[#1][#2]% + {\setvalue{\??naturaltablesetup#1}{#2}} -\def\dodefineTABLEsetup[#1][#2]% - {\setvalue{\@@tbl:set:#1}{#2}} +\let\eTDs\relax +\let\eTRs\relax -\long\def\bTDs[#1]#2\eTDs - {\doifdefinedelse{\@@tbl:set:#1} - {\@EA\@EA\@EA\bTD\@EA\@EA\@EA[\csname\@@tbl:set:#1\endcsname]#2\eTD} - {\bTD[]#2\eTD}} +\unexpanded\def\bTDs[#1]#2\eTDs + {\normalexpanded{\bTD[\ifcsname\??naturaltablesetup#1\endcsname\csname\??naturaltablesetup#1\endcsname\fi]}#2\eTD} -\long\def\bTRs[#1]#2\eTRs - {\doifdefinedelse{\@@tbl:set:#1} - {\@EA\@EA\@EA\bTR\@EA\@EA\@EA[\csname\@@tbl:set:#1\endcsname]#2\eTR} - {\bTR[]#2\eTR}} +\unexpanded\def\bTRs[#1]#2\eTRs + {\normalexpanded{\bTR[\ifcsname\??naturaltablesetup#1\endcsname\csname\??naturaltablesetup#1\endcsname\fi]}#2\eTR} \protect \endinput diff --git a/tex/context/base/xtag-ini.mkii b/tex/context/base/xtag-ini.mkii index 8f10c4f55..ce3cbacd0 100644 --- a/tex/context/base/xtag-ini.mkii +++ b/tex/context/base/xtag-ini.mkii @@ -395,22 +395,22 @@ % \def\disableXML % {\setnormalcatcodes\processingXMLfalse} -\defcatcodecommand\xmlcatcodese `\& \doXMLentity -\defcatcodecommand\xmlcatcodese `\< \doXMLelement -\defcatcodecommand\xmlcatcodesr `\& \doXMLentity -\defcatcodecommand\xmlcatcodesr `\< \doXMLelement -\defcatcodecommand\xmlcatcodesn `\& \doXMLentity -\defcatcodecommand\xmlcatcodesn `\< \doXMLelement - -\letcatcodecommand\xmlcatcodesr `\# \letterhash -\letcatcodecommand\xmlcatcodesr `\$ \letterdollar -\letcatcodecommand\xmlcatcodesr `\% \letterpercent -\letcatcodecommand\xmlcatcodesr `\\ \letterbackslash -\letcatcodecommand\xmlcatcodesr `\^ \letterhat -\letcatcodecommand\xmlcatcodesr `\_ \letterunderscore -\letcatcodecommand\xmlcatcodesr `\{ \letterleftbrace -\letcatcodecommand\xmlcatcodesr `\} \letterrightbrace -\letcatcodecommand\xmlcatcodesr `\| \letterbar +\defcatcodecommand\xmlcatcodese 046 \doXMLentity +\defcatcodecommand\xmlcatcodese 060 \doXMLelement +\defcatcodecommand\xmlcatcodesr 046 \doXMLentity +\defcatcodecommand\xmlcatcodesr 060 \doXMLelement +\defcatcodecommand\xmlcatcodesn 046 \doXMLentity +\defcatcodecommand\xmlcatcodesn 060 \doXMLelement + +\letcatcodecommand\xmlcatcodesr 035 \letterhash +\letcatcodecommand\xmlcatcodesr 036 \letterdollar +\letcatcodecommand\xmlcatcodesr 037 \letterpercent +\letcatcodecommand\xmlcatcodesr 092 \letterbackslash +\letcatcodecommand\xmlcatcodesr 094 \letterhat +\letcatcodecommand\xmlcatcodesr 095 \letterunderscore +\letcatcodecommand\xmlcatcodesr 123 \letterleftbrace +\letcatcodecommand\xmlcatcodesr 125 \letterrightbrace +\letcatcodecommand\xmlcatcodesr 124 \letterbar \bgroup \catcode`\&=13 \let&\relax @@ -426,15 +426,15 @@ \egroup -\letcatcodecommand\xmlcatcodese `\# \entityhash -\letcatcodecommand\xmlcatcodese `\$ \entitydollar -\letcatcodecommand\xmlcatcodese `\% \entitypercent -\letcatcodecommand\xmlcatcodese `\\ \entitybackslash -\letcatcodecommand\xmlcatcodese `\^ \entityhat -\letcatcodecommand\xmlcatcodese `\_ \entityunderscore -\letcatcodecommand\xmlcatcodese `\{ \entityleftbrace -\letcatcodecommand\xmlcatcodese `\} \entityrightbrace -\letcatcodecommand\xmlcatcodese `\| \entitybar +\letcatcodecommand\xmlcatcodese 035 \entityhash +\letcatcodecommand\xmlcatcodese 036 \entitydollar +\letcatcodecommand\xmlcatcodese 037 \entitypercent +\letcatcodecommand\xmlcatcodese 092 \entitybackslash +\letcatcodecommand\xmlcatcodese 094 \entityhat +\letcatcodecommand\xmlcatcodese 095 \entityunderscore +\letcatcodecommand\xmlcatcodese 123 \entityleftbrace +\letcatcodecommand\xmlcatcodese 125 \entityrightbrace +\letcatcodecommand\xmlcatcodese 124 \entitybar % we speed things up by explicitly setting the active char's < & diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 864baf31d..7a76bc33c 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 06/18/12 17:11:41 +-- merge date : 06/19/12 22:27:34 do -- begin closure to overcome local limits and interference @@ -8486,16 +8486,13 @@ function injections.handler(head,where,keep) -- new per 2010-10-06, width adapted per 2010-02-03 -- we used to negate the width of marks because in tfm -- that makes sense but we no longer do that so as a - -- consequence the sign of p.width was changed (we need - -- to keep an eye on it as we don't have that many fonts - -- that enter this branch .. I'm still not sure if this - -- one is right + -- consequence the sign of p.width was changed local k = wx[p] if k then - n.xoffset = p.xoffset + p.width + d[1] - k[2] + -- brill roman: A\char"0300 (but ugly anyway) + n.xoffset = p.xoffset - p.width + d[1] - k[2] -- was + p.width else - -- n.xoffset = p.xoffset + p.width + d[1] - -- lucida U\char"032F (default+mark) + -- lucida: U\char"032F (default+mark) n.xoffset = p.xoffset - p.width + d[1] -- 01-05-2011 end else |