From 35268d29183ddf3b28ecc224ee7c8edfa7673fb2 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 9 Aug 2017 16:31:10 +0200 Subject: 2017-08-09 15:43:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/char-def.lua | 2 + tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/good-mth.lua | 1 + tex/context/base/mkiv/publ-aut.lua | 6 +- tex/context/base/mkiv/publ-imp-aps.lua | 10 +- tex/context/base/mkiv/publ-imp-aps.mkvi | 14 ++- tex/context/base/mkiv/publ-imp-list.mkvi | 79 +++++++------- tex/context/base/mkiv/publ-imp-page.mkvi | 2 +- tex/context/base/mkiv/publ-ini.lua | 110 ++++++++------------ tex/context/base/mkiv/publ-ini.mkiv | 113 +++++++++++---------- tex/context/base/mkiv/spac-chr.lua | 1 + tex/context/base/mkiv/status-files.pdf | Bin 25777 -> 25758 bytes tex/context/base/mkiv/status-lua.pdf | Bin 425922 -> 425919 bytes tex/context/base/mkiv/strc-doc.lua | 53 +++++----- tex/context/base/mkiv/strc-lst.mkvi | 73 ++++++------- tex/context/base/mkiv/strc-ref.mkvi | 21 ---- tex/context/base/mkiv/strc-sec.mkiv | 13 ++- tex/context/interface/mkiv/context-en.xml | 6 ++ tex/context/interface/mkiv/i-context.pdf | Bin 848075 -> 848312 bytes tex/context/interface/mkiv/i-publication.xml | 2 + tex/context/interface/mkiv/i-readme.pdf | Bin 60775 -> 60774 bytes tex/context/modules/mkiv/s-math-characters.lua | 2 + tex/context/modules/mkiv/s-math-ligatures.lua | 71 +++++++++++++ tex/context/modules/mkiv/s-math-ligatures.mkiv | 50 +++++++++ tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 28 files changed, 377 insertions(+), 262 deletions(-) create mode 100644 tex/context/modules/mkiv/s-math-ligatures.lua create mode 100644 tex/context/modules/mkiv/s-math-ligatures.mkiv (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 7f45484a8..1782f0905 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{2017.08.07 11:30} +\newcontextversion{2017.08.09 15:35} %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 b26ab2964..36313bf62 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{2017.08.07 11:30} +\edef\contextversion{2017.08.09 15:35} %D For those who want to use this: diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua index 582e60a3d..4efef117f 100644 --- a/tex/context/base/mkiv/char-def.lua +++ b/tex/context/base/mkiv/char-def.lua @@ -64469,6 +64469,7 @@ characters.data={ linebreak="ai", mathclass="relation", mathname="squaredots", + mathlist={ 0x3A, 0x3A }, unicodeslot=0x2237, }, [0x2238]={ @@ -64488,6 +64489,7 @@ characters.data={ linebreak="al", mathclass="relation", mathname="minuscolon", + mathlist={ 0x2212, 0x3A }, unicodeslot=0x2239, }, [0x223A]={ diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 336cded49..e518a7094 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.08.07 11:30} +\newcontextversion{2017.08.09 15:35} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index d662c62a9..f6367f228 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.08.07 11:30} +\edef\contextversion{2017.08.09 15:35} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/good-mth.lua b/tex/context/base/mkiv/good-mth.lua index 661189350..18a97976f 100644 --- a/tex/context/base/mkiv/good-mth.lua +++ b/tex/context/base/mkiv/good-mth.lua @@ -15,6 +15,7 @@ local trace_goodies = false trackers.register("fonts.goodies", function(v) local report_goodies = logs.reporter("fonts","goodies") local registerotffeature = fonts.handlers.otf.features.register + local fontgoodies = fonts.goodies or { } local fontcharacters = fonts.hashes.characters diff --git a/tex/context/base/mkiv/publ-aut.lua b/tex/context/base/mkiv/publ-aut.lua index cbbdcd9e5..e0f96b9c5 100644 --- a/tex/context/base/mkiv/publ-aut.lua +++ b/tex/context/base/mkiv/publ-aut.lua @@ -330,12 +330,14 @@ local ctx_btxsetfirstnames = context.btxsetfirstnames local ctx_btxsetvons = context.btxsetvons local ctx_btxsetsurnames = context.btxsetsurnames local ctx_btxsetjuniors = context.btxsetjuniors -local ctx_btxciteauthorsetup = context.btxciteauthorsetup -local ctx_btxlistauthorsetup = context.btxlistauthorsetup local ctx_btxsetauthorvariant = context.btxsetauthorvariant + local ctx_btxstartauthor = context.btxstartauthor local ctx_btxstopauthor = context.btxstopauthor +local ctx_btxciteauthorsetup = context.btxciteauthorsetup +local ctx_btxlistauthorsetup = context.btxlistauthorsetup + local concatstate = publications.concatstate local f_invalid = formatters[""] diff --git a/tex/context/base/mkiv/publ-imp-aps.lua b/tex/context/base/mkiv/publ-imp-aps.lua index c15ffe918..f5b33c777 100644 --- a/tex/context/base/mkiv/publ-imp-aps.lua +++ b/tex/context/base/mkiv/publ-imp-aps.lua @@ -412,6 +412,10 @@ categories.unpublished = { -- like misc below but includes organization. categories.electronic = { + sets = { + author = { "author", "collaboration", "organization", }, + howpublished = { "howpublished", "doi", "url", }, + }, required = { "title" }, @@ -420,8 +424,8 @@ categories.electronic = { "year", "month", "author", "collaboration", - "address", "organization", + "address", "howpublished", "doi", "url", "note", }, @@ -430,6 +434,10 @@ categories.electronic = { -- use this type when nothing else fits. categories.misc = { + sets = { + author = { "author", "collaboration", }, + howpublished = { "howpublished", "doi", "url", }, + }, required = { -- nothing is really important here }, diff --git a/tex/context/base/mkiv/publ-imp-aps.mkvi b/tex/context/base/mkiv/publ-imp-aps.mkvi index e9cbd7aaf..4b810672e 100644 --- a/tex/context/base/mkiv/publ-imp-aps.mkvi +++ b/tex/context/base/mkiv/publ-imp-aps.mkvi @@ -551,9 +551,9 @@ \startsetups [btx:aps:list:page-or-pages] \ifx\currentbtxlastpage\empty - \btxlabeltext{p}. + \btxlabeltext{p} \else - \btxlabeltext{pp}. + \btxlabeltext{pp} \fi \btxnbsp \stopsetups @@ -1040,8 +1040,16 @@ \btxflush{organization} \btxcomma } - \btxdoif {howpublished} { + \btxdoifelse {howpublished} { \texdefinition{btx:aps:doi-url} {\btxspace\btxflush{howpublished}} + } { + \btxdoifelse {doi} { + \texdefinition{btx:aps:doi-url} {\btxspace\btxflush{doi}} + } { + \btxdoif {url} { + \texdefinition{btx:aps:doi-url} {\btxspace\btxflush{url}} + } + } } \btxleftparenthesis \texdefinition{btx:aps:year} diff --git a/tex/context/base/mkiv/publ-imp-list.mkvi b/tex/context/base/mkiv/publ-imp-list.mkvi index 68ccaef01..b00c4bd40 100644 --- a/tex/context/base/mkiv/publ-imp-list.mkvi +++ b/tex/context/base/mkiv/publ-imp-list.mkvi @@ -13,8 +13,34 @@ \unprotect -\starttexdefinition unexpanded btx:list:inject #content - \ifconditional\btxinteractive +\starttexdefinition unexpanded btx:list:inject:text #content + \ifconditional\btxinteractivetext + \ifx\currentbtxinternal\empty + #content + \else + \goto { + #content + } [ + \s!internal(\currentbtxinternal) + ] + \fi + \else + #content + \fi +\stoptexdefinition + +\startsetups \s!btx:\s!list:text + \texdefinition {\s!btx:\s!list:inject:text} { + \btxflushlisttext + \ifx\currentbtxcombis\empty \else + \btxrenderingparameter\c!separator + \btxflushlistcombis + \fi + } +\stopsetups + +\starttexdefinition unexpanded btx:list:inject:number #content + \ifconditional\btxinteractivenumber \ifx\currentbtxinternal\empty #content \else @@ -33,64 +59,39 @@ \space \stoptexdefinition -\startsetups[\s!btx:\s!list:\s!page] - \texdefinition{\s!btx:\s!list:concat} - \texdefinition{\s!btx:\s!list:inject} { - % real pagenumber: todo, userpage - \currentbtxfirst - % order - \high{\currentbtxsecond} - } -\stopsetups - \startsetups[\s!btx:\s!list:\s!numbering] - \texdefinition {\s!btx:\s!list:inject} { + \texdefinition {\s!btx:\s!list:inject:number} { \currentbtxfirst \btxparameter\c!stopper } \stopsetups -% Hans: can the following setups be condensed to one using some variable? - -\startsetups[\s!btx:\s!list:\s!numbering:default] - \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:default] - \btxusecommand[\currentbtxspecification:\s!list:\s!numbering:default] { +\starttexdefinition unexpanded btx:list:numbering #variant + \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:#variant] + \btxusecommand[\currentbtxspecification:\s!list:\s!numbering:#variant] { \fastsetup{\s!btx:\s!list:\s!numbering} } \btxstopstyleandcolor +\stoptexdefinition + +\startsetups[\s!btx:\s!list:\s!numbering:default] + \texdefinition {\s!btx:\s!list:\s!numbering} {default} \stopsetups \startsetups[\s!btx:\s!list:\s!numbering:num] - \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:num] - \btxusecommand[\currentbtxspecification:\s!list:\s!numbering:num] { - \fastsetup{\s!btx:\s!list:\s!numbering} - } - \btxstopstyleandcolor + \texdefinition {\s!btx:\s!list:\s!numbering} {num} \stopsetups \startsetups[\s!btx:\s!list:\s!numbering:short] - \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:short] - \btxusecommand [\currentbtxspecification:\s!list:\s!numbering:short] { - \fastsetup{\s!btx:\s!list:\s!numbering} - \btxflushsuffix - } - \btxstopstyleandcolor + \texdefinition {\s!btx:\s!list:\s!numbering} {short} \stopsetups \startsetups[\s!btx:\s!list:\s!numbering:tag] - \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:tag] - \btxusecommand [\currentbtxspecification:\s!list:\s!numbering:tag] { - \fastsetup{\s!btx:\s!list:\s!numbering} - } - \btxstopstyleandcolor + \texdefinition {\s!btx:\s!list:\s!numbering} {tag} \stopsetups \startsetups[\s!btx:\s!list:\s!numbering:index] - \btxstartstyleandcolor [\currentbtxspecification:\s!list:\s!numbering:index] - \btxusecommand [\currentbtxspecification:\s!list:\s!numbering:index] { - \fastsetup{\s!btx:\s!list:\s!numbering} - } - \btxstopstyleandcolor + \texdefinition {\s!btx:\s!list:\s!numbering} {index} \stopsetups \protect diff --git a/tex/context/base/mkiv/publ-imp-page.mkvi b/tex/context/base/mkiv/publ-imp-page.mkvi index 2d9040b10..5bcfe6ea3 100644 --- a/tex/context/base/mkiv/publ-imp-page.mkvi +++ b/tex/context/base/mkiv/publ-imp-page.mkvi @@ -24,7 +24,7 @@ \startsetups [\s!btx:\s!list:\s!page] \fastsetup{\s!btx:\s!list:\s!page:concat} \fastsetup{\s!btx:\currentbtxspecification:\s!list:page-or-pages} - \ifconditional\btxinteractive + \ifconditional\btxinteractivepage \goto { \currentbtxfirstpage } [ diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua index 52642c89d..57aaa2bbf 100644 --- a/tex/context/base/mkiv/publ-ini.lua +++ b/tex/context/base/mkiv/publ-ini.lua @@ -57,6 +57,8 @@ local enhancers = publications.enhancers local tracers = publications.tracers or { } publications.tracers = tracers +local setmacro = interfaces.setmacro -- todo +local setcounter = tex.setcounter -- todo local variables = interfaces.variables local v_local = variables["local"] @@ -125,7 +127,6 @@ local ctx_btxnumberingsetup = context.btxnumberingsetup local ctx_btxpagesetup = context.btxpagesetup local ctx_btxsetfirst = context.btxsetfirst local ctx_btxsetsecond = context.btxsetsecond ------ ctx_btxsetthird = context.btxsetthird local ctx_btxsetsuffix = context.btxsetsuffix local ctx_btxsetinternal = context.btxsetinternal local ctx_btxsetlefttext = context.btxsetlefttext @@ -373,18 +374,9 @@ do nofunique = nofunique + 1 end -- alternative: collect prev in group - local bck = userdata.btxbck - if bck then - lpegmatch(p_collect,bck,1,entry) -- for s in string.gmatch(bck,"[^ ]+") do listtocite[tonumber(s)] = entry end - local lst = tonumber(userdata.btxlst) - if lst then - listtolist[lst] = entry - end - else - local int = tonumber(userdata.btxint) - if int then - listtocite[int] = entry - end + local int = tonumber(userdata.btxint) + if int then + listtocite[int] = entry end local detail = datasets[set].details[tag] -- todo: these have to be pluggable @@ -1591,6 +1583,8 @@ end -- lists +local renderings = { } --- per dataset + do publications.lists = publications.lists or { } @@ -1604,8 +1598,6 @@ do -- per rendering - local renderings = { } --- per dataset - setmetatableindex(renderings,function(t,k) local v = { list = { }, @@ -2140,6 +2132,18 @@ do ctx_btxsetcategory(entry.category or "unknown") ctx_btxsettag(tag) ctx_btxsetnumber(n) + -- + local citation = citetolist[n] + if citation then + local references = citation.references + if references then + local internal = references.internal + if internal and internal > 0 then + ctx_btxsetinternal(internal) + end + end + end + -- if language then ctx_btxsetlanguage(language) end @@ -2449,24 +2453,26 @@ do for i=1,#source do local entry = source[i] local current = entry.sortkey -- so we need a sortkey ! - if entry.suffix then - if not first then - first, last, firstr, lastr = current, current, entry, entry - else - flushrange() - first, last, firstr, lastr = current, current, entry, entry - end - else - if not first then - first, last, firstr, lastr = current, current, entry, entry - elseif current == last + 1 then - last, lastr = current, entry + if type(sortkey) == "number" then + if entry.suffix then + if not first then + first, last, firstr, lastr = current, current, entry, entry + else + flushrange() + first, last, firstr, lastr = current, current, entry, entry + end else - flushrange() - first, last, firstr, lastr = current, current, entry, entry + if not first then + first, last, firstr, lastr = current, current, entry, entry + elseif current == last + 1 then + last, lastr = current, entry + else + flushrange() + first, last, firstr, lastr = current, current, entry, entry + end end + tags[#tags+1] = entry.tag end - tags[#tags+1] = entry.tag end if first and last then flushrange() @@ -2524,9 +2530,6 @@ do -- local found, todo, list = findallused(dataset,reference,internal,method == v_text or method == v_always) -- also when not in list -- --- inspect(found) --- inspect(todo) --- inspect(list) if not found or #found == 0 then report("no entry %a found in dataset %a",reference,dataset) elseif not setup then @@ -2589,11 +2592,12 @@ do local bl = listtocite[currentcitation] if bl then -- we refer to a coming list entry - ctx_btxsetinternal(bl.references.internal or "") + bl = bl.references.internal else -- we refer to a previous list entry - ctx_btxsetinternal(entry.internal or "") + bl = entry.internal end + ctx_btxsetinternal(bl and bl > 0 and bl or "") end local language = entry.language if language then @@ -3080,10 +3084,6 @@ do ctx_btxstartciteauthor() local tag = entry.tag ctx_btxsettag(tag) - -- local currentcitation = markcite(entry.dataset,tag) - -- ctx_btxsetbacklink(currentcitation) - -- local bl = listtocite[currentcitation] - -- ctx_btxsetinternal(bl and bl.references.internal or "") ctx_btxsetfirst(entry[key] or "") -- f_missing(tag) if suffix then ctx_btxsetsuffix(entry.suffix) @@ -3239,7 +3239,10 @@ do local function btxlistvariant(dataset,block,tag,variant,listindex) local action = listvariants[variant] or listvariants.default if action then - action(dataset,block,tag,variant,tonumber(listindex) or 0) + listindex = tonumber(listindex) + if listindex then + action(dataset,block,tag,variant,listindex) + end end end @@ -3299,33 +3302,6 @@ do ctx_btxnumberingsetup(variant or "short") end - function listvariants.page(dataset,block,tag,variant,listindex) - local rendering = renderings[dataset] - local specification = rendering.list[listindex] - for i=3,#specification do - local backlink = tonumber(specification[i]) - if backlink then - local citation = citetolist[backlink] - if citation then - local references = citation.references - if references then - local internal = references.internal - local realpage = references.realpage - if internal and realpage then - ctx_btxsetconcat(i-2) - ctx_btxsetfirst(realpage) - ctx_btxsetsecond(backlink) - if trace_detail then - report("expanding %a list setup %a","page",variant) - end - ctx_btxlistsetup(variant) - end - end - end - end - end - end - end -- a helper diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv index 1a45ec587..a1c76464a 100644 --- a/tex/context/base/mkiv/publ-ini.mkiv +++ b/tex/context/base/mkiv/publ-ini.mkiv @@ -68,7 +68,6 @@ \def\s!btxset {btxset} \def\s!btxref {btxref} \def\s!btxint {btxint} -\def\s!btxbck {btxbck} \def\s!btxltx {btxltx} \def\s!btxrtx {btxrtx} \def\s!btxatx {btxatx} @@ -356,15 +355,6 @@ \unexpanded\def\definebtxcommand#1% {body} #1..#n{body} {\setuvalue{\??btxcommand\csstring#1}}% -% tracing - -\installtextracker - {publications.crosslinks} - {\let\btx_trace_list_cross\strc_references_tracer} - {\let\btx_trace_list_cross\gobbletwoarguments} - -\let\btx_trace_list_cross\gobbletwoarguments - % access \let\currentbtxtag \empty @@ -424,13 +414,11 @@ %D Variables: \let\currentbtxbacklink \empty \unexpanded\def\btxsetbacklink {\def\currentbtxbacklink} -\let\currentbtxbacktrace \empty \unexpanded\def\btxsetbacktrace {\def\currentbtxbacktrace} \let\currentbtxcategory \empty \unexpanded\def\btxsetcategory {\def\currentbtxcategory} \let\currentbtxcombis \empty \unexpanded\def\btxsetcombis {\def\currentbtxcombis} \let\currentbtxdataset \empty \unexpanded\def\btxsetdataset {\def\currentbtxdataset} \let\currentbtxfirst \empty \unexpanded\def\btxsetfirst {\def\currentbtxfirst} \let\currentbtxsecond \empty \unexpanded\def\btxsetsecond {\def\currentbtxsecond} -%let\currentbtxthird \empty \unexpanded\def\btxsetthird {\def\currentbtxthird} \let\currentbtxsuffix \empty \unexpanded\def\btxsetsuffix {\def\currentbtxsuffix} \let\currentbtxinternal \empty \unexpanded\def\btxsetinternal {\def\currentbtxinternal} \let\currentbtxlefttext \empty \unexpanded\def\btxsetlefttext {\def\currentbtxlefttext} @@ -477,7 +465,6 @@ \let\currentbtxbefore \empty \let\currentbtxafter \empty \let\currentbtxbacklink \empty - \let\currentbtxbacktrace\empty \let\currentbtxlanguage \empty \let\currentbtxsuffix \empty %\let\currentbtxdataset \empty % will always be set @@ -494,7 +481,6 @@ \let \currentbtxbefore \empty \let \currentbtxafter \empty \let \currentbtxbacklink \empty - \let \currentbtxbacktrace \empty % not used here \let \currentbtxlanguage \empty %\let \currentbtxdataset \empty % will always be set, beware of local reset ~ %\let \currentbtxtag \empty % will always be set, beware of local reset ~ @@ -576,6 +562,7 @@ [\c!prefixstopper=:, \c!state=\v!start, \c!alternative=a, + \c!interaction=\v!none, %\c!alternative=\v!paragraph, %\c!width=\v!auto, %\c!distance=\emwidth, @@ -635,7 +622,7 @@ \btxparameter\c!right}% \endgroup} -\unexpanded\def\btxpagesetup#1% there will b eno left|right|command|style at this inner level +\unexpanded\def\btxpagesetup#1% there will be no left|right|command|style at this inner level {\begingroup \publ_fast_setup\plusfive\s!list\s!page \endgroup @@ -653,6 +640,22 @@ % end of page stuff +\unexpanded\def\btxflushlisttext + {\begingroup + \usebtxstyleandcolor\c!style\c!color + \ignorespaces + \publ_fast_setup\plusfour\s!list\currentbtxcategory + \removeunwantedspaces + \endgroup} + +\unexpanded\def\btxflushlistcombis + {\begingroup + \processcommacommand[\currentbtxcombis]\btx_entry_inject_combi % maybe in lua + \endgroup} + +\def\btx_entry_inject_list_text + {\publ_fast_setup\plusfour\s!list\s!text} + \unexpanded\def\btx_entry_inject {\begingroup \redoconvertfont % see (**) in strc-lst, this will become an configuration option @@ -661,19 +664,7 @@ \ifconditional\c_btx_list_texts \currentbtxbefore \fi - \begingroup - \usebtxstyleandcolor\c!style\c!color - \ignorespaces - \publ_fast_setup\plusfour\s!list\currentbtxcategory - \removeunwantedspaces - \endgroup - \ifx\currentbtxcombis\empty \else - \btxrenderingparameter\c!separator - % maybe move this loop to lua - \begingroup - \processcommacommand[\currentbtxcombis]\btx_entry_inject_combi - \endgroup - \fi + \btx_entry_inject_list_text \ifconditional\c_btx_list_pages \btx_entry_inject_pages \fi @@ -743,6 +734,8 @@ % \iflocation \letinteractionparameter\c!style\empty +% \letinteractionparameter\c!color\empty +% \letinteractionparameter\c!contrastcolor\empty \fi \to \everybtxlistrendering @@ -976,16 +969,16 @@ \endgroup} \def\btx_list_reference_inject_now - {\btx_trace_list_cross\empty\currentbtxbacktrace - \strc_references_direct_full_user + {\strc_references_direct_full_user {\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi% \s!btxref=\currentbtxtag,% \s!btxspc=\currentbtxspecification,% \s!btxlst=\number\c_btx_list_reference,% check if needed - %\ifx\currentbtxcombis\empty\else\s!btxcom={\currentbtxcombis},\fi% - \ifx\currentbtxbefore\empty\else\s!btxbtx={\currentbtxbefore},\fi% - \ifx\currentbtxafter \empty\else\s!btxatx={\currentbtxafter },\fi% - \ifx\currentbtxbacklink\currentbtxbacktrace\s!btxint=\currentbtxbacklink\else\s!btxbck=\currentbtxbacktrace\fi}% + %\ifx\currentbtxcombis \empty\else\s!btxcom={\currentbtxcombis},\fi% + \ifx\currentbtxbefore \empty\else\s!btxbtx={\currentbtxbefore},\fi% + \ifx\currentbtxafter \empty\else\s!btxatx={\currentbtxafter },\fi% + \ifx\currentbtxbacklink\empty\else\s!btxint=\number\currentbtxbacklink\fi + }% {\s!btx::\v!list::\number\c_btx_list_reference}% {\currentbtxnumber}} @@ -998,27 +991,26 @@ \iftrialtypesetting \else \ifx\currentbtxbacklink\empty % can be made empty when combining author / year - \else + \else\ifnum\currentbtxbacklink>\zerocount \btx_cite_reference_inject_indeed \settrue\c_btx_cite_reference_injected - \fi + \fi\fi \fi \fi} \newtoks\t_btx_reference_inject \def\btx_cite_reference_inject_indeed - {\btx_trace_list_cross\currentbtxbacklink\empty - \the\t_btx_reference_inject + {\the\t_btx_reference_inject \strc_lists_inject_direct % todo: make like \btx_list_reference_inject_now with { } [\s!btx]% [\c!type=\s!btx]% \c!location=\v!none [\ifx\currentbtxdataset\v!default\else\s!btxset=\currentbtxdataset,\fi% \s!btxref=\currentbtxtag,% - %\ifx\currentbtxcombis\empty\else\s!btxcom={\currentbtxcombis},\fi% - \ifx\currentbtxbefore\empty\else\s!btxbtx={\currentbtxbefore},\fi% - \ifx\currentbtxafter \empty\else\s!btxatx={\currentbtxafter },\fi% - \s!btxint=\number\currentbtxbacklink + %\ifx\currentbtxcombis \empty\else\s!btxcom={\currentbtxcombis},\fi% + \ifx\currentbtxbefore \empty\else\s!btxbtx={\currentbtxbefore},\fi% + \ifx\currentbtxafter \empty\else\s!btxatx={\currentbtxafter },\fi% + \ifx\currentbtxbacklink\empty\else\s!btxint=\number\currentbtxbacklink,\fi \ifx\currentbtxciteuservariables\empty\else,\currentbtxciteuservariables\fi]} \def\currentbtxuservariable #1{\clf_btxuservariable {\currentbtxdataset}{#1}} @@ -1149,35 +1141,48 @@ % \btxflushauthor[invertedshort]{author} % Interaction +% +% Because we have more complex entries in lists we don't use the normal list +% interaction features. \newconditional\btxinteractive -\newconditional\btx_interactive +\newconditional\btxinteractivenumber +\newconditional\btxinteractivetext +\newconditional\btxinteractivepage + +\let\currentbtxinteraction\empty + +\installcorenamespace{btxinteraction} + +\setvalue{\??btxinteraction\v!number}{\settrue\btxinteractivenumber} +\setvalue{\??btxinteraction\v!text }{\settrue\btxinteractivetext} +\setvalue{\??btxinteraction\v!page }{\settrue\btxinteractivepage} +\setvalue{\??btxinteraction\v!all }{\settrue\btxinteractivenumber + \settrue\btxinteractivetext + \settrue\btxinteractivepage} -% of maybe modes? +% \setupbtx[interaction=page] % or text or number or all +% \setupbtxrendering[pagestate=start] \appendtoks \iflocation - \edef\p_interaction{\btxparameter\c!interaction}% - \ifx\p_interaction\v!stop + \edef\currentbtxinteraction{\btxparameter\c!interaction}% + \ifx\currentbtxinteraction\v!stop \setfalse\btxinteractive \else + \let\structurelistlocation\empty \settrue\btxinteractive - \ifx\p_interaction\v!all - \settrue\btx_interactive - \else - \setfalse\btx_interactive - \fi + \begincsname\??btxinteraction\currentbtxinteraction\endcsname \fi \else \setfalse\btxinteractive - \setfalse\btx_interactive \fi \to \everysetupbtxlistplacement \appendtoks \iflocation - \edef\p_interaction{\btxparameter\c!interaction}% - \ifx\p_interaction\v!stop + \edef\currentbtxinteraction{\btxparameter\c!interaction}% + \ifx\currentbtxinteraction\v!stop \setfalse\btxinteractive \else \settrue\btxinteractive diff --git a/tex/context/base/mkiv/spac-chr.lua b/tex/context/base/mkiv/spac-chr.lua index 76e3e14f2..299f86ad6 100644 --- a/tex/context/base/mkiv/spac-chr.lua +++ b/tex/context/base/mkiv/spac-chr.lua @@ -135,6 +135,7 @@ local function nbsp(head,current) setsubtype(current,space_skip_code) else head, current = inject_nobreak_space(0x00A0,head,current,para.space,para.spacestretch,para.spaceshrink) + setsubtype(current,space_skip_code) end return head, current end diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 010feba5d..e820737c7 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 8223279b2..76ebe0c1b 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/strc-doc.lua b/tex/context/base/mkiv/strc-doc.lua index 57fff5a21..93d8db56b 100644 --- a/tex/context/base/mkiv/strc-doc.lua +++ b/tex/context/base/mkiv/strc-doc.lua @@ -129,8 +129,8 @@ sections.tobesaved = tobesaved -- -- job.register('structures.sections.collected', tobesaved, initializer) -sections.registered = sections.registered or allocate() -local registered = sections.registered +local registered = sections.registered or allocate() +sections.registered = registered storage.register("structures/sections/registered", registered, "structures.sections.registered") @@ -411,11 +411,6 @@ function sections.setentry(given) v[2](k) end end --- local n = { } --- for i=1,newdepth do --- n[i] = numbers[i] --- end --- numberdata.numbers = n numberdata.numbers = { unpack(numbers,1,newdepth) } if not numberdata.block then numberdata.block = getcurrentblock() -- also in references @@ -447,8 +442,9 @@ function sections.reportstructure() local d = status[depth] local o = concat(ownnumbers,".",1,depth) local n = (numbers and concat(numbers,".",1,min(depth,#numbers))) or 0 - local l = d.titledata.title or "" - local t = (l ~= "" and l) or d.titledata.title or "[no title]" + local t = d.titledata.title + local l = t or "" + local t = (l ~= "" and l) or t or "[no title]" local m = d.metadata.name if o and not find(o,"^%.*$") then report_structure("%s @ level %i : (%s) %s -> %s",m,depth,n,o,t) @@ -460,17 +456,24 @@ function sections.reportstructure() end end +-- function sections.setnumber(depth,n) +-- local forced, depth, new = data.forced, depth or data.depth, tonumber(n) or 0 +-- if type(n) == "string" then +-- if find(n,"^[%+%-]") then +-- forced[depth] = { "add", new } +-- else +-- forced[depth] = { "set", new } +-- end +-- else +-- forced[depth] = { "set", new } +-- end +-- end + function sections.setnumber(depth,n) - local forced, depth, new = data.forced, depth or data.depth, tonumber(n) - if type(n) == "string" then - if find(n,"^[%+%-]") then - forced[depth] = { "add", new } - else - forced[depth] = { "set", new } - end - else - forced[depth] = { "set", new } - end + data.forced[depth or data.depth] = { + type(n) == "string" and find(n,"^[%+%-]") and "add" or "set", + tonumber(n) or 0 + } end function sections.numberatdepth(depth) @@ -774,10 +777,13 @@ function sections.typesetnumber(entry,kind,...) -- kind='section','number','pref if number then local ownnumber = ownnumbers and ownnumbers[index] or "" if number > 0 or (ownnumber ~= "") then - if bb == 0 then bb = k end + if bb == 0 then + bb = k + end ee = k - else - bb, ee = 0, 0 + elseif criterium >= 0 then + bb = 0 + ee = 0 end else break @@ -1028,7 +1034,7 @@ implement { name = "namedstructureuservariable", actions = sections.userdata, implement { name = "setstructurelevel", actions = sections.setlevel, arguments = { "string", "string" } } implement { name = "getstructurelevel", actions = sections.getcurrentlevel, arguments = { "string" } } -implement { name = "setstructurenumber", actions = sections.setnumber, arguments = { "integer", "string" } } +implement { name = "setstructurenumber", actions = sections.setnumber, arguments = { "integer", "string" } } -- string as we support +- implement { name = "getstructurenumber", actions = sections.getnumber, arguments = { "integer" } } implement { name = "getsomestructurenumber", actions = sections.getnumber, arguments = { "integer", "string" } } implement { name = "getfullstructurenumber", actions = sections.fullnumber, arguments = { "integer" } } @@ -1099,6 +1105,7 @@ implement { { "segments" }, { "ownnumber" }, { "language" }, + { "criterium" }, }, }, { "userdata" }, diff --git a/tex/context/base/mkiv/strc-lst.mkvi b/tex/context/base/mkiv/strc-lst.mkvi index 08e56a700..392d92aea 100644 --- a/tex/context/base/mkiv/strc-lst.mkvi +++ b/tex/context/base/mkiv/strc-lst.mkvi @@ -1452,40 +1452,7 @@ \strc_lists_interaction_check_nop \fi} -% \def\strc_lists_interaction_check_yes -% {\edef\p_interaction_forward{\listparameter\c!interaction}% -% \ifcsname\??listinteractions\p_interaction_forward\endcsname -% \expandafter\let\expandafter\p_interaction_forward\csname\??listinteractions\p_interaction_forward\endcsname -% \strc_references_get_simple_reference{internal(\currentlistentrylocation)}% -% \a_strc_lists_reference\currentreferenceattribute -% \else -% \a_strc_lists_reference\attributeunsetvalue -% \fi -% \ifnum\a_strc_lists_reference=\attributeunsetvalue -% \let\strc_lists_get_reference_attribute\gobbleoneargument -% \let\strc_lists_set_reference_attribute\gobbleoneargument -% \let\strc_lists_set_style_color \strc_lists_set_style_color_normal -% \else -% \let\strc_lists_get_reference_attribute\strc_lists_get_reference_attribute_indeed -% \let\strc_lists_set_reference_attribute\strc_lists_set_reference_attribute_indeed -% \let\strc_lists_set_style_color \strc_lists_set_style_color_special -% \fi -% \edef\p_interaction_backward{\namedheadparameter\currentlist\c!interaction}% \namedheadparameter ! -% \ifx\p_interaction_backward\v!list -% \strc_references_set_simple_reference{*\currentlistentrylocation}% -% \a_strc_lists_destination\currentdestinationattribute -% \else -% \a_strc_lists_destination\attributeunsetvalue -% \fi -% \ifnum\a_strc_lists_destination=\attributeunsetvalue -% \let\strc_lists_get_destination_attribute\empty -% \let\strc_lists_set_destination_attribute\empty -% \else -% \let\strc_lists_get_destination_attribute\strc_lists_get_destination_attribute_indeed -% \let\strc_lists_set_destination_attribute\strc_lists_set_destination_attribute_indeed -% \fi} - -\def\strc_lists_interaction_check_yes +\def\strc_lists_interaction_check_yes_yes {\edef\p_interaction_forward{\listparameter\c!interaction}% \ifcsname\??listinteractions\p_interaction_forward\endcsname %\expandafter\let\expandafter\p_interaction_forward\csname\??listinteractions\p_interaction_forward\endcsname @@ -1496,13 +1463,13 @@ \a_strc_lists_reference\attributeunsetvalue \fi \ifnum\a_strc_lists_reference=\attributeunsetvalue - \let\strc_lists_get_reference_attribute\gobbleoneargument - \let\strc_lists_set_reference_attribute\gobbleoneargument - \let\strc_lists_set_style_color \strc_lists_set_style_color_normal + \let\strc_lists_get_reference_attribute\gobbleoneargument + \let\strc_lists_set_reference_attribute\gobbleoneargument + \let\strc_lists_set_style_color \strc_lists_set_style_color_normal \else - \let\strc_lists_get_reference_attribute\strc_lists_get_reference_attribute_indeed - \let\strc_lists_set_reference_attribute\strc_lists_set_reference_attribute_indeed - \let\strc_lists_set_style_color \strc_lists_set_style_color_special + \let\strc_lists_get_reference_attribute\strc_lists_get_reference_attribute_indeed + \let\strc_lists_set_reference_attribute\strc_lists_set_reference_attribute_indeed + \let\strc_lists_set_style_color \strc_lists_set_style_color_special \fi \edef\p_interaction_backward{\namedheadparameter\currentlist\c!interaction}% \namedheadparameter ! \ifx\p_interaction_backward\v!list @@ -1512,13 +1479,31 @@ \a_strc_lists_destination\attributeunsetvalue \fi \ifnum\a_strc_lists_destination=\attributeunsetvalue - \let\strc_lists_get_destination_attribute\empty - \let\strc_lists_set_destination_attribute\empty + \let\strc_lists_get_destination_attribute\empty + \let\strc_lists_set_destination_attribute\empty \else - \let\strc_lists_get_destination_attribute\strc_lists_get_destination_attribute_indeed - \let\strc_lists_set_destination_attribute\strc_lists_set_destination_attribute_indeed + \let\strc_lists_get_destination_attribute\strc_lists_get_destination_attribute_indeed + \let\strc_lists_set_destination_attribute\strc_lists_set_destination_attribute_indeed \fi} +\def\strc_lists_interaction_check_yes_nop + {\a_strc_lists_reference \attributeunsetvalue + \a_strc_lists_destination\attributeunsetvalue + \let\strc_lists_get_reference_attribute\gobbleoneargument + \let\strc_lists_set_reference_attribute\gobbleoneargument + \let\strc_lists_get_destination_attribute\empty + \let\strc_lists_set_destination_attribute\empty + \let\strc_lists_set_style_color\strc_lists_set_style_color_normal} + +\def\strc_lists_interaction_check_yes + {\ifx\currentlistentrylocation\empty + \strc_lists_interaction_check_yes_nop + \else\ifnum\currentlistentrylocation=\zerocount + \strc_lists_interaction_check_yes_nop + \else + \strc_lists_interaction_check_yes_yes + \fi\fi} + \def\strc_lists_interaction_check_nop {\let\strc_lists_get_reference_attribute \gobbleoneargument \let\strc_lists_set_reference_attribute \gobbleoneargument diff --git a/tex/context/base/mkiv/strc-ref.mkvi b/tex/context/base/mkiv/strc-ref.mkvi index 69a9e2219..2cd08f437 100644 --- a/tex/context/base/mkiv/strc-ref.mkvi +++ b/tex/context/base/mkiv/strc-ref.mkvi @@ -2252,27 +2252,6 @@ %D \in{figure}[match(mess)] %D \stoptyping -%D Tracing: - -\unexpanded\def\strc_references_tracer#1#2% \csleft csright - {\hbox to \zeropoint \bgroup - \hss - \infofont - \darkblue - \ifx#1\empty\else - \raise\strutht \hbox \s!to \zeropoint \bgroup - \hss#1\hskip.2\emwidth - \egroup - \fi - \vrule \s!height 1.5\strutht \s!depth \strutdp \s!width .1\emwidth - \ifx#2\empty\else - \raise\strutht \hbox \s!to \zeropoint \bgroup - \hskip.2\emwidth#2\hss - \egroup - \fi - \hss - \egroup}% - \protect \endinput % tricky: diff --git a/tex/context/base/mkiv/strc-sec.mkiv b/tex/context/base/mkiv/strc-sec.mkiv index af8ba5ba1..efed4d896 100644 --- a/tex/context/base/mkiv/strc-sec.mkiv +++ b/tex/context/base/mkiv/strc-sec.mkiv @@ -86,7 +86,8 @@ \c!sectionset=\headparameter\c!sectionset, \c!sectionsegments=\headparameter\c!sectionsegments, \c!reference=\headparameter\c!reference, - \c!referenceprefix=\headparameter\c!referenceprefix] + \c!referenceprefix=\headparameter\c!referenceprefix, + \c!criterium=\headparameter\c!criterium] % see lists/neat-001.tex for usage of: @@ -112,7 +113,14 @@ \globallet\currentstructurebookmark\tempstring \endgroup} -% so it's an experiment +% zeros: +% +% \setuphead[subsection][criterium=all] +% +% \dorecurse{3} { +% \chapter{Blabla} \subsection{bla 1 1} \subsection{bla 1 2} +% \section{bla 2} \subsection{bla 2 1} \subsection{bla 2 2} +% } \unexpanded\def\strc_sectioning_register#1#2#3% #1=interfaced-settings, #2=optional user data (not yet supported) {\begingroup @@ -236,6 +244,7 @@ segments {\structureparameter\c!sectionsegments} ownnumber {\currentstructureownnumber} language {\currentlanguage}% for the moment, needed for bookmarks conversion + criterium {\structureparameter\c!criterium} } userdata {\detokenize{#3}}% will be converted to table at the lua end \relax diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index fc18b8cc3..01dcd6aba 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -32160,6 +32160,9 @@ + + + @@ -32212,6 +32215,9 @@ + + + diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index 97fffd674..29141d1e3 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-publication.xml b/tex/context/interface/mkiv/i-publication.xml index d981c4acd..da308d1ad 100644 --- a/tex/context/interface/mkiv/i-publication.xml +++ b/tex/context/interface/mkiv/i-publication.xml @@ -1026,6 +1026,7 @@ + @@ -1048,6 +1049,7 @@ + diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index f8510015c..7e708175d 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/context/modules/mkiv/s-math-characters.lua b/tex/context/modules/mkiv/s-math-characters.lua index efecbeeb5..1888dabb4 100644 --- a/tex/context/modules/mkiv/s-math-characters.lua +++ b/tex/context/modules/mkiv/s-math-characters.lua @@ -16,6 +16,8 @@ local lower = string.lower local utfchar = utf.char local round = math.round +local context = context + local fontdata = fonts.hashes.identifiers local chardata = characters.data local blocks = characters.blocks diff --git a/tex/context/modules/mkiv/s-math-ligatures.lua b/tex/context/modules/mkiv/s-math-ligatures.lua new file mode 100644 index 000000000..16fe0c4bc --- /dev/null +++ b/tex/context/modules/mkiv/s-math-ligatures.lua @@ -0,0 +1,71 @@ +if not modules then modules = { } end modules['s-math-ligatures'] = { + version = 1.001, + comment = "companion to s-math-ligatures.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.math = moduledata.math or { } +moduledata.math.ligatures = moduledata.math.ligatures or { } + +local context = context + +local utfchar = utf.char +local uformat = string.formatters["%U"] + +function moduledata.math.ligatures.showlist(specification) + -- specification = interfaces.checkedspecification(specification) + + local function setlist(unicode,list,start,v) + if list[start] ~= 0x20 then + local t, u = { }, { } + for i=start,#list do + local li = list[i] + t[#t+1] = utfchar(li) + u[#u+1] = uformat(li) + end + context.NC() context("%U",unicode) + context.NC() context("%c",unicode) + context.NC() context("% t",u) + context.NC() context("%t",t) + context.NC() context("%t",t) + context.NC() + context.nohyphens() + context.veryraggedright() + local n = v.mathname + if n then + context.tex(n) + else + local c = v.mathspec + if c then + for i=1,#c do + local n = c[i].name + if n then + context.tex(n) + context.quad() + end + end + end + end + context.NC() + context.NR() + end + end + + context.starttabulate { "|T|m|T|T|m|pl|" } + for unicode, v in table.sortedhash(characters.data) do + local vs = v.specials + if vs and #vs > 2 then + local kind = vs[1] + if (v.mathclass or v.mathspec) and (kind == "char" or kind == "compat") then + setlist(unicode,vs,2,v) + end + end + local ml = v.mathlist + if ml then + setlist(unicode,ml,1,v) + end + end + context.stoptabulate() +end diff --git a/tex/context/modules/mkiv/s-math-ligatures.mkiv b/tex/context/modules/mkiv/s-math-ligatures.mkiv new file mode 100644 index 000000000..39fc4d2a3 --- /dev/null +++ b/tex/context/modules/mkiv/s-math-ligatures.mkiv @@ -0,0 +1,50 @@ +%D \module +%D [ file=s-math-ligatures.mkiv, +%D version=2017.08.03, +%D title=\CONTEXT\ Style File, +%D subtitle=Math Ligature Checking, +%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. + +\startmodule[math-ligatures] + +\registerctxluafile{s-math-ligatures}{} + +\unprotect + +\unexpanded\def\showmathligatures + {\dosingleempty\module_math_ligatures_show} + +\def\module_math_ligatures_show[#1]% + {\begingroup + \ctxlua{moduledata.math.ligatures.showlist{ }}% + \endgroup} + +\protect + +\stopmodule + +\continueifinputfile{s-math-ligatures.mkiv} + +\setupbodyfont[dejavu,10pt] + +\setuplayout + [width=middle, + height=middle, + topspace=15mm, + backspace=15mm, + bottomspace=15mm, + header=1cm, + headerdistance=0.5cm, + footer=0pt] + +\starttext + + \showmathligatures + +\stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 7624ff77b..8b25160bf 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 : 08/07/17 11:30:07 +-- merge date : 08/09/17 15:35:46 do -- begin closure to overcome local limits and interference -- cgit v1.2.3