diff options
Diffstat (limited to 'Master/texmf-dist/doc/context/presentations/context')
21 files changed, 3617 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-concepts.pdf b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-concepts.pdf Binary files differnew file mode 100644 index 00000000000..913db5ef32b --- /dev/null +++ b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-concepts.pdf diff --git a/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-concepts.tex b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-concepts.tex new file mode 100644 index 00000000000..a472a33f462 --- /dev/null +++ b/Master/texmf-dist/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/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-datatypes.pdf b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-datatypes.pdf Binary files differnew file mode 100644 index 00000000000..906b1fe04d2 --- /dev/null +++ b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-datatypes.pdf diff --git a/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-datatypes.tex b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-datatypes.tex new file mode 100644 index 00000000000..590cdbf93e8 --- /dev/null +++ b/Master/texmf-dist/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/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-ecmascript.pdf b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-ecmascript.pdf Binary files differnew file mode 100644 index 00000000000..35764258c7b --- /dev/null +++ b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-ecmascript.pdf diff --git a/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-ecmascript.tex b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-ecmascript.tex new file mode 100644 index 00000000000..20877d63376 --- /dev/null +++ b/Master/texmf-dist/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/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-gpdemo.gp b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-gpdemo.gp new file mode 100644 index 00000000000..1f21ca57cf4 --- /dev/null +++ b/Master/texmf-dist/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/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-gpdemo.svg b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-gpdemo.svg new file mode 100644 index 00000000000..eb7d6de3c3a --- /dev/null +++ b/Master/texmf-dist/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/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-implementers.pdf b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-implementers.pdf Binary files differnew file mode 100644 index 00000000000..94c51513802 --- /dev/null +++ b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-implementers.pdf diff --git a/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-implementers.tex b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-implementers.tex new file mode 100644 index 00000000000..e1104dabf53 --- /dev/null +++ b/Master/texmf-dist/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/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-luametatex.pdf b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-luametatex.pdf Binary files differnew file mode 100644 index 00000000000..fcb906f8b82 --- /dev/null +++ b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-luametatex.pdf diff --git a/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-luametatex.tex b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-luametatex.tex new file mode 100644 index 00000000000..10b57660ea9 --- /dev/null +++ b/Master/texmf-dist/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/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-mkii-mkiv-mkxl.pdf b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-mkii-mkiv-mkxl.pdf Binary files differnew file mode 100644 index 00000000000..1932da3940a --- /dev/null +++ b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-mkii-mkiv-mkxl.pdf diff --git a/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-mkii-mkiv-mkxl.tex b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-mkii-mkiv-mkxl.tex new file mode 100644 index 00000000000..a0e119e755d --- /dev/null +++ b/Master/texmf-dist/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/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-mp.pdf b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-mp.pdf Binary files differnew file mode 100644 index 00000000000..a86dc2d71fa --- /dev/null +++ b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-mp.pdf diff --git a/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-mp.tex b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-mp.tex new file mode 100644 index 00000000000..6d2f640fb03 --- /dev/null +++ b/Master/texmf-dist/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/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-sin.svg b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-sin.svg new file mode 100644 index 00000000000..2d1f844386f --- /dev/null +++ b/Master/texmf-dist/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/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-svg.pdf b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-svg.pdf Binary files differnew file mode 100644 index 00000000000..39b0e00cb98 --- /dev/null +++ b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-svg.pdf diff --git a/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-svg.tex b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-svg.tex new file mode 100644 index 00000000000..3860438e8a6 --- /dev/null +++ b/Master/texmf-dist/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/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-tokens.pdf b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-tokens.pdf Binary files differnew file mode 100644 index 00000000000..c508d25ac24 --- /dev/null +++ b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-tokens.pdf diff --git a/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-tokens.tex b/Master/texmf-dist/doc/context/presentations/context/2020/context-2020-tokens.tex new file mode 100644 index 00000000000..b987e2d107a --- /dev/null +++ b/Master/texmf-dist/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 |