diff options
Diffstat (limited to 'tex')
22 files changed, 251 insertions, 64 deletions
diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua index 29b225446..31412940e 100644 --- a/tex/context/base/char-def.lua +++ b/tex/context/base/char-def.lua @@ -229107,4 +229107,4 @@ characters.data={ linebreak="cm", unicodeslot=0xE01EF, }, -}
\ No newline at end of file +} diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index a21e4b61d..d6cbc3787 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2015.07.16 13:30} +\newcontextversion{2015.07.24 10:27} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 59cfa7455..1b435f700 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 82f556b11..6bc5fa157 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.07.16 13:30} +\edef\contextversion{2015.07.24 10:27} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-cff.lua b/tex/context/base/font-cff.lua index d4acf7dc2..4d5fe7bdc 100644 --- a/tex/context/base/font-cff.lua +++ b/tex/context/base/font-cff.lua @@ -540,7 +540,7 @@ do for i=1,#dictionaries do local private = dictionaries[i].private if private and private.data then - top = 0 + top = 0 result = { forcebold = false, languagegroup = 0, @@ -549,6 +549,9 @@ do subroutines = 0, defaultwidthx = 0, nominalwidthx = 0, + cid = { + -- actually an error + }, } lpegmatch(p_dictionary,private.data) private.data = result diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index da8373c98..84de6026f 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -59,6 +59,7 @@ local fontgoodies = fonts.goodies local helpers = fonts.helpers local hashes = fonts.hashes local currentfont = font.current +local definefont = font.define local encodings = fonts.encodings ----- aglunicodes = encodings.agl.unicodes @@ -1191,7 +1192,7 @@ do -- else too many locals -- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period -- constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference - local id = font.define(tfmdata) + local id = definefont(tfmdata) csnames[id] = specification.cs tfmdata.properties.id = id definers.register(tfmdata,id) -- to be sure, normally already done @@ -1279,7 +1280,7 @@ do -- else too many locals return tfmdata, fontdata[tfmdata] else constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference - local id = font.define(tfmdata) + local id = definefont(tfmdata) tfmdata.properties.id = id definers.register(tfmdata,id) if cs then diff --git a/tex/context/base/font-oup.lua b/tex/context/base/font-oup.lua index e4b433bc6..f0e182be1 100644 --- a/tex/context/base/font-oup.lua +++ b/tex/context/base/font-oup.lua @@ -57,7 +57,7 @@ local function unifyresources(fontdata,indices) return end -- - local variants = fontdata.variants + local variants = fontdata.resources.variants if variants then for selector, unicodes in next, variants do for unicode, index in next, unicodes do diff --git a/tex/context/base/lang-lab.mkiv b/tex/context/base/lang-lab.mkiv index fbe3346dc..1fdd52b4f 100644 --- a/tex/context/base/lang-lab.mkiv +++ b/tex/context/base/lang-lab.mkiv @@ -88,15 +88,15 @@ \setuvalue{start#1text}{\protecttextprefixes1\def\currenttextprefixclass{#1}\dotripleempty\lang_labels_text_prefix_start[#1]}% \letvalue{stop#1text}\relax \def#4{\reallanguagetag{\defaultlanguage\currentmainlanguage}}% - \ifnum#2=\plustwo + \ifnum#2=\plustwo % used for math and tags \def#3{#5#4}% \def#5##1##2% ##1=language {\ifcsname\??label\currentlabelcategory#1:##1:##2\endcsname \csname\??label\currentlabelcategory#1:##1:##2\endcsname \else\ifcsname\??label#1:##1:##2\endcsname \csname\??label#1:##1:##2\endcsname -% \else\ifcsname\??language#4\s!default\endcsname -% \expandafter#5\csname\??language#4\s!default\endcsname{##2}% + % \else\ifcsname\??language#4\s!default\endcsname + % \expandafter#5\csname\??language#4\s!default\endcsname{##2}% \else\ifcsname\??language##1\s!default\endcsname \expandafter#5\csname\??language##1\s!default\endcsname{##2}% \else\ifcsname\??label\currentlabelcategory#1:##2\endcsname diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 93eafac23..83065c6aa 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -84,6 +84,7 @@ \definesystemattribute[mathmode] [public] \definesystemattribute[mathitalics] [public] \definesystemattribute[mathbidi] [public] +\definesystemattribute[mathdomain] [public] \definesystemattribute[displaymath] [public] @@ -2297,6 +2298,23 @@ \fi\fi \relax} +%D Experiment: + +\unexpanded\def\setmathdomain[#1]% + {\clf_setmathdomain{#1}} + +\appendtoks + \edef\p_domain{\mathematicsparameter\c!domain}% + \ifx\currentmathdomain\p_domain \else + \ifx\p_domain\empty + \attribute\mathdomainattribute\attributeunsetvalue + \else + \clf_setmathdomain\p_domain + \fi + \let\currentmathdomain\p_domain + \fi +\to \everysetupmathematics + \protect \endinput % % not used (yet) diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index b911935de..8e0c7e0ed 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -46,6 +46,7 @@ local trace_goodies = false registertracker("math.goodies", function( 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_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) @@ -60,6 +61,7 @@ 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_domains = logreporter("mathematics","domains") local report_families = logreporter("mathematics","families") local report_fences = logreporter("mathematics","fences") @@ -109,6 +111,9 @@ local variables = interfaces.variables local texsetattribute = tex.setattribute local texgetattribute = tex.getattribute local unsetvalue = attributes.unsetvalue +local implement = interfaces.implement + +local v_reset = variables.reset local chardata = characters.data @@ -1030,6 +1035,12 @@ function mathematics.setalternate(fam,tag) end end +implement { + name = "setmathalternate", + actions = mathematics.setalternate, + arguments = { "integer", "string" } +} + alternate[math_char] = function(pointer) local a = getattr(pointer,a_mathalternate) if a and a > 0 then @@ -1268,21 +1279,27 @@ end -- best do this only on math mode (less overhead) -function mathematics.setitalics(n) +function mathematics.setitalics(name) if enable then enable() end - if n == variables.reset then - texsetattribute(a_mathitalics,unsetvalue) - else - texsetattribute(a_mathitalics,tonumber(n) or unsetvalue) - end + texsetattribute(a_mathitalics,name and name ~= v_reset and tonumber(name) or unsetvalue) end function mathematics.resetitalics() texsetattribute(a_mathitalics,unsetvalue) end +implement { + name = "setmathitalics", + actions = mathematics.setitalics +} + +implement { + name = "resetmathitalics", + actions = mathematics.resetitalics +} + -- primes and such local collapse = { } processors.collapse = collapse @@ -1521,6 +1538,147 @@ end registertracker("math.classes",function(v) tasks.setaction("math","noads.handlers.classes",v) end) +-- experimental + +do + + -- mathematics.registerdomain { + -- name = "foo", + -- parents = { "bar" }, + -- characters = { + -- [0x123] = { char = 0x234, class = binary }, + -- }, + -- } + + local domains = { } + local categories = { } + local numbers = { } + local mclasses = mathematics.classes + local a_mathdomain = privateattribute("mathdomain") + + mathematics.domains = categories + + local permitted = { + ordinary = noadcodes.ord, + binary = noadcodes.bin, + relation = noadcodes.rel, + punctuation = noadcodes.punct, + inner = noadcodes.inner, + } + + 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() + tasks.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 + + implement { + name = "setmathdomain", + arguments = "string", + actions = mathematics.setdomain, + } + + 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[math_char] = 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 + setfield(pointer,"char",chr) + end + if cls and cls ~= getsubtype(parent) then + setfield(parent,"subtype",cls) + end + end + end + end + end + + function handlers.domains(head,style,penalties) + processnoads(head,domains,"domains") + return true + end + +end + + -- just for me function handlers.showtree(head,style,penalties) @@ -1579,23 +1737,3 @@ callbacks.register('mlist_to_hlist',processors.mlist_to_hlist,"preprocessing mat statistics.register("math processing time", function() return statistics.elapsedseconds(noads) end) - --- interface - -local implement = interfaces.implement - -implement { - name = "setmathalternate", - actions = mathematics.setalternate, - arguments = { "integer", "string" } -} - -implement { - name = "setmathitalics", - actions = mathematics.setitalics -} - -implement { - name = "resetmathitalics", - actions = mathematics.resetitalics -} diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv index bad77eac2..c6e39e67b 100644 --- a/tex/context/base/mult-def.mkiv +++ b/tex/context/base/mult-def.mkiv @@ -61,6 +61,7 @@ \def\c!nextrightquotation{nextrightquotation} \def\c!profile {profile} +\def\c!domain {domain} \def\c!fences {fences} \def\c!words {words} diff --git a/tex/context/base/publ-imp-cite.mkvi b/tex/context/base/publ-imp-cite.mkvi index 7ce9ea0da..54e23f67d 100644 --- a/tex/context/base/publ-imp-cite.mkvi +++ b/tex/context/base/publ-imp-cite.mkvi @@ -143,7 +143,6 @@ \currentbtxrighttext \stopsetups - \startsetups btx:cite:range \texdefinition{\s!btx:\s!cite:concat} \currentbtxlefttext diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index fb61788be..3ec8e7380 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -1563,11 +1563,12 @@ \btxparameter\c!right \endgroup} -\let\btxstartcite \begingroup -\let\btxstopcite \endgroup \let\btxstartciteauthor\begingroup \let\btxstopciteauthor \endgroup +\unexpanded\def\btxstartcite{\begingroup\btx_reset_cite} + \let\btxstopcite \endgroup + %D Whatever helpers: \unexpanded\def\btxsingularplural#1{\clf_btxsingularorplural{\currentbtxdataset}{\currentbtxtag}{#1}} diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index 9c4d5acee..c2e07e162 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -696,54 +696,68 @@ end local function packch(entry) local split = entry.split - if #split > 0 then -- useless test + if split and #split > 0 then -- useless test local t = { } for i=1,#split do - local tt, li = { }, split[i].ch - for j=1,#li do - local lij = li[j] - local byt = utfbyte(lij) + local tt = { } + local ch = split[i].ch + for j=1,#ch do + local chr = ch[j] + local byt = utfbyte(chr) if byt > ignoredoffset then tt[j] = "[]" elseif byt == 0 then tt[j] = " " else - tt[j] = lij + tt[j] = chr end end t[i] = concat(tt) end return concat(t," + ") else - local t, li = { }, split.ch - for j=1,#li do - local lij = li[j] - local byt = utfbyte(lij) - if byt > ignoredoffset then - t[j] = "[]" - elseif byt == 0 then - t[j] = " " - else - t[j] = lij + local t = { } + local ch = (split and split.ch) or entry.ch or entry + if ch then + for i=1,#ch do + local chr = ch[i] + local byt = utfbyte(chr) + if byt > ignoredoffset then + t[i] = "[]" + elseif byt == 0 then + t[i] = " " + else + t[i] = chr + end end + return concat(t) + else + return "" end - return concat(t) end end local function packuc(entry) local split = entry.split - if #split > 0 then -- useless test + if split and #split > 0 then -- useless test local t = { } for i=1,#split do t[i] = concat(split[i].uc, " ") -- sq end return concat(t," + ") else - return concat(split.uc," ") -- sq + local uc = (split and split.uc) or entry.uc or entry + if uc then + return concat(uc," ") -- sq + else + return "" + end end end +sorters.packch = packch +sorters.packuc = packuc + function sorters.sort(entries,cmp) if trace_methods then local nofentries = #entries diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 2c2252dcd..aca3000d8 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 18fe9f5f3..188a7d8b5 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-lst.mkvi b/tex/context/base/strc-lst.mkvi index 71fc09829..24aeaae7c 100644 --- a/tex/context/base/strc-lst.mkvi +++ b/tex/context/base/strc-lst.mkvi @@ -856,6 +856,12 @@ % nothing, nb we use the [] syntax here because we end with a \cs \stopsetups +\unexpanded\def\currentlistentrytitlesynchronize + {\the\t_lists_every_renderingsynchronize} + +\unexpanded\def\currentlistentrytitlerendered + {\currentlistentrytitlesynchronize\currentlistentrytitle} + \startsetups[\??listrenderings:command] \edef\p_command{\listalternativeparameter\c!command}% \ifx\p_command\empty @@ -863,7 +869,7 @@ \else \p_command \currentlistentrynumber - {\the\t_lists_every_renderingsynchronize\currentlistentrytitle}% + \currentlistentrytitlerendered % {\currentlistentrytitlesynchronize\currentlistentrytitle} \currentlistentrypagenumber \fi \stopsetups diff --git a/tex/context/base/strc-ren.mkiv b/tex/context/base/strc-ren.mkiv index 34903dfa0..26b7c75a5 100644 --- a/tex/context/base/strc-ren.mkiv +++ b/tex/context/base/strc-ren.mkiv @@ -698,7 +698,7 @@ \headnumbercontent \par \else - \fakeheadnumbercontent % will also be done in the other ones (force consistency with numbered) + \fakeheadnumbercontent \fi \begstrut \headtextcontent diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index b5a1a5ba0..64d034ba2 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -453,6 +453,10 @@ \setuevalue{\e!stop \currenthead}{\strc_sectioning_stop [\currenthead]}% \to \everydefinehead +% so \subject as well as \section will need two commands when ownnumber +% is used (one can disable it anyway for subject) .. this is not downward +% compatible but better + \appendtoks \doifelse{\headparameter\c!ownnumber}\v!yes {\setuevalue\currenthead{\strc_sectioning_handle_own[\currenthead]}} diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua index 56d39445f..b5c58b008 100644 --- a/tex/context/base/task-ini.lua +++ b/tex/context/base/task-ini.lua @@ -91,6 +91,7 @@ appendaction("shipouts", "finishers", "attributes.viewerlayers.handler") appendaction("math", "normalizers", "noads.handlers.showtree", nil, "nohead") appendaction("math", "normalizers", "noads.handlers.unscript", nil, "nohead") -- always on (maybe disabled) +appendaction("math", "normalizers", "noads.handlers.domains", nil, "nohead") -- disabled appendaction("math", "normalizers", "noads.handlers.variants", nil, "nohead") -- always on appendaction("math", "normalizers", "noads.handlers.relocate", nil, "nohead") -- always on appendaction("math", "normalizers", "noads.handlers.families", nil, "nohead") -- always on @@ -192,6 +193,7 @@ disableaction("finalizers", "builders.paragraphs.tag") disableaction("math", "noads.handlers.showtree") disableaction("math", "noads.handlers.tags") disableaction("math", "noads.handlers.italics") +disableaction("math", "noads.handlers.domains") disableaction("math", "noads.handlers.classes") disableaction("math", "typesetters.directions.processmath") diff --git a/tex/context/base/x-asciimath.lua b/tex/context/base/x-asciimath.lua index 7835d8f93..d1dab7dd9 100644 --- a/tex/context/base/x-asciimath.lua +++ b/tex/context/base/x-asciimath.lua @@ -1003,7 +1003,7 @@ local p_unicode = local p_texescape = patterns.texescape local function texescaped(s) - return lpegmatch(p_texescape,s) + return lpegmatch(p_texescape,s) or s end local p_text = @@ -1014,7 +1014,7 @@ local p_text = Cs( P("{") * ((1-P("}"))^0/texescaped) * P("}") ) + Cs((P("(")/"{") * ((1-P(")"))^0/texescaped) * (P(")")/"}")) ) - + Cc("\\asciimathoptext") * Cs(Cc("{") * (patterns.undouble/texescaped) * Cc("}")) + + Cc("\\asciimathoptext") * Cs(Cc("{") * (C(patterns.undouble)/texescaped) * Cc("}")) local m_left = { ["(:"] = s_langle, @@ -1871,7 +1871,6 @@ local function convert(str,nowrap) end end - local context = context if not context then @@ -1881,6 +1880,7 @@ if not context then -- report_asciimath(cleanedup([[ac+sinx+xsqrtx+sinsqrtx+sinsqrt(x)]])) -- report_asciimath(cleanedup([[a "αsinsqrtx" b]])) +-- convert([[a "αsinsqrtx" b]]) -- report_asciimath(cleanedup([[a "α" b]])) -- report_asciimath(cleanedup([[//4]])) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 06de50fd0..ad2e985b8 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 07/16/15 13:30:20 +-- merge date : 07/24/15 10:27:12 do -- begin closure to overcome local limits and interference |