summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2020-08-03 14:53:53 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2020-08-03 14:53:53 +0200
commit757aa0290bc1f866475e055fdf8a9c6df1124860 (patch)
tree3b8bc79a80e33900f3b3f82cd1f4e5e1936f1331 /tex/context/base
parentcbaeded86ee193677fe0cae364b564616557449d (diff)
downloadcontext-757aa0290bc1f866475e055fdf8a9c6df1124860.tar.gz
2020-08-03 14:20:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-en.mkii1
-rw-r--r--tex/context/base/mkii/mult-ro.mkii1
-rw-r--r--tex/context/base/mkiv/back-out.lmt32
-rw-r--r--tex/context/base/mkiv/cldf-lmt.lmt3
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkxl2
-rw-r--r--tex/context/base/mkiv/core-sys.lua10
-rw-r--r--tex/context/base/mkiv/driv-shp.lmt4
-rw-r--r--tex/context/base/mkiv/font-ctx.lua12
-rw-r--r--tex/context/base/mkiv/font-gds.mkvi7
-rw-r--r--tex/context/base/mkiv/good-ctx.lua1
-rw-r--r--tex/context/base/mkiv/mult-low.lua9
-rw-r--r--tex/context/base/mkiv/mult-prm.lua6
-rw-r--r--tex/context/base/mkiv/node-ini.lua7
-rw-r--r--tex/context/base/mkiv/pack-mrl.mkxl54
-rw-r--r--tex/context/base/mkiv/pack-ori.mkxl11
-rw-r--r--tex/context/base/mkiv/pack-rul.mkxl17
-rw-r--r--tex/context/base/mkiv/spac-ali.mkxl37
-rw-r--r--tex/context/base/mkiv/spac-hor.mkxl36
-rw-r--r--tex/context/base/mkiv/spac-par.lmt1
-rw-r--r--tex/context/base/mkiv/spac-par.mkxl76
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin27969 -> 27976 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin254914 -> 255052 bytes
-rw-r--r--tex/context/base/mkiv/strc-not.mkvi260
-rw-r--r--tex/context/base/mkiv/supp-box.lua15
-rw-r--r--tex/context/base/mkiv/supp-box.mkxl8
-rw-r--r--tex/context/base/mkiv/syst-ini.mkxl61
-rw-r--r--tex/context/base/mkiv/syst-lua.lmt99
-rw-r--r--tex/context/base/mkiv/toks-aux.mkiv4
-rw-r--r--tex/context/base/mkiv/toks-ini.lua5
-rw-r--r--tex/context/base/mkiv/toks-scn.lua6
-rw-r--r--tex/context/base/mkiv/trac-vis.lua2
35 files changed, 464 insertions, 331 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 34fcff4b5..0fcb0af08 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.07.31 09:58}
+\newcontextversion{2020.08.03 14:18}
%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 48864f02c..d40a5aff0 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.07.31 09:58}
+\edef\contextversion{2020.08.03 14:18}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-en.mkii b/tex/context/base/mkii/mult-en.mkii
index 2c31fc95a..14d7555b2 100644
--- a/tex/context/base/mkii/mult-en.mkii
+++ b/tex/context/base/mkii/mult-en.mkii
@@ -634,6 +634,7 @@
\setinterfaceconstant{afterkey}{afterkey}
\setinterfaceconstant{aftersection}{aftersection}
\setinterfaceconstant{align}{align}
+\setinterfaceconstant{alignbottom}{alignbottom}
\setinterfaceconstant{aligncharacter}{aligncharacter}
\setinterfaceconstant{alignmentcharacter}{alignmentcharacter}
\setinterfaceconstant{alignmentleftsample}{alignmentleftsample}
diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii
index 056125b9c..ba3e165d8 100644
--- a/tex/context/base/mkii/mult-ro.mkii
+++ b/tex/context/base/mkii/mult-ro.mkii
@@ -634,6 +634,7 @@
\setinterfaceconstant{afterkey}{dupatasta}
\setinterfaceconstant{aftersection}{aftersection}
\setinterfaceconstant{align}{aliniere}
+\setinterfaceconstant{alignbottom}{alignbottom}
\setinterfaceconstant{aligncharacter}{aliniazacaracter}
\setinterfaceconstant{alignmentcharacter}{alierecaracter}
\setinterfaceconstant{alignmentleftsample}{alignmentleftsample}
diff --git a/tex/context/base/mkiv/back-out.lmt b/tex/context/base/mkiv/back-out.lmt
index 5ea5aa048..36787bca2 100644
--- a/tex/context/base/mkiv/back-out.lmt
+++ b/tex/context/base/mkiv/back-out.lmt
@@ -61,17 +61,19 @@ local setmatrixnode = register(newnut(whatsit_code,whatsitcodes.setmatrix)
local tomatrix = drivers.helpers.tomatrix
-local immediately = false -- not watertight
-
local open_command, write_command, close_command
backends = backends or { }
-local function openout()
+local function immediately(prefix)
+ return prefix and (prefix & 8) ~= 0
+end
+
+local function openout(prefix)
local channel = scaninteger()
scankeyword("=") -- hack
local filename = scanstring()
- if not immediately then
+ if not immediately(prefix) then
local n = copynode(opennode)
nodeproperties[n] = { channel = channel, filename = filename } -- action = "open"
return context(tonode(n))
@@ -83,7 +85,6 @@ local function openout()
-- error
end
end
- immediately = false
end
function backends.openout(n)
@@ -98,9 +99,9 @@ function backends.openout(n)
end
end
-local function write()
+local function write(prefix)
local channel = scaninteger()
- if not immediately then
+ if not immediately(prefix) then
local t = scantokenlist()
local n = copynode(writenode)
nodeproperties[n] = { channel = channel, data = t } -- action = "write"
@@ -114,7 +115,6 @@ local function write()
logwriter(content,"\n")
end
end
- immediately = false
end
function backends.writeout(n)
@@ -130,9 +130,9 @@ function backends.writeout(n)
end
end
-local function closeout()
+local function closeout(prefix)
local channel = scaninteger()
- if not immediately then
+ if not immediately(prefix) then
local n = copynode(closenode)
nodeproperties[n] = { channel = channel } -- action = "close"
return context(tonode(n))
@@ -146,7 +146,6 @@ local function closeout()
-- error
end
end
- immediately = false
end
function backends.closeout(n)
@@ -164,10 +163,6 @@ function backends.closeout(n)
end
end
-local function immediate()
- immediately = true
-end
-
local noflatelua = 0
local function latelua()
@@ -247,10 +242,9 @@ function nodepool.setmatrix(rx,sx,sy,ry,tx,ty)
return t
end
-interfaces.implement { name = "immediate", actions = immediate, public = true, protected = true }
-interfaces.implement { name = "openout", actions = openout, public = true, protected = true }
-interfaces.implement { name = "write", actions = write, public = true, protected = true }
-interfaces.implement { name = "closeout", actions = closeout, public = true, protected = true }
+interfaces.implement { name = "openout", actions = openout, public = true, protected = true, value = "none" }
+interfaces.implement { name = "write", actions = write, public = true, protected = true, value = "none" }
+interfaces.implement { name = "closeout", actions = closeout, public = true, protected = true, value = "none" }
interfaces.implement { name = "latelua", actions = latelua, public = true, protected = true }
interfaces.implement { name = "special", actions = scanstring, public = true, protected = true }
diff --git a/tex/context/base/mkiv/cldf-lmt.lmt b/tex/context/base/mkiv/cldf-lmt.lmt
index b23ab1bd0..a660dbb3b 100644
--- a/tex/context/base/mkiv/cldf-lmt.lmt
+++ b/tex/context/base/mkiv/cldf-lmt.lmt
@@ -667,7 +667,8 @@ local function handletable(t,b,array)
end
t[k] = v
end
- if b == "global" then
+ -- if b == "global" then
+ if b and (b & 0x04) ~= 0 then -- or just band(b,0x04)
for k, v in next, stack do
local t = s[t]
if t then
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 1dd3b73e7..0af9acd4e 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.07.31 09:58}
+\newcontextversion{2020.08.03 14:18}
%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 ae9929e59..6c5d16655 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.07.31 09:58}
+\edef\contextversion{2020.08.03 14:18}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index bc442c527..256a19140 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.07.31 09:58}
+\edef\contextversion{2020.08.03 14:18}
%D Kind of special:
diff --git a/tex/context/base/mkiv/core-sys.lua b/tex/context/base/mkiv/core-sys.lua
index 7e9648fb8..3ab597849 100644
--- a/tex/context/base/mkiv/core-sys.lua
+++ b/tex/context/base/mkiv/core-sys.lua
@@ -77,13 +77,9 @@ implement { name = "outputfilename", actions = function() context(environme
statistics.register("result saved in file", function()
-- suffix will be fetched from backend
local outputfilename = environment.outputfilename or environment.jobname or tex.jobname or "<unset>"
- -- if (tex.pdfoutput or tex.outputmode) > 0 then
- return format("%s.%s, compresslevel %s, objectcompresslevel %s",outputfilename,"pdf",
- lpdf.getcompression()
- )
- -- else
- -- return format("%s.%s",outputfilename,"dvi") -- hard to imagine
- -- end
+ return lpdf and format("%s.%s, compresslevel %s, objectcompresslevel %s",outputfilename,"pdf",
+ lpdf.getcompression()
+ ) or "error"
end)
implement {
diff --git a/tex/context/base/mkiv/driv-shp.lmt b/tex/context/base/mkiv/driv-shp.lmt
index 6e4195588..c117405ba 100644
--- a/tex/context/base/mkiv/driv-shp.lmt
+++ b/tex/context/base/mkiv/driv-shp.lmt
@@ -272,13 +272,13 @@ local function flush_vf_packet(pos_h,pos_v,pos_r,font,char,data,factor,vfcommand
end
end
elseif command == "right" then
- local h = packet[2] * siz -- * siz is really needed for boldening
+ local h = packet[2] -- already scaled
if factor ~= 0 and h ~= 0 then
h = h + h * factor / 1000 -- expansion
end
pos_h = pos_h + h
elseif command == "down" then
- local v = packet[2] * siz -- * siz is really needed for boldening
+ local v = packet[2] -- already scaled
pos_v = pos_v - v
elseif command == "push" then
level = level + 1
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua
index 3b2676667..e6ed58492 100644
--- a/tex/context/base/mkiv/font-ctx.lua
+++ b/tex/context/base/mkiv/font-ctx.lua
@@ -329,13 +329,21 @@ function definers.resetnullfont()
definers.resetnullfont = function() end
end
+-- This is some initialization code and we don't want (tracing) clutter in lmtx
+-- which is why we follow a different route there. I admit that is sounds freaky.
+-- Watch out: in lmtx the font dimen array is no longer resized automatically.
+
implement {
name = "resetnullfont",
onlyonce = true,
actions = function()
for i=1,7 do
- -- we have no direct method yet
- context([[\fontdimen%s\nullfont\zeropoint]],i)
+ if CONTEXTLMTXMODE > 0 then
+ font.setfontdimen(0,i,0)
+ else
+ -- we have no direct method
+ context([[\fontdimen%s\nullfont\zeropoint]],i)
+ end
end
definers.resetnullfont()
end
diff --git a/tex/context/base/mkiv/font-gds.mkvi b/tex/context/base/mkiv/font-gds.mkvi
index 0dc0f7508..405419416 100644
--- a/tex/context/base/mkiv/font-gds.mkvi
+++ b/tex/context/base/mkiv/font-gds.mkvi
@@ -43,6 +43,13 @@
\definecolor[colorscheme:3:6][r=.75,g=.75]
\definecolor[colorscheme:3:7][g=.75]
+\definecolor[colorscheme:4:1] [r=.6] % a
+\definecolor[colorscheme:4:5] [g=.6] % e
+\definecolor[colorscheme:4:9] [b=.6] % i
+\definecolor[colorscheme:4:15][g=.6,b=.6] % o
+\definecolor[colorscheme:4:21][r=.6,b=.6] % u
+\definecolor[colorscheme:4:25][r=.6,b=.6] % y
+
\definesystemattribute[colorscheme][public]
\unexpanded\def\loadfontgoodies[#filename]%
diff --git a/tex/context/base/mkiv/good-ctx.lua b/tex/context/base/mkiv/good-ctx.lua
index 82ef25e29..7a25baf93 100644
--- a/tex/context/base/mkiv/good-ctx.lua
+++ b/tex/context/base/mkiv/good-ctx.lua
@@ -158,6 +158,7 @@ function colorschemes.coloring(head)
if lastscheme then
local sc = lastscheme[char]
if sc then
+ -- todo: use new lmtx mechanism instead
setnodecolor(n,lastcache[sc]) -- we could inline this one
end
end
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index 340e96446..e656b987b 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -84,8 +84,10 @@ return {
--
"bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode",
"vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode",
- "discretionarygroupcode", "insertgroupcode", "vcentergroupcode", "mathabovegroupcode", "mathchoicegroupcode",
- "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "vadjustgroupcode",
+ "discgroupcode", "insertgroupcode", "vadjustgroupcode", "vcentergroupcode", "mathabovegroupcode",
+ "mathchoicegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode",
+ "localboxgroupcode", "splitoffgroupcode", "splitkeepgroupcode", "preamblegroupcode",
+ "alignsetgroupcode", "finrowgroupcode", "discretionarygroupcode",
--
"charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode",
"adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode",
@@ -209,6 +211,7 @@ return {
--
"mathortext",
--
+ "thebox",
"htdp",
"unvoidbox",
"hfilll", "vfilll",
@@ -496,5 +499,7 @@ return {
"start", "stop",
--
"unsupportedcs",
+ --
+ "openout", "closeout", "write", "openin", "closein", "read", "readline",
}
}
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index 88b7dad7a..ce48a6d9e 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -245,6 +245,7 @@ return {
"automaticdiscretionary",
"automatichyphenmode",
"automatichyphenpenalty",
+ "automigrationmode",
"begincsname",
"beginlocalcontrol",
"boundary",
@@ -281,7 +282,6 @@ return {
"explicitdiscretionary",
"explicithyphenpenalty",
"firstvalidlanguage",
- "fixupboxesmode",
"fontid",
"formatname",
"frozen",
@@ -327,11 +327,11 @@ return {
"ifusercmd",
"ignorearguments",
"ignorepars",
+ "immediate",
"immediateassigned",
"immediateassignment",
"initcatcodetable",
"insertht",
- "internalcodesmode",
"lastarguments",
"lastnamedcs",
"lastnodesubtype",
@@ -342,6 +342,7 @@ return {
"letprotected",
"linedirection",
"localbrokenpenalty",
+ "localcontrolled",
"localinterlinepenalty",
"localleftbox",
"localrightbox",
@@ -385,6 +386,7 @@ return {
"outputbox",
"parattr",
"pardirection",
+ "parindentmode",
"postexhyphenchar",
"posthyphenchar",
"prebinoppenalty",
diff --git a/tex/context/base/mkiv/node-ini.lua b/tex/context/base/mkiv/node-ini.lua
index 0b048d0e3..797047d6b 100644
--- a/tex/context/base/mkiv/node-ini.lua
+++ b/tex/context/base/mkiv/node-ini.lua
@@ -350,7 +350,7 @@ end
-- We use the real node code numbers.
-if CONTEXTLMTXMODE > 0 then
+if environment.initex and CONTEXTLMTXMODE > 0 then
local texchardef = tex.chardef
@@ -358,7 +358,10 @@ if CONTEXTLMTXMODE > 0 then
for i=0,nodecodes.glyph do
texchardef(nodecodes[i] .. "nodecode",i)
end
- tex.set("internalcodesmode",1)
+ for i=0,#gluecodes do
+ texchardef(gluecodes[i] .. "subtypecode",i)
+ end
+ -- tex.set("internalcodesmode",1) -- obsolete
end
end
diff --git a/tex/context/base/mkiv/pack-mrl.mkxl b/tex/context/base/mkiv/pack-mrl.mkxl
index bd459dc46..2c3a2f174 100644
--- a/tex/context/base/mkiv/pack-mrl.mkxl
+++ b/tex/context/base/mkiv/pack-mrl.mkxl
@@ -842,35 +842,37 @@
\c!before=\blank,
\c!after=\blank]
+\unexpanded\def\pack_fillinline_before#1%
+ {}
+
+\unexpanded\def\pack_fillinline_after#1%
+ {\begingroup
+ \setupcurrentfillinlines[#1]%
+ \ifhmode\unskip\hfill\fi
+ \scratchdistance\directfillinlinesparameter\c!distance
+ \scratchheight\dimexpr\directfillinlinesparameter\c!rulethickness/\plustwo\relax
+ \scratchwidth \dimexpr\directfillinlinesparameter\c!width-\scratchdistance\relax
+ \ifdim\scratchwidth>\directfillinlinesparameter\c!margin\else
+ \expandafter\rlap
+ \fi
+ {\kern\scratchdistance
+ \blackrule
+ [\c!color=\directfillinlinesparameter\c!color,
+ \c!width=\scratchwidth,
+ \c!height=\scratchheight,
+ \c!depth=\scratchheight]}%
+ \frozen\advance\rightskip \directfillinlinesparameter\c!margin\relax
+ \frozen\parfillskip\zeropoint\relax
+ \endgroup}
+
\unexpanded\def\fillinline
{\dosingleempty\pack_fillinline}
\def\pack_fillinline[#1]%
- {\begingroup
- \setupcurrentfillinlines[#1]%
- \directfillinlinesparameter\c!before
- \advance\rightskip \directfillinlinesparameter\c!margin\relax
- \parfillskip\zeropoint\relax
- \dontleavehmode
- \endgroup
- \wrapuppar
- {\begingroup
- \setupcurrentfillinlines[#1]%
- \ifhmode\unskip\hfill\fi
- \scratchdistance\directfillinlinesparameter\c!distance
- \scratchheight\dimexpr\directfillinlinesparameter\c!rulethickness/\plustwo\relax
- \scratchwidth \dimexpr\directfillinlinesparameter\c!width-\scratchdistance\relax
- \ifdim\scratchwidth>\directfillinlinesparameter\c!margin\else
- \expandafter\rlap
- \fi
- {\kern\scratchdistance
- \blackrule
- [\c!color=\directfillinlinesparameter\c!color,
- \c!width=\scratchwidth,
- \c!height=\scratchheight,
- \c!depth=\scratchheight]}%
- \endgraf
- \directfillinlinesparameter\c!after
- \endgroup}}
+ {\registerparwrapper
+ {fillinline}%
+ {\pack_fillinline_before{#1}}%
+ {\pack_fillinline_after {#1}%
+ \unregisterparwrapper{fillinline}}}
\protect \endinput
diff --git a/tex/context/base/mkiv/pack-ori.mkxl b/tex/context/base/mkiv/pack-ori.mkxl
index 5b2af1c4f..2091adea4 100644
--- a/tex/context/base/mkiv/pack-ori.mkxl
+++ b/tex/context/base/mkiv/pack-ori.mkxl
@@ -72,8 +72,17 @@
\fi
\relax}
+%D The \type {\immediateassignment} and \type {\immediateassigned} primitives are
+%D kind of obsolete and might be dropped (if not already) from \LUAMETATEX. Local
+%D scanning is, although it is a bit slower, more general. We didn't really need and
+%D use these primitives in \CONTEXT\ anyway, apart from some playing around with
+%D some full expansion, which made no sense in the end so it was dropped. When
+%D things get that hairy it's often a good reason to look into \LUA\ variants.
+
\def\auto_orientation#1%
- {\immediateassignment\global\expandafter\chardef\csname\??orientations#1\endcsname\stringtoorientation{#1}%
+ %{\immediateassignment\global\expandafter\chardef\csname\??orientations#1\endcsname\stringtoorientation{#1}% % quite fast
+ {\beginlocalcontrol\global\expandafter\chardef\csname\??orientations#1\endcsname\stringtoorientation{#1}\endlocalcontrol % good enough
+ %{\localcontrolled{\global\expandafter\chardef\csname\??orientations#1\endcsname\stringtoorientation{#1}}% % a bit slower
\csname\??orientations#1\endcsname}
\unexpanded\def\doifelseorientation#1%
diff --git a/tex/context/base/mkiv/pack-rul.mkxl b/tex/context/base/mkiv/pack-rul.mkxl
index 97cb82968..3afd09c79 100644
--- a/tex/context/base/mkiv/pack-rul.mkxl
+++ b/tex/context/base/mkiv/pack-rul.mkxl
@@ -3045,16 +3045,15 @@
\let\themaxboxwidth\clf_themaxboxwidth
-%D New: slow but ok for most cases:
+%D Fast enough for most cases:
\unexpanded\def\doifelseframed#1%
- {\ifcase\numexpr\zerocount
- \immediateassignment\edef\tempstring{#1\c!frame }\ifx\tempstring\v!on +\plusone\fi
- \immediateassignment\edef\tempstring{#1\c!topframe }\ifx\tempstring\v!on +\plusone\fi
- \immediateassignment\edef\tempstring{#1\c!bottomframe}\ifx\tempstring\v!on +\plusone\fi
- \immediateassignment\edef\tempstring{#1\c!leftframe }\ifx\tempstring\v!on +\plusone\fi
- \immediateassignment\edef\tempstring{#1\c!rightframe }\ifx\tempstring\v!on +\plusone\fi
- \immediateassignment\edef\tempstring{#1\c!background }\ifempty\tempstring\else+\plusone\fi
- \relax\expandafter\secondoftwoarguments\else\expandafter\firstoftwoarguments\fi}
+ {\iftok{#1\c!frame }{\v!on}\expandafter\firstoftwoarguments
+ \orelse\iftok{#1\c!topframe }{\v!on}\expandafter\firstoftwoarguments
+ \orelse\iftok{#1\c!bottomframe}{\v!on}\expandafter\firstoftwoarguments
+ \orelse\iftok{#1\c!leftframe }{\v!on}\expandafter\firstoftwoarguments
+ \orelse\iftok{#1\c!rightframe }{\v!on}\expandafter\firstoftwoarguments
+ \orelse\iftok{#1\c!background } {}\expandafter\secondoftwoarguments
+ \else \expandafter\firstoftwoarguments\fi}
\protect \endinput
diff --git a/tex/context/base/mkiv/spac-ali.mkxl b/tex/context/base/mkiv/spac-ali.mkxl
index 5573fbd63..4bf711aec 100644
--- a/tex/context/base/mkiv/spac-ali.mkxl
+++ b/tex/context/base/mkiv/spac-ali.mkxl
@@ -1058,23 +1058,38 @@
% beware: \wordright{whatever\kern-\rightskip} should work!
% so, no funny boxing here
+%D We need to pick up a box (downward compatible in case \type {\bgroup}
+%D is used (test suite index example).
+
\unexpanded\def\wordright
{\dosingleempty\spac_word_right}
\def\spac_word_right[#1]%
- {% don't change
- \groupedcommand
- {\removeunwantedspaces
- \hfill
- \allowbreak % changed back from \hskip\zeropoint
+ {\dowithnextbox
+ {\normalexpanded{\spac_word_right_indeed{#1}{\hpack{\thebox\nextbox}}}}
+ \hbox}
+
+\unexpanded\def\spac_word_right_indeed#1#2%
+ {\registerparwrapper
+ {\v!word:\v!right}
+ {\begingroup
+ \frozen\parfillskip \zeropoint
+ \frozen\finalhyphendemerits\zerocount
+ \endgroup}
+ {\doifelseparwrapper{\v!word:\v!right}%
+ {\doifelse{#1}\v!right{\kern-\rightskip}{\doifsomething{#1}{\kern-#1}}%
+ \strut \removeunwantedspaces
+ \hfill
+ \allowbreak % changed back from \hskip\zeropoint
+ \quad}%
+ {\allowbreak % changed back from \hskip\zeropoint
+ \break}%
+ \unregisterparwrapper{\v!word:\v!right}%
\strut
\hfill
- \quad % decent spacing
- \hbox}
- {\doifelse{#1}\v!right{\kern-\rightskip}{\doifsomething{#1}{\kern-#1}}%
- \frozen\parfillskip\zeropoint
- \frozen\finalhyphendemerits\zerocount % yes or no (see hyhenation/specialcases-001.tex)
- \par}}
+ \nobreak
+ #2%
+ \allowbreak}}
% \dorecurse{5}{something} \wordright{--someone} \endgraf
% \dorecurse{6}{something} \wordright{--someone} \endgraf
diff --git a/tex/context/base/mkiv/spac-hor.mkxl b/tex/context/base/mkiv/spac-hor.mkxl
index 38e495e3c..da9593188 100644
--- a/tex/context/base/mkiv/spac-hor.mkxl
+++ b/tex/context/base/mkiv/spac-hor.mkxl
@@ -554,6 +554,8 @@
\newsignal\s_spac_keep_unwanted_space
+% \parindentmode\plusone
+
\unexpanded\def\keepunwantedspaces
{\ifhmode
\ifdim\lastskip=\s_spac_keep_unwanted_space\else
@@ -567,12 +569,14 @@
\fi}
\def\spac_helpers_remove_unwantedspace
- {\ifnum\lastnodetype=\gluenodecode
- \ifdim\lastskip=\s_spac_keep_unwanted_space\relax
- \unskip
+ {\ifnum\lastnodetype=\gluenodecode\relax
+ \ifnum\lastnodesubtype=\indentskipsubtypecode\relax
+ % keep parindent
+ \orelse\ifdim\lastskip=\s_spac_keep_unwanted_space\relax
+ \unskip
\else
- \unskip
- \doubleexpandafter\spac_helpers_remove_unwantedspace
+ \unskip
+ \doubleexpandafter\spac_helpers_remove_unwantedspace
\fi
\fi}
@@ -642,15 +646,21 @@
% Bovendien definieren we enkele extra \fill's:
-\unexpanded\def\hfilll {\hskip\zeropoint\s!plus1\s!filll\relax}
-\unexpanded\def\vfilll {\vskip\zeropoint\s!plus1\s!filll\relax}
+\newskip\s_spac_fil \s_spac_fil = \zeropoint \s!plus 1\s!fil \relax
+\newskip\s_spac_fill \s_spac_fill = \zeropoint \s!plus 1\s!fill \relax
+\newskip\s_spac_filll \s_spac_filll = \zeropoint \s!plus 1\s!filll\relax
+
+\newskip\s_spac_neg_fil \s_spac_neg_fil = \zeropoint \s!plus-1\s!fil \relax
+\newskip\s_spac_neg_fill \s_spac_neg_fill = \zeropoint \s!plus-1\s!fill \relax
+\newskip\s_spac_neg_filll \s_spac_neg_filll = \zeropoint \s!plus-1\s!filll\relax
+
+\unexpanded\def\hfilll {\hskip\s_spac_fill\relax}
+\unexpanded\def\vfilll {\vskip\s_spac_fill\relax}
-%unexpanded\def\hfilneg {\hskip\zeropoint\s!plus-1\s!fil\relax}
-\unexpanded\def\hfillneg {\hskip\zeropoint\s!plus-1\s!fill\relax}
-\unexpanded\def\hfilllneg{\hskip\zeropoint\s!plus-1\s!filll\relax}
-%unexpanded\def\vfilneg {\vskip\zeropoint\s!plus-1\s!fil\relax}
-\unexpanded\def\vfillneg {\vskip\zeropoint\s!plus-1\s!fill\relax}
-\unexpanded\def\vfilllneg{\vskip\zeropoint\s!plus-1\s!filll\relax}
+\unexpanded\def\hfillneg {\hskip\s_spac_neg_fill \relax}
+\unexpanded\def\hfilllneg{\hskip\s_spac_neg_filll\relax}
+\unexpanded\def\vfillneg {\vskip\s_spac_neg_fill \relax}
+\unexpanded\def\vfilllneg{\vskip\s_spac_neg_filll\relax}
\unexpanded\def\tfskip {\begingroup\tf\hskip\emwidth\endgroup}
\unexpanded\def\dotfskip#1{\begingroup\tf\hskip #1\endgroup} % used elsewhere
diff --git a/tex/context/base/mkiv/spac-par.lmt b/tex/context/base/mkiv/spac-par.lmt
index 595eabe62..3af8ea415 100644
--- a/tex/context/base/mkiv/spac-par.lmt
+++ b/tex/context/base/mkiv/spac-par.lmt
@@ -51,6 +51,7 @@ implement {
implement {
name = "setparwrapper",
arguments = "string",
+ protected = true,
actions = function(id)
local t = tobesaved[id]
local n = #t
diff --git a/tex/context/base/mkiv/spac-par.mkxl b/tex/context/base/mkiv/spac-par.mkxl
index 51b210d45..574cfec12 100644
--- a/tex/context/base/mkiv/spac-par.mkxl
+++ b/tex/context/base/mkiv/spac-par.mkxl
@@ -110,6 +110,7 @@
\installcorenamespace {eparwrap}
\installcorenamespace {parwrapbefore}
\installcorenamespace {parwrapafter}
+\installcorenamespace {parwrapcount}
\let\spac_paragraph_wrap\relax
@@ -131,26 +132,39 @@
{\expandafter\newtoks\csname\??bparwrap\the\currentgrouplevel\endcsname
\expandafter\newtoks\csname\??eparwrap\the\currentgrouplevel\endcsname}
+\def\spac_paragraph_install_count#1%
+ {\expandafter\newcount\csname\??parwrapcount#1\endcsname}
+
\def\spac_paragraph_install_pair#1#2#3%
- {\expandafter\newtoks \csname\??parwrapbefore#3\endcsname
- \expandafter\newtoks \csname\??parwrapafter #3\endcsname
- #1\csname\??bparwrap\the\currentgrouplevel\endcsname\expandafter{\expandafter\the\csname\??parwrapbefore#3\endcsname}%
- #2\csname\??eparwrap\the\currentgrouplevel\endcsname\expandafter{\expandafter\the\csname\??parwrapafter #3\endcsname}}
+ {\expandafter\newtoks\csname\??parwrapbefore#3\endcsname
+ \expandafter\newtoks\csname\??parwrapafter #3\endcsname
+ #1\csname\??bparwrap\the\currentgrouplevel\endcsname
+ {\the\csname\??parwrapbefore#3\endcsname}%
+ #2\csname\??eparwrap\the\currentgrouplevel\endcsname
+ {\the\csname\??parwrapafter #3\endcsname}}
\def\spac_register_par_wrapper_yes#1#2#3#4#5%
{\ifcsname\??bparwrap\the\currentgrouplevel\endcsname \else
\spac_paragraph_install
\fi
+ \ifcsname\??parwrapcount#3\endcsname \else
+ \spac_paragraph_install_count{#3}%
+ \fi
\ifcsname\??parwrapbefore#3\endcsname \else
\spac_paragraph_install_pair#1#2{#3}%
\fi
- #1\csname\??parwrapbefore#3\endcsname{\clf_setparwrapper{#3}#4}%
+ #1\csname\??parwrapbefore#3\endcsname{\advance\csname\??parwrapcount#3\endcsname\plusone\relax
+ \clf_setparwrapper{#3}#4}%
#2\csname\??parwrapafter #3\endcsname{#5}%
\clf_newparwrapper{#3}%
\let\spac_paragraph_wrap\spac_paragraph_update}
\def\spac_register_par_wrapper_nop#1#2#3#4#5%
- {#4\wrapuppar{#5}}
+ {\ifcsname\??parwrapcount#3\endcsname \else
+ \spac_paragraph_install_count{#3}%
+ \fi
+ \csname\??parwrapcount #3\endcsname\plusone
+ #4\wrapuppar{#5}}
\protected\def\spac_register_par_wrapper
{\ifhmode
@@ -164,12 +178,35 @@
\csname\??eparwrap\the\currentgrouplevel\endcsname\emptytoks}
\protected\def\unregisterparwrapper#1%
- {\csname\??parwrapbefore#1\endcsname\emptytoks
+ {\csname\??parwrapcount #1\endcsname\zerocount
+ \csname\??parwrapbefore#1\endcsname\emptytoks
\csname\??parwrapafter #1\endcsname\emptytoks}
\def\directparwrapper#1#2%
{#1\wrapuppar{#2}}
+% \protected\def\doifelseparwrapper#1%
+% {\ifcsname\??parwrapbefore#1\endcsname
+% \unless\iftok\lastnamedcs\emptytoks
+% \doubleexpandafter\firstoftwoarguments
+% \orelse\iftok\csname\??parwrapafter#1\endcsname\emptytoks
+% \doubleexpandafter\secondoftwoarguments
+% \else
+% \doubleexpandafter\firstoftwoarguments
+% \fi
+% \else
+% \expandafter\secondoftwoarguments
+% \fi}
+
+\protected\def\doifelseparwrapper#1%
+ {\unless\ifcsname\??parwrapcount#1\endcsname
+ \expandafter\secondoftwoarguments
+ \orelse\ifcase\lastnamedcs
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
+
% \getparwrapper % defined in lua
% \lastparwrapper % defined in lua
@@ -393,9 +430,30 @@
\glet\flushpostponednodedata\spac_postponed_data_flush
\dowithnextboxcs\spac_postponed_data_finish\hpack}
+% \def\spac_postponed_data_finish
+% {\global\setbox\b_spac_postponed_data\hpack % to\zeropoint
+% {\box\b_spac_postponed_data\box\nextbox}%
+% \endgroup}
+%
+% This is better when used with protrusion which does not like too deeply nested
+% boxes:
+%
+% \def\spac_postponed_data_finish
+% {\dontcomplain
+% \global\setbox\b_spac_postponed_data\hpack to \zeropoint
+% {\unhbox\b_spac_postponed_data\unhbox\nextbox}%
+% \endgroup}
+%
+% We could do this if there is content with widths ... not that is should be used
+% that way, but this way we don't overflow:
+
\def\spac_postponed_data_finish
- {\global\setbox\b_spac_postponed_data\hpack % to\zeropoint
- {\box\b_spac_postponed_data\box\nextbox}%
+ {\dontcomplain
+ \global\setbox\b_spac_postponed_data\hpack % to \zeropoint
+ {\unhbox\b_spac_postponed_data
+ \scratchdimen\wd\nextbox
+ \unhbox\nextbox
+ \ifcase\scratchdimen\else\kern-\b_spac_postponed_data\fi}%
\endgroup}
\def\spac_postponed_data_flush
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 96dadd675..ec8fb1b27 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index b64e6fb23..d1d552035 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-not.mkvi b/tex/context/base/mkiv/strc-not.mkvi
index 2605967c6..f288b4a72 100644
--- a/tex/context/base/mkiv/strc-not.mkvi
+++ b/tex/context/base/mkiv/strc-not.mkvi
@@ -27,39 +27,36 @@
\unexpanded\def\unvboxed {\ifvmode\unvbox \else\box \fi} % will change or used more often
\unexpanded\def\unvcopied{\ifvmode\unvcopy\else\copy\fi} % will change or used more often
-%D Notes have two handlers: notations and notes. Although notations can
-%D be defined independently it makes not much sense. In principle we can
-%D treat notes as lists but they are currently done as a variant on
-%D enumerations. I will provide a list variant as well. One complication is
-%D that for page related notes inserts are used and therefore notes are
-%D typeset immediately and descriptions are better suited for that. For
-%D instance endnotes can as well be typeset using lists.
+%D Notes have two handlers: notations and notes. Although notations can be defined
+%D independently it makes not much sense. In principle we can treat notes as lists
+%D but they are currently done as a variant on enumerations. I will provide a list
+%D variant as well. One complication is that for page related notes inserts are used
+%D and therefore notes are typeset immediately and descriptions are better suited
+%D for that. For instance endnotes can as well be typeset using lists.
% textcommand/textstyle/textcolor : set by note commandhandler and used for inline number
%D \macros
%D {setupnote,setupnotation}
%D
-%D We can influence footnote typesetting with the setup
-%D command:
+%D We can influence footnote typesetting with the setup command:
%D
%D \showsetup{setupnotation}
%D \showsetup{setupnote}
%D
-%D The definition command indicate that we can frame the footnote
-%D area. The footnotes themselves are treated as descriptions.
+%D The definition command indicate that we can frame the footnote area. The
+%D footnotes themselves are treated as descriptions.
%D
%D \showsetup{definenote}
%D
-%D It's sort of a custom to precede footnotes by a horizontal
-%D rule and although fancy rules like
+%D It's sort of a custom to precede footnotes by a horizontal rule and although
+%D fancy rules like
%D
%D \starttyping
%D \hbox to 10em{\hskip-3em\dotfill}
%D \stoptyping
%D
-%D Are quite ligitimate, we default to a simple one 20\% of the
-%D text width.
+%D Are quite ligitimate, we default to a simple one 20\% of the text width.
% \c!headstyle=\noteparameter\c!style,
% \c!headcolor=\noteparameter\c!color,
@@ -211,11 +208,10 @@
\fi
\fi}
-%D Notations (we simply needed a word that relates to notes and is
-%D and sounds like description and enumeration) are a special case
-%D in the sense that they are stored, rendered elsewhere and referered
-%D to from where they are specified. For that reason they have a different
-%D set op main commands.
+%D Notations (we simply needed a word that relates to notes and is and sounds like
+%D description and enumeration) are a special case in the sense that they are
+%D stored, rendered elsewhere and referered to from where they are specified. For
+%D that reason they have a different set op main commands.
% \notation[ref]{title}
% \notation[reference=,title=]
@@ -305,10 +301,10 @@
\unexpanded\def\strc_notations_stop
{}
-%D A complication is that we need to set up rather specific properties
-%D of e.g. footnotes. It is for this reason that we introduce an extra
-%D level of indirectness. This way notations don't bark on undefined
-%D macros when used in combination.
+%D A complication is that we need to set up rather specific properties of e.g.
+%D footnotes. It is for this reason that we introduce an extra level of
+%D indirectness. This way notations don't bark on undefined macros when used in
+%D combination.
\unexpanded\setvalue{\??constructionnotehandler\v!notation}%
{\csname\??constructionnotehandler\currentconstructionhandler:\constructionparameter\c!type\endcsname}
@@ -338,8 +334,7 @@
\let\setupnotes\setupnote
-% These only concern the inline symbol/number and wrapping of the
-% whole list.
+% These only concern the inline symbol/number and wrapping of the whole list.
\setupnotes % not all make sense here
[\c!location=\v!page,
@@ -486,20 +481,19 @@
\kern\notesignal\relax % \relax is needed to honor spaces
\fi}
-%D Interaction in notes is somewhat complex due to the way notes get
-%D flushed. In principle it is more or less the same as lists but where
-%D in lists we pack whole entries, in notes this doesn't happen. Okay,
-%D in retrospect we could have made descriptions lists but that will be
-%D a backward compatibility mess. At some point a completely new mechanism
-%D might show up, but not now. Also, as notes are inserts there is some
-%D extra mess to be kept in mind and it's easier to maintain two mechanisms
-%D than to combine too much.
+%D Interaction in notes is somewhat complex due to the way notes get flushed. In
+%D principle it is more or less the same as lists but where in lists we pack whole
+%D entries, in notes this doesn't happen. Okay, in retrospect we could have made
+%D descriptions lists but that will be a backward compatibility mess. At some point
+%D a completely new mechanism might show up, but not now. Also, as notes are inserts
+%D there is some extra mess to be kept in mind and it's easier to maintain two
+%D mechanisms than to combine too much.
%D
-%D Interaction is also complicated because we want to provide several variants.
-%D For simple reference there is no need for anything special, as page references
-%D will do and we store them in the list anyway. But if we want a destination with
-%D dimensions we will use an additional destination because we can have only
-%D one with the same name and we always have the number as one.
+%D Interaction is also complicated because we want to provide several variants. For
+%D simple reference there is no need for anything special, as page references will
+%D do and we store them in the list anyway. But if we want a destination with
+%D dimensions we will use an additional destination because we can have only one
+%D with the same name and we always have the number as one.
% interaction:
%
@@ -579,25 +573,6 @@
\let\strc_notes_set_destination_attribute_text\donothing
\let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_nop}
-% \def\strc_references_prepare_display_references_yes_number
-% {\let\strc_notes_set_reference_attribute_text\donothing
-% \strc_references_get_simple_reference{symb:\currentnote:\currentnotenumber}% reference
-% \edef\strc_notes_set_reference_attribute_number{\c_attr_reference\currentreferenceattribute}%
-% \let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_yes}
-
-% \def\strc_references_prepare_display_references_yes_text
-% {\strc_references_get_simple_reference{symb:\currentnote:\currentnotenumber}% reference
-% \edef\strc_notes_set_reference_attribute_text{\c_attr_reference\currentreferenceattribute}%
-% \let\strc_notes_set_reference_attribute_number\donothing
-% \let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_yes}
-
-% \def\strc_references_prepare_display_references_yes_all
-% {\strc_references_get_simple_reference{symb:\currentnote:\currentnotenumber}% reference
-% \edef\strc_notes_set_reference_attribute_text{\c_attr_reference\currentreferenceattribute}%
-% \strc_references_get_simple_reference{symb:\currentnote:\currentnotenumber}% reference
-% \edef\strc_notes_set_reference_attribute_number{\c_attr_reference\currentreferenceattribute}%
-% \let\strc_notes_set_style_color_display\strc_notes_set_style_color_display_yes}
-
\def\strc_references_prepare_display_references_yes_number
{\edef\currentnoteinternal{\clf_noteinternal{\currentnote}\currentnotenumber}%
\ifcase\currentnoteinternal\relax
@@ -802,26 +777,23 @@
%D Footnotes are can be characterized by three components:
%D
%D \startitemize[packed]
-%D \item a small number \footnote {a footnote number} or
-%D symbol {\setupfootnotes [conversion=set 2]\footnote
-%D {a footnote}}
+%D \item a small number \footnote {a footnote number} or symbol {\setupfootnotes
+%D [conversion=set 2]\footnote {a footnote}}
%D \item and a similar mark at the bottom of the page
%D \item followed by some additional text
%D \stopitemize
%D
-%D Because footnotes are declared at the location of their
-%D reference they can be seen as a special kind of
-%D floating bodies. Their placement is postponed but has to be
-%D taken into account in the pagebreak calculations. This kind
-%D of calculations are forced by using \type{\insert}s and dealing
-%D with all cases is not trivial.
+%D Because footnotes are declared at the location of their reference they can be
+%D seen as a special kind of floating bodies. Their placement is postponed but has
+%D to be taken into account in the pagebreak calculations. This kind of calculations
+%D are forced by using \type{\insert}s and dealing with all cases is not trivial.
%D \macros
%D {notesenabled}
%D
-%D We need a couple of states because at some moments we don't want
-%D to mess around with inserts at all. Take for instance a table
-%D of contents. And so we can temporary disable footnotes by saying
+%D We need a couple of states because at some moments we don't want to mess around
+%D with inserts at all. Take for instance a table of contents. And so we can
+%D temporary disable footnotes by saying
%D
%D \starttyping
%D \notesenabledfalse
@@ -837,8 +809,8 @@
\appendtoks \notesenabledfalse \to \everysimplifycommands % quick hack
\appendtoks \notesenabledfalse \to \everypreroll % quick hack
-%D Often we need to process the whole set of notes and to make that
-%D fast, we use a token register:
+%D Often we need to process the whole set of notes and to make that fast, we use a
+%D token register:
% we have several synchronizers:
%
@@ -952,14 +924,6 @@
\setupnotes
[\c!width=\v!auto]
-% \def\strc_notes_set_width
-% {\edef\p_width{\noteparameter\c!width}%
-% \ifx\p_width\v!auto
-% \setnoteparameter\c!width{\ifdim\hsize<\makeupwidth\hsize\else\makeupwidth\fi}%
-% \else\ifx\p_width\empty
-% \setnoteparameter\c!width{\hsize}%
-% \fi\fi}
-
\def\strc_notes_set_width
{\ifinsidemulticolumns
\setnoteparameter\c!width{\makeupwidth}%
@@ -1216,12 +1180,9 @@
% \dorecurse{10}{test \mynote{one one one one one one} \input zapf \mynote{one one one one one one} }
% \stoptext
-%D The noterule can be a graphic and therefore calling this
-%D setup macro at every skipswitch is tricky (many many MP
-%D runs). Let's just reserve a few points, that probably match
-%D those of the stretch component.
-
-%D A bit messy:
+%D The noterule can be a graphic and therefore calling this setup macro at every
+%D skipswitch is tricky (many many MP runs). Let's just reserve a few points, that
+%D probably match those of the stretch component. A bit messy:
\unexpanded\def\placenoterule
{\begingroup
@@ -1247,8 +1208,8 @@
\fi
-%D The formatting depends on the width of the table, so we
-%D have to set \type {n} to zero.
+%D The formatting depends on the width of the table, so we have to set \type {n} to
+%D zero.
%D
%D \starttyping
%D \startbuffer
@@ -1266,21 +1227,19 @@
%D \macros
%D {footnote}
%D
-%D A footnote can have a reference as optional argument and
-%D therefore its formal specification looks like:
+%D A footnote can have a reference as optional argument and therefore its formal
+%D specification looks like:
%D
%D \showsetup{footnote}
%D
-%D This command has one optional command: the reference. By
-%D saying \type{[-]} the number is omitted. The footnote
-%D command is not that sensitive to spacing, so it's quite
-%D legal to say:
+%D This command has one optional command: the reference. By saying \type{[-]} the
+%D number is omitted. The footnote command is not that sensitive to spacing, so it's
+%D quite legal to say:
%D
%D \startbuffer
-%D Users of \CONTEXT\ must keep both feet \footnote{Given they
-%D have two.} on the ground and not get confused \footnote{Or
-%D even crazy.} by all those obscure \footnote{But fortunately
-%D readable.} parameters.
+%D Users of \CONTEXT\ must keep both feet \footnote {Given they have two.} on the
+%D ground and not get confused \footnote {Or even crazy.} by all those obscure
+%D \footnote {But fortunately readable.} parameters.
%D \stopbuffer
%D
%D \typebuffer
@@ -1295,15 +1254,11 @@
%D \stopnarrower
%D \egroup
%D
-%D Typesetting footnotes is, at least for the moment, disabled
-%D when reshaping boxes.
-%D
-%D The additional macro \type {\footnotetext} and the
-%D associated \type {\note} macro were implemented at
-%D request of users on the mailing list and a suggestion by
-%D taco to split of the symbol placement. I decided to
-%D merge this functionality with the existing \type {\note}
-%D functionality.
+%D Typesetting footnotes is, at least for the moment, disabled when reshaping boxes.
+%D The additional macro \type {\footnotetext} and the associated \type {\note} macro
+%D were implemented at request of users on the mailing list and a suggestion by taco
+%D to split of the symbol placement. I decided to merge this functionality with the
+%D existing \type {\note} functionality.
\newconditional\c_strc_notes_symbol \settrue\c_strc_notes_symbol % not used
\newconditional\c_strc_notes_skip
@@ -1445,10 +1400,9 @@
% not: \appendtoks \setnotehsize \to \everyinsidenoteinsert (spoils columns)
-%D Normally footnotes are saved as inserts that are called upon
-%D as soon as the pagebody is constructed. The footnote
-%D insertion routine looks just like the \PLAIN\ \TEX\ one,
-%D except that we check for the end note state.
+%D Normally footnotes are saved as inserts that are called upon as soon as the
+%D pagebody is constructed. The footnote insertion routine looks just like the
+%D \PLAIN\ \TEX\ one, except that we check for the end note state.
% testcase for split bottom alignment see (a) below
%
@@ -1551,10 +1505,9 @@
{\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteinsertionnumber}%
\endgroup}
-%D Supporting end notes is surprisingly easy. Even better, we
-%D can combine this feature with solving the common \TEX\
-%D problem of disappearing inserts when they're called for in
-%D deeply nested boxes. The general case looks like:
+%D Supporting end notes is surprisingly easy. Even better, we can combine this
+%D feature with solving the common \TEX\ problem of disappearing inserts when
+%D they're called for in deeply nested boxes. The general case looks like:
%D
%D \starttyping
%D \postponenotes
@@ -1562,9 +1515,8 @@
%D \flushnotes
%D \stoptyping
%D
-%D This alternative can be used in headings, captions, tables
-%D etc. The latter one sometimes calls for notes local to
-%D the table, which can be realized by saying
+%D This alternative can be used in headings, captions, tables etc. The latter one
+%D sometimes calls for notes local to the table, which can be realized by saying
%D
%D \starttyping
%D \setlocalfootnotes
@@ -1572,12 +1524,10 @@
%D \placelocalfootnotes
%D \stoptyping
%D
-%D Postponing is accomplished by simply redefining the (local)
-%D insert operation. A not too robust method uses the
-%D \type{\insert} primitive when possible. This method fails in
-%D situations where it's not entirely clear in what mode \TEX\
-%D is. Therefore the auto method can is to be overruled when
-%D needed.
+%D Postponing is accomplished by simply redefining the (local) insert operation. A
+%D not too robust method uses the \type{\insert} primitive when possible. This
+%D method fails in situations where it's not entirely clear in what mode \TEX\ is.
+%D Therefore the auto method can is to be overruled when needed.
\newconditional\postponingnotes
@@ -1627,8 +1577,8 @@
%D \macros
%D {startlocalfootnotes,placelocalfootnotes}
%D
-%D The next two macros can be used in for instance tables, as
-%D we'll demonstrate later on.
+%D The next two macros can be used in for instance tables, as we'll demonstrate
+%D later on.
%D
%D \showsetup{startlocalfootnotes}
%D \showsetup{placelocalfootnotes}
@@ -1710,19 +1660,17 @@
%D
%D \typebuffer
%D
-%D Because this table placement macro expect box content, and
-%D thanks to the grouping of the local footnotes, we don't need
-%D additional braces.
+%D Because this table placement macro expect box content, and thanks to the grouping
+%D of the local footnotes, we don't need additional braces.
%D
%D \getbuffer
%D \macros
%D {placefootnotes}
%D
-%D We still have no decent command for placing footnotes
-%D somewhere else than at the bottom of the page (for which no
-%D user action is needed). Footnotes (endnotes) can be
-%D placed by using
+%D We still have no decent command for placing footnotes somewhere else than at the
+%D bottom of the page (for which no user action is needed). Footnotes (endnotes) can
+%D be placed by using
%D
%D \showsetup{placefootnotes}
@@ -1898,22 +1846,20 @@
\def\calculatetotalclevernoteheight{\totalnoteheight\zeropoint\strc_notes_process\docalculatetotalclevernoteheight}
\def\calculatetotalpagenoteheight {\totalnoteheight\zeropoint\strc_notes_process\docalculatetotalpagenoteheight}
-%D Now how can this mechanism be hooked into \CONTEXT\ without
-%D explictly postponing footnotes? The solution turned out to
-%D be rather simple:
+%D Now how can this mechanism be hooked into \CONTEXT\ without explictly postponing
+%D footnotes? The solution turned out to be rather simple:
%D
%D \starttyping
%D \everypar {...\flushnotes...}
%D \neverypar {...\postponenotes}
%D \stoptyping
%D
-%D We can use \type{\neverypar} because in most commands
-%D sensitive to footnote gobbling we disable \type{\everypar}
-%D in favor for \type{\neverypar}. In fact, this footnote
-%D implementation is the first to use this scheme.
+%D We can use \type {\neverypar} because in most commands sensitive to footnote
+%D gobbling we disable \type {\everypar} in favor for \type {\neverypar}. In fact,
+%D this footnote implementation is the first to use this scheme.
-%D This is a nasty and new secondary footnote flusher. It
-%D can be hooked into \type {\everypar} like:
+%D This is a nasty and new secondary footnote flusher. It can be hooked into \type
+%D {\everypar} like:
%D
%D \starttyping
%D \appendtoks \synchronizenotes \to \everypar
@@ -1927,10 +1873,9 @@
\let\synchronizenotes\relax
-%D When typesetting footnotes, we have to return to the
-%D footnote specific bodyfont size, which is in most cases derived
-%D from the global document bodyfont size. In the previous macros
-%D we already used a footnote specific font setting macro.
+%D When typesetting footnotes, we have to return to the footnote specific bodyfont
+%D size, which is in most cases derived from the global document bodyfont size. In
+%D the previous macros we already used a footnote specific font setting macro.
\def\strc_notes_set_bodyfont
{\let\strc_notes_set_bodyfont\relax
@@ -1938,9 +1883,23 @@
\usebodyfontparameter\noteparameter
\usealignparameter\noteparameter}
-%D The footnote mechanism defaults to a traditional one
-%D column way of showing them. By default we precede them by
-%D a small line.
+%D The footnote mechanism defaults to a traditional one column way of showing them.
+%D By default we precede them by a small line.
+
+% end notes in the margin:
+%
+% \setuptexttexts
+% [margin]
+% [] [{\directsetup{notabene}}]
+%
+% \startsetups notabene
+% \vbox to \textheight \bgroup
+% \setupalign[tolerant]
+% \topskipcorrection
+% \placenotes[endnote][before=,after=]
+% \vfilll
+% \egroup
+% \stopsetups
\definenote [\v!footnote]
\definenote [\v!endnote ] [\c!location=\v!none] % else no break
@@ -1986,8 +1945,7 @@
%D \macros
%D {note}
%D
-%D Refering to a note is accomplished by the rather short
-%D command:
+%D Refering to a note is accomplished by the rather short command:
%D
%D \showsetup{note}
%D
diff --git a/tex/context/base/mkiv/supp-box.lua b/tex/context/base/mkiv/supp-box.lua
index 2dcbbb692..6517e70f5 100644
--- a/tex/context/base/mkiv/supp-box.lua
+++ b/tex/context/base/mkiv/supp-box.lua
@@ -906,3 +906,18 @@ implement {
context(c)
end,
}
+
+do
+
+ local takebox = tex.takebox
+
+ interfaces.implement {
+ name = "thebox",
+ public = true,
+ arguments = "integer",
+ actions = function(n)
+ context(takebox(n))
+ end
+ }
+
+end
diff --git a/tex/context/base/mkiv/supp-box.mkxl b/tex/context/base/mkiv/supp-box.mkxl
index 273a20ef1..35d8da1b6 100644
--- a/tex/context/base/mkiv/supp-box.mkxl
+++ b/tex/context/base/mkiv/supp-box.mkxl
@@ -17,18 +17,14 @@
\registerctxluafile{supp-box}{optimize}
-% This file is partially cleaned up.
-
-%D First some defaults:
-
-\fixupboxesmode\plusone
-
%D And some dimensions:
\newdimen\givenwidth
\newdimen\givenheight
\newdimen\givendepth
+% \fixupboxesmode\plusone % gone: is now the default
+
%D \macros
%D {dontcomplain}
%D
diff --git a/tex/context/base/mkiv/syst-ini.mkxl b/tex/context/base/mkiv/syst-ini.mkxl
index 232048036..048a0bb55 100644
--- a/tex/context/base/mkiv/syst-ini.mkxl
+++ b/tex/context/base/mkiv/syst-ini.mkxl
@@ -617,28 +617,6 @@
\let\active\activecatcode
-%D Constants to be used with \type {\currentgrouptype}.
-
-\chardef\bottomlevelgroupcode = 0
-\chardef\simplegroupcode = 1
-\chardef\hboxgroupcode = 2
-\chardef\adjustedhboxgroupcode = 3
-\chardef\vboxgroupcode = 4
-\chardef\vtopgroupcode = 5
-\chardef\aligngroupcode = 6
-\chardef\noaligngroupcode = 7
-\chardef\outputgroupcode = 8
-\chardef\mathgroupcode = 9
-\chardef\discretionarygroupcode = 10
-\chardef\insertgroupcode = 11
-\chardef\vcentergroupcode = 12
-\chardef\mathabovegroupcode = 13
-\chardef\mathchoicegroupcode = 14
-\chardef\semisimplegroupcode = 15
-\chardef\mathshiftgroupcode = 16
-\chardef\mathleftgroupcode = 17
-\chardef\vadjustgroupcode = \insertgroupcode
-
%D Constants to be used with \type {\interactionmode}.
\chardef\batchmodecode \zerocount
@@ -646,45 +624,6 @@
\chardef\scrollmodecode \plustwo
\chardef\errorstopmodecode \plusthree
-%D Constants to be used with \type {\lastnodetype}. The \type {\lastnodetype}
-%D primitive is \ETEX\ compliant. The valid range is still -1 .. 15 and glyph nodes
-%D have number 0 (used to be char node) and ligature nodes are mapped to 7. That way
-%D macro packages can use the same symbolic names as in traditional \ETEX. Keep in
-%D mind that the internal node numbers are different and that there are more node
-%D types that 15. The mode parameter forces \LUAMETATEX\ to use the real node
-%D numbers.
-
-\internalcodesmode\plusone
-
-%D Constants to be used with \type {\currentiftype}. I wonder if we will ever
-%D use these in \CONTEXT. We have a few more anyway and in \LUAMETATEX\ we
-%D have different numbers. So for now let's just not define them. The
-%D previously mentioned mode parameters enables the real numbers (we have
-%D some more and they are therefore ordered differently).
-
-% \chardef\charifcode = 1
-% \chardef\catifcode = 2
-% \chardef\numifcode = 3
-% \chardef\dimifcode = 4
-% \chardef\oddifcode = 5
-% \chardef\vmodeifcode = 6
-% \chardef\hmodeifcode = 7
-% \chardef\mmodeifcode = 8
-% \chardef\innerifcode = 9
-% \chardef\voidifcode = 10
-% \chardef\hboxifcode = 11
-% \chardef\vboxifcode = 12
-% \chardef\xifcode = 13
-% \chardef\eofifcode = 14
-% \chardef\trueifcode = 15
-% \chardef\falseifcode = 16
-% \chardef\caseifcode = 17
-% \chardef\definedifcode = 18
-% \chardef\csnameifcode = 19
-% \chardef\fontcharifcode = 20
-%
-% % there are some more in luametatex
-
%D Of course we want even bigger log files, so we copied this from the \ETEX\
%D source files.
%D
diff --git a/tex/context/base/mkiv/syst-lua.lmt b/tex/context/base/mkiv/syst-lua.lmt
index 018231e30..68f0d1b75 100644
--- a/tex/context/base/mkiv/syst-lua.lmt
+++ b/tex/context/base/mkiv/syst-lua.lmt
@@ -313,3 +313,102 @@ do
}
end
+
+do
+
+ -- This is some 20% slower than native but we only provide this for compatibility
+ -- reasons so we don't care that much about it. Eventually we can drop the
+ -- built-in method.
+
+ local channels = { }
+
+ local findbinfile = resolvers.findbinfile
+ local loadbinfile = resolvers.loadbinfile
+ local opentexfile = resolvers.opentexfile
+
+ local scaninteger = tokens.scanners.integer
+ local scankeyword = tokens.scanners.keyword
+ local scanstring = tokens.scanners.string
+ local scancsname = tokens.scanners.csname
+
+ local setmacro = tokens.setters.macro
+ local vrbcatcodes = tex.vrbcatcodes
+
+ interfaces.implement {
+ name = "openin",
+ public = true,
+ protected = true,
+ actions = function()
+ local n = scaninteger()
+ scankeyword("=")
+ local s = scanstring(true)
+ local c = channels[n]
+ if c then
+ c:close()
+ end
+ local f = findbinfile(s,"tex")
+ if f then
+ channels[n] = opentexfile(f)
+ else
+ channels[n] = false
+ end
+ end,
+ }
+
+ interfaces.implement {
+ name = "closein",
+ public = true,
+ protected = true,
+ value = "none",
+ actions = function()
+ local n = scaninteger()
+ local c = channels[n]
+ if c then
+ c:close()
+ end
+ channels[n] = false
+ end,
+ }
+
+ interfaces.implement {
+ name = "read",
+ public = true,
+ protected = true,
+ value = "none",
+ actions = function(prefix)
+ local n = scaninteger()
+ scankeyword("to")
+ local m = scancsname(true)
+ local c = channels[n]
+ local s = c and c:reader()
+ if not s then
+ channels[n] = false
+ s = "\\par" -- or just "", no need to fake tex here
+ end
+ setmacro(m, s, prefix) -- checks for frozen
+ end,
+ }
+
+ interfaces.implement {
+ name = "readline",
+ public = true,
+ protected = true,
+ actions = function(prefix)
+ local n = scaninteger()
+ scankeyword("to")
+ local m = scancsname(true)
+ local c = channels[n]
+ local s = c and c:reader()
+ if not s then
+ channels[n] = false
+ s = ""
+ end
+ setmacro(vrbcatcodes, m, s, prefix) -- checks for frozen
+ end,
+ }
+
+ callback.register("end_of_file", function(n)
+ return not channels[n]
+ end)
+
+end
diff --git a/tex/context/base/mkiv/toks-aux.mkiv b/tex/context/base/mkiv/toks-aux.mkiv
index f66b51ec5..817a5aba9 100644
--- a/tex/context/base/mkiv/toks-aux.mkiv
+++ b/tex/context/base/mkiv/toks-aux.mkiv
@@ -65,4 +65,8 @@
\lastnamedcs\emptytoks
\fi}
+\ifcase\contextlmtxmode \or
+ \chardef\discretionarygroupcode = \discgroupcode
+\fi
+
\protect
diff --git a/tex/context/base/mkiv/toks-ini.lua b/tex/context/base/mkiv/toks-ini.lua
index 562e2801a..350fe6947 100644
--- a/tex/context/base/mkiv/toks-ini.lua
+++ b/tex/context/base/mkiv/toks-ini.lua
@@ -50,7 +50,7 @@ local scan_code = token.scan_code
local scan_token_code = token.scan_token_code
local scan_dimen = token.scan_dimen
local scan_glue = token.scan_glue
-local scan_gluespec = token.scan_skip
+local scan_skip = token.scan_skip
local scan_keyword = token.scan_keyword
local scan_keyword_cs = token.scan_keyword_cs or scan_keyword
local scan_token = token.scan_token
@@ -174,7 +174,8 @@ tokens.scanners = { -- these expand
dimen = scan_dimen,
dimension = scan_dimen,
glue = scan_glue,
- gluespec = scan_gluespec,
+ gluevalues = function() return scan_glue(false,false,true) end,
+ gluespec = scan_skip,
integer = scan_int,
real = scan_real,
float = scan_float,
diff --git a/tex/context/base/mkiv/toks-scn.lua b/tex/context/base/mkiv/toks-scn.lua
index 7ef4ce603..4377bece1 100644
--- a/tex/context/base/mkiv/toks-scn.lua
+++ b/tex/context/base/mkiv/toks-scn.lua
@@ -36,6 +36,9 @@ local scankey = scanners.key
local scancode = scanners.code
local scanboolean = scanners.boolean
local scandimen = scanners.dimen
+local scanglue = scanners.glue
+local scangluevalues = scanners.gluevalues
+local scangluespec = scanners.gluespec
local scancsname = scanners.csname
local todimen = number.todimen
@@ -225,6 +228,9 @@ local shortcuts = {
-- scankey = scankey,
scancode = scancode,
scanboolean = scanboolean,
+ scanglue = scanglue, -- list
+ scangluespec = scangluespec,
+ scangluevalues = scangluevalues,
scandimen = scandimen,
scandimension = scandimen,
scanbox = scanners.box,
diff --git a/tex/context/base/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua
index 64038dc38..febb32f75 100644
--- a/tex/context/base/mkiv/trac-vis.lua
+++ b/tex/context/base/mkiv/trac-vis.lua
@@ -877,6 +877,7 @@ local ruledglue do
local spaceskip_code = gluecodes.spaceskip
local xspaceskip_code = gluecodes.xspaceskip
local zerospaceskip_code = gluecodes.zerospaceskip or gluecodes.userskip
+ -- local keepskip_code = gluecodes.keepskip or gluecodes.userskip
local leftskip_code = gluecodes.leftskip
local rightskip_code = gluecodes.rightskip
local parfillskip_code = gluecodes.parfillskip
@@ -906,6 +907,7 @@ local ruledglue do
[gluecodes.medmuskip] = "MM",
[gluecodes.thickmuskip] = "ML",
[gluecodes.intermathskip] = "IM",
+ [gluecodes.keepskip or 99] = "KS",
[gluecodes.mathskip] = "MT",
[leadercodes.leaders] = "NL",
[leadercodes.cleaders] = "CL",