diff options
author | Hans Hagen <pragma@wxs.nl> | 2022-08-25 17:57:42 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2022-08-25 17:57:42 +0200 |
commit | a389a16197fed7803672a8e16fd31d634725d49a (patch) | |
tree | ff79e88e68f213d0a226f57caa23809e720d3c5c /tex | |
parent | 178de9556e3cb519672f9b54db7b5b29eec43c69 (diff) | |
download | context-a389a16197fed7803672a8e16fd31d634725d49a.tar.gz |
2022-08-25 17:40:00
Diffstat (limited to 'tex')
84 files changed, 4575 insertions, 1682 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 40172106d..8efea8d7d 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2022.08.05 17:16} +\newcontextversion{2022.08.25 17:38} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index e7b236699..b3afcdf1a 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2022.08.05 17:16} +\edef\contextversion{2022.08.25 17:38} %D For those who want to use this: diff --git a/tex/context/base/mkii/lang-grk.mkii b/tex/context/base/mkii/lang-grk.mkii index 9fd59382a..9ea252cfe 100644 --- a/tex/context/base/mkii/lang-grk.mkii +++ b/tex/context/base/mkii/lang-grk.mkii @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% \endinput % something changed with greek but what + \writestatus{loading}{ConTeXt Language Macros / Greek} %D The framework of this module is set up by Hans Hagen while @@ -29,6 +31,11 @@ \c!rightquote=\greekrightquot, \c!leftquotation=\greekleftquot, \c!rightquotation=\greekrightquot, + % we're missing an encoding for greek + \s!patterns=\s!agr, + \s!mapping=\s!agr, + \s!encoding=\s!agr, + % but one can use mkiv / lmtx anyway \c!date={\v!day\ \v!month\ \v!year}] \installlanguage [greek] [\s!gr] diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii index 235db7a1e..81d3f32f0 100644 --- a/tex/context/base/mkii/mult-nl.mkii +++ b/tex/context/base/mkii/mult-nl.mkii @@ -870,6 +870,7 @@ \setinterfaceconstant{frameradius}{kaderstraal} \setinterfaceconstant{frames}{hokjes} \setinterfaceconstant{freeregion}{vrijgebied} +\setinterfaceconstant{freezespacing}{freezespacing} \setinterfaceconstant{from}{van} \setinterfaceconstant{functioncolor}{functioncolor} \setinterfaceconstant{functionstyle}{functionstyle} @@ -950,6 +951,7 @@ \setinterfaceconstant{lastpubsep}{lastpubsep} \setinterfaceconstant{layout}{layout} \setinterfaceconstant{left}{links} +\setinterfaceconstant{leftclass}{leftclass} \setinterfaceconstant{leftcolor}{linkerkleur} \setinterfaceconstant{leftcompoundhyphen}{linkerkoppelteken} \setinterfaceconstant{leftedge}{linkerrand} @@ -1008,6 +1010,7 @@ \setinterfaceconstant{menu}{menu} \setinterfaceconstant{method}{methode} \setinterfaceconstant{middle}{midden} +\setinterfaceconstant{middleclass}{middleclass} \setinterfaceconstant{middlecolor}{middenkleur} \setinterfaceconstant{middlecommand}{middencommando} \setinterfaceconstant{middlesource}{middlesource} @@ -1054,6 +1057,8 @@ \setinterfaceconstant{numberconversionset}{numberconversionset} \setinterfaceconstant{numberdistance}{nummerafstand} \setinterfaceconstant{numbering}{nummeren} +\setinterfaceconstant{numberlocation}{numberlocation} +\setinterfaceconstant{numbermethod}{nummermethode} \setinterfaceconstant{numberorder}{numberorder} \setinterfaceconstant{numberprefix}{numberprefix} \setinterfaceconstant{numbersegments}{numbersegments} @@ -1064,6 +1069,7 @@ \setinterfaceconstant{numberstopper}{numberstopper} \setinterfaceconstant{numberstrut}{nummerstrut} \setinterfaceconstant{numberstyle}{nummerletter} +\setinterfaceconstant{numberthreshold}{numberthreshold} \setinterfaceconstant{numberwidth}{nummerbreedte} \setinterfaceconstant{nx}{nx} \setinterfaceconstant{ny}{ny} @@ -1117,6 +1123,7 @@ \setinterfaceconstant{palet}{palet} \setinterfaceconstant{paper}{papier} \setinterfaceconstant{paragraph}{alinea} +\setinterfaceconstant{penalties}{penalties} \setinterfaceconstant{period}{period} \setinterfaceconstant{place}{plaatsen} \setinterfaceconstant{placehead}{plaatskop} @@ -1170,6 +1177,7 @@ \setinterfaceconstant{reverse}{omgekeerd} \setinterfaceconstant{right}{rechts} \setinterfaceconstant{rightchars}{rightchars} +\setinterfaceconstant{rightclass}{rightclass} \setinterfaceconstant{rightcolor}{rechterkleur} \setinterfaceconstant{rightcompoundhyphen}{rechterkoppelteken} \setinterfaceconstant{rightedge}{rechterrand} diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua index 6449e085e..5325dc06e 100644 --- a/tex/context/base/mkiv/char-def.lua +++ b/tex/context/base/mkiv/char-def.lua @@ -456,7 +456,7 @@ characters.data={ direction="es", linebreak="pr", mathclass="binary", - mathgroup="nary arithmic", + mathgroup="nary arithmetic", unicodeslot=0x2B, }, { @@ -480,7 +480,7 @@ characters.data={ direction="es", linebreak="hy", mathclass="ordinary", - mathgroup="binary arithmic", + mathgroup="binary arithmetic", mathextensible="h", mathfiller="relfill", mathname="mathhyphen", @@ -497,8 +497,16 @@ characters.data={ description="FULL STOP", direction="cs", linebreak="is", - mathclass="punctuation", - mathname="ldotp", + mathspec={ + { + class="binary", + name="ldot", + }, + { + class="punctuation", + name="ldotp", + }, + }, synonyms={ "decimal point", "dot", "period" }, unicodeslot=0x2E, }, @@ -511,6 +519,16 @@ characters.data={ direction="cs", linebreak="sy", mathclass="division", + mathspec={ + { + class="division", + name="slash", + }, + { + class="division", + name="solidus", + }, + }, synonyms={ "slash", "virgule" }, unicodeslot=0x2F, }, @@ -683,6 +701,7 @@ characters.data={ { class="relation", name="Relbar", + comment="useless", }, }, unicodeslot=0x3D, @@ -1028,13 +1047,14 @@ characters.data={ { adobename="asciicircum", category="sk", + comment="the Hat looks rediculous in most fonts", cjkwd="na", contextname="textasciicircum", description="CIRCUMFLEX ACCENT", direction="on", linebreak="al", - mathclass="topaccent", - mathname="Hat", +--mathclass="topaccent", +--mathname="Hat", synonyms={ "spacing circumflex accent" }, unicodeslot=0x5E, }, @@ -1057,8 +1077,17 @@ characters.data={ description="GRAVE ACCENT", direction="on", linebreak="al", - mathclass="topaccent", - mathname="grave", + mathspec={ + { + class="topaccent", + name="grave", + }, + { + class="topaccent", + name="widegrave", + stretch="h", + }, + }, synonyms={ "spacing grave accent" }, unicodeslot=0x60, }, @@ -1347,11 +1376,12 @@ characters.data={ description="VERTICAL LINE", direction="on", linebreak="ba", + mathclass="ordinary", mathspec={ - { - class="ordinary", - name="arrowvert", - }, +-- { +-- class="ordinary", +-- name="arrowvert", +-- }, { class="delimiter", name="vert", @@ -1365,10 +1395,6 @@ characters.data={ name="rvert", }, { - class="relation", - name="mid", - }, - { class="delimiter", name="singleverticalbar", }, @@ -1733,8 +1759,17 @@ characters.data={ description="DIAERESIS", direction="on", linebreak="ai", - mathclass="topaccent", - mathname="ddot", + mathspec={ + { + class="topaccent", + name="ddot", + }, + { + class="topaccent", + name="wideddot", + stretch="h", + }, + }, specials={ "compat", 0x20, 0x308 }, synonyms={ "spacing diaeresis" }, unicodeslot=0xA8, @@ -1824,10 +1859,20 @@ characters.data={ description="MACRON", direction="on", linebreak="al", - mathclass="topaccent", - mathfiller="barfill", - mathmleq=0x203E, - mathname="bar", +--mathclass="topaccent", +--mathfiller="barfill", +--mathmleq=0x203E, + mathspec={ + { + class="topaccent", + name="bar", + }, + { + class="topaccent", + name="widebar", + stretch="h", + }, + }, specials={ "compat", 0x20, 0x304 }, synonyms={ "apl overbar", "overline", "spacing macron" }, unicodeslot=0xAF, @@ -1886,8 +1931,17 @@ characters.data={ description="ACUTE ACCENT", direction="on", linebreak="bb", - mathclass="topaccent", - mathname="acute", + mathspec={ + { + class="topaccent", + name="acute", + }, + { + class="topaccent", + name="wideacute", + stretch="h", + }, + }, specials={ "compat", 0x20, 0x301 }, synonyms={ "spacing acute accent" }, unicodeslot=0xB4, @@ -2304,7 +2358,7 @@ characters.data={ direction="on", linebreak="ai", mathclass="binary", - mathgroup="nary arithmic", + mathgroup="nary arithmetic", mathname="times", synonyms={ "cartesian product" }, unicodeslot=0xD7, @@ -2704,7 +2758,7 @@ characters.data={ direction="on", linebreak="ai", mathclass="binary", - mathgroup="binary arithmic", + mathgroup="binary arithmetic", mathname="div", synonyms={ "obelus" }, unicodeslot=0xF7, @@ -7650,8 +7704,17 @@ characters.data={ description="MODIFIER LETTER CIRCUMFLEX ACCENT", direction="on", linebreak="al", - mathclass="topaccent", - mathname="hat", + mathspec={ + { + class="topaccent", + name="hat", + }, + { + class="topaccent", + name="widehat", + stretch="h", + }, + }, specials={ "compat", 0x20, 0x302 }, unicodeslot=0x2C6, }, @@ -7664,8 +7727,17 @@ characters.data={ description="CARON", direction="on", linebreak="ai", - mathclass="topaccent", - mathname="check", + mathspec={ + { + class="topaccent", + name="check", + }, + { + class="topaccent", + name="widecheck", + stretch="h", + }, + }, specials={ "compat", 0x20, 0x30C }, synonyms={ "mandarin chinese third tone", "modifier letter hacek" }, unicodeslot=0x2C7, @@ -7814,8 +7886,17 @@ characters.data={ description="BREVE", direction="on", linebreak="ai", - mathclass="topaccent", - mathname="breve", + mathspec={ + { + class="topaccent", + name="breve", + }, + { + class="topaccent", + name="widebreve", + stretch="h", + }, + }, specials={ "compat", 0x20, 0x306 }, unicodeslot=0x2D8, }, @@ -7827,8 +7908,17 @@ characters.data={ description="DOT ABOVE", direction="on", linebreak="ai", - mathclass="topaccent", - mathname="dot", + mathspec={ + { + class="topaccent", + name="dot", + }, + { + class="topaccent", + name="widedot", + stretch="h", + }, + }, specials={ "compat", 0x20, 0x307 }, synonyms={ "mandarin chinese fifth or neutral tone" }, unicodeslot=0x2D9, @@ -7841,8 +7931,17 @@ characters.data={ description="RING ABOVE", direction="on", linebreak="ai", - mathclass="topaccent", - mathname="ring", + mathspec={ + { + class="topaccent", + name="ring", + }, + { + class="topaccent", + name="widering", + stretch="h", + }, + }, specials={ "compat", 0x20, 0x30A }, unicodeslot=0x2DA, }, @@ -7864,8 +7963,17 @@ characters.data={ description="SMALL TILDE", direction="on", linebreak="al", - mathclass="topaccent", - mathname="tilde", + mathspec={ + { + class="topaccent", + name="tilde", + }, + { + class="topaccent", + name="widetilde", + stretch="h", + }, + }, specials={ "compat", 0x20, 0x303 }, unicodeslot=0x2DC, }, @@ -8142,9 +8250,6 @@ characters.data={ description="COMBINING GRAVE ACCENT", direction="nsm", linebreak="cm", - mathclass="topaccent", - mathname="widegrave", - mathstretch="h", synonyms={ "greek varia" }, unicodeslot=0x300, }, @@ -8167,9 +8272,6 @@ characters.data={ description="COMBINING CIRCUMFLEX ACCENT", direction="nsm", linebreak="cm", - mathclass="topaccent", - mathname="widehat", - mathstretch="h", unicodeslot=0x302, }, { @@ -8180,9 +8282,6 @@ characters.data={ description="COMBINING TILDE", direction="nsm", linebreak="cm", - mathclass="topaccent", - mathname="widetilde", - mathstretch="h", unicodeslot=0x303, }, { @@ -62286,7 +62385,8 @@ characters.data={ [0x2012]={ adobename="figuredash", category="pd", - contextname="textminus", + contextname="figuredash", + contextspec={ "textminus" }, description="FIGURE DASH", direction="on", linebreak="ba", @@ -62842,16 +62942,6 @@ characters.data={ description="FRACTION SLASH", direction="cs", linebreak="is", - mathspec={ - { - class="ordinary", - name="slash", - }, - { - class="close", - name="solidus", - }, - }, synonyms={ "solidus" }, unicodeslot=0x2044, }, @@ -66995,7 +67085,7 @@ characters.data={ description="MINUS SIGN", direction="es", linebreak="pr", - mathgroup="binary arithmic", + mathgroup="binary arithmetic", mathspec={ { class="binary", @@ -67004,6 +67094,7 @@ characters.data={ { class="relation", name="relbar", + comment="useless", }, }, unicodeslot=0x2212, @@ -67194,8 +67285,17 @@ characters.data={ description="DIVIDES", direction="on", linebreak="ai", - mathclass="binary", - mathname="divides", + mathspec={ + { + -- class="binary", + class="ordinary", + name="divides", + }, + { + class="relation", + name="mid", + }, + }, synonyms={ "apl stile", "such that" }, unicodeslot=0x2223, }, @@ -67206,7 +67306,8 @@ characters.data={ linebreak="al", mathspec={ { - class="binary", + -- class="binary", + class="ordinary", name="ndivides", }, { diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua index 09c7994a9..9dcac8033 100644 --- a/tex/context/base/mkiv/char-ini.lua +++ b/tex/context/base/mkiv/char-ini.lua @@ -823,6 +823,7 @@ setmetatableindex(characters.is_command, mti) setmetatableindex(characters.is_spacing, mti) setmetatableindex(characters.is_punctuation,mti) setmetatableindex(characters.is_hyphenator, mti) +setmetatableindex(characters.is_symbol, mti) -- todo: also define callers for the above diff --git a/tex/context/base/mkiv/cldf-ver.lua b/tex/context/base/mkiv/cldf-ver.lua index 7a1c81301..479606f83 100644 --- a/tex/context/base/mkiv/cldf-ver.lua +++ b/tex/context/base/mkiv/cldf-ver.lua @@ -68,8 +68,8 @@ local function flush(s,inline) context.resetbuffer(t_buffer) end -local function t_tocontext(t) - local s = table.serialize(t) +local function t_tocontext(t,s) + local s = table.serialize(t,s) context(function() flush(s,false) end) end diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index e4a711f11..0fc2fe1d6 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2022.08.05 17:16} +\newcontextversion{2022.08.25 17:38} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 664316e97..4125a151b 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2022.08.05 17:16} +\edef\contextversion{2022.08.25 17:38} %D Kind of special: diff --git a/tex/context/base/mkiv/data-tex.lua b/tex/context/base/mkiv/data-tex.lua index 2c1a7dbd5..42547b00b 100644 --- a/tex/context/base/mkiv/data-tex.lua +++ b/tex/context/base/mkiv/data-tex.lua @@ -175,9 +175,10 @@ local function textopener(tag,filename,filehandle,coding) currentline = currentline + 1 -- self.currentline = currentline local content = lines[currentline] --- lines[currentline] = nil + -- lines[currentline] = false if content == "" then - return "" + -- return "" + return content -- elseif content == ctrl_d or ctrl_z then -- return nil -- we need this as \endinput does not work in prints elseif content then diff --git a/tex/context/base/mkiv/font-cff.lua b/tex/context/base/mkiv/font-cff.lua index 4258991c6..114d7dd07 100644 --- a/tex/context/base/mkiv/font-cff.lua +++ b/tex/context/base/mkiv/font-cff.lua @@ -735,8 +735,13 @@ local result = { } local seacs = { } local procidx = nil - local function showstate(where) - report("%w%-10s : [%s] n=%i",depth*2,where,concat(stack," ",1,top),top) + local function showstate(where,i,n) + if i then + local j = i + n - 1 + report("%w%-10s : [%s] step",depth*2+2,where,concat(stack," ",i,j <= top and j or top)) + else + report("%w%-10s : [%s] n=%i",depth*2,where,concat(stack," ",1,top),top) + end end local function showvalue(where,value,showstack) @@ -873,9 +878,9 @@ local result = { } end end - local function xycurveto(x1,y1,x2,y2,x3,y3) -- called local so no blend here + local function xycurveto(x1,y1,x2,y2,x3,y3,i,n) -- called local so no blend here if trace_charstrings then - showstate("curveto") + showstate("curveto",i,n) end if keepcurve then r = r + 1 @@ -1019,6 +1024,16 @@ local result = { } if trace_charstrings then showstate("rrcurveto") end +if top == 6 then + local ax = x + stack[1] -- dxa + local ay = y + stack[2] -- dya + local bx = ax + stack[3] -- dxb + local by = ay + stack[4] -- dyb + x = bx + stack[5] -- dxc + y = by + stack[6] -- dyc + xycurveto(ax,ay,bx,by,x,y,1,6) +else +-- print("rr",top==6,top) for i=1,top,6 do local ax = x + stack[i] -- dxa local ay = y + stack[i+1] -- dya @@ -1026,8 +1041,9 @@ local result = { } local by = ay + stack[i+3] -- dyb x = bx + stack[i+4] -- dxc y = by + stack[i+5] -- dyc - xycurveto(ax,ay,bx,by,x,y) + xycurveto(ax,ay,bx,by,x,y,i,6) end +end top = 0 end @@ -1040,6 +1056,15 @@ local result = { } y = y + stack[1] -- dy1 s = 2 end +if top == 4 then + local ax = x + stack[1] -- dxa + local ay = y + local bx = ax + stack[2] -- dxb + local by = ay + stack[3] -- dyb + x = bx + stack[4] -- dxc + y = by + xycurveto(ax,ay,bx,by,x,y,1,4) +else for i=s,top,4 do local ax = x + stack[i] -- dxa local ay = y @@ -1047,8 +1072,9 @@ local result = { } local by = ay + stack[i+2] -- dyb x = bx + stack[i+3] -- dxc y = by - xycurveto(ax,ay,bx,by,x,y) + xycurveto(ax,ay,bx,by,x,y,i,4) end +end top = 0 end @@ -1062,6 +1088,16 @@ local result = { } d = stack[1] -- dx1 s = 2 end +if top == 4 then + local ax = x + d + local ay = y + stack[1] -- dya + local bx = ax + stack[2] -- dxb + local by = ay + stack[3] -- dyb + x = bx + y = by + stack[4] -- dyc + xycurveto(ax,ay,bx,by,x,y,1,4) + d = 0 +else for i=s,top,4 do local ax = x + d local ay = y + stack[i] -- dya @@ -1069,9 +1105,10 @@ local result = { } local by = ay + stack[i+2] -- dyb x = bx y = by + stack[i+3] -- dyc - xycurveto(ax,ay,bx,by,x,y) + xycurveto(ax,ay,bx,by,x,y,i,4) d = 0 end +end top = 0 end @@ -1080,6 +1117,33 @@ local result = { } if last then top = top - 1 end +if top == 4 then + local ax, ay, bx, by + if swap then + ax = x + stack[1] + ay = y + bx = ax + stack[2] + by = ay + stack[3] + y = by + stack[4] + if last then + x = bx + last + else + x = bx + end + else + ax = x + ay = y + stack[1] + bx = ax + stack[2] + by = ay + stack[3] + x = bx + stack[4] + if last then + y = by + last + else + y = by + end + end + xycurveto(ax,ay,bx,by,x,y,1 ,4) +else for i=1,top,4 do local ax, ay, bx, by if swap then @@ -1107,8 +1171,9 @@ local result = { } end swap = true end - xycurveto(ax,ay,bx,by,x,y) + xycurveto(ax,ay,bx,by,x,y,i,4) end +end top = 0 end @@ -1137,7 +1202,7 @@ local result = { } local by = ay + stack[i+3] -- dyb x = bx + stack[i+4] -- dxc y = by + stack[i+5] -- dyc - xycurveto(ax,ay,bx,by,x,y) + xycurveto(ax,ay,bx,by,x,y,i,6) end x = x + stack[top-1] -- dxc y = y + stack[top] -- dyc @@ -2531,7 +2596,7 @@ local function readfdselect(f,fontdata,data,glyphs,doshapes,version,streams) end end else - -- unsupported format + report("unsupported fd index format %i",format) end -- hm, always if maxindex >= 0 then @@ -2539,21 +2604,30 @@ local function readfdselect(f,fontdata,data,glyphs,doshapes,version,streams) if cidarray then setposition(f,header.offset+cidarray) local dictionaries = readlengths(f,version == "cff2") - for i=1,#dictionaries do - dictionaries[i] = readstring(f,dictionaries[i]) - end - parsedictionaries(data,dictionaries) - cid.dictionaries = dictionaries - readcidprivates(f,data) - for i=1,#dictionaries do - readlocals(f,data,dictionaries[i],version) - end - startparsing(fontdata,data,streams) - for i=1,#charstrings do - parsecharstring(fontdata,data,dictionaries[fdindex[i]+1],charstrings[i],glyphs,i,doshapes,version,streams) --- charstrings[i] = nil + if #dictionaries > 0 then + for i=1,#dictionaries do + dictionaries[i] = readstring(f,dictionaries[i]) + end + parsedictionaries(data,dictionaries) + cid.dictionaries = dictionaries + readcidprivates(f,data) + for i=1,#dictionaries do + readlocals(f,data,dictionaries[i],version) + end + startparsing(fontdata,data,streams) + for i=1,#charstrings do + local dictionary = dictionaries[fdindex[i]+1] + if dictionary then + parsecharstring(fontdata,data,dictionary,charstrings[i],glyphs,i,doshapes,version,streams) + else + -- report("no dictionary for %a : %a => %a",version,i,fdindex[i]+1) + end + -- charstrings[i] = false + end + stopparsing(fontdata,data) + else + report("no cid dictionaries") end - stopparsing(fontdata,data) else report("no cid array") end diff --git a/tex/context/base/mkiv/meta-imp-mat.mkiv b/tex/context/base/mkiv/meta-imp-mat.mkiv index 79757b6a9..66ac33063 100644 --- a/tex/context/base/mkiv/meta-imp-mat.mkiv +++ b/tex/context/base/mkiv/meta-imp-mat.mkiv @@ -139,35 +139,35 @@ enddef ; \stopMPextensions -\startuniqueMPgraphic{minifun::math:stacker:\number"FE3B4}{axis,ex,em} +\startuniqueMPgraphic{minifun::math:stacker:\number"\ifcase\contextlmtxmode FE3B4\else23B4\fi}{axis,ex,em} math_stacker_draw_accent(math_stacker_bracket_shape(OverlayHeight,false)) ; \stopuniqueMPgraphic -\startuniqueMPgraphic{minifun::math:stacker:\number"FE3B5}{axis,ex,em} +\startuniqueMPgraphic{minifun::math:stacker:\number"\ifcase\contextlmtxmode FE3B5\else23B5\fi}{axis,ex,em} math_stacker_draw_accent(math_stacker_bracket_shape(OverlayDepth,true)) ; \stopuniqueMPgraphic -\startuniqueMPgraphic{minifun::math:stacker:\number"FE3DC}{axis,ex,em} +\startuniqueMPgraphic{minifun::math:stacker:\number"\ifcase\contextlmtxmode FE3DC\else23DC\fi}{axis,ex,em} math_stacker_draw_accent(math_stacker_parent_shape(OverlayHeight,false)) ; \stopuniqueMPgraphic -\startuniqueMPgraphic{minifun::math:stacker:\number"FE3DD}{axis,ex,em} +\startuniqueMPgraphic{minifun::math:stacker:\number"\ifcase\contextlmtxmode FE3DD\else23DD\fi}{axis,ex,em} math_stacker_draw_accent(math_stacker_parent_shape(OverlayDepth,true)) ; \stopuniqueMPgraphic -\startuniqueMPgraphic{minifun::math:stacker:\number"FE3DE}{axis,ex,em} +\startuniqueMPgraphic{minifun::math:stacker:\number"\ifcase\contextlmtxmode FE3DE\else23DE\fi}{axis,ex,em} math_stacker_draw_accent(math_stacker_brace_shape(OverlayHeight,false)) ; \stopuniqueMPgraphic -\startuniqueMPgraphic{minifun::math:stacker:\number"FE3DF}{axis,ex,em} +\startuniqueMPgraphic{minifun::math:stacker:\number"\ifcase\contextlmtxmode FE3DF\else23DF\fi}{axis,ex,em} math_stacker_draw_accent(math_stacker_brace_shape(OverlayDepth,true)) ; \stopuniqueMPgraphic -\startuniqueMPgraphic{minifun::math:stacker:\number"FE33E}{axis,ex,em} +\startuniqueMPgraphic{minifun::math:stacker:\number"\ifcase\contextlmtxmode FE33E\else203E\fi}{axis,ex,em} math_stacker_draw_accent(math_stacker_bar_shape(false)) ; \stopuniqueMPgraphic -\startuniqueMPgraphic{minifun::math:stacker:\number"FE33F}{axis,ex,em} +\startuniqueMPgraphic{minifun::math:stacker:\number"\ifcase\contextlmtxmode FE33F\else203F\fi}{axis,ex,em} math_stacker_draw_accent(math_stacker_bar_shape(true)) ; \stopuniqueMPgraphic diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index d2097e7b6..62af2940a 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -173,6 +173,7 @@ return { -- "mathtopaccentcode", "mathbottomaccentcode", "mathdelimitercode", "mathrootcode", "mathprintcode", -- "mathalphacode", "mathboxcode", "mathchoicecode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathunsetcode", "mathunspacedcode", "mathallcode", "mathfakecode", "mathunarycode", + "mathmaybeordinarycode", "mathmayberelationcode", "mathmaybebinarycode", -- "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", -- @@ -215,7 +216,7 @@ return { "checkligatureclassoptioncode", "checkitaliccorrectionclassoptioncode", "checkkernpairclassoptioncode", "flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode", "carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode", - "preferdelimiterdimensionsclassoptioncode", + "preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", -- "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode", "noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode", @@ -586,7 +587,7 @@ return { -- "assumelongusagecs", -- - "Umathbotaccent", "Umathtopaccent", + "Umathbottomaccent", "Umathtopaccent", "Umathbotaccent", -- "righttolefthbox", "lefttorighthbox", "righttoleftvbox", "lefttorightvbox", "righttoleftvtop", "lefttorightvtop", "rtlhbox", "ltrhbox", "rtlvbox", "ltrvbox", "rtlvtop", "ltrvtop", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index ceaa8d5e7..b0ba0dda7 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -108,6 +108,7 @@ return { "Umathdenominatorvariant", "Umathdict", "Umathdictdef", + "Umathdiscretionary", "Umathextrasubpreshift", "Umathextrasubprespace", "Umathextrasubshift", @@ -233,6 +234,8 @@ return { "Ustopdisplaymath", "Ustopmath", "Ustopmathmode", + "Ustretched", + "Ustretchedwithdelims", "Ustyle", "Usubprescript", "Usubscript", @@ -373,6 +376,7 @@ return { "gtokspre", "hccode", "hjcode", + "hmcode", "hpack", "hyphenationmin", "hyphenationmode", @@ -498,9 +502,9 @@ return { "mathghost", "mathgluemode", "mathgroupingmode", - "mathinlinemainstyle", "mathleftclass", "mathlimitsmode", + "mathmainstyle", "mathmiddle", "mathnolimitsmode", "mathpenaltiesmode", @@ -590,8 +594,6 @@ return { "setmathspacing", "shapingpenaltiesmode", "shapingpenalty", - "skewed", - "skewedwithdelims", "snapshotpar", "supmarkmode", "swapcsvalues", @@ -707,6 +709,7 @@ return { "pdfobjcompresslevel", "pdfomitcharset", "pdfomitcidset", + "pdfomitinfodict", "pdfoutline", "pdfoutput", "pdfpageattr", diff --git a/tex/context/base/mkiv/mult-prm.mkiv b/tex/context/base/mkiv/mult-prm.mkiv index 5ffb84d38..75114c330 100644 --- a/tex/context/base/mkiv/mult-prm.mkiv +++ b/tex/context/base/mkiv/mult-prm.mkiv @@ -68,7 +68,7 @@ "pdftracingfonts", "pdftrailer", "pdftrailerid", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage", - "pdfomitcidset", "pdfomitcharset", + "pdfomitcidset", "pdfomitcharset", "pdfomitinfodict", }, aleph = { -- we don't bother "Alephminorversion", "Alephrevision", "Alephversion", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 3c36ed7cf..36fa8c14e 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex c57cfee7c..8dbbc4774 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/util-rnd.lua b/tex/context/base/mkiv/util-rnd.lua new file mode 100644 index 000000000..7504965b2 --- /dev/null +++ b/tex/context/base/mkiv/util-rnd.lua @@ -0,0 +1,116 @@ +if not modules then modules = { } end modules ['util-rnd'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Tamara, Adriana, Tomáš Hála & Hans Hagen", + copyright = "ConTeXt Development Team", -- umbrella + license = "see context related readme files" +} + +-- The rounding code is a variant on Tomáš Hála <tomas.hala@mendelu.cz; mendelu@thala.cz> +-- code that is used in the statistical module. We use local variables and a tolerant name +-- resolver that also permits efficient local aliases. With code like this one +-- really have to make sure that locals are used because changing the rounding +-- can influence other code. + +local floor, ceil, pow = math.floor, math.ceil, math.pow +local rawget, type = rawget, type +local gsub, lower = string.gsub, string.lower + +local rounding = { } + +local methods = { + no = function(num) + -- no rounding + return num + end, + up = function(num,coef) + -- ceiling rounding + coef = coef and pow(10,coef) or 1 + return ceil(num * coef) / coef + end, + down = function(num,coef) + -- floor rounding + coef = coef and pow(10,coef) or 1 + return floor(num * coef) / coef + end, + halfup = function(num,coef) + -- rounds decimal numbers as usual, numbers with 0.5 up, too (e.g. number -0.5 will be rounded to 0) + coef = coef and pow(10,coef) or 1 + return floor(num * coef + 0.5) / coef + end, + halfdown = function(num,coef) + -- rounds decimal numbers as usual, numbers with 0.5 down, too (e.g. number 0.5 will be rounded to 0) + coef = coef and pow(10,coef) or 1 + return ceil(num * coef -0.5) / coef + end, + halfabsup = function(num,coef) + -- rounds deciaml numbers as usual, numbers with 0.5 away from zero, e.g. numbers -0.5 and 0.5 will be rounded to -1 and 1 + coef = coef and pow(10,coef) or 1 + return (num >= 0 and floor(num * coef + 0.5) or ceil(num * coef - 0.5)) / coef + end, + halfabsdown = function(num,coef) + -- rounds deciaml numbers as usual, numbers with 0.5 towards zero, e.g. numbers -0.5 and 0.5 will be rounded both to 0 + coef = coef and pow(10,coef) or 1 + return (num < 0 and floor(num * coef + 0.5) or ceil(num * coef - 0.5)) / coef + end, + halfeven = function(num,coef) + -- rounds deciaml numbers as usual, numbers with 0.5 to the nearest even, e.g. numbers 1.5 and 2.5 will be rounded both to 2 + coef = coef and pow(10,coef) or 1 + num = num*coef + return floor(num + (((num - floor(num)) ~= 0.5 and 0.5) or ((floor(num) % 2 == 1) and 1) or 0)) / coef + end, + halfodd = function(num,coef) + -- rounds deciaml numbers as usual, numbers with 0.5 to the nearest odd (e.g. numbers 1.5 and 2.5 will be rounded to 1 and 3 + coef = coef and pow(10,coef) or 1 + num = num * coef + return floor(num + (((num - floor(num)) ~= 0.5 and 0.5) or ((floor(num) % 2 == 1) and 0) or 1)) / coef + end, +} + +methods.default = methods.halfup + +rounding.methods = table.setmetatableindex(methods,function(t,k) + local s = gsub(lower(k),"[^a-z]","") + local v = rawget(t,s) + if not v then + v = t.halfup + end + t[k] = v + return v +end) + +-- If needed I can make a high performance one. + +local defaultmethod = methods.halfup + +rounding.round = function(num,dec,mode) + if type(dec) == "string" then + mode = dec + dec = 1 + end + return (mode and methods[mode] or defaultmethods)(num,dec) +end + +number.rounding = rounding + +-- -- Tomáš' test numbers: + +-- local list = { 5.49, 5.5, 5.51, 6.49, 6.5, 6.51, 0.5, 12.45 } +-- +-- for method, round in table.sortedhash(number.rounding.methods) do +-- for i=1,#list do +-- local n = list[i] +-- print(n,method,round(n,k),round(n,k,3)) +-- end +-- end +-- +-- local myround = number.rounding.methods["HALF ABS DOWN"] +-- +-- for i=1,#list do +-- local n = list[i] +-- print(n,"Half Abs Down",number.rounding.round(n,1,"Half Abs Down")) +-- print(n,"HALF_ABS_DOWN",number.rounding.round(n,1,"HALF_ABS_DOWN")) +-- print(n,"HALF_ABS_DOWN",myround(n,1)) +-- end + +return rounding diff --git a/tex/context/base/mkxl/char-prv.lmt b/tex/context/base/mkxl/char-prv.lmt new file mode 100644 index 000000000..bb0377a75 --- /dev/null +++ b/tex/context/base/mkxl/char-prv.lmt @@ -0,0 +1,251 @@ +if not modules then modules = { } end modules ['char-prv'] = { + version = 1.001, + comment = "companion to char-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", + dataonly = true, +} + +characters = characters or { } + +-- 0xFE302 -- 0xFE320 for accents (gone with new lm/gyre) +-- 0xFE321 -- 0xFE340 for missing characters + +-- [0xFE302] = { +-- category = "mn", +-- description = "WIDE MATHEMATICAL HAT", +-- direction = "nsm", +-- linebreak = "cm", +-- mathclass = "topaccent", +-- mathname = "widehat", +-- mathstretch = "h", +-- unicodeslot = 0xFE302, +-- nextinsize = { 0x00302, 0x0005E }, +-- }, +-- [0xFE303] = { +-- category = "mn", +-- cjkwd = "a", +-- description = "WIDE MATHEMATICAL TILDE", +-- direction = "nsm", +-- linebreak = "cm", +-- mathclass = "topaccent", +-- mathname = "widetilde", +-- mathstretch = "h", +-- unicodeslot = 0xFE303, +-- nextinsize = { 0x00303, 0x0007E }, +-- }, +-- [0xFE304] = { +-- category = "sm", +-- description = "TOP AND BOTTOM PARENTHESES", +-- direction = "on", +-- linebreak = "al", +-- mathclass = "doubleaccent", +-- mathname = "doubleparent", +-- unicodeslot = 0xFE304, +-- accents = { 0x023DC, 0x023DD }, +-- }, +-- [0xFE305] = { +-- category = "sm", +-- description = "TOP AND BOTTOM BRACES", +-- direction = "on", +-- linebreak = "al", +-- mathclass = "doubleaccent", +-- mathname = "doublebrace", +-- unicodeslot = 0xFE305, +-- accents = { 0x023DE, 0x023DF }, +-- }, +-- [0xFE941]={ +-- category = "sm", +-- description = "EXTREMELY IDENTICAL TO", +-- mathclass = "relation", +-- mathextensible = "h", +-- mathname = "eqequiv", +-- mathpair = { 0x2261, 0x3D }, +-- unicodeslot = 0xFE941, +-- }, + +characters.private={ +--[0xFE302]={ --fbk +-- description="EXTENSIBLE OF 0x0302", +-- mathclass="topaccent", +-- mathstretch="h", +-- unicodeslot=0xFE302, +--}, +--[0xFE303]={ --fbk +-- description="EXTENSIBLE OF 0x0303", +-- mathclass="topaccent", +-- mathstretch="h", +-- unicodeslot=0xFE303, +--}, + [0xFE321]={ -- vfu + category="sm", + description="MATHEMATICAL SHORT BAR", + mathclass="relation", + mathname="mapstochar", + unicodeslot=0xFE321, + }, + [0xFE322]={ -- vfu + category="sm", + description="MATHEMATICAL LEFT HOOK", + mathclass="relation", + mathname="lhook", + unicodeslot=0xFE322, + }, + [0xFE323]={ -- vfu + category="sm", + description="MATHEMATICAL RIGHT HOOK", + mathclass="relation", + mathname="rhook", + unicodeslot=0xFE323, + }, + [0xFE324]={ -- vfu + category="sm", + description="MATHEMATICAL SHORT BAR MIRRORED", + mathclass="relation", + mathname="mapsfromchar", + unicodeslot=0xFE324, + }, + [0xFE33E]={ -- stc + description="TOP OF 0x023E", + mathclass="topaccent", + mathextensible="r", + mathstretch="h", + unicodeslot=0xFE33E, + }, + [0xFE33F]={ -- stc + description="BOTTOM OF 0x023E", + mathclass="botaccent", + mathextensible="r", + mathstretch="h", + unicodeslot=0xFE33E, + }, +--[0xFE350]={ --fbk +-- category="sm", +-- description="MATHEMATICAL DOUBLE ARROW LEFT END", +-- mathclass="relation", +-- mathname="ctxdoublearrowfillleftend", +-- unicodeslot=0xFE350, +--}, +--[0xFE351]={ --fbk +-- category="sm", +-- description="MATHEMATICAL DOUBLE ARROW MIDDLE PART", +-- mathclass="relation", +-- mathname="ctxdoublearrowfillmiddlepart", +-- unicodeslot=0xFE351, +--}, +--[0xFE352]={ --fbk +-- category="sm", +-- description="MATHEMATICAL DOUBLE ARROW RIGHT END", +-- mathclass="relation", +-- mathname="ctxdoublearrowfillrightend", +-- unicodeslot=0xFE352, +--}, +--[0xFE3B4]={ -- stc +-- description="EXTENSIBLE OF 0x03B4", +-- mathclass="topaccent", +-- mathextensible="r", +-- mathstretch="h", +-- unicodeslot=0xFE3B4, +--}, +--[0xFE3B5]={ -- stc +-- description="EXTENSIBLE OF 0x03B5", +-- mathclass="botaccent", +-- mathextensible="r", +-- mathstretch="h", +-- unicodeslot=0xFE3B5, +--}, +--[0xFE3DC]={ -- stc +-- description="EXTENSIBLE OF 0x03DC", +-- mathclass="topaccent", +-- mathextensible="r", +-- mathstretch="h", +-- unicodeslot=0xFE3DC, +--}, +--[0xFE3DD]={ -- stc +-- description="EXTENSIBLE OF 0x03DD", +-- mathclass="botaccent", +-- mathextensible="r", +-- mathstretch="h", +-- unicodeslot=0xFE3DD, +--}, +--[0xFE3DE]={ -- stc +-- description="EXTENSIBLE OF 0x03DE", +-- mathclass="topaccent", +-- mathextensible="r", +-- mathstretch="h", +-- unicodeslot=0xFE3DE, +--}, +--[0xFE3DF]={ -- stc +-- description="EXTENSIBLE OF 0x03DF", +-- mathclass="botaccent", +-- mathextensible="r", +-- mathstretch="h", +-- unicodeslot=0xFE3DF, +--}, + [0xFE932]={ -- vfu + description="SMASHED PRIME 0x02032", + unicodeslot=0xFE932, + }, + [0xFE933]={ -- vfu + description="SMASHED PRIME 0x02033", + unicodeslot=0xFE933, + }, + [0xFE934]={ -- vfu + description="SMASHED PRIME 0x02034", + unicodeslot=0xFE934, + }, + [0xFE935]={ -- vfu + description="SMASHED BACKWARD PRIME 0x02035", + unicodeslot=0xFE935, + }, + [0xFE936]={ -- vfu + description="SMASHED BACKWARD PRIME 0x02036", + unicodeslot=0xFE936, + }, + [0xFE937]={ -- vfu + description="SMASHED BACKWARD PRIME 0x02037", + unicodeslot=0xFE937, + }, + -- + [0xFE942]={ + description="COMBINING REVERSE ANNUITY SYMBOL BASE", + unicodeslot=0xFE942, + }, + [0xFE943]={ + description="COMBINING REVERSE ANNUITY SYMBOL FILL", + unicodeslot=0xFE942, + }, + -- + [0xFE944]={ + description="COMBINING FOURIER CIRCUMFLEX BASE", + unicodeslot=0xFE942, + }, + [0xFE945]={ + description="COMBINING FOURIER CIRCUMFLEX FILL", + unicodeslot=0xFE942, + }, + [0xFE946]={ + description="COMBINING FOURIER TILDE BASE", + unicodeslot=0xFE942, + }, + [0xFE947]={ + description="COMBINING FOURIER TILDE FILL", + unicodeslot=0xFE942, + }, + [0xFE948]={ + description="COMBINING FOURIER CARON BASE", + unicodeslot=0xFE942, + }, + [0xFE949]={ + description="COMBINING FOURIER CARON FILL", + unicodeslot=0xFE942, + }, + -- + [0xFE957]={ -- vfu + description="SMASHED PRIME 0x02057", + unicodeslot=0xFE957, + }, +} + +-- print(table.serialize(characters.private,"characters.private", { hexify = true, noquotes = true })) diff --git a/tex/context/base/mkxl/char-tex.lmt b/tex/context/base/mkxl/char-tex.lmt index 3d8f6a259..e5ce1c4ab 100644 --- a/tex/context/base/mkxl/char-tex.lmt +++ b/tex/context/base/mkxl/char-tex.lmt @@ -770,24 +770,36 @@ if not csletters then storage.register("characters/csletters", csletters, "characters.csletters") end + local function setname(category,chr,u,contextname) + if is_character[category] then + if chr.unicodeslot < 128 then + if is_letter[category] then + texsetmacro(contextname,utfchar(u),"immutable") + else + texsetchar(contextname,u,"immutable") + end + else + texsetmacro(contextname,utfchar(u),"immutable") + end + elseif is_command[category] and not forbidden[u] then + texsetmacro(contextname,utfchar(u),"immutable") + end + end + function characters.setcharacternames(ctt) for u, chr in next, data do -- will move up local contextname = chr.contextname + local contextspec = chr.contextspec local category = chr.category - local isletter = is_letter[category] if contextname then - if is_character[category] then - if chr.unicodeslot < 128 then - if isletter then - texsetmacro(contextname,utfchar(u),"immutable") - else - texsetchar(contextname,u,"immutable") - end - else - texsetmacro(contextname,utfchar(u),"immutable") + setname(category,chr,u,contextname) + end + if contextspec then + for i=1,#contextspec do + local extraname = contextspec[i] + if extraname ~= contextname then + setname(category,chr,u,extraname) end - elseif is_command[category] and not forbidden[u] then - texsetmacro(contextname,utfchar(u),"immutable") end end end diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 8b974f841..006494969 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2022.08.05 17:16} +\newcontextversion{2022.08.25 17:38} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 6d8c81284..c873ff912 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2022.08.05 17:16} +\immutable\edef\contextversion{2022.08.25 17:38} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error @@ -40,6 +40,8 @@ \immutable\chardef\contextlmtxmode\directlua{tex.print(CONTEXTLMTXMODE or 0)}\relax +\directlua{io.output():setvbuf("line")} + %D For those who want to use this: \aliased\let\fmtname \contextformat @@ -401,8 +403,7 @@ \loadmkxlfile{tabl-tab} % thrd-tab stripped and merged \loadmkxlfile{tabl-tbl} -%loadmkxlfile{tabl-ntb} -\doiffileelse{tabl-ntb-new.mkxl}{\loadmkxlfile{tabl-ntb-new}}{\loadmkxlfile{tabl-ntb}} +\loadmkxlfile{tabl-ntb} \loadmkxlfile{tabl-nte} \loadmkxlfile{tabl-ltb} \loadmkxlfile{tabl-frm} @@ -494,6 +495,7 @@ \loadmkxlfile{math-lop} \loadmklxfile{math-acc} \loadmklxfile{math-rad} +\loadmklxfile{math-del} \loadmkxlfile{math-inl} \loadmkxlfile{math-dis} %loadmkxlfile{math-lan} diff --git a/tex/context/base/mkxl/file-mod.mklx b/tex/context/base/mkxl/file-mod.mklx index 3a966894f..56e12f72a 100644 --- a/tex/context/base/mkxl/file-mod.mklx +++ b/tex/context/base/mkxl/file-mod.mklx @@ -29,6 +29,15 @@ %D More information on the specific modules can be found in their dedicated manuals. %D We use \type {\next} so that we can \type {\end} in modules. +% \enabledirectives[logs.errors=*] +% \enabledirectives[logs.errors=missing modules] +% +% \usemodule[letsquit] +% +% \starttext +% test +% \stoptext + \installcorenamespace{module} \mutable\let\currentmodule \s!unknown diff --git a/tex/context/base/mkxl/font-col.lmt b/tex/context/base/mkxl/font-col.lmt index 12603a0dd..1bce9b3a9 100644 --- a/tex/context/base/mkxl/font-col.lmt +++ b/tex/context/base/mkxl/font-col.lmt @@ -26,6 +26,7 @@ local nextchar = nuts.traversers.char local getscales = nuts.getscales local setscales = nuts.setscales local setprop = nuts.setprop +local getcharspec = nuts.getcharspec local settings_to_hash = utilities.parsers.settings_to_hash @@ -411,63 +412,80 @@ end -- todo: also general one for missing +local function apply(n,char,font,vector,vect) + local kind = type(vect) + local newfont, newchar + if kind == "table" then + newfont = vect[1] + newchar = vect[2] + if trace_collecting then + report_fonts("remapping character %C in font %a to character %C in font %a%s", + char,font,newchar,newfont,not chardata[newfont][newchar] and " (missing)" or "" + ) + end + elseif kind == "function" then + newfont, newchar = vect(font,char,vector) + if not newfont then + newfont = font + end + if not newchar then + newchar = char + end + if trace_collecting then + report_fonts("remapping character %C in font %a to character %C in font %a%s", + char,font,newchar,newfont,not chardata[newfont][newchar] and " (missing)" or "" + ) + end + vector[char] = { newfont, newchar } + else + local fakemono = vector.factor + if trace_collecting then + report_fonts("remapping font %a to %a for character %C%s", + font,vect,char,not chardata[vect][char] and " (missing)" or "" + ) + end + newfont = vect + if fakemono then + newchar = monoslot(vect,char,font,fakemono) + else + newchar = char + end + end + local rscale = vector.rscale + if rscale and rscale ~= 1 then + local s, x, y = getscales(n) + setscales(n,s*rscale,x*rscale,y*rscale) + end + setfont(n,newfont,newchar) + setprop(n, "original", { font = font, char = char }) +end + function collections.process(head) -- this way we keep feature processing for n, char, font in nextchar, head do local vector = validvectors[font] if vector then local vect = vector[char] if vect then - local kind = type(vect) - local newfont, newchar - if kind == "table" then - newfont = vect[1] - newchar = vect[2] - if trace_collecting then - report_fonts("remapping character %C in font %a to character %C in font %a%s", - char,font,newchar,newfont,not chardata[newfont][newchar] and " (missing)" or "" - ) - end - elseif kind == "function" then - newfont, newchar = vect(font,char,vector) - if not newfont then - newfont = font - end - if not newchar then - newchar = char - end - if trace_collecting then - report_fonts("remapping character %C in font %a to character %C in font %a%s", - char,font,newchar,newfont,not chardata[newfont][newchar] and " (missing)" or "" - ) - end - vector[char] = { newfont, newchar } - else - local fakemono = vector.factor - if trace_collecting then - report_fonts("remapping font %a to %a for character %C%s", - font,vect,char,not chardata[vect][char] and " (missing)" or "" - ) - end - newfont = vect - if fakemono then - newchar = monoslot(vect,char,font,fakemono) - else - newchar = char - end - end - local rscale = vector.rscale - if rscale and rscale ~= 1 then - local s, x, y = getscales(n) - setscales(n,s*rscale,x*rscale,y*rscale) - end - setfont(n,newfont,newchar) - setprop(n, "original", { font = font, char = char }) + apply(n,char,font,vector,vect) end end end return head end +function collections.direct(n) + local char, font = getcharspec(n) + if font and char then + local vector = validvectors[font] + if vector then + local vect = vector[char] + if vect then + apply(n,char,font,vector,vect) + end + end + end +end + function collections.found(font,char) -- this way we keep feature processing if not char then font, char = currentfont(), font diff --git a/tex/context/base/mkxl/font-con.lmt b/tex/context/base/mkxl/font-con.lmt index 5763d1039..ddaf8afb1 100644 --- a/tex/context/base/mkxl/font-con.lmt +++ b/tex/context/base/mkxl/font-con.lmt @@ -815,6 +815,10 @@ function constructors.scale(tfmdata,specification) if vc then chr.commands = scalecommands(vc,hdelta,vdelta) end + local cb = character.callback + if cb then + chr.callback = cb + end -- we assume that these are done in a manipulator afterwards -- as it makes no sense otherwise -- local vx = character.xoffset diff --git a/tex/context/base/mkxl/font-imp-checks.lmt b/tex/context/base/mkxl/font-imp-checks.lmt new file mode 100644 index 000000000..120f89c49 --- /dev/null +++ b/tex/context/base/mkxl/font-imp-checks.lmt @@ -0,0 +1,40 @@ +if not modules then modules = { } end modules ['font-imp-checks'] = { + version = 1.001, + comment = "companion to font-ini.mkiv", + author = "Hans Hagen, PRAGMA ADE", + copyright = "ConTeXt Development Team", + license = "see context related readme files" +} + +if not context then return end + +local function initialize(tfmdata,value) + if value then + local characters = tfmdata.characters + if not characters[0x2012] then + local data = characters[0x2013] + local zero = characters[0x0030] + if data and zero then + local copy = table.copy(data) + local width = zero.width or 0 + if width > 0 then + characters[0x2012] = copy + copy.effect = { + extend = width/copy.width + } + copy.width = width + end + end + end + end +end + +fonts.handlers.otf.features.register { + name = "checkmissing", + description = "checkmissing", + manipulators = { + base = initialize, + node = initialize, + } +} + diff --git a/tex/context/base/mkxl/font-imp-scripts.lmt b/tex/context/base/mkxl/font-imp-scripts.lmt index 3e5eaa596..8cfbb9ac2 100644 --- a/tex/context/base/mkxl/font-imp-scripts.lmt +++ b/tex/context/base/mkxl/font-imp-scripts.lmt @@ -121,7 +121,7 @@ local function initialize(tfmdata,key,value) local detail = type(value) == "string" and settings_to_hash(value) or { } local orientation = tonumber(detail.orientation) or 0 if orientation == 1 or orientation == 3 then - local characters = tfmdata.characters + local characters = tfmdata.characters local parameters = tfmdata.parameters local emwidth = parameters.quad local exheight = parameters.xheight @@ -146,12 +146,12 @@ local function initialize(tfmdata,key,value) local width = character.width or 0 local height = character.height or 0 local depth = character.depth or 0 - character.width = height + depth + rightshift + rightshift +-- character.width = height + depth + rightshift + rightshift character.height = width - downshift character.depth = shift - character.xoffset = height + rightshift - character.yoffset = - downshift - character.orientation = orientation +-- character.xoffset = height + rightshift +-- character.yoffset = - downshift +-- character.orientation = orientation end end if ranges then diff --git a/tex/context/base/mkxl/font-lib.mklx b/tex/context/base/mkxl/font-lib.mklx index b9a79c0d9..f7342c7d4 100644 --- a/tex/context/base/mkxl/font-lib.mklx +++ b/tex/context/base/mkxl/font-lib.mklx @@ -101,6 +101,7 @@ % extensions, order matters +\registerctxluafile{font-imp-checks}{autosuffix} \registerctxluafile{font-imp-ligatures}{autosuffix} \registerctxluafile{font-imp-tex}{} \registerctxluafile{font-imp-reorder}{} diff --git a/tex/context/base/mkxl/font-mps.lmt b/tex/context/base/mkxl/font-mps.lmt index 8cab9cf5c..9a123a25e 100644 --- a/tex/context/base/mkxl/font-mps.lmt +++ b/tex/context/base/mkxl/font-mps.lmt @@ -118,6 +118,7 @@ function metapost.paths(d,xfactor,yfactor) end end elseif segments then +-- inspect(segments) for i=1,#segments do local segment = segments[i] local operator = segment[#segment] @@ -137,7 +138,7 @@ function metapost.paths(d,xfactor,yfactor) elseif operator == "c" then -- "curveto" size = size + 1 path[size] = f_curveto(xfactor*segment[1],yfactor*segment[2],xfactor*segment[3],yfactor*segment[4],xfactor*segment[5],yfactor*segment[6]) - elseif operator =="q" then -- "quadraticto" + elseif operator == "q" then -- "quadraticto" size = size + 1 -- first is always a moveto local prev = segments[i-1] diff --git a/tex/context/base/mkxl/font-ots.lmt b/tex/context/base/mkxl/font-ots.lmt index e5c5db2fa..3b7e6dbc3 100644 --- a/tex/context/base/mkxl/font-ots.lmt +++ b/tex/context/base/mkxl/font-ots.lmt @@ -325,6 +325,22 @@ local checkstep = (tracers and tracers.steppers.check) or function() local registerstep = (tracers and tracers.steppers.register) or function() end local registermessage = (tracers and tracers.steppers.message) or function() end +do + + local setchr = setchar + local direct = nil + + setchar = function(n,c) + direct = fonts.collections.direct + setchar = function(n,c) + setchr(n,c) + direct(n) + end + setchar(n,c) + end + +end + local function logprocess(...) if trace_steps then registermessage(...) @@ -542,6 +558,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou if start == stop and getchar(start) == char and not hasmarks then resetinjection(start) setchar(start,char) +-- fonts.collections.direct(start) return head, start end if inhibited(start,stop) then @@ -558,6 +575,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou end resetinjection(base) setchar(base,char) +-- fonts.collections.direct(base) setoptions(base,getoptions(start) | getoptions(stop)) -- maybe only lig options -- setsubtype(base,ligatureglyph_code) setcomponents(base,comp) diff --git a/tex/context/base/mkxl/font-pre.mkxl b/tex/context/base/mkxl/font-pre.mkxl index d77869e27..3c7a01857 100644 --- a/tex/context/base/mkxl/font-pre.mkxl +++ b/tex/context/base/mkxl/font-pre.mkxl @@ -47,6 +47,13 @@ % % dtls flac :math +%D The missing feature: +%D +%D \starttyping +%D \ruledhbox{\char"2012}\par % figuredash +%D \ruledhbox{0}\par +%D \stoptyping + \definefontfeature [always] [mode=node, % we had 'auto', but let's try 'node' for a while and see what the impact is @@ -54,6 +61,7 @@ autoscript=position, autolanguage=position, textcontrol=collapsehyphens, + checkmissing=yes, kern=yes, % consider skipping the base passes when no base mode is used mark=yes, mkmk=yes, @@ -404,7 +412,7 @@ [mode=base, % mode=none, % better, maybe do this last kern=yes, -% flac=yes, +% flac=yes, % handled differently % liga=yes, % makes no sense % mode=node, % mathnolimitsmode={0,800}, % now in lfg files diff --git a/tex/context/base/mkxl/font-tex.lmt b/tex/context/base/mkxl/font-tex.lmt index 1c3c17a79..2d21687df 100644 --- a/tex/context/base/mkxl/font-tex.lmt +++ b/tex/context/base/mkxl/font-tex.lmt @@ -6,22 +6,23 @@ if not modules then modules = { } end modules ['font-mpf'] = { license = "see context related readme files" } -local formatters = string.formatters -local sortedhash = table.sortedhash +local formatters = string.formatters +local sortedhash = table.sortedhash -local addcharacters = fonts.constructors.addcharacters -local fontdata = fonts.hashes.identifiers +local addcharacters = fonts.constructors.addcharacters +local fontdata = fonts.hashes.identifiers +local fontchars = fonts.hashes.characters -local otf = fonts.handlers.otf -local otfregister = otf.features.register +local otf = fonts.handlers.otf +local otfregister = otf.features.register ------ getshapes = fonts.dropins.getshapes +----- getshapes = fonts.dropins.getshapes -local register = fonts.collections.register -local checkenabled = fonts.collections.checkenabled -local newprivateslot = fonts.helpers.newprivateslot +local register = fonts.collections.register +local checkenabled = fonts.collections.checkenabled +local newprivateslot = fonts.helpers.newprivateslot -local currentfont = font.current +local currentfont = font.current -- hm, seems to gobble the first \char @@ -84,7 +85,7 @@ local function setboxglyph(specification) end end -function fonts.helpers.setboxdirectly(font,unicode,box) -- hash based on wd/ht/dp +local function setboxdirectly(font,unicode,box) -- hash based on wd/ht/dp if box then local tfmdata = fontdata[font] local glyphboxes = (tfmdata.glyphboxes or 0) + 1 @@ -108,6 +109,8 @@ function fonts.helpers.setboxdirectly(font,unicode,box) -- hash based on wd/ht/d end end +fonts.helpers.setboxdirectly = setboxdirectly + local boxes = table.setmetatableindex("table") function fonts.helpers.registerglyphbox(specification) @@ -182,3 +185,34 @@ fonts.handlers.otf.features.register { -- fonts.helpers.registerboxglyph { category = "demo", unicode = 104 } -- fonts.helpers.registerboxglyph { category = "demo", unicode = 105 } -- fonts.helpers.registerboxglyph { category = "demo", unicode = 106 } + +local callbacks = fonts.callbacks or { } +fonts.callbacks = callbacks + +function callbacks.devirtualize(chardata,f,c) + if chardata.commands then + local h = node.hpack(nodes.pool.glyph(f,c)) + local p = setboxdirectly(f,c,h) + chardata.oldcommands = chardata.commands + chardata.commands = { { "char", p } } + chardata.callback = false + end +end + +local function processcallback(f,c) + local characters = fontchars[f] + local chardata = characters[c] + if chardata then + local callback = chardata.callback + if callback then + local action = type(callback) == "function" and callback or callbacks[callback] + if action then + action(chardata,f,c) + end + end + end +end + +callback.register("process_character",processcallback) + +callbacks.callback = processcallback diff --git a/tex/context/base/mkxl/font-tpk.lmt b/tex/context/base/mkxl/font-tpk.lmt index d216bc257..bf74dedd9 100644 --- a/tex/context/base/mkxl/font-tpk.lmt +++ b/tex/context/base/mkxl/font-tpk.lmt @@ -622,15 +622,15 @@ do local extensibles = { } for i=0,ne-1 do extensibles[i] = wide and { - top = readcardinal2(s), - bot = readcardinal2(s), - mid = readcardinal2(s), - rep = readcardinal2(s), + top = readcardinal2(s), + bottom = readcardinal2(s), + middle = readcardinal2(s), + extender = readcardinal2(s), } or { - top = readcardinal1(s), - bot = readcardinal1(s), - mid = readcardinal1(s), - rep = readcardinal1(s), + top = readcardinal1(s), + bottom = readcardinal1(s), + middle = readcardinal1(s), + extender = readcardinal1(s), } end for i=1,np do diff --git a/tex/context/base/mkxl/lang-ini.mkxl b/tex/context/base/mkxl/lang-ini.mkxl index f964a5083..ff9f5cfda 100644 --- a/tex/context/base/mkxl/lang-ini.mkxl +++ b/tex/context/base/mkxl/lang-ini.mkxl @@ -891,4 +891,20 @@ \clf_setlanguageoptions{\askedlanguage}{#2}% \endgroup} +% \startluacode +% table.save("oeps-fixes.llg", { +% name = "demo", +% options = { +% { patterns = { fio = "f|io" }, words = [[ fioot fiots ]] }, +% { patterns = { fio = "t|h" }, words = [[ this that ]] }, +% }, +% }) +% \stopluacode +% +% \setuplanguage[en][goodies={oeps-fixes.llg}] \setupbodyfont[ebgaramond] +% +% \starttext +% fiets fiots fiats fioot this that +% \stoptext + \protect \endinput diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index 7dbbe0cb7..76867974a 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -2133,7 +2133,7 @@ local finalize do pdf_goto_pagemode() -- for now local objnum = details.objnum - local specification = details.specification + local specification = details.specification or { } local content = concat(buffer,"\n",1,b) diff --git a/tex/context/base/mkxl/luat-cod.lmt b/tex/context/base/mkxl/luat-cod.lmt index 6a7ebdd0b..f96f5c577 100644 --- a/tex/context/base/mkxl/luat-cod.lmt +++ b/tex/context/base/mkxl/luat-cod.lmt @@ -290,7 +290,10 @@ local function open_data_file(name) return { reader = function() return f:read("*line") - end + end, + -- close = function() + -- f:close() + -- end } else return false diff --git a/tex/context/base/mkxl/math-acc.mklx b/tex/context/base/mkxl/math-acc.mklx index baa24fcea..9d51ba697 100644 --- a/tex/context/base/mkxl/math-acc.mklx +++ b/tex/context/base/mkxl/math-acc.mklx @@ -18,29 +18,17 @@ \unprotect -% This module permits overloading of accents so that we can do fancy things. The -% implementation is similar to stackers. By default accenst are defined in a simple -% way. Contrary to extensibles accents cannot grow indefinitely. Alas the -% implementation of accents is different too, in the sense that they are -% prepositioned i.e. are already raised. (In my opinion for no real reason as they -% need to adapt anyway). -% -% $ \ruledhbox{$H$} \hat{H} \ruledhbox{$\widehat{H}$} \widehat{H} $ -% -% One alternative is: -% -% \definemathoverextensible [top] [hoed] ["FE302] -% \definemathoverextensible [top] [slang] ["FE303] -% -% $ \hoed{H} \ruledhbox{$\hoed{H}$} \ruledhbox{$\hoed{\tf H}$} \slang{H} $ -% -% But that nills the italic correction (and I'm in nood to mess with that again). -% -% \definemathaccents [myaccents] [color=darkred] -% \definemathtopaccent [myaccents] [mywidehat] ["0302] -% -% $ \hat{H} \widehat{H} \mywidehat{H} $ - +%D This module permits overloading of accents so that we can do fancy things. The +%D implementation is similar to stackers. By default accenst are defined in a simple +%D way. Contrary to extensibles accents cannot grow indefinitely. Alas the +%D implementation of accents is different too, in the sense that they are +%D prepositioned i.e. are already raised. (In my opinion for no real reason as they +%D need to adapt anyway). +%D +%D In \MKIV\ we used virtual characters in the "FE* range but in \LMTX\ we do it a bit +%D different as we have a more powerful virtual subsystem. For details on the older +%D but neat approach see the lua and mkiv files. +%D %D Older implementations are kept in the \MKII\ and \MKIV\ modules for educational %D purposes. @@ -120,32 +108,33 @@ \newconditional\c_math_accent_auto_dotless \settrue\c_math_accent_auto_dotless % cf opentype math -\aliased\let\normalgrave\grave -\aliased\let\normalddot \ddot -\aliased\let\normalbar \bar -\aliased\let\normalacute\acute -\aliased\let\normalhat \hat -\aliased\let\normalcheck\check -\aliased\let\normalbreve\breve -\aliased\let\normaldot \dot -\aliased\let\normalring \ring -\aliased\let\normaltilde\tilde -\aliased\let\normaldddot\dddot +% \aliased\let\normalgrave\grave +% \aliased\let\normalddot \ddot +% \aliased\let\normalbar \bar +% \aliased\let\normalacute\acute +% \aliased\let\normalhat \hat \aliased\let\normalwidehat \widehat +% \aliased\let\normalcheck\check +% \aliased\let\normalbreve\breve +% \aliased\let\normaldot \dot +% \aliased\let\normalring \ring +% \aliased\let\normaltilde\tilde +% \aliased\let\normaldddot\dddot \pushoverloadmode -% these are not stretched ... we should adapt char-def.lua to use these: - -\definemathtopaccent[\v!top][grave]["60] -\definemathtopaccent[\v!top][ddot] ["A8] -\definemathtopaccent[\v!top][bar] ["AF] -\definemathtopaccent[\v!top][acute]["B4] -\definemathtopaccent[\v!top][hat] ["2C6] % "302 -\definemathtopaccent[\v!top][check]["2C7] -\definemathtopaccent[\v!top][breve]["2D8] -\definemathtopaccent[\v!top][dot] ["2D9] -\definemathtopaccent[\v!top][ring] ["2DA] -\definemathtopaccent[\v!top][tilde]["2DC] +% These retain the given unicode values ... but can stretch when configured +% to do so: \setupmathaccent[\v!top][\c!stretch=\v!yes] + +\definemathtopaccent[\v!top][grave]["0060] % these are old school +\definemathtopaccent[\v!top][ddot] ["00A8] +\definemathtopaccent[\v!top][bar] ["00AF] +\definemathtopaccent[\v!top][acute]["00B4] +\definemathtopaccent[\v!top][hat] ["02C6] +\definemathtopaccent[\v!top][check]["02C7] +\definemathtopaccent[\v!top][breve]["02D8] +\definemathtopaccent[\v!top][dot] ["02D9] +\definemathtopaccent[\v!top][ring] ["02DA] +\definemathtopaccent[\v!top][tilde]["02DC] \definemathtopaccent[\v!top][dddot]["20DB] \definemathaccent @@ -156,16 +145,16 @@ %D We have a problem. We can use stackers but then we need to adapt the dimensions %D which is font dependent. So, for now we keep them as accents. -\definemathtopaccent[\v!top:\v!stretch][widegrave]["0300] % ["060] -\definemathtopaccent[\v!top:\v!stretch][wideddot] ["0308] % ["0A8] -\definemathtopaccent[\v!top:\v!stretch][widebar] ["0304] % ["0AF] -\definemathtopaccent[\v!top:\v!stretch][wideacute]["0301] % ["0B4] -\definemathtopaccent[\v!top:\v!stretch][widehat] ["0302] % ["2C6] -\definemathtopaccent[\v!top:\v!stretch][widecheck]["030C] % ["2C7] -\definemathtopaccent[\v!top:\v!stretch][widebreve]["0306] % ["2D8] -\definemathtopaccent[\v!top:\v!stretch][widedot] ["0307] % ["2D9] -\definemathtopaccent[\v!top:\v!stretch][widering] ["030A] % ["2DA] -\definemathtopaccent[\v!top:\v!stretch][widetilde]["0303] % ["2DC] +\definemathtopaccent[\v!top:\v!stretch][widegrave]["0300] % these are generic modern +\definemathtopaccent[\v!top:\v!stretch][wideddot] ["0308] +\definemathtopaccent[\v!top:\v!stretch][widebar] ["0304] +\definemathtopaccent[\v!top:\v!stretch][wideacute]["0301] +\definemathtopaccent[\v!top:\v!stretch][widehat] ["0302] +\definemathtopaccent[\v!top:\v!stretch][widecheck]["030C] +\definemathtopaccent[\v!top:\v!stretch][widebreve]["0306] +\definemathtopaccent[\v!top:\v!stretch][widedot] ["0307] +\definemathtopaccent[\v!top:\v!stretch][widering] ["030A] +\definemathtopaccent[\v!top:\v!stretch][widetilde]["0303] \definemathtopaccent[\v!top:\v!stretch][widedddot]["20DB] \aliased\let\mathring\ring % for a while diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index 89d7d3153..14c0a94ce 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['math-act'] = { -- have been removed (no longer viable) but can be found in the .lua variant. local type, next, tonumber = type, next, tonumber -local fastcopy, insert, remove = table.fastcopy, table.insert, table.remove +local fastcopy, copytable, insert, remove = table.fastcopy, table.copy, table.insert, table.remove local formatters = string.formatters local byte = string.byte local setmetatableindex, sortedhash = table.setmetatableindex, table.sortedhash @@ -34,7 +34,9 @@ local stepper = utilities.parsers.stepper local helpers = fonts.helpers local upcommand = helpers.commands.up +local downcommand = helpers.commands.down local rightcommand = helpers.commands.right +local leftcommand = helpers.commands.left local charcommand = helpers.commands.char local prependcommands = helpers.prependcommands @@ -98,6 +100,7 @@ function mathematics.initializeparameters(target,original) if not mathparameters.AccentBottomOvershoot then mathparameters.AccentBottomOvershoot = 0 end if not mathparameters.AccentSuperscriptDrop then mathparameters.AccentSuperscriptDrop = 0 end if not mathparameters.AccentSuperscriptPercent then mathparameters.AccentSuperscriptPercent = 0 end + if not mathparameters.AccentExtendMargin then mathparameters.AccentExtendMargin = 50 end if not mathparameters.DelimiterPercent then mathparameters.DelimiterPercent = 100 end if not mathparameters.DelimiterShortfall then mathparameters.DelimiterShortfall = 0 end -- @@ -373,13 +376,24 @@ do k = mathgaps[k] or k local character = targetcharacters[k] if character then - if not character.tweaked then -- todo: add a force +-- if not character.tweaked then -- todo: add a force local t = type(v) if t == "number" then v = list[v] t = type(v) end if t == "table" and next(v) then + local factor = v.factor + if factor then + local m = v + v = setmetatableindex({ + width = factor, + height = factor, + depth = factor, + squeeze = factor, + extend = factor, + }, v) + end local original = v.original if not original then local delta = v.delta @@ -391,7 +405,7 @@ do original = mathgaps[original] or original local data = targetcharacters[original] if data then - data = table.copy(data) + data = copytable(data) data.unicode = original targetcharacters[k] = data character = data @@ -478,7 +492,7 @@ do else report_mathtweak("invalid dimension entry %U",k) end - character.tweaked = true +-- character.tweaked = true if v.all then local nxt = character.next if nxt then @@ -492,7 +506,7 @@ do end end end - end +-- end else report_tweak("no character %U",target,original,k) end @@ -769,7 +783,6 @@ do -- see changed hack in math-fbk - local copytable = table.copy local nps = fonts.helpers.newprivateslot local list = { @@ -920,7 +933,6 @@ end do - local copytable = table.copy local nps = fonts.helpers.newprivateslot local privates = { @@ -996,7 +1008,6 @@ do if preset then local p = predefined[preset] if p then - -- p = table.copy(p) v = table.combine(p,v) p.preset = nil else @@ -1287,7 +1298,7 @@ do } local function adapt(c,factor,baseheight,basedepth) - if not c.tweaked then +-- if not c.tweaked then local height = c.height or 0 local depth = c.depth or 0 local yoffset = 0 @@ -1313,8 +1324,8 @@ do c.yoffset = yoffset ~= 0 and yoffset or nil c.height = height > 0 and height or nil c.depth = depth > 0 and depth or nil - c.tweaked = true - end +-- c.tweaked = true +-- end end local function process(target,original,characters,list,baseheight,basedepth) @@ -1383,6 +1394,9 @@ end do + local addprivate = fonts.helpers.addprivate + local privateslot = fonts.helpers.privateslot + -- function mathtweaks.addrules(target,original,parameters) -- local characters = target.characters -- local height = target.mathparameters.OverbarRuleThickness @@ -1436,8 +1450,6 @@ do -- -- lucida lacks them ... -- - local addprivate = fonts.helpers.addprivate - -- local half = thickness / 2 local double = thickness * 2 -- @@ -1483,6 +1495,215 @@ do } } end + -- + end + + local force = false experiments.register("math.arrows", function(v) force = v end) + + local function tighten(target,unicode,left,right,squeeze,yoffset) + local name = string.formatters["math tightened %U %.3N %.3N %.3N %.3N"](unicode,left,right,squeeze,yoffset) + local slot = privateslot(target,name) + if not slot then + local characters = target.characters + local data = copytable(characters[unicode]) + local width = data.width + data.advance = width + data.width = width * (1-left-right) + data.xoffset = width * -left + if squeeze ~= 1 then + data.effect = { squeeze = squeeze } + end + if yoffset ~= 0 then + data.yoffset = (data.height or 0) * yoffset + end + slot = addprivate(target,name,data) + end + return slot + end + + local function create(target,unicode,list,overloads) + local characters = target.characters + local chardata = characters[unicode] + if chardata then + local endpoint = unicode + while chardata.next do + chardata = characters[chardata.next] + end +-- if chardata and (force or not chardata.hparts) then + if chardata and (force or overloads[unicode] == false or not chardata.hparts) then + if not list then + chardata.hparts = nil -- when we test + else + local overload = overloads[unicode] + local hparts = { } + for i=1,#list do + local part = list[i] + local glyph = part.glyph or unicode + local check = overloads[glyph] + local left = (check and check.left ) or part.left or 0 + local right = (check and check.right ) or part.right or 0 + local squeeze = check and check.squeeze or 1 + local yoffset = check and check.yoffset or 0 + if left~= 0 or right ~= 0 or squeeze ~= 1 or yoffset ~= 0 then + glyph = tighten(target,glyph,left,right,squeeze,yoffset) + end + local width = characters[glyph].width + local step = width/2 + if part.extensible then + hparts[#hparts+1] = { + advance = width, + glyph = glyph, + ["end"] = step, + start = step, + extender = 1, + } + else + hparts[#hparts+1] = { + advance = width, + glyph = glyph, + ["end"] = 0, + start = step, + } + end + end + if #hparts == #list then + chardata.hparts = hparts + end + end + end + end + end + + -- Unicode math lacks the arrow snippet while it does have fence snippets. Also, some + -- fonts have a relbar that doesn't match the double arrow. + -- + -- { + -- tweak = "addarrows", + -- list = { [0x3D] = { squeeze = .85, yoffset = .0975 } } + -- }, + -- + -- We have no begin and end snippet, so I played with centering and rules at the edges + -- + -- [0x21A9] = { -- hookleftarrow + -- { glyph = 0x2212, left = slack, extensible = true }, + -- { glyph = 0x21A9, right = slack }, + -- { glyph = 0x2212, right = slack, extensible = true }, + -- } + -- + -- but in the end rejected it. + + local function initialize(left, right, slack) + -- We save some space with locals. When no glyph is given the unicode itself is + -- used which also saves some. + local single = { glyph = 0x2212, left = slack, right = slack, extensible = true } + local double = { glyph = 0x003D, left = slack, right = slack, extensible = true } + local triple = { glyph = 0x2261, left = slack, right = slack, extensible = true } + ----- spacer = { glyph = 0x0020, left = slack, right = slack, extensible = true } + local slackslack = { left = slack, right = slack } + local leftslack = { left = left, right = slack } + local slackright = { left = slack, right = right } + ----- centered = { spacer, { }, spacer } + local centered = false -- the luametatex engine does this + local singleright = { single, slackright } + local leftsingle = { leftslack, single } + return { + -- + [0x002D] = { { left = slack, right = slack, glyph = 0x2212 }, single }, -- rel + -- + [0x2190] = leftsingle, -- leftarrow + [0x219E] = leftsingle, -- twoheadleftarrow + [0x21BC] = leftsingle, -- leftharpoonup + [0x21BD] = leftsingle, -- leftharpoondown + -- + [0x2192] = singleright, -- rightarrow + [0x21A0] = singleright, -- twoheadrightarrow + [0x21C0] = singleright, -- rightharpoonup + [0x21C1] = singleright, -- rightharpoondown + -- + [0x003D] = { slackslack, double }, -- equaltext + [0x2261] = { slackslack, triple }, -- triplerel + [0x27F8] = { leftslack, double }, -- Leftarrow + [0x27F9] = { double, slackright }, -- Rightarrow + -- + [0x21A9] = centered, -- hookleftarrow + [0x21AA] = centered, -- hookrightarrow + [0x21CB] = centered, -- leftrightharpoons + [0x21CC] = centered, -- rightleftharpoons + [0x21C4] = centered, -- rightoverleftarrow + [0x21A6] = centered, -- mapsto + -- + [0x203E] = { slackslack, { left = slack, right = slack, extensible = true } }, -- bar + -- + [0x27F7] = { { glyph = 0x2190, left = left, right = slack }, single, { glyph = 0x2192, left = slack, right = right } }, -- leftrightarrow rightleftarrow + [0x27FA] = { { glyph = 0x27F8, left = left, right = slack }, double, { glyph = 0x27F9, left = slack, right = right } }, -- Leftrightarrow Rightleftarrow + } + end + + function mathtweaks.addarrows(target,original,parameters) + local overloads = parameters.list or { } -- { [unicode] = { left = .1, right = .1 } } + local left = parameters.left or 0.05 + local right = parameters.right or 0.05 + local slack = parameters.slack or 0.1 + local arrows = initialize(left,right,slack) + -- inspect(arrows) + for unicode, list in sortedhash(arrows) do + create(target,unicode,list,overloads) + end + end + +end + +do -- this could be combined with the previous + + function mathtweaks.addparts(target,original,parameters) + local characters = target.characters + local list = parameters.list + if list then + for unicode, data in sortedhash(list) do + local template = data.template + if template then + local source = characters[template] + local target = characters[unicode] + if source and target then + local sequence = data.sequence + local horizontal = data.horizontal + if sequence then + local parts = horizontal and source.hparts or source.vparts + if parts then + local p = { } + for i=1,#sequence do + local step = sequence[i] + local glyph = step.glyph + if glyph == "first" or glyph == "last" then + local g = glyph == "first" and 1 or #parts + local c = fastcopy(parts[g]) + local f = step.factor + if f then + c["end"] = f * (c["end"] or 0) + c.start = f * (c.start or 0) + end + p[#p+1] = c + else + local c = characters[glyph] + if c then + p[#p+1] = { + glyph = glyph, + advance = c.width, + start = 0, + ["end"] = 0, + } + end + end + end + if #p > 0 then + target[horizontal and "hparts" or "vparts"] = p + end + end + end + end + end + end + end end end @@ -1610,6 +1831,446 @@ end do + local mapping = { + [0x002F] = 0x2044, + } + + function mathtweaks.fixslashes(target,original,parameters) + local characters = target.characters + for normal, weird in sortedhash(mapping) do + local normalone = characters[normal] + local weirdone = characters[weird] + if normalone and weirdone and not normalone.next then + normalone.next = weirdone.next + if trace_tweaking then + report_tweak("extensibles from %U used for %U",target,original,weird,normal) + end + end + weirdone = copytable(normalone) + characters[weird] = weirdone + weirdone.unicode = weird + end + end + +end + +do -- see pagella for an extensive example + + local mapping = { + [0x0300] = { 0x0060, false }, -- aliases can be a table + [0x0308] = { 0x00A8, false }, + [0x0304] = { 0x00AF, false }, + [0x0301] = { 0x00B4, false }, + [0x0302] = { 0x02C6, true }, + [0x030C] = { 0x02C7, true }, + [0x0306] = { 0x02D8, false }, + [0x0307] = { 0x02D9, false }, + [0x030A] = { 0x02DA, false }, + [0x0303] = { 0x02DC, true }, + [0x20DB] = { 0x20DB, false }, + } + +local hat = fonts.helpers.newprivateslot("hat 0x0302") -- todo other sizes + + function mathtweaks.fixaccents(target,original,parameters) + local characters = target.characters + +characters[hat] = copytable(characters[0x0302]) -- TODO + + for stretching, entry in sortedhash(mapping) do + local alias = entry[1] + local stretchingdata = characters[stretching] + if stretchingdata and stretchingdata.width == 0 then + local topaccent = stretchingdata.topaccent or 0 + local width = -topaccent + topaccent = width/2 + stretchingdata.width = width + stretchingdata.topaccent = topaccent + stretchingdata.commands = { rightcommand[width + topaccent], charcommand[stretching] } + if trace_tweaking then + report_tweak("width of initial extensible accent %U set",target,original,stretching) + end + end + end + end + + function mathtweaks.extendaccents(target,original,parameters) + local characters = target.characters + for stretching, entry in sortedhash(mapping) do + local extend = entry[2] + local stretchingdata = characters[stretching] + if extend then + local last = stretchingdata + while last do + local n = last.next + if n then + last = characters[n] + else + last.extensible = true + local flataccent = last.flataccent + if flataccent then + characters[flataccent].extensible = true + end + break + end + end + end + end + end + + function mathtweaks.copyaccents(target,original,parameters) + local characters = target.characters + for stretching, entry in sortedhash(mapping) do + local alias = entry[1] + if alias ~= stretching then + local stretchingdata = characters[stretching] + if stretchingdata then + -- we need to nil [x|y]offsets + characters[alias] = { + width = stretchingdata.width, + height = stretchingdata.height, + depth = stretchingdata.depth, + next = stretchingdata.next, + commands = { charcommand[stretching] }, + topaccent = stretchingdata.topaccent, + -- unicode = stretching, -- when we aliasize to combiners + unicode = alias, -- when we keep the original + } + if trace_tweaking then + report_tweak("extensibles accent %U copied to %U",target,original,stretching,alias) + end + end + end + end + end + +end + +do + + local single <const> = 0x003D + local double <const> = 0x2A75 + local triple <const> = 0x2A76 + + function mathtweaks.addequals(target,original,parameters) + local characters = target.characters + local basechar = characters[single] + local width = basechar.width + local height = basechar.height + local depth = basechar.depth + local advance = (parameters.advance or 1/20) * width + local char = charcommand[single] + local left = leftcommand[advance] + characters[double] = { + unicode = double, + width = 2*width - 1*advance, + height = height, + depth = depth, + callback = "devirtualize", + commands = { char, left, char }, + } + characters[triple] = { + unicode = triple, + width = 3*width - 2*advance, + height = height, + depth = depth, + callback = "devirtualize", + commands = { char, left, char, left, char }, + } + if trace_tweaking then + report_tweak("double %U and triple %U equals added",target,original,double,triple) + end + end + +end + +do + + -- If we really want, we can have variants that also match radicals but in practice + -- radicals and actuarians are never seen together. We could also have a smaller + -- extender. + + local radical <const> = 0x0221A + local actuarian <const> = 0x020E7 + local nairautca <const> = 0xFE942 + local placehold <const> = 0xFE943 + + function mathtweaks.addactuarian(target,original,parameters) + local characters = target.characters + local parameters = target.parameters + local linewidth = target.MathConstants.RadicalRuleThickness -- make option + local basechar = characters[radical] + local baseheight = basechar.height + local basedepth = basechar.depth + local basetotal = baseheight + basedepth + local used = baseheight + characters[actuarian] = { + width = 2*linewidth, + height = baseheight, + depth = basedepth, + unicode = actuarian, + callback = "devirtualize", + commands = { + downcommand[basedepth], + { "rule", basetotal, linewidth }, + }, + vparts = { + { + advance = basetotal, + ["end"] = used, + glyph = actuarian, + start = 0, + }, + { + advance = basetotal, + ["end"] = 0, + extender = 1, + glyph = actuarian, + start = used, + }, + } + } + characters[placehold] = { + width = 2*linewidth, + height = baseheight, + depth = basedepth, + unicode = actuarian, -- whatever + callback = "devirtualize", + commands = { + rightcommand[linewidth], + downcommand[basedepth], + { "rule", basetotal, 0 }, + }, + } + characters[nairautca] = { + width = 2*linewidth, + height = baseheight, + depth = basedepth, + unicode = actuarian, -- whatever + callback = "devirtualize", + -- commands = { + -- rightcommand[linewidth], + -- downcommand[basedepth], + -- { "rule", basetotal, linewidth }, + -- }, + commands = { + rightcommand[linewidth], + upcommand[baseheight-4*linewidth], + { "rule", 4*linewidth, linewidth }, + }, + vparts = { + { + advance = basetotal, + ["end"] = used, + extender = 1, + glyph = placehold, + start = 0, + }, + { + advance = basetotal, + ["end"] = 0, + glyph = nairautca, + start = used, + }, + } + } + if trace_tweaking then + report_tweak("actuarian %U added",target,original,actuarian) + end + end + +end + +do + + -- todo: make callback because we can delay it but then we need to stack + -- callbacks + + -- todo: use named privates for snippets + + local list = { + { 0x302, 0xFE944, 0xFE945 }, + { 0x303, 0xFE946, 0xFE947 }, + { 0x30C, 0xFE948, 0xFE949 }, + } + + function mathtweaks.addfourier(target,original,parameters) + local characters = target.characters + for i=1,#list do + local entry = list[i] + local basecode = entry[1] + local fouriercode = entry[2] + local movecode = entry[3] + local basechar = characters[basecode] + local scale = parameters.scale or 1 + local variant = parameters.variant + if variant then + for i=1,variant do + local okay = basechar.next + if okay then + basecode = okay + basechar = characters[basecode] + else + break + end + end + end + local baseheight = scale * (basechar.height or 0) + local basedepth = scale * (basechar.depth or 0) + local basewidth = scale * (basechar.width or 0) + local used = baseheight/2 + local total = baseheight + basedepth + characters[movecode] = { + width = basewidth, + height = used, + unicode = basecode, + -- callback = "devirtualize", + commands = { + downcommand[used], + { "rule", used, 0 }, + }, + } + characters[fouriercode] = { + width = basewidth, + height = baseheight, + depth = basedepth, + unicode = basecode, + -- callback = "devirtualize", + commands = { + scale == 1 and charcommand[basecode] or { "slot", 0, basecode, scale, scale }, + }, + vparts = { + { + advance = used, + ["end"] = used, + extender = 1, + glyph = movecode, + start = used, + }, + { + advance = total, + ["end"] = 0, + glyph = fouriercode, + start = total, + }, + } + } + if trace_tweaking then + report_tweak("fourier %U added using %U",target,original,basecode,fourier) + end + end + end + +end + +do + + -- \im{\left\Uchar"007C \frac{1}{2} \right\Uchar"007C} + -- \im{\left\Uchar"2016 \frac{1}{2} \right\Uchar"2016} + -- \im{\left\Uchar"2980 \frac{1}{2} \right\Uchar"2980} + + local single <const> = 0x007C + local double <const> = 0x2016 + local triple <const> = 0x2980 + + local function extensible(unicode,total,used) + return { + { + advance = total, + ["end"] = used, + glyph = unicode, + start = 0, + }, + { + advance = total, + ["end"] = 0, + extender = 1, + glyph = unicode, + start = used, + }, + } + end + + function mathtweaks.addbars(target,original,parameters) + local characters = target.characters + local basechar = characters[single] + local width = basechar.width + local height = basechar.height + local depth = basechar.depth + local advance = (parameters.advance or 1/10) * width + local used = 0.8*height + local total = height + depth + characters[single].vparts = extensible(single,total,used) + characters[double] = { + unicode = double, + width = 2*width - 1*advance, + height = height, + depth = depth, + vparts = extensible(double,total,used), + callback = "devirtualize", + commands = { + charcommand[single], + leftcommand[advance], + charcommand[single], + }, + } + characters[triple] = { + unicode = triple, + width = 3*width - 2*advance, + height = height, + depth = depth, + vparts = extensible(triple,total,used), + callback = "devirtualize", + commands = { + charcommand[single], + leftcommand[advance], + charcommand[single], + leftcommand[advance], + charcommand[single], + }, + } + if trace_tweaking then + report_tweak("triple bars %U added",target,original,triple) + end + end + +end + +do + + -- lucida: \im{\cdot \ldot \cdots \ldots} + + local snormal <const> = 0x002E + local sraised <const> = 0x22C5 + + local tnormal <const> = 0x2026 + local traised <const> = 0x22EF + + function mathtweaks.fixellipses(target,original,parameters) + local characters = target.characters + local function fix(normal,raised) + local normalone = characters[normal] + if normalone then + local raisedone = copytable(normalone) + characters[raised] = raisedone + raisedone.unicode = weird + local height = raisedone.height + local yoffset = (parameters.yoffset or 2) * height + raisedone.yoffset = yoffset + raisedone.height = height + yoffset + if trace_tweaking then + report_tweak("taking %U from %U",target,original,weird,normal) + end + end + end + fix(snormal,sraised) + fix(tnormal,traised) + end + +end + +do + -- For Ton, who needs the high minus and plus for calculator signs in Dutch -- school math books. @@ -1700,32 +2361,41 @@ local function applytweaks(when,target,original) if apply_tweaks then local goodies = original.goodies if goodies then - for i=1,#goodies do - local goodie = goodies[i] - local mathematics = goodie.mathematics - local tweaks = mathematics and mathematics.tweaks - if type(tweaks) == "table" then - tweaks = tweaks[when] + local tweaked = target.tweaked or { } + if tweaked[when] then + if trace_defining then + report_math("tweaking math of %a @ %p (%s: %s)",target.properties.fullname,target.parameters.size,when,"done") + end + else + for i=1,#goodies do + local goodie = goodies[i] + local mathematics = goodie.mathematics + local tweaks = mathematics and mathematics.tweaks if type(tweaks) == "table" then - if trace_defining then - report_math("tweaking math of %a @ %p (%s)",target.properties.fullname,target.parameters.size,when) - end - for i=1,#tweaks do - local tweak = tweaks[i] - local tvalue = type(tweak) - if type(tweak) == "table" then - local action = mathtweaks[tweak.tweak or ""] - if action then - if original then - action(target,original,tweak) - else - action(target,tweak) + tweaks = tweaks[when] + if type(tweaks) == "table" then + if trace_defining then + report_math("tweaking math of %a @ %p (%s: %s)",target.properties.fullname,target.parameters.size,when,"okay") + end + for i=1,#tweaks do + local tweak = tweaks[i] + local tvalue = type(tweak) + if type(tweak) == "table" then + local action = mathtweaks[tweak.tweak or ""] + if action then + if original then + action(target,original,tweak) + else + action(target,tweak) + end end end end end end end + tweaked[when] = true + target.tweaked = tweaked end end else diff --git a/tex/context/base/mkxl/math-def.mkxl b/tex/context/base/mkxl/math-def.mkxl index abfd1f74e..d46506add 100644 --- a/tex/context/base/mkxl/math-def.mkxl +++ b/tex/context/base/mkxl/math-def.mkxl @@ -54,14 +54,14 @@ \definemathfunction [injlim] [\c!mathlimits=\v!yes] \definemathfunction [ker] \definemathfunction [lg] -\definemathfunction [liminf] [\c!mathlimits=\v!yes] -\definemathfunction [limsup] [\c!mathlimits=\v!yes] -\definemathfunction [lim] [\c!mathlimits=\v!yes] +\definemathfunction [liminf] [\c!mathlimits=\v!auto] +\definemathfunction [limsup] [\c!mathlimits=\v!auto] +\definemathfunction [lim] [\c!mathlimits=\v!auto] \definemathfunction [ln] \definemathfunction [log] \definemathfunction [median] [\c!mathlimits=\v!yes] -\definemathfunction [max] [\c!mathlimits=\v!yes] -\definemathfunction [min] [\c!mathlimits=\v!yes] +\definemathfunction [max] [\c!mathlimits=\v!auto] +\definemathfunction [min] [\c!mathlimits=\v!auto] \definemathfunction [mod] [\c!mathlimits=\v!yes] %definemathfunction [div] [\c!mathlimits=\v!yes] \definemathfunction [projlim] [\c!mathlimits=\v!yes] diff --git a/tex/context/base/mkxl/math-del.mklx b/tex/context/base/mkxl/math-del.mklx new file mode 100644 index 000000000..875ccdeee --- /dev/null +++ b/tex/context/base/mkxl/math-del.mklx @@ -0,0 +1,87 @@ +%D \module +%D [ file=math-del, +%D version=2022.07.29, +%D title=\CONTEXT\ Math Macros, +%D subtitle=delimiteds, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Math Macros / Delimited} + +\unprotect + +%D This is a variant on radicals but in the end it was better to just define a new +%D environment for this. This is because we don't have the rule and we want a +%D different control over the spacing. We also don't want the degree. + +% Todo: also add the mp plugin here but that more fun stuff for later (when we pick +% up school math). + +\installcorenamespace{mathdelimited} +\installcorenamespace{mathdelimitedalternative} + +\installcommandhandler \??mathdelimited {mathdelimited} \??mathdelimited + +\setupmathdelimited + [\c!alternative=\v!normal, + \c!mpoffset=.25\exheight, + \c!topoffset=\zeropoint, + \c!bottomoffset=\zeropoint, + \c!height=\zeropoint, + \c!depth=\zeropoint, + \c!strut=\v!height, + \c!source=\zerocount, + \c!left=\zerocount, + \c!right=\zerocount, + \c!leftmargin=\zeropoint, + \c!rightmargin=\zeropoint] + +\appendtoks + \frozen\protected\instance\edefcsname\currentmathdelimited\endcsname{\math_delimited_handle{\currentmathdelimited}} +\to \everydefinemathdelimited + +\mutable\let\currentmathdelimited\empty + +\tolerant\protected\def\math_delimited_handle#tag#*[#settings]#:#body% + {\begingroup + \edef\currentmathdelimited{#tag}% + \setupcurrentmathdelimited[#settings]% + \math_delimited_alternative{% + \begincsname\??mathwhateverstrut\mathdelimitedparameter\c!strut\endcsname + \scratchdimen\mathdelimitedparameter\c!leftmargin \relax\ifzeropt\scratchdimen\else\kern\scratchdimen\fi + #body% + \scratchdimen\mathdelimitedparameter\c!rightmargin\relax\ifzeropt\scratchdimen\else\kern\scratchdimen\fi + }% + \endgroup} + +\def\math_delimited_alternative{\csname\??mathdelimitedalternative\mathdelimitedparameter\c!alternative\endcsname} + +\protected\def\math_delimited_common + {\Udelimited + \s!height\dimexpr\mathdelimitedparameter\c!height+\mathdelimitedparameter\c!topoffset\relax + \s!depth \dimexpr\mathdelimitedparameter\c!depth+\mathdelimitedparameter\c!bottomoffset\relax + \s!source\numexpr\namedboxanchor{\mathdelimitedparameter\c!source}\relax + \s!style \normalmathstyle + \zerocount \mathdelimitedparameter\c!left + \zerocount \mathdelimitedparameter\c!right + \relax} + +\defcsname\??mathdelimitedalternative\v!default\endcsname % #body% + {\math_delimited_common} % {#body}} + +\defcsname\??mathdelimitedalternative\v!normal\endcsname#body% + {\edef\p_color{\mathdelimitedparameter\c!color}% + \ifempty\p_color + \math_delimited_common{#body}% {} really needed as \rootdelimited expands first + \else + \pushcolor[\p_color]% + \math_delimited_common + {\popcolor#body}% + \fi} + +\protect \endinput diff --git a/tex/context/base/mkxl/math-fbk.lmt b/tex/context/base/mkxl/math-fbk.lmt index c219bb34f..185bb0d55 100644 --- a/tex/context/base/mkxl/math-fbk.lmt +++ b/tex/context/base/mkxl/math-fbk.lmt @@ -25,16 +25,14 @@ local setmetatableindex = table.setmetatableindex local fallbacks = { } mathematics.fallbacks = fallbacks -local helpers = fonts.helpers -local prependcommands = helpers.prependcommands -local charcommand = helpers.commands.char -local leftcommand = helpers.commands.left -local rightcommand = helpers.commands.right -local upcommand = helpers.commands.up -local downcommand = helpers.commands.down -local dummycommand = helpers.commands.dummy -local popcommand = helpers.commands.pop -local pushcommand = helpers.commands.push +----- helpers = fonts.helpers +----- charcommand = helpers.commands.char +----- leftcommand = helpers.commands.left +----- rightcommand = helpers.commands.right +----- upcommand = helpers.commands.up +----- downcommand = helpers.commands.down +----- popcommand = helpers.commands.pop +----- pushcommand = helpers.commands.push local virtualcharacters = { } local virtualforced = { } @@ -172,79 +170,79 @@ end local addextra = mathematics.extras.add -addextra(0xFE350) -- MATHEMATICAL DOUBLE ARROW LEFT END -addextra(0xFE351) -- MATHEMATICAL DOUBLE ARROW MIDDLE PART -addextra(0xFE352) -- MATHEMATICAL DOUBLE ARROW RIGHT END - -local leftarrow = charcommand[0x2190] -local relbar = charcommand[0x2212] -local rightarrow = charcommand[0x2192] - -virtualcharacters[0xFE350] = function(data) - -- return combined(data,0x2190,0x2212) -- leftarrow relbar - local charone = data.characters[0x2190] - local chartwo = data.characters[0x2212] - if charone and chartwo then - local size = data.size/2 - return { - width = chartwo.width, - height = size, - depth = size, - commands = { - pushcommand, - downcommand[size/2], - leftarrow, - popcommand, - upcommand[size/2], - relbar, - } - } - end -end - -virtualcharacters[0xFE351] = function(data) - -- return combined(data,0x2212,0x2212) -- relbar, relbar (isn't that just equal) - local char = data.characters[0x2212] - if char then - local size = data.size/2 - return { - width = char.width, - height = size, - depth = size, - commands = { - pushcommand, - downcommand[size/2], - relbar, - popcommand, - upcommand[size/2], - relbar, - } - } - end -end - -virtualcharacters[0xFE352] = function(data) - -- return combined(data,0x2192,0x2212) -- rightarrow relbar - local charone = data.characters[0x2192] - local chartwo = data.characters[0x2212] - if charone and chartwo then - local size = data.size/2 - return { - width = chartwo.width, - height = size, - depth = size, - commands = { - pushcommand, - downcommand[size/2], - relbar, - popcommand, - rightcommand[chartwo.width - charone.width], - upcommand[size/2], - rightarrow, - } - } - end -end +-- addextra(0xFE350) -- MATHEMATICAL DOUBLE ARROW LEFT END +-- addextra(0xFE351) -- MATHEMATICAL DOUBLE ARROW MIDDLE PART +-- addextra(0xFE352) -- MATHEMATICAL DOUBLE ARROW RIGHT END +-- +-- local leftarrow = charcommand[0x2190] +-- local relbar = charcommand[0x2212] +-- local rightarrow = charcommand[0x2192] +-- +-- virtualcharacters[0xFE350] = function(data) +-- -- return combined(data,0x2190,0x2212) -- leftarrow relbar +-- local charone = data.characters[0x2190] +-- local chartwo = data.characters[0x2212] +-- if charone and chartwo then +-- local size = data.size/2 +-- return { +-- width = chartwo.width, +-- height = size, +-- depth = size, +-- commands = { +-- pushcommand, +-- downcommand[size/2], +-- leftarrow, +-- popcommand, +-- upcommand[size/2], +-- relbar, +-- } +-- } +-- end +-- end +-- +-- virtualcharacters[0xFE351] = function(data) +-- -- return combined(data,0x2212,0x2212) -- relbar, relbar (isn't that just equal) +-- local char = data.characters[0x2212] +-- if char then +-- local size = data.size/2 +-- return { +-- width = char.width, +-- height = size, +-- depth = size, +-- commands = { +-- pushcommand, +-- downcommand[size/2], +-- relbar, +-- popcommand, +-- upcommand[size/2], +-- relbar, +-- } +-- } +-- end +-- end +-- +-- virtualcharacters[0xFE352] = function(data) +-- -- return combined(data,0x2192,0x2212) -- rightarrow relbar +-- local charone = data.characters[0x2192] +-- local chartwo = data.characters[0x2212] +-- if charone and chartwo then +-- local size = data.size/2 +-- return { +-- width = chartwo.width, +-- height = size, +-- depth = size, +-- commands = { +-- pushcommand, +-- downcommand[size/2], +-- relbar, +-- popcommand, +-- rightcommand[chartwo.width - charone.width], +-- upcommand[size/2], +-- rightarrow, +-- } +-- } +-- end +-- end --------------------------------------------------------------------------------- -- these are moved to math-act.lmt (keep this code) @@ -649,124 +647,144 @@ end --------------------------------------------------------------------------------- -- these might move to math-act.lmt --------------------------------------------------------------------------------- - +-- -- actuarian (beware: xits has an ugly one) -addextra(0xFE940) -- SMALL ANNUITY SYMBOL - -local function actuarian(data) - local characters = data.target.characters - local parameters = data.target.parameters - local basechar = characters[0x0078] -- x (0x0058 X) or 0x1D431 - local linewidth = parameters.xheight / 10 - local basewidth = basechar.width - local baseheight = basechar.height - return { - -- todo: add alttext - -- compromise: lm has large hooks e.g. \actuarial{a} - width = basewidth + 4 * linewidth, - height = basechar.height, - depth = basechar.depth, - unicode = 0x20E7, - commands = { - rightcommand[2 * linewidth], - downcommand[- baseheight - 3 * linewidth], - { "rule", linewidth, basewidth + 4 * linewidth }, - leftcommand[linewidth], - downcommand[baseheight + 4 * linewidth], - { "rule", baseheight + 5 * linewidth, linewidth }, - }, - } -end - -virtualcharacters[0x020E7] = actuarian -- checked -virtualcharacters[0xFE940] = actuarian -- unchecked - -local function equals(data,unicode,snippet,advance,n) -- mathpair needs them - local characters = data.target.characters - local parameters = data.target.parameters - local basechar = characters[snippet] - local advance = advance * parameters.quad - return { - unicode = unicode, - width = n*basechar.width - (n-1)*advance, - height = basechar.height, - depth = basechar.depth, - commands = { - charcommand[snippet], - leftcommand[advance], - charcommand[snippet], - n > 2 and leftcommand[advance] or nil, - n > 2 and charcommand[snippet] or nil, - }, - } -end - -virtualcharacters[0x2A75] = function(data) return equals(data,0x2A75,0x003D, 1/5,2) end -- == -virtualcharacters[0x2A76] = function(data) return equals(data,0x2A76,0x003D, 1/5,3) end -- === -virtualcharacters[0x2980] = function(data) return equals(data,0x2980,0x007C,-1/8,3) end -- ||| - ---------------------------------------------------------------------------------- --- these might move to math-act.lmt -- lucida needs this ---------------------------------------------------------------------------------- +-- addextra(0xFE940) -- SMALL ANNUITY SYMBOL +-- +-- local function actuarian(data) +-- local characters = data.target.characters +-- local parameters = data.target.parameters +-- local basechar = characters[0x0078] -- x (0x0058 X) or 0x1D431 +-- local linewidth = parameters.xheight / 10 +-- local basewidth = basechar.width +-- local baseheight = basechar.height +-- return { +-- -- todo: add alttext +-- -- compromise: lm has large hooks e.g. \actuarial{a} +-- width = basewidth + 4 * linewidth, +-- height = basechar.height, +-- depth = basechar.depth, +-- unicode = 0x20E7, +-- commands = { +-- rightcommand[2 * linewidth], +-- downcommand[- baseheight - 3 * linewidth], +-- { "rule", linewidth, basewidth + 4 * linewidth }, +-- leftcommand[linewidth], +-- downcommand[baseheight + 4 * linewidth], +-- { "rule", baseheight + 5 * linewidth, linewidth }, +-- }, +-- } +-- end +-- +-- virtualcharacters[0x020E7] = actuarian -- checked +-- -----------------[0xFE940] = actuarian -- unchecked -virtualcharacters[0x305] = function(data) - local target = data.target - local height = target.parameters.xheight/8 - local width = target.parameters.emwidth/2 - local depth = height - local used = 0.8 * width - return { - width = width, - height = height, - depth = depth, - commands = { { "rule", height, width } }, - hparts = { - { - advance = width, - ["end"] = used, - glyph = 0x305, - start = 0, - }, - { - advance = width, - ["end"] = 0, - extender = 1, - glyph = 0x305, - start = used, - }, - } - } -end +-- local function equals(data,unicode,snippet,advance,n) -- mathpair needs them +-- local characters = data.target.characters +-- local parameters = data.target.parameters +-- local basechar = characters[snippet] +-- local width = n*basechar.width +-- local advance = advance * parameters.quad -- for equals +-- return { +-- unicode = unicode, +-- width = width - (n-1)*advance, +-- height = basechar.height, +-- depth = basechar.depth, +-- commands = { +-- charcommand[snippet], +-- leftcommand[advance], +-- charcommand[snippet], +-- n > 2 and leftcommand[advance] or nil, +-- n > 2 and charcommand[snippet] or nil, +-- }, +-- } +-- end +-- +-- virtualcharacters[0x2A75] = function(data) return equals(data,0x2A75,0x003D, 1/5,2) end -- == +-- virtualcharacters[0x2A76] = function(data) return equals(data,0x2A76,0x003D, 1/5,3) end -- === +-- +-- local function bars(data,unicode,snippet,advance,n) -- mathpair needs them +-- local characters = data.target.characters +-- local parameters = data.target.parameters +-- local basechar = characters[snippet] +-- local width = n*basechar.width +-- advance = advance * width +-- return { +-- unicode = unicode, +-- width = width - (n-1)*advance, +-- height = basechar.height, +-- depth = basechar.depth, +-- callback = "devirtualize", +-- commands = { +-- charcommand[snippet], +-- leftcommand[advance], +-- charcommand[snippet], +-- n > 2 and leftcommand[advance] or nil, +-- n > 2 and charcommand[snippet] or nil, +-- }, +-- } +-- end +-- +-- virtualcharacters[0x2980] = function(data) return bars(data,0x2980,0x007C,1/10,3) end -- ||| --------------------------------------------------------------------------------- --- these might move to math-act.lmt +-- these might move to math-act.lmt -- lucida needs this -- no longer used --------------------------------------------------------------------------------- -local function threedots(data,shift) - local characters = data.target.characters - local parameters = data.target.parameters - local periodchar = characters[0x002E] - local pluschar = characters[0x002B] - local period = charcommand[0x002E] - local periodwd = periodchar.width or 0 - local periodht = periodchar.height or 0 - local perioddp = periodchar.depth or 0 - local offset = 0 - if shift then - local plusht = pluschar.height or 0 - local plusdp = pluschar.depth or 0 - local axis = (plusdp + plusht)//2 - plusdp - offset = axis - periodht//2 - periodht = axis + periodht//2 - end - return { - width = 3*periodwd, - height = periodht, - depth = 0, - commands = { upcommand[offset], period, period, period } - } -end +-- virtualcharacters[0x305] = function(data) +-- local target = data.target +-- local height = target.parameters.xheight/8 +-- local width = target.parameters.emwidth/2 +-- local depth = height +-- local used = 0.8 * width +-- return { +-- width = width, +-- height = height, +-- depth = depth, +-- commands = { { "rule", height, width } }, +-- hparts = { +-- { +-- advance = width, +-- ["end"] = used, +-- glyph = 0x305, +-- start = 0, +-- }, +-- { +-- advance = width, +-- ["end"] = 0, +-- extender = 1, +-- glyph = 0x305, +-- start = used, +-- }, +-- } +-- } +-- end -virtualcharacters[0x2026] = function(data) return threedots(data,false) end virtualforced[0x2026] = true -virtualcharacters[0x22EF] = function(data) return threedots(data, true) end virtualforced[0x22EF] = true +-- local function threedots(data,shift) +-- local characters = data.target.characters +-- local parameters = data.target.parameters +-- local periodchar = characters[0x002E] +-- local pluschar = characters[0x002B] +-- local period = charcommand[0x002E] +-- local periodwd = periodchar.width or 0 +-- local periodht = periodchar.height or 0 +-- local perioddp = periodchar.depth or 0 +-- local offset = 0 +-- if shift then +-- local plusht = pluschar.height or 0 +-- local plusdp = pluschar.depth or 0 +-- local axis = (plusdp + plusht)//2 - plusdp +-- offset = axis - periodht//2 +-- periodht = axis + periodht//2 +-- end +-- return { +-- width = 3*periodwd, +-- height = periodht, +-- depth = 0, +-- commands = { upcommand[offset], period, period, period } +-- } +-- end +-- +-- virtualcharacters[0x2026] = function(data) return threedots(data,false) end -- virtualforced[0x2026] = true +-- virtualcharacters[0x22EF] = function(data) return threedots(data, true) end -- virtualforced[0x22EF] = true diff --git a/tex/context/base/mkxl/math-fen.mkxl b/tex/context/base/mkxl/math-fen.mkxl index 8f2a4d405..aeed32fcf 100644 --- a/tex/context/base/mkxl/math-fen.mkxl +++ b/tex/context/base/mkxl/math-fen.mkxl @@ -130,10 +130,17 @@ \s!axis \s!exact} +% \startTEXpage[offset=1dk] +% \dm { \fenced[brace][middle="7C] { \frac{p}{q} \fence p,q \in \naturalnumbers} }\par +% \dm { \fenced[brace][middle=`|] { \frac{p}{q} \fence p,q \in \naturalnumbers} }\par +% \dm { \fenced[brace][middle=124] { \frac{p}{q} \fence p,q \in \naturalnumbers} }\par +% \dm { \fenced[brace][middle=|] { \frac{p}{q} \fence p,q \in \naturalnumbers} } +% \stopTEXpage + \newconstant\c_math_fenced_class \integerdef \c_math_fence_check \zerocount -\def\math_fenced_common#1#2#3#4% \Uwhatever class symbol source +\protected\def\math_fenced_common#1#2#3#4% \Uwhatever class symbol source {\c_math_fenced_class\mathfenceparameter#2\relax \math_fenced_check_size_mismatch % we need to catch an unbalanced \F as we are sequential \ifconditional\c_math_fenced_sized @@ -198,10 +205,13 @@ \s!source \numexpr\namedboxanchor{\mathfenceparameter#4}\relax \math_fenced_trace - \Udelimiter - \mathghostcode - \fam - \ifx\p_fence\v!none\zerocount\else\p_fence\relax\fi + \ifx\p_fence\v!none + \Udelimiter\mathghostcode\fam\zerocount + \orelse\ifchknum\p_fence\or + \Udelimiter\mathghostcode\fam\p_fence + \else + \p_fence + \fi \fi % we could use \s!attr \c_math_fenced_stack here \ifconditional\c_math_fenced_sized @@ -459,13 +469,10 @@ \fi \math_fenced_force_size\bigmathdelimitervariant\c_math_fenced_level\relax} -% todo: | in mathmode letter -% -% \appendtoks -% \let\bar\letterbar -% \to \everymathematics -% -% but then we don't have it in embedded text too so ... +\appendtoks + \enforced\aliased\let|\letterbar + %\enforced\aliased\let\bar\letterbar +\to \everymathematics \definemathfence [parenthesis] [\c!left="0028,\c!right="0029] \definemathfence [bracket] [\c!left="005B,\c!right="005D] @@ -578,127 +585,163 @@ \pushoverloadmode -\protected\def\left {\afterassignment\math_left \let\nexttoken} -\protected\def\right {\afterassignment\math_right \let\nexttoken} -\protected\def\middle{\afterassignment\math_middle\let\nexttoken} - -\popoverloadmode - -% \let\leftorright\relax - -\newconditional\c_math_fenced_done -\newconditional\c_math_fenced_unknown \settrue\c_math_fenced_unknown - -\permanent\protected\def\installmathfencepair#1#2#3#4% - {\letcsname\??mathleft \normalmeaningless#1\endcsname#2% - \letcsname\??mathright\normalmeaningless#3\endcsname#4} - -\def\math_unknown_left {\setfalse\c_math_fenced_done\ifconditional\c_math_fenced_unknown\Uleft \nexttoken\fi} -\def\math_unknown_right {\setfalse\c_math_fenced_done\ifconditional\c_math_fenced_unknown\Uright \nexttoken\fi} -\def\math_unknown_middle{\setfalse\c_math_fenced_done\ifconditional\c_math_fenced_unknown\Umiddle nooverflow \nexttoken\fi} - -\letcsname\??mathleft \s!unknown\endcsname\math_unknown_left -\letcsname\??mathright \s!unknown\endcsname\math_unknown_right -\letcsname\??mathmiddle\s!unknown\endcsname\math_unknown_middle - -\def\math_left - {\settrue\c_math_fenced_done - \ifcsname\??mathleft\normalmeaningless\nexttoken\endcsname - \expandafter\lastnamedcs - \else - \expandafter\math_unknown_left - \fi} - -\def\math_right - {\settrue\c_math_fenced_done - \ifcsname\??mathright\normalmeaningless\nexttoken\endcsname - \expandafter\lastnamedcs - \else - \expandafter\math_unknown_right - \fi} - -\def\math_middle - {\settrue\c_math_fenced_done - \ifcsname\??mathmiddle\normalmeaningless\nexttoken\endcsname - \expandafter\lastnamedcs - \else - \expandafter\math_unknown_middle - \fi} - -\permanent\protected\def\lfence#1% - {\settrue\c_math_fenced_done - \let\nexttoken#1% - \ifcsname\??mathleft\normalmeaningless\nexttoken\endcsname - \expandafter\lastnamedcs - \else - \expandafter\math_unknown_left - \fi} - -\permanent\protected\def\rfence#1% - {\settrue\c_math_fenced_done - \let\nexttoken#1% - \ifcsname\??mathright\normalmeaningless\nexttoken\endcsname - \expandafter\lastnamedcs - \else - \expandafter\math_unknown_right - \fi} - -\permanent\protected\def\mfence#1% - {\settrue\c_math_fenced_done - \let\nexttoken#1% - \ifcsname\??mathmiddle\normalmeaningless\nexttoken\endcsname - \expandafter\lastnamedcs - \else - \expandafter\math_unknown_middle - \fi} - -\normalexpanded{\installmathfencepair {|\detokenize {|}} \Ldoublebar {|\detokenize {|}} \Rdoublebar} -\normalexpanded{\installmathfencepair {|\detokenize{||}} \Ltriplebar {|\detokenize{||}} \Rtriplebar} +% \protected\def\left {\afterassignment\math_left \let\nexttoken} +% \protected\def\right {\afterassignment\math_right \let\nexttoken} +% \protected\def\middle{\afterassignment\math_middle\let\nexttoken} -\installmathfencepair \bgroup \Lbrace \egroup \Rbrace -\installmathfencepair \egroup \Rbracemirrored \bgroup \Lbracemirrored +% \im { \left{ \frac{1}{2} \right} } +% \im { \left\bgroup \frac{1}{2} \right\egroup } +% \im { \left\{ \frac{1}{2} \right\} } +% \im { \left\lbrace \frac{1}{2} \right\rbrace } -\installmathfencepair \letteropenbrace \Lbrace \letterclosebrace \Rbrace % as we escape in mp textexts - -\installmathfencepair . \Lnothing . \Rnothing -\installmathfencepair . \Rnothingmirrored . \Lnothingmirrored +\def\math_fenced_x_left + {\advance\c_math_fence_nesting\plusone + \ifx\math_fenced_x_p_left\bgroup\let\math_fenced_x_p_left\letterleftbrace\fi + \math_fenced_common\Uleft\c!leftclass\math_fenced_x_p_left\c!leftsource} -\installmathfencepair [ \Lbracket ] \Rbracket -\installmathfencepair ] \Rbracketmirrored [ \Lbracketmirrored +\def\math_fenced_x_right + {\ifx\math_fenced_x_p_right\egroup\let\math_fenced_x_p_right\letterrightbrace\fi + \math_fenced_common\Uright\c!rightclass\math_fenced_x_p_right\c!rightsource + \advance\c_math_fence_nesting\minusone} -\installmathfencepair ( \Lparenthesis ) \Rparenthesis -\installmathfencepair ) \Rparenthesismirrored ( \Lparenthesismirrored +\def\math_fenced_x_middle_normal + {\math_fenced_common\Umiddle\c!middleclass\math_fenced_x_p_middle\c!middlesource} -\installmathfencepair < \Langle > \Rangle -\installmathfencepair > \Ranglemirrored < \Langlemirrored +% the expandafter permits \left\Uchar... -\installmathfencepair / \Lsolidus / \Rsolidus -%installmathfencepair / \Rsolidusmirrored / \Lsolidusmirrored +\protected\def\lfence{\afterassignment\math_fenced_x_left \expandafter\let\expandafter\math_fenced_x_p_left} +\protected\def\rfence{\afterassignment\math_fenced_x_right \expandafter\let\expandafter\math_fenced_x_p_right} +\protected\def\mfence{\afterassignment\math_fenced_x_middle\expandafter\let\expandafter\math_fenced_x_p_middle} -\installmathfencepair | \Lbar | \Rbar -%installmathfencepair | \Rbarmirrored | \Lbarmirrored +\aliased\let\left \lfence +\aliased\let\right \rfence +\aliased\let\middle\mfence -\installmathfencepair ⌊ \Lfloor ⌋ \Rfloor -\installmathfencepair ⌋ \Rfloormirrored ⌊ \Lfloormirrored -\installmathfencepair ⌈ \Lceiling ⌉ \Rceiling -\installmathfencepair ⌉ \Rceilingmirrored ⌈ \Lceilingmirrored +\popoverloadmode -\installmathfencepair ⟨ \Langle ⟩ \Rangle -\installmathfencepair ⟩ \Ranglemirrored ⟨ \Langlemirrored +% \let\leftorright\relax -\installmathfencepair ⟪ \Ldoubleangle ⟫ \Rdoubleangle -\installmathfencepair ⟫ \Rdoubleanglemirrored ⟪ \Ldoubleanglemirrored +\newconditional\c_math_fenced_unknown \settrue\c_math_fenced_unknown -\installmathfencepair ‖ \Ldoublebar ‖ \Rdoublebar -%installmathfencepair ‖ \Rdoublebarmirrored ‖ \Ldoublebarmirrored +% \permanent\protected\def\installmathfencepair#1#2#3#4% +% {\letcsname\??mathleft \normalmeaningless#1\endcsname#2% +% \letcsname\??mathright\normalmeaningless#3\endcsname#4} -\installmathfencepair ⦀ \Ltriplebar ⦀ \Rtriplebar -%installmathfencepair ⦀ \Rtriplebarmirrored ⦀ \Ltriplebarmirrored +\permanent\protected\def\installmathfencepair#1#2#3#4% + {} -% \installmathfencepair { \Lbrace } \Rbrace -% \installmathfencepair } \Rbracemirrored { \Lbracemirrored +% \def\math_unknown_left {\ifconditional\c_math_fenced_unknown\Uleft \nexttoken\fi} +% \def\math_unknown_right {\ifconditional\c_math_fenced_unknown\Uright \nexttoken\fi} +% \def\math_unknown_middle{\ifconditional\c_math_fenced_unknown\Umiddle nooverflow \nexttoken\fi} -\installmathfencepair ⦗ \Linterval ⦘ \Rinterval +% \def\math_unknown_left +% {\let\math_fenced_p_left\nexttoken +% \math_fenced_left} +% +% \def\math_unknown_right +% {\let\math_fenced_p_right\nexttoken +% \math_fenced_right} +% +% \def\math_unknown_middle +% {\let\math_fenced_p_middle\nexttoken +% \math_fenced_middle} +% +% \letcsname\??mathleft \s!unknown\endcsname\math_unknown_left +% \letcsname\??mathright \s!unknown\endcsname\math_unknown_right +% \letcsname\??mathmiddle\s!unknown\endcsname\math_unknown_middle +% +% \def\math_left +% {\ifcsname\??mathleft\normalmeaningless\nexttoken\endcsname +% \expandafter\lastnamedcs +% \else +% \expandafter\math_unknown_left +% \fi} +% +% \def\math_right +% {\ifcsname\??mathright\normalmeaningless\nexttoken\endcsname +% \expandafter\lastnamedcs +% \else +% \expandafter\math_unknown_right +% \fi} +% +% \def\math_middle +% {\ifcsname\??mathmiddle\normalmeaningless\nexttoken\endcsname +% \expandafter\lastnamedcs +% \else +% \expandafter\math_unknown_middle +% \fi} +% +% \permanent\protected\def\lfence#1% +% {\let\nexttoken#1% +% \ifcsname\??mathleft\normalmeaningless\nexttoken\endcsname +% \expandafter\lastnamedcs +% \else +% \expandafter\math_unknown_left +% \fi} +% +% \permanent\protected\def\rfence#1% +% {\let\nexttoken#1% +% \ifcsname\??mathright\normalmeaningless\nexttoken\endcsname +% \expandafter\lastnamedcs +% \else +% \expandafter\math_unknown_right +% \fi} +% +% \permanent\protected\def\mfence#1% +% {\let\nexttoken#1% +% \ifcsname\??mathmiddle\normalmeaningless\nexttoken\endcsname +% \expandafter\lastnamedcs +% \else +% \expandafter\math_unknown_middle +% \fi} + +% \normalexpanded{\installmathfencepair {|\detokenize {|}} \Ldoublebar {|\detokenize {|}} \Rdoublebar} +% \normalexpanded{\installmathfencepair {|\detokenize{||}} \Ltriplebar {|\detokenize{||}} \Rtriplebar} +% +% \installmathfencepair \bgroup \Lbrace \egroup \Rbrace +% \installmathfencepair \egroup \Rbracemirrored \bgroup \Lbracemirrored +% +% \installmathfencepair \letteropenbrace \Lbrace \letterclosebrace \Rbrace % as we escape in mp textexts +% +% \installmathfencepair . \Lnothing . \Rnothing +% \installmathfencepair . \Rnothingmirrored . \Lnothingmirrored +% +% \installmathfencepair [ \Lbracket ] \Rbracket +% \installmathfencepair ] \Rbracketmirrored [ \Lbracketmirrored +% +% \installmathfencepair ( \Lparenthesis ) \Rparenthesis +% \installmathfencepair ) \Rparenthesismirrored ( \Lparenthesismirrored +% +% \installmathfencepair < \Langle > \Rangle +% \installmathfencepair > \Ranglemirrored < \Langlemirrored +% +% \installmathfencepair / \Lsolidus / \Rsolidus +% %installmathfencepair / \Rsolidusmirrored / \Lsolidusmirrored +% +% \installmathfencepair | \Lbar | \Rbar +% %installmathfencepair | \Rbarmirrored | \Lbarmirrored +% +% \installmathfencepair ⌊ \Lfloor ⌋ \Rfloor +% \installmathfencepair ⌋ \Rfloormirrored ⌊ \Lfloormirrored +% \installmathfencepair ⌈ \Lceiling ⌉ \Rceiling +% \installmathfencepair ⌉ \Rceilingmirrored ⌈ \Lceilingmirrored +% +% \installmathfencepair ⟨ \Langle ⟩ \Rangle +% \installmathfencepair ⟩ \Ranglemirrored ⟨ \Langlemirrored +% +% \installmathfencepair ⟪ \Ldoubleangle ⟫ \Rdoubleangle +% \installmathfencepair ⟫ \Rdoubleanglemirrored ⟪ \Ldoubleanglemirrored +% +% \installmathfencepair ‖ \Ldoublebar ‖ \Rdoublebar +% %installmathfencepair ‖ \Rdoublebarmirrored ‖ \Ldoublebarmirrored +% +% \installmathfencepair ⦀ \Ltriplebar ⦀ \Rtriplebar +% %installmathfencepair ⦀ \Rtriplebarmirrored ⦀ \Ltriplebarmirrored +% +% % \installmathfencepair { \Lbrace } \Rbrace +% % \installmathfencepair } \Rbracemirrored { \Lbracemirrored +% +% \installmathfencepair ⦗ \Linterval ⦘ \Rinterval \appendtoks \ignorediscretionaries % so $\mtext{a|b}$ works, this is ok because it's an \hbox @@ -728,33 +771,33 @@ \aliased\let\Lparen \Lparenthesis \aliased\let\Rparen \Rparenthesis -\installmathfencepair \lbrace \Lbrace \rbrace \Rbrace -\installmathfencepair \lbracket \Lbracket \rbracket \Rbracket -\installmathfencepair \lbrack \Lbracket \rbracket \Rbracket -\installmathfencepair \lparenthesis \Lparenthesis \rparenthesis \Rparenthesis -\installmathfencepair \lparent \Lparenthesis \rparent \Rparenthesis -\installmathfencepair \lparen \Lparenthesis \rparen \Rparenthesis -\installmathfencepair \langle \Langle \rangle \Rangle -\installmathfencepair \llangle \Ldoubleangle \rrangle \Rdoubleangle -%installmathfencepair \lbar \Lbar \rbar \Rbar -\installmathfencepair \lVert \Ldoublebar \rVert \Rdoublebar -\installmathfencepair \vert \Lbar \vert \Rbar -\installmathfencepair \solidus \Lsolidus \solidus \Rsolidus -\installmathfencepair \lfloor \Lfloor \rfloor \Rfloor -\installmathfencepair \lceiling \Lceiling \rceiling \Rceiling -\installmathfencepair \lceil \Lceiling \rceil \Rceiling - -\installmathfencepair \ulcorner \Luppercorner \urcorner \Ruppercorner -\installmathfencepair \llcorner \Llowercorner \lrcorner \Rlowercorner -\installmathfencepair \lmoustache \Lmoustache \rmoustache \Rmoustache -\installmathfencepair \llbracket \Lopenbracket \rrbracket \Ropenbracket -\installmathfencepair \lgroup \Lgroup \rgroup \Rgroup - -\installmathfencepair \linterval \Linterval \rinterval \Rinterval -%installmathfencepair \linterv \Linterval \rinterv \Rinterval -\installmathfencepair \lointerval \Linterval \rointerval \Rinterval -\installmathfencepair \llointerval \Llointerval \rlointerval \Rlointerval -\installmathfencepair \lrointerval \Lrointerval \rrointerval \Rrointerval +% \installmathfencepair \lbrace \Lbrace \rbrace \Rbrace +% \installmathfencepair \lbracket \Lbracket \rbracket \Rbracket +% \installmathfencepair \lbrack \Lbracket \rbracket \Rbracket +% \installmathfencepair \lparenthesis \Lparenthesis \rparenthesis \Rparenthesis +% \installmathfencepair \lparent \Lparenthesis \rparent \Rparenthesis +% \installmathfencepair \lparen \Lparenthesis \rparen \Rparenthesis +% \installmathfencepair \langle \Langle \rangle \Rangle +% \installmathfencepair \llangle \Ldoubleangle \rrangle \Rdoubleangle +% %installmathfencepair \lbar \Lbar \rbar \Rbar +% \installmathfencepair \lVert \Ldoublebar \rVert \Rdoublebar +% \installmathfencepair \vert \Lbar \vert \Rbar +% \installmathfencepair \solidus \Lsolidus \solidus \Rsolidus +% \installmathfencepair \lfloor \Lfloor \rfloor \Rfloor +% \installmathfencepair \lceiling \Lceiling \rceiling \Rceiling +% \installmathfencepair \lceil \Lceiling \rceil \Rceiling + +% \installmathfencepair \ulcorner \Luppercorner \urcorner \Ruppercorner +% \installmathfencepair \llcorner \Llowercorner \lrcorner \Rlowercorner +% \installmathfencepair \lmoustache \Lmoustache \rmoustache \Rmoustache +% \installmathfencepair \llbracket \Lopenbracket \rrbracket \Ropenbracket +% \installmathfencepair \lgroup \Lgroup \rgroup \Rgroup + +% \installmathfencepair \linterval \Linterval \rinterval \Rinterval +% %installmathfencepair \linterv \Linterval \rinterv \Rinterval +% \installmathfencepair \lointerval \Linterval \rointerval \Rinterval +% \installmathfencepair \llointerval \Llointerval \rlointerval \Rlointerval +% \installmathfencepair \lrointerval \Lrointerval \rrointerval \Rrointerval \aliased\let\textlbar\lbar \aliased\let\mathlbar\Lbar \aliased\let\textrbar\lbar \aliased\let\mathrbar\Rbar @@ -764,20 +807,31 @@ % \setupmathfences[color=darkgreen] -\permanent\protected\def\{{\mathortext\lbrace \letterleftbrace } % or maybe a chardef -\permanent\protected\def\}{\mathortext\rbrace \letterrightbrace } % or maybe a chardef -\permanent\protected\def\[{\mathortext\lbracket \letterleftbracket } % or maybe a chardef -\permanent\protected\def\]{\mathortext\rbracket \letterrightbracket } % or maybe a chardef -\permanent\protected\def\({\mathortext\lparenthesis\letterleftparenthesis } % or maybe a chardef -\permanent\protected\def\){\mathortext\rparenthesis\letterrightparenthesis} % or maybe a chardef -\permanent\protected\def\|{\mathortext\vert \letterbar } % or maybe a chardef -%permanent\protected\def\/{\mathortext\solidus \letterslash } % or maybe a chardef - -\installmathfencepair \{ \Lbrace \} \Rbrace -\installmathfencepair \[ \Lbracket \] \Rbracket -\installmathfencepair \( \Lparenthesis \) \Rparenthesis -\installmathfencepair \< \Langle \> \Rangle -\installmathfencepair \| \Lbar \| \Rbar +% \permanent\protected\def\{{\mathortext\lbrace \letterleftbrace } % or maybe a chardef +% \permanent\protected\def\}{\mathortext\rbrace \letterrightbrace } % or maybe a chardef +% \permanent\protected\def\[{\mathortext\lbracket \letterleftbracket } % or maybe a chardef +% \permanent\protected\def\]{\mathortext\rbracket \letterrightbracket } % or maybe a chardef +% \permanent\protected\def\({\mathortext\lparenthesis\letterleftparenthesis } % or maybe a chardef +% \permanent\protected\def\){\mathortext\rparenthesis\letterrightparenthesis} % or maybe a chardef +% \permanent\protected\def\|{\mathortext\vert \letterbar } % or maybe a chardef +% %permanent\protected\def\/{\mathortext\solidus \letterslash } % or maybe a chardef +% +% \installmathfencepair \{ \Lbrace \} \Rbrace +% \installmathfencepair \[ \Lbracket \] \Rbracket +% \installmathfencepair \( \Lparenthesis \) \Rparenthesis +% \installmathfencepair \< \Langle \> \Rangle +% \installmathfencepair \| \Lbar \| \Rbar + +% isn't that already the case .. still needed in lua mode ? + +\aliased\let\{\letterleftbrace +\aliased\let\}\letterrightbrace +\aliased\let\[\letterleftbracket +\aliased\let\]\letterrightbracket +\aliased\let\(\letterleftparenthesis +\aliased\let\)\letterrightparenthesis +\aliased\let\|\letterbar +%aliased\let\/\letterslash % italic correction \popoverloadmode @@ -853,11 +907,6 @@ %definemathfence [fancybracket] [bracket] [command=yes,color=red] -% experimental accents: -% -% \definemathoverextensible [top] [hoed] ["FE302] -% \definemathoverextensible [top] [slang] ["FE303] - %D The nested fences recovery code is needed for mathml and the original %D code can still be found in the mkiv file. @@ -1044,4 +1093,14 @@ \c_math_fence_nesting\zerocount \to \everymathematics +%D Experiment: + +\permanent\protected\def\autofences + {\setmathoptions\mathopencode\numexpression + \setmathoptions\mathopencode bor \autoinjectclassoptioncode + \relax + \setmathoptions\mathclosecode\numexpression + \setmathoptions\mathclosecode bor \autoinjectclassoptioncode + \relax} + \protect diff --git a/tex/context/base/mkxl/math-fnt.lmt b/tex/context/base/mkxl/math-fnt.lmt index 2f80cdfa6..23a69d0ec 100644 --- a/tex/context/base/mkxl/math-fnt.lmt +++ b/tex/context/base/mkxl/math-fnt.lmt @@ -40,10 +40,19 @@ local function register_extensible(font,char,style,box) local fontdata = chardata[font] local oldchar = fontdata[char] local unicode = oldchar.unicode or char - local private = fonts.helpers.setboxdirectly(font,unicode,box) +-- we cannot have self referencing t3 fonts +local oldcommands = oldchar.oldcommands +local newcommands = oldchar.commands +if oldcommands then + oldchar.commands = oldcommands +end + local private = fonts.helpers.setboxdirectly(font,unicode,box) -- we saved a scaled glyph stream so we now use an unscaled one ... local g = new_glyph(font,private,al) local n = new_hlist(g) +if newcommands then + oldchar.commands = newcommands +end -- local newchar = { -- unicode = unicode, diff --git a/tex/context/base/mkxl/math-frc.mkxl b/tex/context/base/mkxl/math-frc.mkxl index 3577a6b2f..06150b3ea 100644 --- a/tex/context/base/mkxl/math-frc.mkxl +++ b/tex/context/base/mkxl/math-frc.mkxl @@ -86,6 +86,7 @@ \c!method=\v!vertical, \c!mathnumeratorstyle=\mathfractionparameter\c!mathstyle, \c!mathdenominatorstyle=\mathfractionparameter\c!mathstyle, + \c!mathclass=\mathfractioncode, \c!alternative=\v!inner, \c!margin=\zeropoint, % \c!rulethickness=.1\exheight, % was .25 for above / atop @@ -201,13 +202,15 @@ \installlocalcurrenthandler\??mathfractions {mathfraction} \tolerant\protected\def\math_frac#1#*[#2]%% - {\mathfrac\bgroup + {\beginmathgroup % \setlocalmathfractioncurrent{#1}% \edef\currentmathfraction{#1}% % \ifparameter#2\or\setupcurrentmathfraction[#2]\fi % \edef\p_math_fraction_fences{\mathfractionparameter\c!fences}% + % + \mathatom \s!class \mathfractionparameter\c!mathclass\bgroup \ifempty\p_math_fraction_fences \else \math_fenced_fenced_start\p_math_fraction_fences \fi @@ -232,7 +235,8 @@ {\ifempty\p_math_fraction_fences \else \math_fenced_fenced_stop\p_math_fraction_fences \fi - \egroup} + \egroup + \endmathgroup} \integerdef\math_frac_no_delim "2E % or just \zerocount @@ -251,42 +255,46 @@ \installcorenamespace{fractionmethods} -\defcsname\??fractionmethods\v!vertical \v!no \v!none\endcsname{\Uatop} -\defcsname\??fractionmethods\v!vertical \v!no \endcsname{\Uatopwithdelims +\defcsname\??fractionmethods\v!vertical \v!no \v!none\endcsname{\Uatop} +\defcsname\??fractionmethods\v!vertical \v!no \endcsname{\Uatopwithdelims + \Udelimiter\zerocount\fam\scratchcounterone + \Udelimiter\zerocount\fam\scratchcountertwo} +\defcsname\??fractionmethods\v!vertical \v!yes \v!none\endcsname{\Uabove} +\defcsname\??fractionmethods\v!vertical \v!yes \endcsname{\Uabovewithdelims + \Udelimiter\zerocount\fam\scratchcounterone + \Udelimiter\zerocount\fam\scratchcountertwo} +\defcsname\??fractionmethods\v!vertical \v!hidden \v!none\endcsname{\Uabove} +\defcsname\??fractionmethods\v!vertical \v!hidden \endcsname{\Uabovewithdelims + \Udelimiter\zerocount\fam\scratchcounterone + \Udelimiter\zerocount\fam\scratchcountertwo} +\defcsname\??fractionmethods\v!vertical \v!auto \v!none\endcsname{\Uover} +\defcsname\??fractionmethods\v!vertical \v!auto \endcsname{\Uoverwithdelims \Udelimiter\zerocount\fam\scratchcounterone \Udelimiter\zerocount\fam\scratchcountertwo} -\defcsname\??fractionmethods\v!vertical \v!yes \v!none\endcsname{\Uabove} -\defcsname\??fractionmethods\v!vertical \v!yes \endcsname{\Uabovewithdelims - \Udelimiter\zerocount\fam\scratchcounterone - \Udelimiter\zerocount\fam\scratchcountertwo} -\defcsname\??fractionmethods\v!vertical \v!hidden\v!none\endcsname{\Uabove - norule} -\defcsname\??fractionmethods\v!vertical \v!hidden \endcsname{\Uabovewithdelims - \Udelimiter\zerocount\fam\scratchcounterone - \Udelimiter\zerocount\fam\scratchcountertwo - norule} -\defcsname\??fractionmethods\v!vertical \v!auto \v!none\endcsname{\Uover} -\defcsname\??fractionmethods\v!vertical \v!auto \endcsname{\Uoverwithdelims - \Udelimiter\zerocount\fam\scratchcounterone - \Udelimiter\zerocount\fam\scratchcountertwo} -\defcsname\??fractionmethods\v!horizontal \v!none\endcsname{\Uskewed - \Udelimiter\zerocount\fam\scratchcounterthree - \s!hfactor \numexpr\mathfractionparameter\c!hfactor\relax} -\defcsname\??fractionmethods\v!horizontal \endcsname{\Uskewedwithdelims - \Udelimiter\zerocount\fam\scratchcounterone - \Udelimiter\zerocount\fam\scratchcountertwo - \Udelimiter\zerocount\fam\scratchcounterthree - \s!hfactor \numexpr\mathfractionparameter\c!hfactor\relax} -\defcsname\??fractionmethods\v!line \v!none\endcsname{\Uskewed - \Udelimiter\zerocount\fam\scratchcounterthree - \s!noaxis \space - \s!hfactor \numexpr\mathfractionparameter\c!hfactor\relax} -\defcsname\??fractionmethods\v!line \endcsname{\Uskewedwithdelims - \Udelimiter\zerocount\fam\scratchcounterone - \Udelimiter\zerocount\fam\scratchcountertwo - \Udelimiter\zerocount\fam\scratchcounterthree - \s!noaxis \space - \s!hfactor \numexpr\mathfractionparameter\c!hfactor\relax} +\defcsname\??fractionmethods\v!vertical \v!symbol \v!none\endcsname{\Ustretched + \Udelimiter\zerocount\fam\scratchcounterthree} +\defcsname\??fractionmethods\v!vertical \v!symbol \endcsname{\Ustretchedwithdelims + \Udelimiter\zerocount\fam\scratchcounterone + \Udelimiter\zerocount\fam\scratchcountertwo + \Udelimiter\zerocount\fam\scratchcounterthree} +\defcsname\??fractionmethods\v!horizontal \v!none\endcsname{\Uskewed + \Udelimiter\zerocount\fam\scratchcounterthree + \s!hfactor \numexpr\mathfractionparameter\c!hfactor\relax} +\defcsname\??fractionmethods\v!horizontal \endcsname{\Uskewedwithdelims + \Udelimiter\zerocount\fam\scratchcounterone + \Udelimiter\zerocount\fam\scratchcountertwo + \Udelimiter\zerocount\fam\scratchcounterthree + \s!hfactor \numexpr\mathfractionparameter\c!hfactor\relax} +\defcsname\??fractionmethods\v!line \v!none\endcsname{\Uskewed + \Udelimiter\zerocount\fam\scratchcounterthree + \s!noaxis \space + \s!hfactor \numexpr\mathfractionparameter\c!hfactor\relax} +\defcsname\??fractionmethods\v!line \endcsname{\Uskewedwithdelims + \Udelimiter\zerocount\fam\scratchcounterone + \Udelimiter\zerocount\fam\scratchcountertwo + \Udelimiter\zerocount\fam\scratchcounterthree + \s!noaxis \space + \s!hfactor \numexpr\mathfractionparameter\c!hfactor\relax} \def\math_frac_command_u {\edef\p_method {\mathfractionparameter\c!method}% @@ -295,7 +303,7 @@ \scratchcounterone \mathfractionparameter\c!left \relax \scratchcountertwo \mathfractionparameter\c!right \relax \scratchcounterthree \mathfractionparameter\c!middle \relax - \csname + \ifcsname \??fractionmethods \p_method \ifx\p_method\v!horizontal @@ -310,7 +318,7 @@ \v!none \fi \fi - \endcsname + \endcsname \lastnamedcs \else \csname\??fractionmethods\v!vertical\v!auto\endcsname \fi \usedcolorparameterattributes{\mathfractionparameter\c!color}% thickness \ifx\p_thickness\v!font \zeropoint @@ -318,11 +326,13 @@ \else \dimexpr\p_thickness\relax \fi + \s!class \numexpr\mathfractionparameter\c!mathclass\relax \s!vfactor \numexpr\mathfractionparameter\c!vfactor\relax - \s!source \number\namedboxanchor{\mathfractionparameter\c!source}} + \s!source \number\namedboxanchor{\mathfractionparameter\c!source}} \protected\defcsname\??mathfractionalternative\v!inner\endcsname#1#2% - {\math_frac_command_u + {%\beginmathgroup + \math_frac_command_u {\dousecolorparameter{\mathfractionparameter\c!topcolor}% \math_fraction_margin_kern \usemathstyleparameter\mathfractionparameter\c!mathnumeratorstyle @@ -333,6 +343,7 @@ \usemathstyleparameter\mathfractionparameter\c!mathdenominatorstyle \m_fractions_strut_bot#2% \math_fraction_margin_kern}% + %\endmathgroup \math_frac_wrapup} \protected\defcsname\??mathfractionalternative\v!outer\endcsname#1#2% @@ -656,7 +667,7 @@ %D These macros are based on Michael J.~Downes posting on comp.text.tex on 2001/12/06 %D but adapted a bit. %D -%D Does anyone actually use this kinf of stuff? +%D Does anyone actually use this kind of stuff? \permanent\protected\def\splitfrac #1#2{{\textstyle {{\textstyle#1\quad\hfill}\normalabove\zeropoint{\textstyle\hfill\quad\mathstrut#2}}}} \permanent\protected\def\splitdfrac#1#2{{\displaystyle{{ #1\quad\hfill}\normalabove\zeropoint{ \hfill\quad\mathstrut#2}}}} @@ -678,6 +689,54 @@ [\c!hfactor=20, \c!vfactor=10] +%D And a cheat (for Mikael): + +% \definemathfraction +% [afrac] +% [\c!mathclass=\mathrelationcode, +% \c!rule=\v!symbol, +% \c!middle="2192] + +%D New stretched fraction with middle symnbol: + +% \enableexperiments[math.arrows] % enforce construction of these in math-act +% +% { +% tweak = "addarrows", +% list = { [0x3D] = { squeeze = .85, yoffset = .0975 } } -- bonum +% }, + +\definemathfraction + [relfraction] + [\c!mathclass=\mathrelationcode, + \c!margin=.25\emwidth, + \c!rule=\v!symbol] + +\definemathfraction [bartext] [relfraction] [\c!middle="203E] +\definemathfraction [leftarrowtext] [relfraction] [\c!middle="2190] +\definemathfraction [rightarrowtext] [relfraction] [\c!middle="2192] +\definemathfraction [twoheadleftarrowtext] [relfraction] [\c!middle="219E] +\definemathfraction [twoheadrightarrowtext] [relfraction] [\c!middle="21A0] +\definemathfraction [reltext] [relfraction] [\c!middle="002D] +\definemathfraction [equaltext] [relfraction] [\c!middle="003D] +\definemathfraction [mapstotext] [relfraction] [\c!middle="21A6] +\definemathfraction [hookleftarrowtext] [relfraction] [\c!middle="21A9] +\definemathfraction [hookrightarrowtext] [relfraction] [\c!middle="21AA] +\definemathfraction [leftharpoondowntext] [relfraction] [\c!middle="21BD] +\definemathfraction [leftharpoonuptext] [relfraction] [\c!middle="21BC] +\definemathfraction [rightharpoondowntext] [relfraction] [\c!middle="21C1] +\definemathfraction [rightharpoonuptext] [relfraction] [\c!middle="21C0] +\definemathfraction [rightoverleftarrowtext] [relfraction] [\c!middle="21C4] +\definemathfraction [leftrightharpoonstext] [relfraction] [\c!middle="21CB] +\definemathfraction [rightleftharpoonstext] [relfraction] [\c!middle="21CC] +\definemathfraction [triplereltext] [relfraction] [\c!middle="2261] +\definemathfraction [leftrightarrowtext] [relfraction] [\c!middle="27F7] +\definemathfraction [rightleftarrowtext] [relfraction] [\c!middle="27F7] +\definemathfraction [Leftarrowtext] [relfraction] [\c!middle="27F8] +\definemathfraction [Rightarrowtext] [relfraction] [\c!middle="27F9] +\definemathfraction [Leftrightarrowtext] [relfraction] [\c!middle="27FA] +\definemathfraction [Rightleftarrowtext] [relfraction] [\c!middle="27FA] + \protect \endinput % I have no clue what \mthfrac and \mthsqrt are supposed to do but diff --git a/tex/context/base/mkxl/math-ini.lmt b/tex/context/base/mkxl/math-ini.lmt index 0af62a45e..81ac23f43 100644 --- a/tex/context/base/mkxl/math-ini.lmt +++ b/tex/context/base/mkxl/math-ini.lmt @@ -52,6 +52,8 @@ local setmathcode = tex.setmathcode local setdelcode = tex.setdelcode local texintegerdef = tex.integerdef +setdelcode = function() end + -- This is relatively new and experimental: do @@ -135,15 +137,18 @@ do end end - function dictionaries.registercharacter(group,index,description) + function dictionaries.registercharacter(group,index,description,class) local d = names[group] -- can be number or string if d then data[d][index] = description or true local v = variants[index] + if not class then + class = true + end if v then - v[d] = true + v[d] = class else - variants[index] = { [d] = true } + variants[index] = { [d] = class} end if not defaults[index] then defaults[index] = d @@ -170,25 +175,27 @@ do local function trace(n,properties,group,index,font,char) -- local properties, group, index, font, char = nodes.nuts.getchardict(nodes.nuts.tonut(n)) - local char = fontchardata[font][char] - if char or whatdetail == "all" then - local unicode = char and char.unicode - if unicode then - local groupname = groups[group] - local indexname = false - if groupname then - indexname = data[group][index] -- dictionaries.data - else - groupname = "unknown" - end - if not indexname or indexname == true then - indexname = chardata[unicode] - indexname = indexname and indexname.description or "unknown" - end - if not f_dictionary then - f_dictionary = formatters["properties [%04X:%04X:%04X] [%s] %U : %s"] + if properties ~= 0 or group ~= 0 or index ~= 0 then + local char = fontchardata[font][char] + if char or whatdetail == "all" then + local unicode = char and char.unicode + if unicode then + local groupname = groups[group] + local indexname = false + if groupname then + indexname = data[group][index] -- dictionaries.data + else + groupname = "unknown" + end + if not indexname or indexname == true then + indexname = chardata[unicode] + indexname = indexname and indexname.description or "unknown" + end + if not f_dictionary then + f_dictionary = formatters["properties [%04X:%04X:%04X] [%s] %U : %s"] + end + return f_dictionary(properties,group,index,groupname,unicode,indexname) end - return f_dictionary(properties,group,index,groupname,unicode,indexname) end end end @@ -217,25 +224,29 @@ do -- abandoned but we can use it as a start and playground anyway. -- -- The char-def.lua file will have mathgroup entries reflecting this. + -- + -- This is a good one (with nice roll-overs too): + -- + -- https://en.wikipedia.org/wiki/List_of_mathematical_symbols_by_subject if environment.initex then local registergroup = mathematics.dictionaries.registergroup registergroup("default") - registergroup("binary arithmic") + registergroup("binary arithmetic") registergroup("binary linear algebra") registergroup("binary logical") registergroup("binary relation") registergroup("binary set") - registergroup("constant arithmic") + registergroup("constant arithmetic") registergroup("constant set") registergroup("differential") registergroup("integral") registergroup("interval") registergroup("lambda") registergroup("limit") - registergroup("nary arithmic") + registergroup("nary arithmetic") registergroup("nary constructor") registergroup("nary functional") registergroup("nary linear algebra") @@ -249,7 +260,7 @@ do registergroup("partial") -- partial differential registergroup("product") registergroup("quantifier") - registergroup("unary arithmic") + registergroup("unary arithmetic") registergroup("unary elementary") registergroup("unary functional") registergroup("unary linear algebra") @@ -358,6 +369,10 @@ registerengineclass("unspaced") registerengineclass("experimental") registerengineclass("fake") +registerengineclass("maybeordinary") +registerengineclass("mayberelation") +registerengineclass("maybebinary") + local specialclasses = tex.specialmathclasscodes classes["all"] = specialclasses["all"] classnames[specialclasses["all"] ] = "all" @@ -366,8 +381,8 @@ classes["end"] = specialclasses["end"] classnames[specialclasses["end"] ] callback.register("get_noad_class", function(n) return classnames[n] end) -local function registerprivateclass(name) - local class = classes[name] +local function registerprivateclass(name,parent) + local class = parent and classes[parent] or classes[name] if not class then lastprivateclass = lastprivateclass + 1 class = lastprivateclass @@ -395,19 +410,22 @@ implement { actions = registerengineclass, } -local topaccent_class = registerprivateclass("topaccent") -local botaccent_class = registerprivateclass("botaccent") -local delimiter_class = registerprivateclass("delimiter") -local root_class = registerprivateclass("root") -local prime_class = registerprivateclass("prime") +local topaccent_class = registerprivateclass("topaccent") +local bottomaccent_class = registerprivateclass("bottomaccent") +local delimiter_class = registerprivateclass("delimiter") +local root_class = registerprivateclass("root") +local prime_class = registerprivateclass("prime") + +registerprivateclass("botaccent","bottomaccent") local accents = allocate { - accent = true, -- some can be both - topaccent = true, [topaccent_class] = true, - botaccent = true, [botaccent_class] = true, - under = true, [under_class] = true, - over = true, [over_class] = true, - unknown = false, + accent = true, -- some can be both + topaccent = true, [topaccent_class] = true, + bottomaccent = true, [bottomaccent_class] = true, + botaccent = true, + under = true, [under_class] = true, + over = true, [over_class] = true, + unknown = false, } local integer_value = tokens.values.integer @@ -503,8 +521,8 @@ do group = groupnames[group] or 0 if group ~= 0 then -- which one - registercharacter(group,unicode) - -- registercharacter(group,slot) + registercharacter(group,unicode,nil,class) + -- registercharacter(group,slot,nil,class) end end return mset, dset @@ -521,18 +539,18 @@ do end end - local f_accent = formatters[ [[\defUmathtopaccent \%s{%X}{%X}{%X}]] ] - local f_fixedtopaccent = formatters[ [[\defUmathfixedtopaccent \%s{%X}{%X}{%X}]] ] - local f_fixedbotaccent = formatters[ [[\defUmathfixedbotaccent \%s{%X}{%X}{%X}]] ] - local f_topaccent = formatters[ [[\defUmathtopaccent \%s{%X}{%X}{%X}]] ] - local f_botaccent = formatters[ [[\defUmathbotaccent \%s{%X}{%X}{%X}]] ] - local f_over = formatters[ [[\defUdelimiterover \%s{%X}{%X}{%X}]] ] - local f_under = formatters[ [[\defUdelimiterunder\%s{%X}{%X}{%X}]] ] - local f_fence = formatters[ [[\defUdelimiter \%s{%X}{%X}{%X}]] ] - local f_delimiter = formatters[ [[\defUdelimiter \%s{%X}{%X}{%X}]] ] - local f_radical = formatters[ [[\defUradical \%s{%X}{%X}]] ] - local f_root = formatters[ [[\defUroot \%s{%X}{%X}]] ] - local f_char = formatters[ [[\defUmathchar \%s{%X}{%X}{%X}]] ] + local f_accent = formatters[ [[\defUmathtopaccent \%s{%X}{%X}{%X}]] ] + local f_fixedtopaccent = formatters[ [[\defUmathfixedtopaccent \%s{%X}{%X}{%X}]] ] + local f_fixedbottomaccent = formatters[ [[\defUmathfixedbottomaccent \%s{%X}{%X}{%X}]] ] + local f_topaccent = formatters[ [[\defUmathtopaccent \%s{%X}{%X}{%X}]] ] + local f_bottomaccent = formatters[ [[\defUmathbottomaccent \%s{%X}{%X}{%X}]] ] + local f_over = formatters[ [[\defUdelimiterover \%s{%X}{%X}{%X}]] ] + local f_under = formatters[ [[\defUdelimiterunder\%s{%X}{%X}{%X}]] ] + local f_fence = formatters[ [[\defUdelimiter \%s{%X}{%X}{%X}]] ] + local f_delimiter = formatters[ [[\defUdelimiter \%s{%X}{%X}{%X}]] ] + local f_radical = formatters[ [[\defUradical \%s{%X}{%X}]] ] + local f_root = formatters[ [[\defUroot \%s{%X}{%X}]] ] + local f_char = formatters[ [[\defUmathchar \%s{%X}{%X}{%X}]] ] local texmathchardef = tex.mathchardef @@ -540,9 +558,10 @@ do if class == accent_class then ctx_sprint(f_topaccent(name,0,family,slot)) elseif class == topaccent_class then + -- only widegrave widehat widetilde : still needed? ctx_sprint((stretch and f_topaccent or f_fixedtopaccent)(name,0,family,slot)) - elseif class == botaccent_class then - ctx_sprint((stretch and f_botaccent or f_fixedbotaccent)(name,0,family,slot)) + elseif class == bottomaccent_class then + ctx_sprint((stretch and f_bottomaccent or f_fixedbottomaccent)(name,0,family,slot)) elseif class == over_class then ctx_sprint(f_over(name,0,family,slot)) elseif class == under_class then @@ -561,7 +580,7 @@ do if group then group = groupnames[group] or 0 if group ~= 0 then - texmathchardef(name,engine,family,slot,"permanent",0,group,slot) + texmathchardef(name,engine,family,slot,"permanent",0x1,group,slot) return end end @@ -639,10 +658,11 @@ do end end for i=1,#spec do - local m = spec[i] - local name = m.name - local class = m.class or class - local group = m.group or group + local m = spec[i] + local name = m.name + local class = m.class or class + local group = m.group or group + local stretch = m.stretch or stretch if class then class = classes[class] or ordinary_class else @@ -898,7 +918,7 @@ do name = "utfmathcommandbelow", public = true, actions = { utfmathcommand, context }, - arguments = { "argument", false, "'botaccent'","'under'" } + arguments = { "argument", false, "'bottomaccent'","'under'" } } implement { @@ -921,7 +941,7 @@ do name = "doifelseutfmathbelow", public = true, actions = { utfmathaccent, ctx_doifelsesomething }, - arguments = { "argument", false, "'botaccent'", "'under'" } + arguments = { "argument", false, "'bottomaccent'", "'under'" } } implement { diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index 9dd9675f3..5b5610ff5 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -1,4 +1,4 @@ - %D \module +%D \module %D [ file=math-ini, %D version=2008.01.02, %D title=\CONTEXT\ Math Macros, @@ -182,11 +182,35 @@ \setnewconstant\mathallcode \mathclassvalue all \setnewconstant\mathfakecode \mathclassvalue fake -%setnewconstant\mathtopaccentcode \mathclassvalue topaccent % these are private and above 31 -%setnewconstant\mathbotaccentcode \mathclassvalue botaccent % these are private and above 31 -%setnewconstant\mathdelimitercode \mathclassvalue delimiter % these are private and above 31 -%setnewconstant\mathrootcode \mathclassvalue root % these are private and above 31 -%setnewconstant\mathprimecode \mathclassvalue prime % these are private and above 31 +%D \starttyping +%D \enabletrackers[math.suspicious] +%D +%D \Umathchardef \foo \mathmaybeordinarycode 0 `o +%D \Umathchardef \oof \mathmayberelationcode 0 `= +%D \Umathchardef \ofo \mathmaybebinarycode 0 `+ +%D +%D \starttext +%D $ \foo _ 1 \ofo \foo _ 2 \oof \foo _ 3 + 4 $ +%D \stoptext +%D \stoptyping +%D +%D Gives: +%D +%D \starttyping +%D mathematics > suspicious > class 36, U+1D45C 𝑜 +%D mathematics > suspicious > class 38, U+0002B + +%D mathematics > suspicious > class 37, U+0003D = +%D \stoptyping + +\setnewconstant\mathmaybeordinarycode \mathclassvalue maybeordinary +\setnewconstant\mathmayberelationcode \mathclassvalue mayberelation +\setnewconstant\mathmaybebinarycode \mathclassvalue maybebinary + +%setnewconstant\mathtopaccentcode \mathclassvalue topaccent % these are private and above 31 +%setnewconstant\mathbottomaccentcode \mathclassvalue bottomaccent % these are private and above 31 +%setnewconstant\mathdelimitercode \mathclassvalue delimiter % these are private and above 31 +%setnewconstant\mathrootcode \mathclassvalue root % these are private and above 31 +%setnewconstant\mathprimecode \mathclassvalue prime % these are private and above 31 %letmathspacing \mathimaginarycode \mathordinarycode \mathordinarycode \mathordinarycode \mathordinarycode %letmathspacing \mathdifferentialcode \mathordinarycode \mathordinarycode \mathordinarycode \mathordinarycode @@ -203,6 +227,10 @@ \copymathspacing \mathwrappedcode \mathfractioncode \copymathspacing \mathunarycode \mathordinarycode +\copymathspacing \mathmaybeordinarycode \mathordinarycode +\copymathspacing \mathmayberelationcode \mathrelationcode +\copymathspacing \mathmaybebinarycode \mathbinarycode + \setnewconstant\mathlimopcode \plusone \setnewconstant\mathnolopcode \plusone @@ -543,6 +571,11 @@ \noitaliccorrectionclassoptioncode % +\middlefenceclassoptioncode +\raiseprimeclassoptioncode + +\carryoverlefttopkernclassoptioncode + +\carryoverleftbottomkernclassoptioncode + +\carryoverrighttopkernclassoptioncode + +\carryoverrightbottomkernclassoptioncode + +\preferdelimiterdimensionsclassoptioncode \relax \setmathoptions\mathfractioncode\numexpr @@ -567,9 +600,10 @@ \setmathoptions\mathaccentcode\numexpr \defaultmathclassoptions + +\autoinjectclassoptioncode \relax -% \m{m^2/x__3} +% ord spacing but with support for \m{m^2/x__3} \setmathoptions\mathdivisioncode\numexpr \nopreslackclassoptioncode @@ -673,9 +707,11 @@ %D A few compatibility helpers: -\permanent\def\Umathbotaccent{\Umathaccent \s!bottom } -\permanent\def\Umathtopaccent{\Umathaccent \s!top } -\permanent\def\Umathaccents {\Umathaccent \s!both } % strange highlighting +\permanent\def\Umathbottomaccent{\Umathaccent \s!bottom } +\permanent\def\Umathtopaccent {\Umathaccent \s!top } +\permanent\def\Umathaccents {\Umathaccent \s!both } % strange highlighting + +\aliased\let\Umathbotaccent\Umathbottomaccent %D The attributes that we will use (todo: pack some into one but uglier code): @@ -690,7 +726,7 @@ \definesystemattribute[mathitalics] [public] \definesystemattribute[mathkernpairs] [public] \definesystemattribute[mathbidi] [public] -\definesystemattribute[mathdomain] [public] +%definesystemattribute[mathdomain] [public] \definesystemattribute[mathcollapsing] [public] \definesystemattribute[mathunstack] [public] \definesystemattribute[mathvariant] [public] @@ -1062,7 +1098,7 @@ \inherited\setmathspacing \mathordinarycode \mathrelationcode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathordinarycode \mathrelationcode \allscriptstyles \pettymuskip % \inherited\setmathspacing \mathordinarycode \mathopencode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathordinarycode \mathmiddlecode \allscriptstyles \pettymuskip % \inherited\setmathspacing \mathordinarycode \mathclosecode \allmathstyles \zeromuskip % \inherited\setmathspacing \mathordinarycode \mathpunctuationcode \allmathstyles \zeromuskip @@ -1081,7 +1117,7 @@ \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathoperatorcode \mathrelationcode \allscriptstyles \pettymuskip % \inherited\setmathspacing \mathoperatorcode \mathopencode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathoperatorcode \mathmiddlecode \allscriptstyles \pettymuskip % \inherited\setmathspacing \mathoperatorcode \mathclosecode \allmathstyles \zeromuskip % \inherited\setmathspacing \mathoperatorcode \mathpunctuationcode \allmathstyles \zeromuskip @@ -1100,7 +1136,7 @@ %% \inherited\setmathspacing \mathbinarycode \mathrelationcode \allmathstyles \zeromuskip \inherited\setmathspacing \mathbinarycode \mathopencode \allsplitstyles \medmuskip \inherited\setmathspacing \mathbinarycode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathbinarycode \mathmiddlecode \allscriptstyles \pettymuskip %% \inherited\setmathspacing \mathbinarycode \mathclosecode \allmathstyles \zeromuskip \inherited\setmathspacing \mathbinarycode \mathpunctuationcode \allsplitstyles \medmuskip @@ -1179,7 +1215,7 @@ \inherited\setmathspacing \mathpunctuationcode \mathrelationcode \allscriptstyles \pettymuskip \inherited\setmathspacing \mathpunctuationcode \mathopencode \allsplitstyles \thinmuskip \inherited\setmathspacing \mathpunctuationcode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathpunctuationcode \mathmiddlecode \allscriptstyles \pettymuskip \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allsplitstyles \thinmuskip \inherited\setmathspacing \mathpunctuationcode \mathclosecode \allscriptstyles \pettymuskip @@ -1203,7 +1239,7 @@ \inherited\setmathspacing \mathconstructcode \mathrelationcode \allscriptstyles \pettymuskip \inherited\setmathspacing \mathconstructcode \mathopencode \allsplitstyles \thinmuskip \inherited\setmathspacing \mathconstructcode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathconstructcode \mathmiddlecode \allscriptstyles \pettymuskip % \inherited\setmathspacing \mathconstructcode \mathclosecode \allmathstyles \zeromuskip \inherited\setmathspacing \mathconstructcode \mathpunctuationcode \allsplitstyles \thinmuskip @@ -1224,7 +1260,7 @@ \inherited\setmathspacing \mathellipsiscode \mathrelationcode \allscriptstyles \pettymuskip \inherited\setmathspacing \mathellipsiscode \mathopencode \allsplitstyles \thinmuskip \inherited\setmathspacing \mathellipsiscode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathellipsiscode \mathmiddlecode \allscriptstyles \pettymuskip % \inherited\setmathspacing \mathellipsiscode \mathclosecode \allmathstyles \zeromuskip \inherited\setmathspacing \mathellipsiscode \mathpunctuationcode \allsplitstyles \thinmuskip @@ -1249,7 +1285,7 @@ \inherited\setmathspacing \mathfractioncode \mathrelationcode \allscriptstyles \pettymuskip \inherited\setmathspacing \mathfractioncode \mathopencode \allsplitstyles \thinmuskip \inherited\setmathspacing \mathfractioncode \mathopencode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathfractioncode \mathmiddlecode \allscriptstyles \pettymuskip \inherited\setmathspacing \mathfractioncode \mathclosecode \allmathstyles \pettymuskip % \inherited\setmathspacing \mathfractioncode \mathpunctuationcode \allmathstyles \zeromuskip @@ -1270,7 +1306,8 @@ \inherited\setmathspacing \mathradicalcode \mathrelationcode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathradicalcode \mathrelationcode \allscriptstyles \pettymuskip % \inherited\setmathspacing \mathradicalcode \mathopencode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathradicalcode \mathmiddlecode \allscriptstyles \pettymuskip % \inherited\setmathspacing \mathradicalcode \mathclosecode \allmathstyles \zeromuskip % \inherited\setmathspacing \mathradicalcode \mathpunctuationcode \allmathstyles \zeromuskip \inherited\setmathspacing \mathradicalcode \mathconstructcode \allsplitstyles \thinmuskip @@ -1282,24 +1319,29 @@ \inherited\setmathspacing \mathradicalcode \mathradicalcode \allsplitstyles \thinmuskip \inherited\setmathspacing \mathradicalcode \mathradicalcode \allscriptstyles \pettymuskip % - \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathmiddlecode \mathordinarycode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathoperatorcode \allmathstyles \thinmuskip + \inherited\setmathspacing \mathmiddlecode \mathoperatorcode \allmathstyles \thickmuskip \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allsplitstyles \medmuskip \inherited\setmathspacing \mathmiddlecode \mathbinarycode \allscriptstyles \pettymuskip \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathmiddlecode \mathrelationcode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathmiddlecode \mathopencode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathmiddlecode \mathclosecode \allmathstyles \zeromuskip - % \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allmathstyles \zeromuskip - \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathmiddlecode \mathopencode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathopencode \allsplitstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathmiddlecode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathclosecode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathclosecode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathpunctuationcode \allscriptstyles \pettymuskip + \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathmiddlecode \mathconstructcode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allsplitstyles \thinmuskip + \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathmiddlecode \mathellipsiscode \allscriptstyles \pettymuskip - \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allsplitstyles \medmuskip + \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allsplitstyles \thickmuskip \inherited\setmathspacing \mathmiddlecode \mathfractioncode \allscriptstyles \pettymuskip - % \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allmathstyles \zeromuskip + \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allsplitstyles \thickmuskip + \inherited\setmathspacing \mathmiddlecode \mathradicalcode \allmathstyles \pettymuskip % \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allsplitstyles \thinmuskip \inherited\setmathspacing \mathclosecode \mathdifferentialcode \allscriptstyles \pettymuskip @@ -1322,6 +1364,10 @@ \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allsplitstyles \medmuskip \inherited\setmathspacing \mathfunctioncode \mathbinarycode \allscriptstyles \pettymuskip % + % \im{1\unit{hour} 20 \unit{minute} 56 \unit{second}} + % + \inherited\setmathspacing \mathdimensioncode \mathdigitcode \allmathstyles \thickmuskip + % \inherited\setmathspacing \mathfakecode \mathallcode \allmathstyles \tinymuskip \inherited\setmathspacing \mathallcode \mathfakecode \allmathstyles \tinymuskip % @@ -3627,29 +3673,30 @@ \permanent\protected\def\mathminus {\ifmmode –\orelse\iffontchar\font`−−\else –\fi} \permanent\protected\def\mathplusminus{±} -%D Experiment: (todo: same switch as italic, using \type {\everyswitchmathematics}). - -\newcount\c_math_domain_attribute - -\def\math_domain_initialize - {\ifnum\c_math_domain_attribute=\attributeunsetvalue \else - \clf_initializemathdomain % one time - \glet\math_domain_initialize\relax - \fi} - -\appendtoks - \edef\p_domain{\mathematicsparameter\c!domain}% - \ifempty\p_domain - \c_math_domain_attribute\attributeunsetvalue - \else - \c_math_domain_attribute\clf_getmathdomain\p_domain\relax - \math_domain_initialize - \fi -\to \everyswitchmathematics % only in mathematics - -\appendtoks - \c_attr_mathdomain\c_math_domain_attribute -\to \everymathematics +%D Experiment, replaced by dictionaries but for now we keep the code as the domain key +%D might come back. +% +% \newcount\c_math_domain_attribute +% +% \def\math_domain_initialize +% {\ifnum\c_math_domain_attribute=\attributeunsetvalue \else +% \clf_initializemathdomain % one time +% \glet\math_domain_initialize\relax +% \fi} +% +% \appendtoks +% \edef\p_domain{\mathematicsparameter\c!domain}% +% \ifempty\p_domain +% \c_math_domain_attribute\attributeunsetvalue +% \else +% \c_math_domain_attribute\clf_getmathdomain\p_domain\relax +% \math_domain_initialize +% \fi +% \to \everyswitchmathematics % only in mathematics +% +% \appendtoks +% \c_attr_mathdomain\c_math_domain_attribute +% \to \everymathematics \setupmathematics [\s!italics=3] % for the moment only this one makes sense .. still experimental diff --git a/tex/context/base/mkxl/math-int.mkxl b/tex/context/base/mkxl/math-int.mkxl index db7aec7e2..fd5ea37c9 100644 --- a/tex/context/base/mkxl/math-int.mkxl +++ b/tex/context/base/mkxl/math-int.mkxl @@ -54,6 +54,6 @@ \to \everyswitchmathematics \setupmathematics - [\c!integral=nolimits] + [\c!integral=auto] \protect \endinput diff --git a/tex/context/base/mkxl/math-lop.mkxl b/tex/context/base/mkxl/math-lop.mkxl index 044ca0634..8be8fc98d 100644 --- a/tex/context/base/mkxl/math-lop.mkxl +++ b/tex/context/base/mkxl/math-lop.mkxl @@ -106,11 +106,18 @@ % TODO: Add 4 (inherited) classes and then define them automatically from char-def % instead. +\definemathoperator [integrals] +\definemathoperator [summations] +\definemathoperator [products] +\definemathoperator [operators] + \setupmathoperators [integrals] [\c!size=\v!auto,\c!method=\mathematicsparameter\c!integral] % cf Mikael's wish \setupmathoperators [summations] [\c!size=\v!auto] \setupmathoperators [products] [\c!size=\v!auto] \setupmathoperators [operators] [\c!size=\v!auto] +\setupmathematics[\c!integral=nolimits] + \definemathoperator [integral] [integrals] [\c!left="222B] % these might go unless we decide \definemathoperator [iintegral] [integrals] [\c!left="222C] % to have verbose parents but who \definemathoperator [iiintegral] [integrals] [\c!left="222D] % will use them diff --git a/tex/context/base/mkxl/math-noa.lmt b/tex/context/base/mkxl/math-noa.lmt index 8e5b75ef4..3f77c2225 100644 --- a/tex/context/base/mkxl/math-noa.lmt +++ b/tex/context/base/mkxl/math-noa.lmt @@ -57,44 +57,35 @@ local mathmode_code = tex.modelevels.math local colortracers = nodes.tracers.colors -local trace_remapping = false registertracker("math.remapping", function(v) trace_remapping = v end) -local trace_processing = false registertracker("math.processing", function(v) trace_processing = v end) -local trace_analyzing = false registertracker("math.analyzing", function(v) trace_analyzing = v end) -local trace_normalizing = false registertracker("math.normalizing", function(v) trace_normalizing = v end) -local trace_collapsing = false registertracker("math.collapsing", function(v) trace_collapsing = v end) -local trace_fixing = false registertracker("math.fixing", function(v) trace_fixing = v end) -local trace_patching = false registertracker("math.patching", function(v) trace_patching = v end) -local trace_goodies = false registertracker("math.goodies", function(v) trace_goodies = v end) -local trace_variants = false registertracker("math.variants", function(v) trace_variants = v end) -local trace_alternates = false registertracker("math.alternates", function(v) trace_alternates = v end) -local trace_italics = false registertracker("math.italics", function(v) trace_italics = v end) -local trace_kernpairs = false registertracker("math.kernpairs", function(v) trace_kernpairs = v end) -local trace_domains = false registertracker("math.domains", function(v) trace_domains = v end) -local trace_families = false registertracker("math.families", function(v) trace_families = v end) -local trace_fences = false registertracker("math.fences", function(v) trace_fences = v end) -local trace_unstacking = false registertracker("math.unstack", function(v) trace_unstacking = v end) -local trace_snapping = false registertracker("math.snapping", function(v) trace_snapping = v end) -local trace_dictionaries = false registertracker("math.dictionaries", function(v) trace_dictionaries = v end) - -local check_coverage = true registerdirective("math.checkcoverage", function(v) check_coverage = v end) -local use_math_goodies = true registerdirective("math.nogoodies", function(v) use_math_goodies = not v end) - -local report_processing = logreporter("mathematics","processing") -local report_remapping = logreporter("mathematics","remapping") -local report_normalizing = logreporter("mathematics","normalizing") -local report_collapsing = logreporter("mathematics","collapsing") -local report_fixing = logreporter("mathematics","fixing") -local report_patching = logreporter("mathematics","patching") -local report_goodies = logreporter("mathematics","goodies") -local report_variants = logreporter("mathematics","variants") -local report_alternates = logreporter("mathematics","alternates") -local report_italics = logreporter("mathematics","italics") -local report_kernpairs = logreporter("mathematics","kernpairs") -local report_domains = logreporter("mathematics","domains") -local report_families = logreporter("mathematics","families") -local report_fences = logreporter("mathematics","fences") -local report_unstacking = logreporter("mathematics","unstack") -local report_snapping = logreporter("mathematics","snapping") +-- most trace/report will move into the closures + +local trace_remapping = false registertracker("math.remapping", function(v) trace_remapping = v end) +local trace_processing = false registertracker("math.processing", function(v) trace_processing = v end) +local trace_analyzing = false registertracker("math.analyzing", function(v) trace_analyzing = v end) +local trace_normalizing = false registertracker("math.normalizing", function(v) trace_normalizing = v end) +local trace_collapsing = false registertracker("math.collapsing", function(v) trace_collapsing = v end) +local trace_fixing = false registertracker("math.fixing", function(v) trace_fixing = v end) +local trace_patching = false registertracker("math.patching", function(v) trace_patching = v end) +local trace_goodies = false registertracker("math.goodies", function(v) trace_goodies = v end) +local trace_variants = false registertracker("math.variants", function(v) trace_variants = v end) +local trace_alternates = false registertracker("math.alternates", function(v) trace_alternates = v end) +local trace_italics = false registertracker("math.italics", function(v) trace_italics = v end) +local trace_kernpairs = false registertracker("math.kernpairs", function(v) trace_kernpairs = v end) + +local check_coverage = true registerdirective("math.checkcoverage", function(v) check_coverage = v end) +local use_math_goodies = true registerdirective("math.nogoodies", function(v) use_math_goodies = not v end) + +local report_processing = logreporter("mathematics","processing") +local report_remapping = logreporter("mathematics","remapping") +local report_normalizing = logreporter("mathematics","normalizing") +local report_collapsing = logreporter("mathematics","collapsing") +local report_fixing = logreporter("mathematics","fixing") +local report_patching = logreporter("mathematics","patching") +local report_goodies = logreporter("mathematics","goodies") +local report_variants = logreporter("mathematics","variants") +local report_alternates = logreporter("mathematics","alternates") +local report_italics = logreporter("mathematics","italics") +local report_kernpairs = logreporter("mathematics","kernpairs") local a_mathrendering = privateattribute("mathrendering") local a_exportstatus = privateattribute("exportstatus") @@ -135,18 +126,30 @@ local getwidth = nuts.getwidth local getheight = nuts.getheight local getdepth = nuts.getdepth local getwhd = nuts.getwhd +local getdelimiter = nuts.getdelimiter +local getleftdelimiter = nuts.getleftdelimiter +local getrightdelimiter = nuts.getrightdelimiter +local getnumerator = nuts.getnumerator +local getdenominator = nuts.getdenominator +local getdegree = nuts.getdegree +local gettop = nuts.gettop +local getmiddle = nuts.getmiddle +local getbottom = nuts.getbottom +local getchoice = nuts.getchoice local getnucleus = nuts.getnucleus local getsub = nuts.getsub local getsup = nuts.getsup local getsubpre = nuts.getsubpre local getsuppre = nuts.getsuppre +local getprime = nuts.getprime local setnucleus = nuts.setnucleus local setsub = nuts.setsub local setsup = nuts.setsup local setsubpre = nuts.setsubpre local setsuppre = nuts.setsuppre +local setprime = nuts.setprime local getoffsets = nuts.getoffsets local setoffsets = nuts.setoffsets @@ -292,48 +295,51 @@ local function process(start,what,n,parent) end elseif id == noad_code then -- single characters are like this - local noad = getnucleus(start) if noad then process(noad,what,n,start) end -- list - noad = getsup (start) if noad then process(noad,what,n,start) end -- list - noad = getsub (start) if noad then process(noad,what,n,start) end -- list - noad = getsuppre (start) if noad then process(noad,what,n,start) end -- list - noad = getsubpre (start) if noad then process(noad,what,n,start) end -- list - noad = getfield(start,"prime") if noad then process(noad,what,n,start) end -- list + local noad = getnucleus(start) if noad then process(noad,what,n,start) end -- list + noad = getsup(start) if noad then process(noad,what,n,start) end -- list + noad = getsub(start) if noad then process(noad,what,n,start) end -- list + noad = getsuppre(start) if noad then process(noad,what,n,start) end -- list + noad = getsubpre(start) if noad then process(noad,what,n,start) end -- list + noad = getprime(start) if noad then process(noad,what,n,start) end -- list elseif id == mathchar_code or id == mathtextchar_code or id == delimiter_code then break elseif id == subbox_code or id == submlist_code then - local noad = getlist(start) if noad then process(noad,what,n,start) end -- list (not getlist !) + local noad = getlist(start) if noad then process(noad,what,n,start) end -- list (not getlist !) elseif id == fraction_code then - local noad = getfield(start,"num") if noad then process(noad,what,n,start) end -- list - noad = getfield(start,"denom") if noad then process(noad,what,n,start) end -- list - noad = getfield(start,"left") if noad then process(noad,what,n,start) end -- delimiter - noad = getfield(start,"right") if noad then process(noad,what,n,start) end -- delimiter + local noad = getnumerator(start) if noad then process(noad,what,n,start) end -- list + noad = getdenominator(start) if noad then process(noad,what,n,start) end -- list + noad = getleftdelimiter(start) if noad then process(noad,what,n,start) end -- delimiter + noad = getdelimiter(start) if noad then process(noad,what,n,start) end -- delimiter + noad = getrightdelimiter(start) if noad then process(noad,what,n,start) end -- delimiter elseif id == math_choice then - local noad = getfield(start,"display") if noad then process(noad,what,n,start) end -- list - noad = getfield(start,"text") if noad then process(noad,what,n,start) end -- list - noad = getfield(start,"script") if noad then process(noad,what,n,start) end -- list - noad = getfield(start,"scriptscript") if noad then process(noad,what,n,start) end -- list + local noad = getchoice(start,1) if noad then process(noad,what,n,start) end -- list + noad = getchoice(start,2) if noad then process(noad,what,n,start) end -- list + noad = getchoice(start,3) if noad then process(noad,what,n,start) end -- list + noad = getchoice(start,4) if noad then process(noad,what,n,start) end -- list elseif id == fence_code then - local noad = getfield(start,"delimiter") if noad then process(noad,what,n,start) end -- delimiter - noad = getfield(start,"top") if noad then process(noad,what,n,start) end -- list - noad = getfield(start,"bottom") if noad then process(noad,what,n,start) end -- list + local noad = getdelimiter(start) if noad then process(noad,what,n,start) end -- delimiter + noad = gettop(start) if noad then process(noad,what,n,start) end -- list + noad = getbottom(start) if noad then process(noad,what,n,start) end -- list elseif id == radical_code then - local noad = getnucleus(start) if noad then process(noad,what,n,start) end -- list - noad = getsup (start) if noad then process(noad,what,n,start) end -- list - noad = getsub (start) if noad then process(noad,what,n,start) end -- list - noad = getsuppre (start) if noad then process(noad,what,n,start) end -- list - noad = getsubpre (start) if noad then process(noad,what,n,start) end -- list - noad = getfield(start,"prime") if noad then process(noad,what,n,start) end -- delimiter - noad = getfield(start,"left") if noad then process(noad,what,n,start) end -- delimiter - noad = getfield(start,"degree") if noad then process(noad,what,n,start) end -- list + local noad = getnucleus(start) if noad then process(noad,what,n,start) end -- list + noad = getsup(start) if noad then process(noad,what,n,start) end -- list + noad = getsub(start) if noad then process(noad,what,n,start) end -- list + noad = getsuppre(start) if noad then process(noad,what,n,start) end -- list + noad = getsubpre(start) if noad then process(noad,what,n,start) end -- list + noad = getprime(start) if noad then process(noad,what,n,start) end -- delimiter + noad = getleftdelimiter(start) if noad then process(noad,what,n,start) end -- delimiter + noad = getrightdelimiter(start) if noad then process(noad,what,n,start) end -- delimiter + noad = getdegree(start) if noad then process(noad,what,n,start) end -- list elseif id == accent_code then - local noad = getnucleus(start) if noad then process(noad,what,n,start) end -- list - noad = getsup (start) if noad then process(noad,what,n,start) end -- list - noad = getsub (start) if noad then process(noad,what,n,start) end -- list - noad = getsuppre (start) if noad then process(noad,what,n,start) end -- list - noad = getsubpre (start) if noad then process(noad,what,n,start) end -- list - noad = getfield(start,"prime") if noad then process(noad,what,n,start) end -- list - noad = getfield(start,"topaccent") if noad then process(noad,what,n,start) end -- list - noad = getfield(start,"botaccent") if noad then process(noad,what,n,start) end -- list + local noad = getnucleus(start) if noad then process(noad,what,n,start) end -- list + noad = getsup(start) if noad then process(noad,what,n,start) end -- list + noad = getsub(start) if noad then process(noad,what,n,start) end -- list + noad = getsuppre(start) if noad then process(noad,what,n,start) end -- list + noad = getsubpre(start) if noad then process(noad,what,n,start) end -- list + noad = getprime(start) if noad then process(noad,what,n,start) end -- list + noad = gettop(start) if noad then process(noad,what,n,start) end -- list + noad = getmiddle(start) if noad then process(noad,what,n,start) end -- list + noad = getbottom(start) if noad then process(noad,what,n,start) end -- list -- elseif id == style_code then -- -- has a next -- elseif id == parameter_code then @@ -352,46 +358,49 @@ local function processnested(current,what,n) local noad = nil local id = getid(current) if id == noad_code then - noad = getnucleus(current) if noad then process(noad,what,n,current) end -- list - noad = getsup (current) if noad then process(noad,what,n,current) end -- list - noad = getsub (current) if noad then process(noad,what,n,current) end -- list - noad = getsuppre (current) if noad then process(noad,what,n,current) end -- list - noad = getsubpre (current) if noad then process(noad,what,n,current) end -- list - noad = getfield (current,"prime") if noad then process(noad,what,n,current) end -- list + noad = getnucleus(current) if noad then process(noad,what,n,current) end -- list + noad = getsup(current) if noad then process(noad,what,n,current) end -- list + noad = getsub(current) if noad then process(noad,what,n,current) end -- list + noad = getsuppre(current) if noad then process(noad,what,n,current) end -- list + noad = getsubpre(current) if noad then process(noad,what,n,current) end -- list + noad = getprime(current) if noad then process(noad,what,n,current) end -- list elseif id == subbox_code or id == submlist_code then - noad = getlist(current) if noad then process(noad,what,n,current) end -- list (not getlist !) + noad = getlist(current) if noad then process(noad,what,n,current) end -- list (not getlist !) elseif id == fraction_code then - noad = getfield(current,"num") if noad then process(noad,what,n,current) end -- list - noad = getfield(current,"denom") if noad then process(noad,what,n,current) end -- list - noad = getfield(current,"left") if noad then process(noad,what,n,current) end -- delimiter - noad = getfield(current,"right") if noad then process(noad,what,n,current) end -- delimiter + noad = getnumerator(current) if noad then process(noad,what,n,current) end -- list + noad = getdenominator(current) if noad then process(noad,what,n,current) end -- list + noad = getleftdelimiter(current) if noad then process(noad,what,n,current) end -- delimiter + noad = getdelimiter(current) if noad then process(noad,what,n,current) end -- delimiter + noad = getrightdelimiter(current) if noad then process(noad,what,n,current) end -- delimiter elseif id == math_choice then - noad = getfield(current,"display") if noad then process(noad,what,n,current) end -- list - noad = getfield(current,"text") if noad then process(noad,what,n,current) end -- list - noad = getfield(current,"script") if noad then process(noad,what,n,current) end -- list - noad = getfield(current,"scriptscript") if noad then process(noad,what,n,current) end -- list + noad = getchoice(start,1) if noad then process(noad,what,n,current) end -- list + noad = getchoice(start,2) if noad then process(noad,what,n,current) end -- list + noad = getchoice(start,3) if noad then process(noad,what,n,current) end -- list + noad = getchoice(start,4) if noad then process(noad,what,n,current) end -- list elseif id == fence_code then - noad = getfield(current,"delimiter") if noad then process(noad,what,n,current) end -- delimiter - noad = getfield(current,"top") if noad then process(noad,what,n,current) end -- list - noad = getfield(current,"bottom") if noad then process(noad,what,n,current) end -- list + noad = getdelimiter(current) if noad then process(noad,what,n,current) end -- delimiter + noad = gettop(current) if noad then process(noad,what,n,current) end -- list + noad = getbottom(current) if noad then process(noad,what,n,current) end -- list elseif id == radical_code then - noad = getnucleus(current) if noad then process(noad,what,n,current) end -- list - noad = getsup (current) if noad then process(noad,what,n,current) end -- list - noad = getsub (current) if noad then process(noad,what,n,current) end -- list - noad = getsuppre (current) if noad then process(noad,what,n,current) end -- list - noad = getsubpre (current) if noad then process(noad,what,n,current) end -- list - noad = getfield(current,"prime") if noad then process(noad,what,n,current) end -- list - noad = getfield(current,"left") if noad then process(noad,what,n,current) end -- delimiter - noad = getfield(current,"degree") if noad then process(noad,what,n,current) end -- list + noad = getnucleus(current) if noad then process(noad,what,n,current) end -- list + noad = getsup(current) if noad then process(noad,what,n,current) end -- list + noad = getsub(current) if noad then process(noad,what,n,current) end -- list + noad = getsuppre(current) if noad then process(noad,what,n,current) end -- list + noad = getsubpre(current) if noad then process(noad,what,n,current) end -- list + noad = getprime(current) if noad then process(noad,what,n,current) end -- list + noad = getleftdelimiter(current) if noad then process(noad,what,n,current) end -- delimiter + noad = getrightdelimiter(current) if noad then process(noad,what,n,current) end -- delimiter + noad = getdegree(current) if noad then process(noad,what,n,current) end -- list elseif id == accent_code then - noad = getnucleus(current) if noad then process(noad,what,n,current) end -- list - noad = getsup (current) if noad then process(noad,what,n,current) end -- list - noad = getsub (current) if noad then process(noad,what,n,current) end -- list - noad = getsuppre (current) if noad then process(noad,what,n,current) end -- list - noad = getsubpre (current) if noad then process(noad,what,n,current) end -- list - noad = getfield(current,"prime") if noad then process(noad,what,n,current) end -- list - noad = getfield(current,"topaccent") if noad then process(noad,what,n,current) end -- list - noad = getfield(current,"botaccent") if noad then process(noad,what,n,current) end -- list + noad = getnucleus(current) if noad then process(noad,what,n,current) end -- list + noad = getsup(current) if noad then process(noad,what,n,current) end -- list + noad = getsub(current) if noad then process(noad,what,n,current) end -- list + noad = getsuppre(current) if noad then process(noad,what,n,current) end -- list + noad = getsubpre(current) if noad then process(noad,what,n,current) end -- list + noad = getprime(current) if noad then process(noad,what,n,current) end -- list + noad = gettop(current) if noad then process(noad,what,n,current) end -- list + noad = getmiddle(current) if noad then process(noad,what,n,current) end -- list + noad = getbottom(current) if noad then process(noad,what,n,current) end -- list end end @@ -399,46 +408,49 @@ local function processstep(current,process,n,id) local noad = nil local id = id or getid(current) if id == noad_code then - noad = getnucleus(current) if noad then process(noad,n,current) end -- list - noad = getsup (current) if noad then process(noad,n,current) end -- list - noad = getsub (current) if noad then process(noad,n,current) end -- list - noad = getsuppre (current) if noad then process(noad,n,current) end -- list - noad = getsubpre (current) if noad then process(noad,n,current) end -- list - noad = getfield (current,"prime") if noad then process(noad,n,current) end -- list + noad = getnucleus(current) if noad then process(noad,n,current) end -- list + noad = getsup(current) if noad then process(noad,n,current) end -- list + noad = getsub(current) if noad then process(noad,n,current) end -- list + noad = getsuppre(current) if noad then process(noad,n,current) end -- list + noad = getsubpre(current) if noad then process(noad,n,current) end -- list + noad = getprime(current) if noad then process(noad,n,current) end -- list elseif id == subbox_code or id == submlist_code then - noad = getlist(current) if noad then process(noad,n,current) end -- list (not getlist !) + noad = getlist(current) if noad then process(noad,n,current) end -- list (not getlist !) elseif id == fraction_code then - noad = getfield(current,"num") if noad then process(noad,n,current) end -- list - noad = getfield(current,"denom") if noad then process(noad,n,current) end -- list - noad = getfield(current,"left") if noad then process(noad,n,current) end -- delimiter - noad = getfield(current,"right") if noad then process(noad,n,current) end -- delimiter + noad = getnumerator(current) if noad then process(noad,n,current) end -- list + noad = getdenominator(current) if noad then process(noad,n,current) end -- list + noad = getleftdelimiter(current) if noad then process(noad,n,current) end -- delimiter + noad = getdelimiter(current) if noad then process(noad,n,current) end -- delimiter + noad = getrightdelimiter(current) if noad then process(noad,n,current) end -- delimiter elseif id == math_choice then - noad = getfield(current,"display") if noad then process(noad,n,current) end -- list - noad = getfield(current,"text") if noad then process(noad,n,current) end -- list - noad = getfield(current,"script") if noad then process(noad,n,current) end -- list - noad = getfield(current,"scriptscript") if noad then process(noad,n,current) end -- list + noad = getchoice(start,1) if noad then process(noad,n,current) end -- list + noad = getchoice(start,2) if noad then process(noad,n,current) end -- list + noad = getchoice(start,3) if noad then process(noad,n,current) end -- list + noad = getchoice(start,4) if noad then process(noad,n,current) end -- list elseif id == fence_code then - noad = getfield(current,"delimiter") if noad then process(noad,n,current) end -- delimiter - noad = getfield(current,"top") if noad then process(noad,n,current) end -- list - noad = getfield(current,"bottom") if noad then process(noad,n,current) end -- list + noad = getdelimiter(current) if noad then process(noad,n,current) end -- delimiter + noad = gettop(current) if noad then process(noad,n,current) end -- list + noad = getbottom(current) if noad then process(noad,n,current) end -- list elseif id == radical_code then - noad = getnucleus(current) if noad then process(noad,n,current) end -- list - noad = getsup (current) if noad then process(noad,n,current) end -- list - noad = getsub (current) if noad then process(noad,n,current) end -- list - noad = getsuppre (current) if noad then process(noad,n,current) end -- list - noad = getsubpre (current) if noad then process(noad,n,current) end -- list - noad = getfield(current,"prime") if noad then process(noad,n,current) end -- delimiter - noad = getfield(current,"left") if noad then process(noad,n,current) end -- delimiter - noad = getfield(current,"degree") if noad then process(noad,n,current) end -- list + noad = getnucleus(current) if noad then process(noad,n,current) end -- list + noad = getsup(current) if noad then process(noad,n,current) end -- list + noad = getsub(current) if noad then process(noad,n,current) end -- list + noad = getsuppre(current) if noad then process(noad,n,current) end -- list + noad = getsubpre(current) if noad then process(noad,n,current) end -- list + noad = getprime(current) if noad then process(noad,n,current) end -- delimiter + noad = getleftdelimiter(current) if noad then process(noad,n,current) end -- delimiter + noad = getrightdelimiter(current) if noad then process(noad,n,current) end -- delimiter + noad = getdegree(current) if noad then process(noad,n,current) end -- list elseif id == accent_code then - noad = getnucleus(current) if noad then process(noad,n,current) end -- list - noad = getsup (current) if noad then process(noad,n,current) end -- list - noad = getsub (current) if noad then process(noad,n,current) end -- list - noad = getsuppre (current) if noad then process(noad,n,current) end -- list - noad = getsubpre (current) if noad then process(noad,n,current) end -- list - noad = getfield(current,"prime") if noad then process(noad,n,current) end -- list - noad = getfield(current,"topaccent") if noad then process(noad,n,current) end -- list - noad = getfield(current,"botaccent") if noad then process(noad,n,current) end -- list + noad = getnucleus(current) if noad then process(noad,n,current) end -- list + noad = getsup(current) if noad then process(noad,n,current) end -- list + noad = getsub(current) if noad then process(noad,n,current) end -- list + noad = getsuppre(current) if noad then process(noad,n,current) end -- list + noad = getsubpre(current) if noad then process(noad,n,current) end -- list + noad = getprime(current) if noad then process(noad,n,current) end -- list + noad = gettop(current) if noad then process(noad,n,current) end -- list + noad = getmiddle(current) if noad then process(noad,n,current) end -- list + noad = getbottom(current) if noad then process(noad,n,current) end -- list end end @@ -520,6 +532,9 @@ do local a_mathfamily = privateattribute("mathfamily") local boldmap = mathematics.boldmap + local trace_families = false registertracker("math.families", function(v) trace_families = v end) + local report_families = logreporter("mathematics","families") + local familymap = { [0] = "regular", "regular", @@ -605,8 +620,42 @@ do end end end + + -- families[delimiter_code] = function(pointer) + -- if getfield(pointer,"smallfamily") == 0 then + -- local a = getattr(pointer,a_mathfamily) + -- if a and a > 0 then + -- setattr(pointer,a_mathfamily,0) + -- if a > 5 then + -- -- no bold delimiters in unicode + -- a = a - 3 + -- end + -- local fam = getfontoffamily(a) + -- local char = getfield(pointer,"smallchar") + -- local okay = fontcharacters[fam][char] + -- if okay then + -- setfield(pointer,"smallfamily",a) + -- elseif a > 2 then + -- setfield(pointer,"smallfamily",a-3) + -- end + -- local char = getfield(pointer,"largechar") + -- local okay = fontcharacters[fam][char] + -- if okay then + -- setfield(pointer,"largefamily",a) + -- elseif a > 2 then + -- setfield(pointer,"largefamily",a-3) + -- end + -- else + -- setfield(pointer,"smallfamily",0) + -- setfield(pointer,"largefamily",0) + -- end + -- end + -- end + + -- has become: + families[delimiter_code] = function(pointer) - if getfield(pointer,"smallfamily") == 0 then + if getfam(pointer) == 0 then local a = getattr(pointer,a_mathfamily) if a and a > 0 then setattr(pointer,a_mathfamily,0) @@ -614,52 +663,19 @@ do -- no bold delimiters in unicode a = a - 3 end - local fam = getfontoffamily(a) - local char = getfield(pointer,"smallchar") - local okay = fontcharacters[fam][char] - if okay then - setfield(pointer,"smallfamily",a) - elseif a > 2 then - setfield(pointer,"smallfamily",a-3) - end - local char = getfield(pointer,"largechar") - local okay = fontcharacters[fam][char] + local char = getchar(pointer) + local okay = fontcharacters[getfontoffamily(a)][char] if okay then - setfield(pointer,"largefamily",a) + setfam(pointer,a) elseif a > 2 then - setfield(pointer,"largefamily",a-3) + setfam(pointer,a-3) end else - setfield(pointer,"smallfamily",0) - setfield(pointer,"largefamily",0) + setfam(pointer,0) end end end - -- will become: - - -- families[delimiter_code] = function(pointer) - -- if getfam(pointer) == 0 then - -- local a = getattr(pointer,a_mathfamily) - -- if a and a > 0 then - -- setattr(pointer,a_mathfamily,0) - -- if a > 5 then - -- -- no bold delimiters in unicode - -- a = a - 3 - -- end - -- local char = getchar(pointer) - -- local okay = fontcharacters[getfontoffamily(a)][char] - -- if okay then - -- setfam(pointer,a) - -- elseif a > 2 then - -- setfam(pointer,a-3) - -- end - -- else - -- setfam(pointer,0) - -- end - -- end - -- end - families[mathtextchar_code] = families[mathchar_code] function handlers.families(head,style,penalties) @@ -861,6 +877,9 @@ do local a_mathsize = privateattribute("mathsize") -- this might move into other fence code local resize = { } + local trace_fences = false registertracker("math.fences", function(v) trace_fences = v end) + local report_fences = logreporter("mathematics","fences") + resize[fence_code] = function(pointer) local subtype = getsubtype(pointer) -- if subtype == leftfence_code or subtype == rightfence_code then @@ -1273,6 +1292,9 @@ do local enabled = false local a_unstack = privateattribute("mathunstack") + local trace_unstacking = false registertracker("math.unstack", function(v) trace_unstacking = v end) + local report_unstacking = logreporter("mathematics","unstack") + unstack[noad_code] = function(pointer) if getattr(pointer,a_unstack) then local sup = getsup(pointer) @@ -1549,6 +1571,8 @@ do end end + alternate[delimiter_code] = alternate[mathchar_code] + function handlers.alternates(head,style,penalties) processnoads(head,alternate,"alternate") return true -- not needed @@ -2004,7 +2028,7 @@ do setsub(prev,primesub) primesub = nil end - setfield(prev,"prime",nuc) + setprime(prev,nuc) setnucleus(parent) if not primesup then setsup(parent) @@ -2142,6 +2166,9 @@ end do + -- Given the amount of classes this no longer makes much sense or we need to + -- extend it. + local classes = { } local colors = { [relationnoad_code] = "trace:dr", @@ -2236,6 +2263,9 @@ do local a_mathsnap = attributes.private("mathsnap") + local trace_snapping = false registertracker("math.snapping", function(v) trace_snapping = v end) + local report_snapping = logreporter("mathematics","snapping") + function handlers.snap(h,_,_,_,_,level) -- if not level or level == 0 then if texgetcount("mathnestinglevel") == 1 then @@ -2363,165 +2393,168 @@ do end --- experimental - -do - - -- mathematics.registerdomain { - -- name = "foo", - -- parents = { "bar" }, - -- characters = { - -- [0x123] = { char = 0x234, class = binary }, - -- }, - -- } - - local domains = { } - local categories = { } - local numbers = { } - local a_mathdomain = privateattribute("mathdomain") - mathematics.domains = categories - local permitted = { - ordinary = ordinarynoad_code, - binary = binarynoad_code, - relation = relationnoad_code, - punctuation = punctuationnoad_code, - inner = innernoad_code, - fenced = fencednoad_code, - -- fraction = fractionnoad_code, - -- radical = radicalnoad_code, - } - - function mathematics.registerdomain(data) - local name = data.name - if not name then - return - end - local attr = #numbers + 1 - categories[name] = data - numbers[attr] = data - data.attribute = attr - -- we delay hashing - return attr - end - - local enable - - enable = function() - enableaction("math", "noads.handlers.domains") - if trace_domains then - report_domains("enabling math domains") - end - enable = false - end - - function mathematics.setdomain(name) - if enable then - enable() - end - local data = name and name ~= v_reset and categories[name] - texsetattribute(a_mathdomain,data and data.attribute or unsetvalue) - end - - function mathematics.getdomain(name) - if enable then - enable() - end - local data = name and name ~= v_reset and categories[name] - context(data and data.attribute or unsetvalue) - end - - implement { - name = "initializemathdomain", - actions = enable, - onlyonce = true, - } - - implement { - name = "setmathdomain", - arguments = "string", - actions = mathematics.setdomain, - } - - implement { - name = "getmathdomain", - arguments = "string", - actions = mathematics.getdomain, - } - - local function makehash(data) - local hash = { } - local parents = data.parents - if parents then - local function merge(name) - if name then - local c = categories[name] - if c then - local hash = c.hash - if not hash then - hash = makehash(c) - end - for k, v in next, hash do - hash[k] = v - end - end - end - end - if type(parents) == "string" then - merge(parents) - elseif type(parents) == "table" then - for i=1,#parents do - merge(parents[i]) - end - end - end - local characters = data.characters - if characters then - for k, v in next, characters do - -- local chr = n.char - local cls = v.class - if cls then - v.code = permitted[cls] - else - -- invalid class - end - hash[k] = v - end - end - data.hash = hash - return hash - end - - domains[mathchar_code] = function(pointer,what,n,parent) - local attr = getattr(pointer,a_mathdomain) - if attr then - local domain = numbers[attr] - if domain then - local hash = domain.hash - if not hash then - hash = makehash(domain) - end - local char = getchar(pointer) - local okay = hash[char] - if okay then - local chr = okay.char - local cls = okay.code - if chr and chr ~= char then - setchar(pointer,chr) - end - if cls and cls ~= getsubtype(parent) then - setsubtype(parent,cls) - end - end - end - end - end - - function handlers.domains(head,style,penalties) - processnoads(head,domains,"domains") - return true -- not needed - end - -end +-- experimental : replaced by dictionaries but for now we keep the code +-- +-- do +-- +-- -- mathematics.registerdomain { +-- -- name = "foo", +-- -- parents = { "bar" }, +-- -- characters = { +-- -- [0x123] = { char = 0x234, class = binary }, +-- -- }, +-- -- } +-- +-- local trace_domains = false registertracker("math.domains", function(v) trace_domains = v end) +-- local report_domains = logreporter("mathematics","domains") +-- +-- local domains = { } +-- local categories = { } +-- local numbers = { } +-- local a_mathdomain = privateattribute("mathdomain") +-- mathematics.domains = categories +-- local permitted = { +-- ordinary = ordinarynoad_code, +-- binary = binarynoad_code, +-- relation = relationnoad_code, +-- punctuation = punctuationnoad_code, +-- inner = innernoad_code, +-- fenced = fencednoad_code, +-- -- fraction = fractionnoad_code, +-- -- radical = radicalnoad_code, +-- } +-- +-- function mathematics.registerdomain(data) +-- local name = data.name +-- if not name then +-- return +-- end +-- local attr = #numbers + 1 +-- categories[name] = data +-- numbers[attr] = data +-- data.attribute = attr +-- -- we delay hashing +-- return attr +-- end +-- +-- local enable +-- +-- enable = function() +-- enableaction("math", "noads.handlers.domains") +-- if trace_domains then +-- report_domains("enabling math domains") +-- end +-- enable = false +-- end +-- +-- function mathematics.setdomain(name) +-- if enable then +-- enable() +-- end +-- local data = name and name ~= v_reset and categories[name] +-- texsetattribute(a_mathdomain,data and data.attribute or unsetvalue) +-- end +-- +-- function mathematics.getdomain(name) +-- if enable then +-- enable() +-- end +-- local data = name and name ~= v_reset and categories[name] +-- context(data and data.attribute or unsetvalue) +-- end +-- +-- implement { +-- name = "initializemathdomain", +-- actions = enable, +-- onlyonce = true, +-- } +-- +-- implement { +-- name = "setmathdomain", +-- arguments = "string", +-- actions = mathematics.setdomain, +-- } +-- +-- implement { +-- name = "getmathdomain", +-- arguments = "string", +-- actions = mathematics.getdomain, +-- } +-- +-- local function makehash(data) +-- local hash = { } +-- local parents = data.parents +-- if parents then +-- local function merge(name) +-- if name then +-- local c = categories[name] +-- if c then +-- local hash = c.hash +-- if not hash then +-- hash = makehash(c) +-- end +-- for k, v in next, hash do +-- hash[k] = v +-- end +-- end +-- end +-- end +-- if type(parents) == "string" then +-- merge(parents) +-- elseif type(parents) == "table" then +-- for i=1,#parents do +-- merge(parents[i]) +-- end +-- end +-- end +-- local characters = data.characters +-- if characters then +-- for k, v in next, characters do +-- -- local chr = n.char +-- local cls = v.class +-- if cls then +-- v.code = permitted[cls] +-- else +-- -- invalid class +-- end +-- hash[k] = v +-- end +-- end +-- data.hash = hash +-- return hash +-- end +-- +-- domains[mathchar_code] = function(pointer,what,n,parent) +-- local attr = getattr(pointer,a_mathdomain) +-- if attr then +-- local domain = numbers[attr] +-- if domain then +-- local hash = domain.hash +-- if not hash then +-- hash = makehash(domain) +-- end +-- local char = getchar(pointer) +-- local okay = hash[char] +-- if okay then +-- local chr = okay.char +-- local cls = okay.code +-- if chr and chr ~= char then +-- setchar(pointer,chr) +-- end +-- if cls and cls ~= getsubtype(parent) then +-- setsubtype(parent,cls) +-- end +-- end +-- end +-- end +-- end +-- +-- function handlers.domains(head,style,penalties) +-- processnoads(head,domains,"domains") +-- return true -- not needed +-- end +-- +-- end -- just for me @@ -2551,12 +2584,16 @@ do end --- for Mikael and me - --- This could be an early callback, when we actually assign a character. +-- Musical timestamp: August 2022 with "Meditation by Cory Wong (Live @ Brooklyn +-- Steel FEB 2022). Seen live earlier that year and its gets better and better! +-- +-- As we also try to do here: do + local trace_dictionaries = false registertracker("math.dictionaries", function(v) trace_dictionaries = v end) + local report_dictionaries = logreporter("mathematics","dictionaries") + local setnodecolor = colortracers.set local getchardict = nuts.getchardict local setchardict = nuts.setchardict @@ -2570,39 +2607,54 @@ do local function check(pointer,group,index) local v = variants[index] if v and v[group] then - return group + return group, class end return 1 end - dictionaries[mathchar_code] = function(pointer) - local properties, group, index = getchardict(pointer) - local set = sets[group] - local real = 1 - if set then - local groups = set.groups - local nofgroups = groups and #groups - if nofgroups > 0 then - for i=1,nofgroups do - real = check(pointer,groups[i],index) - if real ~= 1 then - goto done + dictionaries[mathchar_code] = function(pointer,what,n,parent) + local properties, oldgroup, index, font, char = getchardict(pointer) + local newgroup = 1 + local newclass = false + local oldclass = getsubtype(pointer) + if (properties & 0x1) == 0x1 then + newclass = oldclass + newgroup = oldgroup + else + local set = sets[oldgroup] + if set then + local groups = set.groups + local nofgroups = groups and #groups + if nofgroups > 0 then + for i=1,nofgroups do + real, class = check(pointer,groups[i],index) + if real ~= 1 then + goto done + end end end + else + newgroup, newclass = check(pointer,group,index) + end + ::done:: + if newgroup == 1 then + newgroup = defaults[index] or 1 + end + setchardict(pointer,properties,newgroup,index) + if type(newclass) == "number" then + setsubtype(parent,newclass) + else + newclass = oldclass end - else - real = check(pointer,group,index) - end - ::done:: - if real == 1 then - real = defaults[index] or 1 end - setchardict(pointer,properties,real,index) - if trace_dictionaries and real > 1 then - local groupname = groups[real] - if groupname then - setnodecolor(pointer,"dictionary:"..groupname) + if trace_dictionaries then + if newgroup > 1 then + local groupname = groups[newgroup] + if groupname then + setnodecolor(pointer,"dictionary:"..groupname) + end end + report_dictionaries("group 0x%02X -> 0x%02X, class 0x%02X -> 0x%02X, index %05X, %U %c",oldgroup,newgroup,oldclass,newclass,index,char,char) end end @@ -2612,6 +2664,40 @@ do end +do + + local trace_suspicious = false registertracker("math.suspicious", function(v) trace_suspicious = v end) + local report_suspicious = logreporter("mathematics","suspicious") + + local suspicious = { } noads.processors.suspicious = suspicious + + local candidates = { + [mathematics.classes.maybeordinary] = "maybeordinary", + [mathematics.classes.mayberelation] = "mayberelation", + [mathematics.classes.maybebinary ] = "maybebinary", + } + local registered = setmetatableindex("table") + + suspicious[mathchar_code] = function(pointer,what,n,parent) + local class = getsubtype(pointer) + local found = candidates[class] + if found then + local char = getchar(pointer) + if not registered[class][char] then + report_suspicious("class %a, %U %c",found,char,char) + registered[class][char] = true + end + end + end + + function handlers.suspicious(head,style,penalties) + if trace_suspicious then + processnoads(head,suspicious,"suspicious") + end + end + +end + -- the normal builder -- do diff --git a/tex/context/base/mkxl/math-rad.mklx b/tex/context/base/mkxl/math-rad.mklx index 2293c2a90..caa58b9d0 100644 --- a/tex/context/base/mkxl/math-rad.mklx +++ b/tex/context/base/mkxl/math-rad.mklx @@ -26,8 +26,6 @@ % \def\rootradical{\Uroot 0 "221A } % can be done in char-def % \def\surdradical{\Uradical 0 "221A } % can be done in char-def -\permanent\protected\def\root#1\of{\rootradical{#1}} % #2 - \protected\def\sqrt{\doifelsenextoptionalcs\rootwithdegree\rootwithoutdegree} % will be redefined % \permanent\protected\def\styledrootradical#1#2% so that \text works ok ... \rootradical behaves somewhat weird @@ -93,7 +91,11 @@ \c!height=\zeropoint, \c!depth=\zeropoint, \c!strut=\v!height, - \c!source=\zerocount] + \c!source=\zerocount, + \c!left="221A, + \c!right=\zerocount, + \c!leftmargin=\zeropoint, + \c!rightmargin=\zeropoint] \appendtoks \frozen\protected\instance\edefcsname\currentmathradical\endcsname{\math_radical_handle{\currentmathradical}} @@ -124,9 +126,14 @@ \ifempty\currentmathradicaldegree \let\currentmathradicaldegree\m_math_no_degree \fi + \ifcase\mathradicalparameter\c!right\else + \let\currentmathradicaldegree\m_math_no_degree + \fi \math_radical_alternative{% \begincsname\??mathwhateverstrut\mathradicalparameter\c!strut\endcsname + \scratchdimen\mathradicalparameter\c!leftmargin \relax\ifzeropt\scratchdimen\else\kern\scratchdimen\fi #body% + \scratchdimen\mathradicalparameter\c!rightmargin\relax\ifzeropt\scratchdimen\else\kern\scratchdimen\fi }% \endgroup} @@ -159,19 +166,19 @@ \def\math_radical_alternative{\csname\??mathradicalalternative\mathradicalparameter\c!alternative\endcsname} -\integerdef\c_radical_unicode "221A - % We use a strut in the degree because not all fonts have the right gaps set up but % as struts are sort of predictable we can now fix all fonts in the lfg file. \protected\def\math_radical_common#degree% - {\Uroot + {\Urooted \s!height\dimexpr\mathradicalparameter\c!height\relax \s!depth \dimexpr\mathradicalparameter\c!depth\relax \s!source\numexpr\namedboxanchor{\mathradicalparameter\c!source}\relax \s!style \normalmathstyle - \zerocount \c_radical_unicode - {\mathstrut#degree}} + \zerocount \mathradicalparameter\c!left + \zerocount \mathradicalparameter\c!right + \relax + {\mathstrut#degree}} \defcsname\??mathradicalalternative\v!default\endcsname % #body% {\math_radical_common{\currentmathradicaldegree}} % {#body}} @@ -182,7 +189,7 @@ \math_radical_common{\currentmathradicaldegree}{#body}% {} really needed as \rootradical expands first \orelse\ifempty\currentmathradicaldegree \pushcolor[\p_color]% - \math_radical_common{\currentmathradicaldegree}% + \math_radical_common{}% {\popcolor#body}% \else \pushcolor[\p_color]% @@ -330,4 +337,28 @@ % % \dorecurse{8}{$\mathhat{\blackrule[width=#1ex,color=gray]}$ } +\definemathradical + [rannuity] + [\c!left=\zerocount, + \c!right="20E7, + \c!rightmargin=.05\emwidth] + +\definemathradical + [lannuity] + [\c!left="FE942, + \c!right=\zerocount, + \c!leftmargin=.05\emwidth, + \c!rightmargin=.05\emwidth] + +\definemathradical + [lrannuity] + [\c!left="FE942, + \c!right="20E7, + \c!leftmargin=.05\emwidth, + \c!rightmargin=.05\emwidth] + +\definemathradical + [annuity] + [rannuity] + \protect \endinput diff --git a/tex/context/base/mkxl/math-spa.lmt b/tex/context/base/mkxl/math-spa.lmt index 2bde8dd1d..d26a3f6f8 100644 --- a/tex/context/base/mkxl/math-spa.lmt +++ b/tex/context/base/mkxl/math-spa.lmt @@ -18,6 +18,8 @@ local glue_code = nodes.nodecodes.glue local line_code = nodes.listcodes.line local ghost_code = nodes.listcodes.ghost local middle_code = nodes.listcodes.middle +local leftskip_code = nodes.gluecodes.leftskip +local rightskip_code = nodes.gluecodes.rightskip local nuts = nodes.nuts local tonut = nodes.tonut @@ -104,6 +106,8 @@ local function reposition(n,offset) addxoffset(n,-offset) end end + -- this is tricky ... see line numbering so it might become a real shift + -- inside the box: setprops(n,"repositioned",true) addxoffset(n,offset) end diff --git a/tex/context/base/mkxl/math-stc.mklx b/tex/context/base/mkxl/math-stc.mklx index bed61bb62..2ddfa24fd 100644 --- a/tex/context/base/mkxl/math-stc.mklx +++ b/tex/context/base/mkxl/math-stc.mklx @@ -371,7 +371,8 @@ \scratchwidth\mathcharwd\scratchunicode \ifdim\wd\scratchboxone>\scratchwidth \scratchwidth\wd\scratchboxone - \orelse\ifdim\wd\scratchboxtwo>\scratchwidth + \fi % no \elseif here + \ifdim\wd\scratchboxtwo>\scratchwidth \scratchwidth\wd\scratchboxtwo \fi \else @@ -1084,24 +1085,6 @@ \definemathextensible [\v!mathematics] [mrightleftharpoons] ["21CC] \definemathextensible [\v!mathematics] [mtriplerel] ["2261] -\definemathextensible [\v!mathematics] [eleftarrowfill] ["2190] % ["27F5] -\definemathextensible [\v!mathematics] [erightarrowfill] ["2192] % ["27F6] -\definemathextensible [\v!mathematics] [eleftrightarrowfill] ["27F7] -\definemathextensible [\v!mathematics] [etwoheadrightarrowfill] ["27F9] -\definemathextensible [\v!mathematics] [eleftharpoondownfill] ["21BD] -\definemathextensible [\v!mathematics] [eleftharpoonupfill] ["21BC] -\definemathextensible [\v!mathematics] [erightharpoondownfill] ["21C1] -\definemathextensible [\v!mathematics] [erightharpoonupfill] ["21C0] - -\definemathextensible [\v!mathematics] [eoverbarfill] ["FE33E] -\definemathextensible [\v!mathematics] [eunderbarfill] ["FE33F] -\definemathextensible [\v!mathematics] [eoverbracefill] ["FE3DE] -\definemathextensible [\v!mathematics] [eunderbracefill] ["FE3DF] -\definemathextensible [\v!mathematics] [eoverparentfill] ["FE3DC] -\definemathextensible [\v!mathematics] [eunderparentfill] ["FE3DD] -\definemathextensible [\v!mathematics] [eoverbracketfill] ["FE3B4] -\definemathextensible [\v!mathematics] [eunderbracketfill] ["FE3B5] - \definemathextensible [\v!text] [trel] ["002D] \definemathextensible [\v!text] [tequal] ["003D] \definemathextensible [\v!text] [tmapsto] ["21A6] @@ -1157,28 +1140,6 @@ %D in the backend (okay, we still need to deal with some cut and paste issues but at %D least we now know what we deal with. -% alternatively we can move the original to FE* - -% \definemathoverextensible [\v!vfenced] [overbar] ["FE33E] % ["203E] -% \definemathunderextensible [\v!vfenced] [underbar] ["FE33F] % ["203E] -% \definemathdoubleextensible [\v!vfenced] [doublebar] ["FE33E] ["FE33F] -% -% \definemathoverextensible [\v!vfenced] [overbrace] ["FE3DE] % ["023DE] -% \definemathunderextensible [\v!vfenced] [underbrace] ["FE3DF] % ["023DF] -% \definemathdoubleextensible [\v!vfenced] [doublebrace] ["FE3DE] ["FE3DF] -% -% \definemathoverextensible [\v!vfenced] [overparent] ["FE3DC] % ["023DC] -% \definemathunderextensible [\v!vfenced] [underparent] ["FE3DD] % ["023DD] -% \definemathdoubleextensible [\v!vfenced] [doubleparent] ["FE3DC] ["FE3DD] -% -% \definemathoverextensible [\v!vfenced] [overbracket] ["FE3B4] % ["023B4] -% \definemathunderextensible [\v!vfenced] [underbracket] ["FE3B5] % ["023B5] -% \definemathdoubleextensible [\v!vfenced] [doublebracket] ["FE3B4] ["FE3B5] - -% \definemathoverextensible [\v!vfenced] [overbar] ["203E] -% \definemathunderextensible [\v!vfenced] [underbar] ["203E] -% \definemathdoubleextensible [\v!vfenced] [doublebar] ["203E] ["203E] - \definemathoverextensible [\v!vfenced] [overbar] ["203E] \definemathunderextensible [\v!vfenced] [underbar] ["203E] % ["0332] \definemathdoubleextensible [\v!vfenced] [doublebar] ["203E] ["203E] % ["0332] @@ -1195,29 +1156,8 @@ \definemathunderextensible [\v!vfenced] [underbracket] ["23B5] \definemathdoubleextensible [\v!vfenced] [doublebracket] ["23B4] ["23B5] -% If we do this, we need to adapt the dimensions, so wel leave them accents: -% -% \definemathoverextensible[\v!vfenced][widebar] ["0305] -% \definemathoverextensible[\v!vfenced][widetilde]["0303] - -% \protected\def\mathopwithlimits#1#2{\mathop{#1{#2}}\limits} - %D For mathml: -% \definemathdoubleextensible [\v!both] [overbarunderbar] ["FE33E] ["FE33F] -% \definemathdoubleextensible [\v!both] [overbraceunderbrace] ["FE3DE] ["FE3DF] -% \definemathdoubleextensible [\v!both] [overparentunderparent] ["FE3DC] ["FE3DD] -% \definemathdoubleextensible [\v!both] [overbracketunderbracket] ["FE3B4] ["FE3B5] -% -% \definemathovertextextensible [\v!bothtext] [overbartext] ["FE33E] -% \definemathundertextextensible [\v!bothtext] [underbartext] ["FE33F] -% \definemathovertextextensible [\v!bothtext] [overbracetext] ["FE3DE] -% \definemathundertextextensible [\v!bothtext] [underbracetext] ["FE3DF] -% \definemathovertextextensible [\v!bothtext] [overparenttext] ["FE3DC] -% \definemathundertextextensible [\v!bothtext] [underparenttext] ["FE3DD] -% \definemathovertextextensible [\v!bothtext] [overbrackettext] ["FE3B4] -% \definemathundertextextensible [\v!bothtext] [underbrackettext] ["FE3B5] - \definemathdoubleextensible [\v!both] [overbarunderbar] ["203E] ["203E] \definemathdoubleextensible [\v!both] [overbraceunderbrace] ["23DE] ["23DF] \definemathdoubleextensible [\v!both] [overparentunderparent] ["23DC] ["23DD] @@ -1263,7 +1203,7 @@ #3% \endgroup}} -% These will be defined in char-def as well once we have \leaders<number> +% These will become characters defined in math-act. \immutable\protected\def\rightarrowfill {\math_stackers_hacked_fill \relbar \relbar \rightarrow} \immutable\protected\def\leftarrowfill {\math_stackers_hacked_fill \leftarrow \relbar \relbar } @@ -1285,10 +1225,6 @@ \immutable\protected\def\relfill {\math_stackers_hacked_fill \relbar \relbar \relbar} \immutable\protected\def\triplerelfill {\math_stackers_hacked_fill \equiv \equiv \equiv} -% \permanent\protected\def\singlebond{{\xrel}} % or \def\singlebond{{\xrel[2]}} -% \permanent\protected\def\doublebond{{\xequal}} -% \permanent\protected\def\triplebond{{\xtriplerel}} - %D For the moment (needs checking): \permanent\tolerant\protected\def\defineextensiblefiller[#1]#*[#2]% @@ -1304,8 +1240,8 @@ \defineextensiblefiller [twoheadleftarrowfill] ["219E] \defineextensiblefiller [twoheadrightarrowfill] ["21A0] \defineextensiblefiller [mapstofill] ["21A6] -%defineextensiblefiller [hookleftarrowfill] ["21A9] -%defineextensiblefiller [hookrightarrowfill] ["21AA] +%defineextensiblefiller [hookleftarrowfill] ["21A9] % not in fonts +%defineextensiblefiller [hookrightarrowfill] ["21AA] % not in fonts \defineextensiblefiller [leftharpoondownfill] ["21BD] \defineextensiblefiller [leftharpoonupfill] ["21BC] \defineextensiblefiller [rightharpoondownfill] ["21C1] @@ -1318,28 +1254,7 @@ \defineextensiblefiller [Leftarrowfill] ["27F8] \defineextensiblefiller [Rightarrowfill] ["27F9] \defineextensiblefiller [Leftrightarrowfill] ["27FA] -%\defineextensiblefiller[Rightleftarrowfill] [.....] - -% These are fishy ... we need to check this because now these commands relax (there -% are some entries in char-def.) -% -% %definemathoverextensible [overbarfill] ["FE33E] -% %definemathunderextensible [underbarfill] ["FE33F] -% \definemathoverextensible [overbracefill] ["FE3DE] -% \definemathunderextensible [underbracefill] ["FE3DF] -% \definemathoverextensible [overparentfill] ["FE3DC] -% \definemathunderextensible [underparentfill] ["FE3DD] -% \definemathoverextensible [overbracketfill] ["FE3B4] -% \definemathunderextensible [underbracketfill] ["FE3B5] -% -% %defineextensiblefiller [overbarfill] ["FE33E] -% %defineextensiblefiller [underbarfill] ["FE33F] -% \defineextensiblefiller [overbracefill] ["FE3DE] -% \defineextensiblefiller [underbracefill] ["FE3DF] -% \defineextensiblefiller [overparentfill] ["FE3DC] -% \defineextensiblefiller [underparentfill] ["FE3DD] -% \defineextensiblefiller [overbracketfill] ["FE3B4] -% \defineextensiblefiller [underbracketfill] ["FE3B5] +\defineextensiblefiller [Rightleftarrowfill] ["27FA] %D Extra: diff --git a/tex/context/base/mkxl/math-tag.lmt b/tex/context/base/mkxl/math-tag.lmt index 429191546..2eb9327cf 100644 --- a/tex/context/base/mkxl/math-tag.lmt +++ b/tex/context/base/mkxl/math-tag.lmt @@ -13,6 +13,9 @@ if not modules then modules = { } end modules ['math-tag'] = { -- todo: tracing -- todo: maybe use lpeg matchers +-- todo: prime +-- todo: middle in fraction + local find, match = string.find, string.match local insert, remove, concat = table.insert, table.remove, table.concat @@ -33,6 +36,16 @@ local getattrlist = nuts.getattrlist local setattr = nuts.setattr local getwidth = nuts.getwidth +local getnumerator = nuts.getnumerator +local getdenominator = nuts.getdenominator +local getdelimiter = nuts.getdelimiter +local getleftdelimiter = nuts.getleftdelimiter +local getrightdelimiter = nuts.getrightdelimiter +local getdegree = nuts.getdegree +local gettop = nuts.gettop +local getbottom = nuts.getbottom +local getchoice = nuts.getchoice + local getnucleus = nuts.getnucleus local getsub = nuts.getsub local getsup = nuts.getsup @@ -416,10 +429,13 @@ process = function(start) -- we cannot use the processor as we have no finalizer end end elseif id == fraction_code then - local num = getfield(start,"num") - local denom = getfield(start,"denom") - local left = getfield(start,"left") - local right = getfield(start,"right") + -- + -- if middle then we have a stacker! + -- + local num = getnumerator(start) + local denom = getdenominator(start) + local left = getleftdelimiter(start) + local right = getrightdelimiter(start) if left then setattr(left,a_tagged,start_tagged("mo")) process(left) @@ -435,10 +451,10 @@ process = function(start) -- we cannot use the processor as we have no finalizer stop_tagged() end elseif id == choice_code then - local display = getfield(start,"display") - local text = getfield(start,"text") - local script = getfield(start,"script") - local scriptscript = getfield(start,"scriptscript") + local display = getchoice(start,1) + local text = getchoice(start,2) + local script = getchoice(start,3) + local scriptscript = getchoice(start,4) if display then process(display) end @@ -452,28 +468,28 @@ process = function(start) -- we cannot use the processor as we have no finalizer process(scriptscript) end elseif id == fence_code then - local delim = getfield(start,"delimiter") + local delimiter = getdelimiter(start) if subtype == leftfence_code then -- left local properties = { } insert(fencesstack,properties) setattr(start,a_tagged,start_tagged("mfenced",properties)) -- needs checking - if delim then + if delimiter then start_tagged("ignore") - local chr = getchar(delim) + local chr = getchar(delimiter) if chr ~= 0 then properties.left = chr end - process(delim) + process(delimiter) stop_tagged() end start_tagged("mrow") -- begin of subsequence elseif subtype == middlefence_code then -- middle - if delim then + if delimiter then start_tagged("ignore") local top = fencesstack[#fencesstack] - local chr = getchar(delim) + local chr = getchar(delimiter) if chr ~= 0 then local mid = top.middle if mid then @@ -482,7 +498,7 @@ process = function(start) -- we cannot use the processor as we have no finalizer top.middle = { chr } end end - process(delim) + process(delimiter) stop_tagged() end stop_tagged() -- end of subsequence @@ -493,13 +509,13 @@ process = function(start) -- we cannot use the processor as we have no finalizer report_tags("missing right fence") properties = { } end - if delim then + if delimiter then start_tagged("ignore") - local chr = getchar(delim) + local chr = getchar(delimiter) if chr ~= 0 then properties.right = chr end - process(delim) + process(delimiter) stop_tagged() end stop_tagged() -- end of subsequence @@ -508,13 +524,19 @@ process = function(start) -- we cannot use the processor as we have no finalizer -- can't happen end elseif id == radical_code then - local left = getfield(start,"left") - local degree = getfield(start,"degree") + local left = getleftdelimiter(start) + local right = getrightdelimiter(start) + local degree = getdegree(start) if left then start_tagged("ignore") process(left) -- root symbol, ignored stop_tagged() end + if right then + start_tagged("ignore") + process(lright) -- actuarian symbol, ignored + stop_tagged() + end if degree and hascontent(degree) then setattr(start,a_tagged,start_tagged("mroot")) processsubsup(start) @@ -526,29 +548,29 @@ process = function(start) -- we cannot use the processor as we have no finalizer stop_tagged() end elseif id == accent_code then - local topaccent = getfield(start,"topaccent") - local botaccent = getfield(start,"botaccent") - if botaccent then + local topaccent = gettop(start) + local bottomaccent = getbottom(start) + if bottomaccent then if topaccent then setattr(start,a_tagged,start_tagged("munderover", { accent = true, top = getunicode(topaccent), - bottom = getunicode(botaccent), + bottom = getunicode(bottomaccent), topfixed = subtype == fixedtopaccent_code or subtype == fixedbothaccent_code, bottomfixed = subtype == fixedbottomaccent_code or subtype == fixedbothaccent_code, })) processsubsup(start) - process(botaccent) + process(bottomaccent) process(topaccent) stop_tagged() else setattr(start,a_tagged,start_tagged("munder", { accent = true, - bottom = getunicode(botaccent), + bottom = getunicode(bottomaccent), bottomfixed = subtype == fixedbottomaccent_code or subtype == fixedbothaccent_code, })) processsubsup(start) - process(botaccent) + process(bottomaccent) stop_tagged() end elseif topaccent then diff --git a/tex/context/base/mkxl/mult-prm.mkxl b/tex/context/base/mkxl/mult-prm.mkxl index 2ec763c39..1c0482349 100644 --- a/tex/context/base/mkxl/mult-prm.mkxl +++ b/tex/context/base/mkxl/mult-prm.mkxl @@ -71,7 +71,7 @@ "pdftracingfonts", "pdftrailer", "pdftrailerid", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage", - "pdfomitcidset", "pdfomitcharset", + "pdfomitcidset", "pdfomitcharset", "pdfomitinfodict", }, aleph = { -- we don't bother "Alephminorversion", "Alephrevision", "Alephversion", diff --git a/tex/context/base/mkxl/node-ini.lmt b/tex/context/base/mkxl/node-ini.lmt index 25141b8ab..53bd082af 100644 --- a/tex/context/base/mkxl/node-ini.lmt +++ b/tex/context/base/mkxl/node-ini.lmt @@ -46,6 +46,7 @@ local noadcodes = mark(getsubtypes("noad")) local radicalcodes = mark(getsubtypes("radical")) local accentcodes = mark(getsubtypes("accent")) local fencecodes = mark(getsubtypes("fence")) +local choicecodes = mark(getsubtypes("choice")) ----- fractioncodes = mark(getsubtypes("fraction")) local parcodes = mark(getsubtypes("par")) local attributecodes = mark(getsubtypes("attribute")) @@ -91,6 +92,7 @@ mathcodes = allocate(swapped(mathcodes,mathcodes)) disccodes = allocate(swapped(disccodes,disccodes)) accentcodes = allocate(swapped(accentcodes,accentcodes)) fencecodes = allocate(swapped(fencecodes,fencecodes)) +choicecodes = allocate(swapped(choicecodes,choicecodes)) parcodes = allocate(swapped(parcodes,parcodes)) attributecodes = allocate(swapped(attributecodes,attributecodes)) rulecodes = allocate(swapped(rulecodes,rulecodes)) @@ -114,6 +116,7 @@ nodes.disccodes = disccodes nodes.accentcodes = accentcodes nodes.radicalcodes = radicalcodes nodes.fencecodes = fencecodes +nodes.choicecodes = choicecodes nodes.parcodes = parcodes nodes.attributecodes = attributecodes nodes.rulecodes = rulecodes @@ -162,6 +165,7 @@ local subtypes = allocate { accent = accentcodes, radical = radicalcodes, fence = fencecodes, + choice = choicecodes, par = parcodes, attribute = attributecodes, rule = rulecodes, diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt index fccb539f3..a2a0043ac 100644 --- a/tex/context/base/mkxl/node-nut.lmt +++ b/tex/context/base/mkxl/node-nut.lmt @@ -50,11 +50,12 @@ local nuts = { addxymargins = direct.addxymargins, addyoffset = direct.addyoffset, append = direct.append, + appendaftertail = direct.appendaftertail, checkdiscretionaries = direct.checkdiscretionaries, collapsing = direct.collapsing, copy = direct.copy, - copynode = direct.copy, copylist = direct.copylist, + copynode = direct.copy, copyonly = direct.copyonly, count = direct.count, currentattributes = direct.currentattributes, @@ -63,16 +64,17 @@ local nuts = { effectiveglue = direct.effectiveglue, endofmath = direct.endofmath, exchange = direct.exchange, - flattenleaders = direct.flattenleaders, findattribute = direct.findattribute, findnode = direct.findnode, firstglyph = direct.firstglyph, flattendiscretionaries = direct.flattendiscretionaries, - softenhyphens = direct.softenhyphens, + flattenleaders = direct.flattenleaders, flush = d_flushnode, flushlist = direct.flushlist, flushnode = d_flushnode, free = direct.free, + freeze = direct.freeze, + getanchors = direct.getanchors, getattr = direct.getattribute, getattribute = direct.getattribute, getattributelist = direct.getattributelist, @@ -80,53 +82,65 @@ local nuts = { getattrlist = direct.getattributelist, getattrs = direct.getattributes, getboth = d_getboth, + getbottom = direct.getbottom, getbox = direct.getbox, getboxglue = direct.getglue, getchar = direct.getchar, + getchardict = direct.getchardict, getcharspec = direct.getcharspec, - -- getcomponents = direct.getcomponents, + getchoice = direct.getchoice, getdata = direct.getdata, + getdegree = direct.getdegree, + getdelimiter = direct.getdelimiter, + getmiddle = direct.getdelimiter, + getdenominator = direct.getdenominator, getdepth = direct.getdepth, getdir = direct.getdir, getdirection = direct.getdirection, getdisc = direct.getdisc, getdiscpart = direct.getdiscpart, getdiscretionary = direct.getdisc, - getchardict = direct.getchardict, getexpansion = direct.getexpansion, getfam = direct.getfam, getfield = direct.getfield, getfont = direct.getfont, + getgeometry = direct.getgeometry, getglue = direct.getglue, getglyphdata = direct.getglyphdata, getglyphdimensions = direct.getglyphdimensions, getheight = direct.getheight, getid = d_getid, getindex = direct.getindex, + getinputfields = direct.getinputfields, getkern = direct.getkern, getkerndimension = direct.getkerndimension, getlang = direct.getlanguage,-- will become obsolete getlanguage = direct.getlanguage, getleader = direct.getleader, + getleftdelimiter = direct.getleftdelimiter, getlist = d_getlist, + getmiddledelimiter = direct.getdelimiter, getnext = d_getnext, getnormalizedline = direct.getnormalizedline, getnucleus = direct.getnucleus, + getnumerator = direct.getnumerator, getoffsets = direct.getoffsets, getoptions = direct.getoptions, - getanchors = direct.getanchors, - getgeometry = direct.getgeometry, getorientation = direct.getorientation, + getparstate = direct.getparstate, getpenalty = direct.getpenalty, getpost = direct.getpost, getpre = direct.getpre, getprev = d_getprev, + getprime = direct.getprime, getreplace = direct.getreplace, + getrightdelimiter = direct.getrightdelimiter, getruledata = direct.getdata, -- obsolete when we have the split getscale = direct.getscale, getscales = direct.getscales, getscript = direct.getscript, getshift = direct.getshift, + getspeciallist = direct.getspeciallist, getstate = direct.getstate, getsub = direct.getsub, getsubpre = direct.getsubpre, @@ -134,14 +148,17 @@ local nuts = { getsup = direct.getsup, getsuppre = direct.getsuppre, getsurround = direct.getkern, - getinputfields = direct.getinputfields, + gettop = direct.gettop, gettotal = direct.gettotal, + getusedattributes = direct.getusedattributes, getvalue = direct.getdata, -- obsolete getwhd = direct.getwhd, getwidth = direct.getwidth, + getwordrange = direct.getwordrange, getxscale = direct.getxscale, getxyscales = direct.getxyscales, getyscale = direct.getyscale, + gluetostring = direct.gluetostring, hasattribute = direct.hasattribute, hasdimensions = direct.hasdimensions, hasfield = direct.hasfield, @@ -153,17 +170,13 @@ local nuts = { ignoremathskip = direct.ignoremathskip, insertafter = d_insertafter, insertbefore = d_insertbefore, - appendaftertail = direct.appendaftertail, - prependbeforehead = direct.prependbeforehead, - getparstate = direct.getparstate, - getwordrange = direct.getwordrange, - isdirect = isdirect, - isnode = isnode, - isnut = isdirect, ischar = direct.ischar, + isdirect = isdirect, isglyph = direct.isglyph, isnextchar = direct.isnextchar, isnextglyph = direct.isnextglyph, + isnode = isnode, + isnut = isdirect, isprevchar = direct.isprevchar, isprevglyph = direct.isprevglyph, iszeroglue = direct.iszeroglue, @@ -178,64 +191,76 @@ local nuts = { naturalwidth = direct.naturalwidth, new = direct.new, newmathglyph = direct.newmathglyph, + patchattributes = direct.patchattributes, + prependbeforehead = direct.prependbeforehead, protectglyph = direct.protectglyph, protectglyphs = direct.protectglyphs, protrusionskippable = direct.protrusionskippable, rangedimensions = direct.rangedimensions, remove = d_remove_node, repack = direct.repack, - freeze = direct.freeze, reverse = direct.reverse, + serialized = direct.serialized, + setanchors = direct.setanchors, setattr = direct.setattribute, setattribute = direct.setattribute, - setattributes = direct.setattributes, - patchattributes = direct.patchattributes, setattributelist = direct.setattributelist, + setattributes = direct.setattributes, setattrlist = direct.setattributelist, setattrs = direct.setattributes, setboth = direct.setboth, + setbottom = direct.setbottom, setbox = direct.setbox, setboxglue = direct.setglue, setchar = direct.setchar, - -- setcomponents = direct.setcomponents, + setchardict = direct.setchardict, + setchoice = direct.setchoice, setdata = direct.setdata, + setdegree = direct.setdegree, + setdelimiter = direct.setdelimiter, + setdenominator = direct.setdenominator, setdepth = direct.setdepth, setdir = direct.setdir, setdirection = direct.setdirection, setdisc = direct.setdisc, setdiscpart = direct.setdiscpart, setdiscretionary = direct.setdisc, - setchardict = direct.setchardict, setexpansion = direct.setexpansion, setfam = direct.setfam, setfield = direct.setfield, setfont = direct.setfont, + setgeometry = direct.setgeometry, setglue = direct.setglue, setglyphdata = direct.setglyphdata, setheight = direct.setheight, + setinputfields = direct.setinputfields, setkern = direct.setkern, setlang = direct.setlanguage, setlanguage = direct.setlanguage, setleader = direct.setleader, + setleftdelimiter = direct.setleftdelimiter, setlink = d_setlink, setlist = direct.setlist, + setmiddledelimiter = direct.setdelimiter, setnext = direct.setnext, setnucleus = direct.setnucleus, + setnumerator = direct.setnumerator, setoffsets = direct.setoffsets, setoptions = direct.setoptions, - setanchors = direct.setanchors, - setgeometry = direct.setgeometry, setorientation = direct.setorientation, setpenalty = direct.setpenalty, setpost = direct.setpost, setpre = direct.setpre, setprev = direct.setprev, + setprime = direct.setprime, setreplace = direct.setreplace, + setrightdelimiter = direct.setrightdelimiter, setruledata = direct.setdata, -- obsolete when we have the split setscale = direct.setscale or direct.setscales, setscales = direct.setscales, setscript = direct.setscript, setshift = direct.setshift, + setspeciallist = direct.setspeciallist, setsplit = direct.setsplit, setstate = direct.setstate, setsub = direct.setsub, @@ -244,13 +269,13 @@ local nuts = { setsup = direct.setsup, setsuppre = direct.setsuppre, setsurround = direct.setkern, - setinputfields = direct.setinputfields, setvalue = direct.setdata, -- obsolete + settop = direct.settop, setwhd = direct.setwhd, setwidth = direct.setwidth, show = direct.show, - serialized = direct.serialized, slide = d_slide, + softenhyphens = direct.softenhyphens, startofpar = direct.startofpar, tail = d_find_tail, takeattr = direct.unsetattribute, -- ? @@ -262,8 +287,8 @@ local nuts = { traversecontent = direct.traversecontent, traverseglyph = direct.traverseglyph, traverseid = direct.traverseid, - traverselist = direct.traverselist, traverseleader = direct.traverseleader, + traverselist = direct.traverselist, unprotectglyph = direct.unprotectglyph, unprotectglyphs = direct.unprotectglyphs, unsetattribute = direct.unsetattribute, @@ -275,11 +300,6 @@ local nuts = { write = direct.write, xscaled = direct.xscaled, yscaled = direct.yscaled, - -- getxyoffsets = direct.getxyoffsets, - getspeciallist = direct.getspeciallist, - setspeciallist = direct.setspeciallist, - getusedattributes = direct.getusedattributes, - gluetostring = direct.gluetostring, } nodes.nuts = nuts diff --git a/tex/context/base/mkxl/node-ser.lmt b/tex/context/base/mkxl/node-ser.lmt index 089009260..e45d7f249 100644 --- a/tex/context/base/mkxl/node-ser.lmt +++ b/tex/context/base/mkxl/node-ser.lmt @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['node-ser'] = { license = "see context related readme files" } +-- needs to be updated (mayeb fetch field types) + local type, tostring = type, tostring local concat, tohash, sortedkeys, sortedhash, printtable, serialize = table.concat, table.tohash, table.sortedkeys, table.sortedhash, table.print, table.serialize local formatters, format, rep = string.formatters, string.format, string.rep @@ -64,6 +66,8 @@ end) nodes.fieldtypes = fieldtypes +-- todo: subtype zero too + local function astable(n) n = tonode(n) if n then @@ -75,7 +79,9 @@ local function astable(n) for field, fieldtype in sortedhash(fields) do -- no need to sort local value = n[field] if value then - if canbeignored[field] then + if field == "subtype" then + -- we always show them now + elseif canbeignored[field] then value = nil elseif canbezero[fieldtype] and value == 0 then value = nil diff --git a/tex/context/base/mkxl/phys-dim.mkxl b/tex/context/base/mkxl/phys-dim.mkxl index 44aff6411..90475f5b8 100644 --- a/tex/context/base/mkxl/phys-dim.mkxl +++ b/tex/context/base/mkxl/phys-dim.mkxl @@ -401,9 +401,20 @@ \permanent\protected\def\installunitsspace#1#2% {\defcsname\??unitspace#1\endcsname{#2}} +% \protected\def\phys_units_space +% {\unskip % weird, why is unskip needed +% \ifcsname\??unitspace\unitparameter\c!space\endcsname\lastnamedcs\else\unitsmediumspace\fi} + +% \im{1 \unit{hour} 20 \unit{minute} 56 \unit{second}} +% \im{\unit{1 hour} \unit{20 minute} 56 \unit{second}} + \protected\def\phys_units_space - {\unskip % weird, why is unskip needed - \ifcsname\??unitspace\unitparameter\c!space\endcsname\lastnamedcs\else\unitsmediumspace\fi} + {\ifmmode + % let the atoms do the work + \else + \unskip % weird, why is unskip needed + \ifcsname\??unitspace\unitparameter\c!space\endcsname\lastnamedcs\else\unitsmediumspace\fi + \fi} \installunitsspace\v!normal{\unitsmediumspace} \installunitsspace\v!big {\unitsbigspace} @@ -608,7 +619,7 @@ \dostarttagged\t!maction\t!unit \mathatom \s!leftclass \mathdimensioncode - \s!rightclass \mathordinarycode + \s!rightclass \mathdimensioncode \bgroup \else \dostarttagged\t!unit\empty diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl index ed581db6a..a8d674723 100644 --- a/tex/context/base/mkxl/strc-mat.mkxl +++ b/tex/context/base/mkxl/strc-mat.mkxl @@ -1455,14 +1455,14 @@ % we can't end up here \orelse\ifconditional\c_strc_math_aligned_here \ifzeropt\d_strc_math_indent\else -\ifnum\c_page_sides_hangafter=\zerocount - \hangafter\plusone - \hangindent\d_strc_math_indent -\else +% \ifnum\c_page_sides_hangafter=\zerocount +% \hangafter\plusone +% \hangindent\d_strc_math_indent +% \else % this might become the default anyway: \advance\leftskip\d_strc_math_indent \hskip-\d_strc_math_indent -\fi +% \fi \fi % \strc_math_setup_align % _inner \else diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index ce2f50942..0c5251373 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -765,16 +765,17 @@ % For now: -\permanent\protected\def\defUmathfixedtopaccent#1#2#3#4{\global\immutable\protected\def#1{\Umathtopaccent \s!fixed "#2 "#3 "#4 }} -\permanent\protected\def\defUmathfixedbotaccent#1#2#3#4{\global\immutable\protected\def#1{\Umathbotaccent \s!fixed "#2 "#3 "#4 }} -\permanent\protected\def\defUmathtopaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathtopaccent "#2 "#3 "#4 }} -\permanent\protected\def\defUmathbotaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathbotaccent "#2 "#3 "#4 }} -\permanent\protected\def\defUdelimiterover #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterover "#2 "#3 }} -\permanent\protected\def\defUdelimiterunder #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterunder "#2 "#3 }} -\permanent\protected\def\defUdelimiter #1#2#3#4{\global\immutable\protected\def#1{\Udelimiter "#2 "#3 "#4 }} -\permanent\protected\def\defUradical #1#2#3{\global\immutable\protected\def#1{\Uradical "#2 "#3 }} -\permanent\protected\def\defUroot #1#2#3{\global\immutable\protected\def#1{\Uroot "#2 "#3 }} -\permanent\protected\def\defUmathchar #1#2#3#4{\global\immutable\Umathchardef #1 "#2 "#3 "#4 } +\permanent\protected\def\defUmathfixedtopaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathtopaccent \s!fixed "#2 "#3 "#4 }} +\permanent\protected\def\defUmathfixedbottomaccent#1#2#3#4{\global\immutable\protected\def#1{\Umathbottomaccent \s!fixed "#2 "#3 "#4 }} +\permanent\protected\def\defUmathtopaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathtopaccent "#2 "#3 "#4 }} +\permanent\protected\def\defUmathbottomaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathbottomaccent "#2 "#3 "#4 }} +\permanent\protected\def\defUdelimiterover #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterover "#2 "#3 }} +\permanent\protected\def\defUdelimiterunder #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterunder "#2 "#3 }} +%permanent\protected\def\defUdelimiter #1#2#3#4{\global\immutable\protected\def#1{\Udelimiter "#2 "#3 "#4 }} +\permanent\protected\def\defUdelimiter #1#2#3#4{\global\immutable\Umathchardef #1 "#2 "#3 "#4 } +\permanent\protected\def\defUradical #1#2#3{\global\immutable\protected\def#1{\Uradical "#2 "#3 }} +\permanent\protected\def\defUroot #1#2#3{\global\immutable\protected\def#1{\Uroot "#2 "#3 }} +\permanent\protected\def\defUmathchar #1#2#3#4{\global\immutable\Umathchardef #1 "#2 "#3 "#4 } %D For a while we keep the following, as systems like tikz need it. Best not use %D that one \CONTEXT. It will probably move to the tikz loader. diff --git a/tex/context/base/mkxl/tabl-ntb.mkxl b/tex/context/base/mkxl/tabl-ntb.mkxl index 33e68a4cb..d36d113e1 100644 --- a/tex/context/base/mkxl/tabl-ntb.mkxl +++ b/tex/context/base/mkxl/tabl-ntb.mkxl @@ -321,6 +321,9 @@ \installcorenamespace{naturaltablesqueeze} \installcorenamespace{naturaltabletok} +% \integerdefcsname +% \dimensiondefcsname + \letcsname\??naturaltablesqueeze \endcsname\donefalse \letcsname\??naturaltablesqueeze\v!fit \endcsname\donetrue \letcsname\??naturaltablesqueeze\v!fixed\endcsname\donetrue @@ -336,20 +339,25 @@ \def\tabl_ntb_set_nob#1{\letcsname\??naturaltablenob\m_tabl_tbl_level:\number#1\endcsname\plusone} \def\tabl_ntb_get_nob#1{\ifcsname\??naturaltablenob\m_tabl_tbl_level:\number#1\endcsname\plusone\else\zerocount\fi} -%def\tabl_ntb_set_tag#1#2{\edefcsname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname} -\def\tabl_ntb_set_col#1#2{\edefcsname\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2\endcsname} -\def\tabl_ntb_set_row#1#2{\edefcsname\??naturaltablerow\m_tabl_tbl_level:\number#1:\number#2\endcsname} +%def\tabl_ntb_set_tag#1#2{\expandafter\integerdef\csname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname} +\def\tabl_ntb_set_col#1#2{\expandafter\integerdef\csname\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2\endcsname} +\def\tabl_ntb_set_row#1#2{\expandafter\integerdef\csname\??naturaltablerow\m_tabl_tbl_level:\number#1:\number#2\endcsname} \def\tabl_ntb_let_tag#1#2{\letcsname\??naturaltabletag\m_tabl_tbl_level:\number#1:\number#2\endcsname} \def\tabl_ntb_let_col#1#2{\letcsname\??naturaltablecol\m_tabl_tbl_level:\number#1:\number#2\endcsname} \def\tabl_ntb_let_row#1#2{\letcsname\??naturaltablerow\m_tabl_tbl_level:\number#1:\number#2\endcsname} -%def\tabl_ntb_set_wd#1#2{\xdefcsname\??naturaltablewd\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global ! -\def\tabl_ntb_set_ht#1#2{\xdefcsname\??naturaltableht\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global ! +% \let\tabl_ntb_let_col\tabl_ntb_set_col +% \let\tabl_ntb_let_row\tabl_ntb_set_row + +%def\tabl_ntb_set_wd#1#2{\global\expandafter\dimensiondef\csname\??naturaltablewd\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global ! +\def\tabl_ntb_set_ht#1#2{\global\expandafter\dimensiondef\csname\??naturaltableht\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global ! %def\tabl_ntb_let_wd#1#2{\letcsname\??naturaltablewd\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global ! \def\tabl_ntb_let_ht#1#2{\letcsname\??naturaltableht\m_tabl_tbl_level:\number#1:\number#2\endcsname} % global ! +% \let\tabl_ntb_let_ht\tabl_ntb_set_ht + \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} @@ -357,24 +365,27 @@ %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{\xdefcsname\??naturaltablewid\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! -\def\tabl_ntb_set_hei#1{\xdefcsname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! -\def\tabl_ntb_set_dis#1{\xdefcsname\??naturaltabledis\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! -\def\tabl_ntb_set_aut#1{\xdefcsname\??naturaltableaut\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! +\def\tabl_ntb_set_wid#1{\global\expandafter\dimensiondef\csname\??naturaltablewid\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! +\def\tabl_ntb_set_hei#1{\global\expandafter\dimensiondef\csname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! +\def\tabl_ntb_set_dis#1{\global\expandafter\dimensiondef\csname\??naturaltabledis\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! +\def\tabl_ntb_set_aut#1{\global\expandafter\dimensiondef\csname\??naturaltableaut\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! \def\tabl_ntb_let_wid#1{\gletcsname\??naturaltablewid\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! \def\tabl_ntb_let_hei#1{\gletcsname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! \def\tabl_ntb_let_dis#1{\gletcsname\??naturaltabledis\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! \def\tabl_ntb_let_aut#1{\gletcsname\??naturaltableaut\m_tabl_tbl_level:\number#1\endcsname} % {#2} global ! +% \let\tabl_ntb_let_wid\tabl_ntb_set_wid +% \let\tabl_ntb_let_hei\tabl_ntb_set_hei +% \let\tabl_ntb_let_dis\tabl_ntb_set_dis +% \let\tabl_ntb_let_aut\tabl_ntb_set_aut + \def\tabl_ntb_get_wid#1{\ifcsname\??naturaltablewid\m_tabl_tbl_level:\number#1\endcsname\lastnamedcs\else\zeropoint\fi} \def\tabl_ntb_get_hei#1{\ifcsname\??naturaltablehei\m_tabl_tbl_level:\number#1\endcsname\lastnamedcs\else\zeropoint\fi} \def\tabl_ntb_get_dis#1{\ifcsname\??naturaltabledis\m_tabl_tbl_level:\number#1\endcsname\lastnamedcs\else\zeropoint\fi} \def\tabl_ntb_get_aut#1{\csname \??naturaltableaut\m_tabl_tbl_level:\number#1\endcsname} -% \i ntegerdef - -\def\tabl_ntb_let_bck#1#2{\global\expandafter\chardef\csname\??naturaltablebck\m_tabl_tbl_level:\number#1:\number#2\endcsname} +\def\tabl_ntb_let_bck#1#2{\global\expandafter\integerdef\csname\??naturaltablebck\m_tabl_tbl_level:\number#1:\number#2\endcsname} \def\tabl_ntb_get_bck#1#2{\csname\??naturaltablebck\m_tabl_tbl_level:\number#1:\number#2\endcsname} @@ -408,11 +419,18 @@ %def\tabl_ntb_get_ref #1#2{\ifcsname\??naturaltableref\m_tabl_tbl_level:\number#1:\number#2\endcsname\csname\??naturaltableref\m_tabl_tbl_level:\number#1:\number#2\endcsname\fi} \def\tabl_ntb_get_ref #1#2{\begincsname\??naturaltableref\m_tabl_tbl_level:\number#1:\number#2\endcsname} -\def\tabl_ntb_set_spn #1{\letcsname\??naturaltablespn\m_tabl_tbl_level:\number#1\endcsname \!!plusone} -\def\tabl_ntb_spn_doifelse#1{\ifcase0\csname\??naturaltablespn\m_tabl_tbl_level:\number#1\endcsname\relax % could be inlined - \expandafter\secondoftwoarguments % unset - \else +% \def\tabl_ntb_set_spn #1{\letcsname\??naturaltablespn\m_tabl_tbl_level:\number#1\endcsname \!!plusone} +% \def\tabl_ntb_spn_doifelse#1{\ifcase0\csname\??naturaltablespn\m_tabl_tbl_level:\number#1\endcsname\relax % could be inlined +% \expandafter\secondoftwoarguments % unset +% \else +% \expandafter\firstoftwoarguments % a span +% \fi} + +\def\tabl_ntb_set_spn #1{\letcsname\??naturaltablespn\m_tabl_tbl_level:\number#1\endcsname\plusone} +\def\tabl_ntb_spn_doifelse#1{\ifcsname\??naturaltablespn\m_tabl_tbl_level:\number#1\endcsname \expandafter\firstoftwoarguments % a span + \else + \expandafter\secondoftwoarguments % unset \fi} \protected\def\tabl_ntb_set_txt_process#1#2#3#4#5#6% @@ -508,15 +526,25 @@ \letcsname\??naturaltablesetupthree\s!unknown\endcsname\tabl_ntb_setup_un \letcsname\??naturaltablesetuptwo \s!unknown\endcsname\tabl_ntb_setup_ux -\letcsnamecsname\csname\??naturaltablesetupthree r\endcsname\csname\??naturaltablesetupthree \v!row\endcsname -\letcsnamecsname\csname\??naturaltablesetupthree c\endcsname\csname\??naturaltablesetupthree\v!column\endcsname -\letcsnamecsname\csname\??naturaltablesetupthree y\endcsname\csname\??naturaltablesetupthree \v!row\endcsname -\letcsnamecsname\csname\??naturaltablesetupthree x\endcsname\csname\??naturaltablesetupthree\v!column\endcsname +% \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 + +\letcsname\??naturaltablesetupthree r\expandafter\endcsname\csname\??naturaltablesetupthree \v!row\endcsname +\letcsname\??naturaltablesetupthree c\expandafter\endcsname\csname\??naturaltablesetupthree\v!column\endcsname +\letcsname\??naturaltablesetupthree y\expandafter\endcsname\csname\??naturaltablesetupthree \v!row\endcsname +\letcsname\??naturaltablesetupthree x\expandafter\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 +\letcsname\??naturaltablesetuptwo r\expandafter\endcsname\csname\??naturaltablesetuptwo \v!row\endcsname +\letcsname\??naturaltablesetuptwo c\expandafter\endcsname\csname\??naturaltablesetuptwo \v!column\endcsname +\letcsname\??naturaltablesetuptwo y\expandafter\endcsname\csname\??naturaltablesetuptwo \v!row\endcsname +\letcsname\??naturaltablesetuptwo x\expandafter\endcsname\csname\??naturaltablesetuptwo \v!column\endcsname \def\tabl_ntb_parameters_set[#1][#2]% {\ifappendTBLsetups @@ -598,10 +626,12 @@ {\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_ntb_maximum_row+#1+\minusone\relax}% - \edef\m_tabl_ntb_negative_col{\the\numexpr-\c_tabl_ntb_maximum_col+#2+\minusone\relax}% +% \edef\m_tabl_ntb_negative_row{\the\numexpr-\c_tabl_ntb_maximum_row+#1+\minusone\relax}% +% \edef\m_tabl_ntb_negative_col{\the\numexpr-\c_tabl_ntb_maximum_col+#2+\minusone\relax}% + \edef\m_tabl_ntb_negative_row{\number\numexpr-\c_tabl_ntb_maximum_row+#1+\minusone}% + \edef\m_tabl_ntb_negative_col{\number\numexpr-\c_tabl_ntb_maximum_col+#2+\minusone}% % saves tokens (no speed gain) - \edef\m_tabl_ntb_prefix{\??naturaltableset\m_tabl_tbl_level:}% + \edef\m_tabl_ntb_prefix{\??naturaltableset\m_tabl_tbl_level:}% can move to \tabl_ntb_next_level etc % each each \begincsname\m_tabl_ntb_prefix\c!x\v!each\c!y\v!each\endcsname \begincsname\m_tabl_ntb_prefix\c!y\v!each\endcsname @@ -754,10 +784,10 @@ \else \tabl_ntb_td_pass_m{#1}% \fi - \doloop % skip over columns that result from earlier span + \localcontrolledloop\plusone\maxcard\plusone % skip over columns that result from earlier span {\advance\c_tabl_ntb_running_col\plusone \ifcsname\tabl_ntb_tag_pattern\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col\endcsname \else - \exitloop + \quitloop \fi}% % fill r*c cells and set span \c_tabl_ntb_nx\naturaltableparameter\c!nx\relax @@ -775,8 +805,8 @@ \fi % set values \tabl_ntb_let_tag\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col\c_tabl_ntb_cell - \tabl_ntb_set_col\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col{\the\c_tabl_ntb_nx}% - \tabl_ntb_set_row\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col{\the\c_tabl_ntb_ny}% + \tabl_ntb_set_col\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col\c_tabl_ntb_nx + \tabl_ntb_set_row\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col\c_tabl_ntb_ny % the action key will change! \tabl_ntb_set_ref\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col{\naturaltableparameter\c!action}% % save text @@ -789,10 +819,10 @@ \def\tabl_ntb_td_nop[#1]#2\eTD {\global\advance\c_tabl_ntb_spn\plusone\relax - \doloop + \localcontrolledloop\plusone\maxcard\plusone {\advance\c_tabl_ntb_running_col\plusone \ifcsname\tabl_ntb_tag_pattern\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col\endcsname \else - \exitloop + \quitloop \fi}% \c_tabl_ntb_nx\plusone \c_tabl_ntb_ny\plusone @@ -800,8 +830,8 @@ \c_tabl_ntb_maximum_col\c_tabl_ntb_running_col \fi \tabl_ntb_let_tag\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col\c_tabl_ntb_cell - \tabl_ntb_set_col\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col{\the\c_tabl_ntb_nx}% - \tabl_ntb_set_row\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col{\the\c_tabl_ntb_ny}% + \tabl_ntb_set_col\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col\c_tabl_ntb_nx + \tabl_ntb_set_row\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col\c_tabl_ntb_ny \tabl_ntb_let_ref\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col\empty \normalexpanded {\tabl_ntb_set_txt_process\c_tabl_ntb_maximum_row\c_tabl_ntb_running_col{\the\c_tabl_ntb_maximum_row}{\the\c_tabl_ntb_running_col}}% @@ -825,7 +855,7 @@ \def\tabl_ntb_td_pass_m#1% {\scratchcounter\numexpr\m_tabl_ntb_m-\c_tabl_ntb_running_col+\minusone-\c_tabl_ntb_spn\relax - \dorecurse\scratchcounter{\normalexpanded{\tabl_ntb_td[\c!n=,\c!m=]}\eTD}% + \localcontrolledloop\plusone\scratchcounter\plusone{\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 @@ -838,7 +868,7 @@ \def\tabl_ntb_cell_preset {\c_tabl_ntb_current_row\c_tabl_ntb_maximum_row \c_tabl_ntb_current_col\c_tabl_ntb_running_col - \dorecurse\c_tabl_ntb_ny\tabl_ntb_cell_preset_rows + \localcontrolledloop\plusone\c_tabl_ntb_ny\plusone{\tabl_ntb_cell_preset_rows}% % check max column \advance\c_tabl_ntb_current_col\minusone \ifnum\c_tabl_ntb_current_col>\c_tabl_ntb_maximum_col\relax @@ -847,11 +877,11 @@ \def\tabl_ntb_cell_preset_rows {\c_tabl_ntb_current_col\c_tabl_ntb_running_col - \tabl_ntb_set_col\c_tabl_ntb_current_row\c_tabl_ntb_current_col{\the\c_tabl_ntb_nx}% + \tabl_ntb_set_col\c_tabl_ntb_current_row\c_tabl_ntb_current_col\c_tabl_ntb_nx \ifnum\c_tabl_ntb_nx>\c_tabl_ntb_maximum_row_span\relax \c_tabl_ntb_maximum_row_span\c_tabl_ntb_nx \fi - \dorecurse\c_tabl_ntb_nx\tabl_ntb_cell_preset_cells + \localcontrolledloop\plusone\c_tabl_ntb_nx\plusone{\tabl_ntb_cell_preset_cells}% \advance\c_tabl_ntb_current_row\plusone} \def\tabl_ntb_cell_preset_cells @@ -1057,7 +1087,7 @@ {% tricky and dirty order -) \setfalse\c_tabl_ntb_okay % head - \doifelsesometoks\t_tabl_ntb_head % slow, better a flag + \doifelsesometoks\t_tabl_ntb_head % slow, better a flag \iftok {\c_tabl_ntb_head\numexpr\c_tabl_ntb_maximum_row+\plusone\relax \the\t_tabl_ntb_head \c_tabl_ntb_n_of_head_lines\c_tabl_ntb_maximum_row\relax @@ -1088,11 +1118,11 @@ \ifcase\c_tabl_ntb_maximum_col\else \startTBLprocessing \tabl_ntb_table_start - \dorecurse\c_tabl_ntb_maximum_row + \localcontrolledloop\plusone\c_tabl_ntb_maximum_row\plusone {\tabl_ntb_row_start - \c_tabl_ntb_current_row\recurselevel\relax - \dorecurse\c_tabl_ntb_maximum_col - {\c_tabl_ntb_current_col\recurselevel\relax + \c_tabl_ntb_current_row\currentloopiterator\relax + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone + {\c_tabl_ntb_current_col\currentloopiterator\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 @@ -1106,10 +1136,10 @@ % tracing % \iftrue % \blank \tttf - % \dorecurse\c_tabl_ntb_maximum_row - % {\c_tabl_ntb_current_row\recurselevel\relax - % \dorecurse\c_tabl_ntb_maximum_col - % {\c_tabl_ntb_current_col\recurselevel\relax + % \localcontrolledloop\plusone\c_tabl_ntb_maximum_row\plusone + % {\c_tabl_ntb_current_row\currentloopiterator\relax + % \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone + % {\c_tabl_ntb_current_col\currentloopiterator\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 @@ -1119,14 +1149,14 @@ \tabl_ntb_table_pop} \def\tabl_ntb_loop_one - {\dorecurse\c_tabl_ntb_maximum_row{\tabl_ntb_loop_one_rows}} + {\localcontrolledloop\plusone\c_tabl_ntb_maximum_row\plusone{\tabl_ntb_loop_one_rows}} \def\tabl_ntb_loop_one_rows - {\c_tabl_ntb_current_row\recurselevel\relax - \dorecurse\c_tabl_ntb_maximum_col\tabl_ntb_loop_one_cells} + {\c_tabl_ntb_current_row\currentloopiterator\relax + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone{\tabl_ntb_loop_one_cells}} \def\tabl_ntb_loop_one_cells - {\c_tabl_ntb_current_col\recurselevel\relax + {\c_tabl_ntb_current_col\currentloopiterator\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} @@ -1135,25 +1165,25 @@ {\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 + \localcontrolledloop\plusone\maxcard\plusone {\c_tabl_ntb_current_col_one\c_tabl_ntb_current_col - \doloop + \localcontrolledloop\plusone\maxcard\plusone {\ifcsname\tabl_ntb_tag_pattern\c_tabl_ntb_current_row_one\c_tabl_ntb_current_col_one\endcsname - \exitloop + \quitloop \else \advance\c_tabl_ntb_current_col_one\plusone \ifnum\c_tabl_ntb_current_col_one>\c_tabl_ntb_maximum_col\relax - \exitloop + \quitloop \fi \fi}% \ifcsname\tabl_ntb_tag_pattern\c_tabl_ntb_current_row_one\c_tabl_ntb_current_col_one\endcsname - \exitloop + \quitloop \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_ntb_maximum_row - \exitloop + \quitloop \fi \fi}% \ifnum\c_tabl_ntb_current_row_two>\c_tabl_ntb_maximum_row\c_tabl_ntb_current_row_two\c_tabl_ntb_maximum_row\fi @@ -1161,16 +1191,16 @@ \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 + \localcontrolledloop\plusone\c_tabl_ntb_current_row_two\plusone {\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_set_col\c_tabl_ntb_current_row_one\c_tabl_ntb_current_col_one\c_tabl_ntb_current_col_two + \localcontrolledloop\plusone\c_tabl_ntb_current_col_two\plusone {\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}% + \tabl_ntb_set_col\c_tabl_ntb_current_row\c_tabl_ntb_current_col\c_tabl_ntb_current_col_two + \tabl_ntb_set_row\c_tabl_ntb_current_row\c_tabl_ntb_current_col\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}}% @@ -1178,14 +1208,14 @@ \fi} \def\tabl_ntb_loop_two - {\dorecurse\c_tabl_ntb_maximum_row\tabl_ntb_loop_two_rows} + {\localcontrolledloop\plusone\c_tabl_ntb_maximum_row\plusone{\tabl_ntb_loop_two_rows}} \def\tabl_ntb_loop_two_rows - {\c_tabl_ntb_current_row\recurselevel\relax - \dorecurse\c_tabl_ntb_maximum_col\tabl_ntb_loop_two_cells} + {\c_tabl_ntb_current_row\currentloopiterator\relax + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone{\tabl_ntb_loop_two_cells}} \def\tabl_ntb_loop_two_cells - {\c_tabl_ntb_current_col\recurselevel\relax + {\c_tabl_ntb_current_col\currentloopiterator\relax \ifcsname\tabl_ntb_row_pattern\c_tabl_ntb_current_row\c_tabl_ntb_current_col\endcsname \scratchcounter\numexpr\c_tabl_ntb_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 @@ -1270,8 +1300,8 @@ % \prelocateTBLrows{1000} % may speed up large tables \permanent\protected\def\prelocateTBLrows#1% we start at zero so we have one to much, better play safe anyway - {\dostepwiserecurse\c_tabl_prelocated_rows{#1}\plusone - {\expandafter\newtoks\csname\??naturaltabletok\recurselevel\endcsname}% + {\localcontrolledloop\c_tabl_prelocated_rows#1\plusone + {\expandafter\newtoks\csname\??naturaltabletok\the\currentloopiterator\endcsname}% \def\tabl_ntb_row_start {\ifnum\c_tabl_ntb_row<\c_tabl_prelocated_rows\relax \tabl_ntb_prelocate_okay @@ -1428,7 +1458,7 @@ \protected\def\tabl_ntb_span#1% {\hskip\tabl_ntb_get_dis\c_tabl_ntb_col - \dorecurse{#1} + \localcontrolledloop\plusone#1\plusone {\hskip\tabl_ntb_get_wid\c_tabl_ntb_col\relax \global\advance\c_tabl_ntb_col\plusone}} @@ -1476,15 +1506,15 @@ \scratchcounter\c_tabl_ntb_col \scratchcounterone\tabl_ntb_get_col{#1}{#2}\relax \ifcase\scratchcounterone\or - \advance\d_tabl_ntb_width\dimexpr + \advance\d_tabl_ntb_width\dimexpr % no need for dimexpr \tabl_ntb_get_wid\scratchcounter \relax \advance\scratchcounter\plusone \else - \dorecurse\scratchcounterone + \localcontrolledloop\plusone\scratchcounterone\plusone {\advance\d_tabl_ntb_width\dimexpr \tabl_ntb_get_wid\scratchcounter - \ifnum\recurselevel<\scratchcounterone + \ifnum\currentloopiterator<\scratchcounterone +\d_tabl_ntb_columndistance +\tabl_ntb_get_dis\scratchcounter \fi @@ -1492,11 +1522,11 @@ \advance\scratchcounter\plusone}% \fi \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}% + \tabl_ntb_set_ht{#1}{#2}\ht\scratchbox + %tabl_ntb_set_wd{#1}{#2}\wd\scratchbox \ifdim\ht\scratchbox>\tabl_ntb_get_hei{#1}\relax - \tabl_ntb_set_hei{#1}{\the\ht\scratchbox}% - \fi}% + \tabl_ntb_set_hei{#1}\ht\scratchbox + \fi} \def\tabl_ntb_pass_three#1 #2 % {% height @@ -1511,7 +1541,7 @@ % case: nc=maxcolumns \else \scratchcounter#1\relax - \dorecurse\scratchcountertwo + \localcontrolledloop\plusone\scratchcountertwo\plusone {\advance\d_tabl_ntb_height\tabl_ntb_get_hei\scratchcounter \advance\scratchcounter\plusone}% \ifdim\d_tabl_ntb_height<\scratchheight\relax @@ -1527,10 +1557,10 @@ \relax \advance\scratchcounter\plusone \else - \dorecurse\scratchcounterone + \localcontrolledloop\plusone\scratchcounterone\plusone {\advance\d_tabl_ntb_width\dimexpr \tabl_ntb_get_wid\scratchcounter - \ifnum\recurselevel<\scratchcounterone + \ifnum\currentloopiterator<\scratchcounterone +\d_tabl_ntb_columndistance +\tabl_ntb_get_dis\scratchcounter \fi @@ -1573,7 +1603,7 @@ \def\tabl_ntb_cell_finalize_indeed {\scratchdimen\tabl_ntb_get_aut\c_tabl_ntb_col\relax \ifdim\localwidth>\scratchdimen - \tabl_ntb_set_aut\c_tabl_ntb_col{\the\dimexpr\localwidth}% + \tabl_ntb_set_aut\c_tabl_ntb_col\localwidth\relax \fi} \let\tabl_ntb_preroll\relax @@ -1606,19 +1636,19 @@ % \letnaturaltablelocalparameter\c!align\v!no % \inheritednaturaltablelocalframed{\strut}}% %\edef\minimalcellheight{\the\ht\scratchbox}% not used - \dorecurse\c_tabl_ntb_maximum_col - {\tabl_ntb_let_aut\recurselevel\zeropoint + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone + {\tabl_ntb_let_aut\currentloopiterator\zeropoint % new - \c_tabl_ntb_current_col_one\recurselevel\relax - \dorecurse\c_tabl_ntb_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}% + \c_tabl_ntb_current_col_one\currentloopiterator\relax + \localcontrolledloop\plusone\c_tabl_ntb_maximum_row\plusone + {%tabl_ntb_let_wd\currentloopiterator\c_tabl_ntb_current_col_one\zeropoint + \tabl_ntb_let_ht\currentloopiterator\c_tabl_ntb_current_col_one\zeropoint}% % till here - \tabl_ntb_let_tal\recurselevel\zerocount - \tabl_ntb_let_wid\recurselevel\zeropoint - \tabl_ntb_let_dis\recurselevel\zeropoint}% - \dorecurse\c_tabl_ntb_maximum_row - {\tabl_ntb_let_hei\recurselevel\maxdimen}% + \tabl_ntb_let_tal\currentloopiterator\zerocount + \tabl_ntb_let_wid\currentloopiterator\zeropoint + \tabl_ntb_let_dis\currentloopiterator\zeropoint}% + \localcontrolledloop\plusone\c_tabl_ntb_maximum_row\plusone + {\tabl_ntb_let_hei\currentloopiterator\maxdimen}% \tabl_ntb_let_gal\zerocount \tabl_ntb_preroll\relax \c_tabl_tbl_pass\plusone @@ -1693,12 +1723,12 @@ -\d_tabl_ntb_rightmargindistance +\d_tabl_ntb_columndistance \relax - \dorecurse\c_tabl_ntb_maximum_col + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone {\advance\scratchdimenfour\dimexpr - \tabl_ntb_get_wid\recurselevel + \tabl_ntb_get_wid\currentloopiterator \relax \advance\scratchdimenfive\dimexpr - -\tabl_ntb_get_dis\recurselevel + -\tabl_ntb_get_dis\currentloopiterator -\d_tabl_ntb_columndistance \relax}% \relax @@ -1706,8 +1736,9 @@ \ifdim\scratchdimenfour<\scratchdimenfive \advance\scratchdimenfour-\scratchdimenfive \divide\scratchdimenfour\c_tabl_ntb_maximum_col - \dorecurse\c_tabl_ntb_maximum_col - {\tabl_ntb_set_wid\recurselevel{\the\dimexpr\tabl_ntb_get_wid\recurselevel-\scratchdimenfour\relax}}% + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone + {\scratchdimen\dimexpr\tabl_ntb_get_wid\currentloopiterator-\scratchdimenfour\relax + \tabl_ntb_set_wid\currentloopiterator\scratchdimen}% \fi \fi} @@ -1767,10 +1798,10 @@ \t_split_before{\m_tabl_ntb_before_split}% not used (yet) \setbox\b_split_content\vbox{\tabl_ntb_flush_content}% \ifmultipleTBLheads - \dorecurse\c_tabl_ntb_n_of_head_lines + \localcontrolledloop\plusone\c_tabl_ntb_n_of_head_lines\plusone {\setbox\scratchbox\vsplit\b_split_content to \lineheight \setbox\b_split_head\vbox{\unvcopy\b_split_head\unvcopy\scratchbox}}% \vpack ? - \dorecurse\c_tabl_ntb_n_of_next_lines + \localcontrolledloop\plusone\c_tabl_ntb_n_of_next_lines\plusone {\setbox\scratchbox\vsplit\b_split_content to \lineheight \setbox\b_split_next\vbox{\unvcopy\b_split_next\unvcopy\scratchbox}}% \vpack ? \fi @@ -1803,18 +1834,18 @@ -\d_tabl_ntb_rightmargindistance -\d_tabl_ntb_columndistance \relax - \dorecurse\c_tabl_ntb_maximum_col - {\scratchdimen\tabl_ntb_get_aut\recurselevel\relax + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone + {\scratchdimen\tabl_ntb_get_aut\currentloopiterator \advance\scratchdimenone\dimexpr - -\tabl_ntb_get_dis\recurselevel + -\tabl_ntb_get_dis\currentloopiterator -\d_tabl_ntb_columndistance \relax \ifdim\scratchdimen>\zeropoint\relax \advance\scratchdimenone -\scratchdimen \else - \scratchdimen\tabl_ntb_get_wid\recurselevel\relax + \scratchdimen\tabl_ntb_get_wid\currentloopiterator\relax \ifdim\scratchdimen>\d_tabl_ntb_maxwidth\relax - \ifcase#1\else\tabl_ntb_let_wid\recurselevel\zeropoint\fi + \ifcase#1\else\tabl_ntb_let_wid\currentloopiterator\zeropoint\fi \advance\scratchcounterone \plusone \orelse\ifdim\scratchdimen>\zeropoint\relax \advance\scratchdimenone -\scratchdimen @@ -1826,15 +1857,15 @@ \fi}% \ifconditional\c_tabl_ntb_trace_widths\tabl_ntb_show_widths M#1\fi \ifcase\scratchcounterone \else \divide\scratchdimenone \scratchcounterone \fi - \dorecurse\c_tabl_ntb_maximum_col - {\scratchdimen\tabl_ntb_get_wid\recurselevel\relax + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone + {\scratchdimen\tabl_ntb_get_wid\currentloopiterator \ifcase#1\relax \ifdim\scratchdimen<\scratchdimenone % take natural width - \tabl_ntb_set_aut\recurselevel{\the\scratchdimen}% + \tabl_ntb_set_aut\currentloopiterator\scratchdimen \fi \else \ifzeropt\scratchdimen % auto set width - \tabl_ntb_set_wid\recurselevel{\the\scratchdimenone}% + \tabl_ntb_set_wid\currentloopiterator\scratchdimenone \fi \fi}% \ifconditional\c_tabl_ntb_trace_widths\tabl_ntb_show_widths E#1\fi} @@ -1849,12 +1880,12 @@ \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\c_tabl_ntb_maximum_col - {\ifnum\recurselevel=\c_tabl_ntb_current_col_three\else - \ifcsname\tabl_ntb_row_pattern\c_tabl_ntb_current_row_three\recurselevel\endcsname - \scratchcounterthree\tabl_ntb_get_row\c_tabl_ntb_current_row_three\recurselevel\relax + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone + {\ifnum\currentloopiterator=\c_tabl_ntb_current_col_three\else + \ifcsname\tabl_ntb_row_pattern\c_tabl_ntb_current_row_three\the\currentloopiterator\endcsname + \scratchcounterthree\tabl_ntb_get_row\c_tabl_ntb_current_row_three\currentloopiterator\relax \ifnum\scratchcounterthree=\plusone - \dimen4=\tabl_ntb_get_ht\c_tabl_ntb_current_row_three\recurselevel\relax + \dimen4=\tabl_ntb_get_ht\c_tabl_ntb_current_row_three\currentloopiterator\relax \ifdim\dimen2<\dimen4 \dimen2=\dimen4 \fi @@ -1866,11 +1897,11 @@ \dimen4=\dimen2 \scratchcounterthree\c_tabl_ntb_current_row_three \advance\scratchcounterthree\minusone - \dorecurse\scratchcountertwo + \localcontrolledloop\plusone\scratchcountertwo\plusone {\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=\scratchcountertwo\else + \ifnum\currentloopiterator=\scratchcountertwo\else \tabl_ntb_set_nob\scratchcounterthree \advance\scratchcounterthree\plusone \fi @@ -1881,30 +1912,30 @@ \advance\dimen0 -\dimen4 \divide\dimen0 \scratchcountertwo \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\scratchcountertwo - {\dorecurse\c_tabl_ntb_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}% + \tabl_ntb_set_hei\c_tabl_ntb_current_row_three\dimen2\relax + \localcontrolledloop\plusone\scratchcountertwo\plusone + {\localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone + {\ifnum\currentloopiterator=\c_tabl_ntb_current_col_three\else + \scratchdimen\dimexpr\tabl_ntb_get_ht\c_tabl_ntb_current_row_four\currentloopiterator+\dimen0\relax + \tabl_ntb_set_ht\c_tabl_ntb_current_row_four\currentloopiterator\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}% + \tabl_ntb_set_hei\c_tabl_ntb_current_row_four\scratchdimen \fi \fi}% \advance\c_tabl_ntb_current_row_four\plusone}% \orelse\ifdim\dimen4>\dimen0 \iftightTBLrowspan - \tabl_ntb_set_hei\c_tabl_ntb_current_row_three{\the\dimen2}% + \tabl_ntb_set_hei\c_tabl_ntb_current_row_three\dimen2\relax \fi \fi \fi \fi} \def\tabl_ntb_check_heights_one - {\dorecurse\c_tabl_ntb_maximum_row - {\c_tabl_ntb_current_row_three\recurselevel\relax - \dorecurse\c_tabl_ntb_maximum_col - {\c_tabl_ntb_current_col_three\recurselevel\relax + {\localcontrolledloop\plusone\c_tabl_ntb_maximum_row\plusone + {\c_tabl_ntb_current_row_three\currentloopiterator\relax + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone + {\c_tabl_ntb_current_col_three\currentloopiterator\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}}} @@ -1915,11 +1946,11 @@ \def\tabl_ntb_show_widths#1#2% {\begingroup \scratchdimen\zeropoint - \dorecurse\c_tabl_ntb_maximum_col - {\advance\scratchdimen\tabl_ntb_get_wid\recurselevel\relax}% + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone + {\advance\scratchdimen\tabl_ntb_get_wid\currentloopiterator\relax}% \writestatus\m!TABLE{#1 \ifcase#2trial\else real\fi: hsize: \the\hsize, total: \the\scratchdimen}% - \dorecurse\c_tabl_ntb_maximum_col - {\writestatus\m!TABLE{\space\space\recurselevel: \the\dimexpr\tabl_ntb_get_wid\recurselevel}}% + \localcontrolledloop\plusone\c_tabl_ntb_maximum_col\plusone + {\writestatus\m!TABLE{\space\space\the\currentloopiterator: \the\dimexpr\tabl_ntb_get_wid\currentloopiterator}}% \endgroup} \def\tabl_ntb_char_align % called often @@ -1974,7 +2005,7 @@ \def\tabl_ntb_cell_process_a_check_span_two_nop {\ifdim\tabl_ntb_get_wid\c_tabl_ntb_col<\wd\scratchbox - \tabl_ntb_set_wid\c_tabl_ntb_col{\the\wd\scratchbox}% + \tabl_ntb_set_wid\c_tabl_ntb_col\wd\scratchbox \fi} \protected\def\tabl_ntb_cell_process_a#1#2[#3]#4% grouping added ! ! ! @@ -1988,7 +2019,7 @@ \setbox\scratchbox\hbox {\scratchdimen\naturaltablelocalparameter\c!distance\relax \ifdim\scratchdimen>\tabl_ntb_get_dis{#2}\relax - \tabl_ntb_set_dis{#2}{\the\scratchdimen}% + \tabl_ntb_set_dis{#2}\scratchdimen \fi \anch_backgrounds_text_level_start \inheritednaturaltablelocalframed{\tabl_ntb_cell_start\tabl_ntb_char_align{#1}{#2}#4\tabl_ntb_cell_stop\tabl_ntb_cell_finalize}% @@ -2009,10 +2040,10 @@ \scratchcounter\numexpr\c_tabl_ntb_row+\plusone\relax \scratchdimen\tabl_ntb_get_hei\scratchcounter\relax \ifdim\ht\scratchbox<\scratchdimen - \tabl_ntb_set_hei\scratchcounter{\the\ht\scratchbox}% auto set + \tabl_ntb_set_hei\scratchcounter\ht\scratchbox% auto set \fi - \tabl_ntb_set_ht{#1}{#2}{\the\ht\scratchbox}% - %tabl_ntb_set_wd{#1}{#2}{\the\wd\scratchbox}% + \tabl_ntb_set_ht{#1}{#2}\ht\scratchbox + %tabl_ntb_set_wd{#1}{#2}\wd\scratchbox \ifautoTBLcheckwidth \ifdim\wd\scratchbox<.75\hsize % fuzzy guess \ifdim\ht\scratchbox>2\openlineheight % honor width since this @@ -2020,10 +2051,10 @@ \ifzeropt\scratchdimen % side effect: when width is set to 0pt, % we can force a span that fits the sum of spans widths - \tabl_ntb_set_aut\c_tabl_ntb_col{\the\scratchdimen}% + \tabl_ntb_set_aut\c_tabl_ntb_col\scratchdimen \orelse\ifdim\wd\scratchbox>\scratchdimen % unless span - \tabl_ntb_set_aut\c_tabl_ntb_col{\the\wd\scratchbox}% + \tabl_ntb_set_aut\c_tabl_ntb_col\wd\scratchbox % to be translated \writestatus\m!TABLE{no auto width in (\number#1,\number#2)\space\the\wd\scratchbox/\the\hsize}% \fi @@ -2116,6 +2147,8 @@ \newtoks\everyresetTABLEyes \newtoks\everyresetTABLEnop +% todo : use \letTABLEparameter\c!width\v!fit ... + \appendtoks \setupTABLE [% % diff --git a/tex/context/base/mkxl/task-ini.lmt b/tex/context/base/mkxl/task-ini.lmt index 397f02292..0cb473651 100644 --- a/tex/context/base/mkxl/task-ini.lmt +++ b/tex/context/base/mkxl/task-ini.lmt @@ -106,7 +106,7 @@ appendaction("math", "normalizers", "noads.handlers.families", appendaction("math", "normalizers", "noads.handlers.render", nil, "nonut", "enabled" ) appendaction("math", "normalizers", "noads.handlers.collapse", nil, "nonut", "disabled" ) appendaction("math", "normalizers", "noads.handlers.fixscripts", nil, "nonut", "enabled" ) -appendaction("math", "normalizers", "noads.handlers.domains", nil, "nonut", "disabled" ) +------------("math", "normalizers", "noads.handlers.domains", nil, "nonut", "disabled" ) appendaction("math", "normalizers", "noads.handlers.autofences", nil, "nonut", "disabled" ) appendaction("math", "normalizers", "noads.handlers.resize", nil, "nonut", "enabled" ) ------------("math", "normalizers", "noads.handlers.respace", nil, "nonut", "enabled" ) @@ -116,6 +116,7 @@ appendaction("math", "normalizers", "noads.handlers.italics", appendaction("math", "normalizers", "noads.handlers.kernpairs", nil, "nonut", "disabled" ) appendaction("math", "normalizers", "noads.handlers.classes", nil, "nonut", "disabled" ) appendaction("math", "normalizers", "noads.handlers.dictionaries", nil, "nonut", "enabled" ) +appendaction("math", "normalizers", "noads.handlers.suspicious", nil, "nonut", "enabled" ) appendaction("math", "builders", "builders.kernel.mlisttohlist", nil, "nut", "enabled" ) -- mandate appendaction("math", "builders", "typesetters.directions.processmath", nil, "nut", "disabled" ) diff --git a/tex/context/base/mkxl/typo-lin.lmt b/tex/context/base/mkxl/typo-lin.lmt index 783faeabf..0824a8079 100644 --- a/tex/context/base/mkxl/typo-lin.lmt +++ b/tex/context/base/mkxl/typo-lin.lmt @@ -144,7 +144,7 @@ local function finalize(prop,key) -- delayed calculations end local function normalize(line,islocal) -- assumes prestine lines, nothing pre/appended - local prop = getnormalizedline(line) -- we also can have "lineproperties" set but for a different porpose + local prop = getnormalizedline(line) -- we also can have "lineproperties" set but for a different purpose local width = getwidth(line) local hsize = islocal and width or tex.hsize noflines = noflines + 1 @@ -214,6 +214,12 @@ local function addtoline(n,list,option) delta = line.lefthangskip + line.leftskip end end + + -- this is a quick hack for line numbering in aligned math but maybe we need + -- a signal in the properties: if getprops(n,"repositioned") + local xoffset = nuts.getoffsets(n) + delta = delta - xoffset + -- always kerns, also when 0 so that we can adapt but we can optimize if needed -- by keeping a hash as long as we use the shiftinline helper .. no need to -- optimize now .. we can also decide to put each blob in a hlist diff --git a/tex/context/fonts/mkiv/asana-math.lfg b/tex/context/fonts/mkiv/asana-math.lfg index 07a96741b..934f9e0f0 100644 --- a/tex/context/fonts/mkiv/asana-math.lfg +++ b/tex/context/fonts/mkiv/asana-math.lfg @@ -100,6 +100,10 @@ return { { tweak = "addrules", }, + { + tweak = "fixellipses", + }, + }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/bonum-math.lfg b/tex/context/fonts/mkiv/bonum-math.lfg index 73a1efcaf..c09b55c20 100644 --- a/tex/context/fonts/mkiv/bonum-math.lfg +++ b/tex/context/fonts/mkiv/bonum-math.lfg @@ -32,6 +32,9 @@ return { parameters = { NoLimitSupFactor = 0, NoLimitSubFactor = 900, + AccentTopShiftUp = -15, + FlattenedAccentTopShiftUp = -15, + -- AccentExtendMargin = 50, AccentBaseDepth = 50, RadicalDegreeBottomRaisePercent = 60, RadicalRuleThickness = 66, -- 72 in font @@ -74,7 +77,7 @@ return { [0x1D450] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- c [0x1D451] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.75 }, -- d [0x1D452] = { xoffset = -0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- e - [0x1D453] = { xoffset = 0.45, width = 1.9, italic = 0.45 }, -- f + [0x1D453] = { xoffset = 0.45, width = 1.9, italic = 0.45, anchor = 1.1 }, -- f [0x1D454] = { xoffset = 0.05, width = 1.1, italic = 0, anchor = 0.9 }, -- g [0x0210E] = { xoffset = -0.1, width = 1.05, italic = 0, anchor = 1.15 }, -- h [0x1D456] = { xoffset = -0.2, width = 1.1, italic = 0 }, -- i @@ -180,11 +183,12 @@ return { }, ["lowercasescript"] = { - width = 1.2, - extend = 1.2, - height = 1.2, - depth = 1.2, - squeeze = 1.2, + factor = 1.2, + -- width = 1.2, + -- extend = 1.2, + -- height = 1.2, + -- depth = 1.2, + -- squeeze = 1.2, }, }, }, @@ -195,11 +199,10 @@ return { topleft = -0.2, bottomright = -0.2, }, --- [0x1D453] = { --- [0x0210E] = { --- topleft = 0.5, --- bottomright = -0.2, --- }, + ["0x2F.variants.*"] = { + topleft = -0.2, + bottomright = -0.2, + }, -- [0x28] = { -- left parenthesis. No! -- topleft = -0.1, -- bottomleft = -0.1, @@ -270,6 +273,55 @@ return { }, }, + + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. + { + tweak = "dimensions", + list = { + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + }, + }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + { -- For upright alphabets, we unset the anchor. -- This means that accents are placed @@ -466,6 +518,19 @@ return { tweak = "addrules", }, { + -- This tweak is only needed for the funny arrows and these now get properly + -- centered. (Could actually be done in the engine). + tweak = "addarrows", + -- These are for documentation purposed as they are the defaults anyway: + left = 0.05, + right = 0.05, + slack = 0.10, + -- The equal doesn't really match the double arrows, as in plain etc, so it still + -- looks somewhat bad when zoomed in. This is the best we could do. Anyway, this + -- in only used when testing (forced) so it doesn't kick in normally. + list = { [0x3D] = { squeeze = .85, yoffset = .0975 } } + }, + { tweak = "kernpairs", list = { [mathematics.tweaks.subsets.acenorsuvxz] = { @@ -521,6 +586,21 @@ return { -- tweak = "fixanchors", -- factor = .5, -- }, + { + tweak = "addbars", + advance = 0.275, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, + { + tweak = "addfourier", + variant = 1, + }, + }, }, alternates = { diff --git a/tex/context/fonts/mkiv/cambria-math.lfg b/tex/context/fonts/mkiv/cambria-math.lfg index de8b55b22..2207c0645 100644 --- a/tex/context/fonts/mkiv/cambria-math.lfg +++ b/tex/context/fonts/mkiv/cambria-math.lfg @@ -56,6 +56,9 @@ return { parameters = { NoLimitSupFactor = 0, NoLimitSubFactor = 1000, + -- AccentTopShiftUp = 0, + -- FlattenedAccentTopShiftUp = 0, + -- AccentExtendMargin = 50, AccentBaseDepth = 300, RadicalDegreeBottomRaisePercent = 65, RadicalKernAfterDegree = -900, @@ -80,9 +83,9 @@ return { -- [0x002D8] = { yoffset = -0.15 }, -- breve -- [0x002D9] = { yoffset = -0.15 }, -- dot -- [0x000A8] = { yoffset = -0.1 }, -- ddot - [0x020DB] = { yoffset = -0.05 }, -- dddot + -- [0x020DB] = { yoffset = -0.05 }, -- dddot -- [0x002C7] = { yoffset = -0.1 }, -- check - [0x020D7] = { yoffset = -0.05 }, -- vec + -- [0x020D7] = { yoffset = -0.05 }, -- vec -- [0x00300] = { yoffset = -0.12, all=true }, -- widegrave -- [0x00301] = { yoffset = -0.12, all=true }, -- wideacute @@ -90,8 +93,8 @@ return { -- [0x00303] = { yoffset = -0.12, all=true }, -- widetilde -- [0x00304] = { yoffset = -0.12, all=true }, -- widebar -- [0x00306] = { yoffset = -0.12, all=true }, -- widebreve - [0x00307] = { yoffset = -0.025, all=true }, -- widedot - [0x00308] = { yoffset = -0.025, all=true }, -- wideddot + -- [0x00307] = { yoffset = -0.025, all=true }, -- widedot + -- [0x00308] = { yoffset = -0.025, all=true }, -- wideddot -- [0x020DB] = { yoffset = -0.1, all=true }, -- widedddot -- [0x0030A] = { yoffset = -0.12, all=true }, -- widering -- [0x0030C] = { yoffset = -0.12, all=true }, -- widecheck @@ -147,6 +150,55 @@ return { -- ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, }, }, + + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + [0x00302] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widehat + [0x00303] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widetilde + [0x00306] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widebreve + [0x0030C] = { width = 2, anchor = 1.5, xoffset = .25 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. + { + tweak = "dimensions", + list = { + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + [0x020DB] = { yoffset = -0.03, height = .95, all = true }, -- widedddot : 0x20DB (self) + }, + }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + { tweak = "fixprimes", scale = 0.9, @@ -179,6 +231,26 @@ return { { tweak = "wipecues", }, + { + tweak = "addarrows", + }, + { + tweak = "fixslashes", + }, + { + tweak = "addbars", + advance = 0.33, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addfourier", + variant = 1, + }, + -- { -- the ldots are squareshaped and the cdots are circular + -- tweak = "fixellipses", + -- }, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/concrete-math.lfg b/tex/context/fonts/mkiv/concrete-math.lfg index f7e5f3dda..ff55d353d 100644 --- a/tex/context/fonts/mkiv/concrete-math.lfg +++ b/tex/context/fonts/mkiv/concrete-math.lfg @@ -21,18 +21,33 @@ return { -- factor = 0.9, -- }, { - tweak = "kerns", - list = { - [0x2F] = { - topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - bottomright = -0.2, - }, + tweak = "kerns", + list = { + [0x2F] = { + topleft = -0.2, + -- bottomleft = 0, + -- topright = 0, + bottomright = -0.2, }, }, + }, + { + tweak = "fixellipses", + }, + { + tweak = "addbars", + advance = 0.6, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, + + + }, }, - }, bigslots = { 1, 2, 3, 4 }, diff --git a/tex/context/fonts/mkiv/dejavu-math.lfg b/tex/context/fonts/mkiv/dejavu-math.lfg index b13150295..c2e909aef 100644 --- a/tex/context/fonts/mkiv/dejavu-math.lfg +++ b/tex/context/fonts/mkiv/dejavu-math.lfg @@ -27,6 +27,9 @@ return { NoLimitSupFactor = 0, NoLimitSubFactor = 900, FractionRuleThickness = 60, + AccentTopShiftUp = -25, + FlattenedAccentTopShiftUp = -25, + -- AccentExtendMargin = 50, AccentBaseDepth = 30, RadicalDegreeBottomRaisePercent = 62, RadicalRuleThickness = 46, -- 52 in font @@ -45,6 +48,7 @@ return { { tweak = "dimensions", list = { + [0x1D44E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- a -- [0x1D449] = { xoffset = 0, width = .8, italic = .2 }, -- [0x1D44A] = { xoffset = 0, width = .8, italic = .2 }, ["0x1D449:0x1D44A"] = { xoffset = 0, width = .8, italic = .2 }, @@ -107,6 +111,54 @@ return { }, }, + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. + { + tweak = "dimensions", + list = { + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + [0x020DB] = { yoffset = 0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + }, + }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + { tweak = "fixprimes", -- scale = 0.9, @@ -128,6 +180,20 @@ return { { tweak = "wipecues", }, + { + tweak = "addbars", + advance = 0.175, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, + { + tweak = "addfourier", + variant = 1, + }, }, }, alternates = { diff --git a/tex/context/fonts/mkiv/erewhon-math.lfg b/tex/context/fonts/mkiv/erewhon-math.lfg index e1e7fe9fd..71ff64648 100644 --- a/tex/context/fonts/mkiv/erewhon-math.lfg +++ b/tex/context/fonts/mkiv/erewhon-math.lfg @@ -87,6 +87,12 @@ return { { tweak = "addrules", }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/garamond-math.lfg b/tex/context/fonts/mkiv/garamond-math.lfg index bdbb6b155..7c1e7ab22 100644 --- a/tex/context/fonts/mkiv/garamond-math.lfg +++ b/tex/context/fonts/mkiv/garamond-math.lfg @@ -11,10 +11,11 @@ return { FractionRuleThickness = 60, OverbarRuleThickness = 60, UnderbarRuleThickness = 60, + AccentTopShiftUp = -75, + FlattenedAccentTopShiftUp = -75, + -- AccentExtendMargin = 50, -- AccentBaseHeight = 0, AccentBaseDepth = 75, - -- AccentTopShiftUp = -75, - -- FlattenedAccentTopShiftUp = -100, -- RadicalRuleThickness = 50, -- 50 in font DelimiterPercent = 90, DelimiterShortfall = 400, @@ -32,29 +33,29 @@ return { tweak = "dimensions", list = { -- offset width italic - -- [0x00060] = { yoffset = -0.1 }, -- grave - -- [0x000B4] = { yoffset = -0.1 }, -- acute - [0x002C6] = { yoffset = -0.1 }, -- hat - [0x002DC] = { yoffset = -0.1 }, -- tilde - -- [0x000AF] = { yoffset = -0.1 }, -- bar - [0x002D8] = { yoffset = -0.15 }, -- breve - [0x002D9] = { yoffset = -0.15 }, -- dot - -- [0x000A8] = { yoffset = -0.1 }, -- ddot - [0x020DB] = { yoffset = -0.115 }, -- dddot - [0x002C7] = { yoffset = -0.1 }, -- check - [0x020D7] = { yoffset = -0.1 }, -- vec + -- -- [0x00060] = { yoffset = -0.1 }, -- grave + -- -- [0x000B4] = { yoffset = -0.1 }, -- acute + -- [0x002C6] = { yoffset = -0.1 }, -- hat + -- [0x002DC] = { yoffset = -0.1 }, -- tilde + -- -- [0x000AF] = { yoffset = -0.1 }, -- bar + -- [0x002D8] = { yoffset = -0.15 }, -- breve + -- [0x002D9] = { yoffset = -0.15 }, -- dot + -- -- [0x000A8] = { yoffset = -0.1 }, -- ddot + -- [0x020DB] = { yoffset = -0.115 }, -- dddot + -- [0x002C7] = { yoffset = -0.1 }, -- check + -- [0x020D7] = { yoffset = -0.1 }, -- vec - [0x00300] = { yoffset = -0.12 , all = true }, -- widegrave - [0x00301] = { yoffset = -0.12 , all = true }, -- wideacute - [0x00302] = { yoffset = -0.12 , all = true }, -- widehat - [0x00303] = { yoffset = -0.12 , all = true }, -- widetilde - [0x00304] = { yoffset = -0.12 , all = true }, -- widebar - [0x00306] = { yoffset = -0.12 , all = true }, -- widebreve - [0x00307] = { yoffset = -0.12 , all = true }, -- widedot - [0x00308] = { yoffset = -0.12 , all = true }, -- wideddot - -- [0x020DB] = { yoffset = -0.1 , all = true }, -- widedddot - [0x0030A] = { yoffset = -0.12 , all = true }, -- widering - [0x0030C] = { yoffset = -0.12 , all = true }, -- widecheck + -- [0x00300] = { yoffset = -0.12 , all = true }, -- widegrave + -- [0x00301] = { yoffset = -0.12 , all = true }, -- wideacute + -- [0x00302] = { yoffset = -0.12 , all = true }, -- widehat + -- [0x00303] = { yoffset = -0.12 , all = true }, -- widetilde + -- [0x00304] = { yoffset = -0.12 , all = true }, -- widebar + -- [0x00306] = { yoffset = -0.12 , all = true }, -- widebreve + -- [0x00307] = { yoffset = -0.12 , all = true }, -- widedot + -- [0x00308] = { yoffset = -0.12 , all = true }, -- wideddot + -- -- [0x020DB] = { yoffset = -0.1 , all = true }, -- widedddot + -- [0x0030A] = { yoffset = -0.12 , all = true }, -- widering + -- [0x0030C] = { yoffset = -0.12 , all = true }, -- widecheck -- [0x002C6] = { scale =.85, yoffset = .1, width = .85, height = .935 }, -- hat @@ -147,6 +148,54 @@ return { ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, }, }, + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. + { + tweak = "dimensions", + list = { + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + }, + }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + { tweak = "fixprimes", scale = 0.9, @@ -166,6 +215,20 @@ return { { tweak = "addrules", }, + { + tweak = "addbars", + advance = 0.6, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, + { + tweak = "addfourier", + variant = 1, + }, }, }, alternates = { diff --git a/tex/context/fonts/mkiv/generic-math.lfg b/tex/context/fonts/mkiv/generic-math.lfg index d50d49af9..490ad1416 100644 --- a/tex/context/fonts/mkiv/generic-math.lfg +++ b/tex/context/fonts/mkiv/generic-math.lfg @@ -45,6 +45,15 @@ return { -- keep = true, -- keep the text size prime (aka minute) }, { + tweak = "fixslashes", + }, + { + tweak = "fixellipses", + }, + { + tweak = "addbreve", + }, + { tweak = "checkspacing", }, { @@ -65,8 +74,127 @@ return { -- } }, { + tweak = "checkspacing", + }, + { + tweak = "addscripts", + }, + { + tweak = "accentdimensions", + }, + { + tweak = "addrules", + }, + { + tweak = "addarrows", + left = 0.1, + right = 0.1, + slack = 0.20, + list = { + [0x21A9] = false, + [0x21AA] = false, + [0x2190] = false, + [0x2192] = false, + [0x219E] = false, + [0x21A0] = false, +-- [0x21A6] = false, +-- [0x21CB] = false, +-- [0x21CC] = false, + } + }, + { + -- For upright alphabets, we unset the anchor. + -- This means that accents are placed + -- centered over the character + tweak = "wipeanchors", + -- list = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58 }, -- todo: ranges + list = { + "digitsbold", + "digitsdoublestruck", + "digitsmonospace", + "digitsnormal", + "digitssansserifbold", + "digitssansserifnormal", + "lowercasebold", + "lowercaseboldfraktur", + "lowercasedoublestruck", + "lowercasefraktur", + "lowercasegreekbold", + "lowercasegreeknormal", + "lowercasegreeksansserifbold", + "lowercasemonospace", + "lowercasenormal", + "lowercasesansserifbold", + "lowercasesansserifnormal", + "uppercasebold", + "uppercaseboldfraktur", + "uppercasedoublestruck", + "uppercasefraktur", + "uppercasegreekbold", + "uppercasegreeknormal", + "uppercasegreeksansserifbold", + "uppercasemonospace", + "uppercasenormal", -- they are italic! + "uppercasesansserifbold", + "uppercasesansserifnormal", + }, + }, + { + -- For non-italic alphabets we + -- remove italic correction. + tweak = "wipeitalics", + list = { + -- "digitsbold", + -- "digitsdoublestruck", + -- "digitsmonospace", + -- "digitsnormal", + -- "digitssansserifbold", + -- "digitssansserifnormal", + -- "lowercasebold", + -- "lowercaseboldfraktur", + -- "lowercasedoublestruck", + -- "lowercasefraktur", + "lowercasemonospace", + "lowercasenormal", + -- "lowercasesansserifbold", + -- "lowercasesansserifnormal", + -- "lowercasegreeknormal", + "uppercasebold", + -- "uppercaseboldfraktur", + -- "uppercasedoublestruck", + -- "uppercasefraktur", + -- "uppercasegreekbold", + -- "uppercasegreeknormal", + -- "uppercasegreeksansserifbold", + "uppercasemonospace", + "uppercasesansserifbold", + "uppercasesanserifnormal", + }, + }, + { + -- This one fakes margins to get larger/smaller accents + -- with for example \widetilde. + -- see lm for many examples + tweak = "margins", + list = { + }, + }, + { tweak = "addrules", }, + { + tweak = "addbars", + advance = 0.1, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, + { + tweak = "wipecues", + }, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/kpfonts-math.lfg b/tex/context/fonts/mkiv/kpfonts-math.lfg index 3c2b89b79..c0b019f79 100644 --- a/tex/context/fonts/mkiv/kpfonts-math.lfg +++ b/tex/context/fonts/mkiv/kpfonts-math.lfg @@ -27,7 +27,9 @@ return { { tweak = "dimensions", list = { - -- whatever + [0x2A3F] = { + factor = 0.84625, + } }, }, { @@ -93,6 +95,16 @@ return { { tweak = "addrules", }, + { + tweak = "addbars", + advance = 0.025, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, }, }, alternates = { diff --git a/tex/context/fonts/mkiv/libertinus-math.lfg b/tex/context/fonts/mkiv/libertinus-math.lfg index 4992b41be..77d0161e3 100644 --- a/tex/context/fonts/mkiv/libertinus-math.lfg +++ b/tex/context/fonts/mkiv/libertinus-math.lfg @@ -18,6 +18,9 @@ return { OverbarRuleThickness = 50, -- RadicalRuleThickness = 50, UnderbarRuleThickness = 50, + AccentTopShiftUp = -35, + FlattenedAccentTopShiftUp = -35, + -- AccentExtendMargin = 50, -- AccentTopShiftUp = 0, AccentBaseDepth = 10, RadicalDegreeBottomRaisePercent = 60, @@ -39,30 +42,30 @@ return { { tweak = "dimensions", list = { - [0x00060] = { yoffset = -0.075 }, -- grave - [0x000B4] = { yoffset = -0.075 }, -- acute - [0x002C6] = { yoffset = -0.075 }, -- hat - [0x002DC] = { yoffset = -0.075 }, -- tilde - -- [0x000AF] = { yoffset = -0.1 }, -- bar - [0x002D8] = { yoffset = -0.075 }, -- breve - [0x002D9] = { yoffset = -0.05 }, -- dot - [0x000A8] = { yoffset = -0.02 }, -- ddot - [0x020DB] = { yoffset = -0.02 }, -- dddot - [0x002DA] = { yoffset = -0.1 }, -- ring - -- [0x002C7] = { yoffset = -0.1 }, -- check - [0x020D7] = { yoffset = -0.1 }, -- vec + -- [0x00060] = { yoffset = -0.075 }, -- grave + -- [0x000B4] = { yoffset = -0.075 }, -- acute + -- [0x002C6] = { yoffset = -0.075 }, -- hat + -- [0x002DC] = { yoffset = -0.075 }, -- tilde + -- -- [0x000AF] = { yoffset = -0.1 }, -- bar + -- [0x002D8] = { yoffset = -0.075 }, -- breve + -- [0x002D9] = { yoffset = -0.05 }, -- dot + -- [0x000A8] = { yoffset = -0.02 }, -- ddot + -- [0x020DB] = { yoffset = -0.02 }, -- dddot + -- [0x002DA] = { yoffset = -0.1 }, -- ring + -- -- [0x002C7] = { yoffset = -0.1 }, -- check + -- [0x020D7] = { yoffset = -0.1 }, -- vec - [0x00300] = { yoffset = -0.1, all = true }, -- widegrave - [0x00301] = { yoffset = -0.1, all = true }, -- wideacute - [0x00302] = { yoffset = -0.1, all = true }, -- widehat - [0x00303] = { yoffset = -0.09, all = true }, -- widetilde - -- [0x00304] = { yoffset = -0.12, all = true }, -- widebar - [0x00306] = { yoffset = -0.05, all = true }, -- widebreve - [0x00307] = { yoffset = -0.02, all = true }, -- widedot - [0x00308] = { yoffset = -0.02, all = true }, -- wideddot - -- [0x020DB] = { yoffset = -0.1, all = true }, -- widedddot - [0x0030A] = { yoffset = -0.12, all = true }, -- widering - [0x0030C] = { yoffset = -0.04, all = true }, -- widecheck + -- [0x00300] = { yoffset = -0.1, all = true }, -- widegrave + -- [0x00301] = { yoffset = -0.1, all = true }, -- wideacute + -- [0x00302] = { yoffset = -0.1, all = true }, -- widehat + -- [0x00303] = { yoffset = -0.09, all = true }, -- widetilde + -- -- [0x00304] = { yoffset = -0.12, all = true }, -- widebar + -- [0x00306] = { yoffset = -0.05, all = true }, -- widebreve + -- [0x00307] = { yoffset = -0.02, all = true }, -- widedot + -- [0x00308] = { yoffset = -0.02, all = true }, -- wideddot + -- -- [0x020DB] = { yoffset = -0.1, all = true }, -- widedddot + -- [0x0030A] = { yoffset = -0.12, all = true }, -- widering + -- [0x0030C] = { yoffset = -0.04, all = true }, -- widecheck -- [0x1D44F] = { width = 1, italic = 0, anchor = 1.5 }, -- b (6.8) -- [0x1D451] = { width = 1, italic = 0, anchor = 1.2 }, -- d (6.8) @@ -119,6 +122,55 @@ return { }, }, + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + [0x00302] = { width = 1.8, anchor = 1.40, xoffset = .20 }, -- widehat + [0x00303] = { width = 2.0, anchor = 1.50, xoffset = .30 }, -- widetilde + [0x00306] = { width = 1.6, anchor = 1.30, xoffset = .15 }, -- widebreve + [0x0030C] = { width = 1.3, anchor = 1.15, xoffset = .075 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. + { + tweak = "dimensions", + list = { + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + }, + }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + + { tweak = "fixprimes", scale = 0.9, @@ -137,6 +189,20 @@ return { { tweak = "addrules", }, + { + tweak = "addbars", + advance = 0.5, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, + { + tweak = "addfourier", + variant = 1, + }, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/lm.lfg b/tex/context/fonts/mkiv/lm.lfg index 250fe9e93..1d81e0b77 100644 --- a/tex/context/fonts/mkiv/lm.lfg +++ b/tex/context/fonts/mkiv/lm.lfg @@ -61,6 +61,24 @@ return { author = "Hans Hagen & Mikael Sundqvist", copyright = "ConTeXt development team", mathematics = { + parameters = { + FractionNumeratorDisplayStyleShiftUp = 600, -- used to be a function + NoLimitSupFactor = 0, + NoLimitSubFactor = 900, + AccentTopShiftUp = -60, + FlattenedAccentTopShiftUp = -60, + -- AccentExtendMargin = 50, + -- AccentBaseHeight = 0, + -- AccentBaseDepth = 0, + -- AccentTopOvershoot = 66, + AccentSuperscriptDrop = 100, -- drop the superscripts if accents are present. Amount in percentage of height of accent(?) + AccentSuperscriptPercent = 0, + DelimiterPercent = 90, + DelimiterShortfall = 400, + -- DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) + PrimeRaisePercent = 60, -- 50 default + PrimeRaiseComposedPercent = 15, -- 25 default + }, tweaks = { aftercopying = { { @@ -79,21 +97,21 @@ return { -- [0x002D9] = { yoffset = -0.05 }, -- dot -- [0x000A8] = { yoffset = -0.05 }, -- ddot -- [0x020DB] = { yoffset = 0.2 }, -- dddot (done below!) - [0x002DA] = { width = 0 }, -- ring (bounding box is wrong) + -- [0x002DA] = { width = 0 }, -- ring (bounding box is wrong) -- [0x002C7] = { yoffset = -0.05 }, -- check -- [0x020D7] = { yoffset = -0.05 }, -- vec - [0x00300] = { yoffset = -0.03, all = true }, -- widegrave - [0x00301] = { yoffset = -0.03, all = true }, -- wideacute - [0x00302] = { yoffset = -0.075, all = true }, -- widehat - [0x00303] = { yoffset = -0.05, all = true }, -- widetilde - [0x00304] = { yoffset = -0.02, all = true }, -- widebar - [0x00306] = { yoffset = -0.05, all = true }, -- widebreve - [0x00307] = { yoffset = -0.027, all = true }, -- widedot - [0x00308] = { yoffset = -0.027, all = true }, -- wideddot - [0x020DB] = { yoffset = -0.065, all = true }, -- widedddot - [0x0030C] = { yoffset = -0.05, all = true }, -- widecheck - [0x0030A] = { yoffset = -0.025, all = true }, -- widering + -- [0x00300] = { yoffset = -0.03, all = true }, -- widegrave + -- [0x00301] = { yoffset = -0.03, all = true }, -- wideacute + -- [0x00302] = { yoffset = -0.075, all = true }, -- widehat + -- [0x00303] = { yoffset = -0.05, all = true }, -- widetilde + -- [0x00304] = { yoffset = -0.02, all = true }, -- widebar + -- [0x00306] = { yoffset = -0.05, all = true }, -- widebreve + -- [0x00307] = { yoffset = -0.027, all = true }, -- widedot + -- [0x00308] = { yoffset = -0.027, all = true }, -- wideddot + -- [0x020DB] = { yoffset = -0.065, all = true }, -- widedddot + -- [0x0030C] = { yoffset = -0.05, all = true }, -- widecheck + -- [0x0030A] = { yoffset = -0.025, all = true }, -- widering -- [0x0212C] = { width = 0.95, italic = 0.05 }, -- script B -- [0x1D49E] = { width = 0.8, italic = 0.25 }, -- script C @@ -241,6 +259,58 @@ return { -- }, }, }, + + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + -- [0x00300] = { width = 0.8 }, -- widegrave + -- [0x00301] = { width = 0.9 }, -- wideacute + [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + -- [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering + [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. + { + tweak = "dimensions", + list = { + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + }, + }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + { -- Here we modify "corner kerns". -- We started with 0x2F, the solidus @@ -489,6 +559,20 @@ return { { tweak = "addrules", }, + { + tweak = "addbars", + advance = 0.52, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addfourier", + variant = 1, + }, + { + tweak = "addequals", + }, -- { -- tweak = "wipevariants", -- list = { @@ -497,21 +581,6 @@ return { -- }, }, }, - parameters = { - FractionNumeratorDisplayStyleShiftUp = 600, -- used to be a function - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, - -- AccentBaseHeight = 0, - -- AccentBaseDepth = 0, - -- AccentTopOvershoot = 66, - AccentSuperscriptDrop = 100, -- drop the superscripts if accents are present. Amount in percentage of height of accent(?) - AccentSuperscriptPercent = 0, - DelimiterPercent = 90, - DelimiterShortfall = 400, - -- DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) - PrimeRaisePercent = 60, -- 50 default - PrimeRaiseComposedPercent = 15, -- 25 default - }, bigslots = { 1, 3, 5, 7 -- In fact, 6 is the last one. }, diff --git a/tex/context/fonts/mkiv/lucida-opentype-math.lfg b/tex/context/fonts/mkiv/lucida-opentype-math.lfg index a8cd48ca2..372d8cce2 100644 --- a/tex/context/fonts/mkiv/lucida-opentype-math.lfg +++ b/tex/context/fonts/mkiv/lucida-opentype-math.lfg @@ -42,6 +42,9 @@ return { NoLimitSupFactor = 0, NoLimitSubFactor = 900, FractionRuleThickness = 55, + -- AccentTopShiftUp = 0, + -- FlattenedAccentTopShiftUp = 0, + -- AccentExtendMargin = 50, -- AccentBaseHeight = 650, AccentBaseDepth = 150, RadicalDegreeBottomRaisePercent = 50, @@ -110,6 +113,63 @@ return { ["0x7C.variants.4"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, }, }, + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + -- [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + -- [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + -- [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + -- [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. + { + tweak = "dimensions", + list = { + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + }, + }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + + { + tweak = "fixslashes", + }, + { + tweak = "fixellipses", + }, + { + tweak = "addbreve", + }, { tweak = "kerns", list = { @@ -189,6 +249,31 @@ return { { tweak = "addrules", }, + { + tweak = "addactuarian", + }, + { + tweak = "addfourier", + -- scale = 1.5, + variant = 1, + }, + { + tweak = "addarrows", + left = 0.1, + right = 0.1, + slack = 0.20, + list = { + [0x21A9] = false, + [0x21AA] = false, + [0x2190] = false, + [0x2192] = false, + [0x219E] = false, + [0x21A0] = false, +-- [0x21A6] = false, +-- [0x21CB] = false, +-- [0x21CC] = false, + } + }, }, }, alternates = { diff --git a/tex/context/fonts/mkiv/pagella-math.lfg b/tex/context/fonts/mkiv/pagella-math.lfg index f03c10d65..9be98adcf 100644 --- a/tex/context/fonts/mkiv/pagella-math.lfg +++ b/tex/context/fonts/mkiv/pagella-math.lfg @@ -9,7 +9,7 @@ local dimensions, kerns if CONTEXTLMTXMODE == 0 then -- [0x1D453] = offset_f, -- 𝑓 -- ["1:0x1D453"] = offset_f, -- needed for compact -- ["2:0x1D453"] = offset_f, -- needed for compact --- ["*:0x1D453"] = offset_f, -- 𝑓 + -- ["*:0x1D453"] = offset_f, -- 𝑓 }, } @@ -28,8 +28,9 @@ local dimensions, kerns if CONTEXTLMTXMODE == 0 then end -- When set this will bypass the italic correction hackery! + local integral_variants = { bottomright = -0.20 } --- local integral_top = { topright = 0.05 } +----- integral_top = { topright = 0.05 } local integral_bottom = { bottomright = -0.20 } @@ -43,11 +44,13 @@ return { parameters = { NoLimitSupFactor = 0, NoLimitSubFactor = 900, - AccentTopShiftUp = 30, + AccentTopShiftUp = 10, + FlattenedAccentTopShiftUp = 10, -- now also set, the wide ones (so we can move in one go) + -- AccentExtendMargin = 50, -- AccentBaseHeight = 0, AccentBaseDepth = 80, --- SpaceAfterScript = 0, --- SpaceAfterScript = 30, + -- SpaceAfterScript = 0, + -- SpaceAfterScript = 30, RadicalDegreeBottomRaisePercent = 60, RadicalKernAfterDegree = -500, RadicalRuleThickness = 54, -- 60 in font @@ -78,36 +81,7 @@ return { { tweak = "dimensions", list = { -- offset width italic - -- [0x002C6] = { scale=.85, yoffset = .1, width = .85, height = .935 }, -- hat - -- [0x00302] = { scale=.85, yoffset = .1, width = .85, height = .935 }, -- hat - -- [0x002C6] = { scale=.75, yoffset = .2, advance = .75, width = .75, height = .90 }, -- hat - -- [0x00302] = { scale=.75, yoffset = .2, advance = .75, width = .75, height = .90 }, -- hat - - [0x00060] = { yoffset = -0.035 }, -- grave - [0x000B4] = { yoffset = -0.035 }, -- acute - [0x002C6] = { yoffset = -0.035 }, -- hat - [0x002DC] = { yoffset = -0.035 }, -- tilde - [0x000AF] = { yoffset = -0.05 }, -- bar - [0x002D8] = { yoffset = -0.035 }, -- breve - [0x002D9] = { yoffset = -0.035 }, -- dot - [0x000A8] = { yoffset = -0.05 }, -- ddot - [0x020DB] = { yoffset = -0.06 }, -- dddot - -- [0x002DA] = { yoffset = -0.05 }, -- ring - -- [0x002C7] = { yoffset = -0.05 }, -- check [0x020D7] = { yoffset = -0.05 }, -- vec - - -- [0x00300] = { yoffset = -0.07, all=true }, -- widegrave - -- [0x00301] = { yoffset = -0.07, all=true }, -- wideacute - [0x00302] = { yoffset = -0.02, all=true }, -- widehat - [0x00303] = { yoffset = -0.02, all=true }, -- widetilde - [0x00304] = { yoffset = -0.05, all=true }, -- widebar - [0x00306] = { yoffset = -0.03, all=true }, -- widebreve - [0x00307] = { yoffset = -0.03, all=true }, -- widedot - [0x00308] = { yoffset = -0.03, all=true }, -- wideddot - -- [0x020DB] = { yoffset = 0, all=true }, -- widedddot - -- [0x0030A] = { yoffset = -0.05, all=true }, -- widering - [0x0030C] = { yoffset = -0.03, all=true }, -- widecheck - [0x1D44E] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- a [0x1D44F] = { xoffset = 0, width = 1, italic = 0, anchor = 1.3 }, -- b [0x1D450] = { xoffset = 0, width = 1, italic = 0, anchor = 0.9 }, -- c @@ -132,6 +106,62 @@ return { [0x1D71D] = { xoffset = 0, width = 1, italic = 0, anchor = 0.7 }, -- \varpi }, }, + + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + [0x00300] = { width = 0.9 }, -- widegrave + [0x00301] = { width = 0.9 }, -- wideacute + [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering + [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. + { + tweak = "dimensions", + list = { + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + [0x020DB] = { yoffset = -0.01, height = .95, all = true }, -- widedddot : 0x20DB (self) + }, + }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + + { + tweak = "fixslashes", + }, + { tweak = "kerns", list = { @@ -141,16 +171,7 @@ return { -- bottomleft = 0, -- topright = 0, bottomright = -0.2, - }, - --- [0x1D453] = { --- topleft = 3, --- bottomleft = 3, --- topright = 3, --- bottomright = 3, --- }, - - + }, ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top @@ -223,6 +244,23 @@ return { { tweak = "addrules", }, + { + tweak = "addarrows", + }, + { + tweak = "addbars", + advance = 0.2, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, + { + tweak = "addfourier", + variant = 1, + }, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/schola-math.lfg b/tex/context/fonts/mkiv/schola-math.lfg index 5c96f9055..cb992cd0b 100644 --- a/tex/context/fonts/mkiv/schola-math.lfg +++ b/tex/context/fonts/mkiv/schola-math.lfg @@ -26,6 +26,9 @@ return { parameters = { NoLimitSupFactor = 0, NoLimitSubFactor = 900, + AccentTopShiftUp = -15, + FlattenedAccentTopShiftUp = -15, + -- AccentExtendMargin = 50, -- AccentBaseHeight = 0, AccentBaseDepth = 30, RadicalDegreeBottomRaisePercent = 60, @@ -108,6 +111,57 @@ return { }, }, + + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. + { + tweak = "dimensions", + list = { + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + }, + }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + + + { tweak = "fixprimes", scale = 0.85, @@ -126,6 +180,21 @@ return { { tweak = "addrules", }, + { + tweak = "addbars", + advance = 0.27, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, + { + tweak = "addfourier", + -- scale = 1.25, + variant = 1, + }, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/stix-two-math.lfg b/tex/context/fonts/mkiv/stix-two-math.lfg index bd09c192b..b5e6daf29 100644 --- a/tex/context/fonts/mkiv/stix-two-math.lfg +++ b/tex/context/fonts/mkiv/stix-two-math.lfg @@ -1,5 +1,5 @@ -- When set this will bypass the italic correction hackery! -local integral_variants = { bottomright = -0.20 } +local integral_variants = { bottomright = -0.4 } -- local integral_top = { topright = 0.05 } local integral_bottom = { bottomright = -0.35 } @@ -31,6 +31,8 @@ return { NoLimitSubFactor = 1000, -- AccentBaseHeight = 0, AccentBaseDepth = 30, + FlattenedAccentTopShiftUp = 0, -- now also set, the wide ones (so we can move in one go) + -- AccentExtendMargin = 50, RadicalDegreeBottomRaisePercent = 65, -- RadicalKernBeforeDegree = 500, RadicalKernAfterDegree = -500, @@ -122,34 +124,54 @@ return { feature = "ss01",-- this changes to roundhand style for stixtwo selector = 0xFE01, }, + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + [0x00302] = { width = 1.2, anchor = 1.10, xoffset = .05 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. { tweak = "dimensions", list = { - -- [0x00060] = { yoffset = -0.035 }, -- grave - -- [0x000B4] = { yoffset = -0.035 }, -- acute - -- [0x002C6] = { yoffset = -0.035 }, -- hat - -- [0x002DC] = { yoffset = -0.035 }, -- tilde - -- [0x000AF] = { yoffset = -0.05 }, -- bar - -- [0x002D8] = { yoffset = -0.035 }, -- breve - [0x002D9] = { yoffset = -0.02 }, -- dot - [0x000A8] = { yoffset = -0.02 }, -- ddot - [0x020DB] = { yoffset = 0.04 }, -- dddot - -- [0x002DA] = { yoffset = -0.05 }, -- ring - -- [0x002C7] = { yoffset = -0.05 }, -- check - [0x020D7] = { yoffset = -0.07 }, -- vec + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - -- [0x00300] = { yoffset = -0.07, all=true }, -- widegrave - -- [0x00301] = { yoffset = -0.07, all=true }, -- wideacute - -- [0x00302] = { yoffset = -0.02, all=true }, -- widehat - -- [0x00303] = { yoffset = -0.02, all=true }, -- widetilde - -- [0x00304] = { yoffset = -0.05, all=true }, -- widebar - -- [0x00306] = { yoffset = -0.03, all=true }, -- widebreve - -- [0x00307] = { yoffset = -0.03, all=true }, -- widedot - -- [0x00308] = { yoffset = -0.03, all=true }, -- wideddot - -- [0x020DB] = { yoffset = 0, all=true }, -- widedddot - -- [0x0030A] = { yoffset = -0.05, all=true }, -- widering + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + [0x020DB] = { yoffset = 0.025, height = .95, all = true }, -- widedddot : 0x20DB (self) }, }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + { tweak = "fixprimes", scale = 1, @@ -168,6 +190,35 @@ return { { tweak = "addrules", }, + { + tweak = "addarrows", + }, + { + tweak = "fixslashes", + }, + { -- already exists, but not good spacing + tweak = "addbars", + advance = 0.4, + }, + { + tweak = "addfourier", + variant = 1, + }, +{ + tweak = "addparts", + list = { + [0x21F4] = { + horizontal = true, + template = 0x2192, + sequence = { + { glyph = "first", factor = 2 }, + { glyph = 0x2022, }, + { glyph = "first", factor = 2 }, + { glyph = "last" }, + } + } + } +}, }, }, bigslots = { diff --git a/tex/context/fonts/mkiv/termes-math.lfg b/tex/context/fonts/mkiv/termes-math.lfg index f45ee4433..c5bcb3e84 100644 --- a/tex/context/fonts/mkiv/termes-math.lfg +++ b/tex/context/fonts/mkiv/termes-math.lfg @@ -33,6 +33,9 @@ return { parameters = { NoLimitSupFactor = 0, NoLimitSubFactor = 900, + AccentTopShiftUp = -15, + FlattenedAccentTopShiftUp = -15, + -- AccentExtendMargin = 50, -- AccentBaseHeight = 0, AccentBaseDepth = 50, RadicalDegreeBottomRaisePercent = 60, @@ -125,11 +128,56 @@ return { ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, + }, + }, + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. + { + tweak = "dimensions", + list = { + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + -- [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) }, }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + { tweak = "fixprimes", scale = 0.85, @@ -148,6 +196,20 @@ return { { tweak = "addrules", }, + { + tweak = "addbars", + advance = 0.3, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, + { + tweak = "addfourier", + variant = 1, + }, }, }, bigslots = { diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml index e7e05ec5c..d0ccd5522 100644 --- a/tex/context/interface/mkii/keys-nl.xml +++ b/tex/context/interface/mkii/keys-nl.xml @@ -876,6 +876,7 @@ <cd:constant name='frameradius' value='kaderstraal'/> <cd:constant name='frames' value='hokjes'/> <cd:constant name='freeregion' value='vrijgebied'/> + <cd:constant name='freezespacing' value='freezespacing'/> <cd:constant name='from' value='van'/> <cd:constant name='functioncolor' value='functioncolor'/> <cd:constant name='functionstyle' value='functionstyle'/> @@ -956,6 +957,7 @@ <cd:constant name='lastpubsep' value='lastpubsep'/> <cd:constant name='layout' value='layout'/> <cd:constant name='left' value='links'/> + <cd:constant name='leftclass' value='leftclass'/> <cd:constant name='leftcolor' value='linkerkleur'/> <cd:constant name='leftcompoundhyphen' value='linkerkoppelteken'/> <cd:constant name='leftedge' value='linkerrand'/> @@ -1014,6 +1016,7 @@ <cd:constant name='menu' value='menu'/> <cd:constant name='method' value='methode'/> <cd:constant name='middle' value='midden'/> + <cd:constant name='middleclass' value='middleclass'/> <cd:constant name='middlecolor' value='middenkleur'/> <cd:constant name='middlecommand' value='middencommando'/> <cd:constant name='middlesource' value='middlesource'/> @@ -1060,6 +1063,8 @@ <cd:constant name='numberconversionset' value='numberconversionset'/> <cd:constant name='numberdistance' value='nummerafstand'/> <cd:constant name='numbering' value='nummeren'/> + <cd:constant name='numberlocation' value='numberlocation'/> + <cd:constant name='numbermethod' value='nummermethode'/> <cd:constant name='numberorder' value='numberorder'/> <cd:constant name='numberprefix' value='numberprefix'/> <cd:constant name='numbersegments' value='numbersegments'/> @@ -1070,6 +1075,7 @@ <cd:constant name='numberstopper' value='numberstopper'/> <cd:constant name='numberstrut' value='nummerstrut'/> <cd:constant name='numberstyle' value='nummerletter'/> + <cd:constant name='numberthreshold' value='numberthreshold'/> <cd:constant name='numberwidth' value='nummerbreedte'/> <cd:constant name='nx' value='nx'/> <cd:constant name='ny' value='ny'/> @@ -1123,6 +1129,7 @@ <cd:constant name='palet' value='palet'/> <cd:constant name='paper' value='papier'/> <cd:constant name='paragraph' value='alinea'/> + <cd:constant name='penalties' value='penalties'/> <cd:constant name='period' value='period'/> <cd:constant name='place' value='plaatsen'/> <cd:constant name='placehead' value='plaatskop'/> @@ -1176,6 +1183,7 @@ <cd:constant name='reverse' value='omgekeerd'/> <cd:constant name='right' value='rechts'/> <cd:constant name='rightchars' value='rightchars'/> + <cd:constant name='rightclass' value='rightclass'/> <cd:constant name='rightcolor' value='rechterkleur'/> <cd:constant name='rightcompoundhyphen' value='rechterkoppelteken'/> <cd:constant name='rightedge' value='rechterrand'/> diff --git a/tex/context/modules/mkxl/m-gimmicks.mkxl b/tex/context/modules/mkxl/m-gimmicks.mkxl new file mode 100644 index 000000000..e2659ae99 --- /dev/null +++ b/tex/context/modules/mkxl/m-gimmicks.mkxl @@ -0,0 +1,89 @@ +%D \module +%D [ file=m-gimmicks, +%D version=2022.07.25 +%D title=\CONTEXT\ Extra Modules, +%D subtitle=Whatever comes up, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\def\MacScale {.7}% +\def\MacRule {.05}% +\def\MacDistance {.05}% +\def\MacKern {0}% + +\protected\def\Mac + {\dontleavehmode + \begingroup + \scratchwidth \fontcharwd\font`M\relax + \scratchdistance\MacScale\fontcharwd\font`c\relax + \scratchoffset \dimexpr\fontcharht\font`M -\MacScale\fontcharht\font`c\relax + \scratchdepth \MacRule\exheight + \kern\scratchwidth + \vrule + width \scratchdistance + height \dimexpr \scratchoffset- \scratchdepth-\MacDistance\exheight\relax + depth \dimexpr-\scratchoffset+2\scratchdepth+\MacDistance\exheight\relax + \relax + \kern-\dimexpr\scratchwidth+\scratchdistance\relax + M% + \glyphscale\numexpr\numericscale\MacScale*\glyphyscale/\plusthousand\relax + \glyph + yoffset \scratchoffset `c + \kern\MacKern\emwidth + \endgroup} + +\continueifinputfile{m-gimmicks.mkxl} + +% Question on mailing list: + +\chardef\MacAnulty = \getprivateglyphslot{MacAnulty} + +\startsetups [box:demo:\number\MacAnulty] + \Mac Anulty +\stopsetups + +\registerboxglyph category {demo} unicode \MacAnulty \relax + +\startluacode + fonts.handlers.otf.addfeature { + name = "mcanulty", + type = "ligature", + nocheck = true, + data = { + -- [\number\MacAnulty] = { "M", "c", "A", "n", "u", "l", "t", "y", }, + [fonts.constructors.privateslots.MacAnulty] = { "M", "c", "A", "n", "u", "l", "t", "y", }, + } + } +\stopluacode + +\definefontfeature[whatever][default][box=demo,mcanulty=yes] + +\startTEXpage [offset=10dk] +% \def\Test#1{% +% \begingroup +% #1% +% \dostepwiserecurse{5}{8}{1}{ +% \def\MacScale{.##1}% +% \Mac Anulty +% \par +% } +% \endgroup +% } +% \Test\tf +% \Test\bf +% \Test\it +% \Test\sl +% \Test\bfb +% \def\MacScale{.6} +% \def\MacKern {-.1} +% \Mac Anulty + +\definedfont[Serif*whatever] McAnulty\quad \MacAnulty\par +\definedfont[SerifBold*whatever] McAnulty\quad \MacAnulty\par + +\stopTEXpage diff --git a/tex/context/modules/mkxl/m-oldmath.mkxl b/tex/context/modules/mkxl/m-oldmath.mkxl index 248ff66bd..3594385ff 100644 --- a/tex/context/modules/mkxl/m-oldmath.mkxl +++ b/tex/context/modules/mkxl/m-oldmath.mkxl @@ -135,7 +135,8 @@ \permanent\protected\def\pmatrix#1% {\left(\matrix{#1}\right)} - +\permanent\protected\def\root#1\of% #2% + {\rootradical{#1}} % {#2} \protect diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 05086a7f8..45f32e90b 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2022-08-05 17:16 +-- merge date : 2022-08-25 17:38 do -- begin closure to overcome local limits and interference @@ -13702,8 +13702,13 @@ local result={} local justpass=false local seacs={} local procidx=nil - local function showstate(where) - report("%w%-10s : [%s] n=%i",depth*2,where,concat(stack," ",1,top),top) + local function showstate(where,i,n) + if i then + local j=i+n-1 + report("%w%-10s : [%s] step",depth*2+2,where,concat(stack," ",i,j<=top and j or top)) + else + report("%w%-10s : [%s] n=%i",depth*2,where,concat(stack," ",1,top),top) + end end local function showvalue(where,value,showstack) if showstack then @@ -13819,9 +13824,9 @@ local result={} ymin=y end end - local function xycurveto(x1,y1,x2,y2,x3,y3) + local function xycurveto(x1,y1,x2,y2,x3,y3,i,n) if trace_charstrings then - showstate("curveto") + showstate("curveto",i,n) end if keepcurve then r=r+1 @@ -13958,6 +13963,15 @@ local result={} if trace_charstrings then showstate("rrcurveto") end +if top==6 then + local ax=x+stack[1] + local ay=y+stack[2] + local bx=ax+stack[3] + local by=ay+stack[4] + x=bx+stack[5] + y=by+stack[6] + xycurveto(ax,ay,bx,by,x,y,1,6) +else for i=1,top,6 do local ax=x+stack[i] local ay=y+stack[i+1] @@ -13965,8 +13979,9 @@ local result={} local by=ay+stack[i+3] x=bx+stack[i+4] y=by+stack[i+5] - xycurveto(ax,ay,bx,by,x,y) + xycurveto(ax,ay,bx,by,x,y,i,6) end +end top=0 end local function hhcurveto() @@ -13978,6 +13993,15 @@ local result={} y=y+stack[1] s=2 end +if top==4 then + local ax=x+stack[1] + local ay=y + local bx=ax+stack[2] + local by=ay+stack[3] + x=bx+stack[4] + y=by + xycurveto(ax,ay,bx,by,x,y,1,4) +else for i=s,top,4 do local ax=x+stack[i] local ay=y @@ -13985,8 +14009,9 @@ local result={} local by=ay+stack[i+2] x=bx+stack[i+3] y=by - xycurveto(ax,ay,bx,by,x,y) + xycurveto(ax,ay,bx,by,x,y,i,4) end +end top=0 end local function vvcurveto() @@ -13999,6 +14024,16 @@ local result={} d=stack[1] s=2 end +if top==4 then + local ax=x+d + local ay=y+stack[1] + local bx=ax+stack[2] + local by=ay+stack[3] + x=bx + y=by+stack[4] + xycurveto(ax,ay,bx,by,x,y,1,4) + d=0 +else for i=s,top,4 do local ax=x+d local ay=y+stack[i] @@ -14006,9 +14041,10 @@ local result={} local by=ay+stack[i+2] x=bx y=by+stack[i+3] - xycurveto(ax,ay,bx,by,x,y) + xycurveto(ax,ay,bx,by,x,y,i,4) d=0 end +end top=0 end local function xxcurveto(swap) @@ -14016,6 +14052,33 @@ local result={} if last then top=top-1 end +if top==4 then + local ax,ay,bx,by + if swap then + ax=x+stack[1] + ay=y + bx=ax+stack[2] + by=ay+stack[3] + y=by+stack[4] + if last then + x=bx+last + else + x=bx + end + else + ax=x + ay=y+stack[1] + bx=ax+stack[2] + by=ay+stack[3] + x=bx+stack[4] + if last then + y=by+last + else + y=by + end + end + xycurveto(ax,ay,bx,by,x,y,1,4) +else for i=1,top,4 do local ax,ay,bx,by if swap then @@ -14043,8 +14106,9 @@ local result={} end swap=true end - xycurveto(ax,ay,bx,by,x,y) + xycurveto(ax,ay,bx,by,x,y,i,4) end +end top=0 end local function hvcurveto() @@ -14070,7 +14134,7 @@ local result={} local by=ay+stack[i+3] x=bx+stack[i+4] y=by+stack[i+5] - xycurveto(ax,ay,bx,by,x,y) + xycurveto(ax,ay,bx,by,x,y,i,6) end x=x+stack[top-1] y=y+stack[top] @@ -15214,26 +15278,35 @@ local function readfdselect(f,fontdata,data,glyphs,doshapes,version,streams) end end else + report("unsupported fd index format %i",format) end if maxindex>=0 then local cidarray=cid.fdarray if cidarray then setposition(f,header.offset+cidarray) local dictionaries=readlengths(f,version=="cff2") - for i=1,#dictionaries do - dictionaries[i]=readstring(f,dictionaries[i]) - end - parsedictionaries(data,dictionaries) - cid.dictionaries=dictionaries - readcidprivates(f,data) - for i=1,#dictionaries do - readlocals(f,data,dictionaries[i],version) - end - startparsing(fontdata,data,streams) - for i=1,#charstrings do - parsecharstring(fontdata,data,dictionaries[fdindex[i]+1],charstrings[i],glyphs,i,doshapes,version,streams) + if #dictionaries>0 then + for i=1,#dictionaries do + dictionaries[i]=readstring(f,dictionaries[i]) + end + parsedictionaries(data,dictionaries) + cid.dictionaries=dictionaries + readcidprivates(f,data) + for i=1,#dictionaries do + readlocals(f,data,dictionaries[i],version) + end + startparsing(fontdata,data,streams) + for i=1,#charstrings do + local dictionary=dictionaries[fdindex[i]+1] + if dictionary then + parsecharstring(fontdata,data,dictionary,charstrings[i],glyphs,i,doshapes,version,streams) + else + end + end + stopparsing(fontdata,data) + else + report("no cid dictionaries") end - stopparsing(fontdata,data) else report("no cid array") end diff --git a/tex/generic/context/luatex/luatex-pdf.tex b/tex/generic/context/luatex/luatex-pdf.tex index 569f8664f..6e12575e9 100644 --- a/tex/generic/context/luatex/luatex-pdf.tex +++ b/tex/generic/context/luatex/luatex-pdf.tex @@ -137,6 +137,7 @@ \xdef\pdfgentounicode {\pdfvariable gentounicode} \xdef\pdfomitcidset {\pdfvariable omitcidset} \xdef\pdfomitcharset {\pdfvariable omitcharset} + \xdef\pdfomitinfodict {\pdfvariable omitinfodict} \xdef\pdfpagebox {\pdfvariable pagebox} \xdef\pdfmajorversion {\pdfvariable majorversion} \xdef\pdfminorversion {\pdfvariable minorversion} @@ -182,6 +183,7 @@ \global\pdfgentounicode 0 % \global\pdfomitcidset 0 % \global\pdfomitcharset 0 + % \global\pdfomitinfodict 0 \global\pdfpagebox 0 % \global\pdfmajorversion 1 \global\pdfminorversion 4 |