diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-11-06 16:15:03 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-11-06 16:15:03 +0100 |
commit | 83a028042385004b0c9836b18457612f69f6e231 (patch) | |
tree | 6f14d2edf565937d5b8ee8a56a5b328ca999ca77 | |
parent | b3f3cb27a35cd05a3c87e610cd616e19a8938359 (diff) | |
download | context-83a028042385004b0c9836b18457612f69f6e231.tar.gz |
2014-11-06 14:57:00
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4389 -> 4397 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 3 | ||||
-rw-r--r-- | tex/context/base/m-matrix.mkiv | 59 | ||||
-rw-r--r-- | tex/context/base/math-noa.lua | 73 | ||||
-rw-r--r-- | tex/context/base/publ-dat.lua | 7 | ||||
-rw-r--r-- | tex/context/base/publ-imp-apa.lua | 290 | ||||
-rw-r--r-- | tex/context/base/publ-imp-apa.mkvi | 205 | ||||
-rw-r--r-- | tex/context/base/publ-imp-cite.mkvi | 58 | ||||
-rw-r--r-- | tex/context/base/publ-ini.mkiv | 109 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24692 -> 24744 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 333240 -> 333269 bytes | |||
-rw-r--r-- | tex/context/base/status-mkiv.lua | 11 | ||||
-rw-r--r-- | tex/context/base/typo-bld.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/typo-sus.lua | 215 | ||||
-rw-r--r-- | tex/context/base/typo-sus.mkiv | 51 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
17 files changed, 712 insertions, 375 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index ee0f9c092..aa2bf065e 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{2014.11.05 15:22} +\newcontextversion{2014.11.06 14:55} %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 5cee56c55..219bb4e8a 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 c90cac87b..f4ec1ee66 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.11.05 15:22} +\edef\contextversion{2014.11.06 14:55} \edef\contextkind {beta} %D For those who want to use this: @@ -402,6 +402,7 @@ \loadmkvifile{typo-txt} \loadmarkfile{typo-drp} \loadmarkfile{typo-fln} +\loadmarkfile{typo-sus} \loadmkvifile{type-ini} \loadmarkfile{type-set} diff --git a/tex/context/base/m-matrix.mkiv b/tex/context/base/m-matrix.mkiv index 8aa8074f7..ccb376e39 100644 --- a/tex/context/base/m-matrix.mkiv +++ b/tex/context/base/m-matrix.mkiv @@ -99,18 +99,20 @@ end -- replace i-th row with factor * (i-th row) function matrix.multiply(m,i,factor) - if m then + local mi = m[i] + for k=1,#mi do + mi[k] = factor * mi[k] + end + return m +end + +-- scalar product "factor * m" + +function matrix.scalar(m, factor) + for i=1,#m do local mi = m[i] - for k=1,#mi do - mi[k] = factor * mi[k] - end - elseif i then - factor = i - for i=1,#m do - local mi = m[i] - for j=1,#mi do - mi[j] = factor * mi[j] - end + for j=1,#mi do + mi[j] = factor * mi[j] end end return m @@ -179,17 +181,6 @@ function matrix.product(m1,m2) return product end -function matrix.search(m,i) - for k=i+1,#m do -- searches from the next row - if m[k][i] == 0 then - k = k + 1 - else - return k - end - end - return 0 -end - local function uppertri(m,sign) local temp = copy(m) for i=1,#temp-1 do @@ -248,9 +239,6 @@ local function rowechelon(m,r) local i = pRow local n = #temp while temp[i][pCol] == 0 do - -- context("search non zero element\\crlf current value is ") - -- context(i, pCol) - -- context("\\crlf") i = i + 1 if i > n then -- no nonzero number in a column @@ -263,20 +251,13 @@ local function rowechelon(m,r) end end temp[pRow], temp[i] = temp[i], temp[pRow] - -- context("check the row value\\crlf") - -- matrix.typeset(temp) - -- context("\\crlf") end local row = temp[pRow] pivot = row[pCol] for l=pCol,#row do row[l] = row[l]/pivot end - -- context("divide row %d by pivot element\\ ", pRow) - -- context(pRow, pCol) - -- context("\\crlf") - -- matrix.typeset(temp) - -- context("\\crlf") + if r == 1 then -- make the "reduced row echelon form" local row = temp[pRow] @@ -289,7 +270,7 @@ local function rowechelon(m,r) end end end - -- just row echelon form + -- just make the row echelon form local row = temp[pRow] for k=pRow+1, #temp do local current = temp[k] @@ -301,9 +282,7 @@ local function rowechelon(m,r) end pRow = pRow + 1 pCol = pCol + 1 - -- context("make zeros\\crlf") - -- matrix.typeset(temp) - -- context("\\par") + if pRow > #temp or pCol > #temp[1] then pRow = #temp + 1 end @@ -314,7 +293,9 @@ end matrix.rowechelon = rowechelon matrix.rowEchelon = rowechelon -local function solve(m,c) -- solve the linear equation m X = c +-- solve the linear equation m X = c + +local function solve(m,c) local n = #m if n ~= #c then return copy(m) @@ -329,6 +310,8 @@ end matrix.solve = solve +-- find the inverse matrix of m + local function inverse(m) local n = #m local temp = copy(m) diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index 9ff3e6bda..ba4de833d 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -28,31 +28,36 @@ local otf = fonts.handlers.otf local otffeatures = fonts.constructors.newfeatures("otf") local registerotffeature = otffeatures.register -local trace_remapping = false trackers.register("math.remapping", function(v) trace_remapping = v end) -local trace_processing = false trackers.register("math.processing", function(v) trace_processing = v end) -local trace_analyzing = false trackers.register("math.analyzing", function(v) trace_analyzing = v end) -local trace_normalizing = false trackers.register("math.normalizing", function(v) trace_normalizing = v end) -local trace_collapsing = false trackers.register("math.collapsing", function(v) trace_collapsing = v end) -local trace_goodies = false trackers.register("math.goodies", function(v) trace_goodies = v end) -local trace_variants = false trackers.register("math.variants", function(v) trace_variants = v end) -local trace_alternates = false trackers.register("math.alternates", function(v) trace_alternates = v end) -local trace_italics = false trackers.register("math.italics", function(v) trace_italics = v end) -local trace_families = false trackers.register("math.families", function(v) trace_families = v end) - -local check_coverage = true directives.register("math.checkcoverage", function(v) check_coverage = v end) - -local report_processing = logs.reporter("mathematics","processing") -local report_remapping = logs.reporter("mathematics","remapping") -local report_normalizing = logs.reporter("mathematics","normalizing") -local report_collapsing = logs.reporter("mathematics","collapsing") -local report_goodies = logs.reporter("mathematics","goodies") -local report_variants = logs.reporter("mathematics","variants") -local report_alternates = logs.reporter("mathematics","alternates") -local report_italics = logs.reporter("mathematics","italics") -local report_families = logs.reporter("mathematics","families") - -local a_mathrendering = attributes.private("mathrendering") -local a_exportstatus = attributes.private("exportstatus") +local privateattribute = attributes.private +local registertracker = trackers.register +local registerdirective = directives.register +local logreporter = logs.reporter + +local trace_remapping = false registertracker("math.remapping", function(v) trace_remapping = v end) +local trace_processing = false registertracker("math.processing", function(v) trace_processing = v end) +local trace_analyzing = false registertracker("math.analyzing", function(v) trace_analyzing = v end) +local trace_normalizing = false registertracker("math.normalizing", function(v) trace_normalizing = v end) +local trace_collapsing = false registertracker("math.collapsing", function(v) trace_collapsing = v end) +local trace_goodies = false registertracker("math.goodies", function(v) trace_goodies = v end) +local trace_variants = false registertracker("math.variants", function(v) trace_variants = v end) +local trace_alternates = false registertracker("math.alternates", function(v) trace_alternates = v end) +local trace_italics = false registertracker("math.italics", function(v) trace_italics = v end) +local trace_families = false registertracker("math.families", function(v) trace_families = v end) + +local check_coverage = true registerdirective("math.checkcoverage", function(v) check_coverage = v end) + +local report_processing = logreporter("mathematics","processing") +local report_remapping = logreporter("mathematics","remapping") +local report_normalizing = logreporter("mathematics","normalizing") +local report_collapsing = logreporter("mathematics","collapsing") +local report_goodies = logreporter("mathematics","goodies") +local report_variants = logreporter("mathematics","variants") +local report_alternates = logreporter("mathematics","alternates") +local report_italics = logreporter("mathematics","italics") +local report_families = logreporter("mathematics","families") + +local a_mathrendering = privateattribute("mathrendering") +local a_exportstatus = privateattribute("exportstatus") local nuts = nodes.nuts local nodepool = nuts.pool @@ -236,7 +241,7 @@ noads.process = processnoads -- might as well do this local families = { } -local a_mathfamily = attributes.private("mathfamily") +local a_mathfamily = privateattribute("mathfamily") local boldmap = mathematics.boldmap local familymap = { [0] = @@ -336,8 +341,8 @@ end -- character remapping -local a_mathalphabet = attributes.private("mathalphabet") -local a_mathgreek = attributes.private("mathgreek") +local a_mathalphabet = privateattribute("mathalphabet") +local a_mathgreek = privateattribute("mathgreek") processors.relocate = { } @@ -488,7 +493,7 @@ end -- todo: just replace the character by an ord noad -- and remove the right delimiter as well -local mathsize = attributes.private("mathsize") +local mathsize = privateattribute("mathsize") local resize = { } processors.resize = resize @@ -787,7 +792,7 @@ registerotffeature { local getalternate = otf.getalternate -local a_mathalternate = attributes.private("mathalternate") +local a_mathalternate = privateattribute("mathalternate") local alternate = { } -- processors.alternate = alternate @@ -831,7 +836,7 @@ end -- = we check for correction first because accessing nodes is slower -- = the actual glyph is not that important (we can control it with numbers) -local a_mathitalics = attributes.private("mathitalics") +local a_mathitalics = privateattribute("mathitalics") local italics = { } local default_factor = 1/20 @@ -914,7 +919,7 @@ local italic_kern = new_kern local c_positive_d = "trace:db" local c_negative_d = "trace:dr" -trackers.register("math.italics", function(v) +registertracker("math.italics", function(v) if v then italic_kern = function(k,font) local ex = 1.5 * fontexheights[font] @@ -1139,7 +1144,7 @@ function handlers.classes(head,style,penalties) return true end -trackers.register("math.classes",function(v) tasks.setaction("math","noads.handlers.classes",v) end) +registertracker("math.classes",function(v) tasks.setaction("math","noads.handlers.classes",v) end) -- just for me @@ -1147,7 +1152,7 @@ function handlers.showtree(head,style,penalties) inspect(nodes.totree(head)) end -trackers.register("math.showtree",function(v) tasks.setaction("math","noads.handlers.showtree",v) end) +registertracker("math.showtree",function(v) tasks.setaction("math","noads.handlers.showtree",v) end) -- the normal builder diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua index 43e523f59..b8d8b3651 100644 --- a/tex/context/base/publ-dat.lua +++ b/tex/context/base/publ-dat.lua @@ -33,7 +33,7 @@ local textoutf = characters and characters.tex.toutf local settings_to_hash, settings_to_array = utilities.parsers.settings_to_hash, utilities.parsers.settings_to_array local formatters = string.formatters local sortedkeys, sortedhash = table.sortedkeys, table.sortedhash -local xmlcollected, xmltext, xmlconvert = xml.collected, xml.text, xmlconvert +local xmlcollected, xmltext, xmlconvert = xml.collected, xml.text, xml.convert local setmetatableindex = table.setmetatableindex -- todo: more allocate @@ -173,11 +173,6 @@ local specifications = setmetatableindex(function(t,name) categories = { } specification.categories = categories end - for k, v in next, categories do - if type(v) == "string" then - categories[k] = categories[v] - end - end setmetatableindex(categories,unknowncategory) -- local fields = setmetatableindex(unknownfield) diff --git a/tex/context/base/publ-imp-apa.lua b/tex/context/base/publ-imp-apa.lua index 47d9a4b80..f2625488e 100644 --- a/tex/context/base/publ-imp-apa.lua +++ b/tex/context/base/publ-imp-apa.lua @@ -16,6 +16,124 @@ -- virtual = { "authoryear", "authoryears", "authornum", "num", "suffix" }, -- } +local article = { + required = { "authors" }, + optional = { "year", "subtitle", "type", "journal", "volume", "number", "pages", "note", "links", "file" }, + sets = { + authors = { "author", "editor", "title" }, + links = { "doi", "url" }, + }, +} + +local magazine = { + required = { "authors", "journal", "year" }, + optional = { "subtitle", "volume", "number", "pages", "month", "day", "note", "links", "file" }, + sets = article.sets, +} + +local book = { + required = { "authors" }, + optional = { "subtitle", "year", "month", "day", "type", "edition", "series", "volume", "number", "pages", "address", "url", "note", "ISBN", "file" }, + sets = { + authors = { "author", "editor", "publisher", "title" }, + }, +} + +local inbook = { + required = { "authors", "title", "chapter", "pages", "year" }, + optional = { "subtitle", "volume", "number", "series", "type", "address", "edition", "month", "note", "ISBN", "file" }, + sets = book.sets, +} + +local booklet = { + required = { "authors" }, + optional = { "subtitle", "howpublished", "address", "month", "year", "note", "file" }, + sets = { + authors = { "author", "title" }, + }, +} + +local incollection = { + required = { "authors", "title", "booktitle", "year" }, + optional = { "subtitle", "volume", "number", "series", "type", "chapter", "pages", "address", "edition", "month", "note", "ISBN", "file" }, + sets = { + authors = { "author", "editor", "publisher" }, + }, +} + +local inproceedings = { + optional = { "subtitle", "volume", "number", "series", "pages", "address", "month", "organization", "note", "ISBN", "file" }, + required = incollection.required, + sets = incollection.sets, +} + +local manual = { + required = { "title" }, + optional = { "subtitle", "author", "organization", "address", "edition", "month", "year", "note", "file" }, +} + +local thesis = { + required = { "author", "title", "school", "year", "type" }, + optional = { "subtitle", "address", "month", "note", "file" }, +} + +local misc = { + required = { }, + optional = { "author", "title", "subtitle", "howpublished", "month", "year", "note", "file" }, +} + +local periodical = { + required = { "title", "year" }, + optional = { "subtitle", "authors", "month", "note", "number", "organization", "series", "volume", "file" }, + sets = { + authors = { "editor", "publisher" }, + }, +} + +local proceedings = { + required = { "title", "year" }, + optional = { "subtitle", "editor", "volume", "number", "series", "address", "month", "organization", "publisher", "note", "pages", "ISBN", "file" }, +} + +local techreport = { + required = { "author", "title", "institution", "year" }, + optional = { "subtitle", "type", "number", "address", "month", "note", "file" }, +} + +local other = { + required = { "author", "title", "year" }, + optional = { "subtitle", "note", "doi", "file" }, +} + +local patent = { + required = { "nationality", "number", "year", "yearfiled" }, + optional = { "author", "title", "subtitle", "language", "assignee", "address", "type", "day", "dayfiled", "month", "monthfiled", "note", "file" }, +} + +local electronic = { + required = { "title" }, + optional = { "subtitle", "address", "author", "howpublished", "month", "note", "organization", "year", "url", "doi", "type", "file" }, +} + +local standard = { + required = { "authors", "title", "subtitle", "year", "note", "url" }, + optional = { "doi", "file" }, + sets = { + authors = { "author", "institution", "organization" }, + }, +} + +local unpublished = { + required = { "author", "title", "note" }, + optional = { "subtitle", "month", "year", "file" }, +} + +local literal = { + required = { "key", "text" }, + optional = { }, + virtual = false, +} + return { name = "apa", version = "1.00", @@ -26,143 +144,63 @@ return { -- all share the same default set "authoryear", "authoryears", "authornum", "num", "suffix", }, + types = { + -- + -- list of fields that are interpreted as names: "NAME [and NAME]" where + -- NAME is one of the following: + -- + -- First vons Last + -- vons Last, First + -- vons Last, Jrs, First + -- Vons, Last, Jrs, First + -- + author = "author", + editor = "author", + artist = "author", + interpreter = "author", + composer = "author", + producer = "author", + }, categories = { - article = { - sets = { - authors = { "author", "editor" }, - links = { "doi", "url" }, - }, - required = { "authors", "title" }, - optional = { "year", "subtitle", "type", "journal", "volume", "number", "pages", "note", "links" }, - }, - magazine = { - sets = { - authors = { "author", "editor" }, - }, - required = { "authors", "title", "journal", "year" }, - optional = { "volume", "number", "pages", "month", "day", "note", "url", "doi" }, - }, - newspaper = { - sets = { - authors = { "author", "editor" }, - }, - required = { "authors", "title", "journal", "year" }, - optional = { "volume", "number", "pages", "month", "day", "note", "url", "doi" }, - }, - book = { - sets = { - authors = { "author", "editor", "publisher" }, - }, - required = { "authors", "title" }, - optional = { "year", "month", "day", "title", "type", "edition", "series", "volume", "number", "pages", "address", "url", "note", "ISBN" }, - }, - booklet = { - required = { "title" }, - optional = { "author", "howpublished", "address", "month", "year", "note" }, - }, - inbook = { - sets = { - authors = { "author", "editor", "publisher" }, - }, - required = { "authors", "title", "chapter", "pages", "year" }, - optional = { "volume", "number", "series", "type", "address", "edition", "month", "note", "ISBN" }, - }, - incollection = { - sets = { - authors = { "author", "editor", "publisher" }, - }, - required = { "authors", "title", "booktitle", "year" }, - optional = { "volume", "number", "series", "type", "chapter", "pages", "address", "edition", "month", "note", "ISBN" }, - }, - inproceedings = { - sets = { - authors = { "author", "editor", "publisher" }, - }, - required = { "authors", "title", "booktitle", "year" }, - optional = { "volume", "number", "series", "pages", "address", "month", "organization", "note", "ISBN" }, - }, - conference = - "inproceedings", - manual = { - required = { "title" }, - optional = { "author", "organization", "address", "edition", "month", "year", "note" }, - }, - mastersthesis = { - required = { "author", "title", "school", "year" }, - optional = { "type", "address", "month", "note" }, - }, - phdthesis = { - required = { "author", "title", "school", "year" }, - optional = { "type", "address", "month", "note" }, - }, - thesis = { - required = { "author", "title", "school", "year", "type" }, - optional = { "address", "month", "note" }, - }, - misc = { - required = { }, - optional = { "author", "title", "howpublished", "month", "year", "note" }, - }, - periodical = { - sets = { - authors = { "editor", "publisher" }, - }, - required = { "title", "year" }, - optional = { "authors", "month", "note", "number", "organization", "series", "volume" }, - }, - proceedings = { - required = { "title", "year" }, - optional = { "editor", "volume", "number", "series", "address", "month", "organization", "publisher", "note", "pages", "ISBN" }, - }, - techreport = { - required = { "author", "title", "institution", "year" }, - optional = { "type", "number", "address", "month", "note" }, - }, - other = { - required = { "author", "title", "year" }, - optional = { "note", "doi" }, - }, - patent = { - required = { "nationality", "number", "year", "yearfiled" }, - optional = { "author", "title", "language", "assignee", "address", "type", "day", "dayfiled", "month", "monthfiled", "note", }, - }, - electronic = { - required = { "title" }, - optional = { "address", "author", "howpublished", "month", "note", "organization", "year", "url", "doi", "type" }, - }, - -- check this! - standard = { - sets = { - authors = { "author", "institution", "organization" }, - }, - required = { "authors", "title", "year", "note", "url" }, - optional = { "doi", }, - }, - unpublished = { - required = { "author", "title", "note" }, - optional = { "month", "year" }, - }, - literal = { - required = { "key", "text", }, - optional = { }, - virtual = false, - }, - -- + article = article, + magazine = magazine, + newspaper = magazine, + book = book, + inbook = inbook, + booklet = booklet, + incollection = incollection, + inproceedings = inproceedings, + conference = inproceedings, + manual = manual, + thesis = thesis, + mastersthesis = thesis, + phdthesis = thesis, + misc = misc, + periodical = periodical, + proceedings = proceedings, + techreport = techreport, + other = other, + patent = patent, + electronic = electronic, + standard = standard, + unpublished = unpublished, + literal = literal, + -- -- the following fields are for documentation and testing purposes - -- + -- ["demo-a"] = { + required = { "author", "title", "year", "note", "url" }, + optional = { "subtitle", "doi", "file" }, sets = { author = { "author", "institution", "organization" }, }, - required = { "author", "title", "year", "note", "url" }, - optional = { "doi", }, }, ["demo-b"] = { + required = { "authors", "title", "year", "note", "url" }, + optional = { "subtitle", "doi", "file" }, sets = { authors = { "author", "institution", "organization" }, }, - required = { "authors", "title", "year", "note", "url" }, - optional = { "doi", }, }, }, } diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi index 8fb350741..95682a12e 100644 --- a/tex/context/base/publ-imp-apa.mkvi +++ b/tex/context/base/publ-imp-apa.mkvi @@ -1,6 +1,6 @@ %D \module %D [ file=publ-imp-apa, -%D version=2013.12.12, % based on bibl-apa.tex and later xml variant +%D version=2013.12.12, %D title=APA bibliography style, %D subtitle=Publications, %D author=Alan Braslau and Hans Hagen, @@ -10,6 +10,7 @@ %C This module is part of the \CONTEXT\ macro||package and is therefore copyrighted %D by \PRAGMA. See mreadme.pdf for details. +% Hans: what does the below mean? Just some wrapper (possible tracing and so) % \loadbtxdefinitionfile[def] %D Instead of texdefinitions without arguments, we could have used setups but in my @@ -40,14 +41,100 @@ % does not work here: \setupbtxcitevariant [alternative=authoryear,sorttype=authoryear] -% moved to publ-ini.mkiv for now... -%\setupbtxlistvariant -% [lastnamesep={\nobreakspace\textampersand\space}, -% finalnamesep={\nobreakspace\textampersand\space}] -% -%\setupbtxlistvariant -% [author] -% [author=invertedshort] +% set all APA compliant values (may be redundant but we do not count on defaults.) + +\setupbtxlistvariant + [\c!namesep={,\space}, + \c!lastnamesep={,\nobreakspace\textampersand\space}, + \c!finalnamesep={,\nobreakspace\textampersand\space}, + \c!firstnamesep=\space, + \c!otherstext={\space\btxlabeltext{\currentbtxalternative:others}}, + \c!juniorsep=\space, + \c!vonsep=\space, + \c!initialsep=\space, % between initials and lastname + %\c!initialssep=\space, % between multiple initials % todo + %\c!initialsterminator={.}, % todo + \c!surnamesep={,\space}, + \c!surnameinitialsep={,\space}, + \c!surnamefirstnamesep={,\space}, + \c!etallimit=5, + \c!etaldisplay=\btxlistvariantparameter\c!etallimit, + %\c!journalconversion=\v!normal, + \c!monthconversion=\v!number, + \c!authorconversion=\v!invertedshort] + +\definebtxlistvariant + [author] + +\definebtxlistvariant + [editor] + [author] + +% like \setupbtxlistvariant above but not exactly... + +\setupbtxcitevariant + [\c!alternative=authoryear, + \c!namesep={,\space}, + \c!lastnamesep={,\nobreakspace\textampersand\space}, + \c!finalnamesep={\nobreakspace\textampersand\space}, % no comma! + \c!firstnamesep=\space, + \c!otherstext={\space\btxlabeltext{\currentbtxalternative:others}}, + \c!juniorsep=\space, + \c!vonsep=\space, + \c!initialsep=\space, + %\c!initialssep=\space, + %\c!initialsterminator={.}, + \c!surnamesep={,\space}, + \c!surnameinitialsep={,\space}, + \c!surnamefirstnamesep={,\space}, + \c!etallimit=5, % when 2-4, show all first time, etaldisplay subsequently... + \c!etaldisplay=1, + \c!monthconversion=\v!number, + \c!authorconversion=\v!name, + \c!interaction=\v!start, + % \c!setups=btx:cite:initialize, + \c!alternative=num, + \c!pubsep={,\space}, + \c!lastpubsep={\space\btxlabeltext{\currentbtxalternative:and}\space}, + \c!finalpubsep={\space\btxlabeltext{\currentbtxalternative:and}\space}, + \c!sorttype=, + \c!compress=\v!no, + \c!inbetween=\space, + \c!range=\endash, + \c!left=, + \c!middle=, + \c!right=] + +\definebtxcitevariant + [author] + [\c!lastnamesep={,\nobreakspace\textampersand\space}, + \c!finalnamesep={\nobreakspace\textampersand\space}, % no comma! + \c!authorconversion=\v!name] + +\definebtxcitevariant + [authoryear] + [\c!compress=\v!yes, + \c!inbetween={,\space}, + \c!left={(}, + \c!right={)}, + \c!pubsep={;\space}, + \c!lastpubsep={;\space}, + \c!finalpubsep={;\space}, + \c!lastnamesep={,\space\btxlabeltext{\currentbtxalternative:and}\space}, + \c!finalnamesep={\space\btxlabeltext{\currentbtxalternative:and}\space}, % no comma! + \c!authorconversion=\v!name] + +\definebtxcitevariant + [authoryears] + [authoryear] + [\c!left=, + \c!inbetween={\space(}, + \c!pubsep={);\space}, + \c!lastpubsep={);\space}, + \c!finalpubsep={);\space}, + \c!lastnamesep={,\space\btxlabeltext{\currentbtxalternative:and}\space}, + \c!finalnamesep={\space\btxlabeltext{\currentbtxalternative:and}\space}, % no comma! + \c!authorconversion=\v!name] % Should the following be loaded by default? @@ -157,7 +244,7 @@ apa:Retrieved={heruntergeladen von}, apa:others={et al.}] -% Thanks: Andrea Valle +% thanks: Andrea Valle \setupbtxlabeltext [it] @@ -195,6 +282,22 @@ % First some helpers: +\starttexdefinition btx:apa:inject #link #content + \ifconditional\btxinteractive + \ifx\currentbtxinternal\empty + #content + \else + \goto { + #content + } [ + #link + ] + \fi + \else + #content + \fi +\stoptexdefinition + \starttexdefinition btx:apa:suffixeddate \btxleftparenthesis \btxdoifelse {year} { @@ -222,21 +325,23 @@ \starttexdefinition btx:apa:title-subtitle-type \btxdoif {title} { \setmode{btx:apa:title-placed} - \btxflush{Word -> title} - % subtitle is not bibtex and currently is ignored. - \btxdoif {subtitle} { - \btxcolon - \btxflush{Word -> subtitle} - } - \doifnotmode {btx:apa:thesis} { - \btxdoifelse{type} { - \btxleftbracket - \btxflush{Word -> type} - \btxrightbracketperiod - } { - \btxperiod + \btxdoif {file} { + % we make the title active opening file + \texdefinition{btx:apa:inject} {url(file:\btxflush{file})} + } + { + \btxflush{Word -> title} + \btxdoif {subtitle} { + \btxcolon + \btxflush{Word -> subtitle} + } + \doifnotmode {btx:apa:thesis} { + \btxdoif{type} { + \btxleftbracket + \btxflush{Word -> type} + \btxrightbracket + } } - } { \btxperiod } } @@ -295,7 +400,7 @@ } \stoptexdefinition -\starttexdefinition btx:apa:title-if-not-placed-including- #type #it +\starttexdefinition btx:apa:title-if-not-placed #it \doifnotmode {btx:apa:title-placed} { \btxdoif {title} { \btxspace @@ -535,25 +640,13 @@ \stoptexdefinition \starttexdefinition btx:apa:url-note-doi - \texdefinition{btx:apa:url} + \btxdoifnot {doi} { + \texdefinition{btx:apa:url} + } \texdefinition{btx:apa:note} \texdefinition{btx:apa:doi} \stoptexdefinition -%\starttexdefinition btx:apa:author-editor-other #field -% \btxdoif {#field} { -% \doifelse {#field} {publisher} { -% \doifmodeelse {btx:apa:publisher-as-author} { -% \btxlabeltext{apa:Author} -% } { -% \btxflush{publisher} -% } -% } { -% \btxflush{#field} -% } -% } -%\stoptexdefinition - \starttexdefinition btx:apa:doifelse-publisher-or-author-or-editor #author #if #else \btxdoifelse {publisher} { \btxdoifelse {#author} { @@ -646,7 +739,7 @@ \startsetups btx:apa:article \texdefinition{btx:apa:author-or-title} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{} + \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:journal-volume-number-pages}{} \texdefinition{btx:apa:url-note-doi} \stopsetups @@ -658,7 +751,7 @@ \startsetups btx:apa:magazine \texdefinition{btx:apa:author-or-title} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{} + \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:journal-volume-number-pages}{} \texdefinition{btx:apa:url-note-doi} \stopsetups @@ -670,7 +763,7 @@ \startsetups btx:apa:newspaper \texdefinition{btx:apa:author-or-title} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{} + \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:journal-volume-number-pages}{pp} \texdefinition{btx:apa:url-note-doi} \stopsetups @@ -685,7 +778,7 @@ \startsetups btx:apa:book \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{publisher} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{it} + \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:edition-volume-number-pages}{edition} \texdefinition{btx:apa:wherefrom-publisher-author-is-}{author} \texdefinition{btx:apa:url-note-doi} @@ -721,7 +814,7 @@ \startsetups btx:apa:incollection \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{publisher} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{} + \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:editor}{booktitle} \texdefinition{btx:apa:edition-volume-number-pages}{edition} \texdefinition{btx:apa:wherefrom-publisher-author-is-}{author} @@ -736,7 +829,7 @@ \startsetups btx:apa:proceedings \texdefinition{btx:apa:editor-or-organization}{title} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{} + \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:edition-volume-number-pages}{edition} \btxdoifelse {editor} { \btxdoif {organization} { @@ -759,7 +852,7 @@ \startsetups btx:apa:inproceedings \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{publisher} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{} + \texdefinition{btx:apa:title-if-not-placed}{} \texdefinition{btx:apa:editor}{booktitle} \texdefinition{btx:apa:edition-volume-number-pages}{edition} \btxdoif {organization} { @@ -784,7 +877,7 @@ % unlikely not to have author! \texdefinition{btx:apa:author-or-title} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{it} + \texdefinition{btx:apa:title-if-not-placed}{it} \btxleftparenthesis \btxdoifelse {type} { \btxflush{type} @@ -827,7 +920,7 @@ \startsetups btx:apa:booklet \texdefinition{btx:apa:author-or-title} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{it} + \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:wherefrom-publisher-author-is-}{howpublished} \texdefinition{btx:apa:url-note-doi} \stopsetups @@ -839,7 +932,7 @@ \startsetups btx:apa:manual \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{organization} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{it} + \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:edition-volume-number-pages}{edition} \texdefinition{btx:apa:wherefrom-publisher-author-is-}{organization} \texdefinition{btx:apa:url-note-doi} @@ -852,7 +945,7 @@ \startsetups btx:apa:techreport \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{institution} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{}{it} + \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:edition-volume-number-pages}{type} \texdefinition{btx:apa:wherefrom-publisher-author-is-}{institution} \texdefinition{btx:apa:url-note-doi} @@ -865,7 +958,7 @@ \startsetups btx:apa:unpublished \texdefinition{btx:apa:author-or-title} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{}{it} + \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:url-note-doi} \stopsetups @@ -879,7 +972,7 @@ \startsetups btx:apa:patent \texdefinition{btx:apa:author-or-editor-or-publisher-or-}{title}{assignee} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{it} + \texdefinition{btx:apa:title-if-not-placed}{it} \begingroup \it \btxdoif {nationality} { @@ -939,7 +1032,7 @@ \startsetups btx:apa:electronic \texdefinition{btx:apa:author-or-title} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{type}{it} + \texdefinition{btx:apa:title-if-not-placed}{it} \btxdoif {organization} { \btxspace \btxflush{organization} @@ -960,7 +1053,7 @@ \startsetups btx:apa:other \texdefinition{btx:apa:author-or-title} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{}{it} + \texdefinition{btx:apa:title-if-not-placed}{it} \texdefinition{btx:apa:url-note-doi} \stopsetups @@ -971,7 +1064,7 @@ \startsetups btx:apa:misc \texdefinition{btx:apa:author-or-title} \texdefinition{btx:apa:suffixeddate} - \texdefinition{btx:apa:title-if-not-placed-including-}{}{it} + \texdefinition{btx:apa:title-if-not-placed}{it} \btxdoif {howpublished} { \btxspace \btxflush{howpublished} diff --git a/tex/context/base/publ-imp-cite.mkvi b/tex/context/base/publ-imp-cite.mkvi index 7d0eecc63..f43f677e9 100644 --- a/tex/context/base/publ-imp-cite.mkvi +++ b/tex/context/base/publ-imp-cite.mkvi @@ -115,14 +115,18 @@ \texdefinition {btx:cite:inject} { \btxcitereference \currentbtxfirst - \ifx\currentbtxsecond\empty \else - \btxcitevariantparameter\v!inbetween + } + \ifx\currentbtxsecond\empty \else + \btxcitevariantparameter\v!inbetween + \texdefinition {btx:cite:inject} { \currentbtxsecond - \fi - \ifx\currentbtxthird\empty \else + } + \fi + \ifx\currentbtxthird\empty \else + \texdefinition {btx:cite:inject} { \currentbtxthird - \fi - } + } + \fi \fi \stopsetups @@ -147,29 +151,34 @@ \startsetups \s!btx:\s!cite:render:variant \fastsetup{\s!btx:\s!cite:concat} - \texdefinition {btx:cite:inject} { - \fastsetup{\s!btx:\s!cite:render:\currentbtxcitevariant} - } + \fastsetup{\s!btx:\s!cite:render:\currentbtxcitevariant} \stopsetups \startsetups \s!btx:\s!cite:common:author \ifx\currentbtxfirst\empty \fastsetup{\s!btx:\s!cite:\s!unknown} \else - \btxcitereference - \currentbtxfirst + \texdefinition {btx:cite:inject} { + \btxcitereference + \currentbtxfirst + } \fi \ifx\currentbtxsecond\empty \else \relax % keeps a following space \btxcitevariantparameter\v!inbetween - \currentbtxsecond + \texdefinition {btx:cite:inject} { + \currentbtxsecond + } \fi \ifx\currentbtxthird\empty \else - \currentbtxthird + \texdefinition {btx:cite:inject} { + \currentbtxthird + } \fi \stopsetups % one level will be removed +% yes, isn't there one too many? \startsetups \s!btx:\s!cite:render:author \fastsetup{\s!btx:\s!cite:common:author} @@ -248,18 +257,15 @@ \fastsetup{\s!btx:\s!cite:render:normal} \stopsetups -% We should create a lua function that prepends "doi:" if not already there... -% then we can combine with :url - -\startsetups \s!btx:\s!cite:render:doi +\startsetups \s!btx:\s!cite:doi \ifx\currentbtxfirst\empty \fastsetup{\s!btx:\s!cite:\s!unknown} \else\ifconditional\btxinteractive \goto { \btxcitereference - \hyphenatedurl{doi:\currentbtxfirst} + \hyphenatedurl{\doif{\currentbtxcitevariant}{doi}{doi:}\currentbtxfirst} } [ - url(http://dx.doi.org/\currentbtxfirst) + url(\doif{\currentbtxcitevariant}{doi}{http://dx.doi.org/}\currentbtxfirst) ] \else \btxcitereference @@ -268,19 +274,7 @@ \stopsetups \startsetups \s!btx:\s!cite:url - \ifx\currentbtxfirst\empty - \fastsetup{\s!btx:\s!cite:\s!unknown} - \else\ifconditional\btxinteractive - \goto { - \btxcitereference - \hyphenatedurl{\currentbtxfirst} - } [ - url(\currentbtxfirst) - ] - \else - \btxcitereference - \hyphenatedurl{\currentbtxfirst} - \fi\fi + \fastsetup{\s!btx:\s!cite:\s!doi} \stopsetups \protect diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 05e5b564b..dc729abab 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -68,7 +68,7 @@ \definelabelclass[btxlabel][2] -% It is not that trivail to come up with a proper organization of setup +% It is not that trivial to come up with a proper organization of setup % and control commands for publications. This is because we have complex % inline as well as extensive list rendering. The rules are partially % driven by somewhat archaic bibtex specifications and evolving journal @@ -76,7 +76,7 @@ % complex that it looks like manual rendering is assumed. But, we want to % automate the process as much as possible. % -% Another complication is that in manuals we want to demonstate different +% Another complication is that in manuals we want to demonstrate different % properties of the implementation and therefore we need a way to handle % independent standards, databases, etc. This has resulted in the following % organization: @@ -945,7 +945,6 @@ \unexpanded\def\btxlistauthorsetup#1{\fastsetup{\s!btx:\s!list:\s!author:#1}} % \btxflushauthor{author} -% \btxflushauthor{artauthor} % \btxflushauthor{editor} % % \btxflushauthor[name]{author} @@ -955,7 +954,6 @@ % \btxflushauthor[invertedshort]{author} % \btxflushauthor{author} -% \btxflushauthor{artauthor} % \btxflushauthor{editor} % % \btxflushauthor[name]{author} @@ -1388,7 +1386,6 @@ \c!continue=\v!no, \c!method=\v!global, % \c!setups=btx:\btxrenderingparameter\c!alternative:initialize, % not the same usage as cite ! - \c!alternative=apa, \c!sorttype=, \c!criterium=\v!text, \c!refcommand=authoryears, % todo @@ -1403,26 +1400,27 @@ \definebtxrendering [\v!standard] +% reasonable defaults; may be redefined by style. + \setupbtxlistvariant [\c!namesep={,\space}, - \c!lastnamesep={,\nobreakspace\textampersand\space}, - \c!finalnamesep={,\nobreakspace\textampersand\space}, + \c!lastnamesep={,\space\btxlabeltext{\currentbtxalternative:and}\space}, + \c!finalnamesep={,\space\btxlabeltext{\currentbtxalternative:and}\space}, \c!firstnamesep=\space, - % \c!andtext={\space\btxlabeltext{\currentbtxalternative:and}\space}, \c!otherstext={\space\btxlabeltext{\currentbtxalternative:others}}, \c!juniorsep=\space, \c!vonsep=\space, \c!initialsep=\space, % between initials and lastname - %\c!initialssep=\space, % between multiple initials - %\c!initialsterminator={.}, + %\c!initialssep=\space, % between multiple initials % todo + %\c!initialsterminator={.}, % todo \c!surnamesep={,\space}, \c!surnameinitialsep={,\space}, \c!surnamefirstnamesep={,\space}, - \c!etallimit=5, + \c!etallimit=3, \c!etaldisplay=\btxlistvariantparameter\c!etallimit, - %c!journalconversion=\v!normal, + %\c!journalconversion=\v!normal, \c!monthconversion=\v!number, - \c!authorconversion=\v!invertedshort] + \c!authorconversion=\v!inverted] \definebtxlistvariant [author] @@ -1431,21 +1429,31 @@ [editor] [author] -\definebtxlistvariant - [artauthor] - [author] - -\definebtxlistvariant - [invertedshort] - \setupbtxcitevariant - [\c!interaction=\v!start, + [\c!namesep={,\space}, + \c!lastnamesep={,\space\btxlabeltext{\currentbtxalternative:and}\space}, + \c!finalnamesep={,\space\btxlabeltext{\currentbtxalternative:and}\space}, + \c!firstnamesep=\space, + \c!otherstext={\space\btxlabeltext{\currentbtxalternative:others}}, + \c!juniorsep=\space, + \c!vonsep=\space, + \c!initialsep=\space, + %\c!initialssep=\space, + %\c!initialsterminator={.}, + \c!surnamesep={,\space}, + \c!surnameinitialsep={,\space}, + \c!surnamefirstnamesep={,\space}, + \c!etallimit=5, % when 2-4, show all first time, etaldisplay subsequently... + \c!etaldisplay=1, + \c!monthconversion=\v!number, + \c!authorconversion=\v!name, + \c!interaction=\v!start, % \c!setups=btx:cite:initialize, \c!alternative=num, - % APA 2013 section 6.16 (p. 177) \c!pubsep={,\space}, \c!lastpubsep={\space\btxlabeltext{\currentbtxalternative:and}\space}, \c!finalpubsep={\space\btxlabeltext{\currentbtxalternative:and}\space}, + \c!sorttype=, \c!compress=\v!no, \c!inbetween=\space, \c!range=\endash, @@ -1455,13 +1463,11 @@ \definebtxcitevariant [author] - %[c!sorttype=, \definebtxcitevariant [authornum] [author] [\c!left={(}, - %\c!middle={,\space}, \c!right={)}] \definebtxcitevariant @@ -1469,7 +1475,6 @@ [\c!compress=\v!yes, \c!inbetween={,\space}, \c!left={(}, - %\c!middle={,\space}, \c!right={)}, \c!pubsep={;\space}, \c!lastpubsep={;\space}, @@ -1496,12 +1501,6 @@ [\c!left=, \c!right=] -% \definebtxcitevariant -% [author:years] -% [authoryears] -% [\c!left=, -% \c!right=] - \definebtxcitevariant [author:years] [author:year] @@ -1509,7 +1508,6 @@ \definebtxcitevariant [year] [\c!left={(}, - %\c!middle={,\space}, \c!pubsep={,\space}, \c!lastpubsep={,\space}, \c!finalpubsep={,\space}, @@ -1517,12 +1515,10 @@ \definebtxcitevariant [title] - %[\c!middle={,\space}] \definebtxcitevariant [tag] [\c!left={[}, - %\c!middle={,\space}, \c!right={]}] \definebtxcitevariant @@ -1532,13 +1528,11 @@ \definebtxcitevariant [serial] [\c!left={[}, - %\c!middle={,\space}, \c!right={]}] \definebtxcitevariant [page] [\c!left={[}, - %\c!middle={,\space}, \c!right={]}] \definebtxcitevariant @@ -1551,13 +1545,11 @@ \definebtxcitevariant [short] [\c!left={[}, - %\c!middle={,\space}, \c!right={]}] \definebtxcitevariant [category] [\c!left={[}, - %\c!middle={,\space}, \c!right={]}] \definebtxcitevariant @@ -1567,65 +1559,27 @@ \definebtxcitevariant [doi] [\c!left={[}, - %\c!middle={,\space}, \c!right={]}] \definebtxcitevariant [url] [\c!left={[}, - %\c!middle={,\space}, \c!right={]}] \definebtxcitevariant [page] [\c!left=, - %\c!middle={,\space}, \c!right=] \definebtxcitevariant [num] [\c!compress=\v!yes, \c!left={[}, - %\c!middle={,\space}, \c!right={]}, \c!pubsep={,}, \c!lastpubsep={,}, \c!finalpubsep={,}] -% These cannot, for some reason, be folded-in above... - -\setupbtxcitevariant - [\c!namesep={,\space}, - \c!lastnamesep={,\nobreakspace\textampersand\space}, - \c!finalnamesep={\nobreakspace\textampersand\space}, % no comma! - \c!firstnamesep=\space, - %\c!andtext={\space\btxlabeltext{\currentbtxalternative:and}\space}, - \c!otherstext={\space\btxlabeltext{\currentbtxalternative:others}}, - \c!juniorsep=\space, - \c!vonsep=\space, - \c!initialsep=\space, - %\c!initialssep=\space, % used? - %\c!initialsterminator={.}, - \c!surnamesep={,\space}, - \c!surnameinitialsep={,\space}, - \c!surnamefirstnamesep={,\space}, - \c!etallimit=5, % when 2-4, show all first time, etaldisplay subsequently... - \c!etaldisplay=1, - \c!monthconversion=\v!number, - \c!authorconversion=\v!name] - -\setupbtxcitevariant - [author] - [\c!lastnamesep={,\space\btxlabeltext{\currentbtxalternative:and}\space}, - \c!finalnamesep={\space\btxlabeltext{\currentbtxalternative:and}\space}, % no comma! - \c!authorconversion=\v!name] - -\setupbtxcitevariant - [authoryears] - [\c!lastnamesep={,\space\btxlabeltext{\currentbtxalternative:and}\space}, - \c!finalnamesep={\space\btxlabeltext{\currentbtxalternative:and}\space}, % no comma! - \c!authorconversion=\v!name] - % Do we want these in the format? Loading them delayed is somewhat messy. \loadbtxdefinitionfile[commands] @@ -1639,7 +1593,4 @@ \setupbtx [\c!alternative=apa] -\setupbtxcitevariant - [\c!alternative=authoryear] - \protect diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 35ad7a3e7..f5596fd1c 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 4de759648..347977e6e 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index 157aa0e7e..3c1866f6f 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -394,6 +394,12 @@ return { }, { category = "mkiv", + filename = "typo-sus", + loading = "always", + status = "okay", + }, + { + category = "mkiv", filename = "node-pag", loading = "never", status = "okay", @@ -4832,6 +4838,11 @@ return { }, { category = "lua", + filename = "typo-sus", + status = "okay", + }, + { + category = "lua", filename = "typo-brk", status = "todo", }, diff --git a/tex/context/base/typo-bld.mkiv b/tex/context/base/typo-bld.mkiv index 10502005b..459dfb132 100644 --- a/tex/context/base/typo-bld.mkiv +++ b/tex/context/base/typo-bld.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\writestatus{loading}{ConTeXt Node Macros / Paragraph Building} +\writestatus{loading}{ConTeXt Typesetting Macros / Paragraph Building} %D This is very experimental, undocumented, subjected to changes, etc. just as %D the underlying interfaces. But at least it's cleaned as part of the status-mkiv diff --git a/tex/context/base/typo-sus.lua b/tex/context/base/typo-sus.lua new file mode 100644 index 000000000..ccb10d411 --- /dev/null +++ b/tex/context/base/typo-sus.lua @@ -0,0 +1,215 @@ +if not modules then modules = { } end modules ['typo-sus'] = { + version = 1.001, + comment = "companion to typo-sus.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local punctuation = { + po = true, +} + +local openquote = { + ps = true, + pi = true, +} + +local closequote = { + pe = true, + pf = true, +} + +local categories = characters.categories + +local nodecodes = nodes.nodecodes + +local glyph_code = nodecodes.glyph +local kern_code = nodecodes.kern +local penalty_code = nodecodes.penalty +local glue_code = nodecodes.glue +local math_code = nodecodes.math +local hlist_code = nodecodes.hlist + +local nuts = nodes.nuts +local tonut = nodes.tonut +local tonode = nodes.tonode + +local getid = nuts.getid +local getchar = nuts.getchar +local getprev = nuts.getprev +local getnext = nuts.getnext +local getfield = nuts.getfield +local getattr = nuts.getattr +local getfont = nuts.getfont + +local setcolor = nodes.tracers.colors.set +local insert_before = nuts.insert_before +local insert_after = nuts.insert_after +local end_of_math = nuts.end_of_math + +local nodepool = nuts.pool + +local new_rule = nodepool.rule +local new_kern = nodepool.kern + +local a_characters = attributes.private("characters") + +local threshold = 65536 / 4 + +local function special(n) + if n then + local id = getid(n) + if id == kern_code then + local kern = getfield(n,"kern") + return kern < threshold + elseif id == penalty_code then + return true + elseif id == glue_code then + local width = getfield(getfield(n,"spec"),"width") + return width < threshold + elseif id == hlist_code then + local width = getfield(n,"width") + return width < threshold + end + else + return false + end +end + +local function goback(current) + local prev = getprev(current) + while prev and special(prev) do + prev = getprev(prev) + end + if prev then + return prev, getid(prev) + end +end + +local function goforward(current) + local next = getnext(current) + while next and special(next) do + next = getnext(next) + end + if next then + return next, getid(next) + end +end + +local function mark(head,current,id,color) + if id == glue_code then + local width = getfield(getfield(current,"spec"),"width") + local rule = new_rule(width) + local kern = new_kern(-width) + head = insert_before(head,current,rule) + head = insert_before(head,current,kern) + setcolor(rule,color) + elseif id == kern_code then + local width = getfield(current,"kern") + local rule = new_rule(width) + local kern = new_kern(-width) + head = insert_before(head,current,rule) + head = insert_before(head,current,kern) + setcolor(rule,color) + else + local width = getfield(current,"width") + local rule = new_rule(width,getfield(current,"height"),getfield(current,"depth")) + local kern = new_kern(-width) + head = insert_before(head,current,rule) + head = insert_before(head,current,kern) + setcolor(rule,color) + setcolor(current,"white") + end + return head, current +end + +-- we can cache the font and skip ahead to next but it doesn't +-- save enough time and it makes the code looks bad too ... after +-- all, we seldom use this + +function typesetters.showsuspects(head) + local head = tonut(head) + local current = head + local lastdone = nil + while current do + local id = getid(current) + if id == glyph_code then + local char = getchar(current) + local code = categories[char] + local done = false + if punctuation[code] then + local prev, pid = goback(current) + if prev and pid == glue_code then + done = "darkblue" + elseif prev and pid == math_code then + done = "darkgray" + else + local next, nid = goforward(current) + if next and nid ~= glue_code then + done = "darkblue" + end + end + elseif openquote[code] then + local next, nid = goforward(current) + if next and nid == glue_code then + done = "darkred" + end + elseif closequote[code] then + local prev, pid = goback(current) + if prev and pid == glue_code then + done = "darkred" + end + else + local prev, pid = goback(current) + if prev then + if pid == math_code then + done = "darkgray" + elseif pid == glyph_code and getfont(current) ~= getfont(prev) then + if lastdone ~= prev then + done = "darkgreen" + end + end + end + if not done then + local next, nid = goforward(current) + if next then + if nid == math_code then + done = "darkgray" + elseif nid == glyph_code and getfont(current) ~= getfont(next) then + if lastdone ~= prev then + done = "darkgreen" + end + end + end + end + end + if done then + head = mark(head,current,id,done) + lastdone = current + end + current = getnext(current) + elseif id == math_code then + current = getnext(end_of_math(current)) + elseif id == glue_code then + local a = getattr(current,a_characters) + if a then + head = mark(head,current,id,"orange") + end + current = getnext(current) + else + current = getnext(current) + end + end + return tonode(head), false +end + +nodes.tasks.appendaction("processors","after","typesetters.showsuspects") +nodes.tasks.disableaction("processors","typesetters.showsuspects") + +-- or maybe a directive + +trackers.register("typesetters.suspects",function(v) + nodes.tasks.setaction("processors","typesetters.showsuspects",v) +end) + diff --git a/tex/context/base/typo-sus.mkiv b/tex/context/base/typo-sus.mkiv new file mode 100644 index 000000000..fe44e6327 --- /dev/null +++ b/tex/context/base/typo-sus.mkiv @@ -0,0 +1,51 @@ +%D \module +%D [ file=typo-sus, +%D version=2014.11.06, +%D title=\CONTEXT\ Typesetting Macros, +%D subtitle=Checking Suspects, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Typesetting Macros / Checking Suspects} + +%D This is a rather special module, mostly needed by ourselves for +%D projects where copy||editing is not that precise. + +\registerctxluafile{typo-sus}{1.001} + +\unexpanded\def\showsuspects{\enabletrackers[typesetters.suspects]} + +%D The suspicious spacing will be colored in the text. There can be false +%D positives but this features is mostly used when proofreading. So, we +%D don't worry too much about interference (and efficiency). +%D +%D \unexpanded\def\showsample#1% +%D {\NC \type{#1}% +%D \NC \enabletrackers[typesetters.suspects]#1\disabletrackers[typesetters.spacing]% +%D \NC \NR} +%D +%D \starttabulate[|||][before=,after=] +%D \showsample{foo$x$} +%D \showsample{$x$bar} +%D \showsample{foo$x$bar} +%D \showsample{$f+o+o$:} +%D \showsample{;$f+o+o$} +%D \showsample{; bar} +%D \showsample{foo:bar} +%D \showsample{\quote{ foo }} +%D \showsample{\quote{bar }} +%D \showsample{\quote{ bar}} +%D \showsample{(foo )} +%D \showsample{\{foo \}} +%D \showsample{foo{\bf gnu}bar} +%D \showsample{foo$x^2$bar} +%D \showsample{foo\nobreakspace bar} +%D \stoptabulate + +\endinput + diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 5979c5749..a9f31df7f 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 : 11/05/14 15:22:17 +-- merge date : 11/06/14 14:55:16 do -- begin closure to overcome local limits and interference |