From 0caec226a633182402b349c3ac5b3bf9e0bc76c2 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 15 Jan 2023 14:50:04 +0100 Subject: 2023-01-15 13:55:00 --- tex/context/base/mkii/anch-pos.mkii | 4 +- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-en.mkii | 3 + tex/context/base/mkii/mult-fr.mkii | 2 + tex/context/base/mkii/mult-nl.mkii | 3 + tex/context/base/mkiv/anch-pos.lua | 2 +- tex/context/base/mkiv/anch-pos.mkiv | 4 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/export-example.css | 378 +++--- tex/context/base/mkiv/math-ini.mkiv | 16 +- tex/context/base/mkiv/mult-def.lua | 6 + tex/context/base/mkiv/mult-low.lua | 98 +- tex/context/base/mkiv/mult-prm.lua | 11 +- tex/context/base/mkiv/status-files.pdf | Bin 24606 -> 24557 bytes tex/context/base/mkiv/status-lua.pdf | Bin 264792 -> 265035 bytes tex/context/base/mkxl/anch-pos.lmt | 2 +- tex/context/base/mkxl/anch-pos.mkxl | 4 +- tex/context/base/mkxl/back-exp-imp-mth.lmt | 58 +- tex/context/base/mkxl/back-exp.lmt | 35 +- tex/context/base/mkxl/back-exp.mkxl | 1 + tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 2 +- tex/context/base/mkxl/core-uti.lmt | 76 +- tex/context/base/mkxl/font-ini.mklx | 3 +- tex/context/base/mkxl/font-mat.mklx | 20 +- tex/context/base/mkxl/lang-ini.mkxl | 2 +- tex/context/base/mkxl/lpdf-grp.lmt | 41 +- tex/context/base/mkxl/math-act.lmt | 18 +- tex/context/base/mkxl/math-dld.mklx | 107 +- tex/context/base/mkxl/math-fen.mkxl | 12 +- tex/context/base/mkxl/math-frc.mkxl | 144 ++- tex/context/base/mkxl/math-ini.lmt | 98 +- tex/context/base/mkxl/math-ini.mkxl | 453 ++++--- tex/context/base/mkxl/math-lop.mkxl | 33 +- tex/context/base/mkxl/math-spa.lmt | 7 +- tex/context/base/mkxl/math-stc.mklx | 12 +- tex/context/base/mkxl/math-tag.lmt | 83 +- tex/context/base/mkxl/mult-sys.mkxl | 2 + tex/context/base/mkxl/node-ali.lmt | 68 +- tex/context/base/mkxl/node-mig.lmt | 1 + tex/context/base/mkxl/page-brk.mkxl | 13 +- tex/context/base/mkxl/spac-ali.mkxl | 3 + tex/context/base/mkxl/spac-prf.mklx | 54 +- tex/context/base/mkxl/strc-lst.lmt | 1512 +++++++++++++++++++++++ tex/context/base/mkxl/strc-lst.mklx | 51 +- tex/context/base/mkxl/strc-mat.mkxl | 26 +- tex/context/base/mkxl/strc-ref.lmt | 13 +- tex/context/base/mkxl/syst-ini.mkxl | 23 +- tex/context/base/mkxl/tabl-tsp.mkxl | 4 +- tex/context/fonts/mkiv/bonum-math.lfg | 12 +- tex/context/fonts/mkiv/ebgaramond-math.lfg | 6 + tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv | 31 +- tex/context/interface/mkii/keys-en.xml | 3 + tex/context/interface/mkii/keys-fr.xml | 2 + tex/context/interface/mkii/keys-nl.xml | 3 + tex/context/modules/mkiv/s-fonts-tables.mkiv | 3 +- tex/context/modules/mkxl/m-oldmath.mkxl | 3 +- 59 files changed, 2789 insertions(+), 792 deletions(-) create mode 100644 tex/context/base/mkxl/strc-lst.lmt (limited to 'tex/context') diff --git a/tex/context/base/mkii/anch-pos.mkii b/tex/context/base/mkii/anch-pos.mkii index b86cee5cc..bd6906d1c 100644 --- a/tex/context/base/mkii/anch-pos.mkii +++ b/tex/context/base/mkii/anch-pos.mkii @@ -847,10 +847,10 @@ %D provide a simple test on positione being on the same page. %D %D \starttyping -%D \doifpositionsonsamepageelse{point a}{point b} +%D \doifpositionsonsamepageelse{point a,point b} %D {action when on same page} %D {action when not on same page} -%D \doifpositionsonthispageelse{point a}{point b} +%D \doifpositionsonthispageelse{point a,point b} %D {action when on this page} %D {action when not on this page} %D \stoptyping diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 7a8df6ecd..be7fd9234 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{2023.01.05 17:43} +\newcontextversion{2023.01.15 13:53} %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 5d3930dec..407cde6ad 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{2023.01.05 17:43} +\edef\contextversion{2023.01.15 13:53} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-en.mkii b/tex/context/base/mkii/mult-en.mkii index 9ac93c22d..e6c9225e0 100644 --- a/tex/context/base/mkii/mult-en.mkii +++ b/tex/context/base/mkii/mult-en.mkii @@ -591,6 +591,7 @@ \setinterfacevariable{temporary}{temporary} \setinterfacevariable{test}{test} \setinterfacevariable{text}{text} +\setinterfacevariable{textdisplay}{textdisplay} \setinterfacevariable{textnote}{textnote} \setinterfacevariable{three}{three} \setinterfacevariable{thursday}{thursday} @@ -718,6 +719,7 @@ \setinterfaceconstant{bookmark}{bookmark} \setinterfaceconstant{bottom}{bottom} \setinterfaceconstant{bottomafter}{bottomafter} +\setinterfaceconstant{bottomalign}{bottomalign} \setinterfaceconstant{bottombefore}{bottombefore} \setinterfaceconstant{bottomcolor}{bottomcolor} \setinterfaceconstant{bottomcommand}{bottomcommand} @@ -1332,6 +1334,7 @@ \setinterfaceconstant{toffset}{toffset} \setinterfaceconstant{tolerance}{tolerance} \setinterfaceconstant{top}{top} +\setinterfaceconstant{topalign}{topalign} \setinterfaceconstant{topcolor}{topcolor} \setinterfaceconstant{topcommand}{topcommand} \setinterfaceconstant{topdistance}{topdistance} diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii index aa5c33391..71e6d8978 100644 --- a/tex/context/base/mkii/mult-fr.mkii +++ b/tex/context/base/mkii/mult-fr.mkii @@ -719,6 +719,7 @@ \setinterfaceconstant{bookmark}{marquepage} \setinterfaceconstant{bottom}{bas} \setinterfaceconstant{bottomafter}{basaprès} +\setinterfaceconstant{bottomalign}{bottomalign} \setinterfaceconstant{bottombefore}{basavant} \setinterfaceconstant{bottomcolor}{bottomcolor} \setinterfaceconstant{bottomcommand}{commandebas} @@ -1333,6 +1334,7 @@ \setinterfaceconstant{toffset}{decalaget} \setinterfaceconstant{tolerance}{tolerance} \setinterfaceconstant{top}{haut} +\setinterfaceconstant{topalign}{topalign} \setinterfaceconstant{topcolor}{topcolor} \setinterfaceconstant{topcommand}{commandehaut} \setinterfaceconstant{topdistance}{distancehaut} diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii index ca90b7129..0446f2084 100644 --- a/tex/context/base/mkii/mult-nl.mkii +++ b/tex/context/base/mkii/mult-nl.mkii @@ -591,6 +591,7 @@ \setinterfacevariable{temporary}{voorlopig} \setinterfacevariable{test}{test} \setinterfacevariable{text}{tekst} +\setinterfacevariable{textdisplay}{textdisplay} \setinterfacevariable{textnote}{tekstnoot} \setinterfacevariable{three}{drie} \setinterfacevariable{thursday}{donderdag} @@ -718,6 +719,7 @@ \setinterfaceconstant{bookmark}{bookmark} \setinterfaceconstant{bottom}{onder} \setinterfaceconstant{bottomafter}{bottomafter} +\setinterfaceconstant{bottomalign}{bottomalign} \setinterfaceconstant{bottombefore}{bottombefore} \setinterfaceconstant{bottomcolor}{onderkleur} \setinterfaceconstant{bottomcommand}{ondercommando} @@ -1332,6 +1334,7 @@ \setinterfaceconstant{toffset}{toffset} \setinterfaceconstant{tolerance}{tolerantie} \setinterfaceconstant{top}{boven} +\setinterfaceconstant{topalign}{topalign} \setinterfaceconstant{topcolor}{bovenkleur} \setinterfaceconstant{topcommand}{bovencommando} \setinterfaceconstant{topdistance}{bovenafstand} diff --git a/tex/context/base/mkiv/anch-pos.lua b/tex/context/base/mkiv/anch-pos.lua index 93ba661a7..77f55964f 100644 --- a/tex/context/base/mkiv/anch-pos.lua +++ b/tex/context/base/mkiv/anch-pos.lua @@ -986,7 +986,7 @@ local function overlapping(one,two,overlappingmargin) -- hm, strings so this is end local function onsamepage(list,page) - for id in gmatch(list,"(, )") do + for id in gmatch(list,"([^,%s]+)") do local jpi = collected[id] if jpi then local p = jpi.p diff --git a/tex/context/base/mkiv/anch-pos.mkiv b/tex/context/base/mkiv/anch-pos.mkiv index 772c89504..ce67caa98 100644 --- a/tex/context/base/mkiv/anch-pos.mkiv +++ b/tex/context/base/mkiv/anch-pos.mkiv @@ -477,10 +477,10 @@ %D positions being on the same page. %D %D \starttyping -%D \doifpositionsonsamepageelse{point a}{point b} +%D \doifpositionsonsamepageelse{point a,point b} %D {action when on same page} %D {action when not on same page} -%D \doifpositionsonthispageelse{point a}{point b} +%D \doifpositionsonthispageelse{point a,point b} %D {action when on this page} %D {action when not on this page} %D \stoptyping diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index a05a08583..05a4a397c 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2023.01.05 17:43} +\newcontextversion{2023.01.15 13:53} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index e9ae230e4..a48bbf9cd 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2023.01.05 17:43} +\edef\contextversion{2023.01.15 13:53} %D Kind of special: diff --git a/tex/context/base/mkiv/export-example.css b/tex/context/base/mkiv/export-example.css index 7cfd7f291..45af82c34 100644 --- a/tex/context/base/mkiv/export-example.css +++ b/tex/context/base/mkiv/export-example.css @@ -19,14 +19,14 @@ \definefloat[myfloata] \definefloat[myfloatb][myfloatbs][figure] - context|div.float.myfloata { } float[detail='myfloata'] { } - context|div.float.myfloatb { } float[detail='myfloatb'] { } - context|div.float.figure { } float[detail='figure'] { } - context|div.float.figure.myfloatb { } float[chain~='figure'][detail='myfloata'] { } - context|div.myfloata { } *[detail='myfloata'] { } - context|div.myfloatb { } *[detail='myfloatb'] { } - context|div.figure { } *[chain~='figure'] { } - context|div.figure.myfloatb { } *[chain~='figure'][detail='myfloatb'] { } + div.float.myfloata { } float[detail='myfloata'] { } + div.float.myfloatb { } float[detail='myfloatb'] { } + div.float.figure { } float[detail='figure'] { } + div.float.figure.myfloatb { } float[chain~='figure'][detail='myfloata'] { } + div.myfloata { } *[detail='myfloata'] { } + div.myfloatb { } *[detail='myfloatb'] { } + div.figure { } *[chain~='figure'] { } + div.figure.myfloatb { } *[chain~='figure'][detail='myfloatb'] { } Inheritance when using div seems to be stronger so we need to take more precautions. @@ -39,34 +39,34 @@ /* extradata: display */ ignore, -context|div.ignore { +div.ignore { display : none ; } ignore, -context|div.private { +div.private { display : none ; } xmetadata, -context|div.xmetadata { +div.xmetadata { display : none ; } xmetavariable, -context|div.xmetavariable { +div.xmetavariable { display : none ; } extradata, -context|div.extradata { +div.extradata { display : none ; } /* document : display */ document:before, -context|div.document:before { +div.document:before { content : attr(title) ; font-size : 44pt ; font-weight : bold ; @@ -74,7 +74,7 @@ context|div.document:before { } document, -context|div.document { +div.document { font-family : "DejaVu Serif", "Lucida Bright", serif ; font-size : 12pt ; /* line-height : 14.4pt; */ @@ -88,26 +88,26 @@ context|div.document { } document>metadata, -context|div.document context|div.metadata { +div.document div.metadata { font-family : "DejaVu Sans Mono", "Lucida Console", monospace ; margin-bottom : 3ex ; } /* document>metadata>metavariable[name="X"]:before, - context|div.document context|div.metadata context|div.metavariable.metaname-X:before { + div.document div.metadata div.metavariable.metaname-X:before { content : "X\00A0\00A0\00A0:\00A0" ; } */ document>metadata, -context|div.document context|div.metadata { +div.document div.metadata { display : flex ; flex-flow : column ; } document>metadata>metavariable:before, -context|div.document context|div.metadata context|div.metavariable:before { +div.document div.metadata div.metavariable:before { display : inline ; content : attr(label); width : 8em ; @@ -116,7 +116,7 @@ context|div.document context|div.metadata context|div.metavariable:before { } document>metadata>metavariable[name="title"], -context|div.document context|div.metadata context|div.metavariable.metaname-title { +div.document div.metadata div.metavariable.metaname-title { order : -1 ; display : block ; width : 50em ; @@ -129,7 +129,7 @@ context|div.document context|div.metadata context|div.metavariable.metaname-titl } document>metadata>metavariable[name="title"]:before, -context|div.document context|div.metadata context|div.metavariable.metaname-title:before { +div.document div.metadata div.metavariable.metaname-title:before { content : none ; } @@ -138,8 +138,8 @@ context|div.document context|div.metadata context|div.metavariable.metaname-titl paragraph, p, -context|div.paragraph, -context|div.p { +div.paragraph, +div.p { display : block ; margin-top : 0.5em ; margin-bottom : 0.5em ; @@ -148,7 +148,7 @@ context|div.p { /* break : display */ break, -context|div.break { +div.break { display : block ; margin-bottom : 0.5em ; } @@ -157,16 +157,16 @@ context|div.break { /* highlight : inline */ construct, -context|div.construct { +div.construct { } construct[detail="important"], -context|div.construct.important { +div.construct.important { font-weight : bold ; } highlight, -context|div.highlight { /* todo: style and color */ +div.highlight { /* todo: style and color */ display : inline ; } @@ -176,12 +176,12 @@ context|div.highlight { /* todo: style and color */ /* sectioncontent : display */ section, -context|div.section { +div.section { display : block ; } sectioncaption, -context|div.sectioncaption { +div.sectioncaption { display : block ; text-align : left ; page-break-after : avoid ; @@ -190,18 +190,18 @@ context|div.sectioncaption { } sectioncontent, -context|div.sectioncontent { +div.sectioncontent { display : block ; } sectionnumber, -context|div.sectionnumber { +div.sectionnumber { display : inline ; margin-right : 1em ; } sectionnumber, -context|div.sectiontitle { +div.sectiontitle { display : inline ; } @@ -211,29 +211,29 @@ context|div.sectiontitle { section[detail="chapter"]>sectioncaption, section[detail="title"]>sectioncaption, -context|div.level-2.chapter context|div.sectioncaption , -context|div.level-2.title context|div.sectioncaption { +div.level-2.chapter div.sectioncaption , +div.level-2.title div.sectioncaption { font-size : 2em ; font-weight : bold ; } section[detail="chapter"], section[detail="title"], -context|div.level-2.chapter, -context|div.level-2.title { +div.level-2.chapter, +div.level-2.title { page-break-before : always ; margin-top : 4ex ; } section[detail="chapter"]>sectioncaption>sectionnumber, -context|div.level-2.chapter context|div.sectioncaption context|div.sectionnumber { +div.level-2.chapter div.sectioncaption div.sectionnumber { /* nothing */ } section[detail="chapter"]>sectioncaption>sectiontitle, section[detail="title"]>sectioncaption>sectiontitle, -context|div.level-2.chapter context|div.sectioncaption context|div.sectiontitle, -context|div.level-2.title context|div.sectioncaption context|div.sectiontitle { +div.level-2.chapter div.sectioncaption div.sectiontitle, +div.level-2.title div.sectioncaption div.sectiontitle { /* nothing */ } @@ -241,28 +241,28 @@ context|div.level-2.title context|div.sectioncaption context|div.sectiontitle { section[detail="section"]>sectioncaption, section[detail="subject"]>sectioncaption, -context|div.level-3.section context|div.sectioncaption, -context|div.level-3.subject context|div.sectioncaption { +div.level-3.section div.sectioncaption, +div.level-3.subject div.sectioncaption { font-size : 1.75em ; font-weight : bold ; } section[detail="section"], section[detail="subject"], -context|div.level-3.section, -context|div.level-3.subject { +div.level-3.section, +div.level-3.subject { /* nothing */ } section[detail="section"]>sectioncaption>sectionnumber, -context|div.level-3.section context|div.sectioncaption context|div.sectionnumber { +div.level-3.section div.sectioncaption div.sectionnumber { /* nothing */ } section[detail="section"]>sectioncaption>sectiontitle, section[detail="subject"]>sectioncaption>sectiontitle, -context|div.level-3.section context|div.sectioncaption context|div.sectiontitle, -context|div.level-3.subject context|div.sectioncaption context|div.sectiontitle { +div.level-3.section div.sectioncaption div.sectiontitle, +div.level-3.subject div.sectioncaption div.sectiontitle { /* nothing */ } @@ -270,28 +270,28 @@ context|div.level-3.subject context|div.sectioncaption context|div.sectiontitle section[detail="subsection"]>sectioncaption, section[detail="subsubject"]>sectioncaption, -context|div.level-4.subsection context|div.sectioncaption, -context|div.level-4.subsubject context|div.sectioncaption { +div.level-4.subsection div.sectioncaption, +div.level-4.subsubject div.sectioncaption { font-size : 1.5em ; font-weight : bold ; } section[detail="subsection"], section[detail="subsubject"], -context|div.level-4.subsection, -context|div.level-4.subsubject { +div.level-4.subsection, +div.level-4.subsubject { /* nothing */ } section[detail="subsection"]>sectioncaption>sectionnumber, -context|div.level-4.subsection context|div.sectioncaption context|div.sectionnumber { +div.level-4.subsection div.sectioncaption div.sectionnumber { /* nothing */ } section[detail="subsection"]>sectioncaption>sectiontitle, section[detail="subsubject"]>sectioncaption>sectiontitle, -context|div.level-4.subsection context|div.sectioncaption context|div.sectiontitle, -context|div.level-4.subsubject context|div.sectioncaption context|div.sectiontitle { +div.level-4.subsection div.sectioncaption div.sectiontitle, +div.level-4.subsubject div.sectioncaption div.sectiontitle { /* nothing */ } @@ -299,28 +299,28 @@ context|div.level-4.subsubject context|div.sectioncaption context|div.sectiontit section[detail="subsubsection"]>sectioncaption, section[detail="subsubsubject"]>sectioncaption, -context|div.level-5.subsubsection context|div.sectioncaption, -context|div.level-5.subsubsubject context|div.sectioncaption { +div.level-5.subsubsection div.sectioncaption, +div.level-5.subsubsubject div.sectioncaption { font-size : 1.25em ; font-weight : bold ; } section[detail="subsubsection"], section[detail="subsubsubject"], -context|div.level-5.subsubsection, -context|div.level-5.subsubsubject { +div.level-5.subsubsection, +div.level-5.subsubsubject { /* nothing */ } section[detail="subsubsection"]>sectioncaption>sectionnumber, -context|div.level-5.subsubsection context|div.sectioncaption context|div.sectionnumber { +div.level-5.subsubsection div.sectioncaption div.sectionnumber { /* nothing */ } section[detail="subsubsection"]>sectioncaption>sectiontitle, section[detail="subsubsubject"]>sectioncaption>sectiontitle, -context|div.level-5.subsubsection context|div.sectioncaption context|div.sectiontitle, -context|div.level-5.subsubsubject context|div.sectioncaption context|div.sectiontitle { +div.level-5.subsubsection div.sectioncaption div.sectiontitle, +div.level-5.subsubsubject div.sectioncaption div.sectiontitle { /* nothing */ } @@ -328,14 +328,14 @@ context|div.level-5.subsubsubject context|div.sectioncaption context|div.section section[detail="summary"], section[detail="subsummary"], -context|div.section.summary, -context|div.section.subsummary { +div.section.summary, +div.section.subsummary { margin-top : 1em ; margin-bottom : 1em ; } section[detail="summary"]>sectioncaption>sectiontitle, -context|div.section.summary context|div.sectioncaption context|div.sectiontitle { +div.section.summary div.sectioncaption div.sectiontitle { display : block ; margin-top : 1em ; margin-bottom : 1em ; @@ -347,7 +347,7 @@ context|div.section.summary context|div.sectioncaption context|div.sectiontitle } section[detail="subsummary"]>sectioncaption>sectiontitle, -context|div.section.subsummary context|div.sectioncaption context|div.sectiontitle { +div.section.subsummary div.sectioncaption div.sectiontitle { display : block ; margin-top : 1em ; margin-bottom : 1em ; @@ -377,27 +377,27 @@ context|div.section.subsummary context|div.sectioncaption context|div.sectiontit } itemgroup, -context|div.itemgroup { +div.itemgroup { display : block ; margin-bottom : 0.5em ; margin-top : 0.5em ; } -itemgroup[symbol="1"], context|div.itemgroup.symbol-1 { list-style-type : disc ; } -itemgroup[symbol="2"], context|div.itemgroup.symbol-2 { list-style-type : square ; } -itemgroup[symbol="3"], context|div.itemgroup.symbol-3 { list-style-type : square ; } -itemgroup[symbol="4"], context|div.itemgroup.symbol-4 { list-style-type : square ; } -itemgroup[symbol="5"], context|div.itemgroup.symbol-5 { list-style-type : circ ; } -itemgroup[symbol="a"], context|div.itemgroup.symbol-a { list-style-type : lower-alpha ; } -itemgroup[symbol="A"], context|div.itemgroup.symbol-A { list-style-type : alpha ; } -itemgroup[symbol="r"], context|div.itemgroup.symbol-r { list-style-type : lower-roman ; } -itemgroup[symbol="R"], context|div.itemgroup.symbol-R { list-style-type : upper-roman ; } -itemgroup[symbol="n"], context|div.itemgroup.symbol-n { list-style-type : decimal ; } -itemgroup[symbol="g"], context|div.itemgroup.symbol-g { list-style-type : lower-greek ; } -itemgroup[symbol="G"], context|div.itemgroup.symbol-G { list-style-type : upper-greek ; } +itemgroup[symbol="1"], div.itemgroup.symbol-1 { list-style-type : disc ; } +itemgroup[symbol="2"], div.itemgroup.symbol-2 { list-style-type : square ; } +itemgroup[symbol="3"], div.itemgroup.symbol-3 { list-style-type : square ; } +itemgroup[symbol="4"], div.itemgroup.symbol-4 { list-style-type : square ; } +itemgroup[symbol="5"], div.itemgroup.symbol-5 { list-style-type : circ ; } +itemgroup[symbol="a"], div.itemgroup.symbol-a { list-style-type : lower-alpha ; } +itemgroup[symbol="A"], div.itemgroup.symbol-A { list-style-type : alpha ; } +itemgroup[symbol="r"], div.itemgroup.symbol-r { list-style-type : lower-roman ; } +itemgroup[symbol="R"], div.itemgroup.symbol-R { list-style-type : upper-roman ; } +itemgroup[symbol="n"], div.itemgroup.symbol-n { list-style-type : decimal ; } +itemgroup[symbol="g"], div.itemgroup.symbol-g { list-style-type : lower-greek ; } +itemgroup[symbol="G"], div.itemgroup.symbol-G { list-style-type : upper-greek ; } item, -context|div.item { +div.item { display : list-item ; margin-left : 1em ; margin-bottom : 0.5em ; @@ -405,12 +405,12 @@ context|div.item { } itemtag, -context|div.itemtag { +div.itemtag { display: none ; } itemcontent, -context|div.itemcontent { +div.itemcontent { } /* description : display */ @@ -419,14 +419,14 @@ context|div.itemcontent { /* descriptionsymbol : inline */ description, -context|div.description { +div.description { display : block ; margin-bottom : 1em ; margin-top : 1em ; } descriptiontag, -context|div.descriptiontag { +div.descriptiontag { display : inline ; float : left ; clear : left ; @@ -436,11 +436,11 @@ context|div.descriptiontag { } descriptioncontent, -context|div.descriptioncontent { +div.descriptioncontent { } descriptionsymbol, -context|div.descriptionsymbol { +div.descriptionsymbol { display : inline ; } @@ -450,7 +450,7 @@ context|div.descriptionsymbol { /* verbatim : inline */ verbatimblock, -context|div.verbatimblock { +div.verbatimblock { background-color : rgb(50%,50%,100%) ; display : block ; padding : 1em ; @@ -460,19 +460,19 @@ context|div.verbatimblock { } verbatimlines+verbatimlines, -context|div.verbatimlines+context|div.verbatimlines { +div.verbatimlines+div.verbatimlines { display : block ; margin-top : 1em ; } verbatimline, -context|div.verbatimline { +div.verbatimline { display : block ; white-space : pre-wrap ; } verbatim, -context|div.verbatim { +div.verbatim { display : inline ; white-space : pre-wrap ; color : rgb(60%,60%,0%) ; @@ -484,26 +484,26 @@ context|div.verbatim { /* linenumber : inline */ lines, -context|div.lines { +div.lines { display : block ; margin-bottom : 1em ; margin-top : 1em ; } lines+lines, -context|div.lines+context|div.lines { +div.lines+div.lines { display : block ; margin-top : 1em ; } line, -context|div.line { +div.line { display : block ; white-space : pre-wrap ; } linenumber, -context|div.linenumber { +div.linenumber { display : inline-block ; margin-right : 1em ; width : 3em ; @@ -516,8 +516,8 @@ context|div.linenumber { sorting, synonym, -context|div.sorting, -context|div.synonym { +div.sorting, +div.synonym { display : inline ; font-variant : small-caps ; } @@ -533,17 +533,17 @@ context|div.synonym { /* registerpagerange : mixed */ register, -context|div.register { +div.register { display: none ; } registerlocation, -context|div.registerlocation { +div.registerlocation { display: inline ; } registerlocation:after, -context|div.registerlocation:after { +div.registerlocation:after { content : "\25B6\00A0\00A0" ; color : rgb(40%,40%,40%) ; font-size : x-small ; @@ -559,38 +559,38 @@ context|div.registerlocation:after { /* we have a few bonus mappings here */ table, -context|div.table { +div.table { display : table ; } tablerow, tr -context|div.tablerow, context|div.tr { +div.tablerow, div.tr { display : table-row ; } tablecell[align="middle"], td[align="middle"], -context|div.tablecell.align-middle { +div.tablecell.align-middle { display : table-cell ; text-align : center ; padding : .1em ; } tablecell[align="flushleft"], td[align="flushleft"], -context|div.tablecell.align-flushleft { +div.tablecell.align-flushleft { display : table-cell ; text-align : left ; padding : .1em ; } tablecell[align="flushright"], td[align="flushright"], -context|div.tablecell.align-flushright { +div.tablecell.align-flushright { display : table-cell ; text-align : right ; padding : .1em ; } tablecell, td -context|div.tablecell, context|div.td { +div.tablecell, div.td { display : table-cell ; text-align : left ; padding : .1em ; @@ -616,7 +616,7 @@ div.tbody, div.tablebody { /* tabulatecell : mixed */ tabulate, -context|div.tabulate { +div.tabulate { display : table ; margin-top : 1em ; margin-bottom : 1em ; @@ -624,50 +624,50 @@ context|div.tabulate { } floatcontent>tabulate, -context|div.floatcontent context|div.tabulate { +div.floatcontent div.tabulate { margin-left : 0em ; } tabulaterow, -context|div.tabulaterow { +div.tabulaterow { display : table-row ; } tabulatecell[align="middle"], -context|div.tabulatecell.align-middle { +div.tabulatecell.align-middle { display : table-cell ; text-align : center ; padding-right : 1em ; } tabulatecell[align="flushleft"], -context|div.tabulatecell.align-flushleft { +div.tabulatecell.align-flushleft { display : table-cell ; text-align : left ; padding-right : 1em ; } tabulatecell[align="flushright"], -context|div.tabulatecell.align-flushright { +div.tabulatecell.align-flushright { display : table-cell ; text-align : right ; padding-right : 1em ; } tabulatecell, -context|div.tabulatecell { +div.tabulatecell { display : table-cell ; text-align : left ; padding-right : 1em ; } tabulatecell[kind="strong"], -context|div.tabulatecell.kind-strong { +div.tabulatecell.kind-strong { font-weight : bold ; } tabulatecell[kind="equals"]:before, -context|div.tabulatecell.kind-equals:before { +div.tabulatecell.kind-equals:before { display : inline-block ; clear : left ; margin-left : -.6em ; @@ -688,26 +688,26 @@ context|div.tabulatecell.kind-equals:before { /* combinationcaption : mixed */ combination, -context|div.combination { +div.combination { display : table ; margin-top : 0em ; margin-bottom : 0em ; } combinationpair, combinationtext, -context|div.combinationpair, context|div.combinationtext { +div.combinationpair, div.combinationtext { display : table-cell ; padding-right : 1em ; } combinationcontent, -context|div.combinationcontent { +div.combinationcontent { display : table-row ; text-align : center ; } combinationcaption, -context|div.combinationcaption { +div.combinationcaption { display : table-row ; padding-top : 1ex ; text-align : center ; @@ -722,13 +722,13 @@ context|div.combinationcaption { /* listtext : inline */ list, -context|div.list { +div.list { display : block ; text-align : left ; } listitem[detail="chapter"], -context|div.listitem.chapter { +div.listitem.chapter { display : block ; margin-top : 1em ; margin-left : 5em ; @@ -736,32 +736,32 @@ context|div.listitem.chapter { } listitem[detail="section"], -context|div.listitem.section { +div.listitem.section { display : block ; margin-left : 5em ; } listitem[detail="subsection"], -context|div.listitem.subsection { +div.listitem.subsection { display : block ; margin-left : 5em ; } /* listitem[detail="subsection"], -context|div.listitem.subsection { +div.listitem.subsection { display : inline-block ; margin-left : -5em ; } listitem[detail="subsection"]>listtag, -context|div.listitem.subsection context|div.listtag { +div.listitem.subsection div.listtag { margin-right : 1em ; } */ listitem[detail="chapter"]>listtag, -context|div.listitem.chapter > context|div.listtag { +div.listitem.chapter > div.listtag { display : inline-block ; margin-left : -5em ; float : left ; @@ -769,7 +769,7 @@ context|div.listitem.chapter > context|div.listtag { } listitem[detail="section"]>listtag, -context|div.listitem.section > context|div.listtag { +div.listitem.section > div.listtag { display : inline-block ; margin-left : -5em ; float : left ; @@ -777,7 +777,7 @@ context|div.listitem.section > context|div.listtag { } listitem[detail="subsection"]>listtag, -context|div.listitem.subsection > context|div.listtag { +div.listitem.subsection > div.listtag { display : inline-block ; margin-left : -5em ; float : left ; @@ -785,22 +785,22 @@ context|div.listitem.subsection > context|div.listtag { } listcontent, -context|div.listcontent { +div.listcontent { display : inline ; } listdata, -context|div.listdata { +div.listdata { display : inline ; } listpage, -context|div.listpage { +div.listpage { display : none ; } listtext, -context|div.listtext { +div.listtext { display : inline ; } @@ -816,75 +816,75 @@ context|div.listtext { delimited[detail="quotation"]:before, delimitedblock[detail="quotation"]:before, -context|div.delimited.quotation:before, -context|div.delimitedblock.quotation:before { +div.delimited.quotation:before, +div.delimitedblock.quotation:before { /* content : "\201C" ; */ font-style : italic ; } delimited[detail="quotation"]:after, delimitedblock[detail="quotation"]:after, -context|div.delimited.quotation:after, -context|div.delimitedblock.quotation:after { +div.delimited.quotation:after, +div.delimitedblock.quotation:after { /* content : "\201D" ; */ font-style : italic ; } delimited[detail="quote"]:before, delimitedblock[detail="quote"]:before, -context|div.delimited.quote:before, -context|div.delimitedblock.quote:before { +div.delimited.quote:before, +div.delimitedblock.quote:before { /* content : "\2018" ; */ font-style : italic ; } delimited[detail="quote"]:after, delimitedblock[detail="quote"]:after, -context|div.delimited.quote:after, -context|div.delimitedblock.quote:after { +div.delimited.quote:after, +div.delimitedblock.quote:after { /* content : "\2019" ; */ font-style : italic ; } delimited, -context|div.delimited { +div.delimited { display : inline } delimitedcontent, -context|div.delimitedcontent { +div.delimitedcontent { display : inline } delimitedsymbol, -context|div.delimitedsymbol { +div.delimitedsymbol { display : inline } delimitedblock, -context|div.delimitedblock { +div.delimitedblock { display : block } subsentence:before, subsentence:after, -context|div.subsentence:before, -context|div.subsentence:after { +div.subsentence:before, +div.subsentence:after { content : "\2014" ; } subsentence, -context|div.subsentence { +div.subsentence { display : inline } subsentencecontent, -context|div.subsentencecontent { +div.subsentencecontent { display : inline } subsentencesymbol, -context|div.subsentencesymbol { +div.subsentencesymbol { display : inline } @@ -899,7 +899,7 @@ context|div.subsentencesymbol { /* floatcontent : mixed */ float, -context|div.float { +div.float { display : block ; margin-top : 1em ; margin-bottom : 1em ; @@ -907,33 +907,33 @@ context|div.float { } floatcaption, -context|div.floatcaption { +div.floatcaption { display : block ; margin-top : 0.5em ; color : rgb(60%,60%,0%) ; } floatlabel, -context|div.floatlabel { +div.floatlabel { display : inline-block ; font-weight : bold ; margin-right : 0.25em ; } floatnumber, -context|div.floatnumber { +div.floatnumber { display : inline ; font-weight : bold ; margin-right : 0.25em ; } floattext, -context|div.floattext { +div.floattext { display : inline ; } floatcontent, -context|div.floatcontent { +div.floatcontent { } /* image : mixed */ @@ -948,13 +948,13 @@ context|div.floatcontent { } */ mpgraphic:before, -context|div.mpgraphic:before { +div.mpgraphic:before { /* does not work with empty element */ content : "[runtime metapost graphic]" ; } mpgraphic, -context|div.mpgraphic { +div.mpgraphic { display : inline ; } @@ -967,15 +967,16 @@ context|div.mpgraphic { /* formulacontent : display */ formula, -context|div.formula { - display : block ; +div.formula { + xdisplay : block ; + display : table ; margin-top : 1em ; margin-bottom : 1em ; margin-left : 2.5em ; } subformula, -context|div.subformula { /* todo */ +div.subformula { /* todo */ display : block ; margin-top : 1em ; margin-bottom : 1em ; @@ -983,7 +984,7 @@ context|div.subformula { /* todo */ } formulaset, -context|div.formulaset { /* todo */ +div.formulaset { /* todo */ display : block ; margin-top : 1em ; margin-bottom : 1em ; @@ -991,32 +992,37 @@ context|div.formulaset { /* todo */ } formulacaption, -context|div.formulacaption { /* todo */ - display : block ; - margin-top : 0.5em ; - color : rgb(60%,60%,0%) ; +div.formulacaption { /* todo */ + xdisplay : block ; + display : table-cell ; + margin-top : 0.5em ; + padding-left : 2em ; + color : rgb(60%,60%,0%) ; } formulalabel, -context|div.formulalabel { +div.formulalabel { display : inline ; font-weight : bold ; margin-right : .25em ; } formulanumber, -context|div.formulanumber { +div.formulanumber { display : inline ; font-weight : bold ; + margin-left : 0em ; } formulacontent, -context|div.formulacontent { - display : block ; +div.formulacontent { + xdisplay : block ; + display : table-cell ; + margin-left : 0em ; } link, -context|div.link { +div.link { display : inline ; } @@ -1024,7 +1030,7 @@ context|div.link { /* margintext : inline */ margintext, -context|div.margintext { +div.margintext { display : block ; font-weight : bold ; margin-top : 1em ; @@ -1032,7 +1038,7 @@ context|div.margintext { } margintext:before, -context|div.margintext:before { +div.margintext:before { content : "\25B6\00A0\00A0" ; color : rgb(40%,40%,40%) ; } @@ -1060,12 +1066,12 @@ context|div.margintext:before { /* mtr : display */ /* mtd : display */ -context|div.math-inline { +div.math-inline { display : inline ; vertical-align : 0 ; /* this will be set directly */ } -context|div.math-display { +div.math-display { display : block ; margin : 1ex 0ex 1em 3em ; } @@ -1074,12 +1080,12 @@ context|div.math-display { /* pubfld : inline */ publication, -context|div.publication { +div.publication { display : inline ; } pubfld[detail="title"], -context|div.pubfld.title { +div.pubfld.title { display : inline ; font-weight : italic ; } @@ -1089,17 +1095,17 @@ context|div.pubfld.title { /* number : inline */ quantity, -context|div.quantity { +div.quantity { display : inline-block ; } quantity>unit, -context|div.quantity>context|div.unit { +div.quantity>div.unit { display : inline ; } quantity>number, -context|div.quantity>context|div.number { +div.quantity>div.number { display : inline ; } @@ -1108,34 +1114,34 @@ context|div.quantity>context|div.number { /* subsup : inline */ sup, -context|div.sup { +div.sup { display : inline-block ; font-size : xx-small ; vertical-align : super ; } sub, -context|div.sub { +div.sub { display : inline-block ; font-size : xx-small ; vertical-align : sub ; } subsup>sup, -context|div.subsup>context|div.sup { +div.subsup>div.sup { display : inline ; vertical-align : top ; } subsup>sub, -context|div.subsup>context|div.sub { +div.subsup>div.sub { display : inline ; vertical-align : bottom ; } /* links */ -context|div[href]:hover { +div[href]:hover { color : rgb(50%,0%,0%) ; background-color : rgb(85%,85%,85%) ; } @@ -1143,12 +1149,12 @@ context|div[href]:hover { /* setups */ setup, -context|div.setup { +div.setup { display : block ; } comment, -context|div.comment { +div.comment { background-color : rgb(50%,75%,100%) ; display : block ; padding : 1em ; @@ -1160,18 +1166,18 @@ context|div.comment { /* blocks */ block, -context|div.block { +div.block { display : block ; } /* special */ c, -context|div.c { +div.c { display : inline ; } warning, -context|div.warning { +div.warning { display : none ; } diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv index ca6cccf73..a955e9284 100644 --- a/tex/context/base/mkiv/math-ini.mkiv +++ b/tex/context/base/mkiv/math-ini.mkiv @@ -340,14 +340,14 @@ % For the moment this way: -\appendtoks - \setmathprepenalty \mathbinarycode \defaultdisplayprepenalty - % \setmathpostpenalty\mathbinarycode \zerocount - \setmathprepenalty \mathrelationcode \defaultdisplayprepenalty - % \setmathpostpenalty\mathrelationcode \zerocount - \setmathpostpenalty\mathtextpunctuationcode\defaultdisplayprepenalty - % \setmathprepenalty \mathtextpunctuationcode\zerocount -\to \everybeforedisplayformula +% \appendtoks +% \setmathprepenalty \mathbinarycode \defaultdisplayprepenalty +% % \setmathpostpenalty\mathbinarycode \zerocount +% \setmathprepenalty \mathrelationcode \defaultdisplayprepenalty +% % \setmathpostpenalty\mathrelationcode \zerocount +% \setmathpostpenalty\mathtextpunctuationcode\defaultdisplayprepenalty +% % \setmathprepenalty \mathtextpunctuationcode\zerocount +% \to \everybeforedisplayformula % we need to control these otherwise: % diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index 87e325c41..f73d41e93 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -7408,6 +7408,12 @@ return { ["en"]="alignbottom", ["fr"]="alignerbas", }, + ["topalign"]={ + ["en"]="topalign", + }, + ["bottomalign"]={ + ["en"]="bottomalign", + }, ["aligncharacter"]={ ["cs"]="aligncharacter", ["de"]="aligncharacter", diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 3a78c719d..ffd71ea41 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -191,7 +191,7 @@ return { "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", "optionalspace", "asciispacechar", "softhyphen", "autoinsertedspace", -- - "Ux", "eUx", "Umathaccents", + "Ux", "eUx", -- "parfillleftskip", "parfillrightskip", -- @@ -501,53 +501,53 @@ return { -- "shiftbox", "vpackbox", "hpackbox", "vpackedbox", "hpackedbox", -- - "ordordspacing", "ordopspacing", "ordbinspacing", "ordrelspacing", - "ordopenspacing", "ordclosespacing", "ordpunctspacing", "ordinnerspacing", - "ordfracspacing", "ordradspacing", "ordmiddlespacing", "ordaccentspacing", - -- - "opordspacing", "opopspacing", "opbinspacing", "oprelspacing", - "opopenspacing", "opclosespacing", "oppunctspacing", "opinnerspacing", - "opfracspacing", "opradspacing", "opmiddlespacing", "opaccentspacing", - -- - "binordspacing", "binopspacing", "binbinspacing", "binrelspacing", - "binopenspacing", "binclosespacing", "binpunctspacing", "bininnerspacing", - "binfracspacing", "binradspacing", "binmiddlespacing", "binaccentspacing", - -- - "relordspacing", "relopspacing", "relbinspacing", "relrelspacing", - "relopenspacing", "relclosespacing", "relpunctspacing", "relinnerspacing", - "relfracspacing", "relradspacing", "relmiddlespacing", "relaccentspacing", - -- - "openordspacing", "openopspacing", "openbinspacing", "openrelspacing", - "openopenspacing", "openclosespacing", "openpunctspacing", "openinnerspacing", - "openfracspacing", "openradspacing", "openmiddlespacing", "openaccentspacing", - -- - "closeordspacing", "closeopspacing", "closebinspacing", "closerelspacing", - "closeopenspacing", "closeclosespacing", "closepunctspacing", "closeinnerspacing", - "closefracspacing", "closeradspacing", "closemiddlespacing", "closeaccentspacing", - -- - "punctordspacing", "punctopspacing", "punctbinspacing", "punctrelspacing", - "punctopenspacing", "punctclosespacing", "punctpunctspacing", "punctinnerspacing", - "punctfracspacing", "punctradspacing", "punctmiddlespacing", "punctaccentspacing", - -- - "innerordspacing", "inneropspacing", "innerbinspacing", "innerrelspacing", - "inneropenspacing", "innerclosespacing", "innerpunctspacing", "innerinnerspacing", - "innerfracspacing", "innerradspacing", "innermiddlespacing", "inneraccentspacing", - -- - "fracordspacing", "fracopspacing", "fracbinspacing", "fracrelspacing", - "fracopenspacing", "fracclosespacing", "fracpunctspacing", "fracinnerspacing", - "fracfracspacing", "fracradspacing", "fracmiddlespacing", "fracaccentspacing", - -- - "radordspacing", "radopspacing", "radbinspacing", "radrelspacing", - "radopenspacing", "radclosespacing", "radpunctspacing", "radinnerspacing", - "radfracspacing", "radradspacing", "radmiddlespacing", "radaccentspacing", - -- - "middleordspacing", "middleopspacing", "middlebinspacing", "middlerelspacing", - "middleopenspacing", "middleclosespacing", "middlepunctspacing", "middleinnerspacing", - "middlefracspacing", "middleradspacing", "middlemiddlespacing", "middleaccentspacing", - -- - "accentordspacing", "accentopspacing", "accentbinspacing", "accentrelspacing", - "accentopenspacing", "accentclosespacing", "accentpunctspacing", "accentinnerspacing", - "accentfracspacing", "accentradspacing", "accentmiddlespacing", "accentaccentspacing", + -- "ordordspacing", "ordopspacing", "ordbinspacing", "ordrelspacing", + -- "ordopenspacing", "ordclosespacing", "ordpunctspacing", "ordinnerspacing", + -- "ordfracspacing", "ordradspacing", "ordmiddlespacing", "ordaccentspacing", + -- -- + -- "opordspacing", "opopspacing", "opbinspacing", "oprelspacing", + -- "opopenspacing", "opclosespacing", "oppunctspacing", "opinnerspacing", + -- "opfracspacing", "opradspacing", "opmiddlespacing", "opaccentspacing", + -- -- + -- "binordspacing", "binopspacing", "binbinspacing", "binrelspacing", + -- "binopenspacing", "binclosespacing", "binpunctspacing", "bininnerspacing", + -- "binfracspacing", "binradspacing", "binmiddlespacing", "binaccentspacing", + -- -- + -- "relordspacing", "relopspacing", "relbinspacing", "relrelspacing", + -- "relopenspacing", "relclosespacing", "relpunctspacing", "relinnerspacing", + -- "relfracspacing", "relradspacing", "relmiddlespacing", "relaccentspacing", + -- -- + -- "openordspacing", "openopspacing", "openbinspacing", "openrelspacing", + -- "openopenspacing", "openclosespacing", "openpunctspacing", "openinnerspacing", + -- "openfracspacing", "openradspacing", "openmiddlespacing", "openaccentspacing", + -- -- + -- "closeordspacing", "closeopspacing", "closebinspacing", "closerelspacing", + -- "closeopenspacing", "closeclosespacing", "closepunctspacing", "closeinnerspacing", + -- "closefracspacing", "closeradspacing", "closemiddlespacing", "closeaccentspacing", + -- -- + -- "punctordspacing", "punctopspacing", "punctbinspacing", "punctrelspacing", + -- "punctopenspacing", "punctclosespacing", "punctpunctspacing", "punctinnerspacing", + -- "punctfracspacing", "punctradspacing", "punctmiddlespacing", "punctaccentspacing", + -- -- + -- "innerordspacing", "inneropspacing", "innerbinspacing", "innerrelspacing", + -- "inneropenspacing", "innerclosespacing", "innerpunctspacing", "innerinnerspacing", + -- "innerfracspacing", "innerradspacing", "innermiddlespacing", "inneraccentspacing", + -- -- + -- "fracordspacing", "fracopspacing", "fracbinspacing", "fracrelspacing", + -- "fracopenspacing", "fracclosespacing", "fracpunctspacing", "fracinnerspacing", + -- "fracfracspacing", "fracradspacing", "fracmiddlespacing", "fracaccentspacing", + -- -- + -- "radordspacing", "radopspacing", "radbinspacing", "radrelspacing", + -- "radopenspacing", "radclosespacing", "radpunctspacing", "radinnerspacing", + -- "radfracspacing", "radradspacing", "radmiddlespacing", "radaccentspacing", + -- -- + -- "middleordspacing", "middleopspacing", "middlebinspacing", "middlerelspacing", + -- "middleopenspacing", "middleclosespacing", "middlepunctspacing", "middleinnerspacing", + -- "middlefracspacing", "middleradspacing", "middlemiddlespacing", "middleaccentspacing", + -- -- + -- "accentordspacing", "accentopspacing", "accentbinspacing", "accentrelspacing", + -- "accentopenspacing", "accentclosespacing", "accentpunctspacing", "accentinnerspacing", + -- "accentfracspacing", "accentradspacing", "accentmiddlespacing", "accentaccentspacing", -- "normalreqno", -- @@ -597,8 +597,6 @@ return { -- "assumelongusagecs", -- - "Umathbottomaccent", "Umathtopaccent", "Umathbotaccent", - -- "righttolefthbox", "lefttorighthbox", "righttoleftvbox", "lefttorightvbox", "righttoleftvtop", "lefttorightvtop", "rtlhbox", "ltrhbox", "rtlvbox", "ltrvbox", "rtlvtop", "ltrvtop", "autodirhbox", "autodirvbox", "autodirvtop", diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index c3f5c3f1a..410d67a69 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -293,6 +293,7 @@ return { "boxsource", "boxtarget", "boxtotal", + "boxvadjust", "boxxmove", "boxxoffset", "boxymove", @@ -322,6 +323,7 @@ return { "dimexpression", "directlua", "dpack", + "dsplit", "edefcsname", "efcode", "endlocalcontrol", @@ -401,7 +403,9 @@ return { "ifarguments", "ifboolean", "ifchkdim", + "ifchkdimension", "ifchknum", + "ifchknumber", "ifcmpdim", "ifcmpnum", "ifcondition", @@ -517,7 +521,7 @@ return { "mathfenced", "mathfontcontrol", "mathforwardpenalties", - "mathfrac", + "mathfraction", "mathghost", "mathgluemode", "mathgroupingmode", @@ -527,7 +531,7 @@ return { "mathmiddle", "mathnolimitsmode", "mathpenaltiesmode", - "mathrad", + "mathradical", "mathrightclass", "mathrulesfam", "mathrulesmode", @@ -651,6 +655,7 @@ return { "tracingmath", "tracingnodes", "tracingpenalties", + "tsplit", "uleaders", "undent", "unexpandedloop", @@ -847,7 +852,6 @@ return { "divideby", "doublehyphendemerits", "dp", - "dsplit", "dump", "edef", "else", @@ -1078,7 +1082,6 @@ return { "tracingparagraphs", "tracingrestores", "tracingstats", - "tsplit", "uccode", "uchyph", "unboundary", diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 0b5d11035..d1ff492f2 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index ee5dbae6e..a28499680 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkxl/anch-pos.lmt b/tex/context/base/mkxl/anch-pos.lmt index 6488a2fd7..79a0da097 100644 --- a/tex/context/base/mkxl/anch-pos.lmt +++ b/tex/context/base/mkxl/anch-pos.lmt @@ -1727,7 +1727,7 @@ local function overlapping(one,two,overlappingmargin) -- hm, strings so this is end local function onsamepage(list,page) - for id in gmatch(list,"(, )") do + for id in gmatch(list,"([^,%s]+)") do local jpi = collected[id] if jpi then local p = jpi.p diff --git a/tex/context/base/mkxl/anch-pos.mkxl b/tex/context/base/mkxl/anch-pos.mkxl index ecb2091c6..a1e0cc354 100644 --- a/tex/context/base/mkxl/anch-pos.mkxl +++ b/tex/context/base/mkxl/anch-pos.mkxl @@ -508,10 +508,10 @@ %D positions being on the same page. %D %D \starttyping -%D \doifpositionsonsamepageelse{point a}{point b} +%D \doifpositionsonsamepageelse{point a,point b} %D {action when on same page} %D {action when not on same page} -%D \doifpositionsonthispageelse{point a}{point b} +%D \doifpositionsonthispageelse{point a,point b} %D {action when on this page} %D {action when not on this page} %D \stoptyping diff --git a/tex/context/base/mkxl/back-exp-imp-mth.lmt b/tex/context/base/mkxl/back-exp-imp-mth.lmt index a70ea8511..5f1554e65 100644 --- a/tex/context/base/mkxl/back-exp-imp-mth.lmt +++ b/tex/context/base/mkxl/back-exp-imp-mth.lmt @@ -167,7 +167,16 @@ do if data then local ndata = #data local roottg = root.tg - if roottg == "msubsup" then + if roottg == "mo" then + local s = specifications[root.fulltag] + local c = s.class + if c == "open" or c == "close" or c == "middle" then + root.attributes = { + maxsize = 1 + } + end + + elseif roottg == "msubsup" then -- kind of tricky: we have a diufferent order in display mode local nucleus, superscript, subscript if ndata > 3 then @@ -211,25 +220,33 @@ do -- end elseif roottg == "mfenced" then local s = specifications[root.fulltag] - local l, m, r = s.left, s.middle, s.right - if l then - l = utfchar(l) - end - if m then - local t = { } - for i=1,#m do - t[i] = utfchar(m[i]) + local o = s.operator + if o then + root.skip = "comment" + -- root.content = utfchar(o) -- use embedded for now + else + local l = s.left + local m = s.middle + local r = s.right + if l then + l = utfchar(l) end - m = concat(t) - end - if r then - r = utfchar(r) + if m then + local t = { } + for i=1,#m do + t[i] = utfchar(m[i]) + end + m = concat(t) + end + if r then + r = utfchar(r) + end + root.attributes = { + open = l, + separators = m, + close = r, + } end - root.attributes = { - open = l, - separators = m, - close = r, - } end if ndata == 0 then root.skip = "comment" -- get rid of weird artefacts @@ -628,8 +645,9 @@ do local specification = specifications[di.fulltag] local mode = specification and specification.mode == "display" and "block" or "inline" di.attributes = { - ["display"] = mode, - ["xmlns:m"] = mathmlns, + ["display"] = mode, + ["xmlns:m"] = mathmlns, + ["xmlns:math"] = mathmlns, } -- can be option if needed: if mode == "inline" then diff --git a/tex/context/base/mkxl/back-exp.lmt b/tex/context/base/mkxl/back-exp.lmt index 766f30169..622aae435 100644 --- a/tex/context/base/mkxl/back-exp.lmt +++ b/tex/context/base/mkxl/back-exp.lmt @@ -44,6 +44,7 @@ local formatters = string.formatters local todimen = number.todimen local replacetemplate = utilities.templates.replace local settings_to_array = utilities.parsers.settings_to_array +local settings_to_hash = utilities.parsers.settings_to_hash local addsuffix, joinfile, nameonly, basename, filesuffix = file.addsuffix, file.join, file.nameonly, file.basename, file.suffix @@ -1957,7 +1958,18 @@ local cssheadlink = [[ ]] - local function allusedstylesheets(cssfiles,files,path) +-- great, these suggested valuess attributes + +local mathmlheadscript = [[ + +]] + + local function allusedstylesheets(cssfiles,files,path,extra) local done = { } local result = { } local extras = { } @@ -1976,6 +1988,9 @@ local cssheadlink = [[ done[cssfile] = true end end + if extra then + extras[#extras+1] = extra + end return concat(result), concat(extras) end @@ -2278,11 +2293,16 @@ local htmltemplate = [[ if not c.special then local tg = c.tg local ns = c.ns + local at = c.at if ns == "m" then - if false then -- yes or no + -- should happen elsewhere + -- if false then -- yes or no c.ns = "" - c.at["xmlns:m"] = nil - end + at["xmlns:m"] = nil + if tg == "math" then + at["xmlns"] = mathmlns + end + -- end -- elseif tg == "a" then -- c.ns = "" else @@ -2296,7 +2316,6 @@ local htmltemplate = [[ comment = c.dt end end - local at = c.at local class = nil local label = nil if tg == "document" then @@ -2630,7 +2649,10 @@ local htmltemplate = [[ end end - local x_styles, h_styles = allusedstylesheets(cssfiles,files,"styles") + + local script = settings_to_hash(finetuning.option or "").mathjax and mathmlheadscript or nil + + local x_styles, h_styles = allusedstylesheets(cssfiles,files,"styles",script) local attach = backends.nodeinjections.attachfile @@ -2807,6 +2829,7 @@ implement { { "svgstyle" }, { "cssfile" }, { "file" }, + { "option" }, { "export" }, } } diff --git a/tex/context/base/mkxl/back-exp.mkxl b/tex/context/base/mkxl/back-exp.mkxl index ff0602aee..cafbb938f 100644 --- a/tex/context/base/mkxl/back-exp.mkxl +++ b/tex/context/base/mkxl/back-exp.mkxl @@ -327,6 +327,7 @@ svgstyle {\exportparameter\c!svgstyle}% cssfile {\exportparameter\c!cssfile}% file {\exportparameter\c!file}% + option {\exportparameter\c!option}% export {\backendparameter\c!export}% \relax} diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index c6fec2f2e..26913598c 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2023.01.05 17:43} +\newcontextversion{2023.01.15 13:53} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index b84e3b86d..38c897e6d 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2023.01.05 17:43} +\immutable\edef\contextversion{2023.01.15 13:53} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/core-uti.lmt b/tex/context/base/mkxl/core-uti.lmt index d533de5f3..8ce0cca4a 100644 --- a/tex/context/base/mkxl/core-uti.lmt +++ b/tex/context/base/mkxl/core-uti.lmt @@ -18,8 +18,8 @@ saves much runtime but at the cost of more memory usage.

--ldx]]-- local math = math +local next, type, tostring, tonumber, setmetatable, load = next, type, tostring, tonumber, setmetatable, load local format, match = string.format, string.match -local next, type, tostring, tonumber, setmetatable = next, type, tostring, tonumber, setmetatable local concat = table.concat local definetable = utilities.tables.definetable @@ -280,10 +280,12 @@ job.pack = true directives.register("job.pack",function(v) job.pack = v end) -local _save_, _load_, _others_ = { }, { }, { } -- registers timing +local savedfiles = { } +local loadedfiles = { } -- for now only timers +local otherfiles = { } -- for now only timers function job.save(filename) -- we could return a table but it can get pretty large - statistics.starttiming(_save_) + statistics.starttiming(savedfiles) local f = io.open(filename,'w') if f then f:write("local utilitydata = { }\n\n") @@ -318,7 +320,7 @@ function job.save(filename) -- we could return a table but it can get pretty lar f:write("return utilitydata") f:close() end - statistics.stoptiming(_save_) + statistics.stoptiming(savedfiles) end local function load(filename) @@ -350,11 +352,11 @@ local function load(filename) end function job.load(filename) - statistics.starttiming(_load_) + statistics.starttiming(loadedfiles) local utilitydata = load(filename) if utilitydata then local jobpacker = utilitydata.job.packed -unpacknumberdata(jobpacker.index) + unpacknumberdata(jobpacker.index) for i=1,#savelist do local list = savelist[i] local target = list[1] @@ -376,29 +378,43 @@ unpacknumberdata(jobpacker.index) initializer(utilitydata and accesstable(list[1],utilitydata) or nil) end end - statistics.stoptiming(_load_) + statistics.stoptiming(loadedfiles) end -function job.loadother(filename) - statistics.starttiming(_load_) - _others_[#_others_+1] = file.nameonly(filename) - local utilitydata = load(filename) - if utilitydata then - local jobpacker = utilitydata.job.packed - local unpacked = { } - for l=1,#savelist do - local list = savelist[l] - local target = list[1] - local result = accesstable(target,utilitydata) - local done = packers.unpack(result,jobpacker,true) - if done then - migratetable(target,result,unpacked) +local othercache = { } + +function job.loadother(filename,cache) + local unpacked = false + statistics.starttiming(loadedfiles) + filename = file.addsuffix(filename,"tuc") + if cache then + unpacked = othercache[filename] + end + if not unpacked then + -- so we can register the same name twice(in loading order) + otherfiles[#otherfiles+1] = file.nameonly(filename) + local utilitydata = load(filename) + if utilitydata then + local jobpacker = utilitydata.job.packed + unpacknumberdata(jobpacker.index) + unpacked = { } + for l=1,#savelist do + local list = savelist[l] + local target = list[1] + local result = accesstable(target,utilitydata) + local done = packers.unpack(result,jobpacker,true) + if done then + migratetable(target,result,unpacked) + end + end + unpacked.job.packed = nil -- nicer in inspecting + if cache then + cache[filename] = unpacked end end - unpacked.job.packed = nil -- nicer in inspecting - return unpacked end - statistics.stoptiming(_load_) + statistics.stoptiming(loadedfiles) + return unpacked end statistics.register("startup time", function() @@ -407,16 +423,16 @@ end) statistics.register("jobdata time",function() if enabled then - if #_others_ > 0 then - return format("%s seconds saving, %s seconds loading, other files: %s",statistics.elapsedtime(_save_),statistics.elapsedtime(_load_),concat(_others_," ")) + if #otherfiles > 0 then + return format("%s seconds saving, %s seconds loading, other files: %s",statistics.elapsedtime(savedfiles),statistics.elapsedtime(loadedfiles),concat(otherfiles," ")) else - return format("%s seconds saving, %s seconds loading",statistics.elapsedtime(_save_),statistics.elapsedtime(_load_)) + return format("%s seconds saving, %s seconds loading",statistics.elapsedtime(savedfiles),statistics.elapsedtime(loadedfiles)) end else - if #_others_ > 0 then - return format("nothing saved, %s seconds loading, other files: %s",statistics.elapsedtime(_load_),concat(_others_," ")) + if #otherfiles > 0 then + return format("nothing saved, %s seconds loading, other files: %s",statistics.elapsedtime(loadedfiles),concat(otherfiles," ")) else - return format("nothing saved, %s seconds loading",statistics.elapsedtime(_load_)) + return format("nothing saved, %s seconds loading",statistics.elapsedtime(loadedfiles)) end end end) diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index 6647bd061..6efae2ae1 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -1175,7 +1175,8 @@ % \def\v_font_identifier_class{\??fontinstanceclass\fontclass-\lastfontidentifier-\fontstyle-\fontsize} % no \fontface \def\font_basics_define_font_without_parameters#identifier#2% - {\c_font_feature_inheritance_mode\c_font_feature_inheritance_fontonly + {\relax % intercept lookahead, in case we scan for a number + \c_font_feature_inheritance_mode\c_font_feature_inheritance_fontonly \edef\lastfontidentifier{#identifier}% \let\v_font_size_relative\v_font_rscale_default \let\v_font_size_absolute\fontbody diff --git a/tex/context/base/mkxl/font-mat.mklx b/tex/context/base/mkxl/font-mat.mklx index 11917efe6..33a9f3623 100644 --- a/tex/context/base/mkxl/font-mat.mklx +++ b/tex/context/base/mkxl/font-mat.mklx @@ -512,7 +512,25 @@ \permanent\protected\def\mx {\ifmmode\scaledmathstyle\dimexpression\plusthousand*(\xtextface /\textface)\relax\fi} \permanent\protected\def\mxx{\ifmmode\scaledmathstyle\dimexpression\plusthousand*(\xxtextface/\textface)\relax\fi} -\permanent\protected\def\setmscale#1{\ifmmode\scaledmathstyle\numericscale#1\relax\fi} +% permanent\protected\def\setmscale#1{\ifmmode\scaledmathstyle\numericscale#1\relax\fi} + +\installcorenamespace{mscaled} + +\mutable\def\mathscalefactor{0.7} % 1/sqrt(2} = 0.70710678118655 + +\newinteger\c_math_m_scaled \c_math_m_scaled\plusthousand + +\permanent\protected\def\setmscale#1% + {\ifmmode + \iftok{#1}{-}% + \c_math_m_scaled\numexpr(\numericscale\mathscalefactor)*\c_math_m_scaled/\plusthousand\relax + \orelse\iftok{#1}{=}% + \c_math_m_scaled\plusthousand + \else + \c_math_m_scaled\numericscale#1\relax + \fi + \scaledmathstyle\c_math_m_scaled + \fi} %D This is nasty, as the engine only stores the last set family parameters (per style) which %D in our case can be bold. diff --git a/tex/context/base/mkxl/lang-ini.mkxl b/tex/context/base/mkxl/lang-ini.mkxl index 93b991e44..1f4b741c2 100644 --- a/tex/context/base/mkxl/lang-ini.mkxl +++ b/tex/context/base/mkxl/lang-ini.mkxl @@ -210,7 +210,7 @@ \fi} \def\lang_basics_install_indeed#1#2% - {\ifcstok{\specificlanguageparameter{#1}\c!command}\v!no\orelse\ifcsname#1\endcsname\else + {\ifcstok{\specificlanguageparameter{#1}\c!define}\v!no\orelse\ifcsname#1\endcsname\else \frozen\instance\protected\defcsname#1\endcsname{\lang_basics_set_current[#2]}% \fi} diff --git a/tex/context/base/mkxl/lpdf-grp.lmt b/tex/context/base/mkxl/lpdf-grp.lmt index 48853ab83..585d11459 100644 --- a/tex/context/base/mkxl/lpdf-grp.lmt +++ b/tex/context/base/mkxl/lpdf-grp.lmt @@ -177,10 +177,12 @@ do return wrapimage(image) end - local zlibcompress = xzip.compress - local lpegmatch = lpeg.match - local compresslevel = 3 - local pattern = lpeg.Cs((lpeg.patterns.space/"" + lpeg.patterns.hextobyte)^0) + -- local lpegmatch = lpeg.match + -- local pattern = lpeg.Cs((lpeg.patterns.space/"" + lpeg.patterns.hextobyte)^0) + + local zlibcompress = xzip.compress + local hextocharacters = string.hextocharacters + local compresslevel = 3 methods.png = function(t) -- encoding is ascii hex, no checking here @@ -190,20 +192,36 @@ do if xresolution == 0 or yresolution == 0 or data == "" then return -- fatal error end + data = hextocharacters(data) + if not data then + return + end local colorspace = t.colorspace local colordepth = 8 local colors = 1 +-- if colorspace ~= "rgb" and colorspace ~= "gray" then +-- -- not that efficient but ok +-- local d = gsub(t.data,"[^0-9a-f]","") +-- local b = round(#d / (xresolution * yresolution)) +-- if b == 2 then +-- colorspace = "gray" +-- colors = 1 +-- elseif b == 6 then +-- colorspace = "rgb" +-- colors = 3 +-- elseif b == 8 then +-- return -- for now, todo: convert +-- end +-- end if colorspace ~= "rgb" and colorspace ~= "gray" then - -- not that efficient but ok - local d = gsub(t.data,"[^0-9a-f]","") - local b = round(#d / (xresolution * yresolution)) - if b == 2 then + local b = round(#data / (xresolution * yresolution)) + if b == 1 then colorspace = "gray" colors = 1 - elseif b == 6 then + elseif b == 3 then colorspace = "rgb" colors = 3 - elseif b == 8 then + elseif b == 4 then return -- for now, todo: convert end end @@ -221,7 +239,8 @@ do elseif height == 0 then height = width * yresolution / xresolution end - data = zlibcompress(lpegmatch(pattern,data),compresslevel) + -- data = zlibcompress(lpegmatch(pattern,data),compresslevel) + data = zlibcompress(data,compresslevel) local xobject = pdfdictionary { Type = pdfconstant("XObject"), Subtype = pdfconstant("Image"), diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index 62645ba54..adfb5712c 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -2742,9 +2742,21 @@ do local nps = fonts.helpers.newprivateslot local list = { - { 0x0302, nps("delimited right hat"), nps("delimited ghost hat") }, - { 0x0303, nps("delimited right tilde"), nps("delimited ghost tilde") }, - { 0x030C, nps("delimited right check"), nps("delimited ghost check") }, + -- { 0x0300, nps("delimited right grave"), nps("delimited ghost grave") }, + { 0x0308, nps("delimited right ddot"), nps("delimited ghost ddot") }, + { 0x0304, nps("delimited right bar"), nps("delimited ghost bar") }, + -- { 0x0301, nps("delimited right acute"), nps("delimited ghost acute") }, + { 0x0302, nps("delimited right hat"), nps("delimited ghost hat") }, + { 0x030C, nps("delimited right check"), nps("delimited ghost check") }, + { 0x0306, nps("delimited right breve"), nps("delimited ghost breve") }, + { 0x0307, nps("delimited right dot"), nps("delimited ghost dot") }, + { 0x030A, nps("delimited right ring"), nps("delimited ghost ring") }, + { 0x0303, nps("delimited right tilde"), nps("delimited ghost tilde") }, + { 0x20DB, nps("delimited right dddot"), nps("delimited ghost dddot") }, + { 0x2020, nps("delimited right dagger"), nps("delimited ghost dagger") }, + { 0x2021, nps("delimited right ddagger"), nps("delimited ghost ddagger") }, + { 0x2217, nps("delimited right ast"), nps("delimited ghost ast") }, + { 0x22C6, nps("delimited right star"), nps("delimited ghost star") }, } function mathtweaks.addfourier(target,original,parameters) diff --git a/tex/context/base/mkxl/math-dld.mklx b/tex/context/base/mkxl/math-dld.mklx index 33849e723..66100e0ac 100644 --- a/tex/context/base/mkxl/math-dld.mklx +++ b/tex/context/base/mkxl/math-dld.mklx @@ -43,7 +43,9 @@ \c!rightmargin=\zeropoint] \appendtoks - \frozen\protected\instance\edefcsname\currentmathdelimited\endcsname{\math_delimited_handle{\currentmathdelimited}} + \ifcstok{\mathdelimitedparameter\c!rightmargin}\v!no\else + \frozen\protected\instance\edefcsname\currentmathdelimited\endcsname{\math_delimited_handle{\currentmathdelimited}} + \fi \to \everydefinemathdelimited \mutable\lettonothing\currentmathdelimited @@ -86,11 +88,108 @@ {\popcolor#body}% \fi} -\integerdef\delimitedrighthatuc \privatecharactercode{delimited right hat} -\integerdef\delimitedrighttildeuc \privatecharactercode{delimited right tilde} -\integerdef\delimitedrightcheckuc \privatecharactercode{delimited right check} + +%integerdef\delimitedrightgraveuc \privatecharactercode{delimited right grave} +\integerdef\delimitedrightddotuc \privatecharactercode{delimited right ddot} +\integerdef\delimitedrightbaruc \privatecharactercode{delimited right bar} +%integerdef\delimitedrightacuteuc \privatecharactercode{delimited right acute} +\integerdef\delimitedrighthatuc \privatecharactercode{delimited right hat} +\integerdef\delimitedrightcheckuc \privatecharactercode{delimited right check} +\integerdef\delimitedrightbreveuc \privatecharactercode{delimited right breve} +\integerdef\delimitedrightdotuc \privatecharactercode{delimited right dot} +\integerdef\delimitedrightringuc \privatecharactercode{delimited right ring} +\integerdef\delimitedrighttildeuc \privatecharactercode{delimited right tilde} +\integerdef\delimitedrightdddotuc \privatecharactercode{delimited right dddot} +\integerdef\delimitedrightdaggeruc \privatecharactercode{delimited right dagger} +\integerdef\delimitedrightddaggeruc \privatecharactercode{delimited right ddagger} +\integerdef\delimitedrightastuc \privatecharactercode{delimited right ast} +\integerdef\delimitedrightstaruc \privatecharactercode{delimited right star} + +% \integerdef\delimitedrighthatuc \p rivatecharactercode{delimited right hat} +% \integerdef\delimitedrighttildeuc \privatecharactercode{delimited right tilde} +% \integerdef\delimitedrightcheckuc \privatecharactercode{delimited right check} % todo: some more .. are the offsets okay? +% breve and acute does not make sense + +\definemathdelimited + [marked] + [\c!command=\v!no, + \c!topoffset=.2\exheight] + +\definemathdelimited + [ddotmarked] + [marked] + [\c!right=\delimitedrightddotuc] + +\definemathdelimited + [barmarked] + [marked] + [\c!right=\delimitedrightbaruc] + +\definemathdelimited + [hatmarked] + [marked] + [\c!right=\delimitedrighthatuc] + +\definemathdelimited + [checkmarked] + [marked] + [\c!right=\delimitedrightcheckuc] + +\definemathdelimited + [brevemarked] + [marked] + [\c!right=\delimitedrightbreveuc] + +\definemathdelimited + [dotmarked] + [marked] + [\c!right=\delimitedrightdotuc] + +\definemathdelimited + [ringmarked] + [marked] + [\c!right=\delimitedrightringuc] + +\definemathdelimited + [tildemarked] + [marked] + [\c!right=\delimitedrighttildeuc] + +\definemathdelimited + [dddotmarked] + [marked] + [\c!right=\delimitedrightdddotuc] + +% The following ones are +% not really belonging here, +% but convenient + +\definemathdelimited + [daggermarked] + [marked] + [\c!size=1, + \c!right=\delimitedrightdaggeruc] + +\definemathdelimited + [ddaggermarked] + [marked] + [\c!size=1, + \c!right=\delimitedrightddaggeruc] + +\definemathdelimited + [astmarked] + [\c!size=1, + \c!right=\delimitedrightastuc] + +\definemathdelimited + [starmarked] + [marked] + [\c!size=1, + \c!right=\delimitedrightstaruc] + +% More contextual \definemathdelimited [fourier] diff --git a/tex/context/base/mkxl/math-fen.mkxl b/tex/context/base/mkxl/math-fen.mkxl index 806581b34..1656f4b4a 100644 --- a/tex/context/base/mkxl/math-fen.mkxl +++ b/tex/context/base/mkxl/math-fen.mkxl @@ -154,7 +154,7 @@ \newinteger \c_math_fence_check \protected\def\math_fenced_common#1#2#3#4% \Uwhatever class symbol source - {\c_math_fenced_class\mathfenceparameter#2\relax + {\c_math_fenced_class\math_class_by_parameter\mathfenceparameter#2% \math_fenced_check_size_mismatch % we need to catch an unbalanced \F as we are sequential \ifconditional\c_math_fenced_sized \orelse\ifconditional\c_math_fenced_level_mode @@ -184,9 +184,9 @@ \Uvextensible \else #1% \Uleft \Umiddle \Uleft - \ifx#1\Umiddle - nooverflow % - \fi + \ifx#1\Umiddle + nooverflow % + \fi \fi \orelse\ifx\p_factor\v!auto \ifconditional\c_math_fenced_level_mode @@ -213,7 +213,7 @@ \orelse\ifempty\p_mathclass \c_math_fenced_class \else - \p_mathclass + \mathcodechecked\p_mathclass \fi \s!source \numexpr\namedboxanchor{\mathfenceparameter#4}\relax @@ -339,7 +339,7 @@ % \definemathfence [tupdownarrows] [text] [\c!left="2191,\c!right="2193] \protected\def\math_fenced_horizontal_common#1#2#3#4% \Uwhatever class symbol source - {\c_math_fenced_class\mathfenceparameter#2\relax + {\c_math_fenced_class\math_class_by_parameter\mathfenceparameter#2\relax \edef\p_fence{#3}% #1% \Uleft \Umiddle \Uleft \usedcolorparameterattributes{\mathfenceparameter\c!color}% diff --git a/tex/context/base/mkxl/math-frc.mkxl b/tex/context/base/mkxl/math-frc.mkxl index 05e3957c7..f1a4de236 100644 --- a/tex/context/base/mkxl/math-frc.mkxl +++ b/tex/context/base/mkxl/math-frc.mkxl @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% todo : mathclass=\mathnothingcode, % todo also accept string + \writestatus{loading}{ConTeXt Math Macros / Fractions} \unprotect @@ -189,10 +191,6 @@ \let\math_fraction_margin_kern\relax -%D Because the fraction nodes uses the superscript and subscript for numerator and -%D denomerator so we wrap in a \type {\mathfrac}. Because with \type {\over} one -%D normally wraps the lot it goes unnoticed there. -%D %D \starttyping %D $\Uover{2}{3} ^4$ % double script error but no longer because we use the prescripts %D ${\over{2}{3}}^4$ % no issue anyway because we wrap in {} (goes unnoticed) @@ -210,7 +208,7 @@ % \edef\p_math_fraction_fences{\mathfractionparameter\c!fences}% % - \mathatom \s!class \mathfractionparameter\c!mathclass\bgroup + \math_atom_by_parameter\mathfractionparameter\bgroup \ifempty\p_math_fraction_fences \else \math_fenced_fenced_start\p_math_fraction_fences \fi @@ -326,22 +324,36 @@ \else \dimexpr\p_thickness\relax \fi - \s!class \numexpr\mathfractionparameter\c!mathclass\relax + \s!class \math_class_by_parameter\mathfractionparameter\c!mathclass \s!vfactor \numexpr\mathfractionparameter\c!vfactor\relax \s!source \number\namedboxanchor{\mathfractionparameter\c!source}} +\installcorenamespace{mathalignsimple} + +\defcsname\??mathalignsimple\v!right \endcsname#1{#1\hfill} +\defcsname\??mathalignsimple\v!flushleft \endcsname#1{#1\hfill} +\defcsname\??mathalignsimple\v!left \endcsname#1{\hfill#1} +\defcsname\??mathalignsimple\v!flushright\endcsname#1{\hfill#1} +\defcsname\??mathalignsimple\v!middle \endcsname#1{\hfill#1\hfill} + +\protected\def\math_frac_aligned_top{\begincsname\??mathalignsimple\mathfractionparameter\c!topalign \endcsname} +\protected\def\math_frac_aligned_bot{\begincsname\??mathalignsimple\mathfractionparameter\c!bottomalign\endcsname} + +% \protected\def\math_frac_aligned_top{\begincsname\??mathalignsimple\mathfractionparameter\c!align\endcsname} +% \protected\def\math_frac_aligned_bot{\begincsname\??mathalignsimple\mathfractionparameter\c!align\endcsname} + \protected\defcsname\??mathfractionalternative\v!inner\endcsname#1#2% {%\beginmathgroup \math_frac_command_u {\dousecolorparameter{\mathfractionparameter\c!topcolor}% \math_fraction_margin_kern \usemathstyleparameter\mathfractionparameter\c!mathnumeratorstyle - \m_fractions_strut_top#1% + \m_fractions_strut_top\math_frac_aligned_top{#1}% \math_fraction_margin_kern}% {\dousecolorparameter{\mathfractionparameter\c!bottomcolor}% \math_fraction_margin_kern \usemathstyleparameter\mathfractionparameter\c!mathdenominatorstyle - \m_fractions_strut_bot#2% + \m_fractions_strut_bot\math_frac_aligned_bot{#2}% \math_fraction_margin_kern}% %\endmathgroup \math_frac_wrapup} @@ -352,11 +364,11 @@ \math_frac_command_u {\dousecolorparameter{\mathfractionparameter\c!topcolor}% \math_fraction_margin_kern - \m_fractions_strut_top#1% + \m_fractions_strut_top\math_frac_aligned_top{#1}% \math_fraction_margin_kern}% {\dousecolorparameter{\mathfractionparameter\c!bottomcolor}% \math_fraction_margin_kern - \m_fractions_strut_bot#2% + \m_fractions_strut_bot\math_frac_aligned_bot{#2}% \math_fraction_margin_kern}% \endmathgroup \math_frac_wrapup} @@ -368,12 +380,12 @@ {\dousecolorparameter{\mathfractionparameter\c!topcolor}% \math_fraction_margin_kern \usemathstyleparameter\mathfractionparameter\c!mathnumeratorstyle - \m_fractions_strut_top#1% + \m_fractions_strut_top\math_frac_aligned_top{#1}% \math_fraction_margin_kern}% {\dousecolorparameter{\mathfractionparameter\c!bottomcolor}% \math_fraction_margin_kern \usemathstyleparameter\mathfractionparameter\c!mathdenominatorstyle - \m_fractions_strut_bot#2% + \m_fractions_strut_bot\math_frac_aligned_bot{#2}% \math_fraction_margin_kern}% \endmathgroup \math_frac_wrapup} @@ -506,7 +518,7 @@ \definemathfraction[d:frac] [\c!alternative=\v!inner,\c!mathstyle=\s!cramped] \definemathfraction[d:tfrac][\c!alternative=\v!inner,\c!mathstyle={\s!cramped,\s!script}] -\definemathfraction[d:sfrac][\c!alternative=\v!both,\c!mathstyle={\s!cramped,\s!scriptscript}] +\definemathfraction[d:sfrac][\c!alternative=\v!inner,\c!mathstyle={\s!cramped,\s!scriptscript}] \definemathfraction[d:dfrac][\c!alternative=\v!both,\c!mathstyle=\s!display] %D \protected\def\ShowMathFractions#1#2% @@ -525,32 +537,36 @@ %D \ShowMathFractions{1}{b}\par %D \blank +% % There is no real need to support ams styling so this is now obsolete: + \permanent\protected\def\frac {\csname\inlineordisplaymath id:frac\endcsname} \permanent\protected\def\tfrac{\csname\inlineordisplaymath id:tfrac\endcsname} \permanent\protected\def\sfrac{\csname\inlineordisplaymath id:sfrac\endcsname} \permanent\protected\def\dfrac{\csname\inlineordisplaymath id:dfrac\endcsname} -\definemathfraction[ams] [\c!strut=\v!no,\c!alternative=\v!outer] -\definemathfraction[i:ams:frac][ams][\c!mathstyle={\s!cramped,\s!text}] -\definemathfraction[d:ams:frac][ams][\c!mathstyle={\s!cramped,\s!display}] - -\permanent\protected\def\ctxfrac{\csname\inlineordisplaymath id:frac\endcsname} -\permanent\protected\def\amsfrac{\csname\inlineordisplaymath id:ams:frac\endcsname} - -\appendtoks - \doifelse{\mathematicsparameter\c!fractions}{ams}% - {\enforced\let\frac\amsfrac}% - {\enforced\let\frac\ctxfrac}% -\to \everysetupmathematics +% \definemathfraction[ams] [\c!strut=\v!no,\c!alternative=\v!outer] +% \definemathfraction[i:ams:frac][ams][\c!mathstyle={\s!cramped,\s!text}] +% \definemathfraction[d:ams:frac][ams][\c!mathstyle={\s!cramped,\s!display}] +% +% \permanent\protected\def\ctxfrac{\csname\inlineordisplaymath id:frac\endcsname} +% \permanent\protected\def\amsfrac{\csname\inlineordisplaymath id:ams:frac\endcsname} +% +% \appendtoks +% \doifelse{\mathematicsparameter\c!fractions}{ams}% +% {\enforced\let\frac\amsfrac}% +% {\enforced\let\frac\ctxfrac}% +% \to \everysetupmathematics +% % Also gone: +% % \definemathfraction[ddfrac][\c!mathstyle=\s!display] % \definemathfraction[ttfrac][\c!mathstyle=\s!text] % \definemathfraction[ssfrac][\c!mathstyle=\s!script] - +% % \protected\def\binom #1#2{{\Ustack {{#1}\normalabovewithdelims()\zeropoint{#2}}}} % \protected\def\dbinom#1#2{{\displaystyle{{#1}\normalabovewithdelims()\zeropoint{#2}}}} % \protected\def\tbinom#1#2{{\textstyle {{#1}\normalabovewithdelims()\zeropoint{#2}}}} - +% % \definemathfraction % [binom] % [\c!alternative=\v!outer, @@ -622,21 +638,37 @@ %D %D \getbuffer -\permanent\protected\def\cfrac - {\doifelsenextoptionalcs\math_cfrac_yes\math_cfrac_nop} +% % we forget about this ams one ... no one uses it anyway +% +% \permanent\protected\def\cfrac +% {\doifelsenextoptionalcs\math_cfrac_yes\math_cfrac_nop} +% +% \def\math_cfrac_nop {\math_cfrac_indeed[cc]} +% \def\math_cfrac_yes[#1]{\math_cfrac_indeed[#1cc]} +% +% \def\math_cfrac_indeed[#1#2#3]#4#5% +% {{\displaystyle +% \frac +% {\strut +% \ifx r#1\hfill\fi#4\ifx l#1\hfill\fi}% +% {\ifx r#2\hfill\fi#5\ifx l#2\hfill\fi}% +% \ifzeropt\nulldelimiterspace\else +% \kern-\nulldelimiterspace +% \fi}} +% +% instead we predefine one: -\def\math_cfrac_nop {\math_cfrac_indeed[cc]} -\def\math_cfrac_yes[#1]{\math_cfrac_indeed[#1cc]} +\definemathfraction + [cfrac] + [\c!mathstyle=\v!text] -\def\math_cfrac_indeed[#1#2#3]#4#5% - {{\displaystyle - \frac - {\strut - \ifx r#1\hfill\fi#4\ifx l#1\hfill\fi}% - {\ifx r#2\hfill\fi#5\ifx l#2\hfill\fi}% - \ifzeropt\nulldelimiterspace\else - \kern-\nulldelimiterspace - \fi}} +% so users can do this: +% +% \setupmathfraction +% [cfrac] +% [topalign=flushright] +% +% or define an child instance that presets it. %D \macros %D {splitfrac, splitdfrac} @@ -660,14 +692,32 @@ %D \stopbuffer %D %D \typebuffer \getbuffer -%D -%D These macros are based on Michael J.~Downes posting on comp.text.tex on 2001/12/06 -%D but adapted a bit. -%D -%D Does anyone actually use this kind of stuff? -\permanent\protected\def\splitfrac #1#2{{\textstyle {{\textstyle#1\quad\hfill}\normalabove\zeropoint{\textstyle\hfill\quad\mathstrut#2}}}} -\permanent\protected\def\splitdfrac#1#2{{\displaystyle{{ #1\quad\hfill}\normalabove\zeropoint{ \hfill\quad\mathstrut#2}}}} +\defcsname\??mathalignsimple\v!split:\v!flushleft\endcsname#1% + {#1% + \ifchkdim\mathfractionparameter\c!distance\or\hskip\lastchkdim\fi + \hfill} + +\defcsname\??mathalignsimple\v!split:\v!flushright\endcsname#1% + {\hfill + \ifchkdim\mathfractionparameter\c!distance\or\hskip\lastchkdim\fi + \mathatom \s!class \mathordcode \s!unroll {}% prevents +/- seen as sign, unroll prevents empty box + #1} + +\definemathfraction + [splitfrac] + [\c!mathnumeratorstyle=\v!text, + \c!mathdenominatorstyle=\v!text, + \c!topalign=\v!split:\v!flushleft, + \c!bottomalign=\v!split:\v!flushright, + \c!distance=\emwidth, + \c!rule=\v!no] + +\definemathfraction + [splitdfrac] + [splitfrac] + [\c!mathnumeratorstyle=\v!display, + \c!mathdenominatorstyle=\v!display] %D More fracking (for Alan): diff --git a/tex/context/base/mkxl/math-ini.lmt b/tex/context/base/mkxl/math-ini.lmt index 81138b2e2..fb98ce35b 100644 --- a/tex/context/base/mkxl/math-ini.lmt +++ b/tex/context/base/mkxl/math-ini.lmt @@ -529,66 +529,66 @@ do return mset, dset end - local function report(class,engine,family,unicode,name) + local function report(class,family,unicode,name) local nametype = type(name) if nametype == "string" then - report_math("class %a, engine %a, family %a, char %C, name %a",class,engine,family,unicode,name) + report_math("class %a, family %a, char %C, name %a",class,family,unicode,name) elseif nametype == "number" then - report_math("class %a, engine %a, family %a, char %C, number %U",class,engine,family,unicode,name) + report_math("class %a, family %a, char %C, number %U",class,family,unicode,name) else - report_math("class %a, engine %a, family %a, char %C",class,engine,family,unicode) + report_math("class %a, family %a, char %C",class,family,unicode) end end - local f_accent = formatters[ [[\defUmathtopaccent \%s{%X}{%X}{%X}]] ] - local f_fixedtopaccent = formatters[ [[\defUmathfixedtopaccent \%s{%X}{%X}{%X}]] ] - local f_fixedbottomaccent = formatters[ [[\defUmathfixedbottomaccent \%s{%X}{%X}{%X}]] ] - local f_topaccent = formatters[ [[\defUmathtopaccent \%s{%X}{%X}{%X}]] ] - local f_bottomaccent = formatters[ [[\defUmathbottomaccent \%s{%X}{%X}{%X}]] ] - local f_over = formatters[ [[\defUdelimiterover \%s{%X}{%X}{%X}]] ] - local f_under = formatters[ [[\defUdelimiterunder\%s{%X}{%X}{%X}]] ] - local f_fence = formatters[ [[\defUdelimiter \%s{%X}{%X}{%X}]] ] - local f_delimiter = formatters[ [[\defUdelimiter \%s{%X}{%X}{%X}]] ] - local f_radical = formatters[ [[\defUradical \%s{%X}{%X}]] ] - local f_root = formatters[ [[\defUroot \%s{%X}{%X}]] ] - local f_char = formatters[ [[\defUmathchar \%s{%X}{%X}{%X}]] ] + -- local f_accent = formatters[ [[\defUmathtopaccent \%s{%X}{%X}{%X}]] ] + -- local f_fixedtopaccent = formatters[ [[\defUmathfixedtopaccent \%s{%X}{%X}{%X}]] ] + -- local f_fixedbottomaccent = formatters[ [[\defUmathfixedbottomaccent \%s{%X}{%X}{%X}]] ] + -- local f_topaccent = formatters[ [[\defUmathtopaccent \%s{%X}{%X}{%X}]] ] + -- local f_bottomaccent = formatters[ [[\defUmathbottomaccent \%s{%X}{%X}{%X}]] ] + -- local f_over = formatters[ [[\defUdelimiterover \%s{%X}{%X}{%X}]] ] + -- local f_under = formatters[ [[\defUdelimiterunder\%s{%X}{%X}{%X}]] ] + -- local f_fence = formatters[ [[\defUdelimiter \%s{%X}{%X}{%X}]] ] + -- local f_delimiter = formatters[ [[\defUdelimiter \%s{%X}{%X}{%X}]] ] + -- local f_radical = formatters[ [[\defUradical \%s{%X}{%X}]] ] + -- local f_root = formatters[ [[\defUroot \%s{%X}{%X}]] ] + -- local f_char = formatters[ [[\defUmathchar \%s{%X}{%X}{%X}]] ] local texmathchardef = tex.mathchardef - local setmathsymbol = function(name,class,engine,family,slot,stretch,group) -- hex is nicer for tracing + local setmathsymbol = function(name,class,family,slot,stretch,group) -- hex is nicer for tracing if class == accent_class then - ctx_sprint(f_topaccent(name,0,family,slot)) + -- ctx_sprint(f_accent(name,0,family,slot)) elseif class == topaccent_class then - -- only widegrave widehat widetilde : still needed? - ctx_sprint((stretch and f_topaccent or f_fixedtopaccent)(name,0,family,slot)) + -- ctx_sprint((stretch and f_topaccent or f_fixedtopaccent)(name,0,family,slot)) elseif class == bottomaccent_class then - ctx_sprint((stretch and f_bottomaccent or f_fixedbottomaccent)(name,0,family,slot)) - elseif class == over_class then - ctx_sprint(f_over(name,0,family,slot)) - elseif class == under_class then - ctx_sprint(f_under(name,0,family,slot)) + -- ctx_sprint((stretch and f_bottomaccent or f_fixedbottomaccent)(name,0,family,slot)) + elseif class == over_class then -- only in mkiv + -- ctx_sprint(f_over(name,0,family,slot)) + elseif class == under_class then -- only in mkiv + -- ctx_sprint(f_under(name,0,family,slot)) elseif class == open_class or class == close_class or class == middle_class then - setdelcode("global",slot,family,slot,0,0) - ctx_sprint(f_fence(name,engine,family,slot)) - elseif class == delimiter_class then - setdelcode("global",slot,family,slot,0,0) - ctx_sprint(f_delimiter(name,0,family,slot)) - elseif class == radical_class then - ctx_sprint(f_radical(name,family,slot)) - elseif class == root_class then - ctx_sprint(f_root(name,family,slot)) + setdelcode("global",slot,family,slot,0,0) -- can go + -- ctx_sprint(f_fence(name,class,family,slot)) + -- ctx_sprint(f_char(name,class,family,slot)) + texmathchardef(name,class,family,slot,"permanent") + elseif class == delimiter_class then -- open close or middle (bars) + setdelcode("global",slot,family,slot,0,0) -- can go + -- ctx_sprint(f_delimiter(name,0,family,slot)) + -- ctx_sprint(f_char(name,0,family,slot)) + texmathchardef(name,0,family,slot,"permanent") + elseif class == radical_class then -- only in mkiv + -- ctx_sprint(f_radical(name,family,slot)) + elseif class == root_class then -- only in mkiv + -- ctx_sprint(f_root(name,family,slot)) elseif texmathchardef then if group then group = groupnames[group] or 0 if group ~= 0 then - texmathchardef(name,engine,family,slot,"permanent",0x1,group,slot) + texmathchardef(name,class,family,slot,"permanent",0x1,group,slot) return end end - texmathchardef(name,engine,family,slot,"permanent") - else - -- beware, open/close and other specials should not end up here - ctx_sprint(f_char(name,engine,family,slot)) + texmathchardef(name,class,family,slot,"permanent") end end @@ -620,7 +620,7 @@ do if class then local engine = toengineclass(class) if trace_defining then - report(class,engine,family,unicode,symbol) + report(engine,family,unicode,symbol) end mset, dset = setmathcharacter(engine,family,unicode,symbol,mset,dset,group) end @@ -652,7 +652,7 @@ do class = classes[class] or ordinary_class local engine = toengineclass(class) if trace_defining then - report(class,engine,family,unicode) + report(engine,family,unicode) end mset, dset = setmathcharacter(engine,family,unicode,unicode,mset,dset,group) done = true @@ -673,13 +673,13 @@ do local engine = toengineclass(class) if name then if trace_defining then - report(class,engine,family,unicode,name) + report(engine,family,unicode,name) end - setmathsymbol(name,class,engine,family,unicode,stretch,group) + setmathsymbol(name,engine,family,unicode,stretch,group) else name = (class == classes.ordinary or class == classes.digit) and character.adobename -- bad if name and trace_defining then - report(class,engine,family,unicode,name) + report(engine,family,unicode,name) end end if not done then @@ -698,7 +698,7 @@ do local engine = toengineclass(class) if name == false then if trace_defining then - report(class,engine,family,unicode,name) + report(engine,family,unicode,name) end mset, dset = setmathcharacter(engine,family,unicode,unicode,mset,dset,group) else @@ -707,12 +707,12 @@ do -- end if name then if trace_defining then - report(class,engine,family,unicode,name) + report(engine,family,unicode,name) end - setmathsymbol(name,class,engine,family,unicode,stretch,group) + setmathsymbol(name,engine,family,unicode,stretch,group) else if trace_defining then - report(class,engine,family,unicode,character.adobename) + report(engine,family,unicode,character.adobename) end end mset, dset = setmathcharacter(engine,family,unicode,unicode,mset,dset,group) @@ -720,7 +720,7 @@ do elseif class ~= ordinary_class then local engine = toengineclass(class) if trace_defining then - report(class,engine,family,unicode,character.adobename) + report(engine,family,unicode,character.adobename) end mset, dset = setmathcharacter(engine,family,unicode,unicode,mset,dset,group) end diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index b007a64d1..dfa8a18ef 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -55,6 +55,30 @@ \newdimension\mathstrutdp \newinteger \mathnestinglevel +% For now: + +%protected\def\Umathaccent_top {\Umathaccent top } +%protected\def\Umathaccent_bottom {\Umathaccent bottom } +%protected\def\Umathaccent_top_fixed {\Umathaccent top fixed } +%protected\def\Umathaccent_bottom_fixed{\Umathaccent bottom fixed } + +%permanent\protected\def\defUmathfixedtopaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathaccent_top_fixed "#2 "#3 "#4 }} +%permanent\protected\def\defUmathfixedbottomaccent#1#2#3#4{\global\immutable\protected\def#1{\Umathaccent_bottom_fixed "#2 "#3 "#4 }} +%permanent\protected\def\defUmathtopaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathaccent_top "#2 "#3 "#4 }} +%permanent\protected\def\defUmathbottomaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathaccent_bottom "#2 "#3 "#4 }} + +%permanent\protected\def\defUmathchar #1#2#3#4{\global\immutable\Umathchardef #1 "#2 "#3 "#4 } +%permanent\protected\def\defUdelimiter #1#2#3#4{\global\immutable\protected\def#1{\Udelimiter "#2 "#3 "#4 }} +%permanent\protected\def\defUdelimiter #1#2#3#4{\global\immutable\Umathchardef #1 "#2 "#3 "#4 } + +%permanent\protected\def\defUradical #1#2#3{\global\immutable\protected\def#1{\Uradical "#2 "#3 }} +%permanent\protected\def\defUroot #1#2#3{\global\immutable\protected\def#1{\Uroot "#2 "#3 }} + +%permanent\protected\def\defUdelimiterover #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterover "#2 "#3 }} % radicals +%permanent\protected\def\defUdelimiterunder #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterunder "#2 "#3 }} % radicals + +% So: + \registerctxluafile{math-ini}{autosuffix} \registerctxluafile{math-dim}{autosuffix} %registerctxluafile{math-act}{autosuffix} @@ -295,164 +319,164 @@ \untraced\permanent\protected\def\prerelpenalty {\setmathprepenalty \mathrelationcode} \popoverloadmode -%D These verbose commands are obsolete because there are plenty more classes in -%D \LMTX\ than in \MKIV. - -\permanent\protected\def\ordordspacing {\setmathspacing \mathordinarycode \mathordinarycode } -\permanent\protected\def\ordopspacing {\setmathspacing \mathordinarycode \mathoperatorcode } -\permanent\protected\def\ordbinspacing {\setmathspacing \mathordinarycode \mathbinarycode } -\permanent\protected\def\ordrelspacing {\setmathspacing \mathordinarycode \mathrelationcode } -\permanent\protected\def\ordopenspacing {\setmathspacing \mathordinarycode \mathopencode } -\permanent\protected\def\ordclosespacing {\setmathspacing \mathordinarycode \mathclosecode } -\permanent\protected\def\ordpunctspacing {\setmathspacing \mathordinarycode \mathpunctuationcode} -%permanent\protected\def\ordinnerspacing {\setmathspacing \mathordinarycode \mathinnercode } -%permanent\protected\def\ordfracspacing {\setmathspacing \mathordinarycode \mathfractioncode } -%permanent\protected\def\ordradspacing {\setmathspacing \mathordinarycode \mathradicalcode } -\permanent\protected\def\ordmiddlespacing {\setmathspacing \mathordinarycode \mathmiddlecode } -%permanent\protected\def\ordaccentspacing {\setmathspacing \mathordinarycode \mathaccentcode } - -\permanent\protected\def\opordspacing {\setmathspacing \mathoperatorcode \mathordinarycode } -\permanent\protected\def\opopspacing {\setmathspacing \mathoperatorcode \mathoperatorcode } -\permanent\protected\def\opbinspacing {\setmathspacing \mathoperatorcode \mathbinarycode } -\permanent\protected\def\oprelspacing {\setmathspacing \mathoperatorcode \mathrelationcode } -\permanent\protected\def\opopenspacing {\setmathspacing \mathoperatorcode \mathopencode } -\permanent\protected\def\opclosespacing {\setmathspacing \mathoperatorcode \mathclosecode } -\permanent\protected\def\oppunctspacing {\setmathspacing \mathoperatorcode \mathpunctuationcode} -%permanent\protected\def\opinnerspacing {\setmathspacing \mathoperatorcode \mathinnercode } -%permanent\protected\def\opfracspacing {\setmathspacing \mathoperatorcode \mathfractioncode } -%permanent\protected\def\opradspacing {\setmathspacing \mathoperatorcode \mathradicalcode } -\permanent\protected\def\opmiddlespacing {\setmathspacing \mathoperatorcode \mathmiddlecode } -%permanent\protected\def\opaccentspacing {\setmathspacing \mathoperatorcode \mathaccentcode } - -\permanent\protected\def\binordspacing {\setmathspacing \mathbinarycode \mathordinarycode } -\permanent\protected\def\binopspacing {\setmathspacing \mathbinarycode \mathoperatorcode } -\permanent\protected\def\binbinspacing {\setmathspacing \mathbinarycode \mathbinarycode } -\permanent\protected\def\binrelspacing {\setmathspacing \mathbinarycode \mathrelationcode } -\permanent\protected\def\binopenspacing {\setmathspacing \mathbinarycode \mathopencode } -\permanent\protected\def\binclosespacing {\setmathspacing \mathbinarycode \mathclosecode } -\permanent\protected\def\binpunctspacing {\setmathspacing \mathbinarycode \mathpunctuationcode} -%permanent\protected\def\bininnerspacing {\setmathspacing \mathbinarycode \mathinnercode } -%permanent\protected\def\binfracspacing {\setmathspacing \mathbinarycode \mathfractioncode } -%permanent\protected\def\binradspacing {\setmathspacing \mathbinarycode \mathradicalcode } -\permanent\protected\def\binmiddlespacing {\setmathspacing \mathbinarycode \mathmiddlecode } -%permanent\protected\def\binaccentspacing {\setmathspacing \mathbinarycode \mathaccentcode } - -\permanent\protected\def\relordspacing {\setmathspacing \mathrelationcode \mathordinarycode } -\permanent\protected\def\relopspacing {\setmathspacing \mathrelationcode \mathoperatorcode } -\permanent\protected\def\relbinspacing {\setmathspacing \mathrelationcode \mathbinarycode } -\permanent\protected\def\relrelspacing {\setmathspacing \mathrelationcode \mathrelationcode } -\permanent\protected\def\relopenspacing {\setmathspacing \mathrelationcode \mathopencode } -\permanent\protected\def\relclosespacing {\setmathspacing \mathrelationcode \mathclosecode } -\permanent\protected\def\relpunctspacing {\setmathspacing \mathrelationcode \mathpunctuationcode} -%permanent\protected\def\relinnerspacing {\setmathspacing \mathrelationcode \mathinnercode } -%permanent\protected\def\relfracspacing {\setmathspacing \mathrelationcode \mathfractioncode } -%permanent\protected\def\relradspacing {\setmathspacing \mathrelationcode \mathradicalcode } -\permanent\protected\def\relmiddlespacing {\setmathspacing \mathrelationcode \mathmiddlecode } -%permanent\protected\def\relaccentspacing {\setmathspacing \mathrelationcode \mathaccentcode } - -\permanent\protected\def\openordspacing {\setmathspacing \mathopencode \mathordinarycode } -\permanent\protected\def\openopspacing {\setmathspacing \mathopencode \mathoperatorcode } -\permanent\protected\def\openbinspacing {\setmathspacing \mathopencode \mathbinarycode } -\permanent\protected\def\openrelspacing {\setmathspacing \mathopencode \mathrelationcode } -\permanent\protected\def\openopenspacing {\setmathspacing \mathopencode \mathopencode } -\permanent\protected\def\openclosespacing {\setmathspacing \mathopencode \mathclosecode } -\permanent\protected\def\openpunctspacing {\setmathspacing \mathopencode \mathpunctuationcode} -%permanent\protected\def\openinnerspacing {\setmathspacing \mathopencode \mathinnercode } -%permanent\protected\def\openfracspacing {\setmathspacing \mathopencode \mathfractioncode } -%permanent\protected\def\openradspacing {\setmathspacing \mathopencode \mathradicalcode } -\permanent\protected\def\openmiddlespacing {\setmathspacing \mathopencode \mathmiddlecode } -%permanent\protected\def\openaccentspacing {\setmathspacing \mathopencode \mathaccentcode } - -\permanent\protected\def\closeordspacing {\setmathspacing \mathclosecode \mathordinarycode } -\permanent\protected\def\closeopspacing {\setmathspacing \mathclosecode \mathoperatorcode } -\permanent\protected\def\closebinspacing {\setmathspacing \mathclosecode \mathbinarycode } -\permanent\protected\def\closerelspacing {\setmathspacing \mathclosecode \mathrelationcode } -\permanent\protected\def\closeopenspacing {\setmathspacing \mathclosecode \mathopencode } -\permanent\protected\def\closeclosespacing {\setmathspacing \mathclosecode \mathclosecode } -\permanent\protected\def\closepunctspacing {\setmathspacing \mathclosecode \mathpunctuationcode} -%permanent\protected\def\closeinnerspacing {\setmathspacing \mathclosecode \mathinnercode } -%permanent\protected\def\closefracspacing {\setmathspacing \mathclosecode \mathfractioncode } -%permanent\protected\def\closeradspacing {\setmathspacing \mathclosecode \mathradicalcode } -\permanent\protected\def\closemiddlespacing {\setmathspacing \mathclosecode \mathmiddlecode } -%permanent\protected\def\closeaccentspacing {\setmathspacing \mathclosecode \mathaccentcode } - -\permanent\protected\def\punctordspacing {\setmathspacing \mathpunctuationcode \mathordinarycode } -\permanent\protected\def\punctopspacing {\setmathspacing \mathpunctuationcode \mathoperatorcode } -\permanent\protected\def\punctbinspacing {\setmathspacing \mathpunctuationcode \mathbinarycode } -\permanent\protected\def\punctrelspacing {\setmathspacing \mathpunctuationcode \mathrelationcode } -\permanent\protected\def\punctopenspacing {\setmathspacing \mathpunctuationcode \mathopencode } -\permanent\protected\def\punctclosespacing {\setmathspacing \mathpunctuationcode \mathclosecode } -\permanent\protected\def\punctpunctspacing {\setmathspacing \mathpunctuationcode \mathpunctuationcode} -%permanent\protected\def\punctinnerspacing {\setmathspacing \mathpunctuationcode \mathinnercode } -%permanent\protected\def\punctfracspacing {\setmathspacing \mathpunctuationcode \mathfractioncode } -%permanent\protected\def\punctradspacing {\setmathspacing \mathpunctuationcode \mathradicalcode } -\permanent\protected\def\punctmiddlespacing {\setmathspacing \mathpunctuationcode \mathmiddlecode } -%permanent\protected\def\punctaccentspacing {\setmathspacing \mathpunctuationcode \mathaccentcode } - -%permanent\protected\def\innerordspacing {\setmathspacing \mathinnercode \mathordinarycode } -%permanent\protected\def\inneropspacing {\setmathspacing \mathinnercode \mathoperatorcode } -%permanent\protected\def\innerbinspacing {\setmathspacing \mathinnercode \mathbinarycode } -%permanent\protected\def\innerrelspacing {\setmathspacing \mathinnercode \mathrelationcode } -%permanent\protected\def\inneropenspacing {\setmathspacing \mathinnercode \mathopencode } -%permanent\protected\def\innerclosespacing {\setmathspacing \mathinnercode \mathclosecode } -%permanent\protected\def\innerpunctspacing {\setmathspacing \mathinnercode \mathpunctuationcode} -%permanent\protected\def\innerinnerspacing {\setmathspacing \mathinnercode \mathinnercode } -%permanent\protected\def\innerfracspacing {\setmathspacing \mathinnercode \mathfractioncode } -%permanent\protected\def\innerradspacing {\setmathspacing \mathinnercode \mathradicalcode } -%permanent\protected\def\innermiddlespacing {\setmathspacing \mathinnercode \mathmiddlecode } -%permanent\protected\def\inneraccentspacing {\setmathspacing \mathinnercode \mathaccentcode } - -\permanent\protected\def\fracordspacing {\setmathspacing \mathfractioncode \mathordinarycode } -\permanent\protected\def\fracopspacing {\setmathspacing \mathfractioncode \mathoperatorcode } -\permanent\protected\def\fracbinspacing {\setmathspacing \mathfractioncode \mathbinarycode } -\permanent\protected\def\fracrelspacing {\setmathspacing \mathfractioncode \mathrelationcode } -\permanent\protected\def\fracopenspacing {\setmathspacing \mathfractioncode \mathopencode } -\permanent\protected\def\fracclosespacing {\setmathspacing \mathfractioncode \mathclosecode } -\permanent\protected\def\fracpunctspacing {\setmathspacing \mathfractioncode \mathpunctuationcode} -%permanent\protected\def\fracinnerspacing {\setmathspacing \mathfractioncode \mathinnercode } -%permanent\protected\def\fracfracspacing {\setmathspacing \mathfractioncode \mathfractioncode } -%permanent\protected\def\fracradspacing {\setmathspacing \mathfractioncode \mathradicalcode } -\permanent\protected\def\fracmiddlespacing {\setmathspacing \mathfractioncode \mathmiddlecode } -%permanent\protected\def\fracaccentspacing {\setmathspacing \mathfractioncode \mathaccentcode } - -\permanent\protected\def\radordspacing {\setmathspacing \mathradicalcode \mathordinarycode } -\permanent\protected\def\radopspacing {\setmathspacing \mathradicalcode \mathoperatorcode } -\permanent\protected\def\radbinspacing {\setmathspacing \mathradicalcode \mathbinarycode } -\permanent\protected\def\radrelspacing {\setmathspacing \mathradicalcode \mathrelationcode } -\permanent\protected\def\radopenspacing {\setmathspacing \mathradicalcode \mathopencode } -\permanent\protected\def\radclosespacing {\setmathspacing \mathradicalcode \mathclosecode } -\permanent\protected\def\radpunctspacing {\setmathspacing \mathradicalcode \mathpunctuationcode} -%permanent\protected\def\radinnerspacing {\setmathspacing \mathradicalcode \mathinnercode } -%permanent\protected\def\radfracspacing {\setmathspacing \mathradicalcode \mathfractioncode } -%permanent\protected\def\radradspacing {\setmathspacing \mathradicalcode \mathradicalcode } -\permanent\protected\def\radmiddlespacing {\setmathspacing \mathradicalcode \mathmiddlecode } -%permanent\protected\def\radaccentspacing {\setmathspacing \mathradicalcode \mathaccentcode } - -\permanent\protected\def\middleordspacing {\setmathspacing \mathmiddlecode \mathordinarycode } -\permanent\protected\def\middleopspacing {\setmathspacing \mathmiddlecode \mathoperatorcode } -\permanent\protected\def\middlebinspacing {\setmathspacing \mathmiddlecode \mathbinarycode } -\permanent\protected\def\middlerelspacing {\setmathspacing \mathmiddlecode \mathrelationcode } -\permanent\protected\def\middleopenspacing {\setmathspacing \mathmiddlecode \mathopencode } -\permanent\protected\def\middleclosespacing {\setmathspacing \mathmiddlecode \mathclosecode } -\permanent\protected\def\middlepunctspacing {\setmathspacing \mathmiddlecode \mathpunctuationcode} -%permanent\protected\def\middleinnerspacing {\setmathspacing \mathmiddlecode \mathinnercode } -%permanent\protected\def\middlefracspacing {\setmathspacing \mathmiddlecode \mathfractioncode } -%permanent\protected\def\middleradspacing {\setmathspacing \mathmiddlecode \mathradicalcode } -\permanent\protected\def\middlemiddlespacing{\setmathspacing \mathmiddlecode \mathmiddlecode } -%permanent\protected\def\middleaccentspacing{\setmathspacing \mathmiddlecode \mathaccentcode } - -\permanent\protected\def\accentordspacing {\setmathspacing \mathaccentcode \mathordinarycode } -\permanent\protected\def\accentopspacing {\setmathspacing \mathaccentcode \mathoperatorcode } -\permanent\protected\def\accentbinspacing {\setmathspacing \mathaccentcode \mathbinarycode } -\permanent\protected\def\accentrelspacing {\setmathspacing \mathaccentcode \mathrelationcode } -\permanent\protected\def\accentopenspacing {\setmathspacing \mathaccentcode \mathopencode } -\permanent\protected\def\accentclosespacing {\setmathspacing \mathaccentcode \mathclosecode } -\permanent\protected\def\accentpunctspacing {\setmathspacing \mathaccentcode \mathpunctuationcode} -%permanent\protected\def\accentinnerspacing {\setmathspacing \mathaccentcode \mathinnercode } -%permanent\protected\def\accentfracspacing {\setmathspacing \mathaccentcode \mathfractioncode } -%permanent\protected\def\accentradspacing {\setmathspacing \mathaccentcode \mathradicalcode } -\permanent\protected\def\accentmiddlespacing{\setmathspacing \mathaccentcode \mathmiddlecode } -%permanent\protected\def\accentaccentspacing{\setmathspacing \mathaccentcode \mathaccentcode } +% %D These verbose commands are obsolete because there are plenty more classes in +% %D \LMTX\ than in \MKIV. +% +% \permanent\protected\def\ordordspacing {\setmathspacing \mathordinarycode \mathordinarycode } +% \permanent\protected\def\ordopspacing {\setmathspacing \mathordinarycode \mathoperatorcode } +% \permanent\protected\def\ordbinspacing {\setmathspacing \mathordinarycode \mathbinarycode } +% \permanent\protected\def\ordrelspacing {\setmathspacing \mathordinarycode \mathrelationcode } +% \permanent\protected\def\ordopenspacing {\setmathspacing \mathordinarycode \mathopencode } +% \permanent\protected\def\ordclosespacing {\setmathspacing \mathordinarycode \mathclosecode } +% \permanent\protected\def\ordpunctspacing {\setmathspacing \mathordinarycode \mathpunctuationcode} +% %permanent\protected\def\ordinnerspacing {\setmathspacing \mathordinarycode \mathinnercode } +% %permanent\protected\def\ordfractionspacing {\setmathspacing \mathordinarycode \mathfractioncode } +% %permanent\protected\def\ordradicalspacing {\setmathspacing \mathordinarycode \mathradicalcode } +% \permanent\protected\def\ordmiddlespacing {\setmathspacing \mathordinarycode \mathmiddlecode } +% %permanent\protected\def\ordaccentspacing {\setmathspacing \mathordinarycode \mathaccentcode } +% +% \permanent\protected\def\opordspacing {\setmathspacing \mathoperatorcode \mathordinarycode } +% \permanent\protected\def\opopspacing {\setmathspacing \mathoperatorcode \mathoperatorcode } +% \permanent\protected\def\opbinspacing {\setmathspacing \mathoperatorcode \mathbinarycode } +% \permanent\protected\def\oprelspacing {\setmathspacing \mathoperatorcode \mathrelationcode } +% \permanent\protected\def\opopenspacing {\setmathspacing \mathoperatorcode \mathopencode } +% \permanent\protected\def\opclosespacing {\setmathspacing \mathoperatorcode \mathclosecode } +% \permanent\protected\def\oppunctspacing {\setmathspacing \mathoperatorcode \mathpunctuationcode} +% %permanent\protected\def\opinnerspacing {\setmathspacing \mathoperatorcode \mathinnercode } +% %permanent\protected\def\opfractionspacing {\setmathspacing \mathoperatorcode \mathfractioncode } +% %permanent\protected\def\opradicalspacing {\setmathspacing \mathoperatorcode \mathradicalcode } +% \permanent\protected\def\opmiddlespacing {\setmathspacing \mathoperatorcode \mathmiddlecode } +% %permanent\protected\def\opaccentspacing {\setmathspacing \mathoperatorcode \mathaccentcode } +% +% \permanent\protected\def\binordspacing {\setmathspacing \mathbinarycode \mathordinarycode } +% \permanent\protected\def\binopspacing {\setmathspacing \mathbinarycode \mathoperatorcode } +% \permanent\protected\def\binbinspacing {\setmathspacing \mathbinarycode \mathbinarycode } +% \permanent\protected\def\binrelspacing {\setmathspacing \mathbinarycode \mathrelationcode } +% \permanent\protected\def\binopenspacing {\setmathspacing \mathbinarycode \mathopencode } +% \permanent\protected\def\binclosespacing {\setmathspacing \mathbinarycode \mathclosecode } +% \permanent\protected\def\binpunctspacing {\setmathspacing \mathbinarycode \mathpunctuationcode} +% %permanent\protected\def\bininnerspacing {\setmathspacing \mathbinarycode \mathinnercode } +% %permanent\protected\def\binfractionspacing {\setmathspacing \mathbinarycode \mathfractioncode } +% %permanent\protected\def\binradicalspacing {\setmathspacing \mathbinarycode \mathradicalcode } +% \permanent\protected\def\binmiddlespacing {\setmathspacing \mathbinarycode \mathmiddlecode } +% %permanent\protected\def\binaccentspacing {\setmathspacing \mathbinarycode \mathaccentcode } +% +% \permanent\protected\def\relordspacing {\setmathspacing \mathrelationcode \mathordinarycode } +% \permanent\protected\def\relopspacing {\setmathspacing \mathrelationcode \mathoperatorcode } +% \permanent\protected\def\relbinspacing {\setmathspacing \mathrelationcode \mathbinarycode } +% \permanent\protected\def\relrelspacing {\setmathspacing \mathrelationcode \mathrelationcode } +% \permanent\protected\def\relopenspacing {\setmathspacing \mathrelationcode \mathopencode } +% \permanent\protected\def\relclosespacing {\setmathspacing \mathrelationcode \mathclosecode } +% \permanent\protected\def\relpunctspacing {\setmathspacing \mathrelationcode \mathpunctuationcode} +% %permanent\protected\def\relinnerspacing {\setmathspacing \mathrelationcode \mathinnercode } +% %permanent\protected\def\relfractionspacing {\setmathspacing \mathrelationcode \mathfractioncode } +% %permanent\protected\def\relradicalspacing {\setmathspacing \mathrelationcode \mathradicalcode } +% \permanent\protected\def\relmiddlespacing {\setmathspacing \mathrelationcode \mathmiddlecode } +% %permanent\protected\def\relaccentspacing {\setmathspacing \mathrelationcode \mathaccentcode } +% +% \permanent\protected\def\openordspacing {\setmathspacing \mathopencode \mathordinarycode } +% \permanent\protected\def\openopspacing {\setmathspacing \mathopencode \mathoperatorcode } +% \permanent\protected\def\openbinspacing {\setmathspacing \mathopencode \mathbinarycode } +% \permanent\protected\def\openrelspacing {\setmathspacing \mathopencode \mathrelationcode } +% \permanent\protected\def\openopenspacing {\setmathspacing \mathopencode \mathopencode } +% \permanent\protected\def\openclosespacing {\setmathspacing \mathopencode \mathclosecode } +% \permanent\protected\def\openpunctspacing {\setmathspacing \mathopencode \mathpunctuationcode} +% %permanent\protected\def\openinnerspacing {\setmathspacing \mathopencode \mathinnercode } +% %permanent\protected\def\openfractionspacing {\setmathspacing \mathopencode \mathfractioncode } +% %permanent\protected\def\openradicalspacing {\setmathspacing \mathopencode \mathradicalcode } +% \permanent\protected\def\openmiddlespacing {\setmathspacing \mathopencode \mathmiddlecode } +% %permanent\protected\def\openaccentspacing {\setmathspacing \mathopencode \mathaccentcode } +% +% \permanent\protected\def\closeordspacing {\setmathspacing \mathclosecode \mathordinarycode } +% \permanent\protected\def\closeopspacing {\setmathspacing \mathclosecode \mathoperatorcode } +% \permanent\protected\def\closebinspacing {\setmathspacing \mathclosecode \mathbinarycode } +% \permanent\protected\def\closerelspacing {\setmathspacing \mathclosecode \mathrelationcode } +% \permanent\protected\def\closeopenspacing {\setmathspacing \mathclosecode \mathopencode } +% \permanent\protected\def\closeclosespacing {\setmathspacing \mathclosecode \mathclosecode } +% \permanent\protected\def\closepunctspacing {\setmathspacing \mathclosecode \mathpunctuationcode} +% %permanent\protected\def\closeinnerspacing {\setmathspacing \mathclosecode \mathinnercode } +% %permanent\protected\def\closefractionspacing {\setmathspacing \mathclosecode \mathfractioncode } +% %permanent\protected\def\closeradicalspacing {\setmathspacing \mathclosecode \mathradicalcode } +% \permanent\protected\def\closemiddlespacing {\setmathspacing \mathclosecode \mathmiddlecode } +% %permanent\protected\def\closeaccentspacing {\setmathspacing \mathclosecode \mathaccentcode } +% +% \permanent\protected\def\punctordspacing {\setmathspacing \mathpunctuationcode \mathordinarycode } +% \permanent\protected\def\punctopspacing {\setmathspacing \mathpunctuationcode \mathoperatorcode } +% \permanent\protected\def\punctbinspacing {\setmathspacing \mathpunctuationcode \mathbinarycode } +% \permanent\protected\def\punctrelspacing {\setmathspacing \mathpunctuationcode \mathrelationcode } +% \permanent\protected\def\punctopenspacing {\setmathspacing \mathpunctuationcode \mathopencode } +% \permanent\protected\def\punctclosespacing {\setmathspacing \mathpunctuationcode \mathclosecode } +% \permanent\protected\def\punctpunctspacing {\setmathspacing \mathpunctuationcode \mathpunctuationcode} +% %permanent\protected\def\punctinnerspacing {\setmathspacing \mathpunctuationcode \mathinnercode } +% %permanent\protected\def\punctfractionspacing {\setmathspacing \mathpunctuationcode \mathfractioncode } +% %permanent\protected\def\punctradicalspacing {\setmathspacing \mathpunctuationcode \mathradicalcode } +% \permanent\protected\def\punctmiddlespacing {\setmathspacing \mathpunctuationcode \mathmiddlecode } +% %permanent\protected\def\punctaccentspacing {\setmathspacing \mathpunctuationcode \mathaccentcode } +% +% %permanent\protected\def\innerordspacing {\setmathspacing \mathinnercode \mathordinarycode } +% %permanent\protected\def\inneropspacing {\setmathspacing \mathinnercode \mathoperatorcode } +% %permanent\protected\def\innerbinspacing {\setmathspacing \mathinnercode \mathbinarycode } +% %permanent\protected\def\innerrelspacing {\setmathspacing \mathinnercode \mathrelationcode } +% %permanent\protected\def\inneropenspacing {\setmathspacing \mathinnercode \mathopencode } +% %permanent\protected\def\innerclosespacing {\setmathspacing \mathinnercode \mathclosecode } +% %permanent\protected\def\innerpunctspacing {\setmathspacing \mathinnercode \mathpunctuationcode} +% %permanent\protected\def\innerinnerspacing {\setmathspacing \mathinnercode \mathinnercode } +% %permanent\protected\def\innerfractionspacing {\setmathspacing \mathinnercode \mathfractioncode } +% %permanent\protected\def\innerradicalspacing {\setmathspacing \mathinnercode \mathradicalcode } +% %permanent\protected\def\innermiddlespacing {\setmathspacing \mathinnercode \mathmiddlecode } +% %permanent\protected\def\inneraccentspacing {\setmathspacing \mathinnercode \mathaccentcode } +% +% \permanent\protected\def\fractionordspacing {\setmathspacing \mathfractioncode \mathordinarycode } +% \permanent\protected\def\fractionopspacing {\setmathspacing \mathfractioncode \mathoperatorcode } +% \permanent\protected\def\fractionbinspacing {\setmathspacing \mathfractioncode \mathbinarycode } +% \permanent\protected\def\fractionrelspacing {\setmathspacing \mathfractioncode \mathrelationcode } +% \permanent\protected\def\fractionopenspacing {\setmathspacing \mathfractioncode \mathopencode } +% \permanent\protected\def\fractionclosespacing {\setmathspacing \mathfractioncode \mathclosecode } +% \permanent\protected\def\fractionpunctspacing {\setmathspacing \mathfractioncode \mathpunctuationcode} +% %permanent\protected\def\fractioninnerspacing {\setmathspacing \mathfractioncode \mathinnercode } +% %permanent\protected\def\fractionfractionspacing{\setmathspacing \mathfractioncode \mathfractioncode } +% %permanent\protected\def\fractionradicalspacing {\setmathspacing \mathfractioncode \mathradicalcode } +% \permanent\protected\def\fractionmiddlespacing {\setmathspacing \mathfractioncode \mathmiddlecode } +% %permanent\protected\def\fractionaccentspacing {\setmathspacing \mathfractioncode \mathaccentcode } +% +% \permanent\protected\def\radicalordspacing {\setmathspacing \mathradicalcode \mathordinarycode } +% \permanent\protected\def\radicalopspacing {\setmathspacing \mathradicalcode \mathoperatorcode } +% \permanent\protected\def\radicalbinspacing {\setmathspacing \mathradicalcode \mathbinarycode } +% \permanent\protected\def\radicalrelspacing {\setmathspacing \mathradicalcode \mathrelationcode } +% \permanent\protected\def\radicalopenspacing {\setmathspacing \mathradicalcode \mathopencode } +% \permanent\protected\def\radicalclosespacing {\setmathspacing \mathradicalcode \mathclosecode } +% \permanent\protected\def\radicalpunctspacing {\setmathspacing \mathradicalcode \mathpunctuationcode} +% %permanent\protected\def\radicalinnerspacing {\setmathspacing \mathradicalcode \mathinnercode } +% %permanent\protected\def\radicalfractionspacing {\setmathspacing \mathradicalcode \mathfractioncode } +% %permanent\protected\def\radicalradicalspacing {\setmathspacing \mathradicalcode \mathradicalcode } +% \permanent\protected\def\radicalmiddlespacing {\setmathspacing \mathradicalcode \mathmiddlecode } +% %permanent\protected\def\radicalaccentspacing {\setmathspacing \mathradicalcode \mathaccentcode } +% +% \permanent\protected\def\middleordspacing {\setmathspacing \mathmiddlecode \mathordinarycode } +% \permanent\protected\def\middleopspacing {\setmathspacing \mathmiddlecode \mathoperatorcode } +% \permanent\protected\def\middlebinspacing {\setmathspacing \mathmiddlecode \mathbinarycode } +% \permanent\protected\def\middlerelspacing {\setmathspacing \mathmiddlecode \mathrelationcode } +% \permanent\protected\def\middleopenspacing {\setmathspacing \mathmiddlecode \mathopencode } +% \permanent\protected\def\middleclosespacing {\setmathspacing \mathmiddlecode \mathclosecode } +% \permanent\protected\def\middlepunctspacing {\setmathspacing \mathmiddlecode \mathpunctuationcode} +% %permanent\protected\def\middleinnerspacing {\setmathspacing \mathmiddlecode \mathinnercode } +% %permanent\protected\def\middlefractionspacing {\setmathspacing \mathmiddlecode \mathfractioncode } +% %permanent\protected\def\middleradicalspacing {\setmathspacing \mathmiddlecode \mathradicalcode } +% \permanent\protected\def\middlemiddlespacing {\setmathspacing \mathmiddlecode \mathmiddlecode } +% %permanent\protected\def\middleaccentspacing {\setmathspacing \mathmiddlecode \mathaccentcode } +% +% \permanent\protected\def\accentordspacing {\setmathspacing \mathaccentcode \mathordinarycode } +% \permanent\protected\def\accentopspacing {\setmathspacing \mathaccentcode \mathoperatorcode } +% \permanent\protected\def\accentbinspacing {\setmathspacing \mathaccentcode \mathbinarycode } +% \permanent\protected\def\accentrelspacing {\setmathspacing \mathaccentcode \mathrelationcode } +% \permanent\protected\def\accentopenspacing {\setmathspacing \mathaccentcode \mathopencode } +% \permanent\protected\def\accentclosespacing {\setmathspacing \mathaccentcode \mathclosecode } +% \permanent\protected\def\accentpunctspacing {\setmathspacing \mathaccentcode \mathpunctuationcode} +% %permanent\protected\def\accentinnerspacing {\setmathspacing \mathaccentcode \mathinnercode } +% %permanent\protected\def\accentfractionspacing {\setmathspacing \mathaccentcode \mathfractioncode } +% %permanent\protected\def\accentradicalspacing {\setmathspacing \mathaccentcode \mathradicalcode } +% \permanent\protected\def\accentmiddlespacing {\setmathspacing \mathaccentcode \mathmiddlecode } +% %permanent\protected\def\accentaccentspacing {\setmathspacing \mathaccentcode \mathaccentcode } %D In the end Mikael and I prefer this but we need a high level interface: @@ -473,7 +497,7 @@ %D $ 1 \color[red]{+} 2$\par %D \mathgroupingmode0 %D $ 1 {\red +} 2$\par -%D $ 1 \mathbin{\red +} 2$\par +%D $ 1 \mathbinary{\red +} 2$\par %D $ 1 \color[red]{+} 2$\par %D \stopTEXpage %D \stoptyping @@ -730,14 +754,6 @@ \advanceby\mathnestinglevel\plusone \to \everymathematics -%D A few compatibility helpers: - -\permanent\def\Umathbottomaccent{\Umathaccent \s!bottom } -\permanent\def\Umathtopaccent {\Umathaccent \s!top } -\permanent\def\Umathaccents {\Umathaccent \s!both } % strange highlighting - -\aliased\let\Umathbotaccent\Umathbottomaccent - %D The attributes that we will use (todo: pack some into one but uglier code): \definesystemattribute[mathalphabet] [public] @@ -1699,76 +1715,39 @@ % \permanent\protected\def\mathlimop#1{\mathatom \mathoperatorcode options "C0000 {#1}} % auto "40000 + "80000 % \permanent\protected\def\mathnolop#1{\mathatom \mathoperatorcode options "80000 {#1}} -\aliased\let\mathnothing\firstofoneunexpanded -\aliased\let\mathalpha \firstofoneunexpanded +% \aliased\let\mathnothing\firstofoneunexpanded +% \aliased\let\mathalpha \firstofoneunexpanded + +\ifdefined\mathop \else \aliased\let\mathop \normalmathoperator \aliased\let\normalmathop \normalmathoperator \fi +\ifdefined\mathord \else \aliased\let\mathord \normalmathordinary \aliased\let\normalmathord \normalmathordinary \fi +\ifdefined\mathbin \else \aliased\let\mathbin \normalmathbinary \aliased\let\normalmathbin \normalmathbinary \fi +\ifdefined\mathrel \else \aliased\let\mathrel \normalmathrelation \aliased\let\normalmathrel \normalmathrelation \fi +\ifdefined\mathpunct \else \aliased\let\mathpunct\normalmathpunctuation \aliased\let\normalmathpunct\normalmathpunctuation \fi +\ifdefined\underline \else \aliased\let\underline\normalmathunderline \aliased\let\normalunderline\normalmathunderline \fi +\ifdefined\overline \else \aliased\let\overline \normalmathoverline \aliased\let\normaloverline \normalmathoverline \fi + +\permanent\def\mathcodechecked#1% + {\numexpr + \iftok{#1}\emptytoks + \mathordinarycode + \orelse\ifchknum#1\or + \lastchknum + \orelse\ifchknum\begincsname math#1code\endcsname\or % maybe some day a hash for this + \lastchknum + \else + \mathordinarycode + \fi + \relax} -% \installcorenamespace {mathclasses} -% -% \letcsname\??mathclasses ord\endcsname\normalmathord -% \letcsname\??mathclasses op\endcsname\normalmathop -% \letcsname\??mathclasses rel\endcsname\normalmathrel -% \letcsname\??mathclasses bin\endcsname\normalmathbin -% \letcsname\??mathclasses punct\endcsname\normalmathpunct -% -% \letcsname\??mathclasses \endcsname\normalmathord -% \letcsname\??mathclasses inner\endcsname\normalmathinner -% \letcsname\??mathclasses ellipsis\endcsname\normalmathellipsis -% \letcsname\??mathclasses open\endcsname\normalmathopen -% \letcsname\??mathclasses close\endcsname\normalmathclose -% \letcsname\??mathclasses ordinary\endcsname\normalmathord -% \letcsname\??mathclasses operator\endcsname\normalmathop -% \letcsname\??mathclasses relation\endcsname\normalmathrel -% \letcsname\??mathclasses binary\endcsname\normalmathbin -% \letcsname\??mathclasses punctuation\endcsname\normalmathpunct -% \letcsname\??mathclasses fraction\endcsname\normalmathfrac -% \letcsname\??mathclasses radical\endcsname\normalmathrad - -%D We need only a subset because many classes are sort of special. - -\installcorenamespace{mathcodecommand} - -% short: - -\aliased\letcsname\??mathcodecommand ord\endcsname\mathord -\aliased\letcsname\??mathcodecommand op\endcsname\mathop -\aliased\letcsname\??mathcodecommand rel\endcsname\mathrel -\aliased\letcsname\??mathcodecommand bin\endcsname\mathbin -\aliased\letcsname\??mathcodecommand punct\endcsname\mathpunct - -% official: - -\aliased\letcsname\??mathcodecommand \endcsname\normalmathord -\aliased\letcsname\??mathcodecommand inner\endcsname\normalmathinner -\aliased\letcsname\??mathcodecommand open\endcsname\normalmathopen -\aliased\letcsname\??mathcodecommand close\endcsname\normalmathclose -\aliased\letcsname\??mathcodecommand ordinary\endcsname\normalmathord -\aliased\letcsname\??mathcodecommand operator\endcsname\normalmathop -\aliased\letcsname\??mathcodecommand relation\endcsname\normalmathrel -\aliased\letcsname\??mathcodecommand binary\endcsname\normalmathbin -\aliased\letcsname\??mathcodecommand punctuation\endcsname\normalmathpunct -\aliased\letcsname\??mathcodecommand fraction\endcsname\normalmathfrac -\aliased\letcsname\??mathcodecommand radical\endcsname\normalmathrad - -% special: - -\aliased\letcsname\??mathcodecommand limop\endcsname\mathlimop -\aliased\letcsname\??mathcodecommand nolop\endcsname\mathnolop - -% obsolete: - -\aliased\letcsname\??mathcodecommand box\endcsname\mathbox -%aliased\letcsname\??mathcodecommand choice\endcsname\mathnothing -\aliased\letcsname\??mathcodecommand alpha\endcsname\mathalpha % hm -\aliased\letcsname\??mathcodecommand nothing\endcsname\mathnothing - -% usage: - -\def\math_class_by_parameter #1{\normalexpanded{\noexpand\math_class_by_parameter_indeed{#1\c!mathclass}}} -\def\math_class_by_parameter_indeed#1{\csname\??mathcodecommand\ifcsname\??mathcodecommand#1\endcsname#1\fi\endcsname} - -\permanent \def\mathcodenumber #1{\the\csname math#1code\endcsname} -\permanent\protected\def\mathcodecommand#1{\csname\??mathcodecommand#1\endcsname} -\permanent \def\mathcodechecked#1{\ifcsname math#1code\endcsname\lastnamedcs\else#1\fi} +\permanent\def\mathcodenumber#1% + {\the\mathcodechecked{#1}} + +\permanent\protected\def\mathcodecommand#1% + {\mathatom \s!class \mathcodechecked{#1}} + +\def\math_class_by_parameter #1#2{\normalexpanded{\noexpand\mathcodechecked{#1#2}}} +\def\math_atom_by_parameter #1{\normalexpanded{\noexpand\math_atom_by_parameter_indeed{#1\c!mathclass}}} +\def\math_atom_by_parameter_indeed#1{\mathatom \s!class \mathcodechecked{#1}} % \startlines % $\mathopnolimits{\rm d}x$ @@ -1799,7 +1778,7 @@ \orelse\ifparameter#2\or \frozen\protected\defcsname\??mathcommand#1\endcsname{\mathcodecommand{#2}{#4}}% \else - \frozen\protected\defcsname\??mathcommand#1\endcsname{\mathcodecommand{nothing}{#4}}% + \frozen\protected\defcsname\??mathcommand#1\endcsname{#4}% \fi \ifparameter#1\or % safeguard \letcsname#1\expandafter\endcsname\csname\??mathcommand#1\endcsname diff --git a/tex/context/base/mkxl/math-lop.mkxl b/tex/context/base/mkxl/math-lop.mkxl index 327d663e8..d4dbfa448 100644 --- a/tex/context/base/mkxl/math-lop.mkxl +++ b/tex/context/base/mkxl/math-lop.mkxl @@ -136,7 +136,27 @@ \definemathoperator [ointc] [integrals] [\c!left="2232] % CLOCKWISE CONTOUR INTEGRAL \definemathoperator [aointc] [integrals] [\c!left="2233] % ANTI CLOCKWISE CONTOUR INTEGRAL -\definemathoperator [sum] [summations] [\c!left="2211] % N-ARY SUMMATION +\definemathoperator [sumint] [integrals] [\c!left="2A0B] % Integral with sum +\definemathoperator [barint] [integrals] [\c!left="2A0D] % Integral with bar +\definemathoperator [doublebarint] [integrals] [\c!left="2A0E] % Integral with double bar +\definemathoperator [slashint] [integrals] [\c!left="2A0F] % Integral with slash +\definemathoperator [aodownintc] [integrals] [\c!left="2A11] +\definemathoperator [rectangularpoleintc] [integrals] [\c!left="2A12] +\definemathoperator [semicirclepoleintc] [integrals] [\c!left="2A13] +\definemathoperator [circlepoleoutsideintc] [integrals] [\c!left="2A14] +\definemathoperator [circlepoleinsideintc] [integrals] [\c!left="2A15] +\definemathoperator [squareintc] [integrals] [\c!left="2A16] +\definemathoperator [hookleftarrowint] [integrals] [\c!left="2A17] +\definemathoperator [timesint] [integrals] [\c!left="2A18] +\definemathoperator [capint] [integrals] [\c!left="2A19] +\definemathoperator [cupint] [integrals] [\c!left="2A1A] +\definemathoperator [upperint] [integrals] [\c!left="2A1B] +\definemathoperator [lowerint] [integrals] [\c!left="2A1C] + +\definemathoperator [sum] [summations] [\c!left="2211] % N-ARY SUMMATION +\definemathoperator [blackboardsum] [summations] [\c!left="2140] % blackboard summation +\definemathoperator [modtwosum] [summations] [\c!left="2A0A] % modulo two summation + \definemathoperator [prod] [products] [\c!left="220F] % N-ARY PRODUCT \definemathoperator [coprod] [products] [\c!left="2210] % N-ARY COPRODUCT @@ -156,4 +176,15 @@ \definemathoperator [bigsqcup] [operators] [\c!left="2A06] % N-ARY SQUARE UNION OPERATOR \definemathoperator [bigtimes] [operators] [\c!left="2A09] % N-ARY TIMES OPERATOR +\definemathoperator [leftouterjoin] [operators] [\c!left="27D5] % left outer join +\definemathoperator [rightouterjoin] [operators] [\c!left="27D6] % right outer join +\definemathoperator [fullouterjoin] [operators] [\c!left="27D7] % full outer join +\definemathoperator [bigbottom] [operators] [\c!left="27D8] % big bottom +\definemathoperator [bigtop] [operators] [\c!left="27D9] % big top +\definemathoperator [bigsolidus] [operators] [\c!left="29F8] % big solidus +\definemathoperator [bigreversesolidus] [operators] [\c!left="29F9] % big reverse solidus +\definemathoperator [bigdoublewedge] [operators] [\c!left="2A07] % big double wedge +\definemathoperator [bigdoublevee] [operators] [\c!left="2A08] % big double vee + + \protect \endinput diff --git a/tex/context/base/mkxl/math-spa.lmt b/tex/context/base/mkxl/math-spa.lmt index d26a3f6f8..5fa1a3742 100644 --- a/tex/context/base/mkxl/math-spa.lmt +++ b/tex/context/base/mkxl/math-spa.lmt @@ -34,6 +34,7 @@ local getdepth = nuts.getdepth local getheight = nuts.getheight local getlist = nuts.getlist local setglue = nuts.setglue +local setwhd = nuts.setwhd local getdimensions = nuts.dimensions local getnormalizedline = node.direct.getnormalizedline local getbox = nuts.getbox @@ -159,7 +160,10 @@ end stages[3] = stages[2] stages[4] = function(specification,stage) - nuts.openup(specification,getlist(getbox(specification.box))) + local box = getbox(specification.box) + nuts.openup(specification,getlist(box)) + local w, h, d = getdimensions(getlist(box),true) -- vertical + setwhd(box,w,h,d) end interfaces.implement { @@ -174,6 +178,7 @@ interfaces.implement { { "inbetween", "dimension" }, { "height", "dimension" }, { "depth", "dimension" }, + { "splitmethod" }, } }, actions = function(specification) diff --git a/tex/context/base/mkxl/math-stc.mklx b/tex/context/base/mkxl/math-stc.mklx index 96ed80a89..e1c4fc90a 100644 --- a/tex/context/base/mkxl/math-stc.mklx +++ b/tex/context/base/mkxl/math-stc.mklx @@ -331,7 +331,7 @@ \edef\currentmathstackers{#category}% \mathstackersparameter\c!left\relax \dostarttagged\t!mstacker\currentmathstackers - \ifmmode\math_class_by_parameter\mathstackersparameter\else\dontleavehmode\fi + \ifmmode\math_atom_by_parameter\mathstackersparameter\else\dontleavehmode\fi {\edef\p_offset {\mathstackersparameter\c!offset}% \edef\p_location {\mathstackersparameter\c!location}% \edef\p_strut {\mathstackersparameter\c!strut}% @@ -563,7 +563,7 @@ \fi \mathstackersparameter\c!left\relax \dostarttagged\t!mstacker\currentmathstackers - \ifmmode\math_class_by_parameter\mathstackersparameter\else\dontleavehmode\fi + \ifmmode\math_atom_by_parameter\mathstackersparameter\else\dontleavehmode\fi {\edef\m_math_stackers_text_middle {#text}% % \edef\p_offset {\mathstackersparameter\c!offset}% @@ -750,7 +750,7 @@ {\math_stackers_start_group{#category}% \mathstackersparameter\c!left\relax \dostarttagged\t!mstacker\currentmathstackers - \ifmmode\math_class_by_parameter\mathstackersparameter\else\dontleavehmode\fi + \ifmmode\math_atom_by_parameter\mathstackersparameter\else\dontleavehmode\fi {\edef\currentmathstackers{#category}% % \edef\p_offset {\mathstackersparameter\c!offset}% @@ -1020,8 +1020,8 @@ % \setupbodyfont[xits] \getbuffer % \setupbodyfont[cambria] \getbuffer -\immutable\protected\def\normaldoublebrace {\Umathaccents \zerocount \zerocount "23DE \zerocount \zerocount "23DF } -\immutable\protected\def\normaldoubleparent{\Umathaccents \zerocount \zerocount "23DC \zerocount \zerocount "23DD } +\immutable\protected\def\normaldoublebrace {\Umathaccent \s!both \zerocount \zerocount "23DE \zerocount \zerocount "23DF } +\immutable\protected\def\normaldoubleparent{\Umathaccent \s!both \zerocount \zerocount "23DC \zerocount \zerocount "23DD } % let's keep this @@ -1291,7 +1291,7 @@ \ifempty\p_moffset \else \mskip\p_moffset\relax \fi - \ifmmode\math_class_by_parameter\mathstackersparameter\else\dontleavehmode\fi + \ifmmode\math_atom_by_parameter\mathstackersparameter\else\dontleavehmode\fi {\usemathstackerscolorparameter\c!color \Umathchar\zerocount\zerocount#codepoint}% \ifempty\p_moffset \else diff --git a/tex/context/base/mkxl/math-tag.lmt b/tex/context/base/mkxl/math-tag.lmt index 2eb9327cf..128b85249 100644 --- a/tex/context/base/mkxl/math-tag.lmt +++ b/tex/context/base/mkxl/math-tag.lmt @@ -47,8 +47,6 @@ local getbottom = nuts.getbottom local getchoice = nuts.getchoice local getnucleus = nuts.getnucleus -local getsub = nuts.getsub -local getsup = nuts.getsup local setattributes = nuts.setattributes @@ -76,9 +74,10 @@ local fixedtopaccent_code = accentcodes.fixedtop local fixedbottomaccent_code = accentcodes.fixedbottom local fixedbothaccent_code = accentcodes.fixedboth -local leftfence_code = fencecodes.left -local middlefence_code = fencecodes.middle -local rightfence_code = fencecodes.right +local leftfence_code = fencecodes.left +local middlefence_code = fencecodes.middle +local rightfence_code = fencecodes.right +local operatorfence_code = fencecodes.operator local kerncodes = nodes.kerncodes @@ -119,19 +118,31 @@ local report_tags = logs.reporter("structure","tags") local process +local function processnucleus(nucleus,prime) + if prime then + -- This should work wasn't it that browser handling of primes have an issue with + -- "big semi raised text" vs "small supposedly superscripted". So let's play safe + -- and use a superscript. Even then we get somewhat different positioning for the + -- same primed character in q sqrt and (e.g.) a sequential integral. + -- start_tagged("mrow", { prime = true }) + start_tagged("msup", { prime = true }) + process(nucleus) + process(prime) + stop_tagged() + else + process(nucleus) + end +end + local function processsubsup(start) -- At some point we might need to add an attribute signaling the -- super- and subscripts because TeX and MathML use a different -- order. The mrows are needed to keep mn's separated. - local nucleus = getnucleus(start) - local sup = getsup(start) - local sub = getsub(start) + local nucleus, prime, sup, sub, presup, presub = getnucleus(start,true) if sub then if sup then setattr(start,a_tagged,start_tagged("msubsup")) - -- start_tagged("mrow") - process(nucleus) - -- stop_tagged() + processnucleus(nucleus,prime) start_tagged("mrow", { subscript = true }) process(sub) stop_tagged() @@ -141,9 +152,7 @@ local function processsubsup(start) stop_tagged() else setattr(start,a_tagged,start_tagged("msub")) - -- start_tagged("mrow") - process(nucleus) - -- stop_tagged() + processnucleus(nucleus,prime) start_tagged("mrow") process(sub) stop_tagged() @@ -151,15 +160,13 @@ local function processsubsup(start) end elseif sup then setattr(start,a_tagged,start_tagged("msup")) - -- start_tagged("mrow") - process(nucleus) - -- stop_tagged() + processnucleus(nucleus,prime) start_tagged("mrow") process(sup) stop_tagged() stop_tagged() else - process(nucleus) + processnucleus(nucleus,prime) end end @@ -216,6 +223,10 @@ end -- only focus on structure and let the engine deal with the details. Another reason -- to update this is that we can add some tracing (lmtx only). +-- This has been working ok for quite but in 2023 it's tiem to have a look at it +-- again and see to what extend we need to adapt to new features. Around the time +-- PG's Panopticom was put on youtube. + process = function(start) -- we cannot use the processor as we have no finalizers (yet) local mtexttag = nil for start, id, subtype in nextnode, start do -- current @@ -234,11 +245,12 @@ process = function(start) -- we cannot use the processor as we have no finalizer if id == mathchar_code then local char = getchar(start) local code = getmathcodes(char) + local ch = chardata[char] + local mc = ch and ch.mathclass local tag + local properties= { class = mc } -- todo: we have way more now if code == ordinary_mathcode then - local ch = chardata[char] - local mc = ch and ch.mathclass if mc == "number" then tag = "mn" elseif mc == "variable" or not mc then -- variable is default @@ -249,12 +261,19 @@ process = function(start) -- we cannot use the processor as we have no finalizer else tag = "mo" end +-- if mc == "open" or nc == "close" or mc == "middle" then +-- properties = { maxsize = 1 } +-- end local a = getattr(start,a_mathcategory) if a then - setattr(start,a_tagged,start_tagged(tag,{ mathcategory = a })) - else - setattr(start,a_tagged,start_tagged(tag)) -- todo: a_mathcategory + -- todo / redo + if properties then + properties.mathcategory = a + else + properties = { mathcategory = a } + end end + setattr(start,a_tagged,start_tagged(tag,properties)) stop_tagged() -- showtag(start,id,false) break -- okay? @@ -470,7 +489,6 @@ process = function(start) -- we cannot use the processor as we have no finalizer elseif id == fence_code then local delimiter = getdelimiter(start) if subtype == leftfence_code then - -- left local properties = { } insert(fencesstack,properties) setattr(start,a_tagged,start_tagged("mfenced",properties)) -- needs checking @@ -485,7 +503,6 @@ process = function(start) -- we cannot use the processor as we have no finalizer end start_tagged("mrow") -- begin of subsequence elseif subtype == middlefence_code then - -- middle if delimiter then start_tagged("ignore") local top = fencesstack[#fencesstack] @@ -520,8 +537,20 @@ process = function(start) -- we cannot use the processor as we have no finalizer end stop_tagged() -- end of subsequence stop_tagged() - else - -- can't happen + elseif subtype == operatorfence_code then + -- the same as left but different key + local properties = { } + insert(fencesstack,properties) + setattr(start,a_tagged,start_tagged("mfenced",properties)) -- needs checking + if delimiter then + local chr = getchar(delimiter) + if chr ~= 0 then + properties.operator = chr + end + process(delimiter) + end + processsubsup(start) + start_tagged("mrow") -- begin of subsequence end elseif id == radical_code then local left = getleftdelimiter(start) diff --git a/tex/context/base/mkxl/mult-sys.mkxl b/tex/context/base/mkxl/mult-sys.mkxl index f04418e43..428a8ddcf 100644 --- a/tex/context/base/mkxl/mult-sys.mkxl +++ b/tex/context/base/mkxl/mult-sys.mkxl @@ -224,6 +224,7 @@ \definesystemconstant {forget} \definesystemconstant {format} \definesystemconstant {fraktur} +\definesystemconstant {fraktion} \definesystemconstant {full} \definesystemconstant {f} \definesystemconstant {global} @@ -419,6 +420,7 @@ \definesystemconstant {unpack} \definesystemconstant {unknown} \definesystemconstant {Unicode} +\definesystemconstant {unroll} \definesystemconstant {upright} \definesystemconstant {userdata} \definesystemconstant {userpage} diff --git a/tex/context/base/mkxl/node-ali.lmt b/tex/context/base/mkxl/node-ali.lmt index 69b1e7aa0..510e56b8e 100644 --- a/tex/context/base/mkxl/node-ali.lmt +++ b/tex/context/base/mkxl/node-ali.lmt @@ -26,6 +26,7 @@ local getglue = nuts.getglue local setglue = nuts.setglue local getwhd = nuts.getwhd local setwhd = nuts.setwhd +local setpenalty = nuts.setpenalty local getlist = nuts.getlist local setlist = nuts.setlist local setattrlist = nuts.setattrlist @@ -54,6 +55,7 @@ local nextrecord = traversers.alignrecord local nextunset = traversers.unset local nextglyph = traversers.glyph local nextglue = traversers.glue +local nextpenalty = traversers.penalty local nextboundary = traversers.boundary local nextnode = traversers.node local nextlist = traversers.list @@ -75,6 +77,7 @@ local fontkern_code = nodes.kerncodes.fontkern local row_code = nodes.listcodes.alignment -- should be row local cell_code = nodes.listcodes.cell local line_code = nodes.listcodes.line +local linepenalty_code = nodes.penaltycodes.linepanalty -- local preamble_pass = tex.alignmentcontextcodes.preamble -- local preroll_pass = tex.alignmentcontextcodes.preroll @@ -349,54 +352,79 @@ do local a_location = attributes.system("mathnumberlocation") local a_threshold = attributes.system("mathnumberthreshold") + local v_first = interfaces.variables.first + local v_last = interfaces.variables.last + local v_both = interfaces.variables.both + -- Here: local function openup(specification,head) - local inbetween = specification.inbetween or 0 - local height = specification.height or 0 - local depth = specification.depth or 0 - local lines = { } + local inbetween = specification.inbetween or 0 + local height = specification.height or 0 + local depth = specification.depth or 0 + local splitmethod = specification.splitmethod or "" + local lines = { } for n, id, subtype, list in nextlist, head do lines[#lines+1] = { n, subtype, getwhd(n) } end - local t = #lines - if t > 0 then - local l = 1 + local noflines = #lines + if noflines > 0 then + local currentline = 1 for n, subtype in nextglue, head do -- one day we can decide what to do with intertext stuff based on the -- subtype but not now ... on our agenda (intertext etc) if subtype == baselineskip_code or subtype == lineskip_code then + local nextline = currentline + 1 local amount, stretch, shrink = getglue(n) - local prevdp = lines[l] [5] - local nextht = lines[l+1][4] + local prevdp = lines[currentline][5] + local nextht = lines[nextline][4] local delta = 0 if prevdp < depth then - setdepth(lines[l][1],depth) + setdepth(lines[currentline][1],depth) delta = delta + (depth - prevdp) end if nextht < height then - setheight(lines[l+1][1],height) + setheight(lines[nextline][1],height) delta = delta + (height - nextht) end - if subtype == lineskip_code then - setglue(n,inbetween,stretch,shrink) +-- if subtype == lineskip_code then +-- setglue(n,inbetween,stretch,shrink) setsubtype(n,baselineskip_code) - else +-- else setglue(n,amount+inbetween-delta,stretch,shrink) - end - l = l + 1 --- if l > t then --- break -- end + curline = nextline +-- if currentline > noflines then +-- break +-- end + end + end + if splitmethod ~= "" then + local currentline = 0 + for n, subtype in nextpenalty, head do + if subtype == linepenalty_code then + if l == 1 then + if splitmethod == v_both or splitmethod == v_first then +print("FIRST") + setpenalty(n, 10000) + end + elseif l == noflines then + if splitmethod == v_both or splitmethod == v_last then +print("LAST") + setpenalty(n, 10000) + end + end + curline = currentline + end end end local firstht = lines[1][4] - local lastdp = lines[t][5] + local lastdp = lines[noflines][5] if firstht < height then setheight(lines[1],height) end if lastdp < depth then - setdepth(lines[t],depth) + setdepth(lines[noflines],depth) end end end diff --git a/tex/context/base/mkxl/node-mig.lmt b/tex/context/base/mkxl/node-mig.lmt index 890a7efbb..3e5454784 100644 --- a/tex/context/base/mkxl/node-mig.lmt +++ b/tex/context/base/mkxl/node-mig.lmt @@ -49,6 +49,7 @@ local t_sweeps = 0 local trialtypesetting = context.trialtypesetting function nodes.handlers.migrate(head,where) + -- is this still needed if head and not trialtypesetting() and where == "alignment" then if trace_migrations then report_nodes("migration sweep %a",where) diff --git a/tex/context/base/mkxl/page-brk.mkxl b/tex/context/base/mkxl/page-brk.mkxl index 31c7e64a4..23ffc872d 100644 --- a/tex/context/base/mkxl/page-brk.mkxl +++ b/tex/context/base/mkxl/page-brk.mkxl @@ -370,7 +370,7 @@ \relax} \permanent\tolerant\protected\def\checkpage[#1]#*[#2]% - {\relax % needed before \if + {\relax % look ahead prevention \endgraf \triggerpagebuilder \relax @@ -466,14 +466,17 @@ \definepagechecker[\s!unknown:2][\s!unknown:0][\c!method=2] \definepagechecker[\s!unknown:3][\s!unknown:0][\c!method=3] -\permanent\tolerant\protected\def\testpage [#1]#*[#2]{\normalexpanded{\checkpage[\s!unknown:1][\c!lines=#1,\c!offset=\ifparameter#2\or#2\else\zeropoint\fi]}} % -\permanent\tolerant\protected\def\testpageonly[#1]#*[#2]{\normalexpanded{\checkpage[\s!unknown:2][\c!lines=#1,\c!offset=\ifparameter#2\or#2\else\zeropoint\fi]}} % no penalties added to the mvl -\permanent\tolerant\protected\def\testpagesync[#1]#*[#2]{\normalexpanded{\checkpage[\s!unknown:3][\c!lines=#1,\c!offset=\ifparameter#2\or#2\else\zeropoint\fi]}} % force sync +% the \relax prevents premature expansion in case of lookahead + +\permanent\tolerant\protected\def\testpage [#1]#*[#2]{\relax\normalexpanded{\checkpage[\s!unknown:1][\c!lines=#1,\c!offset=\ifparameter#2\or#2\else\zeropoint\fi]}} % +\permanent\tolerant\protected\def\testpageonly[#1]#*[#2]{\relax\normalexpanded{\checkpage[\s!unknown:2][\c!lines=#1,\c!offset=\ifparameter#2\or#2\else\zeropoint\fi]}} % no penalties added to the mvl +\permanent\tolerant\protected\def\testpagesync[#1]#*[#2]{\relax\normalexpanded{\checkpage[\s!unknown:3][\c!lines=#1,\c!offset=\ifparameter#2\or#2\else\zeropoint\fi]}} % force sync %D Test column breaks. \permanent\tolerant\protected\def\testcolumn[#1]#*[#2]% - {\ifdefined\page_otr_command_test_column + {\relax % look ahead prevention + \ifdefined\page_otr_command_test_column \ifparameter#2\or \page_otr_command_test_column[#1][#2]% \else diff --git a/tex/context/base/mkxl/spac-ali.mkxl b/tex/context/base/mkxl/spac-ali.mkxl index 141adff0a..6ca9e5e55 100644 --- a/tex/context/base/mkxl/spac-ali.mkxl +++ b/tex/context/base/mkxl/spac-ali.mkxl @@ -1253,6 +1253,9 @@ \letcsname\??alignsimplereverse\v!flushright\endcsname\spac_align_simple_left \letcsname\??alignsimplereverse\v!middle \endcsname\spac_align_simple_middle +\protected\def\spac_align_simple#1% + {\begincsname\??alignsimple#1\endcsname} + \permanent\protected\def\simplealignedbox#1#2% {\hbox \ifdim#1>\zeropoint to #1 \ifcsname\??alignsimple#2\endcsname diff --git a/tex/context/base/mkxl/spac-prf.mklx b/tex/context/base/mkxl/spac-prf.mklx index 6b4a966f2..824b14ca7 100644 --- a/tex/context/base/mkxl/spac-prf.mklx +++ b/tex/context/base/mkxl/spac-prf.mklx @@ -20,7 +20,11 @@ \unprotect -\registerctxluafile{spac-prf}{autosuffix} +\doiffileelse{spac-prf-new.lmt}{ + \registerctxluafile{spac-prf-new}{autosuffix} +} { + \registerctxluafile{spac-prf}{autosuffix} +} \definesystemattribute[profilemethod][public] @@ -52,13 +56,15 @@ \c!distance=\zeropoint, \c!factor=\plusone] -\defineprofile[halffixed] [\v!fixed][\c!factor=\plustwo] -\defineprofile[quarterfixed][\v!fixed][\c!factor=\plusfour] -\defineprofile[eightsfixed] [\v!fixed][\c!factor=\pluseight] +\appendtoks + \ifcstok{\profileparameter\c!define}\v!yes + \frozen\protected\edefcsname\e!start\currentprofile\endcsname{\spac_profile_start{\currentprofile}}% + \frozen\protected\defcsname \e!stop \currentprofile\endcsname{\spac_profile_stop}% + \fi +\to \everydefineprofile -\permanent\protected\def\setprofile[#profile]% - {\edef\currentprofile{#profile}% - \clf_setprofile +\def\spac_profile_set + {\clf_setprofile name {\currentprofile}% height \dimexpr\profileparameter\c!height\relax depth \dimexpr\profileparameter\c!depth\relax @@ -68,6 +74,36 @@ method {\profileparameter\c!method}% \relax} +\tolerant\protected\def\spac_profile_start#profile#spacer[#settings]% + {\begingroup + \ifparameter#settings\or + \edef\currentprofile{#profile}% + \setupcurrentprofile[#settings]% + \orelse\ifhastok={#profile}% + \let\currentprofile\v!none + \setupcurrentprofile[#profile]% + \else + \edef\currentprofile{#profile}% + \fi + \spac_profile_set + \par + \profileparameter\c!before} + +\protected\def\spac_profile_stop + {\par % otherwise not applied + \profileparameter\c!after + \endgroup} + +\permanent\protected\def\startprofile[#profile]% + {\spac_profile_start{#profile}} + +\permanent\protected\def\stopprofile + {\spac_profile_stop} + +\permanent\protected\def\setprofile[#profile]% + {\edef\currentprofile{#profile}% + \spac_profile_set} + \permanent\protected\def\resetprofile {\c_attr_profilemethod\attributeunsetvalue} @@ -110,4 +146,8 @@ \relax \endgroup} +\defineprofile[halffixed] [\v!fixed][\c!factor=\plustwo] +\defineprofile[quarterfixed][\v!fixed][\c!factor=\plusfour] +\defineprofile[eightsfixed] [\v!fixed][\c!factor=\pluseight] + \protect \endinput diff --git a/tex/context/base/mkxl/strc-lst.lmt b/tex/context/base/mkxl/strc-lst.lmt new file mode 100644 index 000000000..467d916d8 --- /dev/null +++ b/tex/context/base/mkxl/strc-lst.lmt @@ -0,0 +1,1512 @@ +if not modules then modules = { } end modules ['strc-lst'] = { + version = 1.001, + comment = "companion to strc-lst.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- when all datastructures are stable a packer will be added which will +-- bring down memory consumption a bit; we can use for instance a pagenumber, +-- section, metadata cache (internal then has to move up one level) or a +-- shared cache [we can use a fast and stupid serializer] + +-- todo: tag entry in list is crap +-- +-- move more to commands + +local tonumber, type, next = tonumber, type, next +local concat, insert, remove, sort = table.concat, table.insert, table.remove, table.sort +local lpegmatch = lpeg.match + +local setmetatableindex = table.setmetatableindex +local sortedkeys = table.sortedkeys + +local settings_to_set = utilities.parsers.settings_to_set +local allocate = utilities.storage.allocate +local checked = utilities.storage.checked + +local trace_lists = false trackers.register("structures.lists", function(v) trace_lists = v end) + +local report_lists = logs.reporter("structure","lists") + +local context = context +local commands = commands +local implement = interfaces.implement +local conditionals = tex.conditionals + +local ctx_latelua = context.latelua + +local cheat = true + +local structures = structures +local lists = structures.lists +local sections = structures.sections +local helpers = structures.helpers +local documents = structures.documents +local tags = structures.tags +local counters = structures.counters +local references = structures.references + +local collected = allocate() +local tobesaved = allocate() +local cached = allocate() +local pushed = allocate() +local kinds = allocate() +local names = allocate() + +lists.collected = collected +lists.tobesaved = tobesaved + +lists.enhancers = lists.enhancers or { } +-----.internals = allocate(lists.internals or { }) -- to be checked +lists.ordered = allocate(lists.ordered or { }) -- to be checked +lists.cached = cached +lists.pushed = pushed +lists.kinds = kinds +lists.names = names + +local sorters = sorters +local sortstripper = sorters.strip +local sortsplitter = sorters.splitters.utf +local sortcomparer = sorters.comparers.basic + +local sectionblocks = allocate() +lists.sectionblocks = sectionblocks + +references.specials = references.specials or { } + +local matchingtilldepth = sections.matchingtilldepth +local numberatdepth = sections.numberatdepth +local getsectionlevel = sections.getlevel +local typesetnumber = sections.typesetnumber +local autosectiondepth = sections.autodepth + +local variables = interfaces.variables + +local v_all = variables.all +local v_reference = variables.reference +local v_title = variables.title +local v_command = variables.command +local v_text = variables.text +local v_current = variables.current +local v_previous = variables.previous +local v_intro = variables.intro +local v_here = variables.here +local v_component = variables.component +local v_product = variables.product +local v_local = variables["local"] +local v_default = variables.default + +local cheats = { + [variables.fit] = true, + [variables.tight] = true, +} + +local function zerostrippedconcat(t,separator) + local f = 1 + local l = #t + for i=f,l do + if t[i] == 0 then + f = f + 1 + end + end + for i=l,f,-1 do + if t[i] == 0 then + l = l - 1 + end + end + return concat(t,separator,f,l) +end + +-- -- -- -- -- -- + +local function initializer() + -- create a cross reference between internal references + -- and list entries + local collected = lists.collected + local internals = checked(references.internals) + local ordered = lists.ordered + local usedinternals = references.usedinternals + local blockdone = { } + local lastblock = nil + for i=1,#collected do + local c = collected[i] + local m = c.metadata + local r = c.references + if m then + -- access by internal reference + if r then + local internal = r.internal + if internal then + internals[internal] = c + usedinternals[internal] = r.used + end + local block = r.block + if not block then + -- shouldn't happen + elseif lastblock == block then + -- we're okay + elseif lastblock then + if blockdone[block] then + report_lists("out of order sectionsblocks, maybe use \\setsectionblock") + else + blockdone[block] = true + sectionblocks[#sectionblocks+1] = block + end + lastblock = block + elseif not blockdone[block] then + blockdone[block] = true + sectionblocks[#sectionblocks+1] = block + lastblock = block + end + end + -- access by order in list + local kind = m.kind + local name = m.name + if kind and name then + local ok = ordered[kind] + if ok then + local on = ok[name] + if on then + on[#on+1] = c + else + ok[name] = { c } + end + else + ordered[kind] = { [name] = { c } } + end + kinds[kind] = true + names[name] = true + elseif kind then + kinds[kind] = true + elseif name then + names[name] = true + end + end + if r then + r.listindex = i -- handy to have + end + end +end + +local function finalizer() + local flaginternals = references.flaginternals + local usedviews = references.usedviews + for i=1,#tobesaved do + local r = tobesaved[i].references + if r then + local i = r.internal + local f = flaginternals[i] + local v = usedviews[i] + if cheat and v and cheats[v] then -- cheats check added, to be tested by RKB + -- this permits runs=2 with interactivity + r.view = v + end + if f then + r.used = v or true + end + end + end +end + +job.register('structures.lists.collected', tobesaved, initializer, finalizer) + +local groupindices = setmetatableindex("table") + +function lists.groupindex(name,group) + local groupindex = groupindices[name] + return groupindex and groupindex[group] or 0 +end + +-- we could use t (as hash key) in order to check for dup entries + +function lists.addto(t) -- maybe more more here (saves parsing at the tex end) + local metadata = t.metadata + local userdata = t.userdata + local numberdata = t.numberdata + if userdata and type(userdata) == "string" then + t.userdata = helpers.touserdata(userdata) + end + if not metadata.level then + metadata.level = structures.sections.currentlevel() -- this is not used so it will go away + end + -- + -- if not conditionals.inlinelefttoright then + -- metadata.idir = "r2l" + -- end + -- if not conditionals.displaylefttoright then + -- metadata.ddir = "r2l" + -- end + -- + if numberdata then + local numbers = numberdata.numbers + if type(numbers) == "string" then + counters.compact(numberdata,numbers,numberdata.level) + end + end + local group = numberdata and numberdata.group + local name = metadata.name + local kind = metadata.kind + if not group then + -- forget about it + elseif group == "" then + group, numberdata.group = nil, nil + else + local groupindex = groupindices[name][group] + if groupindex then + numberdata.numbers = cached[groupindex].numberdata.numbers + end + end + local setcomponent = references.setcomponent + if setcomponent then + setcomponent(t) -- can be inlined + end + local r = t.references + if r and not r.section then + r.section = structures.sections.currentid() + end + local b = r and t.block + if r and not b then + local s = r.section + if s then + s = structures.sections.tobesaved[s] + r.block = s and s.block or nil + end + end + local i = r and r.internal or 0 -- brrr + if r and kind and name then + local tag = tags.getid(kind,name) + if tag and tag ~= "?" then + r.tag = tag -- todo: use internal ... is unique enough + end + end + local p = pushed[i] + if not p then + p = #cached + 1 + cached[p] = helpers.simplify(t) + pushed[i] = p + if r then + r.listindex = p + end + end + if group then + groupindices[name][group] = p + end + if trace_lists then + report_lists("added %a, internal %a",name,p) + end + return p +end + +function lists.discard(n) + n = tonumber(n) + if not n then + -- maybe an error message + elseif n == #cached then + cached[n] = nil + n = n - 1 + while n > 0 and cached[n] == false do + cached[n] = nil -- collect garbage + n = n - 1 + end + else + cached[n] = false + end +end + +function lists.iscached(n) + return cached[tonumber(n)] +end + +-- this is the main pagenumber enhancer + +local enhanced = { } + +local synchronizepage = function(r) -- bah ... will move + synchronizepage = references.synchronizepage + return synchronizepage(r) +end + +local function enhancelist(specification) + local n = specification.n + local l = cached[n] + if not l then + report_lists("enhancing %a, unknown internal",n) + elseif enhanced[n] then + if trace_lists then + report_lists("enhancing %a, name %a, duplicate ignored",n,name) + end + else + local metadata = l.metadata + local references = l.references + -- + l.directives = nil -- might change + -- save in the right order (happens at shipout) + lists.tobesaved[#lists.tobesaved+1] = l + -- default enhancer (cross referencing) + synchronizepage(references) + -- tags + local kind = metadata.kind + local name = metadata.name + if trace_lists then + report_lists("enhancing %a, name %a, page %a",n,name,references.realpage or 0) + end +-- if references then +-- -- is this used ? +-- local tag = tags.getid(kind,name) +-- if tag and tag ~= "?" then +-- references.tag = tag +-- end +-- end + -- specific enhancer (kind of obsolete) + local enhancer = kind and lists.enhancers[kind] + if enhancer then + enhancer(l) + end + -- + enhanced[n] = true + return l + end +end + +lists.enhance = enhancelist + +-- we can use level instead but we can also decide to remove level from the metadata + +local nesting = { } + +function lists.pushnesting(i) + local parent = lists.result[i] + local name = parent.metadata.name + local numberdata = parent and parent.numberdata + local numbers = numberdata and numberdata.numbers + local number = numbers and numbers[getsectionlevel(name)] or 0 + insert(nesting, { + number = number, + name = name, + result = lists.result, + parent = parent + }) +end + +function lists.popnesting() + local old = remove(nesting) + if old then + lists.result = old.result + else + report_lists("nesting error") + end +end + +-- Historically we had blocks but in the mkiv approach that could as well be a level +-- which would simplify things a bit. + +local splitter = lpeg.splitat(":") -- maybe also :: or have a block parameter + +local listsorters = { + [v_command] = function(a,b) + if a.metadata.kind == "command" or b.metadata.kind == "command" then + return a.references.internal < b.references.internal + else + return a.references.order < b.references.order + end + end, + [v_all] = function(a,b) + return a.references.internal < b.references.internal + end, + [v_title] = function(a,b) + local da = a.titledata + local db = b.titledata + if da and db then + local ta = da.title + local tb = db.title + if ta and tb then + local sa = da.split + if not sa then + sa = sortsplitter(sortstripper(ta)) + da.split = sa + end + local sb = db.split + if not sb then + sb = sortsplitter(sortstripper(tb)) + db.split = sb + end + return sortcomparer(da,db) == -1 + end + end + return a.references.internal < b.references.internal + end +} + +-- was: names, criterium, number, collected, forced, nested, sortorder + +local filters = setmetatableindex(function(t,k) return t[v_default] end) + +local function filtercollected(specification) + -- + local names = specification.names or { } + local criterium = specification.criterium or v_default + local number = 0 -- specification.number + local reference = specification.reference or "" + local collected = specification.collected or lists.collected + local forced = specification.forced or { } + local nested = specification.nested or false + local sortorder = specification.sortorder or specification.order + -- + local numbers = documents.data.numbers + local depth = documents.data.depth + local block = false -- all + local wantedblock, wantedcriterium = lpegmatch(splitter,criterium) -- block:criterium + if wantedblock == "" or wantedblock == v_all or wantedblock == v_text then + criterium = wantedcriterium ~= "" and wantedcriterium or criterium + elseif not wantedcriterium then + block = documents.data.block + else + block = wantedblock + criterium = wantedcriterium + end + if block == "" then + block = false + end + if type(names) == "string" then + names = settings_to_set(names) + end + local all = not next(names) or names[v_all] or false + -- + specification.names = names + specification.criterium = criterium + specification.number = 0 -- obsolete + specification.reference = reference -- new + specification.collected = collected + specification.forced = forced -- todo: also on other branched, for the moment only needed for bookmarks + specification.nested = nested + specification.sortorder = sortorder + specification.numbers = numbers + specification.depth = depth + specification.block = block + specification.all = all + -- + if specification.atmost then + criterium = v_text + end + -- + if trace_lists then + report_lists("filtering names %,t, criterium %a, block %a",sortedkeys(names), criterium, block or "*") + end + local result = filters[criterium](specification) + if trace_lists then + report_lists("criterium %a, block %a, found %a",specification.criterium, specification.block or "*", #result) + end + -- + local levels = tonumber(specification.levels) + if levels then + local minlevel = 1000 + local found = result + local nofresult = #result + for i=1,nofresult do + local v = found[i] + local l = v.metadata.level or 1 + if l < minlevel then + minlevel = l + end + end + local maxlevel = minlevel + levels - 1 + result = { } + nofresult = 0 + for i=1,#found do + local v = found[i] + local l = v.metadata.level or 1 + if l >= minlevel and l <= maxlevel then + nofresult = nofresult + 1 + result[nofresult] = v + end + end + end + -- + if sortorder then -- experiment + local sorter = listsorters[sortorder] + if sorter then + if trace_lists then + report_lists("sorting list using method %a",sortorder) + end + for i=1,#result do + result[i].references.order = i + end + sort(result,sorter) + end + end + -- + return result +end + +filters[v_intro] = function(specification) + local collected = specification.collected + local result = { } + local nofresult = 0 + local all = specification.all + local names = specification.names + for i=1,#collected do + local v = collected[i] + local metadata = v.metadata + if metadata and (all or names[metadata.name or false]) then + local r = v.references + if r and r.section == 0 then + nofresult = nofresult + 1 + result[nofresult] = v + end + end + end + return result +end + +filters[v_reference] = function(specification) + local collected = specification.collected + local result = { } + local nofresult = 0 + local names = specification.names + local sections = sections.collected + local reference = specification.reference + if reference ~= "" then + local prefix, rest = lpegmatch(references.prefixsplitter,reference) -- p::r + local r = prefix and rest and references.derived[prefix][rest] or references.derived[""][reference] + local s = r and r.numberdata -- table ref ! + if s then + local depth = getsectionlevel(r.metadata.name) + local numbers = s.numbers + for i=1,#collected do + local v = collected[i] + local r = v.references + if r and (not block or not r.block or block == r.block) then + local metadata = v.metadata + if metadata and names[metadata.name or false] then + local sectionnumber = (r.section == 0) or sections[r.section] + if sectionnumber then + if matchingtilldepth(depth,numbers,sectionnumber.numbers) then + nofresult = nofresult + 1 + result[nofresult] = v + end + end + end + end + end + else + report_lists("unknown reference %a specified",reference) + end + else + report_lists("no reference specified") + end + return result +end + +-- maybe: +-- +-- filters[v_reference] = function(specification) +-- local collected = specification.collected +-- local result = { } +-- local nofresult = 0 +-- local names = specification.names +-- local sections = sections.collected +-- local reference = specification.reference +-- if reference ~= "" then +-- local split = references.splitreference(reference) +-- if split then +-- local prefix = split and split.outer +-- local rest = split and split.inner +-- if prefix and rest then +-- local d = references.derived +-- local r = (d[prefix] and d[prefix][rest]) or (d[""] and d[""][reference]) +-- local s = r and r.numberdata -- table ref ! +-- if s then +-- local depth = getsectionlevel(r.metadata.name) +-- local numbers = s.numbers +-- for i=1,#collected do +-- local v = collected[i] +-- local r = v.references +-- if r and (not block or not r.block or block == r.block) then +-- local metadata = v.metadata +-- if metadata and names[metadata.name or false] then +-- local sectionnumber = (r.section == 0) or sections[r.section] +-- if sectionnumber then +-- if matchingtilldepth(depth,numbers,sectionnumber.numbers) then +-- nofresult = nofresult + 1 +-- result[nofresult] = v +-- end +-- end +-- end +-- end +-- end +-- else +-- report_lists("unknown reference %a specified",reference) +-- end +-- end +-- end +-- else +-- report_lists("no reference specified") +-- end +-- return result +-- end + +filters[v_all] = function(specification) + local collected = specification.collected + local result = { } + local nofresult = 0 + local block = specification.block + local all = specification.all + local forced = specification.forced + local names = specification.names + local sections = sections.collected + for i=1,#collected do + local v = collected[i] + local r = v.references + if r and (not block or not r.block or block == r.block) then + local metadata = v.metadata + if metadata then + local name = metadata.name or false + local sectionnumber = (r.section == 0) or sections[r.section] + if forced[name] or (sectionnumber and not metadata.nolist and (all or names[name])) then -- and not sectionnumber.hidenumber then + nofresult = nofresult + 1 + result[nofresult] = v + end + end + end + end + return result +end + +filters[v_text] = filters[v_all] + +filters[v_current] = function(specification) + if specification.depth == 0 then + specification.nested = false + specification.criterium = v_intro + return filters[v_intro](specification) + end + local collected = specification.collected + local result = { } + local nofresult = 0 + local depth = specification.depth + local block = specification.block + local all = specification.all + local names = specification.names + local numbers = specification.numbers + local sections = sections.collected + for i=1,#collected do + local v = collected[i] + local r = v.references + if r and (not block or not r.block or block == r.block) then + local sectionnumber = sections[r.section] + if sectionnumber then -- and not sectionnumber.hidenumber then + local cnumbers = sectionnumber.numbers + local metadata = v.metadata + if cnumbers then + if metadata and not metadata.nolist and (all or names[metadata.name or false]) and #cnumbers > depth then + local ok = true + for d=1,depth do + local cnd = cnumbers[d] + if not (cnd == 0 or cnd == numbers[d]) then + ok = false + break + end + end + if ok then + nofresult = nofresult + 1 + result[nofresult] = v + end + end + end + end + end + end + return result +end + +filters[v_here] = function(specification) + -- this is quite dirty ... as cnumbers is not sparse we can misuse #cnumbers + if specification.depth == 0 then + specification.nested = false + specification.criterium = v_intro + return filters[v_intro](specification) + end + local collected = specification.collected + local result = { } + local nofresult = 0 + local depth = specification.depth + local block = specification.block + local all = specification.all + local names = specification.names + local numbers = specification.numbers + local sections = sections.collected + for i=1,#collected do + local v = collected[i] + local r = v.references + if r then -- and (not block or not r.block or block == r.block) then + local sectionnumber = sections[r.section] + if sectionnumber then -- and not sectionnumber.hidenumber then + local cnumbers = sectionnumber.numbers + local metadata = v.metadata + if cnumbers then + if metadata and not metadata.nolist and (all or names[metadata.name or false]) and #cnumbers >= depth then + local ok = true + for d=1,depth do + local cnd = cnumbers[d] + if not (cnd == 0 or cnd == numbers[d]) then + ok = false + break + end + end + if ok then + nofresult = nofresult + 1 + result[nofresult] = v + end + end + end + end + end + end + return result +end + +filters[v_previous] = function(specification) + if specification.depth == 0 then + specification.nested = false + specification.criterium = v_intro + return filters[v_intro](specification) + end + local collected = specification.collected + local result = { } + local nofresult = 0 + local block = specification.block + local all = specification.all + local names = specification.names + local numbers = specification.numbers + local sections = sections.collected + local depth = specification.depth + for i=1,#collected do + local v = collected[i] + local r = v.references + if r and (not block or not r.block or block == r.block) then + local sectionnumber = sections[r.section] + if sectionnumber then -- and not sectionnumber.hidenumber then + local cnumbers = sectionnumber.numbers + local metadata = v.metadata + if cnumbers then + if metadata and not metadata.nolist and (all or names[metadata.name or false]) and #cnumbers >= depth then + local ok = true + for d=1,depth-1 do + local cnd = cnumbers[d] + if not (cnd == 0 or cnd == numbers[d]) then + ok = false + break + end + end + if ok then + nofresult = nofresult + 1 + result[nofresult] = v + end + end + end + end + end + end + return result +end + +filters[v_local] = function(specification) + local numbers = specification.numbers + local nested = nesting[#nesting] + if nested then + return filtercollected { + names = specification.names, + criterium = nested.name, + collected = specification.collected, + forced = specification.forced, + nested = nested, + sortorder = specification.sortorder, + } + else + specification.criterium = autosectiondepth(numbers) == 0 and v_all or v_current + specification.nested = false + return filtercollected(specification) -- rechecks, so better (for determining all) + end +end + +filters[v_component] = function(specification) + -- special case, no structure yet + local collected = specification.collected + local result = { } + local nofresult = 0 + local all = specification.all + local names = specification.names + local component = resolvers.jobs.currentcomponent() or "" + if component ~= "" then + for i=1,#collected do + local v = collected[i] + local r = v.references + local m = v.metadata + if r and r.component == component and (m and names[m.name] or all) then + nofresult = nofresult + 1 + result[nofresult] = v + end + end + end + return result +end + +filters[v_product] = function(specification) + local reference = specification.reference + if reference and reference ~= "" then +-- local utilitydata = job.loadother(reference,true) + local fullname = file.replacesuffix(reference,"tuc") + if lfs.isfile(fullname) then + local utilitydata = job.loadother(fullname) + if utilitydata then + local collected = utilitydata.structures.lists.collected or { } + setmetatableindex(collected,{ external = reference }) + return collected + end + end + end + return { } +end + +-- local number = tonumber(number) or numberatdepth(depth) or 0 +-- if number > 0 then +-- ... +-- end + +filters[v_default] = function(specification) -- is named + local collected = specification.collected + local result = { } + local nofresult = 0 + ----- depth = specification.depth + local block = specification.block + local criterium = specification.criterium + local all = specification.all + local names = specification.names + local numbers = specification.numbers + local sections = sections.collected + local reference = specification.reference + local nested = specification.nested + -- + if reference then + reference = tonumber(reference) + end + -- + local depth = getsectionlevel(criterium) + local pnumbers = nil + local pblock = block + local parent = nested and nested.parent + -- + if parent then + pnumbers = parent.numberdata.numbers or pnumbers -- so local as well as nested + pblock = parent.references.block or pblock + if trace_lists then + report_lists("filtering by block %a and section %a",pblock,criterium) + end + end + -- + for i=1,#collected do + local v = collected[i] + local r = v.references +-- inspect(v) + if r and (not block or not r.block or pblock == r.block) then + local sectionnumber = sections[r.section] + if sectionnumber then + local metadata = v.metadata + local cnumbers = sectionnumber.numbers + if cnumbers then + if all or names[metadata.name or false] then + if reference then + -- filter by number + if reference == cnumbers[depth] then + nofresult = nofresult + 1 + result[nofresult] = v + end + else + if #cnumbers >= depth and matchingtilldepth(depth,cnumbers,pnumbers) then + nofresult = nofresult + 1 + result[nofresult] = v + end + end + end + end + end + end + end + return result +end + +-- names, criterium, number, collected, forced, nested, sortorder) -- names is hash or string + +lists.filter = filtercollected + +lists.result = { } + +function lists.getresult(r) + return lists.result[r] +end + +function lists.process(specification) + local result = filtercollected(specification) + local total = #result + lists.result = result + if total > 0 then + local usedinternals = references.usedinternals + local usedviews = references.usedviews + local specials = settings_to_set(specification.extras or "") + specials = next(specials) and specials or nil + for i=1,total do + local listentry = result[i] + local metadata = listentry.metadata + local numberdata = listentry.numberdata + local references = listentry.references + local special = specials and numberdata and specials[zerostrippedconcat(numberdata.numbers,".")] or "" + if cheat and references then + -- this permits runs=2 with interactivity + local internal = references.internal + usedinternals[internal] = true + usedviews [internal] = references.view + end + context.strclistsentryprocess(metadata.name,metadata.kind,i,special) + end + end +end + +function lists.analyze(specification) + lists.result = filtercollected(specification) +end + +function lists.userdata(name,r,tag) -- to tex (todo: xml) + local result = lists.result[r] + if result then + local userdata = result.userdata + local str = userdata and userdata[tag] + if str then + return str, result.metadata + end + end +end + +function lists.uservalue(name,r,tag,default) -- to lua + local str = lists.result[r] + if str then + str = str.userdata + end + if str then + str = str[tag] + end + return str or default +end + +function lists.size() + return #lists.result +end + +function lists.external(n) + return lists.result.external or "" +end + +function lists.location(n) + local l = lists.result[n] + return l and l.references.internal or n +end + +function lists.label(n,default) + local l = lists.result[n] + local t = l.titledata + return t and t.label or default or "" +end + +function lists.sectionnumber(name,n,spec) + local data = lists.result[n] + local sectiondata = sections.collected[data.references.section] + -- hm, prefixnumber? + typesetnumber(sectiondata,"prefix",spec,sectiondata) -- data happens to contain the spec too +end + +-- some basics (todo: helpers for pages) + +function lists.title(name,n,tag) -- tag becomes obsolete + local data = lists.result[n] + if data then + local titledata = data.titledata + if titledata then + helpers.title(titledata[tag] or titledata.list or titledata.title or "",data.metadata) + end + end +end + +function lists.hastitledata(name,n,tag) + local data = cached[tonumber(n)] + if data then + local titledata = data.titledata + if titledata then + return (titledata[tag] or titledata.title or "") ~= "" + end + end + return false +end + +function lists.haspagedata(name,n) + local data = lists.result[n] + if data then + local references = data.references + if references and references.realpage then -- or references.pagedata + return true + end + end + return false +end + +function lists.hasnumberdata(name,n) + local data = lists.result[n] + if data then + local numberdata = data.numberdata + if numberdata and not numberdata.hidenumber then -- the hide number is true + return true + end + end + return false +end + +function lists.rawnumber(n,name) + local data = lists.result[n] + if data then + local numberdata = data.numberdata + if numberdata then + numberdata = numberdata.numbers + return numberdata and numberdata[getsectionlevel(name)] or numberdata[name] or 0 + end + end + return 0 +end + +function lists.prefix(name,n,spec) + helpers.prefix(lists.result[n],spec) +end + +function lists.page(name,n,pagespec) + helpers.page(lists.result[n],pagespec) +end + +function lists.prefixedpage(name,n,prefixspec,pagespec) + helpers.prefixpage(lists.result[n],prefixspec,pagespec) +end + +function lists.realpage(name,n) + local data = lists.result[n] + if data then + local references = data.references + return references and references.realpage or 0 + else + return 0 + end +end + +-- numbers stored in entry.numberdata + entry.numberprefix + +function lists.number(name,n,spec) + local data = lists.result[n] + if data then + local numberdata = data.numberdata + if numberdata then + typesetnumber(numberdata,"number",spec or false,numberdata or false) + end + end +end + +function lists.prefixednumber(name,n,prefixspec,numberspec,forceddata) + local data = lists.result[n] + if data then + helpers.prefix(data,prefixspec) + local numberdata = data.numberdata or forceddata + if numberdata then + typesetnumber(numberdata,"number",numberspec or false,numberdata or false) + end + end +end + +-- todo, do this in references namespace ordered instead (this is an experiment) +-- +-- also see lpdf-ano (maybe move this there) + +local splitter = lpeg.splitat(":") + +function references.specials.order(var,actions) -- references.specials ! + local operation = var.operation + if operation then + local kind, name, n = lpegmatch(splitter,operation) + local order = lists.ordered[kind] + order = order and order[name] + local v = order[tonumber(n)] + local r = v and v.references.realpage + if r then + actions.realpage = r + var.operation = r -- brrr, but test anyway + return references.specials.page(var,actions) + end + end +end + +-- interface (maybe strclistpush etc) + +if not lists.reordered then + function lists.reordered(data) + return data.numberdata + end +end + +implement { name = "pushlist", actions = lists.pushnesting, arguments = "integer" } +implement { name = "poplist", actions = lists.popnesting } + +implement { + name = "addtolist", + actions = { lists.addto, context }, + arguments = { + { + { "references", { + { "internal", "integer" }, + { "block" }, + { "section", "integer" }, + { "location" }, + { "prefix" }, + { "reference" }, + { "view" }, + { "order", "integer" }, + } + }, + { "metadata", { + { "kind" }, + { "name" }, + { "level", "integer" }, + { "catcodes", "integer" }, + { "coding" }, + { "xmlroot" }, + { "setup" }, + } + }, + { "userdata" }, + { "titledata", { + { "label" }, + { "title" }, + { "bookmark" }, + { "marking" }, + { "list" }, + { "reference" }, + } + }, + { "prefixdata", { + { "prefix" }, + { "separatorset" }, + { "conversionset" }, + { "conversion" }, + { "set" }, + { "segments" }, + { "connector" }, + } + }, + { "numberdata", { + { "level", "integer" }, + { "numbers" }, + { "groupsuffix" }, + { "group" }, + { "counter" }, + { "separatorset" }, + { "conversionset" }, + { "conversion" }, + { "starter" }, + { "stopper" }, + { "segments" }, + } + } + } + } +} + +implement { + name = "enhancelist", + arguments = "integer", + actions = function(n) + enhancelist { n = n } + end +} + +implement { + name = "deferredenhancelist", + arguments = "integer", + protected = true, -- for now, pre 1.09 + actions = function(n) + ctx_latelua { action = enhancelist, n = n } + end, +} + +implement { + name = "processlist", + actions = lists.process, + arguments = { + { + { "names" }, + { "criterium" }, + { "reference" }, + { "extras" }, + { "order" }, + { "levels" }, + } + } +} + +implement { + name = "analyzelist", + actions = lists.analyze, + arguments = { + { + { "names" }, + { "criterium" }, + { "reference" }, + } + } +} + +implement { + name = "listtitle", + actions = lists.title, + arguments = { "string", "integer" } +} + +implement { + name = "listprefixednumber", + actions = lists.prefixednumber, + arguments = { + "string", + "integer", + { + { "prefix" }, + { "separatorset" }, + { "conversionset" }, + { "starter" }, + { "stopper" }, + { "set" }, + { "segments" }, + { "connector" }, + }, + { + { "separatorset" }, + { "conversionset" }, + { "starter" }, + { "stopper" }, + { "segments" }, + } + } +} + +implement { + name = "listprefixedpage", + actions = lists.prefixedpage, + arguments = { + "string", + "integer", + { + { "separatorset" }, + { "conversionset" }, + { "set" }, + { "segments" }, + { "connector" }, + }, + { + { "prefix" }, + { "conversionset" }, + { "starter" }, + { "stopper" }, + } + } +} + +implement { name = "listsize", actions = { lists.size, context } } +implement { name = "listexternal", actions = { lists.external, context }, arguments = "integer" } +implement { name = "listlocation", actions = { lists.location, context }, arguments = "integer" } +implement { name = "listlabel", actions = { lists.label, context }, arguments = { "integer", "string" } } +implement { name = "listrealpage", actions = { lists.realpage, context }, arguments = { "string", "integer" } } +implement { name = "listgroupindex", actions = { lists.groupindex, context }, arguments = "2 strings", } + +implement { + name = "currentsectiontolist", + actions = { sections.current, lists.addto, context } +} + +local function userdata(name,r,tag) + local str, metadata = lists.userdata(name,r,tag) + if str then + -- local catcodes = metadata and metadata.catcodes + -- if catcodes then + -- context.sprint(catcodes,str) + -- else + -- context(str) + -- end + helpers.title(str,metadata) + end +end + +implement { + name = "listuserdata", + actions = userdata, + arguments = { "string", "integer", "string" } +} + +-- we could also set variables .. names will change (when this module is done) +-- maybe strc_lists_savedtitle etc + +implement { name = "doifelselisthastitle", actions = { lists.hastitledata, commands.doifelse }, arguments = { "string", "integer" } } +implement { name = "doifelselisthaspage", actions = { lists.haspagedata, commands.doifelse }, arguments = { "string", "integer" } } +implement { name = "doifelselisthasnumber", actions = { lists.hasnumberdata, commands.doifelse }, arguments = { "string", "integer" } } +implement { name = "doifelselisthasentry", actions = { lists.iscached, commands.doifelse }, arguments = "integer" } + +local function savedlisttitle(name,n,tag) + local data = cached[tonumber(n)] + if data then + local titledata = data.titledata + if titledata then + helpers.title(titledata[tag] or titledata.title or "",data.metadata) + end + end +end + +local function savedlistnumber(name,n) + local data = cached[tonumber(n)] + if data then + local numberdata = data.numberdata + if numberdata then + typesetnumber(numberdata,"number",numberdata or false) + end + end +end + +local function savedlistprefixednumber(name,n) + local data = cached[tonumber(n)] + if data then + local numberdata = lists.reordered(data) + if numberdata then + helpers.prefix(data,data.prefixdata) + typesetnumber(numberdata,"number",numberdata or false) + end + end +end + +lists.savedlisttitle = savedlisttitle +lists.savedlistnumber = savedlistnumber +lists.savedlistprefixednumber = savedlistprefixednumber + +implement { + name = "savedlistnumber", + actions = savedlistnumber, + arguments = { "string", "integer" } +} + +implement { + name = "savedlisttitle", + actions = savedlisttitle, + arguments = { "string", "integer" } +} + +implement { + name = "savedlistprefixednumber", + actions = savedlistprefixednumber, + arguments = { "string", "integer" } +} + +implement { + name = "discardfromlist", + actions = lists.discard, + arguments = "integer" +} + +implement { + name = "rawlistnumber", + actions = { lists.rawnumber, context }, + arguments = { "integer", "string" }, +} + +-- new and experimental and therefore off by default + +lists.autoreorder = false -- true + +local function addlevel(t,k) + local v = { } + setmetatableindex(v,function(t,k) + local v = { } + t[k] = v + return v + end) + t[k] = v + return v +end + +local internals = setmetatableindex({ }, function(t,k) + + local sublists = setmetatableindex({ },addlevel) + + local collected = lists.collected or { } + + for i=1,#collected do + local entry = collected[i] + local numberdata = entry.numberdata + if numberdata then + local metadata = entry.metadata + if metadata then + local references = entry.references + if references then + local kind = metadata.kind + local name = numberdata.counter or metadata.name + local internal = references.internal + if kind and name and internal then + local sublist = sublists[kind][name] + sublist[#sublist + 1] = { internal, numberdata } + end + end + end + end + end + + for k, v in next, sublists do + for k, v in next, v do + local tmp = { } + for i=1,#v do + tmp[i] = v[i] + end + sort(v,function(a,b) return a[1] < b[1] end) + for i=1,#v do + t[v[i][1]] = tmp[i][2] + end + end + end + + setmetatableindex(t,nil) + + return t[k] + +end) + +function lists.reordered(entry) + local numberdata = entry.numberdata + if lists.autoreorder then + if numberdata then + local metadata = entry.metadata + if metadata then + local references = entry.references + if references then + local kind = metadata.kind + local name = numberdata.counter or metadata.name + local internal = references.internal + if kind and name and internal then + return internals[internal] or numberdata + end + end + end + end + else + function lists.reordered(entry) + return entry.numberdata + end + end + return numberdata +end diff --git a/tex/context/base/mkxl/strc-lst.mklx b/tex/context/base/mkxl/strc-lst.mklx index 66fd5dfb0..66a801241 100644 --- a/tex/context/base/mkxl/strc-lst.mklx +++ b/tex/context/base/mkxl/strc-lst.mklx @@ -13,7 +13,7 @@ \writestatus{loading}{ConTeXt Structure Macros / Lists} -\registerctxluafile{strc-lst}{} +\registerctxluafile{strc-lst}{autosuffix} % clean up in progress ... % @@ -365,6 +365,9 @@ \def\strc_lists_process_pagenumber#1% {\begincsname\??listpagenumber#1\endcsname} +\permanent\def\structurelistexternal + {\clf_listexternal\numexpr\currentlistindex\relax} + \permanent\def\structurelistlocation {\clf_listlocation\numexpr\currentlistindex\relax} @@ -1449,12 +1452,53 @@ \strc_lists_interaction_check_nop \fi} +% \def\strc_lists_interaction_check_yes_yes +% {\edef\p_interaction_forward{\listparameter\c!interaction}% +% \ifcsname\??listinteractions\p_interaction_forward\endcsname +% %\expandafter\let\expandafter\p_interaction_forward\csname\??listinteractions\p_interaction_forward\endcsname +% \expandafter\let\expandafter\p_interaction_forward\lastnamedcs +% \strc_references_get_simple_reference{internal(\currentlistentrylocation)}% +% \a_strc_lists_reference\currentreferenceattribute +% \else +% \a_strc_lists_reference\attributeunsetvalue +% \fi +% \ifnum\a_strc_lists_reference=\attributeunsetvalue +% \let\strc_lists_get_reference_attribute\gobbleoneargument +% \let\strc_lists_set_reference_attribute\gobbleoneargument +% \let\strc_lists_set_style_color \strc_lists_set_style_color_normal +% \else +% \let\strc_lists_get_reference_attribute\strc_lists_get_reference_attribute_indeed +% \let\strc_lists_set_reference_attribute\strc_lists_set_reference_attribute_indeed +% \let\strc_lists_set_style_color \strc_lists_set_style_color_special +% \fi +% \edef\p_interaction_backward{\namedheadparameter\currentlist\c!interaction}% \namedheadparameter ! +% \ifx\p_interaction_backward\v!list +% \strc_references_set_simple_reference{*\currentlistentrylocation}% +% \a_strc_lists_destination\currentdestinationattribute +% \else +% \a_strc_lists_destination\attributeunsetvalue +% \fi +% \ifnum\a_strc_lists_destination=\attributeunsetvalue +% \lettonothing\strc_lists_get_destination_attribute +% \lettonothing\strc_lists_set_destination_attribute +% \else +% \let\strc_lists_get_destination_attribute\strc_lists_get_destination_attribute_indeed +% \let\strc_lists_set_destination_attribute\strc_lists_set_destination_attribute_indeed +% \fi} + \def\strc_lists_interaction_check_yes_yes - {\edef\p_interaction_forward{\listparameter\c!interaction}% + {\edef\p_interaction_forward {\listparameter\c!interaction}% + \edef\p_interaction_backward{\namedheadparameter\currentlist\c!interaction}% \namedheadparameter ! \ifcsname\??listinteractions\p_interaction_forward\endcsname %\expandafter\let\expandafter\p_interaction_forward\csname\??listinteractions\p_interaction_forward\endcsname \expandafter\let\expandafter\p_interaction_forward\lastnamedcs - \strc_references_get_simple_reference{internal(\currentlistentrylocation)}% + \ifcstok{\structurelistexternal}\emptytoks % luacall + \strc_references_get_simple_reference{internal(\currentlistentrylocation)}% + \else + % \writestatus{FAR OUT LIST}{\structurelistexternal::page(\number\structurelistrealpagenumber)}% + \strc_references_get_simple_reference{\structurelistexternal::page(\number\structurelistrealpagenumber)}% + \let\p_interaction_backward\empty + \fi \a_strc_lists_reference\currentreferenceattribute \else \a_strc_lists_reference\attributeunsetvalue @@ -1468,7 +1512,6 @@ \let\strc_lists_set_reference_attribute\strc_lists_set_reference_attribute_indeed \let\strc_lists_set_style_color \strc_lists_set_style_color_special \fi - \edef\p_interaction_backward{\namedheadparameter\currentlist\c!interaction}% \namedheadparameter ! \ifx\p_interaction_backward\v!list \strc_references_set_simple_reference{*\currentlistentrylocation}% \a_strc_lists_destination\currentdestinationattribute diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl index 0d2f85239..025021edb 100644 --- a/tex/context/base/mkxl/strc-mat.mkxl +++ b/tex/context/base/mkxl/strc-mat.mkxl @@ -32,6 +32,7 @@ %\c!margin=, %\c!align=, %\c!separator=, + % \c!splitmethod=\v!both, % first|last|both| \c!snap=\v!no, \c!snapstep=\v!medium, \c!grid=\v!math, @@ -1443,10 +1444,10 @@ \def\strc_math_analyze_box {\clf_handlemathhang - stage \plusone - alignstate \c_strc_math_ragged_status - box \b_strc_math_display - distance \formulaparameter\c!textdistance + stage \plusone + alignstate \c_strc_math_ragged_status + box \b_strc_math_display + distance \formulaparameter\c!textdistance \relax %\holdingmigrations\zerocount \setbox\b_strc_math_display\vbox\bgroup % \vtop @@ -1482,10 +1483,11 @@ \edef\v_spac_whitespace_current{\formulaparameter\c!spaceinbetween}% \spac_whitespace_setup \clf_handlemathhang - stage \plusfour - inbetween 1\parskip - height \strutht - depth \strutdp + stage \plusfour + inbetween 1\parskip + height \strutht + depth \strutdp + splitmethod {\formulaparameter\c!splitmethod}% \relax \endgroup} @@ -1966,16 +1968,16 @@ \permanent\tolerant\protected\def\placenamedformula[#1]% {\ifarguments - \expandafter\strc_formulase_place_named_nop + \expandafter\strc_formulas_place_named_nop \else - \expandafter\strc_formulase_place_named_yes + \expandafter\strc_formulas_place_named_yes \fi[#1]} -\def\strc_formulase_place_named_yes[#1]#2% +\def\strc_formulas_place_named_yes[#1]#2% {\setformulalistentry{#2}% \placeformula[#1]} -\def\strc_formulase_place_named_nop[#1]#2% +\def\strc_formulas_place_named_nop[#1]#2% {\setformulalistentry{#2}% \placeformula} diff --git a/tex/context/base/mkxl/strc-ref.lmt b/tex/context/base/mkxl/strc-ref.lmt index 32c2a5429..3c86d66d9 100644 --- a/tex/context/base/mkxl/strc-ref.lmt +++ b/tex/context/base/mkxl/strc-ref.lmt @@ -1274,8 +1274,9 @@ function references.loadpresets(product,component) -- we can consider a special if product and component and product~= "" and component ~= "" and not productdata.product then -- maybe: productdata.filename ~= filename productdata.product = product productdata.component = component + -- todo: use other locator local fullname = file.replacesuffix(product,"tuc") - if lfs.isfile(fullname) then -- todo: use other locator + if lfs.isfile(fullname) then local utilitydata = job.loadother(fullname) if utilitydata then if trace_importing then @@ -1311,7 +1312,7 @@ if useproduct then implement { name = "useproduct", actions = newuseproduct, - arguments = "string", + arguments = "optional", overload = true, } @@ -2243,7 +2244,13 @@ local function filterreference(name,prefixspec,numberspec) -- number page title local cs = references.analyze() -- normally already analyzed but also sets state context(tonumber(cs.realpage) or 0) else -- assumes data is table - local kind = type(data) == "table" and data.metadata and data.metadata.kind + local kind = false + if type(data) == "string" then + -- todo + end + if type(data) == "table" then + kind = data.metadata and data.metadata.kind + end if kind then local filter = filters[kind] or genericfilters filter = filter and (filter[name] or filter.unknown or genericfilters[name] or genericfilters.unknown) diff --git a/tex/context/base/mkxl/syst-ini.mkxl b/tex/context/base/mkxl/syst-ini.mkxl index 241b83ae4..e3dd91af5 100644 --- a/tex/context/base/mkxl/syst-ini.mkxl +++ b/tex/context/base/mkxl/syst-ini.mkxl @@ -789,20 +789,6 @@ % \permanent\protected\def\uedef{\protected\edef} % \permanent\protected\def\uxdef{\protected\xdef} -% For now: - -\permanent\protected\def\defUmathfixedtopaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathtopaccent \s!fixed "#2 "#3 "#4 }} -\permanent\protected\def\defUmathfixedbottomaccent#1#2#3#4{\global\immutable\protected\def#1{\Umathbottomaccent \s!fixed "#2 "#3 "#4 }} -\permanent\protected\def\defUmathtopaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathtopaccent "#2 "#3 "#4 }} -\permanent\protected\def\defUmathbottomaccent #1#2#3#4{\global\immutable\protected\def#1{\Umathbottomaccent "#2 "#3 "#4 }} -\permanent\protected\def\defUdelimiterover #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterover "#2 "#3 }} -\permanent\protected\def\defUdelimiterunder #1#2#3#4{\global\immutable\protected\def#1{\Udelimiterunder "#2 "#3 }} -%permanent\protected\def\defUdelimiter #1#2#3#4{\global\immutable\protected\def#1{\Udelimiter "#2 "#3 "#4 }} -\permanent\protected\def\defUdelimiter #1#2#3#4{\global\immutable\Umathchardef #1 "#2 "#3 "#4 } -\permanent\protected\def\defUradical #1#2#3{\global\immutable\protected\def#1{\Uradical "#2 "#3 }} -\permanent\protected\def\defUroot #1#2#3{\global\immutable\protected\def#1{\Uroot "#2 "#3 }} -\permanent\protected\def\defUmathchar #1#2#3#4{\global\immutable\Umathchardef #1 "#2 "#3 "#4 } - %D For a while we keep the following, as systems like tikz need it. Best not use %D that one \CONTEXT. It will probably move to the tikz loader. @@ -834,8 +820,7 @@ % no longer \errorstopmode cf. plain tex 3.141592653 \permanent\protected\def\tracingall - {\tracingonline \plusone - \tracingcommands \plusfour % > 3: show mode change independent + {\tracingcommands \plusfour % > 3: show mode change independent \tracingmacros \plusthree % > 2: obey \untraced \tracingoutput \plusone \tracingpages \plusone @@ -848,7 +833,8 @@ \tracingmath \plusone \tracingalignments\plustwo % > 1: also show preamble \showboxbreadth \maxcount - \showboxdepth \maxcount} + \showboxdepth \maxcount + \tracingonline \plusone} \permanent\protected\def\tracingless {\tracingall @@ -861,7 +847,8 @@ \tracingonline \zerocount} \permanent\protected\def\tracingnone - {\showboxdepth \plusfive % lessboxtracing + {\tracingonline \zerocount + \showboxdepth \plusfive % lessboxtracing \showboxbreadth \plusten \tracingalignments\zerocount \tracingmath \zerocount diff --git a/tex/context/base/mkxl/tabl-tsp.mkxl b/tex/context/base/mkxl/tabl-tsp.mkxl index a2a147654..160357a06 100644 --- a/tex/context/base/mkxl/tabl-tsp.mkxl +++ b/tex/context/base/mkxl/tabl-tsp.mkxl @@ -207,7 +207,7 @@ % todo: keep tail to rest, so we need a lookahead \newbox \b_split_content -\newbox \b_split_result +\newbox \b_split_result % watch out, semi public, accessed in cs-* \newbox \b_split_head \newbox \b_split_next \newbox \b_split_tail @@ -231,6 +231,8 @@ \newconditional\tabl_split_forced_page +% \permanent\protected\def\lastsplithtdp{\htdp\b_split_result} + \appendtoks \c_split_minimum_free_lines\zerocount \d_split_minimum_free_space\zeropoint diff --git a/tex/context/fonts/mkiv/bonum-math.lfg b/tex/context/fonts/mkiv/bonum-math.lfg index 32152e15d..c9021352b 100644 --- a/tex/context/fonts/mkiv/bonum-math.lfg +++ b/tex/context/fonts/mkiv/bonum-math.lfg @@ -42,11 +42,19 @@ return { tweak = "replacealphabets", list = { { - source = { first = 0x003B1 }, + source = { first = 0x003B1 }, -- upright alpha filename = "texgyrebonummath-companion.otf", }, { - source = { first = 0x1D6FC }, + source = { first = 0x1D6FC }, -- italic alpha + filename = "texgyrebonummath-companion.otf", + }, + { + source = { first = 0x1D6C2 }, -- bold upright alpha + filename = "texgyrebonummath-companion.otf", + }, + { + source = { first = 0x1D736 }, -- bold italic alpha filename = "texgyrebonummath-companion.otf", }, }, diff --git a/tex/context/fonts/mkiv/ebgaramond-math.lfg b/tex/context/fonts/mkiv/ebgaramond-math.lfg index d5d31c73f..812430525 100644 --- a/tex/context/fonts/mkiv/ebgaramond-math.lfg +++ b/tex/context/fonts/mkiv/ebgaramond-math.lfg @@ -81,6 +81,12 @@ return { ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, [0x27EB] = { topright = -0.1, bottomright = -0.1 }, ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + + [0x51] = { bottomright = 0.25 }, -- Upright Q + [0x211A] = { bottomright = 0.2 }, -- Blackboard bold Q + [0x1D410] = { bottomright = 0.2 }, -- Bold Q + [0x1D478] = { bottomright = 0.05 }, -- Bold Q + [0x1D5B0] = { bottomright = 0.05 }, -- Sans Q }, }, { diff --git a/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv b/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv index 3be50a2de..31026df5b 100644 --- a/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv +++ b/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv @@ -29,11 +29,15 @@ \definefontfeature [eb-garamond-normal] [default] - [mode=node,ccmp=yes, - calt=yes,liga=yes, - dlig=yes,hlig=yes, - kern=yes,mark=yes,mkmk=yes, - onum=yes,pnum=yes,salt=yes, + [mode=node, + ccmp=yes, + calt=yes, + dlig=no, + hlig=no, + % salt=yes, + % onum=yes, + onum=no, + pnum=yes, script=latn] \definefontfeature @@ -41,6 +45,11 @@ [eb-garamond-normal] [smcp=yes,c2sc=yes] +\definefontfeature + [ysabeau-smallcaps] + [default] + [smcp=yes,c2sc=yes] + % \loadtypescriptfile[ebgaramond] % % \definefontfeature @@ -67,6 +76,17 @@ \definefontsynonym [\s!SerifCaps] [\s!Serif] [\s!features=eb-garamond-smallcaps] \stoptypescript + + + \starttypescript [\s!sans] [ysabeau] + % \setups[font:fallback:sans] + \definefontsynonym [\s!Sans] [\s!file:ysabeau-regular] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:ysabeau-italic] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:ysabeau-bold] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic][\s!file:ysabeau-bolditalic] [\s!features=\s!default] + \definefontsynonym [\s!SansCaps] [\s!Sans] [\s!features=ysabeau-smallcaps] + \stoptypescript + \starttypescript [\s!math] [ebgaramond,ebgaramond-nt] \checkedmapfontsize[\typescripttwo][\s!script] [.70] \checkedmapfontsize[\typescripttwo][\s!scriptscript][.50] @@ -84,6 +104,7 @@ \starttypescript[ebgaramond,ebgaramond-nt] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [ebgaramond] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [ysabeau] [\s!default] \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.8] % \definetypeface [\typescriptone] [\s!mm] [\s!math] [bonum] [\s!default] [\s!rscale=0.8] \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] diff --git a/tex/context/interface/mkii/keys-en.xml b/tex/context/interface/mkii/keys-en.xml index adadb86c5..fae9ee691 100644 --- a/tex/context/interface/mkii/keys-en.xml +++ b/tex/context/interface/mkii/keys-en.xml @@ -594,6 +594,7 @@ + @@ -724,6 +725,7 @@ + @@ -1338,6 +1340,7 @@ + diff --git a/tex/context/interface/mkii/keys-fr.xml b/tex/context/interface/mkii/keys-fr.xml index f5474769a..3dc8bf282 100644 --- a/tex/context/interface/mkii/keys-fr.xml +++ b/tex/context/interface/mkii/keys-fr.xml @@ -725,6 +725,7 @@ + @@ -1339,6 +1340,7 @@ + diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml index 13abd22dd..e01eb74d1 100644 --- a/tex/context/interface/mkii/keys-nl.xml +++ b/tex/context/interface/mkii/keys-nl.xml @@ -594,6 +594,7 @@ + @@ -724,6 +725,7 @@ + @@ -1338,6 +1340,7 @@ + diff --git a/tex/context/modules/mkiv/s-fonts-tables.mkiv b/tex/context/modules/mkiv/s-fonts-tables.mkiv index f1340c3ea..aeb526f38 100644 --- a/tex/context/modules/mkiv/s-fonts-tables.mkiv +++ b/tex/context/modules/mkiv/s-fonts-tables.mkiv @@ -52,5 +52,6 @@ [cambria] \starttext - \showfontproperties[name=cambria] +% \showfontproperties[name=cambria] + \showfontproperties[name=lbmi] \stoptext diff --git a/tex/context/modules/mkxl/m-oldmath.mkxl b/tex/context/modules/mkxl/m-oldmath.mkxl index 2132d773e..db223b2d3 100644 --- a/tex/context/modules/mkxl/m-oldmath.mkxl +++ b/tex/context/modules/mkxl/m-oldmath.mkxl @@ -136,7 +136,8 @@ {\left(\matrix{#1}\right)} \permanent\protected\def\root#1\of% #2% - {\rootradical{#1}} % {#2} + %{\rootradical{#1}} % {#2} + {\Uradical \zerocount "221A{#1}} % {#2} \protect -- cgit v1.2.3