diff options
Diffstat (limited to 'tex')
41 files changed, 616 insertions, 291 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index f30ca0714..24441710a 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.08.29 19:35} +\newcontextversion{2017.09.05 15:10} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 4c48a7ce1..f93bb1e35 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2017.08.29 19:35} +\edef\contextversion{2017.09.05 15:10} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-cs.mkii b/tex/context/base/mkii/mult-cs.mkii index 423d47e26..b57c8ece5 100644 --- a/tex/context/base/mkii/mult-cs.mkii +++ b/tex/context/base/mkii/mult-cs.mkii @@ -753,6 +753,7 @@ \setinterfaceconstant{direction}{smer} \setinterfaceconstant{directory}{adresar} \setinterfaceconstant{display}{obrazovka} +\setinterfaceconstant{displaythreshold}{displaythreshold} \setinterfaceconstant{distance}{vzdalenost} \setinterfaceconstant{domain}{domain} \setinterfaceconstant{dot}{tecka} @@ -862,6 +863,7 @@ \setinterfaceconstant{index}{index} \setinterfaceconstant{indicator}{indikator} \setinterfaceconstant{initialsep}{initialsep} +\setinterfaceconstant{inlinethreshold}{inlinethreshold} \setinterfaceconstant{inner}{vnitrni} \setinterfaceconstant{innermargin}{innermargin} \setinterfaceconstant{inputfile}{inputfile} diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index 8210a2a20..98e28eca1 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -1172,6 +1172,7 @@ do mfrac = true, mroot = true, msqrt = true, + mtable = true, mi = true, mo = true, mn = true, @@ -1206,14 +1207,14 @@ do -- sub.__o__, sup.__o__ = subscript, superscript sub.__i__, sup.__i__ = superscript, subscript end --- elseif roottg == "msup" or roottg == "msub" then --- -- m$^2$ --- if ndata == 1 then --- local d = data[1] --- data[2] = d --- d.__i__ = 2 --- data[1] = dummy_nucleus --- end + -- elseif roottg == "msup" or roottg == "msub" then + -- -- m$^2$ + -- if ndata == 1 then + -- local d = data[1] + -- data[2] = d + -- d.__i__ = 2 + -- data[1] = dummy_nucleus + -- end elseif roottg == "mfenced" then local s = specifications[root.fulltag] local l, m, r = s.left, s.middle, s.right @@ -1240,15 +1241,21 @@ do return elseif ndata == 1 then local d = data[1] - if not d then - return - elseif d.content then + if not d or d == "" or d.content then return - elseif #root.data == 1 then + else -- if ndata == 1 then local tg = d.tg if automathrows and roottg == "mrow" then -- maybe just always ! check spec first if no_mrow[tg] then +-- local r = root.__p__ +-- while r do +-- if r.data[1].tg == "mrow" then +-- r.data[1].skip = "comment" +-- r.skip = "comment" +-- end +-- break +-- end root.skip = "comment" end elseif roottg == "mo" then @@ -1417,8 +1424,10 @@ do } elseif di.tg == "math" then local di = di.data[1] - data[i] = di - checkmath(di) + if di then + data[i] = di + checkmath(di) + end end end di.element = "mrow" @@ -1578,7 +1587,6 @@ do if #data > 0 then return di end --- end end -- could be integrated but is messy then -- while roottg == "mrow" and #data == 1 do @@ -1771,7 +1779,7 @@ do end function structurestags.settablecell(rows,columns,align) - if align > 0 or rows > 1 or columns > 1 or kind > 0 then + if align > 0 or rows > 1 or columns > 1 then -- or kind > 0 tabledata[locatedtag("tablecell")] = { rows = rows, columns = columns, diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 7574ee83e..cb106828b 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.08.29 19:35} +\newcontextversion{2017.09.05 15:10} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 9c6ed8e91..ac617fc5b 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.08.29 19:35} +\edef\contextversion{2017.09.05 15:10} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-fea.mkvi b/tex/context/base/mkiv/font-fea.mkvi index 840b64e9c..5f65543ab 100644 --- a/tex/context/base/mkiv/font-fea.mkvi +++ b/tex/context/base/mkiv/font-fea.mkvi @@ -139,6 +139,10 @@ \attribute\zerocount\zerocount % first in list, so fast match +\prependtoks + \attribute\zerocount\attributeunsetvalue % new per 2017-08-30 +\to \t_attr_list_local + % beware: these are global features on top of existing font features \let\currentfeature \s!current diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua index 1d6ef1f31..6d2b99871 100644 --- a/tex/context/base/mkiv/font-mis.lua +++ b/tex/context/base/mkiv/font-mis.lua @@ -21,7 +21,7 @@ local readers = otf.readers if readers then - otf.version = otf.version or 3.102 + otf.version = otf.version or 3.103 otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true) function fonts.helpers.getfeatures(name,save) diff --git a/tex/context/base/mkiv/font-one.lua b/tex/context/base/mkiv/font-one.lua index 63ed610ed..1b5bebb82 100644 --- a/tex/context/base/mkiv/font-one.lua +++ b/tex/context/base/mkiv/font-one.lua @@ -28,6 +28,7 @@ local abs = math.abs local bxor, rshift = bit32.bxor, bit32.rshift local P, S, R, Cmt, C, Ct, Cs, Carg = lpeg.P, lpeg.S, lpeg.R, lpeg.Cmt, lpeg.C, lpeg.Ct, lpeg.Cs, lpeg.Carg local lpegmatch, patterns = lpeg.match, lpeg.patterns +local sortedhash = table.sortedhash local trace_features = false trackers.register("afm.features", function(v) trace_features = v end) local trace_indexing = false trackers.register("afm.indexing", function(v) trace_indexing = v end) @@ -60,7 +61,7 @@ local registerafmfeature = afmfeatures.register local afmenhancers = constructors.enhancers.afm local registerafmenhancer = afmenhancers.register -afm.version = 1.512 -- incrementing this number one up will force a re-cache +afm.version = 1.513 -- incrementing this number one up will force a re-cache afm.cache = containers.define("fonts", "one", afm.version, true) afm.autoprefixed = true -- this will become false some day (catches texnansi-blabla.*) @@ -143,7 +144,7 @@ local function enhance_unify_names(data, filename) local names = { } local private = data.private or privateoffset local descriptions = data.descriptions - for name, blob in next, data.characters do + for name, blob in sortedhash(data.characters) do -- sorting is nicer for privates local code = unicodevector[name] -- or characters.name_to_unicode[name] if not code then code = lpegmatch(uparser,name) diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index 6f71f837f..a71e3ad98 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.102 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.103 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) otf.svgcache = containers.define("fonts", "svg", otf.version, true) otf.sbixcache = containers.define("fonts", "sbix", otf.version, true) diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 6a893a67d..031cf3baa 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -2381,6 +2381,8 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s startnext = getboth(start) local done -- = false + -- hm, contexts can also be nested + for k=1,contexts.n do -- or #contexts do local current = start local last = start @@ -2799,7 +2801,13 @@ local function chained_contextchain(head,start,stop,dataset,sequence,currentlook if nofsteps > 1 then reportmoresteps(dataset,sequence) end - return handle_contextchain(head,start,dataset,sequence,currentlookup,rlmode,skiphash) + -- probably wrong + local l = steps[1].coverage[getchar(start)] + if l then + return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + else + return head, start, false + end end chainprocs.gsub_context = chained_contextchain diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua index 0ebd88c32..da9ed1a77 100644 --- a/tex/context/base/mkiv/font-oup.lua +++ b/tex/context/base/mkiv/font-oup.lua @@ -2675,7 +2675,7 @@ function readers.expand(data) end local rules = step.rules if rules then - local rulehash = { } + local rulehash = { n = 0 } local rulesize = 0 local coverage = { } local lookuptype = sequence.type @@ -2747,8 +2747,8 @@ function readers.expand(data) -- we can have a problem end end + rulehash.n = rulesize -- tiny speedup end - rulehash.n = #rulehash -- tiny speedup end end end diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv index 91906b454..b754714eb 100644 --- a/tex/context/base/mkiv/font-pre.mkiv +++ b/tex/context/base/mkiv/font-pre.mkiv @@ -307,7 +307,8 @@ \fi \ifdefined\mathitalicsmode - \mathitalicsmode\plusone % experiment + \mathitalicsmode\plusone % simple noads become zero + % \mathitalicsmode\plustwo % idem but inner is kept (for testing) \fi % \adaptfontfeature[*math*][mathnolimitsmode=1000] % only subscript diff --git a/tex/context/base/mkiv/lang-url.lua b/tex/context/base/mkiv/lang-url.lua index b682c008d..24a5b9863 100644 --- a/tex/context/base/mkiv/lang-url.lua +++ b/tex/context/base/mkiv/lang-url.lua @@ -187,14 +187,15 @@ local function action(hyphenatedurl,str,left,right,disc) word = letter end end - what = "\\" .. what .. "{" .. utfbyte(char) .. "}" if dodi then - list[i] = "\\d" .. what + list[i] = "\\d" else - list[i] = what + list[i] = "\\" .. what .. "{" .. utfbyte(char) .. "}" end end - context(concat(list)) + list = concat(list) + print(list) + context(list) end -- urls.action = function(_,...) action(...) end -- sort of obsolete diff --git a/tex/context/base/mkiv/math-ali.mkiv b/tex/context/base/mkiv/math-ali.mkiv index a7dfa8815..81ec511e6 100644 --- a/tex/context/base/mkiv/math-ali.mkiv +++ b/tex/context/base/mkiv/math-ali.mkiv @@ -15,19 +15,23 @@ \unprotect -%D The code here has been moved from other files. Beware: the \MKII\ and -%D \MKIV\ code is not gathered in files with the same name. In the -%D meantime this code has been adapted to \MKIV\ but mnore is possible. +%D The code here has been moved from other files. Beware: the \MKII\ and \MKIV\ code +%D is not gathered in files with the same name. In the meantime this code has been +%D adapted to \MKIV\ but more is possible. The code is somewhat complicated by the +%D fact that alignments are tricky with rspect to tagging. + +% export: +% +% alignment : ok +% cases : +% matrix : ok +% substack : %D \macros %D {definemathalignment, setupmathalignment, startmathalignment} %D -%D Modules may provide additional alignment features. The following -%D mechanisms are provided by the core. - -% why all these spans - -% n>1 ### needed, strange # interaction in recurse +%D Modules may provide additional alignment features. The following mechanisms are +%D provided by the core. \newtoks\t_math_align_a \newtoks\t_math_align_b @@ -35,9 +39,6 @@ \newskip\d_math_eqalign_distance -% \unexpanded\def\math_eqalign_distance -% {\tabskip\d_math_eqalign_distance} - \unexpanded\def\math_eqalign_distance {\relax \ifdim\d_math_eqalign_distance>\zeropoint @@ -51,33 +52,36 @@ % \def\math_build_eqalign % {\scratchtoks\emptytoks % \d_math_eqalign_distance\mathalignmentparameter\c!distance -% \dorecurse{\mathalignmentparameter\c!m}\math_build_eqalign_step -% \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_c}}} - -% \unexpanded\def\math_build_eqalign_step % make sure no expansion in tracing -% {\ifnum\recurselevel>\plusone -% \scratchtoks\expandafter{\the\scratchtoks\math_eqalign_distance\aligntab\tabskip\zeropoint}% -% \fi +% \scratchcounterone\mathalignmentparameter\c!m +% \scratchcountertwo\mathalignmentparameter\c!n % \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_a}}% -% \dorecurse{\numexpr\mathalignmentparameter\c!n-\plusone\relax} -% {\normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_b}}}} +% \scratchcounter\plusone +% \dorecurse{\numexpr\scratchcounterone*\scratchcountertwo-\plusone\relax} +% {\ifnum\scratchcounter=\scratchcountertwo +% \scratchcounter\plusone +% \scratchtoks\expandafter{\the\scratchtoks\math_eqalign_distance}% +% \else +% \advance\scratchcounter\plusone +% \fi +% \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_b}}}% +% \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_c}}} \def\math_build_eqalign {\scratchtoks\emptytoks \d_math_eqalign_distance\mathalignmentparameter\c!distance \scratchcounterone\mathalignmentparameter\c!m \scratchcountertwo\mathalignmentparameter\c!n - \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_a}}% + \etoksapp\scratchtoks{\the\t_math_align_a}% \scratchcounter\plusone \dorecurse{\numexpr\scratchcounterone*\scratchcountertwo-\plusone\relax} {\ifnum\scratchcounter=\scratchcountertwo \scratchcounter\plusone - \scratchtoks\expandafter{\the\scratchtoks\math_eqalign_distance}% + \etoksapp\scratchtoks{\math_eqalign_distance}% \else \advance\scratchcounter\plusone \fi - \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_b}}}% - \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_c}}} + \etoksapp\scratchtoks{\the\t_math_align_b}}% + \etoksapp\scratchtoks{\the\t_math_align_c}} \def\math_math_in_eqalign#1% {\startforceddisplaymath @@ -232,21 +236,6 @@ \math_halign_checked\expandafter\bgroup\the\scratchtoks\crcr#2\crcr\egroup \math_finish_eqalign_no} -% \def\math_both_eqalign_no_aligned#1% -% {\ifmmode -% \the\mathdisplayaligntweaks -% \global\mathnumberstatus\plusone -% \ifcase\mathraggedstatus -% \def\math_finish_eqalign_no{\crcr\egroup}% -% \else -% % we're in a mathbox -% \vcenter\bgroup -% \def\math_finish_eqalign_no{\crcr\egroup\egroup}% -% \fi -% \fi -% #1% -% \math_halign_checked\expandafter\bgroup\the\scratchtoks\crcr} - \installcorenamespace {mathalignlocation} \setvalue{\??mathalignlocation\v!top }{\let\math_alignment_halign_method\halign\tpack} @@ -510,9 +499,13 @@ \fi \fi} +% \def\math_eqalign_set_column#1% we could just add to the preamble (as with other alignments) +% {\expandafter\let\csname\??mathalignmentvariant\number\c_math_eqalign_column\expandafter\endcsname +% \csname\??mathalignmentvariant\ifcsname\??mathalignmentvariant#1\endcsname#1\else\v!normal\fi\endcsname} + \def\math_eqalign_set_column#1% we could just add to the preamble (as with other alignments) - {\expandafter\let\csname\??mathalignmentvariant\number\c_math_eqalign_column\expandafter\endcsname - \csname\??mathalignmentvariant\ifcsname\??mathalignmentvariant#1\endcsname#1\else\v!normal\fi\endcsname} + {\expandafter\chardef\csname\??mathalignmentvariant\number\c_math_eqalign_column\expandafter\expandafter\expandafter\endcsname + \ifcsname\??mathalignmentvariant#1\endcsname\lastnamedcs\else\zerocount\fi\relax} \letvalue{\??mathalignmentvariant\v!normal}\zerocount \letvalue{\??mathalignmentvariant\v!left }\plusone @@ -801,7 +794,9 @@ %D \macros %D {definemathmatrix, setupmathmatrix, startmathmatrix} %D -%D Yet another one \unknown +%D Yet another one \unknown. This time we implement the lot a bit +%D different which is a side effect of getting the tagging right. In +%D retrospect the main alignment could be done this way but \unknown \installcorenamespace{mathmatrix} @@ -818,82 +813,153 @@ \setvalue {\e!stop \currentmathmatrix}{\math_matrix_stop}% no u else lookahead problem \to \everydefinemathmatrix -\let\math_matrix_NC\relax +\def\math_matrix_start_table + {\global\c_math_eqalign_column\zerocount + \dostarttagged\t!math\empty + \dostarttagged\t!mathtable\empty} -\unexpanded\def\math_matrix_start#1% - {\pushmacro\math_matrix_NC % not tested that well - \begingroup - \edef\currentmathmatrix{#1}% - \dosingleempty\math_matrix_start_indeed} +\def\math_matrix_stop_table + {\dostoptagged + \dostoptagged} -\unexpanded\def\math_matrix_start_indeed[#1]% - {\iffirstargument - \setupcurrentmathmatrix[#1]% +\def\math_matrix_start_row + {\noalign{\global\c_math_eqalign_column\zerocount}% + \dostarttagged\t!mathtablerow\empty} + +\def\math_matrix_stop_row + {\dostoptagged} + +\unexpanded\def\math_matrix_start_cell + {\dostarttagged\t!mathtablecell\empty + \math_left_of_equalign + \startimath + \math_matrix_set_style + \tabskip\zeropoint + \everycr\emptytoks} + +\unexpanded\def\math_matrix_stop_cell + {\stopimath + \math_right_of_eqalign + \dostoptagged} + +% We could construct a preamble with alignment and such embedded but the number +% of matrices with many rows is normally so low that it doesn't pay of at all. + +\unexpanded\def\math_matrix_distance + {\relax + \ifdim\d_math_eqalign_distance>\zeropoint + \hskip\d_math_eqalign_distance \fi - % \emptyhbox % noted at 25-05-2014: what was that one doing here? it messed up spacing - \math_matrix_align_method_analyze + \relax} + +\def\math_matrix_preamble + {\math_matrix_strut + \global\advance\c_math_eqalign_column\plusone + \math_matrix_start_cell + \alignmark\alignmark + \math_matrix_stop_cell + \aligntab + \aligntab + \math_matrix_distance + \global\advance\c_math_eqalign_column\plusone + \math_matrix_start_cell + \alignmark\alignmark + \math_matrix_stop_cell} + +\def\math_matrix_make_pickup + {\gdef\NC{\gdef\NC{\aligntab}}} + +% \def\math_matrix_stop_wrapup +% {\crcr +% \strut +% \crcr +% \noalign{\vskip-\struthtdp}} + +\def\math_matrix_start_processing + {\dontleavehmode + \bgroup + \tabskip\zeropoint + \math_matrix_make_pickup + \def\NR{% + \aligntab\omit + \math_matrix_stop_row + \math_matrix_make_pickup + \crcr + \math_matrix_start_row + }% + % + \let\endmath\relax + \def\MC{\NC}% + % \mathmatrixleft - % new per 13-10-2014 - \edef\p_strut{\mathmatrixparameter\c!strut}% + \mathmatrixbox \bgroup + \math_matrix_start_table + \halign \bgroup + % preamble + \span\math_matrix_preamble + % done + \crcr + \math_matrix_start_row} + +\def\math_matrix_stop_processing + {%\math_matrix_stop_wrapup % optional + \math_matrix_stop_row + \egroup + \math_matrix_stop_table + \egroup + \mathmatrixright + \egroup} + +\let\math_matrix_strut \strut +\let\math_matrix_set_style\relax + +\def\math_matrix_check_settings + {\edef\p_strut{\mathmatrixparameter\c!strut}% \ifx\p_strut\v!no - \let\m_matrix_strut\relax + \let\math_matrix_strut\relax \else - \let\m_matrix_strut\strut + \let\math_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\m_matrix_strut \crcr}% - \normalbaselines + \d_math_eqalign_distance\mathmatrixparameter\c!distance\relax + \edef\math_matrix_set_style{\mathmatrixparameter\c!style}} + +\def\math_matrix_set_defaults + {\normalbaselines % hm, spacing ? \mathsurround\zeropoint - \everycr\emptytoks - \tabskip\zeropoint - \c_math_eqalign_column\zerocount - \processcommacommand - [\mathmatrixparameter\c!align] - {\advance\c_math_eqalign_column\plusone\math_eqalign_set_column}% - \scratchcounter\ifnum\c_math_eqalign_column>\zerocount \c_math_eqalign_column \else \plusone \fi - \global\c_math_eqalign_column\plusone - \math_matrix_prepare} + \tabskip\zeropoint} -\def\math_matrix_stop - {\crcr - \mathstrut\crcr - \noalign{\vskip-\baselineskip}% - \egroup - \egroup - \mathmatrixright - \endgroup - \popmacro\math_matrix_NC} % not tested that well +\def\math_matrix_set_columns_step + {\advance\c_math_eqalign_column\plusone + %\c_math_matrix_columns\c_math_eqalign_column + \math_eqalign_set_column} -\definemathmatrix[matrix] -\definemathmatrix[\v!mathmatrix] +\def\math_matrix_set_columns + {\c_math_eqalign_column\zerocount + \rawprocesscommacommand[\mathmatrixparameter\c!align]\math_matrix_set_columns_step} + +\unexpanded\def\math_matrix_start#1% + {\pushmacro\NC % not tested that well + \begingroup + \edef\currentmathmatrix{#1}% + \dosingleempty\math_matrix_start_indeed} -\def\math_matrix_prepare - {\t_math_align_a{\strut\math_first_in_eqalign\math_left_of_equalign\span - \math_text_in_eqalign{\mathmatrixparameter\c!style\alignmark\alignmark}\math_right_of_eqalign}% - \t_math_align_b{\aligntab\hskip\mathmatrixparameter\c!distance - \math_next_in_eqalign\math_left_of_equalign\span - \math_text_in_eqalign{\mathmatrixparameter\c!style\alignmark\alignmark}\math_right_of_eqalign}% - \t_math_align_c{\aligntab\aligntab\hskip\mathmatrixparameter\c!distance - \math_left_of_equalign\span - \math_text_in_eqalign{\mathmatrixparameter\c!style\alignmark\alignmark}\math_right_of_eqalign}% - \scratchtoks\emptytoks - \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_a}}% - \dorecurse{\numexpr\scratchcounter-\plusone\relax} - {\normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_b}}}% - \normalexpanded{\scratchtoks{\the\scratchtoks\the\t_math_align_c}}% - \halign \expandafter \bgroup\the\scratchtoks \crcr} - -\unexpanded\def\math_matrix_NC_indeed - {\gdef\math_matrix_NC{\endmath\aligntab}} +\unexpanded\def\math_matrix_start_indeed[#1]% + {\iffirstargument + \setupcurrentmathmatrix[#1]% + \fi + \math_matrix_check_settings + \math_matrix_align_method_analyze + \math_matrix_set_defaults + \math_matrix_set_columns + \math_matrix_start_processing} + +\def\math_matrix_stop + {\math_matrix_stop_processing + \endgroup + \popmacro\NC} \installcorenamespace{mathmatrixalignmethod} @@ -904,6 +970,7 @@ {\dowithnextbox {\scratchdimen\dimexpr(\nextboxdp-\nextboxht)/2 \ifcase#2\or+\mathaxisheight\textfont2\fi\relax \ifcase#1\relax\or\lower\scratchdimen\or\or\raise\scratchdimen\fi\hbox\bgroup + \forgettagging % otherwise dummy mrows and such \normalstartimath \mathmatrixparameter\c!left \vcenter{\unvbox\nextbox}% @@ -915,19 +982,33 @@ \unexpanded\def\installmathmatrixalignmethod#1#2% {\setvalue{\??mathmatrixalignmethod#1}{#2}} +\def\math_matrix_box_normal{\math_matrix_process\plustwo\zerocount} + +\let\mathmatrixbox\math_matrix_box_normal + +% \def\math_matrix_align_method_analyze +% {\csname\??mathmatrixalignmethod\ifcsname\??mathmatrixalignmethod\mathmatrixparameter\c!location\endcsname +% \mathmatrixparameter\c!location +% \else +% \v!normal +% \fi\endcsname} + \def\math_matrix_align_method_analyze - {\csname\??mathmatrixalignmethod\ifcsname\??mathmatrixalignmethod\mathmatrixparameter\c!location\endcsname - \mathmatrixparameter\c!location + {\ifcsname\??mathmatrixalignmethod\mathmatrixparameter\c!location\endcsname + \lastnamedcs \else - \v!normal - \fi\endcsname} + \let\mathmatrixbox\math_matrix_box_normal + \fi} \installmathmatrixalignmethod\v!top {\def\mathmatrixbox{\math_matrix_process\plusthree\plusone }} \installmathmatrixalignmethod\v!high {\def\mathmatrixbox{\math_matrix_process\plusthree\zerocount}} \installmathmatrixalignmethod\v!lohi {\def\mathmatrixbox{\math_matrix_process\plustwo \zerocount}} \installmathmatrixalignmethod\v!low {\def\mathmatrixbox{\math_matrix_process\plusone \zerocount}} \installmathmatrixalignmethod\v!bottom{\def\mathmatrixbox{\math_matrix_process\plusone \plusone }} -\installmathmatrixalignmethod\v!normal{\def\mathmatrixbox{\math_matrix_process\plustwo \zerocount}} % lohi +\installmathmatrixalignmethod\v!normal{\let\mathmatrixbox \math_matrix_box_normal} % lohi + +\definemathmatrix[matrix] +\definemathmatrix[\v!mathmatrix] %D \startbuffer %D \placeformula \startformula[-] \startmatrix diff --git a/tex/context/base/mkiv/math-fen.mkiv b/tex/context/base/mkiv/math-fen.mkiv index 320dffeb8..f65766a85 100644 --- a/tex/context/base/mkiv/math-fen.mkiv +++ b/tex/context/base/mkiv/math-fen.mkiv @@ -38,7 +38,8 @@ \let\setupmathfences\setupmathfence \setupmathfences - [\c!left=, + [\c!method=, + \c!left=, \c!right=, \c!middle=, \c!mathstyle=, @@ -771,14 +772,14 @@ \unexpanded\def\stopcheckedfences {\endgroup} -\appendtoks +% \appendtoks % maybe: safeguard against overloading % % \let\left \math_fences_used_left % \let\right \math_fences_used_right % \let\middle \math_fences_used_middle % \let\leftorright\math_fences_used_both -\to \everymathematics +% \to \everymathematics \appendtoks \ifx\currentmathfence\empty @@ -786,6 +787,15 @@ \fi \to \everysetupmathfence +\unexpanded\def\enableautofencemode {\mathdelimitersmode\plusseven} +\unexpanded\def\disableautofencemode{\mathdelimitersmode\zerocount} + +\appendtoks + \ifx\currentmathfence\empty + \doifelse{\mathfenceparameter\c!method}\v!auto\enableautofencemode\disableautofencemode + \fi +\to \everysetupmathfence + % some day default: \setupmathfences[\c!state=\v!auto] %D The next characters were used for constructing nicer extensibles but diff --git a/tex/context/base/mkiv/math-frc.mkiv b/tex/context/base/mkiv/math-frc.mkiv index 762fc8d23..b1efb7703 100644 --- a/tex/context/base/mkiv/math-frc.mkiv +++ b/tex/context/base/mkiv/math-frc.mkiv @@ -195,6 +195,11 @@ {\begingroup \edef\currentmathfraction{#1}% % + \edef\p_math_fraction_fences{\mathfractionparameter\c!fences}% + \ifx\p_math_fraction_fences\empty \else + \math_fenced_fenced_start\p_math_fraction_fences + \fi + % \d_math_fraction_margin\mathfractionparameter\c!margin % \edef\p_math_fractions_color{\mathfractionparameter\c!color}% @@ -212,6 +217,12 @@ \expandafter\math_frac_colored \fi} +\unexpanded\def\math_frac_wrapup + {\ifx\p_math_fraction_fences\empty \else + \math_fenced_fenced_stop\p_math_fraction_fences + \fi + \endgroup} + \unexpanded\def\math_frac_colored#1#2% {\savecolor \colo_helpers_activate\p_math_fractions_color @@ -222,11 +233,18 @@ % we use utfchar anyway so we can as well do all at the lua end +\def\math_frac_no_delim{0x2E} + \def\math_frac_command {\clf_mathfraction {\mathfractionparameter\c!rule}% - \mathfractionparameter\c!left\space - \mathfractionparameter\c!right\space + \ifx\p_math_fraction_fences\empty + \mathfractionparameter\c!left \space + \mathfractionparameter\c!right\space + \else + \math_frac_no_delim\space + \math_frac_no_delim\space + \fi \dimexpr\mathfractionparameter\c!rulethickness\relax \relax} @@ -267,7 +285,8 @@ \math_frac_command {\usemathstyleparameter\mathfractionparameter{\m_fractions_strut_bot#2}}% }% - }\endgroup} + }% + \math_frac_wrapup} \def\math_fraction_outer_normal#1#2% {\Ustack{% @@ -277,7 +296,8 @@ \math_frac_command {\m_fractions_strut_bot#2}% }% - }\endgroup} + }% + \math_frac_wrapup} \def\math_fraction_both_normal#1#2% {\Ustack{% @@ -287,7 +307,8 @@ \math_frac_command {\usemathstyleparameter\mathfractionparameter\m_fractions_strut_bot#2}% }% - }\endgroup} + }% + \math_frac_wrapup} \def\math_fraction_inner_margin#1#2% {\Ustack{% @@ -300,7 +321,8 @@ \usemathstyleparameter\mathfractionparameter{\m_fractions_strut_bot#2}% \kern\d_math_fraction_margin}% }% - }\endgroup} + }% + \math_frac_wrapup} \def\math_fraction_outer_margin#1#2% {\Ustack{% @@ -314,7 +336,8 @@ \m_fractions_strut_bot#2% \kern\d_math_fraction_margin}% }% - }\endgroup} + }% + \math_frac_wrapup} \def\math_fraction_both_margin#1#2% {\Ustack{% @@ -328,7 +351,8 @@ \usemathstyleparameter\mathfractionparameter\m_fractions_strut_bot#2% \kern\d_math_fraction_margin}% }% - }\endgroup} + }% + \math_frac_wrapup} \definemathfraction[xfrac] [\c!alternative=\v!inner,\c!mathstyle=\s!script] \definemathfraction[xxfrac][\c!alternative=\v!inner,\c!mathstyle=\s!scriptscript] @@ -371,6 +395,47 @@ \fi \to \everymathematics +% theshold is new! + +\let\math_fraction_set_threshold_inline \relax +\let\math_fraction_set_threshold_display\relax + +\appendtoks + \math_fraction_set_threshold_inline + \math_fraction_set_threshold_display +\to \everymathematics + +\appendtoks + \ifx\currentmathfraction\empty + \edef\p_threshold{\mathfractionparameter\c!inlinethreshold}% + \ifx\p_threshold\empty + \let\math_fraction_set_threshold_inline\relax + \else\ifx\p_threshold\v!auto + \let\math_fraction_set_threshold_inline\relax + \else + \let\math_fraction_set_threshold_inline\math_fraction_set_theshold_inline + \fi\fi + \edef\p_threshold{\mathfractionparameter\c!displaythreshold}% + \ifx\p_threshold\empty + \let\math_fraction_set_threshold_display\relax + \else\ifx\p_threshold\v!auto + \let\math_fraction_set_threshold_display\relax + \else + \let\math_fraction_set_threshold_display\math_fraction_set_theshold_display + \fi\fi + \fi +\to \everysetupmathfraction + +\def\math_fraction_set_theshold_inline + {\edef\p_threshold{\mathfractionparameter\c!inlinethreshold}% + \Umathfractiondelsize\textstyle \p_threshold\dimexpr\textface\relax + \Umathfractiondelsize\scriptstyle \p_threshold\dimexpr\scriptface\relax + \Umathfractiondelsize\scriptscriptstyle\p_threshold\dimexpr\scriptscriptface\relax} + +\def\math_fraction_set_theshold_display + {\edef\p_threshold{\mathfractionparameter\c!displaythreshold}% + \Umathfractiondelsize\displaystyle \p_threshold\dimexpr\textface\relax} + %D \macros %D {dfrac, tfrac, frac, dbinom, tbinom, binom} %D @@ -452,9 +517,23 @@ % \unexpanded\def\dbinom#1#2{{\displaystyle{{#1}\normalabovewithdelims()\zeropoint{#2}}}} % \unexpanded\def\tbinom#1#2{{\textstyle {{#1}\normalabovewithdelims()\zeropoint{#2}}}} -\definemathfraction[binom] [\c!alternative=\v!outer,\c!rule=\v!no,\c!left=0x28,\c!right=0x29,\c!mathstyle=\s!auto] -\definemathfraction[dbinom][\c!alternative=\v!outer,\c!rule=\v!no,\c!left=0x28,\c!right=0x29,\c!mathstyle=\s!display] -\definemathfraction[tbinom][\c!alternative=\v!outer,\c!rule=\v!no,\c!left=0x28,\c!right=0x29,\c!mathstyle=\s!text] +\definemathfraction + [binom] + [\c!alternative=\v!outer, + \c!rule=\v!no, + \c!left=0x28, + \c!right=0x29, + \c!mathstyle=\s!auto] + +\definemathfraction + [dbinom] + [binom] + [\c!mathstyle=\s!display] + +\definemathfraction + [tbinom] + [binom] + [\c!mathstyle=\s!text] %D \macros %D {cfrac} diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua index 532e293b9..6e0324256 100644 --- a/tex/context/base/mkiv/math-noa.lua +++ b/tex/context/base/mkiv/math-noa.lua @@ -47,6 +47,8 @@ local registerdirective = directives.register local logreporter = logs.reporter local setmetatableindex = table.setmetatableindex +local colortracers = nodes.tracers.colors + local trace_remapping = false registertracker("math.remapping", function(v) trace_remapping = v end) local trace_processing = false registertracker("math.processing", function(v) trace_processing = v end) local trace_analyzing = false registertracker("math.analyzing", function(v) trace_analyzing = v end) @@ -547,7 +549,7 @@ do local remapalphabets = mathematics.remapalphabets local fallbackstyleattr = mathematics.fallbackstyleattr - local setnodecolor = nodes.tracers.colors.set + local setnodecolor = colortracers.set local function report_remap(tag,id,old,new,extra) report_remapping("remapping %s in font (%s,%s) from %C to %C%s", @@ -1289,8 +1291,8 @@ do local italics = { } local default_factor = 1/20 - local setcolor = nodes.tracers.colors.set - local resetcolor = nodes.tracers.colors.reset + local setcolor = colortracers.set + local resetcolor = colortracers.reset local italic_kern = new_kern local c_positive_d = "trace:dg" @@ -1878,6 +1880,9 @@ do -- [noad_vcenter = "", } + local setcolor = colortracers.set + local resetcolor = colortracers.reset + classes[math_char] = function(pointer,what,n,parent) local color = colors[getsubtype(parent)] if color then diff --git a/tex/context/base/mkiv/math-stc.mkvi b/tex/context/base/mkiv/math-stc.mkvi index 2b10bca45..babf29bce 100644 --- a/tex/context/base/mkiv/math-stc.mkvi +++ b/tex/context/base/mkiv/math-stc.mkvi @@ -76,6 +76,7 @@ \def\math_stackers_fallback {\mathstylehbox to \scratchwidth{\usemathstackerscolorparameter\c!color \hss + \hskip\mathstackersparameter\c!topoffset\relax % for manual italic correction \ifcsname\??mathextensiblefallbacks\number\scratchunicode\endcsname \lastnamedcs \else @@ -165,6 +166,7 @@ \c!mpoffset=.25\exheight, \c!voffset=.25\exheight, \c!hoffset=.5\emwidth, + \c!topoffset=\zeropoint, % for manual italic correction \c!distance=\mathstackersparameter\c!voffset, % distance between symbol and base (can be different from voffset) \c!minheight=\exheight, \c!mindepth=\zeropoint, @@ -1322,9 +1324,15 @@ % New (an example of using \mathexheight): -\definemathstackers[\v!symbol][\c!voffset=-.40\mathexheight,\c!hoffset=\zeropoint] - -\definemathover[\v!symbol][interiorset]["2217] +\definemathstackers + [\v!symbol] + [\c!voffset=-.3\mathexheight, + \c!hoffset=\zeropoint, + \c!mathclass=ord, + \c!topoffset=.4\mathemwidth, % poor man's italic correction + \c!middlecommand=\mathematics] + +\definemathover[\v!symbol][interiorset]["2218] \protect \endinput diff --git a/tex/context/base/mkiv/math-tag.lua b/tex/context/base/mkiv/math-tag.lua index a967ed3e8..3b717af15 100644 --- a/tex/context/base/mkiv/math-tag.lua +++ b/tex/context/base/mkiv/math-tag.lua @@ -251,93 +251,95 @@ process = function(start) -- we cannot use the processor as we have no finalizer -- keep an eye on math_box_code and see what ends up in there local attr = getattr(start,a_tagged) local specification = taglist[attr] - local tag = specification.tagname - if tag == "formulacaption" then - -- skip - elseif tag == "mstacker" then - local list = getlist(start) - if list then - process(list) - end - else - if tag ~= "mstackertop" and tag ~= "mstackermid" and tag ~= "mstackerbot" then - tag = "mtext" - end - local text = start_tagged(tag) - setattr(start,a_tagged,text) - local list = getlist(start) - if not list then - -- empty list - elseif not attr then - -- box comes from strange place - set_attributes(list,a_tagged,text) -- only the first node ? + if specification then + local tag = specification.tagname + if tag == "formulacaption" then + -- skip + elseif tag == "mstacker" then + local list = getlist(start) + if list then + process(list) + end else - -- Beware, the first node in list is the actual list so we definitely - -- need to nest. This approach is a hack, maybe I'll make a proper - -- nesting feature to deal with this at another level. Here we just - -- fake structure by enforcing the inner one. - -- - -- todo: have a local list with local tags that then get appended - -- - local tagdata = specification.taglist - local common = #tagdata + 1 - local function runner(list,depth) -- quite inefficient - local cache = { } -- we can have nested unboxed mess so best local to runner - local keep = nil - -- local keep = { } -- win case we might need to move keep outside - for n in traverse_nodes(list) do - local id = getid(n) - local mth = id == math_code and getsubtype(n) - if mth == 0 then - -- insert(keep,text) - keep = text - text = start_tagged("mrow") - common = common + 1 - end - local aa = getattr(n,a_tagged) - if aa then - local ac = cache[aa] - if not ac then - local tagdata = taglist[aa].taglist - local extra = #tagdata - if common <= extra then - for i=common,extra do - ac = restart_tagged(tagdata[i]) -- can be made faster - end - for i=common,extra do - stop_tagged() -- can be made faster + if tag ~= "mstackertop" and tag ~= "mstackermid" and tag ~= "mstackerbot" then + tag = "mtext" + end + local text = start_tagged(tag) + setattr(start,a_tagged,text) + local list = getlist(start) + if not list then + -- empty list + elseif not attr then + -- box comes from strange place + set_attributes(list,a_tagged,text) -- only the first node ? + else + -- Beware, the first node in list is the actual list so we definitely + -- need to nest. This approach is a hack, maybe I'll make a proper + -- nesting feature to deal with this at another level. Here we just + -- fake structure by enforcing the inner one. + -- + -- todo: have a local list with local tags that then get appended + -- + local tagdata = specification.taglist + local common = #tagdata + 1 + local function runner(list,depth) -- quite inefficient + local cache = { } -- we can have nested unboxed mess so best local to runner + local keep = nil + -- local keep = { } -- win case we might need to move keep outside + for n in traverse_nodes(list) do + local id = getid(n) + local mth = id == math_code and getsubtype(n) + if mth == 0 then + -- insert(keep,text) + keep = text + text = start_tagged("mrow") + common = common + 1 + end + local aa = getattr(n,a_tagged) + if aa then + local ac = cache[aa] + if not ac then + local tagdata = taglist[aa].taglist + local extra = #tagdata + if common <= extra then + for i=common,extra do + ac = restart_tagged(tagdata[i]) -- can be made faster + end + for i=common,extra do + stop_tagged() -- can be made faster + end + else + ac = text end - else - ac = text + cache[aa] = ac end - cache[aa] = ac + setattr(n,a_tagged,ac) + else + setattr(n,a_tagged,text) end - setattr(n,a_tagged,ac) - else - setattr(n,a_tagged,text) - end - if id == hlist_code or id == vlist_code then - runner(getlist(n),depth+1) - elseif id == glyph_code then - runner(getcomponents(n),depth+1) -- this should not be needed - elseif id == disc_code then - local pre, post, replace = getdisc(n) - runner(pre,depth+1) -- idem - runner(post,depth+1) -- idem - runner(replace,depth+1) -- idem - end - if mth == 1 then - stop_tagged() - -- text = remove(keep) - text = keep - common = common - 1 + if id == hlist_code or id == vlist_code then + runner(getlist(n),depth+1) + elseif id == glyph_code then + runner(getcomponents(n),depth+1) -- this should not be needed + elseif id == disc_code then + local pre, post, replace = getdisc(n) + runner(pre,depth+1) -- idem + runner(post,depth+1) -- idem + runner(replace,depth+1) -- idem + end + if mth == 1 then + stop_tagged() + -- text = remove(keep) + text = keep + common = common - 1 + end end end + runner(list,0) end - runner(list,0) + stop_tagged() end - stop_tagged() end elseif id == math_sub_code then -- normally a hbox local list = getlist(start) diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index 6843ae3fe..c12040708 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -11036,6 +11036,12 @@ return { ["threshold"]={ ["en"]="threshold", }, + ["displaythreshold"]={ + ["en"]="displaythreshold", + }, + ["inlinethreshold"]={ + ["en"]="inlinethreshold", + }, ["title"]={ ["cs"]="titul", ["de"]="titel", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index a2a5e39e8..e28150052 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -286,6 +286,7 @@ return { "mathdisplayskipmode", "matheqnogapstep", "mathitalicsmode", + "mathdelimitersmode", "mathnolimitsmode", "mathoption", "mathpenaltiesmode", @@ -903,6 +904,7 @@ return { "matheqnogapstep", "mathinner", "mathitalicsmode", + "mathdelimitersmode", "mathnolimitsmode", "mathop", "mathopen", diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua index f461e7ab9..e7183b569 100644 --- a/tex/context/base/mkiv/spac-ver.lua +++ b/tex/context/base/mkiv/spac-ver.lua @@ -70,8 +70,8 @@ local v_noheight = variables.noheight local v_nodepth = variables.nodepth local v_line = variables.line local v_halfline = variables.halfline -local v_line_m = "-" .. variables.line -local v_halfline_m = "-" .. variables.halfline +local v_line_m = "-" .. v_line +local v_halfline_m = "-" .. v_halfline local v_first = variables.first local v_last = variables.last local v_top = variables.top diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 52f74e413..60c16486a 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 0b11a250e..334bdaa7b 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-mat.mkiv b/tex/context/base/mkiv/strc-mat.mkiv index 7ba652818..e79db99d1 100644 --- a/tex/context/base/mkiv/strc-mat.mkiv +++ b/tex/context/base/mkiv/strc-mat.mkiv @@ -624,32 +624,68 @@ \directvspacing\p_spaceafter \fi} -\def\strc_math_obey_depth - {\ifvmode\ifdim\prevdepth<\zeropoint\else\ifdim\prevdepth<\strutdp - % maybe add a tracing option here - \ifgridsnapping - \directvspacing\v!depth - \else - \kern\dimexpr\strutdp-\prevdepth\relax - \prevdepth\strutdp - \fi - \fi\fi\fi} +% \def\strc_math_obey_depth +% {\ifvmode\ifdim\prevdepth<\zeropoint\else\ifdim\prevdepth<\strutdp +% % maybe add a tracing option here +% \ifgridsnapping +% \directvspacing\v!depth +% \else +% \kern\dimexpr\strutdp-\prevdepth\relax +% \prevdepth\strutdp +% \fi +% \fi\fi\fi} +% +% \setvalue{\??mathdisplayspacemodel\v!before:3}% +% {% not ok, try \stopformula\par\startformula vs \stopformula\startformula +% \ifdim\lastskip>\zeropoint +% % bah +% \else +% \strc_math_obey_depth % somehow \fakenextstrutline doesn't work here +% \nointerlineskip +% \fi +% \ifx\p_spacebefore\v!none +% % nothing +% \else\ifx\p_spacebefore\empty +% \directvspacing\currentvspacing +% \else +% \directvspacing\p_spacebefore +% \fi\fi} \setvalue{\??mathdisplayspacemodel\v!before:3}% {% not ok, try \stopformula\par\startformula vs \stopformula\startformula - \ifdim\lastskip>\zeropoint - % bah - \else - \strc_math_obey_depth % somehow \fakenextstrutline doesn't work here + \let\m_spacebefore\empty + \ifvmode + \ifdim\lastskip>\zeropoint\else + \ifdim\prevdepth<\zeropoint\else + \ifdim\prevdepth<\strutdp + % maybe add a tracing option here + \ifgridsnapping + \let\m_spacebefore\v!depth + \else + \edef\m_spacebefore{\the\dimexpr\strutdp-\prevdepth\relax}% + \fi + \fi + \fi + \fi \nointerlineskip \fi - \ifx\p_spacebefore\v!none - % nothing - \else\ifx\p_spaceafter\empty - \directvspacing\currentvspacing + \ifx\m_spacebefore\empty + \ifx\p_spacebefore\v!none + % nothing + \else\ifx\p_spacebefore\empty + \directvspacing\currentvspacing + \else + \directvspacing{\p_spacebefore,\the\scratchdimen}% + \fi\fi \else - \directvspacing\p_spacebefore - \fi\fi} + \ifx\p_spacebefore\v!none + \directvspacing{\m_spacebefore}% + \else\ifx\p_spacebefore\empty + \directvspacing{\m_spacebefore,\currentvspacing}% + \else + \directvspacing{\m_spacebefore,\p_spacebefore}% + \fi\fi + \fi} \setvalue{\??mathdisplayspacemodel\v!after:3}% {\prevdepth\strutdp % \directvspacing\v!depth diff --git a/tex/context/base/mkiv/strc-tag.mkiv b/tex/context/base/mkiv/strc-tag.mkiv index 34fef5f50..b25cd6108 100644 --- a/tex/context/base/mkiv/strc-tag.mkiv +++ b/tex/context/base/mkiv/strc-tag.mkiv @@ -363,6 +363,9 @@ \doifelse{\taggingparameter\c!state}\v!start{\the\everyenableelements}{\the\everydisableelements}% \to \everysetuptagging +\unexpanded\def\forgettagging + {\attribute\taggedattribute\attributeunsetvalue} + \setuptagging [\c!state=\v!stop, \c!method=\v!auto] diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv index 080cffafc..36a68277b 100644 --- a/tex/context/base/mkiv/syst-ini.mkiv +++ b/tex/context/base/mkiv/syst-ini.mkiv @@ -1182,10 +1182,11 @@ \ifdefined\protrusionboundary \else \let\protrusionboundary\boundary \fi \ifdefined\wordboundary \else \let\wordboundary \noboundary \fi -\ifdefined\mathrulesfam \else \newcount\mathrulesfam \fi -\ifdefined\mathrulesmode \else \newcount\mathrulesmode \fi -\ifdefined\mathsurroundmode \else \newcount\mathsurroundmode \fi -\ifdefined\mathitalicsmode \else \newcount\mathitalicsmode \fi +\ifdefined\mathrulesfam \else \newcount\mathrulesfam \fi +\ifdefined\mathrulesmode \else \newcount\mathrulesmode \fi +\ifdefined\mathsurroundmode \else \newcount\mathsurroundmode \fi +\ifdefined\mathitalicsmode \else \newcount\mathitalicsmode \fi +\ifdefined\mathdelimitersmode \else \newcount\mathdelimitersmode \fi \ifdefined\hyphenpenaltymode \else \newcount\hyphenpenaltymode \fi \ifdefined\automatichyphenpenalty \else \newcount\automatichyphenpenalty \fi diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua index 202b38ede..26229c79c 100644 --- a/tex/context/base/mkiv/task-ini.lua +++ b/tex/context/base/mkiv/task-ini.lua @@ -63,7 +63,7 @@ appendaction("processors", "lists", "typesetters.digits.handler") appendaction("processors", "lists", "typesetters.italics.handler") -- disabled (after otf/kern handling) appendaction("processors", "lists", "languages.visualizediscretionaries") -- disabled -appendaction ("processors", "after", "typesetters.marksuspects") +appendaction("processors", "after", "typesetters.marksuspects") appendaction("shipouts", "normalizers", "typesetters.showsuspects") appendaction("shipouts", "normalizers", "typesetters.margins.finalhandler") -- disabled diff --git a/tex/context/interface/mkii/keys-cs.xml b/tex/context/interface/mkii/keys-cs.xml index 727f8e9aa..52e2b7f60 100644 --- a/tex/context/interface/mkii/keys-cs.xml +++ b/tex/context/interface/mkii/keys-cs.xml @@ -759,6 +759,7 @@ <cd:constant name='direction' value='smer'/> <cd:constant name='directory' value='adresar'/> <cd:constant name='display' value='obrazovka'/> + <cd:constant name='displaythreshold' value='displaythreshold'/> <cd:constant name='distance' value='vzdalenost'/> <cd:constant name='domain' value='domain'/> <cd:constant name='dot' value='tecka'/> @@ -868,6 +869,7 @@ <cd:constant name='index' value='index'/> <cd:constant name='indicator' value='indikator'/> <cd:constant name='initialsep' value='initialsep'/> + <cd:constant name='inlinethreshold' value='inlinethreshold'/> <cd:constant name='inner' value='vnitrni'/> <cd:constant name='innermargin' value='innermargin'/> <cd:constant name='inputfile' value='inputfile'/> diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index 735e5f6de..a0d1d38e7 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -13159,6 +13159,15 @@ <cd:parameter name="right"> <cd:constant type="cd:number"/> </cd:parameter> + <cd:parameter name="inlinethreshold"> + <cd:constant type="cd:number"/> + </cd:parameter> + <cd:parameter name="displaythreshold"> + <cd:constant type="cd:number"/> + </cd:parameter> + <cd:parameter name="fences"> + <cd:constant type="cd:string"/> + </cd:parameter> <cd:parameter name="rulethickness"> <cd:constant type="cd:dimension"/> </cd:parameter> @@ -21922,6 +21931,9 @@ <cd:parameter name="state"> <cd:constant type="auto"/> </cd:parameter> + <cd:parameter name="method"> + <cd:constant type="auto"/> + </cd:parameter> <cd:parameter name="factor"> <cd:constant type="none"/> <cd:constant type="auto"/> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex b3398d7d7..6112ce18e 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-fraction.xml b/tex/context/interface/mkiv/i-fraction.xml index f395b1ea5..18d253784 100644 --- a/tex/context/interface/mkiv/i-fraction.xml +++ b/tex/context/interface/mkiv/i-fraction.xml @@ -52,6 +52,15 @@ <cd:parameter name="right"> <cd:constant type="cd:number"/> </cd:parameter> + <cd:parameter name="inlinethreshold"> + <cd:constant type="cd:number"/> + </cd:parameter> + <cd:parameter name="displaythreshold"> + <cd:constant type="cd:number"/> + </cd:parameter> + <cd:parameter name="fences"> + <cd:constant type="cd:string"/> + </cd:parameter> <cd:parameter name="rulethickness"> <cd:constant type="cd:dimension"/> </cd:parameter> diff --git a/tex/context/interface/mkiv/i-mathfence.xml b/tex/context/interface/mkiv/i-mathfence.xml index d73241053..5b0bf2d56 100644 --- a/tex/context/interface/mkiv/i-mathfence.xml +++ b/tex/context/interface/mkiv/i-mathfence.xml @@ -40,6 +40,9 @@ <cd:parameter name="state"> <cd:constant type="auto"/> </cd:parameter> + <cd:parameter name="method"> + <cd:constant type="auto"/> + </cd:parameter> <cd:parameter name="factor"> <cd:constant type="none"/> <cd:constant type="auto"/> diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex ec31adeff..b08267ccf 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/common/s-abr-01.tex b/tex/context/modules/common/s-abr-01.tex index 632c902b1..48e9559d6 100644 --- a/tex/context/modules/common/s-abr-01.tex +++ b/tex/context/modules/common/s-abr-01.tex @@ -64,6 +64,7 @@ \logo [CID] {cid} \logo [CJK] {cjk} \logo [CMR] {cmr} +\logo [CNC] {cnc} \logo [CLD] {cld} \logo [CMYK] {cmyk} \logo [CODHOST] {CodHost} @@ -231,6 +232,7 @@ \logo [PSTOPAGE] {pstopage} \logo [PSTOPDF] {pstopdf} \logo [PSTRICKS] {pstricks} +\logo [RAID] {raid} \logo [RAM] {ram} \logo [RCA] {RCA} \logo [READER] {Acro\-bat Reader} @@ -277,6 +279,7 @@ \logo [TEXWORKS] {\TeXprefix works} \logo [TEXXET] {\TeX\XeT} \def\XeT{XeT} \logo [TFM] {tfm} +\logo [THREED] {3D} \logo [TIF] {tif} \logo [TIFF] {tiff} \logo [TIFFINFO] {tiffinfo} @@ -328,6 +331,7 @@ \logo [XYPIC] {XYPIC} % wrong logo \logo [VAX] {vax} \logo [VMWARE] {VMWare} +\logo [YOUTUBE] {YouTube} \logo [YandY] {y\&y} \logo [ZIP] {zip} diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv index 18950f6a1..254402ddf 100644 --- a/tex/context/modules/mkiv/m-scite.mkiv +++ b/tex/context/modules/mkiv/m-scite.mkiv @@ -64,6 +64,7 @@ local f_none_none = formatters["\\unexpanded\\def\\slx%s#1{{#1}}%%"] local f_texstyled = formatters["\\slx%s{%s}"] local f_hanging = formatters["\\slxb{%s}%s\\slxe"] +local v_none = interfaces.variables.none local f_mapping = [[ \let\string\slxL\string\letterleftbrace @@ -152,7 +153,9 @@ local function exportstyled(lexer,text) local position = result[i+1] local txt = sub(text,start,position-1) txt = lpegmatch(replacer,txt) - if whites[style] then + if txt == "" then + -- skip + elseif whites[style] then buffer[#buffer+1] = txt else buffer[#buffer+1] = f_texstyled(style,txt) @@ -208,9 +211,21 @@ local loaddata = io.loaddata local loadedlexers = scite.loadedlexers local function lexdata(data,lexname) - local styled = exportstyled(loadedlexers[lexname],data or "") - styled = indent(styled) - assignbuffer("lex",styled) + if not data then + data = "" + elseif data ~= "" then + if data and not find(data,"[\r\n]$") then + -- fix for lexbyline + data = data .. "\r" + end + if lexname == v_none then + data = string.formatters["%!tex!"](data) + else + data = exportstyled(loadedlexers[lexname] or loadedlexers.tex,data) + end + data = indent(data) + end + assignbuffer("lex",data) end scite.lexdata = lexdata @@ -276,17 +291,20 @@ visualizers.register("bibtex",visualizer) visualizers.register("btx", visualizer) visualizers.register("web", visualizer) visualizers.register("cpp", visualizer) +visualizers.register("txt", visualizer) -----------.register("sql", visualizer) \stopluacode -\definetyping[TEX][option=cld] -\definetyping[LUA][option=lua] -\definetyping[BTX][option=bibtex] -\definetyping[MPS][option=mps] -\definetyping[MP] [option=mps] -\definetyping[CPP][option=web] -\definetyping[WEB][option=web] +\definetyping[TEX] [option=cld] +\definetyping[LUA] [option=lua] +\definetyping[BTX] [option=bibtex] +\definetyping[MPS] [option=mps] +\definetyping[MP] [option=mps] +\definetyping[CPP] [option=web] +\definetyping[WEB] [option=web] +\definetyping[TXT] [option=txt] +\definetyping[NONE][option=none] % This is a preliminary interface. @@ -308,7 +326,7 @@ visualizers.register("cpp", visualizer) \unexpanded\def\installscitecommandsinline {\scitespaceskip\interwordspace % \fontcharwd\font`0\relax % brrrrr \let\slxb\gobbleoneargument - \let\slxe\relax + \let\slxe\space \let\installscitecommandsinline\relax} \unexpanded\def\installscitecommandsdisplay @@ -355,7 +373,7 @@ visualizers.register("cpp", visualizer) \endgroup} \unexpanded\def\scitebuffer - {\dodoubleargument\module_scite_buffer} + {\dodoubleempty\module_scite_buffer} \unexpanded\def\module_scite_buffer[#1][#2]% {\begingroup @@ -370,12 +388,12 @@ visualizers.register("cpp", visualizer) \dontcomplain \raggedright \startlines - \getbuffer[lex]% + \getbuffer[lex] \stoplines \endgroup} \unexpanded\def\sciteinlinebuffer - {\dodoubleargument\module_scite_buffer_inline} + {\dodoubleempty\module_scite_buffer_inline} \unexpanded\def\module_scite_buffer_inline[#1][#2]% {\dontleavehmode @@ -468,4 +486,13 @@ visualizers.register("cpp", visualizer) % \getbuffer[demo] \scitebuffer[demo] +\startbuffer[foo] +This is text. % line 1 +This is text. % line 2 +\stopbuffer + +\scitebuffer[none][foo] + +\sciteinlinebuffer[none][foo] + \stoptext diff --git a/tex/context/modules/mkiv/x-asciimath.mkiv b/tex/context/modules/mkiv/x-asciimath.mkiv index 5c96d4f8a..1b0567dbd 100644 --- a/tex/context/modules/mkiv/x-asciimath.mkiv +++ b/tex/context/modules/mkiv/x-asciimath.mkiv @@ -165,6 +165,7 @@ \appendtoks \enableautofences + \enableautofencemode \to \everyasciimath \unexpanded\def\asciimath diff --git a/tex/context/modules/mkiv/x-cals.lua b/tex/context/modules/mkiv/x-cals.lua index 3af6106d8..ef85630da 100644 --- a/tex/context/modules/mkiv/x-cals.lua +++ b/tex/context/modules/mkiv/x-cals.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['x-cals'] = { local next = next local format, lower = string.format, string.lower -local xmlsprint, xmlcprint, xmlcollected, xmlelements = xml.sprint, xml.cprint, xml.collected, xml.elements +local xmlcprint, xmlcollected, xmlelements = xml.cprint, xml.collected, xml.elements local n_todimen, s_todimen = number.todimen, string.todimen -- there is room for speedups as well as cleanup (using context functions) diff --git a/tex/context/modules/mkiv/x-mathml.mkiv b/tex/context/modules/mkiv/x-mathml.mkiv index 50d31da0e..31ccbc153 100644 --- a/tex/context/modules/mkiv/x-mathml.mkiv +++ b/tex/context/modules/mkiv/x-mathml.mkiv @@ -69,6 +69,7 @@ \startxmlsetups mml:math \begingroup \enableautofences + \enableautofencemode \xmlval {mml:math:dir} {\xmlatt{#1}{dir}} {} \xmlval {mml:math:display} {\xmlatt{#1}{display}} { \xmlval {mml:math:mode} {\xmlatt{#1}{mode}} { @@ -87,6 +88,7 @@ \startxmlsetups mml:imath \inlinemathematics { \enableautofences + \enableautofencemode %\math_fences_checked_start %\MMLhack \xmlflush{#1} @@ -97,6 +99,7 @@ \startxmlsetups mml:dmath \displaymathematics { \enableautofences + \enableautofencemode %\math_fences_checked_start %\MMLhack \xmlflush{#1} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e9a5b4127..3eda9d031 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 08/29/17 19:35:06 +-- merge date : 09/05/17 15:10:09 do -- begin closure to overcome local limits and interference @@ -19625,7 +19625,7 @@ function readers.expand(data) end local rules=step.rules if rules then - local rulehash={} + local rulehash={ n=0 } local rulesize=0 local coverage={} local lookuptype=sequence.type @@ -19695,8 +19695,8 @@ function readers.expand(data) else end end + rulehash.n=rulesize end - rulehash.n=#rulehash end end end @@ -19738,7 +19738,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_de local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf -otf.version=3.102 +otf.version=3.103 otf.cache=containers.define("fonts","otl",otf.version,true) otf.svgcache=containers.define("fonts","svg",otf.version,true) otf.sbixcache=containers.define("fonts","sbix",otf.version,true) @@ -24597,7 +24597,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s local skipped local startprev, startnext=getboth(start) - local done + local done for k=1,contexts.n do local current=start local last=start @@ -24979,7 +24979,12 @@ local function chained_contextchain(head,start,stop,dataset,sequence,currentlook if nofsteps>1 then reportmoresteps(dataset,sequence) end - return handle_contextchain(head,start,dataset,sequence,currentlookup,rlmode,skiphash) + local l=steps[1].coverage[getchar(start)] + if l then + return handle_contextchain(head,start,dataset,sequence,l,rlmode,skiphash) + else + return head,start,false + end end chainprocs.gsub_context=chained_contextchain chainprocs.gsub_contextchain=chained_contextchain @@ -29898,6 +29903,7 @@ local abs=math.abs local bxor,rshift=bit32.bxor,bit32.rshift local P,S,R,Cmt,C,Ct,Cs,Carg=lpeg.P,lpeg.S,lpeg.R,lpeg.Cmt,lpeg.C,lpeg.Ct,lpeg.Cs,lpeg.Carg local lpegmatch,patterns=lpeg.match,lpeg.patterns +local sortedhash=table.sortedhash local trace_features=false trackers.register("afm.features",function(v) trace_features=v end) local trace_indexing=false trackers.register("afm.indexing",function(v) trace_indexing=v end) local trace_loading=false trackers.register("afm.loading",function(v) trace_loading=v end) @@ -29919,7 +29925,7 @@ local afmfeatures=constructors.features.afm local registerafmfeature=afmfeatures.register local afmenhancers=constructors.enhancers.afm local registerafmenhancer=afmenhancers.register -afm.version=1.512 +afm.version=1.513 afm.cache=containers.define("fonts","one",afm.version,true) afm.autoprefixed=true afm.helpdata={} @@ -29979,7 +29985,7 @@ local function enhance_unify_names(data,filename) local names={} local private=data.private or privateoffset local descriptions=data.descriptions - for name,blob in next,data.characters do + for name,blob in sortedhash(data.characters) do local code=unicodevector[name] if not code then code=lpegmatch(uparser,name) |