diff options
author | Hans Hagen <pragma@wxs.nl> | 2020-09-15 19:16:53 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2020-09-15 19:16:53 +0200 |
commit | e7dc9c1fc474fa15a2cbc34d8f543518f5853361 (patch) | |
tree | 203dc5620b0ac92b72f37c30de1cbe90e18823a3 | |
parent | 03f6d43b4a5036b4cbb7e4df56db7217717bdadd (diff) | |
download | context-e7dc9c1fc474fa15a2cbc34d8f543518f5853361.tar.gz |
2020-09-15 18:10:00
66 files changed, 4118 insertions, 225 deletions
diff --git a/doc/context/presentations/context/2020/context-2020-concepts.pdf b/doc/context/presentations/context/2020/context-2020-concepts.pdf Binary files differnew file mode 100644 index 000000000..913db5ef3 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-concepts.pdf diff --git a/doc/context/presentations/context/2020/context-2020-concepts.tex b/doc/context/presentations/context/2020/context-2020-concepts.tex new file mode 100644 index 000000000..a472a33f4 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-concepts.tex @@ -0,0 +1,694 @@ +% language=us + +\usemodule[present-boring,abbreviations-logos] + +\startdocument + [title={CONCEPTS}, + banner={experiments turned features}, + location={context\enspace {\bf 2020}\enspace meeting}] + +% see datatypes, hyphenation etc + +\starttitle[title=Experiments] + +There have been quite some experiments. Some results were rejected, some kept. +Here are a few (that come to mind). This talk is a mix of summary, discussion and +some demos. + +\stoptitle + +\starttitle[title=Math] + +There are a couple of additional features in the math engine. Most concern a bit +more control over hard coded behavior, but some are sort of new: + +\startbuffer +test $a = b \discretionary class 3 {$<$}{$>$}{$\neq$} c$ test +\stopbuffer + +\typebuffer + +When there is enough room this will give + +\getbuffer + +When \type {\hsize} is limited we get: + +{\hsize 4mm \getbuffer} + +\page + +\enabletrackers[math.toysymbol] + +\definemathtoysymbol[Plus] [bin][+] +\definemathtoysymbol[Minus][bin][-] +\definemathtoysymbol[Equal][rel][=] + +\start + +\let\darkblue\darkyellow %\showmakeup[glue] + +$\dorecurse{199} { + x_{#1} \ifodd#1\relax\Plus\else\Minus\fi +} x_{200} \Equal n$ + +\dorecurse{10} { + test \discretionary + {\darkred hel $\sqrt{y}$ lo} + {\darkgreen good $\sqrt{z}$ bye} + {\darkblue wel $\sqrt{x}$ come} test +} + +\dorecurse{10} {test #1 + $x + 2x \discretionary class 2 + {$+ \, \cdots $} + {$ \cdots \, +$} + {$+ \, \cdots \, +$} nx$ test +} + +\stop + +\stoptitle + +\starttitle[title=More math] + +In traditional \TEX\ the last setting wins: + +\startbuffer +\def\whatevera + {\Umathordrelspacing \textstyle=50mu + \Umathopenbinspacing\textstyle=50mu} + +\def\whateverb + {\Umathordrelspacing \textstyle=25mu + \Umathopenbinspacing\textstyle=25mu} + +$\whatevera a = (-2)$ \par +$\whateverb a = (-2)$ \par +$\whatevera a = (-2) \quad \whateverb a = (-2)$ \par +\stopbuffer + +\typebuffer \startpacked \getbuffer \stoppacked + +\page + +In \LUAMETATEX\ we can freeze settings on the spot: + +\startbuffer +\def\whatevera + {\frozen\Umathordrelspacing \textstyle=50mu + \frozen\Umathopenbinspacing\textstyle=50mu} + +\def\whateverb + {\frozen\Umathordrelspacing \textstyle=25mu + \frozen\Umathopenbinspacing\textstyle=25mu} + +$\whatevera a = (-2)$ \par +$\whateverb a = (-2)$ \par +$\whatevera a = (-2) \quad \whateverb a = (-2)$ \par +\stopbuffer + +\typebuffer \startpacked \getbuffer \stoppacked + +\stoptitle + +\starttitle[title=Macros] + +Not storing arguments: + +\starttyping +\def\foo#1#0#3{....} + +\foo{11}{22}{33} + +\foo #1#0#3->.... +#1<-11 +#2<- +#3<-33 +\stoptyping + +Ignoring arguments: + +\starttyping +\def\foo#1#-#2{#1#2} + +\foo{1}{2}{3} + +13 +\stoptyping + +\page + +Normal behaviour: + +\starttyping +\def\foo#1#2#3{#1#2#3} + +\foo{1}{{2}}{3} + +\foo #1#2#3->#1#2#3 +#1<-1 +#2<-{2} +#3<-3 +\stoptyping + +Special behaviour: + +\starttyping +\def\foo#1#+#3{#1#2#3} + +\foo #1#2#3->#1#2#3 +#1<-1 +#2<-{{2}} +#3<-3 +\stoptyping + +\page + +Optional tokens (we also show some \TEX-expansion-horror here): + +\starttyping +\edef\a!space{\expandtoken \ignorecatcode \spaceasciicode} + +\normalexpanded { + + \protected \def \noexpand \doifelseinset#1#2% + {\noexpand\ifhasxtoks{,\a!space#1,}{,#2,}% + \noexpand\expandafter\noexpand\firstoftwoarguments + \noexpand\else + \noexpand\expandafter\noexpand\secondoftwoarguments + \noexpand\fi} + +} +\stoptyping + +or as tokens (\type{\showluatokens\doifelseinset}) on the next page: + +\page + +\starttyping +591504 13 1 argument +643771 13 2 argument +595596 14 0 end match +633535 120 48 if test ifhasxtoks +643789 1 123 left brace +643793 12 44 other char +643741 9 32 ignore +185919 5 1 parameter +633495 12 44 other char + 57752 2 125 right brace +167619 1 123 left brace +643686 12 44 other char +228803 5 2 parameter +643434 12 44 other char +643792 2 125 right brace +643788 114 0 expand after expandafter +643775 125 0 call firstoftwoarguments +590609 120 3 if test else +643628 114 0 expand after expandafter +643754 125 0 call secondoftwoarguments +643763 120 2 if test fi +\stoptyping + +\page + +Cheating with arguments: + +\startbuffer +\def\foo#1=#2,{(#1/#2)} + +\foo 1=2,\ignorearguments +\foo 1=2\ignorearguments +\foo 1\ignorearguments +\foo \ignorearguments +\stopbuffer + +\typebuffer + +\getbuffer + +As in: + +\startbuffer +\def\foo#1=#2,{\ifarguments\or(#1)\or(#1/#2)\fi} + +\foo 1=2,\ignorearguments +\foo 1=2\ignorearguments +\foo 1\ignorearguments +\foo \ignorearguments +\stopbuffer + +\typebuffer + +\getbuffer + +\stoptitle + +\starttitle[title=Hyphenation] + +Hyphenation at work: + +\startlinecorrection[line] +\startcombination[distance=3cm,nx=6] + {\vtop{\hsize 2mm \strut NEDERLANDS\vskip.5\lineheight}} {\type{NEDERLANDS}} + {\vtop{\hsize 2mm \strut Nederlands\vskip.5\lineheight}} {\type{Nederlands}} + {\vtop{\hsize 2mm \strut nederlands\vskip.5\lineheight}} {\type{nederlands}} + {\vtop{\hsize 2mm \strut \CONTEXT \vskip.5\lineheight}} {\type{\CONTEXT }} + {\vtop{\hsize 2mm \strut text\-test\vskip.5\lineheight}} {\type{text\-test}} + {\vtop{\hsize 2mm \strut test-test \vskip.5\lineheight}} {\type{test-test }} +\stopcombination +\stoplinecorrection + +Controlling hyphenation: + +\startbuffer[1] +\nohyphens NEDERLANDS {\dohyphens Nederlands} nederlands +\stopbuffer + +\startbuffer[2] +NEDERLANDS {\nohyphens Nederlands} nederlands +\stopbuffer + +\typebuffer[1] and \typebuffer[2] + +\startlinecorrection[line] +\startcombination[distance=4cm,nx=2] + {\small \small \vtop{\hsize 2mm \strut \nl \getbuffer[1]}} {} + {\small \small \vtop{\hsize 2mm \strut \nl \getbuffer[2]}} {} +\stopcombination +\stoplinecorrection + +\page + +There are several ways to implement this: + +\startitemize +\startitem choose a language with no patterns: + \startitemize[packed] + \startitem it's quite efficient \stopitem + \startitem we loose language specifics \stopitem + \stopitemize +\stopitem +\startitem set the left and right hyphen min values high: + \startitemize[packed] + \startitem it works okay \stopitem + \startitem it is a hack \stopitem + \startitem we still enter the routine \stopitem + \stopitemize +\stopitem +\startitem block the mechanism: + \startitemize[packed] + \startitem it provides detailed control \stopitem + \startitem it is conceptually clean \stopitem + \stopitemize +\stopitem +\stopitemize + +The last method is what we use in \LMTX: + +\type {\dohyphens} : {\tttf \meaning\dohyphens} + +\type {\nohyphens} : {\tttf \meaning\nohyphens} + +\page + +For the moment we have this (it might evolve): + +\starttyping[style=\tt\small\small] +\chardef \completehyphenationmodecode \numexpr + \normalhyphenationmodecode % \discretionary + + \automatichyphenationmodecode % - + + \explicithyphenationmodecode % \- + + \syllablehyphenationmodecode % pattern driven + + \uppercasehyphenationmodecode % replaces \uchyph + + \compoundhyphenationmodecode % replaces \compoundhyphenmode + % \strictstarthyphenationmodecode % replaces \hyphenationbounds (strict = original tex) + % \strictendhyphenationmodecode % replaces \hyphenationbounds (strict = original tex) + + \automaticpenaltyhyphenationmodecode % replaces \hyphenpenaltymode (otherwise use \exhyphenpenalty) + + \explicitpenaltyhyphenationmodecode % replaces \hyphenpenaltymode (otherwise use \exhyphenpenalty) + + \permitgluehyphenationmodecode % turn glue into kern in \discretionary + + \permitallhyphenationmodecode % okay, let's be even more tolerant + + \permitmathreplacehyphenationmodecode % and again we're more permissive +\relax +\stoptyping + +This replaces some \LUATEX\ mode variables and adds some more which is why we now use +a bitset instead of multiple parameters. + +\page + +In addition we have more detailed discretionary control: + +\startbuffer +nederlands\discretionary {!}{!}{!}nederlands +nederlands\discretionary options 1 {!}{!}{!}nederlands +nederlands\discretionary options 2 {!}{!}{!}nederlands +nederlands\discretionary options 3 {!}{!}{!}nederlands +\stopbuffer + +\typebuffer + +\startlinecorrection[line] +\startcombination[distance=4cm,nx=4] + {\vtop{\hsize 1mm \strut \nl nederlands\discretionary {!}{!}{!}nederlands}} {} + {\vtop{\hsize 1mm \strut \nl nederlands\discretionary options 1 {!}{!}{!}nederlands}} {} + {\vtop{\hsize 1mm \strut \nl nederlands\discretionary options 2 {!}{!}{!}nederlands}} {} + {\vtop{\hsize 1mm \strut \nl nederlands\discretionary options 3 {!}{!}{!}nederlands}} {} +\stopcombination +\stoplinecorrection + +At some point it will become \quote {frozen} functionality and that's when it gets +documented (first we need to integrate and play a bit more with it in \CONTEXT). + +\stoptitle + +\starttitle[title=Local control] + +In \LUATEX\ we have experimental (kind of ugly) immediate assignments that can be +used in expansions without blocking (resulting in tokens that is). + +But now we now have local control: + +\startbuffer +\newcount\foocounter + +\def\foo + {\advance\foocounter\plusone + \the\foocounter} + +\edef\oof{(\foo)(\foo)(\foo)(\foo)} + +\meaning\oof +\stopbuffer + +\typebuffer + +{\tttf \nohyphens \veryraggedright \getbuffer} + +\page + +Immediate expansion: + +\startbuffer +\def\foo + {\beginlocalcontrol + \advance\foocounter\plusone + \endlocalcontrol + \the\foocounter} + +\edef\oof{(\foo)(\foo)(\foo)(\foo)} + +\meaning\oof +\stopbuffer + +\typebuffer + +{\tttf \getbuffer} + +Hidden assignments: + +\startbuffer +\scratchcounterone \beginlocalcontrol + \scratchcountertwo 100 + \multiply \scratchcountertwo by 4 +\endlocalcontrol \scratchcountertwo +\the\scratchcounterone +\stopbuffer + +\typebuffer + +{\tttf \getbuffer} + +% \the \beginlocalcontrol +% \scratchcountertwo 100 +% \multiply \scratchcountertwo by 4 +% \endlocalcontrol \scratchcountertwo + +\page + +Fancy expansion: + +\startbuffer +\protected\def\foo + {\beginlocalcontrol + \advance\foocounter\plusone + \endlocalcontrol + \the\foocounter} + +\edef\oof{(\foo)(\foo)(\foo)(\foo)} +\edef\ofo{(\expand\foo)(\expand\foo)(\expand\foo)(\expand\foo)} + +\meaning\oof \par \meaning\ofo +\stopbuffer + +\typebuffer + +{\tttf \getbuffer} + +And a teaser: + +\starttyping +\protected\def\widthofcontent#1{\beginlocalcontrol + \setbox\scratchbox\hbox{#1}\endlocalcontrol \wd\scratchbox} +\stoptyping + +\stoptitle + +\starttitle[title=Conditionals] + +We can get nicer code that this: + +\starttyping +\ifdim\scratchdimen=10pt + \expandafter\one +\else\ifnum\scratchcounter=20 + \expandafter\expandafter\expandafter\two +\else + \expandafter\expandafter\expandafter\three +\fi\fi +\stoptyping + +This becomes: + +\starttyping +\ifdim\scratchdimen=10pt + \expandafter\one +\orelse\ifnum\scratchcounter=20 + \expandafter\two +\else + \expandafter\three +\fi +\stoptyping + +\page + +There is a bunch of extra conditions like the generic: + +\startnarrower \type {\ifcondition} \stopnarrower + +some token testers like: + +\startnarrower \type {\iftok} and \type {\ifhas(x)tok(s)} \stopnarrower + +some specific for math: + +\startnarrower \type {\ifmathstyle} and \type {\ifmathparameter} \stopnarrower + +macro helpers: + +\startnarrower \type {\ifarguments}, \type {\ifboolean} and \type {\ifempty} \stopnarrower + +robust number and dimension interception: + +\startnarrower \type {\ifchknum}, \type {\ifchkdim}, \type {\ifcmpnum}, \type {\ifcmpdim)}, \type {\ifnumval} and \type {\ifdimval} \stopnarrower + +bonus checks: + +\startnarrower \type {\iffrozen}, \type {\ifprotected} and \type {\ifusercmd} \stopnarrower + +and the mentioned: + +\startnarrower \type {\orelse} and \type {\orunless} \stopnarrower + +\stoptitle + +\starttitle[title=Migration] + +\startbuffer +h: \setbox0\hbox{box \footnote{h: box}}\setbox2\hbox{\box 0}\box2\par +h: \setbox0\hbox{copy \footnote{h: copy}}\setbox2\hbox{\copy 0}\box2\par +h: \setbox0\hbox{unbox \footnote{h: unhbox}}\setbox2\hbox{\unhbox 0}\box2\par +h: \setbox0\hbox{uncopy \footnote{h: unhcopy}}\setbox2\hbox{\unhcopy0}\box2\par + +v: \setbox0\hbox{box \footnote{v: box}}\setbox2\vbox{\box 0}\box2\par +v: \setbox0\hbox{copy \footnote{v: copy}}\setbox2\vbox{\copy 0}\box2\par +v: \setbox0\hbox{unbox \footnote{v: unhbox}}\setbox2\vbox{\unhbox 0}\box2\par +v: \setbox0\hbox{uncopy \footnote{v: unhcopy}}\setbox2\vbox{\unhcopy0}\box2\par + +\starttabulate[||] +\NC tabulate \footnote{tabulate} \NC \NR +\stoptabulate +\stopbuffer + +\typebuffer[style={\tt\small}] + +\page + +\startpacked \getbuffer \stoppacked + +% \setbox0\hbox{test \footnote{test}} (\prelistbox0) (\postlistbox0) +% \setprelistbox0\hbox{BEFORE} \setpostlistbox0\hbox{AFTER} +% \box0 + +% \setbox0\hbox{test \footnote{test}} (\prelistcopy0) (\postlistcopy0) +% \setprelistbox0\hbox{BEFORE} \setpostlistbox0\hbox{AFTER} +% \box0 + +\stoptitle + +\starttitle[title=Normalizing lines] + +We can have predictable lines: + +\startbuffer + \hangindent3cm \hangafter 2 \leftskip1cm \rightskip1cm \input ward \par +\stopbuffer + +\typebuffer + +Standard (but already with left skips): + +\start + \bitwiseflip \normalizelinemode -\indentskipmodecode + \bitwiseflip \normalizelinemode -\normalizelinemodecode + \showmakeup \relax \getbuffer +\stop + +Normalized (enhanced, no shifts, indent skip): + +\start + \bitwiseflip \normalizelinemode \indentskipmodecode + \bitwiseflip \normalizelinemode \normalizelinemodecode + \showmakeup \relax \getbuffer +\stop + +\page + +\startbuffer + \parshape 2 1cm 10cm 2cm 15cm \leftskip1cm \rightskip1cm \input ward \par +\stopbuffer + +\typebuffer + +Standard: + +\start + \bitwiseflip \normalizelinemode -\indentskipmodecode + \bitwiseflip \normalizelinemode -\normalizelinemodecode + \showmakeup \relax \getbuffer +\stop + +Normalized: + +\start + \bitwiseflip \normalizelinemode \indentskipmodecode + \bitwiseflip \normalizelinemode \normalizelinemodecode + \showmakeup \relax \getbuffer +\stop + +% {\showmakeup \getbuffer} + +\stoptitle + +\starttitle[title=Freezing paragraph properties] + +\startbuffer +\forgetparagraphfreezing \placefigure[left]{}{} {\bf Andrew Cuomo:} \input cuomo +\stopbuffer + +\typebuffer[style=\tt\small] \start \switchtobodyfont[8pt] \getbuffer \par \stop + +\startbuffer +\setparagraphfreezing \placefigure[left]{}{} {\bf Andrew Cuomo:} \input cuomo +\stopbuffer + +\typebuffer[style=\tt\small] \start \switchtobodyfont[8pt] \getbuffer \par \stop + +\stoptitle + +\starttitle[title=Wrapping up paragraphs] + +\setparagraphfreezing + +We have \type {\wrapuppar} as new hook. An experimental mechanism has been build +around it so that Wolfgang and I can freak out on this. + +\startbuffer +\def\TestA{\registerparwrapper + {A} + {[\ignorespaces} + {\removeunwantedspaces]\showparwrapperstate{A}}} + +\def\TestB#1{\registerparwrapper + {B#1} + {(\ignorespaces} + {\removeunwantedspaces)\showparwrapperstate{B#1}}} + +\def\TestC{\registerparwrapper + {C} + {<\ignorespaces} + {\removeunwantedspaces>\showparwrapperstate{C}\forgetparwrapper}} + +\def\TestR{\registerparwrapperreverse + {R} + {<\ignorespaces} + {\removeunwantedspaces>\showparwrapperstate{R}}} +\stopbuffer + +\typebuffer[style=\tt\small] \getbuffer + +\page + +Example 1: + +\startbuffer +\TestA +\dorecurse{3} + {1.#1 before \ruledvbox{\hsize2em\raggedcenter\TestB1 !\par} after\par} +\dorecurse{3} + {2.#1 before \ruledvbox{\hsize3em\raggedcenter !\par} after\par} +\dorecurse{3} + {3.#1 before \ruledvbox{\hsize4em\raggedcenter\TestB2 !} after\par} +\forgetparwrapper +\dorecurse{3} + {4.#1 before \ruledvbox{\hsize5em\raggedcenter\TestB3 !} after\par} +\TestC +\dorecurse{3} + {5.#1 before \ruledvbox{\hsize2em\raggedcenter\TestA !} after\par} +\stopbuffer + +\typebuffer[style=\tt\small] + +\startcolumns \startpacked \getbuffer \stoppacked \stopcolumns + +\page + +Example 2: + +\startbuffer +\TestA +\dorecurse{3}{6.#1 before after\par} \blank +\TestB4 +\dorecurse{3}{7.#1 before after\par} \blank +\TestB5 +\TestR +\dorecurse{3}{8.#1 before after\par} \blank +\stopbuffer + +\typebuffer[style=\tt\small] + +\startcolumns \startpacked \getbuffer \stoppacked \stopcolumns + +\stoptitle + +\stopdocument diff --git a/doc/context/presentations/context/2020/context-2020-datatypes.pdf b/doc/context/presentations/context/2020/context-2020-datatypes.pdf Binary files differnew file mode 100644 index 000000000..906b1fe04 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-datatypes.pdf diff --git a/doc/context/presentations/context/2020/context-2020-datatypes.tex b/doc/context/presentations/context/2020/context-2020-datatypes.tex new file mode 100644 index 000000000..590cdbf93 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-datatypes.tex @@ -0,0 +1,454 @@ +\usemodule[present-boring,abbreviations-logos] + +\startdocument + [title={DATATYPES}, + banner={additional datatypes in lmtx}, + location={context\enspace {\bf 2020}\enspace meeting}] + +\starttitle[title=Native \TEX\ datatypes: simple registers] + +\startbuffer +integer: \count 123 = 456 \the\count123 +\stopbuffer + +\typebuffer {\getbuffer} + +\startbuffer +dimension: \dimen123 = 456pt \the\dimen123 +\stopbuffer + +\typebuffer {\getbuffer} + +\startbuffer +glue: \skip123 = 6pt plus 5pt minus 4pt\relax \the\skip123 +\stopbuffer + +\typebuffer {\getbuffer} + +\startbuffer +muglue: \muskip123 = 6mu plus 5mu minus 4mu\relax \the\muskip123 +\stopbuffer + +\typebuffer {\getbuffer} + +\startbuffer +attribute: \attribute123 = 456 \the\attribute123 +\stopbuffer + +\typebuffer {\getbuffer} + +\blank[2*line] + +\starttyping +\global \the \countdef \dimendef \skipdef \muskipdef \attributedef +\advance \multiply \divide \numexpr \dimexpr \glueexpr \muexpr +\stoptyping + +\stoptitle + +\starttitle[title=Native \TEX\ datatypes: tokens] + +\startbuffer +toks: \toks123 = {456} \the\toks123 +\stopbuffer + +\typebuffer {\getbuffer} + +\blank[2*line] + +\starttyping +\global \the \toksdef +\toksapp \etoksapp \xtoksapp \gtoksapp +\tokspre \etokspre \xtokspre \gtokspre +\stoptyping + +\blank[2*line] + +(in retrospect: eetex) + +\stoptitle + +\starttitle[title=Native \TEX\ datatypes: boxes] + +\startbuffer +box: \box123 = \hbox {456} (\the\wd123,\the\ht123,\the\dp123) \box123 +\stopbuffer + +\typebuffer {\getbuffer} + +\blank[2*line] + +\starttyping +\global \box \copy \unhbox \unvbox +\hbox \vbox \vtop \hpack \vpack \tpack +\wd \ht \dp \boxtotal +\boxdirection \boxattr +\boxorientation \boxxoffset \boxyoffset \boxxmove \boxymove +\stoptyping + +\stoptitle + +\starttitle[title=Native \TEX\ datatypes: macros] + +\startbuffer +\def\onetwothree{346} \onetwothree +\stopbuffer + +\typebuffer {\getbuffer} + +\blank[2*line] + +\starttyping +\global \protected \frozen +\def \edef \edef \xdef +\meaning +\stoptyping + +\stoptitle + +\starttitle[title=Native \LUA\ datatypes: numbers] + +\startbuffer +\ctxlua{local n = 123 context(n)}\quad +\ctxlua{local n = 123.456 context(n)}\quad +\ctxlua{local n = 123.4E56 context(n)}\quad +\ctxlua{local n = 0x123 context(n)}\quad +\ctxlua{local n = 0x1.37fe4cd4b70b2p-1 context(n)} +\stopbuffer + +\typebuffer {\getbuffer} + +\blank[2*line] + +\starttyping ++ - * / // % ^ | ~ & << >> == ~= < > <= >= ( ) +\stoptyping + +\stoptitle + +\starttitle[title=Native \LUA\ datatypes: strings] + +\startbuffer +\ctxlua{local s = "abc" context(s)}\quad +\ctxlua{local s = 'abc' context(s)}\quad +\ctxlua{local s = [[abc]] context(s)}\quad +\ctxlua{local s = [==[abc]==] context(s)}\quad +\stopbuffer + +\typebuffer {\getbuffer} + +\blank[2*line] + +\starttyping +.. # == ~= < > <= >= +\stoptyping + +\stoptitle + +\starttitle[title=Native \LUA\ datatypes: booleans and nil] + +\startbuffer +\ctxlua{local b = true context(b)}\quad +\ctxlua{local b = false context(b)}\quad +\ctxlua{local n = nil context(n)}\quad +\stopbuffer + +\typebuffer {\getbuffer} + +\blank[2*line] + +\starttyping +== ~= and or not +\stoptyping + +\stoptitle + +\starttitle[title=Native \LUA\ datatypes: some more] + +\starttyping +functions +userdata (lpeg is userdata) +coroutine +\stoptyping + +\LUAMETATEX\ provides tokens and nodes as userdata and some libraries also +use them (complex, decimal, pdf, etc). + +\stoptitle + +\starttitle[title=Both worlds combined] + +\startitemize[packed] +\startitem There are only 64K registers (although we can extend that if needed). \stopitem +\startitem Accessing registers at the \LUA\ end is not that efficient. \stopitem +\startitem So we have now datatypes at the \LUA\ end with access at the \TEX\ end. \stopitem +\startitem Their values can go beyond what \TEX\ registers provide. \stopitem +\stopitemize + +\startbuffer +\luacardinal bar 123 +\luainteger bar -456 +\luafloat bar 123.456E-3 +\stopbuffer + +\typebuffer \getbuffer + +\startbuffer +\the\luacardinal bar \quad +\the\luainteger bar \quad +\the\luafloat bar +\stopbuffer + +\typebuffer \getbuffer + +\page + +The usual \LUA\ semantics apply: + +\startbuffer +\luacardinal bar 0x123 +\luainteger bar -0x456 +\luafloat bar 0x123.456p-3 +\stopbuffer + +\typebuffer \getbuffer + +So, now we get: + +\startbuffer +\the\luacardinal bar \quad +\the\luainteger bar \quad +\the\luafloat bar +\stopbuffer + +\getbuffer + +Equal signs are optional: + +\startbuffer +\luainteger gnu= 123456 \luafloat gnu= 123.456e12 +\luainteger gnu = 123456 \luafloat gnu = 123.456e12 +\luainteger gnu =123456 \luafloat gnu =123.456e12 +\stopbuffer + +\typebuffer + +These commands can be uses for assignments as well as serialization. They use the +\LUAMETATEX\ value function feature. + +\page + +Dimensions are serialized differently so that they can be used like this: + +\startbuffer +\luadimen test 100pt \scratchdimen = .25 \luadimen test: \the\scratchdimen +\stopbuffer + +\typebuffer + +\getbuffer + +\page + +Assume that we have this: + +\startbuffer +\luacardinal x = -123 \luafloat x = 123.123 +\luacardinal y = 456 \luafloat y = -456.456 +\stopbuffer + +\typebuffer \getbuffer + +We can then use the macro \type {\luaexpression} that takes an optional keyword: + +\startbuffer +- : \luaexpression {n.x + 2*n.y} +f : \luaexpression float {n.x + 2*n.y} +i : \luaexpression integer {n.x + 2*n.y} +c : \luaexpression cardinal {n.x + 2*n.y} +b : \luaexpression boolean {n.x + 2*n.y} +l : \luaexpression lua {n.x + 2*n.y} +\stopbuffer + +\typebuffer + +The serialization can be different for these cases: + +\startlines +\tt \getbuffer +\stoplines + +Variables have their own namespace but get resolved across namespaces (f, i, c). + +\page + +Special tricks: + +\startbuffer +\scratchdimen 123.456pt [\the\scratchdimen] [\the\nodimen\scratchdimen] +\stopbuffer + +\typebuffer \getbuffer + +Does nothing, nor does: + +\startbuffer +\nodimen\scratchdimen = 654.321pt +\stopbuffer + +\typebuffer \getbuffer + +But: + +\starttabulate[|T|T|] +\NC \type {\the\nodimen bp \scratchdimen} \NC \the\nodimen bp \scratchdimen \NC \NR +\NC \type {\the\nodimen cc \scratchdimen} \NC \the\nodimen cc \scratchdimen \NC \NR +\NC \type {\the\nodimen cm \scratchdimen} \NC \the\nodimen cm \scratchdimen \NC \NR +\NC \type {\the\nodimen dd \scratchdimen} \NC \the\nodimen dd \scratchdimen \NC \NR +\NC \type {\the\nodimen in \scratchdimen} \NC \the\nodimen in \scratchdimen \NC \NR +\NC \type {\the\nodimen mm \scratchdimen} \NC \the\nodimen mm \scratchdimen \NC \NR +\NC \type {\the\nodimen pt \scratchdimen} \NC \the\nodimen pt \scratchdimen \NC \NR +\NC \type {\the\nodimen sp \scratchdimen} \NC \the\nodimen sp \scratchdimen \NC \NR +\stoptabulate + +gives different units! In the coffee break it was decided to drop the \type {nc} +and \type {nd} units in \LUAMETATEX\ when Arthur indicated that they never became +a standard. Dropping the \type {true} variants also makes sense but we postponed +dropping the \type {in} (inch). + +\stoptitle + +\starttitle[title=Arrays] + +Two dimensional arrays have names and a type: + +\startbuffer +\newarray name integers type integer nx 2 ny 2 +\newarray name booleans type boolean nx 2 ny 2 +\newarray name floats type float nx 2 ny 2 +\newarray name dimensions type dimension nx 4 +\stopbuffer + +\typebuffer \getbuffer + +And a special accessor. Here we set values: + +\startbuffer +\arrayvalue integers 1 2 4 \arrayvalue integers 2 1 8 +\arrayvalue booleans 1 2 true \arrayvalue booleans 2 1 true +\arrayvalue floats 1 2 12.34 \arrayvalue floats 2 1 34.12 +\arrayvalue dimensions 1 12.34pt \arrayvalue dimensions 3 34.12pt +\stopbuffer + +\typebuffer \getbuffer + +\page + +Here we get values: + +\startbuffer +[\the\arrayvalue integers 1 2] +[\the\arrayvalue booleans 1 2] +[\the\arrayvalue floats 1 2] +[\the\arrayvalue dimensions 1 ]\crlf +[\the\arrayvalue integers 2 1] +[\the\arrayvalue booleans 2 1] +[\the\arrayvalue floats 2 1] +[\the\arrayvalue dimensions 3] +\stopbuffer + +\typebuffer + +\getbuffer + +When a value is expected the integer is serialized: + +\startbuffer +\scratchcounter\arrayvalue integers 1 2\relax \the\scratchcounter +\stopbuffer + +\typebuffer + +\getbuffer + +You can view an array on the console with: + +\starttyping +\showarray integers +\stoptyping + +\page + +Another expression example: + +\startbuffer +\dostepwiserecurse {1} {4} {1} { + [\the\arrayvalue dimensions #1 : + \luaexpression dimen {math.sind(30) * a.dimensions[#1]}] +} +\stopbuffer + +\typebuffer + +\getbuffer + +\page + +We can combine it all with if tests: + +\startbuffer +slot 1 is \ifboolean\arrayequals dimensions 1 0pt zero \else not zero \fi\quad +slot 2 is \ifboolean\arrayequals dimensions 2 0pt zero \else not zero \fi +\stopbuffer + +\typebuffer + +\getbuffer + +\startbuffer +slot 1: \ifcase\arraycompare dimensions 1 3pt lt \or eq \else gt \fi zero\quad +slot 2: \ifcase\arraycompare dimensions 2 3pt lt \or eq \else gt \fi zero\quad +slot 3: \ifcase\arraycompare dimensions 3 3pt lt \or eq \else gt \fi zero\quad +slot 4: \ifcase\arraycompare dimensions 4 3pt lt \or eq \else gt \fi zero + +slot 1: \ifcmpdim\arrayvalue dimensions 1 3pt lt \or eq \else gt \fi zero\quad +slot 2: \ifcmpdim\arrayvalue dimensions 2 3pt lt \or eq \else gt \fi zero\quad +slot 3: \ifcmpdim\arrayvalue dimensions 3 3pt lt \or eq \else gt \fi zero\quad +slot 4: \ifcmpdim\arrayvalue dimensions 4 3pt lt \or eq \else gt \fi zero +\stopbuffer + +\typebuffer + +\getbuffer + +\stoptitle + +\starttitle[title=Complex numbers] + +\startbuffer +\startluacode +local c1 = xcomplex.new(1,3) +local c2 = xcomplex.new(2,4) +context(c1) context.quad() context(c2) context.quad(c1 + c2) +\stopluacode +\stopbuffer + +\typebuffer \getbuffer + +\stoptitle + +\starttitle[title=Decimal numbers] + +\startbuffer +\startluacode +local c1 = xdecimal.new("123456789012345678901234567890") +local c2 = xdecimal.new(1234567890) +context(c1) context.crlf() context(c2) context.crlf(c1 * c2) +\stopluacode +\stopbuffer + +\typebuffer \getbuffer + +\stoptitle + +\stopdocument diff --git a/doc/context/presentations/context/2020/context-2020-ecmascript.pdf b/doc/context/presentations/context/2020/context-2020-ecmascript.pdf Binary files differnew file mode 100644 index 000000000..35764258c --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-ecmascript.pdf diff --git a/doc/context/presentations/context/2020/context-2020-ecmascript.tex b/doc/context/presentations/context/2020/context-2020-ecmascript.tex new file mode 100644 index 000000000..20877d633 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-ecmascript.tex @@ -0,0 +1,272 @@ +% language=us + +\usemodule[present-boring,abbreviations-logos] + +\startdocument + [title={ECMASCRIPT}, + banner={just because it can be done}, + location={context\enspace {\bf 2020}\enspace meeting}] + +\starttitle[title=Why oh why] + +\startitemize + +\startitem + We use a \type {mupdf} based \PDF\ viewer: \type {SumatraPDF}. +\stopitem +\startitem + And occasionally we use the tools that come with \type {mupdf}. +\stopitem +\startitem + So when checking if that viewer supports \JAVASCRIPT\ in widgets I noticed + the stand alone interpreter. \footnote {The official name is \ECMASCRIPT\ + which is the standardized core language.} +\stopitem +\startitem + Which made me wonder how easy it would be to interface to it. +\stopitem + +\blank + +\startitem + It uses the lightweight library subsystem: like \FFI\ the library interface + is setup dynamically. +\stopitem +\startitem + Support is {\em not} integrated in \LUAMETATEX, so there is no overhead and + there are no dependencies. +\stopitem +\startitem + We assume that the library is on the system, and when not, then there is also + also no support. +\stopitem +\startitem + We stick to the absolute minimum of interfacing needed and delegate + everything else to \LUA. +\stopitem +\startitem + We assume a stable \API, and if not, well \unknown\ sorry. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=The components] + +\startitemize + +\startitem + The optional, delayed loading, interface, adds only a few KB to \LUAMETATEX. +\stopitem + +\startitem + The \LUA\ library interface that is part of the \CONTEXT\ distribution which means + that it's officially supported. +\stopitem + +\startitem + There is a \TEX\ module that loads the lot and provides the user interface. +\stopitem + +\startitem + And of course, somewhere on the system, there should be the \type {mujs} + library. \footnote {Taco compiled the library for his system during the talk + and confirmed that it also works out of the box on \OSX.} +\stopitem + +\startitem + A module like this should conform to the \CONTEXT\ \LMTX\ standards (a + minimalistic not bloated \API, interfacing in \LUA\ and \TEX, etc.). +\stopitem + +\stopitemize + +\blank[2*line] + +In \CONTEXT\ libraries go into the platform tree, like: + +\starttyping +/tex/texmf-win64/bin/lib/luametatex/mujs/libmujs.dll +/tex/texmf-linux-64/bin/lib/luametatex/mujs/libmujs.so +/tex/texmf-osx-64/bin/lib/luametatex/mujs/libmujs.so +\stoptyping + +\stoptitle + +\starttitle[title=An example] + +\startbuffer +\usemodule[ecmascript] + +\ecmacode { + console(""); + console("When you see this, the loading has succeeded!"); + console(""); +} + +\ecmacode {texprint("Just a {\\bf short} sentence.")} + +\startecmacode + texprint("And this is \\inframed{\\bs a bit longer} sentence.") +\stopecmacode +\stopbuffer + +\typebuffer + +\getbuffer + +\stoptitle + +\starttitle[title=Catcodes] + +As with the \LUA\ interface, catcode regimes are supported: + +\startbuffer +\ecmacode {texprint(catcodes.vrb,"Just a {\\bf short} sentence.")} +\stopbuffer + +\typebuffer + +\getbuffer + +Possible values are: + +\starttabulate +\NC \type {tex} \NC regular \TEX\ catcode regime \NC \NR +\NC \type {ctx} \NC standard \CONTEXT\ catcode regime \NC \NR +\NC \type {vrb} \NC verbatim catcode regime \NC \NR +\NC \type {prt} \NC protected \CONTEXT\ catcode regime \NC \NR +\stoptabulate + +\stoptitle + +\starttitle[title=Print whatever you want] + +\startbuffer +\startecmacode + console("We're doing some MetaPost!"); + texsprint( + "\\startMPcode " + + 'fill fullsquare xyscaled (6cm,1cm) withcolor "darkgray";' + + 'fill fullsquare xyscaled (4cm,1cm) withcolor "middlegray";' + + 'fill fullsquare xyscaled (2cm,1cm) withcolor "lightgray";' + + "\\stopMPcode " + ); +\stopecmacode +\stopbuffer + +\typebuffer + +\startlinecorrection +\getbuffer +\stoplinecorrection + +Of course the code doesn't look pretty but it can serve as a step|-|up to the real +deal: coding in \CONTEXT\ speak (or \LUA). + +\stoptitle + +\starttitle[title=Files] + +Because the interpreter is pretty bare, interfacing to the file system has to be +provided but we can just use what we already have (controlled by \LUA). + +\startbuffer +\startecmacode + var f = File("\jobname","r"); + var l = f.read("*a"); + f.close(); + texprint( + "This file has " + + l.length // or: l.length.toString() + + " bytes!" + ) +\stopecmacode +\stopbuffer + +\typebuffer + +\getbuffer + +We support the usual arguments, like \type {*a}, \type {*l}, a number indicating +the bytes to read etc. There is no support for writing files (let's use the +security excuse). + +\page + +A file with some script: + +\startluacode +io.savedata("context-2020-ecmascript.js",[[ +function filesize(name) { + var f = File(name,"r"); + if (f != undefined) { + var l = f.seek("end"); + f.close(); + return l; + } else { + return 0; + } +} +]]) +\stopluacode + +\typefile{context-2020-ecmascript.js} + +Loading that file: + +\startbuffer +\ecmafile{context-2020-ecmascript.js} +\stopbuffer + +\typebuffer \getbuffer + +Using that function: + +\startbuffer +\ecmacode{texsprint("This file has " + filesize("\jobname.tex") + " bytes!")} +\stopbuffer + +\typebuffer \getbuffer + +\stoptitle + +\starttitle[title=Ecmascript from \LUA] + +\startbuffer +\startluacode + optional.loaded.mujs.execute [[ + var MyMax = 10; // an example of persistence + ]] + + optional.loaded.mujs.execute [[ + texsprint("\\startpacked"); + for (var i = 1; i <= MyMax; i++) { + texprint( + "Here is some rather dumb math test: " + + Math.sqrt(i/MyMax) + + "!\\par" + ); + } + texsprint("\\stoppacked"); + ]] +\stopluacode +\stopbuffer + +\typebuffer \page The result: \getbuffer + +\stoptitle + +\starttitle[title=So what good is it] + +\startitemize +\startitem Not that much value is added compared to what we already have. \stopitem +\startitem But at least we can say that we can do \ECMASCRIPT\ (aka \JAVASCRIPT). \stopitem +\startitem And it might convince (new) users to use the \LUA\ interfaces instead. \stopitem +\startitem So we pay a low price and have no overhead anyway. \stopitem +\stopitemize + +\stoptitle + +\stopdocument diff --git a/doc/context/presentations/context/2020/context-2020-gpdemo.gp b/doc/context/presentations/context/2020/context-2020-gpdemo.gp new file mode 100644 index 000000000..1f21ca57c --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-gpdemo.gp @@ -0,0 +1,8 @@ +set format xy "$%g$" + +set title 'This is a plot of $y=\sin(x)$' +set xlabel 'This is the $x$ axis' +set ylabel 'This is the $y$ axis' + +plot [0:6.28] [0:1] sin(x) + diff --git a/doc/context/presentations/context/2020/context-2020-gpdemo.svg b/doc/context/presentations/context/2020/context-2020-gpdemo.svg new file mode 100644 index 000000000..eb7d6de3c --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-gpdemo.svg @@ -0,0 +1,157 @@ +<?xml version="1.0" encoding="windows-1252" standalone="no"?> +<svg + width="600" height="480" + viewBox="0 0 600 480" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" +> + +<title>Gnuplot</title> +<desc>Produced by GNUPLOT 5.5 patchlevel 0 </desc> + +<g id="gnuplot_canvas"> + +<rect x="0" y="0" width="600" height="480" fill="none"/> +<defs> + + <circle id='gpDot' r='0.5' stroke-width='0.5' stroke='currentColor'/> + <path id='gpPt0' stroke-width='0.222' stroke='currentColor' d='M-1,0 h2 M0,-1 v2'/> + <path id='gpPt1' stroke-width='0.222' stroke='currentColor' d='M-1,-1 L1,1 M1,-1 L-1,1'/> + <path id='gpPt2' stroke-width='0.222' stroke='currentColor' d='M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1'/> + <rect id='gpPt3' stroke-width='0.222' stroke='currentColor' x='-1' y='-1' width='2' height='2'/> + <rect id='gpPt4' stroke-width='0.222' stroke='currentColor' fill='currentColor' x='-1' y='-1' width='2' height='2'/> + <circle id='gpPt5' stroke-width='0.222' stroke='currentColor' cx='0' cy='0' r='1'/> + <use xlink:href='#gpPt5' id='gpPt6' fill='currentColor' stroke='none'/> + <path id='gpPt7' stroke-width='0.222' stroke='currentColor' d='M0,-1.33 L-1.33,0.67 L1.33,0.67 z'/> + <use xlink:href='#gpPt7' id='gpPt8' fill='currentColor' stroke='none'/> + <use xlink:href='#gpPt7' id='gpPt9' stroke='currentColor' transform='rotate(180)'/> + <use xlink:href='#gpPt9' id='gpPt10' fill='currentColor' stroke='none'/> + <use xlink:href='#gpPt3' id='gpPt11' stroke='currentColor' transform='rotate(45)'/> + <use xlink:href='#gpPt11' id='gpPt12' fill='currentColor' stroke='none'/> + <path id='gpPt13' stroke-width='0.222' stroke='currentColor' d='M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z'/> + <use xlink:href='#gpPt13' id='gpPt14' fill='currentColor' stroke='none'/> + <filter id='textbox' filterUnits='objectBoundingBox' x='0' y='0' height='1' width='1'> + <feFlood flood-color='white' flood-opacity='1' result='bgnd'/> + <feComposite in='SourceGraphic' in2='bgnd' operator='atop'/> + </filter> + <filter id='greybox' filterUnits='objectBoundingBox' x='0' y='0' height='1' width='1'> + <feFlood flood-color='lightgrey' flood-opacity='1' result='grey'/> + <feComposite in='SourceGraphic' in2='grey' operator='atop'/> + </filter> +</defs> +<g fill="none" color="white" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M80.2,422.4 L89.2,422.4 M575.0,422.4 L566.0,422.4 '/> <g transform="translate(71.9,426.3)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" >$0$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M80.2,348.7 L89.2,348.7 M575.0,348.7 L566.0,348.7 '/> <g transform="translate(71.9,352.6)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" >$0.2$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M80.2,275.1 L89.2,275.1 M575.0,275.1 L566.0,275.1 '/> <g transform="translate(71.9,279.0)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" >$0.4$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M80.2,201.4 L89.2,201.4 M575.0,201.4 L566.0,201.4 '/> <g transform="translate(71.9,205.3)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" >$0.6$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M80.2,127.8 L89.2,127.8 M575.0,127.8 L566.0,127.8 '/> <g transform="translate(71.9,131.7)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" >$0.8$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M80.2,54.1 L89.2,54.1 M575.0,54.1 L566.0,54.1 '/> <g transform="translate(71.9,58.0)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" >$1$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M80.2,422.4 L80.2,413.4 M80.2,54.1 L80.2,63.1 '/> <g transform="translate(80.2,444.3)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >$0$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M159.0,422.4 L159.0,413.4 M159.0,54.1 L159.0,63.1 '/> <g transform="translate(159.0,444.3)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >$1$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M237.8,422.4 L237.8,413.4 M237.8,54.1 L237.8,63.1 '/> <g transform="translate(237.8,444.3)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >$2$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M316.6,422.4 L316.6,413.4 M316.6,54.1 L316.6,63.1 '/> <g transform="translate(316.6,444.3)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >$3$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M395.4,422.4 L395.4,413.4 M395.4,54.1 L395.4,63.1 '/> <g transform="translate(395.4,444.3)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >$4$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M474.1,422.4 L474.1,413.4 M474.1,54.1 L474.1,63.1 '/> <g transform="translate(474.1,444.3)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >$5$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M552.9,422.4 L552.9,413.4 M552.9,54.1 L552.9,63.1 '/> <g transform="translate(552.9,444.3)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >$6$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M80.2,54.1 L80.2,422.4 L575.0,422.4 L575.0,54.1 L80.2,54.1 Z '/></g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <g transform="translate(19.0,238.3) rotate(270)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >This is the $y$ axis</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <g transform="translate(327.6,471.3)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >This is the $x$ axis</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <g transform="translate(327.6,31.0)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >This is a plot of $y=sin(x)$</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> + <g id="gnuplot_plot_1" ><title>sin(x)</title> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <g transform="translate(507.9,76.0)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text>sin(x)</text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='rgb(148, 0, 211)' d='M516.2,72.1 L558.4,72.1 M80.2,422.4 L85.2,399.1 L90.2,375.8 L95.2,352.7 L100.2,329.9 L105.2,307.5 + L110.2,285.6 L115.2,264.2 L120.2,243.4 L125.2,223.4 L130.2,204.1 L135.2,185.8 L140.2,168.3 L145.2,152.0 + L150.2,136.6 L155.2,122.5 L160.2,109.5 L165.2,97.9 L170.2,87.5 L175.2,78.4 L180.2,70.8 L185.2,64.5 + L190.2,59.7 L195.2,56.4 L200.2,54.5 L205.1,54.1 L210.1,55.2 L215.1,57.8 L220.1,61.8 L225.1,67.3 + L230.1,74.2 L235.1,82.6 L240.1,92.2 L245.1,103.2 L250.1,115.5 L255.1,129.1 L260.1,143.8 L265.1,159.6 + L270.1,176.5 L275.1,194.4 L280.1,213.2 L285.1,232.8 L290.1,253.2 L295.1,274.3 L300.1,295.9 L305.1,318.1 + L310.1,340.7 L315.1,363.7 L320.1,386.8 L325.1,410.1 L327.7,422.4 '/></g> + </g> +<g fill="none" color="white" stroke="rgb(148, 0, 211)" stroke-width="2.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="2.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +<g fill="none" color="black" stroke="black" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M80.2,54.1 L80.2,422.4 L575.0,422.4 L575.0,54.1 L80.2,54.1 Z '/></g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +</g> +</svg> + diff --git a/doc/context/presentations/context/2020/context-2020-implementers.pdf b/doc/context/presentations/context/2020/context-2020-implementers.pdf Binary files differnew file mode 100644 index 000000000..94c515138 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-implementers.pdf diff --git a/doc/context/presentations/context/2020/context-2020-implementers.tex b/doc/context/presentations/context/2020/context-2020-implementers.tex new file mode 100644 index 000000000..e1104dabf --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-implementers.tex @@ -0,0 +1,380 @@ +% language=us + +% \enabletrackers[context*] + +\usemodule[present-boring,abbreviations-logos] + +\startdocument + [title={IMPLEMENTERS}, + banner={an old feature still evolving}, + location={context\enspace {\bf 2020}\enspace meeting}] + +\starttitle[title=Interfacing with \LUA] + +\startitemize + +\startitem + Quite some activity is delegated to \LUA. +\stopitem +\startitem + Normally the initiative is at the \TEX\ end. +\stopitem +\startitem + We can set variables or call functions etc. +\stopitem +\startitem + We can parameters to function calls. +\stopitem +\startitem + From the \LUA\ end we can use scanners to pick up data. +\stopitem +\startitem + We provide some consistent interfaces for doing all that. +\stopitem +\startitem + From \TEX\ to \LUA\ we use \type {\ctxlua{...}} and friends. +\stopitem +\startitem + From \LUA\ to \TEX\ we use \type {context(...)} and alike. +\stopitem +\startitem + For adding functionality we use so called implementers. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=Calling \LUA] + +\startbuffer +\ctxlua{context("ok")} +\stopbuffer + +\typebuffer \getbuffer + +\startbuffer +\ctxlua{context(2 * tokens.scanners.integer())} 10 +\stopbuffer + +\typebuffer \getbuffer + +\startbuffer +\startluacode +function document.MyThing() context(2 * tokens.scanners.integer()) end +\stopluacode +\stopbuffer + +\typebuffer \getbuffer + +\startbuffer +\ctxlua{document.MyThing()} 20 \quad +\ctxlua{document.MyThing()} 30 \quad +\ctxlua{document.MyThing()} 40 +\stopbuffer + +\typebuffer \getbuffer + +\stoptitle + +\starttitle[title=Streamlining \LUA] + +\startbuffer +\startluacode +interfaces.implement { + name = "MyThing", + public = true, + arguments = "integer", + actions = function(i) context(i * 2) end, + -- actions = { function(i) return i * 2 end, context }, +} +\stopluacode +\stopbuffer + +\typebuffer \getbuffer + +\startbuffer +\MyThing 20 \quad \MyThing 30 \quad \MyThing 40 +\stopbuffer + +\typebuffer \getbuffer + +\stoptitle + +\starttitle[title=Making commands] + +\startbuffer +\startluacode +interfaces.implement { + name = "MyRoot", + public = true, + actions = function() + local a = tokens.scanners.integer() + if not tokens.scanners.keyword("of") then + -- tex.error("the keyword 'of' expected") + end + local b = tokens.scanners.integer() + context("%0.6N",math.sqrt(b,a)) + end, +} +\stopluacode +\stopbuffer + +\typebuffer \getbuffer + +\startbuffer +\MyRoot 2 of 40 \quad \MyRoot 3 60 +\stopbuffer + +\typebuffer \getbuffer + +\stoptitle + +\starttitle[title=Scanners] + +There are lots of scanners: \blank + +\startalign[flushleft,broad] \tttf + \cldcontext { table.concat ( table.sortedkeys (tokens.scanners), " " ) } +\stopalign + +\stoptitle + +\starttitle[title=A more complex example] + +Let's implement a matcher: \blank + +\startbuffer +\doloopovermatch {(.)} {luametatex} { [#1] } +\stopbuffer + +\typebuffer \getbuffer + +\startbuffer +\doloopovermatch {([\letterpercent w]+)} {\cldloadfile{tufte.tex}} { [#1] } +\stopbuffer + +\typebuffer \getbuffer + +\stoptitle + +\starttitle[title=A more complex example (\TEX)] + +Here is the macro definition of this loop: \blank + +\starttyping +\protected\def\doloopovermatch#1#2#3% + {\pushmacro\matchloopcommand + \def\matchloopcommand##1##2##3##4##5##6##7##8##9{#3}% + \ctxluamatch\matchloopcommand{#1}{#2}% + \popmacro\matchloopcommand} +\stoptyping + +\startitemize + +\startitem The pushing and popping makes it possible to nest this macro. \stopitem +\startitem The definition of the internal match macro permits argument references. \stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=A more complex example (\LUA)] + +At the \LUA\ end we use an implementer: \blank + +\starttyping[style=\small\tt] +local escape = function(s) return "\\" .. string.byte(s) end + +interfaces.implement { + name = "ctxluamatch", + public = true, + usage = "value", + actions = function() + local command = context[tokens.scanners.csname()] + local pattern = string.gsub(tokens.scanners.string(),"\\.",escape) + local input = string.gsub(tokens.scanners.string(),"\\.",escape) + for a, b, c, d, e, f, g, h, i in string.gmatch(input,pattern) do + command(a, b or "", c or "", d or "", e or "", f or "", g or "", + h or "", i or "") + end + return tokens.values.none + end, +} +\stoptyping + +So what does the \type {usage} key tells the implementer? + +\stoptitle + +\starttitle[title=Value functions] + +Normally we pipe back verbose strings that are interpreted as if they were +files. Value functions are different; + +\startitemize + +\startitem + The return value indicates what gets fed back in the input. +\stopitem +\startitem + This can be: \cldcontext { table.concat(token.getfunctionvalues(), ", ", 0) }. +\stopitem +\startitem + When possible an efficient token is injected. +\stopitem +\startitem + Value function can check if they are supposed to feed back a value. +\stopitem +\startitem + So, they can be used as setters and getters. +\stopitem +\startitem + A variant is a function that is seen as conditional. +\stopitem +\startitem + In (simple) tracing they are presented as primitives. +\stopitem +\startitem + They are protected against user overload (aka: frozen). +\stopitem +\startitem + All this is experimental and might evolve. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=So, let's step up a level] + +Say that we want an expandable command: + +\startbuffer +\edef\foo{\doloopovermatched{.}{123}{(#1)}} \meaning\foo +\stopbuffer + +\typebuffer \blank \getbuffer \blank + +Or nested: + +\startbuffer +\edef\foo {% + \doloopovermatched {(..)} {123456} {% + \doloopovermatched {(.)(.)} {#1} {% + [##1][##2]% + }% + }% +} \meaning\foo +\stopbuffer + +\typebuffer \blank \getbuffer \blank + +\stoptitle + +\starttitle[title=So, let's step up a level] + +Compare: + +\starttyping[style=\small\tt] +\protected\def\doloopovermatch#1#2#3% + {\pushmacro\matchloopcommand + \def\matchloopcommand##1##2##3##4##5##6##7##8##9{#3}% + \ctxluamatch\matchloopcommand{#1}{#2}% + \popmacro\matchloopcommand} +\stoptyping + +With: + +\starttyping[style=\small\tt] +\def\doloopovermatched#1#2#3% + {\beginlocalcontrol + \pushmacro\matchloopcommand + \def\matchloopcommand##1##2##3##4##5##6##7##8##9{#3}% + \endlocalcontrol + \the\ctxluamatch\matchloopcommand{#1}{#2}% + \beginlocalcontrol + \popmacro\matchloopcommand + \endlocalcontrol} +\stoptyping + +Local control hides the assignments (it basically nests the mail loop). + +\stoptitle + +\starttitle[title=A few teasers (\TEX)] + +\starttyping[style=\small\tt] +\doloopovermatch {(\letterpercent d+)} {this 1 is 22 a 333 test} { [#1] } + +\doloopovermatch {(\letterpercent w+) *(\letterpercent w*)} {aa bb cc dd} { + [ + \doloopovermatch{(\letterpercent w)(\letterpercent w)} {#1} {(##1 ##2)} + \doloopovermatch{(\letterpercent w)(\letterpercent w)} {#2} {(##1 ##2)} + ] +} + +\doloopovermatch + {(.-)\letterpercent{\bf (.-)\letterpercent}(.*)} + {this is {\bf a} test} + {#1{\it not #2}#3} +\stoptyping + +\stoptitle + +\starttitle[title=A few teasers (\LUA)] + +\starttyping[style=\small\tt] +interfaces.implement { + name = "bitwisexor", public = true, usage = "value", actions = + function(what) + local a = tokens.scanners.cardinal() + scankeyword("with") + local b = tokens.scanners.cardinal() + if what == "value" then + return tokens.values.cardinal, a ~ b + else + logs.texerrormessage("you can't use \\bitwiseor this way") + end + end +} +interfaces.implement { + name = "ifbitwiseand", public = true, usage = "condition", actions = + function(what) + local a = tokens.scanners.cardinal() + local b = tokens.scanners.cardinal() + return tokens.values.boolean, (a & b) ~= 0 + end +} +\stoptyping + +\stoptitle + +\starttitle[title=Questions and more examples] + +More examples will be given in the editor. + +\stoptitle + +\stopdocument + +% \doloopovermatch {(\letterpercent w+) *(\letterpercent w*)} {aa bb cc dd} { +% [ +% \doloopovermatch{(\letterpercent w)(\letterpercent w)} {#1} {(##1 ##2)} +% \doloopovermatch{(\letterpercent w)(\letterpercent w)} {#2} {(##1 ##2)} +% ] +% } + +% \doloopovermatch {(\letterpercent d+)} {this 1 is 22 a 333 test} { [#1] } + +% \testfeatureonce{10000}{\doloopovermatch {(\letterpercent d+)} {this 1 is 22 a 333 test} {}} \elapsedtime + +% \doloopovermatch +% {(.-)\letterpercent{\bf (.-)\letterpercent}(.*)} +% {this is {\bf a} test} +% {#1{\it not #2}#3} + +% \doloopovermatch {([\letterpercent w]+)} {\cldloadfile{tufte.tex}} { [#1] } + +% \testfeatureonce{100}{\doloopovermatch {([\letterpercent w]+)}{\cldloadfile{tufte.tex}} {}} \elapsedtime + diff --git a/doc/context/presentations/context/2020/context-2020-luametatex.pdf b/doc/context/presentations/context/2020/context-2020-luametatex.pdf Binary files differnew file mode 100644 index 000000000..fcb906f8b --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-luametatex.pdf diff --git a/doc/context/presentations/context/2020/context-2020-luametatex.tex b/doc/context/presentations/context/2020/context-2020-luametatex.tex new file mode 100644 index 000000000..10b57660e --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-luametatex.tex @@ -0,0 +1,529 @@ +% language=us + +\usemodule[present-boring,abbreviations-logos] + +\startdocument + [title={LUAMETATEX}, + banner={where do we stand}, + location={context\enspace {\bf 2020}\enspace meeting}] + +\starttitle[title=When it started] + +\startitemize + +\startitem + About three years ago the idea came up to go this route. +\stopitem +\startitem + At the 2018 meeting it was first mentioned and those present were okay with + it. +\stopitem +\startitem + Early 2019 the first beta release took place. +\stopitem +\startitem + At the 2019 meeting the first more official version was presented. +\stopitem +\startitem + Around the 2020 meeting we have more or less arrived at what I had in mind. +\stopitem +\startitem + At the 2021 meeting I expect the code to be stable and repositories to be set + up. +\stopitem +\startitem + At the 2022 meeting we can make the official transition from \MKIV\ to \LMTX. +\stopitem +\startitem + Some new options are only enabled in my local \type {cont-exp.tex} file. +\stopitem +\startitem + Knowing that Wolfgang keeps an eye on all those changes makes me more daring. +\stopitem +\startitem + We aim to get less (but more efficient) macro code that on the average looks + better. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=Why it started] + +\startitemize + +\startitem + There was an increasing pressure for a stable \LUATEX. +\stopitem +\startitem + There should be no more changes to the interfaces, no more extensions. +\stopitem +\startitem + One can run into interesting comments on the web (as usual), like + \startitemize[packed] + \startitem The \LUATEX\ program has \quote {many bugs}. \stopitem + \startitem The \LUATEX\ manual is bad. \stopitem + \startitem The \LUATEX\ program is too slow to be useful. \stopitem + \startitem The \LUATEX\ program will never end up in distributions. \stopitem + \startitem The \LUATEX\ project is funded and developed in a commercial setting. \stopitem + \stopitemize +\stopitem +\startitem + I won't comment on how I read these (demotivating) comments because \unknown +\stopitem +\startitem + \unknown\ it anyway often says more about the writer (attitudes) than about + \LUATEX. +\stopitem +\startitem + I also looks like (non \CONTEXT) users are charmed by \LUATEX, and the more + they code, the more we need to freeze. +\stopitem +\startitem + So, hopefully, the \LUAMETATEX\ development does not interfere badly with + developments outside the \CONTEXT\ community. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=The development] + +The summary on the next pages is partial. More can be found in articles and +documents that come with the distribution. + +\startitemize + +\startitem + \LUATEX\ started out as \CWEB\ code \unknown\ that eventually became just + \CCODE\ \unknown\ which in \LUAMETATEX\ has been detached from the (complex) + infrastructure. +\stopitem +\startitem + The basic idea is to only keep the core of \TEX, but for instance font + loading, file handling and the backend are gone. +\stopitem +\startitem + As a consequence the code has been reorganized (shuffled around). +\stopitem +\startitem + I experimented a lot without bothering about usage elsewhere and I like the + result so far. +\stopitem +\startitem + The \CONTEXT\ distribution will at some point ship with the source. +\stopitem + +\stopitemize + +\starttitle[title=File handling] + +\startitemize + +\startitem + All file handling goes via \LUA, also read and write related primitives. +\stopitem +\startitem + The same is true for terminal (console) handling. +\stopitem +\startitem + Part of that (the writing) was actually kind of extension code in \TEX\ and + partly a system dependency. +\stopitem +\startitem + The \ETEX\ pseudo file \type {\scantokens} primitive uses the same mechanism + as \LUA\ does. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=The macro machinery] + +\startitemize + +\startitem + There are extensions to the way macro arguments are handled (less clumsy + macros). +\stopitem +\startitem + There are extra if tests (makes for nicer macros). +\stopitem +\startitem + Else branches in conditions can be collapsed using \type {\orelse} and \type + {\orunless} which gives cleaner low level code. +\stopitem +\startitem + Tracing gives more detail about node properties and also shows attributes. +\stopitem +\startitem + Some new data carriers have been added that can be played with from \LUA . +\stopitem +\startitem + Macros can efficiently be frozen (new) and protected (redone) and the + concepts \quote {long} and \type {outer} are gone. \footnote {In \CONTEXT\ + macros were always \type {\long} and never \type {\outer}. Most commands were + unexpandable (also in \MKII, pre \ETEX). So, users won't notice this.} +\stopitem +\startitem + Saving and restoring is somewhat more efficient (partly a side effect of + wider memory). +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=Language] + +\startitemize + +\startitem + Language control settings now use less parameters but bit sets instead. +\stopitem +\startitem + Only basic parameters are stored in the format file now. +\stopitem +\startitem + There are all kind of small improvements. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=Typesetting] + +\startitemize + +\startitem + Attributes (the lists and states) are implemented more efficiently. +\stopitem +\startitem + The paragraph state is stored with the paragraph. +\stopitem +\startitem + Paragraphs can be normalized and options are now set with bit sets. +\stopitem +\startitem + Boxes carry orientation related information (offsets, rotation, etc). +\stopitem +\startitem + Some nodes carry more information. +\stopitem +\startitem + Directions are mostly gone (it's up to the backend). +\stopitem +\startitem + Migrated content is optionally kept with boxes. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=Math] + +\startitemize + +\startitem + Some math concepts have been extended (like prescripts and some more + control over styles). +\stopitem +\startitem + There are plenty of new control details. +\stopitem +\startitem + The math parameter settings obey grouping in a math list. +\stopitem +\startitem + We can have math in discretionaries in text and more advanced discretionaries + in math as well. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=Fonts] + +\startitemize + +\startitem + Font specification information no longer uses the string pool (which saves a + lot). +\stopitem +\startitem + Of course we still have the basic font handler. +\stopitem +\startitem + We only store what is needed for traditional \TEX\ font handling. +\stopitem +\startitem + Virtual fonts are even more virtual (also a backend thing) so we can have + more features. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=The code] + +\startitemize + +\startitem + Artifacts from \PASCAL\ and \CWEB\ have been removed. +\stopitem +\startitem + Languages, fonts, marks etc are no longer \quote {register} based. +\stopitem +\startitem + The token interface is more abstract and no longer presents strange numbers. +\stopitem +\startitem + Some internals have been reconstructed because of cleaner \LUA\ interfacing. +\stopitem +\startitem + A side effect of this is better abstraction of the equivalent ranges. +\stopitem +\startitem + The code has been made more abstract (and looks easier in e.g. Visual Studio). +\stopitem +\startitem + The compile farm is used to check if compilation works out of the box. +\stopitem +\startitem + Compilation is fast and easy, otherwise this project was not possible. +\stopitem +\startitem + Readability of the code is constantly improved (the usual: has to look okay + in my editor). +\stopitem +\startitem + The code has been made mostly independent of specific operating system needs. +\stopitem +\startitem + Wide characters are dealt with in Windows interfaces. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=Libraries] + +\startitemize + +\startitem + We really want to stay lean and mean: the engine is also a \LUA\ engine. +\stopitem +\startitem + All code is included, a few libraries are used, but these are small, old and + stable. +\stopitem +\startitem + In addition some helper libraries are made (including pplib by Pawel). +\stopitem +\startitem + What we ship is what you get: \CONTEXT\ will not depend on more than that. +\stopitem +\startitem + If something is updated (at all) the differences are checked first. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=The \LUA\ engine] + +\startitemize + +\startitem + We use the latest (even alpha) \LUA\ (5.4) because \LUAMETATEX\ is a good + test. +\stopitem +\startitem + There is no support for \LUAJIT\ and the \FFI\ interface is gone. +\stopitem +\startitem + There is a limited set of libraries that we support but no code is (and will + be) included. +\stopitem +\startitem + There are less callbacks (because we only have a frontend). +\stopitem +\startitem + There are more token scanners and some options have been added. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=Efficiency] + +\startitemize + +\startitem + We benefit some more from the wider memory words (some constructs could go). +\stopitem +\startitem + The format file is smaller and not longer compressed. +\stopitem +\startitem + Memory management is now mostly dynamic and usage is much lower. +\stopitem +\startitem + There are more statistics (also as side effect of memory management). +\stopitem +\startitem + Dumping the format has been made a bit more robust and is faster. +\stopitem +\startitem + The core engine performs a bit better (machines don't get that much faster). +\stopitem +\startitem + We want to be prepared for future architectures. +\stopitem +\startitem + We manage to keep the binary way below 3 MB. +\stopitem +\startitem + The lot runs quite well on e.g.\ a Raspberry Pi 4. +\stopitem + +\stopitemize + +\starttitle[title=Upgraded \METAPOST] + +\startitemize + +\startitem + All (eight bit) font stuff has been stripped from the \METAPOST\ library. +\stopitem +\startitem + The library no longer has a \POSTSCRIPT\ backend. +\stopitem +\startitem + The library provides scanners that make extensions possible. +\stopitem +\startitem + All file \IO\ goes via \LUA. +\stopitem +\startitem + There are a few additions like pre|/|postscripts for clip and bounding boxes. +\stopitem +\stopitemize + +\stoptitle + +\starttitle[title=Praise for the users] + +\startitemize + +\startitem + Much has been done and I probably forget to mention a lot. +\stopitem +\startitem + The number of bugs is relative small compared to what gets changed and added. +\stopitem +\startitem + The test suite gets ran very often, also to check if performance is okay. +\stopitem +\startitem + I could only do this because the \CONTEXT\ users are so tolerant. +\stopitem +\startitem + Some seem to constantly check for updates so they help with fast testing. +\stopitem +\startitem + The \CONTEXT\ code base gets stepwise adapted (split files) which again + forces users to test. +\stopitem +\startitem + It takes a lot of time because we take small steps in order not to mess up. +\stopitem +\startitem + I would not do it without the positive attribute of the \CONTEXT\ users. +\stopitem +\startitem + It's all about motivation and I thank the \CONTEXT\ users for providing this + friendly and non|-|competitive bubble! +\stopitem + +\stopitemize + +\starttitle[title=Todo] + +\startitemize + +\startitem + Maybe add some more sanity checks in order to catch errors intruded by + callbacks. Maybe add some more tracing too. +\stopitem +\startitem + Explore variants, like having registers in dedicated eqtb tables so that we + can allocate them dynamically (mostly for the fun of doing it). +\stopitem +\startitem + Add some more documentation (read: addition cq.\ remarks about where the + original documentation no longer applies, but we have years for doing that). +\stopitem +\startitem + Update the manual (which is done occasionally in batch based on print|-|outs; + there is no real need to hurry because we still experiment). +\stopitem +\startitem + Apply some of the new stuff in \LMTX. Take up some challenges. +\stopitem +\startitem + Wrap up new functionality (once it's stable) in articles and other documents. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=And \LUATEX ?] + +\startitemize + +\startitem + Of course \LUATEX\ will be maintained! After all, \MKIV\ needs it and it + serves as reference for the front|-|end rendering and back|-|end generation + when we're messing with \LUAMETATEX. +\stopitem +\startitem + It is used by \LATEX\ and there are now also plain inspired packages. Because + there are spin|-|offs (\LATEX\ has settled on a version with built|-|in font + processing) we cannot change much. +\stopitem +\startitem + And \LUATEX\ being nicely integrated into \TEXLIVE\ is another argument for + not touching it too much. +\stopitem +\startitem + I have no clue of \LUATEX\ usage but that fact alone already makes an + argument for being even more careful. It's bad advertisement for \TEX\ when + users who use the low level interfaces get confronted with conceptual + changes. +\stopitem +\startitem + So in the end not much will be back ported to \LUATEX: at some point the code + base became too different and it's the price paid for the stability demand. + That way we cannot introduce new bugs either. It also doesn't pay of. +\stopitem +\startitem + But, a few non|-|intrusive things might actually trickle into it in due time, + also out of self interest: it might help to share code between \MKIV\ and + \LMTX. +\stopitem + +\stopitemize + +\stopdocument diff --git a/doc/context/presentations/context/2020/context-2020-mkii-mkiv-mkxl.pdf b/doc/context/presentations/context/2020/context-2020-mkii-mkiv-mkxl.pdf Binary files differnew file mode 100644 index 000000000..1932da394 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-mkii-mkiv-mkxl.pdf diff --git a/doc/context/presentations/context/2020/context-2020-mkii-mkiv-mkxl.tex b/doc/context/presentations/context/2020/context-2020-mkii-mkiv-mkxl.tex new file mode 100644 index 000000000..a0e119e75 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-mkii-mkiv-mkxl.tex @@ -0,0 +1,208 @@ +% language=us + +\usemodule[present-boring,abbreviations-logos] + +\startdocument + [title={MKII MKIV LMTX}, + banner={where does it end}, + location={context\enspace {\bf 2020}\enspace meeting}] + +\starttitle[title=Welcome] + +This meeting was kind of special because of the Covid situations. It forces us to +adapt and think about how to deal with this kind of situations. But, we had a +very nice meeting as usual. The first talk was a summary of where we started and +where we are now. The other talks are more specialized. + +All presentations use the same simple style. No interaction, no fancy \PDF\ +features, also because we had to stream them. + +\stoptitle + +\starttitle[title=MKII] + +\startitemize +\startitem + In the 80's I bought the \TEX book but it all stayed pretty abstract. +\stopitem +\startitem + In the beginning of the 90's we had to get some math on paper we bought (!) a + copy of \LATEX. +\stopitem +\startitem + Right from the start we had to make in look a bit better than out of the box. +\stopitem +\startitem + So a shell around if evolved but soon we started from scratch. +\stopitem +\startitem + We did so first on top \LAMSTEX, then we switched to \INRSTEX. +\stopitem +\startitem + Soon we only used a few components of that: we learned from trial and error. +\stopitem +\startitem + We joined the \NTG, met Taco and friends, and slowly got some presence. +\stopitem +\startitem + And it all went on till we had what we later called \MKII. +\stopitem +\startitem + But, we always had ideas about what more we wanted. +\stopitem +\startitem + We went from \TEX\ to \ETEX\ to \PDFTEX\ to \PDFETEX. +\stopitem +\startitem + We played with the idea of \type {eetex}, different backends etc.\ (show old + \MAPS\ article). +\stopitem +\stopitemize + +\stoptitle + +\starttitle[title=MK{\thinspace\periods[2]}] + +\startitemize +\startitem + \CONTEXT\ has been keyword driven and class based from the start. +\stopitem +\startitem + This came with a performance hit so the reputation was that it was slow: + inheritance, flexibility, user control \unknown\ it all comes at a price. +\stopitem +\startitem + \CONTEXT\ always had an abstract driver model (\DVIPS, \DVIPSONE, \DVIWINDO, + \ACROBAT, \PDFTEX, etc). +\stopitem +\startitem + It also had an adaptive the front end so we could support successive engines: + \TEX, \ETEX, \PDFTEX, \ALEPH, \XETEX. +\stopitem +\startitem + There had to be color and graphics support from the beginning. +\stopitem +\startitem + The interfaces permitted extension without breaking compatibility. The user + interface was multilingual: we started with Dutch and German (users). +\stopitem +\startitem + It came with management tools (like \TEXEXEC, \TEXUTIL, \TEXFONT, \TEXMFSTART) etc.\ + for job control, dealing with (user) fonts, image manipulations etc. +\stopitem +\startitem + And of course \METAPOST, \XML, combining font setups, mixing encodings, \UTF\ + patterns evolved with the system. +\stopitem +\startitem + Educational usage was often the reason for new features. +\stopitem +\stopitemize + +\stoptitle + +\starttitle[title=MKIV] + +\startitemize +\startitem + At some point we started playing with \LUA\ (in \SCITE). +\stopitem +\startitem + And then with Hartmut started adding some basic \LUA\ support to a clone of + \PDFTEX\ that soon became \LUATEX. +\stopitem +\startitem + Next the Oriental \TEX\ project provided means for Taco to transition to + \CCODE . +\stopitem +\startitem + And for years we slowly built up the system. A \LUAJITTEX\ version showed up + and Luigi took over integration in \TEXLIVE\ (like compilation within the + infrastructure and updating libraries). +\stopitem +\startitem + In parallel we tested features and explored what we needed with \CONTEXT: + \MKIV\ evolved. +\stopitem +\startitem + And \unknown\ soon, all further development happened in \MKIV\ only: \MKII\ + became frozen. +\stopitem +\startitem + The interface subsystem was upgraded and Wolfgang checked and completed all + setups while we did. Obsolete (font, language, input) mechanisms were + removed. +\stopitem +\startitem + A lot happened: some more \TEX, lots of \LUA, better \METAPOST\ integration, + more advanced \XML. +\stopitem +\startitem + To some extend a project like that became to late because the glory days of + \TEX\ were already past (publishing changed) but just as with \PDFTEX\ a + conceptual upgrade like was felt needed. +\stopitem +\stopitemize + +\stoptitle + +\starttitle[title=MKXL (aka LMTX)] + +\startitemize +\startitem + When \LUATEX\ had to be frozen a follow up took place in \LUAMETATEX. The name + reflects the importance of each core component. +\stopitem +\startitem + The idea is to have an lean and mean engine, one that will become very stable + and does not depend on the issues of the day. +\stopitem +\startitem + It's for all those dedicated users who like quality and playing around but + also want guarantees that the tools keeps working years from now: it's about + independence. +\stopitem +\startitem + Of course we tested and explored with \CONTEXT\ and this time \LMTX\ evolves. + Here the \type {X} reflects that we consider \XML\ to be part of the picture. +\stopitem +\startitem + Although there will be (and already is) new functionality the change is less + dramatic because this we don't have the change in fonts, encoding and regime + subsystems (which made some \MKII\ commands go away). +\stopitem +\startitem + Hopefully some of the more tricky (hard to do in good old \TEX) mechanisms + can be improved now. +\stopitem +\startitem + And at some point we will freeze \MKIV\ and development will happen in \LMTX\ + only. +\stopitem +\stopitemize + +\stoptitle + +\starttitle[title=This meeting] + +\startitemize +\startitem + My talks in this meeting are mostly about \LUAMETATEX\ and the \CONTEXT\ + version \LMTX\ that targets it: how it is done, which concepts show up, where + we want to go. +\stopitem +\startitem + Unless you kept a close eye on last years development, you will encounter of + plenty of new features that relate to \LUAMETATEX. So, there is more to tell, + but most of that is already known from previous meetings. +\stopitem +\startitem + And, as usual, a \CONTEXT\ meeting is not only a deadline, but also a + starting point. It's you who keep it all going. And, even more than that, + it is about us meeting. +\stopitem +\stopitemize + +\stoptitle + +\stopdocument diff --git a/doc/context/presentations/context/2020/context-2020-mp.pdf b/doc/context/presentations/context/2020/context-2020-mp.pdf Binary files differnew file mode 100644 index 000000000..a86dc2d71 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-mp.pdf diff --git a/doc/context/presentations/context/2020/context-2020-mp.tex b/doc/context/presentations/context/2020/context-2020-mp.tex new file mode 100644 index 000000000..6d2f640fb --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-mp.tex @@ -0,0 +1,342 @@ +% language=us + +\usemodule[present-boring,abbreviations-logos] + +\startdocument + [title={METAFUN}, + banner={simple fonts}, + location={context\enspace {\bf 2020}\enspace meeting}] + +\starttitle[title=Metafonts] + +\startitemize + +\startitem + Because \METAPOST\ is based on \METAFONT\ it make sense to use of for making fonts. +\stopitem + +\startitem + Making a font is an art in itself, something that is actually proven by many bad + looking fonts, but we have plenty of choice nowadays. +\stopitem + +\startitem + We tend to use free fonts and often being made by volunteers we can hardly have any + demands. +\stopitem + +\startitem + So, instead of complaining (which is not nice anyway) we can try to (at least temporary) + come up with a solution ourselves. +\stopitem + +\startitem + We're actually talking about missing glyphs here and \METAPOST\ can be of help. +\stopitem + +\startitem + Also keep in mind that we always had this option or variants of it in \CONTEXT, it's + just that we can make nicer interfaces now. +\stopitem + +\startitem + So, don't expect something spectacular. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=What is is not] + +Years ago mechanisms were added to \MKIV\ to come up with more fancy shapes in +for instance math. Actually Alan needed it and I wanted a root symbol to look +like school times. + +\startbuffer +\useMPlibrary[mat] + +\setupmathradical[color=darkgray,alternative=mp] + +% \definemathradical [sqrt] [mp=minifun::math:radical:default] +\stopbuffer + +\typebuffer \getbuffer + +So: + +\startbuffer +\scale[height=2cm]{$ \sqrt {a+b+c+d} $} +\stopbuffer + +\typebuffer + +Gives: + +\startlinecorrection +\getbuffer +\stoplinecorrection + +\page + +And with: + +\startbuffer +\startuniqueMPgraphic{minifun::math:radical:default} +draw + math_radical_simple(OverlayWidth,OverlayHeight,OverlayDepth,OverlayOffset) + withpen pencircle + xscaled (2OverlayLineWidth) + yscaled (1OverlayLineWidth/4) + rotated 30 + dashed evenly + withcolor OverlayLineColor ; +\stopuniqueMPgraphic +\stopbuffer + +\typebuffer + +We get + +\startlinecorrection +\getbuffer +\scale[height=2cm]{$ \sqrt {a+b+c+d} $} +\stoplinecorrection + +\page + +Also think of stackers: + +\startbuffer +\setupmathstackers [both] [color=darkgray,alternative=mp] +\setupmathstackers [top] [color=darkgray,alternative=mp] +\setupmathstackers [bottom] [color=darkgray,alternative=mp] +\stopbuffer + +\typebuffer \getbuffer + +\blank[2*line] + +\startbuffer +$ + \overbracket {a+b+c+d} \quad + \underbracket {a+b+c+d} \quad + \doublebracket {a+b+c+d} +$ +\blank +$ + \overparent {a+b+c+d} \quad + \underparent {a+b+c+d} \quad + \doubleparent {a+b+c+d} +$ +\blank +$ + \overbrace {a+b+c+d} \quad + \underbrace {a+b+c+d} \quad + \doublebrace {a+b+c+d} +$ +\blank +$ + \overbar {a+b+c+d} \quad + \underbar {a+b+c+d} \quad + \doublebar {a+b+c+d} +$ +\blank +$ + \overleftarrow {a+b+c+d} \quad + \overrightarrow {a+b+c+d} +$ +\blank +$ + \underleftarrow {a+b+c+d} \quad + \underrightarrow {a+b+c+d} +$ +\stopbuffer + +\getbuffer + +\blank[2*line] + +But, these are just overlays and nothing special: we simply don't use the normal +font route not fancy \LUA\ tricks either (in principle \MKII\ could do this). I +might upgrade it some day (no real demand so far, just fun stuff). + +\stoptitle + +\starttitle[title=Real fonts] + +\startitemize + +\startitem For text we need an efficient way to define extra shapes. \stopitem +\startitem We don't really want inline graphics every time we use a glyph. \stopitem +\startitem We also want to cut and paste properly. \stopitem +\startitem Basically the fact that we drop in shapes should be hidden. \stopitem + +\blank[2*line] + +\startitem + We use the same (generic) subsystem that is also used for color fonts, bitmap + emoji, \SVG\ fonts, etc. +\stopitem +\startitem + Shapes end up as \TYPETHREE\ fonts. These have some specific properties and + limitations, but we can actually make \UNICODE\ fonts. +\stopitem +\startitem + The system is not burdened by much overhead and most happens at embedding time. +\stopitem + +\stopitemize + +\page + +\startbuffer[font] +\definefont[DemoFontA][Serif*default @ 10pt] +\definefont[DemoFontB][Serif*default @ 12pt] +\definefont[DemoFontC][Serif*default @ 14pt] +\definefont[DemoFontD][SerifBold*default @ 14pt] +\stopbuffer + +\typebuffer[font] \getbuffer[font] + +\startbuffer[demo] +\startlines +\DemoFontA first\endash second\emdash third\char"2015\relax fourth +\DemoFontB first\endash second\emdash third\char"2015\relax fourth +\DemoFontC first\endash second\emdash third\char"2015\relax fourth +\DemoFontD first\endash second\emdash third\char"2015\relax fourth +\stoplines +\stopbuffer + +\typebuffer[demo] \getbuffer[demo] + +\page + +\startbuffer[mpone] +\startMPcalculation{simplefun} + + vardef QuotationDashOne = + draw image ( + interim linecap := squared ; + save l ; l := 0.2 ; + draw (l/2,3) -- (10-l/2,3) withpen pencircle scaled l ; + ) + enddef ; + + lmt_registerglyphs [ + name = "symbolsone", + units = 10, + usecolor = true, + width = 10, + height = 3.1, + depth = 0, + ] ; + + lmt_registerglyph [ + category = "symbolsone", + unicode = "0x2015", + code = "QuotationDashOne ;" + ] ; + +\stopMPcalculation +\stopbuffer + +\getbuffer[mpone] + +\startbuffer[font] +\definefontfeature[exampleone][metapost=symbolsone] + +\definefont[DemoFontA][Serif*default,exampleone @ 10pt] +\definefont[DemoFontB][Serif*default,exampleone @ 12pt] +\definefont[DemoFontC][Serif*default,exampleone @ 14pt] +\definefont[DemoFontD][SerifBold*default,exampleone @ 14pt] +\stopbuffer + +\typebuffer[font] \getbuffer[font] + +\getbuffer[demo] + +\page + +\typebuffer[mpone][style=\tt\small\small] + +\page + +\startbuffer[mptwo] +\startMPcalculation{simplefun} + + vardef QuotationDashTwo = + draw image ( + interim linecap := squared ; + save l ; l := 0.4 ; + string weight ; weight := getparameter "mpsfont" "parentdata" "shared" "rawdata" "metadata" "weight" ; + if weight = "semibold" : l := l * 2; + elseif weight = "bold" : l := l * 3; fi + draw (l/2,3) -- (10-l/2,3) withpen pencircle scaled l + withcolor yellow ; + ) + enddef ; + + lmt_registerglyphs [ + name = "symbolstwo", + units = 10, + usecolor = false, + width = 10, + height = 3.1, + depth = 0, + ] ; + + lmt_registerglyph [ + category = "symbolstwo", + unicode = "0x2015", + code = "QuotationDashTwo ;" + ] ; + +\stopMPcalculation +\stopbuffer + +\getbuffer[mptwo] + +\startbuffer[font] +\definefontfeature[exampletwo][metapost=symbolstwo] + +\definefont[DemoFontA][Serif*default,exampletwo @ 10pt] +\definefont[DemoFontB][Serif*default,exampletwo @ 12pt] +\definefont[DemoFontC][Serif*default,exampletwo @ 14pt] +\definefont[DemoFontD][SerifBold*default,exampletwo @ 14pt] +\stopbuffer + +\typebuffer[font] \getbuffer[font] + +\getbuffer[demo] + +\page + +\typebuffer[mptwo][style=\tt\small\small] + +\stoptitle + +\starttitle[title=More examples] + +We give some examples (these are also in the modules). Overloading math +symbols: + +\starttyping +meta-imp-kindergarten.mkxl +\stoptyping + +Extending fonts with Don Knuths dices and tiles (symbols, ligatures, proper +\UNICODE): + +\starttyping +meta-imp-gamesymbols.mkxl +\stoptyping + +An implementation of Don Knuths ThirtySix font in various variants (color, +random, shapes): + +\starttyping +meta-imp-threesix.mkxl +\stoptyping + +\stopdocument diff --git a/doc/context/presentations/context/2020/context-2020-sin.svg b/doc/context/presentations/context/2020/context-2020-sin.svg new file mode 100644 index 000000000..2d1f84438 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-sin.svg @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="windows-1252" standalone="no"?> +<svg + width="600" height="480" + viewBox="0 0 600 480" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" +> + +<title>Gnuplot</title> +<desc>Produced by GNUPLOT 5.2 patchlevel 8 </desc> + +<g id="gnuplot_canvas"> + +<rect x="0" y="0" width="600" height="480" fill="none"/> +<defs> + + <circle id='gpDot' r='0.5' stroke-width='0.5' stroke='currentColor'/> + <path id='gpPt0' stroke-width='0.222' stroke='currentColor' d='M-1,0 h2 M0,-1 v2'/> + <path id='gpPt1' stroke-width='0.222' stroke='currentColor' d='M-1,-1 L1,1 M1,-1 L-1,1'/> + <path id='gpPt2' stroke-width='0.222' stroke='currentColor' d='M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1'/> + <rect id='gpPt3' stroke-width='0.222' stroke='currentColor' x='-1' y='-1' width='2' height='2'/> + <rect id='gpPt4' stroke-width='0.222' stroke='currentColor' fill='currentColor' x='-1' y='-1' width='2' height='2'/> + <circle id='gpPt5' stroke-width='0.222' stroke='currentColor' cx='0' cy='0' r='1'/> + <use xlink:href='#gpPt5' id='gpPt6' fill='currentColor' stroke='none'/> + <path id='gpPt7' stroke-width='0.222' stroke='currentColor' d='M0,-1.33 L-1.33,0.67 L1.33,0.67 z'/> + <use xlink:href='#gpPt7' id='gpPt8' fill='currentColor' stroke='none'/> + <use xlink:href='#gpPt7' id='gpPt9' stroke='currentColor' transform='rotate(180)'/> + <use xlink:href='#gpPt9' id='gpPt10' fill='currentColor' stroke='none'/> + <use xlink:href='#gpPt3' id='gpPt11' stroke='currentColor' transform='rotate(45)'/> + <use xlink:href='#gpPt11' id='gpPt12' fill='currentColor' stroke='none'/> + <path id='gpPt13' stroke-width='0.222' stroke='currentColor' d='M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z'/> + <use xlink:href='#gpPt13' id='gpPt14' fill='currentColor' stroke='none'/> + <filter id='textbox' filterUnits='objectBoundingBox' x='0' y='0' height='1' width='1'> + <feFlood flood-color='white' flood-opacity='1' result='bgnd'/> + <feComposite in='SourceGraphic' in2='bgnd' operator='atop'/> + </filter> + <filter id='greybox' filterUnits='objectBoundingBox' x='0' y='0' height='1' width='1'> + <feFlood flood-color='lightgrey' flood-opacity='1' result='grey'/> + <feComposite in='SourceGraphic' in2='grey' operator='atop'/> + </filter> +</defs> +<g fill="none" color="white" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,444.0 L62.9,444.0 M575.0,444.0 L566.0,444.0 '/> <g transform="translate(45.6,447.9)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" >-1</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,401.4 L62.9,401.4 M575.0,401.4 L566.0,401.4 '/> <g transform="translate(45.6,405.3)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" >-0.8</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,358.8 L62.9,358.8 M575.0,358.8 L566.0,358.8 '/> <g transform="translate(45.6,362.7)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" >-0.6</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,316.2 L62.9,316.2 M575.0,316.2 L566.0,316.2 '/> <g transform="translate(45.6,320.1)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" >-0.4</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,273.6 L62.9,273.6 M575.0,273.6 L566.0,273.6 '/> <g transform="translate(45.6,277.5)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" >-0.2</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,231.0 L62.9,231.0 M575.0,231.0 L566.0,231.0 '/> <g transform="translate(45.6,234.9)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" > 0</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,188.5 L62.9,188.5 M575.0,188.5 L566.0,188.5 '/> <g transform="translate(45.6,192.4)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" > 0.2</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,145.9 L62.9,145.9 M575.0,145.9 L566.0,145.9 '/> <g transform="translate(45.6,149.8)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" > 0.4</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,103.3 L62.9,103.3 M575.0,103.3 L566.0,103.3 '/> <g transform="translate(45.6,107.2)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" > 0.6</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,60.7 L62.9,60.7 M575.0,60.7 L566.0,60.7 '/> <g transform="translate(45.6,64.6)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" > 0.8</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,18.1 L62.9,18.1 M575.0,18.1 L566.0,18.1 '/> <g transform="translate(45.6,22.0)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text><tspan font-family="Arial" > 1</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,444.0 L53.9,435.0 M53.9,18.1 L53.9,27.1 '/> <g transform="translate(53.9,465.9)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >-10</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M184.2,444.0 L184.2,435.0 M184.2,18.1 L184.2,27.1 '/> <g transform="translate(184.2,465.9)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" >-5</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M314.5,444.0 L314.5,435.0 M314.5,18.1 L314.5,27.1 '/> <g transform="translate(314.5,465.9)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" > 0</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M444.7,444.0 L444.7,435.0 M444.7,18.1 L444.7,27.1 '/> <g transform="translate(444.7,465.9)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" > 5</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M575.0,444.0 L575.0,435.0 M575.0,18.1 L575.0,27.1 '/> <g transform="translate(575.0,465.9)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="middle"> + <text><tspan font-family="Arial" > 10</tspan></text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,18.1 L53.9,444.0 L575.0,444.0 L575.0,18.1 L53.9,18.1 Z '/></g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> + <g id="gnuplot_plot_1" ><title>sin(x)</title> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <g transform="translate(507.9,40.0)" stroke="none" fill="black" font-family="Arial" font-size="12.00" text-anchor="end"> + <text>sin(x)</text> + </g> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='rgb(148, 0, 211)' d='M516.2,36.1 L558.4,36.1 M53.9,115.2 L59.2,153.4 L64.4,194.8 L69.7,237.6 L75.0,280.2 L80.2,320.8 + L85.5,357.7 L90.7,389.5 L96.0,414.8 L101.3,432.7 L106.5,442.3 L111.8,443.4 L117.1,435.8 L122.3,419.9 + L127.6,396.3 L132.9,366.0 L138.1,330.2 L143.4,290.4 L148.6,248.2 L153.9,205.2 L159.2,163.3 L164.4,124.2 + L169.7,89.4 L175.0,60.4 L180.2,38.3 L185.5,24.1 L190.8,18.2 L196.0,21.1 L201.3,32.4 L206.5,51.9 + L211.8,78.6 L217.1,111.6 L222.3,149.3 L227.6,190.5 L232.9,233.2 L238.1,275.9 L243.4,316.8 L248.7,354.1 + L253.9,386.5 L259.2,412.5 L264.4,431.2 L269.7,441.7 L275.0,443.7 L280.2,437.0 L285.5,421.9 L290.8,399.1 + L296.0,369.4 L301.3,334.1 L306.6,294.6 L311.8,252.5 L317.1,209.6 L322.3,167.5 L327.6,128.0 L332.9,92.7 + L338.1,63.0 L343.4,40.2 L348.7,25.1 L353.9,18.4 L359.2,20.4 L364.5,30.9 L369.7,49.6 L375.0,75.6 + L380.2,108.0 L385.5,145.3 L390.8,186.2 L396.0,228.9 L401.3,271.6 L406.6,312.8 L411.8,350.5 L417.1,383.5 + L422.4,410.2 L427.6,429.7 L432.9,441.0 L438.1,443.9 L443.4,438.0 L448.7,423.8 L453.9,401.7 L459.2,372.7 + L464.5,337.9 L469.7,298.8 L475.0,256.9 L480.3,213.9 L485.5,171.7 L490.8,131.9 L496.0,96.1 L501.3,65.8 + L506.6,42.2 L511.8,26.3 L517.1,18.7 L522.4,19.8 L527.6,29.4 L532.9,47.3 L538.2,72.6 L543.4,104.4 + L548.7,141.3 L553.9,181.9 L559.2,224.5 L564.5,267.3 L569.7,308.7 L575.0,346.9 '/></g> + </g> +<g fill="none" color="white" stroke="rgb(148, 0, 211)" stroke-width="2.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="2.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +<g fill="none" color="black" stroke="black" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> + <path stroke='black' d='M53.9,18.1 L53.9,444.0 L575.0,444.0 L575.0,18.1 L53.9,18.1 Z '/></g> +<g fill="none" color="black" stroke="currentColor" stroke-width="1.00" stroke-linecap="butt" stroke-linejoin="miter"> +</g> +</g> +</svg> + diff --git a/doc/context/presentations/context/2020/context-2020-svg.pdf b/doc/context/presentations/context/2020/context-2020-svg.pdf Binary files differnew file mode 100644 index 000000000..39b0e00cb --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-svg.pdf diff --git a/doc/context/presentations/context/2020/context-2020-svg.tex b/doc/context/presentations/context/2020/context-2020-svg.tex new file mode 100644 index 000000000..3860438e8 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-svg.tex @@ -0,0 +1,123 @@ +% language=us + +\usemodule[present-boring,abbreviations-logos] + +\startdocument + [title={SVG GRAPHICS}, + banner={some demos and discussion}, + location={context\enspace {\bf 2020}\enspace meeting}] + +\starttitle[title=Wrapup] + +\startitemize + +\startitem + It expands to for Scalable Vector Graphics. +\stopitem +\startitem + It is an example of application \XML\ turned standard. +\stopitem +\startitem + It started out simple, kind of expanded \POSTSCRIPT\ in \XML\ format. +\stopitem +\startitem + It took a while to be picked up as output format. +\stopitem + +\blank[2*line] + +\startitem + In practice you get the same messy build-up as in other vector formats. +\stopitem + +\startitem + This is a side effect of often unstructured editing. \footnote {Afterwards + Hraban gave a demonstration of editing in InkScape and there was some + discussion about this aspect}. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=Properties] + +\startitemize + +\startitem + Properties can be set as attributes to an element (key/values). +\stopitem +\startitem + Properties can be set in the \type {style} attribute (semicolon separated key/values). +\stopitem +\startitem + Properties can be set via one or more \type {class} assignments. +\stopitem +\startitem + Properties can be bound to a specific element +\stopitem +\startitem + Properties can be inherited from an ancestor (somewhat vague). +\stopitem +\startitem + Properties can be redundant (nested), overloaded (parent, style), editors can + add their own. etc.\ \unknown\ it's kind of a mess. +\stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=Side effects] + +\startbuffer +\usemodule[gnuplot] + +\externalfigure + [context-2020-gpdemo.gp] + [conversion=svg,width=4cm, + background=color,backgroundcolor=white] + +\externalfigure + [context-2020-gpdemo.gp] + [conversion=svg,width=6cm, + background=color,backgroundcolor=white] + +\scale + [height=4cm] + {\framed + [background=color,backgroundcolor=white] + {\includegnuplotsvgfile[context-2020-sin.svg]}} + +\stopbuffer + +\typebuffer + +\getbuffer + +\stoptitle + +\starttitle[title=Simple examples] + +Some examples were shown (they can be found in manuals): + +\starttyping +svg-lmtx-context.lua +svg-lmtx-microsoft.lua +svg-lmtx-mozilla.lua +svg-lmtx-xahlee.lua +\stoptyping + +Also some examples were shown from the Math4All project. + +\stoptitle + +% \starttitle[title=Complex examples] +% +% \starttyping +% temporary/svg/test* +% \stoptyping +% +% \stoptitle + +\stopdocument diff --git a/doc/context/presentations/context/2020/context-2020-tokens.pdf b/doc/context/presentations/context/2020/context-2020-tokens.pdf Binary files differnew file mode 100644 index 000000000..c508d25ac --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-tokens.pdf diff --git a/doc/context/presentations/context/2020/context-2020-tokens.tex b/doc/context/presentations/context/2020/context-2020-tokens.tex new file mode 100644 index 000000000..b987e2d10 --- /dev/null +++ b/doc/context/presentations/context/2020/context-2020-tokens.tex @@ -0,0 +1,287 @@ +% language=us + +\usemodule[present-boring,abbreviations-logos,system-tokens] + +\startdocument + [title={TOKENS}, + banner={tokens as I see them}, + location={context\enspace {\bf 2020}\enspace meeting}] + +\starttitle[title=About tokens] + +\startitemize + +\startitem Like nodes, it's a common term used in programming. \stopitem +\startitem In \TEX\ The Program tokens and nodes are therefore omni|-|present. \stopitem +\startitem For most users they are irrelevant concepts. \stopitem +\startitem But we will explain them anyway. \stopitem +\startitem Let's try to avoid the snobbish token|-|speak sometimes heard in the community. \stopitem +\startitem So \unknown\ I won't correct you as long as you don't correct me. \stopitem +\startitem Let's now enter the world of tokens in the na\"ive way. \stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=What are tokens] + +\startitemize + +\startitem It is an internal data structure, effectively a (32 bit) integer. \stopitem +\startitem This integer encodes a command (opcode) and an char code (operand). \stopitem +\startitem But often it's not a character but more a sub command. \stopitem +\startitem Input is converted into tokens. \stopitem +\startitem Tokens are either expanded (interpreted) or stored. \stopitem +\startitem When they are stored they are part of a larger data structure, a memory word. \stopitem +\startitem Token memory is an array of such memory words. \stopitem +\startitem The token memory \quote {word} has two integers: a token value and an index into token memory. \stopitem +\startitem That way \TEX\ can have forward linked lists of tokens. \stopitem +\startitem A hash table maps control sequences onto indices into token memory. \stopitem + +\stopitemize + +\starttitle[title=Some implementation details] + +\startitemize + +\startitem Sometimes there is special head token at the start. \stopitem +\startitem A head token makes for easier appending of extra tokens. \stopitem +\startitem Shared lists use the head node for a reference count. \stopitem +\startitem Original \TEX\ uses global temporary lists. \stopitem +\startitem This is needed when we expand (nested) and need to report issues. \stopitem +\startitem This is not needed when we just serialize (which we do a lot in \LUATEX). \stopitem +\startitem So, this is all optimized for performance and memory consumption. \stopitem +\startitem Freed tokens are collected in a cache so tokens can get scattered. \stopitem +\startitem In \LUAMETATEX\ we stay as close to original \TEX\ as possible. \stopitem +\startitem But the \LUA\ interfaces force us to occasionally divert. \stopitem + +\stopitemize + +\stoptitle + +\starttitle[title=A schematic view of tokens] + +A token value: + +\startlinecorrection[blank] + \setupTABLE[each][align=middle] + \setupTABLE[c][1][width=22mm] + \setupTABLE[c][2][width=42mm] + \bTABLE + \bTR \bTD cmd \eTD \bTD chr \eTD \eTR + \eTABLE +\stoplinecorrection + +Token memory: + +\startlinecorrection[blank] + \setupTABLE[each][align=middle] + \setupTABLE[c][1][width=8mm] + \setupTABLE[c][2][width=64mm] + \setupTABLE[c][3][width=64mm] + \bTABLE + \bTR \bTD 1 \eTD \bTD info \eTD \bTD link \eTD \eTR + \bTR \bTD 2 \eTD \bTD info \eTD \bTD link \eTD \eTR + \bTR \bTD 3 \eTD \bTD info \eTD \bTD link \eTD \eTR + \bTR \bTD n \eTD \bTD info \eTD \bTD link \eTD \eTR + \eTABLE +\stoplinecorrection + +\stoptitle + +\starttitle[title=Looking up control sequences] + +\startitemize + +\startitem A very visible to-be-token is a \type {\controlsequence}. \stopitem +\startitem When read, the name will be looked up in the hash table. \stopitem +\startitem When found its value will point to the table of equivalents. \stopitem +\startitem That table keeps track of: + \startitemize + \startitem the type (cmd) \stopitem + \startitem the current level (grouping) \stopitem + \startitem the current meaning (token list) \stopitem + \stopitemize +\stopitem +\stopitemize + +\stoptitle + +\starttitle[title=The (big) table of equivalents (simplified)] + +\startlinecorrection[blank] + \bTABLE + \bTR \bTD[ny=4] main hash \eTD \bTD null control sequence \eTD \eTR + \bTR \bTD 128K hash entries \eTD \eTR + \bTR \bTD frozen control sequences \eTD \eTR + \bTR \bTD special sequences (undefined) \eTD \eTR + \bTR \bTD[ny=7] registers \eTD \bTD 17 internal & 64K user glues \eTD \eTR + \bTR \bTD 4 internal & 64K user mu glues \eTD \eTR + \bTR \bTD 12 internal & 64K user tokens \eTD \eTR + \bTR \bTD 2 internal & 64K user boxes \eTD \eTR + \bTR \bTD 116 internal & 64K user integers \eTD \eTR + \bTR \bTD 0 internal & 64K user attribute \eTD \eTR + \bTR \bTD 22 internal & 64K user dimensions \eTD \eTR + \bTR \bTD specifications \eTD \bTD 5 internal & 0 user \eTD \eTR + \bTR \bTD extra hash \eTD \bTD additional entries (grows dynamic) \eTD \eTR + \eTABLE +\stoplinecorrection + +\stoptable + +\starttitle[title=The hash table (simplified)] + +The hash table runs parallel to the main hash. On the todo list is is to move the +registers to its own tables and make them dynamic. + +\startlinecorrection[blank] + \setupTABLE[each][align=middle] + \setupTABLE[c][1][width=16mm] + \setupTABLE[c][2][width=64mm] + \setupTABLE[c][3][width=64mm] + \bTABLE + \bTR \bTD 1 \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR + \bTR \bTD 2 \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR + \bTR \bTD n \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR + \bTR \bTD n + 1 \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR + \bTR \bTD n + 2 \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR + \bTR \bTD n + m \eTD \bTD string index \eTD \bTD equivalents or (next > n) index \eTD \eTR + \eTABLE +\stoplinecorrection + +Equivalents (registers direct, macros indirect i.e.\ token lists): + +\startlinecorrection[blank] + \setupTABLE[each][align=middle] + \setupTABLE[c][1][width=8mm] + \setupTABLE[c][2][width=32mm] + \setupTABLE[c][3][width=32mm] + \setupTABLE[c][4][width=64mm] + \bTABLE + \bTR \bTD 1 \eTD \bTD level \eTD \bTD type \eTD \bTD value \eTD \eTR + \bTR \bTD 2 \eTD \bTD level \eTD \bTD type \eTD \bTD value \eTD \eTR + \bTR \bTD 3 \eTD \bTD level \eTD \bTD type \eTD \bTD value \eTD \eTR + \bTR \bTD n \eTD \bTD level \eTD \bTD type \eTD \bTD value \eTD \eTR + \eTABLE +\stoplinecorrection + +\stoptitle + +\starttitle[title=Other data management] + +\startitemize +\startitem Grouping is handles by a nesting stack. \stopitem +\startitem Nested conditionals (\type {\if...}) have their own stack. \stopitem +\startitem The values before assignments are saved ion the save stack. \stopitem +\startitem Also other local changes (housekeeping) ends up in the save stack. \stopitem +\startitem Token lists and macro aliases have references pointers (reuse). \stopitem +\startitem Attributes, being linked node lists, have their own management. \stopitem +\stopitemize + +\stoptitle + +\starttitle[title=Example 1: in the input] + +\startbuffer +\luatokentable{1 \bf{2} 3\what {!}} +\stopbuffer + +\typebuffer \blank[line] {\switchtobodyfont[8pt] \getbuffer} + +\stoptitle + +\starttitle[title=Example 1: in the input] + +\startbuffer +\luatokentable{a \the\scratchcounter b \the\parindent \hbox to 10pt{x}} +\stopbuffer + +\typebuffer \blank[line] {\switchtobodyfont[8pt] \getbuffer} + +\stoptitle + +\starttitle[title=Example 2: user registers] + +\startbuffer +\scratchtoks{foo \framed{\red 123}456} + +\luatokentable\scratchtoks +\stopbuffer + +\typebuffer \blank[line] {\switchtobodyfont[8pt] \getbuffer} + +\stoptitle + +\starttitle[title=Example 3: internal variables] + +\startbuffer +\luatokentable\everypar +\stopbuffer + +\typebuffer \blank[line] {\switchtobodyfont[8pt] \getbuffer} + +\stoptitle + +\starttitle[title=Example 4: macro definitions] + +\startbuffer +\protected\def\whatever#1[#2](#3)\relax{oeps #1 and #2 & #3 done ## error} + +\luatokentable\whatever +\stopbuffer + +\typebuffer \blank[line] {\switchtobodyfont[8pt] \startcolumns \getbuffer \stopcolumns} + +\stoptitle + +\starttitle[title=Example 5: commands] + +\startbuffer +\luatokentable\startitemize +\stopbuffer + +\typebuffer \blank[line] {\switchtobodyfont[8pt] \getbuffer} + +\stoptitle + +\starttitle[title=Example 6: commands] + +\startbuffer +\luatokentable\doifelse +\stopbuffer + +\typebuffer \blank[line] {\switchtobodyfont[8pt] \getbuffer } + +\stoptitle + +\starttitle[title=Example 7: nothing] + +\startbuffer +\luatokentable\relax +\stopbuffer + +\typebuffer \blank[line] {\switchtobodyfont[8pt] \getbuffer } + +\stoptitle + +\starttitle[title=Example 8: Hashes] + +\startbuffer +\edef\foo#1#2{(#1)(\letterhash)(#2)} \luatokentable\foo +\stopbuffer + +\typebuffer \blank[line] {\switchtobodyfont[8pt] \getbuffer } + +\stoptitle + +\starttitle[title=Example 9: Nesting] + +\startbuffer +\def\foo#1{\def\foo##1{(#1)(##1)}} \luatokentable\foo +\stopbuffer + +\typebuffer \blank[line] {\switchtobodyfont[8pt] \getbuffer } + +\stoptitle + +\stopdocument diff --git a/doc/context/sources/general/manuals/about/about-titlepage.tex b/doc/context/sources/general/manuals/about/about-titlepage.tex index 392fdb1be..6ca099554 100644 --- a/doc/context/sources/general/manuals/about/about-titlepage.tex +++ b/doc/context/sources/general/manuals/about/about-titlepage.tex @@ -16,9 +16,9 @@ fill Page enlarged 5mm withcolor \MPcolor{maincolor} ; - draw anchored.lrt(image(draw textext("\getvariable{document}{title}") xsized(.750PaperWidth) withcolor white),(lrcorner Page) shifted (-PaperWidth/20, PaperWidth/ 5)) ; - draw anchored.lrt(image(draw textext("\getvariable{document}{subtitle}") xsized(.750PaperWidth) withcolor white),(lrcorner Page) shifted (-PaperWidth/20, PaperWidth/10)) ; - draw anchored.urt(image(draw textext("\getvariable{document}{author}") xsized(.375PaperWidth) rotated 90 withcolor white),(urcorner Page) shifted (-PaperWidth/20,-PaperWidth/20)) ; + draw anchored.lrt(image(draw textext("\documentvariable{title}") xsized(.750PaperWidth) withcolor white),(lrcorner Page) shifted (-PaperWidth/20, PaperWidth/ 5)) ; + draw anchored.lrt(image(draw textext("\documentvariable{subtitle}") xsized(.750PaperWidth) withcolor white),(lrcorner Page) shifted (-PaperWidth/20, PaperWidth/10)) ; + draw anchored.urt(image(draw textext("\documentvariable{author}") xsized(.375PaperWidth) rotated 90 withcolor white),(urcorner Page) shifted (-PaperWidth/20,-PaperWidth/20)) ; setbounds currentpicture to Page ; diff --git a/doc/context/sources/general/manuals/evenmore/evenmore-keywords.tex b/doc/context/sources/general/manuals/evenmore/evenmore-keywords.tex index 372e54781..1cd0bee25 100644 --- a/doc/context/sources/general/manuals/evenmore/evenmore-keywords.tex +++ b/doc/context/sources/general/manuals/evenmore/evenmore-keywords.tex @@ -8,10 +8,10 @@ Some primitives in \TEX\ can take one or more optional keywords and|/|or keywords followed by one or more values. In traditional \TEX\ it concerns a handful of -primitives, in \PDFTEX\ there are plenty of backend related primitives, \LUATEX\ -introduced optional keywords to some math constructs and attributes to boxes, -while \LUAMETATEX\ adds some more too. The keyword scanner in \TEX\ is kind of -special. Keywords are used in cases like: +primitives, in \PDFTEX\ there are plenty of backend|-|related primitives, +\LUATEX\ introduced optional keywords to some math constructs and attributes to +boxes, and \LUAMETATEX\ adds some more too. The keyword scanner in \TEX\ is +rather special. Keywords are used in cases like: \starttyping \hbox spread 10cm {...} @@ -20,20 +20,20 @@ special. Keywords are used in cases like: \stoptyping Sometimes there are multiple keywords, as with rules, in which case you can -imagine use cases like: +imagine a case like: \starttyping \vrule width 3cm depth 1ex width 10cm depth 0ex height 1ex\relax \stoptyping Here we add a \type {\relax} to end the scanning. If we don't do that and the -rule specification is followed by arbitrary (read: unpredictable) text, the next -word can as well be valid keyword and when followed by a dimensions (unlikely) it -will happily take that as directive or when not followed by a dimension an error -message will show up. Sometimes the scanning is more restricted, like with glue +rule specification is followed by arbitrary (read:\ unpredictable) text, the next +word might be a valid keyword and when followed by a dimension (unlikely) it will +happily be read as a directive, or when not followed by a dimension an error +message will show up. Sometimes the scanning is more restricted, as with glue where the optional \type {plus} and \type {minus} are to come in that order, but when missing, again a word from the text can be picked up if one doesn't -explicitly ends with a \type {\relax} or some other not relevant token. +explicitly end with a \type {\relax} or some other token. \starttyping \scratchskip = 10pt plus 10pt minus 10pt % okay @@ -52,13 +52,13 @@ The scanner is case insensitive, so the following specifications are all valid: \hbox to 10cm {to} \stoptyping -It happens that keywords are always simple english words so the engine uses a +It happens that keywords are always simple English words so the engine uses a cheap check deep down, just offsetting to uppercase, but of course that will not -work for arbitrary \UTF\ (as used in \LUATEX) and it's also unrelated to the +work for arbitrary \UTF-8\ (as used in \LUATEX) and it's also unrelated to the upper- and lowercase codes as \TEX\ knows them. The above lines scan for the keyword \type {to} and after that for a dimension. -Where keyword scanning is case tolerant, dimension scanning is period tolerant: +While keyword scanning is case tolerant, dimension scanning is period tolerant: \starttyping \hbox to 10cm {10cm} @@ -68,10 +68,10 @@ Where keyword scanning is case tolerant, dimension scanning is period tolerant: \hbox to 10.cm {10.cm} \stoptyping -These are all valid and according to the specification; even the single period one -is okay, although it looks funny. It would not be hard to intercept that but I -guess that when \TEX\ was written anything that could harm performance was taken -into account and the above is quite okay. One can even argue for cases like: +These are all valid and according to the specification; even the single period is +okay, although it looks funny. It would not be hard to intercept that but I guess +that when \TEX\ was written anything that could harm performance was taken into +account. One can even argue for cases like: \starttyping \hbox to \first.\second cm {.cm} @@ -80,10 +80,11 @@ into account and the above is quite okay. One can even argue for cases like: Here \type {\first} and|/|or \type {\second} can be empty. Most users won't notice these side effects of scanning numbers anyway. -The reason for even spending words on keywords is the following. Optional keyword -scanning is kind of costly, not so much now, but more so decades ago. For -instance, in the first line below, there is no keyword. The scanner sees a \type -{1} and it not being a keyword, pushes that character back in the input. +The reason for writing up any discussion of keywords is the following. Optional +keyword scanning is kind of costly, not so much now, but more so decades ago +(which led to some interesting optimizations, as we'll see). For instance, in the +first line below, there is no keyword. The scanner sees a \type {1} and it not +being a keyword, pushes that character back in the input. \starttyping \advance\scratchcounter 10 @@ -96,16 +97,16 @@ In the case of: \scratchskip 10pt plux \stoptyping -It has to push back the four scanned tokens \type {plux}. Now, in the engine +it has to push back the four scanned tokens \type {plux}. Now, in the engine there are lots of cases where lookahead happens and when a condition is not -satisfied, the just read token is pushed back. Incidentally, when picking up the -next token triggered some expansion, it's not the original next token that gets -pushed back, but the first token seen at the expansion. Pushing back tokens is -not that inefficient, although it involves allocating a token and pushing and -popping input stacks (we're talking of a mix of reading from file, token memory, -\LUA\ prints, etc) but it always takes a little time and memory. In \LUATEX\ -there are more keywords for boxes, and there we have loops too: in a box -specification one or more optional attributes are scanned before the optional +satisfied, the just|-|read token is pushed back. Incidentally, when picking up +the next token triggered some expansion, it's not the original next token that +gets pushed back, but the first token seen after the expansion. Pushing back +tokens is not that inefficient, although it involves allocating a token and +pushing and popping input stacks (we're talking of a mix of reading from file, +token memory, \LUA\ prints, etc.)\ but it always takes a little time and memory. +In \LUATEX\ there are more keywords for boxes, and there we have loops too: in a +box specification one or more optional attributes are scanned before the optional \type {to} or \type {spread}, so again there can be push back when no more \type {attr} are seen. @@ -124,22 +125,24 @@ for now and just show one example: } \stoptyping -Although one cannot mess to much with these low level scanners there was room for -some optimization so the penalty we pay for more keyword scanning in \LUAMETATEX\ -is not that high. In fact, I often manage to compensate adding features that -have a possible performance hit with some gain elsewhere. +Although one cannot mess too much with these low|-|level scanners there was room +for some optimization, so the penalty we pay for more keyword scanning in +\LUAMETATEX\ is not that high. (I try to compensate when adding features that +have a possible performance hit with some gain elsewhere.) -Anyway, it will be no surprise that there can be interesting side effects to -keyword scanning. For instance, using the two character keyword \type {by} in an -advance can be more efficient because nothing needs to be pushed back. The same is -true for the sometimes optional equal: +It will be no surprise that there can be interesting side effects to keyword +scanning. For instance, using the two character keyword \type {by} in an \type +{\advance} can be more efficient because nothing needs to be pushed back. The +same is true for the sometimes optional equal: \starttyping \scratchskip = 10pt \stoptyping Similar impacts on efficiency can be found in the way the end of a number is -seen, basically anything not resolving to a number (or digit). +seen, basically anything not resolving to a number (or digit). (For these, assume +a following token will terminate the number if needed; we're focusing on the +spaces here.) \starttyping \scratchcounter 10% space not seen, ends \cs @@ -151,21 +154,21 @@ seen, basically anything not resolving to a number (or digit). In the above examples scanning the number involves: skipping over spaces, checking for an optional equal, skipping over spaces, scanning for a sign, -checking for an optional octal or hexadecimal trigger (single or double quote), -scanning the number till a non digit is seen. In the case of dimensions there is -fraction scanning as well as unit scanning too. - -In any case, the equal is optional and kind of a keyword. Having an \type {equal} -can be more efficient then not having one, again due to push back in case of no -equal being seen, In the process spaces have been skipped, so add to the overhead -the scanning for optional spaces. In \LUAMETATEX\ all that has been optimized a -bit. By the way, in dimension scanning \type {pt} is actually a keyword and as -there are several dimensions possible quite some push back can happen there, but -we scan for the most likely candidates first. +checking for an optional octal or hexadecimal trigger (single or double quote +character), scanning the number till a non|-|digit is seen. In the case of +dimensions there is fraction scanning as well as unit scanning too. + +In any case, the equal is optional and kind of a keyword. Having an equal can be +more efficient then not having one, again due to push back in case of no equal +being seen, In the process spaces have been skipped, so add to the overhead the +scanning for optional spaces. In \LUAMETATEX\ all that has been optimized a bit. +By the way, in dimension scanning \type {pt} is actually a keyword and as there +are several dimensions possible quite some push back can happen there, but we +scan for the most likely candidates first. All that said, we're now ready for a surprise. The keyword scanner gets a string -that it will test for, say \type {to} in case of a box specification. It then -will fetch tokens from whatever provides the input. A token encodes a so called +that it will test for, say, \type {to} in case of a box specification. It then +will fetch tokens from whatever provides the input. A token encodes a so|-|called command and a character and can be related to a control sequence. For instance, the character \type {t} becomes a letter command with related value \number`t. So, we have three properties: the command code, the character code and the @@ -173,15 +176,15 @@ control sequence code. Now, instead of checking if the command code is a letter or other character (two checks) a fast check happens for the control sequence code being zero. If that is the case, the character code is compared. In practice that works out well because the characters that make up a keyword are in the -range \number"41\ upto \number"5A\ and \number"61\ upto \number"7A, and all other -character codes are either below that (the ones that relate to primitives where -the character code is actually a sub command of a limited range) or much larger -numbers that for instance indicate an entry in some array, where the first useful -index is above the mentioned ranges. +range \number"41--\number"5A\ and \number"61--\number"7A, and all other character +codes are either below that (the ones that relate to primitives where the +character code is actually a subcommand of a limited range) or much larger +numbers that, for instance, indicate an entry in some array, where the first +useful index is above the mentioned ranges. The surprise is in the fact that there is no checking for letters or other -characters, so this is why the next code will work too: \footnote {No longer in -\LUAMETATEX\ where we do a bit more robust check.} +characters, so this is why the following code will work too: \footnote {No longer +in \LUAMETATEX\ where we do a bit more robust check.} \starttyping \catcode `O= 1 \hbox tO 10cm {...} % { begingroup @@ -195,14 +198,14 @@ characters, so this is why the next code will work too: \footnote {No longer in \catcode `O=12 \hbox tO 10cm {...} % other \stoptyping -In the first line, when we would use change the catcode of \type {T} and use that -one it would kind of fails because they \TEX\ sees a begin group character and -starts the group, but as a second character in a keyword it's okay because \TEX\ -will not look at the category code. +In the first line, if we changed the catcode of \type {T} (instead of \type {O}), +it gives an error because \TEX\ sees a begin group character (category code 1) +and starts the group, but as a second character in a keyword (\type {O}) it's +okay because \TEX\ will not look at the category code. -Of course only the cases \type {11} and \type {12} make sense because one can -imagine that messing with the category codes of regular letters this way will -definitely give problems with processing the text. In a case like: +Of course only the cases \type {11} and \type {12} make sense in practice. +Messing with the category codes of regular letters this way will definitely give +problems with processing normal text. In a case like: \starttyping {\catcode `o=3 \hbox to 10cm {oeps}} % $ mathshift {oeps} @@ -211,32 +214,34 @@ definitely give problems with processing the text. In a case like: we have several issues: the primitive control sequence \type {\hbox} has an \type {o} so \TEX\ will stop after \type {\hb} which can be undefined or a valid macro -and what happens next is hard to predict. Going uppercase will work but then the -content of the box is bad because there the \type {O} enters math. +and what happens next is hard to predict. Using uppercase will work but then the +content of the box is bad because there the \type {O} enters math. Now consider: \starttyping {\catcode `O=3 \hbox tO 10cm {Oeps Oeps}} % {$eps $eps} \stoptyping -This will work because there are now two \type {O} in the box so we have balanced -inline math triggers. But how does one explain that to a user, who probably -doesn't understand where an error message comes from in the first place. Anyway, -this kind of tolerance is still not pretty so in \LUAMETATEX\ we now check for -the command code and stick to letters and other characters. On today's machines -(and even on my by now ancient workhorse) the performance hit can be neglected. -Actually, by intercepting the weird cases we also avoid an unnecessary case check -when we fall through the zero cs test. Of course that also means that the above -mentioned category code trickery doesn't work any more: only letters and other -characters are now valid in keyword scanning. Now, it can be that some macro -programmer actually used those side effects but apart from some macro hacker -being hurt because no longer mastering those details can be showed off, it is -users that we care more for, don't we? - -Now get me right, the above mentioning of performance of keyword and equal -scanning is not that relevant in practice. But for the record, here are some -timings on a laptop with a i7-3849QM processor using \MINGW\ binaries on a 64 bit -\MSWINDOWS\ 10. The times are the averages of five times a million such -assignments and advancements: +This will work because there are now two \type {O}'s in the box, so we have +balanced inline math triggers. But how does one explain that to a user? (Who +probably doesn't understand where an error message comes from in the first +place.) Anyway, this kind of tolerance is still not pretty, so in \LUAMETATEX\ we +now check for the command code and stick to letters and other characters. On +today's machines (and even on my by now ancient workhorse) the performance hit +can be neglected. + +In fact, by intercepting the weird cases we also avoid an unnecessary case check +when we fall through the zero control sequence test. Of course that also means +that the above mentioned category code trickery doesn't work any more: only +letters and other characters are now valid in keyword scanning. Now, it can be +that some macro programmer actually used those side effects but apart from some +macro hacker being hurt because no longer mastering those details can be showed +off, it is users that we care more for, don't we? + +To be sure, the abovementioned performance of keyword and equal scanning is not +that relevant in practice. But for the record, here are some timings on a laptop +with a i7-3849\cap{QM} processor using \MINGW\ binaries on a 64-bit \MSWINDOWS\ +10 system. The times are the averages of five times a million such assignments +and advancements. \starttabulate[|l|c|c|c|] \FL @@ -253,12 +258,13 @@ assignments and advancements: \LL \stoptabulate -We differentiate between using a space as terminal or a \type {\relax}. The later -is a bit less efficient because more code is involved in resolving the meaning of -that control sequence (which eventually boils down to nothing) but nevertheless, -these are not timings that one can loose sleep over, especially when the rest of -a decent \TEX\ run is taken into account. And yes, \LUAMETATEX\ is a bit faster -here than \LUATEX, but I would be disappointed if that weren't the case. +We differentiate here between using a space as terminal or a \type {\relax}. The +latter is a bit less efficient because more code is involved in resolving the +meaning of the control sequence (which eventually boils down to nothing) but +nevertheless, these are not timings that one can lose sleep over, especially when +the rest of a decent \TEX\ run is taken into account. And yes, \LUAMETATEX\ +(\LMTX) is a bit faster here than \LUATEX, but I would be disappointed if that +weren't the case. % luametatex: @@ -282,7 +288,6 @@ here than \LUATEX, but I would be disappointed if that weren't the case. % \luaexpr{(0.076+0.085+0.088+0.073+0.078)/5} 0.080\crlf % \luaexpr{(0.136+0.138+0.142+0.135+0.140)/5} 0.138\crlf - \stopchapter \stopcomponent diff --git a/doc/context/sources/general/manuals/libraries/ecmascript-mkiv.tex b/doc/context/sources/general/manuals/libraries/ecmascript-mkiv.tex index 70350142c..7a8bcd535 100644 --- a/doc/context/sources/general/manuals/libraries/ecmascript-mkiv.tex +++ b/doc/context/sources/general/manuals/libraries/ecmascript-mkiv.tex @@ -410,9 +410,9 @@ for: \startsection[title=Colofon] \starttabulate[|B|p|] -\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR +\NC author \NC \documentvariable{author}, \documentvariable{affiliation}, \documentvariable{location} \NC \NR \NC version \NC \currentdate \NC \NR -\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR +\NC website \NC \documentvariable{website} \endash\ \documentvariable{support} \NC \NR \stoptabulate \stopsection diff --git a/doc/context/sources/general/manuals/libraries/libraries-mkiv.tex b/doc/context/sources/general/manuals/libraries/libraries-mkiv.tex index 19c045f5f..07caca83c 100644 --- a/doc/context/sources/general/manuals/libraries/libraries-mkiv.tex +++ b/doc/context/sources/general/manuals/libraries/libraries-mkiv.tex @@ -277,9 +277,9 @@ at some point provide the libraries that we support. \startsection[title=Colofon] \starttabulate[|B|p|] -\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR +\NC author \NC \documentvariable{author}, \documentvariable{affiliation}, \documentvariable{location} \NC \NR \NC version \NC \currentdate \NC \NR -\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR +\NC website \NC \documentvariable{website} \endash\ \documentvariable{support} \NC \NR \NC comment \NC many thanks to Luigi Scarso for taking care of \FFI\ support in the engines \NC \NR \stoptabulate diff --git a/doc/context/sources/general/manuals/lua/lua-mkiv.tex b/doc/context/sources/general/manuals/lua/lua-mkiv.tex index 25a3d1786..61d7dddad 100644 --- a/doc/context/sources/general/manuals/lua/lua-mkiv.tex +++ b/doc/context/sources/general/manuals/lua/lua-mkiv.tex @@ -65,8 +65,8 @@ fill Page withcolor \MPcolor{maincolor} ; - draw textext.urt("\TitlePageFont \getvariable{document}{title}") xsized (0.8w) shifted (.1w,.2h) withcolor .80white ; - draw textext.top("\TitlePageFont \getvariable{document}{subtitle}") xsized (0.8w) shifted (.5w,.1h) withcolor .60white ; + draw textext.urt("\TitlePageFont \documentvariable{title}") xsized (0.8w) shifted (.1w,.2h) withcolor .80white ; + draw textext.top("\TitlePageFont \documentvariable{subtitle}") xsized (0.8w) shifted (.5w,.1h) withcolor .60white ; StopPage ; @@ -132,9 +132,9 @@ where it can find them. \startsubject[title={Colofon}] \starttabulate[|B|p|] -\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR +\NC author \NC \documentvariable{author}, \documentvariable{affiliation}, \documentvariable{location} \NC \NR \NC version \NC \currentdate \NC \NR -\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR +\NC website \NC \documentvariable{website} \endash\ \documentvariable{support} \NC \NR \NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR \stoptabulate diff --git a/doc/context/sources/general/manuals/mathml/envexamp.tex b/doc/context/sources/general/manuals/mathml/envexamp.tex index 99bc72b8a..8a2b4e2df 100644 --- a/doc/context/sources/general/manuals/mathml/envexamp.tex +++ b/doc/context/sources/general/manuals/mathml/envexamp.tex @@ -219,7 +219,7 @@ \startsubsection[reference=#1,title=#1,marking=#1][filename=#1] \switchtobodyfont [8pt] - \startcolumns[balance=no,n=\getvariable{document}{columns}] + \startcolumns[balance=no,n=\documentvariable{columns}] \typefile{#1.xml} \stopcolumns \vfill diff --git a/doc/context/sources/general/manuals/mcommon.tex b/doc/context/sources/general/manuals/mcommon.tex index d4c2acb53..57ab24a8d 100644 --- a/doc/context/sources/general/manuals/mcommon.tex +++ b/doc/context/sources/general/manuals/mcommon.tex @@ -167,7 +167,7 @@ [rotation=90] {\color [lightgray] - {\getvariable{document}{title}}} + {\documentvariable{title}}} \par \stopstandardmakeup \setupbackgrounds @@ -179,9 +179,9 @@ \blank[2*big] \testpage[3] \startpacked - \getvariable{document}{author}\par - \getvariable{document}{affiliation}\par - \getvariable{document}{location}\par + \documentvariable{author}\par + \documentvariable{affiliation}\par + \documentvariable{location}\par \stoppacked \stopsetups diff --git a/doc/context/sources/general/manuals/publications/publications-titlepage.tex b/doc/context/sources/general/manuals/publications/publications-titlepage.tex index dfc53419a..3f887dd7d 100644 --- a/doc/context/sources/general/manuals/publications/publications-titlepage.tex +++ b/doc/context/sources/general/manuals/publications/publications-titlepage.tex @@ -11,9 +11,9 @@ for i=0 upto 9 : draw pth shifted (0,2*i) ; endfor ; ) ; - picture btx ; btx := textext("\ssbf\WORDS{\getvariable{document}{title}}") ; - picture ctx ; ctx := textext("\ssbf\WORDS{\getvariable{document}{subtitle}}") ; - picture dtx ; dtx := textext("\ssbf \getvariable{document}{author}") ; + picture btx ; btx := textext("\ssbf\WORDS{\documentvariable{title}}") ; + picture ctx ; ctx := textext("\ssbf\WORDS{\documentvariable{subtitle}}") ; + picture dtx ; dtx := textext("\ssbf \documentvariable{author}") ; pic := pic shifted - llcorner pic ; btx := btx shifted - llcorner btx ; diff --git a/doc/context/sources/general/manuals/spreadsheets/spreadsheets-mkiv.tex b/doc/context/sources/general/manuals/spreadsheets/spreadsheets-mkiv.tex index c5c99e97d..a95ddfd79 100644 --- a/doc/context/sources/general/manuals/spreadsheets/spreadsheets-mkiv.tex +++ b/doc/context/sources/general/manuals/spreadsheets/spreadsheets-mkiv.tex @@ -749,9 +749,9 @@ will be added in the future but it all depends on usage. \startsubject[title={Colofon}] \starttabulate[|B|p|] -\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR +\NC author \NC \documentvariable{author}, \documentvariable{affiliation}, \documentvariable{location} \NC \NR \NC version \NC \currentdate \NC \NR -\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR +\NC website \NC \documentvariable{website} \endash\ \documentvariable{support} \NC \NR \NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR \stoptabulate diff --git a/doc/context/sources/general/manuals/sql/sql-mkiv.tex b/doc/context/sources/general/manuals/sql/sql-mkiv.tex index 835065ba0..27be160f7 100644 --- a/doc/context/sources/general/manuals/sql/sql-mkiv.tex +++ b/doc/context/sources/general/manuals/sql/sql-mkiv.tex @@ -580,9 +580,9 @@ In this example we typeset the (small) table): \startsection[title=Colofon] \starttabulate[|B|p|] -\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR +\NC author \NC \documentvariable{author}, \documentvariable{affiliation}, \documentvariable{location} \NC \NR \NC version \NC \currentdate \NC \NR -\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR +\NC website \NC \documentvariable{website} \endash\ \documentvariable{support} \NC \NR \NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR \stoptabulate diff --git a/doc/context/sources/general/manuals/swiglib/swiglib-mkiv.tex b/doc/context/sources/general/manuals/swiglib/swiglib-mkiv.tex index 7360c73fa..6d9d8af9a 100644 --- a/doc/context/sources/general/manuals/swiglib/swiglib-mkiv.tex +++ b/doc/context/sources/general/manuals/swiglib/swiglib-mkiv.tex @@ -516,9 +516,9 @@ handle it \type {--parallel} can speed up the process. \startsection[title=Colofon] \starttabulate[|B|p|] -\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR +\NC author \NC \documentvariable{author}, \documentvariable{affiliation}, \documentvariable{location} \NC \NR \NC version \NC \currentdate \NC \NR -\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR +\NC website \NC \documentvariable{website} \endash\ \documentvariable{support} \NC \NR \NC comment \NC the swiglib infrastructure is implemented by Luigi Scarso \NC \NR \stoptabulate diff --git a/doc/context/sources/general/manuals/templates/templates-mkiv.tex b/doc/context/sources/general/manuals/templates/templates-mkiv.tex index 07dd041c3..e46b1de8a 100644 --- a/doc/context/sources/general/manuals/templates/templates-mkiv.tex +++ b/doc/context/sources/general/manuals/templates/templates-mkiv.tex @@ -276,9 +276,9 @@ possibility is provided. \startsubject[title={Colofon}] \starttabulate[|B|p|] -\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR +\NC author \NC \documentvariable{author}, \documentvariable{affiliation}, \documentvariable{location} \NC \NR \NC version \NC \currentdate \NC \NR -\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR +\NC website \NC \documentvariable{website} \endash\ \documentvariable{support} \NC \NR \NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR \stoptabulate diff --git a/doc/context/sources/general/manuals/tools/tools-mkiv.tex b/doc/context/sources/general/manuals/tools/tools-mkiv.tex index cd5214b3f..b26145d37 100644 --- a/doc/context/sources/general/manuals/tools/tools-mkiv.tex +++ b/doc/context/sources/general/manuals/tools/tools-mkiv.tex @@ -116,13 +116,13 @@ draw p shifted (center Page - center p) withpen pencircle scaled 2 withcolor .5white ; numeric dx ; dx := bbwidth(Page)/21 ; numeric dy ; dy := bbheight(Page)/30 ; - p := textext("\tt\bf\white\getvariable{document}{extra-1}") xsized(14*dx) ; + p := textext("\tt\bf\white\documentvariable{extra-1}") xsized(14*dx) ; p := p shifted (-lrcorner p) shifted lrcorner Page shifted (-1dx,8dy) ; draw p ; - p := textext("\tt\bf\white\getvariable{document}{extra-2}") xsized(14*dx) ; + p := textext("\tt\bf\white\documentvariable{extra-2}") xsized(14*dx) ; p := p shifted (-lrcorner p) shifted lrcorner Page shifted (-1dx,5dy) ; draw p ; - p := textext("\tt\bf\white\getvariable{document}{extra-3}") xsized(14*dx) ; + p := textext("\tt\bf\white\documentvariable{extra-3}") xsized(14*dx) ; p := p shifted (-lrcorner p) shifted lrcorner Page shifted (-1dx,2dy) ; draw p ; setbounds currentpicture to Page ; diff --git a/doc/context/sources/general/manuals/units/units-mkiv.tex b/doc/context/sources/general/manuals/units/units-mkiv.tex index db9306e6c..66338497a 100644 --- a/doc/context/sources/general/manuals/units/units-mkiv.tex +++ b/doc/context/sources/general/manuals/units/units-mkiv.tex @@ -580,9 +580,9 @@ These are also special: \startsection[title={Colofon}] \starttabulate[|B|p|] -\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR +\NC author \NC \documentvariable{author}, \documentvariable{affiliation}, \documentvariable{location} \NC \NR \NC version \NC \currentdate \NC \NR -\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR +\NC website \NC \documentvariable{website} \endash\ \documentvariable{support} \NC \NR \NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR \stoptabulate diff --git a/doc/context/sources/general/manuals/xtables/xtables-mkiv.tex b/doc/context/sources/general/manuals/xtables/xtables-mkiv.tex index 1b878e5cb..d79c14ace 100644 --- a/doc/context/sources/general/manuals/xtables/xtables-mkiv.tex +++ b/doc/context/sources/general/manuals/xtables/xtables-mkiv.tex @@ -1621,9 +1621,9 @@ in the distribution. \startsection[title={Colofon}] \starttabulate[|B|p|] -\NC author \NC \getvariable{document}{author}, \getvariable{document}{affiliation}, \getvariable{document}{location} \NC \NR +\NC author \NC \documentvariable{author}, \documentvariable{affiliation}, \documentvariable{location} \NC \NR \NC version \NC \currentdate \NC \NR -\NC website \NC \getvariable{document}{website} \endash\ \getvariable{document}{support} \NC \NR +\NC website \NC \documentvariable{website} \endash\ \documentvariable{support} \NC \NR \NC copyright \NC \symbol[cc][cc-by-sa-nc] \NC \NR \stoptabulate diff --git a/scripts/context/lua/mtx-unicode.lua b/scripts/context/lua/mtx-unicode.lua index 5ae30b883..297807889 100644 --- a/scripts/context/lua/mtx-unicode.lua +++ b/scripts/context/lua/mtx-unicode.lua @@ -1,4 +1,4 @@ - if not modules then modules = { } end modules ['mtx-unicode'] = { +if not modules then modules = { } end modules ['mtx-unicode'] = { version = 1.002, comment = "companion to mtxrun.lua", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index d3818d44d..3e6741cb3 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{2020.09.05 21:12} +\newcontextversion{2020.09.15 18:07} %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 03ff7cd5b..fef1d6aea 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{2020.09.05 21:12} +\edef\contextversion{2020.09.15 18:07} %D For those who want to use this: diff --git a/tex/context/base/mkiv/back-exp.mkiv b/tex/context/base/mkiv/back-exp.mkiv index e44a23cb2..05e404697 100644 --- a/tex/context/base/mkiv/back-exp.mkiv +++ b/tex/context/base/mkiv/back-exp.mkiv @@ -357,6 +357,6 @@ \ifexporting \dostartexport % in case it is done inside \starttext \fi -\to \everysetupdocument +\to \everystartdocument \protect \endinput diff --git a/tex/context/base/mkiv/buff-ver.mkiv b/tex/context/base/mkiv/buff-ver.mkiv index 3e1eee75a..067ae7c39 100644 --- a/tex/context/base/mkiv/buff-ver.mkiv +++ b/tex/context/base/mkiv/buff-ver.mkiv @@ -39,6 +39,7 @@ \the\everyresettypesetting \resetfontfeature \resetcharacterspacing + \resetbreakpoints \to \everyinitializeverbatim \unexpanded\def\setverbatimspaceskip % to be checked: must happen after font switch diff --git a/tex/context/base/mkiv/buff-ver.mkxl b/tex/context/base/mkiv/buff-ver.mkxl index 292365e8f..4dc82288a 100644 --- a/tex/context/base/mkiv/buff-ver.mkxl +++ b/tex/context/base/mkiv/buff-ver.mkxl @@ -39,6 +39,7 @@ \the\everyresettypesetting \resetfontfeature \resetcharacterspacing + \resetbreakpoints \to \everyinitializeverbatim \unexpanded\def\setverbatimspaceskip % to be checked: must happen after font switch diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua index 7e6af8072..24092d852 100644 --- a/tex/context/base/mkiv/cldf-ini.lua +++ b/tex/context/base/mkiv/cldf-ini.lua @@ -368,11 +368,13 @@ end -- interfaces.scanners.foo = function() context("[%s]",tokens.scanners.string()) end : \scan_foo -local storedscanners = interfaces.storedscanners or { } -local interfacescanners = { } -local privatenamespace = "clf_" +local storedscanners = interfaces.storedscanners or { } +local namesofscanners = interfaces.namesofscanners or { } +local interfacescanners = { } +local privatenamespace = "clf_" -interfaces.storedscanners = storedscanners +interfaces.storedscanners = storedscanners +interfaces.namesofscanners = namesofscanners storage.register("interfaces/storedscanners", storedscanners, "interfaces.storedscanners") @@ -381,6 +383,7 @@ local function registerscanner(name,action,protected,public,usage) -- todo: comb local n = storedscanners[name] n = registerfunction("interfaces.scanners."..name,true,n) storedscanners[name] = n + namesofscanners[n] = name name = public and name or (privatenamespace .. name) -- print(">>",name,protected and "protected" or "",usage or "macro") setluatoken(name,n,"global",protected and "protected" or "",usage or "macro") @@ -392,6 +395,20 @@ function interfaces.knownscanner(name) return interfacescanners[name] end +function interfaces.nameofscanner(slot) + return namesofscanners[slot] or slot +end + +if CONTEXTLMTXMODE > 0 then + + callback.register("show_lua_call", function(what, slot) + local name = namesofscanners[slot] + -- return name and formatters["%s: \\%s, slot: %i"](what,name,slot) or "" + return name and formatters["%s \\%s"](what,name) or "" + end) + +end + setmetatablenewindex(interfacescanners, function(t,k,v) report_cld("don't register scanner %a directly",k) -- registerscanner(k,v) diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index ca66a4283..6e2ec0fb3 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{2020.09.05 21:12} +\newcontextversion{2020.09.15 18:07} %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 367ba9207..2c1bed4a4 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.09.05 21:12} +\edef\contextversion{2020.09.15 18:07} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index 873643725..9d3edf3c1 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.09.05 21:12} +\edef\contextversion{2020.09.15 18:07} %D Kind of special: diff --git a/tex/context/base/mkiv/core-ini.mkiv b/tex/context/base/mkiv/core-ini.mkiv index bbe66307b..c4ab298bf 100644 --- a/tex/context/base/mkiv/core-ini.mkiv +++ b/tex/context/base/mkiv/core-ini.mkiv @@ -47,12 +47,14 @@ %D Document: -\newtoks \everysetupdocument \newtoks \everyendoftextbody \newtoks \everystarttext \newtoks \everystoptext +\newtoks \everystartdocument +\newtoks \everystopdocument + %D Purity: \newtoks \everyforgetall diff --git a/tex/context/base/mkiv/file-job.mkvi b/tex/context/base/mkiv/file-job.mkvi index a46e519c0..db5ac4db1 100644 --- a/tex/context/base/mkiv/file-job.mkvi +++ b/tex/context/base/mkiv/file-job.mkvi @@ -295,22 +295,81 @@ {\popsystemmode\v!environment \signalendofinput\v!environment} -%D Relatively new (might move as it depends on setups): +%D Upgraded after the ctx 2020 meeting: +%D +%D \starttyping +%D \definedocument[thesis] +%D +%D \setupdocument[a=b,e=f] +%D \setupdocument[thesis][a=x,c=d] +%D +%D % \startsetups[thesis:start] +%D \startsetups[document:start] +%D START +%D \stopsetups +%D +%D \startsetups[thesis:stop] +%D % \startsetups[document:stop] +%D STOP +%D \stopsetups +%D +%D % \startdocument[thesis] +%D \startthesis +%D (\currentdocument/a): \documentvariable{a}\par +%D (\currentdocument/c): \documentvariable{c}\par +%D (\currentdocument/e): \documentvariable{e}\par +%D \stopthesis +%D % \stopdocument +%D \stoptyping -%newtoks\everysetupdocument +\installcorenamespace {document} -\unexpanded\def\startdocument % todo: dostarttagged\t!document - {\dosingleargument\syst_structure_document_start} +\installcommandhandler \??document \s!document \??document + +\setupdocument + [\c!before=\directsetup{\s!document:\v!start}, + \c!after =\directsetup{\s!document:\v!stop}] -\unexpanded\def\syst_structure_document_start[#settings]% - {\setvariables[\s!document][#settings]% - \the\everysetupdocument\relax +\def\syst_document_setup#1% + {\directsetup{\doifelsesetups{\currentdocument:\v!start}\currentdocument\s!document:\v!start}} + +\appendtoks + \normalexpanded {% + \startsetups[\currentdocument:\v!start]\noexpand\directsetup{\ifx\empty\currentdocumentparent\s!document\else\currentdocumentparent\fi:\v!start}\stopsetups + \startsetups[\currentdocument:\v!stop ]\noexpand\directsetup{\ifx\empty\currentdocumentparent\s!document\else\currentdocumentparent\fi:\v!stop }\stopsetups + \setvalue{\e!start\currentdocument}{\dodoubleargument\syst_document_start[\currentdocument]}% + \letvalue{\e!stop \currentdocument}\stopdocument + }% +\to \everydefinedocument + +\unexpanded\def\startdocument % todo: dostarttagged\t!document + {\dodoubleargument\syst_document_start} + +\unexpanded\def\syst_document_start[#namespace][#settings]% + {\pushmacro\currentdocument + \ifsecondargument + \edef\currentdocument{#namespace}% + \setupcurrentdocument[#settings]% + \else\iffirstargument + \doifelseassignment{#namespace}% + {\let\currentdocument\empty + \setupcurrentdocument[#namespace]}% + {\edef\currentdocument{#namespace}}% + \fi\fi + \ifx\empty\currentdocument\else\setmode\currentdocument\fi \starttext + \the\everystartdocument \documentvariable\c!before} \unexpanded\def\stopdocument % todo: dostoptagged\t!document {\documentvariable\c!after - \stoptext} + \the\everystopdocument + \stoptext + \ifx\empty\currentdocument\else\resetmode\currentdocument\fi + \popmacro\currentdocument} + + \let\documentvariable \documentparameter +\unexpanded\def\unexpandeddocumentvariable{\documentparameter} \unexpanded\def\doifelsedocumentvariable#name{\doifelsesomething{\documentvariable{#name}}} \unexpanded\def\doifdocumentvariable #name{\doifsomething {\documentvariable{#name}}} @@ -318,38 +377,21 @@ \let\doifdocumentvariableelse\doifelsedocumentvariable -\def\documentvariable#name% - {\getvariable\s!document{#name}} - -\unexpanded\def\unexpandeddocumentvariable#name% - {\getvariable\s!document{#name}} - -\unexpanded\def\setupdocument[#settings]% - {\setvariables[\s!document][#settings]% - \the\everysetupdocument\relax} - -\unexpanded\def\presetdocument[#settings]% - {\checkvariables[\s!document][#settings]} - -% We silently ignore missing documents. Beware: there are no begin/end setups -% invoked as we expect the loaded document to be wrapped in \startdocument ... -% \stopdocument. This is just a convenient variant of input. -% -% \unexpanded\def\document -% {\dosingleempty\syst_document} -% -% \def\syst_document[#1]#2% -% \startdocument[#1] -% \readfile{#2}{}{}} - -% metadata:author metadata:title metadata:subject - -\setvariables - [document] - [\c!before=\directsetup{\s!document:start}, - \c!after=\directsetup{\s!document:stop}] - -%S The document: namespace will be used elsewhere too. +\unexpanded\def\presetdocument + {\dodoubleargument\syst_document_preset} + +\unexpanded\def\syst_document_preset[#namespace][#settings]% + {\pushmacro\currentdocument + \ifsecondargument + \edef\currentdocument{#namespace}% + \setupcurrentdocument[#settings]% + \else\iffirstargument + \doifelseassignment{#namespace}% + {\let\currentdocument\empty + \setupcurrentdocument[#namespace]}% + {}% + \fi\fi + \popmacro\currentdocument} % Bonus: diff --git a/tex/context/base/mkiv/grph-img.lua b/tex/context/base/mkiv/grph-img.lua index 49b082c58..0dc5efa70 100644 --- a/tex/context/base/mkiv/grph-img.lua +++ b/tex/context/base/mkiv/grph-img.lua @@ -97,6 +97,13 @@ do [0x01] = { name = "TEM", zerolength = true }, -- temporary use } + setmetatableindex(tags, function(t,k) + -- we can add some tracing if needed (global) to get an idea + local v = "tag " .. k + t[k] = v + return v + end) + -- More can be found in http://www.exif.org/Exif2-2.PDF but basically we have -- good old tiff tags here. @@ -254,7 +261,7 @@ do local length = 0 local tagdata = tags[category] if not tagdata then - specification.error = "invalid tag" + specification.error = "invalid tag " .. (category or "?") break elseif tagdata.supported == false then specification.error = "unsupported " .. tagdata.comment diff --git a/tex/context/base/mkiv/lang-ini.lua b/tex/context/base/mkiv/lang-ini.lua index ce2b89f3c..ac5b2c113 100644 --- a/tex/context/base/mkiv/lang-ini.lua +++ b/tex/context/base/mkiv/lang-ini.lua @@ -49,7 +49,7 @@ local uccodes = characters.uccodes local lccodes = characters.lccodes lang.exceptions = lang.hyphenation -local new_langage = lang.new +local new_language = lang.new languages = languages or {} local languages = languages @@ -85,7 +85,7 @@ local function resolve(tag) if data then instance = data.instance if not instance then - instance = new_langage(data.number) + instance = new_language(data.number) data.instance = instance end end @@ -101,7 +101,7 @@ local function tolang(what) -- returns lang object if data then local instance = data.lang if not instance then - instance = new_langage(data.number) + instance = new_language(data.number) data.instance = instance end return instance @@ -502,6 +502,14 @@ else end end + if CONTEXTLMTXMODE > 0 then + numbers[0] = "null" + registered.null = { + number = 0, + instance = new_language(0), + } + end + end -- not that usefull, global values diff --git a/tex/context/base/mkiv/meta-imp-threesix.mkxl b/tex/context/base/mkiv/meta-imp-threesix.mkxl index 44ddda579..56a400b45 100644 --- a/tex/context/base/mkiv/meta-imp-threesix.mkxl +++ b/tex/context/base/mkiv/meta-imp-threesix.mkxl @@ -205,22 +205,33 @@ [default] [metapost={category=fontthreesix,shape=diamond,color=random,pen=fancy,spread=.1,random=yes}] -% \definefont[DEKFontA][Serif*fontthreesix-color @ 280pt] -% \definefont[DEKFontB][Serif*fontthreesix-color @ 80pt] - \definefont[DEKFontA][Serif*fontthreesix-color @ 200pt] \definefont[DEKFontB][Serif*fontthreesix-color @ 60pt] -\startTEXpage[align={lohi,middle,nothyphenated},offset=20pt] - \offinterlineskip \vskip10pt - \DEKFontA T\kern-0.05em\lower.75\exheight\hbox{E}\kern-.05emX \vskip60pt - \DEKFontB TOUGH \vskip20pt - SMART \vskip20pt - UNITED \vskip20pt - DISCIPLINED \vskip20pt - LOVING \vskip10pt +% Or course: + +\startTEXpage + \DEKFontA TEX \stopTEXpage +\startTEXpage + \DEKFontA T\kern-0.05em\lower.75\exheight\hbox{E}\kern-.05emX +\stopTEXpage + +% One of the \CONTEXT\ 2020 posters (inspired by NewYork State AC's press +% conferences as these keywords apply quite well to the audience of the +% meeting): + +% \startTEXpage[align={lohi,middle,nothyphenated},offset=20pt] +% \offinterlineskip \vskip10pt +% \DEKFontA T\kern-0.05em\lower.75\exheight\hbox{E}\kern-.05emX \vskip60pt +% \DEKFontB TOUGH \vskip20pt +% SMART \vskip20pt +% UNITED \vskip20pt +% DISCIPLINED \vskip20pt +% LOVING \vskip10pt +% \stopTEXpage + \startpagemakeup \setupalign[middle,nothyphenated] \offinterlineskip \vfil\vfil diff --git a/tex/context/base/mkiv/mlib-int.lmt b/tex/context/base/mkiv/mlib-int.lmt index 4cdc3b076..86e2e5732 100644 --- a/tex/context/base/mkiv/mlib-int.lmt +++ b/tex/context/base/mkiv/mlib-int.lmt @@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['mlib-int'] = { local factor = number.dimenfactors.bp local mpstring = mp.string +local mpboolean = mp.boolean local getdimen = tex.getdimen local getcount = tex.getcount local getmacro = tokens.getters.macro @@ -122,9 +123,13 @@ registerscript("OverlayOffset", function() return getdimen("d_overlay_off registerscript("OverlayRegion", function() mpstring(getmacro("m_overlay_region")) end) --------------("CurrentLayout", function() mpstring(getmacro("currentlayout")) end) -registerscript("PageFraction", page_fraction) -registerscript("OnRightPage", on_right_page) -registerscript("OnOddPage", is_odd_page ) -registerscript("InPageBody", in_body_page ) +-- should be direct +-- +-- registerscript("PageFraction", page_fraction) + +registerscript("PageFraction", function() return mpboolean(page_fraction()) end) +registerscript("OnRightPage", function() return mpboolean(on_right_page()) end) +registerscript("OnOddPage", function() return mpboolean(is_odd_page ()) end) +registerscript("InPageBody", function() return mpboolean(in_body_page ()) end) registerscript("defaultcolormodel", defaultcolormodel) diff --git a/tex/context/base/mkiv/mult-aux.mkiv b/tex/context/base/mkiv/mult-aux.mkiv index 15a5b26a9..d7921bcc2 100644 --- a/tex/context/base/mkiv/mult-aux.mkiv +++ b/tex/context/base/mkiv/mult-aux.mkiv @@ -677,7 +677,7 @@ \installswitchsetuphandler {#1}{#2}% \installstyleandcolorhandler {#1}{#2}} -\protected\def\installautocommandhandler#1#2#3% automatically defined cloned setups +\protected\def\installautocommandhandler#1#2#3% automatically defines cloned setups {\installbasicparameterhandler{#1}{#2}% \installdefinehandler {#1}{#2}{#3}% \installautosetuphandler {#1}{#2}% diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua index d56e2adef..2ebfaff12 100644 --- a/tex/context/base/mkiv/node-tra.lua +++ b/tex/context/base/mkiv/node-tra.lua @@ -513,8 +513,8 @@ function number.tobasepoints (n,fmt) return numbertodimen(n,"bp",fmt) end function number.topicas (n,fmt) return numbertodimen(n "pc",fmt) end function number.todidots (n,fmt) return numbertodimen(n,"dd",fmt) end function number.tociceros (n,fmt) return numbertodimen(n,"cc",fmt) end -function number.tonewdidots (n,fmt) return numbertodimen(n,"nd",fmt) end -function number.tonewciceros (n,fmt) return numbertodimen(n,"nc",fmt) end +-------- number.tonewdidots (n,fmt) return numbertodimen(n,"nd",fmt) end +-------- number.tonewciceros (n,fmt) return numbertodimen(n,"nc",fmt) end function nodes.topoints (n,fmt) return nodetodimen(n,"pt",fmt) end function nodes.toinches (n,fmt) return nodetodimen(n,"in",fmt) end @@ -526,8 +526,8 @@ function nodes.tobasepoints (n,fmt) return nodetodimen(n,"bp",fmt) end function nodes.topicas (n,fmt) return nodetodimen(n "pc",fmt) end function nodes.todidots (n,fmt) return nodetodimen(n,"dd",fmt) end function nodes.tociceros (n,fmt) return nodetodimen(n,"cc",fmt) end -function nodes.tonewdidots (n,fmt) return nodetodimen(n,"nd",fmt) end -function nodes.tonewciceros (n,fmt) return nodetodimen(n,"nc",fmt) end +-------- nodes.tonewdidots (n,fmt) return nodetodimen(n,"nd",fmt) end +-------- nodes.tonewciceros (n,fmt) return nodetodimen(n,"nc",fmt) end -- stop redefinition diff --git a/tex/context/base/mkiv/page-imp.mkiv b/tex/context/base/mkiv/page-imp.mkiv index 2f1e75e9d..a83089986 100644 --- a/tex/context/base/mkiv/page-imp.mkiv +++ b/tex/context/base/mkiv/page-imp.mkiv @@ -167,8 +167,17 @@ % \def\page_shipout_box#1{\normalshipout\box#1\relax} % takes a number +\ifcase\contextlmtxmode + \def\page_shipout_show_box{\scratchcounter} +\else + \def\page_shipout_show_box{\showbox diagnose} +\fi + \unexpanded\def\page_shipout_box#1% - {\clf_shipoutpage#1\relax + {\ifcase\tracingoutput\else + \page_shipout_show_box#1\relax + \fi + \clf_shipoutpage#1\relax \global\setbox#1\emptybox \global\deadcycles\zerocount} diff --git a/tex/context/base/mkiv/scrn-ini.mkvi b/tex/context/base/mkiv/scrn-ini.mkvi index 557ceb563..39fef740c 100644 --- a/tex/context/base/mkiv/scrn-ini.mkvi +++ b/tex/context/base/mkiv/scrn-ini.mkvi @@ -231,7 +231,7 @@ % this comes before starttext \def\scrn_identity_document#1#2% - {\doifvariable{document}{metadata:#1}{\setupinteraction[#2=\documentvariable{metadata:#1}]}} + {\doifdocumentvariable{metadata:#1}{\setupinteraction[#2=\documentvariable{metadata:#1}]}} \appendtoks % not interfaced i.e. english \scrn_identity_document {title}\c!title @@ -242,7 +242,7 @@ \scrn_identity_document {keyword}\c!keyword \scrn_identity_document{keywords}\c!keyword \scrn_identity_document {date}\c!date -\to \everysetupdocument +\to \everystartdocument % or stop \setupinteraction [\c!title=, diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex edb9d62d1..ff922bab8 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 9abda7bce..fd0b5705c 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/syst-aux.mkxl b/tex/context/base/mkiv/syst-aux.mkxl index 30510d6d5..95a1079e8 100644 --- a/tex/context/base/mkiv/syst-aux.mkxl +++ b/tex/context/base/mkiv/syst-aux.mkxl @@ -3723,7 +3723,7 @@ {\def\syst_helpers_grab_indeed##1#1{#2{##1}}\syst_helpers_grab_indeed} \protected\def\grabuntil#1% - {\expandafter\syst_helpers_grab\expandafter{\begincsname#1\endcsname}} + {\expandafter\syst_helpers_grab\expandafter{\csname#1\endcsname}} %D The next command build on this mechanism: %D diff --git a/tex/context/base/mkiv/util-dim.lua b/tex/context/base/mkiv/util-dim.lua index 76b5fd20b..bb9eca966 100644 --- a/tex/context/base/mkiv/util-dim.lua +++ b/tex/context/base/mkiv/util-dim.lua @@ -44,8 +44,8 @@ local dimenfactors = allocate { ["pc"] = ( 1/ 12)/65536, ["dd"] = ( 1157/ 1238)/65536, ["cc"] = ( 1157/14856)/65536, - ["nd"] = (20320/21681)/65536, - ["nc"] = ( 5080/65043)/65536 + -- ["nd"] = (20320/21681)/65536, + -- ["nc"] = ( 5080/65043)/65536 } -- print(table.serialize(dimenfactors)) @@ -61,9 +61,9 @@ local dimenfactors = allocate { -- ["ex"]=6.103515625e-005, -- ["in"]=2.1113586636917117e-007, -- ["mm"]=5.3628510057769473e-008, --- ["nc"]=1.1917446679504327e-006, --- ["nd"]=1.4300936015405194e-005, --- ["pc"]=1.2715657552083333e-006, +-- --["nc"]=1.1917446679504327e-006, +-- --["nd"]=1.4300936015405194e-005, +-- --["pc"]=1.2715657552083333e-006, -- ["pt"]=1.52587890625e-005, -- ["sp"]=1, -- } @@ -79,8 +79,8 @@ local dimenfactors = allocate { -- ["ex"]=0.00006103515625, -- ["in"]=0.00000021113587, -- ["mm"]=0.00000005362851, --- ["nc"]=0.00000119174467, --- ["nd"]=0.00001430093602, +-- --["nc"]=0.00000119174467, +-- --["nd"]=0.00001430093602, -- ["pc"]=0.00000127156576, -- ["pt"]=0.00001525878906, -- ["sp"]=1, @@ -128,8 +128,8 @@ function number.tobasepoints (n,fmt) return numbertodimen(n,"bp",fmt) end function number.topicas (n,fmt) return numbertodimen(n "pc",fmt) end function number.todidots (n,fmt) return numbertodimen(n,"dd",fmt) end function number.tociceros (n,fmt) return numbertodimen(n,"cc",fmt) end -function number.tonewdidots (n,fmt) return numbertodimen(n,"nd",fmt) end -function number.tonewciceros (n,fmt) return numbertodimen(n,"nc",fmt) end +-------- number.tonewdidots (n,fmt) return numbertodimen(n,"nd",fmt) end +-------- number.tonewciceros (n,fmt) return numbertodimen(n,"nc",fmt) end --[[ldx-- <p>More interesting it to implement a (sort of) dimen datatype, one diff --git a/tex/context/modules/mkiv/s-present-bars.mkiv b/tex/context/modules/mkiv/s-present-bars.mkiv index 13c09ff3b..37f18ffca 100644 --- a/tex/context/modules/mkiv/s-present-bars.mkiv +++ b/tex/context/modules/mkiv/s-present-bars.mkiv @@ -68,7 +68,7 @@ \setupheadertexts [Breskens 2012] - [\getvariable{document}{title}] + [\documentvariable{title}] \setupbackgrounds [page] @@ -99,9 +99,9 @@ \startsetups document:setup - \doifsomething {\getvariable{document}{color}} { + \doifsomething {\documentvariable{color}} { - \definecolor[maincolor][\getvariable{document}{color}] + \definecolor[maincolor][\documentvariable{color}] } diff --git a/tex/context/modules/mkiv/s-present-boring.mkiv b/tex/context/modules/mkiv/s-present-boring.mkiv new file mode 100644 index 000000000..334d6216d --- /dev/null +++ b/tex/context/modules/mkiv/s-present-boring.mkiv @@ -0,0 +1,143 @@ +%D \module +%D [ file=s-present-boring, % s-pre-15, +%D version=2020.07.10, +%D title=\CONTEXT\ Style File, +%D subtitle=Presentation Environment Boring, +%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 Because I use a mupdf based viewer and acrobat is not always reliable I nowadays +%D tend to go for simple presentation styles. They mostly serve as a reminder for +%D myself of what I'm supposed to talk about. Just demoing often makes more sense, +%D especially at meetings where there is some interaction. + +\startmodule[present-boring] + +\setupbodyfont + [plex] + +\setuppapersize + [S6] + +\setuplayout + [backspace=20pt, + topspace=20pt, + bottomspace=20pt, + header=0pt, + footer=0pt, + bottom=20pt, + bottomdistance=30pt, + width=middle, + height=fit] + +\definecolor[maincolor] [darkblue] +\definecolor[extracolor][darkyellow] +\definecolor[darkcolor] [darkgray] + +\setupbackgrounds + [page] + [backgroundoffset=10pt, + background=color, + backgroundcolor=darkcolor] + +\setupbackgrounds + [text] [text] + [backgroundoffset=10pt, + background=color, + backgroundcolor=maincolor] + +\setupbackgrounds + [bottom] [text] + [backgroundoffset=10pt, + background=color, + backgroundcolor=extracolor] + +\setupcolors + [textcolor=white] + +\setuphead + [chapter] + [style=\bfc, + after={\blank[line,fixed]}] + +\setupwhitespace + [halfline] + +\setupblank + [halfline,fixed] + +% \setupblank +% [fixed] + +\setuplinenumbering + [typing] + [style=\txx, + color=middlegray] + +\setuptyping + [numbering=line, + location=left, + blank=halfline] + +\startsetups document:start + + \startpagemakeup + \raggedcenter + \vfill + \dontleavehmode \scale [ + width=\textwidth + ] { + \space + {\bf \documentvariable{title}} + \space + } + \vfill + \dontleavehmode \scale [ + width=.8\textwidth + ] { + \space + {\bf \documentvariable{banner}} + \space + } + \vfill + \vfill + \dontleavehmode \scale [ + width=\textwidth + ] { + \qquad + \color[darkcolor]{\documentvariable{location}} + \qquad + } + \vfill + \stoppagemakeup + + \setupbottomtexts [ + { + \words { + \documentvariable{title} + \quad\emdash\quad + \documentvariable{location} + \quad\emdash\quad + \getmarking[title] + } + } + ] + +\stopsetups + +\startsetups document:stop + % +\stopsetups + +\stopmodule + +\continueifinputfile{s-present-boring.mkiv} + +\usemodule[present-common] + +\inputpresentationfile{context/2020/context-2020-tokens.tex} diff --git a/tex/context/modules/mkiv/s-present-tiles.mkiv b/tex/context/modules/mkiv/s-present-tiles.mkiv index 566a610a4..6026dd523 100644 --- a/tex/context/modules/mkiv/s-present-tiles.mkiv +++ b/tex/context/modules/mkiv/s-present-tiles.mkiv @@ -264,7 +264,7 @@ \startalignment[flushleft] \bf \setupinterlinespace - \begstrut\getvariable{document}{title}\endstrut\par + \begstrut\documentvariable{title}\endstrut\par \stopalignment \vfill @@ -272,7 +272,7 @@ \startalignment[flushright] \bf \setupinterlinespace - \begstrut\getvariable{document}{subtitle}\endstrut\par + \begstrut\documentvariable{subtitle}\endstrut\par \stopalignment \stoptopicmakeup diff --git a/tex/context/modules/mkiv/s-system-tokens.mkxl b/tex/context/modules/mkiv/s-system-tokens.mkxl index fd16bade6..3b32b0627 100644 --- a/tex/context/modules/mkiv/s-system-tokens.mkxl +++ b/tex/context/modules/mkiv/s-system-tokens.mkxl @@ -56,5 +56,30 @@ \stoptabulate \stopcolumns + \page + + Here is a typeset table of \type {\startframed} using \type {\luatokentable\startframed}: + + \luatokentable\startframed + + which calls \type {\pack_framed_start_framed} where \type {\luatokentable\pack_framed_start_framed} gives: + + + \unprotect + \luatokentable\pack_framed_start_framed + \protect + + So you can guess what generates this: + + \unprotect + \luatokentable\pack_framed_start_framed_nop + \protect + + And this: + + \unprotect + \luatokentable\pack_framed_start_framed_yes + \protect + \stoptext diff --git a/tex/context/sample/common/cuomo.tex b/tex/context/sample/common/cuomo.tex index 72da38b77..b4ab3f27a 100644 --- a/tex/context/sample/common/cuomo.tex +++ b/tex/context/sample/common/cuomo.tex @@ -1,5 +1,5 @@ -Yeah, my mother is not expandable. And your mother is not expendable. And our -brothers and sisters are not expandable. And we're not going to accept a premise +Yeah, my mother is not expendable. And your mother is not expendable. And our +brothers and sisters are not expendable. And we're not going to accept a premise that human life is disposable. And we're not going to put a dollar figure on human life. First order of business is: save lives. Period. Whatever it costs. Now, I also don't believe it's an either or. I believe you can have an diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 14380a7a3..90eadfd07 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2020-09-05 21:12 +-- merge date : 2020-09-15 18:07 do -- begin closure to overcome local limits and interference |