diff options
author | Hans Hagen <pragma@wxs.nl> | 2022-07-06 22:05:18 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2022-07-06 22:05:18 +0200 |
commit | 82c674fdcf5bcff4ad0dc0936d638fc729145616 (patch) | |
tree | 6ab4ee4417aa22180cd5b3c50ede6a031f8ce3f9 /tex/context/modules/mkxl | |
parent | 3a55e11c7295abf8f2dfe5e9d1c8b153f4518824 (diff) | |
download | context-82c674fdcf5bcff4ad0dc0936d638fc729145616.tar.gz |
2022-07-06 21:35:00
Diffstat (limited to 'tex/context/modules/mkxl')
-rw-r--r-- | tex/context/modules/mkxl/m-barcodes.mkxl | 11 | ||||
-rw-r--r-- | tex/context/modules/mkxl/m-json.mkxl | 2 | ||||
-rw-r--r-- | tex/context/modules/mkxl/m-oldmath.mkxl | 142 | ||||
-rw-r--r-- | tex/context/modules/mkxl/s-layout-show.mkxl | 30 | ||||
-rw-r--r-- | tex/context/modules/mkxl/s-math-tweaks.mkxl | 182 | ||||
-rw-r--r-- | tex/context/modules/mkxl/x-mathml.lmt | 126 | ||||
-rw-r--r-- | tex/context/modules/mkxl/x-mathml.mkxl | 13 |
7 files changed, 458 insertions, 48 deletions
diff --git a/tex/context/modules/mkxl/m-barcodes.mkxl b/tex/context/modules/mkxl/m-barcodes.mkxl index 43540e457..0ded9bbd6 100644 --- a/tex/context/modules/mkxl/m-barcodes.mkxl +++ b/tex/context/modules/mkxl/m-barcodes.mkxl @@ -31,10 +31,13 @@ \continueifinputfile{m-barcodes.mkxl} \starttext - \startTEXpage - \barcode[type=isbn,text=978-9490688011] - \blank - \barcode[type=isbn,text=9780500518724] + \startTEXpage[offset=1dk] + \startcombination[2*2] + {\barcode[type=isbn,text=978-9490688011,width=3cm]} {} + {\barcode[type=isbn,text=9780500518724,width=3cm]} {} + {\barcode[type=datamatrix,text=whatever,width=3cm,option=--square]} {} + {\barcode[type=maxicode,text=whatever,width=3cm]} {} + \stopcombination \stopTEXpage \stoptext diff --git a/tex/context/modules/mkxl/m-json.mkxl b/tex/context/modules/mkxl/m-json.mkxl index 46c2f79a7..893abbe75 100644 --- a/tex/context/modules/mkxl/m-json.mkxl +++ b/tex/context/modules/mkxl/m-json.mkxl @@ -41,7 +41,7 @@ end, arguments = "2 arguments", public = true, -protected = true, + protected = true, } interfaces.implement { diff --git a/tex/context/modules/mkxl/m-oldmath.mkxl b/tex/context/modules/mkxl/m-oldmath.mkxl new file mode 100644 index 000000000..248ff66bd --- /dev/null +++ b/tex/context/modules/mkxl/m-oldmath.mkxl @@ -0,0 +1,142 @@ +%D \module +%D [ file=m-oldmath, +%D version=2022.06.17, +%D title=Math, +%D subtitle=Fallback to old stuff, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is therefore copyrighted +%D by \PRAGMA. See mreadme.pdf for details. + +%D For the \type {\over} die|-|hards (for this occasion I checked out Outlaw Vern's +%D updated review on that movie): + +\unprotect + +\mathgroupingmode \zerocount + +\permanent\protected\def\eqalign#1% rather plain, is this used at all ... + {\dontleavehmode + \mskip\thinmuskip\vcenter\bgroup % \vcenter \s!class \mathwrappercode \bgroup + \mathsurround\zeropoint % \math_eqalign_set_defaults + \ialign + {\strut + \hfil + \mathbeginclass\mathordcode + \mathendclass \mathordcode + \startforceddisplaymath\aligncontent\stopforceddisplaymath + \aligntab + \mathbeginclass\mathordcode + \mathendclass \mathordcode + \startforceddisplaymath\aligncontent\stopforceddisplaymath + \hfil + \crcr + #1% + \crcr}% + \egroup\mskip\thinmuskip} % \egroup + +%D Obsolete: + +% \permanent\protected\def\displaylines#1% +% {\the\mathdisplayaligntweaks +% \tabskip\zeroskip +% \halign +% {\hbox to \displaywidth{% +% \normalstartimath\tabskip\zeroskip\everycr\emptytoks\hfil\displaystyle\alignmark\alignmark\hfil\normalstopimath}\crcr +% #1\crcr}} + +%D no longer defined: + +% \permanent\def\ialign % initialized \halign, to be used grouped! +% {\everycr\emptytoks +% \tabskip\zeroskip +% \halign} +% +% \permanent\def\oalign#1% +% {\leavevmode % plain tex uses this +% \vtop +% {\baselineskip\zeroskip +% \lineskip.25\exheight +% \ialign{\alignmark\alignmark\crcr#1\crcr}}} +% +% \permanent\def\ooalign % chars over each other +% {\lineskiplimit-\maxdimen +% \oalign} + +%D More old plain stuff: + +\permanent\protected\def\buildrel#1\over#2% + {\mathrel{\mathop{\kern\zeropoint#2}\limits^{#1}}} + +\permanent\protected\def\math_openup + {\afterassignment\math_openup_indeed\scratchdimen} + +\aliased\let\math_closeup\relax + +\def\math_openup_indeed + {\enforced\permanent\protected\edef\math_closeup + {\lineskip \the\lineskip + \baselineskip \the\baselineskip + \lineskiplimit\the\lineskiplimit + \relax}% + \advance\lineskip \scratchdimen + \advance\baselineskip \scratchdimen + \advance\lineskiplimit\scratchdimen} + +\permanent\protected\def\openup {\math_openup } % the low level ones are used elsewhere +\permanent\protected\def\closeup{\math_closeup} % the low level ones are used elsewhere + +%D Who knows: + +\permanent\protected\def\choose{\atopwithdelims()} % used in korean test file, has to go +\permanent\protected\def\brack {\atopwithdelims[]} +\permanent\protected\def\brace {\atopwithdelims\{\}} + +%D We have better ways: + +\permanent\protected\def\cases#1% + {\left\{% + \mskip\thinmuskip + \vcenter + {\normalbaselines + \mathsurround\zeropoint + \ialign{% + \normalstartimath\alignmark\alignmark\hfil\normalstopimath + \aligntab + \quad\alignmark\alignmark\hfil + \crcr + #1% + \crcr}}% + \right.} + +\permanent\protected\def\matrix#1% + {\emptyhbox + \mskip\thinmuskip + \vcenter + {\normalbaselines + \mathsurround\zeropoint + \ialign{% + \hfil\normalstartimath\alignmark\alignmark\normalstopimath\hfil + \aligntab + \aligntab + \quad\hfil\normalstartimath\alignmark\alignmark\normalstopimath\hfil + \crcr + \mathstrut + \crcr + \noalign{\kern-\baselineskip} + #1\crcr + \mathstrut + \crcr + \noalign{\kern-\baselineskip}}}% + \mskip\thinmuskip} + +\permanent\protected\def\pmatrix#1% + {\left(\matrix{#1}\right)} + + + +\protect + +\endinput diff --git a/tex/context/modules/mkxl/s-layout-show.mkxl b/tex/context/modules/mkxl/s-layout-show.mkxl index 95a6d3371..948b0953f 100644 --- a/tex/context/modules/mkxl/s-layout-show.mkxl +++ b/tex/context/modules/mkxl/s-layout-show.mkxl @@ -118,6 +118,36 @@ \NC inner margin \NC \the\innermarginwidth \NC \NR \stoptabulate} +\permanent\protected\gdef\showcentering + {\setupbackgrounds + [\v!text] + [\c!background=centeringlines]} + +\defineoverlay + [centeringlines] + [\vpack to \d_overlay_height \bgroup + \vfill + \hpack to \d_overlay_width \bgroup + \hss + \hskip1cm + \dorecurse{15}{% + \kern-.25\onepoint + \ifodd\recurselevel + \darkred + \else + \darkblue + \fi + \vrule + height.5\d_overlay_height + depth .5\d_overlay_height + width .5\onepoint + \hskip1cm + }% + \hss + \egroup + \vfill + \egroup] + %D Page grids: \newconstant\c_page_grids_location diff --git a/tex/context/modules/mkxl/s-math-tweaks.mkxl b/tex/context/modules/mkxl/s-math-tweaks.mkxl index 2579f1ec4..8a70d431f 100644 --- a/tex/context/modules/mkxl/s-math-tweaks.mkxl +++ b/tex/context/modules/mkxl/s-math-tweaks.mkxl @@ -147,6 +147,151 @@ \stopsubject \stoptexdefinition +\starttexdefinition protected showmathalphabettweaks_check_flush #1 + \dontleavehmode + \hbox \bgroup + \smallinfofont + \setstrut + \lower \dimexpr\dp\scratchbox+\ht\strutbox\relax \hbox to \wd\scratchbox\bgroup + \hss + \strut + \hexnumber{#1} + \hss + \egroup + \hskip-\wd\scratchbox + \box\scratchbox + \egroup +\stoptexdefinition + +\starttexdefinition protected showmathalphabettweaks_check_scripts + \subscript 1 + \superscript 2 + \subprescript 3 + \superprescript4 +\stoptexdefinition + +\starttexdefinition protected showmathalphabettweaks_check_hat #1 + \setbox\scratchbox\ruledhbox { + \im { + \resetmathattributes + \widehat{\Uchar#1} + \showmathalphabettweaks_check_scripts + } + } + \showmathalphabettweaks_check_flush{#1} +\stoptexdefinition + +\starttexdefinition protected showmathalphabettweaks_check_fences #1 + \setbox\scratchbox\ruledhbox { + \im { + \resetmathattributes + \left( + \Uchar#1 + \showmathalphabettweaks_check_scripts + \right) + } + } + \showmathalphabettweaks_check_flush{#1} +\stoptexdefinition + +\starttexdefinition protected showmathalphabettweaks_check #1#2 + \startsubsubsubject[title=#1] + \traverseblock {#1} { + \begingroup + \showglyphs + \showfontitalics + \showfontkerns + #2{##1}% + \endgroup + \space\space + } + \removeunwantedspaces + \stopsubsubsubject +\stoptexdefinition + +\starttexdefinition protected showmathalphabettweaks_all #1 + \startsubsubject[title={Numbers}] + \showmathalphabettweaks_check{digits normal}#1 + \showmathalphabettweaks_check{digits bold}#1 + \showmathalphabettweaks_check{digits sansserif normal}#1 + \showmathalphabettweaks_check{digits sansserif bold}#1 + \showmathalphabettweaks_check{digits monospace}#1 + \showmathalphabettweaks_check{digits doublestruck}#1 + \stopsubsubject + \startsubsubject[title={Lowercase}] + \showmathalphabettweaks_check{lowercase normal}#1 + \showmathalphabettweaks_check{lowercase italic}#1 + \showmathalphabettweaks_check{lowercase bold}#1 + \showmathalphabettweaks_check{lowercase bold italic}#1 + \showmathalphabettweaks_check{lowercase sansserif normal}#1 + \showmathalphabettweaks_check{lowercase sansserif italic}#1 + \showmathalphabettweaks_check{lowercase sansserif bold}#1 + \showmathalphabettweaks_check{lowercase sansserif bolditalic}#1 + \showmathalphabettweaks_check{lowercase monospace}#1 + \showmathalphabettweaks_check{lowercase fraktur}#1 + \showmathalphabettweaks_check{lowercase bold fraktur}#1 + \showmathalphabettweaks_check{lowercase script}#1 + \showmathalphabettweaks_check{lowercase bold script}#1 + \showmathalphabettweaks_check{lowercase doublestruck}#1 + \showmathalphabettweaks_check{lowercase greek normal}#1 + \showmathalphabettweaks_check{lowercase greek italic}#1 + \showmathalphabettweaks_check{lowercase greek bold}#1 + \showmathalphabettweaks_check{lowercase greek bold italic}#1 + % \showmathalphabettweaks_check{lowercase greek sansserif normal}#1 + % \showmathalphabettweaks_check{lowercase greek sansserif italic}#1 + \showmathalphabettweaks_check{lowercase greek sansserif bold}#1 + \showmathalphabettweaks_check{lowercase greek sansserif bolditalic}#1 + \stopsubsubject + \startsubsubject[title={Uppercase}] + \showmathalphabettweaks_check{uppercase normal}#1 + \showmathalphabettweaks_check{uppercase italic}#1 + \showmathalphabettweaks_check{uppercase bold}#1 + \showmathalphabettweaks_check{uppercase bolditalic}#1 + \showmathalphabettweaks_check{uppercase sansserif normal}#1 + \showmathalphabettweaks_check{uppercase sansserif italic}#1 + \showmathalphabettweaks_check{uppercase sansserif bold}#1 + \showmathalphabettweaks_check{uppercase sansserif bolditalic}#1 + \showmathalphabettweaks_check{uppercase monospace}#1 + \showmathalphabettweaks_check{uppercase fraktur}#1 + \showmathalphabettweaks_check{uppercase bold fraktur}#1 + \showmathalphabettweaks_check{uppercase script}#1 + \showmathalphabettweaks_check{uppercase bold script}#1 + \showmathalphabettweaks_check{uppercase doublestruck}#1 + \showmathalphabettweaks_check{uppercase greek normal}#1 + \showmathalphabettweaks_check{uppercase greek italic}#1 + \showmathalphabettweaks_check{uppercase greek bold}#1 + \showmathalphabettweaks_check{uppercase greek bolditalic}#1 + \showmathalphabettweaks_check{uppercase greek sansserif bold}#1 + \showmathalphabettweaks_check{uppercase greek sansserif bolditalic}#1 + \stopsubsubject +\stoptexdefinition + +\starttexdefinition protected showmathaccenttweaks + \showmathalphabettweaks_all\showmathalphabettweaks_check_hat +\stoptexdefinition + +\starttexdefinition protected showmathfencetweaks + \showmathalphabettweaks_all\showmathalphabettweaks_check_fences +\stoptexdefinition + +\starttexdefinition protected showmathmiddletweaks + \dostepwiserecurse {5} {75} {1} { + $\left\{ + \mathatom class \mathconstructcode \bgroup \vcenter \bgroup \hbox \bgroup + \blackrule + [\c!height=\dimexpr##1pt/2\relax, + \c!depth=\dimexpr##1pt/2\relax, + \c!width=\emwidth, + \c!color=darkblue]% + \egroup \egroup \egroup + \middle| + % \begingroup\darkblue\scriptscriptstyle\mathtt{##1}\endgroup + \right)$ + \space + } + \removeunwantedspaces +\stoptexdefinition + \protect \stopmodule @@ -156,30 +301,55 @@ \setuplayout [tight] +\setuphead + [chapter] + [style=\bfd] + +\setuphead + [section] + [style=\bfc] + +\setuphead + [subsection] + [style=\bfb] + +\setuphead + [subsubsection] + [before=\blank, + style=\bfa] + +% \enabletrackers[math.tweaks] + \starttext -\definefontfeature[mathextra][compose=yes] +% \definefontfeature[mathextra][compose=yes] -% \number"23DC \doifelse {\getdocumentargument{bodyfont}} {} { % \setupbodyfont[cambria,10pt] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle -% \setupbodyfont[modern] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle +% \setupbodyfont[modern] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle % \setupbodyfont[pagella] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle % \setupbodyfont[termes] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle % \setupbodyfont[bonum] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle % \setupbodyfont[schola] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle % \setupbodyfont[lucidaot,10pt] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle - \setupbodyfont[ebgaramond] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle +% \setupbodyfont[ebgaramond] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle % \setupbodyfont[stixtwo] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle +% \setupbodyfont[bonum] \starttitle[title=\fontclass] \showmathaccenttweaks \stoptitle + +% \setupbodyfont[bonum] \starttitle[title=\fontclass] \showmathfencetweaks \stoptitle + \setupbodyfont[bonum] \starttitle[title=\fontclass] \showmathmiddletweaks \stoptitle +% \setupbodyfont[modern] \starttitle[title=\fontclass] \showmathfencetweaks \stoptitle + } { \normalexpanded{\setupbodyfont[\getdocumentargument{bodyfont},12pt]} \showmathfonttweaks - + \showmathaccenttweaks + \showmathfencetweaks + \showmathmiddletweaks } - \stoptext diff --git a/tex/context/modules/mkxl/x-mathml.lmt b/tex/context/modules/mkxl/x-mathml.lmt index 5d4653268..30a435cde 100644 --- a/tex/context/modules/mkxl/x-mathml.lmt +++ b/tex/context/modules/mkxl/x-mathml.lmt @@ -610,44 +610,108 @@ function mathml.mfenced(id) -- multiple separators ctx_disabledelimiter() end -local function flush(e,tag,toggle) - if tag == "none" then - -- if not toggle then - context("{}") -- {} starts a new ^_ set - -- end - elseif toggle then - context("^{") - xmlsprint(e.dt) - context("}{}") -- {} starts a new ^_ set - else - context("_{") - xmlsprint(e.dt) - context("}") - end - return not toggle -end +-- local function flush(e,tag,toggle) +-- if tag == "none" then +-- -- if not toggle then +-- context("{}") -- {} starts a new ^_ set +-- -- end +-- elseif toggle then +-- context("^{") +-- xmlsprint(e.dt) +-- context("}{}") -- {} starts a new ^_ set +-- else +-- context("_{") +-- xmlsprint(e.dt) +-- context("}") +-- end +-- return not toggle +-- end +-- +-- function mathml.mmultiscripts(id) +-- local done, toggle = false, false +-- for e in lxmlcollected(id,"/*") do +-- local tag = e.tg +-- if tag == "mprescripts" then +-- context("{}") +-- done = true +-- elseif done then +-- toggle = flush(e,tag,toggle) +-- end +-- end +-- local done, toggle = false, false +-- for e in lxmlcollected(id,"/*") do +-- local tag = e.tg +-- if tag == "mprescripts" then +-- break +-- elseif done then +-- toggle = flush(e,tag,toggle) +-- else +-- xmlsprint(e) +-- done = true +-- end +-- end +-- end function mathml.mmultiscripts(id) - local done, toggle = false, false + local prescripts = false + local subscripts = true + local firstdone = false for e in lxmlcollected(id,"/*") do - local tag = e.tg - if tag == "mprescripts" then - context("{}") - done = true - elseif done then - toggle = flush(e,tag,toggle) + if firstdone then + xmlsprint(e.dt) + firstdone = true + else + local tag = e.tg + if tag == "none" then + subscripts = not subscripts + elseif tag == "prescripts" then + prescripts = true + subscripts = true + elseif subscripts then + if prescripts then + context("\\subprescript{") + xmlsprint(e.dt) + context("}") + end + subscripts = false + else + if prescripts then + context("\\superprescript{") + xmlsprint(e.dt) + context("}") + end + subscripts = true + end end end - local done, toggle = false, false + local prescripts = false + local subscripts = true + local firstdone = false for e in lxmlcollected(id,"/*") do - local tag = e.tg - if tag == "mprescripts" then - break - elseif done then - toggle = flush(e,tag,toggle) + if firstdone then + firstdone = true else - xmlsprint(e) - done = true + local tag = e.tg + if tag == "none" then + subscripts = not subscripts + elseif tag == "prescripts" then + prescripts = true + subscripts = true + elseif subscripts then + if not prescripts then + context("\\subscript{") + xmlsprint(e.dt) + context("}") + end + subscripts = false + else + if not prescripts then + context("\\superscript{") + xmlsprint(e.dt) + context("}") + end + subscripts = true + end end end end diff --git a/tex/context/modules/mkxl/x-mathml.mkxl b/tex/context/modules/mkxl/x-mathml.mkxl index 11da32126..07faea353 100644 --- a/tex/context/modules/mkxl/x-mathml.mkxl +++ b/tex/context/modules/mkxl/x-mathml.mkxl @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +%D We should update this one wrt grouping and styles. + % \xmlfilter{#1}{/*/name()} -> \xmltag % This implementation looks like a hack ... this is because we deal with all weird @@ -1299,7 +1301,8 @@ } } { % beware, the second {} is needed for the superscript - \xmlconcatrange{#1}{/*}{2}{}{}\normalsuperscript\prime + % \xmlconcatrange{#1}{/*}{2}{}{}\normalsuperscript\prime + \xmlconcatrange{#1}{/*}{2}{}{}\prime } } } { @@ -2023,11 +2026,9 @@ % probably not yet ok \setdimensionwithunit\scratchdimen\mmlfraclinethickness{pt} } - { - {\mmlfirst{#1}} - \above\scratchdimen - {\mmlsecond{#1}} - } +% { + \Uabove\scratchdimen{\mmlfirst{#1}}{\mmlsecond{#1}} +% } \fi \endgroup \stopxmlsetups |