summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkxl
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2022-03-12 18:45:40 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2022-03-12 18:45:40 +0100
commit188632f4b0f71c5170a20f1b151bde68f603bfd9 (patch)
tree49a5a917a1ce6f17cbb6f542dff5b8254cd74c70 /tex/context/modules/mkxl
parentb7a7de31716616b7a5176259e2b60349f8089615 (diff)
downloadcontext-188632f4b0f71c5170a20f1b151bde68f603bfd9.tar.gz
2022-03-12 11:26:00
Diffstat (limited to 'tex/context/modules/mkxl')
-rw-r--r--tex/context/modules/mkxl/m-svg.mkxl39
-rw-r--r--tex/context/modules/mkxl/s-math-atoms.mkxl104
-rw-r--r--tex/context/modules/mkxl/s-math-definitions.mkxl56
-rw-r--r--tex/context/modules/mkxl/s-math-tweaks.mkxl185
4 files changed, 384 insertions, 0 deletions
diff --git a/tex/context/modules/mkxl/m-svg.mkxl b/tex/context/modules/mkxl/m-svg.mkxl
new file mode 100644
index 000000000..56a101979
--- /dev/null
+++ b/tex/context/modules/mkxl/m-svg.mkxl
@@ -0,0 +1,39 @@
+%D \module
+%D [ file=m-svg,
+%D version=2022.02.18,
+%D title=\CONTEXT\ Extra Modules,
+%D subtitle=SVG Helper Macros,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\protected\def\showSVGcode#1#2%
+ {\ctxlua{metapost.showsvgpage{
+ filename = "#1",
+ index = tonumber(#2),
+ method = "code"
+ }}}
+
+\protected\def\showSVGcodeG#1#2%
+ {\ctxlua{metapost.showsvgpage{
+ filename = "#1",
+ index = tonumber(#2),
+ method = "code",
+ x = 0,
+ y = 1000,
+ width = 1000,
+ height = 1000,
+ noclip = true
+ }}}
+
+\protected\def\typeSVGcode#1#2%
+ {\ctxlua{metapost.typesvgpage{
+ filename = "#1",
+ index = tonumber(#2)
+ }}}
+
+% \continueifinputfile{m-svg.mkxl}
diff --git a/tex/context/modules/mkxl/s-math-atoms.mkxl b/tex/context/modules/mkxl/s-math-atoms.mkxl
new file mode 100644
index 000000000..1b5ebed41
--- /dev/null
+++ b/tex/context/modules/mkxl/s-math-atoms.mkxl
@@ -0,0 +1,104 @@
+%D \module
+%D [ file=s-math-atoms.mksl,
+%D version=2022.02.13,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Show Math Atom Spacing,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This is just a quick and dirty overview.
+
+\startmodule[math-atoms]
+
+\setvalue{atom:\number\mathordinarycode }{ord}%inary}
+\setvalue{atom:\number\mathoperatorcode }{ope}%rator}
+\setvalue{atom:\number\mathbinarycode }{bin}%ary}
+\setvalue{atom:\number\mathrelationcode }{rel}%ation}
+\setvalue{atom:\number\mathopencode }{ope}%n}
+\setvalue{atom:\number\mathclosecode }{clo}%se}
+\setvalue{atom:\number\mathpunctuationcode }{pun}%ctuation}
+%setvalue{atom:\number\mathinnercode }{inn}%er}
+%setvalue{atom:\number\mathovercode }{ove}%r}
+%setvalue{atom:\number\mathundercode }{und}%er}
+\setvalue{atom:\number\mathfractioncode }{fra}%ction}
+\setvalue{atom:\number\mathradicalcode }{rad}%ical}
+\setvalue{atom:\number\mathmiddlecode }{mid}%dle}
+%setvalue{atom:\number\mathaccentcode }{acc}%ent}
+%setvalue{atom:\number\mathfencedcode }{fen}%ced}
+%setvalue{atom:\number\mathvariablecode }{var}%iable}
+%setvalue{atom:\number\mathactivecode }{act}%ive}
+%setvalue{atom:\number\mathvcentercode }{vce}%nter}
+%setvalue{atom:\number\mathreservedcode }{res}%erved}
+%setvalue{atom:\number\mathimaginarycode }{ima}%ginary}
+%setvalue{atom:\number\mathdifferentialcode}{dif}%ferential}
+%setvalue{atom:\number\mathexponentialcode }{exp}%onential}
+\setvalue{atom:\number\mathfunctioncode }{fun}%ction}
+\setvalue{atom:\number\mathdigitcode }{dig}%it}
+
+\dostepwiserecurse \mathordinarycode \mathdigitcode \plusone {
+ \setmathatomrule \mathbegincode #1 \allmathstyles \mathbegincode #1
+ \setmathatomrule #1 \mathendcode \allmathstyles #1 \mathendcode
+ \dostepwiserecurse \mathordinarycode \mathdigitcode \plusone {
+ \setmathatomrule#1 ##1 \allmathstyles #1 ##1
+ }
+}
+
+\protected\def\showmathatomspacing#1{
+ \startTEXpage[offset=10pt]
+ \showmakeup[mathglue]
+ \bTABLE[align=middle,width=4em]
+ \dostepwiserecurse \mathordinarycode \mathdigitcode \plusone {%
+ \ifcsname atom:##1\endcsname
+ \bTR
+ \dostepwiserecurse \mathordinarycode \mathdigitcode \plusone {%
+ \ifcsname atom:####1\endcsname
+ \bTD
+ $ #1%
+ \mathatom class ##1 {\hpack to 1.5em{\infofont[\hss\getvalue{atom:##1}\hss]}}
+ \mathatom class ####1 {\hpack to 1.5em{\infofont[\hss\getvalue{atom:####1}\hss]}}
+ $
+ \eTD
+ \fi
+ }
+ \eTR
+ \fi
+ }
+ \bTR[frame=off]
+ \bTD[nx=12,height=6ex,align={middle,lohi}]
+ \type{#1}
+ \eTD
+ \eTR
+ \bTR
+ \bTD[nx=12,align=middle]
+ \infofont\hfill
+ tiny : \the\tinymuskip\hfill
+ thin : \the\thinmuskip\hfill
+ med : \the\medmuskip\hfill
+ thick : \the\thickmuskip\hfill\strut
+ \eTD
+ \eTR
+ \eTABLE
+ \stopTEXpage
+}
+
+\stopmodule
+
+\continueifinputfile{s-math-atoms.mkxl}
+
+\starttext
+
+ \showmathatomspacing{\displaystyle}
+ \showmathatomspacing{\textstyle}
+ \showmathatomspacing{\scriptstyle}
+ \showmathatomspacing{\scriptscriptstyle}
+ \showmathatomspacing{\crampeddisplaystyle}
+ \showmathatomspacing{\crampedtextstyle}
+ \showmathatomspacing{\crampedscriptstyle}
+ \showmathatomspacing{\crampedscriptscriptstyle}
+
+\stoptext
diff --git a/tex/context/modules/mkxl/s-math-definitions.mkxl b/tex/context/modules/mkxl/s-math-definitions.mkxl
new file mode 100644
index 000000000..8b99ae602
--- /dev/null
+++ b/tex/context/modules/mkxl/s-math-definitions.mkxl
@@ -0,0 +1,56 @@
+%D \module
+%D [ file=s-math-definitions.mkxl,
+%D version=2022.01.27,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Math Definition Checking,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D I use this file for checking the classes as set in \type {char-def.lua}. It
+%D could work with \MKIV\ but because we have more clases in \LMTX\ we only use
+%D (and need) it there.
+
+\startmodule[math-definitions]
+
+\registerctxluafile{s-math-definitions}{autosuffix}
+
+\permanent\tolerant\protected\def\showmathcharacterdefinitions[#1]%
+ {\ctxlua{moduledata.math.definitions.showlist()}}
+
+\permanent\tolerant\protected\def\showmathatomspacing[#1]%
+ {\ctxlua{moduledata.math.definitions.showatoms()}}
+
+\def\ShowMathAtomSpacingPage#1#2#3#4%
+ {\startTEXpage[offset=10pt]
+ \raggedcenter
+ \dontleavehmode\framed
+ [height=60pt,width=150pt]
+ {$\showglyphs\showmakeup[math]#3 #4$}
+ \blank
+ \strut\infofont\detokenize{#1 #2 : $#3 #4$}
+ \stopTEXpage}
+
+\permanent\tolerant\protected\def\showmathatomspacingpage[#1]%
+ {\ctxlua{moduledata.math.definitions.showatomspage()}}
+
+\stopmodule
+
+\continueifinputfile{s-math-definitions.mkxl}
+
+\setuplayout[tight]
+
+\setupbodyfont[cambria,10pt]
+
+\starttext
+ \showmathatomspacing
+% \page
+% \showmathatomspacingpage
+% \page
+% \showmathcharacterdefinitions
+\stoptext
+
diff --git a/tex/context/modules/mkxl/s-math-tweaks.mkxl b/tex/context/modules/mkxl/s-math-tweaks.mkxl
new file mode 100644
index 000000000..2579f1ec4
--- /dev/null
+++ b/tex/context/modules/mkxl/s-math-tweaks.mkxl
@@ -0,0 +1,185 @@
+%D \module
+%D [ file=s-math-atoms.mksl,
+%D version=2022.02.13,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Show Math Atom Spacing,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This is just a quick and dirty overview.
+
+\startmodule[math-tweaks]
+
+\unprotect
+
+\starttexdefinition protected showmathfonttweaks_text_accent #1
+ \bTR
+ \bTD[width=7em,align=flushleft,style=mono] #1 \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{i} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{I} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{x} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{X} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{xx} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{XX} } \eTD
+ \eTR
+\stoptexdefinition
+
+\starttexdefinition protected showmathfonttweaks_wide_accent #1
+ \bTR
+ \bTD[width=7em,align=flushleft,style=mono] #1 \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{i} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{I} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{x} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{X} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{xx} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{XX} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{xxxxx} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{XXXXX} } \eTD
+ \eTR
+\stoptexdefinition
+
+\starttexdefinition protected showmathfonttweaks_prime #1
+ \bTR
+ \bTD \type{#1} \eTD
+ \bTD \m {\showglyphs #1} \eTD
+ \eTR
+\stoptexdefinition
+
+\starttexdefinition protected showmathfonttweaks_bracer #1
+ \bTR
+ \bTD \type{#1} \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{x} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{xxxxx} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{X} } \eTD
+ \bTD \m {\showglyphs \getvalue{#1}{XXXXX} } \eTD
+ \eTR
+\stoptexdefinition
+
+\starttexdefinition protected showmathfonttweaks
+
+ \startsubject[title=text accents]
+ \startlinecorrection
+ \bTABLE[align=middle,offset=1ex]
+ \showmathfonttweaks_text_accent{grave}
+ \showmathfonttweaks_text_accent{bar}
+ \showmathfonttweaks_text_accent{acute}
+ \showmathfonttweaks_text_accent{hat}
+ \showmathfonttweaks_text_accent{check}
+ \showmathfonttweaks_text_accent{breve}
+ \showmathfonttweaks_text_accent{dot}
+ \showmathfonttweaks_text_accent{ring}
+ \showmathfonttweaks_text_accent{tilde}
+ \showmathfonttweaks_text_accent{ddot}
+ \showmathfonttweaks_text_accent{dddot}
+ \eTABLE
+ \stoplinecorrection
+ \stopsubject
+
+ \startsubject[title=wide accents]
+ \startlinecorrection
+ \bTABLE[align=middle,offset=1ex]
+ \showmathfonttweaks_wide_accent{widegrave}
+ \showmathfonttweaks_wide_accent{widebar}
+ \showmathfonttweaks_wide_accent{wideacute}
+ \showmathfonttweaks_wide_accent{widehat}
+ \showmathfonttweaks_wide_accent{widecheck}
+ \showmathfonttweaks_wide_accent{widebreve}
+ \showmathfonttweaks_wide_accent{widedot}
+ \showmathfonttweaks_wide_accent{widering}
+ \showmathfonttweaks_wide_accent{widetilde}
+ \showmathfonttweaks_wide_accent{wideddot}
+ \showmathfonttweaks_wide_accent{widedddot}
+ \eTABLE
+ \stoplinecorrection
+ \stopsubject
+
+ \startsubject[title=primes]
+ \startlinecorrection
+ \bTABLE[align=flushleft,offset=1ex]
+ \showmathfonttweaks_prime{x'}
+ \showmathfonttweaks_prime{x''}
+ \showmathfonttweaks_prime{x'''}
+ \showmathfonttweaks_prime{X'}
+ \showmathfonttweaks_prime{X''}
+ \showmathfonttweaks_prime{X'''}
+ \showmathfonttweaks_prime{x'}
+ \showmathfonttweaks_prime{x'^2}
+ \showmathfonttweaks_prime{x'_2}
+ \showmathfonttweaks_prime{x'^2_2}
+ \showmathfonttweaks_prime{x'}
+ \showmathfonttweaks_prime{x^2'}
+ \showmathfonttweaks_prime{x_2'}
+ \showmathfonttweaks_prime{x^2_2'}
+ \eTABLE
+ \stoplinecorrection
+ \stopsubject
+
+ \startsubject[title=bracers]
+ \startlinecorrection
+ \bTABLE[align=flushleft,offset=1ex]
+ \showmathfonttweaks_bracer{overbrace}
+ \showmathfonttweaks_bracer{underbrace}
+ \showmathfonttweaks_bracer{overbracket}
+ \showmathfonttweaks_bracer{underbracket}
+ \showmathfonttweaks_bracer{overparent}
+ \showmathfonttweaks_bracer{underparent}
+ \showmathfonttweaks_bracer{overbar}
+ \showmathfonttweaks_bracer{underbar}
+ \showmathfonttweaks_bracer{overline}
+ \showmathfonttweaks_bracer{underline}
+ \eTABLE
+ \stoplinecorrection
+ \stopsubject
+
+ \startsubject[title=whatever]
+ \startlinecorrection
+ \bTABLE[align=flushleft,offset=1ex]
+ \bTR
+ \bTD \m{\mfunction{máx}}\eTD
+ \eTR
+ \eTABLE
+ \stoplinecorrection
+ \stopsubject
+\stoptexdefinition
+
+\protect
+
+\stopmodule
+
+\continueifinputfile{s-math-tweaks.mkxl}
+
+\setuplayout
+ [tight]
+
+\starttext
+
+\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[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[stixtwo] \starttitle[title=\fontclass] \showmathfonttweaks \stoptitle
+
+ } {
+
+ \normalexpanded{\setupbodyfont[\getdocumentargument{bodyfont},12pt]}
+ \showmathfonttweaks
+
+ }
+
+
+\stoptext
+