diff options
Diffstat (limited to 'tex')
23 files changed, 175 insertions, 24 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 82a268348..b85af351e 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.09.10 02:42} +\newcontextversion{2022.09.11 20:42} %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 f2ca9aba1..9ec0966b5 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.09.10 02:42} +\edef\contextversion{2022.09.11 20:42} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-de.mkii b/tex/context/base/mkii/mult-de.mkii index cd526730e..6ee6ea7d3 100644 --- a/tex/context/base/mkii/mult-de.mkii +++ b/tex/context/base/mkii/mult-de.mkii @@ -676,6 +676,7 @@ \setinterfaceconstant{authoretaltext}{authoretaltext} \setinterfaceconstant{auto}{auto} \setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofencing}{autofencing} \setinterfaceconstant{autofile}{autofile} \setinterfaceconstant{autofocus}{autofocus} \setinterfaceconstant{autohang}{autohang} diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua index 1701aeb3b..57061735b 100644 --- a/tex/context/base/mkiv/char-def.lua +++ b/tex/context/base/mkiv/char-def.lua @@ -1392,6 +1392,10 @@ characters.data={ name="lvert", }, { + class="middle", + name="mvert", + }, + { class="close", name="rvert", }, @@ -62449,6 +62453,10 @@ characters.data={ name="lVert", }, { + class="middle", + name="mVert", + }, + { class="close", name="rVert", }, diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 3ce44cab3..21bd1470a 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.09.10 02:42} +\newcontextversion{2022.09.11 20:42} %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 12f23d73f..0d89ea361 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.09.10 02:42} +\edef\contextversion{2022.09.11 20:42} %D Kind of special: diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index ca465b8c8..6a6c41a4c 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -7636,6 +7636,10 @@ return { ["en"]="autospacing", ["fr"]="autospacing", }, + ["autofencing"]={ + ["en"]="autofencing", + ["fr"]="autofencing", + }, ["autonumbers"]={ ["en"]="autonumbers", ["fr"]="autonumbers", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 3e3adfbe6..517ab30c3 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 28adce871..07a782d8f 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-sql.lua b/tex/context/base/mkiv/util-sql.lua index 579bd7c09..55c4961f7 100644 --- a/tex/context/base/mkiv/util-sql.lua +++ b/tex/context/base/mkiv/util-sql.lua @@ -121,7 +121,7 @@ if optional then local m = methods[k] if m then report_state("start loading method %a as %a",k,m) - require("libs-imp-" .. m .. "lmt") -- brrr + require("libs-imp-" .. m .. ".lmt") -- brrr report_state("loading method %a done",k) return rawget(t,m) else diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index a9631b7bb..6fc406a17 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.09.10 02:42} +\newcontextversion{2022.09.11 20:42} %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 4ec59e791..47e196a62 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.09.10 02:42} +\immutable\edef\contextversion{2022.09.11 20:42} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index 4f12bf92e..687f5fed5 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -2208,10 +2208,12 @@ do ["end"] = used, glyph = unicode, start = 0, + -- start = used/5, }, { advance = total, - ["end"] = 0, + -- ["end"] = 0, + ["end"] = used/5, -- prevents small gap with inward curved endpoints extender = 1, glyph = unicode, start = used, @@ -2226,7 +2228,8 @@ do local height = basechar.height local depth = basechar.depth local advance = (parameters.advance or 1/10) * width - local used = 0.8*height + -- local used = 0.8*height + local used = 1.2*height -- large overlap because no smaller pieces local total = height + depth characters[single].vparts = extensible(single,total,used) characters[double] = { diff --git a/tex/context/base/mkxl/math-fen.mkxl b/tex/context/base/mkxl/math-fen.mkxl index 5dd7ee118..7cb775294 100644 --- a/tex/context/base/mkxl/math-fen.mkxl +++ b/tex/context/base/mkxl/math-fen.mkxl @@ -349,7 +349,9 @@ \setfalse\c_math_fenced_sized \let\math_fenced_middle\math_fenced_middle_sized % \enforced\let\middle\math_fenced_middle_sized - #1% +\begingroup + #1% otherwise middle interferes +\endgroup \settrue\c_math_fenced_sized \math_fenced_right \setfalse\c_math_fenced_sized @@ -1122,6 +1124,9 @@ \relax \setmathoptions\mathclosecode\numexpression \setmathoptions\mathclosecode bor \autoinjectclassoptioncode + \relax + \setmathoptions\mathmiddlecode\numexpression + \setmathoptions\mathmiddlecode bor \autoinjectclassoptioncode \relax} \protect diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index a1e5c29a6..ce5f73d74 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -737,6 +737,7 @@ \definesystemattribute[mathvariant] [public] \definesystemattribute[mathnumbers] [public] \definesystemattribute[mathspacing] [public] +\definesystemattribute[mathfencing] [public] \definesystemattribute[displaymath] [public] @@ -2817,6 +2818,26 @@ \setupmathematics [\c!autonumbers=\v!no] +\installcorenamespace{autofencing} + +\permanent\protected\def\enablemathautofencing + {\attribute\mathfencingattribute\plusone + \clf_initializemathfencing} + +\permanent\protected\def\disablemathautofencing + {\attribute\mathfencingattribute\attributeunsetvalue} + +\appendtoks + \ifcstok{\mathematicsparameter\c!autofencing}\v!yes + \enablemathautofencing + \else + \disablemathautofencing + \fi +\to \everysetupmathematics + +\setupmathematics + [\c!autofencing=\v!no] + %D The consequences of setting this are as follows: %D %D \def\TestA#1#2#3% diff --git a/tex/context/base/mkxl/math-noa.lmt b/tex/context/base/mkxl/math-noa.lmt index dfdfa6766..8ac0c1cef 100644 --- a/tex/context/base/mkxl/math-noa.lmt +++ b/tex/context/base/mkxl/math-noa.lmt @@ -96,6 +96,8 @@ local setattrlist = nuts.setattrlist local setwidth = nuts.setwidth local setheight = nuts.setheight local setdepth = nuts.setdepth +local setdelimiter = nuts.setdelimiter +local setclass = nuts.setclass local getfield = nuts.getfield local getnext = nuts.getnext @@ -878,7 +880,7 @@ do local method = div(a,100) local size = a % 100 setattr(pointer,a_mathsize,0) - local delimiter = getfield(pointer,"delimiter") + local delimiter = getdelimiter(pointer) if delimiter then local chr, fnt, fam = getcharspec(delimiter) if chr > 0 and fnt > 0 then @@ -920,8 +922,8 @@ do local dummyfencechar = 0x2E local function makefence(what,char,template) - local d = new_delimiter() -- todo: attr - local f = new_fence() -- todo: attr + local d = new_delimiter() + local f = new_fence() if char then local sym = getnucleus(char) local chr, fnt, fam = getcharspec(sym) @@ -935,8 +937,8 @@ do setattrlist(d,template) setattrlist(f,template) setsubtype(f,what) - setfield(f,"delimiter",d) - setfield(f,"class",-1) -- tex itself does this, so not fenceclasses[what] + setdelimiter(f,d) + setclass(f,-1) -- tex itself does this, so not fenceclasses[what] return f end @@ -1834,9 +1836,11 @@ do local a_numbers = privateattribute("mathnumbers") local a_spacing = privateattribute("mathspacing") + local a_fencing = privateattribute("mathfencing") - local numbers = { } - local spacing = { } + local numbers = { } + local spacing = { } + local fencing = { } local separators = { [0x2E] = { 0x2E, 0x2C, 0x002E, 0x002C, 0x2008, 0x2008 }, -- . -- punctuationspace @@ -1861,6 +1865,18 @@ do [0x2236] = snoloc, } + local middles = { + [0x007C] = true, + [0x2016] = true, + [0x2980] = true, + } + + local singles = { + 0x007C, + 0x2016, + 0x2980, + } + local followedbyspace_code = tex.noadoptioncodes.followedbyspace local function followedbyspace(n) @@ -1942,6 +1958,56 @@ do end end + -- we can share code, see earlier + + local function makefence(chr,fam,subtype,class,template) + local f = new_fence() + local d = new_delimiter() + setchar(d,chr) + setfam(d,fam) + setattrlist(d,template) + setattrlist(f,template) + setsubtype(f,subtype) + setdelimiter(f,d) + setclass(f,class) -- tex itself does this, so not fenceclasses[what] + return f + end + + -- we loose scripts so maybe also copy these + + fencing[mathchar_code] = function(pointer,what,n,parent) + if getattr(pointer,a_fencing) and pointer == getnucleus(parent) then + local oldchar = getcharspec(pointer) + local found = middles[oldchar] + if found then + local prev, next = getboth(parent) + if getcharspec(next) == oldchar then + local nextnext = getnext(next) + -- we need to preserve the followed property + if getcharspec(nextnext) == oldchar then + oldchar = singles[3] + prev, parent = nuts.remove(prev,parent,true) + prev, parent = nuts.remove(prev,parent,true) + else + oldchar = singles[2] + prev, parent = nuts.remove(prev,parent,true) + end + next = getnext(parent) + pointer = getnucleus(parent) + setchar(pointer,oldchar) + end + if followedbyspace(prev) and followedbyspace(parent) then + local chr, fnt, fam = getcharspec(pointer) + local f1 = makefence(0,0,0,0,pointer) + local f2 = makefence(chr,fam,middlefence_code,middle_class,pointer) + setlink(prev,f1,f2,next) + flushnode(parent) + end + return true, parent + end + end + end + -- numbers function handlers.numbers(head,style,penalties) @@ -1970,8 +2036,8 @@ do local enable = function() enableaction("math", "noads.handlers.spacing") - -- if trace_numbers then - -- report_spacing("enabling math spacinf") + -- if trace_spacing then + -- report_spacing("enabling math spacing") -- end enable = false end @@ -1982,6 +2048,26 @@ do onlyonce = true, } + -- fences + + function handlers.fencing(head,style,penalties) + processnoads(head,fencing,"fencing") + end + + local enable = function() + enableaction("math", "noads.handlers.fencing") + -- if trace_fencing then + -- report_fencing("enabling math fencing") + -- end + enable = false + end + + implement { + name = "initializemathfencing", + actions = enable, + onlyonce = true, + } + end -- primes and such diff --git a/tex/context/base/mkxl/node-res.lmt b/tex/context/base/mkxl/node-res.lmt index 5b7ac3fb5..e023499e5 100644 --- a/tex/context/base/mkxl/node-res.lmt +++ b/tex/context/base/mkxl/node-res.lmt @@ -462,6 +462,8 @@ function nutpool.noad(class) return n end +-- maybe also the rest wrt subtype and class + function nutpool.delimiter() return copy_nut(delimiter) end nutpool.delim = nutpool.delimiter function nutpool.fence() return copy_nut(fence) end function nutpool.submlist() return copy_nut(submlist) end diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl index a8d674723..71676c9ec 100644 --- a/tex/context/base/mkxl/strc-mat.mkxl +++ b/tex/context/base/mkxl/strc-mat.mkxl @@ -1319,7 +1319,7 @@ {\raggedright \mathgluemode\plustwo \c_strc_math_ragged_status\plustwo - \strc_math_analyze_box}\stopformula + \strc_math_analyze_box} \def\strc_math_setup_align_auto {\ifcsname\??mathtextalign\formulaparameter\c!align:\v!auto\endcsname diff --git a/tex/context/base/mkxl/task-ini.lmt b/tex/context/base/mkxl/task-ini.lmt index 862192c83..9c90aba02 100644 --- a/tex/context/base/mkxl/task-ini.lmt +++ b/tex/context/base/mkxl/task-ini.lmt @@ -100,6 +100,7 @@ appendaction("shipouts", "wrapup", "luatex.synctex.collect", appendaction("math", "normalizers", "noads.handlers.showtree", nil, "nonut", "disabled" ) appendaction("math", "normalizers", "noads.handlers.numbers", nil, "nonut", "disabled" ) appendaction("math", "normalizers", "noads.handlers.spacing", nil, "nonut", "disabled" ) +appendaction("math", "normalizers", "noads.handlers.fencing", nil, "nonut", "disabled" ) appendaction("math", "normalizers", "noads.handlers.unscript", nil, "nonut", "enabled" ) appendaction("math", "normalizers", "noads.handlers.unstack", nil, "nonut", "disabled" ) appendaction("math", "normalizers", "noads.handlers.relocate", nil, "nonut", "enabled" ) diff --git a/tex/context/interface/mkii/keys-de.xml b/tex/context/interface/mkii/keys-de.xml index 51785d147..ccfa88439 100644 --- a/tex/context/interface/mkii/keys-de.xml +++ b/tex/context/interface/mkii/keys-de.xml @@ -682,6 +682,7 @@ <cd:constant name='authoretaltext' value='authoretaltext'/> <cd:constant name='auto' value='auto'/> <cd:constant name='autocase' value='autocase'/> + <cd:constant name='autofencing' value='autofencing'/> <cd:constant name='autofile' value='autofile'/> <cd:constant name='autofocus' value='autofocus'/> <cd:constant name='autohang' value='autohang'/> diff --git a/tex/context/modules/mkiv/m-sql.mkiv b/tex/context/modules/mkiv/m-sql.mkiv index bb62610ea..fb8c0fe7f 100644 --- a/tex/context/modules/mkiv/m-sql.mkiv +++ b/tex/context/modules/mkiv/m-sql.mkiv @@ -13,14 +13,14 @@ \startmodule[sql] -\registerctxluafile{util-tpl}{} -\registerctxluafile{util-sql}{} - \ifcase\contextlmtxmode\else \registerctxluafile{libs-imp-mysql}{autosuffix} \registerctxluafile{libs-imp-sqlite}{autosuffix} \fi +\registerctxluafile{util-tpl}{} +\registerctxluafile{util-sql}{} + \setupmodule \doifsomething {\currentmoduleparameter{method}}{ diff --git a/tex/context/sample/common/welcome-to-context.tex b/tex/context/sample/common/welcome-to-context.tex new file mode 100644 index 000000000..3e491389b --- /dev/null +++ b/tex/context/sample/common/welcome-to-context.tex @@ -0,0 +1,19 @@ +\setupbodyfont[pagella] + +\starttext + +\startTEXpage[offset=1ex,background=color,backgroundcolor=darkgray,align=middle] + \ifcase\contextlmtxmode + {\red Welcome} + {\white to} + {\blue \ConTeXt} + {\orange \MKIV} + \else + {\red welcome} + {\white to} + {\blue context} + {\orange lmtx} + \fi +\stopTEXpage + +\stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 1b464f549..3d3a952f5 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-09-10 02:42 +-- merge date : 2022-09-11 20:42 do -- begin closure to overcome local limits and interference |