diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-11-24 15:29:57 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-11-24 15:29:57 +0100 |
commit | 4f3937859f3619e397cf38e220e59eb26ade73e2 (patch) | |
tree | 398dd98cd403521c016a40bedd2a87124a4da4dc /tex | |
parent | 8d75b6caf54310bf17db7e5a9d91939fe97c4036 (diff) | |
download | context-4f3937859f3619e397cf38e220e59eb26ade73e2.tar.gz |
2021-11-24 15:18:00
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/mkii/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkii/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/math-frc.lua | 38 | ||||
-rw-r--r-- | tex/context/base/mkiv/meta-imp-mat.mkiv | 5 | ||||
-rw-r--r-- | tex/context/base/mkiv/mult-prm.lua | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 24780 -> 24749 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 257126 -> 257136 bytes | |||
-rw-r--r-- | tex/context/base/mkxl/cont-new.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/context.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/math-act.lmt | 28 | ||||
-rw-r--r-- | tex/context/base/mkxl/math-frc.lmt | 91 | ||||
-rw-r--r-- | tex/context/base/mkxl/math-frc.mkxl | 2 | ||||
-rw-r--r-- | tex/context/base/mkxl/math-ini.mkxl | 50 | ||||
-rw-r--r-- | tex/context/base/mkxl/math-pre.lmt | 106 | ||||
-rw-r--r-- | tex/context/fonts/mkiv/asana-math.lfg | 1 | ||||
-rw-r--r-- | tex/context/fonts/mkiv/termes-math.lfg | 4 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
19 files changed, 265 insertions, 76 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 607ada2e8..f6691f252 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.11.22 22:27} +\newcontextversion{2021.11.24 15:16} %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 d57d70feb..1a6bc2ed0 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.11.22 22:27} +\edef\contextversion{2021.11.24 15:16} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 2f16ce08f..c9f60da6c 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.11.22 22:27} +\newcontextversion{2021.11.24 15:16} %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 99f6ee104..c9393a335 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{2021.11.22 22:27} +\edef\contextversion{2021.11.24 15:16} %D Kind of special: diff --git a/tex/context/base/mkiv/math-frc.lua b/tex/context/base/mkiv/math-frc.lua index fa3ac515f..4a04c9203 100644 --- a/tex/context/base/mkiv/math-frc.lua +++ b/tex/context/base/mkiv/math-frc.lua @@ -57,41 +57,3 @@ interfaces.implement { actions = mathfraction, arguments = { "string", "number", "number", "dimen" } } - --- experimental code in lmtx - -if CONTEXTLMTXMODE > 0 then - - local ctx_Uatop = context.Uatop - local ctx_Uover = context.Uover - - local function umathfraction(how,left,right,width) - if how == v_no then - if left == 0x002E and right == 0x002E then - ctx_Uatop() - else - context("\\Uatopwithdelims%s%s",resolved[left],resolved[right]) - end - elseif how == v_yes or how == v_hidden then - local norule = how == v_hidden and " norule " or "" - if left == 0x002E and right == 0x002E then - context("\\Uabove%s%ssp",norule,width) - else - context("\\Uabovewithdelims%s%s%s%ssp",norule,resolved[left],resolved[right],width) - end - else -- v_auto - if left == 0x002E and right == 0x002E then - ctx_Uover() - else - context("\\Uoverwithdelims%s%s",resolved[left],resolved[right]) - end - end - end - - interfaces.implement { - name = "umathfraction", - actions = umathfraction, - arguments = { "string", "number", "number", "dimen" } - } - -end diff --git a/tex/context/base/mkiv/meta-imp-mat.mkiv b/tex/context/base/mkiv/meta-imp-mat.mkiv index e1b5d9d00..79757b6a9 100644 --- a/tex/context/base/mkiv/meta-imp-mat.mkiv +++ b/tex/context/base/mkiv/meta-imp-mat.mkiv @@ -257,5 +257,10 @@ $ \underleftarrow {a+b+c+d} \quad \underrightarrow {a+b+c+d} $ +\blank[2*big] +\setupmathradical[sqrt][alternative=mp,color=darkgreen] +$ + \sqrt[2]{a+b+c+d} \quad +$ \stopTEXpage diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index d29f06934..3fd680c20 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -238,6 +238,8 @@ return { "Umathunderlinevariant", "Umathvextensiblevariant", "Umathvoid", + "Umathxscale", + "Umathyscale", "Umiddle", "Unosubprescript", "Unosubscript", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 70dda4720..6e310ba05 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 20e4c0345..fbb5dddc8 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index ce18d555f..acab1e472 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.11.22 22:27} +\newcontextversion{2021.11.24 15:16} %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 dd39ba19b..36991e8e6 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.11.22 22:27} +\immutable\edef\contextversion{2021.11.24 15:16} %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 05df5eea6..6183d073a 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -190,15 +190,19 @@ local mathtweaks = { } mathematics.tweaks = mathtweaks local function report_tweak(fmt,target,original,...) - local metadata = original.shared.rawdata.metadata - local parameters = target.parameters - report_mathtweak( - "%a, size %p, math size %i, %s", - metadata and metadata.fontname or "unknown", - parameters.size or 655360, - parameters.mathsize or 1, - string.formatters[fmt](...) - ) + if fmt then + local metadata = original.shared.rawdata.metadata + local parameters = target.parameters + report_mathtweak( + "%a, size %p, math size %i, %s", + metadata and metadata.fontname or "unknown", + parameters.size or 655360, + parameters.mathsize or 1, + string.formatters[fmt](...) + ) + else + report_mathtweak("") + end end do @@ -596,12 +600,18 @@ do if version then local expected = parameters.expected local fontname = metadata.fontname or false + local message = parameters.message -- version = tonumber(string.match(version,"%d+.%d+")) if version ~= expected and not reported[fontname] then report_tweak("version %a found, version %a expected",target,original,version,expected) elseif trace_tweaking then report_tweak("version %a found",target,original,version) end + if message and message ~= "" and not reported[fontname] then + report_tweak() + report_tweak("%s",target,original,message) + report_tweak() + end reported[fontname] = true end end diff --git a/tex/context/base/mkxl/math-frc.lmt b/tex/context/base/mkxl/math-frc.lmt new file mode 100644 index 000000000..cf35897ce --- /dev/null +++ b/tex/context/base/mkxl/math-frc.lmt @@ -0,0 +1,91 @@ +if not modules then modules = { } end modules ['math-frc'] = { + version = 1.001, + comment = "companion to math-frc.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local utfchar = utf.char + +local context = context +local variables = interfaces.variables + +local v_no = variables.no +local v_yes = variables.yes +local v_hidden = variables.hidden + +local resolved = { + [0x007B] = "\\{", + [0x007D] = "\\}", +} + +table.setmetatableindex(resolved, function(t,k) + local v = utfchar(k) + t[k] = v + return v +end) + +local ctx_normalatop = context.normalatop +local ctx_normalover = context.normalover + +local function mathfraction(how,left,right,width) + if how == v_no then + if left == 0x002E and right == 0x002E then + ctx_normalatop() + else + context("\\atopwithdelims%s%s",resolved[left],resolved[right]) + end + elseif how == v_yes or how == v_hidden then + local norule = how == v_hidden and LUATEXFUNCTIONALITY > 7361 and " norule " or "" + if left == 0x002E and right == 0x002E then + context("\\normalabove%s%s%ssp",norule,width) + else + context("\\abovewithdelims%s%s%s%s%ssp",norule,resolved[left],resolved[right],width) + end + else -- v_auto + if left == 0x002E and right == 0x002E then + ctx_normalover() + else + context("\\overwithdelims%s%s",resolved[left],resolved[right]) + end + end +end + +interfaces.implement { + name = "mathfraction", + actions = mathfraction, + arguments = { "string", "number", "number", "dimen" } +} + +local ctx_Uatop = context.Uatop +local ctx_Uover = context.Uover + +local function umathfraction(how,left,right,width) + if how == v_no then + if left == 0x002E and right == 0x002E then + ctx_Uatop() + else + context("\\Uatopwithdelims%s%s",resolved[left],resolved[right]) + end + elseif how == v_yes or how == v_hidden then + local norule = how == v_hidden and " norule " or "" + if left == 0x002E and right == 0x002E then + context("\\Uabove%s%ssp",norule,width) + else + context("\\Uabovewithdelims%s%s%s%ssp",norule,resolved[left],resolved[right],width) + end + else -- v_auto + if left == 0x002E and right == 0x002E then + ctx_Uover() + else + context("\\Uoverwithdelims%s%s",resolved[left],resolved[right]) + end + end +end + +interfaces.implement { + name = "umathfraction", + actions = umathfraction, + arguments = { "string", "number", "number", "dimen" } +} diff --git a/tex/context/base/mkxl/math-frc.mkxl b/tex/context/base/mkxl/math-frc.mkxl index 7e2266f2f..8d47e2883 100644 --- a/tex/context/base/mkxl/math-frc.mkxl +++ b/tex/context/base/mkxl/math-frc.mkxl @@ -26,7 +26,7 @@ %D This module is reimplemented in \MKIV\ style. -\registerctxluafile{math-frc}{} +\registerctxluafile{math-frc}{autosuffix} %D \macros %D {frac, xfrac, xxfrac} diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index 774a7ff28..a5f4ac529 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -3044,6 +3044,56 @@ \def\math_relax_limits{\enforced\let\limits\relax} +%D Something new: +%D +%D \starttyping +%D \definemathpreset[whatever][factor=.5,style=all,list={fraction*gap}] +%D % \presetmathematics[whatever] % less more zero +%D \stoptyping +%D +%D as well as: +%D +%D \starttyping +%D \setupmathspacing[narrow] +%D \stoptyping + +\installcorenamespace{mathspacing} + +\protected\def\math_spacing_set#1#2% maybe some day \allmathstyles + {\relax + #1\displaystyle #2% + #1\crampeddisplaystyle#2% + #1\textstyle #2% + #1\scriptstyle #2% + #1\crampedscriptstyle #2% + #1\scriptstyle #2% + #1\crampedscriptstyle #2% + \relax} + +\permanent\tolerant\protected\def\definemathspacing[#1]#*[#2]#*[#3]% + {\ifcstok{#2}\v!horizontal + \edefcsname\??mathspacing#1\endcsname + {\math_spacing_set\Umathxscale{\ifchknum#3\or#3\else\plusthousand\fi\relax}}% + \orelse\ifcstok{#2}\v!vertical + \edefcsname\??mathspacing#1\endcsname + {\math_spacing_set\Umathyscale{\ifchknum#3\or#3\else\plusthousand\fi\relax}}% + \else + \edefcsname\??mathspacing#1\endcsname + {\math_spacing_set\Umathxscale{\ifchknum#2\or\number#2\else\plusthousand\fi\relax}% + \math_spacing_set\Umathyscale{\ifchknum#3\or\number#3\orelse\ifchknum#2\or\number#2\else\plusthousand\fi\relax}}% + \fi} + +\definemathspacing[\v!normal] [1000] [1000] +\definemathspacing[\v!tight] [\c!vertical] [900] +\definemathspacing[\v!loose] [\c!vertical] [1100] +\definemathspacing[\v!narrow][\c!horizontal] [900] +\definemathspacing[\v!wide] [\c!horizontal] [1100] +\definemathspacing[\v!less] [900] [900] +\definemathspacing[\v!more] [1100] [1100] + +\permanent\protected\def\setupmathspacing[#1]% + {\begincsname\??mathspacing#1\endcsname} + \protect \endinput % % not used (yet) diff --git a/tex/context/base/mkxl/math-pre.lmt b/tex/context/base/mkxl/math-pre.lmt index d10f80cfe..974623f27 100644 --- a/tex/context/base/mkxl/math-pre.lmt +++ b/tex/context/base/mkxl/math-pre.lmt @@ -7,24 +7,50 @@ if not modules then modules = { } end modules ['math-pre'] = { license = "see context related readme files" } -local type = type -local gmatch = string.gmatch +local type, tonumber = type, tonumber +local gmatch, find, topattern = string.gmatch, string.find, string.topattern -local h1 = table.swapped(tex.getmathparametervalues()) -local h2 = table.swapped(tex.getmathstylenamevalues()) +local parameterlist = tex.getmathparametervalues() +local mathstylelist = tex.getmathstylenamevalues() +local parameterhash = table.swapped(parameterlist) +local mathstylehash = table.swapped(mathstylelist) -local axis = h1.axis +local axis = parameterhash.axis local getmath = tex.getmath local setmath = tex.setmath +local function expandparameters(t) + local result = { } + local kind = type(t) + local function expand(s) + s = topattern(s) + for i=1,#parameterlist do + local p = parameterlist[i] + if find(p,s) then + result[#result+1] = p + end + end + end + if kind == "string" then + for s in gmatch(t,"[^%s,]+") do + expand(s) + end + elseif kind == "table" then + for i=1,#t do + expand(t[i]) + end + end + return result +end + function setmathparameters(t) if t then for i=1,#t do local ti = t[i] local list = ti.list local factor = ti.factor or 1 - local styles = ti.styles + local style = ti.style local value = ti.value local unit = ti.unit @@ -41,20 +67,20 @@ function setmathparameters(t) end for i=1,#list do - local li = h1[list[i]] + local li = parameterhash[list[i]] if li then - if styles == "all" then + if style == "all" then for si=0,7 do set(li,si,value) end - elseif type(styles) == "string" then - local si = h2[styles] + elseif type(style) == "string" then + local si = mathstylehash[style] if si then set(li,si,value) end else - for s=1,#styles do - local si = h2[styles[s]] + for s=1,#style do + local si = mathstylehash[style[s]] if si then set(li,si,value) end @@ -66,6 +92,8 @@ function setmathparameters(t) end end +-- example + local stacklist = { "fractionnumvgap", "fractiondenomvgap", @@ -84,35 +112,74 @@ local presets = { -- value = 655360, -- unit = "axis", list = stacklist, - -- styles = { "display" }, - -- styles = "display", - styles = "all" + -- style = { "display" }, + -- style = "display", + style = "all" }, }, more = { { factor = 2, list = stacklist, - styles = "all" + style = "all" }, }, zero = { { factor = 0, list = stacklist, - styles = "all" + style = "all" }, }, } -mathematics.presets = presets +mathematics.presets = presets -- we might need to store these in the format file function mathematics.preset(list) - for s in gmatch(list,"[%S,]+") do + for s in gmatch(list,"[^%s,]+") do setmathparameters(presets[s]) end end +-- todo: append, prepend, inherit + +interfaces.implement { + name = "definemathpreset", + public = true, + protected = true, + arguments = { "optional", "hash" }, + actions = function(name,t) + if next(t) then + local factor = t.factor + local style = t.style + local list = t.list + local unit = t.unit + if factor then + t.factor = tonumber(factor) + end + if style and style ~= "all" then + t.style = utilities.parsers.settings_to_array(style) + end + if list then + -- t.list = utilities.parsers.settings_to_array(list) + t.list = expandparameters(list) + end + if unit and unit ~= "axis" then + t.unit = nil + end + -- todo: value + local p = presets[name] + if p then + p[#p+1] = t + else + presets[name] = t + end + else + presets[name] = nil + end + end, +} + interfaces.implement { name = "presetmathematics", public = true, @@ -120,4 +187,3 @@ interfaces.implement { arguments = "optional", actions = mathematics.preset, } - diff --git a/tex/context/fonts/mkiv/asana-math.lfg b/tex/context/fonts/mkiv/asana-math.lfg index f7fd4ba96..63e2aab69 100644 --- a/tex/context/fonts/mkiv/asana-math.lfg +++ b/tex/context/fonts/mkiv/asana-math.lfg @@ -42,6 +42,7 @@ return { { tweak = "version", expected = "Version 000.958", + message = "this font is not supported", }, { tweak = "dimensions", diff --git a/tex/context/fonts/mkiv/termes-math.lfg b/tex/context/fonts/mkiv/termes-math.lfg index 1de85483c..fe6cc7956 100644 --- a/tex/context/fonts/mkiv/termes-math.lfg +++ b/tex/context/fonts/mkiv/termes-math.lfg @@ -34,7 +34,9 @@ return { { tweak = "dimensions", list = { - -- nothing yet + [0x1D453] = { 0.6, 1.4, 1.2 }, -- f + [0x1D457] = { 0.5, 1.3, 1.7 }, -- j + [0x1D45D] = { 0.15, 1.15, 0 }, -- p }, }, { diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 6709446e6..9e290295f 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-11-22 22:27 +-- merge date : 2021-11-24 15:16 do -- begin closure to overcome local limits and interference |