diff options
Diffstat (limited to 'tex')
56 files changed, 465 insertions, 292 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 054c99fe5..f3f004ad8 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2020.11.28 13:15} +\newcontextversion{2020.11.30 10:20} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index ef09b35d7..e4bc700cb 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2020.11.28 13:15} +\edef\contextversion{2020.11.30 10:20} %D For those who want to use this: diff --git a/tex/context/base/mkiv/char-tex.lua b/tex/context/base/mkiv/char-tex.lua index 4580ae40a..7f544b147 100644 --- a/tex/context/base/mkiv/char-tex.lua +++ b/tex/context/base/mkiv/char-tex.lua @@ -681,7 +681,7 @@ if not csletters then if isletter then texsetmacro(contextname,utfchar(u),"immutable") else - texsetchar(contextname,u) + texsetchar(contextname,u,"immutable") end else texsetmacro(contextname,utfchar(u),"immutable") diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 972672192..fe5504ffe 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2020.11.28 13:15} +\newcontextversion{2020.11.30 10:20} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 540d6ea74..46eab5afe 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.11.28 13:15} +\edef\contextversion{2020.11.30 10:20} %D Kind of special: diff --git a/tex/context/base/mkiv/math-ini.lua b/tex/context/base/mkiv/math-ini.lua index b5c4581b7..5475f6f73 100644 --- a/tex/context/base/mkiv/math-ini.lua +++ b/tex/context/base/mkiv/math-ini.lua @@ -97,9 +97,17 @@ local classes = allocate { root = 16, -- a private one } -local open_class = 4 -local middle_class = 4 -local close_class = 5 +local open_class = 4 +local middle_class = 4 +local close_class = 5 +local accent_class = 8 +local radical_class = 9 +local topaccent_class = 11 +local botaccent_class = 12 +local under_class = 13 +local over_class = 14 +local delimiter_class = 15 +local root_class = 16 local accents = allocate { accent = true, -- some can be both @@ -246,26 +254,55 @@ local f_char = formatters[ [[\defUmathchar \%s{%X}{%X}{%X}]] ] local texmathchardef = tex.mathchardef +-- local setmathsymbol = function(name,class,family,slot) -- hex is nicer for tracing +-- if class == classes.accent then +-- ctx_sprint(f_topaccent(name,0,family,slot)) +-- elseif class == classes.topaccent then +-- ctx_sprint(f_topaccent(name,0,family,slot)) +-- elseif class == classes.botaccent then +-- ctx_sprint(f_botaccent(name,0,family,slot)) +-- elseif class == classes.over then +-- ctx_sprint(f_over(name,0,family,slot)) +-- elseif class == classes.under then +-- ctx_sprint(f_under(name,0,family,slot)) +-- elseif class == open_class or class == close_class or class == middle_class then +-- setdelcode("global",slot,{family,slot,0,0}) +-- ctx_sprint(f_fence(name,class,family,slot)) +-- elseif class == classes.delimiter then +-- setdelcode("global",slot,{family,slot,0,0}) +-- ctx_sprint(f_delimiter(name,0,family,slot)) +-- elseif class == classes.radical then +-- ctx_sprint(f_radical(name,family,slot)) +-- elseif class == classes.root then +-- ctx_sprint(f_root(name,family,slot)) +-- elseif texmathchardef then +-- texmathchardef(name,class,family,slot,"permanent") +-- else +-- -- beware, open/close and other specials should not end up here +-- ctx_sprint(f_char(name,class,family,slot)) +-- end +-- end + local setmathsymbol = function(name,class,family,slot) -- hex is nicer for tracing - if class == classes.accent then + if class == accent_class then ctx_sprint(f_topaccent(name,0,family,slot)) - elseif class == classes.topaccent then + elseif class == topaccent_class then ctx_sprint(f_topaccent(name,0,family,slot)) - elseif class == classes.botaccent then + elseif class == botaccent_class then ctx_sprint(f_botaccent(name,0,family,slot)) - elseif class == classes.over then + elseif class == over_class then ctx_sprint(f_over(name,0,family,slot)) - elseif class == classes.under then + elseif class == under_class then ctx_sprint(f_under(name,0,family,slot)) elseif class == open_class or class == close_class or class == middle_class then setdelcode("global",slot,{family,slot,0,0}) ctx_sprint(f_fence(name,class,family,slot)) - elseif class == classes.delimiter then + elseif class == delimiter_class then setdelcode("global",slot,{family,slot,0,0}) ctx_sprint(f_delimiter(name,0,family,slot)) - elseif class == classes.radical then + elseif class == radical_class then ctx_sprint(f_radical(name,family,slot)) - elseif class == classes.root then + elseif class == root_class then ctx_sprint(f_root(name,family,slot)) elseif texmathchardef then texmathchardef(name,class,family,slot,"permanent") diff --git a/tex/context/base/mkiv/node-fnt.lua b/tex/context/base/mkiv/node-fnt.lua index dd40befc8..f3bb6228f 100644 --- a/tex/context/base/mkiv/node-fnt.lua +++ b/tex/context/base/mkiv/node-fnt.lua @@ -138,8 +138,8 @@ fonts.hashes.processes = fontprocesses -- inside a run which means that we need to keep track of this which in turn complicates matters -- in a way i don't like --- we need to deal with the basemode fonts here and can only run over ranges as we --- otherwise get luatex craches due to all kind of asserts in the disc/lig builder +-- we need to deal with the basemode fonts here and can only run over ranges as we otherwise get +-- luatex craches due to all kind of asserts in the disc/lig builder -- there is no gain in merging used (dynamic 0) and dynamics apart from a bit less code diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 5f0d5c4fa..dc575dca5 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 968ce190c..216c5f4c9 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/anch-pgr.mkxl b/tex/context/base/mkxl/anch-pgr.mkxl index d701fc14a..6b0fef441 100644 --- a/tex/context/base/mkxl/anch-pgr.mkxl +++ b/tex/context/base/mkxl/anch-pgr.mkxl @@ -97,22 +97,18 @@ \def\anch_positions_cleanup_action % not in trialtypesetting {\ifcsname\??positioncleanup\currentpositionaction\endcsname \the\everycleanpositionaction - \xdefcsname\??positioncleanup\currentpositionaction\endcsname - {\csname\??positioncleanup\currentpositionaction\endcsname}% + \xdefcsname\??positioncleanup\currentpositionaction\endcsname{\csname\??positioncleanup\currentpositionaction\endcsname}% \fi} \permanent\protected\def\handlepositionaction#1\with#2\on#3% ugly, will change {\begingroup - \edef\currentpositionanchor - {\ifempty\currentpositionoverlay#3\else\currentpositionoverlay::\MPanchoridentifier\fi}% - \normalexpanded{\anch_positions_set_action{\currentpositionanchor}{\noexpand\getvalue{\??positioncleanup\currentpositionanchor}}}% + \edef\currentpositionanchor{\ifempty\currentpositionoverlay#3\else\currentpositionoverlay::\MPanchoridentifier\fi}% + \normalexpanded{\anch_positions_set_action{\currentpositionanchor}{\noexpand\csname\??positioncleanup\currentpositionanchor\endcsname}}% \let#1\relax \ifcsname\??positioncleanup\currentpositionanchor\endcsname - \xdefcsname\??positioncleanup\currentpositionanchor\endcsname - {\csname\??positioncleanup\currentpositionanchor\endcsname#1#2}% + \xdefcsname\??positioncleanup\currentpositionanchor\endcsname{\csname\??positioncleanup\currentpositionanchor\endcsname#1#2}% \else - \xdefcsname\??positioncleanup\currentpositionanchor\endcsname - {#1#2}% + \xdefcsname\??positioncleanup\currentpositionanchor\endcsname{#1#2}% \fi \endgroup} @@ -345,18 +341,6 @@ \expandafter\gobbletwoarguments \fi{#1}{#2}} -% \unexpanded\def\MPpositiongraphic -% {\dodoublegroupempty\anch_positions_meta_graphic_direct} - -% \def\anch_positions_meta_graphic_direct#1% tag setups -% {\ifcsname\??positionmethod#1\endcsname % method -% \expandafter\anch_positions_meta_graphic_direct_indeed_method -% \else\ifcsname\??positiongraphic#1\endcsname -% \doubleexpandafter\anch_positions_meta_graphic_direct_indeed_normal -% \else -% \doubleexpandafter\anch_positions_meta_graphic_direct_indeed_unknown -% \fi\fi{#1}} - \def\anch_positions_meta_graphic_direct_method{\anch_positions_meta_graphic_direct\??positionmethod } \def\anch_positions_meta_graphic_direct_normal{\anch_positions_meta_graphic_direct\??positiongraphic} @@ -367,7 +351,7 @@ \anch_positions_meta_graphic_prepare \obeyMPboxorigin % do we also set the size ? when needed this must be done in mp ... might change \enforced\tolerant\protected\def\MPpositiongraphic##=##*##={\anch_positions_meta_graphic_nested{#3}{##1}{##2}}% takes two extra arguments -% \def\anch_positions_meta_graphic_direct{\anch_positions_meta_graphic_nested{#3}}% takes two extra arguments + % \def\anch_positions_meta_graphic_direct{\anch_positions_meta_graphic_nested{#3}}% takes two extra arguments \setbox\b_anch_positions_graphic\hbox % \hpack {\ignorespaces\begincsname#1#2\endcsname\removelastspace}% \smashbox\b_anch_positions_graphic diff --git a/tex/context/base/mkxl/anch-pos.mkxl b/tex/context/base/mkxl/anch-pos.mkxl index 6a2fbd5e1..3075a9ab6 100644 --- a/tex/context/base/mkxl/anch-pos.mkxl +++ b/tex/context/base/mkxl/anch-pos.mkxl @@ -46,6 +46,11 @@ \newbox\b_anch_position \newif \ifpositioning % sort of public +\mutable\let\currentposition \empty +\mutable\let\currentpositionaction\empty +\mutable\let\currentpositionanchor\empty +\mutable\let\currentpositionregion\empty + %D Sometimes we want to trick the position handler a bit: % \replacepospxywhd #1#2#3#4#5#6#7 % defined at lua end diff --git a/tex/context/base/mkxl/anch-tab.mkxl b/tex/context/base/mkxl/anch-tab.mkxl index 8f4bb0b5b..48e4ae4cb 100644 --- a/tex/context/base/mkxl/anch-tab.mkxl +++ b/tex/context/base/mkxl/anch-tab.mkxl @@ -84,7 +84,7 @@ \permanent\def\tbPOSprefix{\??positiontables\number\noftabpositions:} -\protected\def\tablepos +\permanent\protected\def\tablepos {\normalexpanded{\global\posXCtoks\emptytoks\the\posXCtoks}} \permanent\protected\def\tbXC {\anch_table_checked\anch_tables_indeed_XC } @@ -170,7 +170,7 @@ \aliased\let\tabulatepos\tablepos -\def\tabulatenormalpos +\permanent\protected\def\tabulatenormalpos {\iftrialtypesetting % nothing \orelse\ifconditional\tablehaspositions @@ -179,7 +179,7 @@ % nothing \fi} -\def\tabulateequalpos +\permanent\protected\def\tabulateequalpos {\iftrialtypesetting \tabulateEQ \orelse\ifconditional\tablehaspositions @@ -188,7 +188,7 @@ \tabulateEQ \fi} -\def\tabulateEQpos +\permanent\protected\def\tabulateEQpos {\setbox\scratchbox\hbox{\tabulateEQ}% \hbox to \wd\scratchbox{\hss\kern\zeropoint\tabulatepos\hss}% hpack \kern-\wd\scratchbox diff --git a/tex/context/base/mkxl/buff-par.mklx b/tex/context/base/mkxl/buff-par.mklx index 663ea7254..4b762ff04 100644 --- a/tex/context/base/mkxl/buff-par.mklx +++ b/tex/context/base/mkxl/buff-par.mklx @@ -131,6 +131,12 @@ \relax \endgroup} +\mutable\let\currentparallelinstance\empty +\mutable\let\currentparallelnumber \empty +\mutable\let\currentparallelline \empty +\mutable\let\currentparallellabel \empty +\mutable\let\currentparallelcontent \empty + \def\doflushparallel#instance#status#line#label#content% called at lua end {\begingroup \def\currentparallelinstance{#instance}% diff --git a/tex/context/base/mkxl/colo-ini.mkxl b/tex/context/base/mkxl/colo-ini.mkxl index e6ec0d103..cad33514b 100644 --- a/tex/context/base/mkxl/colo-ini.mkxl +++ b/tex/context/base/mkxl/colo-ini.mkxl @@ -759,7 +759,7 @@ % so far -\def\colo_helpers_activate#1% two-step is not that much faster but less tracing +\permanent\protected\def\colo_helpers_activate#1% two-step is not that much faster but less tracing {\edef\currentcolorname{#1}% \ifempty\currentcolorprefix %\expandafter @@ -796,7 +796,7 @@ \lastnamedcs \fi} -\let\dousecolorparameter\colo_helpers_activate +\aliased\let\dousecolorparameter\colo_helpers_activate \permanent\protected\def\dousecolorhashparameter#1#2% {\ifcsname#1#2\endcsname diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index f89d21f4a..f4ce10be5 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2020.11.28 13:15} +\newcontextversion{2020.11.30 10:20} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 3d5b46d49..613e650de 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2020.11.28 13:15} +\immutable\edef\contextversion{2020.11.30 10:20} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/core-sys.mkxl b/tex/context/base/mkxl/core-sys.mkxl index bcf216c0a..302cdaa99 100644 --- a/tex/context/base/mkxl/core-sys.mkxl +++ b/tex/context/base/mkxl/core-sys.mkxl @@ -192,7 +192,7 @@ \frozen\setuevalue {\currentstartstop}{\syst_startstop_indeed{\currentstartstop}}% \to \everydefinestartstop -\ifdefined\dotagconstruct \else \let\dotagconstruct\relax \fi +\ifdefined\dotagconstruct \else \aliased\let\dotagconstruct\relax \fi \protected\def\syst_startstop_start#1% {\namedstartstopparameter{#1}\c!before\relax @@ -244,7 +244,7 @@ \fi \to \everydefinehighlight -\ifdefined\dotaghighlight \else \let\dotaghighlight\relax \fi +\ifdefined\dotaghighlight \else \aliased\let\dotaghighlight\relax \fi \permanent\protected\def\typo_highlights_indeed#1% inline style/color switch {\dontleavehmode\groupedcommand % otherwise wrong par number in tags diff --git a/tex/context/base/mkxl/enco-ini.mkxl b/tex/context/base/mkxl/enco-ini.mkxl index 1f8a121d5..6dd800bf3 100644 --- a/tex/context/base/mkxl/enco-ini.mkxl +++ b/tex/context/base/mkxl/enco-ini.mkxl @@ -382,7 +382,9 @@ \permanent\protected\def\normalunderscore{\ifmmode\mathunderscore\else\textunderscore\fi} -\let\_\normalunderscore +\pushoverloadmode + \let\_\normalunderscore +\popoverloadmode %D To be sorted out: diff --git a/tex/context/base/mkxl/font-lib.mklx b/tex/context/base/mkxl/font-lib.mklx index 509e8ed86..780611148 100644 --- a/tex/context/base/mkxl/font-lib.mklx +++ b/tex/context/base/mkxl/font-lib.mklx @@ -159,8 +159,10 @@ \permanent\protected\def\typethreelast#1{\char#1\relax} \permanent\protected\def\typethreecode#1{\pdfliteral direct {#1}} -\newtoks\typethreetoks -\let \typethreemacro\empty +% This might change ... + +\newtoks \typethreetoks % used at the lua end +\mutable\let\typethreemacro\empty % used at the lua end \typethreetoks {% \setbox\zerocount\hpack{\typethreemacro}% diff --git a/tex/context/base/mkxl/grph-inc.mkxl b/tex/context/base/mkxl/grph-inc.mkxl index 21be4abf6..024db290e 100644 --- a/tex/context/base/mkxl/grph-inc.mkxl +++ b/tex/context/base/mkxl/grph-inc.mkxl @@ -40,7 +40,7 @@ %D moved from modules to the core. The overall functionality is rather stable and has %D not changed much over the years. -\ifdefined\dotagfigure \else \let\dotagfigure\relax \fi +\ifdefined\dotagfigure \else \aliased\let\dotagfigure\relax \fi \installcorenamespace{externalfigure} \installcorenamespace{externalfigureinstance} @@ -251,7 +251,7 @@ \newtoks\t_grph_include_local_settings \appendtoks - \let\textunderscore\letterunderscore % {\string _} % space needed as _ is now letter in unprotected mode (probably no longer needed) + \enforced\let\textunderscore\letterunderscore % {\string _} % space needed as _ is now letter in unprotected mode (probably no longer needed) % \dontcomplain \restorecatcodes diff --git a/tex/context/base/mkxl/grph-trf.mkxl b/tex/context/base/mkxl/grph-trf.mkxl index 3f5b3a4b0..87e4da7f4 100644 --- a/tex/context/base/mkxl/grph-trf.mkxl +++ b/tex/context/base/mkxl/grph-trf.mkxl @@ -67,10 +67,10 @@ % public: -\let\finalscaleboxxscale \!!plusone -\let\finalscaleboxyscale \!!plusone -\let\finalscaleboxwidth \!!zeropoint -\let\finalscaleboxheight \!!zeropoint +\mutable\let\finalscaleboxxscale \!!plusone +\mutable\let\finalscaleboxyscale \!!plusone +\mutable\let\finalscaleboxwidth \!!zeropoint +\mutable\let\finalscaleboxheight \!!zeropoint % we can let sx/sy win (first check) diff --git a/tex/context/base/mkxl/math-inc.mkxl b/tex/context/base/mkxl/math-inc.mkxl index c23684fd3..4db75e37e 100644 --- a/tex/context/base/mkxl/math-inc.mkxl +++ b/tex/context/base/mkxl/math-inc.mkxl @@ -40,23 +40,23 @@ \relax} \permanent\protected\def\xmlattachmml - {\iftrialtypesetting \else \ifexporting \iflocation + {\iftrialtypesetting\orelse\ifexporting\iflocation \dostarttagged\t!ignore\empty \lxml_add_mml_blob{mmlattachment}\attachment \dostoptagged - \fi \fi \fi} + \fi\fi} \permanent\protected\def\xmlcommentmml - {\iftrialtypesetting \else \ifexporting \iflocation + {\iftrialtypesetting\orelse\ifexporting\iflocation \dostarttagged\t!ignore\empty \lxml_add_mml_blob{mmlcomment}\comment \dostoptagged - \fi \fi \fi} + \fi\fi} %D This kind of feature creep is not yet configurable, nor documented. \permanent\protected\def\xmladdmmlsource - {\iftrialtypesetting \else \ifexporting \iflocation + {\iftrialtypesetting\orelse\ifexporting\iflocation \dostarttagged\t!ignore\empty \inleftmargin{% \lxml_add_mml_blob{mmlattachment}\attachment @@ -64,6 +64,6 @@ \lxml_add_mml_blob{mmlcomment}\comment }% \dostoptagged - \fi \fi \fi} + \fi\fi} \protect \endinput diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index 91946bcdb..d806af427 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -452,10 +452,10 @@ % no longer needed now we have enforce so the next few lines will go -\pushoverloadmode - \enforced\let\dotlessi\dotlessi - \enforced\let\dotlessj\dotlessj -\popoverloadmode +% \pushoverloadmode +% \enforced\let\dotlessi\dotlessi +% \enforced\let\dotlessj\dotlessj +% \popoverloadmode \permanent\protected\def\mathaltcalligraphic{\setmathfontalternate{calligraphic}\cal} % set via goody file \permanent\protected\def\mathaltitalic {\setmathfontalternate{italic}} % set via goody file diff --git a/tex/context/base/mkxl/node-fin.lmt b/tex/context/base/mkxl/node-fin.lmt index 6d29ed57f..dab90863a 100644 --- a/tex/context/base/mkxl/node-fin.lmt +++ b/tex/context/base/mkxl/node-fin.lmt @@ -634,6 +634,102 @@ end -- experimental +-- local function stacker(attribute,head,default) -- no triggering, no inheritance, but list-wise +-- +-- -- nsbegin() +-- local stacked = false +-- +-- local current = head +-- local previous = head +-- local attrib = default or unsetvalue +-- local check = false +-- local leader = false +-- +-- while current do +-- local id = getid(current) +-- if id == glyph_code then +-- check = true +-- elseif id == glue_code then +-- leader = getleader(current) +-- if leader then +-- check = true +-- end +-- elseif id == hlist_code or id == vlist_code then +-- local content = getlist(current) +-- if content then +-- local list +-- if nslistwise then +-- local a = getattr(current,attribute) +-- if a and attrib ~= a and nslistwise[a] then -- viewerlayer +-- head = insert_node_before(head,current,copy_node(nsdata[a])) +-- list = stacker(attribute,content,a) +-- if list ~= content then +-- setlist(current,list) +-- end +-- head, current = insert_node_after(head,current,copy_node(nsnone)) +-- else +-- list = stacker(attribute,content,attrib) +-- if list ~= content then +-- setlist(current,list) +-- end +-- end +-- else +-- list = stacker(attribute,content,default) +-- if list ~= content then +-- setlist(current,list) +-- end +-- end +-- end +-- elseif id == rule_code then +-- check = has_dimensions(current) +-- end +-- +-- if check then +-- local a = getattr(current,attribute) or unsetvalue +-- if a ~= attrib then +-- if not stacked then +-- stacked = true +-- nsbegin() +-- end +-- local n = nsstep(a) +-- if n then +-- head = insert_node_before(head,current,n) -- a +-- end +-- attrib = a +-- if leader then +-- -- tricky as a leader has to be a list so we cannot inject before +-- -- local list = stacker(attribute,leader,attrib) +-- -- leader = false +-- +-- local content = getlist(leader) +-- if content then +-- local list = stacker(attribute,leader,attrib) +-- if leader ~= list then +-- setleader(current,list) +-- end +-- end +-- +-- leader = false +-- end +-- end +-- check = false +-- end +-- +-- previous = current +-- current = getnext(current) +-- end +-- +-- if stacked then +-- local n = nsend() +-- while n do +-- head = insert_node_after(head,previous,n) +-- n = nsend() +-- end +-- end +-- +-- return head +-- end + local function stacker(attribute,head,default) -- no triggering, no inheritance, but list-wise -- nsbegin() @@ -645,43 +741,42 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance, local check = false local leader = false - while current do - local id = getid(current) + for current, id, subtype, content in nextcontent, head do if id == glyph_code then check = true elseif id == glue_code then - leader = getleader(current) - if leader then - check = true - end + leader = content + check = true elseif id == hlist_code or id == vlist_code then - local content = getlist(current) - if content then - local list - if nslistwise then - local a = getattr(current,attribute) - if a and attrib ~= a and nslistwise[a] then -- viewerlayer - head = insert_node_before(head,current,copy_node(nsdata[a])) - list = stacker(attribute,content,a) - if list ~= content then - setlist(current,list) - end - head, current = insert_node_after(head,current,copy_node(nsnone)) - else - list = stacker(attribute,content,attrib) - if list ~= content then - setlist(current,list) - end + local list + if nslistwise then + local a = getattr(current,attribute) + if a and attrib ~= a and nslistwise[a] then -- viewerlayer + head = insert_node_before(head,current,copy_node(nsdata[a])) + list = stacker(attribute,content,a) + if list ~= content then + setlist(current,list) end + head, current = insert_node_after(head,current,copy_node(nsnone)) else - list = stacker(attribute,content,default) + list = stacker(attribute,content,attrib) if list ~= content then setlist(current,list) end end + else + list = stacker(attribute,content,default) + if list ~= content then + setlist(current,list) + end end elseif id == rule_code then - check = has_dimensions(current) + if subtype == boxrule_code or subtype == imagerule_code or subtype == emptyrule_code then + -- so no redundant color stuff (only here, layers for instance should obey) + check = false + else + check = has_dimensions(current) + end end if check then @@ -716,7 +811,6 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance, end previous = current - current = getnext(current) end if stacked then diff --git a/tex/context/base/mkxl/pack-com.mkxl b/tex/context/base/mkxl/pack-com.mkxl index 21511f6b3..9b39bf900 100644 --- a/tex/context/base/mkxl/pack-com.mkxl +++ b/tex/context/base/mkxl/pack-com.mkxl @@ -67,7 +67,7 @@ %D \stopcombination %D \stoptyping -\ifdefined\dotagcombination \else \let\dotagcombination\relax \fi +\ifdefined\dotagcombination \else \aliased\let\dotagcombination\relax \fi \newsystemmode{combination} diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl index 8ca6c69d5..18a667dd6 100644 --- a/tex/context/base/mkxl/pack-rul.mkxl +++ b/tex/context/base/mkxl/pack-rul.mkxl @@ -53,9 +53,9 @@ \installcommandhandler \??framed {framed} \??framed -\let\pack_framed_framedparameter \framedparameter -\let\pack_framed_framedparameterhash\framedparameterhash -\let\pack_framed_setupcurrentframed \setupcurrentframed +\aliased\let\pack_framed_framedparameter \framedparameter +\aliased\let\pack_framed_framedparameterhash\framedparameterhash +\aliased\let\pack_framed_setupcurrentframed \setupcurrentframed \def\pack_framed_initialize {\enforced\let\framedparameter \pack_framed_framedparameter @@ -1657,23 +1657,6 @@ % \framed[width=2cm,align=middle,location=middle] {location\\equals\\middle} % B} -% \installframedlocator \v!hanging % best with strut=no -% {} -% {\dp\b_framed_normal\ht\b_framed_normal -% \ht\b_framed_normal\zeropoint} -% -% \installframedlocator \v!depth -% {} -% {\ht\b_framed_normal\dimexpr\ht\b_framed_normal-\strutdp\relax -% \dp\b_framed_normal\strutdp -% \box\b_framed_normal} -% -% \installframedlocator \v!height -% {} -% {\dp\b_framed_normal\dimexpr\ht\b_framed_normal-\strutht\relax -% \ht\b_framed_normal\strutht -% \box\b_framed_normal} - \installframedlocator \v!hanging % best with strut=no *1* / see mail to list by SB {} {\scratchdimen\ht\b_framed_normal @@ -2623,9 +2606,9 @@ \c!margin=\v!standard] \appendtoks - \frozen\instance\setuevalue{\e!start\currentframedtext}{\pack_framed_text_start {\currentframedtext}}% - \frozen\instance\setuevalue{\e!stop \currentframedtext}{\pack_framed_text_stop }% - \frozen\instance\setuevalue {\currentframedtext}{\pack_framed_text_direct[\currentframedtext]}% + \frozen\instance\protected\edefcsname\e!start\currentframedtext\endcsname{\pack_framed_text_start [\currentframedtext]}% + \frozen\instance\protected\edefcsname\e!stop \currentframedtext\endcsname{\pack_framed_text_stop }% + \frozen\instance\protected\edefcsname \currentframedtext\endcsname{\pack_framed_text_direct[\currentframedtext]}% \to \everydefineframedtext \setvalue{\??framedtextlocation\v!left }{\letframedtextparameter\c!left \relax @@ -2641,15 +2624,12 @@ \letframedtextparameter\c!right\relax \settrue\c_framed_text_location_none} -\protected\def\pack_framed_text_start#1% +\tolerant\protected\def\pack_framed_text_start[#1]#*[#2]#*[#3]% or #1#*[#2]#*[#3]% and pass {#1} {\bgroup - \edef\currentframedtext{#1}% - \dodoubleempty\pack_framed_text_start_indeed} - -\def\pack_framed_text_start_indeed[#1][#2]% - {\doifelseassignment{#1} - {\pack_framed_text_start_continue\empty{#1}} - {\pack_framed_text_start_continue{#1}{#2}}} + \edef\currentframedtext{#1} + \doifelseassignment{#2} + {\pack_framed_text_start_continue\empty{#2}} + {\pack_framed_text_start_continue{#2}{#3}}} % todo: sort out first/lastline ht/dp @@ -2779,7 +2759,7 @@ {\bgroup \edef\currentframedtext{#1}% \usebodyfontparameter\framedtextparameter - \setupcurrentframedtext[#1]% + \setupcurrentframedtext[#2]% \edef\p_framed_text_strut{\framedtextparameter\c!strut}% \letframedtextparameter\c!strut\v!no \inheritedframedtextframed\bgroup diff --git a/tex/context/base/mkxl/page-ffl.mkxl b/tex/context/base/mkxl/page-ffl.mkxl index 4bf685265..de016fdf6 100644 --- a/tex/context/base/mkxl/page-ffl.mkxl +++ b/tex/context/base/mkxl/page-ffl.mkxl @@ -106,7 +106,7 @@ \fi \fi} -\def\strc_floats_facing_flush_indeed +\permanent\protected\def\strc_floats_facing_flush_indeed {\global\advance\c_strc_floats_facing_flushed\plusone \floatingpenalty\zerocount \insert\namedinsertionnumber\s!topfloat\bgroup @@ -128,7 +128,7 @@ \resetboxesincache{\currentfacingfloat}% \fi} -\let\flushfacingfloats\strc_floats_facing_flush +\aliased\let\flushfacingfloats\strc_floats_facing_flush \protected\def\strc_floats_facing_setup {\edef\currentfacingfloat{\currentfacingfloat:\m_strc_floats_state}% diff --git a/tex/context/base/mkxl/page-flt.mkxl b/tex/context/base/mkxl/page-flt.mkxl index 55c6b177f..b6049833e 100644 --- a/tex/context/base/mkxl/page-flt.mkxl +++ b/tex/context/base/mkxl/page-flt.mkxl @@ -182,6 +182,11 @@ % % \placefloatwithsetups[somefigure]{}{\externalfigure[dummy][width=5cm,height=2cm]} +\mutable\let\floatsetupcaption\empty +\mutable\let\floatsetupcontent\empty +\mutable\let\floatsetupwidth \empty +\mutable\let\floatsetupheight \empty + \permanent\tolerant\protected\def\placefloatwithsetups[#1]#*[#2]#*[#3]#:#4% {\def\floatsetupcaption{#4}% \def\floatsetupcontent{\copy\nextbox}% diff --git a/tex/context/base/mkxl/page-ini.mkxl b/tex/context/base/mkxl/page-ini.mkxl index 481e5abd5..e78f759a8 100644 --- a/tex/context/base/mkxl/page-ini.mkxl +++ b/tex/context/base/mkxl/page-ini.mkxl @@ -189,7 +189,7 @@ \def\page_otr_add_special_content {\dowithnextboxcs\page_otr_add_special_content_indeed\hbox} -\def\page_otr_add_special_content_indeed +\permanent\protected\def\page_otr_add_special_content_indeed {\wd\nextbox\zeropoint \ht\nextbox\zeropoint \dp\nextbox\zeropoint @@ -197,9 +197,9 @@ {%\hskip-\maxdimen % not here, fails in acrobat (clips) \box\b_page_otr_special\box\nextbox}}% was \unhbox, is now box again -\let\flushatshipout\page_otr_add_special_content +\aliased\let\flushatshipout\page_otr_add_special_content % this might go away -\maxdeadcycles=1000 +\maxdeadcycles\plusthousand \newtoks\afterpage \newtoks\aftereverypage \newtoks\beforepage \newtoks\beforeeverypage diff --git a/tex/context/base/mkxl/page-lay.mkxl b/tex/context/base/mkxl/page-lay.mkxl index 9c84844bf..6cd0d9579 100644 --- a/tex/context/base/mkxl/page-lay.mkxl +++ b/tex/context/base/mkxl/page-lay.mkxl @@ -1229,9 +1229,9 @@ \def\swapmargins % name will change, frozen? {\doifelsemarginswap\relax\doswapmargins} -\def\doswapmargins % name will change, frozen? - {\let\swapmargins \relax % to prevent local swapping - \let\doswapmargins\relax % to prevent local swapping +\permanent\protected\def\doswapmargins + {\enforced\let\swapmargins \relax % to prevent local swapping + \enforced\let\doswapmargins\relax % to prevent local swapping \the\everyswapmargins} \permanent\def\rightorleftpageaction diff --git a/tex/context/base/mkxl/page-one.mkxl b/tex/context/base/mkxl/page-one.mkxl index 3e7d3e2a8..2169c6018 100644 --- a/tex/context/base/mkxl/page-one.mkxl +++ b/tex/context/base/mkxl/page-one.mkxl @@ -608,7 +608,7 @@ \nonoindentation \fi}} -\def\floatautofactor{.5} +\mutable\def\floatautofactor{.5} \def\page_one_place_float_auto_top_bottom {\ifx\floatmethod\v!auto diff --git a/tex/context/base/mkxl/publ-inc.mkxl b/tex/context/base/mkxl/publ-inc.mkxl index 8e6cd2bdf..9beae595f 100644 --- a/tex/context/base/mkxl/publ-inc.mkxl +++ b/tex/context/base/mkxl/publ-inc.mkxl @@ -33,23 +33,23 @@ \relax} \permanent\protected\def\btxattach - {\iftrialtypesetting \else \ifexporting \iflocation + {\iftrialtypesetting\orelse\ifexporting\iflocation \dostarttagged\t!ignore\empty \btx_add_blob{btxattachment}\attachment \dostoptagged - \fi \fi \fi} + \fi\fi} \permanent\protected\def\btxcomment - {\iftrialtypesetting \else \ifexporting \iflocation + {\iftrialtypesetting\orelse\ifexporting\iflocation \dostarttagged\t!ignore\empty \btx_add_blob{btxcomment}\comment \dostoptagged - \fi \fi \fi} + \fi\fi} %D This kind of feature creep is not yet configurable, nor documented. \permanent\protected\def\btxaddsource - {\iftrialtypesetting \else \ifexporting \iflocation + {\iftrialtypesetting\orelse\ifexporting\iflocation \dostarttagged\t!ignore\empty \llap{% \btx_add_blob{btxattachment}\attachment @@ -58,6 +58,6 @@ \hskip\leftmargindistance }% \dostoptagged - \fi \fi \fi} + \fi\fi} \protect \endinput diff --git a/tex/context/base/mkxl/spac-ali.mkxl b/tex/context/base/mkxl/spac-ali.mkxl index d72371659..d0530d138 100644 --- a/tex/context/base/mkxl/spac-ali.mkxl +++ b/tex/context/base/mkxl/spac-ali.mkxl @@ -583,7 +583,7 @@ \expandafter\let\expandafter\updateraggedskips\csname\??alignmentraggedcache\m_spac_align_asked\endcsname \fi} -\let\dosetraggedcommand\spac_align_prepare % sort of public +\aliased\let\dosetraggedcommand\spac_align_prepare % sort of public % The regular align setter: diff --git a/tex/context/base/mkxl/strc-con.mklx b/tex/context/base/mkxl/strc-con.mklx index 21213a330..ddaa9e570 100644 --- a/tex/context/base/mkxl/strc-con.mklx +++ b/tex/context/base/mkxl/strc-con.mklx @@ -206,7 +206,7 @@ %D Also, passing the title as argument has some history so we need to keep that as %D well. -% \ifdefined\dotagsetconstruction \else \let\dotagsetconstruction\relax \fi +% \ifdefined\dotagsetconstruction \else \aliased\let\dotagsetconstruction\relax \fi % \startuseMPgraphic{MyFrame} % picture p ; numeric o ; path a, b ; pair c ; diff --git a/tex/context/base/mkxl/strc-flt.mklx b/tex/context/base/mkxl/strc-flt.mklx index 31622a336..d2a1551d9 100644 --- a/tex/context/base/mkxl/strc-flt.mklx +++ b/tex/context/base/mkxl/strc-flt.mklx @@ -321,8 +321,12 @@ %D Captions. -\let\floatcaptionsuffix\empty % an optional suffix -\let\floatcaptionnumber\empty % a logical counter +\mutable\let\floatcaptionarrangement\empty +\mutable\let\floatcaptionattribute \empty +\mutable\let\floatcaptiondirectives \empty +\mutable\let\floatcaptionlocation \empty +\mutable\let\floatcaptionnumber \empty +\mutable\let\floatcaptionsuffix \empty % For a while these were placeholders: % @@ -601,11 +605,11 @@ % place -\let\floatlabel \empty -\let\floatcolumn \empty -\let\floatrow \empty -\let\floatlocation \empty -\let\floatlocationmethod\empty +\mutable\let\floatlabel \empty +\mutable\let\floatcolumn \empty +\mutable\let\floatrow \empty +\mutable\let\floatlocation \empty +\mutable\let\floatlocationmethod\empty \def\strc_floats_analyze_location {% more will be moved here @@ -624,7 +628,7 @@ \setupfloat[\c!spacebefore=\v!none,\c!spaceafter=\v!none]% \to \c_floats_every_table_float -\ifdefined\dotagregisterfloat \else \let\dotagregisterfloat\gobbletwoarguments \fi +\ifdefined\dotagregisterfloat \else \aliased\let\dotagregisterfloat\gobbletwoarguments \fi \tolerant\def\strc_floats_place[#tag]#spacer[#location]#spacer[#reference]#:#caption% {\strc_floats_set_current_tag{#tag}% @@ -774,7 +778,7 @@ \ifdefined\page_margin_strc_floats_before \else \let\page_margin_strc_floats_before \relax \fi \ifdefined\page_margin_strc_floats_set_hsize \else \let\page_margin_strc_floats_set_hsize\relax \fi -\def\flushfloatslist +\immutable\def\flushfloatslist {\v!left,\v!right,\v!inner,\v!outer,% \v!backspace,\v!cutspace,% \v!inleft,\v!inright,\v!inmargin,% @@ -1266,12 +1270,13 @@ \permanent\protected\def\hangsidefloat[#number]% {\global\c_page_sides_n_of_lines#number\relax} +\mutable\let\extrafloatlocation\empty + \def\strc_floats_set_extra_action#rightpagelocation#leftpagelocation% {\rightorleftpageaction {\let\extrafloatlocation#rightpagelocation}% {\let\extrafloatlocation#leftpagelocation}} -\let\extrafloatlocation\empty \installcorenamespace{extrafloataction} @@ -2419,11 +2424,13 @@ \installcorenamespace{floatmethods} -\let\floatmethod \empty % set by lua -\let\floatlabel \empty % set by lua -\let\floatcolumn \empty % set by lua -\let\floatrow \empty % set by lua -\let\forcedfloatmethod\empty % set by lua and floatcombinations +\mutable\let\floatmethod \empty % set by lua +\mutable\let\floatlabel \empty % set by lua +\mutable\let\floatcolumn \empty % set by lua +\mutable\let\floatrow \empty % set by lua +\mutable\let\floatspecification\empty + +\mutable\let\forcedfloatmethod \empty % set by lua and floatcombinations \permanent\protected\def\setfloatmethodvariables#1% \floatmethod \floatlabel \floatrow \floatcolumn {\clf_analysefloatmethod{#1}} % move definition to lua end @@ -2433,14 +2440,6 @@ \def\strc_floats_get_box {\ifvisible -% \let\floatlabel \empty -% \let\floatcolumn\empty -% \let\floatrow \empty -% \setfloatmethodvariables\floatlocation - % todo: nog algemeen otr -% \ifdefined\OTRSETsetpreferedcolumnslot -% \OTRSETsetpreferedcolumnslot\floatcolumn\floatrow -% \fi \ifcsname\??floatmethods\currentoutputroutine:\floatmethod\endcsname \else \let\floatmethod\v!here \fi diff --git a/tex/context/base/mkxl/strc-itm.mklx b/tex/context/base/mkxl/strc-itm.mklx index e2f2244a5..33d5c324d 100644 --- a/tex/context/base/mkxl/strc-itm.mklx +++ b/tex/context/base/mkxl/strc-itm.mklx @@ -530,8 +530,8 @@ \lastnamedcs \fi} -\ifdefined\dotagsetitemgroup \else \let\dotagsetitemgroup\relax \fi -\ifdefined\dotagsetitem \else \let\dotagsetitem \gobbleoneargument \fi +\ifdefined\dotagsetitemgroup \else \aliased\let\dotagsetitemgroup\relax \fi +\ifdefined\dotagsetitem \else \aliased\let\dotagsetitem \gobbleoneargument \fi \def\strc_itemgroups_tag_start_group {\dostarttaggedchained\t!itemgroup\currentparentitemgroup\??itemgroup diff --git a/tex/context/base/mkxl/strc-lst.mklx b/tex/context/base/mkxl/strc-lst.mklx index df2eb6e0f..0b8c2e2a3 100644 --- a/tex/context/base/mkxl/strc-lst.mklx +++ b/tex/context/base/mkxl/strc-lst.mklx @@ -495,7 +495,7 @@ \permanent\def\usestructurelistprocessor#tag% {\csname\??structurelistprocessor#tag\endcsname} -\let\dotaglistlocation\relax +\aliased\let\dotaglistlocation\relax \def\strc_lists_entry_process_default {no list method} @@ -1097,10 +1097,10 @@ \hangindent\dimexpr\wd\b_strc_lists_number+\scratchdistance\relax \hangafter\ifx\p_hang\v!no\zerocount\else\plusone\fi \scratchdimen\listalternativeparameter\c!distance\relax - \ifzeropt\wd\b_strc_lists_page \else \ifdim\scratchdimen>\zeropoint\relax + \ifzeropt\wd\b_strc_lists_page\orelse\ifdim\scratchdimen>\zeropoint\relax \rightskip\scratchdimen\s!plus\listalternativeparameter\c!stretch\relax \parfillskip-\rightskip - \fi \fi + \fi \else \scratchdistance\zeropoint \fi diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl index 991c3202e..f69422edc 100644 --- a/tex/context/base/mkxl/strc-mat.mkxl +++ b/tex/context/base/mkxl/strc-mat.mkxl @@ -935,7 +935,7 @@ \newcount\c_strc_formulas_n -\ifdefined\dotagregisterformula \else \let\dotagregisterformula\gobbleoneargument \fi +\ifdefined\dotagregisterformula \else \aliased\let\dotagregisterformula\gobbleoneargument \fi \protected\def\strc_formulas_stop_formula {\strc_formulas_place_number % in case it hasn't happened yet @@ -1194,8 +1194,9 @@ % \startplaceformula[title=whatever] \startformula e=mc^2 \stopformula \stopplaceformula % \startplaceformula[suffix=x] \startformula e=mc^2 \stopformula \stopplaceformula -\let\currentplaceformulareference\empty -\let\currentplaceformulasuffix \empty +\mutable\let\currentplaceformulatitle \empty +\mutable\let\currentplaceformulareference\empty +\mutable\let\currentplaceformulasuffix \empty \permanent\tolerant\protected\def\startplaceformula[#1]% {\begingroup diff --git a/tex/context/base/mkxl/strc-not.mklx b/tex/context/base/mkxl/strc-not.mklx index c07cd2085..cc5455bc6 100644 --- a/tex/context/base/mkxl/strc-not.mklx +++ b/tex/context/base/mkxl/strc-not.mklx @@ -21,8 +21,8 @@ % todo: more p_strc_notations_* (outside trial loop) % todo: see if we can now use \insertpenalties (>0 == some left) -\ifdefined\dotagsetnotesymbol \else \let\dotagsetnotesymbol\relax \fi -\ifdefined\dotagsetnotation \else \let\dotagsetnotation \relax \fi +\ifdefined\dotagsetnotesymbol \else \aliased\let\dotagsetnotesymbol\relax \fi +\ifdefined\dotagsetnotation \else \aliased\let\dotagsetnotation \relax \fi \permanent\protected\def\unvboxed {\ifvmode\unvbox \else\box \fi} % will change or used more often \permanent\protected\def\unvcopied{\ifvmode\unvcopy\else\copy\fi} % will change or used more often diff --git a/tex/context/base/mkxl/strc-num.mkxl b/tex/context/base/mkxl/strc-num.mkxl index f5adcf09a..8cf6039b1 100644 --- a/tex/context/base/mkxl/strc-num.mkxl +++ b/tex/context/base/mkxl/strc-num.mkxl @@ -353,7 +353,6 @@ \aliased\let \convertednumber \convertedcounter % [name] \aliased\let \doifdefinednumber \doifdefinedcounter % {number}{true} -\aliased\let \doifundefinednumber \doifnotdefinedcounter % {number}{true} \aliased\let \doifelsedefinednumber \doifelsedefinedcounter % {number}{true}{false} \aliased\let \doifdefinednumberelse \doifelsedefinedcounter % {number}{true}{false} diff --git a/tex/context/base/mkxl/strc-ref.mklx b/tex/context/base/mkxl/strc-ref.mklx index 10100fa03..758f2855f 100644 --- a/tex/context/base/mkxl/strc-ref.mklx +++ b/tex/context/base/mkxl/strc-ref.mklx @@ -75,12 +75,12 @@ \mutable\let\currentreferenceformattype \empty \mutable\let\currentreferencekind \empty \mutable\let\currentreferencelabels \empty -\mutable\let\currentreferencenumber \empty +%mutable\let\currentreferencenumber \empty \mutable\let\currentreferenceorder \empty -\mutable\let\currentreferencepage \empty -\mutable\let\currentreferencerealpage \empty -\mutable\let\currentreferencetext \empty -\mutable\let\currentreferencetitle \empty +%mutable\let\currentreferencepage \empty +%mutable\let\currentreferencerealpage \empty +%mutable\let\currentreferencetext \empty +%mutable\let\currentreferencetitle \empty \mutable\let\currentreferenceuserdata \empty @@ -572,12 +572,11 @@ %D %D We also use the odd/even characteristic to determine the page state. -\let\currentrealreference \empty -\let\currentpagereference \empty -\let\currenttextreference \empty -\let\currentreferenceorder \empty -\let\currentsubtextreference \empty -\let\currentsubsubtextreference\empty +\mutable\let\currentrealreference \empty +\mutable\let\currentpagereference \empty +\mutable\let\currenttextreference \empty +\mutable\let\currentsubtextreference \empty +\mutable\let\currentsubsubtextreference\empty \newcount\referencehastexstate % set in backend @@ -973,22 +972,24 @@ %D active (and when asked for, typeset in a different color and typeface). \appendtoks - \ifdefined\in \let\normalmathin \in \protected\def\in {\mathortext\normalmathin \strc_references_in } \else \let\in \strc_references_in \fi - \ifdefined\at \let\normalmathat \at \protected\def\at {\mathortext\normalmathat \strc_references_at } \else \let\at \strc_references_at \fi - \ifdefined\about \let\normalmathabout\about \protected\def\about{\mathortext\normalmathabout\strc_references_about} \else \let\about\strc_references_about \fi - \ifdefined\from \let\normalmathfrom \from \protected\def\from {\mathortext\normalmathfrom \strc_references_from } \else \let\from \strc_references_from \fi - \ifdefined\over \let\normalmathover \over \protected\def\over {\mathortext\normalmathover \strc_references_about} \else \let\over \strc_references_about \fi + % likely math + \ifdefined\in \aliased\let\normalmathin \in \permanent\protected\def\in {\mathortext\normalmathin \strc_references_in } \else \aliased\let\in \strc_references_in \fi + \ifdefined\over \aliased\let\normalmathover \over \permanent\protected\def\over {\mathortext\normalmathover \strc_references_about} \else \aliased\let\over \strc_references_about \fi + % + \ifdefined\at \aliased\let\normalmathat \at \permanent\protected\def\at {\mathortext\normalmathat \strc_references_at } \else \aliased\let\at \strc_references_at \fi + \ifdefined\about \aliased\let\normalmathabout\about \permanent\protected\def\about{\mathortext\normalmathabout\strc_references_about} \else \aliased\let\about\strc_references_about \fi + \ifdefined\from \aliased\let\normalmathfrom \from \permanent\protected\def\from {\mathortext\normalmathfrom \strc_references_from } \else \aliased\let\from \strc_references_from \fi \to \everydump \permanent \def\filterreference #key{\clf_filterreference{#key}} % no checking, expandable \permanent\protected\def\getreferenceentry#key{\clf_filterreference{#key}} % no checking, not expandable -\def\currentreferencenumber {\clf_filterreference{number}} -\def\currentreferencepage {\clf_filterreference{page}} -\def\currentreferencetitle {\clf_filterreference{title}} -\def\currentreferencetext {\clf_filterreference{text}} -\def\currentreferencedefault {\clf_filterreference{default}} -\def\currentreferencerealpage{\clf_filterreference{realpage}} +\permanent\def\currentreferencenumber {\clf_filterreference{number}} +\permanent\def\currentreferencepage {\clf_filterreference{page}} +\permanent\def\currentreferencetitle {\clf_filterreference{title}} +\permanent\def\currentreferencetext {\clf_filterreference{text}} +%permanent\def\currentreferencedefault {\clf_filterreference{default}} +\permanent\def\currentreferencerealpage{\clf_filterreference{realpage}} %D The most straightforward way of retrieving references is using \type {\ref}. @@ -1003,7 +1004,7 @@ %D Special cases: -\protected\def\strc_references_about[#label]% +\permanent\protected\def\strc_references_about[#label]% {\dontleavehmode \begingroup \enforced\let\crlf\space @@ -1284,12 +1285,12 @@ \goto{\referencesequence}[#3]}% \strc_references_stop_goto} -\protected\def\strc_references_in +\permanent\protected\def\strc_references_in {\strc_references_start_goto \let\currentreferencecontent\currentreferencedefault \strc_references_pickup_goto} -\protected\def\strc_references_at +\permanent\protected\def\strc_references_at {\strc_references_start_goto \let\currentreferencecontent\currentreferencepage \strc_references_pickup_goto} diff --git a/tex/context/base/mkxl/strc-reg.mkxl b/tex/context/base/mkxl/strc-reg.mkxl index 38ecae4a7..af98ca481 100644 --- a/tex/context/base/mkxl/strc-reg.mkxl +++ b/tex/context/base/mkxl/strc-reg.mkxl @@ -371,7 +371,7 @@ \dostoptagged \endgroup} -\let\dotagregisterlocation\relax % experiment +\aliased\let\dotagregisterlocation\relax % experiment \tolerant\protected\def\strc_registers_insert_entry[#1]#*[#2]% {\def\currentregister{#1}% diff --git a/tex/context/base/mkxl/strc-ren.mkxl b/tex/context/base/mkxl/strc-ren.mkxl index 2d553964b..d0baacb04 100644 --- a/tex/context/base/mkxl/strc-ren.mkxl +++ b/tex/context/base/mkxl/strc-ren.mkxl @@ -89,11 +89,11 @@ \fi} \permanent\def\setinlineheadreferenceattributes - {\ifconditional\headisdisplay \else \iflocation + {\ifconditional\headisdisplay\orelse\iflocation \c_attr_destination\currentstructureattribute \c_attr_reference \currentstructurereferenceattribute % \c_attr_internal \locationcount - \fi \fi} + \fi} \permanent\protected\def\docheckheadreference {\edef\currentheadinteraction{\headparameter\c!interaction}% diff --git a/tex/context/base/mkxl/strc-syn.mkxl b/tex/context/base/mkxl/strc-syn.mkxl index 6f2f255d5..13147a99f 100644 --- a/tex/context/base/mkxl/strc-syn.mkxl +++ b/tex/context/base/mkxl/strc-syn.mkxl @@ -184,7 +184,7 @@ \settrue\c_strc_constructions_define_commands \to \everydefinesimplelist -\setuvalue{\??constructioninitializer\v!simplelist}% +\protected\defcsname\??constructioninitializer\v!simplelist\endcsname {\let \currentsimplelist \currentconstruction \enforced\let\constructionparameter \simplelistparameter \enforced\let\constructionnamespace \??simplelist @@ -193,10 +193,10 @@ \enforced\let\useconstructionstyleandcolor \usesimpleliststyleandcolor \enforced\let\setupcurrentconstruction \setupcurrentsimplelist} -\setuvalue{\??constructionfinalizer\v!simplelist}% +\protected\defcsname\??constructionfinalizer\v!simplelist\endcsname {} -\setuvalue{\??constructiontexthandler\v!simplelist}% +\protected\defcsname\??constructiontexthandler\v!simplelist\endcsname {\begingroup \useconstructionstyleandcolor\c!headstyle\c!headcolor \the\everyconstruction @@ -207,8 +207,8 @@ % And we build on top of this. -\ifdefined\dotagsynonym \else \let\dotagsynonym\relax \fi -\ifdefined\dotagsorting \else \let\dotagsorting\relax \fi +\ifdefined\dotagsynonym \else \aliased\let\dotagsynonym\relax \fi +\ifdefined\dotagsorting \else \aliased\let\dotagsorting\relax \fi \definesimplelist [\v!synonym] @@ -233,12 +233,21 @@ \aliased\let\setupsynonyms\setupsimplelist +% these might become private + +\mutable\let\currentsynonymoption \empty +\mutable\let\currentsynonymcoding \empty +\mutable\let\currentsynonymexpansion\empty +\mutable\let\currentsynonym \empty +\mutable\let\currentsynonymtag \empty +\mutable\let\currentsynonymtext \empty + \permanent\tolerant\protected\def\definesynonyms[#1]#*[#2]#*[#3]#*[#4]% name plural \meaning \use {\ifnum\lastarguments=\plusfour \protected\instance\def#4##1{\strc_synonyms_insert{#1}{##1}}% name tag - \frozen\instance\setuvalue{#1}{\definesynonym[\v!no][#1]}% \name + \frozen\instance\protected\defcsname#1\endcsname{\definesynonym[\v!no][#1]}% \name \else - \frozen\instance\setuvalue{#1}{\definesynonym[\v!yes][#1]}% \name + \frozen\instance\protected\defcsname#1\endcsname{\definesynonym[\v!yes][#1]}% \name \fi \ifparameter#3\or \frozen\instance\protected\def#3##1{\strc_synonyms_insert_meaning{#1}{##1}}% \meaning @@ -260,9 +269,9 @@ % % These will go away. Actually the overloads catched this empty case! % - \frozen\instance\setuvalue{\e!setup #2\e!endsetup}{\setupsynonyms[#1]}% obsolete definition - \frozen\instance\setuvalue{\e!place \e!listof#2}{\placelistofsynonyms[#1]}% accepts extra argument - \frozen\instance\setuvalue{\e!complete\e!listof#2}{\completelistofsynonyms[#1]}% + \frozen\instance\protected\defcsname\e!setup #2\e!endsetup\endcsname{\setupsynonyms[#1]}% obsolete definition + \frozen\instance\protected\defcsname\e!place \e!listof#2\endcsname{\placelistofsynonyms[#1]}% accepts extra argument + \frozen\instance\protected\defcsname\e!complete\e!listof#2\endcsname{\completelistofsynonyms[#1]}% \fi} \permanent\tolerant\protected\def\definesynonym[#1]#*[#2]#*[#3]% @@ -467,15 +476,24 @@ % if #3=\relax or \v!none, then no command but still protected +% these might become private + +\mutable\let\currentsortingoption \empty +\mutable\let\currentsortingcoding \empty +\mutable\let\currentsortingexpansion\empty +\mutable\let\currentsorting \empty +\mutable\let\currentsortingtag \empty +\mutable\let\currentsortingtext \empty + \permanent\tolerant\protected\def\definesorting[#1]#*[#2]#*[#3]% {\ifnum\lastarguments=\plusthree \doifnot{#3}\v!none {\ifx#3\relax \else \protected\instance\def#3##1{\strc_sorting_insert{#1}{##1}}% \fi}% - \frozen\instance\setuvalue{#1}{\definesort[\v!no][#1]}% + \frozen\instance\protected\defcsname#1\endcsname{\definesort[\v!no][#1]}% \else - \frozen\instance\setuvalue{#1}{\definesort[\v!yes][#1]}% + \frozen\instance\protected\defcsname#1\endcsname{\definesort[\v!yes][#1]}% \fi \edef\currentsorting{#1}% \setfalse\c_strc_constructions_define_commands @@ -494,9 +512,9 @@ % \presetheadtext[#2=\Word{#2}]% % - \frozen\instance\setuvalue{\e!setup #2\e!endsetup}{\setupsorting[#1]}% obsolete definition - \frozen\instance\setuvalue{\e!place \e!listof#2}{\placelistofsorts[#1]}% - \frozen\instance\setuvalue{\e!complete\e!listof#2}{\completelistofsorts[#1]}% + \frozen\instance\protected\defcsname\e!setup #2\e!endsetup\endcsname{\setupsorting[#1]}% obsolete definition + \frozen\instance\protected\defcsname\e!place \e!listof#2\endcsname{\placelistofsorts[#1]}% + \frozen\instance\protected\defcsname\e!complete\e!listof#2\endcsname{\completelistofsorts[#1]}% \fi} \permanent\tolerant\protected\def\definesort[#1]#*[#2]#*[#3]% diff --git a/tex/context/base/mkxl/strc-tag.mkxl b/tex/context/base/mkxl/strc-tag.mkxl index 08d8fef6c..18cb65760 100644 --- a/tex/context/base/mkxl/strc-tag.mkxl +++ b/tex/context/base/mkxl/strc-tag.mkxl @@ -296,7 +296,7 @@ \newconditional\c_strc_tags_enabled -\permanent\let\dotaggedplaceholder\empty +\aliased\let\dotaggedplaceholder\empty \immutable\chardef\strc_tags_placeholder_char\zerocount % "FFFC @@ -396,7 +396,7 @@ [\c!color=, \c!style=] -\ifdefined\dotagparagraph \else \let\dotagparagraph\gobbleoneargument \fi +\ifdefined\dotagparagraph \else \aliased\let\dotagparagraph\gobbleoneargument \fi \permanent\tolerant\protected\def\startparagraph[#1]#*[#2]% {\endgraf % we end before the group diff --git a/tex/context/base/mkxl/syst-aux.mkxl b/tex/context/base/mkxl/syst-aux.mkxl index 057aa5e98..7a60e63bb 100644 --- a/tex/context/base/mkxl/syst-aux.mkxl +++ b/tex/context/base/mkxl/syst-aux.mkxl @@ -5083,8 +5083,8 @@ \ifdone\expandafter#1\else\expandafter#2\fi} \permanent\protected\def\doifelseallcommon{\syst_helpers_do_if_all_common_else\firstoftwoarguments\secondoftwoarguments} -\permanent\protected\def\doifallcommon {\syst_helpers_do_if_all_common_else\firstofonearguments\gobbleoneargument } -\permanent\protected\def\doifnotallcommon {\syst_helpers_do_if_all_common_else\gobbleoneargument \firstofonearguments } +\permanent\protected\def\doifallcommon {\syst_helpers_do_if_all_common_else\firstofoneargument \gobbleoneargument } +\permanent\protected\def\doifnotallcommon {\syst_helpers_do_if_all_common_else\gobbleoneargument \firstofoneargument } \aliased\let\doifallcommonelse\doifelseallcommon @@ -5534,9 +5534,9 @@ %D %D \starttyping %D \def\dontleavehmode -%D {\ifhmode\else \ifmmode\else +%D {\ifhmode\orelse\ifmmode\else %D {\mathsurround\zeropoint\everymath\emptytoks$ $}% -%D \fi \fi} +%D \fi} %D \stoptyping %D %D And finaly we got the following alternative, one that avoids interfering grouping @@ -5546,9 +5546,9 @@ %D \newbox\b_syst_helpers_dlh %D %D \protected\def\dontleavehmode -%D {\ifhmode\else \ifmmode\else +%D {\ifhmode\orelse\ifmmode\else %D \setbox\b_syst_helpers_dlh\hbox{\mathsurround\zeropoint\everymath\emptytoks$ $}\unhbox\b_syst_helpers_dlh -%D \fi \fi} +%D \fi} %D \stoptyping %D %D But, as we run a recent version of \TEX, we can use the new primitive: diff --git a/tex/context/base/mkxl/tabl-ltb.mkxl b/tex/context/base/mkxl/tabl-ltb.mkxl index 7be5c42f4..ab9675927 100644 --- a/tex/context/base/mkxl/tabl-ltb.mkxl +++ b/tex/context/base/mkxl/tabl-ltb.mkxl @@ -169,10 +169,10 @@ \fi \getrawnoflines\scratchdimen \global\c_tabl_lines_n_of_lines\noflines - \ifconditional\c_tabl_lines_preroll \else \ifnum\c_tabl_lines_n_of_lines<\plustwo + \ifconditional\c_tabl_lines_preroll\orelse\ifnum\c_tabl_lines_n_of_lines<\plustwo \page \tabl_lines_set - \fi \fi} + \fi} \def\tabl_lines_step_cell {\advance\scratchdimen\linetablecparameter\c!width @@ -478,14 +478,14 @@ \fi \global\d_tabl_lines_width\wd\b_tabl_lines_cell \tabl_lines_start_part - \ifscratchconditionone \else \ifcase\c_tabl_lines_repeat \else + \ifscratchconditionone \orelse \ifcase\c_tabl_lines_repeat \else % check for left/right page \ifcase\c_tabl_lines_page\donetrue\or\donetrue\or\donefalse\fi\ifdone % insert repeater \global\advance\d_tabl_lines_width\wd\tablebox\zerocount \ifconditional\c_tabl_lines_preroll\kern\wd\else\unhcopy\fi\tablebox\zerocount \fi - \fi \fi + \fi \fi \ifconditional\c_tabl_lines_preroll \else \box\b_tabl_lines_cell @@ -535,9 +535,9 @@ \global\c_tabl_lines_column\zerocount \global\c_tabl_lines_subcol\zerocount \global\d_tabl_lines_width\zeropoint - \ifconditional\c_tabl_lines_preroll \else \ifdim\pagetotal>\zeropoint + \ifconditional\c_tabl_lines_preroll\orelse\ifdim\pagetotal>\zeropoint \verticalstrut\kern-\struttotal - \fi \fi + \fi \tabl_lines_set \tabl_lines_check_page \enforced\let\BR\tabl_lines_BR @@ -629,10 +629,10 @@ \def\tabl_lines_check_page {\global\c_tabl_lines_page\zerocount - \ifcase\c_tabl_lines_repeat \else \ifcase\c_tabl_lines_page + \ifcase\c_tabl_lines_repeat\orelse\ifcase\c_tabl_lines_page \doif{\linetableparameter\c!repeat}\v!no {\global\c_tabl_lines_page\doifelseoddpage\plusone\plustwo}% - \fi \fi} + \fi} \def\tabl_lines_flush_head {\ifcase\c_tabl_lines_head_state diff --git a/tex/context/base/mkxl/tabl-ntb.mkxl b/tex/context/base/mkxl/tabl-ntb.mkxl index aa29237b5..2840a9cd1 100644 --- a/tex/context/base/mkxl/tabl-ntb.mkxl +++ b/tex/context/base/mkxl/tabl-ntb.mkxl @@ -77,8 +77,8 @@ %D %D \typebuffer \getbuffer -\ifdefined\dotagTABLEcell \else \let\dotagTABLEcell \relax \fi % todo: namespace -\ifdefined\dotagTABLEsignal \else \let\dotagTABLEsignal\relax \fi % todo: namespace +\ifdefined\dotagTABLEcell \else \aliased\let\dotagTABLEcell \relax \fi % todo: namespace +\ifdefined\dotagTABLEsignal \else \aliased\let\dotagTABLEsignal\relax \fi % todo: namespace \let\tabl_ntb_next_level\relax diff --git a/tex/context/base/mkxl/tabl-tbl.mkxl b/tex/context/base/mkxl/tabl-tbl.mkxl index cacaef12c..d46eebe6a 100644 --- a/tex/context/base/mkxl/tabl-tbl.mkxl +++ b/tex/context/base/mkxl/tabl-tbl.mkxl @@ -219,15 +219,16 @@ \newconstant \c_tabl_tabulate_pass \newconstant \c_tabl_tabulate_type \newconstant \c_tabl_tabulate_kind % 1=strong 2=equals -\newconstant \c_tabl_tabulate_splitlinemode \c_tabl_tabulate_splitlinemode\plusone +\newconstant \c_tabl_tabulate_splitlinemode \c_tabl_tabulate_splitlinemode\plusone \newconstant \c_tabl_tabulate_colorspan \newconstant \c_tabl_tabulate_localcolorspan \newconstant \c_tabl_tabulate_modus -\let\tabulatesplitlinemode\c_tabl_tabulate_splitlinemode % temp hack, we need an interface - \let \m_tabl_tabulate_separator_factor \empty % fraction +\aliased\let\tabulatesplitlinemode\c_tabl_tabulate_splitlinemode % temp hack, we need an interface + + \newtoks \everytabulatepar % where used ? \newtoks \everytabulate % public ? @@ -342,8 +343,8 @@ \let\tabl_tabulate_shaped_par_end\egroup -\ifdefined\dotagtabulatecell \else \let\dotagtabulatecell \relax \fi -\ifdefined\dotagtabulatesignal \else \let\dotagtabulatesignal\relax \fi +\ifdefined\dotagtabulatecell \else \aliased\let\dotagtabulatecell \relax \fi +\ifdefined\dotagtabulatesignal \else \aliased\let\dotagtabulatesignal\relax \fi \protected\def\tabl_tabulate_check_local_color_first#1#2% {\relax} @@ -1328,7 +1329,7 @@ \tabl_tabulate_insert_body \tabl_tabulate_process} -\def\tabulateEQ +\permanent\protected\def\tabulateEQ {\ifconditional\c_tabl_tabulate_firstflushed\else \dostarttaggedchained\t!ignore\empty\empty \dostarttagged\t!ignore\empty @@ -1356,13 +1357,13 @@ \let\m_tabl_tabulate_blank_default \empty \appendtoks - \glet\m_tabl_tabulate_color_previous \empty - \glet\m_tabl_tabulate_color \empty - \glet\m_tabl_tabulate_text_color \empty - \glet\m_tabl_tabulate_color_local \empty - \glet\m_tabl_tabulate_vrule_color \empty - \glet\m_tabl_tabulate_vrule_color_local \empty - \global \d_tabl_tabulate_vrulethickness_local\zeropoint + \glet \m_tabl_tabulate_color_previous \empty + \glet \m_tabl_tabulate_color \empty + \glet \m_tabl_tabulate_text_color \empty + \glet \m_tabl_tabulate_color_local \empty + \glet \m_tabl_tabulate_vrule_color \empty + \glet \m_tabl_tabulate_vrule_color_local \empty + \global\d_tabl_tabulate_vrulethickness_local\zeropoint \to \t_tabl_tabulate_every_row \protected\def\tabl_tabulate_color_side_right_second @@ -2296,7 +2297,7 @@ \dostarttagged\t!tabulaterow\empty \setfalse\inhibitmargindata % new per 2012.06.13 ... really needed % % \everycr\expandafter{\the\everycr\noalign{\the\t_tabl_tabulate_every_real_row}\dostoptagged\dostarttagged\t!tabulaterow\empty}% -% \toksapp\everycr{\noalign{\the\t_tabl_tabulate_every_real_row\dostoptagged\dostarttagged\t!tabulaterow\empty}}% + \toksapp\everycr{\noalign{\the\t_tabl_tabulate_every_real_row\dostoptagged\dostarttagged\t!tabulaterow\empty}}% \expandafter\halign\expandafter{\the\t_tabl_tabulate_preamble\crcr\tabl_tabulate_insert_content\crcr}% \dostoptagged \dostoptagged diff --git a/tex/context/base/mkxl/tabl-tsp.mkxl b/tex/context/base/mkxl/tabl-tsp.mkxl index 561ed73cb..9d4a13380 100644 --- a/tex/context/base/mkxl/tabl-tsp.mkxl +++ b/tex/context/base/mkxl/tabl-tsp.mkxl @@ -74,8 +74,8 @@ \newcount \noffloatssplits \newtoks \everysplitfloatsetup -\let \extrasplitfloatlines \!!zerocount -\let \splitfloatfinalizer \relax +\mutable\let \extrasplitfloatlines \!!zerocount +\mutable\let \splitfloatfinalizer \relax \mutable\let \floatcaptionsuffix \empty diff --git a/tex/context/base/mkxl/tabl-xtb.mklx b/tex/context/base/mkxl/tabl-xtb.mklx index ae763dd52..b15d99c12 100644 --- a/tex/context/base/mkxl/tabl-xtb.mklx +++ b/tex/context/base/mkxl/tabl-xtb.mklx @@ -410,7 +410,7 @@ % % \let\xtablesplitstate\c_tabl_x_state -\let\extratxtablesplitheight\zeropoint % might disappear so don't depend on it +\mutable\let\extraxtablesplitheight\zeropoint % might disappear so don't depend on it \protected\def\tabl_x_flush_float_normal {\clf_x_table_flush @@ -420,7 +420,7 @@ \protected\def\tabl_x_flush_float_split {\resetdirecttsplit \edef\extrasplitfloatlines{\xtableparameter\c!split}% - \d_split_minimum_free_space\dimexpr\extratxtablesplitheight+\xtableparameter\c!splitoffset\relax + \d_split_minimum_free_space\dimexpr\extraxtablesplitheight+\xtableparameter\c!splitoffset\relax %\c_split_minimum_free_lines\plustwo % not needed here as we're precise enough \let\tsplitdirectsplitter\tabl_x_split_splitter \let\tsplitdirectwidth \d_tabl_x_final_width diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt index 96f3215f7..29cdbaeda 100644 --- a/tex/context/base/mkxl/trac-vis.lmt +++ b/tex/context/base/mkxl/trac-vis.lmt @@ -37,9 +37,7 @@ local tonut = nuts.tonut local setboth = nuts.setboth local setlink = nuts.setlink -local setdisc = nuts.setdisc local setlist = nuts.setlist -local setleader = nuts.setleader local setsubtype = nuts.setsubtype local setattr = nuts.setattr local setwidth = nuts.setwidth @@ -51,18 +49,13 @@ local getattr = nuts.getattr local getsubtype = nuts.getsubtype local getbox = nuts.getbox local getlist = nuts.getlist -local getleader = nuts.getleader local getnext = nuts.getnext local getboth = nuts.getboth -local getdisc = nuts.getdisc local getwhd = nuts.getwhd local getkern = nuts.getkern -local getpenalty = nuts.getpenalty local getwidth = nuts.getwidth local getdepth = nuts.getdepth -local getshift = nuts.getshift local getexpansion = nuts.getexpansion -local getdirection = nuts.getdirection local getstate = nuts.getstate local isglyph = nuts.isglyph @@ -75,7 +68,6 @@ local flush_node_list = nuts.flush_list local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after local apply_to_nodes = nuts.apply -local effectiveglue = nuts.effective_glue local hpack_string = nuts.typesetters.tohpack @@ -185,9 +177,9 @@ local preset_all = preset_makeup + modes.dir + modes.whatsit function visualizers.setfont(id) - usedfont = id or current_font() - exheight = exheights[usedfont] - emwidth = emwidths[usedfont] + usedfont = id or current_font() + exheight = exheights[usedfont] + emwidth = emwidths[usedfont] end -- we can preset a bunch of bits @@ -373,7 +365,8 @@ for mode, value in next, modes do trackers.register(formatters["visualizers.%s"](mode), function(v) set(mode,v) end) end -local fraction = 10 +local fraction = 10 +local normalize = true trackers .register("visualizers.reset", function(v) set("reset", v) end) trackers .register("visualizers.all", function(v) set("all", v) end) @@ -417,7 +410,9 @@ local c_discretionary_d = "trace:dd" ----- c_depth_d = "trace:do" ----- c_indent_d = "trace:ds" -local function sometext(str,layer,color,textcolor,lap) -- we can just paste verbatim together .. no typesteting needed +-- we can just paste verbatim together .. no typesetting needed + +local function sometext(str,layer,color,textcolor,lap,variant) local text = hpack_string(str,usedfont) local size = getwidth(text) local rule = new_rule(size,2*exheight,exheight/2) @@ -432,6 +427,9 @@ local function sometext(str,layer,color,textcolor,lap) -- we can just paste verb setlisttransparency(info,c_zero) info = hpack_nodes(info) local width = getwidth(info) + if variant then + nuts.setoffsets(info,0,variant*exheight) + end if lap then info = new_hlist(setlink(new_kern(-width),info)) else @@ -627,14 +625,16 @@ end local dir, par do - local dircodes = nodes.dircodes - local dirvalues = nodes.dirvalues + local dircodes = nodes.dircodes + local dirvalues = nodes.dirvalues - local cancel_code = dircodes.cancel - local l2r_code = dirvalues.l2r - local r2l_code = dirvalues.r2l + local cancel_code = dircodes.cancel + local l2r_code = dirvalues.l2r + local r2l_code = dirvalues.r2l - local d_cache = caches["dir"] + local d_cache = caches["dir"] + + local getdirection = nuts.getdirection local tags = { l2r = "L2R", @@ -757,6 +757,8 @@ local ruledbox do local b_cache = caches["box"] local o_cache = caches["origin"] + local getshift = nuts.getshift + setmetatableindex(o_cache,function(t,size) local rule = new_rule(2*size,size,size) local origin = hpack_nodes(rule) @@ -927,6 +929,8 @@ end local ruledglue do + local effectiveglue = nuts.effective_glue + local gluecodes = nodes.gluecodes local userskip_code = gluecodes.userskip @@ -943,8 +947,16 @@ local ruledglue do local indentskip_code = gluecodes.indentskip local correctionskip_code = gluecodes.correctionskip - local g_cache_v = caches["vglue"] - local g_cache_h = caches["hglue"] + local g_cache_v = caches["vglue"] + local g_cache_h = caches["hglue"] + local g_cache_ls = caches["leftskip"] + local g_cache_rs = caches["rightskip"] + local g_cache_lh = caches["lefthang"] + local g_cache_rh = caches["righthang"] + local g_cache_lp = caches["parfillleftskip"] + local g_cache_rp = caches["parfillrightskip"] + local g_cache_is = caches["indentskip"] + local g_cache_cs = caches["correctionskip"] local tags = { -- [userskip_code] = "US", @@ -983,11 +995,21 @@ local ruledglue do [correctionskip_code] = "CS", } + local stags = { + [lefthangskip_code] = 0.5, + [righthangskip_code] = 0.5, + [leftskip_code] = -2, + [rightskip_code] = -2, + [parfillleftskip_code] = -0.75, + [parfillrightskip_code] = -0.75, + } + -- we sometimes pass previous as we can have issues in math (not watertight for all) ruledglue = function(head,current,vertical,parent) local subtype = getsubtype(current) local width = effectiveglue(current,parent) + local stag = normalize and stags[subtype] local amount = formatters["%s:%0.3f"](tags[subtype] or (vertical and "VS") or "HS",width*pt_factor) local info = (vertical and g_cache_v or g_cache_h)[amount] if info then @@ -995,12 +1017,6 @@ local ruledglue do else if subtype == spaceskip_code or subtype == xspaceskip_code or subtype == zerospaceskip_code then info = sometext(amount,l_glue,c_space) - elseif subtype == leftskip_code or subtype == rightskip_code then - info = sometext(amount,l_glue,c_skip_a) - elseif subtype == lefthangskip_code or subtype == righthangskip_code then - info = sometext(amount,l_glue,c_skip_b) - elseif subtype == parfillleftskip_code or subtype == parfillrightskip_code or subtype == indentskip_code or subtype == correctionskip_code then - info = sometext(amount,l_glue,c_indent) elseif subtype == userskip_code then if width > 0 then info = sometext(amount,l_glue,c_positive) @@ -1009,11 +1025,26 @@ local ruledglue do else info = sometext(amount,l_glue,c_zero) end + elseif subtype == indentskip_code or subtype == correctionskip_code then + info = sometext(amount,l_glue,c_indent) + elseif subtype == leftskip_code then + info = sometext(amount,l_glue,normalize and c_space or c_skip_a,false,true,stag) + elseif subtype == rightskip_code then + info = sometext(amount,l_glue,normalize and c_space or c_skip_a,false,false,stag) + elseif subtype == lefthangskip_code then + info = sometext(amount,l_glue,normalize and c_space or c_skip_b,false,true,stag) + elseif subtype == righthangskip_code then + info = sometext(amount,l_glue,normalize and c_space or c_skip_b,false,false,stag) + elseif subtype == parfillleftskip_code then + info = sometext(amount,l_glue,c_indent,false,true,stag) + elseif subtype == parfillrightskip_code then + info = sometext(amount,l_glue,c_indent,false,false,stag) else info = sometext(amount,l_glue,c_skip_b) end (vertical and g_cache_v or g_cache_h)[amount] = info end + ::PICKIP:: info = copy_list(info) if vertical then info = vpack_nodes(info) @@ -1207,6 +1238,8 @@ local ruledpenalty do local raisepenalties = false + local getpenalty = nuts.getpenalty + directives.register("visualizers.raisepenalties",function(v) raisepenalties = v end) ruledpenalty = function(head,current,vertical) @@ -1267,6 +1300,12 @@ do local vtop_package_state = 3 -- todo: symbolic + local getleader = nuts.getleader + local getdisc = nuts.getdisc + + local setleader = nuts.setleader + local setdisc = nuts.setdisc + local cache local function visualize(head,vertical,forced,parent) diff --git a/tex/context/base/mkxl/type-ini.mklx b/tex/context/base/mkxl/type-ini.mklx index 95587c493..fa616e0f7 100644 --- a/tex/context/base/mkxl/type-ini.mklx +++ b/tex/context/base/mkxl/type-ini.mklx @@ -82,8 +82,8 @@ % tricky ... here we push/pop ... so \let -\let\typescriptmethod\plusone % 1: empty==all==true 2: empty==false -\let\typescriptstate \plustwo % 1: process 2: store +\mutable\let\typescriptmethod\plusone % 1: empty==all==true 2: empty==false +\mutable\let\typescriptstate \plustwo % 1: process 2: store \installmacrostack\typescriptmethod \installmacrostack\typescriptstate diff --git a/tex/context/base/mkxl/typo-del.mkxl b/tex/context/base/mkxl/typo-del.mkxl index 13f525f69..ad0c93fa0 100644 --- a/tex/context/base/mkxl/typo-del.mkxl +++ b/tex/context/base/mkxl/typo-del.mkxl @@ -17,8 +17,8 @@ \unprotect -\ifdefined\dotagsetdelimitedsymbol \else \let\dotagsetdelimitedsymbol \gobbleoneargument \fi -\ifdefined\dotagsetsubsentencesymbol \else \let\dotagsetsubsentencesymbol\gobbleoneargument \fi +\ifdefined\dotagsetdelimitedsymbol \else \aliased\let\dotagsetdelimitedsymbol \gobbleoneargument \fi +\ifdefined\dotagsetsubsentencesymbol \else \aliased\let\dotagsetsubsentencesymbol\gobbleoneargument \fi % THIS IS OBSOLETE: diff --git a/tex/context/base/mkxl/typo-mar.mkxl b/tex/context/base/mkxl/typo-mar.mkxl index 1fd904cc3..3b9b99a28 100644 --- a/tex/context/base/mkxl/typo-mar.mkxl +++ b/tex/context/base/mkxl/typo-mar.mkxl @@ -164,8 +164,8 @@ \newcount\nofmargintexts \newcount\c_typo_margins_n -\ifdefined\dotagmarginanchor \else \let\dotagmarginanchor\gobbleoneargument \fi -\ifdefined\dotagmargintext \else \let\dotagmargintext \gobbleoneargument \fi +\ifdefined\dotagmarginanchor \else \aliased\let\dotagmarginanchor\gobbleoneargument \fi +\ifdefined\dotagmargintext \else \aliased\let\dotagmargintext \gobbleoneargument \fi \definepagestate[\s!margintext] diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index f4e9fbcca..a90920888 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2020-11-28 13:15 +-- merge date : 2020-11-30 10:20 do -- begin closure to overcome local limits and interference |