From b37d4b7219f0631cb86b5c2f2fd794dbf57acc3e Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Tue, 14 Oct 2014 11:15:04 +0200 Subject: 2014-10-14 10:59:00 --- tex/context/base/buff-imp-lua.lua | 4 +- tex/context/base/buff-ini.lua | 6 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4385 -> 4384 bytes tex/context/base/context.mkiv | 4 +- tex/context/base/font-con.lua | 6 + tex/context/base/lpdf-ano.lua | 4 +- tex/context/base/lpdf-ini.lua | 17 +- tex/context/base/m-morse.mkvi | 273 ---- tex/context/base/math-ali.mkiv | 15 +- tex/context/base/mtx-context-listing.tex | 2 +- tex/context/base/page-mix.lua | 71 +- tex/context/base/page-mix.mkiv | 32 +- tex/context/base/publ-aut.lua | 5 +- tex/context/base/publ-imp-apa.mkvi | 118 +- tex/context/base/publ-imp-author.mkvi | 16 +- tex/context/base/publ-imp-cite.mkvi | 21 +- tex/context/base/publ-ini.lua | 814 ++++++----- tex/context/base/publ-ini.mkiv | 7 +- tex/context/base/status-files.pdf | Bin 24716 -> 24702 bytes tex/context/base/status-lua.pdf | Bin 333682 -> 333862 bytes tex/context/base/strc-lst.mkvi | 26 +- tex/context/base/strc-reg.mkiv | 46 +- tex/context/base/strc-rsc.lua | 15 +- tex/context/base/strc-tag.lua | 5 + tex/context/base/typo-inj.lua | 90 ++ tex/context/base/typo-inj.mkiv | 72 + tex/context/base/x-asciimath.lua | 1467 +++++++++----------- tex/context/bib/bibl-apa-it.tex | 386 +++++ tex/generic/context/luatex/luatex-fonts-merged.lua | 7 +- 30 files changed, 1982 insertions(+), 1549 deletions(-) delete mode 100644 tex/context/base/m-morse.mkvi create mode 100644 tex/context/base/typo-inj.lua create mode 100644 tex/context/base/typo-inj.mkiv create mode 100644 tex/context/bib/bibl-apa-it.tex diff --git a/tex/context/base/buff-imp-lua.lua b/tex/context/base/buff-imp-lua.lua index 4396c1ab8..e873a34d1 100644 --- a/tex/context/base/buff-imp-lua.lua +++ b/tex/context/base/buff-imp-lua.lua @@ -159,11 +159,11 @@ end local grammar = visualizers.newgrammar("default", { "visualizer", sstring = makepattern(handler,"quote",patterns.dquote) - * (V("whitespace") + makepattern(handler,"string",1-patterns.dquote))^0 -- patterns.nodquote + * (V("whitespace") + makepattern(handler,"string",(1-patterns.dquote-V("whitespace"))^1))^0 -- patterns.nodquote * makepattern(handler,"quote",patterns.dquote), dstring = makepattern(handler,"quote",patterns.squote) - * (V("whitespace") + makepattern(handler,"string",1-patterns.squote))^0 -- patterns.nosquote + * (V("whitespace") + makepattern(handler,"string",(1-patterns.squote-V("whitespace"))^1))^0 -- patterns.nosquote * makepattern(handler,"quote",patterns.squote), longstring = longstring / long, diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua index c4046d649..040aa731e 100644 --- a/tex/context/base/buff-ini.lua +++ b/tex/context/base/buff-ini.lua @@ -170,12 +170,14 @@ commands.assignbuffer = assign local anything = patterns.anything local alwaysmatched = patterns.alwaysmatched +local utf8character = patterns.utf8character local function countnesting(b,e) local n local g = P(b) / function() n = n + 1 end + P(e) / function() n = n - 1 end - + anything + -- + anything + + utf8character local p = alwaysmatched / function() n = 0 end * g^0 * alwaysmatched / function() return n end @@ -232,7 +234,7 @@ local continue = false -- how about tabs -local getmargin = (Cs(P(" ")^1)*P(-1)+1)^1 +local getmargin = (Cs(P(" ")^1)*P(-1)+1)^1 -- 1 or utf8character local eol = patterns.eol local whatever = (P(1)-eol)^0 * eol^1 diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 177366224..60f79b963 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.10.09 15:22} +\newcontextversion{2014.10.14 10:56} %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 index 835657da2..d969cad74 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index d08f95dd4..49990f7e7 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.10.09 15:22} +\edef\contextversion{2014.10.14 10:56} \edef\contextkind {beta} %D For those who want to use this: @@ -172,6 +172,8 @@ \loadmarkfile{typo-ini} \loadmarkfile{typo-bld} % par builders +\loadmarkfile{typo-inj} + \loadmkvifile{file-syn} \loadmkvifile{file-mod} diff --git a/tex/context/base/font-con.lua b/tex/context/base/font-con.lua index dd4cfa56a..bb9691225 100644 --- a/tex/context/base/font-con.lua +++ b/tex/context/base/font-con.lua @@ -45,6 +45,8 @@ constructors.cache = containers.define("fonts", "constructors", constr constructors.privateoffset = 0xF0000 -- 0x10FFFF +constructors.cacheintex = true -- so we see the original table in fonts.font + -- Some experimental helpers (handy for tracing): -- -- todo: extra: @@ -437,6 +439,7 @@ function constructors.scale(tfmdata,specification) target.tounicode = 1 target.cidinfo = properties.cidinfo target.format = properties.format + target.cache = constructors.cacheintex and "yes" or "renew" -- local fontname = properties.fontname or tfmdata.fontname -- for the moment we fall back on local fullname = properties.fullname or tfmdata.fullname -- names in the tfmdata although @@ -454,6 +457,7 @@ function constructors.scale(tfmdata,specification) target.psname = psname target.name = name -- + -- properties.fontname = fontname properties.fullname = fullname properties.filename = filename @@ -952,6 +956,8 @@ function constructors.finalize(tfmdata) tfmdata.slant = nil tfmdata.units_per_em = nil -- + tfmdata.cache = nil + -- properties.finalized = true -- return tfmdata diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua index ab78ec0a1..6370abff8 100644 --- a/tex/context/base/lpdf-ano.lua +++ b/tex/context/base/lpdf-ano.lua @@ -546,7 +546,9 @@ local function pdfaction(actions) if what then what = what(a,actions) end - if what then + if action == what then + -- ignore this one, else we get a loop + elseif what then action.Next = what action = what else diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 033895cdc..6167b86cc 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -313,6 +313,7 @@ local function merge_t(a,b) return setmetatable(t,getmetatable(a)) end +local f_key_null = formatters["/%s null"] local f_key_value = formatters["/%s %s"] local f_key_dictionary = formatters["/%s << % t >>"] local f_dictionary = formatters["<< % t >>"] @@ -344,7 +345,12 @@ tostring_d = function(t,contentonly,key) elseif tv == "table" then local mv = getmetatable(v) if mv and mv.__lpdftype then - r[rn] = f_key_value(k,tostring(v)) + -- if v == t then + -- report_objects("ignoring circular reference in dirctionary") + -- r[rn] = f_key_null(k) + -- else + r[rn] = f_key_value(k,tostring(v)) + -- end elseif v[1] then r[rn] = f_key_value(k,tostring_a(v)) else @@ -385,7 +391,12 @@ tostring_a = function(t,contentonly,key) local mv = getmetatable(v) local mt = mv and mv.__lpdftype if mt then - r[k] = tostring(v) + -- if v == t then + -- report_objects("ignoring circular reference in array") + -- r[k] = "null" + -- else + r[k] = tostring(v) + -- end elseif v[1] then r[k] = tostring_a(v) else @@ -413,7 +424,7 @@ local tostring_x = function(t) return concat(t," ") end local tostring_s = function(t) return toeight(t[1]) end local tostring_p = function(t) return topdfdoc(t[1],t[2]) end local tostring_u = function(t) return tosixteen(t[1]) end -local tostring_n = function(t) return tostring(t[1]) end -- tostring not needed +----- tostring_n = function(t) return tostring(t[1]) end -- tostring not needed local tostring_n = function(t) return f_tonumber(t[1]) end -- tostring not needed local tostring_c = function(t) return t[1] end -- already prefixed (hashed) local tostring_z = function() return "null" end diff --git a/tex/context/base/m-morse.mkvi b/tex/context/base/m-morse.mkvi deleted file mode 100644 index a2c20dff7..000000000 --- a/tex/context/base/m-morse.mkvi +++ /dev/null @@ -1,273 +0,0 @@ -%D \module -%D [ file=m-morse, -%D version=2010.12.10, -%D title=\CONTEXT\ Extra Modules, -%D subtitle=Morse, -%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. - -% todo: act upon the node list -% make it a buffer operation -% nice in cld manual - -\startluacode - -moduledata.morse = moduledata.morse or { } -local morse = moduledata.morse - -local utfcharacters, gsub = string.utfcharacters, string.gsub -local ucchars, shchars = characters.ucchars, characters.shchars - -local codes = { - - ["A"] = "·—", - ["B"] = "—···", - ["C"] = "—·—·", - ["D"] = "—··", - ["E"] = "·", - ["F"] = "··—·", - ["G"] = "——·", - ["H"] = "····", - ["I"] = "··", - ["J"] = "·———", - ["K"] = "—·—", - ["L"] = "·—··", - ["M"] = "——", - ["N"] = "—·", - ["O"] = "———", - ["P"] = "·——·", - ["Q"] = "——·—", - ["R"] = "·—·", - ["S"] = "···", - ["T"] = "—", - ["U"] = "··—", - ["V"] = "···—", - ["W"] = "·——", - ["X"] = "—··—", - ["Y"] = "—·——", - ["Z"] = "——··", - - ["0"] = "—————", - ["1"] = "·————", - ["2"] = "··———", - ["3"] = "···——", - ["4"] = "····—", - ["5"] = "·····", - ["6"] = "—····", - ["7"] = "——···", - ["8"] = "———··", - ["9"] = "————·", - - ["."] = "·—·—·—", - [","] = "——··——", - [":"] = "———···", - [";"] = "—·—·—", - - ["?"] = "··——··", - ["!"] = "—·—·——", - - ["-"] = "—····—", - ["/"] = "—··—· ", - - ["("] = "—·——·", - [")"] = "—·——·—", - - ["="] = "—···—", - ["@"] = "·——·—·", - - ["'"] = "·————·", - ['"'] = "·—··—·", - - ["À"] = "·——·—", - ["Å"] = "·——·—", - ["Ä"] = "·—·—", - ["Æ"] = "·—·—", - ["Ç"] = "—·—··", - ["É"] = "··—··", - ["È"] = "·—··—", - ["Ñ"] = "——·——", - ["Ö"] = "———·", - ["Ø"] = "———·", - ["Ü"] = "··——", - ["ß"] = "··· ···", - -} - -morse.codes = codes - -local fallbackself = false - -local function codefallback(t,k) - if k then - local u = ucchars[k] - local v = rawget(t,u) or rawget(t,shchars[u]) or false - t[k] = v - return v - elseif fallbackself then - return k - else - return false - end -end - -table.setmetatableindex(codes,codefallback) - -local MorseBetweenWords = context.MorseBetweenWords -local MorseBetweenCharacters = context.MorseBetweenCharacters -local MorseLong = context.MorseLong -local MorseShort = context.MorseShort -local MorseSpace = context.MorseSpace -local MorseUnknown = context.MorseUnknown - -local function toverbose(str) - str = gsub(str,"%s*+%s*","+") - str = gsub(str,"%s+"," ") - local done = false - for m in utfcharacters(str) do - if done then - MorseBetweenCharacters() - end - if m == "·" or m == "." then - MorseShort() - done = true - elseif m == "—" or m == "-" then - MorseLong() - done = true - elseif m == " " then - if done then - MorseBetweenCharacters() - end - done = false - elseif m == "+" then - MorseBetweenWords() - done = false - else - MorseUnknown(m) - end - end -end - -local function toregular(str) - local inmorse = false - for s in utfcharacters(str) do - local m = codes[s] - if m then - if inmorse then - MorseBetweenWords() - else - inmorse = true - end - local done = false - for m in utfcharacters(m) do - if done then - MorseBetweenCharacters() - else - done = true - end - if m == "·" then - MorseShort() - elseif m == "—" then - MorseLong() - elseif m == " " then - MorseBetweenCharacters() - end - end - inmorse = true - elseif s == "\n" or s == " " then - MorseSpace() - inmorse = false - else - if inmorse then - MorseBetweenWords() - else - inmorse = true - end - MorseUnknown(s) - end - end -end - -local function tomorse(str,verbose) - if verbose then - toverbose(str) - else - toregular(str) - end -end - -morse.tomorse = tomorse - -function morse.filetomorse(name,verbose) - tomorse(resolvers.loadtexfile(name),verbose) -end - -function morse.showtable() - context.starttabulate { "|l|l|" } -- { "|l|l|l|" } - for k, v in table.sortedpairs(codes) do - context.NC() context(k) - -- context.NC() context(v) - context.NC() tomorse(v,true) - context.NC() context.NR() - end - context.stoptabulate() -end - -\stopluacode - -\unprotect - -% todo: \setupmorse, but probably it's not worth the trouble. - -\def\MorseWidth {0.4em} -\def\MorseHeight {0.2em} -%def\MorseShort {\dontleavehmode\blackrule[\c!height=\MorseHeight,\c!width=\dimexpr\MorseWidth]} -%def\MorseLong {\dontleavehmode\blackrule[\c!height=\MorseHeight,\c!width=3\dimexpr\MorseWidth]} -\def\MorseShort {\dontleavehmode\vrule\!!width \dimexpr\MorseWidth\!!height\MorseHeight\!!depth\zeropoint\relax} -\def\MorseLong {\dontleavehmode\vrule\!!width3\dimexpr\MorseWidth\!!height\MorseHeight\!!depth\zeropoint\relax} -\def\MorseBetweenCharacters {\kern\MorseWidth} -\def\MorseBetweenWords {\hskip3\dimexpr\MorseWidth\relax} -\def\MorseSpace {\hskip7\dimexpr\MorseWidth\relax} -\def\MorseUnknown #text{[\detokenize{#text}]} - -\unexpanded\def\MorseCode #text{\ctxlua{moduledata.morse.tomorse(\!!bs#text\!!es,true)}} -\unexpanded\def\MorseString #text{\ctxlua{moduledata.morse.tomorse(\!!bs#text\!!es)}} -\unexpanded\def\MorseFile #text{\ctxlua{moduledata.morse.filetomorse("#text")}} -\unexpanded\def\MorseTable {\ctxlua{moduledata.morse.showtable()}} - -\let\Morse \MorseString - -%def\MorseShort {·} -%def\MorseLong {—} - -\protect - -\continueifinputfile{m-morse.mkvi} - -\starttext - -\MorseTable - -\startlines -\MorseCode{—·—· ——— —· — · —··— —+—— —·— ·· ···—} -\MorseCode{—·—· ——— —· — · —··— — + —— —·— ·· ···—} -\Morse{ÀÁÂÃÄÅàáâãäå} -\Morse{ÆÇæç} -\Morse{ÈÉÊËèéêë} -\Morse{ÌÍÎÏìíîï} -\Morse{Ññ} -\Morse{ÒÓÔÕÖòóôõö} -\Morse{Øø} -\Morse{ÙÚÛÜùúû} -\Morse{Ýýÿ} -\Morse{ß} -\Morse{Ţţ} -\stoplines - -\Morse{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} - -\stoptext diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv index ddfb0f909..124b85dec 100644 --- a/tex/context/base/math-ali.mkiv +++ b/tex/context/base/math-ali.mkiv @@ -608,13 +608,24 @@ % \emptyhbox % noted at 25-05-2014: what was that one doing here? it messed up spacing \math_matrix_align_method_analyze \mathmatrixleft + % new per 13-10-2014 + \edef\p_strut{\mathmatrixparameter\c!strut}% + \ifx\p_strut\v!no + \let\m_matrix_strut\relax + \else + \let\m_matrix_strut\strut + \ifx\p_strut\v!yes\else + \spacing\p_strut + \fi + \fi + % \mathmatrixbox\bgroup \pushmacro\math_matrix_NC \let\endmath\relax \def\NC{\math_matrix_NC}% \def\MC{\math_matrix_NC\ifmmode\else\startimath\let\endmath\stopimath\fi}% \global\let\math_matrix_NC\math_matrix_NC_indeed - \def\NR{\endmath\global\let\math_matrix_NC\math_matrix_NC_indeed\crcr}% + \def\NR{\endmath\global\let\math_matrix_NC\math_matrix_NC_indeed\m_matrix_strut \crcr}% \normalbaselines \mathsurround\zeropoint \everycr\emptytoks @@ -700,7 +711,7 @@ %D %D \typebuffer \getbuffer %D -%D \definemathmatrix[bmatrix][left={\left[\mskip\thinmuskip},right={\mskip\thinmuskip\right]}] +%D \definemathmatrix[bmatrix][left={\left[\mskip\thinmuskip},right={\mskip\thinmuskip\right]},strut=1.25] %D %D \startbuffer %D \placeformula \startformula[-] \startbmatrix diff --git a/tex/context/base/mtx-context-listing.tex b/tex/context/base/mtx-context-listing.tex index 2a333c789..8b7efd8a5 100644 --- a/tex/context/base/mtx-context-listing.tex +++ b/tex/context/base/mtx-context-listing.tex @@ -30,7 +30,7 @@ \input mtx-context-common.tex \setupbodyfont - [11pt,tt,\getdocumentargument{bodyfont}] + [dejavu,11pt,tt,\getdocumentargument{bodyfont}] % dejavu is more complete \setuptyping [lines=yes] diff --git a/tex/context/base/page-mix.lua b/tex/context/base/page-mix.lua index 0fbaa4e30..2695d915b 100644 --- a/tex/context/base/page-mix.lua +++ b/tex/context/base/page-mix.lua @@ -14,6 +14,7 @@ if not modules then modules = { } end modules ["page-mix"] = { -- local number, table = number, table local concat = table.concat +local ceil, floor = math.ceil, math.floor local trace_state = false trackers.register("mixedcolumns.trace", function(v) trace_state = v end) local trace_detail = false trackers.register("mixedcolumns.detail", function(v) trace_detail = v end) @@ -81,6 +82,7 @@ local v_auto = variables.auto local v_none = variables.none local v_more = variables.more local v_less = variables.less +local v_halfline = variables.halfline pagebuilders = pagebuilders or { } pagebuilders.mixedcolumns = pagebuilders.mixedcolumns or { } @@ -718,8 +720,10 @@ end function mixedcolumns.finalize(result) if result then - local results = result.results - for i=1,result.nofcolumns do + local results = result.results + local columns = result.nofcolumns + local maxtotal = 0 + for i=1,columns do local r = results[i] local h = r.head if h then @@ -747,6 +751,16 @@ function mixedcolumns.finalize(result) r.inserts[c] = t end end + local total = r.height + r.depth + if total > maxtotal then + maxtotal = total + end + r.total = total + end + result.maxtotal = maxtotal + for i=1,columns do + local r = results[i] + r.extra = maxtotal - r.total end end end @@ -819,13 +833,14 @@ function mixedcolumns.getsplit(result,n) local strutht = result.strutht local strutdp = result.strutdp local lineheight = strutht + strutdp + local isglobal = result.alternative == v_global local v = new_vlist() setfield(v,"list",h) -- local v = vpack(h,"exactly",height) - if result.alternative == v_global then -- option + if isglobal then -- option result.height = result.maxheight end @@ -833,11 +848,55 @@ function mixedcolumns.getsplit(result,n) local dp = 0 local wd = result.originalwidth - local grid = result.grid + local grid = result.grid + local internalgrid = result.internalgrid + local httolerance = .25 + local dptolerance = .50 + local lineheight = internalgrid == v_halfline and lineheight/2 or lineheight + + local function amount(r,s,t) + local l = ceil((r-t)/lineheight) + local a = lineheight * l + if a > s then + return a - s + else + return s + end + end if grid then - ht = lineheight * math.ceil(result.height/lineheight) - strutdp - dp = strutdp + -- print(n,result.maxtotal,r.total,r.extra) + if isglobal then + -- ht = (lineheight * ceil(result.height/lineheight) - strutdp + ht = amount(rh,strutdp,0) + dp = strutdp + else + -- natural dimensions + local rh = r.height + local rd = r.depth + if rh > ht then + ht = amount(rh,strutdp,httolerance*strutht) + end + if rd > dp then + dp = amount(rd,strutht,dptolerance*strutdp) + end + -- forced dimensions + local rh = result.height or 0 + local rd = result.depth or 0 + if rh > ht then + ht = amount(rh,strutdp,httolerance*strutht) + end + if rd > dp then + dp = amount(rd,strutht,dptolerance*strutdp) + end + -- always one line at least + if ht < strutht then + ht = strutht + end + if dp < strutdp then + dp = strutdp + end + end else ht = result.height dp = result.depth diff --git a/tex/context/base/page-mix.mkiv b/tex/context/base/page-mix.mkiv index 0fe56d970..0066f02cf 100644 --- a/tex/context/base/page-mix.mkiv +++ b/tex/context/base/page-mix.mkiv @@ -69,6 +69,7 @@ \c!maxheight=\textheight, \c!maxwidth=\makeupwidth, \c!grid=\v!tolerant, + \c!internalgrid=\v!line, \c!step=.25\lineheight, % needs some experimenting %\c!splitmethod=\v!fixed, % will be default \c!method=\ifinner\s!box\else\s!otr\fi] % automatic as suggested by WS @@ -167,6 +168,8 @@ [\c!n=\itemgroupparameter\c!n, \c!separator=\v!none, \c!splitmethod=\v!none, + \c!grid=\v!tolerant, + \c!internalgrid=\v!halfline, % new, we may still revert to \v!line \c!balance=\v!yes] \unexpanded\def\strc_itemgroups_start_columns @@ -522,20 +525,21 @@ \unexpanded\def\page_mix_routine_construct#1% {\d_page_mix_max_height\mixedcolumnsparameter\c!maxheight % can have changed due to header=high \ctxcommand{mixsetsplit { - box = \number\b_page_mix_collected, - nofcolumns = \number\c_page_mix_n_of_columns, - maxheight = \number\d_page_mix_max_height, - step = \number\d_page_mix_balance_step, - cycles = \number\c_page_mix_balance_cycles, - preheight = \number\d_page_mix_preceding_height, - prebox = \number\b_page_mix_preceding, - strutht = \number\strutht, - strutdp = \number\strutdp, - threshold = \number\d_page_mix_threshold, - splitmethod = "\mixedcolumnsparameter\c!splitmethod", - balance = "#1", - alternative = "\mixedcolumnsparameter\c!alternative", - grid = \ifgridsnapping true\else false\fi, + box = \number\b_page_mix_collected, + nofcolumns = \number\c_page_mix_n_of_columns, + maxheight = \number\d_page_mix_max_height, + step = \number\d_page_mix_balance_step, + cycles = \number\c_page_mix_balance_cycles, + preheight = \number\d_page_mix_preceding_height, + prebox = \number\b_page_mix_preceding, + strutht = \number\strutht, + strutdp = \number\strutdp, + threshold = \number\d_page_mix_threshold, + splitmethod = "\mixedcolumnsparameter\c!splitmethod", + balance = "#1", + alternative = "\mixedcolumnsparameter\c!alternative", + grid = \ifgridsnapping true\else false\fi, + internalgrid = "\mixedcolumnsparameter\c!internalgrid", }}% \deadcycles\zerocount} diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua index 28d89f6b5..5267bd9bd 100644 --- a/tex/context/base/publ-aut.lua +++ b/tex/context/base/publ-aut.lua @@ -337,10 +337,11 @@ function commands.btxauthor(dataset,tag,field,settings) currentauthordata = split currentauthorsymbol = symbol for i=1,max do - ctx_btxstartauthor(i,max) + local author = split[i] + local state = author.state or 0 + ctx_btxstartauthor(i,max,state) ctx_btxsetconcat(concatstate(i,max)) ctx_btxsetauthorvariant(combiner) - local author = split[i] local initials = author.initials if initials and #initials > 0 then ctx_btxsetinitials() -- (concat(the_initials(initials,symbol)," ")) diff --git a/tex/context/base/publ-imp-apa.mkvi b/tex/context/base/publ-imp-apa.mkvi index 8732e782e..c8841444f 100644 --- a/tex/context/base/publ-imp-apa.mkvi +++ b/tex/context/base/publ-imp-apa.mkvi @@ -34,9 +34,30 @@ %D } %D \stopTEX +% First of all, the APA style defines authoryear bibliography lists. -%D In order to get journals expanded (or normalized or abbreviated) you need to load -%D a list: +\setupbtxrendering [standard] [numbering=no,sorttype=authoryear] + +% does not work here: \setupbtxcitevariant [alternative=authoryear,sorttype=authoryear] + +\setupbtxlistvariant [lastnamesep={ \& },finalnamesep={ \& }] + +\definebtxlistvariant + [author] + [author=invertedshort] + +\definebtxlistvariant + [editor] + [author] + +\definebtxlistvariant + [artauthor] + [author] + +% Should the following be loaded by default? + +%D In order to be able to get journals expanded (or normalized or abbreviated) you need +%D to load a list: %D %D \starttyping %D \btxloadjournallist[journals.txt] % the jabref list @@ -70,7 +91,8 @@ apa:pp=pp, apa:pages=pages, apa:and=and, - apa:Author=Author, % TODO, should be typeset in italic... + apa:period={. }, + apa:Author=Author, %TODO, should be typeset in italic... apa:Advanced={Advanced online publication}, apa:Retrieved={Retrieved from}, apa:others={et al.}] @@ -81,8 +103,8 @@ apa:phdthesis={Thèse de doctorat}, apa:technicalreport={Rapport technique}, apa:patent=brevet, - apa:editor={Éd.}, % éditeur - apa:editors={Éds.}, % éditeurs + apa:editor={Éd.}, % éditeur, + apa:editors={Éds.}, % éditeurs, apa:edition=édition, apa:volume=volume, apa:Volume=Volume, @@ -95,6 +117,7 @@ apa:pp=pp, apa:pages=pages, apa:and=et, + apa:period={. }, apa:Author=Auteur, apa:Advanced={Publication en ligne anticipée}, apa:Retrieved={Téléchargé de}, @@ -120,11 +143,46 @@ apa:pp=S, apa:pages=Seiten, apa:and=und, + apa:period={. }, apa:Author=Autor, apa:Advanced={Erweiterte Online-Publikation}, % Check this German! apa:Retrieved={aus abgerufen}, % heruntergeladen? Check this German! apa:others={et al.}] +% Thanks: Andrea Valle + +\setupbtxlabeltext + [it] + [apa:mastersthesis={Tesi di laurea}, % should be abbr. = T.? + apa:phdthesis={Tesi di dottorato}, % should be abbr. = T.? + apa:technicalreport={Relazione tecnica}, + apa:supplement={Suppl.}, % Supplement + apa:patent=patent, + apa:Translator={Trad.}, % Translator(s) + apa:editor={A c. di}, + apa:editors={A c. di}, + apa:edition={ed.}, + apa:volume=volume, + apa:Volume={Vol.}, + apa:Volumes={Vol.}, + apa:number=number, + apa:Number={N.}, + apa:nd={s.d.}, + apa:in=in, + apa:of=of, + apa:In=In, + apa:Part={Pt.}, + apa:p=p, + apa:pp=pp, + apa:pages=pagine, + apa:and=e, + apa:period={. }, + apa:Author=Author, %TODO, should be typeset in italic... + apa:Advanced={Pubblicazione online}, % ? + apa:Retrieved={Retrieved from}, % ? website? + apa:others={et al.}] + + %D The variables control the shared code for which we use a tex definition with %D one argument, specifying the field name. @@ -150,8 +208,16 @@ right=\btxperiod, otherwise=\btxperiod] +\starttexdefinition btx:apa:author-editor-other #field + \doifelse {#field} {publisher} + {\doifelse {\btxflush{#field}} {\btxflush{author}} + {\btxlabeltext{apa:Author}} + {\btxflush{#field}} + } + {\btxflush{#field}} +\stoptexdefinition + \starttexdefinition btx:apa:wherefrom #field -% TODO: for publisher, if =author use "Author" \btxdoifelse {address} { \btxspace \btxflush{address} @@ -161,7 +227,7 @@ } \btxdoif {#field} { \btxcolon - \btxflush{#field} + \texdefinition{btx:apa:author-editor-other}{#field} } \btxperiod } { @@ -170,13 +236,13 @@ \btxflush{country} \btxdoif {#field} { \btxcolon - \btxflush{#field} + \texdefinition{btx:apa:author-editor-other}{#field} } \btxperiod } { \btxdoifelse {#field} { \getvariable{btx:apa:#field}{left} - \btxflush{#field} + \texdefinition{btx:apa:author-editor-other}{#field} \getvariable{btx:apa:#field}{right} } { % check that this is needed! @@ -261,7 +327,7 @@ % TODO: if there is no author or editor, then use publisher... \btxdoifelse {author} { \btxflushauthor{author} - } { + } { \btxdoifelse {editor} { \setmode{btx:apa:edited-book} \btxflushauthor{editor} @@ -306,6 +372,14 @@ \btxperiod \stoptexdefinition +\starttexdefinition btx:apa:title + \btxdoif {title} { + \btxspace + \btxflush{Word -> title} + \btxperiod + } +\stoptexdefinition + % No longer used (not conforming to APA style) \starttexdefinition btx:apa:title-it \btxdoif {title} { @@ -369,18 +443,34 @@ } \stoptexdefinition -% if interaction, we should make these active hyperlinks! +% We should create a lua function that prepends "doi:" if not already there... \starttexdefinition btx:apa:doi-or-url \btxdoifelse {doi} { \btxspace - \hyphenatedurl{doi:\btxflush{doi}} + \ifconditional\btxinteractive + \goto { + \hyphenatedurl{doi:\btxflush{doi}} + } [ + url(http://dx.doi.org/\btxflush{doi}) + ] + \else + \hyphenatedurl{doi:\btxflush{doi}} + \fi } { \btxdoif {url} { \btxspace \btxlabeltext{apa:Retrieved} \btxspace - \hyphenatedurl{\btxflush{url}} + \ifconditional\btxinteractive + \goto { + \hyphenatedurl{\btxflush{url}} + } [ + url(\btxflush{url}) + ] + \else + \hyphenatedurl{\btxflush{url}} + \fi } } \stoptexdefinition @@ -873,7 +963,7 @@ \btxdoif {type} { \btxlparenthesis \btxflush{type} - \btxrparent + \btxrparenthesis } \texdefinition{btx:apa:note} \stopsetups diff --git a/tex/context/base/publ-imp-author.mkvi b/tex/context/base/publ-imp-author.mkvi index bfcae159a..3f344e86b 100644 --- a/tex/context/base/publ-imp-author.mkvi +++ b/tex/context/base/publ-imp-author.mkvi @@ -137,13 +137,17 @@ \stopsetups \startsetups \s!btx:\s!cite:\s!author:name - \fastsetup{\s!btx:\s!cite:\s!author:concat} - \ifx\currentbtxvons\empty \else - \currentbtxvons - \btxcitevariantparameter\c!vonsep + \ifcase\currentbtxauthorstate + \fastsetup{\s!btx:\s!cite:\s!author:concat} + \ifx\currentbtxvons\empty \else + \currentbtxvons + \btxcitevariantparameter\c!vonsep + \fi + \currentbtxsurnames + \fastsetup{\s!btx:\s!cite:\s!author:others} + \else + \fastsetup{\s!btx:\s!list:\s!author:normal} \fi - \currentbtxsurnames - \fastsetup{\s!btx:\s!cite:\s!author:others} \stopsetups % list (mostly the same) diff --git a/tex/context/base/publ-imp-cite.mkvi b/tex/context/base/publ-imp-cite.mkvi index 64a244def..f6ce77e9c 100644 --- a/tex/context/base/publ-imp-cite.mkvi +++ b/tex/context/base/publ-imp-cite.mkvi @@ -237,17 +237,34 @@ \startsetups \s!btx:\s!cite:num \fastsetup{\s!btx:\s!cite:render:range} \stopsetups +\startsetups \s!btx:\s!cite:title + \fastsetup{\s!btx:\s!cite:render:normal} +\stopsetups +\startsetups \s!btx:\s!cite:pages + \fastsetup{\s!btx:\s!cite:render:range} +\stopsetups + \startsetups \s!btx:\s!cite:page \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 \ifx\currentbtxfirst\empty \fastsetup{\s!btx:\s!cite:\s!unknown} + \else\ifconditional\btxinteractive + \goto { + \btxcitereference + \hyphenatedurl{doi:\currentbtxfirst} + } [ + url(http://dx.doi.org/\currentbtxfirst) + ] \else \btxcitereference - \hyphenatedurl{\currentbtxfirst} - \fi + \hyphenatedurl{doi:\currentbtxfirst} + \fi\fi \stopsetups \startsetups \s!btx:\s!cite:url diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index dae93b000..f415faf4a 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -34,6 +34,7 @@ local trace_cite = false trackers.register("publications.cite", local trace_missing = false trackers.register("publications.cite.missing", function(v) trace_missing = v end) local trace_references = false trackers.register("publications.cite.references", function(v) trace_references = v end) +publications = publications or { } local datasets = publications.datasets local writers = publications.writers @@ -186,87 +187,91 @@ local tobesaved = allocate() -- we use a a dedicated (and efficient as it know what it deals with) serializer, -- also because we need to ignore the 'details' field -local function serialize(t) - local f_key_table = formatters[" [%q] = {"] - local f_key_string = formatters[" %s = %q,"] - local r = { "return {" } - local m = 1 - for tag, entry in sortedhash(t) do - m = m + 1 - r[m] = f_key_table(tag) - local s = sortedkeys(entry) - for i=1,#s do - local k = s[i] +do + + local function serialize(t) + local f_key_table = formatters[" [%q] = {"] + local f_key_string = formatters[" %s = %q,"] + local r = { "return {" } + local m = 1 + for tag, entry in sortedhash(t) do m = m + 1 - r[m] = f_key_string(k,entry[k]) - end - m = m + 1 - r[m] = " }," - end - r[m] = "}" - return concat(r,"\n") -end - -local function finalizer() - local prefix = tex.jobname -- or environment.jobname - local setnames = sortedkeys(datasets) - for i=1,#setnames do - local name = setnames[i] - local dataset = datasets[name] - local userdata = dataset.userdata - local checksum = nil - local username = file.addsuffix(file.robustname(formatters["%s-btx-%s"](prefix,name)),"lua") - if userdata and next(userdata) then - if job.passes.first then - local newdata = serialize(userdata) - checksum = md5.HEX(newdata) - io.savedata(username,newdata) + r[m] = f_key_table(tag) + local s = sortedkeys(entry) + for i=1,#s do + local k = s[i] + m = m + 1 + r[m] = f_key_string(k,entry[k]) end - else - os.remove(username) - username = nil + m = m + 1 + r[m] = " }," end - local loaded = dataset.loaded - local sources = dataset.sources - local used = { } - for i=1,#sources do - local source = sources[i] - -- if loaded[source.filename] ~= "previous" then -- needs checking - if loaded[source.filename] ~= "previous" or loaded[source.filename] == "current" then - used[#used+1] = source + r[m] = "}" + return concat(r,"\n") + end + + local function finalizer() + local prefix = tex.jobname -- or environment.jobname + local setnames = sortedkeys(datasets) + for i=1,#setnames do + local name = setnames[i] + local dataset = datasets[name] + local userdata = dataset.userdata + local checksum = nil + local username = file.addsuffix(file.robustname(formatters["%s-btx-%s"](prefix,name)),"lua") + if userdata and next(userdata) then + if job.passes.first then + local newdata = serialize(userdata) + checksum = md5.HEX(newdata) + io.savedata(username,newdata) + end + else + os.remove(username) + username = nil + end + local loaded = dataset.loaded + local sources = dataset.sources + local used = { } + for i=1,#sources do + local source = sources[i] + -- if loaded[source.filename] ~= "previous" then -- needs checking + if loaded[source.filename] ~= "previous" or loaded[source.filename] == "current" then + used[#used+1] = source + end end + tobesaved[name] = { + usersource = { + filename = username, + checksum = checksum, + }, + datasources = used, + } end - tobesaved[name] = { - usersource = { - filename = username, - checksum = checksum, - }, - datasources = used, - } end -end -local function initializer() - statistics.starttiming(publications) - for name, state in next, collected do - local dataset = datasets[name] - local datasources = state.datasources - local usersource = state.usersource - if datasources then - for i=1,#datasources do - local filename = datasources[i].filename - publications.load(dataset,filename,"previous") + local function initializer() + statistics.starttiming(publications) + for name, state in next, collected do + local dataset = datasets[name] + local datasources = state.datasources + local usersource = state.usersource + if datasources then + for i=1,#datasources do + local filename = datasources[i].filename + publications.load(dataset,filename,"previous") + end + end + if usersource then + dataset.userdata = table.load(usersource.filename) or { } end end - if usersource then - dataset.userdata = table.load(usersource.filename) or { } - end + statistics.stoptiming(publications) + function initializer() end -- will go, for now, runtime loaded end - statistics.stoptiming(publications) - function initializer() end -- will go, for now, runtime loaded -end -job.register('publications.collected',tobesaved,initializer,finalizer) + job.register('publications.collected',tobesaved,initializer,finalizer) + +end if not publications.authors then initializer() -- for now, runtime loaded @@ -283,9 +288,10 @@ local nofcitations = 0 setmetatableindex(usedentries,function(t,k) if not initialized then - usedentries = { } - citetolist = { } - listtocite = { } + usedentries = allocate { } + citetolist = allocate { } + listtocite = allocate { } +local names = { } local internals = structures.references.internals local p_collect = (C(R("09")^1) * Carg(1) / function(s,entry) listtocite[tonumber(s)] = entry end + P(1))^0 for i=1,#internals do @@ -322,6 +328,26 @@ setmetatableindex(usedentries,function(t,k) listtocite[int] = entry end end +local detail = datasets[set].details[tag] +if detail then + local author = detail.author + if author then + for i=1,#author do + local a = author[i] + local s = a.surnames + if s then + local c = concat(s,"+") + local n = names[c] + if n then + n[#n+1] = a + break + else + names[c] = { a } + end + end + end + end +end end end elseif kind == "userdata" then @@ -331,7 +357,6 @@ setmetatableindex(usedentries,function(t,k) local int = tonumber(userdata.btxint) if int then citetolist[int] = entry --- xx[dataset][tag] = { entry, ... } end end end @@ -345,6 +370,13 @@ setmetatableindex(usedentries,function(t,k) -- setmetatableindex(citetolist,"table") -- setmetatableindex(listtocite,"table") -- +for k, v in next, names do + if #v > 1 then + for i=1,#v do + v[i].state = 1 + end + end +end return usedentries[k] end end) @@ -870,13 +902,6 @@ function commands.btxfield(name,tag,field) local manipulator, field = splitmanipulation(field) local value = fields[field] if type(value) == "string" then --- local suffixes = dataset.suffixes[tag] --- if suffixes then --- local suffix = suffixes[field] --- if suffix then --- value = value .. converters.characters(suffix) --- end --- end context(manipulator and applymanipulation(manipulator,value) or value) else report("unknown field %a of tag %a in dataset %a",field,tag,name) @@ -1800,172 +1825,200 @@ end -- short -local function setter(dataset,tag,entry,internal) - return { - tag = tag, - internal = internal, - short = getdetail(dataset,tag,"short"), - suffix = getdetail(dataset,tag,"suffix"), - } -end +do -local function getter(first,last) -- last not used - local short = first.short - if short then - local suffix = first.suffix - if suffix then - ctx_btxsetfirst(short .. suffix) - else - ctx_btxsetfirst(short) + local function setter(dataset,tag,entry,internal) + return { + tag = tag, + internal = internal, + short = getdetail(dataset,tag,"short"), + suffix = getdetail(dataset,tag,"suffix"), + } + end + + local function getter(first,last) -- last not used + local short = first.short + if short then + local suffix = first.suffix + if suffix then + ctx_btxsetfirst(short .. suffix) + else + ctx_btxsetfirst(short) + end + return true end - return true end -end -function citevariants.short(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,false,"short",internal,setter,getter) + function citevariants.short(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,false,"short",internal,setter,getter) + end + end -- pages (no compress) -local function setter(dataset,tag,entry,internal) - return { - dataset = dataset, - tag = tag, - internal = internal, - pages = getdetail(dataset,tag,"pages"), - } -end +do -local function getter(first,last) - local pages = first.pages - if pages then - if type(pages) == "table" then - ctx_btxsetfirst(pages[1]) - ctx_btxsetsecond(pages[2]) - else - ctx_btxsetfirst(pages) + local function setter(dataset,tag,entry,internal) + return { + dataset = dataset, + tag = tag, + internal = internal, + pages = getdetail(dataset,tag,"pages"), + } + end + + local function getter(first,last) + local pages = first.pages + if pages then + if type(pages) == "table" then + ctx_btxsetfirst(pages[1]) + ctx_btxsetsecond(pages[2]) + else + ctx_btxsetfirst(pages) + end + return true end - return true end -end -function citevariants.page(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,compress,"page",internal,setter,getter) + function citevariants.page(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,compress,"page",internal,setter,getter) + end + end -- num -local function setter(dataset,tag,entry,internal) - local entries = entry.entries - local text = entries and entries.text or "?" - return { - tag = tag, - internal = internal, - num = text, - sortkey = text, - } -end +do -local function getter(first,last) - return simplegetter(first,last,"num") -end + local function setter(dataset,tag,entry,internal) + local entries = entry.entries + local text = entries and entries.text or "?" + return { + tag = tag, + internal = internal, + num = text, + sortkey = text, + } + end + + local function getter(first,last) + return simplegetter(first,last,"num") + end + + function citevariants.num(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,compress,"num",internal,setter,getter) + -- processcite(dataset,reference,mark,false,"num",internal,setter,getter) + end -function citevariants.num(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,compress,"num",internal,setter,getter) --- processcite(dataset,reference,mark,false,"num",internal,setter,getter) end -- year -local function setter(dataset,tag,entry,internal) - return { - dataset = dataset, - tag = tag, - internal = internal, - year = getfield(dataset,tag,"year"), - suffix = getdetail(dataset,tag,"suffix"), - sortkey = getdetail(dataset,tag,"suffixedyear"), - } -end +do -local function getter(first,last) - return simplegetter(first,last,"year") -end + local function setter(dataset,tag,entry,internal) + return { + dataset = dataset, + tag = tag, + internal = internal, + year = getfield(dataset,tag,"year"), + suffix = getdetail(dataset,tag,"suffix"), + sortkey = getdetail(dataset,tag,"suffixedyear"), + } + end + + local function getter(first,last) + return simplegetter(first,last,"year") + end + + function citevariants.year(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,compress,"year",internal,setter,getter) + end -function citevariants.year(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,compress,"year",internal,setter,getter) end -- index | serial -local function setter(dataset,tag,entry,internal) - local index = getfield(dataset,tag,"index") - return { - dataset = dataset, - tag = tag, - internal = internal, - index = index, - sortkey = index, - } -end +do -local function getter(first,last) - return simplegetter(first,last,"index") -end + local function setter(dataset,tag,entry,internal) + local index = getfield(dataset,tag,"index") + return { + dataset = dataset, + tag = tag, + internal = internal, + index = index, + sortkey = index, + } + end -function citevariants.index(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,compress,"index",internal,setter,getter) -end + local function getter(first,last) + return simplegetter(first,last,"index") + end + + function citevariants.index(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,compress,"index",internal,setter,getter) + end + + function citevariants.serial(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,compress,"serial",internal,setter,getter) + end -function citevariants.serial(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,compress,"serial",internal,setter,getter) end -- category | type -local function setter(dataset,tag,entry,internal) - return { - dataset = dataset, - tag = tag, - internal = internal, - category = getfield(dataset,tag,"category"), - } -end +do -local function getter(first,last) - return simplegetter(first,last,"category") -end + local function setter(dataset,tag,entry,internal) + return { + dataset = dataset, + tag = tag, + internal = internal, + category = getfield(dataset,tag,"category"), + } + end -function citevariants.category(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,compress,"category",internal,setter,getter) -end + local function getter(first,last) + return simplegetter(first,last,"category") + end + + function citevariants.category(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,compress,"category",internal,setter,getter) + end + + function citevariants.type(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,compress,"type",internal,setter,getter) + end -function citevariants.type(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,compress,"type",internal,setter,getter) end -- key | tag -local function setter(dataset,tag,entry,internal) - return { - dataset = dataset, - tag = tag, - internal = internal, - } -end +do -local function getter(first,last) - ctx_btxsetfirst(first.tag) - return true -end + local function setter(dataset,tag,entry,internal) + return { + dataset = dataset, + tag = tag, + internal = internal, + } + end -function citevariants.key(dataset,reference,mark,compress,variant,internal) - return processcite(dataset,reference,mark,compress,"key",internal,setter,getter) -end + local function getter(first,last) + ctx_btxsetfirst(first.tag) + return true + end + + function citevariants.key(dataset,reference,mark,compress,variant,internal) + return processcite(dataset,reference,mark,compress,"key",internal,setter,getter) + end + + function citevariants.tag(dataset,reference,mark,compress,variant,internal) + return processcite(dataset,reference,mark,compress,"tag",internal,setter,getter) + end -function citevariants.tag(dataset,reference,mark,compress,variant,internal) - return processcite(dataset,reference,mark,compress,"tag",internal,setter,getter) end -- todo : sort @@ -1978,217 +2031,208 @@ end -- common -local currentbtxciteauthor = function() - context.currentbtxciteauthor() - return true -- needed? -end +do -local function authorcompressor(found) - local result = { } - local entries = { } - for i=1,#found do - local entry = found[i] - local author = entry.author - local aentries = entries[author] - if aentries then - aentries[#aentries+1] = entry - else - entries[author] = { entry } - end + local currentbtxciteauthor = function() + context.currentbtxciteauthor() + return true -- needed? end - for i=1,#found do - local entry = found[i] - local author = entry.author - local aentries = entries[author] - if not aentries then - result[#result+1] = entry - elseif aentries == true then - -- already done - else - result[#result+1] = entry - entry.entries = aentries - entries[author] = true + + local function authorcompressor(found) + local result = { } + local entries = { } + for i=1,#found do + local entry = found[i] + local author = entry.author + local aentries = entries[author] + if aentries then + aentries[#aentries+1] = entry + else + entries[author] = { entry } + end end + for i=1,#found do + local entry = found[i] + local author = entry.author + local aentries = entries[author] + if not aentries then + result[#result+1] = entry + elseif aentries == true then + -- already done + else + result[#result+1] = entry + entry.entries = aentries + entries[author] = true + end + end + -- todo: add letters (should we then tag all?) + return result end - -- todo: add letters (should we then tag all?) - return result -end -local function authorconcat(target,key,setup) - ctx_btxstartsubcite(setup) - local nofcollected = #target - if nofcollected == 0 then - unknowncite(tag) - else - for i=1,nofcollected do - local entry = target[i] - local first = entry.first - local tag = entry.tag - local currentcitation = markcite(entry.dataset,tag) - ctx_btxstartciteauthor() - ctx_btxsettag(tag) - ctx_btxsetbacklink(currentcitation) - local bl = listtocite[currentcitation] - ctx_btxsetinternal(bl and bl.references.internal or "") - if first then - ctx_btxsetfirst(first[key] or f_missing(first.tag)) - local suffix = entry.suffix - local value = entry.last[key] - ctx_btxsetsecond(value) - if suffix then - ctx_btxsetthird(suffix) - end - else - local suffix = entry.suffix - local value = entry[key] or f_missing(tag) - ctx_btxsetfirst(value) - if suffix then - ctx_btxsetthird(suffix) + local function authorconcat(target,key,setup) + ctx_btxstartsubcite(setup) + local nofcollected = #target + if nofcollected == 0 then + unknowncite(tag) + else + for i=1,nofcollected do + local entry = target[i] + local first = entry.first + local tag = entry.tag + local currentcitation = markcite(entry.dataset,tag) + ctx_btxstartciteauthor() + ctx_btxsettag(tag) + ctx_btxsetbacklink(currentcitation) + local bl = listtocite[currentcitation] + ctx_btxsetinternal(bl and bl.references.internal or "") + if first then + ctx_btxsetfirst(first[key] or f_missing(first.tag)) + local suffix = entry.suffix + local value = entry.last[key] + ctx_btxsetsecond(value) + if suffix then + ctx_btxsetthird(suffix) + end + else + local suffix = entry.suffix + local value = entry[key] or f_missing(tag) + ctx_btxsetfirst(value) + if suffix then + ctx_btxsetthird(suffix) + end end + ctx_btxsetconcat(concatstate(i,nofcollected)) + ctx_btxcitesetup(setup) + ctx_btxstopciteauthor() end - ctx_btxsetconcat(concatstate(i,nofcollected)) - ctx_btxcitesetup(setup) - ctx_btxstopciteauthor() end + ctx_btxstopsubcite() end - ctx_btxstopsubcite() -end -local function authorsingle(entry,key,setup) - ctx_btxstartsubcite(setup) - 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)) - ctx_btxsetthird(entry.suffix) - ctx_btxcitesetup(setup) - ctx_btxstopciteauthor() - ctx_btxstopsubcite() -end - -local partialinteractive = false - -local function authorgetter(first,last,key,setup) -- only first - -- ctx_btxsetfirst(first.author) -- unformatted - ctx_btxsetfirst(currentbtxciteauthor) -- formatter (much slower) - local entries = first.entries - -- alternatively we can use a concat with one ... so that we can only make the - -- year interactive, as with the concat - if partialinteractive and not entries then - entries = { first } - end - if entries then - local c = compresslist(entries) - local f = function() authorconcat(c,key,setup) return true end -- indeed return true? - ctx_btxsetcount(#c) - ctx_btxsetsecond(f) - else - local f = function() authorsingle(first,key,setup) return true end -- indeed return true? - ctx_btxsetcount(0) - ctx_btxsetsecond(f) + local function authorsingle(entry,key,setup) + ctx_btxstartsubcite(setup) + 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)) + ctx_btxsetthird(entry.suffix) + ctx_btxcitesetup(setup) + ctx_btxstopciteauthor() + ctx_btxstopsubcite() + end + + local partialinteractive = false + + local function authorgetter(first,last,key,setup) -- only first + -- ctx_btxsetfirst(first.author) -- unformatted + ctx_btxsetfirst(currentbtxciteauthor) -- formatter (much slower) + local entries = first.entries + -- alternatively we can use a concat with one ... so that we can only make the + -- year interactive, as with the concat + if partialinteractive and not entries then + entries = { first } + end + if entries then + local c = compresslist(entries) + local f = function() authorconcat(c,key,setup) return true end -- indeed return true? + ctx_btxsetcount(#c) + ctx_btxsetsecond(f) + else + local f = function() authorsingle(first,key,setup) return true end -- indeed return true? + ctx_btxsetcount(0) + ctx_btxsetsecond(f) + end + return true end - return true -end --- author + -- author -local function setter(dataset,tag,entry,internal) - return { - dataset = dataset, - tag = tag, - internal = internal, - author = getfield(dataset,tag,"author"), - } -end + local function setter(dataset,tag,entry,internal) + return { + dataset = dataset, + tag = tag, + internal = internal, + author = getfield(dataset,tag,"author"), + } + end -local function getter(first,last,_,setup) - -- ctx_btxsetfirst(first.author) -- unformatted - ctx_btxsetfirst(currentbtxciteauthor) -- formatter (much slower) - return true -end + local function getter(first,last,_,setup) + -- ctx_btxsetfirst(first.author) -- unformatted + ctx_btxsetfirst(currentbtxciteauthor) -- formatter (much slower) + return true + end -function citevariants.author(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,false,"author",internal,setter,getter) -end + function citevariants.author(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,false,"author",internal,setter,getter) + end --- authornum + -- authornum -local function setter(dataset,tag,entry,internal) - local text = entry.entries.text - return { - dataset = dataset, - tag = tag, - internal = internal, - author = getfield(dataset,tag,"author"), - num = text, - sortkey = text and lpegmatch(numberonly,text), - } -end + local function setter(dataset,tag,entry,internal) + local text = entry.entries.text + return { + dataset = dataset, + tag = tag, + internal = internal, + author = getfield(dataset,tag,"author"), + num = text, + sortkey = text and lpegmatch(numberonly,text), + } + end -local function getter(first,last) - authorgetter(first,last,"num","author:num") - return true -end + local function getter(first,last) + authorgetter(first,last,"num","author:num") + return true + end -local function compressor(found) - return authorcompressor(found) -- can be just an alias -end + local function compressor(found) + return authorcompressor(found) -- can be just an alias + end -function citevariants.authornum(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,compress,"authornum",internal,setter,getter,compressor) -end + function citevariants.authornum(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,compress,"authornum",internal,setter,getter,compressor) + end --- authoryear | authoryears + -- authoryear | authoryears --- local function setter(dataset,tag,entry,internal) --- local year = getfield(dataset,tag,"year") --- return { --- dataset = dataset, --- tag = tag, --- internal = internal, --- author = getfield(dataset,tag,"author"), --- year = year, --- sortkey = year and lpegmatch(numberonly,year), --- sortfld = "year", --- } --- end + local function setter(dataset,tag,entry,internal) + return { + dataset = dataset, + tag = tag, + internal = internal, + author = getfield(dataset,tag,"author"), + year = getfield(dataset,tag,"year"), + suffix = getdetail(dataset,tag,"suffix"), + sortkey = getdetail(dataset,tag,"suffixedyear"), + } + end -local function setter(dataset,tag,entry,internal) - return { - dataset = dataset, - tag = tag, - internal = internal, - author = getfield(dataset,tag,"author"), - year = getfield(dataset,tag,"year"), - suffix = getdetail(dataset,tag,"suffix"), - sortkey = getdetail(dataset,tag,"suffixedyear"), - } -end + local function getter(first,last) + authorgetter(first,last,"year","author:year") + return true + end -local function getter(first,last) - authorgetter(first,last,"year","author:year") - return true -end + local function compressor(found) + return authorcompressor(found) + end -local function compressor(found) - return authorcompressor(found) -end + function citevariants.authoryear(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,compress,"authoryear",internal,setter,getter,compressor) + end -function citevariants.authoryear(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,compress,"authoryear",internal,setter,getter,compressor) -end + local function getter(first,last) + authorgetter(first,last,"year","author:years") + return true + end -local function getter(first,last) - authorgetter(first,last,"year","author:years") - return true -end + function citevariants.authoryears(dataset,reference,mark,compress,variant,internal) + processcite(dataset,reference,mark,compress,"authoryears",internal,setter,getter,compressor) + end -function citevariants.authoryears(dataset,reference,mark,compress,variant,internal) - processcite(dataset,reference,mark,compress,"authoryears",internal,setter,getter,compressor) end -- List variants diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 592071f31..b48cca99f 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -401,6 +401,7 @@ \newconstant\currentbtxcount \unexpanded\def\btxsetcount #1{\currentbtxcount #1\relax} \newconstant\currentbtxauthorindex %unexpanded\def\btxsetauthorindex#1{\currentbtxauthorindex#1\relax} % passed directly \newconstant\currentbtxauthorcount %unexpanded\def\btxsetauthorcount#1{\currentbtxauthorcount#1\relax} % passed directly +\newconstant\currentbtxauthorstate \unexpanded\def\btxsetauthorstate#1{\currentbtxauthorstate#1\relax} \def\currentbtxauthorvariant{normal} @@ -774,10 +775,11 @@ })}% \endgroup} -\unexpanded\def\btxstartauthor#1#2% +\unexpanded\def\btxstartauthor#1#2#3% {\begingroup \currentbtxauthorindex#1\relax - \currentbtxauthorcount#2\relax} + \currentbtxauthorcount#2\relax + \currentbtxauthorstate#3\relax} \unexpanded\def\btxstopauthor {\endgroup} @@ -1297,6 +1299,7 @@ \c!lastnamesep={ \btxlabeltext{\currentbtxalternative:and} }, \c!finalnamesep={ \btxlabeltext{\currentbtxalternative:and} }, \c!firstnamesep={ }, + \c!andtext={ \btxlabeltext{\currentbtxalternative:and} }, \c!otherstext={ \btxlabeltext{\currentbtxalternative:others}}, \c!juniorsep={ }, \c!vonsep={ }, diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 4791ec7e4..91a674766 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index 2eb5f4a46..50ae71c29 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-lst.mkvi b/tex/context/base/strc-lst.mkvi index b10ab696d..bea547bcf 100644 --- a/tex/context/base/strc-lst.mkvi +++ b/tex/context/base/strc-lst.mkvi @@ -821,6 +821,8 @@ % todo: provide packager via attributes +\doinstallinjector\v!list + \installcorenamespace{listalternativemethods} % the general wrapper of a rendering \startsetups[\??listrenderings:none] @@ -848,12 +850,15 @@ % \stopsetups \startsetups[\??listrenderings:generic] +\typo_injectors_check_list \listparameter\c!before % can be \hskip \edef\p_command{\listalternativeparameter\c!command} \ifx\p_command\empty \listalternativeparameter\c!before \vbox { \forgetall + \noindent % otherwise annotations are mirrored up +\typo_injectors_mark_list \hbox \strc_lists_get_reference_attribute\v!all { \ifconditional\c_lists_show_number % \ifconditional\c_lists_has_page @@ -881,6 +886,8 @@ } \listalternativeparameter\c!after \else + \noindent % otherwise annotations are mirrored up +\typo_injectors_mark_list \hbox \strc_lists_get_reference_attribute\v!all \strc_lists_get_destination_attribute { \p_command\currentlistentrynumber\currentlistentrytitle\currentlistentrypagenumber } @@ -893,6 +900,7 @@ \startsetups[\??listrenderings:abc] \endgraf % are we grouped? % \advance % yes or no ... \rightskip is also honored +\typo_injectors_check_list \leftskip\listparameter\c!margin % after \endgraf ! \listparameter\c!before \endgraf @@ -911,7 +919,8 @@ \scratchwidth\p_width \fi \fi\fi - \noindent + \noindent % otherwise annotations are mirrored up +\typo_injectors_mark_list \hbox \strc_lists_get_reference_attribute\v!all \strc_lists_get_destination_attribute { \setlocalhsize \hsize\localhsize @@ -1092,7 +1101,9 @@ \stopsetups \startsetups[\??listrenderings:e] - \noindent +\typo_injectors_check_list + \noindent % otherwise annotations are mirrored up +\typo_injectors_mark_list \hbox \strc_lists_get_reference_attribute\v!all \strc_lists_get_destination_attribute { \letlistparameter\c!depth\zeropoint \letlistparameter\c!color\empty @@ -1112,7 +1123,9 @@ \stopsetups \startsetups[\??listrenderings:f] - \noindent +\typo_injectors_check_list + \noindent % otherwise annotations are mirrored up +\typo_injectors_mark_list \hbox \strc_lists_get_reference_attribute\v!all \strc_lists_get_destination_attribute { \dosetraggedhbox{\listparameter\c!align}% \raggedbox { @@ -1130,7 +1143,9 @@ \stopsetups \startsetups[\??listrenderings:g] - \noindent +\typo_injectors_check_list + \noindent % otherwise annotations are mirrored up +\typo_injectors_mark_list \hbox \strc_lists_get_reference_attribute\v!all \strc_lists_get_destination_attribute { \midaligned { \strc_lists_set_style_color\c!style\c!color\v!all @@ -1158,7 +1173,10 @@ \ifx\p_command\empty [\currentlist: \currentlistentrynumber\space -- \currentlistentrytitle\space -- \currentlistentrypagenumber]% \else +\typo_injectors_check_list \listparameter\c!before + \noindent % otherwise annotations are mirrored up +\typo_injectors_mark_list \hbox \strc_lists_get_reference_attribute\v!all \strc_lists_get_destination_attribute { \p_command\currentlistentrynumber\currentlistentrytitle\currentlistentrypagenumber } diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv index 9cb135fdf..3fa673d24 100644 --- a/tex/context/base/strc-reg.mkiv +++ b/tex/context/base/strc-reg.mkiv @@ -354,7 +354,7 @@ \def\strc_registers_finish_entry_indeed#1#2#3% register data userdata {\begingroup \edef\currentregister{#1}% - \setupcurrentregister[\c!entries=,\c!label=,\c!keys=,\c!alternative=,#2]% + \setupcurrentregister[\c!entries=,\c!label=,\c!keys=,\c!alternative=,#2]% todo: fast setter \edef\currentregisterlabel {\registerparameter\c!label}% \edef\currentregisterexpansion{\registerparameter\c!expansion}% \edef\currentregisterownnumber{\registerparameter\c!ownnumber}% @@ -644,17 +644,19 @@ % a = -\setvalue{\??registerindicator a}#1% +\def\strc_registers_indicator_a#1#2% {\registerparameter\c!before % bugged, why does leftskip gets set: \vskip\lineheight\goodbreak\vskip-\lineheight + \typo_injectors_check_register \begingroup \useregisterstyleandcolor\c!style\c!color \dontleavehmode + \typo_injectors_mark_register \strut \iflocation \dosetdirectpagereference{\currentregister:\v!section:#1}% \fi - \registerparameter\c!command{#1}% + \registerparameter\c!command{#2}% \endgroup \blank[\v!samepage]% \registerparameter\c!after @@ -663,26 +665,43 @@ % b = -\setvalue{\??registerindicator b}#1% will be shared with a +\def\strc_registers_indicator_b#1#2% {\registerparameter\c!before + \typo_injectors_check_register \begingroup \useregisterstyleandcolor\c!style\c!color \dontleavehmode + \typo_injectors_mark_register \strut \iflocation \dosetdirectpagereference{\currentregister:\v!section:#1}% \fi - \registerparameter\c!command{#1}% + \registerparameter\c!command{#2}% \endgroup \registerparameter\c!after \nobreak} -\setvalue{\??registerindicator A}#1{\getvalue{\??registerindicator a}{\WORD{#1}}} -\setvalue{\??registerindicator B}#1{\getvalue{\??registerindicator b}{\WORD{#1}}} +\setvalue{\??registerindicator a}#1{\strc_registers_indicator_a{#1}{#1}} +\setvalue{\??registerindicator A}#1{\strc_registers_indicator_a{#1}{\WORD{#1}}} +\setvalue{\??registerindicator b}#1{\strc_registers_indicator_b{#1}{#1}} +\setvalue{\??registerindicator B}#1{\strc_registers_indicator_b{#1}{\WORD{#1}}} %D The following macros are the interface to the rendering. These are %D generated by \LUA. This might change. +% \showinjector +% \setinjector[register][2][\column] +% +% \starttext +% first \index{first} +% second \index{second} +% third \index{third} +% fourth \index{fourth} +% \placeregister[index] +% \stoptext + +\doinstallinjector\v!register + %D Beware, we get funny side effects when a dangling \index precedes an %D placeindex as then flushing takes place inside the index. Took me hours %D to notice that. @@ -729,11 +748,13 @@ \endgroup} \unexpanded\def\startregisterentry#1% todo: level - {\begingroup + {\typo_injectors_check_register + \begingroup \dostarttagged\t!registerentry\empty \global\setconstant\c_strc_registers_page_state\zerocount \hangindent\d_strc_registers_hangindent - \hangafter \c_strc_registers_hangafter} + \hangafter \c_strc_registers_hangafter + \typo_injectors_mark_register} \unexpanded\def\stopregisterentry {\endgraf @@ -814,12 +835,8 @@ \dostoptagged \dostoptagged} -\let\strc_register_injector_process\relax -\let\strc_register_injector_show \relax - \unexpanded\def\defaultregisterentry#1#2#3#4% #1:processor #2:internal #3:seeindex #4:word {\def\currentregisterpageindex{#2}% - \strc_register_injector_process \iflocation \def\currentregisterseeindex{#3}% \doifelse{\registerparameter\c!interaction}\v!text @@ -834,7 +851,6 @@ {\dostarttagged\t!registercontent\empty \ifx\currentregisterseeindex\empty \else \dontleavehmode - \strc_register_injector_show \dosetdirectpagereference{seeindex:\currentregisterseeindex}% maybe some day we will support an area \fi \applyprocessor{#1}{\registerparameter\c!textcommand{\limitedregisterentry{\registerparameter\c!deeptextcommand{#2}}}}% @@ -919,7 +935,7 @@ \def\registeronepage {\registerpagebuttonsymbol\gobblefourarguments}% \def\registerpagerange{\registerpagebuttonsymbol\gobblesevenarguments}} -\def\setregisterpagerendering +\unexpanded\def\setregisterpagerendering {\doifelse{\registerparameter\c!pagenumber}\v!no {\let \currentregisterpagesymbol\v!none} {\edef\currentregisterpagesymbol{\registerparameter\c!symbol}}% diff --git a/tex/context/base/strc-rsc.lua b/tex/context/base/strc-rsc.lua index cc670400f..627e443b2 100644 --- a/tex/context/base/strc-rsc.lua +++ b/tex/context/base/strc-rsc.lua @@ -67,9 +67,16 @@ local inner = lpegCg(lpegCc("inner") * lpegCs(i_token^1)) inner = inner * arguments special = special * lparent * (operation * arguments)^-1 * rparent -local referencesplitter = spaces * lpegCf (lpegCt("") * (component + outer)^-1 * (special + inner)^-1 * endofall, rawset) -local prefixsplitter = lpegCs(lpegP((1-scolon)^1 * scolon)) * #-scolon * lpegCs(lpegP(1)^1) -local componentsplitter = lpegCs(lpegP((1-scolon)^1)) * scolon * #-scolon * lpegCs(lpegP(1)^1) +local referencesplitter = spaces + * lpegCf (lpegCt("") * (component + outer)^-1 * (special + inner)^-1 * endofall, rawset) + +local prefixsplitter = lpegCs(lpegP((1-scolon)^1 * scolon)) + * #-scolon + * lpegCs(lpegP(1)^1) + +local componentsplitter = lpegCs(lpegP((1-scolon)^1)) + * scolon * #-scolon + * lpegCs(lpegP(1)^1) prefixsplitter = componentsplitter @@ -146,6 +153,8 @@ references.splitcomponent = splitcomponent -- inspect(splitreference([[ outer :: inner { argument } ]])) -- inspect(splitreference([[ special ( outer :: operation ) ]])) +-- inspect(splitreference([[inner(foo,bar)]])) + -- inspect(splitreference([[]])) -- inspect(splitreference([[inner]])) -- inspect(splitreference([[special(operation{argument,argument})]])) diff --git a/tex/context/base/strc-tag.lua b/tex/context/base/strc-tag.lua index 690f86efd..d37298a61 100644 --- a/tex/context/base/strc-tag.lua +++ b/tex/context/base/strc-tag.lua @@ -446,3 +446,8 @@ commands.starttag = tags.start commands.stoptag = tags.stop commands.settagproperty = tags.setproperty commands.settagaspect = tags.setaspect + +-- function commands.tagindex(tag) +-- context(lasttags[tag] or 0) +-- end + diff --git a/tex/context/base/typo-inj.lua b/tex/context/base/typo-inj.lua new file mode 100644 index 000000000..4c870d83d --- /dev/null +++ b/tex/context/base/typo-inj.lua @@ -0,0 +1,90 @@ +if not modules then modules = { } end modules ['typo-inj'] = { -- was node-par + version = 1.001, + comment = "companion to typo-inj.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local tonumber = tonumber +local context, commands = context, commands + +local injectors = { } +typesetters.injectors = injectors +local list = { } +injectors.list = list +local showall = false + +local settings_to_array = utilities.parsers.settings_to_array + +local ctx_domarkinjector = context.domarkinjector +local ctx_doactivateinjector = context.doactivateinjector + +table.setmetatableindex(list,function(t,k) + local v = { + counter = 0, + actions = { }, + show = false, + active = false, + } + t[k] = v + return v +end) + +function injectors.reset(name) + list[name] = nil +end + +function injectors.set(name,numbers,command) + local injector = list[name] + local actions = injector.actions + local places = settings_to_array(numbers) + for i=1,#places do + actions[tonumber(places[i])] = command + end + if not injector.active then + ctx_doactivateinjector(name) + injector.active = true + end +end + +function injectors.show(name) + if not name or name == "" then + showall = true + else + local list = settings_to_array(name) + for i=1,#list do + list[list[i]].show = true + end + end +end + +function injectors.mark(name,show) + local injector = list[name] + local n = injector.counter + 1 + injector.counter = n + if showall or injector.show then + ctx_domarkinjector(injector.actions[n] and 1 or 0,n) + end +end + +function injectors.check(name,n) + local injector = list[name] + if n == false then + n = injector.counter + elseif n == nil then + n = injector.counter + 1 -- next (upcoming) + else + n = tonumber(n) or 0 + end + local action = injector.actions[n] + if action then + context(action) + end +end + +commands.resetinjector = injectors.reset +commands.showinjector = injectors.show +commands.setinjector = injectors.set +commands.markinjector = injectors.mark +commands.checkinjector = injectors.check diff --git a/tex/context/base/typo-inj.mkiv b/tex/context/base/typo-inj.mkiv new file mode 100644 index 000000000..11c04e9f0 --- /dev/null +++ b/tex/context/base/typo-inj.mkiv @@ -0,0 +1,72 @@ +%D \module +%D [ file=typo-inj, +%D version=2014.10.13, +%D title=\CONTEXT\ Typesetting Macros, +%D subtitle=Triggering Actions, +%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 / Triggering Actions} + +%D This is a sort of escape from too automatic typesetting of lists. I have +%D been thinking fo a more generic injector for instance based on tags (as we +%D already index each element) but thi sis sort of fuzzy because the number of a +%D tag is not always incremented before we check for it. Also, registers and lists +%D are among the few candidates that cannot be controlled directly by putting +%D something in the input. So,m for the moment I stick to this mechanism but +%D future versions of \CONTEXT\ might do it differently. Compatibility is not much +%D of an issue here as this mechanism is only to be used in final production runs. + +\unprotect + +\registerctxluafile{typo-inj}{1.001} + +% todo: no need in trialmode + +%D \showinjector +%D +%D \setinjector[register][3][\column] +%D \setinjector[list] [2][{\blank[3*big]}] +%D +%D \starttext +%D \placelist[section][criterium=text] +%D \blank[3*big] +%D \placeregister[index][criterium=text] +%D \page +%D \startsection[title=Alpha] first \index{first} \stopsection +%D \startsection[title=Beta] second \index{second} \stopsection +%D \startsection[title=Gamma] third \index{third} \stopsection +%D \startsection[title=Delta] fourth \index{fourth} \stopsection +%D \stoptext + +\unexpanded\def\resetinjector [#1]{\ctxcommand{resetinjector("#1")}} +\unexpanded\def\markinjector [#1]{\dontleavehmode\ctxcommand{markinjector("#1")}} +\unexpanded\def\checkinjector [#1]{\ctxcommand{checkinjector("#1")}} +\unexpanded\def\checknextinjector {\ctxcommand{checkinjector()}} +\unexpanded\def\checkpreviousinjector {\ctxcommand{checkinjector(true)}} +\unexpanded\def\dosetinjector [#1][#2][#3]{\ctxcommand{setinjector("#1","#2",\!!bs#3\!!es)}} +\unexpanded\def\doshowinjector [#1]{\ctxcommand{showinjector("#1")}} + +\unexpanded\def\setinjector {\dotripleargument\dosetinjector} +\unexpanded\def\showinjector{\dosingleempty\doshowinjector} + +\unexpanded\def\domarkinjector#1#2% called at the lua end + {\dontleavehmode\llap{\infofont\ifcase#1\else\red\fi<#2>\quad}} + +% low level definers + +\unexpanded\def\doinstallinjector#1% + {\letvalue{typo_injectors_mark_#1}\donothing + \letvalue{typo_injectors_check_#1}\donothing} + +\unexpanded\def\doactivateinjector#1% used at lua end + {\setuxvalue{typo_injectors_mark_#1}{\dontleavehmode\noexpand\ctxcommand{markinjector("#1")}}% + \setuxvalue{typo_injectors_check_#1}{\noexpand\ctxcommand{checkinjector("#1")}}} + +\protect \endinput + diff --git a/tex/context/base/x-asciimath.lua b/tex/context/base/x-asciimath.lua index ee4fb5134..410479128 100644 --- a/tex/context/base/x-asciimath.lua +++ b/tex/context/base/x-asciimath.lua @@ -37,6 +37,7 @@ end local type, rawget = type, rawget local concat, insert, remove = table.concat, table.insert, table.remove local rep, gmatch, gsub, find = string.rep, string.gmatch, string.gsub, string.find +local utfchar = utf.char local lpegmatch, patterns = lpeg.match, lpeg.patterns local S, P, R, C, V, Cc, Ct, Cs = lpeg.S, lpeg.P, lpeg.R, lpeg.C, lpeg.V, lpeg.Cc, lpeg.Ct, lpeg.Cs @@ -51,643 +52,630 @@ local xmltext = xml.text local xmlinclusion = xml.inclusion local xmlcollected = xml.collected +-- todo: use private unicodes as temporary slots ... easier to compare + +local s_lparent = "\\left\\lparent" +local s_lbrace = "\\left\\lbrace" +local s_lbracket = "\\left\\lbracket" +local s_langle = "\\left\\langle" +local s_lfloor = "\\left\\lfloor" +local s_lceil = "\\left\\lceil" +local s_left = "\\left." + +local s_rparent = "\\right\\rparent" +local s_rbrace = "\\right\\rbrace" +local s_rbracket = "\\right\\rbracket" +local s_rangle = "\\right\\rangle" +local s_rfloor = "\\right\\rfloor" +local s_rceil = "\\right\\rceil" +local s_right = "\\right." + +local s_mslash = "\\middle/" + +local s_lbar = "\\left\\|" +local s_mbar = "\\middle\\|" +local s_rbar = "\\right\\|" + +local s_lnothing = "\\left ." -- space fools checker +local s_rnothing = "\\right ." -- space fools checker + local reserved = { - -- ["aleph"] = "\\aleph", - -- ["vdots"] = "\\vdots", - -- ["ddots"] = "\\ddots", - -- ["oint"] = "\\oint", - -- ["grad"] = "\\nabla", - ["prod"] = "\\prod", - -- ["prop"] = "\\propto", - -- ["sube"] = "\\subseteq", - -- ["supe"] = "\\supseteq", - ["sinh"] = "\\sinh", - ["cosh"] = "\\cosh", - ["tanh"] = "\\tanh", - ["sum"] = "\\sum", - -- ["vvv"] = "\\vee", - -- ["nnn"] = "\\cap", - -- ["uuu"] = "\\cup", - -- ["sub"] = "\\subset", - -- ["sup"] = "\\supset", - -- ["iff"] = "\\Leftrightarrow", - ["int"] = "\\int", - -- ["del"] = "\\partial", - ["sin"] = "\\sin", - ["cos"] = "\\cos", - ["tan"] = "\\tan", - ["csc"] = "\\csc", - ["sec"] = "\\sec", - ["cot"] = "\\cot", - ["log"] = "\\log", - ["det"] = "\\det", - ["lim"] = "\\lim", - ["mod"] = "\\mod", - ["gcd"] = "\\gcd", - -- ["lcm"] = "\\lcm", -- undefined in context - ["min"] = "\\min", - ["max"] = "\\max", - -- ["xx"] = "\\times", - ["in"] = "\\in", - -- ["ox"] = "\\otimes", - -- ["vv"] = "\\vee", - -- ["nn"] = "\\cap", - -- ["uu"] = "\\cup", - -- ["oo"] = "\\infty", - ["ln"] = "\\ln", - - -- ["not"] = "\\not", - ["and"] = "\\text{and}", - ["or"] = "\\text{or}", - ["if"] = "\\text{if}", - - -- ["AA"] = "\\forall", - -- ["EE"] = "\\exists", - -- ["TT"] = "\\top", - - ["sqrt"] = "\\rootradical{}", - ["root"] = "\\rootradical", - ["frac"] = "\\frac", - -- ["stackrel"] = "\\stackrel", - ["stackrel"] = "\\asciimathstackrel", - -- ["text"] = "\\asciimathoptext", - -- ["bb"] = "\\bb", - ["hat"] = "\\widehat", - ["bar"] = "\\overbar", - ["overbar"] = "\\overbar", - ["underline"] = "\\underline", - ["vec"] = "\\overrightarrow", - ["dot"] = "\\dot", - ["ddot"] = "\\ddot", + + ["prod"] = { false, "\\prod" }, + ["sinh"] = { false, "\\sinh" }, + ["cosh"] = { false, "\\cosh" }, + ["tanh"] = { false, "\\tanh" }, + ["sum"] = { false, "\\sum" }, + ["int"] = { false, "\\int" }, + ["sin"] = { false, "\\sin" }, + ["cos"] = { false, "\\cos" }, + ["tan"] = { false, "\\tan" }, + ["csc"] = { false, "\\csc" }, + ["sec"] = { false, "\\sec" }, + ["cot"] = { false, "\\cot" }, + ["log"] = { false, "\\log" }, + ["det"] = { false, "\\det" }, + ["lim"] = { false, "\\lim" }, + ["mod"] = { false, "\\mod" }, + ["gcd"] = { false, "\\gcd" }, + ["min"] = { false, "\\min" }, + ["max"] = { false, "\\max" }, + ["in"] = { false, "\\in" }, + ["ln"] = { false, "\\ln" }, + + ["atan"] = { false, "\\atan" }, -- extra + ["acos"] = { false, "\\acos" }, -- extra + ["asin"] = { false, "\\asin" }, -- extra + -- extra + ["arctan"] = { false, "\\arctan" }, -- extra + ["arccos"] = { false, "\\arccos" }, -- extra + ["arcsin"] = { false, "\\arcsin" }, -- extra + + ["and"] = { false, "\\text{and}" }, + ["or"] = { false, "\\text{or}" }, + ["if"] = { false, "\\text{if}" }, + + ["sqrt"] = { false, "\\rootradical{}", "unary" }, + ["root"] = { false, "\\rootradical", "binary" }, + ["frac"] = { false, "\\frac", "binary" }, + ["stackrel"] = { false, "\\asciimathstackrel", "binary" }, + ["hat"] = { false, "\\widehat", "unary" }, + ["bar"] = { false, "\\overbar", "unary" }, + ["overbar"] = { false, "\\overbar", "unary" }, + ["underline"] = { false, "\\underline", "unary" }, + ["vec"] = { false, "\\overrightarrow", "unary" }, + ["dot"] = { false, "\\dot", "unary" }, -- 0x2D9 + ["ddot"] = { false, "\\ddot", "unary" }, -- 0xA8 -- binary operators - -- ["+"] = "+", - -- ["-"] = "-", - ["*"] = "⋅", - ["**"] = "⋆", - ["//"] = "\\slash", - ["\\"] = "\\", - ["xx"] = "×", - ["times"] = "×", - ["-:"] = "÷", - ["@"] = "∘", - ["o+"] = "⊕", - ["ox"] = "⊗", - ["o."] = "⊙", - ["^^"] = "∧", - ["vv"] = "∨", - ["nn"] = "∩", - ["uu"] = "∪", + ["+"] = { true, "+" }, + ["-"] = { true, "-" }, + ["*"] = { true, "⋅" }, + ["**"] = { true, "⋆" }, + ["//"] = { true, "⁄" }, -- \slash + ["\\"] = { true, "\\" }, + ["xx"] = { true, "×" }, + ["times"] = { true, "×" }, + ["-:"] = { true, "÷" }, + ["@"] = { true, "∘" }, + ["o+"] = { true, "⊕" }, + ["ox"] = { true, "⊗" }, + ["o."] = { true, "⊙" }, + ["^^"] = { true, "∧" }, + ["vv"] = { true, "∨" }, + ["nn"] = { true, "∩" }, + ["uu"] = { true, "∪" }, -- big operators - -- ["sum"] = "∑", - -- ["prod"] = "∏", - ["^^^"] = "⋀", - ["vvv"] = "⋁", - ["nnn"] = "⋂", - ["uuu"] = "⋃", - ["int"] = "∫", - ["oint"] = "∮", + ["^^^"] = { true, "⋀" }, + ["vvv"] = { true, "⋁" }, + ["nnn"] = { true, "⋂" }, + ["uuu"] = { true, "⋃" }, + ["int"] = { true, "∫" }, + ["oint"] = { true, "∮" }, -- brackets - -- ["("] = "(, - -- [")"] = "), - -- ["["] = "[, - -- ["]"] = "], - -- ["{"] = "{, - -- ["}"] = "}, - -- ["(:"] = "〈", - -- [":)"] = "〉", + ["("] = { true, "(" }, + [")"] = { true, ")" }, + ["["] = { true, "[" }, + ["]"] = { true, "]" }, + ["{"] = { true, "{" }, + ["}"] = { true, "}" }, -- binary relations - ["="] = "=", - ["eq"] = "=", - ["!="] = "≠", - ["ne"] = "≠", - ["neq"] = "≠", - ["<"] = "<", - ["lt"] = "<", - [">"] = ">", - ["gt"] = ">", - ["<="] = "≤", - ["le"] = "≤", - ["leq"] = "≤", - [">="] = "≥", - ["ge"] = "≥", - ["geq"] = "≥", - ["-<"] = "≺", - [">-"] = "≻", - ["in"] = "∈", - ["!in"] = "∉", - ["sub"] = "⊂", - ["sup"] = "⊃", - ["sube"] = "⊆", - ["supe"] = "⊇", - ["-="] = "≡", - ["~="] = "≅", - ["~~"] = "≈", - ["prop"] = "∝", + ["="] = { true, "=" }, + ["eq"] = { true, "=" }, + ["!="] = { true, "≠" }, + ["ne"] = { true, "≠" }, + ["neq"] = { true, "≠" }, + ["<"] = { true, "<" }, + ["lt"] = { true, "<" }, + [">"] = { true, ">" }, + ["gt"] = { true, ">" }, + ["<="] = { true, "≤" }, + ["le"] = { true, "≤" }, + ["leq"] = { true, "≤" }, + [">="] = { true, "≥" }, + ["ge"] = { true, "≥" }, + ["geq"] = { true, "≥" }, + ["-<"] = { true, "≺" }, + [">-"] = { true, "≻" }, + ["in"] = { true, "∈" }, + ["!in"] = { true, "∉" }, + ["sub"] = { true, "⊂" }, + ["sup"] = { true, "⊃" }, + ["sube"] = { true, "⊆" }, + ["supe"] = { true, "⊇" }, + ["-="] = { true, "≡" }, + ["~="] = { true, "≅" }, + ["~~"] = { true, "≈" }, + ["prop"] = { true, "∝" }, -- arrows - ["rarr"] = "→", - ["->"] = "→", - ["larr"] = "←", - ["harr"] = "↔", - ["uarr"] = "↑", - ["darr"] = "↓", - ["rArr"] = "⇒", - ["lArr"] = "⇐", - ["hArr"] = "⇔", - ["|->"] = "↦", + ["rarr"] = { true, "→" }, + ["->"] = { true, "→" }, + ["larr"] = { true, "←" }, + ["harr"] = { true, "↔" }, + ["uarr"] = { true, "↑" }, + ["darr"] = { true, "↓" }, + ["rArr"] = { true, "⇒" }, + ["lArr"] = { true, "⇐" }, + ["hArr"] = { true, "⇔" }, + ["|->"] = { true, "↦" }, -- logical - -- ["and"] = "and", - -- ["or"] = "or", - -- ["if"] = "if", - ["not"] = "¬", - ["=>"] = "⇒", - ["iff"] = "⇔", - ["AA"] = "∀", - ["EE"] = "∃", - ["_|_"] = "⊥", - ["TT"] = "⊤", - ["|--"] = "⊢", - ["|=="] = "⊨", + ["not"] = { true, "¬" }, + ["=>"] = { true, "⇒" }, + ["iff"] = { true, "⇔" }, + ["AA"] = { true, "∀" }, + ["EE"] = { true, "∃" }, + ["_|_"] = { true, "⊥" }, + ["TT"] = { true, "⊤" }, + ["|--"] = { true, "⊢" }, + ["|=="] = { true, "⊨" }, -- miscellaneous - ["del"] = "∂", - ["grad"] = "∇", - ["+-"] = "±", - ["O/"] = "∅", - ["oo"] = "∞", - ["aleph"] = "ℵ", - ["angle"] = "∠", - ["/_"] = "∠", - [":."] = "∴", - ["..."] = "...", -- ldots - ["ldots"] = "...", -- ldots - ["cdots"] = "⋯", - ["vdots"] = "⋮", - ["ddots"] = "⋱", - ["diamond"] = "⋄", - ["square"] = "□", - ["|__"] = "⌊", - ["__|"] = "⌋", - ["|~"] = "⌈", - ["~|"] = "⌉", + ["del"] = { true, "∂" }, + ["grad"] = { true, "∇" }, + ["+-"] = { true, "±" }, + ["O/"] = { true, "∅" }, + ["oo"] = { true, "∞" }, + ["aleph"] = { true, "ℵ" }, + ["angle"] = { true, "∠" }, + ["/_"] = { true, "∠" }, + [":."] = { true, "∴" }, + ["..."] = { true, "..." }, -- ldots + ["ldots"] = { true, "..." }, -- ldots + ["cdots"] = { true, "⋯" }, + ["vdots"] = { true, "⋮" }, + ["ddots"] = { true, "⋱" }, + ["diamond"] = { true, "⋄" }, + ["square"] = { true, "□" }, + ["|__"] = { true, "⌊" }, + ["__|"] = { true, "⌋" }, + ["|~"] = { true, "⌈" }, + ["~|"] = { true, "⌉" }, - -- special + -- more - ["%"] = "\\mathpercent", - ["&"] = "\\mathampersand", - ["#"] = "\\mathhash", - ["$"] = "\\mathdollar", + ["_="] = { true, "≡" }, - -- more - ["_="] = "≡", + -- bonus + + ["prime"] = { true, "′" }, -- bonus + ["'"] = { true, "′" }, -- bonus + ["''"] = { true, "″" }, -- bonus + ["'''"] = { true, "‴" }, -- bonus + + -- special + + ["%"] = { false, "\\mathpercent" }, + ["&"] = { false, "\\mathampersand" }, + ["#"] = { false, "\\mathhash" }, + ["$"] = { false, "\\mathdollar" }, -- blackboard - ["CC"] = "ℂ", - ["NN"] = "ℕ", - ["QQ"] = "ℚ", - ["RR"] = "ℝ", - ["ZZ"] = "ℤ", + ["CC"] = { true, "ℂ" }, + ["NN"] = { true, "ℕ" }, + ["QQ"] = { true, "ℚ" }, + ["RR"] = { true, "ℝ" }, + ["ZZ"] = { true, "ℤ" }, -- greek lowercase - alpha = "α", - beta = "β", - gamma = "γ", - delta = "δ", - epsilon = "ε", - varepsilon = "ɛ", - zeta = "ζ", - eta = "η", - theta = "θ", - vartheta = "ϑ", - iota = "ι", - kappa = "κ", - lambda = "λ", - mu = "μ", - nu = "ν", - xi = "ξ", - pi = "π", - rho = "ρ", - sigma = "σ", - tau = "τ", - upsilon = "υ", - phi = "φ", - varphi = "ϕ", - chi = "χ", - psi = "ψ", - omega = "ω", + ["alpha"] = { true, "α" }, + ["beta"] = { true, "β" }, + ["gamma"] = { true, "γ" }, + ["delta"] = { true, "δ" }, + ["epsilon"] = { true, "ε" }, + ["varepsilon"] = { true, "ɛ" }, + ["zeta"] = { true, "ζ" }, + ["eta"] = { true, "η" }, + ["theta"] = { true, "θ" }, + ["vartheta"] = { true, "ϑ" }, + ["iota"] = { true, "ι" }, + ["kappa"] = { true, "κ" }, + ["lambda"] = { true, "λ" }, + ["mu"] = { true, "μ" }, + ["nu"] = { true, "ν" }, + ["xi"] = { true, "ξ" }, + ["pi"] = { true, "π" }, + ["rho"] = { true, "ρ" }, + ["sigma"] = { true, "σ" }, + ["tau"] = { true, "τ" }, + ["upsilon"] = { true, "υ" }, + ["phi"] = { true, "φ" }, + ["varphi"] = { true, "ϕ" }, + ["chi"] = { true, "χ" }, + ["psi"] = { true, "ψ" }, + ["omega"] = { true, "ω" }, -- greek uppercase - Gamma = "Γ", - Delta = "Δ", - Theta = "Θ", - Lambda = "Λ", - Xi = "Ξ", - Pi = "Π", - Sigma = "Σ", - Phi = "Φ", - Psi = "Ψ", - Omega = "Ω", - - -- alternatively we could just inject a style switch + following character + ["Gamma"] = { true, "Γ" }, + ["Delta"] = { true, "Δ" }, + ["Theta"] = { true, "Θ" }, + ["Lambda"] = { true, "Λ" }, + ["Xi"] = { true, "Ξ" }, + ["Pi"] = { true, "Π" }, + ["Sigma"] = { true, "Σ" }, + ["Phi"] = { true, "Φ" }, + ["Psi"] = { true, "Ψ" }, + ["Omega"] = { true, "Ω" }, -- blackboard - ["bbb a"] = "𝕒", - ["bbb b"] = "𝕓", - ["bbb c"] = "𝕔", - ["bbb d"] = "𝕕", - ["bbb e"] = "𝕖", - ["bbb f"] = "𝕗", - ["bbb g"] = "𝕘", - ["bbb h"] = "𝕙", - ["bbb i"] = "𝕚", - ["bbb j"] = "𝕛", - ["bbb k"] = "𝕜", - ["bbb l"] = "𝕝", - ["bbb m"] = "𝕞", - ["bbb n"] = "𝕟", - ["bbb o"] = "𝕠", - ["bbb p"] = "𝕡", - ["bbb q"] = "𝕢", - ["bbb r"] = "𝕣", - ["bbb s"] = "𝕤", - ["bbb t"] = "𝕥", - ["bbb u"] = "𝕦", - ["bbb v"] = "𝕧", - ["bbb w"] = "𝕨", - ["bbb x"] = "𝕩", - ["bbb y"] = "𝕪", - ["bbb z"] = "𝕫", - - ["bbb A"] = "𝔸", - ["bbb B"] = "𝔹", - ["bbb C"] = "ℂ", - ["bbb D"] = "𝔻", - ["bbb E"] = "𝔼", - ["bbb F"] = "𝔽", - ["bbb G"] = "𝔾", - ["bbb H"] = "ℍ", - ["bbb I"] = "𝕀", - ["bbb J"] = "𝕁", - ["bbb K"] = "𝕂", - ["bbb L"] = "𝕃", - ["bbb M"] = "𝕄", - ["bbb N"] = "ℕ", - ["bbb O"] = "𝕆", - ["bbb P"] = "ℙ", - ["bbb Q"] = "ℚ", - ["bbb R"] = "ℝ", - ["bbb S"] = "𝕊", - ["bbb T"] = "𝕋", - ["bbb U"] = "𝕌", - ["bbb V"] = "𝕍", - ["bbb W"] = "𝕎", - ["bbb X"] = "𝕏", - ["bbb Y"] = "𝕐", - ["bbb Z"] = "ℤ", + ["bbb a"] = { true, "𝕒" }, + ["bbb b"] = { true, "𝕓" }, + ["bbb c"] = { true, "𝕔" }, + ["bbb d"] = { true, "𝕕" }, + ["bbb e"] = { true, "𝕖" }, + ["bbb f"] = { true, "𝕗" }, + ["bbb g"] = { true, "𝕘" }, + ["bbb h"] = { true, "𝕙" }, + ["bbb i"] = { true, "𝕚" }, + ["bbb j"] = { true, "𝕛" }, + ["bbb k"] = { true, "𝕜" }, + ["bbb l"] = { true, "𝕝" }, + ["bbb m"] = { true, "𝕞" }, + ["bbb n"] = { true, "𝕟" }, + ["bbb o"] = { true, "𝕠" }, + ["bbb p"] = { true, "𝕡" }, + ["bbb q"] = { true, "𝕢" }, + ["bbb r"] = { true, "𝕣" }, + ["bbb s"] = { true, "𝕤" }, + ["bbb t"] = { true, "𝕥" }, + ["bbb u"] = { true, "𝕦" }, + ["bbb v"] = { true, "𝕧" }, + ["bbb w"] = { true, "𝕨" }, + ["bbb x"] = { true, "𝕩" }, + ["bbb y"] = { true, "𝕪" }, + ["bbb z"] = { true, "𝕫" }, + + ["bbb A"] = { true, "𝔸" }, + ["bbb B"] = { true, "𝔹" }, + ["bbb C"] = { true, "ℂ" }, + ["bbb D"] = { true, "𝔻" }, + ["bbb E"] = { true, "𝔼" }, + ["bbb F"] = { true, "𝔽" }, + ["bbb G"] = { true, "𝔾" }, + ["bbb H"] = { true, "ℍ" }, + ["bbb I"] = { true, "𝕀" }, + ["bbb J"] = { true, "𝕁" }, + ["bbb K"] = { true, "𝕂" }, + ["bbb L"] = { true, "𝕃" }, + ["bbb M"] = { true, "𝕄" }, + ["bbb N"] = { true, "ℕ" }, + ["bbb O"] = { true, "𝕆" }, + ["bbb P"] = { true, "ℙ" }, + ["bbb Q"] = { true, "ℚ" }, + ["bbb R"] = { true, "ℝ" }, + ["bbb S"] = { true, "𝕊" }, + ["bbb T"] = { true, "𝕋" }, + ["bbb U"] = { true, "𝕌" }, + ["bbb V"] = { true, "𝕍" }, + ["bbb W"] = { true, "𝕎" }, + ["bbb X"] = { true, "𝕏" }, + ["bbb Y"] = { true, "𝕐" }, + ["bbb Z"] = { true, "ℤ" }, -- fraktur - ["fr a"] = "𝔞", - ["fr b"] = "𝔟", - ["fr c"] = "𝔠", - ["fr d"] = "𝔡", - ["fr e"] = "𝔢", - ["fr f"] = "𝔣", - ["fr g"] = "𝔤", - ["fr h"] = "𝔥", - ["fr i"] = "𝔦", - ["fr j"] = "𝔧", - ["fr k"] = "𝔨", - ["fr l"] = "𝔩", - ["fr m"] = "𝔪", - ["fr n"] = "𝔫", - ["fr o"] = "𝔬", - ["fr p"] = "𝔭", - ["fr q"] = "𝔮", - ["fr r"] = "𝔯", - ["fr s"] = "𝔰", - ["fr t"] = "𝔱", - ["fr u"] = "𝔲", - ["fr v"] = "𝔳", - ["fr w"] = "𝔴", - ["fr x"] = "𝔵", - ["fr y"] = "𝔶", - ["fr z"] = "𝔷", - - ["fr A"] = "𝔄", - ["fr B"] = "𝔅", - ["fr C"] = "ℭ", - ["fr D"] = "𝔇", - ["fr E"] = "𝔈", - ["fr F"] = "𝔉", - ["fr G"] = "𝔊", - ["fr H"] = "ℌ", - ["fr I"] = "ℑ", - ["fr J"] = "𝔍", - ["fr K"] = "𝔎", - ["fr L"] = "𝔏", - ["fr M"] = "𝔐", - ["fr N"] = "𝔑", - ["fr O"] = "𝔒", - ["fr P"] = "𝔓", - ["fr Q"] = "𝔔", - ["fr R"] = "ℜ", - ["fr S"] = "𝔖", - ["fr T"] = "𝔗", - ["fr U"] = "𝔘", - ["fr V"] = "𝔙", - ["fr W"] = "𝔚", - ["fr X"] = "𝔛", - ["fr Y"] = "𝔜", - ["fr Z"] = "ℨ", + ["fr a"] = { true, "𝔞" }, + ["fr b"] = { true, "𝔟" }, + ["fr c"] = { true, "𝔠" }, + ["fr d"] = { true, "𝔡" }, + ["fr e"] = { true, "𝔢" }, + ["fr f"] = { true, "𝔣" }, + ["fr g"] = { true, "𝔤" }, + ["fr h"] = { true, "𝔥" }, + ["fr i"] = { true, "𝔦" }, + ["fr j"] = { true, "𝔧" }, + ["fr k"] = { true, "𝔨" }, + ["fr l"] = { true, "𝔩" }, + ["fr m"] = { true, "𝔪" }, + ["fr n"] = { true, "𝔫" }, + ["fr o"] = { true, "𝔬" }, + ["fr p"] = { true, "𝔭" }, + ["fr q"] = { true, "𝔮" }, + ["fr r"] = { true, "𝔯" }, + ["fr s"] = { true, "𝔰" }, + ["fr t"] = { true, "𝔱" }, + ["fr u"] = { true, "𝔲" }, + ["fr v"] = { true, "𝔳" }, + ["fr w"] = { true, "𝔴" }, + ["fr x"] = { true, "𝔵" }, + ["fr y"] = { true, "𝔶" }, + ["fr z"] = { true, "𝔷" }, + + ["fr A"] = { true, "𝔄" }, + ["fr B"] = { true, "𝔅" }, + ["fr C"] = { true, "ℭ" }, + ["fr D"] = { true, "𝔇" }, + ["fr E"] = { true, "𝔈" }, + ["fr F"] = { true, "𝔉" }, + ["fr G"] = { true, "𝔊" }, + ["fr H"] = { true, "ℌ" }, + ["fr I"] = { true, "ℑ" }, + ["fr J"] = { true, "𝔍" }, + ["fr K"] = { true, "𝔎" }, + ["fr L"] = { true, "𝔏" }, + ["fr M"] = { true, "𝔐" }, + ["fr N"] = { true, "𝔑" }, + ["fr O"] = { true, "𝔒" }, + ["fr P"] = { true, "𝔓" }, + ["fr Q"] = { true, "𝔔" }, + ["fr R"] = { true, "ℜ" }, + ["fr S"] = { true, "𝔖" }, + ["fr T"] = { true, "𝔗" }, + ["fr U"] = { true, "𝔘" }, + ["fr V"] = { true, "𝔙" }, + ["fr W"] = { true, "𝔚" }, + ["fr X"] = { true, "𝔛" }, + ["fr Y"] = { true, "𝔜" }, + ["fr Z"] = { true, "ℨ" }, -- script - ["cc a"] = "𝒶", - ["cc b"] = "𝒷", - ["cc c"] = "𝒸", - ["cc d"] = "𝒹", - ["cc e"] = "ℯ", - ["cc f"] = "𝒻", - ["cc g"] = "ℊ", - ["cc h"] = "𝒽", - ["cc i"] = "𝒾", - ["cc j"] = "𝒿", - ["cc k"] = "𝓀", - ["cc l"] = "𝓁", - ["cc m"] = "𝓂", - ["cc n"] = "𝓃", - ["cc o"] = "ℴ", - ["cc p"] = "𝓅", - ["cc q"] = "𝓆", - ["cc r"] = "𝓇", - ["cc s"] = "𝓈", - ["cc t"] = "𝓉", - ["cc u"] = "𝓊", - ["cc v"] = "𝓋", - ["cc w"] = "𝓌", - ["cc x"] = "𝓍", - ["cc y"] = "𝓎", - ["cc z"] = "𝓏", - - ["cc A"] = "𝒜", - ["cc B"] = "ℬ", - ["cc C"] = "𝒞", - ["cc D"] = "𝒟", - ["cc E"] = "ℰ", - ["cc F"] = "ℱ", - ["cc G"] = "𝒢", - ["cc H"] = "ℋ", - ["cc I"] = "ℐ", - ["cc J"] = "𝒥", - ["cc K"] = "𝒦", - ["cc L"] = "ℒ", - ["cc M"] = "ℳ", - ["cc N"] = "𝒩", - ["cc O"] = "𝒪", - ["cc P"] = "𝒫", - ["cc Q"] = "𝒬", - ["cc R"] = "ℛ", - ["cc S"] = "𝒮", - ["cc T"] = "𝒯", - ["cc U"] = "𝒰", - ["cc V"] = "𝒱", - ["cc W"] = "𝒲", - ["cc X"] = "𝒳", - ["cc Y"] = "𝒴", - ["cc Z"] = "𝒵", + ["cc a"] = { true, "𝒶" }, + ["cc b"] = { true, "𝒷" }, + ["cc c"] = { true, "𝒸" }, + ["cc d"] = { true, "𝒹" }, + ["cc e"] = { true, "ℯ" }, + ["cc f"] = { true, "𝒻" }, + ["cc g"] = { true, "ℊ" }, + ["cc h"] = { true, "𝒽" }, + ["cc i"] = { true, "𝒾" }, + ["cc j"] = { true, "𝒿" }, + ["cc k"] = { true, "𝓀" }, + ["cc l"] = { true, "𝓁" }, + ["cc m"] = { true, "𝓂" }, + ["cc n"] = { true, "𝓃" }, + ["cc o"] = { true, "ℴ" }, + ["cc p"] = { true, "𝓅" }, + ["cc q"] = { true, "𝓆" }, + ["cc r"] = { true, "𝓇" }, + ["cc s"] = { true, "𝓈" }, + ["cc t"] = { true, "𝓉" }, + ["cc u"] = { true, "𝓊" }, + ["cc v"] = { true, "𝓋" }, + ["cc w"] = { true, "𝓌" }, + ["cc x"] = { true, "𝓍" }, + ["cc y"] = { true, "𝓎" }, + ["cc z"] = { true, "𝓏" }, + + ["cc A"] = { true, "𝒜" }, + ["cc B"] = { true, "ℬ" }, + ["cc C"] = { true, "𝒞" }, + ["cc D"] = { true, "𝒟" }, + ["cc E"] = { true, "ℰ" }, + ["cc F"] = { true, "ℱ" }, + ["cc G"] = { true, "𝒢" }, + ["cc H"] = { true, "ℋ" }, + ["cc I"] = { true, "ℐ" }, + ["cc J"] = { true, "𝒥" }, + ["cc K"] = { true, "𝒦" }, + ["cc L"] = { true, "ℒ" }, + ["cc M"] = { true, "ℳ" }, + ["cc N"] = { true, "𝒩" }, + ["cc O"] = { true, "𝒪" }, + ["cc P"] = { true, "𝒫" }, + ["cc Q"] = { true, "𝒬" }, + ["cc R"] = { true, "ℛ" }, + ["cc S"] = { true, "𝒮" }, + ["cc T"] = { true, "𝒯" }, + ["cc U"] = { true, "𝒰" }, + ["cc V"] = { true, "𝒱" }, + ["cc W"] = { true, "𝒲" }, + ["cc X"] = { true, "𝒳" }, + ["cc Y"] = { true, "𝒴" }, + ["cc Z"] = { true, "𝒵" }, -- bold - ["bb a"] = "𝒂", - ["bb b"] = "𝒃", - ["bb c"] = "𝒄", - ["bb d"] = "𝒅", - ["bb e"] = "𝒆", - ["bb f"] = "𝒇", - ["bb g"] = "𝒈", - ["bb h"] = "𝒉", - ["bb i"] = "𝒊", - ["bb j"] = "𝒋", - ["bb k"] = "𝒌", - ["bb l"] = "𝒍", - ["bb m"] = "𝒎", - ["bb n"] = "𝒏", - ["bb o"] = "𝒐", - ["bb p"] = "𝒑", - ["bb q"] = "𝒒", - ["bb r"] = "𝒓", - ["bb s"] = "𝒔", - ["bb t"] = "𝒕", - ["bb u"] = "𝒖", - ["bb v"] = "𝒗", - ["bb w"] = "𝒘", - ["bb x"] = "𝒙", - ["bb y"] = "𝒚", - ["bb z"] = "𝒛", - - ["bb A"] = "𝑨", - ["bb B"] = "𝑩", - ["bb C"] = "𝑪", - ["bb D"] = "𝑫", - ["bb E"] = "𝑬", - ["bb F"] = "𝑭", - ["bb G"] = "𝑮", - ["bb H"] = "𝑯", - ["bb I"] = "𝑰", - ["bb J"] = "𝑱", - ["bb K"] = "𝑲", - ["bb L"] = "𝑳", - ["bb M"] = "𝑴", - ["bb N"] = "𝑵", - ["bb O"] = "𝑶", - ["bb P"] = "𝑷", - ["bb Q"] = "𝑸", - ["bb R"] = "𝑹", - ["bb S"] = "𝑺", - ["bb T"] = "𝑻", - ["bb U"] = "𝑼", - ["bb V"] = "𝑽", - ["bb W"] = "𝑾", - ["bb X"] = "𝑿", - ["bb Y"] = "𝒀", - ["bb Z"] = "𝒁", + ["bb a"] = { true, "𝒂" }, + ["bb b"] = { true, "𝒃" }, + ["bb c"] = { true, "𝒄" }, + ["bb d"] = { true, "𝒅" }, + ["bb e"] = { true, "𝒆" }, + ["bb f"] = { true, "𝒇" }, + ["bb g"] = { true, "𝒈" }, + ["bb h"] = { true, "𝒉" }, + ["bb i"] = { true, "𝒊" }, + ["bb j"] = { true, "𝒋" }, + ["bb k"] = { true, "𝒌" }, + ["bb l"] = { true, "𝒍" }, + ["bb m"] = { true, "𝒎" }, + ["bb n"] = { true, "𝒏" }, + ["bb o"] = { true, "𝒐" }, + ["bb p"] = { true, "𝒑" }, + ["bb q"] = { true, "𝒒" }, + ["bb r"] = { true, "𝒓" }, + ["bb s"] = { true, "𝒔" }, + ["bb t"] = { true, "𝒕" }, + ["bb u"] = { true, "𝒖" }, + ["bb v"] = { true, "𝒗" }, + ["bb w"] = { true, "𝒘" }, + ["bb x"] = { true, "𝒙" }, + ["bb y"] = { true, "𝒚" }, + ["bb z"] = { true, "𝒛" }, + + ["bb A"] = { true, "𝑨" }, + ["bb B"] = { true, "𝑩" }, + ["bb C"] = { true, "𝑪" }, + ["bb D"] = { true, "𝑫" }, + ["bb E"] = { true, "𝑬" }, + ["bb F"] = { true, "𝑭" }, + ["bb G"] = { true, "𝑮" }, + ["bb H"] = { true, "𝑯" }, + ["bb I"] = { true, "𝑰" }, + ["bb J"] = { true, "𝑱" }, + ["bb K"] = { true, "𝑲" }, + ["bb L"] = { true, "𝑳" }, + ["bb M"] = { true, "𝑴" }, + ["bb N"] = { true, "𝑵" }, + ["bb O"] = { true, "𝑶" }, + ["bb P"] = { true, "𝑷" }, + ["bb Q"] = { true, "𝑸" }, + ["bb R"] = { true, "𝑹" }, + ["bb S"] = { true, "𝑺" }, + ["bb T"] = { true, "𝑻" }, + ["bb U"] = { true, "𝑼" }, + ["bb V"] = { true, "𝑽" }, + ["bb W"] = { true, "𝑾" }, + ["bb X"] = { true, "𝑿" }, + ["bb Y"] = { true, "𝒀" }, + ["bb Z"] = { true, "𝒁" }, -- sans - ["sf a"] = "𝖺", - ["sf b"] = "𝖻", - ["sf c"] = "𝖼", - ["sf d"] = "𝖽", - ["sf e"] = "𝖾", - ["sf f"] = "𝖿", - ["sf g"] = "𝗀", - ["sf h"] = "𝗁", - ["sf i"] = "𝗂", - ["sf j"] = "𝗃", - ["sf k"] = "𝗄", - ["sf l"] = "𝗅", - ["sf m"] = "𝗆", - ["sf n"] = "𝗇", - ["sf o"] = "𝗈", - ["sf p"] = "𝗉", - ["sf q"] = "𝗊", - ["sf r"] = "𝗋", - ["sf s"] = "𝗌", - ["sf t"] = "𝗍", - ["sf u"] = "𝗎", - ["sf v"] = "𝗏", - ["sf w"] = "𝗐", - ["sf x"] = "𝗑", - ["sf y"] = "𝗒", - ["sf z"] = "𝗓", - - ["sf A"] = "𝖠", - ["sf B"] = "𝖡", - ["sf C"] = "𝖢", - ["sf D"] = "𝖣", - ["sf E"] = "𝖤", - ["sf F"] = "𝖥", - ["sf G"] = "𝖦", - ["sf H"] = "𝖧", - ["sf I"] = "𝖨", - ["sf J"] = "𝖩", - ["sf K"] = "𝖪", - ["sf L"] = "𝖫", - ["sf M"] = "𝖬", - ["sf N"] = "𝖭", - ["sf O"] = "𝖮", - ["sf P"] = "𝖯", - ["sf Q"] = "𝖰", - ["sf R"] = "𝖱", - ["sf S"] = "𝖲", - ["sf T"] = "𝖳", - ["sf U"] = "𝖴", - ["sf V"] = "𝖵", - ["sf W"] = "𝖶", - ["sf X"] = "𝖷", - ["sf Y"] = "𝖸", - ["sf Z"] = "𝖹", + ["sf a"] = { true, "𝖺" }, + ["sf b"] = { true, "𝖻" }, + ["sf c"] = { true, "𝖼" }, + ["sf d"] = { true, "𝖽" }, + ["sf e"] = { true, "𝖾" }, + ["sf f"] = { true, "𝖿" }, + ["sf g"] = { true, "𝗀" }, + ["sf h"] = { true, "𝗁" }, + ["sf i"] = { true, "𝗂" }, + ["sf j"] = { true, "𝗃" }, + ["sf k"] = { true, "𝗄" }, + ["sf l"] = { true, "𝗅" }, + ["sf m"] = { true, "𝗆" }, + ["sf n"] = { true, "𝗇" }, + ["sf o"] = { true, "𝗈" }, + ["sf p"] = { true, "𝗉" }, + ["sf q"] = { true, "𝗊" }, + ["sf r"] = { true, "𝗋" }, + ["sf s"] = { true, "𝗌" }, + ["sf t"] = { true, "𝗍" }, + ["sf u"] = { true, "𝗎" }, + ["sf v"] = { true, "𝗏" }, + ["sf w"] = { true, "𝗐" }, + ["sf x"] = { true, "𝗑" }, + ["sf y"] = { true, "𝗒" }, + ["sf z"] = { true, "𝗓" }, + + ["sf A"] = { true, "𝖠" }, + ["sf B"] = { true, "𝖡" }, + ["sf C"] = { true, "𝖢" }, + ["sf D"] = { true, "𝖣" }, + ["sf E"] = { true, "𝖤" }, + ["sf F"] = { true, "𝖥" }, + ["sf G"] = { true, "𝖦" }, + ["sf H"] = { true, "𝖧" }, + ["sf I"] = { true, "𝖨" }, + ["sf J"] = { true, "𝖩" }, + ["sf K"] = { true, "𝖪" }, + ["sf L"] = { true, "𝖫" }, + ["sf M"] = { true, "𝖬" }, + ["sf N"] = { true, "𝖭" }, + ["sf O"] = { true, "𝖮" }, + ["sf P"] = { true, "𝖯" }, + ["sf Q"] = { true, "𝖰" }, + ["sf R"] = { true, "𝖱" }, + ["sf S"] = { true, "𝖲" }, + ["sf T"] = { true, "𝖳" }, + ["sf U"] = { true, "𝖴" }, + ["sf V"] = { true, "𝖵" }, + ["sf W"] = { true, "𝖶" }, + ["sf X"] = { true, "𝖷" }, + ["sf Y"] = { true, "𝖸" }, + ["sf Z"] = { true, "𝖹" }, -- monospace - ["tt a"] = "𝚊", - ["tt b"] = "𝚋", - ["tt c"] = "𝚌", - ["tt d"] = "𝚍", - ["tt e"] = "𝚎", - ["tt f"] = "𝚏", - ["tt g"] = "𝚐", - ["tt h"] = "𝚑", - ["tt i"] = "𝚒", - ["tt j"] = "𝚓", - ["tt k"] = "𝚔", - ["tt l"] = "𝚕", - ["tt m"] = "𝚖", - ["tt n"] = "𝚗", - ["tt o"] = "𝚘", - ["tt p"] = "𝚙", - ["tt q"] = "𝚚", - ["tt r"] = "𝚛", - ["tt s"] = "𝚜", - ["tt t"] = "𝚝", - ["tt u"] = "𝚞", - ["tt v"] = "𝚟", - ["tt w"] = "𝚠", - ["tt x"] = "𝚡", - ["tt y"] = "𝚢", - ["tt z"] = "𝚣", - - ["tt A"] = "𝙰", - ["tt B"] = "𝙱", - ["tt C"] = "𝙲", - ["tt D"] = "𝙳", - ["tt E"] = "𝙴", - ["tt F"] = "𝙵", - ["tt G"] = "𝙶", - ["tt H"] = "𝙷", - ["tt I"] = "𝙸", - ["tt J"] = "𝙹", - ["tt K"] = "𝙺", - ["tt L"] = "𝙻", - ["tt M"] = "𝙼", - ["tt N"] = "𝙽", - ["tt O"] = "𝙾", - ["tt P"] = "𝙿", - ["tt Q"] = "𝚀", - ["tt R"] = "𝚁", - ["tt S"] = "𝚂", - ["tt T"] = "𝚃", - ["tt U"] = "𝚄", - ["tt V"] = "𝚅", - ["tt W"] = "𝚆", - ["tt X"] = "𝚇", - ["tt Y"] = "𝚈", - ["tt Z"] = "𝚉", + ["tt a"] = { true, "𝚊" }, + ["tt b"] = { true, "𝚋" }, + ["tt c"] = { true, "𝚌" }, + ["tt d"] = { true, "𝚍" }, + ["tt e"] = { true, "𝚎" }, + ["tt f"] = { true, "𝚏" }, + ["tt g"] = { true, "𝚐" }, + ["tt h"] = { true, "𝚑" }, + ["tt i"] = { true, "𝚒" }, + ["tt j"] = { true, "𝚓" }, + ["tt k"] = { true, "𝚔" }, + ["tt l"] = { true, "𝚕" }, + ["tt m"] = { true, "𝚖" }, + ["tt n"] = { true, "𝚗" }, + ["tt o"] = { true, "𝚘" }, + ["tt p"] = { true, "𝚙" }, + ["tt q"] = { true, "𝚚" }, + ["tt r"] = { true, "𝚛" }, + ["tt s"] = { true, "𝚜" }, + ["tt t"] = { true, "𝚝" }, + ["tt u"] = { true, "𝚞" }, + ["tt v"] = { true, "𝚟" }, + ["tt w"] = { true, "𝚠" }, + ["tt x"] = { true, "𝚡" }, + ["tt y"] = { true, "𝚢" }, + ["tt z"] = { true, "𝚣" }, + + ["tt A"] = { true, "𝙰" }, + ["tt B"] = { true, "𝙱" }, + ["tt C"] = { true, "𝙲" }, + ["tt D"] = { true, "𝙳" }, + ["tt E"] = { true, "𝙴" }, + ["tt F"] = { true, "𝙵" }, + ["tt G"] = { true, "𝙶" }, + ["tt H"] = { true, "𝙷" }, + ["tt I"] = { true, "𝙸" }, + ["tt J"] = { true, "𝙹" }, + ["tt K"] = { true, "𝙺" }, + ["tt L"] = { true, "𝙻" }, + ["tt M"] = { true, "𝙼" }, + ["tt N"] = { true, "𝙽" }, + ["tt O"] = { true, "𝙾" }, + ["tt P"] = { true, "𝙿" }, + ["tt Q"] = { true, "𝚀" }, + ["tt R"] = { true, "𝚁" }, + ["tt S"] = { true, "𝚂" }, + ["tt T"] = { true, "𝚃" }, + ["tt U"] = { true, "𝚄" }, + ["tt V"] = { true, "𝚅" }, + ["tt W"] = { true, "𝚆" }, + ["tt X"] = { true, "𝚇" }, + ["tt Y"] = { true, "𝚈" }, + ["tt Z"] = { true, "𝚉" }, -- some more undocumented - ["dx"] = { "d", "x" }, -- "{dx}" "\\left(dx\\right)" - ["dy"] = { "d", "y" }, -- "{dy}" "\\left(dy\\right)" - ["dz"] = { "d", "z" }, -- "{dz}" "\\left(dz\\right)" - - ["atan"] = "\\atan", - ["acos"] = "\\acos", - ["asin"] = "\\asin", + ["dx"] = { false, { "d", "x" } }, -- "{dx}" "\\left(dx\\right)" + ["dy"] = { false, { "d", "y" } }, -- "{dy}" "\\left(dy\\right)" + ["dz"] = { false, { "d", "z" } }, -- "{dz}" "\\left(dz\\right)" - ["arctan"] = "\\arctan", - ["arccos"] = "\\arccos", - ["arcsin"] = "\\arcsin", - - ["prime"] = "′", - ["'"] = "′", - ["''"] = "″", - ["'''"] = "‴", } local isbinary = { ["\\frac"] = true, - ["\\root"] = true, ["\\rootradical"] = true, - ["\\stackrel"] = true, ["\\asciimathstackrel"] = true, } local isunary = { - ["\\sqrt"] = true, - ["\\rootradical{}"] = true, - -- ["\\bb"] = true, - ["\\text"] = true, -- mathoptext - ["\\mathoptext"] = true, -- mathoptext - ["\\asciimathoptext"]= true, -- mathoptext - ["\\hat"] = true, -- widehat - ["\\widehat"] = true, -- widehat - ["\\bar"] = true, -- - ["\\overbar"] = true, -- - ["\\underline"] = true, -- - ["\\vec"] = true, -- overrightarrow - ["\\overrightarrow"] = true, -- overrightarrow - ["\\dot"] = true, -- - ["\\ddot"] = true, -- - --- ["^"] = true, --- ["_"] = true, + ["\\sqrt"] = true, + ["\\rootradical{}"] = true, + ["\\text"] = true, -- mathoptext + ["\\mathoptext"] = true, -- mathoptext + ["\\asciimathoptext"] = true, -- mathoptext + ["\\hat"] = true, -- widehat + ["\\widehat"] = true, -- widehat + ["\\bar"] = true, -- + ["\\overbar"] = true, -- + ["\\underline"] = true, -- + ["\\vec"] = true, -- overrightarrow + ["\\overrightarrow"] = true, -- overrightarrow + ["\\dot"] = true, -- + ["\\ddot"] = true, -- } @@ -701,18 +689,23 @@ local isinfix = { } local isleft = { - ["\\left\\lparent"] = true, - ["\\left\\lbrace"] = true, - ["\\left\\lbracket"] = true, - ["\\left\\langle"] = true, - ["\\left."] = true, + [s_lparent] = true, + [s_lbrace] = true, + [s_lbracket] = true, + [s_langle] = true, + [s_lfloor] = true, + [s_lceil] = true, + [s_left] = true, } + local isright = { - ["\\right\\rparent"] = true, - ["\\right\\rbrace"] = true, - ["\\right\\rbracket"] = true, - ["\\right\\rangle"] = true, - ["\\right."] = true, + [s_rparent] = true, + [s_rbrace] = true, + [s_rbracket] = true, + [s_rangle] = true, + [s_rfloor] = true, + [s_rceil] = true, + [s_right] = true, } local issimplified = { @@ -722,6 +715,11 @@ local p_number_base = patterns.cpnumber or patterns.cnumber or patterns.number local p_number = C(p_number_base) local p_spaces = patterns.whitespace +local p_utf_base = patterns.utf8character +local p_utf = C(p_utf_base) +local p_entity_base = P("&") * ((1-P(";"))^2) * P(";") +local p_entity = P("&") * (((1-P(";"))^2) / entities) * P(";") + ----- p_number = Cs((patterns.cpnumber or patterns.cnumber or patterns.number)/function(s) return (gsub(s,",","{,}")) end) local sign = P("-")^-1 @@ -734,29 +732,9 @@ local float = real * (P("E") * integer)^-1 -- local number = C(float + integer) local p_number = C(float) -local p_utf_base = - patterns.utf8character -local p_utf = - C(p_utf_base) - -local p_entity_base = - P("&") * ((1-P(";"))^2) * P(";") -local p_entity = - P("&") * (((1-P(";"))^2) / entities) * P(";") - --- This is (given the large match): --- --- local s = sortedkeys(reserved) --- local p = P(false) --- for i=#s,1,-1 do --- local k = s[i] --- p = p + P(k) --- end --- local p_reserved = p / reserved --- --- twice as slow as: - local k_reserved = sortedkeys(reserved) +local k_commands = { } +local k_unicode = { } asciimath.keys = { reserved = k_reserved @@ -766,26 +744,25 @@ local k_reserved_different = { } local k_reserved_words = { } for k, v in sortedhash(reserved) do - if k ~= v then - k_reserved_different[#k_reserved_different+1] = k + local replacement = v[2] + if v[1] then + k_unicode[k] = replacement + else + if k ~= replacement then + k_reserved_different[#k_reserved_different+1] = k + end end if not find(k,"[^a-zA-Z]") then k_reserved_words[#k_reserved_words+1] = k end + k_commands[k] = replacement end local p_reserved = - lpeg.utfchartabletopattern(k_reserved_different) / reserved - --- local p_text = --- P("text") --- * p_spaces^0 --- * Cc("\\mathoptext") --- * ( -- maybe balanced --- Cs((P("{") ) * (1-P("}"))^0 * P("}") ) --- + Cs((P("(")/"{") * (1-P(")"))^0 * (P(")")/"}")) --- ) --- + Cc("\\mathoptext") * Cs(Cc("{") * patterns.undouble * Cc("}")) + lpeg.utfchartabletopattern(k_reserved_different) / k_commands + +local p_unicode = + lpeg.utfchartabletopattern(table.keys(k_unicode)) / k_unicode local p_text = P("text") @@ -797,91 +774,55 @@ local p_text = ) + Cc("\\asciimathoptext") * Cs(Cc("{") * patterns.undouble * Cc("}")) --- either map to \left or map to \left\name - --- local p_open = S("{[") * P(":") --- local p_close = P(":") * S("]}") - --- local p_open_left = (S("{[") * P(":")) / "\\left." --- local p_close_right = (P(":") * S("]}")) / "\\right." - --- local p_left = --- P("(:") / "\\left\\langle" --- + P("{:") / "\\left." --- + P("[:") / "\\left." --- + P("(") / "\\left\\lparent" --- + P("[") / "\\left\\lbracket" --- + P("{") / "\\left\\lbrace" --- + P("<<") / "\\left\\langle" -- why not <: --- + P("|_") / "\\left\\lfloor" --- + P("|~") / "\\left\\lceil" --- + P("⟨") / "\\left\\langle" --- + P("〈") / "\\left\\langle" --- + P("〈") / "\\left\\langle" - --- local p_right = --- P(")") / "\\right\\rparent" --- + P(":)") / "\\right\\rangle" --- + P(":}") / "\\right." --- + P(":]") / "\\right." --- + P("]") / "\\right\\rbracket" --- + P("}") / "\\right\\rbrace" --- + P(">>") / "\\right\\rangle" -- why not :> --- + P("~|") / "\\right\\rceil" --- + P("_|") / "\\right\\rfloor" --- + P("⟩") / "\\right\\rangle" --- + P("〉") / "\\right\\rangle" --- + P("〉") / "\\right\\rangle" - local m_left = { - ["(:"] = "\\left\\langle", - ["{:"] = "\\left.", - ["[:"] = "\\left.", - ["("] = "\\left\\lparent", - ["["] = "\\left\\lbracket", - ["{"] = "\\left\\lbrace", - ["<<"] = "\\left\\langle", -- why not <: - ["|_"] = "\\left\\lfloor", - ["|~"] = "\\left\\lceil", - ["⟨"] = "\\left\\langle", - ["〈"] = "\\left\\langle", - ["〈"] = "\\left\\langle", + ["(:"] = s_langle, + ["{:"] = s_left, + ["[:"] = s_left, + ["("] = s_lparent, + ["["] = s_lbracket, + ["{"] = s_lbrace, + ["<<"] = s_langle, -- why not <: + ["|_"] = s_lfloor, + ["|~"] = s_lceil, + ["⟨"] = s_langle, + ["〈"] = s_langle, + ["〈"] = s_langle, -- - ["lparent"] = "\\left\\lparent", - ["lbracket"] = "\\left\\lbracket", - ["lbrace"] = "\\left\\lbrace", - ["langle"] = "\\left\\langle", - ["lfloor"] = "\\left\\lfloor", - ["lceil"] = "\\left\\lceil", + ["lparent"] = s_lparent, + ["lbracket"] = s_lbracket, + ["lbrace"] = s_lbrace, + ["langle"] = s_langle, + ["lfloor"] = s_lfloor, + ["lceil"] = s_lceil, } local m_right = { - [")"] = "\\right\\rparent", - [":)"] = "\\right\\rangle", - [":}"] = "\\right.", - [":]"] = "\\right.", - ["]"] = "\\right\\rbracket", - ["}"] = "\\right\\rbrace", - [">>"] = "\\right\\rangle", -- why not :> - ["~|"] = "\\right\\rceil", - ["_|"] = "\\right\\rfloor", - ["⟩"] = "\\right\\rangle", - ["〉"] = "\\right\\rangle", - ["〉"] = "\\right\\rangle", + [")"] = s_rparent, + [":)"] = s_rangle, + [":}"] = s_right, + [":]"] = s_right, + ["]"] = s_rbracket, + ["}"] = s_rbrace, + [">>"] = s_rangle, -- why not :> + ["~|"] = s_rceil, + ["_|"] = s_rfloor, + ["⟩"] = s_rangle, + ["〉"] = s_rangle, + ["〉"] = s_rangle, -- - ["rparent"] = "\\right\\rparent", - ["rbracket"] = "\\right\\rbracket", - ["rbrace"] = "\\right\\rbrace", - ["rangle"] = "\\right\\rangle", - ["rfloor"] = "\\right\\rfloor", - ["rceil"] = "\\right\\rceil", + ["rparent"] = s_rparent, + ["rbracket"] = s_rbracket, + ["rbrace"] = s_rbrace, + ["rangle"] = s_rangle, + ["rfloor"] = s_rfloor, + ["rceil"] = s_rceil, } local islimits = { ["\\sum"] = true, - ["∑"] = true, + -- ["∑"] = true, ["\\prod"] = true, - ["∏"] = true, + -- ["∏"] = true, ["\\lim"] = true, } @@ -898,12 +839,12 @@ local p_right = -- + P("\\ ") * Cc("\\space") -- + P("\\\\") * Cc("\\backslash") -- + P("\\") * (R("az","AZ")^1/entities) --- + P("|") * Cc("\\|") -- "\\middle\\|" -- maybe always add left / right as in mml ? +-- + P("|") * Cc("\\|") -- -- faster bug also uglier: local p_special = - P("|") * Cc("\\|") -- "\\middle\\|" -- maybe always add left / right as in mml ? + P("|") * Cc("\\|") -- s_mbar -- maybe always add left / right as in mml ? + P("\\") * ( ( P(" ") * ( @@ -917,7 +858,14 @@ local p_special = -- open | close :: {: | :} -local parser = Ct { "tokenizer", +local u_parser = Cs ( ( + patterns.doublequoted + + P("text") * p_spaces^0 * P("(") * (1-P(")"))^0 * P(")") + -- -- todo: balanced + p_unicode + + p_utf_base +)^0 ) + +local a_parser = Ct { "tokenizer", tokenizer = ( p_spaces + p_number @@ -977,7 +925,7 @@ local function collapse_matrices(t) end end if valid then - local omit = l1 == "\\left." and r1 == "\\right." + local omit = l1 == s_left and r1 == s_right if omit then t[1] = "\\startmatrix" else @@ -1017,8 +965,8 @@ local function collapse_bars(t) if current == "\\|" then if l then m = m + 1 - t[l] = "\\left\\|" - t[i] = "\\right\\|" + t[l] = s_lbar + t[i] = s_rbar t[m] = { unpack(t,l,i) } l = false else @@ -1031,20 +979,20 @@ local function collapse_bars(t) i = i + 1 end if l then - local tt = { "\\left ." } -- space fools final checker + local tt = { s_lnothing } -- space fools final checker local tm = 1 for i=1,m do tm = tm + 1 tt[tm] = t[i] end tm = tm + 1 - tt[tm] = "\\middle\\|" + tt[tm] = s_mbar for i=l+1,n do tm = tm + 1 tt[tm] = t[i] end tm = tm + 1 - tt[tm] = "\\right ." -- space fools final checker + tt[tm] = s_rnothing -- space fools final checker m = tm t = tt elseif m < n then @@ -1413,8 +1361,8 @@ local function collapse_fractions_2(t) local n, m, i = #t, 0, 1 while i < n do local current = t[i] - if current == "\\slash" and i > 1 then - t[m] = "{\\left." .. t[i-1] .. "\\middle/" .. t[i+1] .. "\\right.}" + if current == "⁄" and i > 1 then -- \slash + t[m] = "{" .. s_left .. t[i-1] .. s_mslash .. t[i+1] .. s_right .. "}" i = i + 2 else m = m + 1 @@ -1436,7 +1384,7 @@ end local function collapse_result(t) local n = #t - if t[1] == "\\left." and t[n] == "\\right." then -- see bar .. space needed there + if t[1] == s_left and t[n] == s_right then -- see bar .. space needed there return concat(t," ",2,n-1) else return concat(t," ") @@ -1482,14 +1430,15 @@ local ctx_type = context and context.type or function() end local ctx_inleft = context and context.inleft or function() end local function convert(str,totex) - local texcode = collapse(lpegmatch(parser,str)) + local unicoded = lpegmatch(u_parser,str) + local texcoded = collapse(lpegmatch(a_parser,unicoded)) if trace_mapping then - show_result(str,texcode) + show_result(str,texcoded) end if totex then - ctx_mathematics(texcode) + ctx_mathematics(texcoded) else - return texcode + return texcoded end end @@ -1497,7 +1446,7 @@ local n = 0 local p = ( (S("{[(") + P("\\left" )) / function() n = n + 1 end + (S("}])") + P("\\right")) / function() n = n - 1 end - + P(1) + + p_utf_base )^0 local function invalidtex(str) @@ -1636,7 +1585,8 @@ local function convert(str) if #str == 1 then ctx_mathematics(str) else - local texcode = collapse(lpegmatch(parser,str)) + local unicode = lpegmatch(u_parser,str) + local texcode = collapse(lpegmatch(a_parser,unicode)) if trace_mapping then show_result(str,texcode) end @@ -1872,102 +1822,3 @@ end function show.save(name) table.save(name ~= "" and name or "dummy.lua",collected) end - --- maybe: - --- \backslash \ --- \times × --- \divide ÷ --- \circ ∘ --- \oplus ⊕ --- \otimes ⊗ --- \sum ∑ --- \prod ∏ --- \wedge ∧ --- \bigwedge ⋀ --- \vee ∨ --- \bigvee ⋁ --- \cup ∪ --- \bigcup ⋃ --- \cap ∩ --- \bigcap ⋂ - --- \ne ≠ --- \le ≤ --- \leq ≤ --- \ge ≥ --- \geq ≥ --- \prec ≺ --- \succ ≻ --- \in ∈ --- \notin ∉ --- \subset ⊂ --- \supset ⊃ --- \subseteq ⊆ --- \supseteq ⊇ --- \equiv ≡ --- \cong ≅ --- \approx ≈ --- \propto ∝ --- --- \neg ¬ --- \implies ⇒ --- \iff ⇔ --- \forall ∀ --- \exists ∃ --- \bot ⊥ --- \top ⊤ --- \vdash ⊢ --- \models ⊨ --- --- \int ∫ --- \oint ∮ --- \partial ∂ --- \nabla ∇ --- \pm ± --- \emptyset ∅ --- \infty ∞ --- \aleph ℵ --- \ldots ... --- \cdots ⋯ --- \quad --- \diamond ⋄ --- \square □ --- \lfloor ⌊ --- \rfloor ⌋ --- \lceiling ⌈ --- \rceiling ⌉ --- --- \sin sin --- \cos cos --- \tan tan --- \csc csc --- \sec sec --- \cot cot --- \sinh sinh --- \cosh cosh --- \tanh tanh --- \log log --- \ln ln --- \det det --- \dim dim --- \lim lim --- \mod mod --- \gcd gcd --- \lcm lcm --- --- \uparrow ↑ --- \downarrow ↓ --- \rightarrow → --- \to → --- \leftarrow ← --- \leftrightarrow ↔ --- \Rightarrow ⇒ --- \Leftarrow ⇐ --- \Leftrightarrow ⇔ --- --- \mathbf --- \mathbb --- \mathcal --- \mathtt --- \mathfrak diff --git a/tex/context/bib/bibl-apa-it.tex b/tex/context/bib/bibl-apa-it.tex new file mode 100644 index 000000000..3892dcb74 --- /dev/null +++ b/tex/context/bib/bibl-apa-it.tex @@ -0,0 +1,386 @@ +%D \module +%D [ file=bibl-apa-it, +%D version=2014.10.10, +%D title=APA bibliography style, +%D subtitle=Publications, +%D author={Andrea Valle \& Alan Braslau}, +%D date=\currentdate, +%D copyright={Public Domain}] +%C +%C Donated to the public domain. Use at your own risk + +\unprotect + +\setupcite + [author,year] + [\c!andtext={ e }, + \c!otherstext={ et al.}, + \c!pubsep={, }, + \c!lastpubsep={ e }, + \c!compress=\v!no, + \c!inbetween={ }, + \c!left={(}, + \c!right={)}] + +\setupcite + [authoryear] + [\c!andtext={ e }, + \c!otherstext={ et al.}, + \c!pubsep={, }, + \c!lastpubsep={ e }, + \c!compress=\v!yes, + \c!inbetween={ }, + \c!left={(}, + \c!right={)}] + +\setupcite + [authoryears] + [\c!andtext={ e }, + \c!otherstext={ et al.}, + \c!pubsep={, }, + \c!lastpubsep={ e }, + \c!compress=\v!yes, + \c!inbetween={, }, + \c!left={(}, + \c!right={)}] + +\setupcite + [key,serial,authornum,page,short,type,doi,url] + [\c!andtext={ e }, + \c!otherstext={ et al.}, + \c!pubsep={, }, + \c!lastpubsep={ e }, + \c!compress=\v!no, + \c!inbetween={ }, + \c!left={[}, + \c!right={]}] + +\setupcite + [num] + [\c!andtext={ e }, + \c!otherstext={ et al.}, + \c!pubsep={, }, + \c!lastpubsep={ e }, + \c!compress=\v!yes, + \c!inbetween={--}, + \c!left={[}, + \c!right={]}] + +\setuppublications + [\c!sorttype=, + \c!criterium=, + \c!refcommand=authoryears, + \c!numbering=\v!no, + \c!autohang=\v!no] + +\setuppublicationlist + [\c!width=24pt, + \c!artauthor=\invertedshortauthor, + \c!editor=\invertedshortauthor, + \c!author=\invertedshortauthor, + \c!namesep={, }, + \c!lastnamesep={ e }, + \c!finalnamesep={ e }, + \c!firstnamesep={, }, + \c!juniorsep={ }, + \c!vonsep={ }, + \c!surnamesep={, }, + \c!authoretallimit=5, + \c!editoretallimit=5, + \c!artauthoretallimit=5, + \c!authoretaldisplay=5, + \c!editoretaldisplay=5, + \c!artauthoretaldisplay=5, + \c!authoretaltext={ et al.}, + \c!editoretaltext={ et al.}, + \c!artauthoretaltext={ et al.}] + +\def\maybeyear#1{#1} +\def\etalchar #1{#1} + +%D \macros{insertchapter,insertpublisher} + +%D Some shortcuts. + +% ((#1(type\ |)chapter#2)|#3) + +\def\insertchap#1#2#3% + {\insertchapter + {#1\insertbibtype{}{\ }{capitolo\ }}{#2}% + {#3}} + +% #1city, country: pubname#2 +% #1country: pubname#2 +% #1pubname#2 +% #1city, country#2 +% #3 + +\def\insertpublisher#1#2#3% + {\insertpubname + {\insertcity + {#1} + {\insertcountry{, }{}{}: }% + {#1\insertcountry{}{: }{}}}% + {#2}% + {\insertcity + {#1} + {\insertcountry{, }{}{#2}}% + {\insertcountry{#1}{#2}{#3}}}% + } + +\def\insertorg#1#2#3% + {\insertorganization + {\insertcity + {#1} + {\insertcountry{, }{}{#2}: }% + {\insertcountry{}{: }{#2}}}% + {}% + {\insertcity + {#1} + {\insertcountry{, }{}{#2}}% + {\insertcountry{}{#2}{#3}}}% + } + + + +\setuppublicationlayout[article]{% + \insertartauthors{}{ }{\insertthekey{}{ }{}}% + \insertpubyear{(}{). }{\unskip.}% + \insertarttitle{\bgroup }{\egroup. }{}% + \insertjournal{\bgroup \it}{\egroup} + {\insertcrossref{In }{}{}}% + \insertvolume + {\bgroup \it, } + {\egroup\insertissue{\/(}{)}{}\insertpages{, }{.}{.}} + {\insertpages{, pp. }{.}{.}}% + \insertnote{ }{.}{}% + \insertcomment{}{.}{}% +} + +\newif\ifeditedbook + +\setuppublicationlayout[book]{% + \insertauthors{}{ }{\inserteditors{}{, A c. di% + \ifnum\getvalue{editor@num}> 1 s\fi + \ \global\editedbooktrue + }{\insertthekey{}{. }{}}}% + \insertpubyear{(}{). }{\unskip.}% + \inserttitle + {\bgroup\it }% + {\/\egroup + \ifeditedbook + \global\editedbookfalse + \insertvolume + { N.~}% + {\insertseries + { in~\bgroup}% + {\egroup. }% + {\insertcrossref{ in~}{}{. }}}% + {\insertseries{ }{.}{.}}% + \else + \insertcrossref + {\insertchap{, }{}{}% + \insertpages{\unskip, pp. }{. }{. }% + \insertvolume{Vol.~}{ of~}{}% + }% + {}% + {\insertvolume + {, vol.~}% + {\insertseries + { of~\bgroup\it}% + {\egroup} + {}} + {}% + \insertchap{, }{}{}% + \insertpages{\unskip, pp. }{.}{.}% + }% + \fi}% + {}% + \insertedition{ }{ ed.}{}% + \insertpublisher{ }{.}{.}% + \insertpages{ }{p. }{ }% + \insertnote{}{.}{}% +} + +\setuppublicationlayout[inbook]{% + \insertauthors{}{ }{\inserteditors{}{, A c. di% + \ \global\editedbooktrue + }{\insertthekey{}{. }{}}}% + \insertpubyear{(}{). }{\unskip.}% + \inserttitle + {\bgroup\it }% + {\/\egroup + \ifeditedbook + \global\editedbookfalse + \insertvolume + { number~}% + {\insertseries + { in~\bgroup}% + {\egroup. }% + {\insertcrossref{ in~}{}{.}}}% + {\insertseries{ }{.}{}}% + \else + \insertcrossref + {\insertchap{, }{}{}% + \insertpages{\unskip, pp. }{. }{. }% + \insertvolume{Volume~}{ of~}{}% + }% + {}% + {\insertvolume + {, volume~}% + {\insertseries + { of~\bgroup\it}% + {\egroup} + {}} + {}% + \insertchap{, }{}{}% + \insertpages{\unskip, pp. }{.}{}% + }% + \fi}% + { }% + \insertedition{ }{ ed.}{}% + \insertpublisher{ }{.}{.}% + \insertnote{ }{.}{}% +} + +\setuppublicationlayout[booklet]{% + \insertauthors{}{ }{\insertthekey{}{. }{}}% + \insertpubyear{(}{). }{}% + \inserttitle{\bgroup }{\egroup \insertseries{ (}{)}{}. }{}% + \insertedition{ }{ ed.}{}% + \insertpublisher{ }{.}{.}% + \insertpages{}{p. }{}% + \insertnote{ }{.}{}% +} + +\setuppublicationlayout[manual]{% + \insertauthors{}{ }{\insertthekey{}{. }{}}% + \insertpubyear{(}{). }{}% + \inserttitle{\bgroup \it }{\/\egroup \insertseries{ (}{)}{}. }{}% + \insertedition{ }{ ed.}{}% + \insertorg{ }{.}{.}% + \insertpages{}{p. }{}% + \insertnote{ }{.}{}% +} + +\setuppublicationlayout[incollection]{% + \insertartauthors{}{ }{\insertthekey{}{. }{}}% + \insertpubyear{(}{). }{}% + \insertarttitle{\bgroup }{\egroup. }{}% + \inserttitle + {In \inserteditors{}% + {, A c. di, }% + {}% + \bgroup\it}% + {\egroup + \insertseries + {\insertvolume{, number }{~in }{ }}% + {}% + {}% + \insertchap{\unskip, }{ }{ }% + \insertpages{\unskip, pp.~}{. }{\unskip. }% + \insertedition{ }{ edition}{}% + \insertpublisher{ }{.}{.}% + }% + {In \insertcrossref{}{}{}% + \insertchap{\unskip, }{ }{ }% + \insertpages{\unskip, pp.~}{. }{\unskip. }% + }% + \insertnote{ }{.}{}% +} + +\setuppublicationlayout[inproceedings]{% + \insertauthors{}{ }{}% + \insertpubyear{(}{). }{}% + \insertarttitle{\bgroup }{\egroup. }{}%% + \inserttitle + {In \inserteditors{}% + {, A c. di, }% + {}% + \bgroup\it}% + {\egroup + \insertseries + {\insertvolume{, number }{~in }{ }}% + {}% + {}% + \insertchap{\unskip, }{ }{ }% + \insertpages{\unskip, pp.~}{}{}% + \insertorg{. }{.}{.}% + }% + {In \insertcrossref{}{}{}% + \insertchap{\unskip, }{ }{ }% + \insertpages{\unskip, pp.~}{. }{\unskip. }% + }% + \insertnote{ }{.}{}% +} + +\setuppublicationlayout[proceedings]{% + \inserteditors{}{, A c. di% + \ \global\editedbooktrue + }{\insertthekey{}{ }{}}% + \insertpubyear{(}{). }{}% + \inserttitle + {\bgroup\it}% + {\egroup + \insertseries + {\insertvolume{, number }{~in }{ }}% + {}% + {}% + \insertchap{\unskip, }{ }{ }% + \insertpages{\unskip, pp.~}{}{}% + \insertorg{. }{.}{.}% + }% + {}% + \insertnote{ }{.}{}% +} + +\setuppublicationlayout[mastersthesis]{% + \insertauthors{}{ }{}% + \insertpubyear{(}{). }{}% + \inserttitle{\bgroup }{\egroup \insertseries{ (}{)}{}. }{}% + \insertbibtype{}{, }{Tesi di laurea, }% + \insertpublisher{ }{.}{.}% + \insertpages{ }{p. }{}% + \insertnote{ }{.}{}% +} + +\setuppublicationlayout[phdthesis]{% + \insertauthors{}{ }{}% + \insertpubyear{(}{). }{}% + \inserttitle{\bgroup\it }{\egroup \insertseries{ (}{)}{}. }{}% + \insertbibtype{}{, }{Tesi di dottorato,}% + \insertpublisher{ }{.}{.}% + \insertpages{ }{ p. }{}% + \insertnote{ }{.}{}% +} + +\setuppublicationlayout[misc]{% + \insertauthors{}{ }{\insertthekey{}{. }{}}% + \insertpubyear{(}{). }{}% + \inserttitle{\bgroup }{\egroup \insertseries{ (}{)}. }{}% + \insertpublisher{ }{.}{.}% + \insertpages{ }{p. }{}% + \insertnote{ }{.}{}% +} + +\setuppublicationlayout[techreport]{% + \insertauthors{}{ }{}% + \insertpubyear{(}{). }{}% + \inserttitle{\bgroup }{\egroup \insertseries{ (}{)}{}. }{}% + \insertbibtype{}{\insertvolume{ }{, }{, }}{Relazione tecnica}% + \insertpublisher{ }{.}{.}% + \insertpages{ }{p. }{}% + \insertnote{ }{.}{}% +} + +\setuppublicationlayout[unpublished]{% + \insertauthors{}{ }{}% + \insertpubyear{(}{). }{}% + \inserttitle{\bgroup }{\egroup \insertseries{ (}{)}{}. }{}% + % \insertpublisher{ }{.}{.}% + \insertpages{ }{p. }{}% + \insertbibtype{(}{)}{}% + \insertnote{ }{.}{}% +} + +\protect diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 14f00406c..818293e36 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 : 10/09/14 15:22:01 +-- merge date : 10/14/14 10:56:50 do -- begin closure to overcome local limits and interference @@ -3947,7 +3947,8 @@ constructors.autocleanup=true constructors.namemode="fullpath" constructors.version=1.01 constructors.cache=containers.define("fonts","constructors",constructors.version,false) -constructors.privateoffset=0xF0000 +constructors.privateoffset=0xF0000 +constructors.cacheintex=true constructors.keys={ properties={ encodingbytes="number", @@ -4226,6 +4227,7 @@ function constructors.scale(tfmdata,specification) target.tounicode=1 target.cidinfo=properties.cidinfo target.format=properties.format + target.cache=constructors.cacheintex and "yes" or "renew" local fontname=properties.fontname or tfmdata.fontname local fullname=properties.fullname or tfmdata.fullname local filename=properties.filename or tfmdata.filename @@ -4663,6 +4665,7 @@ function constructors.finalize(tfmdata) tfmdata.extend=nil tfmdata.slant=nil tfmdata.units_per_em=nil + tfmdata.cache=nil properties.finalized=true return tfmdata end -- cgit v1.2.3